@opendatalabs/personal-server-ts-core 0.0.1-canary.00328bf
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 +408 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +1257 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/raw-envelope.d.ts +3 -0
- package/dist/api/raw-envelope.d.ts.map +1 -0
- package/dist/api/raw-envelope.js +215 -0
- package/dist/api/raw-envelope.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 +12 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +12 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +3 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/paths.d.ts +9 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +14 -0
- package/dist/config/paths.js.map +1 -0
- 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 +35 -0
- package/dist/contracts/sync.js.map +1 -0
- package/dist/derivatives/answer-shape.d.ts +83 -0
- package/dist/derivatives/answer-shape.d.ts.map +1 -0
- package/dist/derivatives/answer-shape.js +320 -0
- package/dist/derivatives/answer-shape.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 +374 -0
- package/dist/derivatives/api.js.map +1 -0
- package/dist/derivatives/compute.d.ts +112 -0
- package/dist/derivatives/compute.d.ts.map +1 -0
- package/dist/derivatives/compute.js +476 -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 +11 -0
- package/dist/derivatives/index.d.ts.map +1 -0
- package/dist/derivatives/index.js +11 -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 +99 -0
- package/dist/derivatives/prompt.d.ts.map +1 -0
- package/dist/derivatives/prompt.js +281 -0
- package/dist/derivatives/prompt.js.map +1 -0
- package/dist/derivatives/registration.d.ts +56 -0
- package/dist/derivatives/registration.d.ts.map +1 -0
- package/dist/derivatives/registration.js +187 -0
- package/dist/derivatives/registration.js.map +1 -0
- package/dist/derivatives/scheduler.d.ts +114 -0
- package/dist/derivatives/scheduler.d.ts.map +1 -0
- package/dist/derivatives/scheduler.js +331 -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 +79 -0
- package/dist/derivatives/store.js.map +1 -0
- package/dist/derivatives/types.d.ts +102 -0
- package/dist/derivatives/types.d.ts.map +1 -0
- package/dist/derivatives/types.js +29 -0
- package/dist/derivatives/types.js.map +1 -0
- package/dist/errors/catalog.d.ts +125 -0
- package/dist/errors/catalog.d.ts.map +1 -0
- package/dist/errors/catalog.js +198 -0
- package/dist/errors/catalog.js.map +1 -0
- package/dist/errors/pdpp-catalog.d.ts +36 -0
- package/dist/errors/pdpp-catalog.d.ts.map +1 -0
- package/dist/errors/pdpp-catalog.js +82 -0
- package/dist/errors/pdpp-catalog.js.map +1 -0
- package/dist/grants/index.d.ts +5 -0
- package/dist/grants/index.d.ts.map +1 -0
- package/dist/grants/index.js +6 -0
- package/dist/grants/index.js.map +1 -0
- package/dist/grants/pdpp-binding-store.d.ts +58 -0
- package/dist/grants/pdpp-binding-store.d.ts.map +1 -0
- package/dist/grants/pdpp-binding-store.js +97 -0
- package/dist/grants/pdpp-binding-store.js.map +1 -0
- package/dist/grants/pdpp-binding.d.ts +179 -0
- package/dist/grants/pdpp-binding.d.ts.map +1 -0
- package/dist/grants/pdpp-binding.js +214 -0
- package/dist/grants/pdpp-binding.js.map +1 -0
- package/dist/keys/index.d.ts +3 -0
- package/dist/keys/index.d.ts.map +1 -0
- package/dist/keys/index.js +2 -0
- package/dist/keys/index.js.map +1 -0
- 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 +24 -0
- package/dist/keys/server-account.d.ts.map +1 -0
- package/dist/keys/server-account.js +2 -0
- package/dist/keys/server-account.js.map +1 -0
- 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 +9 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +5 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logging/access-log.d.ts +23 -0
- package/dist/logging/access-log.d.ts.map +1 -0
- package/dist/logging/access-log.js +2 -0
- package/dist/logging/access-log.js.map +1 -0
- package/dist/logging/access-reader.d.ts +14 -0
- package/dist/logging/access-reader.d.ts.map +1 -0
- package/dist/logging/access-reader.js +2 -0
- package/dist/logging/access-reader.js.map +1 -0
- 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 +201 -0
- package/dist/mcp/connection-api.d.ts.map +1 -0
- package/dist/mcp/connection-api.js +506 -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 +12 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +12 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/read-client.d.ts +176 -0
- package/dist/mcp/read-client.d.ts.map +1 -0
- package/dist/mcp/read-client.js +579 -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 +72 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +447 -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 +119 -0
- package/dist/mcp/store.js.map +1 -0
- package/dist/mcp/token-expiry.d.ts +38 -0
- package/dist/mcp/token-expiry.d.ts.map +1 -0
- package/dist/mcp/token-expiry.js +55 -0
- package/dist/mcp/token-expiry.js.map +1 -0
- package/dist/mcp/tools.d.ts +95 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +1381 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp/types.d.ts +135 -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/pdpp/approval.d.ts +182 -0
- package/dist/pdpp/approval.d.ts.map +1 -0
- package/dist/pdpp/approval.js +337 -0
- package/dist/pdpp/approval.js.map +1 -0
- package/dist/pdpp/client-identity.d.ts +88 -0
- package/dist/pdpp/client-identity.d.ts.map +1 -0
- package/dist/pdpp/client-identity.js +183 -0
- package/dist/pdpp/client-identity.js.map +1 -0
- package/dist/pdpp/client-metadata.d.ts +95 -0
- package/dist/pdpp/client-metadata.d.ts.map +1 -0
- package/dist/pdpp/client-metadata.js +96 -0
- package/dist/pdpp/client-metadata.js.map +1 -0
- package/dist/pdpp/declaration.d.ts +118 -0
- package/dist/pdpp/declaration.d.ts.map +1 -0
- package/dist/pdpp/declaration.js +549 -0
- package/dist/pdpp/declaration.js.map +1 -0
- package/dist/pdpp/index.d.ts +35 -0
- package/dist/pdpp/index.d.ts.map +1 -0
- package/dist/pdpp/index.js +22 -0
- package/dist/pdpp/index.js.map +1 -0
- package/dist/pdpp/issuance.d.ts +91 -0
- package/dist/pdpp/issuance.d.ts.map +1 -0
- package/dist/pdpp/issuance.js +124 -0
- package/dist/pdpp/issuance.js.map +1 -0
- package/dist/pdpp/pkce.d.ts +53 -0
- package/dist/pdpp/pkce.d.ts.map +1 -0
- package/dist/pdpp/pkce.js +109 -0
- package/dist/pdpp/pkce.js.map +1 -0
- package/dist/pdpp/redirect.d.ts +60 -0
- package/dist/pdpp/redirect.d.ts.map +1 -0
- package/dist/pdpp/redirect.js +125 -0
- package/dist/pdpp/redirect.js.map +1 -0
- package/dist/pdpp/resolve.d.ts +53 -0
- package/dist/pdpp/resolve.d.ts.map +1 -0
- package/dist/pdpp/resolve.js +218 -0
- package/dist/pdpp/resolve.js.map +1 -0
- package/dist/pdpp/review.d.ts +155 -0
- package/dist/pdpp/review.d.ts.map +1 -0
- package/dist/pdpp/review.js +142 -0
- package/dist/pdpp/review.js.map +1 -0
- package/dist/pdpp/selection.d.ts +43 -0
- package/dist/pdpp/selection.d.ts.map +1 -0
- package/dist/pdpp/selection.js +211 -0
- package/dist/pdpp/selection.js.map +1 -0
- package/dist/pdpp/store.d.ts +204 -0
- package/dist/pdpp/store.d.ts.map +1 -0
- package/dist/pdpp/store.js +501 -0
- package/dist/pdpp/store.js.map +1 -0
- package/dist/pdpp/tokens.d.ts +149 -0
- package/dist/pdpp/tokens.d.ts.map +1 -0
- package/dist/pdpp/tokens.js +387 -0
- package/dist/pdpp/tokens.js.map +1 -0
- package/dist/pdpp/types.d.ts +258 -0
- package/dist/pdpp/types.d.ts.map +1 -0
- package/dist/pdpp/types.js +40 -0
- package/dist/pdpp/types.js.map +1 -0
- package/dist/pdpp-version.d.ts +28 -0
- package/dist/pdpp-version.d.ts.map +1 -0
- package/dist/pdpp-version.js +28 -0
- package/dist/pdpp-version.js.map +1 -0
- package/dist/policy/data-read.d.ts +56 -0
- package/dist/policy/data-read.d.ts.map +1 -0
- package/dist/policy/data-read.js +176 -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 +243 -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/ports/pdpp-auth.d.ts +103 -0
- package/dist/ports/pdpp-auth.d.ts.map +1 -0
- package/dist/ports/pdpp-auth.js +37 -0
- package/dist/ports/pdpp-auth.js.map +1 -0
- package/dist/ports/pdpp-auth.test-utils.d.ts +9 -0
- package/dist/ports/pdpp-auth.test-utils.d.ts.map +1 -0
- package/dist/ports/pdpp-auth.test-utils.js +18 -0
- package/dist/ports/pdpp-auth.test-utils.js.map +1 -0
- package/dist/schemas/server-config.d.ts +190 -0
- package/dist/schemas/server-config.d.ts.map +1 -0
- package/dist/schemas/server-config.js +282 -0
- package/dist/schemas/server-config.js.map +1 -0
- package/dist/signing/index.d.ts +3 -0
- package/dist/signing/index.d.ts.map +1 -0
- package/dist/signing/index.js +3 -0
- package/dist/signing/index.js.map +1 -0
- package/dist/signing/request-signer.d.ts +20 -0
- package/dist/signing/request-signer.d.ts.map +1 -0
- package/dist/signing/request-signer.js +23 -0
- package/dist/signing/request-signer.js.map +1 -0
- package/dist/signing/signer.d.ts +40 -0
- package/dist/signing/signer.d.ts.map +1 -0
- package/dist/signing/signer.js +56 -0
- package/dist/signing/signer.js.map +1 -0
- package/dist/storage/adapters/index.d.ts +4 -0
- package/dist/storage/adapters/index.d.ts.map +1 -0
- package/dist/storage/adapters/index.js +3 -0
- package/dist/storage/adapters/index.js.map +1 -0
- package/dist/storage/adapters/interface.d.ts +57 -0
- package/dist/storage/adapters/interface.d.ts.map +1 -0
- package/dist/storage/adapters/interface.js +2 -0
- package/dist/storage/adapters/interface.js.map +1 -0
- 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 +12 -0
- package/dist/storage/adapters/vana.d.ts.map +1 -0
- package/dist/storage/adapters/vana.js +111 -0
- package/dist/storage/adapters/vana.js.map +1 -0
- 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/storage/blocks/types.js.map +1 -0
- package/dist/storage/hierarchy/index.d.ts +3 -0
- package/dist/storage/hierarchy/index.d.ts.map +1 -0
- package/dist/storage/hierarchy/index.js +2 -0
- package/dist/storage/hierarchy/index.js.map +1 -0
- package/dist/storage/hierarchy/manager.d.ts +9 -0
- package/dist/storage/hierarchy/manager.d.ts.map +1 -0
- package/dist/storage/hierarchy/manager.js +2 -0
- package/dist/storage/hierarchy/manager.js.map +1 -0
- package/dist/storage/hierarchy/paths.d.ts +11 -0
- package/dist/storage/hierarchy/paths.d.ts.map +1 -0
- package/dist/storage/hierarchy/paths.js +43 -0
- package/dist/storage/hierarchy/paths.js.map +1 -0
- package/dist/storage/index/index.d.ts +3 -0
- package/dist/storage/index/index.d.ts.map +1 -0
- package/dist/storage/index/index.js +2 -0
- package/dist/storage/index/index.js.map +1 -0
- package/dist/storage/index/manager.d.ts +63 -0
- package/dist/storage/index/manager.d.ts.map +1 -0
- package/dist/storage/index/manager.js +2 -0
- package/dist/storage/index/manager.js.map +1 -0
- package/dist/storage/index/schema.d.ts +2 -0
- package/dist/storage/index/schema.d.ts.map +1 -0
- package/dist/storage/index/schema.js +2 -0
- package/dist/storage/index/schema.js.map +1 -0
- package/dist/storage/index/types.d.ts +37 -0
- package/dist/storage/index/types.d.ts.map +1 -0
- package/dist/storage/index/types.js +2 -0
- package/dist/storage/index/types.js.map +1 -0
- package/dist/storage/pdpp-records/cursor.d.ts +27 -0
- package/dist/storage/pdpp-records/cursor.d.ts.map +1 -0
- package/dist/storage/pdpp-records/cursor.js +49 -0
- package/dist/storage/pdpp-records/cursor.js.map +1 -0
- package/dist/storage/pdpp-records/enforcement.d.ts +37 -0
- package/dist/storage/pdpp-records/enforcement.d.ts.map +1 -0
- package/dist/storage/pdpp-records/enforcement.js +79 -0
- package/dist/storage/pdpp-records/enforcement.js.map +1 -0
- package/dist/storage/pdpp-records/index.d.ts +8 -0
- package/dist/storage/pdpp-records/index.d.ts.map +1 -0
- package/dist/storage/pdpp-records/index.js +8 -0
- package/dist/storage/pdpp-records/index.js.map +1 -0
- package/dist/storage/pdpp-records/interface.d.ts +49 -0
- package/dist/storage/pdpp-records/interface.d.ts.map +1 -0
- package/dist/storage/pdpp-records/interface.js +2 -0
- package/dist/storage/pdpp-records/interface.js.map +1 -0
- package/dist/storage/pdpp-records/memory-store.d.ts +9 -0
- package/dist/storage/pdpp-records/memory-store.d.ts.map +1 -0
- package/dist/storage/pdpp-records/memory-store.js +0 -0
- package/dist/storage/pdpp-records/memory-store.js.map +1 -0
- package/dist/storage/pdpp-records/record-key.d.ts +52 -0
- package/dist/storage/pdpp-records/record-key.d.ts.map +1 -0
- package/dist/storage/pdpp-records/record-key.js +97 -0
- package/dist/storage/pdpp-records/record-key.js.map +1 -0
- package/dist/storage/pdpp-records/stream-declaration.d.ts +43 -0
- package/dist/storage/pdpp-records/stream-declaration.d.ts.map +1 -0
- package/dist/storage/pdpp-records/stream-declaration.js +17 -0
- package/dist/storage/pdpp-records/stream-declaration.js.map +1 -0
- package/dist/storage/pdpp-records/types.d.ts +93 -0
- package/dist/storage/pdpp-records/types.d.ts.map +1 -0
- package/dist/storage/pdpp-records/types.js +17 -0
- package/dist/storage/pdpp-records/types.js.map +1 -0
- 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 +10 -0
- package/dist/sync/cursor.d.ts.map +1 -0
- package/dist/sync/cursor.js +2 -0
- package/dist/sync/cursor.js.map +1 -0
- 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 +58 -0
- package/dist/sync/engine/sync-manager.d.ts.map +1 -0
- package/dist/sync/engine/sync-manager.js +285 -0
- package/dist/sync/engine/sync-manager.js.map +1 -0
- package/dist/sync/index.d.ts +15 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +14 -0
- package/dist/sync/index.js.map +1 -0
- 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/pdpp-import.d.ts +192 -0
- package/dist/sync/pdpp-import.d.ts.map +1 -0
- package/dist/sync/pdpp-import.js +422 -0
- package/dist/sync/pdpp-import.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 +27 -0
- package/dist/sync/types.d.ts.map +1 -0
- package/dist/sync/types.js +2 -0
- package/dist/sync/types.js.map +1 -0
- 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 +159 -0
- package/dist/sync/workers/download.d.ts.map +1 -0
- package/dist/sync/workers/download.js +731 -0
- package/dist/sync/workers/download.js.map +1 -0
- package/dist/sync/workers/upload.d.ts +98 -0
- package/dist/sync/workers/upload.d.ts.map +1 -0
- package/dist/sync/workers/upload.js +412 -0
- package/dist/sync/workers/upload.js.map +1 -0
- 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 +5 -0
- package/dist/test-utils/index.d.ts.map +1 -0
- package/dist/test-utils/index.js +5 -0
- package/dist/test-utils/index.js.map +1 -0
- 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 +47 -0
- package/dist/test-utils/wallet.d.ts.map +1 -0
- package/dist/test-utils/wallet.js +98 -0
- package/dist/test-utils/wallet.js.map +1 -0
- 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 +175 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { classifySyncFailure, inferPayloadKind, } from "./issues.js";
|
|
2
|
+
export { createSyncManager, } from "./engine/sync-manager.js";
|
|
3
|
+
// The single-data-point download path, exported so an integration test can
|
|
4
|
+
// drive the REAL decrypt-and-index worker end to end rather than restate it.
|
|
5
|
+
export { downloadOne } from "./workers/download.js";
|
|
6
|
+
export { createPdppImporter, isPermanentRejection, normalizeDigest, PDPP_METADATA_KEY, SUPPORTED_PDPP_METADATA_VERSION, } from "./pdpp-import.js";
|
|
7
|
+
export { BLOB_DELETE_BATCH_SIZE, deleteScope, planBlobDeletions, retryPendingBlobDeletions, } from "./workers/delete.js";
|
|
8
|
+
export { createGatewayDataPointFeed, feedFromGatewayClient, } from "./data-point-feed.js";
|
|
9
|
+
export { createGatewayDeleteDataPort, } from "./delete-data-port.js";
|
|
10
|
+
export { createMemoryPendingBlobDeletionStore, createPendingBlobDeletionStore, normalizePendingBlobDeletions, } from "./pending-blob-deletions.js";
|
|
11
|
+
export { computeDataPointId } from "./data-point-id.js";
|
|
12
|
+
export { createScopeDeletionTracker, deletionTimestamp, isEntryCoveredByTombstone, tombstoneVersion, DEFAULT_SCOPE_DELETION_GATEWAY_RETRY_MS, DEFAULT_SCOPE_DELETION_MAX_STALENESS_MS, } from "./scope-deletions.js";
|
|
13
|
+
export { TOMBSTONE_DATA_HASH, TOMBSTONE_METADATA_HASH, isTombstoneRecord, } from "./tombstone.js";
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GAQjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,GAGlB,MAAM,0BAA0B,CAAC;AAKlC,2EAA2E;AAC3E,6EAA6E;AAC7E,OAAO,EAAE,WAAW,EAAuB,MAAM,uBAAuB,CAAC;AACzE,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,+BAA+B,GAShC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EACtB,WAAW,EACX,iBAAiB,EACjB,yBAAyB,GAM1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,GAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,2BAA2B,GAE5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,oCAAoC,EACpC,8BAA8B,EAC9B,6BAA6B,GAE9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,0BAA0B,EAC1B,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,uCAAuC,EACvC,uCAAuC,GAOxC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type SyncFailureStage = "download" | "openpgp_parse" | "decrypt" | "json_parse" | "envelope_validate" | "block_build" | "unknown";
|
|
2
|
+
export type SyncPayloadKind = "openpgp" | "json" | "html" | "empty" | "binary" | "unknown";
|
|
3
|
+
export type SyncFailureDisposition = "deterministic" | "transient";
|
|
4
|
+
export interface SyncFileIssue {
|
|
5
|
+
fileId: string;
|
|
6
|
+
schemaId?: string;
|
|
7
|
+
scope?: string;
|
|
8
|
+
stage: SyncFailureStage;
|
|
9
|
+
errorClass: string;
|
|
10
|
+
message: string;
|
|
11
|
+
payloadKind?: SyncPayloadKind;
|
|
12
|
+
encryptedSizeBytes?: number;
|
|
13
|
+
syncRunId: string;
|
|
14
|
+
firstSeenAt: string;
|
|
15
|
+
lastSeenAt: string;
|
|
16
|
+
disposition: SyncFailureDisposition;
|
|
17
|
+
retryable: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface SyncDownloadFailureTelemetryEvent {
|
|
20
|
+
event: "sync.download.failure";
|
|
21
|
+
syncRunId: string;
|
|
22
|
+
fileId: string;
|
|
23
|
+
schemaId?: string;
|
|
24
|
+
scope?: string;
|
|
25
|
+
stage: SyncFailureStage;
|
|
26
|
+
payloadKind?: SyncPayloadKind;
|
|
27
|
+
encryptedSizeBytes?: number;
|
|
28
|
+
errorClass: string;
|
|
29
|
+
disposition: SyncFailureDisposition;
|
|
30
|
+
retryable: boolean;
|
|
31
|
+
appVersion?: string;
|
|
32
|
+
personalServerVersion?: string;
|
|
33
|
+
storageBackend?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ClassifySyncFailureInput {
|
|
36
|
+
error: unknown;
|
|
37
|
+
fileId: string;
|
|
38
|
+
syncRunId: string;
|
|
39
|
+
stage?: SyncFailureStage;
|
|
40
|
+
schemaId?: string;
|
|
41
|
+
scope?: string;
|
|
42
|
+
payloadKind?: SyncPayloadKind;
|
|
43
|
+
encryptedSizeBytes?: number;
|
|
44
|
+
now?: Date;
|
|
45
|
+
appVersion?: string;
|
|
46
|
+
personalServerVersion?: string;
|
|
47
|
+
storageBackend?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface ClassifiedSyncFailure {
|
|
50
|
+
issue: SyncFileIssue;
|
|
51
|
+
telemetry: SyncDownloadFailureTelemetryEvent;
|
|
52
|
+
}
|
|
53
|
+
export declare function classifySyncFailure(input: ClassifySyncFailureInput): ClassifiedSyncFailure;
|
|
54
|
+
export declare function inferPayloadKind(bytes: Uint8Array | string): SyncPayloadKind;
|
|
55
|
+
//# sourceMappingURL=issues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issues.d.ts","sourceRoot":"","sources":["../../src/sync/issues.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GACxB,UAAU,GACV,eAAe,GACf,SAAS,GACT,YAAY,GACZ,mBAAmB,GACnB,aAAa,GACb,SAAS,CAAC;AAEd,MAAM,MAAM,eAAe,GACzB,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG,WAAW,CAAC;AAEnE,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,gBAAgB,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAA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AAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,eAAe,CAgB5E"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
const DETERMINISTIC_STAGES = new Set([
|
|
2
|
+
"openpgp_parse",
|
|
3
|
+
"decrypt",
|
|
4
|
+
"json_parse",
|
|
5
|
+
"envelope_validate",
|
|
6
|
+
"block_build",
|
|
7
|
+
]);
|
|
8
|
+
// Only statuses that PROVE the blob cannot appear by retrying are
|
|
9
|
+
// deterministic. Everything else — 5xx, Cloudflare 52x, 401/403 auth blips
|
|
10
|
+
// (downloads are Web3Signed off the local clock), 429 — is treated as
|
|
11
|
+
// transient and bounded by the retry memory's attempt cap instead of being
|
|
12
|
+
// permanently quarantined on first sight.
|
|
13
|
+
const DETERMINISTIC_DOWNLOAD_STATUSES = new Set([404, 410]);
|
|
14
|
+
export function classifySyncFailure(input) {
|
|
15
|
+
const stage = input.stage ?? inferStage(input.error);
|
|
16
|
+
const disposition = classifyDisposition(input.error, stage);
|
|
17
|
+
const retryable = disposition === "transient";
|
|
18
|
+
const timestamp = (input.now ?? new Date()).toISOString();
|
|
19
|
+
const errorClass = getErrorClass(input.error);
|
|
20
|
+
const message = getSafeIssueMessage(stage, disposition);
|
|
21
|
+
const issue = {
|
|
22
|
+
fileId: input.fileId,
|
|
23
|
+
schemaId: input.schemaId,
|
|
24
|
+
scope: input.scope,
|
|
25
|
+
stage,
|
|
26
|
+
errorClass,
|
|
27
|
+
message,
|
|
28
|
+
payloadKind: input.payloadKind,
|
|
29
|
+
encryptedSizeBytes: input.encryptedSizeBytes,
|
|
30
|
+
syncRunId: input.syncRunId,
|
|
31
|
+
firstSeenAt: timestamp,
|
|
32
|
+
lastSeenAt: timestamp,
|
|
33
|
+
disposition,
|
|
34
|
+
retryable,
|
|
35
|
+
};
|
|
36
|
+
const telemetry = {
|
|
37
|
+
event: "sync.download.failure",
|
|
38
|
+
syncRunId: input.syncRunId,
|
|
39
|
+
fileId: input.fileId,
|
|
40
|
+
schemaId: input.schemaId,
|
|
41
|
+
scope: input.scope,
|
|
42
|
+
stage,
|
|
43
|
+
payloadKind: input.payloadKind,
|
|
44
|
+
encryptedSizeBytes: input.encryptedSizeBytes,
|
|
45
|
+
errorClass,
|
|
46
|
+
disposition,
|
|
47
|
+
retryable,
|
|
48
|
+
appVersion: input.appVersion,
|
|
49
|
+
personalServerVersion: input.personalServerVersion,
|
|
50
|
+
storageBackend: input.storageBackend,
|
|
51
|
+
};
|
|
52
|
+
return { issue, telemetry };
|
|
53
|
+
}
|
|
54
|
+
export function inferPayloadKind(bytes) {
|
|
55
|
+
const text = typeof bytes === "string"
|
|
56
|
+
? bytes
|
|
57
|
+
: new TextDecoder().decode(bytes.slice(0, 256));
|
|
58
|
+
const trimmed = text.trimStart();
|
|
59
|
+
if (trimmed.length === 0)
|
|
60
|
+
return "empty";
|
|
61
|
+
if (trimmed.startsWith("-----BEGIN PGP MESSAGE-----"))
|
|
62
|
+
return "openpgp";
|
|
63
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("["))
|
|
64
|
+
return "json";
|
|
65
|
+
if (/^<!doctype html\b/i.test(trimmed) || /^<html[\s>]/i.test(trimmed)) {
|
|
66
|
+
return "html";
|
|
67
|
+
}
|
|
68
|
+
if (containsBinaryByte(bytes))
|
|
69
|
+
return "binary";
|
|
70
|
+
return "unknown";
|
|
71
|
+
}
|
|
72
|
+
function classifyDisposition(error, stage) {
|
|
73
|
+
if (stage === "download") {
|
|
74
|
+
const status = getNumericProperty(error, "status") ??
|
|
75
|
+
getNumericProperty(error, "statusCode") ??
|
|
76
|
+
getDownloadStatusFromMessage(error);
|
|
77
|
+
if (status !== undefined) {
|
|
78
|
+
return DETERMINISTIC_DOWNLOAD_STATUSES.has(status)
|
|
79
|
+
? "deterministic"
|
|
80
|
+
: "transient";
|
|
81
|
+
}
|
|
82
|
+
return "transient";
|
|
83
|
+
}
|
|
84
|
+
if (DETERMINISTIC_STAGES.has(stage)) {
|
|
85
|
+
return "deterministic";
|
|
86
|
+
}
|
|
87
|
+
return "transient";
|
|
88
|
+
}
|
|
89
|
+
function inferStage(error) {
|
|
90
|
+
if (error instanceof SyntaxError)
|
|
91
|
+
return "json_parse";
|
|
92
|
+
const name = getStringProperty(error, "name").toLowerCase();
|
|
93
|
+
const message = getRawMessage(error).toLowerCase();
|
|
94
|
+
if (name === "zoderror" || message.includes("zod"))
|
|
95
|
+
return "envelope_validate";
|
|
96
|
+
if (message.includes("decrypt") || message.includes("session key"))
|
|
97
|
+
return "decrypt";
|
|
98
|
+
if (message.includes("openpgp") || message.includes("pgp message")) {
|
|
99
|
+
return "openpgp_parse";
|
|
100
|
+
}
|
|
101
|
+
return "unknown";
|
|
102
|
+
}
|
|
103
|
+
function getErrorClass(error) {
|
|
104
|
+
const name = getStringProperty(error, "name");
|
|
105
|
+
if (name.length > 0)
|
|
106
|
+
return name;
|
|
107
|
+
if (error instanceof Error && error.constructor.name.length > 0) {
|
|
108
|
+
return error.constructor.name;
|
|
109
|
+
}
|
|
110
|
+
return typeof error;
|
|
111
|
+
}
|
|
112
|
+
function getRawMessage(error) {
|
|
113
|
+
if (error instanceof Error)
|
|
114
|
+
return error.message;
|
|
115
|
+
if (typeof error === "string")
|
|
116
|
+
return error;
|
|
117
|
+
const message = getStringProperty(error, "message");
|
|
118
|
+
return message.length > 0 ? message : "Unknown sync failure";
|
|
119
|
+
}
|
|
120
|
+
function getStringProperty(value, key) {
|
|
121
|
+
if (typeof value !== "object" || value === null || !(key in value))
|
|
122
|
+
return "";
|
|
123
|
+
const property = value[key];
|
|
124
|
+
return typeof property === "string" ? property : "";
|
|
125
|
+
}
|
|
126
|
+
// The SDK's StorageError carries the HTTP status only in its message —
|
|
127
|
+
// "vana-storage download failed: 404 Not Found" — with no numeric property.
|
|
128
|
+
// Without this fallback a 404'd blob classifies transient and is retried
|
|
129
|
+
// every sync cycle forever. The anchored "download failed: " prefix mirrors
|
|
130
|
+
// the provider's stable message shape and avoids misreading digits in
|
|
131
|
+
// network-error causes (IPs, ports), which stay transient.
|
|
132
|
+
function getDownloadStatusFromMessage(error) {
|
|
133
|
+
const match = /download failed: ([1-5]\d{2})\b/.exec(getRawMessage(error));
|
|
134
|
+
return match ? Number(match[1]) : undefined;
|
|
135
|
+
}
|
|
136
|
+
function getNumericProperty(value, key) {
|
|
137
|
+
if (typeof value !== "object" || value === null || !(key in value)) {
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
const property = value[key];
|
|
141
|
+
return typeof property === "number" ? property : undefined;
|
|
142
|
+
}
|
|
143
|
+
function containsBinaryByte(bytes) {
|
|
144
|
+
if (typeof bytes === "string")
|
|
145
|
+
return false;
|
|
146
|
+
return bytes.some((byte) => byte === 0 || (byte < 0x09 && byte !== 0x07));
|
|
147
|
+
}
|
|
148
|
+
function getSafeIssueMessage(stage, disposition) {
|
|
149
|
+
switch (stage) {
|
|
150
|
+
case "download":
|
|
151
|
+
return disposition === "transient"
|
|
152
|
+
? "Download failed with a retryable storage or network error"
|
|
153
|
+
: "Download failed with a non-retryable storage response";
|
|
154
|
+
case "openpgp_parse":
|
|
155
|
+
return "Encrypted payload could not be parsed as an OpenPGP message";
|
|
156
|
+
case "decrypt":
|
|
157
|
+
return "Encrypted payload could not be decrypted";
|
|
158
|
+
case "json_parse":
|
|
159
|
+
return "Decrypted payload could not be parsed as JSON";
|
|
160
|
+
case "envelope_validate":
|
|
161
|
+
return "Decrypted JSON did not match the expected envelope shape";
|
|
162
|
+
case "block_build":
|
|
163
|
+
return "Envelope was stored, but bounded block build failed";
|
|
164
|
+
case "unknown":
|
|
165
|
+
return "Sync file failed at an unknown stage";
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=issues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issues.js","sourceRoot":"","sources":["../../src/sync/issues.ts"],"names":[],"mappings":"AAmEA,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAmB;IACrD,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
3
|
+
*
|
|
4
|
+
* The production path already existed end to end: Unity's OwnerDataClient
|
|
5
|
+
* writes an encrypted `DataFileEnvelope` and registers it with the Gateway,
|
|
6
|
+
* and `sync/workers/download.ts` downloads, decrypts and indexes it. What was
|
|
7
|
+
* missing was the last hop — that decrypted envelope reaching the PDPP record
|
|
8
|
+
* store, so a grant-bound client can read it. This module is that hop, and
|
|
9
|
+
* nothing else: it does not fetch, does not decrypt, and does not open a
|
|
10
|
+
* second ingestion surface. There is no web HTTP ingest here by design; the
|
|
11
|
+
* encrypted owner-data transport stays the only way data arrives.
|
|
12
|
+
*
|
|
13
|
+
* Why the metadata lives in `data.$pdpp`
|
|
14
|
+
* -------------------------------------
|
|
15
|
+
* The SDK's `DataFileEnvelopeSchema` accepts only `$schema`, `version`,
|
|
16
|
+
* `scope`, `schemaId`, `collectedAt` and `data`, and STRIPS unknown top-level
|
|
17
|
+
* keys. A `$pdpp` sibling of `scope` would therefore be silently deleted in
|
|
18
|
+
* transit — not rejected, deleted — so the producer nests it inside `data`,
|
|
19
|
+
* the one field whose interior the transport preserves verbatim. That is a
|
|
20
|
+
* transport constraint, not a preference.
|
|
21
|
+
*
|
|
22
|
+
* The consequence this module owns: `$pdpp` is import metadata that arrived
|
|
23
|
+
* inside the payload, so it must be removed before the record is stored.
|
|
24
|
+
* Otherwise every PDPP read would serve back a `$pdpp` blob that is not part
|
|
25
|
+
* of the source's declared schema, and a field projection computed from the
|
|
26
|
+
* declaration would not cover it.
|
|
27
|
+
*
|
|
28
|
+
* What is verified before anything is written
|
|
29
|
+
* -------------------------------------------
|
|
30
|
+
* Every check below is a fail-closed rejection, because the alternative is
|
|
31
|
+
* importing a record whose identity or authority we could not confirm:
|
|
32
|
+
*
|
|
33
|
+
* 1. `$pdpp.version === 1`. An unknown metadata version is refused rather
|
|
34
|
+
* than interpreted under this version's assumptions.
|
|
35
|
+
* 2. The declaration digest is recomputed over the EXACT retained
|
|
36
|
+
* declaration document this deployment booted with, and must equal the
|
|
37
|
+
* digest the producer claims. This is the check that makes the rest
|
|
38
|
+
* meaningful: without it the producer would be asserting its own
|
|
39
|
+
* authority over the stream shape it is being validated against.
|
|
40
|
+
* 3. `scope`, `stream.name` and `primaryKey` must agree with that same
|
|
41
|
+
* declaration, and `record.key` must agree with the payload's actual
|
|
42
|
+
* primary-key values.
|
|
43
|
+
*
|
|
44
|
+
* Only then is `$pdpp` stripped and the record handed to the store.
|
|
45
|
+
*
|
|
46
|
+
* Instance derivation is PS-owned
|
|
47
|
+
* -------------------------------
|
|
48
|
+
* The producer supplies no instance id and must not: an instance handle is a
|
|
49
|
+
* statement about this deployment's connection inventory, which the producer
|
|
50
|
+
* cannot observe. The importer derives it through the same function the
|
|
51
|
+
* authorization and resource servers use, so an imported record is readable
|
|
52
|
+
* under a grant issued for the same source. An id that cannot be derived is a
|
|
53
|
+
* rejection, never an invention.
|
|
54
|
+
*/
|
|
55
|
+
import type { PdppRecordStore, StreamSemantics } from "../storage/pdpp-records/index.js";
|
|
56
|
+
import type { Logger } from "../logger/index.js";
|
|
57
|
+
/** The reserved key carrying PDPP import metadata inside `data`. */
|
|
58
|
+
export declare const PDPP_METADATA_KEY = "$pdpp";
|
|
59
|
+
/** The only `$pdpp.version` this importer understands. */
|
|
60
|
+
export declare const SUPPORTED_PDPP_METADATA_VERSION = 1;
|
|
61
|
+
/**
|
|
62
|
+
* The stream shape the importer validates against, projected from the
|
|
63
|
+
* deployment's retained declaration. Deliberately not the full declaration
|
|
64
|
+
* model: the importer only needs to answer "does this envelope match the
|
|
65
|
+
* document we retained?".
|
|
66
|
+
*/
|
|
67
|
+
export interface ImportStreamShape {
|
|
68
|
+
name: string;
|
|
69
|
+
primaryKey: string[];
|
|
70
|
+
semantics: StreamSemantics;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* One retained declaration, as this deployment booted with it.
|
|
74
|
+
*
|
|
75
|
+
* The digest must be taken over the exact retained bytes, not over a
|
|
76
|
+
* re-serialization of a parsed snapshot. The distinction is the whole point
|
|
77
|
+
* of the check: the authorization store persists a parsed `snapshot_json`,
|
|
78
|
+
* and re-digesting that would produce a different value than the digest
|
|
79
|
+
* recorded at retrieval (key order, whitespace, and fields the parser does
|
|
80
|
+
* not carry). Digesting anything other than the retrieved bytes would be a
|
|
81
|
+
* check that passes against itself while proving nothing about what the
|
|
82
|
+
* producer actually read.
|
|
83
|
+
*/
|
|
84
|
+
export interface RetainedDeclaration {
|
|
85
|
+
sourceId: string;
|
|
86
|
+
version: string;
|
|
87
|
+
/**
|
|
88
|
+
* SHA-256 over the exact retained document, as bare lowercase hex.
|
|
89
|
+
*
|
|
90
|
+
* Passed in already computed rather than hashed here on purpose. This
|
|
91
|
+
* module is bundled into the browser lite runtime, where `node:crypto` does
|
|
92
|
+
* not exist; hashing here would break that build. The server computes it
|
|
93
|
+
* once at boot from the document it read — which is also the only place the
|
|
94
|
+
* original bytes exist — so doing it there costs nothing and keeps this
|
|
95
|
+
* module runtime-agnostic.
|
|
96
|
+
*/
|
|
97
|
+
documentDigest: string;
|
|
98
|
+
streams: ImportStreamShape[];
|
|
99
|
+
}
|
|
100
|
+
export type PdppImportRejectionCode = "no_metadata" | "malformed_metadata" | "unsupported_metadata_version" | "unknown_source" | "digest_mismatch" | "declaration_version_mismatch" | "scope_mismatch" | "unknown_stream" | "primary_key_mismatch" | "semantics_mismatch" | "record_key_mismatch" | "no_instance" | "store_rejected";
|
|
101
|
+
export interface PdppImportRejection {
|
|
102
|
+
code: PdppImportRejectionCode;
|
|
103
|
+
message: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Whether a rejection is a settled verdict about the envelope itself.
|
|
107
|
+
*
|
|
108
|
+
* Callers use this to decide whether re-offering the same envelope later
|
|
109
|
+
* could ever change the answer. Fail-closed by construction: an unrecognized
|
|
110
|
+
* code is treated as transient, so a new failure mode is retried (visibly,
|
|
111
|
+
* with a logged outcome) rather than silently abandoned.
|
|
112
|
+
*/
|
|
113
|
+
export declare function isPermanentRejection(rejection: PdppImportRejection): boolean;
|
|
114
|
+
export type PdppImportOutcome =
|
|
115
|
+
/** Not a PDPP-bearing envelope. Legacy-only, and not an error. */
|
|
116
|
+
{
|
|
117
|
+
status: "skipped";
|
|
118
|
+
}
|
|
119
|
+
/** Imported a new version. */
|
|
120
|
+
| {
|
|
121
|
+
status: "imported";
|
|
122
|
+
instance: string;
|
|
123
|
+
stream: string;
|
|
124
|
+
recordKey: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Verified and already present unchanged. Deliberately distinct from
|
|
128
|
+
* "imported": re-writing it would allocate a new version and publish a
|
|
129
|
+
* spurious `changes_since` entry for a record that did not change.
|
|
130
|
+
*/
|
|
131
|
+
| {
|
|
132
|
+
status: "unchanged";
|
|
133
|
+
instance: string;
|
|
134
|
+
stream: string;
|
|
135
|
+
recordKey: string;
|
|
136
|
+
} | {
|
|
137
|
+
status: "rejected";
|
|
138
|
+
rejection: PdppImportRejection;
|
|
139
|
+
};
|
|
140
|
+
/** The envelope fields this importer reads. */
|
|
141
|
+
export interface ImportableEnvelope {
|
|
142
|
+
scope: string;
|
|
143
|
+
collectedAt: string;
|
|
144
|
+
data: unknown;
|
|
145
|
+
}
|
|
146
|
+
export interface PdppImporterDeps {
|
|
147
|
+
store: PdppRecordStore;
|
|
148
|
+
/** The exact declarations this deployment retained at boot. */
|
|
149
|
+
declarations: RetainedDeclaration[];
|
|
150
|
+
/**
|
|
151
|
+
* PS-owned instance derivation, wired to the same inventory the AS and RS
|
|
152
|
+
* use so an imported record is readable under a grant for that source.
|
|
153
|
+
*/
|
|
154
|
+
instanceFor: (sourceId: string) => string | undefined;
|
|
155
|
+
logger: Logger;
|
|
156
|
+
}
|
|
157
|
+
export interface PdppImporter {
|
|
158
|
+
/** Import one decrypted envelope. Never throws; failures are outcomes. */
|
|
159
|
+
importEnvelope(envelope: ImportableEnvelope): PdppImportOutcome;
|
|
160
|
+
/**
|
|
161
|
+
* Whether re-offering this already-indexed (scope, collectedAt) could still
|
|
162
|
+
* change anything.
|
|
163
|
+
*
|
|
164
|
+
* The retry path uses this to decide whether reading the envelope back off
|
|
165
|
+
* disk is worth doing at all. It answers false once an offer for that exact
|
|
166
|
+
* version has settled — imported, verified-unchanged, permanently rejected,
|
|
167
|
+
* or found to carry no `$pdpp` — because none of those can be changed by
|
|
168
|
+
* looking again. It answers true for a version never offered, and for one
|
|
169
|
+
* whose last attempt failed transiently.
|
|
170
|
+
*
|
|
171
|
+
* Deliberately in-memory and process-scoped. The answers it caches are all
|
|
172
|
+
* re-derivable: after a restart the first cycle re-reads each entry once and
|
|
173
|
+
* re-settles it. Persisting them would add schema and a migration to avoid
|
|
174
|
+
* a single bounded read per entry per boot, and would risk a stale "settled"
|
|
175
|
+
* row outliving the condition that produced it — the exact class of bug this
|
|
176
|
+
* whole retry path exists to fix.
|
|
177
|
+
*/
|
|
178
|
+
needsRetry(scope: string, collectedAt: string): boolean;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Normalize a claimed digest to bare lowercase hex.
|
|
182
|
+
*
|
|
183
|
+
* The producer contract writes `sha256:<hex>`; this repo's
|
|
184
|
+
* `computeDeclarationDigest` returns bare hex with no prefix. Accepting both
|
|
185
|
+
* spellings of the same SHA-256 value keeps the two sides interoperable
|
|
186
|
+
* without either silently coercing the other. Any OTHER algorithm prefix
|
|
187
|
+
* returns null and fails the import: treating `md5:...` as if it were the
|
|
188
|
+
* SHA-256 we computed would turn the digest check into decoration.
|
|
189
|
+
*/
|
|
190
|
+
export declare function normalizeDigest(claimed: string): string | null;
|
|
191
|
+
export declare function createPdppImporter(deps: PdppImporterDeps): PdppImporter;
|
|
192
|
+
//# sourceMappingURL=pdpp-import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdpp-import.d.ts","sourceRoot":"","sources":["../../src/sync/pdpp-import.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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