@aigne/afs-did-space 1.12.0-beta.5
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.md +26 -0
- package/README.md +129 -0
- package/dist/_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.cjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.mjs +10 -0
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/afs-metadata-context.cjs +20 -0
- package/dist/afs-metadata-context.d.cts +21 -0
- package/dist/afs-metadata-context.d.cts.map +1 -0
- package/dist/afs-metadata-context.d.mts +21 -0
- package/dist/afs-metadata-context.d.mts.map +1 -0
- package/dist/afs-metadata-context.mjs +18 -0
- package/dist/afs-metadata-context.mjs.map +1 -0
- package/dist/blocklet-hook.cjs +180 -0
- package/dist/blocklet-hook.d.cts +29 -0
- package/dist/blocklet-hook.d.cts.map +1 -0
- package/dist/blocklet-hook.d.mts +29 -0
- package/dist/blocklet-hook.d.mts.map +1 -0
- package/dist/blocklet-hook.mjs +178 -0
- package/dist/blocklet-hook.mjs.map +1 -0
- package/dist/changelog-schema.cjs +603 -0
- package/dist/changelog-schema.d.cts +395 -0
- package/dist/changelog-schema.d.cts.map +1 -0
- package/dist/changelog-schema.d.mts +395 -0
- package/dist/changelog-schema.d.mts.map +1 -0
- package/dist/changelog-schema.mjs +570 -0
- package/dist/changelog-schema.mjs.map +1 -0
- package/dist/changelog-write.cjs +80 -0
- package/dist/changelog-write.d.cts +70 -0
- package/dist/changelog-write.d.cts.map +1 -0
- package/dist/changelog-write.d.mts +70 -0
- package/dist/changelog-write.d.mts.map +1 -0
- package/dist/changelog-write.mjs +77 -0
- package/dist/changelog-write.mjs.map +1 -0
- package/dist/cid-byte-cache.cjs +126 -0
- package/dist/cid-byte-cache.d.cts +46 -0
- package/dist/cid-byte-cache.d.cts.map +1 -0
- package/dist/cid-byte-cache.d.mts +47 -0
- package/dist/cid-byte-cache.d.mts.map +1 -0
- package/dist/cid-byte-cache.mjs +125 -0
- package/dist/cid-byte-cache.mjs.map +1 -0
- package/dist/cid.cjs +68 -0
- package/dist/cid.d.cts +22 -0
- package/dist/cid.d.cts.map +1 -0
- package/dist/cid.d.mts +22 -0
- package/dist/cid.d.mts.map +1 -0
- package/dist/cid.mjs +65 -0
- package/dist/cid.mjs.map +1 -0
- package/dist/client.cjs +221 -0
- package/dist/client.d.cts +72 -0
- package/dist/client.d.cts.map +1 -0
- package/dist/client.d.mts +72 -0
- package/dist/client.d.mts.map +1 -0
- package/dist/client.mjs +220 -0
- package/dist/client.mjs.map +1 -0
- package/dist/cloudflare.cjs +510 -0
- package/dist/cloudflare.d.cts +307 -0
- package/dist/cloudflare.d.cts.map +1 -0
- package/dist/cloudflare.d.mts +308 -0
- package/dist/cloudflare.d.mts.map +1 -0
- package/dist/cloudflare.mjs +507 -0
- package/dist/cloudflare.mjs.map +1 -0
- package/dist/ctime-backfill.cjs +272 -0
- package/dist/ctime-backfill.d.cts +169 -0
- package/dist/ctime-backfill.d.cts.map +1 -0
- package/dist/ctime-backfill.d.mts +169 -0
- package/dist/ctime-backfill.d.mts.map +1 -0
- package/dist/ctime-backfill.mjs +267 -0
- package/dist/ctime-backfill.mjs.map +1 -0
- package/dist/d1-gc-queue.cjs +80 -0
- package/dist/d1-gc-queue.d.cts +59 -0
- package/dist/d1-gc-queue.d.cts.map +1 -0
- package/dist/d1-gc-queue.d.mts +59 -0
- package/dist/d1-gc-queue.d.mts.map +1 -0
- package/dist/d1-gc-queue.mjs +81 -0
- package/dist/d1-gc-queue.mjs.map +1 -0
- package/dist/d1-resolve-store.cjs +189 -0
- package/dist/d1-resolve-store.d.cts +93 -0
- package/dist/d1-resolve-store.d.cts.map +1 -0
- package/dist/d1-resolve-store.d.mts +93 -0
- package/dist/d1-resolve-store.d.mts.map +1 -0
- package/dist/d1-resolve-store.mjs +190 -0
- package/dist/d1-resolve-store.mjs.map +1 -0
- package/dist/d1-schema.cjs +361 -0
- package/dist/d1-schema.d.cts +237 -0
- package/dist/d1-schema.d.cts.map +1 -0
- package/dist/d1-schema.d.mts +237 -0
- package/dist/d1-schema.d.mts.map +1 -0
- package/dist/d1-schema.mjs +341 -0
- package/dist/d1-schema.mjs.map +1 -0
- package/dist/d1-share-store.cjs +0 -0
- package/dist/d1-share-store.d.cts +53 -0
- package/dist/d1-share-store.d.cts.map +1 -0
- package/dist/d1-share-store.d.mts +53 -0
- package/dist/d1-share-store.d.mts.map +1 -0
- package/dist/d1-share-store.mjs +0 -0
- package/dist/d1-share-store.mjs.map +1 -0
- package/dist/d1-tree-index.cjs +1098 -0
- package/dist/d1-tree-index.d.cts +203 -0
- package/dist/d1-tree-index.d.cts.map +1 -0
- package/dist/d1-tree-index.d.mts +203 -0
- package/dist/d1-tree-index.d.mts.map +1 -0
- package/dist/d1-tree-index.mjs +1094 -0
- package/dist/d1-tree-index.mjs.map +1 -0
- package/dist/data-backend.cjs +147 -0
- package/dist/data-backend.d.cts +30 -0
- package/dist/data-backend.d.cts.map +1 -0
- package/dist/data-backend.d.mts +30 -0
- package/dist/data-backend.d.mts.map +1 -0
- package/dist/data-backend.mjs +148 -0
- package/dist/data-backend.mjs.map +1 -0
- package/dist/dedup-backfill.cjs +278 -0
- package/dist/dedup-backfill.d.cts +165 -0
- package/dist/dedup-backfill.d.cts.map +1 -0
- package/dist/dedup-backfill.d.mts +165 -0
- package/dist/dedup-backfill.d.mts.map +1 -0
- package/dist/dedup-backfill.mjs +273 -0
- package/dist/dedup-backfill.mjs.map +1 -0
- package/dist/did-space-like.d.cts +2 -0
- package/dist/did-space-like.d.mts +2 -0
- package/dist/did-utils.cjs +44 -0
- package/dist/did-utils.d.cts +25 -0
- package/dist/did-utils.d.cts.map +1 -0
- package/dist/did-utils.d.mts +25 -0
- package/dist/did-utils.d.mts.map +1 -0
- package/dist/did-utils.mjs +43 -0
- package/dist/did-utils.mjs.map +1 -0
- package/dist/dirty-path-queue.cjs +31 -0
- package/dist/dirty-path-queue.d.cts +104 -0
- package/dist/dirty-path-queue.d.cts.map +1 -0
- package/dist/dirty-path-queue.d.mts +104 -0
- package/dist/dirty-path-queue.d.mts.map +1 -0
- package/dist/dirty-path-queue.mjs +31 -0
- package/dist/dirty-path-queue.mjs.map +1 -0
- package/dist/dirty-path-schema.cjs +142 -0
- package/dist/dirty-path-schema.d.cts +90 -0
- package/dist/dirty-path-schema.d.cts.map +1 -0
- package/dist/dirty-path-schema.d.mts +90 -0
- package/dist/dirty-path-schema.d.mts.map +1 -0
- package/dist/dirty-path-schema.mjs +136 -0
- package/dist/dirty-path-schema.mjs.map +1 -0
- package/dist/download-actions.cjs +43 -0
- package/dist/download-actions.mjs +40 -0
- package/dist/download-actions.mjs.map +1 -0
- package/dist/fs-object-store.cjs +153 -0
- package/dist/fs-object-store.d.cts +21 -0
- package/dist/fs-object-store.d.cts.map +1 -0
- package/dist/fs-object-store.d.mts +22 -0
- package/dist/fs-object-store.d.mts.map +1 -0
- package/dist/fs-object-store.mjs +153 -0
- package/dist/fs-object-store.mjs.map +1 -0
- package/dist/gc-queue.d.cts +43 -0
- package/dist/gc-queue.d.cts.map +1 -0
- package/dist/gc-queue.d.mts +43 -0
- package/dist/gc-queue.d.mts.map +1 -0
- package/dist/index.cjs +2712 -0
- package/dist/index.d.cts +504 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +505 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2537 -0
- package/dist/index.mjs.map +1 -0
- package/dist/inline-content-migration.cjs +212 -0
- package/dist/inline-content-migration.d.cts +110 -0
- package/dist/inline-content-migration.d.cts.map +1 -0
- package/dist/inline-content-migration.d.mts +111 -0
- package/dist/inline-content-migration.d.mts.map +1 -0
- package/dist/inline-content-migration.mjs +207 -0
- package/dist/inline-content-migration.mjs.map +1 -0
- package/dist/inline-content.cjs +145 -0
- package/dist/inline-content.d.cts +98 -0
- package/dist/inline-content.d.cts.map +1 -0
- package/dist/inline-content.d.mts +98 -0
- package/dist/inline-content.d.mts.map +1 -0
- package/dist/inline-content.mjs +137 -0
- package/dist/inline-content.mjs.map +1 -0
- package/dist/local-changelog.cjs +241 -0
- package/dist/local-changelog.d.cts +119 -0
- package/dist/local-changelog.d.cts.map +1 -0
- package/dist/local-changelog.d.mts +119 -0
- package/dist/local-changelog.d.mts.map +1 -0
- package/dist/local-changelog.mjs +240 -0
- package/dist/local-changelog.mjs.map +1 -0
- package/dist/local.cjs +435 -0
- package/dist/local.d.cts +254 -0
- package/dist/local.d.cts.map +1 -0
- package/dist/local.d.mts +254 -0
- package/dist/local.d.mts.map +1 -0
- package/dist/local.mjs +427 -0
- package/dist/local.mjs.map +1 -0
- package/dist/memory-gc-queue.cjs +36 -0
- package/dist/memory-gc-queue.d.cts +22 -0
- package/dist/memory-gc-queue.d.cts.map +1 -0
- package/dist/memory-gc-queue.d.mts +22 -0
- package/dist/memory-gc-queue.d.mts.map +1 -0
- package/dist/memory-gc-queue.mjs +36 -0
- package/dist/memory-gc-queue.mjs.map +1 -0
- package/dist/memory-tree-index.cjs +734 -0
- package/dist/memory-tree-index.d.cts +159 -0
- package/dist/memory-tree-index.d.cts.map +1 -0
- package/dist/memory-tree-index.d.mts +159 -0
- package/dist/memory-tree-index.d.mts.map +1 -0
- package/dist/memory-tree-index.mjs +735 -0
- package/dist/memory-tree-index.mjs.map +1 -0
- package/dist/metadata-db.cjs +562 -0
- package/dist/metadata-db.d.cts +102 -0
- package/dist/metadata-db.d.cts.map +1 -0
- package/dist/metadata-db.d.mts +102 -0
- package/dist/metadata-db.d.mts.map +1 -0
- package/dist/metadata-db.mjs +562 -0
- package/dist/metadata-db.mjs.map +1 -0
- package/dist/mime-utils.cjs +2 -0
- package/dist/mime-utils.d.cts +2 -0
- package/dist/mime-utils.d.mts +2 -0
- package/dist/mime-utils.mjs +3 -0
- package/dist/object-key.cjs +41 -0
- package/dist/object-key.d.cts +25 -0
- package/dist/object-key.d.cts.map +1 -0
- package/dist/object-key.d.mts +25 -0
- package/dist/object-key.d.mts.map +1 -0
- package/dist/object-key.mjs +40 -0
- package/dist/object-key.mjs.map +1 -0
- package/dist/packages/session/dist/index.cjs +788 -0
- package/dist/packages/session/dist/index.mjs +782 -0
- package/dist/packages/session/dist/index.mjs.map +1 -0
- package/dist/platform/r2/dist/types.d.cts +49 -0
- package/dist/platform/r2/dist/types.d.cts.map +1 -0
- package/dist/prefix-range.cjs +33 -0
- package/dist/prefix-range.d.cts +29 -0
- package/dist/prefix-range.d.cts.map +1 -0
- package/dist/prefix-range.d.mts +29 -0
- package/dist/prefix-range.d.mts.map +1 -0
- package/dist/prefix-range.mjs +33 -0
- package/dist/prefix-range.mjs.map +1 -0
- package/dist/prefixed-tree-index.cjs +238 -0
- package/dist/prefixed-tree-index.d.cts +85 -0
- package/dist/prefixed-tree-index.d.cts.map +1 -0
- package/dist/prefixed-tree-index.d.mts +85 -0
- package/dist/prefixed-tree-index.d.mts.map +1 -0
- package/dist/prefixed-tree-index.mjs +239 -0
- package/dist/prefixed-tree-index.mjs.map +1 -0
- package/dist/presign-signer.cjs +7 -0
- package/dist/presign-signer.d.cts +99 -0
- package/dist/presign-signer.d.cts.map +1 -0
- package/dist/presign-signer.d.mts +99 -0
- package/dist/presign-signer.d.mts.map +1 -0
- package/dist/presign-signer.mjs +7 -0
- package/dist/presign-signer.mjs.map +1 -0
- package/dist/providers/platform/r2/dist/index.d.mts +3 -0
- package/dist/providers/platform/r2/dist/types.d.mts +49 -0
- package/dist/providers/platform/r2/dist/types.d.mts.map +1 -0
- package/dist/reconcile.cjs +184 -0
- package/dist/reconcile.d.cts +26 -0
- package/dist/reconcile.d.cts.map +1 -0
- package/dist/reconcile.d.mts +26 -0
- package/dist/reconcile.d.mts.map +1 -0
- package/dist/reconcile.mjs +184 -0
- package/dist/reconcile.mjs.map +1 -0
- package/dist/reference-check.cjs +49 -0
- package/dist/reference-check.d.cts +10 -0
- package/dist/reference-check.d.cts.map +1 -0
- package/dist/reference-check.d.mts +10 -0
- package/dist/reference-check.d.mts.map +1 -0
- package/dist/reference-check.mjs +48 -0
- package/dist/reference-check.mjs.map +1 -0
- package/dist/remote-afs.cjs +681 -0
- package/dist/remote-afs.d.cts +236 -0
- package/dist/remote-afs.d.cts.map +1 -0
- package/dist/remote-afs.d.mts +236 -0
- package/dist/remote-afs.d.mts.map +1 -0
- package/dist/remote-afs.mjs +676 -0
- package/dist/remote-afs.mjs.map +1 -0
- package/dist/rename-guard.cjs +18 -0
- package/dist/rename-guard.mjs +18 -0
- package/dist/rename-guard.mjs.map +1 -0
- package/dist/resolve.cjs +260 -0
- package/dist/resolve.d.cts +113 -0
- package/dist/resolve.d.cts.map +1 -0
- package/dist/resolve.d.mts +113 -0
- package/dist/resolve.d.mts.map +1 -0
- package/dist/resolve.mjs +260 -0
- package/dist/resolve.mjs.map +1 -0
- package/dist/rsync-content.cjs +33 -0
- package/dist/rsync-content.mjs +33 -0
- package/dist/rsync-content.mjs.map +1 -0
- package/dist/rsync.cjs +400 -0
- package/dist/rsync.d.cts +157 -0
- package/dist/rsync.d.cts.map +1 -0
- package/dist/rsync.d.mts +157 -0
- package/dist/rsync.d.mts.map +1 -0
- package/dist/rsync.mjs +397 -0
- package/dist/rsync.mjs.map +1 -0
- package/dist/run-gc.cjs +57 -0
- package/dist/run-gc.d.cts +40 -0
- package/dist/run-gc.d.cts.map +1 -0
- package/dist/run-gc.d.mts +41 -0
- package/dist/run-gc.d.mts.map +1 -0
- package/dist/run-gc.mjs +57 -0
- package/dist/run-gc.mjs.map +1 -0
- package/dist/scope-id.cjs +70 -0
- package/dist/scope-id.d.cts +35 -0
- package/dist/scope-id.d.cts.map +1 -0
- package/dist/scope-id.d.mts +35 -0
- package/dist/scope-id.d.mts.map +1 -0
- package/dist/scope-id.mjs +68 -0
- package/dist/scope-id.mjs.map +1 -0
- package/dist/scope-migration-node.cjs +172 -0
- package/dist/scope-migration-node.d.cts +44 -0
- package/dist/scope-migration-node.d.cts.map +1 -0
- package/dist/scope-migration-node.d.mts +44 -0
- package/dist/scope-migration-node.d.mts.map +1 -0
- package/dist/scope-migration-node.mjs +171 -0
- package/dist/scope-migration-node.mjs.map +1 -0
- package/dist/scope-migration.cjs +155 -0
- package/dist/scope-migration.d.cts +65 -0
- package/dist/scope-migration.d.cts.map +1 -0
- package/dist/scope-migration.d.mts +65 -0
- package/dist/scope-migration.d.mts.map +1 -0
- package/dist/scope-migration.mjs +154 -0
- package/dist/scope-migration.mjs.map +1 -0
- package/dist/share-declaration.cjs +225 -0
- package/dist/share-declaration.d.cts +30 -0
- package/dist/share-declaration.d.cts.map +1 -0
- package/dist/share-declaration.d.mts +32 -0
- package/dist/share-declaration.d.mts.map +1 -0
- package/dist/share-declaration.mjs +221 -0
- package/dist/share-declaration.mjs.map +1 -0
- package/dist/share-hook.cjs +63 -0
- package/dist/share-hook.mjs +62 -0
- package/dist/share-hook.mjs.map +1 -0
- package/dist/share-resolve.cjs +176 -0
- package/dist/share-resolve.d.cts +36 -0
- package/dist/share-resolve.d.cts.map +1 -0
- package/dist/share-resolve.d.mts +36 -0
- package/dist/share-resolve.d.mts.map +1 -0
- package/dist/share-resolve.mjs +177 -0
- package/dist/share-resolve.mjs.map +1 -0
- package/dist/share-serve.cjs +145 -0
- package/dist/share-serve.d.cts +30 -0
- package/dist/share-serve.d.cts.map +1 -0
- package/dist/share-serve.d.mts +30 -0
- package/dist/share-serve.d.mts.map +1 -0
- package/dist/share-serve.mjs +144 -0
- package/dist/share-serve.mjs.map +1 -0
- package/dist/share-store.cjs +25 -0
- package/dist/share-store.d.cts +65 -0
- package/dist/share-store.d.cts.map +1 -0
- package/dist/share-store.d.mts +65 -0
- package/dist/share-store.d.mts.map +1 -0
- package/dist/share-store.mjs +25 -0
- package/dist/share-store.mjs.map +1 -0
- package/dist/share-virtual-path.cjs +102 -0
- package/dist/share-virtual-path.mjs +101 -0
- package/dist/share-virtual-path.mjs.map +1 -0
- package/dist/space-resolver.cjs +54 -0
- package/dist/space-resolver.d.cts +34 -0
- package/dist/space-resolver.d.cts.map +1 -0
- package/dist/space-resolver.d.mts +34 -0
- package/dist/space-resolver.d.mts.map +1 -0
- package/dist/space-resolver.mjs +55 -0
- package/dist/space-resolver.mjs.map +1 -0
- package/dist/sqlite-gc-queue.cjs +51 -0
- package/dist/sqlite-gc-queue.d.cts +22 -0
- package/dist/sqlite-gc-queue.d.cts.map +1 -0
- package/dist/sqlite-gc-queue.d.mts +22 -0
- package/dist/sqlite-gc-queue.d.mts.map +1 -0
- package/dist/sqlite-gc-queue.mjs +52 -0
- package/dist/sqlite-gc-queue.mjs.map +1 -0
- package/dist/sqlite-resolve-store.cjs +163 -0
- package/dist/sqlite-resolve-store.d.cts +50 -0
- package/dist/sqlite-resolve-store.d.cts.map +1 -0
- package/dist/sqlite-resolve-store.d.mts +50 -0
- package/dist/sqlite-resolve-store.d.mts.map +1 -0
- package/dist/sqlite-resolve-store.mjs +164 -0
- package/dist/sqlite-resolve-store.mjs.map +1 -0
- package/dist/sqlite-share-store.cjs +157 -0
- package/dist/sqlite-share-store.d.cts +31 -0
- package/dist/sqlite-share-store.d.cts.map +1 -0
- package/dist/sqlite-share-store.d.mts +31 -0
- package/dist/sqlite-share-store.d.mts.map +1 -0
- package/dist/sqlite-share-store.mjs +157 -0
- package/dist/sqlite-share-store.mjs.map +1 -0
- package/dist/sqlite-tree-index.cjs +901 -0
- package/dist/sqlite-tree-index.d.cts +107 -0
- package/dist/sqlite-tree-index.d.cts.map +1 -0
- package/dist/sqlite-tree-index.d.mts +107 -0
- package/dist/sqlite-tree-index.d.mts.map +1 -0
- package/dist/sqlite-tree-index.mjs +902 -0
- package/dist/sqlite-tree-index.mjs.map +1 -0
- package/dist/sync-engine.cjs +1324 -0
- package/dist/sync-engine.d.cts +473 -0
- package/dist/sync-engine.d.cts.map +1 -0
- package/dist/sync-engine.d.mts +473 -0
- package/dist/sync-engine.d.mts.map +1 -0
- package/dist/sync-engine.mjs +1315 -0
- package/dist/sync-engine.mjs.map +1 -0
- package/dist/sync-state.cjs +303 -0
- package/dist/sync-state.d.cts +224 -0
- package/dist/sync-state.d.cts.map +1 -0
- package/dist/sync-state.d.mts +224 -0
- package/dist/sync-state.d.mts.map +1 -0
- package/dist/sync-state.mjs +297 -0
- package/dist/sync-state.mjs.map +1 -0
- package/dist/timestamp.cjs +92 -0
- package/dist/timestamp.mjs +91 -0
- package/dist/timestamp.mjs.map +1 -0
- package/dist/transports/http.cjs +54 -0
- package/dist/transports/http.d.cts +26 -0
- package/dist/transports/http.d.cts.map +1 -0
- package/dist/transports/http.d.mts +26 -0
- package/dist/transports/http.d.mts.map +1 -0
- package/dist/transports/http.mjs +54 -0
- package/dist/transports/http.mjs.map +1 -0
- package/dist/transports/static.cjs +55 -0
- package/dist/transports/static.d.cts +28 -0
- package/dist/transports/static.d.cts.map +1 -0
- package/dist/transports/static.d.mts +28 -0
- package/dist/transports/static.d.mts.map +1 -0
- package/dist/transports/static.mjs +55 -0
- package/dist/transports/static.mjs.map +1 -0
- package/dist/transports/types.cjs +13 -0
- package/dist/transports/types.d.cts +72 -0
- package/dist/transports/types.d.cts.map +1 -0
- package/dist/transports/types.d.mts +72 -0
- package/dist/transports/types.d.mts.map +1 -0
- package/dist/transports/types.mjs +13 -0
- package/dist/transports/types.mjs.map +1 -0
- package/dist/transports/ws.cjs +207 -0
- package/dist/transports/ws.d.cts +47 -0
- package/dist/transports/ws.d.cts.map +1 -0
- package/dist/transports/ws.d.mts +47 -0
- package/dist/transports/ws.d.mts.map +1 -0
- package/dist/transports/ws.mjs +206 -0
- package/dist/transports/ws.mjs.map +1 -0
- package/dist/tree-index.cjs +333 -0
- package/dist/tree-index.d.cts +524 -0
- package/dist/tree-index.d.cts.map +1 -0
- package/dist/tree-index.d.mts +524 -0
- package/dist/tree-index.d.mts.map +1 -0
- package/dist/tree-index.mjs +322 -0
- package/dist/tree-index.mjs.map +1 -0
- package/dist/tree-query.cjs +655 -0
- package/dist/tree-query.d.cts +70 -0
- package/dist/tree-query.d.cts.map +1 -0
- package/dist/tree-query.d.mts +70 -0
- package/dist/tree-query.d.mts.map +1 -0
- package/dist/tree-query.mjs +648 -0
- package/dist/tree-query.mjs.map +1 -0
- package/dist/upload-actions.cjs +97 -0
- package/dist/upload-actions.d.cts +19 -0
- package/dist/upload-actions.d.cts.map +1 -0
- package/dist/upload-actions.d.mts +21 -0
- package/dist/upload-actions.d.mts.map +1 -0
- package/dist/upload-actions.mjs +90 -0
- package/dist/upload-actions.mjs.map +1 -0
- package/dist/upload-session-store.cjs +185 -0
- package/dist/upload-session-store.d.cts +99 -0
- package/dist/upload-session-store.d.cts.map +1 -0
- package/dist/upload-session-store.d.mts +99 -0
- package/dist/upload-session-store.d.mts.map +1 -0
- package/dist/upload-session-store.mjs +184 -0
- package/dist/upload-session-store.mjs.map +1 -0
- package/dist/url-normalize.cjs +61 -0
- package/dist/url-normalize.d.cts +33 -0
- package/dist/url-normalize.d.cts.map +1 -0
- package/dist/url-normalize.d.mts +33 -0
- package/dist/url-normalize.d.mts.map +1 -0
- package/dist/url-normalize.mjs +61 -0
- package/dist/url-normalize.mjs.map +1 -0
- package/dist/versioned-content-backends.cjs +155 -0
- package/dist/versioned-content-backends.d.cts +49 -0
- package/dist/versioned-content-backends.d.cts.map +1 -0
- package/dist/versioned-content-backends.d.mts +49 -0
- package/dist/versioned-content-backends.d.mts.map +1 -0
- package/dist/versioned-content-backends.mjs +154 -0
- package/dist/versioned-content-backends.mjs.map +1 -0
- package/dist/versioned-content-index.cjs +102 -0
- package/dist/versioned-content-index.d.cts +46 -0
- package/dist/versioned-content-index.d.cts.map +1 -0
- package/dist/versioned-content-index.d.mts +46 -0
- package/dist/versioned-content-index.d.mts.map +1 -0
- package/dist/versioned-content-index.mjs +103 -0
- package/dist/versioned-content-index.mjs.map +1 -0
- package/dist/versioned-content-store.cjs +121 -0
- package/dist/versioned-content-store.d.cts +90 -0
- package/dist/versioned-content-store.d.cts.map +1 -0
- package/dist/versioned-content-store.d.mts +90 -0
- package/dist/versioned-content-store.d.mts.map +1 -0
- package/dist/versioned-content-store.mjs +122 -0
- package/dist/versioned-content-store.mjs.map +1 -0
- package/dist/versioned-scope.cjs +39 -0
- package/dist/versioned-scope.d.cts +57 -0
- package/dist/versioned-scope.d.cts.map +1 -0
- package/dist/versioned-scope.d.mts +57 -0
- package/dist/versioned-scope.d.mts.map +1 -0
- package/dist/versioned-scope.mjs +37 -0
- package/dist/versioned-scope.mjs.map +1 -0
- package/migrations/0001_tree_entries.sql +17 -0
- package/migrations/0002_resolve_entries.sql +7 -0
- package/migrations/0003_entries_v2.sql +38 -0
- package/migrations/0004_gc_queue.sql +5 -0
- package/migrations/0006_resolve_enhance.sql +14 -0
- package/migrations/0007_resolve_created_at.sql +10 -0
- package/migrations/0008_changelog.sql +34 -0
- package/migrations/0009_device_sync_state.sql +29 -0
- package/migrations/0010_scope_meta.sql +33 -0
- package/migrations/0011_shares.sql +25 -0
- package/migrations/0012_scope_meta_file_count.sql +41 -0
- package/migrations/0013_scope_meta_total_bytes.sql +47 -0
- package/migrations/0014_rename_tables.sql +62 -0
- package/package.json +102 -0
|
@@ -0,0 +1,734 @@
|
|
|
1
|
+
const require_changelog_schema = require('./changelog-schema.cjs');
|
|
2
|
+
const require_inline_content = require('./inline-content.cjs');
|
|
3
|
+
const require_timestamp = require('./timestamp.cjs');
|
|
4
|
+
const require_tree_index = require('./tree-index.cjs');
|
|
5
|
+
const require_tree_query = require('./tree-query.cjs');
|
|
6
|
+
const require_changelog_write = require('./changelog-write.cjs');
|
|
7
|
+
const require_prefix_range = require('./prefix-range.cjs');
|
|
8
|
+
const require_d1_tree_index = require('./d1-tree-index.cjs');
|
|
9
|
+
const require_dirty_path_queue = require('./dirty-path-queue.cjs');
|
|
10
|
+
|
|
11
|
+
//#region src/memory-tree-index.ts
|
|
12
|
+
/**
|
|
13
|
+
* MemoryTreeIndex — in-memory implementation of TreeIndex for testing.
|
|
14
|
+
*
|
|
15
|
+
* Task 2.4a: maintains an in-memory `changelog` array that mirrors the
|
|
16
|
+
* D1/libsql changelog table. No persistence, no libsql dependency — the goal
|
|
17
|
+
* is a pure-data-structure impl so tests can assert against the same row
|
|
18
|
+
* shape that production code will see on the wire. Access the array via
|
|
19
|
+
* `getChangelogSnapshot()`.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Sort-value extraction for the ordered (explicit orderBy) listing path —
|
|
23
|
+
* mirrors the SQL impls' column semantics: `name`/`path` are strings,
|
|
24
|
+
* numbers stay numbers, missing mimeType is NULL (sorts last).
|
|
25
|
+
*/
|
|
26
|
+
function orderSortValue(path, entry, orderBy) {
|
|
27
|
+
switch (orderBy) {
|
|
28
|
+
case "name": return require_d1_tree_index.nameOf(path);
|
|
29
|
+
case "path": return path;
|
|
30
|
+
case "mimeType": return entry.mimeType ?? null;
|
|
31
|
+
default: return entry[orderBy];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Apply the includeContent projection to an in-memory page: stored inline
|
|
36
|
+
* content is surfaced ONLY under `{ includeContent: true }` — mirroring the
|
|
37
|
+
* SQL impls, whose default SELECT never projects the content column.
|
|
38
|
+
*/
|
|
39
|
+
function projectContent(page, options) {
|
|
40
|
+
if (options?.includeContent) return page;
|
|
41
|
+
return {
|
|
42
|
+
...page,
|
|
43
|
+
entries: page.entries.map((e) => {
|
|
44
|
+
if (e.content === void 0) return e;
|
|
45
|
+
const { content: _content, ...rest } = e;
|
|
46
|
+
return rest;
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
var MemoryTreeIndex = class MemoryTreeIndex {
|
|
51
|
+
entries = /* @__PURE__ */ new Map();
|
|
52
|
+
/**
|
|
53
|
+
* DIR rows with their timestamps. Was a `Set<string>` (existence only);
|
|
54
|
+
* upgraded to a `Map` carrying `{ ctime, mtime }` so Rule R2 (feed-sort
|
|
55
|
+
* §5.3) can stamp a direct parent's ctime and `collectChildren` can surface
|
|
56
|
+
* it (the SQL backends sort doc-mode dir rows by `e.ctime`) — keeping the
|
|
57
|
+
* memory backend in lockstep with D1/SQLite.
|
|
58
|
+
*/
|
|
59
|
+
dirEntries = /* @__PURE__ */ new Map();
|
|
60
|
+
/** Phase 2: in-memory mirror of the `changelog` table. */
|
|
61
|
+
changelog = [];
|
|
62
|
+
/**
|
|
63
|
+
* index-follower-dirty-path — in-memory mirror of the `ds_dirty_path` table.
|
|
64
|
+
* Keyed `${scope}\x00${path}`, updated through {@link applyDirtyUpsert} on
|
|
65
|
+
* every changelog append so its merge/guard semantics match the SQL trigger
|
|
66
|
+
* byte-for-byte. There is no DB trigger here, so {@link pushChangelog} is the
|
|
67
|
+
* single hook every write path funnels through.
|
|
68
|
+
*/
|
|
69
|
+
dirtyMap = /* @__PURE__ */ new Map();
|
|
70
|
+
/** Monotonic seq counter mirroring `AUTOINCREMENT` in the SQL impl. */
|
|
71
|
+
nextSeq = 1;
|
|
72
|
+
/** Live Update Resilience §11.4 — in-memory mirror of `prefix_watermark`. */
|
|
73
|
+
watermarks = /* @__PURE__ */ new Map();
|
|
74
|
+
/**
|
|
75
|
+
* Dedup-on-write secondary index (#1159) — in-memory mirror of the
|
|
76
|
+
* `(scope, dedup_scope, dedup_key)` partial UNIQUE index. Keyed
|
|
77
|
+
* `${dedupScope}\x00${dedupKey}` → path. Maintained on put/delete; enforces
|
|
78
|
+
* uniqueness (the SQL backends get it from the DB index).
|
|
79
|
+
*/
|
|
80
|
+
dedupIndex = /* @__PURE__ */ new Map();
|
|
81
|
+
/** Logical scope string baked into every changelog row (default ""). */
|
|
82
|
+
scope;
|
|
83
|
+
inline;
|
|
84
|
+
constructor(opts) {
|
|
85
|
+
this.scope = opts?.scope ?? "";
|
|
86
|
+
this.inline = require_inline_content.resolveInlineConfig(opts);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Return a read-only snapshot of the in-memory changelog.
|
|
90
|
+
*
|
|
91
|
+
* Used by unit tests to assert that the correct row shape was appended on
|
|
92
|
+
* each put/delete. Production code never calls this.
|
|
93
|
+
*/
|
|
94
|
+
getChangelogSnapshot() {
|
|
95
|
+
return this.changelog;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The single append hook for the in-memory changelog. Mirrors the SQL
|
|
99
|
+
* `AFTER INSERT ON ds_changelog` trigger: it appends the row AND folds it into
|
|
100
|
+
* the dirty map via {@link applyDirtyUpsert} (same latest_seq guard + backoff
|
|
101
|
+
* reset). Every write path (`put` / `delete` / `deleteByPrefix`; `putBatch`
|
|
102
|
+
* and the batch* methods loop those) funnels through here, so the dirty map
|
|
103
|
+
* covers all six TreeIndex write methods for free — the Memory-backend twin of
|
|
104
|
+
* the trigger's "covers every write face by construction".
|
|
105
|
+
*/
|
|
106
|
+
pushChangelog(row, now) {
|
|
107
|
+
this.changelog.push(row);
|
|
108
|
+
const key = `${row.scope}\x00${row.path}`;
|
|
109
|
+
this.dirtyMap.set(key, require_dirty_path_queue.applyDirtyUpsert(this.dirtyMap.get(key), {
|
|
110
|
+
scope: row.scope,
|
|
111
|
+
path: row.path,
|
|
112
|
+
latestSeq: row.seq,
|
|
113
|
+
op: row.op,
|
|
114
|
+
cid: row.cid,
|
|
115
|
+
mtime: row.mtime,
|
|
116
|
+
updatedAt: now
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
async get(path, _opts) {
|
|
120
|
+
return this.entries.get(path) ?? null;
|
|
121
|
+
}
|
|
122
|
+
async getDirTimes(dirPath) {
|
|
123
|
+
const dir = this.dirEntries.get(dirPath);
|
|
124
|
+
return dir ? {
|
|
125
|
+
ctime: dir.ctime,
|
|
126
|
+
mtime: dir.mtime
|
|
127
|
+
} : null;
|
|
128
|
+
}
|
|
129
|
+
async put(path, entry, opts) {
|
|
130
|
+
require_changelog_write.validateDeviceId(opts.deviceId);
|
|
131
|
+
const existing = this.entries.get(path);
|
|
132
|
+
const inlineContent = await require_inline_content.resolveInlineContent(entry, this.inline);
|
|
133
|
+
if (existing && existing.cid === entry.cid && existing.mimeType === entry.mimeType && require_tree_index.treeEntryMetadataEqual(existing.metadata, entry.metadata)) {
|
|
134
|
+
if (this.inline.inlineCache !== "on" || (existing.content ?? null) === inlineContent) return { oldCid: existing.cid };
|
|
135
|
+
}
|
|
136
|
+
if (inlineContent !== null && require_inline_content.utf8ByteLength(inlineContent) > require_inline_content.INLINE_CONTENT_HARD_CAP) throw new Error(`inline content exceeds hard cap (${require_inline_content.INLINE_CONTENT_HARD_CAP} bytes)`);
|
|
137
|
+
const stored = {
|
|
138
|
+
cid: entry.cid,
|
|
139
|
+
size: entry.size,
|
|
140
|
+
mtime: entry.mtime,
|
|
141
|
+
ctime: existing?.ctime ?? entry.ctime,
|
|
142
|
+
mimeType: entry.mimeType
|
|
143
|
+
};
|
|
144
|
+
if (inlineContent !== null) stored.content = inlineContent;
|
|
145
|
+
if (entry.metadata && Object.keys(entry.metadata).length > 0) stored.metadata = { ...entry.metadata };
|
|
146
|
+
const nextDedupScope = entry.dedupScope ?? existing?.dedupScope;
|
|
147
|
+
const nextDedupKey = entry.dedupKey ?? existing?.dedupKey;
|
|
148
|
+
if (nextDedupKey != null) {
|
|
149
|
+
this.assertDedupUnique(nextDedupScope, nextDedupKey, path);
|
|
150
|
+
stored.dedupScope = nextDedupScope;
|
|
151
|
+
stored.dedupKey = nextDedupKey;
|
|
152
|
+
}
|
|
153
|
+
this.updateDedupMapping(existing, nextDedupScope, nextDedupKey, path);
|
|
154
|
+
this.entries.set(path, stored);
|
|
155
|
+
this.ensureParentDirs(path);
|
|
156
|
+
const dirStamp = require_timestamp.resolveParentDirStamp(entry.metadata);
|
|
157
|
+
if (dirStamp) {
|
|
158
|
+
const directParent = require_d1_tree_index.parentOf(path);
|
|
159
|
+
if (directParent) this.dirEntries.set(directParent, dirStamp);
|
|
160
|
+
}
|
|
161
|
+
if (!opts.skipChangelog) {
|
|
162
|
+
this.pushChangelog({
|
|
163
|
+
seq: this.nextSeq++,
|
|
164
|
+
scope: this.scope,
|
|
165
|
+
path,
|
|
166
|
+
op: "put",
|
|
167
|
+
cid: entry.cid,
|
|
168
|
+
old_cid: existing?.cid ?? null,
|
|
169
|
+
size: entry.size,
|
|
170
|
+
mtime: entry.mtime,
|
|
171
|
+
device_id: opts.deviceId
|
|
172
|
+
}, Date.now());
|
|
173
|
+
this.bumpWatermark(require_changelog_schema.watermarkWritePrefix(path));
|
|
174
|
+
}
|
|
175
|
+
return { oldCid: existing?.cid };
|
|
176
|
+
}
|
|
177
|
+
/** Inline content this entry would store — drives loopBatchPutEntries' content-aware skip. */
|
|
178
|
+
inlineForEntry(entry) {
|
|
179
|
+
return require_inline_content.resolveInlineContent(entry, this.inline);
|
|
180
|
+
}
|
|
181
|
+
dedupMapKey(dedupScope, dedupKey) {
|
|
182
|
+
return `${dedupScope ?? ""}\x00${dedupKey}`;
|
|
183
|
+
}
|
|
184
|
+
/** Mirror the `(scope, dedup_scope, dedup_key)` UNIQUE constraint. */
|
|
185
|
+
assertDedupUnique(dedupScope, dedupKey, path) {
|
|
186
|
+
const held = this.dedupIndex.get(this.dedupMapKey(dedupScope, dedupKey));
|
|
187
|
+
if (held !== void 0 && held !== path) throw new Error("UNIQUE constraint failed: ds_entries.dedup_scope, ds_entries.dedup_key");
|
|
188
|
+
}
|
|
189
|
+
dropDedupMapping(dedupScope, dedupKey, path) {
|
|
190
|
+
const k = this.dedupMapKey(dedupScope, dedupKey);
|
|
191
|
+
if (this.dedupIndex.get(k) === path) this.dedupIndex.delete(k);
|
|
192
|
+
}
|
|
193
|
+
/** Re-point the dedup map for `path`: drop its stale mapping, set the new one. */
|
|
194
|
+
updateDedupMapping(existing, nextDedupScope, nextDedupKey, path) {
|
|
195
|
+
if (existing?.dedupKey != null) this.dropDedupMapping(existing.dedupScope, existing.dedupKey, path);
|
|
196
|
+
if (nextDedupKey != null) this.dedupIndex.set(this.dedupMapKey(nextDedupScope, nextDedupKey), path);
|
|
197
|
+
}
|
|
198
|
+
async findByDedupKey(dedupScope, dedupKey) {
|
|
199
|
+
const path = this.dedupIndex.get(this.dedupMapKey(dedupScope, dedupKey));
|
|
200
|
+
if (path === void 0) return null;
|
|
201
|
+
const entry = this.entries.get(path);
|
|
202
|
+
return entry ? {
|
|
203
|
+
path,
|
|
204
|
+
...entry
|
|
205
|
+
} : null;
|
|
206
|
+
}
|
|
207
|
+
async setDedupKey(path, dedupScope, dedupKey, opts) {
|
|
208
|
+
require_changelog_write.validateDeviceId(opts.deviceId);
|
|
209
|
+
const entry = this.entries.get(path);
|
|
210
|
+
if (!entry) return;
|
|
211
|
+
this.assertDedupUnique(dedupScope, dedupKey, path);
|
|
212
|
+
this.updateDedupMapping(entry, dedupScope, dedupKey, path);
|
|
213
|
+
entry.dedupScope = dedupScope;
|
|
214
|
+
entry.dedupKey = dedupKey;
|
|
215
|
+
}
|
|
216
|
+
/** Bump a collection root's watermark by 1 (lazy-create at 1). No-op for null. */
|
|
217
|
+
bumpWatermark(prefix) {
|
|
218
|
+
if (prefix === null) return;
|
|
219
|
+
this.watermarks.set(prefix, (this.watermarks.get(prefix) ?? 0) + 1);
|
|
220
|
+
}
|
|
221
|
+
async getPrefixWatermark(prefix) {
|
|
222
|
+
const wmPrefix = require_changelog_schema.watermarkPrefix(prefix);
|
|
223
|
+
if (wmPrefix === null) return null;
|
|
224
|
+
return this.watermarks.get(wmPrefix) ?? 0;
|
|
225
|
+
}
|
|
226
|
+
async delete(path, opts) {
|
|
227
|
+
require_changelog_write.validateDeviceId(opts.deviceId);
|
|
228
|
+
const existing = this.entries.get(path);
|
|
229
|
+
this.entries.delete(path);
|
|
230
|
+
if (existing?.dedupKey != null) this.dropDedupMapping(existing.dedupScope, existing.dedupKey, path);
|
|
231
|
+
this.cleanEmptyParents(path);
|
|
232
|
+
if (existing && !opts.skipChangelog) {
|
|
233
|
+
this.pushChangelog({
|
|
234
|
+
seq: this.nextSeq++,
|
|
235
|
+
scope: this.scope,
|
|
236
|
+
path,
|
|
237
|
+
op: "delete",
|
|
238
|
+
cid: null,
|
|
239
|
+
old_cid: existing.cid,
|
|
240
|
+
size: null,
|
|
241
|
+
mtime: opts.mtime ?? Date.now(),
|
|
242
|
+
device_id: opts.deviceId
|
|
243
|
+
}, Date.now());
|
|
244
|
+
this.bumpWatermark(require_changelog_schema.watermarkWritePrefix(path));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
cleanEmptyParents(path) {
|
|
248
|
+
for (const dirPath of require_d1_tree_index.ancestorDirs(path)) {
|
|
249
|
+
if (!this.dirEntries.has(dirPath)) break;
|
|
250
|
+
let hasChildren = false;
|
|
251
|
+
for (const p of this.entries.keys()) if (require_d1_tree_index.parentOf(p) === dirPath) {
|
|
252
|
+
hasChildren = true;
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
if (!hasChildren) {
|
|
256
|
+
for (const d of this.dirEntries.keys()) if (d !== dirPath && require_d1_tree_index.parentOf(d) === dirPath) {
|
|
257
|
+
hasChildren = true;
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (hasChildren) break;
|
|
262
|
+
this.dirEntries.delete(dirPath);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
static VALID_ORDER_BY = new Set([
|
|
266
|
+
"path",
|
|
267
|
+
"mtime",
|
|
268
|
+
"size",
|
|
269
|
+
"ctime",
|
|
270
|
+
"mimeType",
|
|
271
|
+
"name"
|
|
272
|
+
]);
|
|
273
|
+
/**
|
|
274
|
+
* Ordered + keyset-paged listing shared by listEntries/listChildren when
|
|
275
|
+
* an explicit orderBy is set — same semantics as the SQL impls (NULL
|
|
276
|
+
* mimeType last in both directions, unique-tie keyset resume, v2 cursor).
|
|
277
|
+
*/
|
|
278
|
+
orderedPage(rows, options, tieOf) {
|
|
279
|
+
const orderBy = options.orderBy;
|
|
280
|
+
if (!MemoryTreeIndex.VALID_ORDER_BY.has(orderBy)) throw new Error(`Invalid orderBy: ${orderBy}`);
|
|
281
|
+
const order = options.order === "desc" ? "desc" : "asc";
|
|
282
|
+
const limit = options.limit ?? 1e3;
|
|
283
|
+
const parsed = require_tree_index.parseTreeCursor(options.cursor, true);
|
|
284
|
+
const sorted = [...rows].sort((a, b) => {
|
|
285
|
+
const cmp = require_tree_index.compareTreeSortValues(orderSortValue(a.path, a, orderBy), orderSortValue(b.path, b, orderBy), order);
|
|
286
|
+
if (cmp !== 0) return cmp;
|
|
287
|
+
const at = tieOf(a);
|
|
288
|
+
const bt = tieOf(b);
|
|
289
|
+
const tieCmp = at === bt ? 0 : at < bt ? -1 : 1;
|
|
290
|
+
return order === "desc" ? -tieCmp : tieCmp;
|
|
291
|
+
});
|
|
292
|
+
const filtered = parsed.kind === "v2" ? sorted.filter((row) => require_tree_index.keysetAfter(orderSortValue(row.path, row, orderBy), tieOf(row), parsed.cursor, order)) : sorted;
|
|
293
|
+
const hasMore = filtered.length > limit;
|
|
294
|
+
const selected = hasMore ? filtered.slice(0, limit) : filtered;
|
|
295
|
+
const last = selected[selected.length - 1];
|
|
296
|
+
return {
|
|
297
|
+
entries: selected,
|
|
298
|
+
hasMore,
|
|
299
|
+
cursor: hasMore && last ? require_tree_index.buildKeysetCursor(orderSortValue(last.path, last, orderBy), tieOf(last)) : void 0
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
async list(prefix, options) {
|
|
303
|
+
const limit = options?.limit ?? 1e3;
|
|
304
|
+
const orderBy = options?.orderBy ?? "path";
|
|
305
|
+
const order = options?.order ?? "asc";
|
|
306
|
+
const cursor = options?.cursor;
|
|
307
|
+
if (!MemoryTreeIndex.VALID_ORDER_BY.has(orderBy)) throw new Error(`Invalid orderBy: ${orderBy}`);
|
|
308
|
+
if (limit === 0) return {
|
|
309
|
+
entries: [],
|
|
310
|
+
hasMore: false
|
|
311
|
+
};
|
|
312
|
+
const matched = [];
|
|
313
|
+
for (const [p, e] of this.entries) if (p.startsWith(prefix)) matched.push({
|
|
314
|
+
path: p,
|
|
315
|
+
entry: e
|
|
316
|
+
});
|
|
317
|
+
matched.sort((a, b) => {
|
|
318
|
+
let cmp;
|
|
319
|
+
if (orderBy === "path") cmp = a.path.localeCompare(b.path);
|
|
320
|
+
else if (orderBy === "name") cmp = require_d1_tree_index.nameOf(a.path).localeCompare(require_d1_tree_index.nameOf(b.path));
|
|
321
|
+
else if (orderBy === "mimeType") cmp = (a.entry.mimeType ?? "").localeCompare(b.entry.mimeType ?? "");
|
|
322
|
+
else cmp = a.entry[orderBy] - b.entry[orderBy];
|
|
323
|
+
return order === "desc" ? -cmp : cmp;
|
|
324
|
+
});
|
|
325
|
+
let filtered = matched;
|
|
326
|
+
if (cursor) filtered = matched.filter((item) => {
|
|
327
|
+
let val;
|
|
328
|
+
if (orderBy === "path") val = item.path;
|
|
329
|
+
else if (orderBy === "name") val = require_d1_tree_index.nameOf(item.path);
|
|
330
|
+
else if (orderBy === "mimeType") val = item.entry.mimeType ?? "";
|
|
331
|
+
else val = item.entry[orderBy];
|
|
332
|
+
const strVal = String(val);
|
|
333
|
+
const stringKey = orderBy === "path" || orderBy === "name" || orderBy === "mimeType";
|
|
334
|
+
if (order === "asc") return stringKey ? strVal > cursor : Number(strVal) > Number(cursor);
|
|
335
|
+
return stringKey ? strVal < cursor : Number(strVal) < Number(cursor);
|
|
336
|
+
});
|
|
337
|
+
const hasMore = filtered.length > limit;
|
|
338
|
+
const selected = hasMore ? filtered.slice(0, limit) : filtered;
|
|
339
|
+
let nextCursor;
|
|
340
|
+
if (hasMore && selected.length > 0) {
|
|
341
|
+
const last = selected[selected.length - 1];
|
|
342
|
+
if (orderBy === "path") nextCursor = last.path;
|
|
343
|
+
else if (orderBy === "name") nextCursor = require_d1_tree_index.nameOf(last.path);
|
|
344
|
+
else if (orderBy === "mimeType") nextCursor = last.entry.mimeType ?? "";
|
|
345
|
+
else nextCursor = String(last.entry[orderBy]);
|
|
346
|
+
}
|
|
347
|
+
return {
|
|
348
|
+
entries: selected.map((s) => ({ path: s.path })),
|
|
349
|
+
hasMore,
|
|
350
|
+
cursor: nextCursor
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
async listEntries(prefix, options) {
|
|
354
|
+
const limit = options?.limit ?? 1e3;
|
|
355
|
+
const orderBy = options?.orderBy ?? "path";
|
|
356
|
+
const order = options?.order ?? "asc";
|
|
357
|
+
if (!MemoryTreeIndex.VALID_ORDER_BY.has(orderBy)) throw new Error(`Invalid orderBy: ${orderBy}`);
|
|
358
|
+
if (limit === 0) return {
|
|
359
|
+
entries: [],
|
|
360
|
+
hasMore: false
|
|
361
|
+
};
|
|
362
|
+
if (options?.orderBy !== void 0) {
|
|
363
|
+
const rows = [];
|
|
364
|
+
for (const [p, e] of this.entries) if (p.startsWith(prefix)) rows.push({
|
|
365
|
+
path: p,
|
|
366
|
+
...e
|
|
367
|
+
});
|
|
368
|
+
return projectContent(this.orderedPage(rows, options, (row) => row.path), options);
|
|
369
|
+
}
|
|
370
|
+
const parsedCursor = require_tree_index.parseTreeCursor(options?.cursor, false);
|
|
371
|
+
const cursor = parsedCursor.kind === "legacy" ? parsedCursor.value : void 0;
|
|
372
|
+
const matched = [];
|
|
373
|
+
for (const [p, e] of this.entries) if (p.startsWith(prefix)) matched.push({
|
|
374
|
+
path: p,
|
|
375
|
+
entry: e
|
|
376
|
+
});
|
|
377
|
+
matched.sort((a, b) => {
|
|
378
|
+
let cmp;
|
|
379
|
+
if (orderBy === "path") cmp = a.path.localeCompare(b.path);
|
|
380
|
+
else if (orderBy === "name") cmp = require_d1_tree_index.nameOf(a.path).localeCompare(require_d1_tree_index.nameOf(b.path));
|
|
381
|
+
else if (orderBy === "mimeType") cmp = (a.entry.mimeType ?? "").localeCompare(b.entry.mimeType ?? "");
|
|
382
|
+
else cmp = a.entry[orderBy] - b.entry[orderBy];
|
|
383
|
+
return order === "desc" ? -cmp : cmp;
|
|
384
|
+
});
|
|
385
|
+
let filtered = matched;
|
|
386
|
+
if (cursor) filtered = matched.filter((item) => {
|
|
387
|
+
let val;
|
|
388
|
+
if (orderBy === "path") val = item.path;
|
|
389
|
+
else if (orderBy === "name") val = require_d1_tree_index.nameOf(item.path);
|
|
390
|
+
else if (orderBy === "mimeType") val = item.entry.mimeType ?? "";
|
|
391
|
+
else val = item.entry[orderBy];
|
|
392
|
+
const strVal = String(val);
|
|
393
|
+
const stringKey = orderBy === "path" || orderBy === "name" || orderBy === "mimeType";
|
|
394
|
+
if (order === "asc") return stringKey ? strVal > cursor : Number(strVal) > Number(cursor);
|
|
395
|
+
return stringKey ? strVal < cursor : Number(strVal) < Number(cursor);
|
|
396
|
+
});
|
|
397
|
+
const hasMore = filtered.length > limit;
|
|
398
|
+
const selected = hasMore ? filtered.slice(0, limit) : filtered;
|
|
399
|
+
let nextCursor;
|
|
400
|
+
if (hasMore && selected.length > 0) {
|
|
401
|
+
const last = selected[selected.length - 1];
|
|
402
|
+
if (orderBy === "path") nextCursor = last.path;
|
|
403
|
+
else if (orderBy === "name") nextCursor = require_d1_tree_index.nameOf(last.path);
|
|
404
|
+
else if (orderBy === "mimeType") nextCursor = last.entry.mimeType ?? "";
|
|
405
|
+
else nextCursor = String(last.entry[orderBy]);
|
|
406
|
+
}
|
|
407
|
+
return {
|
|
408
|
+
entries: selected.map((s) => {
|
|
409
|
+
const e = {
|
|
410
|
+
path: s.path,
|
|
411
|
+
cid: s.entry.cid,
|
|
412
|
+
size: s.entry.size,
|
|
413
|
+
mtime: s.entry.mtime,
|
|
414
|
+
ctime: s.entry.ctime,
|
|
415
|
+
mimeType: s.entry.mimeType
|
|
416
|
+
};
|
|
417
|
+
if (options?.includeContent && s.entry.content !== void 0) e.content = s.entry.content;
|
|
418
|
+
return e;
|
|
419
|
+
}),
|
|
420
|
+
hasMore,
|
|
421
|
+
cursor: nextCursor
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
async hasChildren(prefix) {
|
|
425
|
+
for (const p of this.entries.keys()) if (p.startsWith(prefix)) return true;
|
|
426
|
+
return false;
|
|
427
|
+
}
|
|
428
|
+
async count(prefix) {
|
|
429
|
+
let n = 0;
|
|
430
|
+
for (const p of this.entries.keys()) if (p.startsWith(prefix)) n++;
|
|
431
|
+
return n;
|
|
432
|
+
}
|
|
433
|
+
async deleteByPrefix(prefix, opts) {
|
|
434
|
+
require_changelog_write.validateDeviceId(opts.deviceId);
|
|
435
|
+
const snapshot = [];
|
|
436
|
+
for (const [p, e] of this.entries) if (p.startsWith(prefix)) snapshot.push({
|
|
437
|
+
path: p,
|
|
438
|
+
cid: e.cid
|
|
439
|
+
});
|
|
440
|
+
let n = 0;
|
|
441
|
+
for (const p of [...this.entries.keys()]) if (p.startsWith(prefix)) {
|
|
442
|
+
this.entries.delete(p);
|
|
443
|
+
n++;
|
|
444
|
+
}
|
|
445
|
+
for (const d of [...this.dirEntries.keys()]) if (d.startsWith(prefix)) this.dirEntries.delete(d);
|
|
446
|
+
for (const [k, targetPath] of [...this.dedupIndex]) if (targetPath.startsWith(prefix)) this.dedupIndex.delete(k);
|
|
447
|
+
if (!opts.skipChangelog) {
|
|
448
|
+
const now = opts.mtime ?? Date.now();
|
|
449
|
+
const updatedAt = Date.now();
|
|
450
|
+
for (const row of snapshot) this.pushChangelog({
|
|
451
|
+
seq: this.nextSeq++,
|
|
452
|
+
scope: this.scope,
|
|
453
|
+
path: row.path,
|
|
454
|
+
op: "delete",
|
|
455
|
+
cid: null,
|
|
456
|
+
old_cid: row.cid,
|
|
457
|
+
size: null,
|
|
458
|
+
mtime: now,
|
|
459
|
+
device_id: opts.deviceId
|
|
460
|
+
}, updatedAt);
|
|
461
|
+
if (snapshot.length > 0) this.bumpWatermark(require_changelog_schema.watermarkPrefix(prefix));
|
|
462
|
+
}
|
|
463
|
+
return n;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* THE single source of direct-children candidates — files with their own
|
|
467
|
+
* entry fields/content plus dir rows with the optional `<dir><docFile>`
|
|
468
|
+
* sub-file join. Shared by `listChildren` (join-free form post-T4.3) and
|
|
469
|
+
* `query` (doc surface) so the child-candidate semantics cannot drift —
|
|
470
|
+
* the in-memory mirror of `buildChildrenFrom` in tree-query.ts.
|
|
471
|
+
*/
|
|
472
|
+
collectChildren(parent, docFile) {
|
|
473
|
+
const children = [];
|
|
474
|
+
for (const [p, e] of this.entries) {
|
|
475
|
+
if (require_d1_tree_index.parentOf(p) !== parent) continue;
|
|
476
|
+
const candidate = {
|
|
477
|
+
path: p,
|
|
478
|
+
name: require_d1_tree_index.nameOf(p),
|
|
479
|
+
kind: "file",
|
|
480
|
+
cid: e.cid,
|
|
481
|
+
size: e.size,
|
|
482
|
+
mtime: e.mtime,
|
|
483
|
+
ctime: e.ctime,
|
|
484
|
+
mimeType: e.mimeType,
|
|
485
|
+
content: e.content
|
|
486
|
+
};
|
|
487
|
+
if (e.metadata) candidate.metadata = e.metadata;
|
|
488
|
+
children.push(candidate);
|
|
489
|
+
}
|
|
490
|
+
for (const [dirPath, dirMeta] of this.dirEntries) {
|
|
491
|
+
if (require_d1_tree_index.parentOf(dirPath) !== parent) continue;
|
|
492
|
+
const child = {
|
|
493
|
+
path: dirPath,
|
|
494
|
+
name: require_d1_tree_index.nameOf(dirPath),
|
|
495
|
+
kind: "dir",
|
|
496
|
+
cid: "",
|
|
497
|
+
size: 0,
|
|
498
|
+
mtime: dirMeta.mtime,
|
|
499
|
+
ctime: dirMeta.ctime
|
|
500
|
+
};
|
|
501
|
+
if (docFile) {
|
|
502
|
+
const sub = this.entries.get(dirPath + docFile);
|
|
503
|
+
if (sub?.content !== void 0) {
|
|
504
|
+
child.content = sub.content;
|
|
505
|
+
child.contentCid = sub.cid;
|
|
506
|
+
}
|
|
507
|
+
if (sub?.metadata) child.metadata = sub.metadata;
|
|
508
|
+
}
|
|
509
|
+
children.push(child);
|
|
510
|
+
}
|
|
511
|
+
return children;
|
|
512
|
+
}
|
|
513
|
+
async listChildren(parent, options) {
|
|
514
|
+
const limit = options?.limit ?? 1e3;
|
|
515
|
+
const order = options?.order ?? "asc";
|
|
516
|
+
if (limit === 0) return {
|
|
517
|
+
entries: [],
|
|
518
|
+
hasMore: false
|
|
519
|
+
};
|
|
520
|
+
const children = this.collectChildren(parent).map(({ name: _name, kind: _kind, record: _record, contentCid: _cc, ...row }) => row);
|
|
521
|
+
if (options?.orderBy !== void 0) return projectContent(this.orderedPage(children, options, (row) => require_d1_tree_index.nameOf(row.path)), options);
|
|
522
|
+
const parsedCursor = require_tree_index.parseTreeCursor(options?.cursor, false);
|
|
523
|
+
const cursor = parsedCursor.kind === "legacy" ? parsedCursor.value : void 0;
|
|
524
|
+
children.sort((a, b) => {
|
|
525
|
+
const cmp = require_d1_tree_index.nameOf(a.path).localeCompare(require_d1_tree_index.nameOf(b.path));
|
|
526
|
+
return order === "desc" ? -cmp : cmp;
|
|
527
|
+
});
|
|
528
|
+
let filtered = children;
|
|
529
|
+
if (cursor) filtered = children.filter((item) => {
|
|
530
|
+
const n = require_d1_tree_index.nameOf(item.path);
|
|
531
|
+
return order === "asc" ? n > cursor : n < cursor;
|
|
532
|
+
});
|
|
533
|
+
const hasMore = filtered.length > limit;
|
|
534
|
+
const selected = hasMore ? filtered.slice(0, limit) : filtered;
|
|
535
|
+
return projectContent({
|
|
536
|
+
entries: selected,
|
|
537
|
+
hasMore,
|
|
538
|
+
cursor: hasMore && selected.length > 0 ? require_d1_tree_index.nameOf(selected[selected.length - 1].path) : void 0
|
|
539
|
+
}, options);
|
|
540
|
+
}
|
|
541
|
+
async countChildren(parent) {
|
|
542
|
+
let count = 0;
|
|
543
|
+
for (const p of this.entries.keys()) if (require_d1_tree_index.parentOf(p) === parent) count++;
|
|
544
|
+
for (const dirPath of this.dirEntries.keys()) if (require_d1_tree_index.parentOf(dirPath) === parent) count++;
|
|
545
|
+
return count;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Collection query (afs-collection-query Phase 1) — JS executor over the
|
|
549
|
+
* same candidate set the SQL impls compile (lockstep-tested).
|
|
550
|
+
*/
|
|
551
|
+
async query(parent, spec) {
|
|
552
|
+
return require_tree_query.runTreeQueryInMemory(this.collectChildren(parent, spec.doc).filter((c) => spec.doc ? true : c.kind === "file").map((c) => {
|
|
553
|
+
if (!spec.doc || c.kind === "dir") return {
|
|
554
|
+
...c,
|
|
555
|
+
record: require_tree_query.parseRecordText(c.content)
|
|
556
|
+
};
|
|
557
|
+
return {
|
|
558
|
+
...c,
|
|
559
|
+
content: void 0,
|
|
560
|
+
contentCid: void 0
|
|
561
|
+
};
|
|
562
|
+
}), spec);
|
|
563
|
+
}
|
|
564
|
+
async countChildrenMany(parents) {
|
|
565
|
+
const want = new Set(parents);
|
|
566
|
+
const map = /* @__PURE__ */ new Map();
|
|
567
|
+
const bump = (childPath) => {
|
|
568
|
+
const par = require_d1_tree_index.parentOf(childPath);
|
|
569
|
+
if (want.has(par)) map.set(par, (map.get(par) ?? 0) + 1);
|
|
570
|
+
};
|
|
571
|
+
for (const p of this.entries.keys()) bump(p);
|
|
572
|
+
for (const dirPath of this.dirEntries.keys()) bump(dirPath);
|
|
573
|
+
return map;
|
|
574
|
+
}
|
|
575
|
+
async aggregate(prefix) {
|
|
576
|
+
let fileCount = 0;
|
|
577
|
+
let totalSize = 0;
|
|
578
|
+
for (const [p, e] of this.entries) if (p.startsWith(prefix)) {
|
|
579
|
+
fileCount++;
|
|
580
|
+
totalSize += e.size;
|
|
581
|
+
}
|
|
582
|
+
return {
|
|
583
|
+
fileCount,
|
|
584
|
+
totalSize
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
/** Batch metadata read — loop over get (no IN-merge needed off-CF). */
|
|
588
|
+
async getMany(paths) {
|
|
589
|
+
const map = /* @__PURE__ */ new Map();
|
|
590
|
+
for (const path of paths) map.set(path, await this.get(path));
|
|
591
|
+
return map;
|
|
592
|
+
}
|
|
593
|
+
/** Batch sync fast path — loop reference semantics (conformance-pinned
|
|
594
|
+
* equivalent of the merged D1 implementation). */
|
|
595
|
+
async batchPutEntries(entries, ctx) {
|
|
596
|
+
return require_tree_index.loopBatchPutEntries(this, entries, ctx);
|
|
597
|
+
}
|
|
598
|
+
/** Delete twin of {@link batchPutEntries} (loop reference semantics). */
|
|
599
|
+
async batchDeleteEntries(entries, ctx) {
|
|
600
|
+
return require_tree_index.loopBatchDeleteEntries(this, entries, ctx);
|
|
601
|
+
}
|
|
602
|
+
async putBatch(entries, opts) {
|
|
603
|
+
for (const { path, entry } of entries) await this.put(path, entry, opts);
|
|
604
|
+
}
|
|
605
|
+
async listModifiedSince(prefix, since, options) {
|
|
606
|
+
const limit = options?.limit ?? 1e3;
|
|
607
|
+
const order = options?.order ?? "asc";
|
|
608
|
+
const cursor = options?.cursor;
|
|
609
|
+
if (limit === 0) return {
|
|
610
|
+
entries: [],
|
|
611
|
+
hasMore: false
|
|
612
|
+
};
|
|
613
|
+
const matched = [];
|
|
614
|
+
for (const [p, e] of this.entries) if (p.startsWith(prefix) && e.mtime > since) matched.push({
|
|
615
|
+
path: p,
|
|
616
|
+
...e
|
|
617
|
+
});
|
|
618
|
+
matched.sort((a, b) => {
|
|
619
|
+
const cmp = a.path.localeCompare(b.path);
|
|
620
|
+
return order === "desc" ? -cmp : cmp;
|
|
621
|
+
});
|
|
622
|
+
let filtered = matched;
|
|
623
|
+
if (cursor) filtered = matched.filter((item) => order === "asc" ? item.path > cursor : item.path < cursor);
|
|
624
|
+
const hasMore = filtered.length > limit;
|
|
625
|
+
const selected = hasMore ? filtered.slice(0, limit) : filtered;
|
|
626
|
+
return projectContent({
|
|
627
|
+
entries: selected,
|
|
628
|
+
hasMore,
|
|
629
|
+
cursor: hasMore && selected.length > 0 ? selected[selected.length - 1].path : void 0
|
|
630
|
+
}, options);
|
|
631
|
+
}
|
|
632
|
+
async getMaxSeq() {
|
|
633
|
+
const compactedBelow = await this.getCompactedBelowSeq();
|
|
634
|
+
if (this.changelog.length === 0) return compactedBelow;
|
|
635
|
+
return Math.max(Math.max(...this.changelog.map((r) => r.seq)), compactedBelow);
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Read-auth reference check (design §4.1) — three-way, scoped, optionally
|
|
639
|
+
* prefix-local. See {@link TreeIndex.isReferenced}. This impl is single-scope
|
|
640
|
+
* (every row shares `this.scope`), so the scope filter is implicit; only the
|
|
641
|
+
* path-prefix restriction is applied.
|
|
642
|
+
*/
|
|
643
|
+
async isReferenced(cid, pathPrefix = "") {
|
|
644
|
+
if (!cid) return false;
|
|
645
|
+
for (const [path, entry] of this.entries) if (entry.cid === cid && path.startsWith(pathPrefix)) return true;
|
|
646
|
+
for (const row of this.changelog) {
|
|
647
|
+
if (!row.path.startsWith(pathPrefix)) continue;
|
|
648
|
+
if (row.cid === cid || row.old_cid === cid) return true;
|
|
649
|
+
}
|
|
650
|
+
return false;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Batch read-auth (design §7.2 / §14) — in-memory three-way equivalent to
|
|
654
|
+
* per-cid {@link isReferenced}. No bound-param cap (no sharding), but the
|
|
655
|
+
* result MUST agree cid-for-cid with the SQL backends.
|
|
656
|
+
*/
|
|
657
|
+
async isReferencedMany(cids, pathPrefix = "") {
|
|
658
|
+
const want = new Set(cids.filter((c) => c));
|
|
659
|
+
const referenced = /* @__PURE__ */ new Set();
|
|
660
|
+
if (want.size === 0) return referenced;
|
|
661
|
+
for (const [path, entry] of this.entries) if (entry.cid && want.has(entry.cid) && path.startsWith(pathPrefix)) referenced.add(entry.cid);
|
|
662
|
+
for (const row of this.changelog) {
|
|
663
|
+
if (!row.path.startsWith(pathPrefix)) continue;
|
|
664
|
+
if (row.cid && want.has(row.cid)) referenced.add(row.cid);
|
|
665
|
+
if (row.old_cid && want.has(row.old_cid)) referenced.add(row.old_cid);
|
|
666
|
+
}
|
|
667
|
+
return referenced;
|
|
668
|
+
}
|
|
669
|
+
async getChangelogSince(sinceSeq, limit) {
|
|
670
|
+
const after = this.changelog.filter((r) => r.seq > sinceSeq).sort((a, b) => a.seq - b.seq);
|
|
671
|
+
const safeLimit = limit > 0 ? limit : 0;
|
|
672
|
+
const page = after.slice(0, safeLimit);
|
|
673
|
+
const hasMore = after.length > safeLimit;
|
|
674
|
+
const cursor = page.length > 0 ? page[page.length - 1].seq : sinceSeq;
|
|
675
|
+
return {
|
|
676
|
+
entries: page.map((r) => ({ ...r })),
|
|
677
|
+
hasMore,
|
|
678
|
+
cursor
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
async getCompactedBelowSeq() {
|
|
682
|
+
return 0;
|
|
683
|
+
}
|
|
684
|
+
async listDirtyPaths(options) {
|
|
685
|
+
const now = options.now ?? Date.now();
|
|
686
|
+
const limit = options.limit > 0 ? options.limit : 0;
|
|
687
|
+
if (limit === 0) return [];
|
|
688
|
+
const [lo, hi] = require_prefix_range.prefixRange(options.prefix);
|
|
689
|
+
return [...this.dirtyMap.values()].filter((r) => r.scope === this.scope && r.path >= lo && r.path < hi && r.nextAttemptAt <= now).sort((a, b) => a.nextAttemptAt - b.nextAttemptAt || a.updatedAt - b.updatedAt).slice(0, limit).map((r) => ({
|
|
690
|
+
path: r.path,
|
|
691
|
+
latestSeq: r.latestSeq,
|
|
692
|
+
op: r.op,
|
|
693
|
+
cid: r.cid,
|
|
694
|
+
mtime: r.mtime,
|
|
695
|
+
attempts: r.attempts
|
|
696
|
+
}));
|
|
697
|
+
}
|
|
698
|
+
async ackDirtyPath(path, latestSeq) {
|
|
699
|
+
const key = `${this.scope}\x00${path}`;
|
|
700
|
+
const row = this.dirtyMap.get(key);
|
|
701
|
+
if (row && row.latestSeq === latestSeq) {
|
|
702
|
+
this.dirtyMap.delete(key);
|
|
703
|
+
return true;
|
|
704
|
+
}
|
|
705
|
+
return false;
|
|
706
|
+
}
|
|
707
|
+
async markDirtyPathError(path, latestSeq, error, nextAttemptAt) {
|
|
708
|
+
const key = `${this.scope}\x00${path}`;
|
|
709
|
+
const row = this.dirtyMap.get(key);
|
|
710
|
+
if (row && row.latestSeq === latestSeq) {
|
|
711
|
+
this.dirtyMap.set(key, {
|
|
712
|
+
...row,
|
|
713
|
+
attempts: row.attempts + 1,
|
|
714
|
+
lastError: error,
|
|
715
|
+
nextAttemptAt
|
|
716
|
+
});
|
|
717
|
+
return true;
|
|
718
|
+
}
|
|
719
|
+
return false;
|
|
720
|
+
}
|
|
721
|
+
ensureParentDirs(filePath) {
|
|
722
|
+
const now = Date.now();
|
|
723
|
+
for (const dirPath of require_d1_tree_index.ancestorDirs(filePath)) {
|
|
724
|
+
if (this.dirEntries.has(dirPath)) break;
|
|
725
|
+
this.dirEntries.set(dirPath, {
|
|
726
|
+
ctime: now,
|
|
727
|
+
mtime: now
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
|
|
733
|
+
//#endregion
|
|
734
|
+
exports.MemoryTreeIndex = MemoryTreeIndex;
|