@craft-ts/core 0.7.0-beta.13
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/LICENSE +21 -0
- package/package.json +58 -0
- package/src/index.d.ts +148 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +150 -0
- package/src/index.js.map +1 -0
- package/src/lib/after-recomputation.d.ts +327 -0
- package/src/lib/after-recomputation.d.ts.map +1 -0
- package/src/lib/after-recomputation.js +25 -0
- package/src/lib/after-recomputation.js.map +1 -0
- package/src/lib/app-checked-di.d.ts +82 -0
- package/src/lib/app-checked-di.d.ts.map +1 -0
- package/src/lib/app-checked-di.js +1 -0
- package/src/lib/app-checked-di.js.map +1 -0
- package/src/lib/async-process.d.ts +411 -0
- package/src/lib/async-process.d.ts.map +1 -0
- package/src/lib/async-process.js +702 -0
- package/src/lib/async-process.js.map +1 -0
- package/src/lib/branded-component/branded-component.d.ts +129 -0
- package/src/lib/branded-component/branded-component.d.ts.map +1 -0
- package/src/lib/branded-component/branded-component.js +7 -0
- package/src/lib/branded-component/branded-component.js.map +1 -0
- package/src/lib/browser-boundaries.d.ts +165 -0
- package/src/lib/browser-boundaries.d.ts.map +1 -0
- package/src/lib/browser-boundaries.js +550 -0
- package/src/lib/browser-boundaries.js.map +1 -0
- package/src/lib/client-di-requirement.d.ts +28 -0
- package/src/lib/client-di-requirement.d.ts.map +1 -0
- package/src/lib/client-di-requirement.js +11 -0
- package/src/lib/client-di-requirement.js.map +1 -0
- package/src/lib/client-function-middleware.d.ts +130 -0
- package/src/lib/client-function-middleware.d.ts.map +1 -0
- package/src/lib/client-function-middleware.js +144 -0
- package/src/lib/client-function-middleware.js.map +1 -0
- package/src/lib/component-monitoring.d.ts +7 -0
- package/src/lib/component-monitoring.d.ts.map +1 -0
- package/src/lib/component-monitoring.js +28 -0
- package/src/lib/component-monitoring.js.map +1 -0
- package/src/lib/component-register.d.ts +12 -0
- package/src/lib/component-register.d.ts.map +1 -0
- package/src/lib/component-register.js +13 -0
- package/src/lib/component-register.js.map +1 -0
- package/src/lib/computed-source.d.ts +303 -0
- package/src/lib/computed-source.d.ts.map +1 -0
- package/src/lib/computed-source.js +319 -0
- package/src/lib/computed-source.js.map +1 -0
- package/src/lib/correlation-id-plugin.d.ts +3 -0
- package/src/lib/correlation-id-plugin.d.ts.map +1 -0
- package/src/lib/correlation-id-plugin.js +73 -0
- package/src/lib/correlation-id-plugin.js.map +1 -0
- package/src/lib/correlation-id.d.ts +30 -0
- package/src/lib/correlation-id.d.ts.map +1 -0
- package/src/lib/correlation-id.js +86 -0
- package/src/lib/correlation-id.js.map +1 -0
- package/src/lib/craft-a11y.d.ts +22 -0
- package/src/lib/craft-a11y.d.ts.map +1 -0
- package/src/lib/craft-a11y.js +32 -0
- package/src/lib/craft-a11y.js.map +1 -0
- package/src/lib/craft-activated-route.d.ts +21 -0
- package/src/lib/craft-activated-route.d.ts.map +1 -0
- package/src/lib/craft-activated-route.js +20 -0
- package/src/lib/craft-activated-route.js.map +1 -0
- package/src/lib/craft-app-config.d.ts +91 -0
- package/src/lib/craft-app-config.d.ts.map +1 -0
- package/src/lib/craft-app-config.js +64 -0
- package/src/lib/craft-app-config.js.map +1 -0
- package/src/lib/craft-codec.d.ts +16 -0
- package/src/lib/craft-codec.d.ts.map +1 -0
- package/src/lib/craft-codec.js +1 -0
- package/src/lib/craft-codec.js.map +1 -0
- package/src/lib/craft-computed.d.ts +31 -0
- package/src/lib/craft-computed.d.ts.map +1 -0
- package/src/lib/craft-computed.js +81 -0
- package/src/lib/craft-computed.js.map +1 -0
- package/src/lib/craft-control-flow.d.ts +14 -0
- package/src/lib/craft-control-flow.d.ts.map +1 -0
- package/src/lib/craft-control-flow.js +18 -0
- package/src/lib/craft-control-flow.js.map +1 -0
- package/src/lib/craft-effect.d.ts +13 -0
- package/src/lib/craft-effect.d.ts.map +1 -0
- package/src/lib/craft-effect.js +93 -0
- package/src/lib/craft-effect.js.map +1 -0
- package/src/lib/craft-exception.d.ts +40 -0
- package/src/lib/craft-exception.d.ts.map +1 -0
- package/src/lib/craft-exception.js +16 -0
- package/src/lib/craft-exception.js.map +1 -0
- package/src/lib/craft-gen.d.ts +123 -0
- package/src/lib/craft-gen.d.ts.map +1 -0
- package/src/lib/craft-gen.js +90 -0
- package/src/lib/craft-gen.js.map +1 -0
- package/src/lib/craft-generator-runtime.d.ts +110 -0
- package/src/lib/craft-generator-runtime.d.ts.map +1 -0
- package/src/lib/craft-generator-runtime.js +191 -0
- package/src/lib/craft-generator-runtime.js.map +1 -0
- package/src/lib/craft-guard-runtime.d.ts +70 -0
- package/src/lib/craft-guard-runtime.d.ts.map +1 -0
- package/src/lib/craft-guard-runtime.js +195 -0
- package/src/lib/craft-guard-runtime.js.map +1 -0
- package/src/lib/craft-handshake.d.ts +35 -0
- package/src/lib/craft-handshake.d.ts.map +1 -0
- package/src/lib/craft-handshake.js +34 -0
- package/src/lib/craft-handshake.js.map +1 -0
- package/src/lib/craft-http-client.d.ts +236 -0
- package/src/lib/craft-http-client.d.ts.map +1 -0
- package/src/lib/craft-http-client.js +437 -0
- package/src/lib/craft-http-client.js.map +1 -0
- package/src/lib/craft-http-trace.d.ts +12 -0
- package/src/lib/craft-http-trace.d.ts.map +1 -0
- package/src/lib/craft-http-trace.js +28 -0
- package/src/lib/craft-http-trace.js.map +1 -0
- package/src/lib/craft-lazy.d.ts +42 -0
- package/src/lib/craft-lazy.d.ts.map +1 -0
- package/src/lib/craft-lazy.js +83 -0
- package/src/lib/craft-lazy.js.map +1 -0
- package/src/lib/craft-load-retry.d.ts +76 -0
- package/src/lib/craft-load-retry.d.ts.map +1 -0
- package/src/lib/craft-load-retry.js +160 -0
- package/src/lib/craft-load-retry.js.map +1 -0
- package/src/lib/craft-machine-history.d.ts +145 -0
- package/src/lib/craft-machine-history.d.ts.map +1 -0
- package/src/lib/craft-machine-history.js +276 -0
- package/src/lib/craft-machine-history.js.map +1 -0
- package/src/lib/craft-match.d.ts +49 -0
- package/src/lib/craft-match.d.ts.map +1 -0
- package/src/lib/craft-match.js +58 -0
- package/src/lib/craft-match.js.map +1 -0
- package/src/lib/craft-method.d.ts +28 -0
- package/src/lib/craft-method.d.ts.map +1 -0
- package/src/lib/craft-method.js +45 -0
- package/src/lib/craft-method.js.map +1 -0
- package/src/lib/craft-node-directive.d.ts +32 -0
- package/src/lib/craft-node-directive.d.ts.map +1 -0
- package/src/lib/craft-node-directive.js +22 -0
- package/src/lib/craft-node-directive.js.map +1 -0
- package/src/lib/craft-pending.d.ts +115 -0
- package/src/lib/craft-pending.d.ts.map +1 -0
- package/src/lib/craft-pending.js +187 -0
- package/src/lib/craft-pending.js.map +1 -0
- package/src/lib/craft-pipe.d.ts +63 -0
- package/src/lib/craft-pipe.d.ts.map +1 -0
- package/src/lib/craft-pipe.js +57 -0
- package/src/lib/craft-pipe.js.map +1 -0
- package/src/lib/craft-platform.d.ts +50 -0
- package/src/lib/craft-platform.d.ts.map +1 -0
- package/src/lib/craft-platform.js +175 -0
- package/src/lib/craft-platform.js.map +1 -0
- package/src/lib/craft-primitive-gen.d.ts +137 -0
- package/src/lib/craft-primitive-gen.d.ts.map +1 -0
- package/src/lib/craft-primitive-gen.js +76 -0
- package/src/lib/craft-primitive-gen.js.map +1 -0
- package/src/lib/craft-primitive-registry.d.ts +113 -0
- package/src/lib/craft-primitive-registry.d.ts.map +1 -0
- package/src/lib/craft-primitive-registry.js +159 -0
- package/src/lib/craft-primitive-registry.js.map +1 -0
- package/src/lib/craft-program-operators.d.ts +101 -0
- package/src/lib/craft-program-operators.d.ts.map +1 -0
- package/src/lib/craft-program-operators.js +116 -0
- package/src/lib/craft-program-operators.js.map +1 -0
- package/src/lib/craft-program-runtime.d.ts +80 -0
- package/src/lib/craft-program-runtime.d.ts.map +1 -0
- package/src/lib/craft-program-runtime.js +166 -0
- package/src/lib/craft-program-runtime.js.map +1 -0
- package/src/lib/craft-register-for-runtime.d.ts +39 -0
- package/src/lib/craft-register-for-runtime.d.ts.map +1 -0
- package/src/lib/craft-register-for-runtime.js +96 -0
- package/src/lib/craft-register-for-runtime.js.map +1 -0
- package/src/lib/craft-register-for.d.ts +57 -0
- package/src/lib/craft-register-for.d.ts.map +1 -0
- package/src/lib/craft-register-for.js +200 -0
- package/src/lib/craft-register-for.js.map +1 -0
- package/src/lib/craft-render-identity.d.ts +19 -0
- package/src/lib/craft-render-identity.d.ts.map +1 -0
- package/src/lib/craft-render-identity.js +23 -0
- package/src/lib/craft-render-identity.js.map +1 -0
- package/src/lib/craft-replay.d.ts +5 -0
- package/src/lib/craft-replay.d.ts.map +1 -0
- package/src/lib/craft-replay.js +28 -0
- package/src/lib/craft-replay.js.map +1 -0
- package/src/lib/craft-resolve.d.ts +39 -0
- package/src/lib/craft-resolve.d.ts.map +1 -0
- package/src/lib/craft-resolve.js +9 -0
- package/src/lib/craft-resolve.js.map +1 -0
- package/src/lib/craft-resource.d.ts +11 -0
- package/src/lib/craft-resource.d.ts.map +1 -0
- package/src/lib/craft-resource.js +264 -0
- package/src/lib/craft-resource.js.map +1 -0
- package/src/lib/craft-route-exceptions.d.ts +785 -0
- package/src/lib/craft-route-exceptions.d.ts.map +1 -0
- package/src/lib/craft-route-exceptions.js +86 -0
- package/src/lib/craft-route-exceptions.js.map +1 -0
- package/src/lib/craft-route-load-error.d.ts +1145 -0
- package/src/lib/craft-route-load-error.d.ts.map +1 -0
- package/src/lib/craft-route-load-error.js +173 -0
- package/src/lib/craft-route-load-error.js.map +1 -0
- package/src/lib/craft-route-meta.d.ts +52 -0
- package/src/lib/craft-route-meta.d.ts.map +1 -0
- package/src/lib/craft-route-meta.js +16 -0
- package/src/lib/craft-route-meta.js.map +1 -0
- package/src/lib/craft-route-target.d.ts +27 -0
- package/src/lib/craft-route-target.d.ts.map +1 -0
- package/src/lib/craft-route-target.js +22 -0
- package/src/lib/craft-route-target.js.map +1 -0
- package/src/lib/craft-router-outlet.d.ts +105 -0
- package/src/lib/craft-router-outlet.d.ts.map +1 -0
- package/src/lib/craft-router-outlet.js +735 -0
- package/src/lib/craft-router-outlet.js.map +1 -0
- package/src/lib/craft-router-tokens.d.ts +49 -0
- package/src/lib/craft-router-tokens.d.ts.map +1 -0
- package/src/lib/craft-router-tokens.js +15 -0
- package/src/lib/craft-router-tokens.js.map +1 -0
- package/src/lib/craft-router-trace.d.ts +18 -0
- package/src/lib/craft-router-trace.d.ts.map +1 -0
- package/src/lib/craft-router-trace.js +54 -0
- package/src/lib/craft-router-trace.js.map +1 -0
- package/src/lib/craft-router.d.ts +248 -0
- package/src/lib/craft-router.d.ts.map +1 -0
- package/src/lib/craft-router.js +559 -0
- package/src/lib/craft-router.js.map +1 -0
- package/src/lib/craft-routes.d.ts +755 -0
- package/src/lib/craft-routes.d.ts.map +1 -0
- package/src/lib/craft-routes.js +510 -0
- package/src/lib/craft-routes.js.map +1 -0
- package/src/lib/craft-service.d.ts +1034 -0
- package/src/lib/craft-service.d.ts.map +1 -0
- package/src/lib/craft-service.js +1072 -0
- package/src/lib/craft-service.js.map +1 -0
- package/src/lib/craft-service.shared.d.ts +35 -0
- package/src/lib/craft-service.shared.d.ts.map +1 -0
- package/src/lib/craft-service.shared.js +4 -0
- package/src/lib/craft-service.shared.js.map +1 -0
- package/src/lib/craft-settled.d.ts +171 -0
- package/src/lib/craft-settled.d.ts.map +1 -0
- package/src/lib/craft-settled.js +130 -0
- package/src/lib/craft-settled.js.map +1 -0
- package/src/lib/craft-ssr.d.ts +29 -0
- package/src/lib/craft-ssr.d.ts.map +1 -0
- package/src/lib/craft-ssr.js +27 -0
- package/src/lib/craft-ssr.js.map +1 -0
- package/src/lib/craft-state-machine-runtime.d.ts +88 -0
- package/src/lib/craft-state-machine-runtime.d.ts.map +1 -0
- package/src/lib/craft-state-machine-runtime.js +167 -0
- package/src/lib/craft-state-machine-runtime.js.map +1 -0
- package/src/lib/craft-state-machine.d.ts +233 -0
- package/src/lib/craft-state-machine.d.ts.map +1 -0
- package/src/lib/craft-state-machine.js +254 -0
- package/src/lib/craft-state-machine.js.map +1 -0
- package/src/lib/craft-target-runtime.d.ts +20 -0
- package/src/lib/craft-target-runtime.d.ts.map +1 -0
- package/src/lib/craft-target-runtime.js +42 -0
- package/src/lib/craft-target-runtime.js.map +1 -0
- package/src/lib/craft-transfer-snapshot.d.ts +19 -0
- package/src/lib/craft-transfer-snapshot.d.ts.map +1 -0
- package/src/lib/craft-transfer-snapshot.js +90 -0
- package/src/lib/craft-transfer-snapshot.js.map +1 -0
- package/src/lib/craft-unique.d.ts +7 -0
- package/src/lib/craft-unique.d.ts.map +1 -0
- package/src/lib/craft-unique.js +16 -0
- package/src/lib/craft-unique.js.map +1 -0
- package/src/lib/craft-until-settled.d.ts +99 -0
- package/src/lib/craft-until-settled.d.ts.map +1 -0
- package/src/lib/craft-until-settled.js +81 -0
- package/src/lib/craft-until-settled.js.map +1 -0
- package/src/lib/craft-use.d.ts +26 -0
- package/src/lib/craft-use.d.ts.map +1 -0
- package/src/lib/craft-use.js +37 -0
- package/src/lib/craft-use.js.map +1 -0
- package/src/lib/craft-view-transition.d.ts +102 -0
- package/src/lib/craft-view-transition.d.ts.map +1 -0
- package/src/lib/craft-view-transition.js +130 -0
- package/src/lib/craft-view-transition.js.map +1 -0
- package/src/lib/dom-event-hook.d.ts +30 -0
- package/src/lib/dom-event-hook.d.ts.map +1 -0
- package/src/lib/dom-event-hook.js +16 -0
- package/src/lib/dom-event-hook.js.map +1 -0
- package/src/lib/fn-wrapper.d.ts +13 -0
- package/src/lib/fn-wrapper.d.ts.map +1 -0
- package/src/lib/fn-wrapper.js +66 -0
- package/src/lib/fn-wrapper.js.map +1 -0
- package/src/lib/form/craft-field.d.ts +155 -0
- package/src/lib/form/craft-field.d.ts.map +1 -0
- package/src/lib/form/craft-field.directive.d.ts +70 -0
- package/src/lib/form/craft-field.directive.d.ts.map +1 -0
- package/src/lib/form/craft-field.directive.js +549 -0
- package/src/lib/form/craft-field.directive.js.map +1 -0
- package/src/lib/form/craft-field.js +586 -0
- package/src/lib/form/craft-field.js.map +1 -0
- package/src/lib/form/field-exception.d.ts +62 -0
- package/src/lib/form/field-exception.d.ts.map +1 -0
- package/src/lib/form/field-exception.js +37 -0
- package/src/lib/form/field-exception.js.map +1 -0
- package/src/lib/form/field-lens.d.ts +29 -0
- package/src/lib/form/field-lens.d.ts.map +1 -0
- package/src/lib/form/field-lens.js +32 -0
- package/src/lib/form/field-lens.js.map +1 -0
- package/src/lib/form/insert-form-attributes.d.ts +69 -0
- package/src/lib/form/insert-form-attributes.d.ts.map +1 -0
- package/src/lib/form/insert-form-attributes.js +163 -0
- package/src/lib/form/insert-form-attributes.js.map +1 -0
- package/src/lib/form/insert-form-internals.d.ts +110 -0
- package/src/lib/form/insert-form-internals.d.ts.map +1 -0
- package/src/lib/form/insert-form-internals.js +276 -0
- package/src/lib/form/insert-form-internals.js.map +1 -0
- package/src/lib/form/insert-form-schema.d.ts +10 -0
- package/src/lib/form/insert-form-schema.d.ts.map +1 -0
- package/src/lib/form/insert-form-schema.js +62 -0
- package/src/lib/form/insert-form-schema.js.map +1 -0
- package/src/lib/form/insert-form-submit.d.ts +79 -0
- package/src/lib/form/insert-form-submit.d.ts.map +1 -0
- package/src/lib/form/insert-form-submit.js +126 -0
- package/src/lib/form/insert-form-submit.js.map +1 -0
- package/src/lib/form/insert-form.d.ts +39 -0
- package/src/lib/form/insert-form.d.ts.map +1 -0
- package/src/lib/form/insert-form.js +255 -0
- package/src/lib/form/insert-form.js.map +1 -0
- package/src/lib/form/insert-select-form-tree.d.ts +33 -0
- package/src/lib/form/insert-select-form-tree.d.ts.map +1 -0
- package/src/lib/form/insert-select-form-tree.js +144 -0
- package/src/lib/form/insert-select-form-tree.js.map +1 -0
- package/src/lib/form/insert-sub-form-field.d.ts +17 -0
- package/src/lib/form/insert-sub-form-field.d.ts.map +1 -0
- package/src/lib/form/insert-sub-form-field.js +41 -0
- package/src/lib/form/insert-sub-form-field.js.map +1 -0
- package/src/lib/form/make-form-tree-insert.d.ts +22 -0
- package/src/lib/form/make-form-tree-insert.d.ts.map +1 -0
- package/src/lib/form/make-form-tree-insert.js +43 -0
- package/src/lib/form/make-form-tree-insert.js.map +1 -0
- package/src/lib/form/target-form-field.d.ts +11 -0
- package/src/lib/form/target-form-field.d.ts.map +1 -0
- package/src/lib/form/target-form-field.js +1 -0
- package/src/lib/form/target-form-field.js.map +1 -0
- package/src/lib/form/validator.d.ts +174 -0
- package/src/lib/form/validator.d.ts.map +1 -0
- package/src/lib/form/validator.js +465 -0
- package/src/lib/form/validator.js.map +1 -0
- package/src/lib/from-event-to-source$.d.ts +210 -0
- package/src/lib/from-event-to-source$.d.ts.map +1 -0
- package/src/lib/from-event-to-source$.js +29 -0
- package/src/lib/from-event-to-source$.js.map +1 -0
- package/src/lib/global-persister-handler.service.d.ts +10 -0
- package/src/lib/global-persister-handler.service.d.ts.map +1 -0
- package/src/lib/global-persister-handler.service.js +40 -0
- package/src/lib/global-persister-handler.service.js.map +1 -0
- package/src/lib/host/craft-compat.d.ts +242 -0
- package/src/lib/host/craft-compat.d.ts.map +1 -0
- package/src/lib/host/craft-compat.js +444 -0
- package/src/lib/host/craft-compat.js.map +1 -0
- package/src/lib/host/craft-dom.d.ts +16 -0
- package/src/lib/host/craft-dom.d.ts.map +1 -0
- package/src/lib/host/craft-dom.js +24 -0
- package/src/lib/host/craft-dom.js.map +1 -0
- package/src/lib/host/craft-http.d.ts +22 -0
- package/src/lib/host/craft-http.d.ts.map +1 -0
- package/src/lib/host/craft-http.js +80 -0
- package/src/lib/host/craft-http.js.map +1 -0
- package/src/lib/host/craft-injector-host.d.ts +3 -0
- package/src/lib/host/craft-injector-host.d.ts.map +1 -0
- package/src/lib/host/craft-injector-host.js +2 -0
- package/src/lib/host/craft-injector-host.js.map +1 -0
- package/src/lib/host/craft-injector.d.ts +40 -0
- package/src/lib/host/craft-injector.d.ts.map +1 -0
- package/src/lib/host/craft-injector.js +318 -0
- package/src/lib/host/craft-injector.js.map +1 -0
- package/src/lib/host/craft-linked-signal.d.ts +17 -0
- package/src/lib/host/craft-linked-signal.d.ts.map +1 -0
- package/src/lib/host/craft-linked-signal.js +86 -0
- package/src/lib/host/craft-linked-signal.js.map +1 -0
- package/src/lib/host/craft-router-runtime.d.ts +61 -0
- package/src/lib/host/craft-router-runtime.d.ts.map +1 -0
- package/src/lib/host/craft-router-runtime.js +456 -0
- package/src/lib/host/craft-router-runtime.js.map +1 -0
- package/src/lib/host/craft-router-types.d.ts +84 -0
- package/src/lib/host/craft-router-types.d.ts.map +1 -0
- package/src/lib/host/craft-router-types.js +35 -0
- package/src/lib/host/craft-router-types.js.map +1 -0
- package/src/lib/host/craft-signal.d.ts +45 -0
- package/src/lib/host/craft-signal.d.ts.map +1 -0
- package/src/lib/host/craft-signal.js +161 -0
- package/src/lib/host/craft-signal.js.map +1 -0
- package/src/lib/host/craft-test-bed.d.ts +63 -0
- package/src/lib/host/craft-test-bed.d.ts.map +1 -0
- package/src/lib/host/craft-test-bed.js +114 -0
- package/src/lib/host/craft-test-bed.js.map +1 -0
- package/src/lib/host-tag.d.ts +2 -0
- package/src/lib/host-tag.d.ts.map +1 -0
- package/src/lib/host-tag.js +2 -0
- package/src/lib/host-tag.js.map +1 -0
- package/src/lib/insert-entities.d.ts +131 -0
- package/src/lib/insert-entities.d.ts.map +1 -0
- package/src/lib/insert-entities.js +159 -0
- package/src/lib/insert-entities.js.map +1 -0
- package/src/lib/insert-noop-typing-anchor.d.ts +15 -0
- package/src/lib/insert-noop-typing-anchor.d.ts.map +1 -0
- package/src/lib/insert-noop-typing-anchor.js +16 -0
- package/src/lib/insert-noop-typing-anchor.js.map +1 -0
- package/src/lib/insert-pagination-placeholder-data.d.ts +122 -0
- package/src/lib/insert-pagination-placeholder-data.d.ts.map +1 -0
- package/src/lib/insert-pagination-placeholder-data.js +244 -0
- package/src/lib/insert-pagination-placeholder-data.js.map +1 -0
- package/src/lib/insert-react-on-mutation.d.ts +261 -0
- package/src/lib/insert-react-on-mutation.d.ts.map +1 -0
- package/src/lib/insert-react-on-mutation.js +227 -0
- package/src/lib/insert-react-on-mutation.js.map +1 -0
- package/src/lib/insert-select-resource.d.ts +31 -0
- package/src/lib/insert-select-resource.d.ts.map +1 -0
- package/src/lib/insert-select-resource.js +27 -0
- package/src/lib/insert-select-resource.js.map +1 -0
- package/src/lib/insert-select.d.ts +126 -0
- package/src/lib/insert-select.d.ts.map +1 -0
- package/src/lib/insert-select.js +535 -0
- package/src/lib/insert-select.js.map +1 -0
- package/src/lib/insert-storage-persister.d.ts +27 -0
- package/src/lib/insert-storage-persister.d.ts.map +1 -0
- package/src/lib/insert-storage-persister.js +65 -0
- package/src/lib/insert-storage-persister.js.map +1 -0
- package/src/lib/insert-typed-pipes.d.ts +64 -0
- package/src/lib/insert-typed-pipes.d.ts.map +1 -0
- package/src/lib/insert-typed-pipes.js +32 -0
- package/src/lib/insert-typed-pipes.js.map +1 -0
- package/src/lib/linked-source.d.ts +8 -0
- package/src/lib/linked-source.d.ts.map +1 -0
- package/src/lib/linked-source.js +24 -0
- package/src/lib/linked-source.js.map +1 -0
- package/src/lib/local-storage-persister.d.ts +4 -0
- package/src/lib/local-storage-persister.d.ts.map +1 -0
- package/src/lib/local-storage-persister.js +342 -0
- package/src/lib/local-storage-persister.js.map +1 -0
- package/src/lib/middleware-schema-shared.d.ts +67 -0
- package/src/lib/middleware-schema-shared.d.ts.map +1 -0
- package/src/lib/middleware-schema-shared.js +34 -0
- package/src/lib/middleware-schema-shared.js.map +1 -0
- package/src/lib/mock-http-request-for-route.d.ts +173 -0
- package/src/lib/mock-http-request-for-route.d.ts.map +1 -0
- package/src/lib/mock-http-request-for-route.js +127 -0
- package/src/lib/mock-http-request-for-route.js.map +1 -0
- package/src/lib/mutation.d.ts +332 -0
- package/src/lib/mutation.d.ts.map +1 -0
- package/src/lib/mutation.js +923 -0
- package/src/lib/mutation.js.map +1 -0
- package/src/lib/on$.d.ts +26 -0
- package/src/lib/on$.d.ts.map +1 -0
- package/src/lib/on$.js +19 -0
- package/src/lib/on$.js.map +1 -0
- package/src/lib/portable-server-function.d.ts +68 -0
- package/src/lib/portable-server-function.d.ts.map +1 -0
- package/src/lib/portable-server-function.js +97 -0
- package/src/lib/portable-server-function.js.map +1 -0
- package/src/lib/preserved-resource.d.ts +4 -0
- package/src/lib/preserved-resource.d.ts.map +1 -0
- package/src/lib/preserved-resource.js +60 -0
- package/src/lib/preserved-resource.js.map +1 -0
- package/src/lib/primitive-method-runtime-context.d.ts +28 -0
- package/src/lib/primitive-method-runtime-context.d.ts.map +1 -0
- package/src/lib/primitive-method-runtime-context.js +38 -0
- package/src/lib/primitive-method-runtime-context.js.map +1 -0
- package/src/lib/primitive-resource-runtime-context.d.ts +46 -0
- package/src/lib/primitive-resource-runtime-context.d.ts.map +1 -0
- package/src/lib/primitive-resource-runtime-context.js +102 -0
- package/src/lib/primitive-resource-runtime-context.js.map +1 -0
- package/src/lib/query-params.d.ts +216 -0
- package/src/lib/query-params.d.ts.map +1 -0
- package/src/lib/query-params.js +324 -0
- package/src/lib/query-params.js.map +1 -0
- package/src/lib/query.core.d.ts +214 -0
- package/src/lib/query.core.d.ts.map +1 -0
- package/src/lib/query.core.js +210 -0
- package/src/lib/query.core.js.map +1 -0
- package/src/lib/query.d.ts +324 -0
- package/src/lib/query.d.ts.map +1 -0
- package/src/lib/query.js +971 -0
- package/src/lib/query.js.map +1 -0
- package/src/lib/reactive-read.d.ts +162 -0
- package/src/lib/reactive-read.d.ts.map +1 -0
- package/src/lib/reactive-read.js +389 -0
- package/src/lib/reactive-read.js.map +1 -0
- package/src/lib/resource-by-id.d.ts +71 -0
- package/src/lib/resource-by-id.d.ts.map +1 -0
- package/src/lib/resource-by-id.js +294 -0
- package/src/lib/resource-by-id.js.map +1 -0
- package/src/lib/resource-exception.d.ts +30 -0
- package/src/lib/resource-exception.d.ts.map +1 -0
- package/src/lib/resource-exception.js +86 -0
- package/src/lib/resource-exception.js.map +1 -0
- package/src/lib/route-checked-di.d.ts +229 -0
- package/src/lib/route-checked-di.d.ts.map +1 -0
- package/src/lib/route-checked-di.js +1 -0
- package/src/lib/route-checked-di.js.map +1 -0
- package/src/lib/schema-validation.d.ts +89 -0
- package/src/lib/schema-validation.d.ts.map +1 -0
- package/src/lib/schema-validation.js +110 -0
- package/src/lib/schema-validation.js.map +1 -0
- package/src/lib/send-context-to-ai.d.ts +20 -0
- package/src/lib/send-context-to-ai.d.ts.map +1 -0
- package/src/lib/send-context-to-ai.js +18 -0
- package/src/lib/send-context-to-ai.js.map +1 -0
- package/src/lib/send-context-to-ai.tokens.d.ts +12 -0
- package/src/lib/send-context-to-ai.tokens.d.ts.map +1 -0
- package/src/lib/send-context-to-ai.tokens.js +1 -0
- package/src/lib/send-context-to-ai.tokens.js.map +1 -0
- package/src/lib/server-function-client.d.ts +102 -0
- package/src/lib/server-function-client.d.ts.map +1 -0
- package/src/lib/server-function-client.js +106 -0
- package/src/lib/server-function-client.js.map +1 -0
- package/src/lib/server-function-contract.d.ts +42 -0
- package/src/lib/server-function-contract.d.ts.map +1 -0
- package/src/lib/server-function-contract.js +23 -0
- package/src/lib/server-function-contract.js.map +1 -0
- package/src/lib/server-function-middleware.d.ts +222 -0
- package/src/lib/server-function-middleware.d.ts.map +1 -0
- package/src/lib/server-function-middleware.js +189 -0
- package/src/lib/server-function-middleware.js.map +1 -0
- package/src/lib/server-function.d.ts +114 -0
- package/src/lib/server-function.d.ts.map +1 -0
- package/src/lib/server-function.js +80 -0
- package/src/lib/server-function.js.map +1 -0
- package/src/lib/server-layer.d.ts +185 -0
- package/src/lib/server-layer.d.ts.map +1 -0
- package/src/lib/server-layer.js +121 -0
- package/src/lib/server-layer.js.map +1 -0
- package/src/lib/server.d.ts +83 -0
- package/src/lib/server.d.ts.map +1 -0
- package/src/lib/server.js +266 -0
- package/src/lib/server.js.map +1 -0
- package/src/lib/setup-craft-service-test.d.ts +90 -0
- package/src/lib/setup-craft-service-test.d.ts.map +1 -0
- package/src/lib/setup-craft-service-test.js +193 -0
- package/src/lib/setup-craft-service-test.js.map +1 -0
- package/src/lib/setup-craft-service-testing-by-register.d.ts +245 -0
- package/src/lib/setup-craft-service-testing-by-register.d.ts.map +1 -0
- package/src/lib/setup-craft-service-testing-by-register.js +316 -0
- package/src/lib/setup-craft-service-testing-by-register.js.map +1 -0
- package/src/lib/signal-proxy.d.ts +21 -0
- package/src/lib/signal-proxy.d.ts.map +1 -0
- package/src/lib/signal-proxy.js +79 -0
- package/src/lib/signal-proxy.js.map +1 -0
- package/src/lib/signal-source.d.ts +392 -0
- package/src/lib/signal-source.d.ts.map +1 -0
- package/src/lib/signal-source.js +433 -0
- package/src/lib/signal-source.js.map +1 -0
- package/src/lib/source$.d.ts +121 -0
- package/src/lib/source$.d.ts.map +1 -0
- package/src/lib/source$.js +171 -0
- package/src/lib/source$.js.map +1 -0
- package/src/lib/source-from-event.d.ts +350 -0
- package/src/lib/source-from-event.d.ts.map +1 -0
- package/src/lib/source-from-event.js +26 -0
- package/src/lib/source-from-event.js.map +1 -0
- package/src/lib/stacked-source.d.ts +6 -0
- package/src/lib/stacked-source.d.ts.map +1 -0
- package/src/lib/stacked-source.js +29 -0
- package/src/lib/stacked-source.js.map +1 -0
- package/src/lib/standard-schema.d.ts +43 -0
- package/src/lib/standard-schema.d.ts.map +1 -0
- package/src/lib/standard-schema.js +1 -0
- package/src/lib/standard-schema.js.map +1 -0
- package/src/lib/state-method-runtime-context.d.ts +13 -0
- package/src/lib/state-method-runtime-context.d.ts.map +1 -0
- package/src/lib/state-method-runtime-context.js +11 -0
- package/src/lib/state-method-runtime-context.js.map +1 -0
- package/src/lib/state.d.ts +158 -0
- package/src/lib/state.d.ts.map +1 -0
- package/src/lib/state.js +388 -0
- package/src/lib/state.js.map +1 -0
- package/src/lib/storage-persister.service.d.ts +25 -0
- package/src/lib/storage-persister.service.d.ts.map +1 -0
- package/src/lib/storage-persister.service.js +27 -0
- package/src/lib/storage-persister.service.js.map +1 -0
- package/src/lib/take-app-snapshot.d.ts +31 -0
- package/src/lib/take-app-snapshot.d.ts.map +1 -0
- package/src/lib/take-app-snapshot.js +93 -0
- package/src/lib/take-app-snapshot.js.map +1 -0
- package/src/lib/template-trace.d.ts +37 -0
- package/src/lib/template-trace.d.ts.map +1 -0
- package/src/lib/template-trace.js +37 -0
- package/src/lib/template-trace.js.map +1 -0
- package/src/lib/temporal-runtime.d.ts +146 -0
- package/src/lib/temporal-runtime.d.ts.map +1 -0
- package/src/lib/temporal-runtime.js +375 -0
- package/src/lib/temporal-runtime.js.map +1 -0
- package/src/lib/to-source.d.ts +335 -0
- package/src/lib/to-source.d.ts.map +1 -0
- package/src/lib/to-source.js +359 -0
- package/src/lib/to-source.js.map +1 -0
- package/src/lib/util/craft-resource-ref.d.ts +29 -0
- package/src/lib/util/craft-resource-ref.d.ts.map +1 -0
- package/src/lib/util/craft-resource-ref.js +1 -0
- package/src/lib/util/craft-resource-ref.js.map +1 -0
- package/src/lib/util/craft-resource-status.d.ts +17 -0
- package/src/lib/util/craft-resource-status.d.ts.map +1 -0
- package/src/lib/util/craft-resource-status.js +14 -0
- package/src/lib/util/craft-resource-status.js.map +1 -0
- package/src/lib/util/entities-util.d.ts +340 -0
- package/src/lib/util/entities-util.d.ts.map +1 -0
- package/src/lib/util/entities-util.js +136 -0
- package/src/lib/util/entities-util.js.map +1 -0
- package/src/lib/util/explicit-effect.d.ts +42 -0
- package/src/lib/util/explicit-effect.d.ts.map +1 -0
- package/src/lib/util/explicit-effect.js +37 -0
- package/src/lib/util/explicit-effect.js.map +1 -0
- package/src/lib/util/extract-signal-props-and-methods.d.ts +20 -0
- package/src/lib/util/extract-signal-props-and-methods.d.ts.map +1 -0
- package/src/lib/util/extract-signal-props-and-methods.js +1 -0
- package/src/lib/util/extract-signal-props-and-methods.js.map +1 -0
- package/src/lib/util/method-trigger-nonce.d.ts +45 -0
- package/src/lib/util/method-trigger-nonce.d.ts.map +1 -0
- package/src/lib/util/method-trigger-nonce.js +58 -0
- package/src/lib/util/method-trigger-nonce.js.map +1 -0
- package/src/lib/util/persister.type.d.ts +37 -0
- package/src/lib/util/persister.type.d.ts.map +1 -0
- package/src/lib/util/persister.type.js +1 -0
- package/src/lib/util/persister.type.js.map +1 -0
- package/src/lib/util/persister.util.d.ts +8 -0
- package/src/lib/util/persister.util.d.ts.map +1 -0
- package/src/lib/util/persister.util.js +71 -0
- package/src/lib/util/persister.util.js.map +1 -0
- package/src/lib/util/react-on-mutation-effect.d.ts +16 -0
- package/src/lib/util/react-on-mutation-effect.d.ts.map +1 -0
- package/src/lib/util/react-on-mutation-effect.js +148 -0
- package/src/lib/util/react-on-mutation-effect.js.map +1 -0
- package/src/lib/util/resource-by-id-changes-tracker.util.d.ts +27 -0
- package/src/lib/util/resource-by-id-changes-tracker.util.d.ts.map +1 -0
- package/src/lib/util/resource-by-id-changes-tracker.util.js +97 -0
- package/src/lib/util/resource-by-id-changes-tracker.util.js.map +1 -0
- package/src/lib/util/source.type.d.ts +6 -0
- package/src/lib/util/source.type.d.ts.map +1 -0
- package/src/lib/util/source.type.js +1 -0
- package/src/lib/util/source.type.js.map +1 -0
- package/src/lib/util/types/access-type-object-property-by-dotted-path.type.d.ts +4 -0
- package/src/lib/util/types/access-type-object-property-by-dotted-path.type.d.ts.map +1 -0
- package/src/lib/util/types/access-type-object-property-by-dotted-path.type.js +1 -0
- package/src/lib/util/types/access-type-object-property-by-dotted-path.type.js.map +1 -0
- package/src/lib/util/types/boolean-or-mapper-fn-by-path-by-id.type.d.ts +27 -0
- package/src/lib/util/types/boolean-or-mapper-fn-by-path-by-id.type.d.ts.map +1 -0
- package/src/lib/util/types/boolean-or-mapper-fn-by-path-by-id.type.js +1 -0
- package/src/lib/util/types/boolean-or-mapper-fn-by-path-by-id.type.js.map +1 -0
- package/src/lib/util/types/boolean-or-mapper-fn-by-path.type.d.ts +24 -0
- package/src/lib/util/types/boolean-or-mapper-fn-by-path.type.d.ts.map +1 -0
- package/src/lib/util/types/boolean-or-mapper-fn-by-path.type.js +1 -0
- package/src/lib/util/types/boolean-or-mapper-fn-by-path.type.js.map +1 -0
- package/src/lib/util/types/brand.d.ts +7 -0
- package/src/lib/util/types/brand.d.ts.map +1 -0
- package/src/lib/util/types/brand.js +9 -0
- package/src/lib/util/types/brand.js.map +1 -0
- package/src/lib/util/types/object-deep-path-mapper.type.d.ts +13 -0
- package/src/lib/util/types/object-deep-path-mapper.type.d.ts.map +1 -0
- package/src/lib/util/types/object-deep-path-mapper.type.js +1 -0
- package/src/lib/util/types/object-deep-path-mapper.type.js.map +1 -0
- package/src/lib/util/types/resource-by-id-config.type.d.ts +115 -0
- package/src/lib/util/types/resource-by-id-config.type.d.ts.map +1 -0
- package/src/lib/util/types/resource-by-id-config.type.js +1 -0
- package/src/lib/util/types/resource-by-id-config.type.js.map +1 -0
- package/src/lib/util/types/resource-with-params-or-params-fn.type.d.ts +52 -0
- package/src/lib/util/types/resource-with-params-or-params-fn.type.d.ts.map +1 -0
- package/src/lib/util/types/resource-with-params-or-params-fn.type.js +1 -0
- package/src/lib/util/types/resource-with-params-or-params-fn.type.js.map +1 -0
- package/src/lib/util/types/shared.type.d.ts +66 -0
- package/src/lib/util/types/shared.type.d.ts.map +1 -0
- package/src/lib/util/types/shared.type.js +1 -0
- package/src/lib/util/types/shared.type.js.map +1 -0
- package/src/lib/util/types/util.d.ts +16 -0
- package/src/lib/util/types/util.d.ts.map +1 -0
- package/src/lib/util/types/util.js +60 -0
- package/src/lib/util/types/util.js.map +1 -0
- package/src/lib/util/types/util.type.d.ts +67 -0
- package/src/lib/util/types/util.type.d.ts.map +1 -0
- package/src/lib/util/types/util.type.js +5 -0
- package/src/lib/util/types/util.type.js.map +1 -0
- package/src/lib/util/update-state.util.d.ts +10 -0
- package/src/lib/util/update-state.util.d.ts.map +1 -0
- package/src/lib/util/update-state.util.js +31 -0
- package/src/lib/util/update-state.util.js.map +1 -0
- package/src/lib/util/util.d.ts +19 -0
- package/src/lib/util/util.d.ts.map +1 -0
- package/src/lib/util/util.js +50 -0
- package/src/lib/util/util.js.map +1 -0
- package/src/lib/util/util.type.d.ts +107 -0
- package/src/lib/util/util.type.d.ts.map +1 -0
- package/src/lib/util/util.type.js +9 -0
- package/src/lib/util/util.type.js.map +1 -0
- package/src/lib/yieldable.d.ts +94 -0
- package/src/lib/yieldable.d.ts.map +1 -0
- package/src/lib/yieldable.js +109 -0
- package/src/lib/yieldable.js.map +1 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { type Signal } from './host/craft-compat';
|
|
2
|
+
import { type CraftGenExceptionMarker } from './craft-gen';
|
|
3
|
+
import type { AnyCraftException } from './craft-exception';
|
|
4
|
+
import type { CraftResourceStatus } from './util/craft-resource-status';
|
|
5
|
+
import type { ReactiveReadRequest, YieldableReactiveValue } from './reactive-read';
|
|
6
|
+
declare const CRAFT_NOT_SETTLED: unique symbol;
|
|
7
|
+
/**
|
|
8
|
+
* Thrown by a {@link CraftSettledSignal} read while its source has not settled
|
|
9
|
+
* yet (`status` still `'idle'` or `'loading'`).
|
|
10
|
+
*
|
|
11
|
+
* It is the pending twin of {@link CraftGenShortCircuit}: both are native
|
|
12
|
+
* `throw`s raised during a render pass and caught by the nearest boundary — a
|
|
13
|
+
* `catchBlock` for the exception, a `pendingBlock` for this one. The dependency
|
|
14
|
+
* on the source's `status` signal is established *before* the throw, so the
|
|
15
|
+
* reading computation re-runs on its own once the source settles.
|
|
16
|
+
*/
|
|
17
|
+
export declare class CraftNotSettled extends Error {
|
|
18
|
+
readonly [CRAFT_NOT_SETTLED] = true;
|
|
19
|
+
/** Name of the async source that is not settled yet (`query` name, …). */
|
|
20
|
+
readonly source: string;
|
|
21
|
+
constructor(source: string);
|
|
22
|
+
}
|
|
23
|
+
export declare function isCraftNotSettled(value: unknown): value is CraftNotSettled;
|
|
24
|
+
declare const CRAFT_SETTLED_BRAND: unique symbol;
|
|
25
|
+
/**
|
|
26
|
+
* Type-only brand carried by a {@link CraftSettledSignal}. It records **which**
|
|
27
|
+
* async source the reader depends on and **which** exception codes that source
|
|
28
|
+
* may raise, so both requirements can be enforced by the template type-checker:
|
|
29
|
+
*
|
|
30
|
+
* - `Source` must be covered by a `pendingBlock` boundary;
|
|
31
|
+
* - `Codes` must be covered by a `catchBlock` boundary.
|
|
32
|
+
*
|
|
33
|
+
* The brand survives passing the signal by reference (`span(users.settledValue)`)
|
|
34
|
+
* and travels through `craftComputed` via the marker yielded by {@link settled}.
|
|
35
|
+
* It is lost inside a lambda (`() => users.settledValue().name`) — that case is
|
|
36
|
+
* a lint concern, not a type one.
|
|
37
|
+
*/
|
|
38
|
+
export interface CraftSettledBrand<Source extends string = string, Exceptions = never> {
|
|
39
|
+
readonly [CRAFT_SETTLED_BRAND]: {
|
|
40
|
+
readonly source: Source;
|
|
41
|
+
readonly exceptions: Exceptions;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A `Signal<Value>` that never returns `undefined` and never returns a value
|
|
46
|
+
* while its source carries an exception — it throws instead (see
|
|
47
|
+
* {@link CraftNotSettled}). Its brand makes both obligations visible to the
|
|
48
|
+
* template type-checker.
|
|
49
|
+
*/
|
|
50
|
+
export type CraftSettledSignal<Value, Source extends string = string, Exceptions = never> = Signal<Value> & CraftSettledBrand<Source, Exceptions>;
|
|
51
|
+
/** Type-only yields carried by a direct settled reader in a generator. */
|
|
52
|
+
export type CraftSettledReadMarkers<Source extends string, Exceptions> = CraftPendingMarker<Source> | CraftGenExceptionMarker<Exceptions>;
|
|
53
|
+
/** A settled reader that can be consumed directly with `yield* reader()`. */
|
|
54
|
+
export type CraftSettledYieldableValue<Value, Source extends string = string, Exceptions = never> = YieldableReactiveValue<Value, 'settledState', CraftSettledReadMarkers<Source, Exceptions>> & CraftSettledBrand<Source, Exceptions>;
|
|
55
|
+
/** The async source names a value depends on (`never` when it depends on none). */
|
|
56
|
+
export type CraftSettledSourcesOf<Value> = Value extends CraftSettledBrand<infer Source, any> ? string extends Source ? never : Source : never;
|
|
57
|
+
/** The `craftException`s a settled read may surface. */
|
|
58
|
+
export type CraftSettledExceptionsOf<Value> = Value extends CraftSettledBrand<any, infer Exceptions> ? Exceptions : never;
|
|
59
|
+
/** The exception codes a settled read may surface. */
|
|
60
|
+
export type CraftSettledCodesOf<Value> = Extract<CraftSettledExceptionsOf<Value>, {
|
|
61
|
+
readonly _tag: string;
|
|
62
|
+
}>['_tag'];
|
|
63
|
+
/**
|
|
64
|
+
* Type-level marker surfaced by a {@link settled} call's `Yielded`, carrying the
|
|
65
|
+
* name of the async source the enclosing computation now depends on.
|
|
66
|
+
*
|
|
67
|
+
* Like {@link CraftGenExceptionMarker} it is **never** yielded at runtime, and is
|
|
68
|
+
* intentionally not a `ServiceYieldRequest` so dependency-map extraction ignores
|
|
69
|
+
* it.
|
|
70
|
+
*/
|
|
71
|
+
export interface CraftPendingMarker<Source extends string> {
|
|
72
|
+
readonly __craftPendingSource__: Source;
|
|
73
|
+
}
|
|
74
|
+
/** Extracts the union of async source names advertised by the markers in `Yielded`. */
|
|
75
|
+
export type ExtractCraftPendingSources<Yielded> = [
|
|
76
|
+
Extract<Yielded, CraftPendingMarker<any>>
|
|
77
|
+
] extends [never] ? never : Extract<Yielded, CraftPendingMarker<any>> extends CraftPendingMarker<infer Source> ? Source : never;
|
|
78
|
+
/**
|
|
79
|
+
* What a settled read reports about its source to whoever is listening — today
|
|
80
|
+
* a `pendingBlock` boundary, which needs a handle on the source's liveness to
|
|
81
|
+
* render a reload indicator.
|
|
82
|
+
*
|
|
83
|
+
* A suspension is announced by a `throw`, but a **reload** is not: the stale
|
|
84
|
+
* value is returned and nothing is thrown. Without this channel a boundary
|
|
85
|
+
* would never learn that a source it covers is refetching.
|
|
86
|
+
*/
|
|
87
|
+
export interface CraftSettledReadNotice {
|
|
88
|
+
readonly source: string;
|
|
89
|
+
readonly status: Signal<CraftResourceStatus | string>;
|
|
90
|
+
readonly value: Signal<unknown>;
|
|
91
|
+
}
|
|
92
|
+
export type CraftSettledReadObserver = (notice: CraftSettledReadNotice) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Runs `work` with `observer` notified of every settled read it performs. The
|
|
95
|
+
* observer is registered for the synchronous extent of the call — settled reads
|
|
96
|
+
* are computations, so they evaluate inside the reader's own effect.
|
|
97
|
+
*/
|
|
98
|
+
export declare function ɵwithSettledReadObserver<T>(observer: CraftSettledReadObserver | undefined, work: () => T): T;
|
|
99
|
+
/** The minimal shape {@link craftSettledValue} needs to build a settled read. */
|
|
100
|
+
export type SettleableResource = {
|
|
101
|
+
status: Signal<CraftResourceStatus | string>;
|
|
102
|
+
value: Signal<unknown>;
|
|
103
|
+
error?: Signal<Error | undefined>;
|
|
104
|
+
hasException: Signal<boolean>;
|
|
105
|
+
exceptions: Signal<{
|
|
106
|
+
list: readonly AnyCraftException[];
|
|
107
|
+
}>;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Builds the `settledValue` signal of a craft primitive. Reading it:
|
|
111
|
+
*
|
|
112
|
+
* - throws {@link CraftGenShortCircuit} when the source carries a business
|
|
113
|
+
* exception — routed to the nearest `catchBlock`;
|
|
114
|
+
* - throws {@link CraftNotSettled} while the source has no value to show yet —
|
|
115
|
+
* routed to the nearest `pendingBlock`;
|
|
116
|
+
* - otherwise returns the resolved value, never `undefined`.
|
|
117
|
+
*
|
|
118
|
+
* A reload that preserves its previous value does **not** suspend: the stale
|
|
119
|
+
* value is returned while the new one is in flight (stale-while-revalidate), so
|
|
120
|
+
* a refetch never blanks a screen that already has data. Only a source with
|
|
121
|
+
* nothing to show suspends.
|
|
122
|
+
*
|
|
123
|
+
* A residual technical failure (status `'exception'` with no business exception)
|
|
124
|
+
* is rethrown through the internal Angular `error` channel, mirroring
|
|
125
|
+
* `craftUntilSettled`.
|
|
126
|
+
*/
|
|
127
|
+
export declare function craftSettledValue<Value>(source: string, resource: SettleableResource): CraftSettledSignal<Value>;
|
|
128
|
+
type SettledReaderOf<Ref> = Ref extends {
|
|
129
|
+
settledValue: YieldableReactiveValue<infer Value, any, any> & CraftSettledBrand<infer Source, infer Exceptions>;
|
|
130
|
+
} ? YieldableReactiveValue<Value> & CraftSettledBrand<Source, Exceptions> : never;
|
|
131
|
+
/**
|
|
132
|
+
* Reads the settled value of a craft primitive from inside a generator-based
|
|
133
|
+
* computation, and records the dependency in its type:
|
|
134
|
+
*
|
|
135
|
+
* ```ts
|
|
136
|
+
* readonly activeUserName = craftComputed('activeUserName', function* () {
|
|
137
|
+
* const users = yield* settled(this.users);
|
|
138
|
+
* // `users` is `User[]` here — never undefined, never in exception
|
|
139
|
+
* return users.filter((user) => user.active).length;
|
|
140
|
+
* });
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* The primitive's `settledValue` reader is executed immediately by the Craft
|
|
144
|
+
* generator runtime. The additional yielded markers are type-only and make the
|
|
145
|
+
* enclosing `craftComputed`:
|
|
146
|
+
*
|
|
147
|
+
* - depend on the source's pending state — a `pendingBlock` becomes mandatory in
|
|
148
|
+
* any template rendering it;
|
|
149
|
+
* - carry the source's exceptions — a `catchBlock` becomes mandatory too.
|
|
150
|
+
*/
|
|
151
|
+
export declare function settled<const Ref extends {
|
|
152
|
+
readonly settledValue: YieldableReactiveValue<any, any, any> & CraftSettledBrand<any, any>;
|
|
153
|
+
}>(resource: Ref): Generator<CraftPendingMarker<SettledReaderOf<Ref> extends CraftSettledBrand<infer Source, any> ? Source : never> | CraftGenExceptionMarker<CraftSettledExceptionsOf<SettledReaderOf<Ref>>> | ReactiveReadRequest, SettledReaderOf<Ref> extends YieldableReactiveValue<infer Value> ? Value : never, unknown>;
|
|
154
|
+
/**
|
|
155
|
+
* Installs the lazily-created `settledValue` read on a resource-like primitive
|
|
156
|
+
* ref (`query`, `mutation`, `asyncProcess`).
|
|
157
|
+
*
|
|
158
|
+
* It is a getter — the computation is only built on first read — and it is
|
|
159
|
+
* **enumerable**: a template context is rebuilt by copying the ref's own
|
|
160
|
+
* enumerable members, so a hidden property would not survive the trip into the
|
|
161
|
+
* template.
|
|
162
|
+
*/
|
|
163
|
+
export declare function attachCraftSettledValue(name: string, ref: object): void;
|
|
164
|
+
/** Creates an insertion-facing generator reader over a settled raw signal. */
|
|
165
|
+
export declare function createYieldableSettledValue<Value, Source extends string, Exceptions>(source: Signal<Value>, identity: {
|
|
166
|
+
readonly primitive?: string;
|
|
167
|
+
readonly insertion?: string;
|
|
168
|
+
readonly path?: string;
|
|
169
|
+
}): CraftSettledYieldableValue<Value, Source, Exceptions>;
|
|
170
|
+
export {};
|
|
171
|
+
//# sourceMappingURL=craft-settled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"craft-settled.d.ts","sourceRoot":"","sources":["../../../../../libs/core/src/lib/craft-settled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAGzB,QAAA,MAAM,iBAAiB,eAA8B,CAAC;AAEtD;;;;;;;;;GASG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,CAAC,iBAAiB,CAAC,QAAQ;IACpC,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM;CAO3B;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAI1E;AAED,OAAO,CAAC,MAAM,mBAAmB,EAAE,OAAO,MAAM,CAAC;AAEjD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,iBAAiB,CAChC,MAAM,SAAS,MAAM,GAAG,MAAM,EAC9B,UAAU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EACL,MAAM,SAAS,MAAM,EACrB,UAAU,EAEV,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,EACrB,QAAQ,EAAE;IACR,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB,GACA,0BAA0B,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,CAMvD"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { computed } from './host/craft-compat';
|
|
2
|
+
import { CraftGenShortCircuit, } from './craft-gen';
|
|
3
|
+
import { createYieldableReactiveValue } from './reactive-read';
|
|
4
|
+
const CRAFT_NOT_SETTLED = Symbol('craft-not-settled');
|
|
5
|
+
/**
|
|
6
|
+
* Thrown by a {@link CraftSettledSignal} read while its source has not settled
|
|
7
|
+
* yet (`status` still `'idle'` or `'loading'`).
|
|
8
|
+
*
|
|
9
|
+
* It is the pending twin of {@link CraftGenShortCircuit}: both are native
|
|
10
|
+
* `throw`s raised during a render pass and caught by the nearest boundary — a
|
|
11
|
+
* `catchBlock` for the exception, a `pendingBlock` for this one. The dependency
|
|
12
|
+
* on the source's `status` signal is established *before* the throw, so the
|
|
13
|
+
* reading computation re-runs on its own once the source settles.
|
|
14
|
+
*/
|
|
15
|
+
export class CraftNotSettled extends Error {
|
|
16
|
+
[CRAFT_NOT_SETTLED] = true;
|
|
17
|
+
/** Name of the async source that is not settled yet (`query` name, …). */
|
|
18
|
+
source;
|
|
19
|
+
constructor(source) {
|
|
20
|
+
super(`Craft async source "${source}" is not settled yet. Wrap the reading template in a pendingBlock(...).`);
|
|
21
|
+
this.name = 'CraftNotSettled';
|
|
22
|
+
this.source = source;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export function isCraftNotSettled(value) {
|
|
26
|
+
return (typeof value === 'object' && value !== null && CRAFT_NOT_SETTLED in value);
|
|
27
|
+
}
|
|
28
|
+
let activeSettledReadObserver;
|
|
29
|
+
/**
|
|
30
|
+
* Runs `work` with `observer` notified of every settled read it performs. The
|
|
31
|
+
* observer is registered for the synchronous extent of the call — settled reads
|
|
32
|
+
* are computations, so they evaluate inside the reader's own effect.
|
|
33
|
+
*/
|
|
34
|
+
export function ɵwithSettledReadObserver(observer, work) {
|
|
35
|
+
const previous = activeSettledReadObserver;
|
|
36
|
+
activeSettledReadObserver = observer ?? previous;
|
|
37
|
+
try {
|
|
38
|
+
return work();
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
activeSettledReadObserver = previous;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Builds the `settledValue` signal of a craft primitive. Reading it:
|
|
46
|
+
*
|
|
47
|
+
* - throws {@link CraftGenShortCircuit} when the source carries a business
|
|
48
|
+
* exception — routed to the nearest `catchBlock`;
|
|
49
|
+
* - throws {@link CraftNotSettled} while the source has no value to show yet —
|
|
50
|
+
* routed to the nearest `pendingBlock`;
|
|
51
|
+
* - otherwise returns the resolved value, never `undefined`.
|
|
52
|
+
*
|
|
53
|
+
* A reload that preserves its previous value does **not** suspend: the stale
|
|
54
|
+
* value is returned while the new one is in flight (stale-while-revalidate), so
|
|
55
|
+
* a refetch never blanks a screen that already has data. Only a source with
|
|
56
|
+
* nothing to show suspends.
|
|
57
|
+
*
|
|
58
|
+
* A residual technical failure (status `'exception'` with no business exception)
|
|
59
|
+
* is rethrown through the internal Angular `error` channel, mirroring
|
|
60
|
+
* `craftUntilSettled`.
|
|
61
|
+
*/
|
|
62
|
+
export function craftSettledValue(source, resource) {
|
|
63
|
+
return computed(() => {
|
|
64
|
+
const status = resource.status();
|
|
65
|
+
activeSettledReadObserver?.({
|
|
66
|
+
source,
|
|
67
|
+
status: resource.status,
|
|
68
|
+
value: resource.value,
|
|
69
|
+
});
|
|
70
|
+
if (resource.hasException()) {
|
|
71
|
+
throw new CraftGenShortCircuit(resource.exceptions().list[0]);
|
|
72
|
+
}
|
|
73
|
+
if (status === 'exception') {
|
|
74
|
+
throw resource.error?.();
|
|
75
|
+
}
|
|
76
|
+
const value = resource.value();
|
|
77
|
+
if (value === undefined) {
|
|
78
|
+
throw new CraftNotSettled(source);
|
|
79
|
+
}
|
|
80
|
+
return value;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Reads the settled value of a craft primitive from inside a generator-based
|
|
85
|
+
* computation, and records the dependency in its type:
|
|
86
|
+
*
|
|
87
|
+
* ```ts
|
|
88
|
+
* readonly activeUserName = craftComputed('activeUserName', function* () {
|
|
89
|
+
* const users = yield* settled(this.users);
|
|
90
|
+
* // `users` is `User[]` here — never undefined, never in exception
|
|
91
|
+
* return users.filter((user) => user.active).length;
|
|
92
|
+
* });
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* The primitive's `settledValue` reader is executed immediately by the Craft
|
|
96
|
+
* generator runtime. The additional yielded markers are type-only and make the
|
|
97
|
+
* enclosing `craftComputed`:
|
|
98
|
+
*
|
|
99
|
+
* - depend on the source's pending state — a `pendingBlock` becomes mandatory in
|
|
100
|
+
* any template rendering it;
|
|
101
|
+
* - carry the source's exceptions — a `catchBlock` becomes mandatory too.
|
|
102
|
+
*/
|
|
103
|
+
export function* settled(resource) {
|
|
104
|
+
const read = resource.settledValue;
|
|
105
|
+
return yield* read();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Installs the lazily-created `settledValue` read on a resource-like primitive
|
|
109
|
+
* ref (`query`, `mutation`, `asyncProcess`).
|
|
110
|
+
*
|
|
111
|
+
* It is a getter — the computation is only built on first read — and it is
|
|
112
|
+
* **enumerable**: a template context is rebuilt by copying the ref's own
|
|
113
|
+
* enumerable members, so a hidden property would not survive the trip into the
|
|
114
|
+
* template.
|
|
115
|
+
*/
|
|
116
|
+
export function attachCraftSettledValue(name, ref) {
|
|
117
|
+
if ('settledValue' in ref)
|
|
118
|
+
return;
|
|
119
|
+
let cached;
|
|
120
|
+
Object.defineProperty(ref, 'settledValue', {
|
|
121
|
+
get: () => (cached ??= craftSettledValue(name, ref)),
|
|
122
|
+
enumerable: true,
|
|
123
|
+
configurable: true,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/** Creates an insertion-facing generator reader over a settled raw signal. */
|
|
127
|
+
export function createYieldableSettledValue(source, identity) {
|
|
128
|
+
return createYieldableReactiveValue(source, 'settledState', identity);
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=craft-settled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"craft-settled.js","sourceRoot":"","sources":["../../../../../libs/core/src/lib/craft-settled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EACL,oBAAoB,GAErB,MAAM,aAAa,CAAC;AAOrB,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAE/D,MAAM,iBAAiB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAEtD;;;;;;;;;GASG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC;IACpC,0EAA0E;IACjE,MAAM,CAAS;IAExB,YAAY,MAAc;QACxB,KAAK,CACH,uBAAuB,MAAM,yEAAyE,CACvG,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,iBAAiB,IAAI,KAAK,CAC1E,CAAC;AACJ,CAAC;AAqHD,IAAI,yBAA+D,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACtC,QAA8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GAQG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAY,EAAE,GAAW;IAC/D,IAAI,cAAc,IAAI,GAAG;QAAE,OAAO;IAElC,IAAI,MAA+C,CAAC;IACpD,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,cAAc,EAAE;QACzC,GAAG,EAAE,GAAG,EAAE,CACR,CAAC,MAAM,KAAK,iBAAiB,CAC3B,IAAI,EACJ,GAAoC,CACrC,CAAC;QACJ,UAAU,EAAE,IAAI;QAChB,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;AACL,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,2BAA2B,CAKzC,MAAqB,EACrB,QAIC;IAED,OAAO,4BAA4B,CACjC,MAAM,EACN,cAAc,EACd,QAAQ,CACgD,CAAC;AAC7D,CAAC","sourcesContent":["import { computed, type Signal } from './host/craft-compat';\nimport {\n CraftGenShortCircuit,\n type CraftGenExceptionMarker,\n} from './craft-gen';\nimport type { AnyCraftException } from './craft-exception';\nimport type { CraftResourceStatus } from './util/craft-resource-status';\nimport type {\n ReactiveReadRequest,\n YieldableReactiveValue,\n} from './reactive-read';\nimport { createYieldableReactiveValue } from './reactive-read';\n\nconst CRAFT_NOT_SETTLED = Symbol('craft-not-settled');\n\n/**\n * Thrown by a {@link CraftSettledSignal} read while its source has not settled\n * yet (`status` still `'idle'` or `'loading'`).\n *\n * It is the pending twin of {@link CraftGenShortCircuit}: both are native\n * `throw`s raised during a render pass and caught by the nearest boundary — a\n * `catchBlock` for the exception, a `pendingBlock` for this one. The dependency\n * on the source's `status` signal is established *before* the throw, so the\n * reading computation re-runs on its own once the source settles.\n */\nexport class CraftNotSettled extends Error {\n readonly [CRAFT_NOT_SETTLED] = true;\n /** Name of the async source that is not settled yet (`query` name, …). */\n readonly source: string;\n\n constructor(source: string) {\n super(\n `Craft async source \"${source}\" is not settled yet. Wrap the reading template in a pendingBlock(...).`,\n );\n this.name = 'CraftNotSettled';\n this.source = source;\n }\n}\n\nexport function isCraftNotSettled(value: unknown): value is CraftNotSettled {\n return (\n typeof value === 'object' && value !== null && CRAFT_NOT_SETTLED in value\n );\n}\n\ndeclare const CRAFT_SETTLED_BRAND: unique symbol;\n\n/**\n * Type-only brand carried by a {@link CraftSettledSignal}. It records **which**\n * async source the reader depends on and **which** exception codes that source\n * may raise, so both requirements can be enforced by the template type-checker:\n *\n * - `Source` must be covered by a `pendingBlock` boundary;\n * - `Codes` must be covered by a `catchBlock` boundary.\n *\n * The brand survives passing the signal by reference (`span(users.settledValue)`)\n * and travels through `craftComputed` via the marker yielded by {@link settled}.\n * It is lost inside a lambda (`() => users.settledValue().name`) — that case is\n * a lint concern, not a type one.\n */\nexport interface CraftSettledBrand<\n Source extends string = string,\n Exceptions = never,\n> {\n // Required (never present at runtime) so that extraction is exact: an\n // unbranded signal simply does not match, instead of matching with the\n // parameters falling back to their constraint.\n readonly [CRAFT_SETTLED_BRAND]: {\n readonly source: Source;\n readonly exceptions: Exceptions;\n };\n}\n\n/**\n * A `Signal<Value>` that never returns `undefined` and never returns a value\n * while its source carries an exception — it throws instead (see\n * {@link CraftNotSettled}). Its brand makes both obligations visible to the\n * template type-checker.\n */\nexport type CraftSettledSignal<\n Value,\n Source extends string = string,\n Exceptions = never,\n> = Signal<Value> & CraftSettledBrand<Source, Exceptions>;\n\n/** Type-only yields carried by a direct settled reader in a generator. */\nexport type CraftSettledReadMarkers<Source extends string, Exceptions> =\n | CraftPendingMarker<Source>\n | CraftGenExceptionMarker<Exceptions>;\n\n/** A settled reader that can be consumed directly with `yield* reader()`. */\nexport type CraftSettledYieldableValue<\n Value,\n Source extends string = string,\n Exceptions = never,\n> = YieldableReactiveValue<\n Value,\n 'settledState',\n CraftSettledReadMarkers<Source, Exceptions>\n> &\n CraftSettledBrand<Source, Exceptions>;\n\n/** The async source names a value depends on (`never` when it depends on none). */\nexport type CraftSettledSourcesOf<Value> =\n Value extends CraftSettledBrand<infer Source, any>\n ? string extends Source\n ? never\n : Source\n : never;\n\n/** The `craftException`s a settled read may surface. */\nexport type CraftSettledExceptionsOf<Value> =\n Value extends CraftSettledBrand<any, infer Exceptions> ? Exceptions : never;\n\n/** The exception codes a settled read may surface. */\nexport type CraftSettledCodesOf<Value> = Extract<\n CraftSettledExceptionsOf<Value>,\n { readonly _tag: string }\n>['_tag'];\n\n/**\n * Type-level marker surfaced by a {@link settled} call's `Yielded`, carrying the\n * name of the async source the enclosing computation now depends on.\n *\n * Like {@link CraftGenExceptionMarker} it is **never** yielded at runtime, and is\n * intentionally not a `ServiceYieldRequest` so dependency-map extraction ignores\n * it.\n */\nexport interface CraftPendingMarker<Source extends string> {\n readonly __craftPendingSource__: Source;\n}\n\n/** Extracts the union of async source names advertised by the markers in `Yielded`. */\nexport type ExtractCraftPendingSources<Yielded> = [\n Extract<Yielded, CraftPendingMarker<any>>,\n] extends [never]\n ? never\n : Extract<Yielded, CraftPendingMarker<any>> extends CraftPendingMarker<\n infer Source\n >\n ? Source\n : never;\n\n/**\n * What a settled read reports about its source to whoever is listening — today\n * a `pendingBlock` boundary, which needs a handle on the source's liveness to\n * render a reload indicator.\n *\n * A suspension is announced by a `throw`, but a **reload** is not: the stale\n * value is returned and nothing is thrown. Without this channel a boundary\n * would never learn that a source it covers is refetching.\n */\nexport interface CraftSettledReadNotice {\n readonly source: string;\n readonly status: Signal<CraftResourceStatus | string>;\n readonly value: Signal<unknown>;\n}\n\nexport type CraftSettledReadObserver = (notice: CraftSettledReadNotice) => void;\n\nlet activeSettledReadObserver: CraftSettledReadObserver | undefined;\n\n/**\n * Runs `work` with `observer` notified of every settled read it performs. The\n * observer is registered for the synchronous extent of the call — settled reads\n * are computations, so they evaluate inside the reader's own effect.\n */\nexport function ɵwithSettledReadObserver<T>(\n observer: CraftSettledReadObserver | undefined,\n work: () => T,\n): T {\n const previous = activeSettledReadObserver;\n activeSettledReadObserver = observer ?? previous;\n try {\n return work();\n } finally {\n activeSettledReadObserver = previous;\n }\n}\n\n/** The minimal shape {@link craftSettledValue} needs to build a settled read. */\nexport type SettleableResource = {\n status: Signal<CraftResourceStatus | string>;\n value: Signal<unknown>;\n error?: Signal<Error | undefined>;\n hasException: Signal<boolean>;\n exceptions: Signal<{ list: readonly AnyCraftException[] }>;\n};\n\n/**\n * Builds the `settledValue` signal of a craft primitive. Reading it:\n *\n * - throws {@link CraftGenShortCircuit} when the source carries a business\n * exception — routed to the nearest `catchBlock`;\n * - throws {@link CraftNotSettled} while the source has no value to show yet —\n * routed to the nearest `pendingBlock`;\n * - otherwise returns the resolved value, never `undefined`.\n *\n * A reload that preserves its previous value does **not** suspend: the stale\n * value is returned while the new one is in flight (stale-while-revalidate), so\n * a refetch never blanks a screen that already has data. Only a source with\n * nothing to show suspends.\n *\n * A residual technical failure (status `'exception'` with no business exception)\n * is rethrown through the internal Angular `error` channel, mirroring\n * `craftUntilSettled`.\n */\nexport function craftSettledValue<Value>(\n source: string,\n resource: SettleableResource,\n): CraftSettledSignal<Value> {\n return computed(() => {\n const status = resource.status();\n\n activeSettledReadObserver?.({\n source,\n status: resource.status,\n value: resource.value,\n });\n\n if (resource.hasException()) {\n throw new CraftGenShortCircuit(\n resource.exceptions().list[0] as AnyCraftException,\n );\n }\n\n if (status === 'exception') {\n throw resource.error?.();\n }\n\n const value = resource.value();\n\n if (value === undefined) {\n throw new CraftNotSettled(source);\n }\n\n return value as Value;\n }) as CraftSettledSignal<Value>;\n}\n\ntype SettledReaderOf<Ref> = Ref extends {\n settledValue: YieldableReactiveValue<infer Value, any, any> &\n CraftSettledBrand<infer Source, infer Exceptions>;\n}\n ? YieldableReactiveValue<Value> & CraftSettledBrand<Source, Exceptions>\n : never;\n\n/**\n * Reads the settled value of a craft primitive from inside a generator-based\n * computation, and records the dependency in its type:\n *\n * ```ts\n * readonly activeUserName = craftComputed('activeUserName', function* () {\n * const users = yield* settled(this.users);\n * // `users` is `User[]` here — never undefined, never in exception\n * return users.filter((user) => user.active).length;\n * });\n * ```\n *\n * The primitive's `settledValue` reader is executed immediately by the Craft\n * generator runtime. The additional yielded markers are type-only and make the\n * enclosing `craftComputed`:\n *\n * - depend on the source's pending state — a `pendingBlock` becomes mandatory in\n * any template rendering it;\n * - carry the source's exceptions — a `catchBlock` becomes mandatory too.\n */\nexport function* settled<\n const Ref extends {\n readonly settledValue: YieldableReactiveValue<any, any, any> &\n CraftSettledBrand<any, any>;\n },\n>(\n resource: Ref,\n): Generator<\n | CraftPendingMarker<\n SettledReaderOf<Ref> extends CraftSettledBrand<infer Source, any>\n ? Source\n : never\n >\n | CraftGenExceptionMarker<CraftSettledExceptionsOf<SettledReaderOf<Ref>>>\n | ReactiveReadRequest,\n SettledReaderOf<Ref> extends YieldableReactiveValue<infer Value>\n ? Value\n : never,\n unknown\n> {\n type Value =\n SettledReaderOf<Ref> extends YieldableReactiveValue<infer T> ? T : never;\n const read = resource.settledValue as () => Generator<\n ReactiveReadRequest<Value>,\n Value,\n unknown\n >;\n return yield* read();\n}\n\n/**\n * Installs the lazily-created `settledValue` read on a resource-like primitive\n * ref (`query`, `mutation`, `asyncProcess`).\n *\n * It is a getter — the computation is only built on first read — and it is\n * **enumerable**: a template context is rebuilt by copying the ref's own\n * enumerable members, so a hidden property would not survive the trip into the\n * template.\n */\nexport function attachCraftSettledValue(name: string, ref: object): void {\n if ('settledValue' in ref) return;\n\n let cached: CraftSettledSignal<unknown> | undefined;\n Object.defineProperty(ref, 'settledValue', {\n get: () =>\n (cached ??= craftSettledValue(\n name,\n ref as unknown as SettleableResource,\n )),\n enumerable: true,\n configurable: true,\n });\n}\n\n/** Creates an insertion-facing generator reader over a settled raw signal. */\nexport function createYieldableSettledValue<\n Value,\n Source extends string,\n Exceptions,\n>(\n source: Signal<Value>,\n identity: {\n readonly primitive?: string;\n readonly insertion?: string;\n readonly path?: string;\n },\n): CraftSettledYieldableValue<Value, Source, Exceptions> {\n return createYieldableReactiveValue(\n source,\n 'settledState',\n identity,\n ) as CraftSettledYieldableValue<Value, Source, Exceptions>;\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type SsrMode = 'block' | 'fallback' | 'client';
|
|
2
|
+
export type CraftSsrPolicy = Readonly<{
|
|
3
|
+
mode: SsrMode;
|
|
4
|
+
timeoutMs?: number;
|
|
5
|
+
}>;
|
|
6
|
+
/** Nearest route-level default, overridden by a local pendingBlock policy. */
|
|
7
|
+
export declare const CRAFT_SSR_POLICY: import("..").CraftToken<Readonly<{
|
|
8
|
+
mode: SsrMode;
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
}>>;
|
|
11
|
+
/** Request-scoped bridge used by core async work such as lazy route loading. */
|
|
12
|
+
export type CraftSsrRuntime = Readonly<{
|
|
13
|
+
track(source: string, work: PromiseLike<unknown>): void;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const CRAFT_SSR_RUNTIME: import("..").CraftToken<Readonly<{
|
|
16
|
+
track(source: string, work: PromiseLike<unknown>): void;
|
|
17
|
+
}>>;
|
|
18
|
+
export declare class CraftUnhandledSsrResolutionError extends Error {
|
|
19
|
+
readonly source: string;
|
|
20
|
+
readonly route?: string;
|
|
21
|
+
readonly reason: 'no pendingBlock or route SSR policy';
|
|
22
|
+
constructor(source: string, route?: string);
|
|
23
|
+
}
|
|
24
|
+
export declare class CraftSsrTimeoutError extends Error {
|
|
25
|
+
readonly timeoutMs: number;
|
|
26
|
+
readonly sources: readonly string[];
|
|
27
|
+
constructor(timeoutMs: number, sources: readonly string[]);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=craft-ssr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"craft-ssr.d.ts","sourceRoot":"","sources":["../../../../../libs/core/src/lib/craft-ssr.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEtD,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB;UALrB,OAAO;gBACD,MAAM;GAIwD,CAAC;AAE7E,gFAAgF;AAChF,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;CACzD,CAAC,CAAC;AAEH,eAAO,MAAM,iBAAiB;kBAHd,MAAM,QAAQ,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI;GAGsB,CAAC;AAEhF,qBAAa,gCAAiC,SAAQ,KAAK;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,qCAAqC,CAAC;gBAE3C,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;CAS3C;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;gBAExB,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE;CAQ1D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { craftToken } from './host/craft-injector';
|
|
2
|
+
/** Nearest route-level default, overridden by a local pendingBlock policy. */
|
|
3
|
+
export const CRAFT_SSR_POLICY = craftToken('CraftSsrPolicy');
|
|
4
|
+
export const CRAFT_SSR_RUNTIME = craftToken('CraftSsrRuntime');
|
|
5
|
+
export class CraftUnhandledSsrResolutionError extends Error {
|
|
6
|
+
source;
|
|
7
|
+
route;
|
|
8
|
+
reason;
|
|
9
|
+
constructor(source, route) {
|
|
10
|
+
super(`Craft async source "${source}" suspended during SSR without a pendingBlock or route SSR policy${route ? ` (route: ${route})` : ''}.`);
|
|
11
|
+
this.name = 'CraftUnhandledSsrResolutionError';
|
|
12
|
+
this.source = source;
|
|
13
|
+
this.route = route;
|
|
14
|
+
this.reason = 'no pendingBlock or route SSR policy';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export class CraftSsrTimeoutError extends Error {
|
|
18
|
+
timeoutMs;
|
|
19
|
+
sources;
|
|
20
|
+
constructor(timeoutMs, sources) {
|
|
21
|
+
super(`Craft SSR timed out after ${timeoutMs}ms while waiting for: ${sources.join(', ')}.`);
|
|
22
|
+
this.name = 'CraftSsrTimeoutError';
|
|
23
|
+
this.timeoutMs = timeoutMs;
|
|
24
|
+
this.sources = sources;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=craft-ssr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"craft-ssr.js","sourceRoot":"","sources":["../../../../../libs/core/src/lib/craft-ssr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AASnD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAiB,gBAAgB,CAAC,CAAC;AAO7E,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAkB,iBAAiB,CAAC,CAAC;AAEhF,MAAM,OAAO,gCAAiC,SAAQ,KAAK;IAChD,MAAM,CAAS;IACf,KAAK,CAAU;IACf,MAAM,CAAwC;IAEvD,YAAY,MAAc,EAAE,KAAc;QACxC,KAAK,CACH,uBAAuB,MAAM,oEAAoE,KAAK,CAAC,CAAC,CAAC,YAAY,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CACtI,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,kCAAkC,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,qCAAqC,CAAC;IACtD,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,SAAS,CAAS;IAClB,OAAO,CAAoB;IAEpC,YAAY,SAAiB,EAAE,OAA0B;QACvD,KAAK,CACH,6BAA6B,SAAS,yBAAyB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACrF,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF","sourcesContent":["import { craftToken } from './host/craft-injector';\n\nexport type SsrMode = 'block' | 'fallback' | 'client';\n\nexport type CraftSsrPolicy = Readonly<{\n mode: SsrMode;\n timeoutMs?: number;\n}>;\n\n/** Nearest route-level default, overridden by a local pendingBlock policy. */\nexport const CRAFT_SSR_POLICY = craftToken<CraftSsrPolicy>('CraftSsrPolicy');\n\n/** Request-scoped bridge used by core async work such as lazy route loading. */\nexport type CraftSsrRuntime = Readonly<{\n track(source: string, work: PromiseLike<unknown>): void;\n}>;\n\nexport const CRAFT_SSR_RUNTIME = craftToken<CraftSsrRuntime>('CraftSsrRuntime');\n\nexport class CraftUnhandledSsrResolutionError extends Error {\n readonly source: string;\n readonly route?: string;\n readonly reason: 'no pendingBlock or route SSR policy';\n\n constructor(source: string, route?: string) {\n super(\n `Craft async source \"${source}\" suspended during SSR without a pendingBlock or route SSR policy${route ? ` (route: ${route})` : ''}.`,\n );\n this.name = 'CraftUnhandledSsrResolutionError';\n this.source = source;\n this.route = route;\n this.reason = 'no pendingBlock or route SSR policy';\n }\n}\n\nexport class CraftSsrTimeoutError extends Error {\n readonly timeoutMs: number;\n readonly sources: readonly string[];\n\n constructor(timeoutMs: number, sources: readonly string[]) {\n super(\n `Craft SSR timed out after ${timeoutMs}ms while waiting for: ${sources.join(', ')}.`,\n );\n this.name = 'CraftSsrTimeoutError';\n this.timeoutMs = timeoutMs;\n this.sources = sources;\n }\n}\n"]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Injector, type Signal } from './host/craft-compat';
|
|
2
|
+
import type { CraftWritableSignal } from './host/craft-signal';
|
|
3
|
+
/** A guard as the machine stores it: any transition in, truthiness out. */
|
|
4
|
+
export type RuntimeTransitionGuard = (transition: {
|
|
5
|
+
readonly from: string | undefined;
|
|
6
|
+
readonly to: string;
|
|
7
|
+
readonly context: unknown;
|
|
8
|
+
readonly event: unknown;
|
|
9
|
+
}) => unknown;
|
|
10
|
+
/** What an accepted or refused `transit(...)` reports to its observers. */
|
|
11
|
+
export type MachineTransitionRecord = Readonly<{
|
|
12
|
+
from: string | undefined;
|
|
13
|
+
to: string;
|
|
14
|
+
event: unknown;
|
|
15
|
+
accepted: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
export type MachineTransitionObserver = (record: MachineTransitionRecord) => void;
|
|
18
|
+
export type MachineRuntime = {
|
|
19
|
+
readonly context: unknown;
|
|
20
|
+
readonly currentStep: CraftWritableSignal<string | undefined>;
|
|
21
|
+
readonly globalGuards: readonly RuntimeTransitionGuard[];
|
|
22
|
+
readonly stepGuards: Map<string, readonly RuntimeTransitionGuard[]>;
|
|
23
|
+
readonly injector: Injector;
|
|
24
|
+
readonly initRegistrations: Array<() => void>;
|
|
25
|
+
readonly observers: Set<MachineTransitionObserver>;
|
|
26
|
+
/**
|
|
27
|
+
* While suspended, the machine's registrations do not run. Restoring a
|
|
28
|
+
* captured value would otherwise re-fire the very reactions that produced
|
|
29
|
+
* the transition being replayed, and the machine would fight the replay.
|
|
30
|
+
*/
|
|
31
|
+
suspended: boolean;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The step currently being installed (or the step a registered callback was
|
|
35
|
+
* declared under). `transit(...)` reads it to know its target, which is why the
|
|
36
|
+
* registration helpers restore it around every deferred callback.
|
|
37
|
+
*/
|
|
38
|
+
export type MachineScope = {
|
|
39
|
+
readonly runtime: MachineRuntime;
|
|
40
|
+
readonly target: string;
|
|
41
|
+
};
|
|
42
|
+
export declare function ɵactiveMachineScope(): MachineScope | undefined;
|
|
43
|
+
export declare function ɵrequireMachineScope(helper: string): MachineScope;
|
|
44
|
+
export declare function ɵwithMachineScope<Result>(scope: MachineScope, run: () => Result): Result;
|
|
45
|
+
/**
|
|
46
|
+
* Drives a generator produced inside a machine (a step installation, a
|
|
47
|
+
* registered callback, one of the machine factories) through the synchronous
|
|
48
|
+
* craft runtime, so `yield* SomeService()` resolves against the machine's
|
|
49
|
+
* injector.
|
|
50
|
+
*/
|
|
51
|
+
export declare function ɵdriveMachineGenerator(value: unknown, injector: Injector): unknown;
|
|
52
|
+
/**
|
|
53
|
+
* Runs a deferred machine callback: the declaring step is restored so
|
|
54
|
+
* `transit(...)` resolves to the right target, reads stay untracked (a callback
|
|
55
|
+
* driven from an effect must not subscribe the effect to whatever its guards
|
|
56
|
+
* read), and the returned generator — typically `transit(event).pipe(...)` — is
|
|
57
|
+
* driven through the craft runtime.
|
|
58
|
+
*/
|
|
59
|
+
export declare function ɵrunMachineCallback(scope: MachineScope, run: () => unknown): unknown;
|
|
60
|
+
/**
|
|
61
|
+
* The value `yield* on$(...)` / `yield* afterRecomputation(...)` /
|
|
62
|
+
* `yield* initStateMachine(...)` resolve to. It yields one tracked-deps request
|
|
63
|
+
* (a no-op the craft runtime already understands) so the registration is a
|
|
64
|
+
* regular member of the step generator's yield chain.
|
|
65
|
+
*/
|
|
66
|
+
export declare function ɵmachineRegistration(): Generator<unknown, void, unknown>;
|
|
67
|
+
/** Registration behind `on$(source, callback)` inside a transitionStep. */
|
|
68
|
+
export declare function ɵregisterMachineSource(source: {
|
|
69
|
+
subscribe: (callback: (value: never) => void) => {
|
|
70
|
+
unsubscribe(): void;
|
|
71
|
+
};
|
|
72
|
+
}, callback: (value: never) => unknown): Generator<unknown, void, unknown>;
|
|
73
|
+
/** Registration behind `afterRecomputation(signal, callback)` inside a step. */
|
|
74
|
+
export declare function ɵregisterMachineRecomputation(source: Signal<unknown>, callback: (value: never) => unknown): Generator<unknown, void, unknown>;
|
|
75
|
+
/** Registration behind `initStateMachine(callback)` inside a step. */
|
|
76
|
+
export declare function ɵregisterMachineInit(callback: () => unknown): Generator<unknown, void, unknown>;
|
|
77
|
+
/**
|
|
78
|
+
* Evaluates a transition attempt: global guards, then the target step's guards,
|
|
79
|
+
* then the guards attached to this very `transit(...)` call. A transition to the
|
|
80
|
+
* current step is a no-op, and the accepted attempt simply publishes the new
|
|
81
|
+
* step — the last accepted `transit()` wins, with no queue and no priority.
|
|
82
|
+
*/
|
|
83
|
+
export declare function ɵrunTransition(scope: MachineScope, event: unknown, localGuards: readonly RuntimeTransitionGuard[]): Generator<unknown, boolean, unknown>;
|
|
84
|
+
/** Moves the machine to `step` without consulting any guard. */
|
|
85
|
+
export declare function ɵrestoreMachineStep(runtime: MachineRuntime, step: string): void;
|
|
86
|
+
/** Runs `restore` with the machine's registrations muted. */
|
|
87
|
+
export declare function ɵwithSuspendedMachine<Result>(runtime: MachineRuntime, restore: () => Result): Result;
|
|
88
|
+
//# sourceMappingURL=craft-state-machine-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"craft-state-machine-runtime.d.ts","sourceRoot":"","sources":["../../../../../libs/core/src/lib/craft-state-machine-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,QAAQ,EAGR,KAAK,MAAM,EACZ,MAAM,qBAAqB,CAAC;AAM7B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAkB/D,2EAA2E;AAC3E,MAAM,MAAM,sBAAsB,GAAG,CAAC,UAAU,EAAE;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,KAAK,OAA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