@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,324 @@
|
|
|
1
|
+
import { assertInInjectionContext, computed, DestroyRef, inject, Injector, isSignal, runInInjectionContext, signal, } from './host/craft-compat';
|
|
2
|
+
import { takeUntilDestroyed } from './host/craft-compat';
|
|
3
|
+
import { isGenerator, runCraftGenerator } from './craft-generator-runtime';
|
|
4
|
+
import { injectFnWrapper } from './fn-wrapper';
|
|
5
|
+
import { craftException, isCraftException, } from './craft-exception';
|
|
6
|
+
import { ɵcreateHostTaggedInjector, ɵHOST_TAG_LIST } from './craft-service';
|
|
7
|
+
import { createNamedPrimitiveGen, } from './craft-primitive-gen';
|
|
8
|
+
import { APP_SNAPSHOT_REGISTRY, INSERTION_SNAPSHOT_REGISTRY, InsertionSnapshotRegistry, triggerAndCollectInsertions, } from './take-app-snapshot';
|
|
9
|
+
import { ɵprovidePrimitiveMethodRuntimeContext } from './primitive-method-runtime-context';
|
|
10
|
+
import { ɵcreatePrimitiveResourceRuntimeContext, ɵobservePrimitiveResourceRuntimeContext, } from './primitive-resource-runtime-context';
|
|
11
|
+
import { createYieldableInsertionMethod, isNonYieldableInsertionMethod, yieldableInvocation, } from './yieldable';
|
|
12
|
+
import { CRAFT_HISTORY, CRAFT_LOCATION } from './craft-router-tokens';
|
|
13
|
+
import { parseSearchParams, serializeSearchParams, } from './host/craft-router-runtime';
|
|
14
|
+
import { craftWatch } from './host/craft-signal';
|
|
15
|
+
import { createYieldableReactiveFacade, createYieldableReactiveValue, deepYieldable, hasDeepYieldableInsertion, isYieldableReactiveValue, nameInsertedReactiveValue, } from './reactive-read';
|
|
16
|
+
function enrichQueryParamsParseException(exception, key) {
|
|
17
|
+
return {
|
|
18
|
+
...exception,
|
|
19
|
+
scope: 'parse',
|
|
20
|
+
identifier: key,
|
|
21
|
+
[exception._tag]: exception.payload,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function createQueryParamDecodeError(key, value, error) {
|
|
25
|
+
return craftException({
|
|
26
|
+
_tag: 'QueryParamDecodeError',
|
|
27
|
+
scope: 'parse',
|
|
28
|
+
identifier: key,
|
|
29
|
+
}, { key, value, error });
|
|
30
|
+
}
|
|
31
|
+
function createQueryParamEncodeError(key, value, error) {
|
|
32
|
+
return craftException({
|
|
33
|
+
_tag: 'QueryParamEncodeError',
|
|
34
|
+
scope: 'serialize',
|
|
35
|
+
}, { key, value, error });
|
|
36
|
+
}
|
|
37
|
+
const QUERY_PARAM_INVALID_YIELD_ERROR_MESSAGE = 'queryParams generators can only yield craftService dependencies or exposed dependency helpers.';
|
|
38
|
+
const QUERY_PARAM_APP_START_ERROR_MESSAGE = 'queryParams generators do not support onAppStart(...).';
|
|
39
|
+
function executeQueryParamsFactory(injector, factory, thisArg, ...args) {
|
|
40
|
+
return runInInjectionContext(injector, () => {
|
|
41
|
+
const result = factory.apply(thisArg, args);
|
|
42
|
+
if (!isGenerator(result)) {
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
return runCraftGenerator({
|
|
46
|
+
iterator: result,
|
|
47
|
+
injector,
|
|
48
|
+
hostScope: 'function',
|
|
49
|
+
invalidYieldErrorMessage: QUERY_PARAM_INVALID_YIELD_ERROR_MESSAGE,
|
|
50
|
+
multipleAppStartErrorMessage: QUERY_PARAM_APP_START_ERROR_MESSAGE,
|
|
51
|
+
onAppStartNotSupportedErrorMessage: QUERY_PARAM_APP_START_ERROR_MESSAGE,
|
|
52
|
+
}).value;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
export function queryParams(name,
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
+
config,
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
+
...insertions
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
61
|
+
) {
|
|
62
|
+
return createNamedPrimitiveGen(name, createQueryParamsRef(name, config, ...insertions));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* If it is not called in an injection context, it returns the config under _config.
|
|
67
|
+
*/
|
|
68
|
+
function createQueryParamsRef(name, config, ...insertions) {
|
|
69
|
+
try {
|
|
70
|
+
assertInInjectionContext(queryParams);
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
return {
|
|
74
|
+
_config: config,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const insertionSnapshotRegistry = new InsertionSnapshotRegistry();
|
|
78
|
+
const injector = ɵcreateHostTaggedInjector(inject(Injector), `queryParams:${name}`, [
|
|
79
|
+
{
|
|
80
|
+
provide: INSERTION_SNAPSHOT_REGISTRY,
|
|
81
|
+
useValue: insertionSnapshotRegistry,
|
|
82
|
+
},
|
|
83
|
+
]);
|
|
84
|
+
const history = inject(CRAFT_HISTORY);
|
|
85
|
+
const location = inject(CRAFT_LOCATION);
|
|
86
|
+
const { state: queryParamsConfig, ...options } = config;
|
|
87
|
+
const decodeQueryParamsState = (rawParams) => Object.entries(queryParamsConfig).reduce((acc, [key, config]) => {
|
|
88
|
+
const rawValue = rawParams[key];
|
|
89
|
+
if (rawValue === undefined || rawValue === null) {
|
|
90
|
+
acc[key] = config.fallbackValue;
|
|
91
|
+
return acc;
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
const decoded = config.codec.decode(rawValue);
|
|
95
|
+
acc[key] = isCraftException(decoded) ? config.fallbackValue : decoded;
|
|
96
|
+
return acc;
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
acc[key] = config.fallbackValue;
|
|
100
|
+
return acc;
|
|
101
|
+
}
|
|
102
|
+
}, {});
|
|
103
|
+
// URL state is updated by the router watch; the public state is a separate
|
|
104
|
+
// writable Craft signal so a local set is visible synchronously and is not
|
|
105
|
+
// accidentally reset by a new object returned while parsing the URL.
|
|
106
|
+
const queryParamsFromUrl = signal(parseSearchParams(location().search));
|
|
107
|
+
const queryParamsState = signal(decodeQueryParamsState(queryParamsFromUrl()));
|
|
108
|
+
const locationWatch = craftWatch(() => {
|
|
109
|
+
const rawParams = parseSearchParams(location().search);
|
|
110
|
+
queryParamsFromUrl.set(rawParams);
|
|
111
|
+
queryParamsState.set(decodeQueryParamsState(rawParams));
|
|
112
|
+
});
|
|
113
|
+
inject(DestroyRef).onDestroy(() => locationWatch.destroy());
|
|
114
|
+
const parseExceptions = computed(() => Object.entries(queryParamsConfig).reduce((acc, [key, config]) => {
|
|
115
|
+
const rawValue = queryParamsFromUrl()?.[key];
|
|
116
|
+
if (rawValue === undefined || rawValue === null) {
|
|
117
|
+
return acc;
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
const decoded = config.codec.decode(rawValue);
|
|
121
|
+
if (isCraftException(decoded)) {
|
|
122
|
+
acc[key] = enrichQueryParamsParseException(decoded, key);
|
|
123
|
+
}
|
|
124
|
+
return acc;
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
acc[key] = enrichQueryParamsParseException(createQueryParamDecodeError(key, rawValue, error), key);
|
|
128
|
+
return acc;
|
|
129
|
+
}
|
|
130
|
+
}, {}));
|
|
131
|
+
const exceptions = computed(() => {
|
|
132
|
+
const parse = parseExceptions();
|
|
133
|
+
return {
|
|
134
|
+
list: Object.values(parse),
|
|
135
|
+
parse,
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
const hasException = computed(() => exceptions().list.length > 0);
|
|
139
|
+
// Get initial values from the url or use the fallback values
|
|
140
|
+
const getDefaultState = () => Object.entries(queryParamsConfig).reduce((acc, [key, config]) => {
|
|
141
|
+
acc[key] = config.fallbackValue;
|
|
142
|
+
return acc;
|
|
143
|
+
}, {});
|
|
144
|
+
// Save the original set method before we override it
|
|
145
|
+
const originalSet = queryParamsState.set.bind(queryParamsState);
|
|
146
|
+
// Navigation helper
|
|
147
|
+
const navigate = (newState, navOptions) => {
|
|
148
|
+
// Only include params that differ from their fallback values (SEO optimization)
|
|
149
|
+
const serializedParams = Object.entries(queryParamsConfig).reduce((acc, [key, config]) => {
|
|
150
|
+
const currentValue = newState[key];
|
|
151
|
+
// Skip if value equals fallback value
|
|
152
|
+
if (currentValue !== config.fallbackValue) {
|
|
153
|
+
try {
|
|
154
|
+
const encoded = config.codec.encode(currentValue);
|
|
155
|
+
if (isCraftException(encoded)) {
|
|
156
|
+
throw createQueryParamEncodeError(key, currentValue, encoded);
|
|
157
|
+
}
|
|
158
|
+
acc[key] = encoded;
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
throw createQueryParamEncodeError(key, currentValue, error);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return acc;
|
|
165
|
+
}, {});
|
|
166
|
+
// Update the local state only after all codecs have encoded successfully.
|
|
167
|
+
originalSet(newState);
|
|
168
|
+
const mergedOptions = { ...options, ...navOptions };
|
|
169
|
+
queueMicrotask(() => {
|
|
170
|
+
const current = history.get();
|
|
171
|
+
let nextParams = serializedParams;
|
|
172
|
+
if (mergedOptions.queryParamsHandling === 'preserve') {
|
|
173
|
+
nextParams = parseSearchParams(current.search);
|
|
174
|
+
}
|
|
175
|
+
else if (mergedOptions.queryParamsHandling === 'merge') {
|
|
176
|
+
nextParams = {
|
|
177
|
+
...parseSearchParams(current.search),
|
|
178
|
+
...nextParams,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
const search = serializeSearchParams(nextParams);
|
|
182
|
+
const url = `${current.pathname}${search}${mergedOptions.preserveFragment === false ? '' : current.hash}`;
|
|
183
|
+
if (mergedOptions.skipLocationChange) {
|
|
184
|
+
history.skip(url, null);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (mergedOptions.replaceUrl) {
|
|
188
|
+
history.replace(url);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
history.push(url);
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
// Create individual property signals
|
|
195
|
+
const props = Object.entries(queryParamsConfig).reduce((acc, [key, config]) => {
|
|
196
|
+
acc[key] = computed(() => queryParamsState()[key]);
|
|
197
|
+
return acc;
|
|
198
|
+
}, {});
|
|
199
|
+
// Create methods
|
|
200
|
+
const methods = {
|
|
201
|
+
set: (params, navOptions) => {
|
|
202
|
+
navigate(params, navOptions);
|
|
203
|
+
return params;
|
|
204
|
+
},
|
|
205
|
+
update: (updateFn, navOptions) => {
|
|
206
|
+
const newState = updateFn(queryParamsState());
|
|
207
|
+
navigate(newState, navOptions);
|
|
208
|
+
return newState;
|
|
209
|
+
},
|
|
210
|
+
patch: (paramsOrPatchFn, navOptions) => {
|
|
211
|
+
const params = typeof paramsOrPatchFn === 'function'
|
|
212
|
+
? paramsOrPatchFn(queryParamsState())
|
|
213
|
+
: paramsOrPatchFn;
|
|
214
|
+
const newState = { ...queryParamsState(), ...params };
|
|
215
|
+
navigate(newState, navOptions);
|
|
216
|
+
return newState;
|
|
217
|
+
},
|
|
218
|
+
reset: (navOptions) => {
|
|
219
|
+
const defaultState = getDefaultState();
|
|
220
|
+
navigate(defaultState, navOptions);
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
const insertionMethods = {
|
|
224
|
+
set: (params, navOptions) => yieldableInvocation(methods.set(params, navOptions)),
|
|
225
|
+
update: (updateFn, navOptions) => yieldableInvocation(methods.update(updateFn, navOptions)),
|
|
226
|
+
patch: (paramsOrPatchFn, navOptions) => yieldableInvocation(methods.patch(paramsOrPatchFn, navOptions)),
|
|
227
|
+
reset: (navOptions) => yieldableInvocation(methods.reset(navOptions)),
|
|
228
|
+
};
|
|
229
|
+
runInInjectionContext(injector, () => ɵobservePrimitiveResourceRuntimeContext(ɵcreatePrimitiveResourceRuntimeContext('queryParams', {
|
|
230
|
+
state: queryParamsState.asReadonly(),
|
|
231
|
+
set: (value) => methods.set(value),
|
|
232
|
+
update: (updater) => methods.update((current) => updater(current)),
|
|
233
|
+
}), name));
|
|
234
|
+
// Process insertions
|
|
235
|
+
const readonlyQueryParamsState = queryParamsState.asReadonly();
|
|
236
|
+
const publicStateReader = createYieldableReactiveValue(readonlyQueryParamsState, 'state', { primitive: 'queryParams', path: `${name}.state` });
|
|
237
|
+
const publicHasException = createYieldableReactiveValue(hasException, 'hasException', { primitive: 'queryParams', path: `${name}.hasException` });
|
|
238
|
+
const publicExceptions = createYieldableReactiveValue(exceptions, 'exceptions', { primitive: 'queryParams', path: `${name}.exceptions` });
|
|
239
|
+
const insertionResults = insertions?.reduce((acc, insert) => {
|
|
240
|
+
const newInsertions = executeQueryParamsFactory(injector, insert, undefined, {
|
|
241
|
+
state: publicStateReader,
|
|
242
|
+
config: queryParamsConfig,
|
|
243
|
+
hasException: publicHasException,
|
|
244
|
+
exceptions: publicExceptions,
|
|
245
|
+
...insertionMethods,
|
|
246
|
+
insertions: acc,
|
|
247
|
+
});
|
|
248
|
+
const wrappedInsertions = Object.entries(newInsertions).reduce((wrappedAcc, [key, value]) => {
|
|
249
|
+
if (typeof value !== 'function' ||
|
|
250
|
+
isSignal(value) ||
|
|
251
|
+
isNonYieldableInsertionMethod(value)) {
|
|
252
|
+
wrappedAcc[key] = nameInsertedReactiveValue(value, key, 'queryParams', `${name}.${key}`);
|
|
253
|
+
return wrappedAcc;
|
|
254
|
+
}
|
|
255
|
+
if (isYieldableReactiveValue(value)) {
|
|
256
|
+
wrappedAcc[key] = nameInsertedReactiveValue(value, key, 'queryParams', `${name}.${key}`);
|
|
257
|
+
return wrappedAcc;
|
|
258
|
+
}
|
|
259
|
+
const methodInjector = ɵcreateHostTaggedInjector(injector, `method:${key}`, [
|
|
260
|
+
ɵprovidePrimitiveMethodRuntimeContext('queryParams', {
|
|
261
|
+
state: queryParamsState.asReadonly(),
|
|
262
|
+
set: (next) => methods.set(next),
|
|
263
|
+
update: (updater) => methods.update((current) => updater(current)),
|
|
264
|
+
patch: (patchFn) => methods.patch((current) => patchFn(current)),
|
|
265
|
+
}, value),
|
|
266
|
+
]);
|
|
267
|
+
const wrappedFn = runInInjectionContext(methodInjector, () => injectFnWrapper()(value));
|
|
268
|
+
wrappedAcc[key] = createYieldableInsertionMethod(wrappedFn, {
|
|
269
|
+
injector: methodInjector,
|
|
270
|
+
invalidYieldErrorMessage: QUERY_PARAM_INVALID_YIELD_ERROR_MESSAGE,
|
|
271
|
+
multipleAppStartErrorMessage: QUERY_PARAM_APP_START_ERROR_MESSAGE,
|
|
272
|
+
onAppStartNotSupportedErrorMessage: QUERY_PARAM_APP_START_ERROR_MESSAGE,
|
|
273
|
+
});
|
|
274
|
+
return wrappedAcc;
|
|
275
|
+
}, {});
|
|
276
|
+
return {
|
|
277
|
+
...acc,
|
|
278
|
+
...wrappedInsertions,
|
|
279
|
+
};
|
|
280
|
+
}, {}) || {};
|
|
281
|
+
const queryParamsCallable = readonlyQueryParamsState;
|
|
282
|
+
Object.defineProperty(queryParamsCallable, 'name', {
|
|
283
|
+
configurable: true,
|
|
284
|
+
writable: true,
|
|
285
|
+
value: undefined,
|
|
286
|
+
});
|
|
287
|
+
const queryParamsOutput = Object.assign(queryParamsCallable, props, insertionResults, { hasException, exceptions, _config: config });
|
|
288
|
+
const snapshotRegistry = injector.get(APP_SNAPSHOT_REGISTRY, null);
|
|
289
|
+
const hostTagList = injector.get(ɵHOST_TAG_LIST, null) ?? [];
|
|
290
|
+
const destroyRefParam = injector.get(DestroyRef, null);
|
|
291
|
+
if (snapshotRegistry && destroyRefParam) {
|
|
292
|
+
snapshotRegistry.triggerSnapshot$
|
|
293
|
+
.pipe(takeUntilDestroyed(destroyRefParam))
|
|
294
|
+
.subscribe(() => {
|
|
295
|
+
const insertionSnapshots = triggerAndCollectInsertions(insertionSnapshotRegistry);
|
|
296
|
+
let stateSnapshot;
|
|
297
|
+
try {
|
|
298
|
+
stateSnapshot = {
|
|
299
|
+
value: queryParamsState(),
|
|
300
|
+
...(insertionSnapshots ? { insertions: insertionSnapshots } : {}),
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
catch (error) {
|
|
304
|
+
stateSnapshot = {
|
|
305
|
+
error: error instanceof Error ? error.message : String(error),
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
snapshotRegistry.allSnapShot$.next({
|
|
309
|
+
source: 'queryParams',
|
|
310
|
+
from: hostTagList,
|
|
311
|
+
state: stateSnapshot,
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
const publicQueryParams = createYieldableReactiveFacade(queryParamsOutput, {
|
|
316
|
+
name,
|
|
317
|
+
primitive: 'queryParams',
|
|
318
|
+
path: name,
|
|
319
|
+
});
|
|
320
|
+
return (hasDeepYieldableInsertion(insertions)
|
|
321
|
+
? deepYieldable(publicQueryParams)
|
|
322
|
+
: publicQueryParams);
|
|
323
|
+
}
|
|
324
|
+
//# sourceMappingURL=query-params.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-params.js","sourceRoot":"","sources":["../../../../../libs/core/src/lib/query-params.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,QAAQ,EACR,UAAU,EACV,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,qBAAqB,EAErB,MAAM,GAEP,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AASzD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAEL,cAAc,EACd,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EACL,u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iBAC9D,CAAC;YACJ,CAAC;YACD,gBAAgB,CAAC,YAAY,CAAC,IAAI,CAAC;gBACjC,MAAM,EAAE,aAAa;gBACrB,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,aAAa;aACrB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM,iBAAiB,GAAG,6BAA6B,CAAC,iBAAiB,EAAE;QACzE,IAAI;QACJ,SAAS,EAAE,aAAa;QACxB,IAAI,EAAE,IAAI;KACX,CAAC,CAAC;IACH,OAAO,CAAC,yBAAyB,CAAC,UAAU,CAAC;QAC3C,CAAC,CAAC,aAAa,CAAC,iBAAiB,CAAC;QAClC,CAAC,CAAC,iBAAiB,CAA6D,CAAC;AACrF,CAAC","sourcesContent":["import {\n assertInInjectionContext,\n computed,\n DestroyRef,\n inject,\n Injector,\n isSignal,\n runInInjectionContext,\n Signal,\n signal,\n WritableSignal,\n} from './host/craft-compat';\nimport { takeUntilDestroyed } from './host/craft-compat';\nimport {\n InsertionsQueryParamsFactory,\n InsertionQueryParamsFactoryContext,\n QueryParamsMethods,\n} from './query.core';\nimport { MergeObjects } from './util/types/util.type';\nimport { FilterSource, IsEmptyObject } from './util/util.type';\nimport { Prettify } from './util/util.type';\nimport { isGenerator, runCraftGenerator } from './craft-generator-runtime';\nimport { injectFnWrapper } from './fn-wrapper';\nimport {\n AnyCraftException,\n craftException,\n isCraftException,\n} from './craft-exception';\nimport { ɵcreateHostTaggedInjector, ɵHOST_TAG_LIST } from './craft-service';\nimport {\n createNamedPrimitiveGen,\n type CraftPrimitiveGen,\n type NamedCraftPrimitiveGen,\n} from './craft-primitive-gen';\nimport type {\n SERVICE_HELPER_DEPENDENCIES,\n ServiceDependencyMapFromYieldedAndValues,\n} from './craft-service';\nimport {\n APP_SNAPSHOT_REGISTRY,\n INSERTION_SNAPSHOT_REGISTRY,\n InsertionSnapshotRegistry,\n triggerAndCollectInsertions,\n} from './take-app-snapshot';\nimport { ɵprovidePrimitiveMethodRuntimeContext } from './primitive-method-runtime-context';\nimport {\n ɵcreatePrimitiveResourceRuntimeContext,\n ɵobservePrimitiveResourceRuntimeContext,\n} from './primitive-resource-runtime-context';\nimport {\n createYieldableInsertionMethod,\n isNonYieldableInsertionMethod,\n yieldableInvocation,\n} from './yieldable';\nimport { CRAFT_HISTORY, CRAFT_LOCATION } from './craft-router-tokens';\nimport {\n parseSearchParams,\n serializeSearchParams,\n} from './host/craft-router-runtime';\nimport { craftWatch } from './host/craft-signal';\nimport {\n createYieldableReactiveFacade,\n createYieldableReactiveValue,\n deepYieldable,\n hasDeepYieldableInsertion,\n isYieldableReactiveValue,\n nameInsertedReactiveValue,\n type YieldableReactiveProperties,\n type YieldableReactiveValue,\n} from './reactive-read';\nimport type { YieldableInsertionMethods } from './yieldable';\n\nexport interface QueryParamsNavigationOptions {\n queryParamsHandling?: 'merge' | 'preserve' | '';\n onSameUrlNavigation?: 'reload' | 'ignore';\n replaceUrl?: boolean;\n skipLocationChange?: boolean;\n preserveFragment?: boolean;\n}\n\ntype ResolveGeneratorResult<Result> =\n Result extends Generator<any, infer Output, unknown> ? Output : Result;\n\ntype QueryParamsTrackedDependencies<\n QueryParamsType,\n InsertionsYielded = never,\n Insertions = never,\n> = ServiceDependencyMapFromYieldedAndValues<InsertionsYielded, Insertions>;\n\ntype AnyQueryParamsConfig = {\n codec: QueryParamsCodec<any, any>;\n fallbackValue: any;\n};\n\nexport type QueryParamsToState<QueryParamsConfigs> = {\n [K in keyof QueryParamsConfigs]: QueryParamsConfigs[K] extends {\n codec: { decode: (input: any) => infer Decoded };\n }\n ? Exclude<Decoded, AnyCraftException>\n : never;\n};\n\nexport type QueryParamDecodeErrorPayload = {\n key: string;\n value: unknown;\n error: unknown;\n};\n\nexport type QueryParamDecodeError<Key extends string = string> =\n import('./craft-exception').CraftExceptionResult<\n {\n _tag: 'QueryParamDecodeError';\n scope: 'parse';\n identifier: Key;\n },\n QueryParamDecodeErrorPayload & { key: Key }\n >;\n\nexport type QueryParamEncodeErrorPayload = {\n key: string;\n value: unknown;\n error: unknown;\n};\n\nexport type QueryParamEncodeError =\n import('./craft-exception').CraftExceptionResult<\n {\n _tag: 'QueryParamEncodeError';\n scope: 'serialize';\n },\n QueryParamEncodeErrorPayload\n >;\n\ntype QueryParamsParseExceptionsByKey<QueryParamsType> =\n QueryParamsType extends Record<string, AnyQueryParamsConfig>\n ? {\n [K in keyof QueryParamsType]: QueryParamDecodeError<K & string>;\n }\n : Record<string, never>;\n\ntype QueryParamsParseExceptionUnion<QueryParamsType> =\n QueryParamsParseExceptionsByKey<QueryParamsType>[keyof QueryParamsParseExceptionsByKey<QueryParamsType>];\n\nexport type QueryParamsExceptions<QueryParamsType> = {\n list: QueryParamsParseExceptionUnion<QueryParamsType>[];\n parse: Partial<QueryParamsParseExceptionsByKey<QueryParamsType>>;\n};\n\nexport type QueryParamsOutput<\n QueryParamsType,\n Insertions,\n QueryParamsState,\n Dependencies = QueryParamsTrackedDependencies<QueryParamsType>,\n> = YieldableReactiveValue<QueryParamsState> &\n YieldableReactiveProperties<\n MergeObjects<\n [\n {\n [K in keyof QueryParamsState]: Signal<QueryParamsState[K]>;\n },\n IsEmptyObject<Insertions> extends true\n ? {}\n : YieldableInsertionMethods<FilterSource<Insertions>>,\n {\n hasException: Signal<boolean>;\n exceptions: Signal<QueryParamsExceptions<QueryParamsType>>;\n },\n {\n _config: QueryParamsType;\n readonly [SERVICE_HELPER_DEPENDENCIES]?: Dependencies;\n },\n ]\n >\n >;\n\nfunction enrichQueryParamsParseException(\n exception: AnyCraftException,\n key: string,\n): AnyCraftException {\n return {\n ...exception,\n scope: 'parse',\n identifier: key,\n [exception._tag]: exception.payload,\n };\n}\n\nfunction createQueryParamDecodeError(\n key: string,\n value: unknown,\n error: unknown,\n): AnyCraftException {\n return craftException(\n {\n _tag: 'QueryParamDecodeError',\n scope: 'parse',\n identifier: key,\n },\n { key, value, error },\n );\n}\n\nfunction createQueryParamEncodeError(\n key: string,\n value: unknown,\n error: unknown,\n): AnyCraftException {\n return craftException(\n {\n _tag: 'QueryParamEncodeError',\n scope: 'serialize',\n },\n { key, value, error },\n );\n}\n\nconst QUERY_PARAM_INVALID_YIELD_ERROR_MESSAGE =\n 'queryParams generators can only yield craftService dependencies or exposed dependency helpers.';\nconst QUERY_PARAM_APP_START_ERROR_MESSAGE =\n 'queryParams generators do not support onAppStart(...).';\n\nfunction executeQueryParamsFactory<This, Args extends unknown[], Result>(\n injector: Injector,\n factory: (this: This, ...args: Args) => Result,\n thisArg: This,\n ...args: Args\n): ResolveGeneratorResult<Result> {\n return runInInjectionContext(injector, () => {\n const result = factory.apply(thisArg, args);\n\n if (!isGenerator(result)) {\n return result as ResolveGeneratorResult<Result>;\n }\n\n return runCraftGenerator({\n iterator: result,\n injector,\n hostScope: 'function',\n invalidYieldErrorMessage: QUERY_PARAM_INVALID_YIELD_ERROR_MESSAGE,\n multipleAppStartErrorMessage: QUERY_PARAM_APP_START_ERROR_MESSAGE,\n onAppStartNotSupportedErrorMessage: QUERY_PARAM_APP_START_ERROR_MESSAGE,\n }).value as ResolveGeneratorResult<Result>;\n });\n}\n\nexport interface QueryParamsCodecConfig<\n T = unknown,\n Encoded = unknown,\n Codec extends QueryParamsCodec<Encoded, T> = QueryParamsCodec<Encoded, T>,\n> {\n codec: Codec;\n fallbackValue: NoInfer<T>;\n}\n\ntype QueryParamsCodec<Encoded, Decoded> = {\n decode(input: Encoded): Decoded | AnyCraftException;\n encode(value: Decoded): Encoded | AnyCraftException;\n};\n\nexport type QueryParamsConfig<\n T = unknown,\n Encoded = unknown,\n> = QueryParamsCodecConfig<T, Encoded>;\n\n/**\n * Creates a reactive query parameter manager that synchronizes state with URL query parameters.\n *\n * This function manages query parameter state by:\n * - Reading initial values from the URL or using default values\n * - Decoding URL values into typed values using the provided `codec`\n * - Encoding typed values back to URL values using the provided `codec`\n * - Providing reactive signals for each query parameter\n *\n * @remarks\n * **Important:** This function must be called within an injection context.\n * If called outside an injection context, it will only return an object containing the configuration under `_config`.\n *\n * @param name - The query params manager name. Used to key the returned record\n * (`const pagination = yield* queryParams('pagination', config)`) and as the\n * injector host tag (`queryParams:pagination`), so the primitive is precisely\n * locatable in snapshots and logs.\n * @param config - Configuration object containing:\n * - `state`: Record of query parameter configurations, each with `fallbackValue` and `codec`\n * - `queryParamsHandling` (optional): How to handle existing query params ('merge' | 'preserve' | '')\n * - `onSameUrlNavigation` (optional): Behavior on same URL navigation ('reload' | 'ignore')\n * - `replaceUrl` (optional): Whether to replace the URL in browser history\n * - `skipLocationChange` (optional): Whether to skip updating the browser's location\n * @param insertion1 - Optional single insertion factory to add custom methods, computed values or side effects to the query param manager.\n * The insertion receives a context with `state`, `config`, `set`, `update`, `patch` and `reset`.\n * To attach several insertions, compose them with `insertQueryParamsPipe`:\n * `queryParams('name', config, insertQueryParamsPipe(insertion1, insertion2))` —\n * each member then also sees the previous members' outputs on `context.insertions`.\n * Methods bound to a source using `afterRecomputation` (effectRef-like) are not exposed in the output.\n * @returns A single-use primitive generator resolving to a signal returning\n * the current query parameter state,\n * extended with:\n * - Individual signals for each query parameter (e.g., `pagination.page()`)\n * - Custom methods from insertions (excluding methods bound to sources)\n * - `_config`: The original configuration\n *\n * Consume it with `yield*` inside a generator host (craftService factory,\n * craftGen, …).\n *\n * @example\n * Basic usage\n * ```ts\n * const myQueryParams = yield* queryParams(\n * 'myQueryParams',\n * {\n * state: {\n * page: {\n * fallbackValue: 1,\n * codec: {\n * decode: (value) => parseInt(value, 10),\n * encode: (value) => String(value),\n * },\n * },\n * pageSize: {\n * fallbackValue: 10,\n * codec: {\n * decode: (value) => parseInt(value, 10),\n * encode: (value) => String(value),\n * },\n * },\n * },\n * },\n * ({ set, update, patch, reset }) => ({ set, update, patch, reset })\n * );\n *\n * // Access state\n * console.log(yield* myQueryParams()); // { page: 1, pageSize: 10 }\n * console.log(yield* myQueryParams.page()); // 1\n *\n * // Update state (also updates URL)\n * yield* myQueryParams.set({ page: 2, pageSize: 20 });\n * yield* myQueryParams.update(current => ({ ...current, page: current.page + 1 }));\n * yield* myQueryParams.patch({ pageSize: 50 });\n * yield* myQueryParams.reset();\n * ```\n *\n * @example\n * With custom methods via insertions\n * ```ts\n * const myQueryParams = yield* queryParams(\n * 'myQueryParams',\n * {\n * state: {\n * page: {\n * fallbackValue: 1,\n * codec: { decode: parseInt, encode: String },\n * },\n * },\n * },\n * ({ state, patch }) => ({\n * goTo: function* (newPage: number) {\n * const current = yield* state();\n * return yield* patch({ ...current, page: newPage });\n * },\n * })\n * );\n *\n * yield* myQueryParams.goTo(5); // Custom method from insertion\n * ```\n *\n * @example\n * Parse exceptions with `craftException`\n * ```ts\n * import { craftException, queryParams } from '@craft-ts/core';\n *\n * const mode = yield* queryParams('mode', {\n * state: {\n * mode: {\n * fallbackValue: 'success' as const,\n * codec: {\n * decode: (value: string) => {\n * if (value !== 'success') {\n * throw new Error(`Invalid mode: ${value}`);\n * }\n * return 'success' as const;\n * },\n * encode: (value) => String(value),\n * },\n * },\n * },\n * });\n *\n * console.log(yield* mode.mode()); // fallbackValue when parse exception occurs\n * console.log(yield* mode.hasException()); // true/false\n * console.log((yield* mode.exceptions()).parse.mode?.INVALID_MODE_FROM_URL);\n * ```\n */\nexport function queryParams<\n Name extends string,\n QueryParamsType extends Record<string, AnyQueryParamsConfig>,\n QueryParamsState = Prettify<QueryParamsToState<QueryParamsType>>,\n>(\n name: Name,\n config: { state: QueryParamsType } & QueryParamsNavigationOptions,\n): NamedCraftPrimitiveGen<\n Name,\n QueryParamsOutput<QueryParamsType, {}, QueryParamsState>\n>;\nexport function queryParams<\n Name extends string,\n QueryParamsType extends Record<string, AnyQueryParamsConfig>,\n Insertion1,\n Insertion1Yielded = never,\n QueryParamsState = Prettify<QueryParamsToState<QueryParamsType>>,\n>(\n name: Name,\n config: { state: QueryParamsType } & QueryParamsNavigationOptions,\n insertion1: InsertionsQueryParamsFactory<\n NoInfer<QueryParamsType>,\n Insertion1,\n {},\n Insertion1Yielded\n >,\n): NamedCraftPrimitiveGen<\n Name,\n QueryParamsOutput<\n QueryParamsType,\n Insertion1,\n QueryParamsState,\n QueryParamsTrackedDependencies<\n QueryParamsType,\n Insertion1Yielded,\n Insertion1\n >\n >\n>;\n\nexport function queryParams(\n name: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n config: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...insertions: any[]\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n return createNamedPrimitiveGen(\n name,\n createQueryParamsRef(name, config, ...insertions),\n );\n}\n\n/**\n *\n * If it is not called in an injection context, it returns the config under _config.\n */\nfunction createQueryParamsRef<\n QueryParamsType extends Record<string, AnyQueryParamsConfig>,\n QueryParamsState = Prettify<QueryParamsToState<QueryParamsType>>,\n>(\n name: string,\n config: { state: QueryParamsType } & QueryParamsNavigationOptions,\n ...insertions: any[]\n): QueryParamsOutput<QueryParamsType, {}, QueryParamsState> {\n try {\n assertInInjectionContext(queryParams);\n } catch (e) {\n return {\n _config: config,\n } as any;\n }\n\n const insertionSnapshotRegistry = new InsertionSnapshotRegistry();\n const injector = ɵcreateHostTaggedInjector(\n inject(Injector),\n `queryParams:${name}`,\n [\n {\n provide: INSERTION_SNAPSHOT_REGISTRY,\n useValue: insertionSnapshotRegistry,\n },\n ],\n );\n const history = inject(CRAFT_HISTORY);\n const location = inject(CRAFT_LOCATION);\n\n const { state: queryParamsConfig, ...options } = config;\n\n const decodeQueryParamsState = (rawParams: Record<string, string>) =>\n Object.entries(queryParamsConfig).reduce(\n (acc, [key, config]) => {\n const rawValue = rawParams[key];\n if (rawValue === undefined || rawValue === null) {\n acc[key] = config.fallbackValue;\n return acc;\n }\n try {\n const decoded = config.codec.decode(rawValue);\n acc[key] = isCraftException(decoded) ? config.fallbackValue : decoded;\n return acc;\n } catch {\n acc[key] = config.fallbackValue;\n return acc;\n }\n },\n {} as Record<string, unknown>,\n ) as QueryParamsToState<QueryParamsType>;\n\n // URL state is updated by the router watch; the public state is a separate\n // writable Craft signal so a local set is visible synchronously and is not\n // accidentally reset by a new object returned while parsing the URL.\n const queryParamsFromUrl = signal(parseSearchParams(location().search));\n const queryParamsState = signal(\n decodeQueryParamsState(queryParamsFromUrl()),\n ) as WritableSignal<QueryParamsToState<QueryParamsType>>;\n const locationWatch = craftWatch(() => {\n const rawParams = parseSearchParams(location().search);\n queryParamsFromUrl.set(rawParams);\n queryParamsState.set(decodeQueryParamsState(rawParams));\n });\n inject(DestroyRef).onDestroy(() => locationWatch.destroy());\n\n const parseExceptions = computed(() =>\n Object.entries(queryParamsConfig).reduce(\n (acc, [key, config]) => {\n const rawValue = queryParamsFromUrl()?.[key];\n if (rawValue === undefined || rawValue === null) {\n return acc;\n }\n\n try {\n const decoded = config.codec.decode(rawValue);\n if (isCraftException(decoded)) {\n acc[key] = enrichQueryParamsParseException(decoded, key);\n }\n return acc;\n } catch (error) {\n acc[key] = enrichQueryParamsParseException(\n createQueryParamDecodeError(key, rawValue, error),\n key,\n );\n return acc;\n }\n },\n {} as Record<string, AnyCraftException>,\n ),\n );\n\n const exceptions = computed(() => {\n const parse = parseExceptions();\n return {\n list: Object.values(parse),\n parse,\n };\n }) as Signal<QueryParamsExceptions<QueryParamsType>>;\n\n const hasException = computed(() => exceptions().list.length > 0);\n\n // Get initial values from the url or use the fallback values\n const getDefaultState = () =>\n Object.entries(queryParamsConfig).reduce(\n (acc, [key, config]) => {\n acc[key] = config.fallbackValue;\n return acc;\n },\n {} as Record<string, unknown>,\n ) as QueryParamsToState<QueryParamsType>;\n\n // Save the original set method before we override it\n const originalSet = queryParamsState.set.bind(queryParamsState);\n\n // Navigation helper\n const navigate = (\n newState: QueryParamsToState<QueryParamsType>,\n navOptions?: QueryParamsNavigationOptions,\n ) => {\n // Only include params that differ from their fallback values (SEO optimization)\n const serializedParams = Object.entries(queryParamsConfig).reduce(\n (acc, [key, config]) => {\n const currentValue = newState[key];\n // Skip if value equals fallback value\n if (currentValue !== config.fallbackValue) {\n try {\n const encoded = config.codec.encode(currentValue);\n if (isCraftException(encoded)) {\n throw createQueryParamEncodeError(key, currentValue, encoded);\n }\n acc[key] = encoded as string | string[];\n } catch (error) {\n throw createQueryParamEncodeError(key, currentValue, error);\n }\n }\n return acc;\n },\n {} as Record<string, string | string[]>,\n );\n\n // Update the local state only after all codecs have encoded successfully.\n originalSet(newState);\n\n const mergedOptions = { ...options, ...navOptions };\n\n queueMicrotask(() => {\n const current = history.get();\n let nextParams = serializedParams as Record<string, string>;\n if (mergedOptions.queryParamsHandling === 'preserve') {\n nextParams = parseSearchParams(current.search);\n } else if (mergedOptions.queryParamsHandling === 'merge') {\n nextParams = {\n ...parseSearchParams(current.search),\n ...nextParams,\n };\n }\n const search = serializeSearchParams(nextParams);\n const url = `${current.pathname}${search}${\n mergedOptions.preserveFragment === false ? '' : current.hash\n }`;\n if (mergedOptions.skipLocationChange) {\n history.skip(url, null);\n return;\n }\n if (mergedOptions.replaceUrl) {\n history.replace(url);\n return;\n }\n history.push(url);\n });\n };\n\n // Create individual property signals\n const props = Object.entries(queryParamsConfig).reduce(\n (acc, [key, config]) => {\n acc[key] = computed(() => queryParamsState()[key]);\n return acc;\n },\n {} as Record<string, Signal<unknown>>,\n );\n\n // Create methods\n const methods = {\n set: (\n params: QueryParamsToState<QueryParamsType>,\n navOptions?: QueryParamsNavigationOptions,\n ) => {\n navigate(params, navOptions);\n return params;\n },\n update: (\n updateFn: (\n currentParams: QueryParamsToState<QueryParamsType>,\n ) => QueryParamsToState<QueryParamsType>,\n navOptions?: QueryParamsNavigationOptions,\n ) => {\n const newState = updateFn(queryParamsState());\n navigate(newState, navOptions);\n return newState;\n },\n patch: (\n paramsOrPatchFn:\n | Partial<QueryParamsToState<QueryParamsType>>\n | ((\n currentParams: QueryParamsToState<QueryParamsType>,\n ) => Partial<QueryParamsToState<QueryParamsType>>),\n navOptions?: QueryParamsNavigationOptions,\n ) => {\n const params =\n typeof paramsOrPatchFn === 'function'\n ? paramsOrPatchFn(queryParamsState())\n : paramsOrPatchFn;\n const newState = { ...queryParamsState(), ...params };\n navigate(newState, navOptions);\n return newState;\n },\n reset: (navOptions?: QueryParamsNavigationOptions) => {\n const defaultState = getDefaultState();\n navigate(defaultState, navOptions);\n },\n };\n\n const insertionMethods = {\n set: (\n params: QueryParamsToState<QueryParamsType>,\n navOptions?: QueryParamsNavigationOptions,\n ) =>\n yieldableInvocation(methods.set(params, navOptions)),\n update: (\n updateFn: (\n currentParams: QueryParamsToState<QueryParamsType>,\n ) => QueryParamsToState<QueryParamsType>,\n navOptions?: QueryParamsNavigationOptions,\n ) =>\n yieldableInvocation(methods.update(updateFn, navOptions)),\n patch: (\n paramsOrPatchFn:\n | Partial<QueryParamsToState<QueryParamsType>>\n | ((\n currentParams: QueryParamsToState<QueryParamsType>,\n ) => Partial<QueryParamsToState<QueryParamsType>>),\n navOptions?: QueryParamsNavigationOptions,\n ) =>\n yieldableInvocation(methods.patch(paramsOrPatchFn, navOptions)),\n reset: (navOptions?: QueryParamsNavigationOptions) =>\n yieldableInvocation(methods.reset(navOptions)),\n } as unknown as QueryParamsMethods<QueryParamsToState<QueryParamsType>>;\n\n runInInjectionContext(injector, () =>\n ɵobservePrimitiveResourceRuntimeContext(\n ɵcreatePrimitiveResourceRuntimeContext('queryParams', {\n state: queryParamsState.asReadonly(),\n set: (value) =>\n methods.set(value as QueryParamsToState<QueryParamsType>),\n update: (updater) =>\n methods.update(\n (current) =>\n updater(current) as QueryParamsToState<QueryParamsType>,\n ),\n }),\n name,\n ),\n );\n\n // Process insertions\n const readonlyQueryParamsState = queryParamsState.asReadonly();\n const publicStateReader = createYieldableReactiveValue(\n readonlyQueryParamsState,\n 'state',\n { primitive: 'queryParams', path: `${name}.state` },\n );\n const publicHasException = createYieldableReactiveValue(\n hasException,\n 'hasException',\n { primitive: 'queryParams', path: `${name}.hasException` },\n );\n const publicExceptions = createYieldableReactiveValue(\n exceptions,\n 'exceptions',\n { primitive: 'queryParams', path: `${name}.exceptions` },\n );\n const insertionResults =\n (insertions as InsertionsQueryParamsFactory<QueryParamsType, {}>[])?.reduce(\n (acc, insert) => {\n const newInsertions = executeQueryParamsFactory(\n injector,\n insert,\n undefined,\n {\n state: publicStateReader,\n config: queryParamsConfig,\n hasException: publicHasException,\n exceptions: publicExceptions,\n ...insertionMethods,\n insertions: acc as {},\n } as InsertionQueryParamsFactoryContext<QueryParamsType, {}>,\n );\n const wrappedInsertions = Object.entries(newInsertions).reduce(\n (wrappedAcc, [key, value]) => {\n if (\n typeof value !== 'function' ||\n isSignal(value) ||\n isNonYieldableInsertionMethod(value)\n ) {\n wrappedAcc[key] = nameInsertedReactiveValue(\n value,\n key,\n 'queryParams',\n `${name}.${key}`,\n );\n return wrappedAcc;\n }\n if (isYieldableReactiveValue(value)) {\n wrappedAcc[key] = nameInsertedReactiveValue(\n value,\n key,\n 'queryParams',\n `${name}.${key}`,\n );\n return wrappedAcc;\n }\n const methodInjector = ɵcreateHostTaggedInjector(\n injector,\n `method:${key}`,\n [\n ɵprovidePrimitiveMethodRuntimeContext(\n 'queryParams',\n {\n state: queryParamsState.asReadonly(),\n set: (next) =>\n methods.set(next as QueryParamsToState<QueryParamsType>),\n update: (updater) =>\n methods.update(\n (current) =>\n updater(\n current,\n ) as QueryParamsToState<QueryParamsType>,\n ),\n patch: (patchFn) =>\n methods.patch(\n (current) =>\n patchFn(current) as Partial<\n QueryParamsToState<QueryParamsType>\n >,\n ),\n },\n value as (...args: never[]) => unknown,\n ),\n ],\n );\n const wrappedFn = runInInjectionContext(methodInjector, () =>\n injectFnWrapper()(value as (...args: unknown[]) => unknown),\n );\n wrappedAcc[key] = createYieldableInsertionMethod(wrappedFn, {\n injector: methodInjector,\n invalidYieldErrorMessage: QUERY_PARAM_INVALID_YIELD_ERROR_MESSAGE,\n multipleAppStartErrorMessage: QUERY_PARAM_APP_START_ERROR_MESSAGE,\n onAppStartNotSupportedErrorMessage:\n QUERY_PARAM_APP_START_ERROR_MESSAGE,\n });\n return wrappedAcc;\n },\n {} as Record<string, unknown>,\n );\n return {\n ...acc,\n ...wrappedInsertions,\n };\n },\n {} as Record<string, unknown>,\n ) || {};\n\n const queryParamsCallable = readonlyQueryParamsState;\n Object.defineProperty(queryParamsCallable, 'name', {\n configurable: true,\n writable: true,\n value: undefined,\n });\n const queryParamsOutput = Object.assign(\n queryParamsCallable,\n props,\n insertionResults,\n { hasException, exceptions, _config: config },\n ) as unknown as QueryParamsOutput<QueryParamsType, {}, QueryParamsState>;\n\n const snapshotRegistry = injector.get(APP_SNAPSHOT_REGISTRY, null);\n const hostTagList: readonly string[] =\n injector.get(ɵHOST_TAG_LIST, null) ?? [];\n\n const destroyRefParam = injector.get(DestroyRef, null);\n\n if (snapshotRegistry && destroyRefParam) {\n snapshotRegistry.triggerSnapshot$\n .pipe(takeUntilDestroyed(destroyRefParam))\n .subscribe(() => {\n const insertionSnapshots = triggerAndCollectInsertions(\n insertionSnapshotRegistry,\n );\n let stateSnapshot: unknown;\n try {\n stateSnapshot = {\n value: queryParamsState(),\n ...(insertionSnapshots ? { insertions: insertionSnapshots } : {}),\n };\n } catch (error) {\n stateSnapshot = {\n error: error instanceof Error ? error.message : String(error),\n };\n }\n snapshotRegistry.allSnapShot$.next({\n source: 'queryParams',\n from: hostTagList,\n state: stateSnapshot,\n });\n });\n }\n\n const publicQueryParams = createYieldableReactiveFacade(queryParamsOutput, {\n name,\n primitive: 'queryParams',\n path: name,\n });\n return (hasDeepYieldableInsertion(insertions)\n ? deepYieldable(publicQueryParams)\n : publicQueryParams) as QueryParamsOutput<QueryParamsType, {}, QueryParamsState>;\n}\n"]}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { Signal, WritableSignal } from './host/craft-compat';
|
|
2
|
+
import { CustomReloadOnSpecificMutationStatus, FilterQueryById, PatchMutationQuery, QueryAndMutationRecordConstraints, ReloadQueriesConfig } from './util/types/shared.type';
|
|
3
|
+
import { ResourceByIdRef } from './resource-by-id';
|
|
4
|
+
import { MergeObjects } from './util//types/util.type';
|
|
5
|
+
import { ResourceByIdLikeMutationRef, ResourceLikeMutationRef } from './mutation';
|
|
6
|
+
import { CraftResourceRef } from './util/craft-resource-ref';
|
|
7
|
+
import { QueryParamsExceptions, QueryParamsToState } from './query-params';
|
|
8
|
+
import { Prettify } from './util/util.type';
|
|
9
|
+
import { InsertMetaInCraftExceptionIfExists } from './craft-exception';
|
|
10
|
+
import type { YieldableInsertionMethods, YieldableInvocation } from './yieldable';
|
|
11
|
+
import type { DeepYieldableReactiveValue, YieldableReactiveProperties, YieldableReactiveSignal, YieldableReactiveValue } from './reactive-read';
|
|
12
|
+
import type { CraftSettledYieldableValue } from './craft-settled';
|
|
13
|
+
export interface QueryParamsNavigationOptions {
|
|
14
|
+
queryParamsHandling?: 'merge' | 'preserve' | '';
|
|
15
|
+
onSameUrlNavigation?: 'reload' | 'ignore';
|
|
16
|
+
replaceUrl?: boolean;
|
|
17
|
+
skipLocationChange?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export type MutationResourceRefHelper<QueryAndMutationRecord extends QueryAndMutationRecordConstraints> = ResourceLikeMutationRef<QueryAndMutationRecord['mutation']['state'], QueryAndMutationRecord['mutation']['params'], QueryAndMutationRecord['mutation']['isMethod'], QueryAndMutationRecord['mutation']['args'], QueryAndMutationRecord['mutation']['sourceParams'], QueryAndMutationRecord['mutation']['insertions'], QueryAndMutationRecord['mutation']['exceptions']>;
|
|
20
|
+
export type MutationResourceByIdRefHelper<QueryAndMutationRecord extends QueryAndMutationRecordConstraints> = ResourceByIdLikeMutationRef<QueryAndMutationRecord['mutation']['state'], QueryAndMutationRecord['mutation']['params'], QueryAndMutationRecord['mutation']['isMethod'], QueryAndMutationRecord['mutation']['args'], QueryAndMutationRecord['mutation']['sourceParams'], QueryAndMutationRecord['mutation']['insertions'], QueryAndMutationRecord['mutation']['groupIdentifier'], QueryAndMutationRecord['mutation']['exceptions']>;
|
|
21
|
+
type UpdateData<QueryAndMutationRecord extends QueryAndMutationRecordConstraints> = MergeObjects<[
|
|
22
|
+
{
|
|
23
|
+
queryResource: CraftResourceRef<QueryAndMutationRecord['query']['state'], QueryAndMutationRecord['query']['params']>;
|
|
24
|
+
mutationResource: CraftResourceRef<NoInfer<QueryAndMutationRecord['mutation']['state']>, NoInfer<QueryAndMutationRecord['mutation']['params']>>;
|
|
25
|
+
mutationParams: NonNullable<NoInfer<QueryAndMutationRecord['mutation']['params']>>;
|
|
26
|
+
},
|
|
27
|
+
QueryAndMutationRecord['query']['isGroupedResource'] extends true ? {
|
|
28
|
+
queryIdentifier: QueryAndMutationRecord['query']['groupIdentifier'];
|
|
29
|
+
queryResources: ResourceByIdRef<string, QueryAndMutationRecord['query']['state'], QueryAndMutationRecord['query']['params']>;
|
|
30
|
+
} : {},
|
|
31
|
+
QueryAndMutationRecord['mutation']['groupIdentifier'] extends string | number ? {
|
|
32
|
+
mutationIdentifier: QueryAndMutationRecord['mutation']['groupIdentifier'];
|
|
33
|
+
mutationResources: ResourceByIdRef<string, QueryAndMutationRecord['mutation']['state'], QueryAndMutationRecord['mutation']['params']>;
|
|
34
|
+
} : {}
|
|
35
|
+
]>;
|
|
36
|
+
export type QueryDeclarativeEffect<QueryAndMutationRecord extends QueryAndMutationRecordConstraints> = MergeObjects<[
|
|
37
|
+
{
|
|
38
|
+
/**
|
|
39
|
+
* Run when the mutation is in loading state.
|
|
40
|
+
*/
|
|
41
|
+
optimisticUpdate?: (data: UpdateData<QueryAndMutationRecord>) => QueryAndMutationRecord['query']['state'];
|
|
42
|
+
/**
|
|
43
|
+
* Run when the mutation is in loaded state.
|
|
44
|
+
*/
|
|
45
|
+
update?: (data: UpdateData<QueryAndMutationRecord>) => QueryAndMutationRecord['query']['state'];
|
|
46
|
+
reload?: ReloadQueriesConfig<QueryAndMutationRecord>;
|
|
47
|
+
/**
|
|
48
|
+
* Run when the mutation is in loading state.
|
|
49
|
+
* Will patch the query specific state with the mutation data.
|
|
50
|
+
* If the query is loading, it will not patch.
|
|
51
|
+
* If the mutation data is not compatible with the query state, it will not patch.
|
|
52
|
+
* Be careful! If the mutation is already in a loading state, trigger the mutation again will cancelled the previous mutation loader and will patch with the new value.
|
|
53
|
+
*/
|
|
54
|
+
optimisticPatch?: PatchMutationQuery<QueryAndMutationRecord>;
|
|
55
|
+
/**
|
|
56
|
+
* Run when the mutation is in loaded state.
|
|
57
|
+
* Will patch the query specific state with the mutation data.
|
|
58
|
+
* If the query is loading, it will not patch.
|
|
59
|
+
* If the mutation data is not compatible with the query state, it will not patch.
|
|
60
|
+
* Be careful! If the mutation is already in a loading state, trigger the mutation again will cancelled the previous mutation loader and will patch with the new value.
|
|
61
|
+
*/
|
|
62
|
+
patch?: PatchMutationQuery<QueryAndMutationRecord>;
|
|
63
|
+
},
|
|
64
|
+
QueryAndMutationRecord['mutation']['isGroupedResource'] extends true ? {
|
|
65
|
+
filter: FilterQueryById<QueryAndMutationRecord>;
|
|
66
|
+
} : QueryAndMutationRecord['query']['isGroupedResource'] extends true ? {
|
|
67
|
+
filter: FilterQueryById<QueryAndMutationRecord>;
|
|
68
|
+
} : {}
|
|
69
|
+
]>;
|
|
70
|
+
export declare function triggerQueryReloadFromMutationChange<QueryAndMutationRecord extends QueryAndMutationRecordConstraints>({ reload, mutationStatus, queryResource, mutationResource, mutationParamsSrc, queryIdentifier, queryResources, mutationIdentifier, mutationResources, }: {
|
|
71
|
+
reload: ReloadQueriesConfig<QueryAndMutationRecord>;
|
|
72
|
+
mutationStatus: string;
|
|
73
|
+
queryResource: CraftResourceRef<QueryAndMutationRecord['query']['state'], QueryAndMutationRecord['query']['params']>;
|
|
74
|
+
queryResources: ResourceByIdRef<string, QueryAndMutationRecord['query']['state'], QueryAndMutationRecord['query']['params']> | undefined;
|
|
75
|
+
mutationResource: CraftResourceRef<any, any>;
|
|
76
|
+
mutationParamsSrc: Signal<QueryAndMutationRecord['mutation']['params'] | undefined>;
|
|
77
|
+
queryIdentifier: QueryAndMutationRecord['query']['groupIdentifier'];
|
|
78
|
+
mutationIdentifier: QueryAndMutationRecord['mutation']['groupIdentifier'];
|
|
79
|
+
mutationResources: ResourceByIdRef<string, any, unknown> | undefined;
|
|
80
|
+
}): void;
|
|
81
|
+
export declare function triggerQueryReloadOnMutationStatusChange<QueryAndMutationRecord extends QueryAndMutationRecordConstraints>({ mutationStatus, queryResourceTarget, mutationEffectOptions, mutationResource, mutationParamsSrc, reloadCConfig, mutationIdentifier, mutationResources, }: {
|
|
82
|
+
mutationStatus: string;
|
|
83
|
+
queryResourceTarget: ResourceByIdRef<string, QueryAndMutationRecord['query']['state'], QueryAndMutationRecord['query']['params']> | CraftResourceRef<QueryAndMutationRecord['query']['state'], QueryAndMutationRecord['query']['params']>;
|
|
84
|
+
mutationEffectOptions: QueryDeclarativeEffect<QueryAndMutationRecord>;
|
|
85
|
+
mutationResource: CraftResourceRef<any, any>;
|
|
86
|
+
mutationParamsSrc: Signal<QueryAndMutationRecord['mutation']['params']>;
|
|
87
|
+
reloadCConfig: {
|
|
88
|
+
onMutationException?: boolean | CustomReloadOnSpecificMutationStatus<QueryAndMutationRecord>;
|
|
89
|
+
onMutationResolved?: boolean | CustomReloadOnSpecificMutationStatus<QueryAndMutationRecord>;
|
|
90
|
+
onMutationLoading?: boolean | CustomReloadOnSpecificMutationStatus<QueryAndMutationRecord>;
|
|
91
|
+
};
|
|
92
|
+
mutationIdentifier: QueryAndMutationRecord['mutation']['groupIdentifier'] | undefined;
|
|
93
|
+
mutationResources: ResourceByIdRef<string, QueryAndMutationRecord['mutation']['state'], QueryAndMutationRecord['mutation']['params']> | undefined;
|
|
94
|
+
}): void;
|
|
95
|
+
export declare function setAllPatchFromMutationOnQueryValue<QueryAndMutationRecord extends QueryAndMutationRecordConstraints>({ mutationStatus, queryResourceTarget, mutationEffectOptions, mutationResource, mutationParamsSrc, mutationIdentifier, mutationResources, }: {
|
|
96
|
+
mutationStatus: string;
|
|
97
|
+
queryResourceTarget: ResourceByIdRef<string, QueryAndMutationRecord['query']['state'], QueryAndMutationRecord['query']['params']> | CraftResourceRef<QueryAndMutationRecord['query']['state'], QueryAndMutationRecord['query']['params']>;
|
|
98
|
+
mutationEffectOptions: QueryDeclarativeEffect<QueryAndMutationRecord>;
|
|
99
|
+
mutationResource: CraftResourceRef<any, any>;
|
|
100
|
+
mutationParamsSrc: Signal<QueryAndMutationRecord['mutation']['params']>;
|
|
101
|
+
mutationIdentifier: QueryAndMutationRecord['mutation']['groupIdentifier'] | undefined;
|
|
102
|
+
mutationResources: MutationResourceByIdRefHelper<QueryAndMutationRecord> | undefined;
|
|
103
|
+
}): void;
|
|
104
|
+
export declare function setAllUpdatesFromMutationOnQueryValue<QueryAndMutationRecord extends QueryAndMutationRecordConstraints>({ mutationStatus, queryResourceTarget, mutationEffectOptions, mutationResource, mutationParamsSrc, mutationIdentifier, mutationResources, }: {
|
|
105
|
+
mutationStatus: string;
|
|
106
|
+
queryResourceTarget: ResourceByIdRef<string, QueryAndMutationRecord['query']['state'], QueryAndMutationRecord['query']['params']> | CraftResourceRef<QueryAndMutationRecord['query']['state'], QueryAndMutationRecord['query']['params']>;
|
|
107
|
+
mutationEffectOptions: QueryDeclarativeEffect<QueryAndMutationRecord>;
|
|
108
|
+
mutationResource: CraftResourceRef<any, any> | undefined;
|
|
109
|
+
mutationParamsSrc: Signal<QueryAndMutationRecord['mutation']['params']>;
|
|
110
|
+
mutationIdentifier: QueryAndMutationRecord['mutation']['groupIdentifier'] | undefined;
|
|
111
|
+
mutationResources: ResourceByIdRef<string, QueryAndMutationRecord['mutation']['state'], QueryAndMutationRecord['mutation']['params']> | undefined;
|
|
112
|
+
}): void;
|
|
113
|
+
export type ResourceExceptionConstraints = {
|
|
114
|
+
params: unknown;
|
|
115
|
+
loader: unknown;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* A mutation exposed to insertion factories.
|
|
119
|
+
*
|
|
120
|
+
* The authored contract is an invocation consumed with `yield*`. The
|
|
121
|
+
* synchronous mutation itself remains internal to the primitive runtime; the
|
|
122
|
+
* returned invocation is what insertion methods expose to callers.
|
|
123
|
+
*/
|
|
124
|
+
export type YieldableInsertionWrite<Args extends unknown[], Result> = {
|
|
125
|
+
(...args: Args): YieldableInvocation<never, Result>;
|
|
126
|
+
};
|
|
127
|
+
export type InsertionParams<ResourceState extends object | undefined, ResourceParams, Exceptions extends ResourceExceptionConstraints, PreviousInsertionsOutputs, PrimitiveName extends string = string> = {
|
|
128
|
+
test: ResourceState;
|
|
129
|
+
state: YieldableReactiveValue<ResourceState, 'state'>;
|
|
130
|
+
settledState: CraftSettledYieldableValue<NonNullable<ResourceState>, PrimitiveName, Exceptions['params'] | Exceptions['loader']>;
|
|
131
|
+
set: YieldableInsertionWrite<[newState: ResourceState], ResourceState>;
|
|
132
|
+
update: YieldableInsertionWrite<[
|
|
133
|
+
updateFn: (currentState: ResourceState) => ResourceState
|
|
134
|
+
], ResourceState>;
|
|
135
|
+
patch: YieldableInsertionWrite<[
|
|
136
|
+
patchFn: (currentState: ResourceState) => Partial<ResourceState>
|
|
137
|
+
], ResourceState>;
|
|
138
|
+
insertions: keyof PreviousInsertionsOutputs extends string ? YieldableInsertionMethods<PreviousInsertionsOutputs> : never;
|
|
139
|
+
resource: YieldableReactiveProperties<CraftResourceRef<ResourceState, ResourceParams>>;
|
|
140
|
+
resourceParamsSrc: YieldableReactiveSignal<WritableSignal<ResourceParams | undefined>, 'resourceParamsSrc'>;
|
|
141
|
+
hasException: YieldableReactiveValue<boolean, 'hasException'>;
|
|
142
|
+
exceptions: DeepYieldableReactiveValue<{
|
|
143
|
+
list: (InsertMetaInCraftExceptionIfExists<Exceptions['params'], 'params', unknown> | InsertMetaInCraftExceptionIfExists<Exceptions['loader'], 'loader', unknown>)[];
|
|
144
|
+
params?: InsertMetaInCraftExceptionIfExists<Exceptions['params'], 'params', unknown>;
|
|
145
|
+
loader?: InsertMetaInCraftExceptionIfExists<Exceptions['loader'], 'loader', unknown>;
|
|
146
|
+
}, 'exceptions'>;
|
|
147
|
+
resourceById: never;
|
|
148
|
+
identifier: never;
|
|
149
|
+
};
|
|
150
|
+
export type InsertionsFactory<ResourceState extends object | undefined, ResourceParams, InsertsOutputs, Exceptions extends ResourceExceptionConstraints, PreviousInsertionsOutputs = {}, Yielded = never, PrimitiveName extends string = string> = (context: InsertionParams<ResourceState, ResourceParams, Exceptions, PreviousInsertionsOutputs, PrimitiveName>) => InsertsOutputs | Generator<Yielded, InsertsOutputs, unknown>;
|
|
151
|
+
export type InsertionByIdParams<GroupIdentifier extends string, ResourceState extends object | undefined, ResourceParams, Exceptions extends ResourceExceptionConstraints, PreviousInsertionsOutputs, PrimitiveName extends string = string> = {
|
|
152
|
+
state: YieldableReactiveValue<ResourceState, 'state'>;
|
|
153
|
+
settledState: CraftSettledYieldableValue<NonNullable<ResourceState>, PrimitiveName, Exceptions['params'] | Exceptions['loader']>;
|
|
154
|
+
set: YieldableInsertionWrite<[newState: ResourceState], ResourceState>;
|
|
155
|
+
update: YieldableInsertionWrite<[
|
|
156
|
+
updateFn: (currentState: ResourceState) => ResourceState
|
|
157
|
+
], ResourceState>;
|
|
158
|
+
patch: YieldableInsertionWrite<[
|
|
159
|
+
patchFn: (currentState: ResourceState) => Partial<ResourceState>
|
|
160
|
+
], ResourceState>;
|
|
161
|
+
insertions: keyof PreviousInsertionsOutputs extends string ? YieldableInsertionMethods<PreviousInsertionsOutputs> : never;
|
|
162
|
+
resourceById: YieldableReactiveSignal<ResourceByIdRef<GroupIdentifier, ResourceState, ResourceParams>, 'resourceById'>;
|
|
163
|
+
resource: never;
|
|
164
|
+
resourceParamsSrc: YieldableReactiveSignal<WritableSignal<ResourceParams | undefined>, 'resourceParamsSrc'>;
|
|
165
|
+
hasException: YieldableReactiveValue<boolean, 'hasException'>;
|
|
166
|
+
exceptions: DeepYieldableReactiveValue<{
|
|
167
|
+
list: (InsertMetaInCraftExceptionIfExists<Exceptions['params'], 'params', unknown> | InsertMetaInCraftExceptionIfExists<Exceptions['loader'], 'loader', GroupIdentifier>)[];
|
|
168
|
+
params?: InsertMetaInCraftExceptionIfExists<Exceptions['params'], 'params', unknown>;
|
|
169
|
+
loader: Partial<Record<GroupIdentifier, InsertMetaInCraftExceptionIfExists<Exceptions['loader'], 'loader', GroupIdentifier>>>;
|
|
170
|
+
}, 'exceptions'>;
|
|
171
|
+
identifier: (params: NonNullable<ResourceParams>) => GroupIdentifier;
|
|
172
|
+
};
|
|
173
|
+
export type InsertionStateFactoryContext<StateType, PreviousInsertionsOutputs> = {
|
|
174
|
+
state: YieldableReactiveValue<StateType, 'state'>;
|
|
175
|
+
set: YieldableInsertionWrite<[newState: StateType], StateType>;
|
|
176
|
+
update: YieldableInsertionWrite<[
|
|
177
|
+
updateFn: (currentState: StateType) => StateType
|
|
178
|
+
], StateType>;
|
|
179
|
+
patch: YieldableInsertionWrite<[
|
|
180
|
+
patchFn: (currentState: StateType) => Partial<StateType>
|
|
181
|
+
], StateType>;
|
|
182
|
+
insertions: keyof PreviousInsertionsOutputs extends string ? YieldableInsertionMethods<PreviousInsertionsOutputs> : never;
|
|
183
|
+
};
|
|
184
|
+
export type QueryParamsMethods<QueryParamsState> = {
|
|
185
|
+
patch: {
|
|
186
|
+
(patchFn: (currentParams: QueryParamsState) => Partial<QueryParamsState>, options?: QueryParamsNavigationOptions): YieldableInvocation<never, QueryParamsState>;
|
|
187
|
+
(params: Partial<QueryParamsState>, options?: QueryParamsNavigationOptions): YieldableInvocation<never, QueryParamsState>;
|
|
188
|
+
};
|
|
189
|
+
reset: {
|
|
190
|
+
(options?: QueryParamsNavigationOptions): YieldableInvocation<never, void>;
|
|
191
|
+
};
|
|
192
|
+
set: {
|
|
193
|
+
(params: QueryParamsState, options?: QueryParamsNavigationOptions): YieldableInvocation<never, QueryParamsState>;
|
|
194
|
+
};
|
|
195
|
+
update: {
|
|
196
|
+
(updateFn: (currentParams: QueryParamsState) => QueryParamsState, options?: QueryParamsNavigationOptions): YieldableInvocation<never, QueryParamsState>;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
export type InsertionQueryParamsFactoryContext<QueryParamsType, PreviousInsertionsOutputs, QueryParamsState = Prettify<QueryParamsToState<QueryParamsType>>> = QueryParamsMethods<QueryParamsState> & {
|
|
200
|
+
state: YieldableReactiveValue<QueryParamsState, 'state'>;
|
|
201
|
+
config: QueryParamsType;
|
|
202
|
+
hasException: YieldableReactiveValue<boolean, 'hasException'>;
|
|
203
|
+
exceptions: YieldableReactiveValue<QueryParamsExceptions<QueryParamsType>, 'exceptions'>;
|
|
204
|
+
insertions: keyof PreviousInsertionsOutputs extends string ? YieldableInsertionMethods<PreviousInsertionsOutputs> : never;
|
|
205
|
+
};
|
|
206
|
+
export type InsertionsByIdFactory<ResourceState extends object | undefined, ResourceParams, GroupIdentifier extends string, Exceptions extends ResourceExceptionConstraints, InsertionsOutputs, PreviousInsertionsOutputs = {}, Yielded = never, PrimitiveName extends string = string> = (context: InsertionByIdParams<GroupIdentifier, ResourceState, ResourceParams, Exceptions, PreviousInsertionsOutputs, PrimitiveName>) => InsertionsOutputs | Generator<Yielded, InsertionsOutputs, unknown>;
|
|
207
|
+
export type InsertionResourceFactoryContext<GroupIdentifier, ResourceState extends object | undefined, ResourceParams, Exceptions extends ResourceExceptionConstraints, PreviousInsertionsOutputs, PrimitiveName extends string = string> = [unknown] extends [GroupIdentifier] ? InsertionParams<ResourceState, ResourceParams, Exceptions, PreviousInsertionsOutputs, PrimitiveName> : InsertionByIdParams<GroupIdentifier & string, ResourceState, ResourceParams, Exceptions, PreviousInsertionsOutputs, PrimitiveName>;
|
|
208
|
+
export type InsertionsResourcesFactory<GroupIdentifier, ResourceState extends object | undefined, ResourceParams, Exceptions extends ResourceExceptionConstraints, InsertionsOutputs, PreviousInsertionsOutputs = {}, Yielded = never, PrimitiveName extends string = string> = (context: InsertionResourceFactoryContext<GroupIdentifier, ResourceState, ResourceParams, Exceptions, PreviousInsertionsOutputs, PrimitiveName>) => InsertionsOutputs | Generator<Yielded, InsertionsOutputs, unknown>;
|
|
209
|
+
export type InsertionsStateFactory<State, InsertionsOutputs, PreviousInsertionsOutputs = {}, Yielded = never> = (context: InsertionStateFactoryContext<State, PreviousInsertionsOutputs>) => InsertionsOutputs | Generator<Yielded, InsertionsOutputs, unknown>;
|
|
210
|
+
export type InsertionsQueryParamsFactory<QueryParamsType, InsertionsOutputs, PreviousInsertionsOutputs = {}, Yielded = never> = (context: InsertionQueryParamsFactoryContext<QueryParamsType, PreviousInsertionsOutputs>) => InsertionsOutputs | Generator<Yielded, InsertionsOutputs, unknown>;
|
|
211
|
+
export type DefaultInsertionByIdParams = InsertionByIdParams<string, {}, unknown, ResourceExceptionConstraints, {}>;
|
|
212
|
+
export type DefaultInsertionParams = InsertionParams<{}, unknown, ResourceExceptionConstraints, unknown>;
|
|
213
|
+
export {};
|
|
214
|
+
//# sourceMappingURL=query.core.d.ts.map
|