@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 @@
|
|
|
1
|
+
{"version":3,"file":"insert-entities.d.ts","sourceRoot":"","sources":["../../../../../libs/core/src/lib/insert-entities.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { createNestedStateUpdate, getNestedStateValue, } from './util/update-state.util';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an insertion that adds entity collection management methods to state, query, or queryParams primitives.
|
|
4
|
+
*
|
|
5
|
+
* Provides type-safe manipulation of arrays of entities with operations like add, remove, update, and upsert.
|
|
6
|
+
* Supports nested properties via dot notation paths and custom entity identifiers.
|
|
7
|
+
*
|
|
8
|
+
* @template State - The state type (array or object containing arrays)
|
|
9
|
+
* @template K - The type of entity identifiers (string or number)
|
|
10
|
+
* @template PreviousInsertionsOutputs - Combined outputs from previous insertions
|
|
11
|
+
* @template EntityHelperFns - Tuple type of entity utility functions to expose
|
|
12
|
+
* @template StateIdentifier - Type of identifier function for parallel queries
|
|
13
|
+
* @template Path - Dot-notation path to nested array (inferred from state structure)
|
|
14
|
+
*
|
|
15
|
+
* @param config - Configuration object
|
|
16
|
+
* @param config.methods - Array of entity utility functions (addOne, removeOne, updateOne, etc.) to expose as methods
|
|
17
|
+
* @param config.identifier - Optional custom function to extract unique ID from entities.
|
|
18
|
+
* Defaults to `entity.id` for objects or `entity` for primitives
|
|
19
|
+
* @param config.path - Optional dot-notation path to nested array property (e.g., 'catalog.products').
|
|
20
|
+
* Method names are prefixed with camelCase path when provided
|
|
21
|
+
*
|
|
22
|
+
* @returns Insertion function that adds entity management methods to the primitive
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // Basic usage with primitives
|
|
26
|
+
* const tags = yield* state(
|
|
27
|
+
* [] as string[],
|
|
28
|
+
* insertEntities({
|
|
29
|
+
* methods: [addOne, addMany, removeOne],
|
|
30
|
+
* })
|
|
31
|
+
* ));
|
|
32
|
+
* yield* tags.addOne({ entity: 'typescript' });
|
|
33
|
+
* yield* tags.addMany({ newEntities: ['angular', 'signals'] });
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // With objects having default id property
|
|
37
|
+
* interface Product {
|
|
38
|
+
* id: string;
|
|
39
|
+
* name: string;
|
|
40
|
+
* price: number;
|
|
41
|
+
* }
|
|
42
|
+
* const products = yield* state(
|
|
43
|
+
* [] as Product[],
|
|
44
|
+
* insertEntities({
|
|
45
|
+
* methods: [addOne, setOne, removeOne],
|
|
46
|
+
* })
|
|
47
|
+
* ));
|
|
48
|
+
* yield* products.addOne({ entity: { id: '1', name: 'Laptop', price: 999 } });
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* // With custom identifier
|
|
52
|
+
* interface User {
|
|
53
|
+
* uuid: string;
|
|
54
|
+
* name: string;
|
|
55
|
+
* }
|
|
56
|
+
* const users = yield* state(
|
|
57
|
+
* [] as User[],
|
|
58
|
+
* insertEntities({
|
|
59
|
+
* methods: [setOne, removeOne],
|
|
60
|
+
* identifier: (user) => user.uuid,
|
|
61
|
+
* })
|
|
62
|
+
* ));
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* // With nested path
|
|
66
|
+
* interface Catalog {
|
|
67
|
+
* total: number;
|
|
68
|
+
* products: Array<{ id: string; name: string }>;
|
|
69
|
+
* }
|
|
70
|
+
* const catalog = yield* state(
|
|
71
|
+
* { total: 0, products: [] } as Catalog,
|
|
72
|
+
* insertEntities({
|
|
73
|
+
* methods: [addMany, removeOne],
|
|
74
|
+
* path: 'products',
|
|
75
|
+
* })
|
|
76
|
+
* ));
|
|
77
|
+
* yield* catalog.productsAddMany({ newEntities: [{ id: '1', name: 'Item' }] });
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* // With parallel queries
|
|
81
|
+
* const userQuery = yield* query(
|
|
82
|
+
* {
|
|
83
|
+
* params: () => 'userId',
|
|
84
|
+
* identifier: (params) => params,
|
|
85
|
+
* loader: async ({ params }) => fetchUserPosts(params),
|
|
86
|
+
* },
|
|
87
|
+
* insertEntities({
|
|
88
|
+
* methods: [addOne],
|
|
89
|
+
* })
|
|
90
|
+
* ));
|
|
91
|
+
* yield* userQuery.addOne({
|
|
92
|
+
* select: 'user-123', // Target specific query instance
|
|
93
|
+
* entity: { id: 'post-1', title: 'New Post' },
|
|
94
|
+
* });
|
|
95
|
+
*
|
|
96
|
+
* @see {@link https://github.com/craft-ts/craft-ts/blob/main/apps/docs/insertions/insert-entities.md | insertEntities Documentation}
|
|
97
|
+
*/
|
|
98
|
+
export function insertEntities(config) {
|
|
99
|
+
return (context) => {
|
|
100
|
+
const methods = {};
|
|
101
|
+
const hasPath = 'path' in config;
|
|
102
|
+
const path = hasPath ? config.path : undefined;
|
|
103
|
+
const pathKeys = path ? path.split('.') : undefined;
|
|
104
|
+
const pathMethodPrefix = pathKeys
|
|
105
|
+
? pathKeys.reduce((acc, key, index) => index === 0 ? key : `${acc}${key[0].toUpperCase()}${key.slice(1)}`, '')
|
|
106
|
+
: undefined;
|
|
107
|
+
for (const helperFn of config.methods) {
|
|
108
|
+
const helperName = helperFn.name;
|
|
109
|
+
if (!helperName) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const methodName = hasPath
|
|
113
|
+
? `${pathMethodPrefix}${helperName[0].toUpperCase()}${helperName.slice(1)}`
|
|
114
|
+
: helperName;
|
|
115
|
+
methods[methodName] = (payload) => {
|
|
116
|
+
context.update((state) => {
|
|
117
|
+
const hasSelect = 'select' in payload && payload.select;
|
|
118
|
+
const targetState = hasSelect
|
|
119
|
+
? state[payload.select]
|
|
120
|
+
: state;
|
|
121
|
+
const entities = pathKeys
|
|
122
|
+
? getNestedStateValue({
|
|
123
|
+
state: targetState,
|
|
124
|
+
keysPath: pathKeys,
|
|
125
|
+
})
|
|
126
|
+
: targetState;
|
|
127
|
+
const updatedEntities = helperFn({
|
|
128
|
+
...payload,
|
|
129
|
+
entities,
|
|
130
|
+
identifier: config.identifier,
|
|
131
|
+
});
|
|
132
|
+
if (hasSelect) {
|
|
133
|
+
const updatedTargetState = pathKeys
|
|
134
|
+
? createNestedStateUpdate({
|
|
135
|
+
state: targetState,
|
|
136
|
+
keysPath: pathKeys,
|
|
137
|
+
value: updatedEntities,
|
|
138
|
+
})
|
|
139
|
+
: updatedEntities;
|
|
140
|
+
return {
|
|
141
|
+
...state,
|
|
142
|
+
[payload.select]: updatedTargetState,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
if (pathKeys) {
|
|
146
|
+
return createNestedStateUpdate({
|
|
147
|
+
state,
|
|
148
|
+
keysPath: pathKeys,
|
|
149
|
+
value: updatedEntities,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return updatedEntities;
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
return methods;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=insert-entities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert-entities.js","sourceRoot":"","sources":["../../../../../libs/core/src/lib/insert-entities.ts"],"names":[],"mappings":"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","sourcesContent":["import { InsertionStateFactoryContext } from './query.core';\nimport { EntitiesUtilBrand, IdSelector } from './util/entities-util';\nimport {\n AccessTypeObjectPropertyByDottedPath,\n DottedPathPathToTuple,\n} from './util/types/access-type-object-property-by-dotted-path.type';\nimport {\n createNestedStateUpdate,\n getNestedStateValue,\n} from './util/update-state.util';\nimport { ObjectDeepPath } from './util/types/object-deep-path-mapper.type';\nimport { MergeObject, Prettify } from './util/util.type';\n\ntype ArrayObjectDeepPath<State extends object> =\n ObjectDeepPath<State> extends infer Path\n ? Path extends string\n ? AccessTypeObjectPropertyByDottedPath<\n State,\n DottedPathPathToTuple<Path>\n > extends Array<any>\n ? Path\n : never\n : never\n : never;\n\ntype DottedPathToCamel<Path extends string> =\n Path extends `${infer Head}.${infer Tail}`\n ? `${Head}${Capitalize<DottedPathToCamel<Tail>>}`\n : Path;\n\ntype EntitiesUtilsToMap<\n EntityHelperFns,\n Entity,\n K,\n HasStateIdentifier,\n StateIdentifier,\n HasPath,\n Path,\n Acc = {},\n> = EntityHelperFns extends [infer First, ...infer Rest]\n ? First extends (data: infer Payload) => infer R\n ? R extends EntitiesUtilBrand<infer Name>\n ? EntitiesUtilsToMap<\n Rest,\n Entity,\n K,\n HasStateIdentifier,\n StateIdentifier,\n HasPath,\n Path,\n Acc & {\n [key in Name as `${HasPath extends true ? `${DottedPathToCamel<Path & string>}${Capitalize<string & key>}` : key & string}`]: (\n payload: MergeObject<\n {\n [key in Exclude<\n keyof Payload,\n 'identifier'\n > as `${key extends 'entities' ? never : key & string}`]: key extends 'entity'\n ? Entity\n : key extends 'ids'\n ? K[]\n : key extends 'newEntities'\n ? Entity[]\n : `Not implemented mapping for ${key & string}`;\n },\n HasStateIdentifier extends true\n ? {\n select: StateIdentifier extends (...args: any) => infer R\n ? R\n : never;\n }\n : {}\n >,\n ) => void;\n }\n >\n : 'No EntitiesBranded Name Detected'\n : false\n : Acc;\n\n/**\n * Creates an insertion that adds entity collection management methods to state, query, or queryParams primitives.\n *\n * Provides type-safe manipulation of arrays of entities with operations like add, remove, update, and upsert.\n * Supports nested properties via dot notation paths and custom entity identifiers.\n *\n * @template State - The state type (array or object containing arrays)\n * @template K - The type of entity identifiers (string or number)\n * @template PreviousInsertionsOutputs - Combined outputs from previous insertions\n * @template EntityHelperFns - Tuple type of entity utility functions to expose\n * @template StateIdentifier - Type of identifier function for parallel queries\n * @template Path - Dot-notation path to nested array (inferred from state structure)\n *\n * @param config - Configuration object\n * @param config.methods - Array of entity utility functions (addOne, removeOne, updateOne, etc.) to expose as methods\n * @param config.identifier - Optional custom function to extract unique ID from entities.\n * Defaults to `entity.id` for objects or `entity` for primitives\n * @param config.path - Optional dot-notation path to nested array property (e.g., 'catalog.products').\n * Method names are prefixed with camelCase path when provided\n *\n * @returns Insertion function that adds entity management methods to the primitive\n *\n * @example\n * // Basic usage with primitives\n * const tags = yield* state(\n * [] as string[],\n * insertEntities({\n * methods: [addOne, addMany, removeOne],\n * })\n * ));\n * yield* tags.addOne({ entity: 'typescript' });\n * yield* tags.addMany({ newEntities: ['angular', 'signals'] });\n *\n * @example\n * // With objects having default id property\n * interface Product {\n * id: string;\n * name: string;\n * price: number;\n * }\n * const products = yield* state(\n * [] as Product[],\n * insertEntities({\n * methods: [addOne, setOne, removeOne],\n * })\n * ));\n * yield* products.addOne({ entity: { id: '1', name: 'Laptop', price: 999 } });\n *\n * @example\n * // With custom identifier\n * interface User {\n * uuid: string;\n * name: string;\n * }\n * const users = yield* state(\n * [] as User[],\n * insertEntities({\n * methods: [setOne, removeOne],\n * identifier: (user) => user.uuid,\n * })\n * ));\n *\n * @example\n * // With nested path\n * interface Catalog {\n * total: number;\n * products: Array<{ id: string; name: string }>;\n * }\n * const catalog = yield* state(\n * { total: 0, products: [] } as Catalog,\n * insertEntities({\n * methods: [addMany, removeOne],\n * path: 'products',\n * })\n * ));\n * yield* catalog.productsAddMany({ newEntities: [{ id: '1', name: 'Item' }] });\n *\n * @example\n * // With parallel queries\n * const userQuery = yield* query(\n * {\n * params: () => 'userId',\n * identifier: (params) => params,\n * loader: async ({ params }) => fetchUserPosts(params),\n * },\n * insertEntities({\n * methods: [addOne],\n * })\n * ));\n * yield* userQuery.addOne({\n * select: 'user-123', // Target specific query instance\n * entity: { id: 'post-1', title: 'New Post' },\n * });\n *\n * @see {@link https://github.com/craft-ts/craft-ts/blob/main/apps/docs/insertions/insert-entities.md | insertEntities Documentation}\n */\nexport function insertEntities<\n State,\n K extends string | number,\n PreviousInsertionsOutputs,\n const EntityHelperFns extends unknown[],\n StateIdentifier,\n const Path = State extends Array<infer Entity>\n ? never\n : State extends object\n ? ArrayObjectDeepPath<State>\n : never,\n StateType = State extends Array<infer R>\n ? R\n : State extends object\n ? Path extends string\n ? AccessTypeObjectPropertyByDottedPath<\n State,\n DottedPathPathToTuple<Path>\n > extends Array<infer Entity>\n ? Entity\n : never\n : never\n : never,\n HasStateIdentifier = [unknown] extends [StateIdentifier]\n ? false\n : StateIdentifier extends (...args: any) => infer R\n ? [unknown] extends [R]\n ? false\n : true\n : false,\n IsEntityIdentifierOptional = StateType extends { id: NoInfer<K> }\n ? true\n : StateType extends string | number\n ? true\n : false,\n>(\n config: {\n methods: EntityHelperFns;\n } & MergeObject<\n IsEntityIdentifierOptional extends true\n ? {\n identifier?: IdSelector<NoInfer<StateType>, NoInfer<K>>;\n }\n : {\n identifier: IdSelector<NoInfer<StateType>, NoInfer<K>>;\n },\n [Path] extends [never]\n ? {}\n : {\n path: Path;\n }\n >,\n) {\n return (\n context: InsertionStateFactoryContext<State, PreviousInsertionsOutputs> & {\n identifier?: StateIdentifier;\n },\n ) => {\n const methods: Record<string, (payload: unknown) => void> = {};\n const hasPath = 'path' in config;\n const path = hasPath ? (config as { path: string }).path : undefined;\n const pathKeys = path ? path.split('.') : undefined;\n const pathMethodPrefix = pathKeys\n ? pathKeys.reduce(\n (acc, key, index) =>\n index === 0 ? key : `${acc}${key[0].toUpperCase()}${key.slice(1)}`,\n '',\n )\n : undefined;\n\n for (const helperFn of config.methods as Array<\n ((data: Record<string, unknown>) => StateType[]) & { name: string }\n >) {\n const helperName = helperFn.name;\n if (!helperName) {\n continue;\n }\n const methodName = hasPath\n ? `${pathMethodPrefix}${helperName[0].toUpperCase()}${helperName.slice(1)}`\n : helperName;\n\n methods[methodName] = (payload: any) => {\n context.update((state) => {\n const hasSelect = 'select' in payload && payload.select;\n const targetState = hasSelect\n ? (state as any)[payload.select as number]\n : state;\n const entities = pathKeys\n ? getNestedStateValue({\n state: targetState,\n keysPath: pathKeys,\n })\n : targetState;\n const updatedEntities = helperFn({\n ...(payload as Record<string, unknown>),\n entities,\n identifier: config.identifier,\n });\n\n if (hasSelect) {\n const updatedTargetState = pathKeys\n ? createNestedStateUpdate({\n state: targetState,\n keysPath: pathKeys,\n value: updatedEntities,\n })\n : updatedEntities;\n return {\n ...(state as any),\n [payload.select as number]: updatedTargetState,\n } as any;\n }\n\n if (pathKeys) {\n return createNestedStateUpdate({\n state,\n keysPath: pathKeys,\n value: updatedEntities,\n });\n }\n\n return updatedEntities;\n });\n };\n }\n return methods as Prettify<\n EntitiesUtilsToMap<\n EntityHelperFns,\n StateType,\n K,\n HasStateIdentifier,\n StateIdentifier,\n 'path' extends keyof typeof config ? true : false,\n Path\n >\n > & {\n testState: State;\n testPath: Path;\n testHasPath: 'path' extends keyof typeof config ? true : false;\n };\n };\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { InsertionStateFactoryContext } from './query.core';
|
|
2
|
+
/**
|
|
3
|
+
* No-op insertion used to preserve contextual typing in insertion chains of
|
|
4
|
+
* the form-tree helpers (`insertForm` / `insertSelectFormTree`), which keep a
|
|
5
|
+
* variadic signature.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* `insertSelectFormTree('name', insertNoopTypingAnchor, insertFormAttributes(...))`
|
|
9
|
+
*
|
|
10
|
+
* It is NOT needed with `insertSelect`: use
|
|
11
|
+
* `insertSelect('grid', (gridContext) => craftPipe(gridContext, ...))`,
|
|
12
|
+
* which preserves nested contextual typing by itself.
|
|
13
|
+
*/
|
|
14
|
+
export declare function insertNoopTypingAnchor<StateType, PreviousInsertionsOutputs = {}>(_context: InsertionStateFactoryContext<StateType, PreviousInsertionsOutputs>): {};
|
|
15
|
+
//# sourceMappingURL=insert-noop-typing-anchor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert-noop-typing-anchor.d.ts","sourceRoot":"","sources":["../../../../../libs/core/src/lib/insert-noop-typing-anchor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAEjE;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EACT,yBAAyB,GAAG,EAAE,EAE9B,QAAQ,EAAE,4BAA4B,CAAC,SAAS,EAAE,yBAAyB,CAAC,GAC3E,EAAE,CAEJ"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No-op insertion used to preserve contextual typing in insertion chains of
|
|
3
|
+
* the form-tree helpers (`insertForm` / `insertSelectFormTree`), which keep a
|
|
4
|
+
* variadic signature.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* `insertSelectFormTree('name', insertNoopTypingAnchor, insertFormAttributes(...))`
|
|
8
|
+
*
|
|
9
|
+
* It is NOT needed with `insertSelect`: use
|
|
10
|
+
* `insertSelect('grid', (gridContext) => craftPipe(gridContext, ...))`,
|
|
11
|
+
* which preserves nested contextual typing by itself.
|
|
12
|
+
*/
|
|
13
|
+
export function insertNoopTypingAnchor(_context) {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=insert-noop-typing-anchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert-noop-typing-anchor.js","sourceRoot":"","sources":["../../../../../libs/core/src/lib/insert-noop-typing-anchor.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,sBAAsB,CAIpC,QAA4E;IAE5E,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import type { InsertionStateFactoryContext } from './query.core';\n\n/**\n * No-op insertion used to preserve contextual typing in insertion chains of\n * the form-tree helpers (`insertForm` / `insertSelectFormTree`), which keep a\n * variadic signature.\n *\n * Usage:\n * `insertSelectFormTree('name', insertNoopTypingAnchor, insertFormAttributes(...))`\n *\n * It is NOT needed with `insertSelect`: use\n * `insertSelect('grid', (gridContext) => craftPipe(gridContext, ...))`,\n * which preserves nested contextual typing by itself.\n */\nexport function insertNoopTypingAnchor<\n StateType,\n PreviousInsertionsOutputs = {},\n>(\n _context: InsertionStateFactoryContext<StateType, PreviousInsertionsOutputs>,\n): {} {\n return {};\n}\n"]}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Signal } from './host/craft-compat';
|
|
2
|
+
import { type CraftSettledBrand } from './craft-settled';
|
|
3
|
+
import { InsertionByIdParams, ResourceExceptionConstraints, YieldableInsertionWrite } from './query.core';
|
|
4
|
+
import { CraftResourceStatus } from './util/craft-resource-status';
|
|
5
|
+
import { type YieldableReactiveValue } from './reactive-read';
|
|
6
|
+
/**
|
|
7
|
+
* Base outputs produced by {@link insertPaginationPlaceholderData}.
|
|
8
|
+
*
|
|
9
|
+
* - `currentPageData`: the current page data, or the previous page data while the
|
|
10
|
+
* next page is loading (placeholder). Never `undefined`: falls back to `initialValue`.
|
|
11
|
+
* - `currentPageStatus`: the `CraftResourceStatus` of the current page.
|
|
12
|
+
* - `isPlaceHolderData`: whether placeholder (previous page) data is currently shown.
|
|
13
|
+
* - `currentIdentifier`: the identifier of the current page.
|
|
14
|
+
*/
|
|
15
|
+
export type PaginationBaseOutputs<PageState, PrimitiveName extends string = string, SettledExceptions = never> = {
|
|
16
|
+
currentPageData: Signal<PageState>;
|
|
17
|
+
currentPageStatus: YieldableReactiveValue<CraftResourceStatus, 'currentPageStatus'> & CraftSettledBrand<PrimitiveName, SettledExceptions>;
|
|
18
|
+
isPlaceHolderData: Signal<boolean>;
|
|
19
|
+
currentIdentifier: Signal<string>;
|
|
20
|
+
};
|
|
21
|
+
type PublicPaginationBaseOutputs<PageState, PrimitiveName extends string = string, SettledExceptions = never> = {
|
|
22
|
+
currentPageData: YieldableReactiveValue<PageState, 'currentPageData'>;
|
|
23
|
+
currentPageStatus: YieldableReactiveValue<CraftResourceStatus, 'currentPageStatus'> & CraftSettledBrand<PrimitiveName, SettledExceptions>;
|
|
24
|
+
isPlaceHolderData: YieldableReactiveValue<boolean, 'isPlaceHolderData'>;
|
|
25
|
+
currentIdentifier: YieldableReactiveValue<string, 'currentIdentifier'>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Passthrough pieces of the underlying insertion context exposed to the `build` callback.
|
|
29
|
+
*/
|
|
30
|
+
type PaginationContextPassthrough<PageState, PrimitiveName extends string = string, Exceptions extends ResourceExceptionConstraints = ResourceExceptionConstraints> = Pick<InsertionByIdParams<string, PageState & object, unknown, Exceptions, {}, PrimitiveName>, 'resourceById' | 'resourceParamsSrc' | 'identifier' | 'hasException' | 'exceptions' | 'settledState'>;
|
|
31
|
+
/**
|
|
32
|
+
* Context passed to the optional `build` callback of {@link insertPaginationPlaceholderData}.
|
|
33
|
+
*
|
|
34
|
+
* In addition to the base pagination outputs, it exposes helpers scoped to the
|
|
35
|
+
* **current page** (the data displayed), so custom computed/methods act on the
|
|
36
|
+
* page the user is looking at rather than the global `Record<id, State>`.
|
|
37
|
+
*/
|
|
38
|
+
export type PaginationBuildContext<PageState, PrimitiveName extends string = string, Exceptions extends ResourceExceptionConstraints = ResourceExceptionConstraints> = PublicPaginationBaseOutputs<PageState, PrimitiveName, Exceptions['params'] | Exceptions['loader']> & {
|
|
39
|
+
/**
|
|
40
|
+
* The data on screen: the current page's, or the previous page's while the
|
|
41
|
+
* current one loads. Matches what `currentPageData` renders, so a derived
|
|
42
|
+
* count cannot disagree with the visible rows.
|
|
43
|
+
*/
|
|
44
|
+
state: YieldableReactiveValue<PageState, 'state'>;
|
|
45
|
+
/** Current page data only when the current page has settled; suspends otherwise. */
|
|
46
|
+
settledState: PaginationContextPassthrough<PageState, PrimitiveName, Exceptions>['settledState'];
|
|
47
|
+
/** Replace the current page data. No-op if the page is not loaded yet. */
|
|
48
|
+
set: YieldableInsertionWrite<[newValue: PageState], PageState>;
|
|
49
|
+
/** Update the current page data from its previous value. */
|
|
50
|
+
update: YieldableInsertionWrite<[
|
|
51
|
+
updateFn: (current: PageState) => PageState
|
|
52
|
+
], PageState>;
|
|
53
|
+
/** Patch the current page data with a partial value. */
|
|
54
|
+
patch: YieldableInsertionWrite<[
|
|
55
|
+
patchFn: (current: PageState) => Partial<PageState>
|
|
56
|
+
], PageState>;
|
|
57
|
+
} & PaginationContextPassthrough<PageState, PrimitiveName, Exceptions>;
|
|
58
|
+
/**
|
|
59
|
+
* Provides placeholder data during pagination transitions for a smoother user experience.
|
|
60
|
+
*
|
|
61
|
+
* When navigating between pages, this insertion shows the previous page's data while
|
|
62
|
+
* the new page is loading, avoiding empty states during transitions.
|
|
63
|
+
*
|
|
64
|
+
* It is a **higher-order insertion**: call it with a `config` (and an optional `build`
|
|
65
|
+
* callback) and pass the result to `query(...)`.
|
|
66
|
+
*
|
|
67
|
+
* - `config.initialValue` is both the default value **and** the type of a page: thanks to
|
|
68
|
+
* it, `currentPageData` is a yieldable reader for `PageState` and is never `undefined`.
|
|
69
|
+
* - The optional `build` callback lets you attach custom outputs (computed/methods)
|
|
70
|
+
* alongside the pagination outputs. Its helpers (`state`, `set`, `update`, `patch`)
|
|
71
|
+
* are scoped to the **current page** (the displayed data), never the global record.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const pagination = signal(1);
|
|
76
|
+
*
|
|
77
|
+
* const userQuery = yield* query(
|
|
78
|
+
* {
|
|
79
|
+
* params: pagination,
|
|
80
|
+
* identifier: (params) => '' + params,
|
|
81
|
+
* loader: async ({ params: page }) => fetchUsers(page),
|
|
82
|
+
* },
|
|
83
|
+
* insertPaginationPlaceholderData({ initialValue: [] as User[] }),
|
|
84
|
+
* ));
|
|
85
|
+
*
|
|
86
|
+
* // Access the data (or placeholder during loading) — never undefined
|
|
87
|
+
* const data = yield* userQuery.currentPageData();
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* With custom outputs via `build`:
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const usersQuery = yield* query(
|
|
94
|
+
* {
|
|
95
|
+
* params: pagination,
|
|
96
|
+
* identifier: (params) => `${params.page}-${params.pageSize}`,
|
|
97
|
+
* loader: function* ({ params }) {
|
|
98
|
+
* return yield* ApiService.getDataList(params);
|
|
99
|
+
* },
|
|
100
|
+
* },
|
|
101
|
+
* insertPaginationPlaceholderData(
|
|
102
|
+
* { initialValue: [] as Data[] },
|
|
103
|
+
* ({ state, set }) => ({
|
|
104
|
+
* totalOfUnCompletedData: craftComputed(function* () {
|
|
105
|
+
* return (yield* state()).filter((d) => !d.completed).length;
|
|
106
|
+
* }),
|
|
107
|
+
* markAsCompleted: function* (id: string) {
|
|
108
|
+
* const current = yield* state();
|
|
109
|
+
* return yield* set(
|
|
110
|
+
* current.map((d) => (d.id === id ? { ...d, completed: true } : d)),
|
|
111
|
+
* );
|
|
112
|
+
* },
|
|
113
|
+
* }),
|
|
114
|
+
* ),
|
|
115
|
+
* ));
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
export declare function insertPaginationPlaceholderData<PageState, ExtraOutputs extends Record<string, unknown> = {}>(config: {
|
|
119
|
+
initialValue: PageState;
|
|
120
|
+
}, build?: (context: PaginationBuildContext<PageState>) => ExtraOutputs): <GroupIdentifier extends string, ResourceParams, Exceptions extends ResourceExceptionConstraints, PreviousInsertionsOutputs, PrimitiveName extends string>(context: InsertionByIdParams<GroupIdentifier, PageState & object, ResourceParams, Exceptions, NoInfer<PreviousInsertionsOutputs>, PrimitiveName>) => PaginationBaseOutputs<PageState, PrimitiveName, Exceptions["params"] | Exceptions["loader"]> & ExtraOutputs;
|
|
121
|
+
export {};
|
|
122
|
+
//# sourceMappingURL=insert-pagination-placeholder-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert-pagination-placeholder-data.d.ts","sourceRoot":"","sources":["../../../../../libs/core/src/lib/insert-pagination-placeholder-data.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { craftComputed } from './craft-computed';
|
|
2
|
+
import { isGenerator } from './craft-generator-runtime';
|
|
3
|
+
import { settled } from './craft-settled';
|
|
4
|
+
import { toCraftStatus, } from './util/craft-resource-status';
|
|
5
|
+
import { createYieldableReactiveFacade, rawReactiveFacade, } from './reactive-read';
|
|
6
|
+
function* readPaginationReactive(reader) {
|
|
7
|
+
const value = reader();
|
|
8
|
+
return isGenerator(value) ? yield* value : value;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Provides placeholder data during pagination transitions for a smoother user experience.
|
|
12
|
+
*
|
|
13
|
+
* When navigating between pages, this insertion shows the previous page's data while
|
|
14
|
+
* the new page is loading, avoiding empty states during transitions.
|
|
15
|
+
*
|
|
16
|
+
* It is a **higher-order insertion**: call it with a `config` (and an optional `build`
|
|
17
|
+
* callback) and pass the result to `query(...)`.
|
|
18
|
+
*
|
|
19
|
+
* - `config.initialValue` is both the default value **and** the type of a page: thanks to
|
|
20
|
+
* it, `currentPageData` is a yieldable reader for `PageState` and is never `undefined`.
|
|
21
|
+
* - The optional `build` callback lets you attach custom outputs (computed/methods)
|
|
22
|
+
* alongside the pagination outputs. Its helpers (`state`, `set`, `update`, `patch`)
|
|
23
|
+
* are scoped to the **current page** (the displayed data), never the global record.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const pagination = signal(1);
|
|
28
|
+
*
|
|
29
|
+
* const userQuery = yield* query(
|
|
30
|
+
* {
|
|
31
|
+
* params: pagination,
|
|
32
|
+
* identifier: (params) => '' + params,
|
|
33
|
+
* loader: async ({ params: page }) => fetchUsers(page),
|
|
34
|
+
* },
|
|
35
|
+
* insertPaginationPlaceholderData({ initialValue: [] as User[] }),
|
|
36
|
+
* ));
|
|
37
|
+
*
|
|
38
|
+
* // Access the data (or placeholder during loading) — never undefined
|
|
39
|
+
* const data = yield* userQuery.currentPageData();
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* With custom outputs via `build`:
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const usersQuery = yield* query(
|
|
46
|
+
* {
|
|
47
|
+
* params: pagination,
|
|
48
|
+
* identifier: (params) => `${params.page}-${params.pageSize}`,
|
|
49
|
+
* loader: function* ({ params }) {
|
|
50
|
+
* return yield* ApiService.getDataList(params);
|
|
51
|
+
* },
|
|
52
|
+
* },
|
|
53
|
+
* insertPaginationPlaceholderData(
|
|
54
|
+
* { initialValue: [] as Data[] },
|
|
55
|
+
* ({ state, set }) => ({
|
|
56
|
+
* totalOfUnCompletedData: craftComputed(function* () {
|
|
57
|
+
* return (yield* state()).filter((d) => !d.completed).length;
|
|
58
|
+
* }),
|
|
59
|
+
* markAsCompleted: function* (id: string) {
|
|
60
|
+
* const current = yield* state();
|
|
61
|
+
* return yield* set(
|
|
62
|
+
* current.map((d) => (d.id === id ? { ...d, completed: true } : d)),
|
|
63
|
+
* );
|
|
64
|
+
* },
|
|
65
|
+
* }),
|
|
66
|
+
* ),
|
|
67
|
+
* ));
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export function insertPaginationPlaceholderData(config, build) {
|
|
71
|
+
// The returned factory is generic over the query's shape (GroupIdentifier,
|
|
72
|
+
// ResourceParams, Exceptions, PreviousInsertionsOutputs) so it adapts to any
|
|
73
|
+
// query and its context stays precisely typed. Note: since the primitives
|
|
74
|
+
// wrap every shape generic of their insertion slot in `NoInfer` (including
|
|
75
|
+
// `Exceptions`), a factory can no longer degrade the primitive's inference —
|
|
76
|
+
// the generic shape here is about the factory's own context typing. Only
|
|
77
|
+
// `ResourceState` is fixed, to `PageState` (inferred from `config.initialValue`).
|
|
78
|
+
return (context) => {
|
|
79
|
+
const { resourceById, resourceParamsSrc, identifier, hasException, exceptions, settledState, } = context;
|
|
80
|
+
/**
|
|
81
|
+
* The rows currently on screen, whichever page they came from.
|
|
82
|
+
*
|
|
83
|
+
* This used to be tracked as a previous page KEY, which could not survive
|
|
84
|
+
* the case it exists for: on a page change the incoming page has no
|
|
85
|
+
* resource yet, so there was no 'loading' status to recognise, the
|
|
86
|
+
* placeholder branch was skipped, and the key was overwritten with the new
|
|
87
|
+
* page before it could ever be used — the list blanked on every
|
|
88
|
+
* navigation. Holding the VALUE needs neither the old resource to still be
|
|
89
|
+
* cached nor the new one to exist yet.
|
|
90
|
+
*/
|
|
91
|
+
let lastShownValue;
|
|
92
|
+
const currentPageValue = function* () {
|
|
93
|
+
const page = yield* readPaginationReactive(resourceParamsSrc);
|
|
94
|
+
const resources = (yield* readPaginationReactive(resourceById));
|
|
95
|
+
const pageKey = page != null ? identifier(page) : undefined;
|
|
96
|
+
return {
|
|
97
|
+
pageKey,
|
|
98
|
+
hasOwnValue: pageKey !== undefined && resources[pageKey]?.value() !== undefined,
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
const showPlaceHolderData = craftComputed('showPlaceHolderData', function* () {
|
|
102
|
+
const { pageKey, hasOwnValue } = yield* currentPageValue();
|
|
103
|
+
if (!pageKey) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
// Placeholder: the page in the URL has nothing of its own yet, and
|
|
107
|
+
// rows from an earlier one are still on screen.
|
|
108
|
+
return !hasOwnValue && lastShownValue !== undefined;
|
|
109
|
+
});
|
|
110
|
+
const currentPageData = craftComputed('currentPageData', function* () {
|
|
111
|
+
const { pageKey, hasOwnValue } = yield* currentPageValue();
|
|
112
|
+
if (pageKey !== undefined && hasOwnValue) {
|
|
113
|
+
const settled = (yield* settledState());
|
|
114
|
+
lastShownValue = settled;
|
|
115
|
+
return settled;
|
|
116
|
+
}
|
|
117
|
+
if (lastShownValue === undefined) {
|
|
118
|
+
const resources = (yield* readPaginationReactive(resourceById));
|
|
119
|
+
// A page can change before its rows were read (for example, a store
|
|
120
|
+
// test can wait only for the loader). Recover the most recently
|
|
121
|
+
// inserted resolved page so the placeholder still has something to
|
|
122
|
+
// display while the new page is loading.
|
|
123
|
+
for (const resource of Object.values(resources).reverse()) {
|
|
124
|
+
const value = resource?.value();
|
|
125
|
+
if (value !== undefined) {
|
|
126
|
+
lastShownValue = value;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// Nothing for this page yet: keep what is already on screen instead of
|
|
132
|
+
// blanking the list, which is the entire point of the placeholder.
|
|
133
|
+
return lastShownValue ?? config.initialValue;
|
|
134
|
+
});
|
|
135
|
+
const currentPageStatus = craftComputed('currentPageStatus', function* () {
|
|
136
|
+
const page = yield* readPaginationReactive(resourceParamsSrc);
|
|
137
|
+
const resources = (yield* readPaginationReactive(resourceById));
|
|
138
|
+
if (page == null) {
|
|
139
|
+
return 'idle'; // avoid to handle the undefined check
|
|
140
|
+
}
|
|
141
|
+
const pageKey = identifier(page);
|
|
142
|
+
const currentResource = resources[pageKey];
|
|
143
|
+
const currentExceptions = yield* readPaginationReactive(exceptions);
|
|
144
|
+
const hasCurrentPageException = Object.keys(currentExceptions.params ?? {}).length > 0 ||
|
|
145
|
+
currentExceptions.loader?.[pageKey] !== undefined;
|
|
146
|
+
// Status is also a settled read while the current page has no value.
|
|
147
|
+
// This makes the status binding suspend during the initial/page load,
|
|
148
|
+
// while preserving the visible exception status and stale status during
|
|
149
|
+
// reloads of an already resolved page.
|
|
150
|
+
if (!hasCurrentPageException && currentResource?.value() === undefined) {
|
|
151
|
+
yield* settled({ settledValue: settledState });
|
|
152
|
+
}
|
|
153
|
+
return toCraftStatus(currentResource?.status() ?? 'idle', hasCurrentPageException);
|
|
154
|
+
});
|
|
155
|
+
const currentIdentifier = craftComputed('currentIdentifier', function* () {
|
|
156
|
+
const page = yield* readPaginationReactive(resourceParamsSrc);
|
|
157
|
+
if (page == null) {
|
|
158
|
+
return '';
|
|
159
|
+
}
|
|
160
|
+
return identifier(page);
|
|
161
|
+
});
|
|
162
|
+
const baseOutputs = {
|
|
163
|
+
currentPageData,
|
|
164
|
+
currentPageStatus,
|
|
165
|
+
isPlaceHolderData: showPlaceHolderData,
|
|
166
|
+
currentIdentifier,
|
|
167
|
+
};
|
|
168
|
+
if (!build) {
|
|
169
|
+
return baseOutputs;
|
|
170
|
+
}
|
|
171
|
+
// Helpers scoped to the current page (the displayed data), not the global record.
|
|
172
|
+
const currentPageKey = () => {
|
|
173
|
+
const params = rawReactiveFacade(resourceParamsSrc)();
|
|
174
|
+
return params != null ? identifier(params) : undefined;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* What the page in the URL holds by itself — no placeholder.
|
|
178
|
+
*
|
|
179
|
+
* Writes are anchored here rather than on `state`: `set` targets the
|
|
180
|
+
* current page, so basing an update on rows that still belong to the
|
|
181
|
+
* PREVIOUS one would compute the new value from the wrong page.
|
|
182
|
+
*/
|
|
183
|
+
const currentPageOwnValue = () => {
|
|
184
|
+
const params = rawReactiveFacade(resourceParamsSrc)();
|
|
185
|
+
const resources = rawReactiveFacade(resourceById)();
|
|
186
|
+
const key = params != null ? identifier(params) : undefined;
|
|
187
|
+
const res = key ? resources[key] : undefined;
|
|
188
|
+
return res?.hasValue() ? res.value() : config.initialValue;
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* What the reader SEES, placeholder included — the same value the rows are
|
|
192
|
+
* rendered from.
|
|
193
|
+
*
|
|
194
|
+
* It used to report the current page's own data, which is `initialValue`
|
|
195
|
+
* for as long as that page is loading. Anything derived from it — a count,
|
|
196
|
+
* a summary — then contradicted the list still on screen: "0 on page"
|
|
197
|
+
* above four visible rows. `settledState` stays the strict reading for
|
|
198
|
+
* code that must wait for the page it actually asked for.
|
|
199
|
+
*/
|
|
200
|
+
const state = craftComputed('state', function* () {
|
|
201
|
+
return yield* currentPageData();
|
|
202
|
+
});
|
|
203
|
+
const set = function* (newValue) {
|
|
204
|
+
const key = currentPageKey();
|
|
205
|
+
if (key) {
|
|
206
|
+
// Use the page's CraftResourceRef directly. Do NOT use resourceById.set({...}),
|
|
207
|
+
// which is destructive: it resets keys absent from the payload.
|
|
208
|
+
// No-op if the page is not loaded yet (we only act on a displayed page).
|
|
209
|
+
const resources = rawReactiveFacade(resourceById)();
|
|
210
|
+
resources[key]?.set(newValue);
|
|
211
|
+
}
|
|
212
|
+
return newValue;
|
|
213
|
+
};
|
|
214
|
+
const update = function* (updateFn) {
|
|
215
|
+
return yield* set(updateFn(currentPageOwnValue()));
|
|
216
|
+
};
|
|
217
|
+
const patch = function* (patchFn) {
|
|
218
|
+
return yield* update((current) => ({ ...current, ...patchFn(current) }));
|
|
219
|
+
};
|
|
220
|
+
const publicBaseOutputs = createYieldableReactiveFacade(baseOutputs, {
|
|
221
|
+
name: 'pagination',
|
|
222
|
+
primitive: 'insertPaginationPlaceholderData',
|
|
223
|
+
path: 'pagination',
|
|
224
|
+
});
|
|
225
|
+
const extra = build({
|
|
226
|
+
...publicBaseOutputs,
|
|
227
|
+
state,
|
|
228
|
+
settledState,
|
|
229
|
+
set,
|
|
230
|
+
update,
|
|
231
|
+
patch,
|
|
232
|
+
resourceById,
|
|
233
|
+
resourceParamsSrc,
|
|
234
|
+
identifier,
|
|
235
|
+
hasException,
|
|
236
|
+
exceptions,
|
|
237
|
+
});
|
|
238
|
+
return {
|
|
239
|
+
...baseOutputs,
|
|
240
|
+
...extra,
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=insert-pagination-placeholder-data.js.map
|