@craft-ts/core 0.7.0-beta.13 → 0.7.0-beta.16
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/package.json +10 -2
- package/src/index.d.ts +156 -148
- package/src/index.js +153 -142
- package/src/lib/after-recomputation.d.ts +3 -4
- package/src/lib/after-recomputation.js +3 -4
- package/src/lib/app-checked-di.d.ts +3 -4
- package/src/lib/app-checked-di.js +0 -1
- package/src/lib/async-process.d.ts +18 -19
- package/src/lib/async-process.js +24 -25
- package/src/lib/branded-component/branded-component.d.ts +3 -4
- package/src/lib/branded-component/branded-component.js +0 -1
- package/src/lib/browser-boundaries.d.ts +6 -7
- package/src/lib/browser-boundaries.js +5 -6
- package/src/lib/client-di-requirement.d.ts +1 -2
- package/src/lib/client-di-requirement.js +0 -1
- package/src/lib/client-function-middleware.d.ts +8 -92
- package/src/lib/client-function-middleware.js +89 -90
- package/src/lib/component-monitoring.d.ts +1 -2
- package/src/lib/component-monitoring.js +2 -3
- package/src/lib/component-register.d.ts +1 -2
- package/src/lib/component-register.js +1 -2
- package/src/lib/computed-source.d.ts +3 -4
- package/src/lib/computed-source.js +2 -3
- package/src/lib/correlation-id-plugin.d.ts +1 -2
- package/src/lib/correlation-id-plugin.js +6 -7
- package/src/lib/correlation-id.d.ts +4 -5
- package/src/lib/correlation-id.js +3 -4
- package/src/lib/craft-a11y.d.ts +3 -4
- package/src/lib/craft-a11y.js +5 -6
- package/src/lib/craft-activated-route.d.ts +2 -3
- package/src/lib/craft-activated-route.js +2 -3
- package/src/lib/craft-app-config.d.ts +4 -5
- package/src/lib/craft-app-config.js +3 -4
- package/src/lib/craft-codec.d.ts +0 -1
- package/src/lib/craft-codec.js +0 -1
- package/src/lib/craft-computed.d.ts +6 -7
- package/src/lib/craft-computed.js +7 -8
- package/src/lib/craft-control-flow.d.ts +0 -1
- package/src/lib/craft-control-flow.js +2 -3
- package/src/lib/craft-effect.d.ts +2 -3
- package/src/lib/craft-effect.js +7 -8
- package/src/lib/craft-exception.d.ts +0 -1
- package/src/lib/craft-exception.js +0 -1
- package/src/lib/craft-gen.d.ts +1 -2
- package/src/lib/craft-gen.js +2 -3
- package/src/lib/craft-generator-runtime.d.ts +21 -5
- package/src/lib/craft-generator-runtime.js +28 -6
- package/src/lib/craft-guard-runtime.d.ts +4 -5
- package/src/lib/craft-guard-runtime.js +6 -7
- package/src/lib/craft-handshake.d.ts +1 -2
- package/src/lib/craft-handshake.js +0 -1
- package/src/lib/craft-http-client.d.ts +3 -4
- package/src/lib/craft-http-client.js +4 -5
- package/src/lib/craft-http-trace.d.ts +1 -2
- package/src/lib/craft-http-trace.js +5 -2
- package/src/lib/craft-hydration.d.ts +11 -0
- package/src/lib/craft-hydration.js +2 -0
- package/src/lib/craft-lazy.d.ts +3 -4
- package/src/lib/craft-lazy.js +5 -6
- package/src/lib/craft-load-retry.d.ts +2 -3
- package/src/lib/craft-load-retry.js +11 -4
- package/src/lib/craft-machine-history.d.ts +6 -7
- package/src/lib/craft-machine-history.js +6 -7
- package/src/lib/craft-match.d.ts +0 -1
- package/src/lib/craft-match.js +0 -1
- package/src/lib/craft-method.d.ts +3 -4
- package/src/lib/craft-method.js +5 -6
- package/src/lib/craft-node-directive.d.ts +3 -4
- package/src/lib/craft-node-directive.js +2 -3
- package/src/lib/craft-pending.d.ts +3 -4
- package/src/lib/craft-pending.js +2 -3
- package/src/lib/craft-pipe.d.ts +1 -2
- package/src/lib/craft-pipe.js +7 -8
- package/src/lib/craft-platform.d.ts +2 -3
- package/src/lib/craft-platform.js +2 -3
- package/src/lib/craft-primitive-gen.d.ts +7 -8
- package/src/lib/craft-primitive-gen.js +4 -5
- package/src/lib/craft-primitive-registry.d.ts +4 -2
- package/src/lib/craft-primitive-registry.js +5 -3
- package/src/lib/craft-program-operators.d.ts +3 -4
- package/src/lib/craft-program-operators.js +4 -5
- package/src/lib/craft-program-runtime.d.ts +3 -4
- package/src/lib/craft-program-runtime.js +7 -8
- package/src/lib/craft-register-for-runtime.d.ts +2 -3
- package/src/lib/craft-register-for-runtime.js +2 -3
- package/src/lib/craft-register-for.d.ts +3 -4
- package/src/lib/craft-register-for.js +6 -7
- package/src/lib/craft-render-identity.d.ts +0 -1
- package/src/lib/craft-render-identity.js +1 -2
- package/src/lib/craft-replay.d.ts +0 -1
- package/src/lib/craft-replay.js +0 -1
- package/src/lib/craft-request-context.d.ts +15 -0
- package/src/lib/craft-request-context.js +40 -0
- package/src/lib/craft-resolve.d.ts +2 -3
- package/src/lib/craft-resolve.js +0 -1
- package/src/lib/craft-resource.d.ts +2 -3
- package/src/lib/craft-resource.js +14 -6
- package/src/lib/craft-route-exceptions.d.ts +27 -28
- package/src/lib/craft-route-exceptions.js +3 -4
- package/src/lib/craft-route-load-error.d.ts +92 -93
- package/src/lib/craft-route-load-error.js +6 -7
- package/src/lib/craft-route-meta.d.ts +4 -5
- package/src/lib/craft-route-meta.js +0 -1
- package/src/lib/craft-route-target.d.ts +1 -2
- package/src/lib/craft-route-target.js +1 -2
- package/src/lib/craft-router-outlet.d.ts +7 -7
- package/src/lib/craft-router-outlet.js +24 -18
- package/src/lib/craft-router-tokens.d.ts +3 -4
- package/src/lib/craft-router-tokens.js +2 -3
- package/src/lib/craft-router-trace.d.ts +3 -4
- package/src/lib/craft-router-trace.js +9 -3
- package/src/lib/craft-router.d.ts +16 -17
- package/src/lib/craft-router.js +75 -74
- package/src/lib/craft-routes.d.ts +20 -15
- package/src/lib/craft-routes.js +13 -12
- package/src/lib/craft-runtime-mode.d.ts +13 -0
- package/src/lib/craft-runtime-mode.js +21 -0
- package/src/lib/craft-security.d.ts +87 -0
- package/src/lib/craft-security.js +117 -0
- package/src/lib/craft-service.d.ts +12 -13
- package/src/lib/craft-service.js +11 -12
- package/src/lib/craft-service.shared.d.ts +0 -1
- package/src/lib/craft-service.shared.js +0 -1
- package/src/lib/craft-settled.d.ts +23 -16
- package/src/lib/craft-settled.js +9 -10
- package/src/lib/craft-ssr.d.ts +2 -3
- package/src/lib/craft-ssr.js +4 -5
- package/src/lib/craft-state-machine-runtime.d.ts +2 -3
- package/src/lib/craft-state-machine-runtime.js +3 -4
- package/src/lib/craft-state-machine.d.ts +5 -6
- package/src/lib/craft-state-machine.js +9 -10
- package/src/lib/craft-target-runtime.d.ts +1 -2
- package/src/lib/craft-target-runtime.js +2 -3
- package/src/lib/craft-transfer-snapshot.d.ts +10 -5
- package/src/lib/craft-transfer-snapshot.js +139 -14
- package/src/lib/craft-unique.d.ts +0 -1
- package/src/lib/craft-unique.js +0 -1
- package/src/lib/craft-until-settled.d.ts +5 -6
- package/src/lib/craft-until-settled.js +4 -5
- package/src/lib/craft-use.d.ts +0 -1
- package/src/lib/craft-use.js +2 -3
- package/src/lib/craft-view-transition.d.ts +2 -3
- package/src/lib/craft-view-transition.js +2 -3
- package/src/lib/dev-tools.d.ts +7 -0
- package/src/lib/dev-tools.js +244 -0
- package/src/lib/dom-event-hook.d.ts +1 -2
- package/src/lib/dom-event-hook.js +1 -2
- package/src/lib/fn-wrapper.d.ts +2 -3
- package/src/lib/fn-wrapper.js +3 -4
- package/src/lib/form/craft-field.d.ts +2 -3
- package/src/lib/form/craft-field.directive.d.ts +6 -7
- package/src/lib/form/craft-field.directive.js +5 -6
- package/src/lib/form/craft-field.js +1 -2
- package/src/lib/form/field-exception.d.ts +4 -5
- package/src/lib/form/field-exception.js +1 -2
- package/src/lib/form/field-lens.d.ts +0 -1
- package/src/lib/form/field-lens.js +0 -1
- package/src/lib/form/insert-form-attributes.d.ts +6 -7
- package/src/lib/form/insert-form-attributes.js +5 -6
- package/src/lib/form/insert-form-internals.d.ts +11 -12
- package/src/lib/form/insert-form-internals.js +9 -10
- package/src/lib/form/insert-form-schema.d.ts +3 -4
- package/src/lib/form/insert-form-schema.js +4 -5
- package/src/lib/form/insert-form-submit.d.ts +7 -8
- package/src/lib/form/insert-form-submit.js +3 -4
- package/src/lib/form/insert-form.d.ts +6 -7
- package/src/lib/form/insert-form.js +8 -9
- package/src/lib/form/insert-select-form-tree.d.ts +2 -3
- package/src/lib/form/insert-select-form-tree.js +5 -6
- package/src/lib/form/insert-sub-form-field.d.ts +3 -4
- package/src/lib/form/insert-sub-form-field.js +6 -7
- package/src/lib/form/make-form-tree-insert.d.ts +1 -2
- package/src/lib/form/make-form-tree-insert.js +3 -4
- package/src/lib/form/target-form-field.d.ts +0 -1
- package/src/lib/form/target-form-field.js +0 -1
- package/src/lib/form/validator.d.ts +5 -6
- package/src/lib/form/validator.js +3 -4
- package/src/lib/from-event-to-source$.d.ts +2 -3
- package/src/lib/from-event-to-source$.js +3 -4
- package/src/lib/global-persister-handler.service.d.ts +1 -2
- package/src/lib/global-persister-handler.service.js +2 -3
- package/src/lib/host/craft-compat.d.ts +2 -3
- package/src/lib/host/craft-compat.js +2 -3
- package/src/lib/host/craft-dom.d.ts +0 -1
- package/src/lib/host/craft-dom.js +0 -1
- package/src/lib/host/craft-http.d.ts +0 -1
- package/src/lib/host/craft-http.js +0 -1
- package/src/lib/host/craft-injector-host.d.ts +2 -3
- package/src/lib/host/craft-injector-host.js +1 -2
- package/src/lib/host/craft-injector.d.ts +0 -1
- package/src/lib/host/craft-injector.js +0 -1
- package/src/lib/host/craft-linked-signal.d.ts +1 -2
- package/src/lib/host/craft-linked-signal.js +2 -3
- package/src/lib/host/craft-router-runtime.d.ts +0 -1
- package/src/lib/host/craft-router-runtime.js +0 -1
- package/src/lib/host/craft-router-types.d.ts +1 -2
- package/src/lib/host/craft-router-types.js +1 -2
- package/src/lib/host/craft-signal.d.ts +0 -1
- package/src/lib/host/craft-signal.js +1 -2
- package/src/lib/host/craft-test-bed.d.ts +2 -3
- package/src/lib/host/craft-test-bed.js +2 -3
- package/src/lib/host-tag.d.ts +1 -2
- package/src/lib/host-tag.js +1 -2
- package/src/lib/http-server.d.ts +156 -0
- package/src/lib/http-server.js +590 -0
- package/src/lib/insert-entities.d.ts +5 -6
- package/src/lib/insert-entities.js +1 -2
- package/src/lib/insert-noop-typing-anchor.d.ts +1 -2
- package/src/lib/insert-noop-typing-anchor.js +0 -1
- package/src/lib/insert-pagination-placeholder-data.d.ts +5 -6
- package/src/lib/insert-pagination-placeholder-data.js +5 -6
- package/src/lib/insert-react-on-mutation.d.ts +5 -6
- package/src/lib/insert-react-on-mutation.js +2 -3
- package/src/lib/insert-select-resource.d.ts +2 -3
- package/src/lib/insert-select-resource.js +1 -2
- package/src/lib/insert-select.d.ts +5 -6
- package/src/lib/insert-select.js +18 -19
- package/src/lib/insert-storage-persister.d.ts +4 -5
- package/src/lib/insert-storage-persister.js +2 -3
- package/src/lib/insert-typed-pipes.d.ts +3 -4
- package/src/lib/insert-typed-pipes.js +2 -3
- package/src/lib/lambda-adapter.d.ts +52 -0
- package/src/lib/lambda-adapter.js +101 -0
- package/src/lib/linked-source.d.ts +3 -4
- package/src/lib/linked-source.js +2 -3
- package/src/lib/local-storage-persister.d.ts +2 -3
- package/src/lib/local-storage-persister.js +3 -4
- package/src/lib/middleware-schema-shared.d.ts +9 -21
- package/src/lib/middleware-schema-shared.js +6 -1
- package/src/lib/mock-http-request-for-route.d.ts +3 -4
- package/src/lib/mock-http-request-for-route.js +0 -1
- package/src/lib/mutation.d.ts +18 -19
- package/src/lib/mutation.js +23 -24
- package/src/lib/on$.d.ts +6 -7
- package/src/lib/on$.js +4 -5
- package/src/lib/portable-server-function.d.ts +8 -9
- package/src/lib/portable-server-function.js +12 -5
- package/src/lib/preserved-resource.d.ts +2 -3
- package/src/lib/preserved-resource.js +4 -5
- package/src/lib/primitive-method-runtime-context.d.ts +1 -2
- package/src/lib/primitive-method-runtime-context.js +2 -3
- package/src/lib/primitive-resource-runtime-context.d.ts +1 -2
- package/src/lib/primitive-resource-runtime-context.js +2 -3
- package/src/lib/query-params.d.ts +12 -13
- package/src/lib/query-params.js +15 -16
- package/src/lib/query.core.d.ts +15 -14
- package/src/lib/query.core.js +1 -2
- package/src/lib/query.d.ts +19 -20
- package/src/lib/query.js +23 -24
- package/src/lib/reactive-read.d.ts +2 -3
- package/src/lib/reactive-read.js +2 -3
- package/src/lib/render/channels.d.ts +130 -0
- package/src/lib/render/channels.js +0 -0
- package/src/lib/resource-by-id.d.ts +4 -5
- package/src/lib/resource-by-id.js +4 -5
- package/src/lib/resource-exception.d.ts +2 -3
- package/src/lib/resource-exception.js +1 -2
- package/src/lib/route-checked-di.d.ts +4 -5
- package/src/lib/route-checked-di.js +0 -1
- package/src/lib/schema-validation.d.ts +4 -5
- package/src/lib/schema-validation.js +2 -3
- package/src/lib/send-context-to-ai.d.ts +3 -4
- package/src/lib/send-context-to-ai.js +1 -2
- package/src/lib/send-context-to-ai.tokens.d.ts +1 -2
- package/src/lib/send-context-to-ai.tokens.js +0 -1
- package/src/lib/server-function-client.d.ts +18 -7
- package/src/lib/server-function-client.js +31 -9
- package/src/lib/server-function-contract.d.ts +1 -2
- package/src/lib/server-function-contract.js +0 -1
- package/src/lib/server-function-middleware.d.ts +49 -132
- package/src/lib/server-function-middleware.js +83 -103
- package/src/lib/server-function.d.ts +58 -8
- package/src/lib/server-function.js +20 -6
- package/src/lib/server-layer.d.ts +3 -4
- package/src/lib/server-layer.js +1 -2
- package/src/lib/server.d.ts +39 -6
- package/src/lib/server.js +259 -27
- package/src/lib/setup-craft-service-test.d.ts +3 -4
- package/src/lib/setup-craft-service-test.js +6 -7
- package/src/lib/setup-craft-service-testing-by-register.d.ts +4 -5
- package/src/lib/setup-craft-service-testing-by-register.js +4 -5
- package/src/lib/signal-proxy.d.ts +2 -3
- package/src/lib/signal-proxy.js +1 -2
- package/src/lib/signal-source.d.ts +3 -4
- package/src/lib/signal-source.js +7 -8
- package/src/lib/source$.d.ts +3 -4
- package/src/lib/source$.js +7 -8
- package/src/lib/source-from-event.d.ts +2 -3
- package/src/lib/source-from-event.js +2 -3
- package/src/lib/stacked-source.d.ts +1 -2
- package/src/lib/stacked-source.js +1 -2
- package/src/lib/standard-schema.d.ts +0 -1
- package/src/lib/standard-schema.js +0 -1
- package/src/lib/state-method-runtime-context.d.ts +2 -3
- package/src/lib/state-method-runtime-context.js +1 -2
- package/src/lib/state.d.ts +13 -14
- package/src/lib/state.js +17 -18
- package/src/lib/storage-persister.service.d.ts +3 -4
- package/src/lib/storage-persister.service.js +3 -4
- package/src/lib/take-app-snapshot.d.ts +1 -2
- package/src/lib/take-app-snapshot.js +10 -4
- package/src/lib/template-trace.d.ts +1 -2
- package/src/lib/template-trace.js +5 -2
- package/src/lib/temporal-runtime.d.ts +1 -2
- package/src/lib/temporal-runtime.js +1 -2
- package/src/lib/to-source.d.ts +3 -4
- package/src/lib/to-source.js +2 -3
- package/src/lib/util/craft-resource-ref.d.ts +2 -3
- package/src/lib/util/craft-resource-ref.js +0 -1
- package/src/lib/util/craft-resource-status.d.ts +1 -2
- package/src/lib/util/craft-resource-status.js +0 -1
- package/src/lib/util/entities-util.d.ts +0 -1
- package/src/lib/util/entities-util.js +0 -1
- package/src/lib/util/explicit-effect.d.ts +1 -2
- package/src/lib/util/explicit-effect.js +1 -2
- package/src/lib/util/extract-signal-props-and-methods.d.ts +2 -3
- package/src/lib/util/extract-signal-props-and-methods.js +0 -1
- package/src/lib/util/method-trigger-nonce.d.ts +1 -2
- package/src/lib/util/method-trigger-nonce.js +0 -1
- package/src/lib/util/persister.type.d.ts +2 -3
- package/src/lib/util/persister.type.js +0 -1
- package/src/lib/util/persister.util.d.ts +0 -1
- package/src/lib/util/persister.util.js +0 -1
- package/src/lib/util/react-on-mutation-effect.d.ts +5 -6
- package/src/lib/util/react-on-mutation-effect.js +4 -5
- package/src/lib/util/resource-by-id-changes-tracker.util.d.ts +2 -3
- package/src/lib/util/resource-by-id-changes-tracker.util.js +2 -3
- package/src/lib/util/source.type.d.ts +2 -3
- package/src/lib/util/source.type.js +0 -1
- package/src/lib/util/types/access-type-object-property-by-dotted-path.type.d.ts +1 -2
- package/src/lib/util/types/access-type-object-property-by-dotted-path.type.js +0 -1
- package/src/lib/util/types/boolean-or-mapper-fn-by-path-by-id.type.d.ts +4 -5
- package/src/lib/util/types/boolean-or-mapper-fn-by-path-by-id.type.js +0 -1
- package/src/lib/util/types/boolean-or-mapper-fn-by-path.type.d.ts +3 -4
- package/src/lib/util/types/boolean-or-mapper-fn-by-path.type.js +0 -1
- package/src/lib/util/types/brand.d.ts +0 -1
- package/src/lib/util/types/brand.js +0 -1
- package/src/lib/util/types/object-deep-path-mapper.type.d.ts +1 -2
- package/src/lib/util/types/object-deep-path-mapper.type.js +0 -1
- package/src/lib/util/types/resource-by-id-config.type.d.ts +3 -4
- package/src/lib/util/types/resource-by-id-config.type.js +0 -1
- package/src/lib/util/types/resource-with-params-or-params-fn.type.d.ts +2 -3
- package/src/lib/util/types/resource-with-params-or-params-fn.type.js +0 -1
- package/src/lib/util/types/shared.type.d.ts +6 -7
- package/src/lib/util/types/shared.type.js +0 -1
- package/src/lib/util/types/util.d.ts +2 -3
- package/src/lib/util/types/util.js +3 -3
- package/src/lib/util/types/util.type.d.ts +3 -4
- package/src/lib/util/types/util.type.js +0 -1
- package/src/lib/util/update-state.util.d.ts +0 -1
- package/src/lib/util/update-state.util.js +0 -1
- package/src/lib/util/util.d.ts +2 -3
- package/src/lib/util/util.js +1 -2
- package/src/lib/util/util.type.d.ts +5 -6
- package/src/lib/util/util.type.js +0 -1
- package/src/lib/worker-adapter.d.ts +8 -0
- package/src/lib/worker-adapter.js +8 -0
- package/src/lib/yieldable.d.ts +4 -5
- package/src/lib/yieldable.js +4 -5
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/after-recomputation.d.ts.map +0 -1
- package/src/lib/after-recomputation.js.map +0 -1
- package/src/lib/app-checked-di.d.ts.map +0 -1
- package/src/lib/app-checked-di.js.map +0 -1
- package/src/lib/async-process.d.ts.map +0 -1
- package/src/lib/async-process.js.map +0 -1
- package/src/lib/branded-component/branded-component.d.ts.map +0 -1
- package/src/lib/branded-component/branded-component.js.map +0 -1
- package/src/lib/browser-boundaries.d.ts.map +0 -1
- package/src/lib/browser-boundaries.js.map +0 -1
- package/src/lib/client-di-requirement.d.ts.map +0 -1
- package/src/lib/client-di-requirement.js.map +0 -1
- package/src/lib/client-function-middleware.d.ts.map +0 -1
- package/src/lib/client-function-middleware.js.map +0 -1
- package/src/lib/component-monitoring.d.ts.map +0 -1
- package/src/lib/component-monitoring.js.map +0 -1
- package/src/lib/component-register.d.ts.map +0 -1
- package/src/lib/component-register.js.map +0 -1
- package/src/lib/computed-source.d.ts.map +0 -1
- package/src/lib/computed-source.js.map +0 -1
- package/src/lib/correlation-id-plugin.d.ts.map +0 -1
- package/src/lib/correlation-id-plugin.js.map +0 -1
- package/src/lib/correlation-id.d.ts.map +0 -1
- package/src/lib/correlation-id.js.map +0 -1
- package/src/lib/craft-a11y.d.ts.map +0 -1
- package/src/lib/craft-a11y.js.map +0 -1
- package/src/lib/craft-activated-route.d.ts.map +0 -1
- package/src/lib/craft-activated-route.js.map +0 -1
- package/src/lib/craft-app-config.d.ts.map +0 -1
- package/src/lib/craft-app-config.js.map +0 -1
- package/src/lib/craft-codec.d.ts.map +0 -1
- package/src/lib/craft-codec.js.map +0 -1
- package/src/lib/craft-computed.d.ts.map +0 -1
- package/src/lib/craft-computed.js.map +0 -1
- package/src/lib/craft-control-flow.d.ts.map +0 -1
- package/src/lib/craft-control-flow.js.map +0 -1
- package/src/lib/craft-effect.d.ts.map +0 -1
- package/src/lib/craft-effect.js.map +0 -1
- package/src/lib/craft-exception.d.ts.map +0 -1
- package/src/lib/craft-exception.js.map +0 -1
- package/src/lib/craft-gen.d.ts.map +0 -1
- package/src/lib/craft-gen.js.map +0 -1
- package/src/lib/craft-generator-runtime.d.ts.map +0 -1
- package/src/lib/craft-generator-runtime.js.map +0 -1
- package/src/lib/craft-guard-runtime.d.ts.map +0 -1
- package/src/lib/craft-guard-runtime.js.map +0 -1
- package/src/lib/craft-handshake.d.ts.map +0 -1
- package/src/lib/craft-handshake.js.map +0 -1
- package/src/lib/craft-http-client.d.ts.map +0 -1
- package/src/lib/craft-http-client.js.map +0 -1
- package/src/lib/craft-http-trace.d.ts.map +0 -1
- package/src/lib/craft-http-trace.js.map +0 -1
- package/src/lib/craft-lazy.d.ts.map +0 -1
- package/src/lib/craft-lazy.js.map +0 -1
- package/src/lib/craft-load-retry.d.ts.map +0 -1
- package/src/lib/craft-load-retry.js.map +0 -1
- package/src/lib/craft-machine-history.d.ts.map +0 -1
- package/src/lib/craft-machine-history.js.map +0 -1
- package/src/lib/craft-match.d.ts.map +0 -1
- package/src/lib/craft-match.js.map +0 -1
- package/src/lib/craft-method.d.ts.map +0 -1
- package/src/lib/craft-method.js.map +0 -1
- package/src/lib/craft-node-directive.d.ts.map +0 -1
- package/src/lib/craft-node-directive.js.map +0 -1
- package/src/lib/craft-pending.d.ts.map +0 -1
- package/src/lib/craft-pending.js.map +0 -1
- package/src/lib/craft-pipe.d.ts.map +0 -1
- package/src/lib/craft-pipe.js.map +0 -1
- package/src/lib/craft-platform.d.ts.map +0 -1
- package/src/lib/craft-platform.js.map +0 -1
- package/src/lib/craft-primitive-gen.d.ts.map +0 -1
- package/src/lib/craft-primitive-gen.js.map +0 -1
- package/src/lib/craft-primitive-registry.d.ts.map +0 -1
- package/src/lib/craft-primitive-registry.js.map +0 -1
- package/src/lib/craft-program-operators.d.ts.map +0 -1
- package/src/lib/craft-program-operators.js.map +0 -1
- package/src/lib/craft-program-runtime.d.ts.map +0 -1
- package/src/lib/craft-program-runtime.js.map +0 -1
- package/src/lib/craft-register-for-runtime.d.ts.map +0 -1
- package/src/lib/craft-register-for-runtime.js.map +0 -1
- package/src/lib/craft-register-for.d.ts.map +0 -1
- package/src/lib/craft-register-for.js.map +0 -1
- package/src/lib/craft-render-identity.d.ts.map +0 -1
- package/src/lib/craft-render-identity.js.map +0 -1
- package/src/lib/craft-replay.d.ts.map +0 -1
- package/src/lib/craft-replay.js.map +0 -1
- package/src/lib/craft-resolve.d.ts.map +0 -1
- package/src/lib/craft-resolve.js.map +0 -1
- package/src/lib/craft-resource.d.ts.map +0 -1
- package/src/lib/craft-resource.js.map +0 -1
- package/src/lib/craft-route-exceptions.d.ts.map +0 -1
- package/src/lib/craft-route-exceptions.js.map +0 -1
- package/src/lib/craft-route-load-error.d.ts.map +0 -1
- package/src/lib/craft-route-load-error.js.map +0 -1
- package/src/lib/craft-route-meta.d.ts.map +0 -1
- package/src/lib/craft-route-meta.js.map +0 -1
- package/src/lib/craft-route-target.d.ts.map +0 -1
- package/src/lib/craft-route-target.js.map +0 -1
- package/src/lib/craft-router-outlet.d.ts.map +0 -1
- package/src/lib/craft-router-outlet.js.map +0 -1
- package/src/lib/craft-router-tokens.d.ts.map +0 -1
- package/src/lib/craft-router-tokens.js.map +0 -1
- package/src/lib/craft-router-trace.d.ts.map +0 -1
- package/src/lib/craft-router-trace.js.map +0 -1
- package/src/lib/craft-router.d.ts.map +0 -1
- package/src/lib/craft-router.js.map +0 -1
- package/src/lib/craft-routes.d.ts.map +0 -1
- package/src/lib/craft-routes.js.map +0 -1
- package/src/lib/craft-service.d.ts.map +0 -1
- package/src/lib/craft-service.js.map +0 -1
- package/src/lib/craft-service.shared.d.ts.map +0 -1
- package/src/lib/craft-service.shared.js.map +0 -1
- package/src/lib/craft-settled.d.ts.map +0 -1
- package/src/lib/craft-settled.js.map +0 -1
- package/src/lib/craft-ssr.d.ts.map +0 -1
- package/src/lib/craft-ssr.js.map +0 -1
- package/src/lib/craft-state-machine-runtime.d.ts.map +0 -1
- package/src/lib/craft-state-machine-runtime.js.map +0 -1
- package/src/lib/craft-state-machine.d.ts.map +0 -1
- package/src/lib/craft-state-machine.js.map +0 -1
- package/src/lib/craft-target-runtime.d.ts.map +0 -1
- package/src/lib/craft-target-runtime.js.map +0 -1
- package/src/lib/craft-transfer-snapshot.d.ts.map +0 -1
- package/src/lib/craft-transfer-snapshot.js.map +0 -1
- package/src/lib/craft-unique.d.ts.map +0 -1
- package/src/lib/craft-unique.js.map +0 -1
- package/src/lib/craft-until-settled.d.ts.map +0 -1
- package/src/lib/craft-until-settled.js.map +0 -1
- package/src/lib/craft-use.d.ts.map +0 -1
- package/src/lib/craft-use.js.map +0 -1
- package/src/lib/craft-view-transition.d.ts.map +0 -1
- package/src/lib/craft-view-transition.js.map +0 -1
- package/src/lib/dom-event-hook.d.ts.map +0 -1
- package/src/lib/dom-event-hook.js.map +0 -1
- package/src/lib/fn-wrapper.d.ts.map +0 -1
- package/src/lib/fn-wrapper.js.map +0 -1
- package/src/lib/form/craft-field.d.ts.map +0 -1
- package/src/lib/form/craft-field.directive.d.ts.map +0 -1
- package/src/lib/form/craft-field.directive.js.map +0 -1
- package/src/lib/form/craft-field.js.map +0 -1
- package/src/lib/form/field-exception.d.ts.map +0 -1
- package/src/lib/form/field-exception.js.map +0 -1
- package/src/lib/form/field-lens.d.ts.map +0 -1
- package/src/lib/form/field-lens.js.map +0 -1
- package/src/lib/form/insert-form-attributes.d.ts.map +0 -1
- package/src/lib/form/insert-form-attributes.js.map +0 -1
- package/src/lib/form/insert-form-internals.d.ts.map +0 -1
- package/src/lib/form/insert-form-internals.js.map +0 -1
- package/src/lib/form/insert-form-schema.d.ts.map +0 -1
- package/src/lib/form/insert-form-schema.js.map +0 -1
- package/src/lib/form/insert-form-submit.d.ts.map +0 -1
- package/src/lib/form/insert-form-submit.js.map +0 -1
- package/src/lib/form/insert-form.d.ts.map +0 -1
- package/src/lib/form/insert-form.js.map +0 -1
- package/src/lib/form/insert-select-form-tree.d.ts.map +0 -1
- package/src/lib/form/insert-select-form-tree.js.map +0 -1
- package/src/lib/form/insert-sub-form-field.d.ts.map +0 -1
- package/src/lib/form/insert-sub-form-field.js.map +0 -1
- package/src/lib/form/make-form-tree-insert.d.ts.map +0 -1
- package/src/lib/form/make-form-tree-insert.js.map +0 -1
- package/src/lib/form/target-form-field.d.ts.map +0 -1
- package/src/lib/form/target-form-field.js.map +0 -1
- package/src/lib/form/validator.d.ts.map +0 -1
- package/src/lib/form/validator.js.map +0 -1
- package/src/lib/from-event-to-source$.d.ts.map +0 -1
- package/src/lib/from-event-to-source$.js.map +0 -1
- package/src/lib/global-persister-handler.service.d.ts.map +0 -1
- package/src/lib/global-persister-handler.service.js.map +0 -1
- package/src/lib/host/craft-compat.d.ts.map +0 -1
- package/src/lib/host/craft-compat.js.map +0 -1
- package/src/lib/host/craft-dom.d.ts.map +0 -1
- package/src/lib/host/craft-dom.js.map +0 -1
- package/src/lib/host/craft-http.d.ts.map +0 -1
- package/src/lib/host/craft-http.js.map +0 -1
- package/src/lib/host/craft-injector-host.d.ts.map +0 -1
- package/src/lib/host/craft-injector-host.js.map +0 -1
- package/src/lib/host/craft-injector.d.ts.map +0 -1
- package/src/lib/host/craft-injector.js.map +0 -1
- package/src/lib/host/craft-linked-signal.d.ts.map +0 -1
- package/src/lib/host/craft-linked-signal.js.map +0 -1
- package/src/lib/host/craft-router-runtime.d.ts.map +0 -1
- package/src/lib/host/craft-router-runtime.js.map +0 -1
- package/src/lib/host/craft-router-types.d.ts.map +0 -1
- package/src/lib/host/craft-router-types.js.map +0 -1
- package/src/lib/host/craft-signal.d.ts.map +0 -1
- package/src/lib/host/craft-signal.js.map +0 -1
- package/src/lib/host/craft-test-bed.d.ts.map +0 -1
- package/src/lib/host/craft-test-bed.js.map +0 -1
- package/src/lib/host-tag.d.ts.map +0 -1
- package/src/lib/host-tag.js.map +0 -1
- package/src/lib/insert-entities.d.ts.map +0 -1
- package/src/lib/insert-entities.js.map +0 -1
- package/src/lib/insert-noop-typing-anchor.d.ts.map +0 -1
- package/src/lib/insert-noop-typing-anchor.js.map +0 -1
- package/src/lib/insert-pagination-placeholder-data.d.ts.map +0 -1
- package/src/lib/insert-pagination-placeholder-data.js.map +0 -1
- package/src/lib/insert-react-on-mutation.d.ts.map +0 -1
- package/src/lib/insert-react-on-mutation.js.map +0 -1
- package/src/lib/insert-select-resource.d.ts.map +0 -1
- package/src/lib/insert-select-resource.js.map +0 -1
- package/src/lib/insert-select.d.ts.map +0 -1
- package/src/lib/insert-select.js.map +0 -1
- package/src/lib/insert-storage-persister.d.ts.map +0 -1
- package/src/lib/insert-storage-persister.js.map +0 -1
- package/src/lib/insert-typed-pipes.d.ts.map +0 -1
- package/src/lib/insert-typed-pipes.js.map +0 -1
- package/src/lib/linked-source.d.ts.map +0 -1
- package/src/lib/linked-source.js.map +0 -1
- package/src/lib/local-storage-persister.d.ts.map +0 -1
- package/src/lib/local-storage-persister.js.map +0 -1
- package/src/lib/middleware-schema-shared.d.ts.map +0 -1
- package/src/lib/middleware-schema-shared.js.map +0 -1
- package/src/lib/mock-http-request-for-route.d.ts.map +0 -1
- package/src/lib/mock-http-request-for-route.js.map +0 -1
- package/src/lib/mutation.d.ts.map +0 -1
- package/src/lib/mutation.js.map +0 -1
- package/src/lib/on$.d.ts.map +0 -1
- package/src/lib/on$.js.map +0 -1
- package/src/lib/portable-server-function.d.ts.map +0 -1
- package/src/lib/portable-server-function.js.map +0 -1
- package/src/lib/preserved-resource.d.ts.map +0 -1
- package/src/lib/preserved-resource.js.map +0 -1
- package/src/lib/primitive-method-runtime-context.d.ts.map +0 -1
- package/src/lib/primitive-method-runtime-context.js.map +0 -1
- package/src/lib/primitive-resource-runtime-context.d.ts.map +0 -1
- package/src/lib/primitive-resource-runtime-context.js.map +0 -1
- package/src/lib/query-params.d.ts.map +0 -1
- package/src/lib/query-params.js.map +0 -1
- package/src/lib/query.core.d.ts.map +0 -1
- package/src/lib/query.core.js.map +0 -1
- package/src/lib/query.d.ts.map +0 -1
- package/src/lib/query.js.map +0 -1
- package/src/lib/reactive-read.d.ts.map +0 -1
- package/src/lib/reactive-read.js.map +0 -1
- package/src/lib/resource-by-id.d.ts.map +0 -1
- package/src/lib/resource-by-id.js.map +0 -1
- package/src/lib/resource-exception.d.ts.map +0 -1
- package/src/lib/resource-exception.js.map +0 -1
- package/src/lib/route-checked-di.d.ts.map +0 -1
- package/src/lib/route-checked-di.js.map +0 -1
- package/src/lib/schema-validation.d.ts.map +0 -1
- package/src/lib/schema-validation.js.map +0 -1
- package/src/lib/send-context-to-ai.d.ts.map +0 -1
- package/src/lib/send-context-to-ai.js.map +0 -1
- package/src/lib/send-context-to-ai.tokens.d.ts.map +0 -1
- package/src/lib/send-context-to-ai.tokens.js.map +0 -1
- package/src/lib/server-function-client.d.ts.map +0 -1
- package/src/lib/server-function-client.js.map +0 -1
- package/src/lib/server-function-contract.d.ts.map +0 -1
- package/src/lib/server-function-contract.js.map +0 -1
- package/src/lib/server-function-middleware.d.ts.map +0 -1
- package/src/lib/server-function-middleware.js.map +0 -1
- package/src/lib/server-function.d.ts.map +0 -1
- package/src/lib/server-function.js.map +0 -1
- package/src/lib/server-layer.d.ts.map +0 -1
- package/src/lib/server-layer.js.map +0 -1
- package/src/lib/server.d.ts.map +0 -1
- package/src/lib/server.js.map +0 -1
- package/src/lib/setup-craft-service-test.d.ts.map +0 -1
- package/src/lib/setup-craft-service-test.js.map +0 -1
- package/src/lib/setup-craft-service-testing-by-register.d.ts.map +0 -1
- package/src/lib/setup-craft-service-testing-by-register.js.map +0 -1
- package/src/lib/signal-proxy.d.ts.map +0 -1
- package/src/lib/signal-proxy.js.map +0 -1
- package/src/lib/signal-source.d.ts.map +0 -1
- package/src/lib/signal-source.js.map +0 -1
- package/src/lib/source$.d.ts.map +0 -1
- package/src/lib/source$.js.map +0 -1
- package/src/lib/source-from-event.d.ts.map +0 -1
- package/src/lib/source-from-event.js.map +0 -1
- package/src/lib/stacked-source.d.ts.map +0 -1
- package/src/lib/stacked-source.js.map +0 -1
- package/src/lib/standard-schema.d.ts.map +0 -1
- package/src/lib/standard-schema.js.map +0 -1
- package/src/lib/state-method-runtime-context.d.ts.map +0 -1
- package/src/lib/state-method-runtime-context.js.map +0 -1
- package/src/lib/state.d.ts.map +0 -1
- package/src/lib/state.js.map +0 -1
- package/src/lib/storage-persister.service.d.ts.map +0 -1
- package/src/lib/storage-persister.service.js.map +0 -1
- package/src/lib/take-app-snapshot.d.ts.map +0 -1
- package/src/lib/take-app-snapshot.js.map +0 -1
- package/src/lib/template-trace.d.ts.map +0 -1
- package/src/lib/template-trace.js.map +0 -1
- package/src/lib/temporal-runtime.d.ts.map +0 -1
- package/src/lib/temporal-runtime.js.map +0 -1
- package/src/lib/to-source.d.ts.map +0 -1
- package/src/lib/to-source.js.map +0 -1
- package/src/lib/util/craft-resource-ref.d.ts.map +0 -1
- package/src/lib/util/craft-resource-ref.js.map +0 -1
- package/src/lib/util/craft-resource-status.d.ts.map +0 -1
- package/src/lib/util/craft-resource-status.js.map +0 -1
- package/src/lib/util/entities-util.d.ts.map +0 -1
- package/src/lib/util/entities-util.js.map +0 -1
- package/src/lib/util/explicit-effect.d.ts.map +0 -1
- package/src/lib/util/explicit-effect.js.map +0 -1
- package/src/lib/util/extract-signal-props-and-methods.d.ts.map +0 -1
- package/src/lib/util/extract-signal-props-and-methods.js.map +0 -1
- package/src/lib/util/method-trigger-nonce.d.ts.map +0 -1
- package/src/lib/util/method-trigger-nonce.js.map +0 -1
- package/src/lib/util/persister.type.d.ts.map +0 -1
- package/src/lib/util/persister.type.js.map +0 -1
- package/src/lib/util/persister.util.d.ts.map +0 -1
- package/src/lib/util/persister.util.js.map +0 -1
- package/src/lib/util/react-on-mutation-effect.d.ts.map +0 -1
- package/src/lib/util/react-on-mutation-effect.js.map +0 -1
- package/src/lib/util/resource-by-id-changes-tracker.util.d.ts.map +0 -1
- package/src/lib/util/resource-by-id-changes-tracker.util.js.map +0 -1
- package/src/lib/util/source.type.d.ts.map +0 -1
- package/src/lib/util/source.type.js.map +0 -1
- package/src/lib/util/types/access-type-object-property-by-dotted-path.type.d.ts.map +0 -1
- package/src/lib/util/types/access-type-object-property-by-dotted-path.type.js.map +0 -1
- package/src/lib/util/types/boolean-or-mapper-fn-by-path-by-id.type.d.ts.map +0 -1
- package/src/lib/util/types/boolean-or-mapper-fn-by-path-by-id.type.js.map +0 -1
- package/src/lib/util/types/boolean-or-mapper-fn-by-path.type.d.ts.map +0 -1
- package/src/lib/util/types/boolean-or-mapper-fn-by-path.type.js.map +0 -1
- package/src/lib/util/types/brand.d.ts.map +0 -1
- package/src/lib/util/types/brand.js.map +0 -1
- package/src/lib/util/types/object-deep-path-mapper.type.d.ts.map +0 -1
- package/src/lib/util/types/object-deep-path-mapper.type.js.map +0 -1
- package/src/lib/util/types/resource-by-id-config.type.d.ts.map +0 -1
- package/src/lib/util/types/resource-by-id-config.type.js.map +0 -1
- package/src/lib/util/types/resource-with-params-or-params-fn.type.d.ts.map +0 -1
- package/src/lib/util/types/resource-with-params-or-params-fn.type.js.map +0 -1
- package/src/lib/util/types/shared.type.d.ts.map +0 -1
- package/src/lib/util/types/shared.type.js.map +0 -1
- package/src/lib/util/types/util.d.ts.map +0 -1
- package/src/lib/util/types/util.js.map +0 -1
- package/src/lib/util/types/util.type.d.ts.map +0 -1
- package/src/lib/util/types/util.type.js.map +0 -1
- package/src/lib/util/update-state.util.d.ts.map +0 -1
- package/src/lib/util/update-state.util.js.map +0 -1
- package/src/lib/util/util.d.ts.map +0 -1
- package/src/lib/util/util.js.map +0 -1
- package/src/lib/util/util.type.d.ts.map +0 -1
- package/src/lib/util/util.type.js.map +0 -1
- package/src/lib/yieldable.d.ts.map +0 -1
- package/src/lib/yieldable.js.map +0 -1
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { CraftSecurityError, } from './craft-security.js';
|
|
1
2
|
export const CRAFT_TRANSFER_SNAPSHOT_VERSION = 1;
|
|
2
3
|
/** Captures only JSON-compatible state; non-serializable entries fail loudly. */
|
|
3
|
-
export function captureCraftTransferSnapshot(registry) {
|
|
4
|
+
export function captureCraftTransferSnapshot(registry, options = { legacy: true }) {
|
|
4
5
|
const values = {};
|
|
5
6
|
const queries = {};
|
|
6
7
|
for (const entry of registry.list()) {
|
|
7
|
-
|
|
8
|
+
if (!isTransferable(entry.address, entry.transfer, options.policy, options.legacy)) {
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
const value = readSerializableEntry(entry, options.policy?.maxDepth ?? Number.POSITIVE_INFINITY, options.policy?.redact);
|
|
8
12
|
if (value === SKIP_ENTRY)
|
|
9
13
|
continue;
|
|
10
14
|
if (entry.kind === 'query') {
|
|
@@ -12,7 +16,11 @@ export function captureCraftTransferSnapshot(registry) {
|
|
|
12
16
|
queries[entry.address] = {
|
|
13
17
|
status: entry.status?.() ?? (value === undefined ? 'idle' : 'resolved'),
|
|
14
18
|
...(value === undefined ? {} : { value }),
|
|
15
|
-
...(
|
|
19
|
+
...(options.policy || options.legacy === false
|
|
20
|
+
? {}
|
|
21
|
+
: error === undefined
|
|
22
|
+
? {}
|
|
23
|
+
: { error: serializeError(error) }),
|
|
16
24
|
};
|
|
17
25
|
}
|
|
18
26
|
else {
|
|
@@ -31,18 +39,24 @@ function serializeError(error) {
|
|
|
31
39
|
: error;
|
|
32
40
|
}
|
|
33
41
|
/** Primes registrations that will be created during the first client render. */
|
|
34
|
-
export function primeCraftTransferSnapshot(registry, snapshot) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
export function primeCraftTransferSnapshot(registry, snapshot, policy) {
|
|
43
|
+
validateCraftTransferSnapshot(snapshot, policy);
|
|
44
|
+
// Le filtrage par adresse appartient à la capture : le rejouer ici, avec
|
|
45
|
+
// une politique cliente qui peut différer de celle du rendu, ferait
|
|
46
|
+
// disparaître silencieusement des données légitimement transférées.
|
|
38
47
|
registry.prime({
|
|
39
48
|
...snapshot.values,
|
|
40
49
|
...Object.fromEntries(Object.entries(snapshot.queries).flatMap(([address, query]) => 'value' in query ? [[address, query.value]] : [])),
|
|
41
50
|
});
|
|
42
51
|
}
|
|
43
52
|
/** JSON safe for embedding in an HTML script element. */
|
|
44
|
-
export function serializeCraftTransferSnapshot(snapshot) {
|
|
45
|
-
|
|
53
|
+
export function serializeCraftTransferSnapshot(snapshot, policy) {
|
|
54
|
+
validateCraftTransferSnapshot(snapshot, policy);
|
|
55
|
+
const json = JSON.stringify(snapshot);
|
|
56
|
+
if (policy?.maxBytes !== undefined && byteLength(json) > policy.maxBytes) {
|
|
57
|
+
throw new CraftSecurityError('CRAFT_TRANSFER_SNAPSHOT_TOO_LARGE', `Snapshot exceeds the ${policy.maxBytes}-byte limit.`);
|
|
58
|
+
}
|
|
59
|
+
return json
|
|
46
60
|
.replaceAll('<', '\\u003c')
|
|
47
61
|
.replaceAll('>', '\\u003e')
|
|
48
62
|
.replaceAll('&', '\\u0026')
|
|
@@ -50,7 +64,7 @@ export function serializeCraftTransferSnapshot(snapshot) {
|
|
|
50
64
|
.replaceAll('\u2029', '\\u2029');
|
|
51
65
|
}
|
|
52
66
|
const SKIP_ENTRY = Symbol('skip-transfer-entry');
|
|
53
|
-
function readSerializableEntry(entry) {
|
|
67
|
+
function readSerializableEntry(entry, maxDepth = Number.POSITIVE_INFINITY, redact) {
|
|
54
68
|
let value;
|
|
55
69
|
try {
|
|
56
70
|
value = entry.read();
|
|
@@ -58,10 +72,122 @@ function readSerializableEntry(entry) {
|
|
|
58
72
|
catch {
|
|
59
73
|
return SKIP_ENTRY;
|
|
60
74
|
}
|
|
61
|
-
|
|
75
|
+
const safeValue = redactSensitive(entry.address, value);
|
|
76
|
+
const redacted = redact ? redact(entry.address, safeValue) : safeValue;
|
|
77
|
+
if (redacted === undefined && value !== undefined)
|
|
78
|
+
return SKIP_ENTRY;
|
|
79
|
+
assertSerializable(redacted, entry.address, new Set(), 0, maxDepth);
|
|
80
|
+
return redacted;
|
|
81
|
+
}
|
|
82
|
+
const SENSITIVE_NAME = /(?:^|[_:-])(pass(?:word)?|secret|token|api[-_]?key|authorization|cookie|session|private[-_]?key)(?:$|[_:-])/i;
|
|
83
|
+
function redactSensitive(address, value) {
|
|
84
|
+
return redactSensitiveWithSeen(address, value, new Set());
|
|
85
|
+
}
|
|
86
|
+
function redactSensitiveWithSeen(address, value, seen) {
|
|
87
|
+
if (SENSITIVE_NAME.test(address))
|
|
88
|
+
return undefined;
|
|
89
|
+
if (Array.isArray(value)) {
|
|
90
|
+
if (seen.has(value))
|
|
91
|
+
return value;
|
|
92
|
+
seen.add(value);
|
|
93
|
+
const result = value.map((item) => redactSensitiveWithSeen(address, item, seen));
|
|
94
|
+
seen.delete(value);
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
if (isRecord(value)) {
|
|
98
|
+
if (Object.getPrototypeOf(value) !== Object.prototype) {
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
if (seen.has(value))
|
|
102
|
+
return value;
|
|
103
|
+
seen.add(value);
|
|
104
|
+
const result = {};
|
|
105
|
+
for (const [key, child] of Object.entries(value)) {
|
|
106
|
+
if (SENSITIVE_NAME.test(key))
|
|
107
|
+
continue;
|
|
108
|
+
result[key] = redactSensitiveWithSeen(`${address}:${key}`, child, seen);
|
|
109
|
+
}
|
|
110
|
+
seen.delete(value);
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
62
113
|
return value;
|
|
63
114
|
}
|
|
64
|
-
|
|
115
|
+
/**
|
|
116
|
+
* Une primitive n'est transférée que si la politique la nomme. Un défaut
|
|
117
|
+
* ouvert ne protégerait rien : c'est l'application qui sait ce qui peut
|
|
118
|
+
* atterrir dans le HTML envoyé au navigateur, pas le framework.
|
|
119
|
+
*/
|
|
120
|
+
function isTransferable(address, transfer, policy, legacy) {
|
|
121
|
+
if (transfer === false)
|
|
122
|
+
return false;
|
|
123
|
+
if (!policy)
|
|
124
|
+
return legacy !== false;
|
|
125
|
+
if (policy.mode === 'legacy')
|
|
126
|
+
return true;
|
|
127
|
+
if (policy.mode === 'deny')
|
|
128
|
+
return false;
|
|
129
|
+
return (policy.allow ?? []).includes(address);
|
|
130
|
+
}
|
|
131
|
+
function validateCraftTransferSnapshot(snapshot, policy) {
|
|
132
|
+
if (!isRecord(snapshot) || snapshot['version'] !== CRAFT_TRANSFER_SNAPSHOT_VERSION) {
|
|
133
|
+
throw new CraftSecurityError('CRAFT_TRANSFER_SNAPSHOT_INVALID', 'Unsupported or missing transfer snapshot version.');
|
|
134
|
+
}
|
|
135
|
+
if (Object.keys(snapshot).some((key) => !['version', 'values', 'queries'].includes(key))) {
|
|
136
|
+
throw new CraftSecurityError('CRAFT_TRANSFER_SNAPSHOT_INVALID', 'The snapshot contains unknown top-level fields.');
|
|
137
|
+
}
|
|
138
|
+
if (!isRecord(snapshot['values']) || !isRecord(snapshot['queries'])) {
|
|
139
|
+
throw new CraftSecurityError('CRAFT_TRANSFER_SNAPSHOT_INVALID', 'The snapshot must contain values and queries objects.');
|
|
140
|
+
}
|
|
141
|
+
const maxDepth = policy?.maxDepth ?? Number.POSITIVE_INFINITY;
|
|
142
|
+
for (const [address, value] of Object.entries(snapshot['values'])) {
|
|
143
|
+
assertKnownAddress(address);
|
|
144
|
+
assertSerializable(value, address, new Set(), 0, maxDepth);
|
|
145
|
+
}
|
|
146
|
+
for (const [address, query] of Object.entries(snapshot['queries'])) {
|
|
147
|
+
assertKnownAddress(address);
|
|
148
|
+
if (!isRecord(query) || typeof query['status'] !== 'string') {
|
|
149
|
+
throw new CraftSecurityError('CRAFT_TRANSFER_SNAPSHOT_INVALID', `Invalid query entry at ${address}.`);
|
|
150
|
+
}
|
|
151
|
+
if (Object.keys(query).some((key) => !['status', 'value', 'error'].includes(key)) ||
|
|
152
|
+
!['idle', 'loading', 'reloading', 'resolved', 'error', 'local'].includes(query['status'])) {
|
|
153
|
+
throw new CraftSecurityError('CRAFT_TRANSFER_SNAPSHOT_INVALID', `Invalid query status or fields at ${address}.`);
|
|
154
|
+
}
|
|
155
|
+
if ('value' in query) {
|
|
156
|
+
assertSerializable(query['value'], address, new Set(), 0, maxDepth);
|
|
157
|
+
}
|
|
158
|
+
// Error payloads are deliberately not accepted from a secure client path.
|
|
159
|
+
if (policy && 'error' in query) {
|
|
160
|
+
throw new CraftSecurityError('CRAFT_TRANSFER_SNAPSHOT_INVALID', `Query errors cannot be transferred at ${address}.`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (policy?.maxBytes !== undefined) {
|
|
164
|
+
const json = JSON.stringify(snapshot);
|
|
165
|
+
if (byteLength(json) > policy.maxBytes) {
|
|
166
|
+
throw new CraftSecurityError('CRAFT_TRANSFER_SNAPSHOT_TOO_LARGE', `Snapshot exceeds the ${policy.maxBytes}-byte limit.`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function assertKnownAddress(address) {
|
|
171
|
+
const segments = address.split(' / ');
|
|
172
|
+
const last = segments.at(-1) ?? '';
|
|
173
|
+
if (segments.some((segment) => !/^[A-Za-z][A-Za-z0-9:_#.-]*$/.test(segment)) ||
|
|
174
|
+
!/^(?:state|query|mutation|asyncProcess|queryParams):[A-Za-z][A-Za-z0-9_.:-]*#\d+$/.test(last)) {
|
|
175
|
+
throw new CraftSecurityError('CRAFT_TRANSFER_SNAPSHOT_INVALID', `Unknown primitive address "${address}".`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function isRecord(value) {
|
|
179
|
+
return (typeof value === 'object' &&
|
|
180
|
+
value !== null &&
|
|
181
|
+
!Array.isArray(value) &&
|
|
182
|
+
Object.getPrototypeOf(value) === Object.prototype);
|
|
183
|
+
}
|
|
184
|
+
function byteLength(value) {
|
|
185
|
+
return new TextEncoder().encode(value).byteLength;
|
|
186
|
+
}
|
|
187
|
+
function assertSerializable(value, address, seen, depth = 0, maxDepth = Number.POSITIVE_INFINITY) {
|
|
188
|
+
if (depth > maxDepth) {
|
|
189
|
+
throw new CraftSecurityError('CRAFT_TRANSFER_SNAPSHOT_TOO_DEEP', `Transfer value "${address}" exceeds the depth limit.`);
|
|
190
|
+
}
|
|
65
191
|
if (value === null ||
|
|
66
192
|
value === undefined ||
|
|
67
193
|
typeof value === 'string' ||
|
|
@@ -83,8 +209,7 @@ function assertSerializable(value, address, seen) {
|
|
|
83
209
|
}
|
|
84
210
|
seen.add(value);
|
|
85
211
|
for (const child of Object.values(value)) {
|
|
86
|
-
assertSerializable(child, address, seen);
|
|
212
|
+
assertSerializable(child, address, seen, depth + 1, maxDepth);
|
|
87
213
|
}
|
|
88
214
|
seen.delete(value);
|
|
89
215
|
}
|
|
90
|
-
//# sourceMappingURL=craft-transfer-snapshot.js.map
|
package/src/lib/craft-unique.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Signal } from './host/craft-compat';
|
|
2
|
-
import { type AnyCraftException, type ExtractCraftException } from './craft-exception';
|
|
3
|
-
import { type CraftGenExceptionMarker, type CraftPipeableProgram } from './craft-gen';
|
|
4
|
-
import type { CraftHttpClientError } from './craft-http-client';
|
|
5
|
-
import { type YieldableReactiveValue } from './reactive-read';
|
|
1
|
+
import type { Signal } from './host/craft-compat.js';
|
|
2
|
+
import { type AnyCraftException, type ExtractCraftException } from './craft-exception.js';
|
|
3
|
+
import { type CraftGenExceptionMarker, type CraftPipeableProgram } from './craft-gen.js';
|
|
4
|
+
import type { CraftHttpClientError } from './craft-http-client.js';
|
|
5
|
+
import { type YieldableReactiveValue } from './reactive-read.js';
|
|
6
6
|
type ReactiveResourceValue<T> = Signal<T> | YieldableReactiveValue<T>;
|
|
7
7
|
/**
|
|
8
8
|
* The minimal shape a craft resource (`query` / `mutation` / `asyncProcess`)
|
|
@@ -96,4 +96,3 @@ export declare function craftUntilSettled<G extends Generator<any, any, any>>(ca
|
|
|
96
96
|
*/
|
|
97
97
|
export declare function craftUntilDefined<T>(signal: Signal<T>): CraftPipeableProgram<never, NonNullable<T>>;
|
|
98
98
|
export {};
|
|
99
|
-
//# sourceMappingURL=craft-until-settled.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isCraftException, } from './craft-exception';
|
|
2
|
-
import { CraftGenShortCircuit, ɵcreateCraftProgram, } from './craft-gen';
|
|
3
|
-
import { GUARD_AWAIT_REQUEST_MARKER, isGenerator, } from './craft-generator-runtime';
|
|
4
|
-
import { isYieldableReactiveValue, rawReactiveValue, } from './reactive-read';
|
|
1
|
+
import { isCraftException, } from './craft-exception.js';
|
|
2
|
+
import { CraftGenShortCircuit, ɵcreateCraftProgram, } from './craft-gen.js';
|
|
3
|
+
import { GUARD_AWAIT_REQUEST_MARKER, isGenerator, } from './craft-generator-runtime.js';
|
|
4
|
+
import { isYieldableReactiveValue, rawReactiveValue, } from './reactive-read.js';
|
|
5
5
|
function guardAwaitRequest(request) {
|
|
6
6
|
return {
|
|
7
7
|
[GUARD_AWAIT_REQUEST_MARKER]: true,
|
|
@@ -78,4 +78,3 @@ export function craftUntilDefined(signal) {
|
|
|
78
78
|
return signal();
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
-
//# sourceMappingURL=craft-until-settled.js.map
|
package/src/lib/craft-use.d.ts
CHANGED
|
@@ -23,4 +23,3 @@ export declare function craftUse<Yielded, Output>(invocation: Generator<Yielded,
|
|
|
23
23
|
export declare function craftUse<Yielded, Output>(invocation: Generator<Yielded, Output, unknown> | undefined): Output | undefined;
|
|
24
24
|
export declare function craftUse<Yielded, Output>(factory: () => Generator<Yielded, Output, unknown>): Output;
|
|
25
25
|
export declare function craftUse<Value>(value: Value): Value;
|
|
26
|
-
//# sourceMappingURL=craft-use.d.ts.map
|
package/src/lib/craft-use.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { inject, Injector, runInInjectionContext } from './host/craft-compat';
|
|
2
|
-
import { isGenerator, runCraftGenerator } from './craft-generator-runtime';
|
|
1
|
+
import { inject, Injector, runInInjectionContext } from './host/craft-compat.js';
|
|
2
|
+
import { isGenerator, runCraftGenerator } from './craft-generator-runtime.js';
|
|
3
3
|
const INVALID_YIELD_ERROR_MESSAGE = 'craftUse(...) generators can only yield craft primitives, exposed dependency helpers, or craftService dependencies.';
|
|
4
4
|
const ON_APP_START_ERROR_MESSAGE = 'craftUse(...) does not support onAppStart(...): it is only available inside a craftService factory.';
|
|
5
5
|
const GUARD_AWAIT_ERROR_MESSAGE = 'craftUse(...) does not support craftUntilSettled(...)/craftUntilDefined(...): they are only available inside route guards.';
|
|
@@ -34,4 +34,3 @@ export function craftUse(input) {
|
|
|
34
34
|
}).value;
|
|
35
35
|
return injector ? runInInjectionContext(injector, drive) : drive();
|
|
36
36
|
}
|
|
37
|
-
//# sourceMappingURL=craft-use.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InjectionToken, type Signal } from './host/craft-compat';
|
|
2
|
-
import { type CraftLoadingFeature } from './craft-pending';
|
|
1
|
+
import { InjectionToken, type Signal } from './host/craft-compat.js';
|
|
2
|
+
import { type CraftLoadingFeature } from './craft-pending.js';
|
|
3
3
|
/**
|
|
4
4
|
* The marker a route stores in `withLoaderViewTransitionImage` to declare the
|
|
5
5
|
* shape `T` of its shared-element payload — the view-transition analogue of how
|
|
@@ -99,4 +99,3 @@ export declare const CRAFT_START_VIEW_TRANSITION: InjectionToken<CraftStartViewT
|
|
|
99
99
|
export declare function withCraftViewTransitions(options?: {
|
|
100
100
|
skipBlank?: boolean;
|
|
101
101
|
}): CraftLoadingFeature;
|
|
102
|
-
//# sourceMappingURL=craft-view-transition.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { inject, InjectionToken, signal } from './host/craft-compat';
|
|
2
|
-
import { craftLoadingFeature } from './craft-pending';
|
|
1
|
+
import { inject, InjectionToken, signal } from './host/craft-compat.js';
|
|
2
|
+
import { craftLoadingFeature } from './craft-pending.js';
|
|
3
3
|
/**
|
|
4
4
|
* Declares the shared-element payload shape `T` for a view-transition route.
|
|
5
5
|
* Place it on `withLoaderViewTransitionImage` exactly like `queryParams`:
|
|
@@ -127,4 +127,3 @@ export function withCraftViewTransitions(options) {
|
|
|
127
127
|
},
|
|
128
128
|
]);
|
|
129
129
|
}
|
|
130
|
-
//# sourceMappingURL=craft-view-transition.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Provider } from './host/craft-compat.js';
|
|
2
|
+
export type CraftDevToolsOptions = Readonly<{
|
|
3
|
+
readonly logServerUrl?: string;
|
|
4
|
+
readonly mcpBridgeUrl?: string;
|
|
5
|
+
}>;
|
|
6
|
+
/** Install the standard development logs and browser MCP surface. */
|
|
7
|
+
export declare function provideCraftDevTools(options?: CraftDevToolsOptions): readonly Provider[];
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { craftUse } from './craft-use.js';
|
|
2
|
+
import { abstract, craftService, SERVICE_RUNTIME_OVERRIDES, } from './craft-service.js';
|
|
3
|
+
import { DestroyRef, inject, provideAppInitializer, } from './host/craft-compat.js';
|
|
4
|
+
const DEFAULT_LOG_SERVER_URL = 'http://127.0.0.1:4319/logs';
|
|
5
|
+
const DEFAULT_MCP_BRIDGE_URL = 'ws://127.0.0.1:3333';
|
|
6
|
+
const LOG_LEVELS = ['debug', 'info', 'log', 'warn', 'error'];
|
|
7
|
+
const CLIENT_ID_KEY = 'craft-ts.dev-tools.client-id';
|
|
8
|
+
const { CraftLogServerUrl, provideCraftLogServerUrl } = craftService({ name: 'CraftLogServerUrl', providedIn: 'abstract' }, abstract());
|
|
9
|
+
/** Install the standard development logs and browser MCP surface. */
|
|
10
|
+
export function provideCraftDevTools(options = {}) {
|
|
11
|
+
return [
|
|
12
|
+
provideCraftLogServerUrl(() => options.logServerUrl ?? DEFAULT_LOG_SERVER_URL),
|
|
13
|
+
provideCraftLogForwarding(),
|
|
14
|
+
provideCraftMcpPageBridge(options.mcpBridgeUrl ?? DEFAULT_MCP_BRIDGE_URL),
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
function provideCraftLogForwarding() {
|
|
18
|
+
return {
|
|
19
|
+
provide: SERVICE_RUNTIME_OVERRIDES,
|
|
20
|
+
useFactory: () => {
|
|
21
|
+
if (!isBrowser())
|
|
22
|
+
return new Map();
|
|
23
|
+
const endpoint = craftUse(CraftLogServerUrl());
|
|
24
|
+
const destroyRef = inject(DestroyRef);
|
|
25
|
+
const clientId = getClientId();
|
|
26
|
+
const pending = [];
|
|
27
|
+
const flush = (beacon = false) => {
|
|
28
|
+
if (pending.length === 0)
|
|
29
|
+
return;
|
|
30
|
+
const entries = pending.splice(0, pending.length);
|
|
31
|
+
const body = JSON.stringify({ clientId, entries });
|
|
32
|
+
try {
|
|
33
|
+
if (beacon && typeof globalThis.navigator?.sendBeacon === 'function') {
|
|
34
|
+
globalThis.navigator.sendBeacon(endpoint, new Blob([body], { type: 'application/json' }));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
void globalThis.fetch(endpoint, {
|
|
38
|
+
method: 'POST',
|
|
39
|
+
headers: { 'content-type': 'application/json' },
|
|
40
|
+
body,
|
|
41
|
+
keepalive: true,
|
|
42
|
+
}).catch(() => undefined);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
// Observability is best effort and must never break the application.
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const forward = (level, args) => {
|
|
50
|
+
const metadata = isConsoleMetadata(args.at(-1)) ? args.at(-1) : undefined;
|
|
51
|
+
const values = metadata === undefined ? args : args.slice(0, -1);
|
|
52
|
+
pending.push({
|
|
53
|
+
level,
|
|
54
|
+
message: values.map(formatValue).join(' '),
|
|
55
|
+
args: values.map(toJsonSafe),
|
|
56
|
+
...(metadata ?? {}),
|
|
57
|
+
});
|
|
58
|
+
while (pending.length > 1000)
|
|
59
|
+
pending.shift();
|
|
60
|
+
if (pending.length >= 50)
|
|
61
|
+
flush();
|
|
62
|
+
};
|
|
63
|
+
const timer = globalThis.setInterval(() => flush(), 1000);
|
|
64
|
+
const target = globalThis.console;
|
|
65
|
+
const forwardingConsole = { ...target };
|
|
66
|
+
for (const level of LOG_LEVELS) {
|
|
67
|
+
forwardingConsole[level] = (...args) => {
|
|
68
|
+
forward(level, args);
|
|
69
|
+
target[level](...args);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const onPageHide = () => flush(true);
|
|
73
|
+
globalThis.addEventListener('pagehide', onPageHide);
|
|
74
|
+
const stop = () => {
|
|
75
|
+
globalThis.clearInterval(timer);
|
|
76
|
+
globalThis.removeEventListener('pagehide', onPageHide);
|
|
77
|
+
flush();
|
|
78
|
+
};
|
|
79
|
+
destroyRef.onDestroy(stop);
|
|
80
|
+
return new Map([['ConsoleService', { kind: 'useValue', value: forwardingConsole }]]);
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function provideCraftMcpPageBridge(url) {
|
|
85
|
+
return provideAppInitializer(() => {
|
|
86
|
+
if (!isBrowser() || typeof globalThis.WebSocket === 'undefined')
|
|
87
|
+
return;
|
|
88
|
+
const destroyRef = inject(DestroyRef);
|
|
89
|
+
destroyRef.onDestroy(startMcpPageBridge(url, getClientId()));
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function startMcpPageBridge(url, initialClientId) {
|
|
93
|
+
let socket;
|
|
94
|
+
let clientId = initialClientId;
|
|
95
|
+
let stopped = false;
|
|
96
|
+
let reconnectTimer;
|
|
97
|
+
const pageInfo = () => ({
|
|
98
|
+
pageUrl: globalThis.location.href,
|
|
99
|
+
pageTitle: globalThis.document.title,
|
|
100
|
+
});
|
|
101
|
+
const controls = () => Array.from(globalThis.document.querySelectorAll('[data-craft-name]')).map((element, index) => ({
|
|
102
|
+
id: element.dataset['craftName'] ?? '',
|
|
103
|
+
role: element.getAttribute('role') ?? element.tagName.toLowerCase(),
|
|
104
|
+
name: element.getAttribute('aria-label') ?? element.textContent?.trim() ?? '',
|
|
105
|
+
enabled: !element.hasAttribute('disabled'),
|
|
106
|
+
index,
|
|
107
|
+
}));
|
|
108
|
+
const publish = () => {
|
|
109
|
+
if (socket?.readyState !== WebSocket.OPEN)
|
|
110
|
+
return;
|
|
111
|
+
const info = pageInfo();
|
|
112
|
+
socket.send(JSON.stringify({
|
|
113
|
+
type: 'page/surface', clientId, url: info.pageUrl, title: info.pageTitle,
|
|
114
|
+
controls: controls(),
|
|
115
|
+
}));
|
|
116
|
+
};
|
|
117
|
+
const snapshot = () => {
|
|
118
|
+
if (socket?.readyState !== WebSocket.OPEN)
|
|
119
|
+
return;
|
|
120
|
+
const info = pageInfo();
|
|
121
|
+
socket.send(JSON.stringify({
|
|
122
|
+
type: 'registry/snapshot', clientId, pageUrl: info.pageUrl,
|
|
123
|
+
pageTitle: info.pageTitle, entries: [], logs: [],
|
|
124
|
+
}));
|
|
125
|
+
};
|
|
126
|
+
const onMessage = (event) => {
|
|
127
|
+
let message;
|
|
128
|
+
try {
|
|
129
|
+
message = JSON.parse(String(event.data));
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (typeof message !== 'object' || message === null)
|
|
135
|
+
return;
|
|
136
|
+
const record = message;
|
|
137
|
+
if (record['type'] === 'hello/ok' && typeof record['clientId'] === 'string') {
|
|
138
|
+
clientId = record['clientId'];
|
|
139
|
+
globalThis.sessionStorage.setItem(CLIENT_ID_KEY, clientId);
|
|
140
|
+
snapshot();
|
|
141
|
+
publish();
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (record['type'] !== 'request' || typeof record['callId'] !== 'string')
|
|
145
|
+
return;
|
|
146
|
+
const result = record['method'] === 'page'
|
|
147
|
+
? { ...pageInfo(), status: 'ready', controls: controls() }
|
|
148
|
+
: undefined;
|
|
149
|
+
socket?.send(JSON.stringify({
|
|
150
|
+
type: 'response', callId: record['callId'],
|
|
151
|
+
...(result === undefined
|
|
152
|
+
? { error: { message: 'This app exposes only the page MCP surface.' } }
|
|
153
|
+
: { result }),
|
|
154
|
+
}));
|
|
155
|
+
};
|
|
156
|
+
const connect = () => {
|
|
157
|
+
if (stopped)
|
|
158
|
+
return;
|
|
159
|
+
try {
|
|
160
|
+
socket = new WebSocket(url);
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
reconnectTimer = globalThis.setTimeout(connect, 1000);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
socket.onopen = () => {
|
|
167
|
+
socket?.send(JSON.stringify({ type: 'hello', role: 'registry-app', clientId, ...pageInfo() }));
|
|
168
|
+
snapshot();
|
|
169
|
+
publish();
|
|
170
|
+
};
|
|
171
|
+
socket.onmessage = onMessage;
|
|
172
|
+
socket.onclose = () => {
|
|
173
|
+
if (!stopped)
|
|
174
|
+
reconnectTimer = globalThis.setTimeout(connect, 1000);
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
const observer = new MutationObserver(publish);
|
|
178
|
+
observer.observe(globalThis.document.documentElement, { childList: true, subtree: true, attributes: true });
|
|
179
|
+
globalThis.document.addEventListener('input', publish, true);
|
|
180
|
+
globalThis.document.addEventListener('change', publish, true);
|
|
181
|
+
connect();
|
|
182
|
+
return () => {
|
|
183
|
+
stopped = true;
|
|
184
|
+
if (reconnectTimer !== undefined)
|
|
185
|
+
globalThis.clearTimeout(reconnectTimer);
|
|
186
|
+
observer.disconnect();
|
|
187
|
+
globalThis.document.removeEventListener('input', publish, true);
|
|
188
|
+
globalThis.document.removeEventListener('change', publish, true);
|
|
189
|
+
socket?.close();
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function getClientId() {
|
|
193
|
+
const existing = globalThis.sessionStorage.getItem(CLIENT_ID_KEY);
|
|
194
|
+
if (existing)
|
|
195
|
+
return existing;
|
|
196
|
+
const id = globalThis.crypto.randomUUID();
|
|
197
|
+
globalThis.sessionStorage.setItem(CLIENT_ID_KEY, id);
|
|
198
|
+
return id;
|
|
199
|
+
}
|
|
200
|
+
function isBrowser() {
|
|
201
|
+
return typeof globalThis.document !== 'undefined';
|
|
202
|
+
}
|
|
203
|
+
function isConsoleMetadata(value) {
|
|
204
|
+
if (typeof value !== 'object' || value === null)
|
|
205
|
+
return false;
|
|
206
|
+
const candidate = value;
|
|
207
|
+
return Array.isArray(candidate['from']) && Array.isArray(candidate['tags']) &&
|
|
208
|
+
typeof candidate['trace'] === 'string' && typeof candidate['timestamp'] === 'string' &&
|
|
209
|
+
typeof candidate['route'] === 'string';
|
|
210
|
+
}
|
|
211
|
+
function toJsonSafe(value, depth = 0) {
|
|
212
|
+
if (depth > 6)
|
|
213
|
+
return '[Depth limit]';
|
|
214
|
+
if (value instanceof Error)
|
|
215
|
+
return { name: value.name, message: value.message, stack: value.stack };
|
|
216
|
+
if (typeof value === 'function')
|
|
217
|
+
return `[Function ${value.name || 'anonymous'}]`;
|
|
218
|
+
if (value === null || typeof value !== 'object')
|
|
219
|
+
return value;
|
|
220
|
+
if (Array.isArray(value))
|
|
221
|
+
return value.map((item) => toJsonSafe(item, depth + 1));
|
|
222
|
+
const result = {};
|
|
223
|
+
for (const [key, item] of Object.entries(value)) {
|
|
224
|
+
try {
|
|
225
|
+
result[key] = toJsonSafe(item, depth + 1);
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
result[key] = '[Circular]';
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return result;
|
|
232
|
+
}
|
|
233
|
+
function formatValue(value) {
|
|
234
|
+
if (typeof value === 'string')
|
|
235
|
+
return value;
|
|
236
|
+
if (value instanceof Error)
|
|
237
|
+
return `${value.name}: ${value.message}`;
|
|
238
|
+
try {
|
|
239
|
+
return JSON.stringify(toJsonSafe(value));
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
return String(value);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InjectionToken, type Provider } from './host/craft-compat';
|
|
1
|
+
import { InjectionToken, type Provider } from './host/craft-compat.js';
|
|
2
2
|
/** Metadata describing a DOM event bound from a Craft template. */
|
|
3
3
|
export interface CraftDomEvent {
|
|
4
4
|
/** The native event received by the binding. */
|
|
@@ -27,4 +27,3 @@ export type CraftDomEventHook = (interaction: CraftDomEvent, next: () => unknown
|
|
|
27
27
|
export declare const CRAFT_DOM_EVENT_HOOK: InjectionToken<readonly CraftDomEventHook[]>;
|
|
28
28
|
/** Register one composable DOM event hook. */
|
|
29
29
|
export declare function provideCraftDomEventHook(hook: CraftDomEventHook): Provider;
|
|
30
|
-
//# sourceMappingURL=dom-event-hook.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InjectionToken } from './host/craft-compat';
|
|
1
|
+
import { InjectionToken } from './host/craft-compat.js';
|
|
2
2
|
/** All DOM hooks active in the current component injector. */
|
|
3
3
|
export const CRAFT_DOM_EVENT_HOOK = new InjectionToken('CRAFT_DOM_EVENT_HOOK', {
|
|
4
4
|
providedIn: 'root',
|
|
@@ -13,4 +13,3 @@ export function provideCraftDomEventHook(hook) {
|
|
|
13
13
|
multi: true,
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=dom-event-hook.js.map
|
package/src/lib/fn-wrapper.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InjectionToken, type Provider } from './host/craft-compat';
|
|
2
|
-
export { isGenerator, isGeneratorFunction } from './craft-generator-runtime';
|
|
1
|
+
import { InjectionToken, type Provider } from './host/craft-compat.js';
|
|
2
|
+
export { isGenerator, isGeneratorFunction } from './craft-generator-runtime.js';
|
|
3
3
|
type AnyFactory = (...args: any[]) => any;
|
|
4
4
|
type AnyGeneratorFactory = (...args: any[]) => Generator<unknown, unknown, unknown>;
|
|
5
5
|
export type FnWrapper = (factory: AnyGeneratorFactory, thisArg: unknown, args: unknown[]) => Generator<unknown, unknown, unknown>;
|
|
@@ -10,4 +10,3 @@ export declare const FN_WRAP_OBSERVER: InjectionToken<readonly FnWrapObserver[]>
|
|
|
10
10
|
export declare function provideFnWrapper(_warning: string, wrapper: FnWrapper): Provider;
|
|
11
11
|
export declare function provideFnWrapObserver(observer: FnWrapObserver): Provider;
|
|
12
12
|
export declare function injectFnWrapper(): FnFactoryAdapter;
|
|
13
|
-
//# sourceMappingURL=fn-wrapper.d.ts.map
|
package/src/lib/fn-wrapper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { inject, InjectionToken } from './host/craft-compat';
|
|
2
|
-
import { isGenerator, isGeneratorFunction } from './craft-generator-runtime';
|
|
3
|
-
export { isGenerator, isGeneratorFunction } from './craft-generator-runtime';
|
|
1
|
+
import { inject, InjectionToken } from './host/craft-compat.js';
|
|
2
|
+
import { isGenerator, isGeneratorFunction } from './craft-generator-runtime.js';
|
|
3
|
+
export { isGenerator, isGeneratorFunction } from './craft-generator-runtime.js';
|
|
4
4
|
const IDENTITY_ADAPTER = ((factory) => factory);
|
|
5
5
|
export const FN_WRAPPER = new InjectionToken('FN_WRAPPER', {
|
|
6
6
|
providedIn: 'root',
|
|
@@ -63,4 +63,3 @@ function toGeneratorFactory(factory) {
|
|
|
63
63
|
return result;
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
//# sourceMappingURL=fn-wrapper.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Signal, WritableSignal } from '../host/craft-compat';
|
|
2
|
-
import type { AnyCraftException } from '../craft-exception';
|
|
1
|
+
import { Signal, WritableSignal } from '../host/craft-compat.js';
|
|
2
|
+
import type { AnyCraftException } from '../craft-exception.js';
|
|
3
3
|
export type CraftFieldError = AnyCraftException;
|
|
4
4
|
export type CraftFieldSchemaErrorEntry = {
|
|
5
5
|
readonly path: ReadonlyArray<string | number>;
|
|
@@ -152,4 +152,3 @@ export declare function ɵgetOrCreateDerivedChild<Source, Sub>(parent: CraftFiel
|
|
|
152
152
|
write: (s: Source, next: Sub) => Source;
|
|
153
153
|
}): CraftFieldTree<Sub>;
|
|
154
154
|
export {};
|
|
155
|
-
//# sourceMappingURL=craft-field.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { InjectionToken, Injector, Renderer2 } from '../host/craft-compat';
|
|
2
|
-
import type { GetDeps } from '../branded-component/branded-component';
|
|
3
|
-
import { type CraftNodeDirective, type CraftNodeEffectFactory } from '../craft-node-directive';
|
|
4
|
-
import type { CraftDomAdapter } from '../host/craft-dom';
|
|
5
|
-
import { CraftCheckboxControl, CraftField, CraftValueControl } from './craft-field';
|
|
6
|
-
import { type CraftFieldExceptionSourceCarrier, type CraftFieldValidationCasesCarrier, type FieldValidationCasesOf } from './field-exception';
|
|
1
|
+
import { InjectionToken, Injector, Renderer2 } from '../host/craft-compat.js';
|
|
2
|
+
import type { GetDeps } from '../branded-component/branded-component.js';
|
|
3
|
+
import { type CraftNodeDirective, type CraftNodeEffectFactory } from '../craft-node-directive.js';
|
|
4
|
+
import type { CraftDomAdapter } from '../host/craft-dom.js';
|
|
5
|
+
import { CraftCheckboxControl, CraftField, CraftValueControl } from './craft-field.js';
|
|
6
|
+
import { type CraftFieldExceptionSourceCarrier, type CraftFieldValidationCasesCarrier, type FieldValidationCasesOf } from './field-exception.js';
|
|
7
7
|
/**
|
|
8
8
|
* Token used by custom controls to declare themselves as Craft form value controls.
|
|
9
9
|
* A custom component should provide itself via this token to opt into [craftField] binding.
|
|
@@ -67,4 +67,3 @@ export type GenDeps_LegacyCraftFieldDirective = GetDeps<{
|
|
|
67
67
|
}>;
|
|
68
68
|
/** @deprecated DI metadata belongs to `LegacyCraftFieldDirective` only. */
|
|
69
69
|
export type GenDeps_CraftFieldDirective = GenDeps_LegacyCraftFieldDirective;
|
|
70
|
-
//# sourceMappingURL=craft-field.directive.d.ts.map
|