@notatki/sync 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Aliaksandr Radzivanovich
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ export * from "./report.js";
2
+ export * from "./sync.js";
3
+ export * from "./sync-options.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./report.js";
2
+ export * from "./sync.js";
3
+ export * from "./sync-options.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type Model, type Note } from "@notatki/core";
2
+ export declare class Reporter {
3
+ start(): void;
4
+ syncModel(model: Model): void;
5
+ syncNote(note: Note): void;
6
+ end(): void;
7
+ }
8
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AAEtD,qBAAa,QAAQ;IACnB,KAAK,IAAI,IAAI;IAEb,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAE7B,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAE1B,GAAG,IAAI,IAAI;CACZ"}
package/dist/report.js ADDED
@@ -0,0 +1,8 @@
1
+ import {} from "@notatki/core";
2
+ export class Reporter {
3
+ start() { }
4
+ syncModel(model) { }
5
+ syncNote(note) { }
6
+ end() { }
7
+ }
8
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,MAAM,eAAe,CAAC;AAEtD,MAAM,OAAO,QAAQ;IACnB,KAAK,KAAU,CAAC;IAEhB,SAAS,CAAC,KAAY,IAAS,CAAC;IAEhC,QAAQ,CAAC,IAAU,IAAS,CAAC;IAE7B,GAAG,KAAU,CAAC;CACf"}
@@ -0,0 +1,8 @@
1
+ import { Reporter } from "./report.js";
2
+ export type SyncOptions = {
3
+ reporter: Reporter;
4
+ deleteNotes: boolean;
5
+ signal: AbortSignal;
6
+ };
7
+ export declare function expandSyncOptions(options: Partial<Readonly<SyncOptions>>): SyncOptions;
8
+ //# sourceMappingURL=sync-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-options.d.ts","sourceRoot":"","sources":["../src/sync-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,WAAW,CAWtF"}
@@ -0,0 +1,11 @@
1
+ import { Reporter } from "./report.js";
2
+ export function expandSyncOptions(options) {
3
+ const { reporter = new Reporter(), //
4
+ deleteNotes = false, signal = new AbortController().signal, } = options;
5
+ return {
6
+ reporter, //
7
+ deleteNotes,
8
+ signal,
9
+ };
10
+ }
11
+ //# sourceMappingURL=sync-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-options.js","sourceRoot":"","sources":["../src/sync-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQvC,MAAM,UAAU,iBAAiB,CAAC,OAAuC;IACvE,MAAM,EACJ,QAAQ,GAAG,IAAI,QAAQ,EAAE,EAAE,EAAE;IAC7B,WAAW,GAAG,KAAK,EACnB,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC,MAAM,GACtC,GAAG,OAAO,CAAC;IACZ,OAAO;QACL,QAAQ,EAAE,EAAE;QACZ,WAAW;QACX,MAAM;KACP,CAAC;AACJ,CAAC"}
package/dist/sync.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { type NoteList } from "@notatki/core";
2
+ import { type SyncOptions } from "./sync-options.js";
3
+ export declare function synchronizeNotes(notes: NoteList, options?: Partial<Readonly<SyncOptions>>): Promise<void>;
4
+ //# sourceMappingURL=sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAExE,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,GAAE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnH"}
package/dist/sync.js ADDED
@@ -0,0 +1,13 @@
1
+ import {} from "@notatki/core";
2
+ import { expandSyncOptions } from "./sync-options.js";
3
+ export async function synchronizeNotes(notes, options = {}) {
4
+ await new Synchronizer().sync(notes, expandSyncOptions(options));
5
+ }
6
+ class Synchronizer {
7
+ async sync(notes, options) {
8
+ const { reporter } = options;
9
+ reporter.start();
10
+ reporter.end();
11
+ }
12
+ }
13
+ //# sourceMappingURL=sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.js","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAoB,MAAM,mBAAmB,CAAC;AAExE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAAe,EAAE,UAA0C,EAAE;IAClG,MAAM,IAAI,YAAY,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,YAAY;IAChB,KAAK,CAAC,IAAI,CAAC,KAAe,EAAE,OAAoB;QAC9C,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAE7B,QAAQ,CAAC,KAAK,EAAE,CAAC;QAEjB,QAAQ,CAAC,GAAG,EAAE,CAAC;IACjB,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@notatki/sync",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "dependencies": {
7
+ "@notatki/core": "^0.0.1",
8
+ "@notatki/format": "^0.0.1",
9
+ "@notatki/parser": "^0.0.1"
10
+ },
11
+ "scripts": {
12
+ "compile": "rm -fr dist && tsc",
13
+ "pretest": "npm run compile",
14
+ "test": "node --test 'dist/**/*.test.js'"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "gitHead": "545474a85a5cc649ff9ce50f36e87ccf5c57073a"
20
+ }
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./report.js";
2
+ export * from "./sync.js";
3
+ export * from "./sync-options.js";
package/src/report.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { type Model, type Note } from "@notatki/core";
2
+
3
+ export class Reporter {
4
+ start(): void {}
5
+
6
+ syncModel(model: Model): void {}
7
+
8
+ syncNote(note: Note): void {}
9
+
10
+ end(): void {}
11
+ }
@@ -0,0 +1,20 @@
1
+ import { Reporter } from "./report.js";
2
+
3
+ export type SyncOptions = {
4
+ reporter: Reporter;
5
+ deleteNotes: boolean;
6
+ signal: AbortSignal;
7
+ };
8
+
9
+ export function expandSyncOptions(options: Partial<Readonly<SyncOptions>>): SyncOptions {
10
+ const {
11
+ reporter = new Reporter(), //
12
+ deleteNotes = false,
13
+ signal = new AbortController().signal,
14
+ } = options;
15
+ return {
16
+ reporter, //
17
+ deleteNotes,
18
+ signal,
19
+ };
20
+ }
package/src/sync.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { type NoteList } from "@notatki/core";
2
+ import { expandSyncOptions, type SyncOptions } from "./sync-options.js";
3
+
4
+ export async function synchronizeNotes(notes: NoteList, options: Partial<Readonly<SyncOptions>> = {}): Promise<void> {
5
+ await new Synchronizer().sync(notes, expandSyncOptions(options));
6
+ }
7
+
8
+ class Synchronizer {
9
+ async sync(notes: NoteList, options: SyncOptions): Promise<void> {
10
+ const { reporter } = options;
11
+
12
+ reporter.start();
13
+
14
+ reporter.end();
15
+ }
16
+ }