@decocms/blocks 8.1.0-next.0 → 8.1.0-next.2
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 +22 -0
- package/dist/protocol/conformance/contentHashFixtures.d.ts.map +1 -0
- package/dist/protocol/conformance/contentHashFixtures.js +64 -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 +25 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +25 -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 +42 -0
- package/dist/v8/canonical.d.ts.map +1 -0
- package/dist/v8/canonical.js +111 -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 +120 -0
- package/dist/v8/cli/schema/tsProgram.d.ts.map +1 -0
- package/dist/v8/cli/schema/tsProgram.js +418 -0
- package/dist/v8/cli/schema/tsProgram.js.map +1 -0
- package/dist/v8/cli/schema/typeToSchema.d.ts +81 -0
- package/dist/v8/cli/schema/typeToSchema.d.ts.map +1 -0
- package/dist/v8/cli/schema/typeToSchema.js +683 -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 +206 -0
- package/dist/v8/cms.js.map +1 -0
- package/dist/v8/content.d.ts +35 -0
- package/dist/v8/content.d.ts.map +1 -0
- package/dist/v8/content.js +183 -0
- package/dist/v8/content.js.map +1 -0
- package/dist/v8/draft.d.ts +44 -0
- package/dist/v8/draft.d.ts.map +1 -0
- package/dist/v8/draft.js +133 -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 +243 -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 +214 -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/package.json +65 -105
- package/src/index.ts +3 -13
- 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/context.ts +4 -4
- package/src/protocol/conformance/index.ts +10 -10
- package/src/protocol/index.ts +6 -6
- 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 +5 -5
- package/src/protocol/storage.ts +1 -1
- package/src/v8/analytics.ts +2 -2
- package/src/v8/background.ts +3 -3
- 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 +2 -2
- package/src/v8/builtins/multivariate.ts +1 -1
- package/src/v8/builtins/secret.ts +2 -2
- 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 +8 -8
- 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 +6 -6
- package/src/v8/cli/schema/index.ts +4 -4
- package/src/v8/cli/schema/tsProgram.ts +1 -1
- package/src/v8/cli/schema/typeToSchema.ts +24 -2
- package/src/v8/cli/serve/server.ts +9 -9
- package/src/v8/client.ts +5 -5
- package/src/v8/cms.ts +9 -9
- package/src/v8/content.ts +4 -4
- package/src/v8/draft.ts +1 -1
- package/src/v8/errors.ts +1 -1
- package/src/v8/fetch.ts +9 -28
- 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 +7 -7
- package/src/v8/resolver.ts +6 -6
- package/src/v8/secrets.ts +1 -1
- package/src/v8/telemetry.ts +6 -6
- package/src/cms/applySectionConventions.ts +0 -148
- package/src/cms/blockSource.ts +0 -228
- package/src/cms/client.ts +0 -85
- package/src/cms/deferredTrigger.ts +0 -58
- package/src/cms/draftSource.ts +0 -476
- package/src/cms/index.ts +0 -180
- package/src/cms/loadDecofileDirectory.ts +0 -89
- package/src/cms/loader.ts +0 -563
- package/src/cms/registry.ts +0 -264
- package/src/cms/renderJson.ts +0 -179
- package/src/cms/resolve.ts +0 -2583
- package/src/cms/schema.ts +0 -1219
- package/src/cms/sectionLoaderContext.ts +0 -113
- package/src/cms/sectionLoaders.ts +0 -686
- package/src/cms/sectionMixins.ts +0 -153
- package/src/flags/audience.ts +0 -56
- package/src/flags/everyone.ts +0 -29
- package/src/flags/flag.ts +0 -15
- package/src/flags/multivariate/image.ts +0 -11
- package/src/flags/multivariate/message.ts +0 -11
- package/src/flags/multivariate/page.ts +0 -16
- package/src/flags/multivariate/section.ts +0 -16
- package/src/flags/multivariate.ts +0 -1
- package/src/flags/types.ts +0 -59
- package/src/flags/utils/multivariate.ts +0 -20
- package/src/hooks/Image.tsx +0 -314
- package/src/hooks/JsonLd.tsx +0 -353
- package/src/hooks/LazySection.tsx +0 -121
- package/src/hooks/LiveControls.tsx +0 -144
- package/src/hooks/Picture.tsx +0 -127
- package/src/hooks/RenderSection.tsx +0 -91
- package/src/hooks/SectionErrorFallback.tsx +0 -97
- package/src/hooks/Stats.tsx +0 -134
- package/src/hooks/index.ts +0 -35
- package/src/hooks/useLoadMore.ts +0 -100
- package/src/matchers/builtins.ts +0 -459
- package/src/matchers/countryNames.ts +0 -104
- package/src/matchers/override.ts +0 -136
- package/src/matchers/posthog.ts +0 -154
- package/src/middleware/decoState.ts +0 -55
- package/src/middleware/healthMetrics.ts +0 -133
- package/src/middleware/hydrationContext.ts +0 -79
- package/src/middleware/index.ts +0 -88
- package/src/middleware/liveness.ts +0 -21
- package/src/middleware/observability.ts +0 -800
- package/src/middleware/validateSection.ts +0 -100
- package/src/preview/DraftPreviewBadge.tsx +0 -306
- package/src/preview/decoMark.ts +0 -11
- package/src/preview/index.ts +0 -8
- package/src/sdk/abTesting.ts +0 -556
- package/src/sdk/analytics.ts +0 -147
- package/src/sdk/cacheHeaders.ts +0 -633
- package/src/sdk/cacheStorage.ts +0 -287
- package/src/sdk/cachedLoader.ts +0 -556
- package/src/sdk/clx.ts +0 -5
- package/src/sdk/cn.ts +0 -28
- package/src/sdk/composite.ts +0 -114
- package/src/sdk/cookie.ts +0 -129
- package/src/sdk/crypto.ts +0 -199
- package/src/sdk/csp.ts +0 -59
- package/src/sdk/deepOmit.ts +0 -52
- package/src/sdk/detectDevice.ts +0 -45
- package/src/sdk/djb2.ts +0 -20
- package/src/sdk/encoding.ts +0 -44
- package/src/sdk/env.ts +0 -54
- package/src/sdk/experiments.ts +0 -314
- package/src/sdk/fetchCache.ts +0 -269
- package/src/sdk/fetchTimeout.ts +0 -58
- package/src/sdk/flags.ts +0 -138
- package/src/sdk/http.ts +0 -124
- package/src/sdk/index.ts +0 -97
- package/src/sdk/inflightTimeout.ts +0 -53
- package/src/sdk/instrumentedFetch.ts +0 -362
- package/src/sdk/invoke.ts +0 -298
- package/src/sdk/logger.ts +0 -304
- package/src/sdk/mergeCacheControl.ts +0 -150
- package/src/sdk/nonce.ts +0 -46
- package/src/sdk/normalizeUrls.ts +0 -91
- package/src/sdk/observability.ts +0 -116
- package/src/sdk/otel.ts +0 -1118
- package/src/sdk/otelAdapters/clickhouseCollector.ts +0 -65
- package/src/sdk/otelAdapters.ts +0 -144
- package/src/sdk/otelHttpLog.ts +0 -419
- package/src/sdk/otelHttpMeter.ts +0 -532
- package/src/sdk/otelHttpTracer.ts +0 -543
- package/src/sdk/redirects.ts +0 -336
- package/src/sdk/requestContext.ts +0 -281
- package/src/sdk/requestContextStorage.browser.ts +0 -43
- package/src/sdk/requestContextStorage.ts +0 -35
- package/src/sdk/responseCache.ts +0 -82
- package/src/sdk/retry.ts +0 -45
- package/src/sdk/serverTimings.ts +0 -68
- package/src/sdk/signal.ts +0 -42
- package/src/sdk/sitemap.ts +0 -160
- package/src/sdk/urlRedaction.ts +0 -82
- package/src/sdk/urlUtils.ts +0 -183
- package/src/sdk/useDevice.ts +0 -89
- package/src/sdk/useDeviceContext.tsx +0 -108
- package/src/sdk/useId.ts +0 -7
- package/src/sdk/useScript.ts +0 -210
- package/src/sdk/useSuggestions.ts +0 -188
- package/src/sdk/wrapCaughtErrors.ts +0 -107
- package/src/setup.ts +0 -120
- package/src/types/index.ts +0 -53
- package/src/types/widgets.ts +0 -14
package/src/sdk/cacheStorage.ts
DELETED
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
import { RequestContext } from "./requestContext";
|
|
2
|
-
|
|
3
|
-
/** Storage only. Values are serialized by the caller; expiration is absolute epoch ms. */
|
|
4
|
-
export interface CacheStorage {
|
|
5
|
-
get(key: string): Promise<string | null>;
|
|
6
|
-
set(key: string, value: string, expiresAt: number): Promise<void>;
|
|
7
|
-
delete(key: string): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface CacheStorageContext {
|
|
11
|
-
storage: CacheStorage | null;
|
|
12
|
-
/** Include site, deployment and content revision. Never use a tenant-wide global binding. */
|
|
13
|
-
scope: string;
|
|
14
|
-
/** Bypass both memory and shared storage for previews or private requests. */
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
waitUntil?: (work: Promise<unknown>) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const BAG_KEY = "deco:cache-storage";
|
|
20
|
-
|
|
21
|
-
export function bindCacheStorage(context: CacheStorageContext): void {
|
|
22
|
-
RequestContext.setBag(BAG_KEY, context);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function getCacheStorageContext(): CacheStorageContext | undefined {
|
|
26
|
-
return RequestContext.getBag<CacheStorageContext>(BAG_KEY);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** Keep optional cache work alive on Workers, without letting storage errors fail a request. */
|
|
30
|
-
export function cacheBackground(work: Promise<unknown>): void {
|
|
31
|
-
const safe = work.catch(() => {});
|
|
32
|
-
getCacheStorageContext()?.waitUntil?.(safe);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export async function hashCacheKey(key: string): Promise<string> {
|
|
36
|
-
const bytes = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(key));
|
|
37
|
-
return Array.from(new Uint8Array(bytes), (b) => b.toString(16).padStart(2, "0")).join("");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
interface StoredValue {
|
|
41
|
-
value: string;
|
|
42
|
-
expiresAt: number;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function decode(raw: string | null): string | null {
|
|
46
|
-
if (raw === null) return null;
|
|
47
|
-
try {
|
|
48
|
-
const entry = JSON.parse(raw) as StoredValue;
|
|
49
|
-
return typeof entry.value === "string" &&
|
|
50
|
-
Number.isFinite(entry.expiresAt) &&
|
|
51
|
-
Date.now() < entry.expiresAt
|
|
52
|
-
? entry.value
|
|
53
|
-
: null;
|
|
54
|
-
} catch {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** Bounded LRU adapter, useful in Node, development and tests. */
|
|
60
|
-
export function createMemoryCacheStorage(maxBytes = 32 * 1024 * 1024): CacheStorage {
|
|
61
|
-
const entries = new Map<string, string>();
|
|
62
|
-
let bytes = 0;
|
|
63
|
-
function remove(key: string) {
|
|
64
|
-
const old = entries.get(key);
|
|
65
|
-
if (old !== undefined) bytes -= (key.length + old.length) * 2;
|
|
66
|
-
entries.delete(key);
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
async get(key) {
|
|
70
|
-
const raw = entries.get(key);
|
|
71
|
-
const value = decode(raw ?? null);
|
|
72
|
-
if (value === null) remove(key);
|
|
73
|
-
else {
|
|
74
|
-
entries.delete(key);
|
|
75
|
-
entries.set(key, raw!);
|
|
76
|
-
}
|
|
77
|
-
return value;
|
|
78
|
-
},
|
|
79
|
-
async set(key, value, expiresAt) {
|
|
80
|
-
remove(key);
|
|
81
|
-
if (!Number.isFinite(expiresAt) || expiresAt <= Date.now()) return;
|
|
82
|
-
const raw = JSON.stringify({ value, expiresAt });
|
|
83
|
-
const size = (key.length + raw.length) * 2;
|
|
84
|
-
if (size > maxBytes) return;
|
|
85
|
-
entries.set(key, raw);
|
|
86
|
-
bytes += size;
|
|
87
|
-
while (bytes > maxBytes) remove(entries.keys().next().value!);
|
|
88
|
-
},
|
|
89
|
-
async delete(key) {
|
|
90
|
-
remove(key);
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/** Structural binding type; the core has no Cloudflare package dependency. */
|
|
96
|
-
export interface CacheKVNamespace {
|
|
97
|
-
get(key: string): Promise<string | null>;
|
|
98
|
-
put(key: string, value: string, options: { expirationTtl: number }): Promise<void>;
|
|
99
|
-
delete(key: string): Promise<void>;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export function createKVCacheStorage(
|
|
103
|
-
kv: CacheKVNamespace,
|
|
104
|
-
prefix = "deco-cache:v1:",
|
|
105
|
-
): CacheStorage {
|
|
106
|
-
const keyFor = async (key: string) => prefix + (await hashCacheKey(key));
|
|
107
|
-
return {
|
|
108
|
-
async get(key) {
|
|
109
|
-
return decode(await kv.get(await keyFor(key)));
|
|
110
|
-
},
|
|
111
|
-
async set(key, value, expiresAt) {
|
|
112
|
-
if (!Number.isFinite(expiresAt) || expiresAt <= Date.now()) return;
|
|
113
|
-
const raw = JSON.stringify({ value, expiresAt });
|
|
114
|
-
// Leave space below KV's 25 MiB value limit. Oversized cache entries are optional.
|
|
115
|
-
if (new TextEncoder().encode(raw).byteLength > 25 * 1024 * 1024) return;
|
|
116
|
-
await kv.put(await keyFor(key), raw, {
|
|
117
|
-
expirationTtl: Math.max(60, Math.ceil((expiresAt - Date.now()) / 1000)),
|
|
118
|
-
});
|
|
119
|
-
},
|
|
120
|
-
async delete(key) {
|
|
121
|
-
await kv.delete(await keyFor(key));
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/** The app supplies the native cache and its origin; no global API detection in consumers. */
|
|
127
|
-
export function createWebCacheStorage(
|
|
128
|
-
cache: Pick<Cache, "match" | "put" | "delete">,
|
|
129
|
-
origin: string,
|
|
130
|
-
): CacheStorage {
|
|
131
|
-
const requestFor = async (key: string) =>
|
|
132
|
-
new Request(new URL(`/__deco_cache/${await hashCacheKey(key)}`, origin));
|
|
133
|
-
return {
|
|
134
|
-
async get(key) {
|
|
135
|
-
const response = await cache.match(await requestFor(key));
|
|
136
|
-
return decode(response ? await response.text() : null);
|
|
137
|
-
},
|
|
138
|
-
async set(key, value, expiresAt) {
|
|
139
|
-
if (!Number.isFinite(expiresAt) || expiresAt <= Date.now()) return;
|
|
140
|
-
await cache.put(
|
|
141
|
-
await requestFor(key),
|
|
142
|
-
new Response(JSON.stringify({ value, expiresAt }), {
|
|
143
|
-
headers: {
|
|
144
|
-
"Cache-Control": `public, max-age=${Math.max(1, Math.ceil((expiresAt - Date.now()) / 1000))}`,
|
|
145
|
-
},
|
|
146
|
-
}),
|
|
147
|
-
);
|
|
148
|
-
},
|
|
149
|
-
async delete(key) {
|
|
150
|
-
await cache.delete(await requestFor(key));
|
|
151
|
-
},
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/** Reject values JSON would silently change, including dates, functions and circular references. */
|
|
156
|
-
function serialize(value: unknown): string | undefined {
|
|
157
|
-
const seen = new Set<object>();
|
|
158
|
-
function check(v: unknown): void {
|
|
159
|
-
if (v === null || typeof v === "string" || typeof v === "boolean") return;
|
|
160
|
-
if (typeof v === "number" && Number.isFinite(v)) return;
|
|
161
|
-
// Optional object fields are common in section props. JSON omits them safely.
|
|
162
|
-
if (v === undefined) return;
|
|
163
|
-
if (typeof v !== "object" || seen.has(v)) throw new Error("Unsupported cached value");
|
|
164
|
-
if (
|
|
165
|
-
!Array.isArray(v) &&
|
|
166
|
-
Object.getPrototypeOf(v) !== Object.prototype &&
|
|
167
|
-
Object.getPrototypeOf(v) !== null
|
|
168
|
-
) {
|
|
169
|
-
throw new Error("Unsupported cached object");
|
|
170
|
-
}
|
|
171
|
-
seen.add(v);
|
|
172
|
-
for (const item of Object.values(v)) check(item);
|
|
173
|
-
seen.delete(v);
|
|
174
|
-
}
|
|
175
|
-
check(value);
|
|
176
|
-
return JSON.stringify(value);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Typed cache with a bounded, decoded memory tier. All remote access uses CacheStorage.
|
|
181
|
-
* Call key() once per operation so a content change cannot redirect an in-flight write.
|
|
182
|
-
* In-flight promises remain in the calling isolate; only completed results are persisted.
|
|
183
|
-
*/
|
|
184
|
-
export function createCacheStore<T>(
|
|
185
|
-
namespace: string,
|
|
186
|
-
maxEntries = 200,
|
|
187
|
-
maxBytes = 4 * 1024 * 1024,
|
|
188
|
-
sizeOf?: (value: T) => number,
|
|
189
|
-
) {
|
|
190
|
-
const local = new Map<string, { value: T; expiresAt: number; bytes: number }>();
|
|
191
|
-
let bytes = 0;
|
|
192
|
-
let generation = 0;
|
|
193
|
-
function remove(key: string) {
|
|
194
|
-
const entry = local.get(key);
|
|
195
|
-
if (entry) bytes -= entry.bytes;
|
|
196
|
-
local.delete(key);
|
|
197
|
-
}
|
|
198
|
-
function remember(key: string, value: T, expiresAt: number) {
|
|
199
|
-
remove(key);
|
|
200
|
-
let size: number;
|
|
201
|
-
try {
|
|
202
|
-
size = sizeOf
|
|
203
|
-
? sizeOf(value)
|
|
204
|
-
: Math.max(512, (key.length + (JSON.stringify(value)?.length ?? 0)) * 2);
|
|
205
|
-
} catch {
|
|
206
|
-
size = 1024;
|
|
207
|
-
}
|
|
208
|
-
if (size > maxBytes) return;
|
|
209
|
-
local.set(key, { value, expiresAt, bytes: size });
|
|
210
|
-
bytes += size;
|
|
211
|
-
while (local.size > 0 && (local.size > maxEntries || bytes > maxBytes))
|
|
212
|
-
remove(local.keys().next().value!);
|
|
213
|
-
}
|
|
214
|
-
function get(key: string): T | undefined {
|
|
215
|
-
if (getCacheStorageContext()?.disabled) return undefined;
|
|
216
|
-
const entry = local.get(key);
|
|
217
|
-
if (!entry) return undefined;
|
|
218
|
-
if (Date.now() >= entry.expiresAt) {
|
|
219
|
-
remove(key);
|
|
220
|
-
return undefined;
|
|
221
|
-
}
|
|
222
|
-
local.delete(key);
|
|
223
|
-
local.set(key, entry);
|
|
224
|
-
return entry.value;
|
|
225
|
-
}
|
|
226
|
-
return {
|
|
227
|
-
key(raw: string): string {
|
|
228
|
-
return JSON.stringify([getCacheStorageContext()?.scope ?? "local", namespace, raw]);
|
|
229
|
-
},
|
|
230
|
-
get,
|
|
231
|
-
async read(key: string): Promise<T | undefined> {
|
|
232
|
-
const hit = get(key);
|
|
233
|
-
if (hit !== undefined) return hit;
|
|
234
|
-
const context = getCacheStorageContext();
|
|
235
|
-
if (!context?.storage || context.disabled) return undefined;
|
|
236
|
-
const gen = generation;
|
|
237
|
-
try {
|
|
238
|
-
const raw = await context.storage.get(key);
|
|
239
|
-
if (gen !== generation) return undefined;
|
|
240
|
-
const concurrent = get(key);
|
|
241
|
-
if (concurrent !== undefined) return concurrent;
|
|
242
|
-
if (raw === null) return undefined;
|
|
243
|
-
const entry = JSON.parse(raw) as { value: T; expiresAt: number };
|
|
244
|
-
if (!Number.isFinite(entry.expiresAt) || Date.now() >= entry.expiresAt) return undefined;
|
|
245
|
-
remember(key, entry.value, entry.expiresAt);
|
|
246
|
-
return entry.value;
|
|
247
|
-
} catch {
|
|
248
|
-
return undefined;
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
set(key: string, value: T, expiresAt: number, persist = true): void {
|
|
252
|
-
if (
|
|
253
|
-
getCacheStorageContext()?.disabled ||
|
|
254
|
-
!Number.isFinite(expiresAt) ||
|
|
255
|
-
expiresAt <= Date.now()
|
|
256
|
-
)
|
|
257
|
-
return;
|
|
258
|
-
remember(key, value, expiresAt);
|
|
259
|
-
const storage = getCacheStorageContext()?.storage;
|
|
260
|
-
if (!persist || !storage || !Number.isFinite(expiresAt)) return;
|
|
261
|
-
try {
|
|
262
|
-
const raw = serialize({ value, expiresAt });
|
|
263
|
-
if (raw !== undefined) cacheBackground(storage.set(key, raw, expiresAt));
|
|
264
|
-
} catch {
|
|
265
|
-
/* Non-serializable results remain in the memory tier. */
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
delete(key: string): void {
|
|
269
|
-
remove(key);
|
|
270
|
-
},
|
|
271
|
-
/** Local eviction only. Shared invalidation uses a new scope/version or storage.delete(). */
|
|
272
|
-
clear(): void {
|
|
273
|
-
local.clear();
|
|
274
|
-
bytes = 0;
|
|
275
|
-
generation++;
|
|
276
|
-
},
|
|
277
|
-
get size(): number {
|
|
278
|
-
return local.size;
|
|
279
|
-
},
|
|
280
|
-
get estimatedBytes(): number {
|
|
281
|
-
return bytes;
|
|
282
|
-
},
|
|
283
|
-
*entries(): IterableIterator<[string, T]> {
|
|
284
|
-
for (const [key, entry] of local) yield [key, entry.value];
|
|
285
|
-
},
|
|
286
|
-
};
|
|
287
|
-
}
|