@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,694 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DataSourceDefinition,
|
|
3
|
+
} from './module'
|
|
4
|
+
import {
|
|
5
|
+
readObjectPath,
|
|
6
|
+
} from './object-path'
|
|
7
|
+
import {
|
|
8
|
+
dataSourcePaginationKindLabels,
|
|
9
|
+
dataSourcePaginationKinds,
|
|
10
|
+
type DataSourcePaginationDefinition,
|
|
11
|
+
type DataSourcePaginationKind,
|
|
12
|
+
} from '@cohesivesystems/presentation-contracts'
|
|
13
|
+
|
|
14
|
+
export const presentationPaginationKinds = {
|
|
15
|
+
cursor: 'cursor',
|
|
16
|
+
offset: 'offset',
|
|
17
|
+
pageNumber: 'page-number',
|
|
18
|
+
} as const
|
|
19
|
+
|
|
20
|
+
export type PresentationPaginationKind =
|
|
21
|
+
(typeof presentationPaginationKinds)[keyof typeof presentationPaginationKinds]
|
|
22
|
+
|
|
23
|
+
export type PresentationPaginationState =
|
|
24
|
+
| PresentationCursorPaginationState
|
|
25
|
+
| PresentationOffsetPaginationState
|
|
26
|
+
| PresentationPageNumberPaginationState
|
|
27
|
+
|
|
28
|
+
export interface PresentationCursorPaginationState {
|
|
29
|
+
readonly cursorHistory: readonly (string | null)[]
|
|
30
|
+
readonly kind: typeof presentationPaginationKinds.cursor
|
|
31
|
+
readonly pageIndex: number
|
|
32
|
+
readonly pageSize: number
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface PresentationOffsetPaginationState {
|
|
36
|
+
readonly kind: typeof presentationPaginationKinds.offset
|
|
37
|
+
readonly pageIndex: number
|
|
38
|
+
readonly pageSize: number
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface PresentationPageNumberPaginationState {
|
|
42
|
+
readonly kind: typeof presentationPaginationKinds.pageNumber
|
|
43
|
+
readonly pageNumber: number
|
|
44
|
+
readonly pageSize: number
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface PresentationPaginationUrlPolicy {
|
|
48
|
+
readonly enabled: boolean
|
|
49
|
+
readonly parameterPrefix: string
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface PresentationPaginationBinding {
|
|
53
|
+
readonly dataSourceId: string
|
|
54
|
+
readonly defaultPageSize: number
|
|
55
|
+
readonly kind: PresentationPaginationKind
|
|
56
|
+
readonly request: PresentationPaginationRequestBinding
|
|
57
|
+
readonly response: PresentationPaginationResponseBinding
|
|
58
|
+
readonly url: PresentationPaginationUrlPolicy
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface PresentationPaginationRequestBinding {
|
|
62
|
+
readonly cursorField?: string | null
|
|
63
|
+
readonly limitField?: string | null
|
|
64
|
+
readonly offsetField?: string | null
|
|
65
|
+
readonly pageField?: string | null
|
|
66
|
+
readonly pageNumberField?: string | null
|
|
67
|
+
readonly skipField?: string | null
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface PresentationPaginationResponseBinding {
|
|
71
|
+
readonly cursorField?: string | null
|
|
72
|
+
readonly hasNextPageField?: string | null
|
|
73
|
+
readonly limitField?: string | null
|
|
74
|
+
readonly offsetField?: string | null
|
|
75
|
+
readonly pageField?: string | null
|
|
76
|
+
readonly pageNumberField?: string | null
|
|
77
|
+
readonly totalCountDataSourceId?: string | null
|
|
78
|
+
readonly totalCountField?: string | null
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface PresentationPaginationRuntime {
|
|
82
|
+
readonly binding: PresentationPaginationBinding
|
|
83
|
+
readonly canGoPreviousPage: boolean
|
|
84
|
+
readonly dataSourceId: string
|
|
85
|
+
readonly goToFirstPage: () => void
|
|
86
|
+
readonly goToNextPage: (response?: unknown) => void
|
|
87
|
+
readonly goToPreviousPage: () => void
|
|
88
|
+
readonly pageIndex: number
|
|
89
|
+
readonly pageSize: number
|
|
90
|
+
readonly state: PresentationPaginationState
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface ResolvedPresentationPageInfo {
|
|
94
|
+
readonly hasNextPage: boolean
|
|
95
|
+
readonly itemCount: number
|
|
96
|
+
readonly pageIndex: number
|
|
97
|
+
readonly pageSize: number
|
|
98
|
+
readonly totalCount: number | null
|
|
99
|
+
readonly totalPageCount: number | null
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function createInitialPresentationPaginationState(
|
|
103
|
+
binding: PresentationPaginationBinding,
|
|
104
|
+
): PresentationPaginationState {
|
|
105
|
+
switch (binding.kind) {
|
|
106
|
+
case presentationPaginationKinds.cursor:
|
|
107
|
+
return {
|
|
108
|
+
cursorHistory: [null],
|
|
109
|
+
kind: presentationPaginationKinds.cursor,
|
|
110
|
+
pageIndex: 0,
|
|
111
|
+
pageSize: binding.defaultPageSize,
|
|
112
|
+
}
|
|
113
|
+
case presentationPaginationKinds.offset:
|
|
114
|
+
return {
|
|
115
|
+
kind: presentationPaginationKinds.offset,
|
|
116
|
+
pageIndex: 0,
|
|
117
|
+
pageSize: binding.defaultPageSize,
|
|
118
|
+
}
|
|
119
|
+
case presentationPaginationKinds.pageNumber:
|
|
120
|
+
return {
|
|
121
|
+
kind: presentationPaginationKinds.pageNumber,
|
|
122
|
+
pageNumber: 1,
|
|
123
|
+
pageSize: binding.defaultPageSize,
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function readPresentationPaginationStateFromSearch(
|
|
129
|
+
search: string,
|
|
130
|
+
binding: PresentationPaginationBinding,
|
|
131
|
+
): PresentationPaginationState {
|
|
132
|
+
if (!binding.url.enabled) {
|
|
133
|
+
return createInitialPresentationPaginationState(binding)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const params = new URLSearchParams(search)
|
|
137
|
+
const pageIndex = readPageIndex(params, binding.url.parameterPrefix)
|
|
138
|
+
const pageSize = readPositiveInteger(
|
|
139
|
+
params.get(createPaginationParam(binding.url.parameterPrefix, 'page_size')),
|
|
140
|
+
) ?? binding.defaultPageSize
|
|
141
|
+
|
|
142
|
+
switch (binding.kind) {
|
|
143
|
+
case presentationPaginationKinds.cursor:
|
|
144
|
+
return normalizePresentationPaginationState({
|
|
145
|
+
cursorHistory: [
|
|
146
|
+
null,
|
|
147
|
+
...params
|
|
148
|
+
.getAll(createPaginationParam(binding.url.parameterPrefix, 'cursor'))
|
|
149
|
+
.map((cursor) => cursor.trim())
|
|
150
|
+
.filter((cursor) => cursor.length > 0),
|
|
151
|
+
],
|
|
152
|
+
kind: presentationPaginationKinds.cursor,
|
|
153
|
+
pageIndex,
|
|
154
|
+
pageSize,
|
|
155
|
+
})
|
|
156
|
+
case presentationPaginationKinds.offset:
|
|
157
|
+
return normalizePresentationPaginationState({
|
|
158
|
+
kind: presentationPaginationKinds.offset,
|
|
159
|
+
pageIndex,
|
|
160
|
+
pageSize,
|
|
161
|
+
})
|
|
162
|
+
case presentationPaginationKinds.pageNumber:
|
|
163
|
+
return normalizePresentationPaginationState({
|
|
164
|
+
kind: presentationPaginationKinds.pageNumber,
|
|
165
|
+
pageNumber: pageIndex + 1,
|
|
166
|
+
pageSize,
|
|
167
|
+
})
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export function createPresentationPaginationSearch(
|
|
172
|
+
search: string,
|
|
173
|
+
binding: PresentationPaginationBinding,
|
|
174
|
+
state: PresentationPaginationState,
|
|
175
|
+
) {
|
|
176
|
+
if (!binding.url.enabled) {
|
|
177
|
+
return search
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const normalizedState = normalizePresentationPaginationState(state)
|
|
181
|
+
const params = new URLSearchParams(search)
|
|
182
|
+
deletePresentationPaginationParams(params, binding.url.parameterPrefix)
|
|
183
|
+
|
|
184
|
+
const pageIndex = getPresentationPaginationPageIndex(normalizedState)
|
|
185
|
+
if (pageIndex > 0) {
|
|
186
|
+
params.set(createPaginationParam(binding.url.parameterPrefix, 'page'), String(pageIndex + 1))
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (normalizedState.pageSize !== binding.defaultPageSize) {
|
|
190
|
+
params.set(
|
|
191
|
+
createPaginationParam(binding.url.parameterPrefix, 'page_size'),
|
|
192
|
+
String(normalizedState.pageSize),
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (normalizedState.kind === presentationPaginationKinds.cursor && pageIndex > 0) {
|
|
197
|
+
normalizedState.cursorHistory.slice(1, pageIndex + 1).forEach((cursor) => {
|
|
198
|
+
if (cursor) {
|
|
199
|
+
params.append(createPaginationParam(binding.url.parameterPrefix, 'cursor'), cursor)
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const value = params.toString()
|
|
205
|
+
return value.length > 0 ? `?${value}` : ''
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export function deletePresentationPaginationParams(
|
|
209
|
+
params: URLSearchParams,
|
|
210
|
+
parameterPrefix: string,
|
|
211
|
+
) {
|
|
212
|
+
params.delete(createPaginationParam(parameterPrefix, 'cursor'))
|
|
213
|
+
params.delete(createPaginationParam(parameterPrefix, 'page'))
|
|
214
|
+
params.delete(createPaginationParam(parameterPrefix, 'page_size'))
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export function applyPresentationPaginationToRequest<TRequest extends object>(
|
|
218
|
+
request: TRequest,
|
|
219
|
+
binding: PresentationPaginationBinding | null | undefined,
|
|
220
|
+
state: PresentationPaginationState | null | undefined,
|
|
221
|
+
): TRequest {
|
|
222
|
+
if (!binding || !state) {
|
|
223
|
+
return request
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const normalizedState = normalizePresentationPaginationState(state)
|
|
227
|
+
const target = { ...request } as Record<string, unknown>
|
|
228
|
+
writeRequestField(target, binding.request.limitField, normalizedState.pageSize)
|
|
229
|
+
|
|
230
|
+
if (normalizedState.kind === presentationPaginationKinds.cursor) {
|
|
231
|
+
writeRequestField(
|
|
232
|
+
target,
|
|
233
|
+
binding.request.cursorField,
|
|
234
|
+
normalizedState.cursorHistory[normalizedState.pageIndex] ?? null,
|
|
235
|
+
)
|
|
236
|
+
} else if (normalizedState.kind === presentationPaginationKinds.offset) {
|
|
237
|
+
const offset = normalizedState.pageIndex * normalizedState.pageSize
|
|
238
|
+
writeRequestField(target, binding.request.offsetField, offset)
|
|
239
|
+
writeRequestField(target, binding.request.skipField, offset)
|
|
240
|
+
} else {
|
|
241
|
+
writeRequestField(target, binding.request.pageField, normalizedState.pageNumber)
|
|
242
|
+
writeRequestField(target, binding.request.pageNumberField, normalizedState.pageNumber)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return target as TRequest
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export function createNextPresentationPaginationState(
|
|
249
|
+
binding: PresentationPaginationBinding,
|
|
250
|
+
state: PresentationPaginationState,
|
|
251
|
+
response?: unknown,
|
|
252
|
+
): PresentationPaginationState {
|
|
253
|
+
const normalizedState = normalizePresentationPaginationState(state)
|
|
254
|
+
switch (normalizedState.kind) {
|
|
255
|
+
case presentationPaginationKinds.cursor: {
|
|
256
|
+
const nextCursor = readStringPath(response, binding.response.cursorField)
|
|
257
|
+
if (!nextCursor) {
|
|
258
|
+
return normalizedState
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return normalizePresentationPaginationState({
|
|
262
|
+
...normalizedState,
|
|
263
|
+
cursorHistory: [
|
|
264
|
+
...normalizedState.cursorHistory.slice(0, normalizedState.pageIndex + 1),
|
|
265
|
+
nextCursor,
|
|
266
|
+
],
|
|
267
|
+
pageIndex: normalizedState.pageIndex + 1,
|
|
268
|
+
})
|
|
269
|
+
}
|
|
270
|
+
case presentationPaginationKinds.offset:
|
|
271
|
+
return normalizePresentationPaginationState({
|
|
272
|
+
...normalizedState,
|
|
273
|
+
pageIndex: normalizedState.pageIndex + 1,
|
|
274
|
+
})
|
|
275
|
+
case presentationPaginationKinds.pageNumber:
|
|
276
|
+
return normalizePresentationPaginationState({
|
|
277
|
+
...normalizedState,
|
|
278
|
+
pageNumber: normalizedState.pageNumber + 1,
|
|
279
|
+
})
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export function createPreviousPresentationPaginationState(
|
|
284
|
+
state: PresentationPaginationState,
|
|
285
|
+
): PresentationPaginationState {
|
|
286
|
+
const normalizedState = normalizePresentationPaginationState(state)
|
|
287
|
+
if (normalizedState.kind === presentationPaginationKinds.pageNumber) {
|
|
288
|
+
return normalizePresentationPaginationState({
|
|
289
|
+
...normalizedState,
|
|
290
|
+
pageNumber: Math.max(1, normalizedState.pageNumber - 1),
|
|
291
|
+
})
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return normalizePresentationPaginationState({
|
|
295
|
+
...normalizedState,
|
|
296
|
+
pageIndex: Math.max(0, normalizedState.pageIndex - 1),
|
|
297
|
+
})
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export function normalizePresentationPaginationState(
|
|
301
|
+
state: PresentationPaginationState,
|
|
302
|
+
): PresentationPaginationState {
|
|
303
|
+
const pageSize = Math.max(1, state.pageSize)
|
|
304
|
+
switch (state.kind) {
|
|
305
|
+
case presentationPaginationKinds.cursor: {
|
|
306
|
+
const cursorHistory = [
|
|
307
|
+
null,
|
|
308
|
+
...state.cursorHistory
|
|
309
|
+
.slice(1)
|
|
310
|
+
.map((cursor) => cursor?.trim() ?? '')
|
|
311
|
+
.filter((cursor) => cursor.length > 0),
|
|
312
|
+
]
|
|
313
|
+
return {
|
|
314
|
+
...state,
|
|
315
|
+
cursorHistory,
|
|
316
|
+
pageIndex: clamp(state.pageIndex, 0, cursorHistory.length - 1),
|
|
317
|
+
pageSize,
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
case presentationPaginationKinds.offset:
|
|
321
|
+
return {
|
|
322
|
+
...state,
|
|
323
|
+
pageIndex: Math.max(0, state.pageIndex),
|
|
324
|
+
pageSize,
|
|
325
|
+
}
|
|
326
|
+
case presentationPaginationKinds.pageNumber:
|
|
327
|
+
return {
|
|
328
|
+
...state,
|
|
329
|
+
pageNumber: Math.max(1, state.pageNumber),
|
|
330
|
+
pageSize,
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export function resolvePresentationPageInfo({
|
|
336
|
+
binding,
|
|
337
|
+
itemCount,
|
|
338
|
+
readDataSource,
|
|
339
|
+
response,
|
|
340
|
+
state,
|
|
341
|
+
totalCount,
|
|
342
|
+
}: {
|
|
343
|
+
readonly binding: PresentationPaginationBinding
|
|
344
|
+
readonly itemCount: number
|
|
345
|
+
readonly response?: unknown
|
|
346
|
+
readonly readDataSource?: (dataSourceId: string) => unknown
|
|
347
|
+
readonly state: PresentationPaginationState
|
|
348
|
+
readonly totalCount?: number | null
|
|
349
|
+
}): ResolvedPresentationPageInfo {
|
|
350
|
+
const normalizedState = normalizePresentationPaginationState(state)
|
|
351
|
+
const pageIndex = getPresentationPaginationPageIndex(normalizedState)
|
|
352
|
+
const pageSize = normalizedState.pageSize
|
|
353
|
+
const projectedTotalCount = readPaginationTotalCount({
|
|
354
|
+
binding,
|
|
355
|
+
readDataSource,
|
|
356
|
+
response,
|
|
357
|
+
})
|
|
358
|
+
const resolvedTotalCount =
|
|
359
|
+
totalCount !== undefined ? totalCount : projectedTotalCount
|
|
360
|
+
const totalPageCount =
|
|
361
|
+
typeof resolvedTotalCount === 'number'
|
|
362
|
+
? Math.max(1, Math.ceil(resolvedTotalCount / pageSize))
|
|
363
|
+
: null
|
|
364
|
+
const hasNextPage = resolveHasNextPage({
|
|
365
|
+
binding,
|
|
366
|
+
itemCount,
|
|
367
|
+
pageIndex,
|
|
368
|
+
response,
|
|
369
|
+
totalPageCount,
|
|
370
|
+
})
|
|
371
|
+
|
|
372
|
+
return {
|
|
373
|
+
hasNextPage,
|
|
374
|
+
itemCount,
|
|
375
|
+
pageIndex,
|
|
376
|
+
pageSize,
|
|
377
|
+
totalCount: typeof resolvedTotalCount === 'number' ? resolvedTotalCount : null,
|
|
378
|
+
totalPageCount,
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export function getPresentationPaginationPageIndex(state: PresentationPaginationState) {
|
|
383
|
+
return state.kind === presentationPaginationKinds.pageNumber
|
|
384
|
+
? state.pageNumber - 1
|
|
385
|
+
: state.pageIndex
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export function inferPresentationPaginationBinding({
|
|
389
|
+
dataSource,
|
|
390
|
+
defaultPageSize,
|
|
391
|
+
parameterPrefix,
|
|
392
|
+
useUrl,
|
|
393
|
+
}: {
|
|
394
|
+
readonly dataSource: DataSourceDefinition
|
|
395
|
+
readonly defaultPageSize: number
|
|
396
|
+
readonly parameterPrefix?: string
|
|
397
|
+
readonly useUrl: boolean
|
|
398
|
+
}): PresentationPaginationBinding | null {
|
|
399
|
+
if (dataSource.Query?.Pagination) {
|
|
400
|
+
return projectDataSourcePaginationDefinition({
|
|
401
|
+
dataSource,
|
|
402
|
+
defaultPageSize,
|
|
403
|
+
pagination: dataSource.Query.Pagination,
|
|
404
|
+
parameterPrefix,
|
|
405
|
+
useUrl,
|
|
406
|
+
})
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
const requestPaths = new Set(
|
|
410
|
+
dataSource.Query?.Fields.flatMap((field) => field.RequestPaths) ?? [],
|
|
411
|
+
)
|
|
412
|
+
const request = inferRequestBinding(requestPaths)
|
|
413
|
+
const kind = inferPaginationKind(request)
|
|
414
|
+
if (!kind) {
|
|
415
|
+
return null
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
return {
|
|
419
|
+
dataSourceId: dataSource.Id,
|
|
420
|
+
defaultPageSize,
|
|
421
|
+
kind,
|
|
422
|
+
request,
|
|
423
|
+
response: inferResponseBinding(kind),
|
|
424
|
+
url: {
|
|
425
|
+
enabled: useUrl,
|
|
426
|
+
parameterPrefix: parameterPrefix ?? createDataSourcePaginationParameterPrefix(dataSource.Id),
|
|
427
|
+
},
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
function projectDataSourcePaginationDefinition({
|
|
432
|
+
dataSource,
|
|
433
|
+
defaultPageSize,
|
|
434
|
+
pagination,
|
|
435
|
+
parameterPrefix,
|
|
436
|
+
useUrl,
|
|
437
|
+
}: {
|
|
438
|
+
readonly dataSource: DataSourceDefinition
|
|
439
|
+
readonly defaultPageSize: number
|
|
440
|
+
readonly pagination: DataSourcePaginationDefinition
|
|
441
|
+
readonly parameterPrefix?: string
|
|
442
|
+
readonly useUrl: boolean
|
|
443
|
+
}): PresentationPaginationBinding | null {
|
|
444
|
+
const kind = projectPaginationKind(pagination)
|
|
445
|
+
if (!kind) {
|
|
446
|
+
return null
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
return {
|
|
450
|
+
dataSourceId: dataSource.Id,
|
|
451
|
+
defaultPageSize: pagination.DefaultPageSize ?? defaultPageSize,
|
|
452
|
+
kind,
|
|
453
|
+
request: {
|
|
454
|
+
cursorField: pagination.Request.CursorField,
|
|
455
|
+
limitField: pagination.Request.LimitField,
|
|
456
|
+
offsetField: pagination.Request.OffsetField,
|
|
457
|
+
pageField: pagination.Request.PageField,
|
|
458
|
+
pageNumberField: pagination.Request.PageNumberField,
|
|
459
|
+
skipField: pagination.Request.SkipField,
|
|
460
|
+
},
|
|
461
|
+
response: {
|
|
462
|
+
cursorField: pagination.Response.CursorField,
|
|
463
|
+
hasNextPageField: pagination.Response.HasNextPageField,
|
|
464
|
+
limitField: pagination.Response.LimitField,
|
|
465
|
+
offsetField: pagination.Response.OffsetField,
|
|
466
|
+
pageField: pagination.Response.PageField,
|
|
467
|
+
pageNumberField: pagination.Response.PageNumberField,
|
|
468
|
+
totalCountDataSourceId: pagination.Response.TotalCountDataSourceId,
|
|
469
|
+
totalCountField: pagination.Response.TotalCountField,
|
|
470
|
+
},
|
|
471
|
+
url: {
|
|
472
|
+
enabled: useUrl && (pagination.Url?.IsEnabled ?? true),
|
|
473
|
+
parameterPrefix:
|
|
474
|
+
parameterPrefix ??
|
|
475
|
+
pagination.Url?.ParameterPrefix ??
|
|
476
|
+
createDataSourcePaginationParameterPrefix(dataSource.Id),
|
|
477
|
+
},
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
function readPaginationTotalCount({
|
|
482
|
+
binding,
|
|
483
|
+
readDataSource,
|
|
484
|
+
response,
|
|
485
|
+
}: {
|
|
486
|
+
readonly binding: PresentationPaginationBinding
|
|
487
|
+
readonly readDataSource?: (dataSourceId: string) => unknown
|
|
488
|
+
readonly response?: unknown
|
|
489
|
+
}) {
|
|
490
|
+
const field = binding.response.totalCountField
|
|
491
|
+
if (!field) {
|
|
492
|
+
return null
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
const totalCountSourceId = binding.response.totalCountDataSourceId
|
|
496
|
+
if (totalCountSourceId) {
|
|
497
|
+
return readNumberPath(readDataSource?.(totalCountSourceId), field)
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
return readNumberPath(response, field)
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
function projectPaginationKind(
|
|
504
|
+
pagination: DataSourcePaginationDefinition,
|
|
505
|
+
): PresentationPaginationKind | null {
|
|
506
|
+
if (matchesDataSourcePaginationKind(pagination.Kind, dataSourcePaginationKinds.cursor, 'cursor')) {
|
|
507
|
+
return presentationPaginationKinds.cursor
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
if (matchesDataSourcePaginationKind(pagination.Kind, dataSourcePaginationKinds.offset, 'offset')) {
|
|
511
|
+
return presentationPaginationKinds.offset
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
if (matchesDataSourcePaginationKind(pagination.Kind, dataSourcePaginationKinds.pageNumber, 'pageNumber')) {
|
|
515
|
+
return presentationPaginationKinds.pageNumber
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
return null
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
function matchesDataSourcePaginationKind(
|
|
522
|
+
value: unknown,
|
|
523
|
+
numericValue: DataSourcePaginationKind,
|
|
524
|
+
camelLabel: string,
|
|
525
|
+
) {
|
|
526
|
+
const pascalLabel = dataSourcePaginationKindLabels[numericValue]
|
|
527
|
+
return (
|
|
528
|
+
value === numericValue ||
|
|
529
|
+
String(value) === String(numericValue) ||
|
|
530
|
+
String(value) === pascalLabel ||
|
|
531
|
+
String(value) === camelLabel
|
|
532
|
+
)
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
export function createDataSourcePaginationParameterPrefix(dataSourceId: string) {
|
|
536
|
+
return dataSourceId
|
|
537
|
+
.replace(/^[^a-zA-Z]+/, '')
|
|
538
|
+
.replace(/[^a-zA-Z0-9]+/g, '_')
|
|
539
|
+
.replace(/^_+|_+$/g, '')
|
|
540
|
+
.toLocaleLowerCase()
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function inferRequestBinding(
|
|
544
|
+
requestPaths: ReadonlySet<string>,
|
|
545
|
+
): PresentationPaginationRequestBinding {
|
|
546
|
+
return {
|
|
547
|
+
cursorField: findFieldPath(requestPaths, ['ContinuationToken', 'Cursor']),
|
|
548
|
+
limitField: findFieldPath(requestPaths, ['Limit']),
|
|
549
|
+
offsetField: findFieldPath(requestPaths, ['Offset']),
|
|
550
|
+
pageField: findFieldPath(requestPaths, ['Page']),
|
|
551
|
+
pageNumberField: findFieldPath(requestPaths, ['PageNumber']),
|
|
552
|
+
skipField: findFieldPath(requestPaths, ['Skip']),
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function inferPaginationKind(
|
|
557
|
+
request: PresentationPaginationRequestBinding,
|
|
558
|
+
): PresentationPaginationKind | null {
|
|
559
|
+
if (request.cursorField) {
|
|
560
|
+
return presentationPaginationKinds.cursor
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
if (request.offsetField || request.skipField) {
|
|
564
|
+
return presentationPaginationKinds.offset
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
if (request.pageField || request.pageNumberField) {
|
|
568
|
+
return presentationPaginationKinds.pageNumber
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
return null
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
function inferResponseBinding(
|
|
575
|
+
kind: PresentationPaginationKind,
|
|
576
|
+
): PresentationPaginationResponseBinding {
|
|
577
|
+
if (kind === presentationPaginationKinds.cursor) {
|
|
578
|
+
return {
|
|
579
|
+
cursorField: 'ContinuationToken',
|
|
580
|
+
hasNextPageField: 'PageInfo.HasNextPage',
|
|
581
|
+
limitField: 'Limit',
|
|
582
|
+
totalCountField: 'PageInfo.TotalCount',
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
if (kind === presentationPaginationKinds.offset) {
|
|
587
|
+
return {
|
|
588
|
+
hasNextPageField: 'PageInfo.HasNextPage',
|
|
589
|
+
limitField: 'Limit',
|
|
590
|
+
offsetField: 'Offset',
|
|
591
|
+
totalCountField: 'PageInfo.TotalCount',
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
return {
|
|
596
|
+
hasNextPageField: 'PageInfo.HasNextPage',
|
|
597
|
+
limitField: 'Limit',
|
|
598
|
+
pageNumberField: 'PageNumber',
|
|
599
|
+
totalCountField: 'PageInfo.TotalCount',
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
function resolveHasNextPage({
|
|
604
|
+
binding,
|
|
605
|
+
itemCount,
|
|
606
|
+
pageIndex,
|
|
607
|
+
response,
|
|
608
|
+
totalPageCount,
|
|
609
|
+
}: {
|
|
610
|
+
readonly binding: PresentationPaginationBinding
|
|
611
|
+
readonly itemCount: number
|
|
612
|
+
readonly pageIndex: number
|
|
613
|
+
readonly response?: unknown
|
|
614
|
+
readonly totalPageCount: number | null
|
|
615
|
+
}) {
|
|
616
|
+
const hasNextPage = readBooleanPath(response, binding.response.hasNextPageField)
|
|
617
|
+
if (typeof hasNextPage === 'boolean') {
|
|
618
|
+
return hasNextPage
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
if (binding.kind === presentationPaginationKinds.cursor) {
|
|
622
|
+
return Boolean(readStringPath(response, binding.response.cursorField))
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
if (totalPageCount !== null) {
|
|
626
|
+
return pageIndex + 1 < totalPageCount
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
return itemCount >= binding.defaultPageSize
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
function readPageIndex(params: URLSearchParams, parameterPrefix: string) {
|
|
633
|
+
const requestedPage = readPositiveInteger(
|
|
634
|
+
params.get(createPaginationParam(parameterPrefix, 'page')),
|
|
635
|
+
)
|
|
636
|
+
return requestedPage ? requestedPage - 1 : 0
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
function createPaginationParam(parameterPrefix: string, name: string) {
|
|
640
|
+
return `${parameterPrefix}_${name}`
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
function findFieldPath(paths: ReadonlySet<string>, names: readonly string[]) {
|
|
644
|
+
for (const name of names) {
|
|
645
|
+
const path = Array.from(paths).find(
|
|
646
|
+
(candidate) => candidate.toLocaleLowerCase() === name.toLocaleLowerCase(),
|
|
647
|
+
)
|
|
648
|
+
if (path) {
|
|
649
|
+
return path
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
return null
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
function writeRequestField(
|
|
657
|
+
target: Record<string, unknown>,
|
|
658
|
+
field: string | null | undefined,
|
|
659
|
+
value: unknown,
|
|
660
|
+
) {
|
|
661
|
+
if (!field || value === null || value === undefined || value === '') {
|
|
662
|
+
return
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
target[field] = value
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
function readBooleanPath(value: unknown, path: string | null | undefined) {
|
|
669
|
+
const raw = readObjectPath(value, path)
|
|
670
|
+
return typeof raw === 'boolean' ? raw : null
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
function readNumberPath(value: unknown, path: string | null | undefined) {
|
|
674
|
+
const raw = readObjectPath(value, path)
|
|
675
|
+
return typeof raw === 'number' && Number.isFinite(raw) ? raw : null
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
function readStringPath(value: unknown, path: string | null | undefined) {
|
|
679
|
+
const raw = readObjectPath(value, path)
|
|
680
|
+
return typeof raw === 'string' && raw.trim() ? raw.trim() : null
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
function readPositiveInteger(value: string | null) {
|
|
684
|
+
if (!value) {
|
|
685
|
+
return null
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
const parsed = Number.parseInt(value, 10)
|
|
689
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : null
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
function clamp(value: number, min: number, max: number) {
|
|
693
|
+
return Math.min(Math.max(value, min), max)
|
|
694
|
+
}
|