@hesprs/sync-engine-sdk 3.0.0

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.
Files changed (91) hide show
  1. package/dist/debug-wrapper.d.ts +6 -0
  2. package/dist/debug-wrapper.js +1 -0
  3. package/dist/dev.d.ts +5 -0
  4. package/dist/dev.js +1 -0
  5. package/dist/index.d.ts +35 -0
  6. package/dist/index.js +1 -0
  7. package/dist/node_modules/.bun/synthkernel@._synthkernel.tgz/node_modules/synthkernel/dist/context.d.ts +29 -0
  8. package/dist/node_modules/.bun/synthkernel@._synthkernel.tgz/node_modules/synthkernel/dist/reactive.d.ts +14 -0
  9. package/dist/node_modules/.bun/uni-kv@.._.._uni-kv.tgz/node_modules/uni-kv/dist/interface.d.ts +46 -0
  10. package/dist/obsidian-bridge.d.ts +15 -0
  11. package/dist/obsidian-bridge.js +1 -0
  12. package/dist/packages/plugin/src/components/FilterEditorModal.d.ts +17 -0
  13. package/dist/packages/plugin/src/components/HeadersEditorModal.d.ts +18 -0
  14. package/dist/packages/plugin/src/components/MigrationModal.d.ts +45 -0
  15. package/dist/packages/plugin/src/components/MigrationModal.js +1 -0
  16. package/dist/packages/plugin/src/components/ModuleEditorModal.d.ts +26 -0
  17. package/dist/packages/plugin/src/components/SourceEditorModal.d.ts +16 -0
  18. package/dist/packages/plugin/src/components/UnknownModuleModal.d.ts +19 -0
  19. package/dist/packages/plugin/src/components/file-tree/index.d.ts +7 -0
  20. package/dist/packages/plugin/src/components/module-management/index.d.ts +23 -0
  21. package/dist/packages/plugin/src/components/render-progress.js +1 -0
  22. package/dist/packages/plugin/src/fs/hierarchical-optimizer.d.ts +1 -0
  23. package/dist/packages/plugin/src/fs/index.d.ts +13 -0
  24. package/dist/packages/plugin/src/fs/interface.d.ts +71 -0
  25. package/dist/packages/plugin/src/fs/middlewares/custom-headers.d.ts +1 -0
  26. package/dist/packages/plugin/src/fs/middlewares/rate-limiter.d.ts +1 -0
  27. package/dist/packages/plugin/src/fs/middlewares/retry.d.ts +1 -0
  28. package/dist/packages/plugin/src/fs/vault/index.d.ts +3 -0
  29. package/dist/packages/plugin/src/fs/vault/request.d.ts +71 -0
  30. package/dist/packages/plugin/src/fs/wrappers/asymmetric-storage.d.ts +2 -0
  31. package/dist/packages/plugin/src/fs/wrappers/cancellation.d.ts +2 -0
  32. package/dist/packages/plugin/src/fs/wrappers/context.d.ts +2 -0
  33. package/dist/packages/plugin/src/fs/wrappers/memory-control.d.ts +1 -0
  34. package/dist/packages/plugin/src/fs/wrappers/optimization.d.ts +1 -0
  35. package/dist/packages/plugin/src/index.d.ts +30 -0
  36. package/dist/packages/plugin/src/modules/Bootstrap.d.ts +85 -0
  37. package/dist/packages/plugin/src/modules/EventBus.d.ts +35 -0
  38. package/dist/packages/plugin/src/modules/Extensibility.d.ts +96 -0
  39. package/dist/packages/plugin/src/modules/I18n.d.ts +22 -0
  40. package/dist/packages/plugin/src/modules/ModulesModal.d.ts +49 -0
  41. package/dist/packages/plugin/src/modules/Observability.d.ts +58 -0
  42. package/dist/packages/plugin/src/modules/ProgressModal.d.ts +66 -0
  43. package/dist/packages/plugin/src/modules/Registrar.d.ts +147 -0
  44. package/dist/packages/plugin/src/modules/Scheduler.d.ts +43 -0
  45. package/dist/packages/plugin/src/modules/Storage.d.ts +54 -0
  46. package/dist/packages/plugin/src/modules/Sync.d.ts +84 -0
  47. package/dist/packages/plugin/src/settings/controls.d.ts +21 -0
  48. package/dist/packages/plugin/src/settings/development.d.ts +17 -0
  49. package/dist/packages/plugin/src/settings/features.d.ts +24 -0
  50. package/dist/packages/plugin/src/settings/filter.d.ts +11 -0
  51. package/dist/packages/plugin/src/settings/head.d.ts +23 -0
  52. package/dist/packages/plugin/src/settings/miscellaneous.d.ts +21 -0
  53. package/dist/packages/plugin/src/sync/conflict-resolve/keep-local.d.ts +1 -0
  54. package/dist/packages/plugin/src/sync/conflict-resolve/keep-remote.d.ts +1 -0
  55. package/dist/packages/plugin/src/sync/conflict-resolve/latest-survive.d.ts +1 -0
  56. package/dist/packages/plugin/src/sync/conflict-resolve/rename-and-keep-both.d.ts +1 -0
  57. package/dist/packages/plugin/src/sync/decision/bidirectional.d.ts +2 -0
  58. package/dist/packages/plugin/src/sync/decision/interface.d.ts +90 -0
  59. package/dist/packages/plugin/src/sync/index.d.ts +21 -0
  60. package/dist/packages/plugin/src/sync/tasks/AddRecord.d.ts +8 -0
  61. package/dist/packages/plugin/src/sync/tasks/CreateLocalDir.d.ts +8 -0
  62. package/dist/packages/plugin/src/sync/tasks/CreateRemoteDir.d.ts +8 -0
  63. package/dist/packages/plugin/src/sync/tasks/Download.d.ts +8 -0
  64. package/dist/packages/plugin/src/sync/tasks/MoveLocal.d.ts +8 -0
  65. package/dist/packages/plugin/src/sync/tasks/MoveRemote.d.ts +8 -0
  66. package/dist/packages/plugin/src/sync/tasks/RemoveLocal.d.ts +8 -0
  67. package/dist/packages/plugin/src/sync/tasks/RemoveRecord.d.ts +7 -0
  68. package/dist/packages/plugin/src/sync/tasks/RemoveRemote.d.ts +8 -0
  69. package/dist/packages/plugin/src/sync/tasks/ResolveConflict.d.ts +11 -0
  70. package/dist/packages/plugin/src/sync/tasks/Upload.d.ts +8 -0
  71. package/dist/packages/plugin/src/sync/tasks/interface.d.ts +36 -0
  72. package/dist/packages/plugin/src/sync/utils/detect-moves.d.ts +2 -0
  73. package/dist/packages/plugin/src/sync/utils/post-traversal.d.ts +1 -0
  74. package/dist/packages/plugin/src/types.d.ts +40 -0
  75. package/dist/packages/plugin/src/utils/glob-match.d.ts +5 -0
  76. package/dist/packages/plugin/src/utils/pipe.d.ts +14 -0
  77. package/dist/packages/plugin/src/utils/pipe.js +1 -0
  78. package/dist/packages/plugin/src/utils/round-percent.js +1 -0
  79. package/dist/packages/plugin/src/utils/sha-256.d.ts +4 -0
  80. package/dist/packages/plugin/src/utils/sha-256.js +1 -0
  81. package/dist/packages/plugin/src/utils/to-error-message.js +1 -0
  82. package/dist/packages/plugin/test/e2e-utils.d.ts +5 -0
  83. package/dist/packages/plugin/test/test-kit.d.ts +58 -0
  84. package/dist/packages/plugin/test/test-kit.js +1 -0
  85. package/dist/packages/shared/src/get-status.js +1 -0
  86. package/dist/packages/shared/src/path.js +1 -0
  87. package/dist/prefix.d.ts +6 -0
  88. package/dist/prefix.js +1 -0
  89. package/dist/transform.d.ts +15 -0
  90. package/dist/transform.js +1 -0
  91. package/package.json +65 -0
