@cohesivesystems/presentation-core 0.1.0-alpha.1
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 +55 -0
- package/dist/api-scope-request.d.ts +43 -0
- package/dist/api-scope-request.d.ts.map +1 -0
- package/dist/api-scope-request.js +96 -0
- package/dist/api-scope-request.js.map +1 -0
- package/dist/collection-chrome-icons.d.ts +18 -0
- package/dist/collection-chrome-icons.d.ts.map +1 -0
- package/dist/collection-chrome-icons.js +57 -0
- package/dist/collection-chrome-icons.js.map +1 -0
- package/dist/collection-chrome-runtime.d.ts +25 -0
- package/dist/collection-chrome-runtime.d.ts.map +1 -0
- package/dist/collection-chrome-runtime.js +72 -0
- package/dist/collection-chrome-runtime.js.map +1 -0
- package/dist/collection-chrome-slot-renderer-registry.d.ts +110 -0
- package/dist/collection-chrome-slot-renderer-registry.d.ts.map +1 -0
- package/dist/collection-chrome-slot-renderer-registry.js +136 -0
- package/dist/collection-chrome-slot-renderer-registry.js.map +1 -0
- package/dist/collection-selection-state.d.ts +18 -0
- package/dist/collection-selection-state.d.ts.map +1 -0
- package/dist/collection-selection-state.js +2 -0
- package/dist/collection-selection-state.js.map +1 -0
- package/dist/data-source-projection.d.ts +475 -0
- package/dist/data-source-projection.d.ts.map +1 -0
- package/dist/data-source-projection.js +880 -0
- package/dist/data-source-projection.js.map +1 -0
- package/dist/data-source-query-lowering.d.ts +35 -0
- package/dist/data-source-query-lowering.d.ts.map +1 -0
- package/dist/data-source-query-lowering.js +104 -0
- package/dist/data-source-query-lowering.js.map +1 -0
- package/dist/date-time-filter-model.d.ts +20 -0
- package/dist/date-time-filter-model.d.ts.map +1 -0
- package/dist/date-time-filter-model.js +115 -0
- package/dist/date-time-filter-model.js.map +1 -0
- package/dist/document-badge-icons.d.ts +4 -0
- package/dist/document-badge-icons.d.ts.map +1 -0
- package/dist/document-badge-icons.js +4 -0
- package/dist/document-badge-icons.js.map +1 -0
- package/dist/document-module.d.ts +268 -0
- package/dist/document-module.d.ts.map +1 -0
- package/dist/document-module.js +347 -0
- package/dist/document-module.js.map +1 -0
- package/dist/document-summary-model.d.ts +2 -0
- package/dist/document-summary-model.d.ts.map +1 -0
- package/dist/document-summary-model.js +2 -0
- package/dist/document-summary-model.js.map +1 -0
- package/dist/document-workspace-chrome-projection.d.ts +18 -0
- package/dist/document-workspace-chrome-projection.d.ts.map +1 -0
- package/dist/document-workspace-chrome-projection.js +35 -0
- package/dist/document-workspace-chrome-projection.js.map +1 -0
- package/dist/document-workspace-surface-slots.d.ts +75 -0
- package/dist/document-workspace-surface-slots.d.ts.map +1 -0
- package/dist/document-workspace-surface-slots.js +268 -0
- package/dist/document-workspace-surface-slots.js.map +1 -0
- package/dist/endpoint-executor.d.ts +62 -0
- package/dist/endpoint-executor.d.ts.map +1 -0
- package/dist/endpoint-executor.js +35 -0
- package/dist/endpoint-executor.js.map +1 -0
- package/dist/field-display-resolution.d.ts +5 -0
- package/dist/field-display-resolution.d.ts.map +1 -0
- package/dist/field-display-resolution.js +50 -0
- package/dist/field-display-resolution.js.map +1 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +89 -0
- package/dist/index.js.map +1 -0
- package/dist/module.d.ts +48 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +108 -0
- package/dist/module.js.map +1 -0
- package/dist/navigation-shell-frame-renderer-registry.d.ts +12 -0
- package/dist/navigation-shell-frame-renderer-registry.d.ts.map +1 -0
- package/dist/navigation-shell-frame-renderer-registry.js +29 -0
- package/dist/navigation-shell-frame-renderer-registry.js.map +1 -0
- package/dist/navigation-shell-layout-runtime.d.ts +29 -0
- package/dist/navigation-shell-layout-runtime.d.ts.map +1 -0
- package/dist/navigation-shell-layout-runtime.js +50 -0
- package/dist/navigation-shell-layout-runtime.js.map +1 -0
- package/dist/navigation-shell-region-component-registry.d.ts +96 -0
- package/dist/navigation-shell-region-component-registry.d.ts.map +1 -0
- package/dist/navigation-shell-region-component-registry.js +108 -0
- package/dist/navigation-shell-region-component-registry.js.map +1 -0
- package/dist/navigation-shell-runtime.d.ts +48 -0
- package/dist/navigation-shell-runtime.d.ts.map +1 -0
- package/dist/navigation-shell-runtime.js +457 -0
- package/dist/navigation-shell-runtime.js.map +1 -0
- package/dist/navigation-shell-slot-renderer-registry.d.ts +15 -0
- package/dist/navigation-shell-slot-renderer-registry.d.ts.map +1 -0
- package/dist/navigation-shell-slot-renderer-registry.js +48 -0
- package/dist/navigation-shell-slot-renderer-registry.js.map +1 -0
- package/dist/navigation.d.ts +84 -0
- package/dist/navigation.d.ts.map +1 -0
- package/dist/navigation.js +167 -0
- package/dist/navigation.js.map +1 -0
- package/dist/object-path.d.ts +23 -0
- package/dist/object-path.d.ts.map +1 -0
- package/dist/object-path.js +63 -0
- package/dist/object-path.js.map +1 -0
- package/dist/page-host-renderer-registry.d.ts +119 -0
- package/dist/page-host-renderer-registry.d.ts.map +1 -0
- package/dist/page-host-renderer-registry.js +305 -0
- package/dist/page-host-renderer-registry.js.map +1 -0
- package/dist/presentation-action-endpoint-request-projection.d.ts +23 -0
- package/dist/presentation-action-endpoint-request-projection.d.ts.map +1 -0
- package/dist/presentation-action-endpoint-request-projection.js +117 -0
- package/dist/presentation-action-endpoint-request-projection.js.map +1 -0
- package/dist/presentation-action-endpoint.d.ts +24 -0
- package/dist/presentation-action-endpoint.d.ts.map +1 -0
- package/dist/presentation-action-endpoint.js +56 -0
- package/dist/presentation-action-endpoint.js.map +1 -0
- package/dist/presentation-action-icons.d.ts +4 -0
- package/dist/presentation-action-icons.d.ts.map +1 -0
- package/dist/presentation-action-icons.js +4 -0
- package/dist/presentation-action-icons.js.map +1 -0
- package/dist/presentation-action-result-state.d.ts +48 -0
- package/dist/presentation-action-result-state.d.ts.map +1 -0
- package/dist/presentation-action-result-state.js +109 -0
- package/dist/presentation-action-result-state.js.map +1 -0
- package/dist/presentation-action-runtime-binding.d.ts +48 -0
- package/dist/presentation-action-runtime-binding.d.ts.map +1 -0
- package/dist/presentation-action-runtime-binding.js +52 -0
- package/dist/presentation-action-runtime-binding.js.map +1 -0
- package/dist/presentation-action-runtime-diagnostics.d.ts +18 -0
- package/dist/presentation-action-runtime-diagnostics.d.ts.map +1 -0
- package/dist/presentation-action-runtime-diagnostics.js +69 -0
- package/dist/presentation-action-runtime-diagnostics.js.map +1 -0
- package/dist/presentation-action-runtime-labels.d.ts +15 -0
- package/dist/presentation-action-runtime-labels.d.ts.map +1 -0
- package/dist/presentation-action-runtime-labels.js +28 -0
- package/dist/presentation-action-runtime-labels.js.map +1 -0
- package/dist/presentation-action-runtime-projection.d.ts +17 -0
- package/dist/presentation-action-runtime-projection.d.ts.map +1 -0
- package/dist/presentation-action-runtime-projection.js +31 -0
- package/dist/presentation-action-runtime-projection.js.map +1 -0
- package/dist/presentation-badge-resolution.d.ts +8 -0
- package/dist/presentation-badge-resolution.d.ts.map +1 -0
- package/dist/presentation-badge-resolution.js +73 -0
- package/dist/presentation-badge-resolution.js.map +1 -0
- package/dist/presentation-collection-pagination.d.ts +32 -0
- package/dist/presentation-collection-pagination.d.ts.map +1 -0
- package/dist/presentation-collection-pagination.js +275 -0
- package/dist/presentation-collection-pagination.js.map +1 -0
- package/dist/presentation-content-diagnostics.d.ts +17 -0
- package/dist/presentation-content-diagnostics.d.ts.map +1 -0
- package/dist/presentation-content-diagnostics.js +61 -0
- package/dist/presentation-content-diagnostics.js.map +1 -0
- package/dist/presentation-content-resolution.d.ts +9 -0
- package/dist/presentation-content-resolution.d.ts.map +1 -0
- package/dist/presentation-content-resolution.js +19 -0
- package/dist/presentation-content-resolution.js.map +1 -0
- package/dist/presentation-data-source-binding-model.d.ts +81 -0
- package/dist/presentation-data-source-binding-model.d.ts.map +1 -0
- package/dist/presentation-data-source-binding-model.js +56 -0
- package/dist/presentation-data-source-binding-model.js.map +1 -0
- package/dist/presentation-data-source-runtime.d.ts +62 -0
- package/dist/presentation-data-source-runtime.d.ts.map +1 -0
- package/dist/presentation-data-source-runtime.js +80 -0
- package/dist/presentation-data-source-runtime.js.map +1 -0
- package/dist/presentation-design-intent-diagnostics.d.ts +25 -0
- package/dist/presentation-design-intent-diagnostics.d.ts.map +1 -0
- package/dist/presentation-design-intent-diagnostics.js +55 -0
- package/dist/presentation-design-intent-diagnostics.js.map +1 -0
- package/dist/presentation-icon-diagnostics.d.ts +45 -0
- package/dist/presentation-icon-diagnostics.d.ts.map +1 -0
- package/dist/presentation-icon-diagnostics.js +235 -0
- package/dist/presentation-icon-diagnostics.js.map +1 -0
- package/dist/presentation-icon-registry.d.ts +36 -0
- package/dist/presentation-icon-registry.d.ts.map +1 -0
- package/dist/presentation-icon-registry.js +81 -0
- package/dist/presentation-icon-registry.js.map +1 -0
- package/dist/presentation-navigation-action-runtime-bindings.d.ts +13 -0
- package/dist/presentation-navigation-action-runtime-bindings.d.ts.map +1 -0
- package/dist/presentation-navigation-action-runtime-bindings.js +29 -0
- package/dist/presentation-navigation-action-runtime-bindings.js.map +1 -0
- package/dist/presentation-pagination.d.ts +98 -0
- package/dist/presentation-pagination.d.ts.map +1 -0
- package/dist/presentation-pagination.js +427 -0
- package/dist/presentation-pagination.js.map +1 -0
- package/dist/presentation-projection-coverage.d.ts +38 -0
- package/dist/presentation-projection-coverage.d.ts.map +1 -0
- package/dist/presentation-projection-coverage.js +2429 -0
- package/dist/presentation-projection-coverage.js.map +1 -0
- package/dist/presentation-projection-diagnostics.d.ts +33 -0
- package/dist/presentation-projection-diagnostics.d.ts.map +1 -0
- package/dist/presentation-projection-diagnostics.js +17 -0
- package/dist/presentation-projection-diagnostics.js.map +1 -0
- package/dist/presentation-projection-trace.d.ts +97 -0
- package/dist/presentation-projection-trace.d.ts.map +1 -0
- package/dist/presentation-projection-trace.js +110 -0
- package/dist/presentation-projection-trace.js.map +1 -0
- package/dist/presentation-query-form-state.d.ts +15 -0
- package/dist/presentation-query-form-state.d.ts.map +1 -0
- package/dist/presentation-query-form-state.js +20 -0
- package/dist/presentation-query-form-state.js.map +1 -0
- package/dist/presentation-renderer-registry.d.ts +86 -0
- package/dist/presentation-renderer-registry.d.ts.map +1 -0
- package/dist/presentation-renderer-registry.js +108 -0
- package/dist/presentation-renderer-registry.js.map +1 -0
- package/dist/presentation-semantics.d.ts +288 -0
- package/dist/presentation-semantics.d.ts.map +1 -0
- package/dist/presentation-semantics.js +560 -0
- package/dist/presentation-semantics.js.map +1 -0
- package/dist/presentation-standards.d.ts +8 -0
- package/dist/presentation-standards.d.ts.map +1 -0
- package/dist/presentation-standards.js +9 -0
- package/dist/presentation-standards.js.map +1 -0
- package/dist/presentation-test-selectors.d.ts +146 -0
- package/dist/presentation-test-selectors.d.ts.map +1 -0
- package/dist/presentation-test-selectors.js +113 -0
- package/dist/presentation-test-selectors.js.map +1 -0
- package/dist/presentation-value-formatting.d.ts +12 -0
- package/dist/presentation-value-formatting.d.ts.map +1 -0
- package/dist/presentation-value-formatting.js +33 -0
- package/dist/presentation-value-formatting.js.map +1 -0
- package/dist/presentation-value-resolution.d.ts +7 -0
- package/dist/presentation-value-resolution.d.ts.map +1 -0
- package/dist/presentation-value-resolution.js +69 -0
- package/dist/presentation-value-resolution.js.map +1 -0
- package/dist/presentation-view-tree.d.ts +6 -0
- package/dist/presentation-view-tree.d.ts.map +1 -0
- package/dist/presentation-view-tree.js +15 -0
- package/dist/presentation-view-tree.js.map +1 -0
- package/dist/process-task-model.d.ts +80 -0
- package/dist/process-task-model.d.ts.map +1 -0
- package/dist/process-task-model.js +52 -0
- package/dist/process-task-model.js.map +1 -0
- package/dist/process-task-projection.d.ts +46 -0
- package/dist/process-task-projection.d.ts.map +1 -0
- package/dist/process-task-projection.js +233 -0
- package/dist/process-task-projection.js.map +1 -0
- package/dist/projected-action-status-projection.d.ts +18 -0
- package/dist/projected-action-status-projection.d.ts.map +1 -0
- package/dist/projected-action-status-projection.js +19 -0
- package/dist/projected-action-status-projection.js.map +1 -0
- package/dist/projected-activity-state-model.d.ts +22 -0
- package/dist/projected-activity-state-model.d.ts.map +1 -0
- package/dist/projected-activity-state-model.js +87 -0
- package/dist/projected-activity-state-model.js.map +1 -0
- package/dist/projected-collection-action-runtime-bindings.d.ts +12 -0
- package/dist/projected-collection-action-runtime-bindings.d.ts.map +1 -0
- package/dist/projected-collection-action-runtime-bindings.js +37 -0
- package/dist/projected-collection-action-runtime-bindings.js.map +1 -0
- package/dist/projected-collection-action-runtime-diagnostics.d.ts +23 -0
- package/dist/projected-collection-action-runtime-diagnostics.d.ts.map +1 -0
- package/dist/projected-collection-action-runtime-diagnostics.js +168 -0
- package/dist/projected-collection-action-runtime-diagnostics.js.map +1 -0
- package/dist/projected-collection-runtime.d.ts +475 -0
- package/dist/projected-collection-runtime.d.ts.map +1 -0
- package/dist/projected-collection-runtime.js +832 -0
- package/dist/projected-collection-runtime.js.map +1 -0
- package/dist/projected-document-action-diagnostics.d.ts +16 -0
- package/dist/projected-document-action-diagnostics.d.ts.map +1 -0
- package/dist/projected-document-action-diagnostics.js +113 -0
- package/dist/projected-document-action-diagnostics.js.map +1 -0
- package/dist/projected-document-action-enablements.d.ts +25 -0
- package/dist/projected-document-action-enablements.d.ts.map +1 -0
- package/dist/projected-document-action-enablements.js +38 -0
- package/dist/projected-document-action-enablements.js.map +1 -0
- package/dist/projected-document-action-projection.d.ts +45 -0
- package/dist/projected-document-action-projection.d.ts.map +1 -0
- package/dist/projected-document-action-projection.js +201 -0
- package/dist/projected-document-action-projection.js.map +1 -0
- package/dist/projected-document-action-runtime-profile-diagnostics.d.ts +16 -0
- package/dist/projected-document-action-runtime-profile-diagnostics.d.ts.map +1 -0
- package/dist/projected-document-action-runtime-profile-diagnostics.js +168 -0
- package/dist/projected-document-action-runtime-profile-diagnostics.js.map +1 -0
- package/dist/projected-document-action-runtime-profile.d.ts +64 -0
- package/dist/projected-document-action-runtime-profile.d.ts.map +1 -0
- package/dist/projected-document-action-runtime-profile.js +33 -0
- package/dist/projected-document-action-runtime-profile.js.map +1 -0
- package/dist/projected-document-action-status-notice-diagnostics.d.ts +10 -0
- package/dist/projected-document-action-status-notice-diagnostics.d.ts.map +1 -0
- package/dist/projected-document-action-status-notice-diagnostics.js +64 -0
- package/dist/projected-document-action-status-notice-diagnostics.js.map +1 -0
- package/dist/projected-document-badge-formatting.d.ts +2 -0
- package/dist/projected-document-badge-formatting.d.ts.map +1 -0
- package/dist/projected-document-badge-formatting.js +7 -0
- package/dist/projected-document-badge-formatting.js.map +1 -0
- package/dist/projected-document-editor-model.d.ts +4 -0
- package/dist/projected-document-editor-model.d.ts.map +1 -0
- package/dist/projected-document-editor-model.js +2 -0
- package/dist/projected-document-editor-model.js.map +1 -0
- package/dist/projected-document-field-navigation.d.ts +72 -0
- package/dist/projected-document-field-navigation.d.ts.map +1 -0
- package/dist/projected-document-field-navigation.js +143 -0
- package/dist/projected-document-field-navigation.js.map +1 -0
- package/dist/projected-document-field-semantics.d.ts +5 -0
- package/dist/projected-document-field-semantics.d.ts.map +1 -0
- package/dist/projected-document-field-semantics.js +16 -0
- package/dist/projected-document-field-semantics.js.map +1 -0
- package/dist/projected-document-workspace-data-source-bindings.d.ts +69 -0
- package/dist/projected-document-workspace-data-source-bindings.d.ts.map +1 -0
- package/dist/projected-document-workspace-data-source-bindings.js +81 -0
- package/dist/projected-document-workspace-data-source-bindings.js.map +1 -0
- package/dist/projected-document-workspace-notice-diagnostics.d.ts +12 -0
- package/dist/projected-document-workspace-notice-diagnostics.d.ts.map +1 -0
- package/dist/projected-document-workspace-notice-diagnostics.js +13 -0
- package/dist/projected-document-workspace-notice-diagnostics.js.map +1 -0
- package/dist/projected-input-form-runtime.d.ts +62 -0
- package/dist/projected-input-form-runtime.d.ts.map +1 -0
- package/dist/projected-input-form-runtime.js +2 -0
- package/dist/projected-input-form-runtime.js.map +1 -0
- package/dist/projected-process-task-notice-diagnostics.d.ts +13 -0
- package/dist/projected-process-task-notice-diagnostics.d.ts.map +1 -0
- package/dist/projected-process-task-notice-diagnostics.js +170 -0
- package/dist/projected-process-task-notice-diagnostics.js.map +1 -0
- package/dist/projected-query-form-runtime.d.ts +46 -0
- package/dist/projected-query-form-runtime.d.ts.map +1 -0
- package/dist/projected-query-form-runtime.js +2 -0
- package/dist/projected-query-form-runtime.js.map +1 -0
- package/dist/prompt-document-preview-projection.d.ts +46 -0
- package/dist/prompt-document-preview-projection.d.ts.map +1 -0
- package/dist/prompt-document-preview-projection.js +173 -0
- package/dist/prompt-document-preview-projection.js.map +1 -0
- package/dist/prompt-icons.d.ts +4 -0
- package/dist/prompt-icons.d.ts.map +1 -0
- package/dist/prompt-icons.js +4 -0
- package/dist/prompt-icons.js.map +1 -0
- package/dist/prompt-status-message-resolution.d.ts +18 -0
- package/dist/prompt-status-message-resolution.d.ts.map +1 -0
- package/dist/prompt-status-message-resolution.js +83 -0
- package/dist/prompt-status-message-resolution.js.map +1 -0
- package/dist/query-form-lowering.d.ts +16 -0
- package/dist/query-form-lowering.d.ts.map +1 -0
- package/dist/query-form-lowering.js +38 -0
- package/dist/query-form-lowering.js.map +1 -0
- package/dist/query-form-url-state.d.ts +44 -0
- package/dist/query-form-url-state.d.ts.map +1 -0
- package/dist/query-form-url-state.js +197 -0
- package/dist/query-form-url-state.js.map +1 -0
- package/dist/query-offset-page.d.ts +13 -0
- package/dist/query-offset-page.d.ts.map +1 -0
- package/dist/query-offset-page.js +24 -0
- package/dist/query-offset-page.js.map +1 -0
- package/dist/relation-query-input-form-target.d.ts +10 -0
- package/dist/relation-query-input-form-target.d.ts.map +1 -0
- package/dist/relation-query-input-form-target.js +30 -0
- package/dist/relation-query-input-form-target.js.map +1 -0
- package/dist/scope-selection.d.ts +94 -0
- package/dist/scope-selection.d.ts.map +1 -0
- package/dist/scope-selection.js +95 -0
- package/dist/scope-selection.js.map +1 -0
- package/dist/target-bindings.d.ts +39 -0
- package/dist/target-bindings.d.ts.map +1 -0
- package/dist/target-bindings.js +40 -0
- package/dist/target-bindings.js.map +1 -0
- package/dist/view-chrome-content-diagnostics.d.ts +8 -0
- package/dist/view-chrome-content-diagnostics.d.ts.map +1 -0
- package/dist/view-chrome-content-diagnostics.js +84 -0
- package/dist/view-chrome-content-diagnostics.js.map +1 -0
- package/dist/view-chrome-icons.d.ts +12 -0
- package/dist/view-chrome-icons.d.ts.map +1 -0
- package/dist/view-chrome-icons.js +50 -0
- package/dist/view-chrome-icons.js.map +1 -0
- package/dist/view-chrome-slot-renderer-registry.d.ts +19 -0
- package/dist/view-chrome-slot-renderer-registry.d.ts.map +1 -0
- package/dist/view-chrome-slot-renderer-registry.js +62 -0
- package/dist/view-chrome-slot-renderer-registry.js.map +1 -0
- package/package.json +53 -0
- package/src/api-scope-request.ts +186 -0
- package/src/collection-chrome-icons.ts +89 -0
- package/src/collection-chrome-runtime.ts +151 -0
- package/src/collection-chrome-slot-renderer-registry.ts +227 -0
- package/src/collection-selection-state.ts +32 -0
- package/src/data-source-projection.ts +2149 -0
- package/src/data-source-query-lowering.ts +217 -0
- package/src/date-time-filter-model.ts +156 -0
- package/src/document-badge-icons.ts +3 -0
- package/src/document-module.ts +741 -0
- package/src/document-summary-model.ts +1 -0
- package/src/document-workspace-chrome-projection.ts +62 -0
- package/src/document-workspace-surface-slots.ts +458 -0
- package/src/endpoint-executor.ts +122 -0
- package/src/field-display-resolution.ts +99 -0
- package/src/index.ts +104 -0
- package/src/module.ts +281 -0
- package/src/navigation-shell-frame-renderer-registry.ts +65 -0
- package/src/navigation-shell-layout-runtime.ts +124 -0
- package/src/navigation-shell-region-component-registry.ts +242 -0
- package/src/navigation-shell-runtime.ts +579 -0
- package/src/navigation-shell-slot-renderer-registry.ts +94 -0
- package/src/navigation.ts +364 -0
- package/src/object-path.ts +99 -0
- package/src/page-host-renderer-registry.ts +615 -0
- package/src/presentation-action-endpoint-request-projection.ts +223 -0
- package/src/presentation-action-endpoint.ts +130 -0
- package/src/presentation-action-icons.ts +3 -0
- package/src/presentation-action-result-state.ts +189 -0
- package/src/presentation-action-runtime-binding.ts +177 -0
- package/src/presentation-action-runtime-diagnostics.ts +120 -0
- package/src/presentation-action-runtime-labels.ts +57 -0
- package/src/presentation-action-runtime-projection.ts +67 -0
- package/src/presentation-badge-resolution.ts +138 -0
- package/src/presentation-collection-pagination.ts +436 -0
- package/src/presentation-content-diagnostics.ts +121 -0
- package/src/presentation-content-resolution.ts +46 -0
- package/src/presentation-data-source-binding-model.ts +140 -0
- package/src/presentation-data-source-runtime.ts +190 -0
- package/src/presentation-design-intent-diagnostics.ts +104 -0
- package/src/presentation-icon-diagnostics.ts +368 -0
- package/src/presentation-icon-registry.ts +181 -0
- package/src/presentation-navigation-action-runtime-bindings.ts +54 -0
- package/src/presentation-pagination.ts +694 -0
- package/src/presentation-projection-coverage.ts +3257 -0
- package/src/presentation-projection-diagnostics.ts +71 -0
- package/src/presentation-projection-trace.ts +293 -0
- package/src/presentation-query-form-state.ts +54 -0
- package/src/presentation-renderer-registry.ts +269 -0
- package/src/presentation-semantics.ts +1028 -0
- package/src/presentation-standards.ts +14 -0
- package/src/presentation-test-selectors.ts +312 -0
- package/src/presentation-value-formatting.ts +65 -0
- package/src/presentation-value-resolution.ts +100 -0
- package/src/presentation-view-tree.ts +33 -0
- package/src/process-task-model.ts +158 -0
- package/src/process-task-projection.ts +398 -0
- package/src/projected-action-status-projection.ts +43 -0
- package/src/projected-activity-state-model.ts +123 -0
- package/src/projected-collection-action-runtime-bindings.ts +76 -0
- package/src/projected-collection-action-runtime-diagnostics.ts +289 -0
- package/src/projected-collection-runtime.ts +1772 -0
- package/src/projected-document-action-diagnostics.ts +196 -0
- package/src/projected-document-action-enablements.ts +99 -0
- package/src/projected-document-action-projection.ts +464 -0
- package/src/projected-document-action-runtime-profile-diagnostics.ts +250 -0
- package/src/projected-document-action-runtime-profile.ts +133 -0
- package/src/projected-document-action-status-notice-diagnostics.ts +116 -0
- package/src/projected-document-badge-formatting.ts +7 -0
- package/src/projected-document-editor-model.ts +7 -0
- package/src/projected-document-field-navigation.ts +300 -0
- package/src/projected-document-field-semantics.ts +27 -0
- package/src/projected-document-workspace-data-source-bindings.ts +182 -0
- package/src/projected-document-workspace-notice-diagnostics.ts +41 -0
- package/src/projected-input-form-runtime.ts +86 -0
- package/src/projected-process-task-notice-diagnostics.ts +283 -0
- package/src/projected-query-form-runtime.ts +62 -0
- package/src/prompt-document-preview-projection.ts +345 -0
- package/src/prompt-icons.ts +3 -0
- package/src/prompt-status-message-resolution.ts +158 -0
- package/src/query-form-lowering.ts +77 -0
- package/src/query-form-url-state.ts +346 -0
- package/src/query-offset-page.ts +50 -0
- package/src/relation-query-input-form-target.ts +61 -0
- package/src/scope-selection.ts +201 -0
- package/src/target-bindings.ts +123 -0
- package/src/view-chrome-content-diagnostics.ts +139 -0
- package/src/view-chrome-icons.ts +81 -0
- package/src/view-chrome-slot-renderer-registry.ts +128 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ActionDefinition,
|
|
3
|
+
ActionEndpointRequestProjectionDefinition,
|
|
4
|
+
ActionEndpointRequestValueBindingDefinition,
|
|
5
|
+
PresentationValueDefinition,
|
|
6
|
+
} from './module'
|
|
7
|
+
import { presentationValueKinds } from '@cohesivesystems/presentation-contracts'
|
|
8
|
+
import {
|
|
9
|
+
readObjectPath,
|
|
10
|
+
writeObjectPath,
|
|
11
|
+
} from './object-path'
|
|
12
|
+
import type { EndpointExecutionRequest } from './endpoint-executor'
|
|
13
|
+
|
|
14
|
+
export type PresentationActionEndpointExecutionRequest<
|
|
15
|
+
TBody = unknown,
|
|
16
|
+
TQuery = unknown,
|
|
17
|
+
> = EndpointExecutionRequest<TBody, TQuery>
|
|
18
|
+
|
|
19
|
+
export interface PresentationActionEndpointRequestProjectionOptions {
|
|
20
|
+
readonly action: ActionDefinition | null
|
|
21
|
+
readonly dataSourceId?: string | null
|
|
22
|
+
readonly endpointId: string
|
|
23
|
+
readonly sources: Readonly<Record<string, unknown>>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface RequiredPresentationActionEndpointRequestProjectionOptions
|
|
27
|
+
extends PresentationActionEndpointRequestProjectionOptions {
|
|
28
|
+
readonly actionId: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Lowers a Presentation IR action endpoint request projection into the concrete
|
|
33
|
+
* endpoint request envelope used by the app transport.
|
|
34
|
+
*/
|
|
35
|
+
export function projectPresentationActionEndpointRequest({
|
|
36
|
+
action,
|
|
37
|
+
dataSourceId,
|
|
38
|
+
endpointId,
|
|
39
|
+
sources,
|
|
40
|
+
}: PresentationActionEndpointRequestProjectionOptions): PresentationActionEndpointExecutionRequest | null {
|
|
41
|
+
const projection = selectActionEndpointRequestProjection({
|
|
42
|
+
action,
|
|
43
|
+
dataSourceId,
|
|
44
|
+
endpointId,
|
|
45
|
+
})
|
|
46
|
+
if (!projection) {
|
|
47
|
+
return null
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
body: projectRequestBody(projection.BodyFields, sources),
|
|
52
|
+
routeParameters: projectRouteParameters(projection.RouteParameters, sources),
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Projects a required action endpoint request, failing early when the action
|
|
58
|
+
* lacks an endpoint request projection for the selected endpoint/data source.
|
|
59
|
+
*/
|
|
60
|
+
export function projectRequiredPresentationActionEndpointRequest({
|
|
61
|
+
action,
|
|
62
|
+
actionId,
|
|
63
|
+
dataSourceId,
|
|
64
|
+
endpointId,
|
|
65
|
+
sources,
|
|
66
|
+
}: RequiredPresentationActionEndpointRequestProjectionOptions): PresentationActionEndpointExecutionRequest {
|
|
67
|
+
const request = projectPresentationActionEndpointRequest({
|
|
68
|
+
action,
|
|
69
|
+
dataSourceId,
|
|
70
|
+
endpointId,
|
|
71
|
+
sources,
|
|
72
|
+
})
|
|
73
|
+
if (!request) {
|
|
74
|
+
throw new Error(
|
|
75
|
+
`No endpoint request projection is registered for action '${actionId}' and endpoint '${endpointId}'.`,
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return request
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function selectActionEndpointRequestProjection({
|
|
83
|
+
action,
|
|
84
|
+
dataSourceId,
|
|
85
|
+
endpointId,
|
|
86
|
+
}: {
|
|
87
|
+
readonly action: ActionDefinition | null
|
|
88
|
+
readonly dataSourceId?: string | null
|
|
89
|
+
readonly endpointId: string
|
|
90
|
+
}): ActionEndpointRequestProjectionDefinition | null {
|
|
91
|
+
const endpointRequests = action?.EndpointRequests ?? []
|
|
92
|
+
const endpointMatches = endpointRequests.filter((candidate) =>
|
|
93
|
+
candidate.EndpointId === endpointId,
|
|
94
|
+
)
|
|
95
|
+
if (!dataSourceId && endpointMatches.length === 1) {
|
|
96
|
+
return endpointMatches[0]
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return endpointRequests.find((candidate) =>
|
|
100
|
+
candidate.EndpointId === endpointId && candidate.DataSourceId === dataSourceId,
|
|
101
|
+
) ??
|
|
102
|
+
endpointRequests.find((candidate) =>
|
|
103
|
+
candidate.EndpointId === endpointId && !candidate.DataSourceId,
|
|
104
|
+
) ??
|
|
105
|
+
endpointRequests.find((candidate) =>
|
|
106
|
+
!candidate.EndpointId && candidate.DataSourceId === dataSourceId,
|
|
107
|
+
) ??
|
|
108
|
+
endpointRequests.find((candidate) =>
|
|
109
|
+
!candidate.EndpointId && !candidate.DataSourceId,
|
|
110
|
+
) ??
|
|
111
|
+
null
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function projectRouteParameters(
|
|
115
|
+
bindings: readonly ActionEndpointRequestValueBindingDefinition[],
|
|
116
|
+
sources: Readonly<Record<string, unknown>>,
|
|
117
|
+
) {
|
|
118
|
+
return Object.fromEntries(
|
|
119
|
+
bindings.flatMap((binding) => {
|
|
120
|
+
const value =
|
|
121
|
+
resolvePresentationActionRequestValue(binding.Source, sources) ??
|
|
122
|
+
resolveFallbackRouteParameterValue(binding.TargetPath, sources)
|
|
123
|
+
if ((value === null || value === undefined) && binding.OmitWhenNull) {
|
|
124
|
+
return []
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return [[binding.TargetPath, value == null ? value : String(value)]]
|
|
128
|
+
}),
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function resolveFallbackRouteParameterValue(
|
|
133
|
+
targetPath: string,
|
|
134
|
+
sources: Readonly<Record<string, unknown>>,
|
|
135
|
+
) {
|
|
136
|
+
if (targetPath !== 'id') {
|
|
137
|
+
return undefined
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return readObjectPath(sources, 'route.id') ?? readObjectPath(sources, 'resource.Id')
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function projectRequestBody(
|
|
144
|
+
bindings: readonly ActionEndpointRequestValueBindingDefinition[],
|
|
145
|
+
sources: Readonly<Record<string, unknown>>,
|
|
146
|
+
) {
|
|
147
|
+
if (bindings.length === 0) {
|
|
148
|
+
return undefined
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const body: Record<string, unknown> = {}
|
|
152
|
+
for (const binding of bindings) {
|
|
153
|
+
const resolvedValue = resolvePresentationActionRequestValue(binding.Source, sources)
|
|
154
|
+
const value = resolvedValue === undefined
|
|
155
|
+
? resolveFallbackRequestBodyValue(binding.TargetPath, sources)
|
|
156
|
+
: resolvedValue
|
|
157
|
+
if ((value === null || value === undefined) && binding.OmitWhenNull) {
|
|
158
|
+
continue
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (value === undefined && isDocumentRequestBodyTarget(binding.TargetPath)) {
|
|
162
|
+
throw new Error(
|
|
163
|
+
`Unable to project request body field '${binding.TargetPath}' because its source did not resolve.`,
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
writeObjectPath(body, binding.TargetPath, value)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return body
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function resolveFallbackRequestBodyValue(
|
|
174
|
+
targetPath: string,
|
|
175
|
+
sources: Readonly<Record<string, unknown>>,
|
|
176
|
+
) {
|
|
177
|
+
if (!isDocumentRequestBodyTarget(targetPath)) {
|
|
178
|
+
return undefined
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const documentValue = readObjectPath(sources, 'document.value')
|
|
182
|
+
if (documentValue !== undefined) {
|
|
183
|
+
return documentValue
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return readObjectPath(sources, 'document.Document')
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function isDocumentRequestBodyTarget(targetPath: string) {
|
|
190
|
+
return targetPath.toLowerCase() === 'document'
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function resolvePresentationActionRequestValue(
|
|
194
|
+
value: PresentationValueDefinition,
|
|
195
|
+
sources: Readonly<Record<string, unknown>>,
|
|
196
|
+
) {
|
|
197
|
+
if (isPresentationValueKind(value.Kind, presentationValueKinds.literal, 'literal')) {
|
|
198
|
+
return value.Literal
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (isPresentationValueKind(value.Kind, presentationValueKinds.field, 'field')) {
|
|
202
|
+
return value.Field ? readObjectPath(sources, value.Field) : undefined
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (isPresentationValueKind(value.Kind, presentationValueKinds.state, 'state')) {
|
|
206
|
+
return value.StateId ? sources[value.StateId] : undefined
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (isPresentationValueKind(value.Kind, presentationValueKinds.expression, 'expression')) {
|
|
210
|
+
throw new Error('Action endpoint request expression values are not supported yet.')
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return undefined
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function isPresentationValueKind(
|
|
217
|
+
value: unknown,
|
|
218
|
+
numericKind: number,
|
|
219
|
+
stringKind: string,
|
|
220
|
+
) {
|
|
221
|
+
return value === numericKind ||
|
|
222
|
+
(typeof value === 'string' && value.toLowerCase() === stringKind.toLowerCase())
|
|
223
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
findPresentationAction,
|
|
3
|
+
type PresentationBindingDefinition,
|
|
4
|
+
type PresentationModuleDefinition,
|
|
5
|
+
} from './module'
|
|
6
|
+
import {
|
|
7
|
+
createPresentationEnumDiscriminator,
|
|
8
|
+
matchesPresentationEnum,
|
|
9
|
+
type PresentationEnumDiscriminator,
|
|
10
|
+
} from './target-bindings'
|
|
11
|
+
import {
|
|
12
|
+
presentationBindingKinds,
|
|
13
|
+
presentationTargetKinds,
|
|
14
|
+
} from '@cohesivesystems/presentation-contracts'
|
|
15
|
+
|
|
16
|
+
interface PresentationTargetBindingProjection {
|
|
17
|
+
readonly Bindings: readonly PresentationBindingDefinition[]
|
|
18
|
+
readonly ComponentSet?: string | null
|
|
19
|
+
readonly Target: string | number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface ResolvePresentationActionEndpointBindingOptions {
|
|
23
|
+
readonly actionId: string
|
|
24
|
+
readonly componentSet?: string | null
|
|
25
|
+
readonly dataSourceId?: string | null
|
|
26
|
+
readonly module: Pick<PresentationModuleDefinition, 'Actions'> & {
|
|
27
|
+
readonly Targets?: readonly PresentationTargetBindingProjection[]
|
|
28
|
+
} | null
|
|
29
|
+
readonly targetKind?: PresentationEnumDiscriminator | null
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Resolves the concrete endpoint that realizes a semantic action for the
|
|
34
|
+
* current projection target. Target bindings can specialize an action by data
|
|
35
|
+
* source while the action definition remains semantic and reusable.
|
|
36
|
+
*/
|
|
37
|
+
export function resolvePresentationActionEndpointBinding({
|
|
38
|
+
actionId,
|
|
39
|
+
componentSet,
|
|
40
|
+
dataSourceId,
|
|
41
|
+
module,
|
|
42
|
+
targetKind = createPresentationEnumDiscriminator(presentationTargetKinds, 'react', 'React'),
|
|
43
|
+
}: ResolvePresentationActionEndpointBindingOptions): PresentationBindingDefinition | null {
|
|
44
|
+
if (!module) {
|
|
45
|
+
return null
|
|
46
|
+
}
|
|
47
|
+
return (
|
|
48
|
+
resolveActionEndpointTargetBinding({
|
|
49
|
+
actionId,
|
|
50
|
+
componentSet,
|
|
51
|
+
dataSourceId,
|
|
52
|
+
module,
|
|
53
|
+
targetKind,
|
|
54
|
+
}) ??
|
|
55
|
+
resolveActionDefinitionEndpointBinding(module, actionId) ??
|
|
56
|
+
null
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function resolveActionEndpointTargetBinding({
|
|
61
|
+
actionId,
|
|
62
|
+
componentSet,
|
|
63
|
+
dataSourceId,
|
|
64
|
+
module,
|
|
65
|
+
targetKind,
|
|
66
|
+
}: ResolvePresentationActionEndpointBindingOptions): PresentationBindingDefinition | null {
|
|
67
|
+
const targets = resolveCandidateTargets(module?.Targets ?? [], {
|
|
68
|
+
componentSet,
|
|
69
|
+
targetKind,
|
|
70
|
+
})
|
|
71
|
+
const bindings = targets
|
|
72
|
+
.flatMap((target) => target.Bindings)
|
|
73
|
+
.filter(
|
|
74
|
+
(binding) =>
|
|
75
|
+
matchesPresentationEnum(binding.Kind, actionEndpointBindingKind) &&
|
|
76
|
+
binding.Id === actionId,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
bindings.find((binding) => dataSourceId && binding.DataSourceId === dataSourceId) ??
|
|
81
|
+
bindings.find((binding) => !binding.DataSourceId) ??
|
|
82
|
+
bindings[0] ??
|
|
83
|
+
null
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function resolveActionDefinitionEndpointBinding(
|
|
88
|
+
module: Pick<PresentationModuleDefinition, 'Actions'>,
|
|
89
|
+
actionId: string,
|
|
90
|
+
): PresentationBindingDefinition | null {
|
|
91
|
+
const binding = findPresentationAction(module, actionId)?.Binding ?? null
|
|
92
|
+
return binding && isEndpointBinding(binding) ? binding : null
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function resolveCandidateTargets(
|
|
96
|
+
targets: readonly PresentationTargetBindingProjection[],
|
|
97
|
+
{
|
|
98
|
+
componentSet,
|
|
99
|
+
targetKind,
|
|
100
|
+
}: Pick<ResolvePresentationActionEndpointBindingOptions, 'componentSet' | 'targetKind'>,
|
|
101
|
+
) {
|
|
102
|
+
const filteredTargets = targets.filter((target) => {
|
|
103
|
+
if (targetKind && !matchesPresentationEnum(target.Target, targetKind)) {
|
|
104
|
+
return false
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return !componentSet || target.ComponentSet === componentSet
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
return filteredTargets.length > 0 ? filteredTargets : targets
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function isEndpointBinding(binding: PresentationBindingDefinition) {
|
|
114
|
+
return (
|
|
115
|
+
matchesPresentationEnum(binding.Kind, actionEndpointBindingKind) ||
|
|
116
|
+
matchesPresentationEnum(binding.Kind, apiEndpointBindingKind)
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const actionEndpointBindingKind = createPresentationEnumDiscriminator(
|
|
121
|
+
presentationBindingKinds,
|
|
122
|
+
'actionEndpoint',
|
|
123
|
+
'ActionEndpoint',
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
const apiEndpointBindingKind = createPresentationEnumDiscriminator(
|
|
127
|
+
presentationBindingKinds,
|
|
128
|
+
'apiEndpoint',
|
|
129
|
+
'ApiEndpoint',
|
|
130
|
+
)
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import {
|
|
2
|
+
actionResultStateWriteModes,
|
|
3
|
+
type ActionResultPolicy,
|
|
4
|
+
type ActionResultStateWriteDefinition,
|
|
5
|
+
type ActionResultStateWriteMode,
|
|
6
|
+
} from '@cohesivesystems/presentation-contracts'
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
readObjectPath,
|
|
10
|
+
} from './object-path'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Route-scoped presentation state keyed by semantic data-source id.
|
|
14
|
+
*
|
|
15
|
+
* Values in this map are action outputs, or values derived from action outputs,
|
|
16
|
+
* that should be projected as local data-source values until the route scope is
|
|
17
|
+
* reset.
|
|
18
|
+
*/
|
|
19
|
+
export type PresentationActionResultStateValues = Readonly<Record<string, unknown>>
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Inputs for applying explicit action-result state writes.
|
|
23
|
+
*/
|
|
24
|
+
export interface ApplyPresentationActionResultStateWritesOptions {
|
|
25
|
+
/** Action endpoint response used as the source value for each write. */
|
|
26
|
+
readonly result: unknown
|
|
27
|
+
|
|
28
|
+
/** Current route-scoped action-result state. */
|
|
29
|
+
readonly state: PresentationActionResultStateValues
|
|
30
|
+
|
|
31
|
+
/** State-write declarations to apply. */
|
|
32
|
+
readonly writes?: readonly ActionResultStateWriteDefinition[] | null
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Inputs for applying the state-write policy declared by an action result.
|
|
37
|
+
*/
|
|
38
|
+
export interface ApplyPresentationActionResultPolicyStateWritesOptions {
|
|
39
|
+
/** Action result policy that declares state writes, when one is present. */
|
|
40
|
+
readonly policy?: ActionResultPolicy | null
|
|
41
|
+
|
|
42
|
+
/** Action endpoint response used as the source value for each policy write. */
|
|
43
|
+
readonly result: unknown
|
|
44
|
+
|
|
45
|
+
/** Current route-scoped action-result state. */
|
|
46
|
+
readonly state: PresentationActionResultStateValues
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Applies the state writes declared by an action result policy.
|
|
51
|
+
*
|
|
52
|
+
* The returned state preserves object identity when the policy has no writes,
|
|
53
|
+
* which lets React callers avoid unnecessary rebinding work.
|
|
54
|
+
*/
|
|
55
|
+
export function applyPresentationActionResultPolicyStateWrites({
|
|
56
|
+
policy,
|
|
57
|
+
result,
|
|
58
|
+
state,
|
|
59
|
+
}: ApplyPresentationActionResultPolicyStateWritesOptions) {
|
|
60
|
+
return applyPresentationActionResultStateWrites({
|
|
61
|
+
result,
|
|
62
|
+
state,
|
|
63
|
+
writes: policy?.StateWrites,
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Applies backend-declared action response writes to route-local presentation
|
|
69
|
+
* data-source state.
|
|
70
|
+
*
|
|
71
|
+
* Each write targets a semantic data-source id and reads either the full action
|
|
72
|
+
* response or a dot-separated response path. The function returns a new state
|
|
73
|
+
* object only when at least one valid write is applied.
|
|
74
|
+
*/
|
|
75
|
+
export function applyPresentationActionResultStateWrites({
|
|
76
|
+
result,
|
|
77
|
+
state,
|
|
78
|
+
writes,
|
|
79
|
+
}: ApplyPresentationActionResultStateWritesOptions): PresentationActionResultStateValues {
|
|
80
|
+
if (!writes?.length) {
|
|
81
|
+
return state
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
let next: Record<string, unknown> | null = null
|
|
85
|
+
for (const write of writes) {
|
|
86
|
+
if (!write.TargetDataSourceId) {
|
|
87
|
+
continue
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
next ??= { ...state }
|
|
91
|
+
applyPresentationActionResultStateWrite(next, write, result)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return next ?? state
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Applies a single write declaration to a mutable state accumulator.
|
|
99
|
+
*/
|
|
100
|
+
function applyPresentationActionResultStateWrite(
|
|
101
|
+
state: Record<string, unknown>,
|
|
102
|
+
write: ActionResultStateWriteDefinition,
|
|
103
|
+
result: unknown,
|
|
104
|
+
) {
|
|
105
|
+
const mode = normalizeActionResultStateWriteMode(write.Mode)
|
|
106
|
+
if (mode === 'clear') {
|
|
107
|
+
delete state[write.TargetDataSourceId]
|
|
108
|
+
return
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const value = write.SourcePath ? readObjectPath(result, write.SourcePath) : result
|
|
112
|
+
switch (mode) {
|
|
113
|
+
case 'append':
|
|
114
|
+
state[write.TargetDataSourceId] = appendPresentationStateValue(
|
|
115
|
+
state[write.TargetDataSourceId],
|
|
116
|
+
value,
|
|
117
|
+
)
|
|
118
|
+
return
|
|
119
|
+
case 'merge':
|
|
120
|
+
state[write.TargetDataSourceId] = mergePresentationStateValue(
|
|
121
|
+
state[write.TargetDataSourceId],
|
|
122
|
+
value,
|
|
123
|
+
)
|
|
124
|
+
return
|
|
125
|
+
case 'replace':
|
|
126
|
+
default:
|
|
127
|
+
state[write.TargetDataSourceId] = value
|
|
128
|
+
return
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Appends one scalar or array-valued write source to the current target value.
|
|
134
|
+
*/
|
|
135
|
+
function appendPresentationStateValue(current: unknown, value: unknown) {
|
|
136
|
+
const currentItems = Array.isArray(current) ? current : current === undefined ? [] : [current]
|
|
137
|
+
const nextItems = Array.isArray(value) ? value : [value]
|
|
138
|
+
return [...currentItems, ...nextItems]
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Merges object writes shallowly and falls back to replacement for non-objects.
|
|
143
|
+
*/
|
|
144
|
+
function mergePresentationStateValue(current: unknown, value: unknown) {
|
|
145
|
+
if (isRecord(current) && isRecord(value)) {
|
|
146
|
+
return {
|
|
147
|
+
...current,
|
|
148
|
+
...value,
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return value
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Narrows values that can participate in shallow merge writes.
|
|
157
|
+
*/
|
|
158
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
159
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Normalizes generated numeric enum values and JSON string enum values into the
|
|
164
|
+
* runtime write-mode labels used by the state applicator.
|
|
165
|
+
*/
|
|
166
|
+
function normalizeActionResultStateWriteMode(
|
|
167
|
+
mode: ActionResultStateWriteMode | string,
|
|
168
|
+
): 'replace' | 'merge' | 'append' | 'clear' {
|
|
169
|
+
if (mode === actionResultStateWriteModes.merge || matchesModeLabel(mode, 'merge')) {
|
|
170
|
+
return 'merge'
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (mode === actionResultStateWriteModes.append || matchesModeLabel(mode, 'append')) {
|
|
174
|
+
return 'append'
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (mode === actionResultStateWriteModes.clear || matchesModeLabel(mode, 'clear')) {
|
|
178
|
+
return 'clear'
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return 'replace'
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Compares a generated JSON enum label case-insensitively.
|
|
186
|
+
*/
|
|
187
|
+
function matchesModeLabel(value: unknown, label: string) {
|
|
188
|
+
return typeof value === 'string' && value.toLocaleLowerCase() === label
|
|
189
|
+
}
|