@opendatalabs/personal-server-ts-core 0.0.1-canary.016adf9 → 0.0.1-canary.052d47e
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/dist/api/index.d.ts +361 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +1213 -0
- package/dist/api/index.js.map +1 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +2 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/request.d.ts +28 -0
- package/dist/auth/request.d.ts.map +1 -0
- package/dist/auth/request.js +106 -0
- package/dist/auth/request.js.map +1 -0
- package/dist/client.d.ts +233 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +243 -0
- package/dist/client.js.map +1 -0
- package/dist/config/defaults.d.ts +5 -5
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +3 -5
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/index.d.ts +0 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +0 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/paths.d.ts.map +1 -1
- package/dist/config/paths.js +1 -9
- package/dist/config/paths.js.map +1 -1
- package/dist/contracts/access-logs.d.ts +8 -0
- package/dist/contracts/access-logs.d.ts.map +1 -0
- package/dist/contracts/access-logs.js +7 -0
- package/dist/contracts/access-logs.js.map +1 -0
- package/dist/contracts/auth-device.d.ts +70 -0
- package/dist/contracts/auth-device.d.ts.map +1 -0
- package/dist/contracts/auth-device.js +163 -0
- package/dist/contracts/auth-device.js.map +1 -0
- package/dist/contracts/binary.d.ts +66 -0
- package/dist/contracts/binary.d.ts.map +1 -0
- package/dist/contracts/binary.js +123 -0
- package/dist/contracts/binary.js.map +1 -0
- package/dist/contracts/config.d.ts +5 -0
- package/dist/contracts/config.d.ts.map +1 -0
- package/dist/contracts/config.js +30 -0
- package/dist/contracts/config.js.map +1 -0
- package/dist/contracts/data.d.ts +165 -0
- package/dist/contracts/data.d.ts.map +1 -0
- package/dist/contracts/data.js +371 -0
- package/dist/contracts/data.js.map +1 -0
- package/dist/contracts/grants.d.ts +45 -0
- package/dist/contracts/grants.d.ts.map +1 -0
- package/dist/contracts/grants.js +177 -0
- package/dist/contracts/grants.js.map +1 -0
- package/dist/contracts/http.d.ts +21 -0
- package/dist/contracts/http.d.ts.map +1 -0
- package/dist/contracts/http.js +49 -0
- package/dist/contracts/http.js.map +1 -0
- package/dist/contracts/index.d.ts +16 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +10 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/oauth.d.ts +38 -0
- package/dist/contracts/oauth.d.ts.map +1 -0
- package/dist/contracts/oauth.js +130 -0
- package/dist/contracts/oauth.js.map +1 -0
- package/dist/contracts/sync.d.ts +10 -0
- package/dist/contracts/sync.d.ts.map +1 -0
- package/dist/contracts/sync.js +34 -0
- package/dist/contracts/sync.js.map +1 -0
- package/dist/derivatives/api.d.ts +48 -0
- package/dist/derivatives/api.d.ts.map +1 -0
- package/dist/derivatives/api.js +366 -0
- package/dist/derivatives/api.js.map +1 -0
- package/dist/derivatives/compute.d.ts +106 -0
- package/dist/derivatives/compute.d.ts.map +1 -0
- package/dist/derivatives/compute.js +414 -0
- package/dist/derivatives/compute.js.map +1 -0
- package/dist/derivatives/e2ee/aad.d.ts +22 -0
- package/dist/derivatives/e2ee/aad.d.ts.map +1 -0
- package/dist/derivatives/e2ee/aad.js +32 -0
- package/dist/derivatives/e2ee/aad.js.map +1 -0
- package/dist/derivatives/e2ee/attestation.d.ts +134 -0
- package/dist/derivatives/e2ee/attestation.d.ts.map +1 -0
- package/dist/derivatives/e2ee/attestation.js +248 -0
- package/dist/derivatives/e2ee/attestation.js.map +1 -0
- package/dist/derivatives/e2ee/index.d.ts +6 -0
- package/dist/derivatives/e2ee/index.d.ts.map +1 -0
- package/dist/derivatives/e2ee/index.js +6 -0
- package/dist/derivatives/e2ee/index.js.map +1 -0
- package/dist/derivatives/e2ee/jcs.d.ts +17 -0
- package/dist/derivatives/e2ee/jcs.d.ts.map +1 -0
- package/dist/derivatives/e2ee/jcs.js +55 -0
- package/dist/derivatives/e2ee/jcs.js.map +1 -0
- package/dist/derivatives/e2ee/phala.d.ts +62 -0
- package/dist/derivatives/e2ee/phala.d.ts.map +1 -0
- package/dist/derivatives/e2ee/phala.js +168 -0
- package/dist/derivatives/e2ee/phala.js.map +1 -0
- package/dist/derivatives/e2ee/suite.d.ts +56 -0
- package/dist/derivatives/e2ee/suite.d.ts.map +1 -0
- package/dist/derivatives/e2ee/suite.js +164 -0
- package/dist/derivatives/e2ee/suite.js.map +1 -0
- package/dist/derivatives/index.d.ts +10 -0
- package/dist/derivatives/index.d.ts.map +1 -0
- package/dist/derivatives/index.js +10 -0
- package/dist/derivatives/index.js.map +1 -0
- package/dist/derivatives/inference.d.ts +151 -0
- package/dist/derivatives/inference.d.ts.map +1 -0
- package/dist/derivatives/inference.js +262 -0
- package/dist/derivatives/inference.js.map +1 -0
- package/dist/derivatives/prompt.d.ts +64 -0
- package/dist/derivatives/prompt.d.ts.map +1 -0
- package/dist/derivatives/prompt.js +193 -0
- package/dist/derivatives/prompt.js.map +1 -0
- package/dist/derivatives/registration.d.ts +54 -0
- package/dist/derivatives/registration.d.ts.map +1 -0
- package/dist/derivatives/registration.js +180 -0
- package/dist/derivatives/registration.js.map +1 -0
- package/dist/derivatives/scheduler.d.ts +84 -0
- package/dist/derivatives/scheduler.d.ts.map +1 -0
- package/dist/derivatives/scheduler.js +257 -0
- package/dist/derivatives/scheduler.js.map +1 -0
- package/dist/derivatives/store.d.ts +14 -0
- package/dist/derivatives/store.d.ts.map +1 -0
- package/dist/derivatives/store.js +77 -0
- package/dist/derivatives/store.js.map +1 -0
- package/dist/derivatives/types.d.ts +92 -0
- package/dist/derivatives/types.d.ts.map +1 -0
- package/dist/derivatives/types.js +27 -0
- package/dist/derivatives/types.js.map +1 -0
- package/dist/errors/catalog.d.ts +84 -0
- package/dist/errors/catalog.d.ts.map +1 -1
- package/dist/errors/catalog.js +119 -0
- package/dist/errors/catalog.js.map +1 -1
- package/dist/grants/index.d.ts +2 -4
- package/dist/grants/index.d.ts.map +1 -1
- package/dist/grants/index.js +1 -2
- package/dist/grants/index.js.map +1 -1
- package/dist/keys/index.d.ts +2 -2
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +1 -2
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/public-only-account.d.ts +8 -0
- package/dist/keys/public-only-account.d.ts.map +1 -0
- package/dist/keys/public-only-account.js +21 -0
- package/dist/keys/public-only-account.js.map +1 -0
- package/dist/keys/server-account.d.ts +7 -11
- package/dist/keys/server-account.d.ts.map +1 -1
- package/dist/keys/server-account.js +1 -47
- package/dist/keys/server-account.js.map +1 -1
- package/dist/lineage/attestation.d.ts +42 -0
- package/dist/lineage/attestation.d.ts.map +1 -0
- package/dist/lineage/attestation.js +25 -0
- package/dist/lineage/attestation.js.map +1 -0
- package/dist/lineage/gateway.d.ts +105 -0
- package/dist/lineage/gateway.d.ts.map +1 -0
- package/dist/lineage/gateway.js +242 -0
- package/dist/lineage/gateway.js.map +1 -0
- package/dist/lineage/index.d.ts +5 -0
- package/dist/lineage/index.d.ts.map +1 -0
- package/dist/lineage/index.js +5 -0
- package/dist/lineage/index.js.map +1 -0
- package/dist/lineage/lineage.d.ts +141 -0
- package/dist/lineage/lineage.d.ts.map +1 -0
- package/dist/lineage/lineage.js +255 -0
- package/dist/lineage/lineage.js.map +1 -0
- package/dist/logger/index.d.ts +6 -2
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +2 -6
- package/dist/logger/index.js.map +1 -1
- package/dist/logging/access-log.d.ts +10 -2
- package/dist/logging/access-log.d.ts.map +1 -1
- package/dist/logging/access-log.js +1 -24
- package/dist/logging/access-log.js.map +1 -1
- package/dist/logging/access-reader.d.ts +0 -5
- package/dist/logging/access-reader.d.ts.map +1 -1
- package/dist/logging/access-reader.js +1 -49
- package/dist/logging/access-reader.js.map +1 -1
- package/dist/mcp/activity.d.ts +68 -0
- package/dist/mcp/activity.d.ts.map +1 -0
- package/dist/mcp/activity.js +111 -0
- package/dist/mcp/activity.js.map +1 -0
- package/dist/mcp/builder-registration.d.ts +24 -0
- package/dist/mcp/builder-registration.d.ts.map +1 -0
- package/dist/mcp/builder-registration.js +89 -0
- package/dist/mcp/builder-registration.js.map +1 -0
- package/dist/mcp/connection-api.d.ts +170 -0
- package/dist/mcp/connection-api.d.ts.map +1 -0
- package/dist/mcp/connection-api.js +379 -0
- package/dist/mcp/connection-api.js.map +1 -0
- package/dist/mcp/grantee.d.ts +52 -0
- package/dist/mcp/grantee.d.ts.map +1 -0
- package/dist/mcp/grantee.js +91 -0
- package/dist/mcp/grantee.js.map +1 -0
- package/dist/mcp/index.d.ts +11 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +11 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/read-client.d.ts +174 -0
- package/dist/mcp/read-client.d.ts.map +1 -0
- package/dist/mcp/read-client.js +576 -0
- package/dist/mcp/read-client.js.map +1 -0
- package/dist/mcp/resources.d.ts +37 -0
- package/dist/mcp/resources.d.ts.map +1 -0
- package/dist/mcp/resources.js +114 -0
- package/dist/mcp/resources.js.map +1 -0
- package/dist/mcp/search/index.d.ts +34 -0
- package/dist/mcp/search/index.d.ts.map +1 -0
- package/dist/mcp/search/index.js +156 -0
- package/dist/mcp/search/index.js.map +1 -0
- package/dist/mcp/server.d.ts +53 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +307 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/session.d.ts +160 -0
- package/dist/mcp/session.d.ts.map +1 -0
- package/dist/mcp/session.js +243 -0
- package/dist/mcp/session.js.map +1 -0
- package/dist/mcp/store.d.ts +13 -0
- package/dist/mcp/store.d.ts.map +1 -0
- package/dist/mcp/store.js +98 -0
- package/dist/mcp/store.js.map +1 -0
- package/dist/mcp/tools.d.ts +70 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +1346 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp/types.d.ts +97 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +24 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/payment/index.d.ts +2 -0
- package/dist/payment/index.d.ts.map +1 -0
- package/dist/payment/index.js +2 -0
- package/dist/payment/index.js.map +1 -0
- package/dist/payment/x402.d.ts +155 -0
- package/dist/payment/x402.d.ts.map +1 -0
- package/dist/payment/x402.js +402 -0
- package/dist/payment/x402.js.map +1 -0
- package/dist/policy/data-read.d.ts +32 -0
- package/dist/policy/data-read.d.ts.map +1 -0
- package/dist/policy/data-read.js +128 -0
- package/dist/policy/data-read.js.map +1 -0
- package/dist/policy/data-write.d.ts +69 -0
- package/dist/policy/data-write.d.ts.map +1 -0
- package/dist/policy/data-write.js +131 -0
- package/dist/policy/data-write.js.map +1 -0
- package/dist/policy/index.d.ts +4 -0
- package/dist/policy/index.d.ts.map +1 -0
- package/dist/policy/index.js +4 -0
- package/dist/policy/index.js.map +1 -0
- package/dist/policy/signed-artifacts.d.ts +17 -0
- package/dist/policy/signed-artifacts.d.ts.map +1 -0
- package/dist/policy/signed-artifacts.js +110 -0
- package/dist/policy/signed-artifacts.js.map +1 -0
- package/dist/ports/index.d.ts +239 -0
- package/dist/ports/index.d.ts.map +1 -0
- package/dist/ports/index.js +7 -0
- package/dist/ports/index.js.map +1 -0
- package/dist/schemas/server-config.d.ts +55 -0
- package/dist/schemas/server-config.d.ts.map +1 -1
- package/dist/schemas/server-config.js +107 -4
- package/dist/schemas/server-config.js.map +1 -1
- package/dist/signing/index.d.ts +1 -2
- package/dist/signing/index.d.ts.map +1 -1
- package/dist/signing/index.js +0 -1
- package/dist/signing/index.js.map +1 -1
- package/dist/signing/request-signer.d.ts +10 -2
- package/dist/signing/request-signer.d.ts.map +1 -1
- package/dist/signing/request-signer.js +6 -31
- package/dist/signing/request-signer.js.map +1 -1
- package/dist/signing/signer.d.ts +28 -2
- package/dist/signing/signer.d.ts.map +1 -1
- package/dist/signing/signer.js +32 -13
- package/dist/signing/signer.js.map +1 -1
- package/dist/storage/adapters/index.d.ts +2 -1
- package/dist/storage/adapters/index.d.ts.map +1 -1
- package/dist/storage/adapters/index.js +2 -1
- package/dist/storage/adapters/index.js.map +1 -1
- package/dist/storage/adapters/interface.d.ts +10 -0
- package/dist/storage/adapters/interface.d.ts.map +1 -1
- package/dist/storage/adapters/sdk.d.ts +23 -0
- package/dist/storage/adapters/sdk.d.ts.map +1 -0
- package/dist/storage/adapters/sdk.js +73 -0
- package/dist/storage/adapters/sdk.js.map +1 -0
- package/dist/storage/adapters/vana.d.ts +10 -30
- package/dist/storage/adapters/vana.d.ts.map +1 -1
- package/dist/storage/adapters/vana.js +94 -84
- package/dist/storage/adapters/vana.js.map +1 -1
- package/dist/storage/blocks/build.d.ts +20 -0
- package/dist/storage/blocks/build.d.ts.map +1 -0
- package/dist/storage/blocks/build.js +378 -0
- package/dist/storage/blocks/build.js.map +1 -0
- package/dist/storage/blocks/cursor.d.ts +33 -0
- package/dist/storage/blocks/cursor.d.ts.map +1 -0
- package/dist/storage/blocks/cursor.js +142 -0
- package/dist/storage/blocks/cursor.js.map +1 -0
- package/dist/storage/blocks/errors.d.ts +6 -0
- package/dist/storage/blocks/errors.d.ts.map +1 -0
- package/dist/storage/blocks/errors.js +9 -0
- package/dist/storage/blocks/errors.js.map +1 -0
- package/dist/storage/blocks/index.d.ts +6 -0
- package/dist/storage/blocks/index.d.ts.map +1 -0
- package/dist/storage/blocks/index.js +5 -0
- package/dist/storage/blocks/index.js.map +1 -0
- package/dist/storage/blocks/select.d.ts +29 -0
- package/dist/storage/blocks/select.d.ts.map +1 -0
- package/dist/storage/blocks/select.js +120 -0
- package/dist/storage/blocks/select.js.map +1 -0
- package/dist/storage/blocks/types.d.ts +56 -0
- package/dist/storage/blocks/types.d.ts.map +1 -0
- package/dist/storage/blocks/types.js +2 -0
- package/dist/{grants → storage/blocks}/types.js.map +1 -1
- package/dist/storage/hierarchy/index.d.ts +0 -1
- package/dist/storage/hierarchy/index.d.ts.map +1 -1
- package/dist/storage/hierarchy/index.js +0 -1
- package/dist/storage/hierarchy/index.js.map +1 -1
- package/dist/storage/hierarchy/manager.d.ts +0 -14
- package/dist/storage/hierarchy/manager.d.ts.map +1 -1
- package/dist/storage/hierarchy/manager.js +1 -59
- package/dist/storage/hierarchy/manager.js.map +1 -1
- package/dist/storage/hierarchy/paths.d.ts.map +1 -1
- package/dist/storage/hierarchy/paths.js +11 -4
- package/dist/storage/hierarchy/paths.js.map +1 -1
- package/dist/storage/index/index.d.ts +2 -3
- package/dist/storage/index/index.d.ts.map +1 -1
- package/dist/storage/index/index.js +1 -2
- package/dist/storage/index/index.js.map +1 -1
- package/dist/storage/index/manager.d.ts +32 -6
- package/dist/storage/index/manager.d.ts.map +1 -1
- package/dist/storage/index/manager.js +1 -131
- package/dist/storage/index/manager.js.map +1 -1
- package/dist/storage/index/schema.d.ts +1 -3
- package/dist/storage/index/schema.d.ts.map +1 -1
- package/dist/storage/index/schema.js +1 -26
- package/dist/storage/index/schema.js.map +1 -1
- package/dist/storage/index/types.d.ts +17 -0
- package/dist/storage/index/types.d.ts.map +1 -1
- package/dist/storage/preview.d.ts +12 -0
- package/dist/storage/preview.d.ts.map +1 -0
- package/dist/storage/preview.js +239 -0
- package/dist/storage/preview.js.map +1 -0
- package/dist/sync/cursor.d.ts +5 -7
- package/dist/sync/cursor.d.ts.map +1 -1
- package/dist/sync/cursor.js +1 -18
- package/dist/sync/cursor.js.map +1 -1
- package/dist/sync/data-point-feed.d.ts +35 -0
- package/dist/sync/data-point-feed.d.ts.map +1 -0
- package/dist/sync/data-point-feed.js +122 -0
- package/dist/sync/data-point-feed.js.map +1 -0
- package/dist/sync/data-point-id.d.ts +7 -0
- package/dist/sync/data-point-id.d.ts.map +1 -0
- package/dist/sync/data-point-id.js +16 -0
- package/dist/sync/data-point-id.js.map +1 -0
- package/dist/sync/delete-data-port.d.ts +50 -0
- package/dist/sync/delete-data-port.d.ts.map +1 -0
- package/dist/sync/delete-data-port.js +244 -0
- package/dist/sync/delete-data-port.js.map +1 -0
- package/dist/sync/engine/sync-manager.d.ts +29 -0
- package/dist/sync/engine/sync-manager.d.ts.map +1 -1
- package/dist/sync/engine/sync-manager.js +156 -45
- package/dist/sync/engine/sync-manager.js.map +1 -1
- package/dist/sync/index.d.ts +11 -2
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +8 -1
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/issues.d.ts +55 -0
- package/dist/sync/issues.d.ts.map +1 -0
- package/dist/sync/issues.js +168 -0
- package/dist/sync/issues.js.map +1 -0
- package/dist/sync/pending-blob-deletions.d.ts +29 -0
- package/dist/sync/pending-blob-deletions.d.ts.map +1 -0
- package/dist/sync/pending-blob-deletions.js +116 -0
- package/dist/sync/pending-blob-deletions.js.map +1 -0
- package/dist/sync/retry-memory.d.ts +33 -0
- package/dist/sync/retry-memory.d.ts.map +1 -0
- package/dist/sync/retry-memory.js +68 -0
- package/dist/sync/retry-memory.js.map +1 -0
- package/dist/sync/scope-deletions.d.ts +155 -0
- package/dist/sync/scope-deletions.d.ts.map +1 -0
- package/dist/sync/scope-deletions.js +225 -0
- package/dist/sync/scope-deletions.js.map +1 -0
- package/dist/sync/tombstone.d.ts +27 -0
- package/dist/sync/tombstone.d.ts.map +1 -0
- package/dist/sync/tombstone.js +28 -0
- package/dist/sync/tombstone.js.map +1 -0
- package/dist/sync/types.d.ts +9 -24
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/workers/delete.d.ts +163 -0
- package/dist/sync/workers/delete.d.ts.map +1 -0
- package/dist/sync/workers/delete.js +474 -0
- package/dist/sync/workers/delete.js.map +1 -0
- package/dist/sync/workers/download.d.ts +115 -18
- package/dist/sync/workers/download.d.ts.map +1 -1
- package/dist/sync/workers/download.js +523 -54
- package/dist/sync/workers/download.js.map +1 -1
- package/dist/sync/workers/upload.d.ts +73 -18
- package/dist/sync/workers/upload.d.ts.map +1 -1
- package/dist/sync/workers/upload.js +382 -45
- package/dist/sync/workers/upload.js.map +1 -1
- package/dist/test-utils/e2ee-fixtures.d.ts +94 -0
- package/dist/test-utils/e2ee-fixtures.d.ts.map +1 -0
- package/dist/test-utils/e2ee-fixtures.js +116 -0
- package/dist/test-utils/e2ee-fixtures.js.map +1 -0
- package/dist/test-utils/e2ee-gateway.d.ts +61 -0
- package/dist/test-utils/e2ee-gateway.d.ts.map +1 -0
- package/dist/test-utils/e2ee-gateway.js +248 -0
- package/dist/test-utils/e2ee-gateway.js.map +1 -0
- package/dist/test-utils/index.d.ts +3 -0
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/index.js +3 -0
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/memory-storage.d.ts +12 -0
- package/dist/test-utils/memory-storage.d.ts.map +1 -0
- package/dist/test-utils/memory-storage.js +146 -0
- package/dist/test-utils/memory-storage.js.map +1 -0
- package/dist/test-utils/wallet.d.ts +7 -0
- package/dist/test-utils/wallet.d.ts.map +1 -1
- package/dist/test-utils/wallet.js +51 -27
- package/dist/test-utils/wallet.js.map +1 -1
- package/dist/write/attribution.d.ts +185 -0
- package/dist/write/attribution.d.ts.map +1 -0
- package/dist/write/attribution.js +450 -0
- package/dist/write/attribution.js.map +1 -0
- package/dist/write/authorize.d.ts +77 -0
- package/dist/write/authorize.d.ts.map +1 -0
- package/dist/write/authorize.js +109 -0
- package/dist/write/authorize.js.map +1 -0
- package/dist/write/index.d.ts +5 -0
- package/dist/write/index.d.ts.map +1 -0
- package/dist/write/index.js +5 -0
- package/dist/write/index.js.map +1 -0
- package/dist/write/route.d.ts +61 -0
- package/dist/write/route.d.ts.map +1 -0
- package/dist/write/route.js +132 -0
- package/dist/write/route.js.map +1 -0
- package/dist/write/session.d.ts +96 -0
- package/dist/write/session.d.ts.map +1 -0
- package/dist/write/session.js +136 -0
- package/dist/write/session.js.map +1 -0
- package/package.json +63 -27
- package/dist/auth/web3-signed.d.ts +0 -48
- package/dist/auth/web3-signed.d.ts.map +0 -1
- package/dist/auth/web3-signed.js +0 -110
- package/dist/auth/web3-signed.js.map +0 -1
- package/dist/config/loader.d.ts +0 -8
- package/dist/config/loader.d.ts.map +0 -1
- package/dist/config/loader.js +0 -74
- package/dist/config/loader.js.map +0 -1
- package/dist/gateway/client.d.ts +0 -98
- package/dist/gateway/client.d.ts.map +0 -1
- package/dist/gateway/client.js +0 -171
- package/dist/gateway/client.js.map +0 -1
- package/dist/grants/eip712.d.ts +0 -28
- package/dist/grants/eip712.d.ts.map +0 -1
- package/dist/grants/eip712.js +0 -30
- package/dist/grants/eip712.js.map +0 -1
- package/dist/grants/types.d.ts +0 -29
- package/dist/grants/types.d.ts.map +0 -1
- package/dist/grants/types.js +0 -6
- package/dist/grants/verify.d.ts +0 -24
- package/dist/grants/verify.d.ts.map +0 -1
- package/dist/grants/verify.js +0 -71
- package/dist/grants/verify.js.map +0 -1
- package/dist/keys/derive.d.ts +0 -18
- package/dist/keys/derive.d.ts.map +0 -1
- package/dist/keys/derive.js +0 -43
- package/dist/keys/derive.js.map +0 -1
- package/dist/schemas/data-file.d.ts +0 -20
- package/dist/schemas/data-file.d.ts.map +0 -1
- package/dist/schemas/data-file.js +0 -23
- package/dist/schemas/data-file.js.map +0 -1
- package/dist/scopes/index.d.ts +0 -3
- package/dist/scopes/index.d.ts.map +0 -1
- package/dist/scopes/index.js +0 -3
- package/dist/scopes/index.js.map +0 -1
- package/dist/scopes/match.d.ts +0 -13
- package/dist/scopes/match.d.ts.map +0 -1
- package/dist/scopes/match.js +0 -23
- package/dist/scopes/match.js.map +0 -1
- package/dist/scopes/parse.d.ts +0 -12
- package/dist/scopes/parse.d.ts.map +0 -1
- package/dist/scopes/parse.js +0 -29
- package/dist/scopes/parse.js.map +0 -1
- package/dist/signing/eip712.d.ts +0 -69
- package/dist/signing/eip712.d.ts.map +0 -1
- package/dist/signing/eip712.js +0 -68
- package/dist/signing/eip712.js.map +0 -1
- package/dist/storage/encryption/decrypt.d.ts +0 -10
- package/dist/storage/encryption/decrypt.d.ts.map +0 -1
- package/dist/storage/encryption/decrypt.js +0 -19
- package/dist/storage/encryption/decrypt.js.map +0 -1
- package/dist/storage/encryption/encrypt.d.ts +0 -10
- package/dist/storage/encryption/encrypt.d.ts.map +0 -1
- package/dist/storage/encryption/encrypt.js +0 -19
- package/dist/storage/encryption/encrypt.js.map +0 -1
- package/dist/storage/encryption/index.d.ts +0 -3
- package/dist/storage/encryption/index.d.ts.map +0 -1
- package/dist/storage/encryption/index.js +0 -3
- package/dist/storage/encryption/index.js.map +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block-addressed selection: read exactly the blocks a caller names.
|
|
3
|
+
*
|
|
4
|
+
* Search returns a `blockRef` per hit and the manifest is a table of contents,
|
|
5
|
+
* but without this path a client still has to walk `nextCursor` from the start
|
|
6
|
+
* of the scope to reach a block it already knows the id of. Every storage
|
|
7
|
+
* implementation pages the manifest identically, so the selection loop lives
|
|
8
|
+
* here instead of being copied into each of them.
|
|
9
|
+
*/
|
|
10
|
+
import type { DataBlockManifest, DataBlockWarning, DataScopeBlock } from "./types.js";
|
|
11
|
+
/** Upper bound on block ids honoured in a single block-addressed read. */
|
|
12
|
+
export declare const MAX_SELECTED_BLOCK_IDS = 50;
|
|
13
|
+
export interface SelectScopeBlocksResult {
|
|
14
|
+
blocks: DataScopeBlock[];
|
|
15
|
+
warnings: DataBlockWarning[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Return the requested blocks in the order they were asked for, bounded by
|
|
19
|
+
* `maxBytes`. Ids that are not in the manifest, ids dropped by the id cap, and
|
|
20
|
+
* ids left out because the byte budget ran out are reported as warnings rather
|
|
21
|
+
* than errors — a partially answered selection is still useful.
|
|
22
|
+
*
|
|
23
|
+
* No cursor is produced: the selection order is the caller's, not the
|
|
24
|
+
* manifest's, so a manifest-index cursor could not resume it.
|
|
25
|
+
*/
|
|
26
|
+
export declare function selectScopeBlocksByIds(manifest: DataBlockManifest, blockIds: readonly string[], options: {
|
|
27
|
+
maxBytes: number;
|
|
28
|
+
}, loadBlock: (blockId: string) => Promise<DataScopeBlock | null>): Promise<SelectScopeBlocksResult>;
|
|
29
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/storage/blocks/select.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,0EAA0E;AAC1E,eAAO,MAAM,sBAAsB,KAAK,CAAC;AASzC,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,OAAO,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,EAC7B,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,GAC7D,OAAO,CAAC,uBAAuB,CAAC,CAsElC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block-addressed selection: read exactly the blocks a caller names.
|
|
3
|
+
*
|
|
4
|
+
* Search returns a `blockRef` per hit and the manifest is a table of contents,
|
|
5
|
+
* but without this path a client still has to walk `nextCursor` from the start
|
|
6
|
+
* of the scope to reach a block it already knows the id of. Every storage
|
|
7
|
+
* implementation pages the manifest identically, so the selection loop lives
|
|
8
|
+
* here instead of being copied into each of them.
|
|
9
|
+
*/
|
|
10
|
+
/** Upper bound on block ids honoured in a single block-addressed read. */
|
|
11
|
+
export const MAX_SELECTED_BLOCK_IDS = 50;
|
|
12
|
+
/** Ids listed inline in a warning message before it is summarized by count. */
|
|
13
|
+
const WARNING_ID_SAMPLE = 10;
|
|
14
|
+
const TEXT_PAGE_MEDIA_TYPE = "text/plain; charset=utf-8";
|
|
15
|
+
const textEncoder = new TextEncoder();
|
|
16
|
+
const textDecoder = new TextDecoder();
|
|
17
|
+
/**
|
|
18
|
+
* Return the requested blocks in the order they were asked for, bounded by
|
|
19
|
+
* `maxBytes`. Ids that are not in the manifest, ids dropped by the id cap, and
|
|
20
|
+
* ids left out because the byte budget ran out are reported as warnings rather
|
|
21
|
+
* than errors — a partially answered selection is still useful.
|
|
22
|
+
*
|
|
23
|
+
* No cursor is produced: the selection order is the caller's, not the
|
|
24
|
+
* manifest's, so a manifest-index cursor could not resume it.
|
|
25
|
+
*/
|
|
26
|
+
export async function selectScopeBlocksByIds(manifest, blockIds, options, loadBlock) {
|
|
27
|
+
const maxBytes = Math.max(1, options.maxBytes);
|
|
28
|
+
const refById = new Map(manifest.blocks.map((ref) => [ref.id, ref]));
|
|
29
|
+
const requested = [];
|
|
30
|
+
const seen = new Set();
|
|
31
|
+
let cappedIds = 0;
|
|
32
|
+
for (const blockId of blockIds) {
|
|
33
|
+
if (typeof blockId !== "string" || !blockId || seen.has(blockId))
|
|
34
|
+
continue;
|
|
35
|
+
seen.add(blockId);
|
|
36
|
+
if (requested.length >= MAX_SELECTED_BLOCK_IDS) {
|
|
37
|
+
cappedIds += 1;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
requested.push(blockId);
|
|
41
|
+
}
|
|
42
|
+
const blocks = [];
|
|
43
|
+
const missingIds = [];
|
|
44
|
+
const skippedIds = [];
|
|
45
|
+
const warnings = [];
|
|
46
|
+
let bytes = 0;
|
|
47
|
+
for (let index = 0; index < requested.length; index += 1) {
|
|
48
|
+
const blockId = requested[index];
|
|
49
|
+
const ref = refById.get(blockId);
|
|
50
|
+
if (!ref) {
|
|
51
|
+
missingIds.push(blockId);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
// Mirrors the cursor path: a block that does not fit whole is only sliced
|
|
55
|
+
// when it is the first one in the page, so a caller always makes progress.
|
|
56
|
+
if (blocks.length > 0 && bytes + ref.sizeBytes > maxBytes) {
|
|
57
|
+
skippedIds.push(...requested.slice(index));
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
const block = await loadBlock(blockId);
|
|
61
|
+
if (!block) {
|
|
62
|
+
missingIds.push(blockId);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const page = pageBlock(block, maxBytes - bytes);
|
|
66
|
+
blocks.push(page.block);
|
|
67
|
+
bytes += page.block.sizeBytes;
|
|
68
|
+
if (page.truncated) {
|
|
69
|
+
skippedIds.push(...requested.slice(index + 1));
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (cappedIds > 0) {
|
|
74
|
+
warnings.push({
|
|
75
|
+
code: "block_selection_capped",
|
|
76
|
+
message: `${cappedIds} block ids beyond the ${MAX_SELECTED_BLOCK_IDS} id limit were ignored`,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (missingIds.length > 0) {
|
|
80
|
+
warnings.push({
|
|
81
|
+
code: "block_not_found",
|
|
82
|
+
message: `${missingIds.length} requested block ids are not in this scope: ${summarizeIds(missingIds)}`,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (skippedIds.length > 0) {
|
|
86
|
+
warnings.push({
|
|
87
|
+
code: "block_selection_truncated",
|
|
88
|
+
message: `maxBytes reached; ${skippedIds.length} requested blocks were not returned: ${summarizeIds(skippedIds)}. Request them in a follow-up read.`,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return { blocks, warnings };
|
|
92
|
+
}
|
|
93
|
+
function summarizeIds(ids) {
|
|
94
|
+
const sample = ids.slice(0, WARNING_ID_SAMPLE).join(", ");
|
|
95
|
+
return ids.length > WARNING_ID_SAMPLE
|
|
96
|
+
? `${sample}, ...(${ids.length - WARNING_ID_SAMPLE} more)`
|
|
97
|
+
: sample;
|
|
98
|
+
}
|
|
99
|
+
function pageBlock(block, maxBytes) {
|
|
100
|
+
const text = typeof block.value === "string" ? block.value : JSON.stringify(block.value);
|
|
101
|
+
const bytes = textEncoder.encode(text);
|
|
102
|
+
if (bytes.length <= maxBytes) {
|
|
103
|
+
return { block, truncated: false };
|
|
104
|
+
}
|
|
105
|
+
const end = Math.max(1, maxBytes);
|
|
106
|
+
return {
|
|
107
|
+
block: {
|
|
108
|
+
...block,
|
|
109
|
+
path: `${block.path}[bytes 0:${end}]`,
|
|
110
|
+
mediaType: block.mediaType.startsWith("text/")
|
|
111
|
+
? block.mediaType
|
|
112
|
+
: TEXT_PAGE_MEDIA_TYPE,
|
|
113
|
+
value: textDecoder.decode(bytes.slice(0, end)),
|
|
114
|
+
sizeBytes: end,
|
|
115
|
+
truncated: true,
|
|
116
|
+
},
|
|
117
|
+
truncated: true,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/storage/blocks/select.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAEzC,+EAA+E;AAC/E,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AACzD,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AACtC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAOtC;;;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AK;YACR,IAAI,EAAE,GAAG,KAAK,CAAC,IAAI,YAAY,GAAG,GAAG;YACrC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC;gBAC5C,CAAC,CAAC,KAAK,CAAC,SAAS;gBACjB,CAAC,CAAC,oBAAoB;YACxB,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YAC9C,SAAS,EAAE,GAAG;YACd,SAAS,EAAE,IAAI;SAChB;QACD,SAAS,EAAE,IAAI;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export type ContentKind = "vana-envelope" | "json" | "zip" | "text" | "binary" | "unsupported";
|
|
2
|
+
export interface DataBlockManifest {
|
|
3
|
+
version: 1;
|
|
4
|
+
scope: string;
|
|
5
|
+
collectedAt: string;
|
|
6
|
+
schemaId?: string;
|
|
7
|
+
contentKind: ContentKind;
|
|
8
|
+
rawSizeBytes?: number;
|
|
9
|
+
blocks: DataBlockRef[];
|
|
10
|
+
warnings: DataBlockWarning[];
|
|
11
|
+
}
|
|
12
|
+
export interface DataBlockRef {
|
|
13
|
+
id: string;
|
|
14
|
+
path: string;
|
|
15
|
+
mediaType: string;
|
|
16
|
+
sizeBytes: number;
|
|
17
|
+
itemCount?: number;
|
|
18
|
+
truncated?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface DataBlockWarning {
|
|
21
|
+
code: string;
|
|
22
|
+
message: string;
|
|
23
|
+
fileId?: string;
|
|
24
|
+
path?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ReadScopeBlocksRequest {
|
|
27
|
+
scope: string;
|
|
28
|
+
collectedAt?: string;
|
|
29
|
+
cursor?: string;
|
|
30
|
+
maxBytes?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Read only these blocks, in this order, instead of paging the scope from
|
|
33
|
+
* `cursor`. Ids come from a manifest listing or from a search hit's
|
|
34
|
+
* `blockRef`. When set, `cursor` is ignored and no `nextCursor` is returned;
|
|
35
|
+
* `maxBytes` still bounds the response.
|
|
36
|
+
*/
|
|
37
|
+
blockIds?: string[];
|
|
38
|
+
}
|
|
39
|
+
export interface ReadScopeBlocksResponse {
|
|
40
|
+
scope: string;
|
|
41
|
+
collectedAt: string;
|
|
42
|
+
schemaId?: string;
|
|
43
|
+
contentKind: ContentKind;
|
|
44
|
+
blocks: DataScopeBlock[];
|
|
45
|
+
nextCursor?: string;
|
|
46
|
+
warnings: DataBlockWarning[];
|
|
47
|
+
}
|
|
48
|
+
export interface DataScopeBlock {
|
|
49
|
+
id: string;
|
|
50
|
+
path: string;
|
|
51
|
+
mediaType: string;
|
|
52
|
+
value: unknown;
|
|
53
|
+
sizeBytes: number;
|
|
54
|
+
truncated?: boolean;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/storage/blocks/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GACrB,eAAe,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,aAAa,CAAC;AAEvE,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,CAAC,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/storage/blocks/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { timestampToFilename, filenameToTimestamp, buildDataFilePath, buildScopeDir, generateCollectedAt, } from "./paths.js";
|
|
2
|
-
export { writeDataFile, readDataFile, listVersions, deleteDataFile, deleteAllForScope, } from "./manager.js";
|
|
3
2
|
export type { HierarchyManagerOptions, WriteResult } from "./manager.js";
|
|
4
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/hierarchy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/hierarchy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/storage/hierarchy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,GACpB,MAAM,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/storage/hierarchy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { DataFileEnvelope } from "../../schemas/data-file.js";
|
|
2
1
|
export interface HierarchyManagerOptions {
|
|
3
2
|
dataDir: string;
|
|
4
3
|
}
|
|
@@ -7,17 +6,4 @@ export interface WriteResult {
|
|
|
7
6
|
relativePath: string;
|
|
8
7
|
sizeBytes: number;
|
|
9
8
|
}
|
|
10
|
-
/** Atomic write: mkdir -p, write temp file, rename */
|
|
11
|
-
export declare function writeDataFile(options: HierarchyManagerOptions, envelope: DataFileEnvelope): Promise<WriteResult>;
|
|
12
|
-
/** Read and parse a data file */
|
|
13
|
-
export declare function readDataFile(options: HierarchyManagerOptions, scope: string, collectedAt: string): Promise<DataFileEnvelope>;
|
|
14
|
-
/** List version filenames for a scope, newest first. Empty array if scope dir doesn't exist. */
|
|
15
|
-
export declare function listVersions(options: HierarchyManagerOptions, scope: string): Promise<string[]>;
|
|
16
|
-
/** Delete a single data file */
|
|
17
|
-
export declare function deleteDataFile(options: HierarchyManagerOptions, scope: string, collectedAt: string): Promise<void>;
|
|
18
|
-
/**
|
|
19
|
-
* Delete all files for a scope by removing the scope directory recursively.
|
|
20
|
-
* No-op if directory doesn't exist.
|
|
21
|
-
*/
|
|
22
|
-
export declare function deleteAllForScope(options: HierarchyManagerOptions, scope: string): Promise<void>;
|
|
23
9
|
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/storage/hierarchy/manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/storage/hierarchy/manager.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -1,60 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { dirname, relative } from "node:path";
|
|
3
|
-
import { randomUUID } from "node:crypto";
|
|
4
|
-
import { DataFileEnvelopeSchema } from "../../schemas/data-file.js";
|
|
5
|
-
import { buildDataFilePath, buildScopeDir, filenameToTimestamp, } from "./paths.js";
|
|
6
|
-
/** Atomic write: mkdir -p, write temp file, rename */
|
|
7
|
-
export async function writeDataFile(options, envelope) {
|
|
8
|
-
const filePath = buildDataFilePath(options.dataDir, envelope.scope, envelope.collectedAt);
|
|
9
|
-
const dir = dirname(filePath);
|
|
10
|
-
await mkdir(dir, { recursive: true });
|
|
11
|
-
const content = JSON.stringify(envelope, null, 2);
|
|
12
|
-
const tempPath = filePath + ".tmp." + randomUUID();
|
|
13
|
-
await writeFile(tempPath, content, "utf-8");
|
|
14
|
-
await rename(tempPath, filePath);
|
|
15
|
-
const stats = await stat(filePath);
|
|
16
|
-
return {
|
|
17
|
-
path: filePath,
|
|
18
|
-
relativePath: relative(options.dataDir, filePath),
|
|
19
|
-
sizeBytes: stats.size,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
/** Read and parse a data file */
|
|
23
|
-
export async function readDataFile(options, scope, collectedAt) {
|
|
24
|
-
const filePath = buildDataFilePath(options.dataDir, scope, collectedAt);
|
|
25
|
-
const content = await readFile(filePath, "utf-8");
|
|
26
|
-
return DataFileEnvelopeSchema.parse(JSON.parse(content));
|
|
27
|
-
}
|
|
28
|
-
/** List version filenames for a scope, newest first. Empty array if scope dir doesn't exist. */
|
|
29
|
-
export async function listVersions(options, scope) {
|
|
30
|
-
const scopeDir = buildScopeDir(options.dataDir, scope);
|
|
31
|
-
let entries;
|
|
32
|
-
try {
|
|
33
|
-
entries = await readdir(scopeDir);
|
|
34
|
-
}
|
|
35
|
-
catch (err) {
|
|
36
|
-
if (err.code === "ENOENT") {
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
throw err;
|
|
40
|
-
}
|
|
41
|
-
const jsonFiles = entries
|
|
42
|
-
.filter((f) => f.endsWith(".json"))
|
|
43
|
-
.sort()
|
|
44
|
-
.reverse();
|
|
45
|
-
return jsonFiles.map((f) => filenameToTimestamp(f.replace(".json", "")));
|
|
46
|
-
}
|
|
47
|
-
/** Delete a single data file */
|
|
48
|
-
export async function deleteDataFile(options, scope, collectedAt) {
|
|
49
|
-
const filePath = buildDataFilePath(options.dataDir, scope, collectedAt);
|
|
50
|
-
await unlink(filePath);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Delete all files for a scope by removing the scope directory recursively.
|
|
54
|
-
* No-op if directory doesn't exist.
|
|
55
|
-
*/
|
|
56
|
-
export async function deleteAllForScope(options, scope) {
|
|
57
|
-
const scopeDir = buildScopeDir(options.dataDir, scope);
|
|
58
|
-
await rm(scopeDir, { recursive: true, force: true });
|
|
59
|
-
}
|
|
1
|
+
export {};
|
|
60
2
|
//# sourceMappingURL=manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/storage/hierarchy/manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/storage/hierarchy/manager.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/storage/hierarchy/paths.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/storage/hierarchy/paths.ts"],"names":[],"mappings":"AAEA,sDAAsD;AACtD,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,sDAAsD;AACtD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAS5D;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAClB,MAAM,CAIR;AAED,iCAAiC;AACjC,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAGpE;AAED,uEAAuE;AACvE,wBAAgB,mBAAmB,IAAI,MAAM,CAI5C"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { scopeToPathSegments } from "../../scopes/parse.js";
|
|
1
|
+
import { scopeToPathSegments } from "@opendatalabs/vana-sdk/browser";
|
|
3
2
|
/** "2026-01-21T10:00:00Z" → "2026-01-21T10-00-00Z" */
|
|
4
3
|
export function timestampToFilename(isoTimestamp) {
|
|
5
4
|
return isoTimestamp.replace(/:/g, "-");
|
|
@@ -20,12 +19,12 @@ export function filenameToTimestamp(filename) {
|
|
|
20
19
|
export function buildDataFilePath(baseDir, scope, collectedAt) {
|
|
21
20
|
const segments = scopeToPathSegments(scope);
|
|
22
21
|
const filename = timestampToFilename(collectedAt) + ".json";
|
|
23
|
-
return
|
|
22
|
+
return joinPath(baseDir, ...segments, filename);
|
|
24
23
|
}
|
|
25
24
|
/** Directory path for a scope */
|
|
26
25
|
export function buildScopeDir(baseDir, scope) {
|
|
27
26
|
const segments = scopeToPathSegments(scope);
|
|
28
|
-
return
|
|
27
|
+
return joinPath(baseDir, ...segments);
|
|
29
28
|
}
|
|
30
29
|
/** Generate current UTC timestamp without milliseconds, ending in Z */
|
|
31
30
|
export function generateCollectedAt() {
|
|
@@ -33,4 +32,12 @@ export function generateCollectedAt() {
|
|
|
33
32
|
now.setMilliseconds(0);
|
|
34
33
|
return now.toISOString().replace(".000Z", "Z");
|
|
35
34
|
}
|
|
35
|
+
function joinPath(...parts) {
|
|
36
|
+
const [first = "", ...rest] = parts;
|
|
37
|
+
const prefix = first.startsWith("/") ? "/" : "";
|
|
38
|
+
const segments = [first, ...rest]
|
|
39
|
+
.flatMap((part) => part.split("/"))
|
|
40
|
+
.filter((part) => part.length > 0);
|
|
41
|
+
return prefix + segments.join("/");
|
|
42
|
+
}
|
|
36
43
|
//# sourceMappingURL=paths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../src/storage/hierarchy/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,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M,UAAU,mBAAmB;IACjC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACvB,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,QAAQ,CAAC,GAAG,KAAe;IAClC,MAAM,CAAC,KAAK,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;IACpC,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAChD,MAAM,QAAQ,GAAG,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC;SAC9B,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SAClC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrC,OAAO,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export type { IndexEntry, IndexListOptions } from "./types.js";
|
|
2
|
-
export {
|
|
3
|
-
export { createIndexManager, type IndexManager } from "./manager.js";
|
|
1
|
+
export type { IndexEntry, IndexListOptions, NewIndexEntry, ScopeSummary, } from "./types.js";
|
|
2
|
+
export type { IndexManager } from "./manager.js";
|
|
4
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/index/index.ts"],"names":[],"mappings":"AAAA,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/index/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/storage/index/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/storage/index/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { IndexEntry, IndexListOptions, ScopeSummary } from "./types.js";
|
|
1
|
+
import type { IndexEntry, IndexListOptions, NewIndexEntry, ScopeSummary } from "./types.js";
|
|
3
2
|
export interface IndexManager {
|
|
4
|
-
insert(entry:
|
|
3
|
+
insert(entry: NewIndexEntry): IndexEntry;
|
|
5
4
|
findByPath(path: string): IndexEntry | undefined;
|
|
6
5
|
findByScope(options: IndexListOptions): IndexEntry[];
|
|
7
6
|
findLatestByScope(scope: string): IndexEntry | undefined;
|
|
8
7
|
countByScope(scope: string): number;
|
|
9
8
|
deleteByPath(path: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Delete a row by path ONLY if it is still unsynced (`dataPointId` null).
|
|
11
|
+
* Atomic guard so a row that raced to synced after selection keeps its
|
|
12
|
+
* metadata. Returns true only when an unsynced row was actually removed.
|
|
13
|
+
*/
|
|
14
|
+
deleteUnsyncedByPath(path: string): boolean;
|
|
10
15
|
listDistinctScopes(options?: {
|
|
11
16
|
scopePrefix?: string;
|
|
12
17
|
limit?: number;
|
|
@@ -17,9 +22,12 @@ export interface IndexManager {
|
|
|
17
22
|
};
|
|
18
23
|
findClosestByScope(scope: string, at: string): IndexEntry | undefined;
|
|
19
24
|
findByFileId(fileId: string): IndexEntry | undefined;
|
|
25
|
+
/** Find an index entry by its DPv2 data-point id (download dedup). */
|
|
26
|
+
findByDataPointId(dataPointId: string): IndexEntry | undefined;
|
|
20
27
|
/**
|
|
21
|
-
* Find all index entries where
|
|
22
|
-
* Returns entries ordered by created_at ASC (oldest
|
|
28
|
+
* Find all index entries where dataPointId is null (not yet synced /
|
|
29
|
+
* registered on-chain). Returns entries ordered by created_at ASC (oldest
|
|
30
|
+
* first).
|
|
23
31
|
*/
|
|
24
32
|
findUnsynced(options?: {
|
|
25
33
|
limit?: number;
|
|
@@ -29,9 +37,27 @@ export interface IndexManager {
|
|
|
29
37
|
* @returns true if row was updated, false if path not found
|
|
30
38
|
*/
|
|
31
39
|
updateFileId(path: string, fileId: string): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Returns the highest stored `version` for a scope, or 0 if none. Used by
|
|
42
|
+
* `insert` to derive the next expectedVersion for DPv2 AddData.
|
|
43
|
+
*/
|
|
44
|
+
findLatestVersionByScope(scope: string): number;
|
|
45
|
+
/**
|
|
46
|
+
* Update the dataPointId for an index entry (after successful DPv2
|
|
47
|
+
* registerDataPoint). Sync-worker step that runs alongside fileId update.
|
|
48
|
+
* @returns true if row was updated, false if path not found
|
|
49
|
+
*/
|
|
50
|
+
updateDataPointId(path: string, dataPointId: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Update the DPv2 `version` for an index entry. Used by the upload worker
|
|
53
|
+
* when a registration is rebased onto the registry's live version after a
|
|
54
|
+
* stale-expectedVersion conflict (the blob key embeds the version, so the
|
|
55
|
+
* local row must follow).
|
|
56
|
+
* @returns true if row was updated, false if path not found
|
|
57
|
+
*/
|
|
58
|
+
updateVersion(path: string, version: number): boolean;
|
|
32
59
|
/** Deletes all index entries for a scope. Returns count of deleted rows. */
|
|
33
60
|
deleteByScope(scope: string): number;
|
|
34
61
|
close(): void;
|
|
35
62
|
}
|
|
36
|
-
export declare function createIndexManager(db: Database.Database): IndexManager;
|
|
37
63
|
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/storage/index/manager.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A;KAAE,GAAG,UAAU,EAAE,CAAC;IACzD;;;OAGG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACpD;;;OAGG;IACH,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAChD;;;;OAIG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9D;;;;;;OAMG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IACtD,4EAA4E;IAC5E,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACrC,KAAK,IAAI,IAAI,CAAC;CACf"}
|
|
@@ -1,132 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
return {
|
|
3
|
-
id: row.id,
|
|
4
|
-
fileId: row.file_id,
|
|
5
|
-
path: row.path,
|
|
6
|
-
scope: row.scope,
|
|
7
|
-
collectedAt: row.collected_at,
|
|
8
|
-
createdAt: row.created_at,
|
|
9
|
-
sizeBytes: row.size_bytes,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export function createIndexManager(db) {
|
|
13
|
-
const insertStmt = db.prepare(`INSERT INTO data_files (file_id, path, scope, collected_at, size_bytes)
|
|
14
|
-
VALUES (@file_id, @path, @scope, @collected_at, @size_bytes)`);
|
|
15
|
-
const findByPathStmt = db.prepare("SELECT * FROM data_files WHERE path = @path");
|
|
16
|
-
const findLatestByScopeStmt = db.prepare("SELECT * FROM data_files WHERE scope = @scope ORDER BY collected_at DESC LIMIT 1");
|
|
17
|
-
const countByScopeStmt = db.prepare("SELECT COUNT(*) AS cnt FROM data_files WHERE scope = @scope");
|
|
18
|
-
const deleteByPathStmt = db.prepare("DELETE FROM data_files WHERE path = @path");
|
|
19
|
-
const findClosestByScopeStmt = db.prepare("SELECT * FROM data_files WHERE scope = @scope AND collected_at <= @at ORDER BY collected_at DESC LIMIT 1");
|
|
20
|
-
const findByFileIdStmt = db.prepare("SELECT * FROM data_files WHERE file_id = @file_id");
|
|
21
|
-
const findUnsyncedStmt = db.prepare("SELECT * FROM data_files WHERE file_id IS NULL ORDER BY created_at ASC");
|
|
22
|
-
const findUnsyncedLimitStmt = db.prepare("SELECT * FROM data_files WHERE file_id IS NULL ORDER BY created_at ASC LIMIT @limit");
|
|
23
|
-
const updateFileIdStmt = db.prepare("UPDATE data_files SET file_id = @file_id WHERE path = @path");
|
|
24
|
-
const deleteByScopeStmt = db.prepare("DELETE FROM data_files WHERE scope = @scope");
|
|
25
|
-
return {
|
|
26
|
-
insert(entry) {
|
|
27
|
-
const result = insertStmt.run({
|
|
28
|
-
file_id: entry.fileId,
|
|
29
|
-
path: entry.path,
|
|
30
|
-
scope: entry.scope,
|
|
31
|
-
collected_at: entry.collectedAt,
|
|
32
|
-
size_bytes: entry.sizeBytes,
|
|
33
|
-
});
|
|
34
|
-
const row = db
|
|
35
|
-
.prepare("SELECT * FROM data_files WHERE id = ?")
|
|
36
|
-
.get(result.lastInsertRowid);
|
|
37
|
-
return rowToEntry(row);
|
|
38
|
-
},
|
|
39
|
-
findByPath(path) {
|
|
40
|
-
const row = findByPathStmt.get({ path });
|
|
41
|
-
return row ? rowToEntry(row) : undefined;
|
|
42
|
-
},
|
|
43
|
-
findByScope(options) {
|
|
44
|
-
let sql = "SELECT * FROM data_files";
|
|
45
|
-
const params = {};
|
|
46
|
-
if (options.scope) {
|
|
47
|
-
sql += " WHERE scope = @scope";
|
|
48
|
-
params.scope = options.scope;
|
|
49
|
-
}
|
|
50
|
-
sql += " ORDER BY collected_at DESC";
|
|
51
|
-
if (options.limit !== undefined) {
|
|
52
|
-
sql += " LIMIT @limit";
|
|
53
|
-
params.limit = options.limit;
|
|
54
|
-
}
|
|
55
|
-
if (options.offset !== undefined) {
|
|
56
|
-
sql += " OFFSET @offset";
|
|
57
|
-
params.offset = options.offset;
|
|
58
|
-
}
|
|
59
|
-
const rows = db.prepare(sql).all(params);
|
|
60
|
-
return rows.map(rowToEntry);
|
|
61
|
-
},
|
|
62
|
-
findLatestByScope(scope) {
|
|
63
|
-
const row = findLatestByScopeStmt.get({ scope });
|
|
64
|
-
return row ? rowToEntry(row) : undefined;
|
|
65
|
-
},
|
|
66
|
-
countByScope(scope) {
|
|
67
|
-
const row = countByScopeStmt.get({ scope });
|
|
68
|
-
return row.cnt;
|
|
69
|
-
},
|
|
70
|
-
deleteByPath(path) {
|
|
71
|
-
const result = deleteByPathStmt.run({ path });
|
|
72
|
-
return result.changes > 0;
|
|
73
|
-
},
|
|
74
|
-
listDistinctScopes(options) {
|
|
75
|
-
const hasPrefix = options?.scopePrefix !== undefined && options.scopePrefix !== "";
|
|
76
|
-
const prefix = hasPrefix ? options.scopePrefix + "%" : "%";
|
|
77
|
-
const countRow = db
|
|
78
|
-
.prepare("SELECT COUNT(DISTINCT scope) AS cnt FROM data_files WHERE scope LIKE @prefix")
|
|
79
|
-
.get({ prefix });
|
|
80
|
-
const total = countRow.cnt;
|
|
81
|
-
let sql = "SELECT scope, MAX(collected_at) AS latest_collected_at, COUNT(*) AS version_count FROM data_files WHERE scope LIKE @prefix GROUP BY scope ORDER BY scope ASC";
|
|
82
|
-
const params = { prefix };
|
|
83
|
-
if (options?.limit !== undefined) {
|
|
84
|
-
sql += " LIMIT @limit";
|
|
85
|
-
params.limit = options.limit;
|
|
86
|
-
}
|
|
87
|
-
if (options?.offset !== undefined) {
|
|
88
|
-
sql += " OFFSET @offset";
|
|
89
|
-
params.offset = options.offset;
|
|
90
|
-
}
|
|
91
|
-
const rows = db.prepare(sql).all(params);
|
|
92
|
-
return {
|
|
93
|
-
scopes: rows.map((r) => ({
|
|
94
|
-
scope: r.scope,
|
|
95
|
-
latestCollectedAt: r.latest_collected_at,
|
|
96
|
-
versionCount: r.version_count,
|
|
97
|
-
})),
|
|
98
|
-
total,
|
|
99
|
-
};
|
|
100
|
-
},
|
|
101
|
-
findClosestByScope(scope, at) {
|
|
102
|
-
const row = findClosestByScopeStmt.get({ scope, at });
|
|
103
|
-
return row ? rowToEntry(row) : undefined;
|
|
104
|
-
},
|
|
105
|
-
findByFileId(fileId) {
|
|
106
|
-
const row = findByFileIdStmt.get({ file_id: fileId });
|
|
107
|
-
return row ? rowToEntry(row) : undefined;
|
|
108
|
-
},
|
|
109
|
-
findUnsynced(options) {
|
|
110
|
-
if (options?.limit !== undefined) {
|
|
111
|
-
const rows = findUnsyncedLimitStmt.all({
|
|
112
|
-
limit: options.limit,
|
|
113
|
-
});
|
|
114
|
-
return rows.map(rowToEntry);
|
|
115
|
-
}
|
|
116
|
-
const rows = findUnsyncedStmt.all();
|
|
117
|
-
return rows.map(rowToEntry);
|
|
118
|
-
},
|
|
119
|
-
updateFileId(path, fileId) {
|
|
120
|
-
const result = updateFileIdStmt.run({ file_id: fileId, path });
|
|
121
|
-
return result.changes > 0;
|
|
122
|
-
},
|
|
123
|
-
deleteByScope(scope) {
|
|
124
|
-
const result = deleteByScopeStmt.run({ scope });
|
|
125
|
-
return result.changes;
|
|
126
|
-
},
|
|
127
|
-
close() {
|
|
128
|
-
db.close();
|
|
129
|
-
},
|
|
130
|
-
};
|
|
131
|
-
}
|
|
1
|
+
export {};
|
|
132
2
|
//# sourceMappingURL=manager.js.map
|