@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,702 @@
|
|
|
1
|
+
import { assertInInjectionContext, computed, batch as craftBatch, DestroyRef, inject, Injector, isSignal, runInInjectionContext, signal, untracked, } from './host/craft-compat';
|
|
2
|
+
import { executeGeneratorCompatibleFactory, isGeneratorFunction, } from './craft-generator-runtime';
|
|
3
|
+
import { executeGeneratorCompatibleFactoryAsync } from './craft-program-runtime';
|
|
4
|
+
import { attachCraftSettledValue, createYieldableSettledValue, CraftNotSettled, } from './craft-settled';
|
|
5
|
+
import { toCraftStatus, } from './util/craft-resource-status';
|
|
6
|
+
import { resourceById } from './resource-by-id';
|
|
7
|
+
import { isSource } from './util/util';
|
|
8
|
+
import { methodParamsWrapperEqual, unwrapMethodParams, wrapMethodParams, } from './util/method-trigger-nonce';
|
|
9
|
+
import { craftResource } from './craft-resource';
|
|
10
|
+
import { preservedResource } from './preserved-resource';
|
|
11
|
+
import { isCraftException, } from './craft-exception';
|
|
12
|
+
import { CORRELATION_ID_SERVICE } from './correlation-id';
|
|
13
|
+
import { createNamedPrimitiveGen, } from './craft-primitive-gen';
|
|
14
|
+
import { takeUntilDestroyed } from './host/craft-compat';
|
|
15
|
+
import { createSchemaValidationRuntime, useSchemaValidationPolicy, } from './schema-validation';
|
|
16
|
+
import { APP_SNAPSHOT_REGISTRY, INSERTION_SNAPSHOT_REGISTRY, InsertionSnapshotRegistry, TAKE_APP_SNAPSHOT, triggerAndCollectInsertions, } from './take-app-snapshot';
|
|
17
|
+
import { createResourceExceptionsRuntime, enrichResourceException, } from './resource-exception';
|
|
18
|
+
import { ɵcreateHostTaggedInjector, ɵHOST_TAG_LIST } from './craft-service';
|
|
19
|
+
import { injectFnWrapper } from './fn-wrapper';
|
|
20
|
+
import { ɵprovidePrimitiveMethodRuntimeContext } from './primitive-method-runtime-context';
|
|
21
|
+
import { ɵcreatePrimitiveResourceByIdRuntimeContext, ɵcreatePrimitiveResourceRuntimeContext, ɵobservePrimitiveResourceRuntimeContext, } from './primitive-resource-runtime-context';
|
|
22
|
+
import { createYieldableInsertionMethod, isNonYieldableInsertionMethod, yieldableInvocation, } from './yieldable';
|
|
23
|
+
import { createYieldableReactiveFacade, deepYieldable, hasDeepYieldableInsertion, isYieldableReactiveValue, nameInsertedReactiveValue, } from './reactive-read';
|
|
24
|
+
import { craftUse } from './craft-use';
|
|
25
|
+
const ASYNC_PROCESS_INVALID_YIELD_ERROR_MESSAGE = 'asyncProcess generators can only yield craftService dependencies or exposed dependency helpers.';
|
|
26
|
+
const ASYNC_PROCESS_APP_START_ERROR_MESSAGE = 'asyncProcess generators do not support onAppStart(...).';
|
|
27
|
+
export function asyncProcess(name,
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
+
AsyncProcessConfig,
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
+
...insertions
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
+
) {
|
|
34
|
+
return createNamedPrimitiveGen(name, createAsyncProcessRef(name, AsyncProcessConfig, ...insertions));
|
|
35
|
+
}
|
|
36
|
+
function createAsyncProcessRef(name, AsyncProcessConfig, ...insertions) {
|
|
37
|
+
const insertionSnapshotRegistry = new InsertionSnapshotRegistry();
|
|
38
|
+
const asyncExtraProviders = [
|
|
39
|
+
{
|
|
40
|
+
provide: INSERTION_SNAPSHOT_REGISTRY,
|
|
41
|
+
useValue: insertionSnapshotRegistry,
|
|
42
|
+
},
|
|
43
|
+
...(AsyncProcessConfig.providers ?? []),
|
|
44
|
+
];
|
|
45
|
+
let injector;
|
|
46
|
+
if ([
|
|
47
|
+
'params' in AsyncProcessConfig ? AsyncProcessConfig.params : undefined,
|
|
48
|
+
'method' in AsyncProcessConfig ? AsyncProcessConfig.method : undefined,
|
|
49
|
+
'loader' in AsyncProcessConfig ? AsyncProcessConfig.loader : undefined,
|
|
50
|
+
'stream' in AsyncProcessConfig ? AsyncProcessConfig.stream : undefined,
|
|
51
|
+
...insertions,
|
|
52
|
+
].some((value) => isGeneratorFunction(value))) {
|
|
53
|
+
assertInInjectionContext(asyncProcess);
|
|
54
|
+
injector = ɵcreateHostTaggedInjector(inject(Injector), `asyncProcess:${name}`, asyncExtraProviders);
|
|
55
|
+
}
|
|
56
|
+
const getInjector = () => {
|
|
57
|
+
if (!injector) {
|
|
58
|
+
assertInInjectionContext(asyncProcess);
|
|
59
|
+
injector = ɵcreateHostTaggedInjector(inject(Injector), `asyncProcess:${name}`, asyncExtraProviders);
|
|
60
|
+
}
|
|
61
|
+
return injector;
|
|
62
|
+
};
|
|
63
|
+
const AsyncProcessResourceParamsFnSignal = signal(undefined);
|
|
64
|
+
// Incremented on every explicit method call so the resource request always
|
|
65
|
+
// changes, forcing the loader to re-run even when the method returns the same
|
|
66
|
+
// value or `undefined`. Starts at 0 = "never called" to preserve idle.
|
|
67
|
+
const methodTriggerSeq = signal(0);
|
|
68
|
+
const hasParamsFn = 'params' in AsyncProcessConfig &&
|
|
69
|
+
typeof AsyncProcessConfig.params === 'function';
|
|
70
|
+
const isConnectedToSource = !hasParamsFn && isSource(AsyncProcessConfig.method);
|
|
71
|
+
const hasMethodFn = !hasParamsFn &&
|
|
72
|
+
typeof AsyncProcessConfig.method === 'function' &&
|
|
73
|
+
!isSignal(AsyncProcessConfig.method);
|
|
74
|
+
const isUsingIdentifier = 'identifier' in AsyncProcessConfig;
|
|
75
|
+
const methodParamsException = signal(undefined);
|
|
76
|
+
const schemaParseExceptions = signal({});
|
|
77
|
+
const configuredSchemas = {
|
|
78
|
+
method: AsyncProcessConfig.methodSchema,
|
|
79
|
+
params: AsyncProcessConfig.paramsSchema,
|
|
80
|
+
loader: AsyncProcessConfig.loaderSchema,
|
|
81
|
+
};
|
|
82
|
+
const hasConfiguredSchema = Object.values(configuredSchemas).some(Boolean);
|
|
83
|
+
const setSchemaException = (stage, exception) => {
|
|
84
|
+
untracked(() => {
|
|
85
|
+
schemaParseExceptions.update((current) => {
|
|
86
|
+
const next = { ...current };
|
|
87
|
+
if (exception)
|
|
88
|
+
next[stage] = exception;
|
|
89
|
+
else
|
|
90
|
+
delete next[stage];
|
|
91
|
+
return next;
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
const schemaPolicy = useSchemaValidationPolicy(getInjector(), AsyncProcessConfig.schemaValidationPolicy);
|
|
96
|
+
const schemaValidation = {
|
|
97
|
+
method: createSchemaValidationRuntime({
|
|
98
|
+
schema: configuredSchemas.method,
|
|
99
|
+
primitive: 'asyncProcess',
|
|
100
|
+
name,
|
|
101
|
+
policy: schemaPolicy,
|
|
102
|
+
setException: setSchemaException,
|
|
103
|
+
}),
|
|
104
|
+
params: createSchemaValidationRuntime({
|
|
105
|
+
schema: configuredSchemas.params,
|
|
106
|
+
primitive: 'asyncProcess',
|
|
107
|
+
name,
|
|
108
|
+
policy: schemaPolicy,
|
|
109
|
+
setException: setSchemaException,
|
|
110
|
+
}),
|
|
111
|
+
loader: createSchemaValidationRuntime({
|
|
112
|
+
schema: configuredSchemas.loader,
|
|
113
|
+
primitive: 'asyncProcess',
|
|
114
|
+
name,
|
|
115
|
+
policy: schemaPolicy,
|
|
116
|
+
setException: setSchemaException,
|
|
117
|
+
}),
|
|
118
|
+
};
|
|
119
|
+
const schemaParse = computed(() => {
|
|
120
|
+
const values = schemaParseExceptions();
|
|
121
|
+
return {
|
|
122
|
+
...(values['method'] ? { method: values['method'] } : {}),
|
|
123
|
+
...(values['params'] ? { params: values['params'] } : {}),
|
|
124
|
+
...(values['loader'] ? { loader: values['loader'] } : {}),
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
const getIdentifierFromParams = (params) => {
|
|
128
|
+
if (!isUsingIdentifier || !('identifier' in AsyncProcessConfig)) {
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
if (params === undefined || params === null) {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
return AsyncProcessConfig.identifier?.(params);
|
|
135
|
+
};
|
|
136
|
+
const sanitizeParamsResult = (value) => {
|
|
137
|
+
if (isCraftException(value)) {
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
return value;
|
|
141
|
+
};
|
|
142
|
+
const reactiveParamsException = computed(() => {
|
|
143
|
+
if (hasMethodFn) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
const schemaParamsException = schemaParseExceptions()['params'];
|
|
147
|
+
if (schemaParamsException) {
|
|
148
|
+
return enrichResourceException(schemaParamsException, {
|
|
149
|
+
scope: 'params',
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
if (hasParamsFn) {
|
|
153
|
+
const paramsValue = executeGeneratorCompatibleFactory({
|
|
154
|
+
factory: AsyncProcessConfig
|
|
155
|
+
.params,
|
|
156
|
+
thisArg: undefined,
|
|
157
|
+
getInjector,
|
|
158
|
+
args: [],
|
|
159
|
+
invalidYieldErrorMessage: ASYNC_PROCESS_INVALID_YIELD_ERROR_MESSAGE,
|
|
160
|
+
multipleAppStartErrorMessage: ASYNC_PROCESS_APP_START_ERROR_MESSAGE,
|
|
161
|
+
onAppStartNotSupportedErrorMessage: ASYNC_PROCESS_APP_START_ERROR_MESSAGE,
|
|
162
|
+
});
|
|
163
|
+
return isCraftException(paramsValue)
|
|
164
|
+
? enrichResourceException(paramsValue, { scope: 'params' })
|
|
165
|
+
: undefined;
|
|
166
|
+
}
|
|
167
|
+
if (isConnectedToSource) {
|
|
168
|
+
const sourceValue = AsyncProcessConfig.method();
|
|
169
|
+
return isCraftException(sourceValue)
|
|
170
|
+
? enrichResourceException(sourceValue, { scope: 'params' })
|
|
171
|
+
: undefined;
|
|
172
|
+
}
|
|
173
|
+
return undefined;
|
|
174
|
+
});
|
|
175
|
+
const paramsException = computed(() => {
|
|
176
|
+
return hasMethodFn ? methodParamsException() : reactiveParamsException();
|
|
177
|
+
});
|
|
178
|
+
const { setLoaderException, exceptions, hasException, createSelectExceptions, createSelectHasException, } = createResourceExceptionsRuntime({
|
|
179
|
+
isUsingIdentifier,
|
|
180
|
+
paramsException,
|
|
181
|
+
});
|
|
182
|
+
const wrappedSourceParams = isConnectedToSource
|
|
183
|
+
? (() => {
|
|
184
|
+
const value = sanitizeParamsResult(AsyncProcessConfig.method());
|
|
185
|
+
if (!configuredSchemas.params || isCraftException(value))
|
|
186
|
+
return value;
|
|
187
|
+
const parsed = schemaValidation.params.parseSync(value, 'params', 'source');
|
|
188
|
+
return parsed.accepted ? parsed.value : undefined;
|
|
189
|
+
})
|
|
190
|
+
: undefined;
|
|
191
|
+
const wrappedParamsFn = hasParamsFn
|
|
192
|
+
? (() => {
|
|
193
|
+
const value = executeGeneratorCompatibleFactory({
|
|
194
|
+
factory: AsyncProcessConfig.params,
|
|
195
|
+
thisArg: undefined,
|
|
196
|
+
getInjector,
|
|
197
|
+
args: [],
|
|
198
|
+
invalidYieldErrorMessage: ASYNC_PROCESS_INVALID_YIELD_ERROR_MESSAGE,
|
|
199
|
+
multipleAppStartErrorMessage: ASYNC_PROCESS_APP_START_ERROR_MESSAGE,
|
|
200
|
+
onAppStartNotSupportedErrorMessage: ASYNC_PROCESS_APP_START_ERROR_MESSAGE,
|
|
201
|
+
});
|
|
202
|
+
if (!configuredSchemas.params || isCraftException(value)) {
|
|
203
|
+
return sanitizeParamsResult(value);
|
|
204
|
+
}
|
|
205
|
+
const parsed = schemaValidation.params.parseSync(value, 'params', 'params');
|
|
206
|
+
return parsed.accepted ? parsed.value : undefined;
|
|
207
|
+
})
|
|
208
|
+
: undefined;
|
|
209
|
+
const wrappedLoader = 'loader' in AsyncProcessConfig && AsyncProcessConfig.loader
|
|
210
|
+
? (async (param) => {
|
|
211
|
+
const injector = getInjector();
|
|
212
|
+
const correlationSvc = injector.get(CORRELATION_ID_SERVICE, null);
|
|
213
|
+
const operationId = correlationSvc?.lastCorrelationId() ?? null;
|
|
214
|
+
if (operationId)
|
|
215
|
+
correlationSvc?.startOperation(operationId);
|
|
216
|
+
// Unwrap the method-trigger nonce so the user loader and identifier logic
|
|
217
|
+
// only ever see plain params (no-op for source / params-fn / byId modes).
|
|
218
|
+
const rawParams = unwrapMethodParams(param.params);
|
|
219
|
+
const loaderParam = { ...param, params: rawParams };
|
|
220
|
+
try {
|
|
221
|
+
const step = await executeGeneratorCompatibleFactoryAsync({
|
|
222
|
+
factory: AsyncProcessConfig.loader,
|
|
223
|
+
thisArg: undefined,
|
|
224
|
+
getInjector,
|
|
225
|
+
args: [loaderParam],
|
|
226
|
+
invalidYieldErrorMessage: ASYNC_PROCESS_INVALID_YIELD_ERROR_MESSAGE,
|
|
227
|
+
appStartNotSupportedErrorMessage: ASYNC_PROCESS_APP_START_ERROR_MESSAGE,
|
|
228
|
+
});
|
|
229
|
+
if (step.kind === 'shortCircuit') {
|
|
230
|
+
const exceptionId = getIdentifierFromParams(rawParams);
|
|
231
|
+
setLoaderException(enrichResourceException(step.exception, {
|
|
232
|
+
scope: 'loader',
|
|
233
|
+
identifier: exceptionId,
|
|
234
|
+
}), exceptionId);
|
|
235
|
+
return undefined;
|
|
236
|
+
}
|
|
237
|
+
const result = step.value;
|
|
238
|
+
if (isCraftException(result)) {
|
|
239
|
+
const exceptionId = getIdentifierFromParams(rawParams);
|
|
240
|
+
setLoaderException(enrichResourceException(result, {
|
|
241
|
+
scope: 'loader',
|
|
242
|
+
identifier: exceptionId,
|
|
243
|
+
}), exceptionId);
|
|
244
|
+
return undefined;
|
|
245
|
+
}
|
|
246
|
+
let validatedResult = result;
|
|
247
|
+
if (configuredSchemas.loader) {
|
|
248
|
+
const parsed = await schemaValidation.loader.parseAsync(result, 'loader', 'loader', getIdentifierFromParams(rawParams));
|
|
249
|
+
if (!parsed.accepted) {
|
|
250
|
+
const exceptionId = getIdentifierFromParams(rawParams);
|
|
251
|
+
setLoaderException(enrichResourceException(parsed.exception, {
|
|
252
|
+
scope: 'loader',
|
|
253
|
+
identifier: exceptionId,
|
|
254
|
+
}), exceptionId);
|
|
255
|
+
return undefined;
|
|
256
|
+
}
|
|
257
|
+
validatedResult = parsed.value;
|
|
258
|
+
}
|
|
259
|
+
const successId = getIdentifierFromParams(rawParams);
|
|
260
|
+
setLoaderException(undefined, successId);
|
|
261
|
+
return validatedResult;
|
|
262
|
+
}
|
|
263
|
+
catch (error) {
|
|
264
|
+
if (!isCraftException(error)) {
|
|
265
|
+
injector.get(TAKE_APP_SNAPSHOT, null)?.();
|
|
266
|
+
}
|
|
267
|
+
throw error;
|
|
268
|
+
}
|
|
269
|
+
finally {
|
|
270
|
+
if (operationId)
|
|
271
|
+
correlationSvc?.endOperation(operationId);
|
|
272
|
+
}
|
|
273
|
+
})
|
|
274
|
+
: undefined;
|
|
275
|
+
const wrappedStream = 'stream' in AsyncProcessConfig && AsyncProcessConfig.stream
|
|
276
|
+
? ((...args) => {
|
|
277
|
+
const result = executeGeneratorCompatibleFactory({
|
|
278
|
+
factory: AsyncProcessConfig.stream,
|
|
279
|
+
thisArg: undefined,
|
|
280
|
+
getInjector,
|
|
281
|
+
args,
|
|
282
|
+
invalidYieldErrorMessage: ASYNC_PROCESS_INVALID_YIELD_ERROR_MESSAGE,
|
|
283
|
+
multipleAppStartErrorMessage: ASYNC_PROCESS_APP_START_ERROR_MESSAGE,
|
|
284
|
+
onAppStartNotSupportedErrorMessage: ASYNC_PROCESS_APP_START_ERROR_MESSAGE,
|
|
285
|
+
});
|
|
286
|
+
const wrapStreamSignal = (streamSignal) => {
|
|
287
|
+
if (!configuredSchemas.loader || !isSignal(streamSignal)) {
|
|
288
|
+
return streamSignal;
|
|
289
|
+
}
|
|
290
|
+
let lastValue;
|
|
291
|
+
return computed(() => {
|
|
292
|
+
const streamItem = streamSignal();
|
|
293
|
+
if (streamItem &&
|
|
294
|
+
typeof streamItem === 'object' &&
|
|
295
|
+
'error' in streamItem) {
|
|
296
|
+
return streamItem;
|
|
297
|
+
}
|
|
298
|
+
const rawValue = streamItem &&
|
|
299
|
+
typeof streamItem === 'object' &&
|
|
300
|
+
'value' in streamItem
|
|
301
|
+
? streamItem.value
|
|
302
|
+
: streamItem;
|
|
303
|
+
const parsed = schemaValidation.loader.parseSync(rawValue, 'loader', 'stream');
|
|
304
|
+
if (!parsed.accepted) {
|
|
305
|
+
return lastValue === undefined
|
|
306
|
+
? undefined
|
|
307
|
+
: { value: lastValue };
|
|
308
|
+
}
|
|
309
|
+
lastValue = parsed.value;
|
|
310
|
+
return { value: lastValue };
|
|
311
|
+
});
|
|
312
|
+
};
|
|
313
|
+
if (result &&
|
|
314
|
+
typeof result.then === 'function') {
|
|
315
|
+
return Promise.resolve(result).then(wrapStreamSignal);
|
|
316
|
+
}
|
|
317
|
+
return wrapStreamSignal(result);
|
|
318
|
+
})
|
|
319
|
+
: undefined;
|
|
320
|
+
const resourceParamsSrc = isConnectedToSource
|
|
321
|
+
? wrappedSourceParams
|
|
322
|
+
: hasParamsFn
|
|
323
|
+
? wrappedParamsFn
|
|
324
|
+
: AsyncProcessResourceParamsFnSignal;
|
|
325
|
+
// Method-based, non-grouped: feed the resource a nonce-tagged request so every
|
|
326
|
+
// explicit call re-runs the loader (even for identical / `undefined` params),
|
|
327
|
+
// while `resourceParamsSrc` stays the raw signal for all public consumers.
|
|
328
|
+
const usesMethodParamsSignal = !isConnectedToSource && !hasParamsFn;
|
|
329
|
+
const methodTaggedParams = computed(() => {
|
|
330
|
+
const seq = methodTriggerSeq();
|
|
331
|
+
if (seq === 0)
|
|
332
|
+
return undefined; // idle until the first call
|
|
333
|
+
return wrapMethodParams(AsyncProcessResourceParamsFnSignal(), seq);
|
|
334
|
+
});
|
|
335
|
+
const asyncProcessResourceOptions = {
|
|
336
|
+
...AsyncProcessConfig,
|
|
337
|
+
params: usesMethodParamsSignal
|
|
338
|
+
? methodTaggedParams
|
|
339
|
+
: resourceParamsSrc,
|
|
340
|
+
equal: usesMethodParamsSignal
|
|
341
|
+
? methodParamsWrapperEqual(AsyncProcessConfig.equal)
|
|
342
|
+
: AsyncProcessConfig.equal,
|
|
343
|
+
loader: wrappedLoader,
|
|
344
|
+
stream: wrappedStream,
|
|
345
|
+
};
|
|
346
|
+
const resourceTarget = isUsingIdentifier
|
|
347
|
+
? resourceById({
|
|
348
|
+
...AsyncProcessConfig,
|
|
349
|
+
params: resourceParamsSrc,
|
|
350
|
+
loader: wrappedLoader,
|
|
351
|
+
stream: wrappedStream,
|
|
352
|
+
identifier: AsyncProcessConfig.identifier,
|
|
353
|
+
})
|
|
354
|
+
: AsyncProcessConfig.preservePreviousValue?.()
|
|
355
|
+
? preservedResource(asyncProcessResourceOptions)
|
|
356
|
+
: craftResource(asyncProcessResourceOptions);
|
|
357
|
+
if (configuredSchemas.loader) {
|
|
358
|
+
const target = resourceTarget;
|
|
359
|
+
const originalResourceSet = target.set.bind(target);
|
|
360
|
+
const originalResourceUpdate = target.update.bind(target);
|
|
361
|
+
target.set = (value) => {
|
|
362
|
+
const parsed = schemaValidation.loader.parseSync(value, 'loader', 'set');
|
|
363
|
+
if (parsed.accepted)
|
|
364
|
+
originalResourceSet(parsed.value);
|
|
365
|
+
};
|
|
366
|
+
target.update = (updateFn) => originalResourceUpdate((current) => {
|
|
367
|
+
const parsed = schemaValidation.loader.parseSync(updateFn(current), 'loader', 'update');
|
|
368
|
+
return parsed.accepted ? parsed.value : current;
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
runInInjectionContext(getInjector(), () => ɵobservePrimitiveResourceRuntimeContext(isUsingIdentifier
|
|
372
|
+
? ɵcreatePrimitiveResourceByIdRuntimeContext('asyncProcess', resourceTarget)
|
|
373
|
+
: ɵcreatePrimitiveResourceRuntimeContext('asyncProcess', resourceTarget), name));
|
|
374
|
+
// Capture the raw Angular status BEFORE `Object.assign` overrides
|
|
375
|
+
// `resourceTarget.status` with the craft computed (avoids a computation cycle).
|
|
376
|
+
const rawResourceStatus = resourceTarget.status;
|
|
377
|
+
const publicExceptions = hasConfiguredSchema
|
|
378
|
+
? computed(() => ({ ...exceptions(), parse: schemaParse() }))
|
|
379
|
+
: exceptions;
|
|
380
|
+
const asyncOutput = Object.assign(resourceTarget,
|
|
381
|
+
// byId is used to helps TS to correctly infer the resourceByGroup
|
|
382
|
+
isUsingIdentifier
|
|
383
|
+
? {
|
|
384
|
+
/**
|
|
385
|
+
* Only added to help TS inference (TS cannot infer ResourceByIdHandler without erasing the signal getter, () => ResourceByIdRef<...>) )
|
|
386
|
+
*/
|
|
387
|
+
_resourceById: resourceTarget,
|
|
388
|
+
select: (id) => {
|
|
389
|
+
const selectExceptions = createSelectExceptions(id);
|
|
390
|
+
const selectHasException = createSelectHasException(id);
|
|
391
|
+
return computed(() => {
|
|
392
|
+
const list = resourceTarget();
|
|
393
|
+
//@ts-expect-error GroupIdentifier & string is not recognized correctly
|
|
394
|
+
const resource = list[id];
|
|
395
|
+
if (!resource) {
|
|
396
|
+
return undefined;
|
|
397
|
+
}
|
|
398
|
+
const rawSelectStatus = resource.status;
|
|
399
|
+
const result = Object.assign(resource, {
|
|
400
|
+
status: computed(() => toCraftStatus(rawSelectStatus(), selectHasException())),
|
|
401
|
+
exception: computed(() => selectExceptions().list[0]),
|
|
402
|
+
hasException: selectHasException,
|
|
403
|
+
hasSchema: signal(hasConfiguredSchema),
|
|
404
|
+
exceptions: hasConfiguredSchema
|
|
405
|
+
? computed(() => ({
|
|
406
|
+
...selectExceptions(),
|
|
407
|
+
parse: schemaParse(),
|
|
408
|
+
}))
|
|
409
|
+
: selectExceptions,
|
|
410
|
+
});
|
|
411
|
+
attachCraftSettledValue(name, result);
|
|
412
|
+
return result;
|
|
413
|
+
})();
|
|
414
|
+
},
|
|
415
|
+
selectOrCreate: (id) => {
|
|
416
|
+
const selected = resourceTarget.addById(id);
|
|
417
|
+
const selectExceptions = createSelectExceptions(id);
|
|
418
|
+
const selectHasException = createSelectHasException(id);
|
|
419
|
+
const rawSelectStatus = selected.status;
|
|
420
|
+
const result = Object.assign(selected, {
|
|
421
|
+
status: computed(() => toCraftStatus(rawSelectStatus(), selectHasException())),
|
|
422
|
+
exception: computed(() => selectExceptions().list[0]),
|
|
423
|
+
hasException: selectHasException,
|
|
424
|
+
hasSchema: signal(hasConfiguredSchema),
|
|
425
|
+
exceptions: hasConfiguredSchema
|
|
426
|
+
? computed(() => ({
|
|
427
|
+
...selectExceptions(),
|
|
428
|
+
parse: schemaParse(),
|
|
429
|
+
}))
|
|
430
|
+
: selectExceptions,
|
|
431
|
+
});
|
|
432
|
+
attachCraftSettledValue(name, result);
|
|
433
|
+
return result;
|
|
434
|
+
},
|
|
435
|
+
}
|
|
436
|
+
: {}, {
|
|
437
|
+
...(isUsingIdentifier
|
|
438
|
+
? {}
|
|
439
|
+
: {
|
|
440
|
+
status: computed(() => toCraftStatus(rawResourceStatus(), hasException())),
|
|
441
|
+
exception: computed(() => exceptions().list[0]),
|
|
442
|
+
}),
|
|
443
|
+
hasException,
|
|
444
|
+
hasSchema: signal(hasConfiguredSchema),
|
|
445
|
+
exceptions: publicExceptions,
|
|
446
|
+
...(hasParamsFn
|
|
447
|
+
? { resourceParamsSrc }
|
|
448
|
+
: {
|
|
449
|
+
method: isSignal(AsyncProcessConfig.method)
|
|
450
|
+
? undefined
|
|
451
|
+
: (arg) => {
|
|
452
|
+
let methodArg = arg;
|
|
453
|
+
if (configuredSchemas.method) {
|
|
454
|
+
const parsedMethod = schemaValidation.method.parseSync(arg, 'method', 'method');
|
|
455
|
+
if (!parsedMethod.accepted) {
|
|
456
|
+
methodParamsException.set(enrichResourceException(parsedMethod.exception, {
|
|
457
|
+
scope: 'params',
|
|
458
|
+
}));
|
|
459
|
+
return yieldableInvocation(parsedMethod.exception);
|
|
460
|
+
}
|
|
461
|
+
methodArg = parsedMethod.value;
|
|
462
|
+
}
|
|
463
|
+
const result = executeGeneratorCompatibleFactory({
|
|
464
|
+
factory: AsyncProcessConfig.method,
|
|
465
|
+
thisArg: undefined,
|
|
466
|
+
getInjector,
|
|
467
|
+
args: [methodArg],
|
|
468
|
+
invalidYieldErrorMessage: ASYNC_PROCESS_INVALID_YIELD_ERROR_MESSAGE,
|
|
469
|
+
multipleAppStartErrorMessage: ASYNC_PROCESS_APP_START_ERROR_MESSAGE,
|
|
470
|
+
onAppStartNotSupportedErrorMessage: ASYNC_PROCESS_APP_START_ERROR_MESSAGE,
|
|
471
|
+
});
|
|
472
|
+
if (isCraftException(result)) {
|
|
473
|
+
methodParamsException.set(enrichResourceException(result, { scope: 'params' }));
|
|
474
|
+
return yieldableInvocation(result);
|
|
475
|
+
}
|
|
476
|
+
let paramsResult = result;
|
|
477
|
+
if (configuredSchemas.params) {
|
|
478
|
+
const parsedParams = schemaValidation.params.parseSync(result, 'params', 'method');
|
|
479
|
+
if (!parsedParams.accepted) {
|
|
480
|
+
methodParamsException.set(enrichResourceException(parsedParams.exception, {
|
|
481
|
+
scope: 'params',
|
|
482
|
+
}));
|
|
483
|
+
return yieldableInvocation(parsedParams.exception);
|
|
484
|
+
}
|
|
485
|
+
paramsResult = parsedParams.value;
|
|
486
|
+
}
|
|
487
|
+
if (methodParamsException()) {
|
|
488
|
+
methodParamsException.set(undefined);
|
|
489
|
+
}
|
|
490
|
+
if (isUsingIdentifier) {
|
|
491
|
+
const id = AsyncProcessConfig.identifier?.(arg);
|
|
492
|
+
resourceTarget.addById(id);
|
|
493
|
+
}
|
|
494
|
+
// These two signals form one method request. Publish them as
|
|
495
|
+
// one batch so the resource watch cannot start the loader
|
|
496
|
+
// once for the nonce and once again for the params.
|
|
497
|
+
craftBatch(() => {
|
|
498
|
+
methodTriggerSeq.update((n) => n + 1);
|
|
499
|
+
AsyncProcessResourceParamsFnSignal.set(paramsResult);
|
|
500
|
+
});
|
|
501
|
+
return yieldableInvocation(paramsResult);
|
|
502
|
+
},
|
|
503
|
+
}),
|
|
504
|
+
});
|
|
505
|
+
if (!isUsingIdentifier) {
|
|
506
|
+
attachCraftSettledValue(name, asyncOutput);
|
|
507
|
+
}
|
|
508
|
+
const publicAsyncContext = createYieldableReactiveFacade(asyncOutput, {
|
|
509
|
+
name,
|
|
510
|
+
primitive: 'asyncProcess',
|
|
511
|
+
path: name,
|
|
512
|
+
});
|
|
513
|
+
const insertionSettledState = isUsingIdentifier
|
|
514
|
+
? createYieldableSettledValue(computed(() => {
|
|
515
|
+
const params = craftUse(publicAsyncContext.resourceParamsSrc());
|
|
516
|
+
if (params == null)
|
|
517
|
+
throw new CraftNotSettled(name);
|
|
518
|
+
const id = AsyncProcessConfig.identifier?.(params);
|
|
519
|
+
if (id == null)
|
|
520
|
+
throw new CraftNotSettled(name);
|
|
521
|
+
const selected = publicAsyncContext.select(id);
|
|
522
|
+
if (!selected)
|
|
523
|
+
throw new CraftNotSettled(name);
|
|
524
|
+
return craftUse(selected.settledValue());
|
|
525
|
+
}), {
|
|
526
|
+
primitive: 'asyncProcess',
|
|
527
|
+
insertion: 'settledState',
|
|
528
|
+
path: `${name}.settledState`,
|
|
529
|
+
})
|
|
530
|
+
: createYieldableSettledValue(computed(() => craftUse(publicAsyncContext.settledValue())), {
|
|
531
|
+
primitive: 'asyncProcess',
|
|
532
|
+
insertion: 'settledState',
|
|
533
|
+
path: `${name}.settledState`,
|
|
534
|
+
});
|
|
535
|
+
const insertionsResult = insertions?.reduce((acc, insert) => {
|
|
536
|
+
const rawResult = executeGeneratorCompatibleFactory({
|
|
537
|
+
factory: insert,
|
|
538
|
+
thisArg: undefined,
|
|
539
|
+
getInjector,
|
|
540
|
+
args: [
|
|
541
|
+
{
|
|
542
|
+
...(isUsingIdentifier
|
|
543
|
+
? {
|
|
544
|
+
resourceById: createYieldableReactiveFacade(resourceTarget, {
|
|
545
|
+
name: 'resourceById',
|
|
546
|
+
primitive: 'asyncProcess',
|
|
547
|
+
path: `${name}.resourceById`,
|
|
548
|
+
}),
|
|
549
|
+
}
|
|
550
|
+
: { resource: publicAsyncContext }),
|
|
551
|
+
resourceParamsSrc: createYieldableReactiveFacade(resourceParamsSrc, {
|
|
552
|
+
name: 'resourceParamsSrc',
|
|
553
|
+
primitive: 'asyncProcess',
|
|
554
|
+
path: `${name}.resourceParamsSrc`,
|
|
555
|
+
}),
|
|
556
|
+
hasException: publicAsyncContext.hasException,
|
|
557
|
+
exceptions: publicAsyncContext.exceptions,
|
|
558
|
+
insertions: acc,
|
|
559
|
+
state: createYieldableReactiveFacade(resourceTarget.state, {
|
|
560
|
+
name: 'state',
|
|
561
|
+
primitive: 'asyncProcess',
|
|
562
|
+
path: `${name}.state`,
|
|
563
|
+
}),
|
|
564
|
+
settledState: insertionSettledState,
|
|
565
|
+
set: (nextState) => yieldableInvocation(resourceTarget.set(nextState)),
|
|
566
|
+
update: (updateFn) => yieldableInvocation(resourceTarget.update(updateFn)),
|
|
567
|
+
patch: (patchFn) => yieldableInvocation(resourceTarget.update((current) => ({
|
|
568
|
+
...current,
|
|
569
|
+
...patchFn(current),
|
|
570
|
+
}))),
|
|
571
|
+
__primitiveKind: 'asyncProcess',
|
|
572
|
+
},
|
|
573
|
+
],
|
|
574
|
+
invalidYieldErrorMessage: ASYNC_PROCESS_INVALID_YIELD_ERROR_MESSAGE,
|
|
575
|
+
multipleAppStartErrorMessage: ASYNC_PROCESS_APP_START_ERROR_MESSAGE,
|
|
576
|
+
onAppStartNotSupportedErrorMessage: ASYNC_PROCESS_APP_START_ERROR_MESSAGE,
|
|
577
|
+
});
|
|
578
|
+
const wrappedResult = Object.entries(rawResult).reduce((wrappedAcc, [key, value]) => {
|
|
579
|
+
if (typeof value === 'function' &&
|
|
580
|
+
!isSignal(value) &&
|
|
581
|
+
!isYieldableReactiveValue(value) &&
|
|
582
|
+
!isNonYieldableInsertionMethod(value)) {
|
|
583
|
+
const injector = getInjector();
|
|
584
|
+
const methodInjector = ɵcreateHostTaggedInjector(injector, `method:${key}`, [
|
|
585
|
+
ɵprovidePrimitiveMethodRuntimeContext('asyncProcess', {
|
|
586
|
+
state: resourceTarget.state,
|
|
587
|
+
set: resourceTarget.set,
|
|
588
|
+
update: resourceTarget.update,
|
|
589
|
+
patch: (patchFn) => resourceTarget.update((current) => ({
|
|
590
|
+
...current,
|
|
591
|
+
...patchFn(current),
|
|
592
|
+
})),
|
|
593
|
+
}, value),
|
|
594
|
+
]);
|
|
595
|
+
const wrappedFn = runInInjectionContext(methodInjector, () => injectFnWrapper()(value));
|
|
596
|
+
wrappedAcc[key] = createYieldableInsertionMethod(wrappedFn, {
|
|
597
|
+
injector: methodInjector,
|
|
598
|
+
invalidYieldErrorMessage: ASYNC_PROCESS_INVALID_YIELD_ERROR_MESSAGE,
|
|
599
|
+
multipleAppStartErrorMessage: ASYNC_PROCESS_APP_START_ERROR_MESSAGE,
|
|
600
|
+
onAppStartNotSupportedErrorMessage: ASYNC_PROCESS_APP_START_ERROR_MESSAGE,
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
const namedValue = nameInsertedReactiveValue(value, key, 'asyncProcess', `${name}.${key}`);
|
|
605
|
+
wrappedAcc[key] = createYieldableReactiveFacade(namedValue, {
|
|
606
|
+
name: key,
|
|
607
|
+
primitive: 'asyncProcess',
|
|
608
|
+
insertion: key,
|
|
609
|
+
path: `${name}.${key}`,
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
return wrappedAcc;
|
|
613
|
+
}, {});
|
|
614
|
+
return { ...acc, ...wrappedResult };
|
|
615
|
+
}, {});
|
|
616
|
+
Object.assign(asyncOutput, insertionsResult);
|
|
617
|
+
const snapshotRegistry = injector
|
|
618
|
+
? injector.get(APP_SNAPSHOT_REGISTRY, null)
|
|
619
|
+
: (() => {
|
|
620
|
+
try {
|
|
621
|
+
return inject(APP_SNAPSHOT_REGISTRY, { optional: true });
|
|
622
|
+
}
|
|
623
|
+
catch {
|
|
624
|
+
return null;
|
|
625
|
+
}
|
|
626
|
+
})();
|
|
627
|
+
const hostTagList = injector
|
|
628
|
+
? (injector.get(ɵHOST_TAG_LIST, null) ?? [])
|
|
629
|
+
: (() => {
|
|
630
|
+
try {
|
|
631
|
+
return inject(ɵHOST_TAG_LIST, { optional: true }) ?? [];
|
|
632
|
+
}
|
|
633
|
+
catch {
|
|
634
|
+
return [];
|
|
635
|
+
}
|
|
636
|
+
})();
|
|
637
|
+
const destroyRefAsync = injector
|
|
638
|
+
? injector.get(DestroyRef, null)
|
|
639
|
+
: (() => {
|
|
640
|
+
try {
|
|
641
|
+
return inject(DestroyRef, { optional: true });
|
|
642
|
+
}
|
|
643
|
+
catch {
|
|
644
|
+
return null;
|
|
645
|
+
}
|
|
646
|
+
})();
|
|
647
|
+
if (snapshotRegistry && destroyRefAsync) {
|
|
648
|
+
snapshotRegistry.triggerSnapshot$
|
|
649
|
+
.pipe(takeUntilDestroyed(destroyRefAsync))
|
|
650
|
+
.subscribe(() => {
|
|
651
|
+
const insertionSnapshots = triggerAndCollectInsertions(insertionSnapshotRegistry);
|
|
652
|
+
let stateSnapshot;
|
|
653
|
+
try {
|
|
654
|
+
if (isUsingIdentifier) {
|
|
655
|
+
const byId = resourceTarget();
|
|
656
|
+
stateSnapshot = {
|
|
657
|
+
params: AsyncProcessResourceParamsFnSignal(),
|
|
658
|
+
resources: Object.entries(byId ?? {}).reduce((acc, [id, res]) => {
|
|
659
|
+
acc[id] = res?.state?.();
|
|
660
|
+
return acc;
|
|
661
|
+
}, {}),
|
|
662
|
+
...(insertionSnapshots ? { insertions: insertionSnapshots } : {}),
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
else {
|
|
666
|
+
const resourceState = asyncOutput.state();
|
|
667
|
+
stateSnapshot = {
|
|
668
|
+
params: AsyncProcessResourceParamsFnSignal(),
|
|
669
|
+
...resourceState,
|
|
670
|
+
...(insertionSnapshots ? { insertions: insertionSnapshots } : {}),
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
catch (error) {
|
|
675
|
+
stateSnapshot = {
|
|
676
|
+
error: error instanceof Error ? error.message : String(error),
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
snapshotRegistry.allSnapShot$.next({
|
|
680
|
+
source: 'asyncProcess',
|
|
681
|
+
from: hostTagList,
|
|
682
|
+
state: stateSnapshot,
|
|
683
|
+
});
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
if (!('resource' in asyncOutput)) {
|
|
687
|
+
Object.defineProperty(asyncOutput, 'resource', {
|
|
688
|
+
value: asyncOutput,
|
|
689
|
+
enumerable: false,
|
|
690
|
+
configurable: true,
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
const publicAsyncProcess = createYieldableReactiveFacade(asyncOutput, {
|
|
694
|
+
name,
|
|
695
|
+
primitive: 'asyncProcess',
|
|
696
|
+
path: name,
|
|
697
|
+
});
|
|
698
|
+
return (hasDeepYieldableInsertion(insertions)
|
|
699
|
+
? deepYieldable(publicAsyncProcess)
|
|
700
|
+
: publicAsyncProcess);
|
|
701
|
+
}
|
|
702
|
+
//# sourceMappingURL=async-process.js.map
|