@@ -0,0 +1 @@
1
+ function e(e){return e.split(`/`).map(e=>decodeURIComponent(e.normalize(`NFC`))).join(`/`)}function t(e,t){let n=e.split(`/`).filter(e=>e!==``).join(`/`);return t?`${n}/`:n}function n(n){return t(e(n),!0)}export{n as normalizeBaseDir,e as normalizeChar,t as normalizeKey};
@@ -0,0 +1,6 @@
1
+ import { Fs, WrappedFs } from "./packages/plugin/src/fs/interface.js";
2
+ import "./packages/plugin/src/fs/index.js";
3
+ //#region src/sdk/prefix.d.ts
4
+ declare function prefixWrapper(original: Fs, prefix: string): WrappedFs;
5
+ //#endregion
6
+ export { prefixWrapper as default };
package/dist/prefix.js ADDED
@@ -0,0 +1 @@
1
+ import{normalizeBaseDir as e}from"./packages/shared/src/path.js";function t(e,t){return t===`/`?e:e===`/`?t:`${e}${t}`}function n(e,t){if(e===`/`)return t;if(!t.startsWith(e))throw Error(`Accessed out-of-scope path "${t}"`);return t=t.slice(e.length),t===``?`/`:t}function r(e,t){return Object.assign(t,{key:n(e,t.key)})}function i(e,t){return t.map(t=>r(e,t)).filter(e=>e.key!==`/`)}var a=class{original;prefix;constructor(e,t){this.original=e,this.prefix=t}getUid(){return`${this.original.getUid()}~${this.prefix}`}read(e,n){return this.original.read(t(this.prefix,e),n)}readStream(e,n){return this.original.readStream(t(this.prefix,e),n)}write(e,n,r){return this.original.write(t(this.prefix,e),n,r)}writeStream(e,n,r){return this.original.writeStream(t(this.prefix,e),n,r)}delete(e){return this.original.delete(t(this.prefix,e))}move(e,n){return this.original.move(t(this.prefix,e),t(this.prefix,n))}mkdir(e,n){return this.original.mkdir(t(this.prefix,e),n)}async stat(e){let n=await this.original.stat(t(this.prefix,e));return r(this.prefix,n)}exists(e){return this.original.exists(t(this.prefix,e))}async list(e,r){let a=await this.original.list(t(this.prefix,e),e=>r(Object.assign(e,{current:n(this.prefix,e.current)})));return i(this.prefix,a)}};function o(t,n){return new a(t,e(n))}export{o as default};
@@ -0,0 +1,15 @@
1
+ //#region src/sdk/transform.d.ts
2
+ type SyncEngineConfig = {
3
+ deps?: {
4
+ neverBundle?: true | string | RegExp | Array<string | RegExp> | ((id: string, parentId: string | undefined, isResolved: boolean) => boolean | null | undefined);
5
+ };
6
+ };
7
+ declare function syncEngineTransform(): {
8
+ name: string;
9
+ renderChunk(code: string): {
10
+ code: string;
11
+ } | undefined;
12
+ tsdownConfig(config: SyncEngineConfig): void;
13
+ };
14
+ //#endregion
15
+ export { syncEngineTransform as default };
@@ -0,0 +1 @@
1
+ function e(){return{name:`sync-engine-transform`,renderChunk(e){let t=e.replaceAll(/^\s*import\s+(?<name>[A-Za-z_$][\w$]*)\s+from\s+(?<quote>['"])obsidian\k<quote>\s*;?\s*$/gmv,(e,t)=>`const ${t} = window.syncEngineApiBridge;`).replaceAll(/^\s*import\s+\*\s+as\s+(?<name>[A-Za-z_$][\w$]*)\s+from\s+(?<quote>['"])obsidian\k<quote>\s*;?\s*$/gmv,(e,t)=>`const ${t} = window.syncEngineApiBridge;`).replaceAll(/^\s*import\s+(?!(?:type\b|\*\s+as\s+))(?<name>.+?)\s+from\s+(?<quote>['"])obsidian\k<quote>\s*;?\s*$/gmv,(e,t)=>`const ${t} = window.syncEngineApiBridge;`);return t===e?void 0:{code:t}},tsdownConfig(e){e.deps??={};let{neverBundle:t}=e.deps;t!==!0&&(typeof t==`function`?e.deps.neverBundle=(e,n,r)=>e===`obsidian`||t(e,n,r):Array.isArray(t)?t.push(`obsidian`):t?e.deps.neverBundle=[t,`obsidian`]:e.deps.neverBundle=[`obsidian`])}}}export{e as default};
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@hesprs/sync-engine-sdk",
3
+ "version": "3.0.0",
4
+ "keywords": [
5
+ "obsidian-plugin",
6
+ "sdk",
7
+ "synchronization"
8
+ ],
9
+ "homepage": "https://sync.consensia.cc",
10
+ "bugs": {
11
+ "url": "https://github.com/hesprs/sync-engine/issues"
12
+ },
13
+ "license": "MIT",
14
+ "author": {
15
+ "name": "Hēsperus",
16
+ "email": "hesprs@outlook.com"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/hesprs/obsidian-webdav-sync.git"
21
+ },
22
+ "files": [
23
+ "./dist"
24
+ ],
25
+ "type": "module",
26
+ "sideEffects": false,
27
+ "module": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "default": "./dist/index.js"
33
+ },
34
+ "./dev": {
35
+ "types": "./dist/dev.d.ts",
36
+ "default": "./dist/dev.js"
37
+ }
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "scripts": {
43
+ "dev:plugin": "MODE=dev BUILD=plugin tsdown",
44
+ "build:plugin": "BUILD=plugin tsdown",
45
+ "dev": "MODE=dev tsdown",
46
+ "compile": "tsdown",
47
+ "fix": "oxlint --silent --fix && oxfmt",
48
+ "check": "tsc && oxlint && oxfmt --check",
49
+ "tests": "bun --preload=./test/mocks test"
50
+ },
51
+ "dependencies": {
52
+ "obsidian": "^1.13.1"
53
+ },
54
+ "devDependencies": {
55
+ "@repo/shared": "workspace:*",
56
+ "@unocss/postcss": "^66.7.5",
57
+ "postcss-merge-rules": "^8.0.1",
58
+ "solid-js": "^1.9.13",
59
+ "synthkernel": "./synthkernel.tgz",
60
+ "uni-kv": "../../uni-kv.tgz",
61
+ "unocss": "^66.7.5",
62
+ "unplugin-solid": "^2.0.0",
63
+ "verkit": "^0.3.1"
64
+ }
65
+ }