Skip to content

Build your personal knowledge base with Trilium Notes

server-ts: Port services/meta/*

Elian Doran45582ebaac7d
diff --git a/src/services/export/zip.js b/src/services/export/zip.js
index 8fd8fd896a..e0204891da 100644
--- a/src/services/export/zip.js
+++ b/src/services/export/zip.js
@@ -16,9 +16,9 @@ const archiver = require('archiver');
const log = require('../log');
const TaskContext = require('../task_context');
const ValidationError = require('../../errors/validation_error');
-const NoteMeta = require('../meta/note_meta.js');
-const AttachmentMeta = require('../meta/attachment_meta.js');
-const AttributeMeta = require('../meta/attribute_meta.js');
+const NoteMeta = require('../meta/note_meta');
+const AttachmentMeta = require('../meta/attachment_meta');
+const AttributeMeta = require('../meta/attribute_meta');
/**
* @param {TaskContext} taskContext
diff --git a/src/services/meta/attachment_meta.js b/src/services/meta/attachment_meta.js
deleted file mode 100644
index 067a4a3363..0000000000
--- a/src/services/meta/attachment_meta.js
+++ /dev/null
@@ -1,16 +0,0 @@
-class AttachmentMeta {
- /** @type {string} */
- attachmentId;
- /** @type {string} */
- title;
- /** @type {string} */
- role;
- /** @type {string} */
- mime;
- /** @type {int} */
- position;
- /** @type {string} */
- dataFileName;
-}
-
-module.exports = AttachmentMeta;
diff --git a/src/services/meta/attachment_meta.ts b/src/services/meta/attachment_meta.ts
new file mode 100644
index 0000000000..b848305919
--- /dev/null
+++ b/src/services/meta/attachment_meta.ts
@@ -0,0 +1,10 @@
+interface AttachmentMeta {
+ attachmentId: string;
+ title: string;
+ role: string;
+ mime: string;
+ position: number;
+ dataFileName: string;
+}
+
+export = AttachmentMeta;
diff --git a/src/services/meta/attribute_meta.js b/src/services/meta/attribute_meta.js
deleted file mode 100644
index 3d50cb5855..0000000000
--- a/src/services/meta/attribute_meta.js
+++ /dev/null
@@ -1,14 +0,0 @@
-class AttributeMeta {
- /** @type {string} */
- type;
- /** @type {string} */
- name;
- /** @type {string} */
- value;
- /** @type {boolean} */
- isInheritable;
- /** @type {int} */
- position;
-}
-
-module.exports = AttributeMeta;
diff --git a/src/services/meta/attribute_meta.ts b/src/services/meta/attribute_meta.ts
new file mode 100644
index 0000000000..319295944f
--- /dev/null
+++ b/src/services/meta/attribute_meta.ts
@@ -0,0 +1,9 @@
+interface AttributeMeta {
+ type: string;
+ name: string;
+ value: string;
+ isInheritable: boolean;
+ position: number;
+}
+
+export = AttributeMeta;
diff --git a/src/services/meta/note_meta.js b/src/services/meta/note_meta.js
deleted file mode 100644
index fd24381d65..0000000000
--- a/src/services/meta/note_meta.js
+++ /dev/null
@@ -1,36 +0,0 @@
-class NoteMeta {
- /** @type {string} */
- noteId;
- /** @type {string} */
- notePath;
- /** @type {boolean} */
- isClone;
- /** @type {string} */
- title;
- /** @type {int} */
- notePosition;
- /** @type {string} */
- prefix;
- /** @type {boolean} */
- isExpanded;
- /** @type {string} */
- type;
- /** @type {string} */
- mime;
- /** @type {string} - 'html' or 'markdown', applicable to text notes only */
- format;
- /** @type {string} */
- dataFileName;
- /** @type {string} */
- dirFileName;
- /** @type {boolean} - this file should not be imported (e.g., HTML navigation) */
- noImport = false;
- /** @type {AttributeMeta[]} */
- attributes;
- /** @type {AttachmentMeta[]} */
- attachments;
- /** @type {NoteMeta[]|undefined} */
- children;
-}
-
-module.exports = NoteMeta;
diff --git a/src/services/meta/note_meta.ts b/src/services/meta/note_meta.ts
new file mode 100644
index 0000000000..3492c9c630
--- /dev/null
+++ b/src/services/meta/note_meta.ts
@@ -0,0 +1,24 @@
+import AttributeMeta = require("./attribute_meta");
+
+interface NoteMeta {
+ noteId: string;
+ notePath: string;
+ isClone: boolean;
+ title: string;
+ notePosition: number;
+ prefix: string;
+ isExpanded: boolean;
+ type: string;
+ mime: string;
+ /** 'html' or 'markdown', applicable to text notes only */
+ format: "html" | "markdown";
+ dataFileName: string;
+ dirFileName: string;
+ /** this file should not be imported (e.g., HTML navigation) */
+ noImport: boolean;
+ attributes: AttributeMeta[];
+ attachments: AttributeMeta[];
+ children?: NoteMeta[];
+}
+
+export = NoteMeta;