@decocms/blocks 8.1.0-next.1 → 8.1.0-next.3
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/bin/deco.js +5 -12
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol/assets.d.ts +46 -0
- package/dist/protocol/assets.d.ts.map +1 -0
- package/dist/protocol/assets.js +105 -0
- package/dist/protocol/assets.js.map +1 -0
- package/dist/protocol/canonical.d.ts +8 -0
- package/dist/protocol/canonical.d.ts.map +1 -0
- package/dist/protocol/canonical.js +8 -0
- package/dist/protocol/canonical.js.map +1 -0
- package/dist/protocol/ciphertext.d.ts +7 -0
- package/dist/protocol/ciphertext.d.ts.map +1 -0
- package/dist/protocol/ciphertext.js +7 -0
- package/dist/protocol/ciphertext.js.map +1 -0
- package/dist/protocol/client.d.ts +54 -0
- package/dist/protocol/client.d.ts.map +1 -0
- package/dist/protocol/client.js +104 -0
- package/dist/protocol/client.js.map +1 -0
- package/dist/protocol/conformance/cases/assets.d.ts +3 -0
- package/dist/protocol/conformance/cases/assets.d.ts.map +1 -0
- package/dist/protocol/conformance/cases/assets.js +71 -0
- package/dist/protocol/conformance/cases/assets.js.map +1 -0
- package/dist/protocol/conformance/cases/guards.d.ts +3 -0
- package/dist/protocol/conformance/cases/guards.d.ts.map +1 -0
- package/dist/protocol/conformance/cases/guards.js +265 -0
- package/dist/protocol/conformance/cases/guards.js.map +1 -0
- package/dist/protocol/conformance/cases/reads.d.ts +3 -0
- package/dist/protocol/conformance/cases/reads.d.ts.map +1 -0
- package/dist/protocol/conformance/cases/reads.js +140 -0
- package/dist/protocol/conformance/cases/reads.js.map +1 -0
- package/dist/protocol/conformance/cases/types.d.ts +9 -0
- package/dist/protocol/conformance/cases/types.d.ts.map +1 -0
- package/dist/protocol/conformance/cases/types.js +2 -0
- package/dist/protocol/conformance/cases/types.js.map +1 -0
- package/dist/protocol/conformance/cases/wire.d.ts +3 -0
- package/dist/protocol/conformance/cases/wire.d.ts.map +1 -0
- package/dist/protocol/conformance/cases/wire.js +130 -0
- package/dist/protocol/conformance/cases/wire.js.map +1 -0
- package/dist/protocol/conformance/cases/writes.d.ts +3 -0
- package/dist/protocol/conformance/cases/writes.d.ts.map +1 -0
- package/dist/protocol/conformance/cases/writes.js +278 -0
- package/dist/protocol/conformance/cases/writes.js.map +1 -0
- package/dist/protocol/conformance/contentHashFixtures.d.ts +51 -0
- package/dist/protocol/conformance/contentHashFixtures.d.ts.map +1 -0
- package/dist/protocol/conformance/contentHashFixtures.js +94 -0
- package/dist/protocol/conformance/contentHashFixtures.js.map +1 -0
- package/dist/protocol/conformance/context.d.ts +100 -0
- package/dist/protocol/conformance/context.d.ts.map +1 -0
- package/dist/protocol/conformance/context.js +155 -0
- package/dist/protocol/conformance/context.js.map +1 -0
- package/dist/protocol/conformance/index.d.ts +32 -0
- package/dist/protocol/conformance/index.d.ts.map +1 -0
- package/dist/protocol/conformance/index.js +90 -0
- package/dist/protocol/conformance/index.js.map +1 -0
- package/dist/protocol/errors.d.ts +85 -0
- package/dist/protocol/errors.d.ts.map +1 -0
- package/dist/protocol/errors.js +62 -0
- package/dist/protocol/errors.js.map +1 -0
- package/dist/protocol/index.d.ts +28 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +28 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/protocol/keys.d.ts +101 -0
- package/dist/protocol/keys.d.ts.map +1 -0
- package/dist/protocol/keys.js +223 -0
- package/dist/protocol/keys.js.map +1 -0
- package/dist/protocol/params.d.ts +10 -0
- package/dist/protocol/params.d.ts.map +1 -0
- package/dist/protocol/params.js +54 -0
- package/dist/protocol/params.js.map +1 -0
- package/dist/protocol/secrets.d.ts +22 -0
- package/dist/protocol/secrets.d.ts.map +1 -0
- package/dist/protocol/secrets.js +200 -0
- package/dist/protocol/secrets.js.map +1 -0
- package/dist/protocol/server/assets.d.ts +20 -0
- package/dist/protocol/server/assets.d.ts.map +1 -0
- package/dist/protocol/server/assets.js +77 -0
- package/dist/protocol/server/assets.js.map +1 -0
- package/dist/protocol/server/auth.d.ts +31 -0
- package/dist/protocol/server/auth.d.ts.map +1 -0
- package/dist/protocol/server/auth.js +32 -0
- package/dist/protocol/server/auth.js.map +1 -0
- package/dist/protocol/server/bodyCache.d.ts +28 -0
- package/dist/protocol/server/bodyCache.d.ts.map +1 -0
- package/dist/protocol/server/bodyCache.js +75 -0
- package/dist/protocol/server/bodyCache.js.map +1 -0
- package/dist/protocol/server/content.d.ts +44 -0
- package/dist/protocol/server/content.d.ts.map +1 -0
- package/dist/protocol/server/content.js +132 -0
- package/dist/protocol/server/content.js.map +1 -0
- package/dist/protocol/server/core.d.ts +63 -0
- package/dist/protocol/server/core.d.ts.map +1 -0
- package/dist/protocol/server/core.js +77 -0
- package/dist/protocol/server/core.js.map +1 -0
- package/dist/protocol/server/handler.d.ts +5 -0
- package/dist/protocol/server/handler.d.ts.map +1 -0
- package/dist/protocol/server/handler.js +70 -0
- package/dist/protocol/server/handler.js.map +1 -0
- package/dist/protocol/server/http.d.ts +24 -0
- package/dist/protocol/server/http.d.ts.map +1 -0
- package/dist/protocol/server/http.js +133 -0
- package/dist/protocol/server/http.js.map +1 -0
- package/dist/protocol/server/index.d.ts +11 -0
- package/dist/protocol/server/index.d.ts.map +1 -0
- package/dist/protocol/server/index.js +9 -0
- package/dist/protocol/server/index.js.map +1 -0
- package/dist/protocol/server/methods/apply.d.ts +4 -0
- package/dist/protocol/server/methods/apply.d.ts.map +1 -0
- package/dist/protocol/server/methods/apply.js +275 -0
- package/dist/protocol/server/methods/apply.js.map +1 -0
- package/dist/protocol/server/methods/read.d.ts +14 -0
- package/dist/protocol/server/methods/read.d.ts.map +1 -0
- package/dist/protocol/server/methods/read.js +132 -0
- package/dist/protocol/server/methods/read.js.map +1 -0
- package/dist/protocol/server/rpc.d.ts +7 -0
- package/dist/protocol/server/rpc.d.ts.map +1 -0
- package/dist/protocol/server/rpc.js +115 -0
- package/dist/protocol/server/rpc.js.map +1 -0
- package/dist/protocol/storage/fs/hash.d.ts +8 -0
- package/dist/protocol/storage/fs/hash.d.ts.map +1 -0
- package/dist/protocol/storage/fs/hash.js +20 -0
- package/dist/protocol/storage/fs/hash.js.map +1 -0
- package/dist/protocol/storage/fs/index.d.ts +30 -0
- package/dist/protocol/storage/fs/index.d.ts.map +1 -0
- package/dist/protocol/storage/fs/index.js +301 -0
- package/dist/protocol/storage/fs/index.js.map +1 -0
- package/dist/protocol/storage/fs/lock.d.ts +8 -0
- package/dist/protocol/storage/fs/lock.d.ts.map +1 -0
- package/dist/protocol/storage/fs/lock.js +61 -0
- package/dist/protocol/storage/fs/lock.js.map +1 -0
- package/dist/protocol/storage/fs/transaction.d.ts +19 -0
- package/dist/protocol/storage/fs/transaction.d.ts.map +1 -0
- package/dist/protocol/storage/fs/transaction.js +174 -0
- package/dist/protocol/storage/fs/transaction.js.map +1 -0
- package/dist/protocol/storage/fs/unsupported.d.ts +10 -0
- package/dist/protocol/storage/fs/unsupported.d.ts.map +1 -0
- package/dist/protocol/storage/fs/unsupported.js +4 -0
- package/dist/protocol/storage/fs/unsupported.js.map +1 -0
- package/dist/protocol/storage/memory.d.ts +40 -0
- package/dist/protocol/storage/memory.d.ts.map +1 -0
- package/dist/protocol/storage/memory.js +179 -0
- package/dist/protocol/storage/memory.js.map +1 -0
- package/dist/protocol/storage.d.ts +178 -0
- package/dist/protocol/storage.d.ts.map +1 -0
- package/dist/protocol/storage.js +29 -0
- package/dist/protocol/storage.js.map +1 -0
- package/dist/protocol/types.d.ts +194 -0
- package/dist/protocol/types.d.ts.map +1 -0
- package/dist/protocol/types.js +31 -0
- package/dist/protocol/types.js.map +1 -0
- package/dist/v8/analytics.d.ts +31 -0
- package/dist/v8/analytics.d.ts.map +1 -0
- package/dist/v8/analytics.js +46 -0
- package/dist/v8/analytics.js.map +1 -0
- package/dist/v8/background.d.ts +26 -0
- package/dist/v8/background.d.ts.map +1 -0
- package/dist/v8/background.js +95 -0
- package/dist/v8/background.js.map +1 -0
- package/dist/v8/builtins/data.d.ts +15 -0
- package/dist/v8/builtins/data.d.ts.map +1 -0
- package/dist/v8/builtins/data.js +18 -0
- package/dist/v8/builtins/data.js.map +1 -0
- package/dist/v8/builtins/index.d.ts +9 -0
- package/dist/v8/builtins/index.d.ts.map +1 -0
- package/dist/v8/builtins/index.js +24 -0
- package/dist/v8/builtins/index.js.map +1 -0
- package/dist/v8/builtins/lazy.d.ts +17 -0
- package/dist/v8/builtins/lazy.d.ts.map +1 -0
- package/dist/v8/builtins/lazy.js +13 -0
- package/dist/v8/builtins/lazy.js.map +1 -0
- package/dist/v8/builtins/legacy.d.ts +41 -0
- package/dist/v8/builtins/legacy.d.ts.map +1 -0
- package/dist/v8/builtins/legacy.js +62 -0
- package/dist/v8/builtins/legacy.js.map +1 -0
- package/dist/v8/builtins/matchers.d.ts +19 -0
- package/dist/v8/builtins/matchers.d.ts.map +1 -0
- package/dist/v8/builtins/matchers.js +24 -0
- package/dist/v8/builtins/matchers.js.map +1 -0
- package/dist/v8/builtins/multivariate.d.ts +15 -0
- package/dist/v8/builtins/multivariate.d.ts.map +1 -0
- package/dist/v8/builtins/multivariate.js +18 -0
- package/dist/v8/builtins/multivariate.js.map +1 -0
- package/dist/v8/builtins/secret.d.ts +7 -0
- package/dist/v8/builtins/secret.d.ts.map +1 -0
- package/dist/v8/builtins/secret.js +68 -0
- package/dist/v8/builtins/secret.js.map +1 -0
- package/dist/v8/canonical.d.ts +70 -0
- package/dist/v8/canonical.d.ts.map +1 -0
- package/dist/v8/canonical.js +130 -0
- package/dist/v8/canonical.js.map +1 -0
- package/dist/v8/ciphertext.d.ts +58 -0
- package/dist/v8/ciphertext.d.ts.map +1 -0
- package/dist/v8/ciphertext.js +134 -0
- package/dist/v8/ciphertext.js.map +1 -0
- package/dist/v8/cli/builtins.d.ts +11 -0
- package/dist/v8/cli/builtins.d.ts.map +1 -0
- package/dist/v8/cli/builtins.js +18 -0
- package/dist/v8/cli/builtins.js.map +1 -0
- package/dist/v8/cli/check/index.d.ts +41 -0
- package/dist/v8/cli/check/index.d.ts.map +1 -0
- package/dist/v8/cli/check/index.js +713 -0
- package/dist/v8/cli/check/index.js.map +1 -0
- package/dist/v8/cli/check/messages.d.ts +24 -0
- package/dist/v8/cli/check/messages.d.ts.map +1 -0
- package/dist/v8/cli/check/messages.js +150 -0
- package/dist/v8/cli/check/messages.js.map +1 -0
- package/dist/v8/cli/content.d.ts +60 -0
- package/dist/v8/cli/content.d.ts.map +1 -0
- package/dist/v8/cli/content.js +231 -0
- package/dist/v8/cli/content.js.map +1 -0
- package/dist/v8/cli/index.d.ts +18 -0
- package/dist/v8/cli/index.d.ts.map +1 -0
- package/dist/v8/cli/index.js +18 -0
- package/dist/v8/cli/index.js.map +1 -0
- package/dist/v8/cli/log.d.ts +9 -0
- package/dist/v8/cli/log.d.ts.map +1 -0
- package/dist/v8/cli/log.js +11 -0
- package/dist/v8/cli/log.js.map +1 -0
- package/dist/v8/cli/main.d.ts +2 -0
- package/dist/v8/cli/main.d.ts.map +1 -0
- package/dist/v8/cli/main.js +9 -0
- package/dist/v8/cli/main.js.map +1 -0
- package/dist/v8/cli/root.d.ts +28 -0
- package/dist/v8/cli/root.d.ts.map +1 -0
- package/dist/v8/cli/root.js +64 -0
- package/dist/v8/cli/root.js.map +1 -0
- package/dist/v8/cli/run.d.ts +13 -0
- package/dist/v8/cli/run.d.ts.map +1 -0
- package/dist/v8/cli/run.js +210 -0
- package/dist/v8/cli/run.js.map +1 -0
- package/dist/v8/cli/schema/builtinSchemas.d.ts +22 -0
- package/dist/v8/cli/schema/builtinSchemas.d.ts.map +1 -0
- package/dist/v8/cli/schema/builtinSchemas.js +213 -0
- package/dist/v8/cli/schema/builtinSchemas.js.map +1 -0
- package/dist/v8/cli/schema/generate.d.ts +50 -0
- package/dist/v8/cli/schema/generate.d.ts.map +1 -0
- package/dist/v8/cli/schema/generate.js +415 -0
- package/dist/v8/cli/schema/generate.js.map +1 -0
- package/dist/v8/cli/schema/index.d.ts +21 -0
- package/dist/v8/cli/schema/index.d.ts.map +1 -0
- package/dist/v8/cli/schema/index.js +51 -0
- package/dist/v8/cli/schema/index.js.map +1 -0
- package/dist/v8/cli/schema/tsProgram.d.ts +126 -0
- package/dist/v8/cli/schema/tsProgram.d.ts.map +1 -0
- package/dist/v8/cli/schema/tsProgram.js +435 -0
- package/dist/v8/cli/schema/tsProgram.js.map +1 -0
- package/dist/v8/cli/schema/typeToSchema.d.ts +94 -0
- package/dist/v8/cli/schema/typeToSchema.d.ts.map +1 -0
- package/dist/v8/cli/schema/typeToSchema.js +752 -0
- package/dist/v8/cli/schema/typeToSchema.js.map +1 -0
- package/dist/v8/cli/serve/server.d.ts +31 -0
- package/dist/v8/cli/serve/server.d.ts.map +1 -0
- package/dist/v8/cli/serve/server.js +247 -0
- package/dist/v8/cli/serve/server.js.map +1 -0
- package/dist/v8/cli/watch.d.ts +20 -0
- package/dist/v8/cli/watch.d.ts.map +1 -0
- package/dist/v8/cli/watch.js +79 -0
- package/dist/v8/cli/watch.js.map +1 -0
- package/dist/v8/client.d.ts +20 -0
- package/dist/v8/client.d.ts.map +1 -0
- package/dist/v8/client.js +115 -0
- package/dist/v8/client.js.map +1 -0
- package/dist/v8/cms.d.ts +9 -0
- package/dist/v8/cms.d.ts.map +1 -0
- package/dist/v8/cms.js +217 -0
- package/dist/v8/cms.js.map +1 -0
- package/dist/v8/content.d.ts +51 -0
- package/dist/v8/content.d.ts.map +1 -0
- package/dist/v8/content.js +218 -0
- package/dist/v8/content.js.map +1 -0
- package/dist/v8/draft.d.ts +48 -0
- package/dist/v8/draft.d.ts.map +1 -0
- package/dist/v8/draft.js +195 -0
- package/dist/v8/draft.js.map +1 -0
- package/dist/v8/errors.d.ts +21 -0
- package/dist/v8/errors.d.ts.map +1 -0
- package/dist/v8/errors.js +39 -0
- package/dist/v8/errors.js.map +1 -0
- package/dist/v8/fetch.d.ts +26 -0
- package/dist/v8/fetch.d.ts.map +1 -0
- package/dist/v8/fetch.js +98 -0
- package/dist/v8/fetch.js.map +1 -0
- package/dist/v8/identity.d.ts +19 -0
- package/dist/v8/identity.d.ts.map +1 -0
- package/dist/v8/identity.js +54 -0
- package/dist/v8/identity.js.map +1 -0
- package/dist/v8/index.d.ts +11 -0
- package/dist/v8/index.d.ts.map +1 -0
- package/dist/v8/index.js +10 -0
- package/dist/v8/index.js.map +1 -0
- package/dist/v8/json.d.ts +19 -0
- package/dist/v8/json.d.ts.map +1 -0
- package/dist/v8/json.js +65 -0
- package/dist/v8/json.js.map +1 -0
- package/dist/v8/matchRoute.d.ts +30 -0
- package/dist/v8/matchRoute.d.ts.map +1 -0
- package/dist/v8/matchRoute.js +175 -0
- package/dist/v8/matchRoute.js.map +1 -0
- package/dist/v8/remoteLoader.d.ts +16 -0
- package/dist/v8/remoteLoader.d.ts.map +1 -0
- package/dist/v8/remoteLoader.js +427 -0
- package/dist/v8/remoteLoader.js.map +1 -0
- package/dist/v8/resolver.d.ts +34 -0
- package/dist/v8/resolver.d.ts.map +1 -0
- package/dist/v8/resolver.js +219 -0
- package/dist/v8/resolver.js.map +1 -0
- package/dist/v8/secrets.d.ts +9 -0
- package/dist/v8/secrets.d.ts.map +1 -0
- package/dist/v8/secrets.js +14 -0
- package/dist/v8/secrets.js.map +1 -0
- package/dist/v8/telemetry.d.ts +61 -0
- package/dist/v8/telemetry.d.ts.map +1 -0
- package/dist/v8/telemetry.js +460 -0
- package/dist/v8/telemetry.js.map +1 -0
- package/dist/v8/types.d.ts +226 -0
- package/dist/v8/types.d.ts.map +1 -0
- package/dist/v8/types.js +2 -0
- package/dist/v8/types.js.map +1 -0
- package/dist/v8/variants.d.ts +3 -0
- package/dist/v8/variants.d.ts.map +1 -0
- package/dist/v8/variants.js +65 -0
- package/dist/v8/variants.js.map +1 -0
- package/package.json +64 -18
- package/src/index.ts +1 -1
- package/src/protocol/canonical.ts +1 -1
- package/src/protocol/ciphertext.ts +1 -1
- package/src/protocol/client.ts +2 -2
- package/src/protocol/conformance/cases/assets.ts +3 -3
- package/src/protocol/conformance/cases/guards.ts +4 -4
- package/src/protocol/conformance/cases/reads.ts +4 -4
- package/src/protocol/conformance/cases/types.ts +1 -1
- package/src/protocol/conformance/cases/wire.ts +4 -4
- package/src/protocol/conformance/cases/writes.ts +4 -4
- package/src/protocol/conformance/contentHashFixtures.ts +57 -0
- package/src/protocol/conformance/context.ts +4 -4
- package/src/protocol/conformance/index.ts +15 -10
- package/src/protocol/index.ts +14 -7
- package/src/protocol/params.ts +2 -2
- package/src/protocol/secrets.ts +3 -3
- package/src/protocol/server/assets.ts +6 -6
- package/src/protocol/server/auth.ts +1 -1
- package/src/protocol/server/content.ts +5 -5
- package/src/protocol/server/core.ts +12 -6
- package/src/protocol/server/handler.ts +6 -6
- package/src/protocol/server/http.ts +1 -1
- package/src/protocol/server/index.ts +3 -3
- package/src/protocol/server/methods/apply.ts +9 -9
- package/src/protocol/server/methods/read.ts +5 -5
- package/src/protocol/server/rpc.ts +6 -6
- package/src/protocol/storage/fs/index.ts +7 -7
- package/src/protocol/storage/fs/lock.ts +1 -1
- package/src/protocol/storage/fs/unsupported.ts +2 -2
- package/src/protocol/storage/memory.ts +4 -4
- package/src/protocol/storage.ts +1 -1
- package/src/v8/analytics.ts +2 -2
- package/src/v8/builtins/data.ts +1 -1
- package/src/v8/builtins/index.ts +6 -6
- package/src/v8/builtins/lazy.ts +1 -1
- package/src/v8/builtins/legacy.ts +1 -1
- package/src/v8/builtins/multivariate.ts +1 -1
- package/src/v8/builtins/secret.ts +2 -2
- package/src/v8/canonical.ts +36 -0
- package/src/v8/cli/builtins.ts +2 -2
- package/src/v8/cli/check/index.ts +11 -11
- package/src/v8/cli/content.ts +6 -6
- package/src/v8/cli/index.ts +7 -7
- package/src/v8/cli/main.ts +1 -1
- package/src/v8/cli/run.ts +7 -7
- package/src/v8/cli/schema/builtinSchemas.ts +1 -1
- package/src/v8/cli/schema/generate.ts +8 -7
- package/src/v8/cli/schema/index.ts +4 -4
- package/src/v8/cli/schema/tsProgram.ts +18 -1
- package/src/v8/cli/schema/typeToSchema.ts +100 -4
- package/src/v8/cli/serve/server.ts +9 -9
- package/src/v8/client.ts +5 -5
- package/src/v8/cms.ts +23 -11
- package/src/v8/content.ts +58 -22
- package/src/v8/draft.ts +75 -6
- package/src/v8/errors.ts +1 -1
- package/src/v8/fetch.ts +1 -1
- package/src/v8/identity.ts +1 -1
- package/src/v8/index.ts +5 -5
- package/src/v8/matchRoute.ts +1 -1
- package/src/v8/remoteLoader.ts +246 -26
- package/src/v8/resolver.ts +6 -6
- package/src/v8/secrets.ts +1 -1
- package/src/v8/telemetry.ts +5 -5
- package/src/v8/types.ts +14 -1
- package/src/v8/variants.ts +61 -0
|
@@ -19,17 +19,22 @@
|
|
|
19
19
|
* don't apply to an endpoint (a read-only one, one without request keys)
|
|
20
20
|
* skip themselves. Browser-safe: it only needs `fetch`.
|
|
21
21
|
*/
|
|
22
|
-
import { assetCases } from "./cases/assets";
|
|
23
|
-
import { guardCases } from "./cases/guards";
|
|
24
|
-
import { readCases } from "./cases/reads";
|
|
25
|
-
import type { ConformanceCase } from "./cases/types";
|
|
26
|
-
import { wireCases } from "./cases/wire";
|
|
27
|
-
import { writeCases } from "./cases/writes";
|
|
28
|
-
import { ConformanceContext, type ConformanceOptions, SkipCase } from "./context";
|
|
22
|
+
import { assetCases } from "./cases/assets.ts";
|
|
23
|
+
import { guardCases } from "./cases/guards.ts";
|
|
24
|
+
import { readCases } from "./cases/reads.ts";
|
|
25
|
+
import type { ConformanceCase } from "./cases/types.ts";
|
|
26
|
+
import { wireCases } from "./cases/wire.ts";
|
|
27
|
+
import { writeCases } from "./cases/writes.ts";
|
|
28
|
+
import { ConformanceContext, type ConformanceOptions, SkipCase } from "./context.ts";
|
|
29
29
|
|
|
30
|
-
export type { ConformanceCase } from "./cases/types";
|
|
31
|
-
export {
|
|
32
|
-
|
|
30
|
+
export type { ConformanceCase } from "./cases/types.ts";
|
|
31
|
+
export {
|
|
32
|
+
type ContentHashFixture,
|
|
33
|
+
contentHashFixtures,
|
|
34
|
+
type DraftOverlayFixture,
|
|
35
|
+
draftOverlayFixtures,
|
|
36
|
+
} from "./contentHashFixtures.ts";
|
|
37
|
+
export type { ConformanceOptions } from "./context.ts";
|
|
33
38
|
|
|
34
39
|
/** Every conformance case, in the order they run. */
|
|
35
40
|
export const conformanceCases: readonly ConformanceCase[] = [
|
package/src/protocol/index.ts
CHANGED
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
*
|
|
15
15
|
* The SDK's runtime never imports the protocol, so it never reaches an app
|
|
16
16
|
* bundle. The canonical hash it re-exports is the SDK's own dependency-free
|
|
17
|
-
* leaf module (see ./canonical.ts)
|
|
17
|
+
* leaf module (see ./canonical.ts), including the draft overlay hashes
|
|
18
|
+
* (`computeBlockHash`, `computeOverlayVersion`). Draft overlays themselves,
|
|
19
|
+
* preview grants and the draft lifecycle are outside the protocol: overlays
|
|
20
|
+
* are delivery assets (see /next/content-delivery#exact-draft-previews).
|
|
18
21
|
*/
|
|
19
22
|
export {
|
|
20
23
|
APPLY_DIGEST_DOMAIN,
|
|
@@ -22,9 +25,13 @@ export {
|
|
|
22
25
|
CanonicalJsonError,
|
|
23
26
|
CONTENT_HASH_FORMAT,
|
|
24
27
|
canonicalJson,
|
|
28
|
+
computeBlockHash,
|
|
25
29
|
computeContentRevision,
|
|
30
|
+
computeOverlayVersion,
|
|
31
|
+
DRAFT_OVERLAY_FORMAT,
|
|
32
|
+
type DraftOverlay,
|
|
26
33
|
sha256Hex,
|
|
27
|
-
} from "./canonical";
|
|
34
|
+
} from "./canonical.ts";
|
|
28
35
|
export {
|
|
29
36
|
assertSupportedEndpoint,
|
|
30
37
|
type BatchCall,
|
|
@@ -32,8 +39,8 @@ export {
|
|
|
32
39
|
type ContentClient,
|
|
33
40
|
type ContentClientOptions,
|
|
34
41
|
createContentClient,
|
|
35
|
-
} from "./client";
|
|
36
|
-
export * from "./errors";
|
|
37
|
-
export * from "./keys";
|
|
38
|
-
export * from "./storage";
|
|
39
|
-
export * from "./types";
|
|
42
|
+
} from "./client.ts";
|
|
43
|
+
export * from "./errors.ts";
|
|
44
|
+
export * from "./keys.ts";
|
|
45
|
+
export * from "./storage.ts";
|
|
46
|
+
export * from "./types.ts";
|
package/src/protocol/params.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* parsed copy of a record would turn an own `__proto__` key into a prototype.
|
|
8
8
|
*/
|
|
9
9
|
import { z } from "zod";
|
|
10
|
-
import { invalidParams } from "./errors";
|
|
11
|
-
import type { BlocksApplyParams, MethodName, ReadParams } from "./types";
|
|
10
|
+
import { invalidParams } from "./errors.ts";
|
|
11
|
+
import type { BlocksApplyParams, MethodName, ReadParams } from "./types.ts";
|
|
12
12
|
|
|
13
13
|
const opaque = z.string().min(1).max(1024);
|
|
14
14
|
|
package/src/protocol/secrets.ts
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
* The schema marks a `Secret` field with `"format": "secret"` — the contract
|
|
12
12
|
* `deco schema` emits for the `Secret` type. Browser-safe.
|
|
13
13
|
*/
|
|
14
|
-
import { parseCiphertext } from "./ciphertext";
|
|
15
|
-
import type { BlockViolation } from "./errors";
|
|
16
|
-
import type { DecoMeta } from "./types";
|
|
14
|
+
import { parseCiphertext } from "./ciphertext.ts";
|
|
15
|
+
import type { BlockViolation } from "./errors.ts";
|
|
16
|
+
import type { DecoMeta } from "./types.ts";
|
|
17
17
|
|
|
18
18
|
/** The built-in block type that holds an encrypted value. */
|
|
19
19
|
export const SECRET_BLOCK_TYPE = "secret";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
assetNameForType,
|
|
18
18
|
isAcceptedAssetType,
|
|
19
19
|
sanitizeAssetName,
|
|
20
|
-
} from "../assets";
|
|
20
|
+
} from "../assets.ts";
|
|
21
21
|
import {
|
|
22
22
|
type ContentProtocolError,
|
|
23
23
|
ErrorCode,
|
|
@@ -27,11 +27,11 @@ import {
|
|
|
27
27
|
readOnly,
|
|
28
28
|
unauthorized,
|
|
29
29
|
unsupported,
|
|
30
|
-
} from "../errors";
|
|
31
|
-
import type { ContentStorage } from "../storage";
|
|
32
|
-
import { ASSETS_URL_PREFIX } from "../types";
|
|
33
|
-
import { type AuthOptions, assertAuthOptions, authenticate } from "./auth";
|
|
34
|
-
import { BodyEncodingError, BodyTooLargeError, jsonResponse, readBody } from "./http";
|
|
30
|
+
} from "../errors.ts";
|
|
31
|
+
import type { ContentStorage } from "../storage.ts";
|
|
32
|
+
import { ASSETS_URL_PREFIX } from "../types.ts";
|
|
33
|
+
import { type AuthOptions, assertAuthOptions, authenticate } from "./auth.ts";
|
|
34
|
+
import { BodyEncodingError, BodyTooLargeError, jsonResponse, readBody } from "./http.ts";
|
|
35
35
|
|
|
36
36
|
const STATUS: Record<number, number> = {
|
|
37
37
|
[ErrorCode.Unauthorized]: 401,
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Shared by `blocks.list` (which needs every body) and `blocks.apply` (which
|
|
5
5
|
* needs bodies only to break ties between spellings).
|
|
6
6
|
*/
|
|
7
|
-
import { limitExceeded, unavailable } from "../errors";
|
|
8
|
-
import { entryHasPath, fullyDecodeFileName, isBlockFileName, resolveSpellings } from "../keys";
|
|
9
|
-
import type { ContentStorage, StorageFile, StorageSnapshot } from "../storage";
|
|
10
|
-
import type { Diagnostic, Limits } from "../types";
|
|
11
|
-
import { type BodyCache, type ParsedBody, parseBody } from "./bodyCache";
|
|
7
|
+
import { limitExceeded, unavailable } from "../errors.ts";
|
|
8
|
+
import { entryHasPath, fullyDecodeFileName, isBlockFileName, resolveSpellings } from "../keys.ts";
|
|
9
|
+
import type { ContentStorage, StorageFile, StorageSnapshot } from "../storage.ts";
|
|
10
|
+
import type { Diagnostic, Limits } from "../types.ts";
|
|
11
|
+
import { type BodyCache, type ParsedBody, parseBody } from "./bodyCache.ts";
|
|
12
12
|
|
|
13
13
|
export interface LoadedEntry {
|
|
14
14
|
file: string;
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The shared state of one content handler: its storage, options and caches.
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
ContentProtocolError,
|
|
6
|
+
invalidBlock,
|
|
7
|
+
notFound,
|
|
8
|
+
unavailable,
|
|
9
|
+
unsupported,
|
|
10
|
+
} from "../errors.ts";
|
|
11
|
+
import { blockNameFromFile } from "../keys.ts";
|
|
6
12
|
import {
|
|
7
13
|
type ContentStorage,
|
|
8
14
|
type StorageDescription,
|
|
9
15
|
StorageInvalidFileError,
|
|
10
16
|
StorageNotFoundError,
|
|
11
17
|
StorageUnavailableError,
|
|
12
|
-
} from "../storage";
|
|
13
|
-
import { DEFAULT_LIMITS, type DecoMeta, type Limits } from "../types";
|
|
14
|
-
import type { AuthOptions } from "./auth";
|
|
15
|
-
import { BodyCache } from "./bodyCache";
|
|
18
|
+
} from "../storage.ts";
|
|
19
|
+
import { DEFAULT_LIMITS, type DecoMeta, type Limits } from "../types.ts";
|
|
20
|
+
import type { AuthOptions } from "./auth.ts";
|
|
21
|
+
import { BodyCache } from "./bodyCache.ts";
|
|
16
22
|
|
|
17
23
|
export interface ContentHandlerOptions extends AuthOptions {
|
|
18
24
|
/** Reported by `describe`, such as `{ name: "deco-cli", version: "8.0.0" }`. */
|
|
@@ -23,18 +23,18 @@ import {
|
|
|
23
23
|
limitExceeded,
|
|
24
24
|
parseError,
|
|
25
25
|
unauthorized,
|
|
26
|
-
} from "../errors";
|
|
27
|
-
import type { ContentStorage } from "../storage";
|
|
28
|
-
import { assertAuthOptions, authenticate } from "./auth";
|
|
29
|
-
import { type ContentHandlerOptions, Core } from "./core";
|
|
26
|
+
} from "../errors.ts";
|
|
27
|
+
import type { ContentStorage } from "../storage.ts";
|
|
28
|
+
import { assertAuthOptions, authenticate } from "./auth.ts";
|
|
29
|
+
import { type ContentHandlerOptions, Core } from "./core.ts";
|
|
30
30
|
import {
|
|
31
31
|
BodyEncodingError,
|
|
32
32
|
BodyTooLargeError,
|
|
33
33
|
isJsonContentType,
|
|
34
34
|
jsonResponse,
|
|
35
35
|
readBody,
|
|
36
|
-
} from "./http";
|
|
37
|
-
import { dispatch } from "./rpc";
|
|
36
|
+
} from "./http.ts";
|
|
37
|
+
import { dispatch } from "./rpc.ts";
|
|
38
38
|
|
|
39
39
|
export type ContentHandler = (request: Request) => Promise<Response>;
|
|
40
40
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* only (Request, Response, CompressionStream), so it runs on Node, Bun,
|
|
5
5
|
* Workers and Deno.
|
|
6
6
|
*/
|
|
7
|
-
import { sha256Hex } from "../canonical";
|
|
7
|
+
import { sha256Hex } from "../canonical.ts";
|
|
8
8
|
|
|
9
9
|
/** The body was larger than allowed (after decompression). */
|
|
10
10
|
export class BodyTooLargeError extends Error {
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* and Deno. (`deco serve`'s asset uploads use `./assets`, which isn't public.)
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
export type { AuthOptions, AuthorizeResult } from "./auth";
|
|
10
|
-
export type { ContentHandlerOptions } from "./core";
|
|
11
|
-
export { type ContentHandler, createContentHandler } from "./handler";
|
|
9
|
+
export type { AuthOptions, AuthorizeResult } from "./auth.ts";
|
|
10
|
+
export type { ContentHandlerOptions } from "./core.ts";
|
|
11
|
+
export { type ContentHandler, createContentHandler } from "./handler.ts";
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* key reserved meanwhile) is retried against a new snapshot after a jittered
|
|
19
19
|
* backoff, rechecking every guard, up to `maxCommitAttempts` times.
|
|
20
20
|
*/
|
|
21
|
-
import { applyRequestDigest, canonicalJson } from "../../canonical";
|
|
21
|
+
import { applyRequestDigest, canonicalJson } from "../../canonical.ts";
|
|
22
22
|
import {
|
|
23
23
|
type BlockViolation,
|
|
24
24
|
conflict,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
unavailable,
|
|
30
30
|
unsupported,
|
|
31
31
|
type VersionMismatch,
|
|
32
|
-
} from "../../errors";
|
|
32
|
+
} from "../../errors.ts";
|
|
33
33
|
import {
|
|
34
34
|
blockFileName,
|
|
35
35
|
blockNameFromFile,
|
|
@@ -39,13 +39,13 @@ import {
|
|
|
39
39
|
isBlockFileName,
|
|
40
40
|
serializeBlock,
|
|
41
41
|
spellingKey,
|
|
42
|
-
} from "../../keys";
|
|
43
|
-
import { checkSecrets } from "../../secrets";
|
|
44
|
-
import type { StorageDescription, StoredReceipt } from "../../storage";
|
|
45
|
-
import type { BlocksApplyParams, BlocksApplyResult, DecoMeta, Limits } from "../../types";
|
|
46
|
-
import { type LoadedContent, type LoadedEntry, loadCurrentContent } from "../content";
|
|
47
|
-
import type { Core } from "../core";
|
|
48
|
-
import { parseSchema, readSchema } from "./read";
|
|
42
|
+
} from "../../keys.ts";
|
|
43
|
+
import { checkSecrets } from "../../secrets.ts";
|
|
44
|
+
import type { StorageDescription, StoredReceipt } from "../../storage.ts";
|
|
45
|
+
import type { BlocksApplyParams, BlocksApplyResult, DecoMeta, Limits } from "../../types.ts";
|
|
46
|
+
import { type LoadedContent, type LoadedEntry, loadCurrentContent } from "../content.ts";
|
|
47
|
+
import type { Core } from "../core.ts";
|
|
48
|
+
import { parseSchema, readSchema } from "./read.ts";
|
|
49
49
|
|
|
50
50
|
const utf8 = new TextEncoder();
|
|
51
51
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The three read methods: `describe`, `schema.get` and `blocks.list`.
|
|
3
3
|
*/
|
|
4
|
-
import { publicKeyDerFromPem } from "../../ciphertext";
|
|
5
|
-
import { limitExceeded, notFound, unavailable } from "../../errors";
|
|
4
|
+
import { publicKeyDerFromPem } from "../../ciphertext.ts";
|
|
5
|
+
import { limitExceeded, notFound, unavailable } from "../../errors.ts";
|
|
6
6
|
import {
|
|
7
7
|
ASSETS_URL_PREFIX,
|
|
8
8
|
type BlocksListResult,
|
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
type ReadParams,
|
|
14
14
|
SCHEMA_FORMAT,
|
|
15
15
|
type SchemaGetResult,
|
|
16
|
-
} from "../../types";
|
|
17
|
-
import { loadCurrentContent } from "../content";
|
|
18
|
-
import type { Core } from "../core";
|
|
16
|
+
} from "../../types.ts";
|
|
17
|
+
import { loadCurrentContent } from "../content.ts";
|
|
18
|
+
import type { Core } from "../core.ts";
|
|
19
19
|
|
|
20
20
|
const DEFAULT_SERVER = { name: "deco-blocks", version: "unknown" };
|
|
21
21
|
|
|
@@ -15,12 +15,12 @@ import {
|
|
|
15
15
|
invalidRequest,
|
|
16
16
|
limitExceeded,
|
|
17
17
|
methodNotFound,
|
|
18
|
-
} from "../errors";
|
|
19
|
-
import { validateParams } from "../params";
|
|
20
|
-
import { MAX_BATCH_CALLS, METHOD_NAMES, type MethodName, type RpcId } from "../types";
|
|
21
|
-
import { type Core, toProtocolError } from "./core";
|
|
22
|
-
import { blocksApply } from "./methods/apply";
|
|
23
|
-
import { blocksList, describe, schemaGet } from "./methods/read";
|
|
18
|
+
} from "../errors.ts";
|
|
19
|
+
import { validateParams } from "../params.ts";
|
|
20
|
+
import { MAX_BATCH_CALLS, METHOD_NAMES, type MethodName, type RpcId } from "../types.ts";
|
|
21
|
+
import { type Core, toProtocolError } from "./core.ts";
|
|
22
|
+
import { blocksApply } from "./methods/apply.ts";
|
|
23
|
+
import { blocksList, describe, schemaGet } from "./methods/read.ts";
|
|
24
24
|
|
|
25
25
|
const utf8 = new TextEncoder();
|
|
26
26
|
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { lstat, mkdir, open, readdir, readFile, stat } from "node:fs/promises";
|
|
23
23
|
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
24
|
-
import { suffixedAssetName } from "../../assets";
|
|
25
|
-
import { isBlockFileName } from "../../keys";
|
|
24
|
+
import { suffixedAssetName } from "../../assets.ts";
|
|
25
|
+
import { isBlockFileName } from "../../keys.ts";
|
|
26
26
|
import {
|
|
27
27
|
type CommitResult,
|
|
28
28
|
type ContentStorage,
|
|
@@ -34,11 +34,11 @@ import {
|
|
|
34
34
|
StorageUnavailableError,
|
|
35
35
|
type StoredFileBody,
|
|
36
36
|
type StoredSchema,
|
|
37
|
-
} from "../../storage";
|
|
38
|
-
import type { Limits } from "../../types";
|
|
39
|
-
import { gitBlobHash, revisionOf } from "./hash";
|
|
40
|
-
import { withCommitLock } from "./lock";
|
|
41
|
-
import { applyFileChange, sweepStaleTransactions } from "./transaction";
|
|
37
|
+
} from "../../storage.ts";
|
|
38
|
+
import type { Limits } from "../../types.ts";
|
|
39
|
+
import { gitBlobHash, revisionOf } from "./hash.ts";
|
|
40
|
+
import { withCommitLock } from "./lock.ts";
|
|
41
|
+
import { applyFileChange, sweepStaleTransactions } from "./transaction.ts";
|
|
42
42
|
|
|
43
43
|
export interface FsStorageOptions {
|
|
44
44
|
/** The app root: the folder that contains `.deco/`. */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { open, rm, stat } from "node:fs/promises";
|
|
7
7
|
import { join } from "node:path";
|
|
8
|
-
import { StorageUnavailableError } from "../../storage";
|
|
8
|
+
import { StorageUnavailableError } from "../../storage.ts";
|
|
9
9
|
|
|
10
10
|
const LOCK_FILE = ".blocks.lock";
|
|
11
11
|
const queues = new Map<string, Promise<unknown>>();
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* filesystem storage needs `node:fs`; on Workers or in a browser, implement
|
|
5
5
|
* `ContentStorage` over the storage you have instead.
|
|
6
6
|
*/
|
|
7
|
-
import type { createFsStorage as nodeCreateFsStorage } from "./index";
|
|
7
|
+
import type { createFsStorage as nodeCreateFsStorage } from "./index.ts";
|
|
8
8
|
|
|
9
|
-
export type { FsStorage, FsStorageOptions } from "./index";
|
|
9
|
+
export type { FsStorage, FsStorageOptions } from "./index.ts";
|
|
10
10
|
|
|
11
11
|
export const createFsStorage: typeof nodeCreateFsStorage = () => {
|
|
12
12
|
throw new Error(
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* for tests: its state can be dumped and restored to simulate a restart, and
|
|
7
7
|
* hooks let a test change files between a snapshot and a commit. Browser-safe.
|
|
8
8
|
*/
|
|
9
|
-
import { suffixedAssetName } from "../assets";
|
|
10
|
-
import { sha256Hex } from "../canonical";
|
|
11
|
-
import { isBlockFileName } from "../keys";
|
|
9
|
+
import { suffixedAssetName } from "../assets.ts";
|
|
10
|
+
import { sha256Hex } from "../canonical.ts";
|
|
11
|
+
import { isBlockFileName } from "../keys.ts";
|
|
12
12
|
import {
|
|
13
13
|
type CommitAttempt,
|
|
14
14
|
type CommitResult,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
type StoredFileBody,
|
|
21
21
|
type StoredReceipt,
|
|
22
22
|
type StoredSchema,
|
|
23
|
-
} from "../storage";
|
|
23
|
+
} from "../storage.ts";
|
|
24
24
|
|
|
25
25
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
26
26
|
|
package/src/protocol/storage.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Browser-safe: types and small error classes only.
|
|
12
12
|
*/
|
|
13
|
-
import type { Limits, StorageKind } from "./types";
|
|
13
|
+
import type { Limits, StorageKind } from "./types.ts";
|
|
14
14
|
|
|
15
15
|
/** What a storage tells `describe`. */
|
|
16
16
|
export interface StorageDescription {
|
package/src/v8/analytics.ts
CHANGED
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* `navigator.sendBeacon` or a `POST`.
|
|
18
18
|
*/
|
|
19
19
|
import { createElement, type ReactNode } from "react";
|
|
20
|
-
import { HOSTED_ANALYTICS_COLLECTOR } from "./builtins/data";
|
|
21
|
-
import type { Analytics } from "./types";
|
|
20
|
+
import { HOSTED_ANALYTICS_COLLECTOR } from "./builtins/data.ts";
|
|
21
|
+
import type { Analytics } from "./types.ts";
|
|
22
22
|
|
|
23
23
|
const GLOBAL = "__decoAnalytics";
|
|
24
24
|
|
package/src/v8/builtins/data.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Analytics, Redirect, Telemetry } from "../types";
|
|
1
|
+
import type { Analytics, Redirect, Telemetry } from "../types.ts";
|
|
2
2
|
|
|
3
3
|
/** The hosted Deco CMS collector: where page views go when `collector` is left out. */
|
|
4
4
|
export const HOSTED_ANALYTICS_COLLECTOR = "https://d.lilstts.com/events";
|
package/src/v8/builtins/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { BlockFunction } from "../types";
|
|
2
|
-
import { analytics, page, redirect, telemetry } from "./data";
|
|
3
|
-
import { lazy } from "./lazy";
|
|
4
|
-
import { always, date, never } from "./matchers";
|
|
5
|
-
import { multivariate } from "./multivariate";
|
|
6
|
-
import { secretBlock } from "./secret";
|
|
1
|
+
import type { BlockFunction } from "../types.ts";
|
|
2
|
+
import { analytics, page, redirect, telemetry } from "./data.ts";
|
|
3
|
+
import { lazy } from "./lazy.ts";
|
|
4
|
+
import { always, date, never } from "./matchers.ts";
|
|
5
|
+
import { multivariate } from "./multivariate.ts";
|
|
6
|
+
import { secretBlock } from "./secret.ts";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The built-in blocks every block map gets. `secret` here has no key, so it
|
package/src/v8/builtins/lazy.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* - Legacy variants are saved as plain values; on the way to `multivariate`
|
|
17
17
|
* each one is wrapped in a `lazy` block, so only the chosen one runs.
|
|
18
18
|
*/
|
|
19
|
-
import { isPlainObject, type JsonObject } from "../json";
|
|
19
|
+
import { isPlainObject, type JsonObject } from "../json.ts";
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Legacy type name → built-in. The one table: the runtime falls back to it,
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* telemetry). A decrypted value stays on the server because it's resolved
|
|
18
18
|
* there; tainting it (React's taint API) is up to the site's own code.
|
|
19
19
|
*/
|
|
20
|
-
import { parseCiphertext } from "../ciphertext";
|
|
21
|
-
import type { BlockFunction } from "../types";
|
|
20
|
+
import { parseCiphertext } from "../ciphertext.ts";
|
|
21
|
+
import type { BlockFunction } from "../types.ts";
|
|
22
22
|
|
|
23
23
|
/** True in a browser, where a secret must never be decrypted. */
|
|
24
24
|
function inBrowser(): boolean {
|
package/src/v8/canonical.ts
CHANGED
|
@@ -115,3 +115,39 @@ export const APPLY_DIGEST_DOMAIN = "deco-content/blocks.apply@1\n";
|
|
|
115
115
|
export function applyRequestDigest(params: object): Promise<string> {
|
|
116
116
|
return sha256Hex(APPLY_DIGEST_DOMAIN + canonicalJson(params));
|
|
117
117
|
}
|
|
118
|
+
|
|
119
|
+
/** The version of the draft overlay manifest format below. */
|
|
120
|
+
export const DRAFT_OVERLAY_FORMAT = 1;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* A draft overlay manifest (see /next/content-delivery#exact-draft-previews):
|
|
124
|
+
* the complete, cumulative set of a draft's changes, never a patch over an
|
|
125
|
+
* earlier version. `set` maps each changed entry's name to the block hash of
|
|
126
|
+
* its JSON; `delete` names the entries the draft removed (tombstones). The two
|
|
127
|
+
* are disjoint. There is no base revision: a preview server layers it over the
|
|
128
|
+
* production content it already has.
|
|
129
|
+
*/
|
|
130
|
+
export interface DraftOverlay {
|
|
131
|
+
format: typeof DRAFT_OVERLAY_FORMAT;
|
|
132
|
+
set: Record<string, string>;
|
|
133
|
+
delete: string[];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The block hash of one changed entry: SHA-256 over its canonical JSON,
|
|
138
|
+
* lowercase hex. A draft block asset is stored under it
|
|
139
|
+
* (`/sites/<site>/draft-blocks/<block-hash>.json`), and the SDK checks every
|
|
140
|
+
* asset it downloads hashes to its name.
|
|
141
|
+
*/
|
|
142
|
+
export function computeBlockHash(entry: unknown): Promise<string> {
|
|
143
|
+
return sha256Hex(canonicalJson(entry));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The overlay version: SHA-256 over the manifest's canonical JSON, lowercase
|
|
148
|
+
* hex. The manifest is stored under it (`/sites/<site>/drafts/<version>.json`)
|
|
149
|
+
* and a draft pointer names it after its `@`.
|
|
150
|
+
*/
|
|
151
|
+
export function computeOverlayVersion(overlay: DraftOverlay): Promise<string> {
|
|
152
|
+
return sha256Hex(canonicalJson(overlay));
|
|
153
|
+
}
|
package/src/v8/cli/builtins.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Names the CLI knows without reading any code: the built-in blocks (the
|
|
3
3
|
* core's reserved names) and the legacy alias table.
|
|
4
4
|
*/
|
|
5
|
-
import { RESERVED_NAMES } from "../builtins";
|
|
5
|
+
import { RESERVED_NAMES } from "../builtins/index.ts";
|
|
6
6
|
|
|
7
7
|
/** Spec: built-in-blocks. Every block map gets these, in this order. */
|
|
8
8
|
export const BUILT_IN_BLOCKS: readonly string[] = [...RESERVED_NAMES];
|
|
@@ -17,4 +17,4 @@ export function isBuiltIn(name: string): boolean {
|
|
|
17
17
|
* editor's special screens still look types up by these names (spec:
|
|
18
18
|
* studio-compatibility › Well-known types and the alias table).
|
|
19
19
|
*/
|
|
20
|
-
export { LEGACY_ALIASES, storesPlainVariants } from "../builtins/legacy";
|
|
20
|
+
export { LEGACY_ALIASES, storesPlainVariants } from "../builtins/legacy.ts";
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import fs from "node:fs";
|
|
21
|
-
import Ajv,
|
|
22
|
-
import { isWellFormedCiphertext } from "../../../protocol/secrets";
|
|
23
|
-
import { isBlock, own } from "../../json";
|
|
24
|
-
import { findRouteConflicts } from "../../matchRoute";
|
|
25
|
-
import { isBuiltIn, storesPlainVariants } from "../builtins";
|
|
26
|
-
import { readSavedBlocks, type SavedBlocks } from "../content";
|
|
27
|
-
import { consoleReporter, type Reporter } from "../log";
|
|
28
|
-
import { CliError, decoPaths, findDecoRoot } from "../root";
|
|
29
|
-
import type { DecoMeta } from "../schema/generate";
|
|
30
|
-
import { SECTION_REF_KEY, toBase64 } from "../schema/typeToSchema";
|
|
31
|
-
import { BLOCK_DEF, joinPath, rewriteErrors } from "./messages";
|
|
21
|
+
import { Ajv, type ValidateFunction } from "ajv";
|
|
22
|
+
import { isWellFormedCiphertext } from "../../../protocol/secrets.ts";
|
|
23
|
+
import { isBlock, own } from "../../json.ts";
|
|
24
|
+
import { findRouteConflicts } from "../../matchRoute.ts";
|
|
25
|
+
import { isBuiltIn, storesPlainVariants } from "../builtins.ts";
|
|
26
|
+
import { readSavedBlocks, type SavedBlocks } from "../content.ts";
|
|
27
|
+
import { consoleReporter, type Reporter } from "../log.ts";
|
|
28
|
+
import { CliError, decoPaths, findDecoRoot } from "../root.ts";
|
|
29
|
+
import type { DecoMeta } from "../schema/generate.ts";
|
|
30
|
+
import { SECTION_REF_KEY, toBase64 } from "../schema/typeToSchema.ts";
|
|
31
|
+
import { BLOCK_DEF, joinPath, rewriteErrors } from "./messages.ts";
|
|
32
32
|
|
|
33
33
|
export interface Problem {
|
|
34
34
|
/** The saved block's file, relative to the root: `.deco/blocks/HomePage.json`. */
|
package/src/v8/cli/content.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
|
-
import { computeContentRevision } from "../../protocol/canonical";
|
|
8
|
+
import { computeContentRevision } from "../../protocol/canonical.ts";
|
|
9
9
|
import {
|
|
10
10
|
blockNameFromFile,
|
|
11
11
|
checkBlockName,
|
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
isBlockFileName,
|
|
14
14
|
resolveSpellings,
|
|
15
15
|
type SpellingCandidate,
|
|
16
|
-
} from "../../protocol/keys";
|
|
17
|
-
import { isPlainObject } from "../json";
|
|
18
|
-
import { LEGACY_ALIASES } from "./builtins";
|
|
19
|
-
import { consoleReporter, type Reporter } from "./log";
|
|
20
|
-
import { CliError, type DecoPaths, decoPaths, findDecoRoot } from "./root";
|
|
16
|
+
} from "../../protocol/keys.ts";
|
|
17
|
+
import { isPlainObject } from "../json.ts";
|
|
18
|
+
import { LEGACY_ALIASES } from "./builtins.ts";
|
|
19
|
+
import { consoleReporter, type Reporter } from "./log.ts";
|
|
20
|
+
import { CliError, type DecoPaths, decoPaths, findDecoRoot } from "./root.ts";
|
|
21
21
|
|
|
22
22
|
export interface ContentDiagnostic {
|
|
23
23
|
/** The file name inside `.deco/blocks`. */
|
package/src/v8/cli/index.ts
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
* (the `deco-v7-to-v8-migration` skill) reads: the built-in block names, the alias
|
|
9
9
|
* table and the saved-blocks reader.
|
|
10
10
|
*/
|
|
11
|
-
export { BUILT_IN_BLOCKS, LEGACY_ALIASES } from "./builtins";
|
|
12
|
-
export { type CheckOptions, check } from "./check/index";
|
|
13
|
-
export { type ContentOptions, content, readSavedBlocks, type SavedBlocks } from "./content";
|
|
14
|
-
export { type Reporter, silentReporter } from "./log";
|
|
15
|
-
export { runCli } from "./run";
|
|
16
|
-
export { type SchemaOptions, schema } from "./schema/index";
|
|
17
|
-
export { type ServeOptions, serve } from "./serve/server";
|
|
11
|
+
export { BUILT_IN_BLOCKS, LEGACY_ALIASES } from "./builtins.ts";
|
|
12
|
+
export { type CheckOptions, check } from "./check/index.ts";
|
|
13
|
+
export { type ContentOptions, content, readSavedBlocks, type SavedBlocks } from "./content.ts";
|
|
14
|
+
export { type Reporter, silentReporter } from "./log.ts";
|
|
15
|
+
export { runCli } from "./run.ts";
|
|
16
|
+
export { type SchemaOptions, schema } from "./schema/index.ts";
|
|
17
|
+
export { type ServeOptions, serve } from "./serve/server.ts";
|
package/src/v8/cli/main.ts
CHANGED
package/src/v8/cli/run.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* The `deco` command line: `deco <schema|content|check|serve> [flags]`
|
|
3
3
|
* (spec: cli). Parses flags, runs one command and returns its exit code.
|
|
4
4
|
*/
|
|
5
|
-
import { check } from "./check/index";
|
|
6
|
-
import { content, writeContent } from "./content";
|
|
7
|
-
import { consoleReporter, type Reporter } from "./log";
|
|
8
|
-
import { CliError, decoPaths, findDecoRoot } from "./root";
|
|
9
|
-
import { reportSchema, schema, writeSchema } from "./schema/index";
|
|
10
|
-
import { serve, startServer } from "./serve/server";
|
|
11
|
-
import { watchFiles, watchTree } from "./watch";
|
|
5
|
+
import { check } from "./check/index.ts";
|
|
6
|
+
import { content, writeContent } from "./content.ts";
|
|
7
|
+
import { consoleReporter, type Reporter } from "./log.ts";
|
|
8
|
+
import { CliError, decoPaths, findDecoRoot } from "./root.ts";
|
|
9
|
+
import { reportSchema, schema, writeSchema } from "./schema/index.ts";
|
|
10
|
+
import { serve, startServer } from "./serve/server.ts";
|
|
11
|
+
import { watchFiles, watchTree } from "./watch.ts";
|
|
12
12
|
|
|
13
13
|
type FlagKind = "string" | "boolean" | "list";
|
|
14
14
|
|