@flanksource/clicky-ui 0.3.18 → 0.3.20
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/dist/components/ComboboxMenu.cjs +5 -1
- package/dist/components/ComboboxMenu.cjs.map +1 -1
- package/dist/components/ComboboxMenu.d.ts.map +1 -1
- package/dist/components/ComboboxMenu.js +5 -1
- package/dist/components/ComboboxMenu.js.map +1 -1
- package/dist/components/EndpointSelector.model.cjs +96 -0
- package/dist/components/EndpointSelector.model.cjs.map +1 -0
- package/dist/components/EndpointSelector.model.d.ts +2 -0
- package/dist/components/EndpointSelector.model.d.ts.map +1 -1
- package/dist/components/EndpointSelector.model.js +96 -0
- package/dist/components/EndpointSelector.model.js.map +1 -0
- package/dist/components/ErrorWrapper.cjs +1 -1
- package/dist/components/ErrorWrapper.cjs.map +1 -1
- package/dist/components/ErrorWrapper.js +1 -1
- package/dist/components/ErrorWrapper.js.map +1 -1
- package/dist/components/FilterBar.cjs +52 -2
- package/dist/components/FilterBar.cjs.map +1 -1
- package/dist/components/FilterBar.d.ts +20 -2
- package/dist/components/FilterBar.d.ts.map +1 -1
- package/dist/components/FilterBar.js +52 -2
- package/dist/components/FilterBar.js.map +1 -1
- package/dist/components/JSONPathField.cjs +87 -66
- package/dist/components/JSONPathField.cjs.map +1 -1
- package/dist/components/JSONPathField.d.ts +26 -9
- package/dist/components/JSONPathField.d.ts.map +1 -1
- package/dist/components/JSONPathField.js +88 -67
- package/dist/components/JSONPathField.js.map +1 -1
- package/dist/components/JSONPathPlayground.cjs +225 -0
- package/dist/components/JSONPathPlayground.cjs.map +1 -0
- package/dist/components/JSONPathPlayground.d.ts +59 -0
- package/dist/components/JSONPathPlayground.d.ts.map +1 -0
- package/dist/components/JSONPathPlayground.js +225 -0
- package/dist/components/JSONPathPlayground.js.map +1 -0
- package/dist/components/OnePasswordSelector.cjs +178 -0
- package/dist/components/OnePasswordSelector.cjs.map +1 -0
- package/dist/components/OnePasswordSelector.d.ts +8 -0
- package/dist/components/OnePasswordSelector.d.ts.map +1 -0
- package/dist/components/OnePasswordSelector.js +178 -0
- package/dist/components/OnePasswordSelector.js.map +1 -0
- package/dist/components/OnePasswordSelector.model.cjs +31 -0
- package/dist/components/OnePasswordSelector.model.cjs.map +1 -0
- package/dist/components/OnePasswordSelector.model.d.ts +27 -0
- package/dist/components/OnePasswordSelector.model.d.ts.map +1 -0
- package/dist/components/OnePasswordSelector.model.js +31 -0
- package/dist/components/OnePasswordSelector.model.js.map +1 -0
- package/dist/components/SecretFormField.cjs +142 -0
- package/dist/components/SecretFormField.cjs.map +1 -0
- package/dist/components/SecretFormField.d.ts +9 -0
- package/dist/components/SecretFormField.d.ts.map +1 -0
- package/dist/components/SecretFormField.js +142 -0
- package/dist/components/SecretFormField.js.map +1 -0
- package/dist/components/SecretKeySelector.cjs +20 -14
- package/dist/components/SecretKeySelector.cjs.map +1 -1
- package/dist/components/SecretKeySelector.d.ts +4 -1
- package/dist/components/SecretKeySelector.d.ts.map +1 -1
- package/dist/components/SecretKeySelector.js +20 -14
- package/dist/components/SecretKeySelector.js.map +1 -1
- package/dist/components/TreePickerField.cjs +55 -29
- package/dist/components/TreePickerField.cjs.map +1 -1
- package/dist/components/TreePickerField.d.ts +10 -1
- package/dist/components/TreePickerField.d.ts.map +1 -1
- package/dist/components/TreePickerField.js +56 -30
- package/dist/components/TreePickerField.js.map +1 -1
- package/dist/components/UnitStepControls.cjs +55 -0
- package/dist/components/UnitStepControls.cjs.map +1 -0
- package/dist/components/UnitStepControls.d.ts +10 -0
- package/dist/components/UnitStepControls.d.ts.map +1 -0
- package/dist/components/UnitStepControls.js +55 -0
- package/dist/components/UnitStepControls.js.map +1 -0
- package/dist/components/combobox-types.d.ts +9 -0
- package/dist/components/combobox-types.d.ts.map +1 -1
- package/dist/components/filter-bar-utils.cjs +7 -0
- package/dist/components/filter-bar-utils.cjs.map +1 -1
- package/dist/components/filter-bar-utils.d.ts.map +1 -1
- package/dist/components/filter-bar-utils.js +7 -0
- package/dist/components/filter-bar-utils.js.map +1 -1
- package/dist/components/jotai-bindings-core.cjs.map +1 -1
- package/dist/components/jotai-bindings-core.d.ts +4 -1
- package/dist/components/jotai-bindings-core.d.ts.map +1 -1
- package/dist/components/jotai-bindings-core.js.map +1 -1
- package/dist/components/json-schema-form-accordion-array.cjs +5 -73
- package/dist/components/json-schema-form-accordion-array.cjs.map +1 -1
- package/dist/components/json-schema-form-accordion-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-accordion-array.js +3 -71
- package/dist/components/json-schema-form-accordion-array.js.map +1 -1
- package/dist/components/json-schema-form-array.cjs +6 -1
- package/dist/components/json-schema-form-array.cjs.map +1 -1
- package/dist/components/json-schema-form-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-array.js +6 -1
- package/dist/components/json-schema-form-array.js.map +1 -1
- package/dist/components/json-schema-form-cards-array.cjs +96 -0
- package/dist/components/json-schema-form-cards-array.cjs.map +1 -0
- package/dist/components/json-schema-form-cards-array.d.ts +7 -0
- package/dist/components/json-schema-form-cards-array.d.ts.map +1 -0
- package/dist/components/json-schema-form-cards-array.js +96 -0
- package/dist/components/json-schema-form-cards-array.js.map +1 -0
- package/dist/components/json-schema-form-item-row.cjs +81 -0
- package/dist/components/json-schema-form-item-row.cjs.map +1 -0
- package/dist/components/json-schema-form-item-row.d.ts +19 -0
- package/dist/components/json-schema-form-item-row.d.ts.map +1 -0
- package/dist/components/json-schema-form-item-row.js +81 -0
- package/dist/components/json-schema-form-item-row.js.map +1 -0
- package/dist/components/json-schema-form-render.cjs +4 -3
- package/dist/components/json-schema-form-render.cjs.map +1 -1
- package/dist/components/json-schema-form-render.d.ts.map +1 -1
- package/dist/components/json-schema-form-render.js +4 -3
- package/dist/components/json-schema-form-render.js.map +1 -1
- package/dist/components/json-schema-form-resolve.cjs +1 -1
- package/dist/components/json-schema-form-resolve.cjs.map +1 -1
- package/dist/components/json-schema-form-resolve.js +1 -1
- package/dist/components/json-schema-form-resolve.js.map +1 -1
- package/dist/components/json-schema-form-tone.cjs +12 -0
- package/dist/components/json-schema-form-tone.cjs.map +1 -1
- package/dist/components/json-schema-form-tone.js +12 -0
- package/dist/components/json-schema-form-tone.js.map +1 -1
- package/dist/components/json-schema-form-types.d.ts +10 -1
- package/dist/components/json-schema-form-types.d.ts.map +1 -1
- package/dist/components/jsonPathTree.cjs +189 -0
- package/dist/components/jsonPathTree.cjs.map +1 -0
- package/dist/components/jsonPathTree.d.ts +92 -0
- package/dist/components/jsonPathTree.d.ts.map +1 -0
- package/dist/components/jsonPathTree.js +189 -0
- package/dist/components/jsonPathTree.js.map +1 -0
- package/dist/components/secret-form-extension.cjs +30 -0
- package/dist/components/secret-form-extension.cjs.map +1 -0
- package/dist/components/secret-form-extension.d.ts +23 -0
- package/dist/components/secret-form-extension.d.ts.map +1 -0
- package/dist/components/secret-form-extension.js +30 -0
- package/dist/components/secret-form-extension.js.map +1 -0
- package/dist/components/unit-form-extension.cjs +126 -0
- package/dist/components/unit-form-extension.cjs.map +1 -0
- package/dist/components/unit-form-extension.d.ts +8 -0
- package/dist/components/unit-form-extension.d.ts.map +1 -0
- package/dist/components/unit-form-extension.js +126 -0
- package/dist/components/unit-form-extension.js.map +1 -0
- package/dist/components.cjs +20 -0
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.ts +7 -0
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +20 -0
- package/dist/components.js.map +1 -1
- package/dist/data/TaskExecDetails.cjs +40 -0
- package/dist/data/TaskExecDetails.cjs.map +1 -0
- package/dist/data/TaskExecDetails.d.ts +5 -0
- package/dist/data/TaskExecDetails.d.ts.map +1 -0
- package/dist/data/TaskExecDetails.js +40 -0
- package/dist/data/TaskExecDetails.js.map +1 -0
- package/dist/data/TaskProgress.cjs +9 -3
- package/dist/data/TaskProgress.cjs.map +1 -1
- package/dist/data/TaskProgress.d.ts.map +1 -1
- package/dist/data/TaskProgress.js +9 -3
- package/dist/data/TaskProgress.js.map +1 -1
- package/dist/data/TaskSnapshot.cjs.map +1 -1
- package/dist/data/TaskSnapshot.d.ts +12 -1
- package/dist/data/TaskSnapshot.d.ts.map +1 -1
- package/dist/data/TaskSnapshot.js.map +1 -1
- package/dist/data/TreeNode.cjs +3 -0
- package/dist/data/TreeNode.cjs.map +1 -1
- package/dist/data/TreeNode.d.ts.map +1 -1
- package/dist/data/TreeNode.js +3 -0
- package/dist/data/TreeNode.js.map +1 -1
- package/dist/data/data-table-filter-values.cjs +20 -0
- package/dist/data/data-table-filter-values.cjs.map +1 -1
- package/dist/data/data-table-filter-values.d.ts +16 -0
- package/dist/data/data-table-filter-values.d.ts.map +1 -1
- package/dist/data/data-table-filter-values.js +20 -0
- package/dist/data/data-table-filter-values.js.map +1 -1
- package/dist/data/data-table-server-filters.cjs +23 -29
- package/dist/data/data-table-server-filters.cjs.map +1 -1
- package/dist/data/data-table-server-filters.d.ts.map +1 -1
- package/dist/data/data-table-server-filters.js +21 -27
- package/dist/data/data-table-server-filters.js.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.cjs +61 -8
- package/dist/data/diagnostics/ErrorDetails.cjs.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.d.ts.map +1 -1
- package/dist/data/diagnostics/ErrorDetails.js +61 -8
- package/dist/data/diagnostics/ErrorDetails.js.map +1 -1
- package/dist/data/diagnostics/error-diagnostics.cjs +10 -4
- package/dist/data/diagnostics/error-diagnostics.cjs.map +1 -1
- package/dist/data/diagnostics/error-diagnostics.d.ts.map +1 -1
- package/dist/data/diagnostics/error-diagnostics.js +10 -4
- package/dist/data/diagnostics/error-diagnostics.js.map +1 -1
- package/dist/data/query-browser/QueryBrowser.cjs +139 -161
- package/dist/data/query-browser/QueryBrowser.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.d.ts +1 -71
- package/dist/data/query-browser/QueryBrowser.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.editor.cjs +88 -0
- package/dist/data/query-browser/QueryBrowser.editor.cjs.map +1 -0
- package/dist/data/query-browser/QueryBrowser.editor.d.ts +12 -0
- package/dist/data/query-browser/QueryBrowser.editor.d.ts.map +1 -0
- package/dist/data/query-browser/QueryBrowser.editor.js +88 -0
- package/dist/data/query-browser/QueryBrowser.editor.js.map +1 -0
- package/dist/data/query-browser/QueryBrowser.js +140 -162
- package/dist/data/query-browser/QueryBrowser.js.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.cjs +12 -0
- package/dist/data/query-browser/QueryBrowser.types.cjs.map +1 -0
- package/dist/data/query-browser/QueryBrowser.types.d.ts +94 -0
- package/dist/data/query-browser/QueryBrowser.types.d.ts.map +1 -0
- package/dist/data/query-browser/QueryBrowser.types.js +12 -0
- package/dist/data/query-browser/QueryBrowser.types.js.map +1 -0
- package/dist/data/query-browser/QueryBrowserDiagnosticsPanel.cjs +56 -0
- package/dist/data/query-browser/QueryBrowserDiagnosticsPanel.cjs.map +1 -0
- package/dist/data/query-browser/QueryBrowserDiagnosticsPanel.d.ts +5 -0
- package/dist/data/query-browser/QueryBrowserDiagnosticsPanel.d.ts.map +1 -0
- package/dist/data/query-browser/QueryBrowserDiagnosticsPanel.js +56 -0
- package/dist/data/query-browser/QueryBrowserDiagnosticsPanel.js.map +1 -0
- package/dist/data/query-browser/QueryBrowserResults.cjs +80 -0
- package/dist/data/query-browser/QueryBrowserResults.cjs.map +1 -0
- package/dist/data/query-browser/QueryBrowserResults.d.ts +16 -0
- package/dist/data/query-browser/QueryBrowserResults.d.ts.map +1 -0
- package/dist/data/query-browser/QueryBrowserResults.js +80 -0
- package/dist/data/query-browser/QueryBrowserResults.js.map +1 -0
- package/dist/data/query-browser/index.d.ts +2 -1
- package/dist/data/query-browser/index.d.ts.map +1 -1
- package/dist/data/task-exec-details.cjs +9 -0
- package/dist/data/task-exec-details.cjs.map +1 -0
- package/dist/data/task-exec-details.d.ts +3 -0
- package/dist/data/task-exec-details.d.ts.map +1 -0
- package/dist/data/task-exec-details.js +9 -0
- package/dist/data/task-exec-details.js.map +1 -0
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/data.cjs +2 -0
- package/dist/data.cjs.map +1 -1
- package/dist/data.d.ts +1 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +2 -0
- package/dist/data.js.map +1 -1
- package/dist/index.cjs +22 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/string.cjs +8 -0
- package/dist/lib/string.cjs.map +1 -1
- package/dist/lib/string.d.ts +1 -0
- package/dist/lib/string.d.ts.map +1 -1
- package/dist/lib/string.js +8 -0
- package/dist/lib/string.js.map +1 -1
- package/dist/profiles/catalogTree.cjs +133 -0
- package/dist/profiles/catalogTree.cjs.map +1 -0
- package/dist/profiles/catalogTree.d.ts +11 -0
- package/dist/profiles/catalogTree.d.ts.map +1 -0
- package/dist/profiles/catalogTree.js +133 -0
- package/dist/profiles/catalogTree.js.map +1 -0
- package/dist/profiles/connectionBrowserModel.cjs +185 -0
- package/dist/profiles/connectionBrowserModel.cjs.map +1 -0
- package/dist/profiles/connectionBrowserModel.d.ts +169 -0
- package/dist/profiles/connectionBrowserModel.d.ts.map +1 -0
- package/dist/profiles/connectionBrowserModel.js +185 -0
- package/dist/profiles/connectionBrowserModel.js.map +1 -0
- package/dist/profiles/connectionQueryWorkspace.cjs +185 -0
- package/dist/profiles/connectionQueryWorkspace.cjs.map +1 -0
- package/dist/profiles/connectionQueryWorkspace.d.ts +63 -0
- package/dist/profiles/connectionQueryWorkspace.d.ts.map +1 -0
- package/dist/profiles/connectionQueryWorkspace.js +185 -0
- package/dist/profiles/connectionQueryWorkspace.js.map +1 -0
- package/dist/profiles/connectionQueryWorkspaceModel.cjs +28 -0
- package/dist/profiles/connectionQueryWorkspaceModel.cjs.map +1 -0
- package/dist/profiles/connectionQueryWorkspaceModel.d.ts +38 -0
- package/dist/profiles/connectionQueryWorkspaceModel.d.ts.map +1 -0
- package/dist/profiles/connectionQueryWorkspaceModel.js +28 -0
- package/dist/profiles/connectionQueryWorkspaceModel.js.map +1 -0
- package/dist/profiles/esFieldValues.cjs +64 -0
- package/dist/profiles/esFieldValues.cjs.map +1 -0
- package/dist/profiles/esFieldValues.d.ts +48 -0
- package/dist/profiles/esFieldValues.d.ts.map +1 -0
- package/dist/profiles/esFieldValues.js +64 -0
- package/dist/profiles/esFieldValues.js.map +1 -0
- package/dist/profiles/esParamMappingModel.cjs +301 -0
- package/dist/profiles/esParamMappingModel.cjs.map +1 -0
- package/dist/profiles/esParamMappingModel.d.ts +37 -0
- package/dist/profiles/esParamMappingModel.d.ts.map +1 -0
- package/dist/profiles/esParamMappingModel.js +301 -0
- package/dist/profiles/esParamMappingModel.js.map +1 -0
- package/dist/profiles/esParamMappingPill.cjs +24 -0
- package/dist/profiles/esParamMappingPill.cjs.map +1 -0
- package/dist/profiles/esParamMappingPill.d.ts +13 -0
- package/dist/profiles/esParamMappingPill.d.ts.map +1 -0
- package/dist/profiles/esParamMappingPill.js +24 -0
- package/dist/profiles/esParamMappingPill.js.map +1 -0
- package/dist/profiles/esParamOperandExtension.cjs +75 -0
- package/dist/profiles/esParamOperandExtension.cjs.map +1 -0
- package/dist/profiles/esParamOperandExtension.d.ts +11 -0
- package/dist/profiles/esParamOperandExtension.d.ts.map +1 -0
- package/dist/profiles/esParamOperandExtension.js +75 -0
- package/dist/profiles/esParamOperandExtension.js.map +1 -0
- package/dist/profiles/esQueryBuilder.cjs +205 -0
- package/dist/profiles/esQueryBuilder.cjs.map +1 -0
- package/dist/profiles/esQueryBuilder.d.ts +35 -0
- package/dist/profiles/esQueryBuilder.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilder.js +205 -0
- package/dist/profiles/esQueryBuilder.js.map +1 -0
- package/dist/profiles/esQueryBuilderExtension.cjs +23 -0
- package/dist/profiles/esQueryBuilderExtension.cjs.map +1 -0
- package/dist/profiles/esQueryBuilderExtension.d.ts +5 -0
- package/dist/profiles/esQueryBuilderExtension.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilderExtension.js +23 -0
- package/dist/profiles/esQueryBuilderExtension.js.map +1 -0
- package/dist/profiles/esQueryBuilderForm.cjs +26 -0
- package/dist/profiles/esQueryBuilderForm.cjs.map +1 -0
- package/dist/profiles/esQueryBuilderForm.d.ts +18 -0
- package/dist/profiles/esQueryBuilderForm.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilderForm.js +26 -0
- package/dist/profiles/esQueryBuilderForm.js.map +1 -0
- package/dist/profiles/esQueryBuilderModel.cjs +131 -0
- package/dist/profiles/esQueryBuilderModel.cjs.map +1 -0
- package/dist/profiles/esQueryBuilderModel.d.ts +108 -0
- package/dist/profiles/esQueryBuilderModel.d.ts.map +1 -0
- package/dist/profiles/esQueryBuilderModel.js +131 -0
- package/dist/profiles/esQueryBuilderModel.js.map +1 -0
- package/dist/profiles/esQueryClauseGroup.cjs +144 -0
- package/dist/profiles/esQueryClauseGroup.cjs.map +1 -0
- package/dist/profiles/esQueryClauseGroup.d.ts +10 -0
- package/dist/profiles/esQueryClauseGroup.d.ts.map +1 -0
- package/dist/profiles/esQueryClauseGroup.js +144 -0
- package/dist/profiles/esQueryClauseGroup.js.map +1 -0
- package/dist/profiles/esQueryCompile.cjs +47 -0
- package/dist/profiles/esQueryCompile.cjs.map +1 -0
- package/dist/profiles/esQueryCompile.d.ts +39 -0
- package/dist/profiles/esQueryCompile.d.ts.map +1 -0
- package/dist/profiles/esQueryCompile.js +47 -0
- package/dist/profiles/esQueryCompile.js.map +1 -0
- package/dist/profiles/esQueryConditionRow.cjs +168 -0
- package/dist/profiles/esQueryConditionRow.cjs.map +1 -0
- package/dist/profiles/esQueryConditionRow.d.ts +37 -0
- package/dist/profiles/esQueryConditionRow.d.ts.map +1 -0
- package/dist/profiles/esQueryConditionRow.js +168 -0
- package/dist/profiles/esQueryConditionRow.js.map +1 -0
- package/dist/profiles/esQueryGroupModel.cjs +12 -0
- package/dist/profiles/esQueryGroupModel.cjs.map +1 -0
- package/dist/profiles/esQueryGroupModel.d.ts +9 -0
- package/dist/profiles/esQueryGroupModel.d.ts.map +1 -0
- package/dist/profiles/esQueryGroupModel.js +12 -0
- package/dist/profiles/esQueryGroupModel.js.map +1 -0
- package/dist/profiles/esQueryOccur.cjs +16 -0
- package/dist/profiles/esQueryOccur.cjs.map +1 -0
- package/dist/profiles/esQueryOccur.d.ts +11 -0
- package/dist/profiles/esQueryOccur.d.ts.map +1 -0
- package/dist/profiles/esQueryOccur.js +16 -0
- package/dist/profiles/esQueryOccur.js.map +1 -0
- package/dist/profiles/esQueryOperandEditors.cjs +279 -0
- package/dist/profiles/esQueryOperandEditors.cjs.map +1 -0
- package/dist/profiles/esQueryOperandEditors.d.ts +24 -0
- package/dist/profiles/esQueryOperandEditors.d.ts.map +1 -0
- package/dist/profiles/esQueryOperandEditors.js +279 -0
- package/dist/profiles/esQueryOperandEditors.js.map +1 -0
- package/dist/profiles/esQueryOperandModel.cjs +28 -0
- package/dist/profiles/esQueryOperandModel.cjs.map +1 -0
- package/dist/profiles/esQueryOperandModel.d.ts +17 -0
- package/dist/profiles/esQueryOperandModel.d.ts.map +1 -0
- package/dist/profiles/esQueryOperandModel.js +28 -0
- package/dist/profiles/esQueryOperandModel.js.map +1 -0
- package/dist/profiles/esQueryOperators.cjs +165 -0
- package/dist/profiles/esQueryOperators.cjs.map +1 -0
- package/dist/profiles/esQueryOperators.d.ts +83 -0
- package/dist/profiles/esQueryOperators.d.ts.map +1 -0
- package/dist/profiles/esQueryOperators.js +165 -0
- package/dist/profiles/esQueryOperators.js.map +1 -0
- package/dist/profiles/esQueryOutputEditor.cjs +138 -0
- package/dist/profiles/esQueryOutputEditor.cjs.map +1 -0
- package/dist/profiles/esQueryOutputEditor.d.ts +7 -0
- package/dist/profiles/esQueryOutputEditor.d.ts.map +1 -0
- package/dist/profiles/esQueryOutputEditor.js +138 -0
- package/dist/profiles/esQueryOutputEditor.js.map +1 -0
- package/dist/profiles/esQueryOutputModel.cjs +16 -0
- package/dist/profiles/esQueryOutputModel.cjs.map +1 -0
- package/dist/profiles/esQueryOutputModel.d.ts +14 -0
- package/dist/profiles/esQueryOutputModel.d.ts.map +1 -0
- package/dist/profiles/esQueryOutputModel.js +16 -0
- package/dist/profiles/esQueryOutputModel.js.map +1 -0
- package/dist/profiles/esQueryPreview.cjs +30 -0
- package/dist/profiles/esQueryPreview.cjs.map +1 -0
- package/dist/profiles/esQueryPreview.d.ts +6 -0
- package/dist/profiles/esQueryPreview.d.ts.map +1 -0
- package/dist/profiles/esQueryPreview.js +30 -0
- package/dist/profiles/esQueryPreview.js.map +1 -0
- package/dist/profiles/esQuerySortEditor.cjs +143 -0
- package/dist/profiles/esQuerySortEditor.cjs.map +1 -0
- package/dist/profiles/esQuerySortEditor.d.ts +9 -0
- package/dist/profiles/esQuerySortEditor.d.ts.map +1 -0
- package/dist/profiles/esQuerySortEditor.js +143 -0
- package/dist/profiles/esQuerySortEditor.js.map +1 -0
- package/dist/profiles/esQuerySortModel.cjs +13 -0
- package/dist/profiles/esQuerySortModel.cjs.map +1 -0
- package/dist/profiles/esQuerySortModel.d.ts +4 -0
- package/dist/profiles/esQuerySortModel.d.ts.map +1 -0
- package/dist/profiles/esQuerySortModel.js +13 -0
- package/dist/profiles/esQuerySortModel.js.map +1 -0
- package/dist/profiles/esValueCombobox.cjs +86 -0
- package/dist/profiles/esValueCombobox.cjs.map +1 -0
- package/dist/profiles/esValueCombobox.d.ts +15 -0
- package/dist/profiles/esValueCombobox.d.ts.map +1 -0
- package/dist/profiles/esValueCombobox.js +86 -0
- package/dist/profiles/esValueCombobox.js.map +1 -0
- package/dist/profiles/jsonPathSample.cjs +75 -0
- package/dist/profiles/jsonPathSample.cjs.map +1 -0
- package/dist/profiles/jsonPathSample.d.ts +27 -0
- package/dist/profiles/jsonPathSample.d.ts.map +1 -0
- package/dist/profiles/jsonPathSample.js +75 -0
- package/dist/profiles/jsonPathSample.js.map +1 -0
- package/dist/profiles/jsonPathSampleRow.cjs +14 -0
- package/dist/profiles/jsonPathSampleRow.cjs.map +1 -0
- package/dist/profiles/jsonPathSampleRow.d.ts +6 -0
- package/dist/profiles/jsonPathSampleRow.d.ts.map +1 -0
- package/dist/profiles/jsonPathSampleRow.js +14 -0
- package/dist/profiles/jsonPathSampleRow.js.map +1 -0
- package/dist/profiles/profileApi.cjs +37 -0
- package/dist/profiles/profileApi.cjs.map +1 -0
- package/dist/profiles/profileApi.d.ts +32 -0
- package/dist/profiles/profileApi.d.ts.map +1 -0
- package/dist/profiles/profileApi.js +37 -0
- package/dist/profiles/profileApi.js.map +1 -0
- package/dist/profiles/profileBuilder.cjs +65 -0
- package/dist/profiles/profileBuilder.cjs.map +1 -0
- package/dist/profiles/profileBuilder.d.ts +11 -0
- package/dist/profiles/profileBuilder.d.ts.map +1 -0
- package/dist/profiles/profileBuilder.js +65 -0
- package/dist/profiles/profileBuilder.js.map +1 -0
- package/dist/profiles/profileBuilderExtension.cjs +25 -0
- package/dist/profiles/profileBuilderExtension.cjs.map +1 -0
- package/dist/profiles/profileBuilderExtension.d.ts +5 -0
- package/dist/profiles/profileBuilderExtension.d.ts.map +1 -0
- package/dist/profiles/profileBuilderExtension.js +25 -0
- package/dist/profiles/profileBuilderExtension.js.map +1 -0
- package/dist/profiles/profileBuilderWorkspace.cjs +368 -0
- package/dist/profiles/profileBuilderWorkspace.cjs.map +1 -0
- package/dist/profiles/profileBuilderWorkspace.d.ts +21 -0
- package/dist/profiles/profileBuilderWorkspace.d.ts.map +1 -0
- package/dist/profiles/profileBuilderWorkspace.js +368 -0
- package/dist/profiles/profileBuilderWorkspace.js.map +1 -0
- package/dist/profiles/profileColumnModel.cjs +23 -0
- package/dist/profiles/profileColumnModel.cjs.map +1 -0
- package/dist/profiles/profileColumnModel.d.ts +8 -0
- package/dist/profiles/profileColumnModel.d.ts.map +1 -0
- package/dist/profiles/profileColumnModel.js +23 -0
- package/dist/profiles/profileColumnModel.js.map +1 -0
- package/dist/profiles/profileColumnPicker.cjs +68 -0
- package/dist/profiles/profileColumnPicker.cjs.map +1 -0
- package/dist/profiles/profileColumnPicker.d.ts +11 -0
- package/dist/profiles/profileColumnPicker.d.ts.map +1 -0
- package/dist/profiles/profileColumnPicker.js +68 -0
- package/dist/profiles/profileColumnPicker.js.map +1 -0
- package/dist/profiles/profileEditor.cjs +386 -0
- package/dist/profiles/profileEditor.cjs.map +1 -0
- package/dist/profiles/profileEditor.d.ts +19 -0
- package/dist/profiles/profileEditor.d.ts.map +1 -0
- package/dist/profiles/profileEditor.js +386 -0
- package/dist/profiles/profileEditor.js.map +1 -0
- package/dist/profiles/profileEditorModel.cjs +181 -0
- package/dist/profiles/profileEditorModel.cjs.map +1 -0
- package/dist/profiles/profileEditorModel.d.ts +74 -0
- package/dist/profiles/profileEditorModel.d.ts.map +1 -0
- package/dist/profiles/profileEditorModel.js +181 -0
- package/dist/profiles/profileEditorModel.js.map +1 -0
- package/dist/profiles/profileEditorPreview.cjs +38 -0
- package/dist/profiles/profileEditorPreview.cjs.map +1 -0
- package/dist/profiles/profileEditorPreview.d.ts +12 -0
- package/dist/profiles/profileEditorPreview.d.ts.map +1 -0
- package/dist/profiles/profileEditorPreview.js +38 -0
- package/dist/profiles/profileEditorPreview.js.map +1 -0
- package/dist/profiles/profileEditorRail.cjs +46 -0
- package/dist/profiles/profileEditorRail.cjs.map +1 -0
- package/dist/profiles/profileEditorRail.d.ts +8 -0
- package/dist/profiles/profileEditorRail.d.ts.map +1 -0
- package/dist/profiles/profileEditorRail.js +46 -0
- package/dist/profiles/profileEditorRail.js.map +1 -0
- package/dist/profiles/profileEditorRaw.cjs +118 -0
- package/dist/profiles/profileEditorRaw.cjs.map +1 -0
- package/dist/profiles/profileEditorRaw.d.ts +7 -0
- package/dist/profiles/profileEditorRaw.d.ts.map +1 -0
- package/dist/profiles/profileEditorRaw.js +118 -0
- package/dist/profiles/profileEditorRaw.js.map +1 -0
- package/dist/profiles/profileEditorRoutes.cjs +7 -0
- package/dist/profiles/profileEditorRoutes.cjs.map +1 -0
- package/dist/profiles/profileEditorRoutes.d.ts +2 -0
- package/dist/profiles/profileEditorRoutes.d.ts.map +1 -0
- package/dist/profiles/profileEditorRoutes.js +7 -0
- package/dist/profiles/profileEditorRoutes.js.map +1 -0
- package/dist/profiles/profileEditorSections.cjs +213 -0
- package/dist/profiles/profileEditorSections.cjs.map +1 -0
- package/dist/profiles/profileEditorSections.d.ts +23 -0
- package/dist/profiles/profileEditorSections.d.ts.map +1 -0
- package/dist/profiles/profileEditorSections.js +213 -0
- package/dist/profiles/profileEditorSections.js.map +1 -0
- package/dist/profiles/profileFieldEditor.cjs +200 -0
- package/dist/profiles/profileFieldEditor.cjs.map +1 -0
- package/dist/profiles/profileFieldEditor.d.ts +34 -0
- package/dist/profiles/profileFieldEditor.d.ts.map +1 -0
- package/dist/profiles/profileFieldEditor.js +200 -0
- package/dist/profiles/profileFieldEditor.js.map +1 -0
- package/dist/profiles/profileFieldGrid.cjs +250 -0
- package/dist/profiles/profileFieldGrid.cjs.map +1 -0
- package/dist/profiles/profileFieldGrid.d.ts +20 -0
- package/dist/profiles/profileFieldGrid.d.ts.map +1 -0
- package/dist/profiles/profileFieldGrid.js +250 -0
- package/dist/profiles/profileFieldGrid.js.map +1 -0
- package/dist/profiles/profileFieldManager.cjs +103 -0
- package/dist/profiles/profileFieldManager.cjs.map +1 -0
- package/dist/profiles/profileFieldManager.d.ts +9 -0
- package/dist/profiles/profileFieldManager.d.ts.map +1 -0
- package/dist/profiles/profileFieldManager.js +103 -0
- package/dist/profiles/profileFieldManager.js.map +1 -0
- package/dist/profiles/profileFieldState.cjs +136 -0
- package/dist/profiles/profileFieldState.cjs.map +1 -0
- package/dist/profiles/profileFieldState.d.ts +41 -0
- package/dist/profiles/profileFieldState.d.ts.map +1 -0
- package/dist/profiles/profileFieldState.js +136 -0
- package/dist/profiles/profileFieldState.js.map +1 -0
- package/dist/profiles/profileFieldTypes.cjs +17 -0
- package/dist/profiles/profileFieldTypes.cjs.map +1 -0
- package/dist/profiles/profileFieldTypes.d.ts +8 -0
- package/dist/profiles/profileFieldTypes.d.ts.map +1 -0
- package/dist/profiles/profileFieldTypes.js +17 -0
- package/dist/profiles/profileFieldTypes.js.map +1 -0
- package/dist/profiles/profileParamModel.cjs +78 -0
- package/dist/profiles/profileParamModel.cjs.map +1 -0
- package/dist/profiles/profileParamModel.d.ts +3 -0
- package/dist/profiles/profileParamModel.d.ts.map +1 -0
- package/dist/profiles/profileParamModel.js +78 -0
- package/dist/profiles/profileParamModel.js.map +1 -0
- package/dist/profiles/profileSamplePayload.cjs +15 -0
- package/dist/profiles/profileSamplePayload.cjs.map +1 -0
- package/dist/profiles/profileSamplePayload.d.ts +13 -0
- package/dist/profiles/profileSamplePayload.d.ts.map +1 -0
- package/dist/profiles/profileSamplePayload.js +15 -0
- package/dist/profiles/profileSamplePayload.js.map +1 -0
- package/dist/profiles/profileWizard.cjs +257 -0
- package/dist/profiles/profileWizard.cjs.map +1 -0
- package/dist/profiles/profileWizard.d.ts +12 -0
- package/dist/profiles/profileWizard.d.ts.map +1 -0
- package/dist/profiles/profileWizard.js +257 -0
- package/dist/profiles/profileWizard.js.map +1 -0
- package/dist/profiles/profileWizardHelp.cjs +10 -0
- package/dist/profiles/profileWizardHelp.cjs.map +1 -0
- package/dist/profiles/profileWizardHelp.d.ts +13 -0
- package/dist/profiles/profileWizardHelp.d.ts.map +1 -0
- package/dist/profiles/profileWizardHelp.js +10 -0
- package/dist/profiles/profileWizardHelp.js.map +1 -0
- package/dist/profiles/profileWizardModel.cjs +198 -0
- package/dist/profiles/profileWizardModel.cjs.map +1 -0
- package/dist/profiles/profileWizardModel.d.ts +255 -0
- package/dist/profiles/profileWizardModel.d.ts.map +1 -0
- package/dist/profiles/profileWizardModel.js +198 -0
- package/dist/profiles/profileWizardModel.js.map +1 -0
- package/dist/profiles/profileWizardQueryStep.cjs +215 -0
- package/dist/profiles/profileWizardQueryStep.cjs.map +1 -0
- package/dist/profiles/profileWizardQueryStep.d.ts +18 -0
- package/dist/profiles/profileWizardQueryStep.d.ts.map +1 -0
- package/dist/profiles/profileWizardQueryStep.js +215 -0
- package/dist/profiles/profileWizardQueryStep.js.map +1 -0
- package/dist/profiles/profileWizardSteps.cjs +214 -0
- package/dist/profiles/profileWizardSteps.cjs.map +1 -0
- package/dist/profiles/profileWizardSteps.d.ts +35 -0
- package/dist/profiles/profileWizardSteps.d.ts.map +1 -0
- package/dist/profiles/profileWizardSteps.js +214 -0
- package/dist/profiles/profileWizardSteps.js.map +1 -0
- package/dist/profiles/profileYaml.cjs +19 -0
- package/dist/profiles/profileYaml.cjs.map +1 -0
- package/dist/profiles/profileYaml.d.ts +4 -0
- package/dist/profiles/profileYaml.d.ts.map +1 -0
- package/dist/profiles/profileYaml.js +19 -0
- package/dist/profiles/profileYaml.js.map +1 -0
- package/dist/profiles/prometheusResults.cjs +60 -0
- package/dist/profiles/prometheusResults.cjs.map +1 -0
- package/dist/profiles/prometheusResults.d.ts +7 -0
- package/dist/profiles/prometheusResults.d.ts.map +1 -0
- package/dist/profiles/prometheusResults.js +60 -0
- package/dist/profiles/prometheusResults.js.map +1 -0
- package/dist/profiles/queryRowLimits.cjs +82 -0
- package/dist/profiles/queryRowLimits.cjs.map +1 -0
- package/dist/profiles/queryRowLimits.d.ts +9 -0
- package/dist/profiles/queryRowLimits.d.ts.map +1 -0
- package/dist/profiles/queryRowLimits.js +82 -0
- package/dist/profiles/queryRowLimits.js.map +1 -0
- package/dist/profiles/queryRowLimitsModel.cjs +10 -0
- package/dist/profiles/queryRowLimitsModel.cjs.map +1 -0
- package/dist/profiles/queryRowLimitsModel.d.ts +9 -0
- package/dist/profiles/queryRowLimitsModel.d.ts.map +1 -0
- package/dist/profiles/queryRowLimitsModel.js +10 -0
- package/dist/profiles/queryRowLimitsModel.js.map +1 -0
- package/dist/profiles/queryTargetPicker.cjs +42 -0
- package/dist/profiles/queryTargetPicker.cjs.map +1 -0
- package/dist/profiles/queryTargetPicker.d.ts +8 -0
- package/dist/profiles/queryTargetPicker.d.ts.map +1 -0
- package/dist/profiles/queryTargetPicker.js +42 -0
- package/dist/profiles/queryTargetPicker.js.map +1 -0
- package/dist/profiles/testSchema.d.ts +3 -0
- package/dist/profiles/testSchema.d.ts.map +1 -0
- package/dist/profiles.cjs +223 -0
- package/dist/profiles.cjs.map +1 -0
- package/dist/profiles.d.ts +68 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +223 -0
- package/dist/profiles.js.map +1 -0
- package/dist/rpc/FilterForm.cjs +20 -0
- package/dist/rpc/FilterForm.cjs.map +1 -1
- package/dist/rpc/FilterForm.js +20 -0
- package/dist/rpc/FilterForm.js.map +1 -1
- package/dist/rpc/formMetadata.cjs +34 -0
- package/dist/rpc/formMetadata.cjs.map +1 -1
- package/dist/rpc/formMetadata.d.ts.map +1 -1
- package/dist/rpc/formMetadata.js +35 -1
- package/dist/rpc/formMetadata.js.map +1 -1
- package/dist/rpc/types.cjs.map +1 -1
- package/dist/rpc/types.d.ts +9 -1
- package/dist/rpc/types.d.ts.map +1 -1
- package/dist/rpc/types.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esValueCombobox.d.ts","sourceRoot":"","sources":["../../src/profiles/esValueCombobox.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,gBAAgB,EAAqB,MAAM,iBAAiB,CAAC;AAqC3E,wBAAgB,aAAa,CAAC,EAC5B,EAAE,EACF,KAAK,EACL,MAAM,EACN,KAAK,EACL,QAAQ,GACT,EAAE;IACD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,2CAkBA;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACpC,2CAmBA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Combobox } from "../components/Combobox.js";
|
|
3
|
+
import { useQuery, keepPreviousData } from "@tanstack/react-query";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
function useFieldValues(lookup) {
|
|
6
|
+
const [query, setQuery] = useState("");
|
|
7
|
+
const result = useQuery({
|
|
8
|
+
queryKey: ["es-field-values", lookup.key, query],
|
|
9
|
+
queryFn: () => lookup.fetch(query),
|
|
10
|
+
placeholderData: keepPreviousData,
|
|
11
|
+
staleTime: 3e4,
|
|
12
|
+
retry: 0
|
|
13
|
+
});
|
|
14
|
+
return { ...result, onSearch: setQuery };
|
|
15
|
+
}
|
|
16
|
+
function valueOptions(result) {
|
|
17
|
+
return ((result == null ? void 0 : result.values) ?? []).map((entry) => ({
|
|
18
|
+
value: entry.value,
|
|
19
|
+
label: entry.value,
|
|
20
|
+
title: `${entry.count.toLocaleString()} documents`
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
function valueSummary(result, error) {
|
|
24
|
+
if (error) return error.message;
|
|
25
|
+
if (!result) return void 0;
|
|
26
|
+
const scope = result.scoped ? "matching current filters" : "across the index";
|
|
27
|
+
if (!result.values.length) return `no values ${scope}`;
|
|
28
|
+
return `${result.values.length} of ${result.total.toLocaleString()} · ${scope}`;
|
|
29
|
+
}
|
|
30
|
+
function ValueCombobox({
|
|
31
|
+
id,
|
|
32
|
+
label,
|
|
33
|
+
lookup,
|
|
34
|
+
value,
|
|
35
|
+
onChange
|
|
36
|
+
}) {
|
|
37
|
+
const { data, error, isFetching, onSearch } = useFieldValues(lookup);
|
|
38
|
+
const summary = valueSummary(data, error);
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
40
|
+
Combobox,
|
|
41
|
+
{
|
|
42
|
+
id,
|
|
43
|
+
ariaLabel: label,
|
|
44
|
+
className: "min-w-48",
|
|
45
|
+
placeholder: label,
|
|
46
|
+
value,
|
|
47
|
+
onChange,
|
|
48
|
+
options: valueOptions(data),
|
|
49
|
+
onSearch,
|
|
50
|
+
loading: isFetching,
|
|
51
|
+
allowCustomValue: true,
|
|
52
|
+
...summary ? { footer: summary } : {}
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
function ValuesCombobox({
|
|
57
|
+
label,
|
|
58
|
+
lookup,
|
|
59
|
+
values,
|
|
60
|
+
onChange
|
|
61
|
+
}) {
|
|
62
|
+
const { data, error, isFetching, onSearch } = useFieldValues(lookup);
|
|
63
|
+
const summary = valueSummary(data, error);
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
65
|
+
Combobox,
|
|
66
|
+
{
|
|
67
|
+
multiple: true,
|
|
68
|
+
variant: "tags",
|
|
69
|
+
ariaLabel: label,
|
|
70
|
+
className: "min-w-56 flex-1",
|
|
71
|
+
placeholder: label,
|
|
72
|
+
value: values,
|
|
73
|
+
onChange,
|
|
74
|
+
options: valueOptions(data),
|
|
75
|
+
onSearch,
|
|
76
|
+
loading: isFetching,
|
|
77
|
+
allowCustomValue: true,
|
|
78
|
+
...summary ? { footer: summary } : {}
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
ValueCombobox,
|
|
84
|
+
ValuesCombobox
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=esValueCombobox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esValueCombobox.js","sources":["../../src/profiles/esValueCombobox.tsx"],"sourcesContent":["/**\n * The operand controls backed by a field's real values. Typing narrows the\n * terms aggregation server-side rather than filtering a fetched page, so a\n * field with thousands of values stays usable; a value outside the returned\n * window is still typeable, which is what `allowCustomValue` stands for.\n */\n\nimport { Combobox } from \"../components/Combobox\";\nimport type { ComboboxOption } from \"../components/Combobox\";\nimport { keepPreviousData, useQuery } from \"@tanstack/react-query\";\nimport { useState } from \"react\";\nimport type { FieldValuesQuery, FieldValuesResult } from \"./esFieldValues\";\n\nfunction useFieldValues(lookup: FieldValuesQuery) {\n const [query, setQuery] = useState(\"\");\n const result = useQuery<FieldValuesResult>({\n queryKey: [\"es-field-values\", lookup.key, query],\n queryFn: () => lookup.fetch(query),\n placeholderData: keepPreviousData,\n staleTime: 30_000,\n retry: 0,\n });\n return { ...result, onSearch: setQuery };\n}\n\nfunction valueOptions(result: FieldValuesResult | undefined): ComboboxOption[] {\n return (result?.values ?? []).map((entry) => ({\n value: entry.value,\n label: entry.value,\n title: `${entry.count.toLocaleString()} documents`,\n }));\n}\n\n/**\n * The summary explains what the list is a window onto: how much of the field's\n * cardinality is shown, and whether the rest of the query narrowed it.\n */\nfunction valueSummary(\n result: FieldValuesResult | undefined,\n error: Error | null,\n): string | undefined {\n if (error) return error.message;\n if (!result) return undefined;\n const scope = result.scoped ? \"matching current filters\" : \"across the index\";\n if (!result.values.length) return `no values ${scope}`;\n return `${result.values.length} of ${result.total.toLocaleString()} · ${scope}`;\n}\n\nexport function ValueCombobox({\n id,\n label,\n lookup,\n value,\n onChange,\n}: {\n id: string;\n label: string;\n lookup: FieldValuesQuery;\n value: string;\n onChange: (next: string) => void;\n}) {\n const { data, error, isFetching, onSearch } = useFieldValues(lookup);\n const summary = valueSummary(data, error as Error | null);\n return (\n <Combobox\n id={id}\n ariaLabel={label}\n className=\"min-w-48\"\n placeholder={label}\n value={value}\n onChange={onChange}\n options={valueOptions(data)}\n onSearch={onSearch}\n loading={isFetching}\n allowCustomValue\n {...(summary ? { footer: summary } : {})}\n />\n );\n}\n\nexport function ValuesCombobox({\n label,\n lookup,\n values,\n onChange,\n}: {\n label: string;\n lookup: FieldValuesQuery;\n values: string[];\n onChange: (next: string[]) => void;\n}) {\n const { data, error, isFetching, onSearch } = useFieldValues(lookup);\n const summary = valueSummary(data, error as Error | null);\n return (\n <Combobox\n multiple\n variant=\"tags\"\n ariaLabel={label}\n className=\"min-w-56 flex-1\"\n placeholder={label}\n value={values}\n onChange={onChange}\n options={valueOptions(data)}\n onSearch={onSearch}\n loading={isFetching}\n allowCustomValue\n {...(summary ? { footer: summary } : {})}\n />\n );\n}\n"],"names":[],"mappings":";;;;AAaA,SAAS,eAAe,QAA0B;AAChD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AACrC,QAAM,SAAS,SAA4B;AAAA,IACzC,UAAU,CAAC,mBAAmB,OAAO,KAAK,KAAK;AAAA,IAC/C,SAAS,MAAM,OAAO,MAAM,KAAK;AAAA,IACjC,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX,OAAO;AAAA,EAAA,CACR;AACD,SAAO,EAAE,GAAG,QAAQ,UAAU,SAAA;AAChC;AAEA,SAAS,aAAa,QAAyD;AAC7E,WAAQ,iCAAQ,WAAU,CAAA,GAAI,IAAI,CAAC,WAAW;AAAA,IAC5C,OAAO,MAAM;AAAA,IACb,OAAO,MAAM;AAAA,IACb,OAAO,GAAG,MAAM,MAAM,gBAAgB;AAAA,EAAA,EACtC;AACJ;AAMA,SAAS,aACP,QACA,OACoB;AACpB,MAAI,cAAc,MAAM;AACxB,MAAI,CAAC,OAAQ,QAAO;AACpB,QAAM,QAAQ,OAAO,SAAS,6BAA6B;AAC3D,MAAI,CAAC,OAAO,OAAO,OAAQ,QAAO,aAAa,KAAK;AACpD,SAAO,GAAG,OAAO,OAAO,MAAM,OAAO,OAAO,MAAM,eAAA,CAAgB,MAAM,KAAK;AAC/E;AAEO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMG;AACD,QAAM,EAAE,MAAM,OAAO,YAAY,SAAA,IAAa,eAAe,MAAM;AACnE,QAAM,UAAU,aAAa,MAAM,KAAqB;AACxD,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW;AAAA,MACX,WAAU;AAAA,MACV,aAAa;AAAA,MACb;AAAA,MACA;AAAA,MACA,SAAS,aAAa,IAAI;AAAA,MAC1B;AAAA,MACA,SAAS;AAAA,MACT,kBAAgB;AAAA,MACf,GAAI,UAAU,EAAE,QAAQ,YAAY,CAAA;AAAA,IAAC;AAAA,EAAA;AAG5C;AAEO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKG;AACD,QAAM,EAAE,MAAM,OAAO,YAAY,SAAA,IAAa,eAAe,MAAM;AACnE,QAAM,UAAU,aAAa,MAAM,KAAqB;AACxD,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,UAAQ;AAAA,MACR,SAAQ;AAAA,MACR,WAAW;AAAA,MACX,WAAU;AAAA,MACV,aAAa;AAAA,MACb,OAAO;AAAA,MACP;AAAA,MACA,SAAS,aAAa,IAAI;AAAA,MAC1B;AAAA,MACA,SAAS;AAAA,MACT,kBAAgB;AAAA,MACf,GAAI,UAAU,EAAE,QAAQ,YAAY,CAAA;AAAA,IAAC;AAAA,EAAA;AAG5C;"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const reactQuery = require("@tanstack/react-query");
|
|
4
|
+
const react = require("react");
|
|
5
|
+
const connectionBrowserModel = require("./connectionBrowserModel.cjs");
|
|
6
|
+
const profileApi = require("./profileApi.cjs");
|
|
7
|
+
function useJsonPathSampleRows() {
|
|
8
|
+
return react.useContext(JsonPathSampleRowsContext);
|
|
9
|
+
}
|
|
10
|
+
function sampleRequestProfile(profile) {
|
|
11
|
+
if (!isRecord(profile)) return null;
|
|
12
|
+
const provider = profile.provider;
|
|
13
|
+
if (!isRecord(provider)) return null;
|
|
14
|
+
const type = typeof provider.type === "string" ? provider.type.trim() : "";
|
|
15
|
+
if (!type) return null;
|
|
16
|
+
const request = {};
|
|
17
|
+
for (const key of SAMPLE_PROFILE_KEYS) {
|
|
18
|
+
if (profile[key] !== void 0) request[key] = profile[key];
|
|
19
|
+
}
|
|
20
|
+
const name = typeof profile.profile === "string" ? profile.profile.trim() : "";
|
|
21
|
+
request.profile = name || "sample";
|
|
22
|
+
return request;
|
|
23
|
+
}
|
|
24
|
+
function useJsonPathSample(profile) {
|
|
25
|
+
const request = react.useMemo(() => sampleRequestProfile(profile), [profile]);
|
|
26
|
+
const { data } = reactQuery.useQuery({
|
|
27
|
+
queryKey: ["jsonpath-sample", JSON.stringify(request)],
|
|
28
|
+
enabled: request !== null,
|
|
29
|
+
// The sample is a query against someone's backend, so it is fetched once per
|
|
30
|
+
// profile shape and reused by every column's picker rather than re-run as
|
|
31
|
+
// the form re-renders.
|
|
32
|
+
staleTime: Infinity,
|
|
33
|
+
gcTime: 5 * 60 * 1e3,
|
|
34
|
+
retry: false,
|
|
35
|
+
refetchOnWindowFocus: false,
|
|
36
|
+
queryFn: async () => {
|
|
37
|
+
const result = await connectionBrowserModel.fetchJSON(
|
|
38
|
+
profileApi.profileApiPath("profile/sample"),
|
|
39
|
+
{
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers: { "Content-Type": "application/json" },
|
|
42
|
+
body: JSON.stringify({ profile: request, params: {} })
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
return result.rows ?? EMPTY_ROWS;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return data ?? EMPTY_ROWS;
|
|
49
|
+
}
|
|
50
|
+
function evaluateJsonPath(request) {
|
|
51
|
+
return connectionBrowserModel.fetchJSON(profileApi.profileApiPath("profile/sample/jsonpath"), {
|
|
52
|
+
method: "POST",
|
|
53
|
+
headers: { "Content-Type": "application/json" },
|
|
54
|
+
body: JSON.stringify(request)
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const EMPTY_ROWS = [];
|
|
58
|
+
const JsonPathSampleRowsContext = react.createContext(EMPTY_ROWS);
|
|
59
|
+
const SAMPLE_PROFILE_KEYS = [
|
|
60
|
+
"profile",
|
|
61
|
+
"provider",
|
|
62
|
+
"query",
|
|
63
|
+
"params",
|
|
64
|
+
"imports",
|
|
65
|
+
"namespace"
|
|
66
|
+
];
|
|
67
|
+
function isRecord(value) {
|
|
68
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
69
|
+
}
|
|
70
|
+
exports.JsonPathSampleRowsContext = JsonPathSampleRowsContext;
|
|
71
|
+
exports.evaluateJsonPath = evaluateJsonPath;
|
|
72
|
+
exports.sampleRequestProfile = sampleRequestProfile;
|
|
73
|
+
exports.useJsonPathSample = useJsonPathSample;
|
|
74
|
+
exports.useJsonPathSampleRows = useJsonPathSampleRows;
|
|
75
|
+
//# sourceMappingURL=jsonPathSample.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonPathSample.cjs","sources":["../../src/profiles/jsonPathSample.ts"],"sourcesContent":["import type { JSONPathEvalResult as JsonPathEvalResult } from \"../components/JSONPathPlayground\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { createContext, useContext, useMemo } from \"react\";\nimport { fetchJSON } from \"./connectionBrowserModel\";\nimport { profileApiPath } from \"./profileApi\";\n\n/** Every sampled row in scope; empty where nothing has been sampled. */\nexport function useJsonPathSampleRows(): unknown[] {\n return useContext(JsonPathSampleRowsContext);\n}\n\nexport function sampleRequestProfile(profile: unknown): Record<string, unknown> | null {\n if (!isRecord(profile)) return null;\n const provider = profile.provider;\n if (!isRecord(provider)) return null;\n const type = typeof provider.type === \"string\" ? provider.type.trim() : \"\";\n if (!type) return null;\n const request: Record<string, unknown> = {};\n for (const key of SAMPLE_PROFILE_KEYS) {\n if (profile[key] !== undefined) request[key] = profile[key];\n }\n const name = typeof profile.profile === \"string\" ? profile.profile.trim() : \"\";\n request.profile = name || \"sample\";\n return request;\n}\n\n/**\n * The rows the picker browses: a read-only sample of `profile`.\n *\n * A profile that cannot be sampled — no provider yet, or a query the backend\n * rejects — yields nothing, which leaves JSONPathField's browse button disabled\n * and the path typed by hand rather than picked.\n */\nexport function useJsonPathSample(profile: unknown): unknown[] {\n const request = useMemo(() => sampleRequestProfile(profile), [profile]);\n const { data } = useQuery({\n queryKey: [\"jsonpath-sample\", JSON.stringify(request)],\n enabled: request !== null,\n // The sample is a query against someone's backend, so it is fetched once per\n // profile shape and reused by every column's picker rather than re-run as\n // the form re-renders.\n staleTime: Infinity,\n gcTime: 5 * 60 * 1000,\n retry: false,\n refetchOnWindowFocus: false,\n queryFn: async () => {\n const result = await fetchJSON<{ rows?: Record<string, unknown>[] }>(\n profileApiPath(\"profile/sample\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ profile: request, params: {} }),\n },\n );\n return result.rows ?? EMPTY_ROWS;\n },\n });\n return data ?? EMPTY_ROWS;\n}\n\n/**\n * Evaluates a JSONPath against one sampled row, server-side.\n *\n * The path has to be read by the library the query engine reads it with, or the\n * preview would confidently disagree with the column it previews. The row goes\n * up with the request because the caller already has it — re-running someone's\n * backend query on every keystroke would make the preview cost real money.\n */\nexport function evaluateJsonPath(request: {\n jsonpath: string;\n source?: string;\n row: unknown;\n}): Promise<JsonPathEvalResult> {\n return fetchJSON<JsonPathEvalResult>(profileApiPath(\"profile/sample/jsonpath\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(request),\n });\n}\n\n// A stable identity so a component reading \"nothing sampled\" does not re-render\n// every parent render on a fresh [].\nconst EMPTY_ROWS: unknown[] = [];\n\n// The rows the JSONPath picker browses, for the surfaces that cannot ask for\n// them themselves.\n//\n// The entity form's extension reads the profile straight off the form root and\n// samples it directly. The standalone profile editor renders its column\n// inspector far from the draft it is editing, so that page samples once here and\n// every column field reads the result — one request per editor rather than one\n// per column, and no query client needed at the leaf.\nexport const JsonPathSampleRowsContext = createContext<unknown[]>(EMPTY_ROWS);\n\n// The keys /profile/sample accepts. It decodes with DisallowUnknownFields, so\n// this is a whitelist rather than a tidy-up: one stray key and the whole request\n// is a 400.\n//\n// `columns`, `aliases` and `ignore` are left out deliberately. Those transforms\n// are the thing the author is still writing — a source column gets renamed and\n// consumed by them — and the picker has to offer the provider's own row shape,\n// not the shape a half-written profile projects out of it.\nconst SAMPLE_PROFILE_KEYS = [\n \"profile\",\n \"provider\",\n \"query\",\n \"params\",\n \"imports\",\n \"namespace\",\n] as const;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\n"],"names":["useContext","useMemo","useQuery","fetchJSON","profileApiPath","createContext"],"mappings":";;;;;;AAOO,SAAS,wBAAmC;AACjD,SAAOA,MAAAA,WAAW,yBAAyB;AAC7C;AAEO,SAAS,qBAAqB,SAAkD;AACrF,MAAI,CAAC,SAAS,OAAO,EAAG,QAAO;AAC/B,QAAM,WAAW,QAAQ;AACzB,MAAI,CAAC,SAAS,QAAQ,EAAG,QAAO;AAChC,QAAM,OAAO,OAAO,SAAS,SAAS,WAAW,SAAS,KAAK,SAAS;AACxE,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,UAAmC,CAAA;AACzC,aAAW,OAAO,qBAAqB;AACrC,QAAI,QAAQ,GAAG,MAAM,gBAAmB,GAAG,IAAI,QAAQ,GAAG;AAAA,EAC5D;AACA,QAAM,OAAO,OAAO,QAAQ,YAAY,WAAW,QAAQ,QAAQ,SAAS;AAC5E,UAAQ,UAAU,QAAQ;AAC1B,SAAO;AACT;AASO,SAAS,kBAAkB,SAA6B;AAC7D,QAAM,UAAUC,MAAAA,QAAQ,MAAM,qBAAqB,OAAO,GAAG,CAAC,OAAO,CAAC;AACtE,QAAM,EAAE,KAAA,IAASC,oBAAS;AAAA,IACxB,UAAU,CAAC,mBAAmB,KAAK,UAAU,OAAO,CAAC;AAAA,IACrD,SAAS,YAAY;AAAA;AAAA;AAAA;AAAA,IAIrB,WAAW;AAAA,IACX,QAAQ,IAAI,KAAK;AAAA,IACjB,OAAO;AAAA,IACP,sBAAsB;AAAA,IACtB,SAAS,YAAY;AACnB,YAAM,SAAS,MAAMC,uBAAAA;AAAAA,QACnBC,WAAAA,eAAe,gBAAgB;AAAA,QAC/B;AAAA,UACE,QAAQ;AAAA,UACR,SAAS,EAAE,gBAAgB,mBAAA;AAAA,UAC3B,MAAM,KAAK,UAAU,EAAE,SAAS,SAAS,QAAQ,GAAC,CAAG;AAAA,QAAA;AAAA,MACvD;AAEF,aAAO,OAAO,QAAQ;AAAA,IACxB;AAAA,EAAA,CACD;AACD,SAAO,QAAQ;AACjB;AAUO,SAAS,iBAAiB,SAID;AAC9B,SAAOD,uBAAAA,UAA8BC,0BAAe,yBAAyB,GAAG;AAAA,IAC9E,QAAQ;AAAA,IACR,SAAS,EAAE,gBAAgB,mBAAA;AAAA,IAC3B,MAAM,KAAK,UAAU,OAAO;AAAA,EAAA,CAC7B;AACH;AAIA,MAAM,aAAwB,CAAA;AAUvB,MAAM,4BAA4BC,MAAAA,cAAyB,UAAU;AAU5E,MAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,SAAS,OAAkD;AAClE,SAAO,QAAQ,KAAK,KAAK,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC5E;;;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { JSONPathEvalResult as JsonPathEvalResult } from '../components/JSONPathPlayground';
|
|
2
|
+
/** Every sampled row in scope; empty where nothing has been sampled. */
|
|
3
|
+
export declare function useJsonPathSampleRows(): unknown[];
|
|
4
|
+
export declare function sampleRequestProfile(profile: unknown): Record<string, unknown> | null;
|
|
5
|
+
/**
|
|
6
|
+
* The rows the picker browses: a read-only sample of `profile`.
|
|
7
|
+
*
|
|
8
|
+
* A profile that cannot be sampled — no provider yet, or a query the backend
|
|
9
|
+
* rejects — yields nothing, which leaves JSONPathField's browse button disabled
|
|
10
|
+
* and the path typed by hand rather than picked.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useJsonPathSample(profile: unknown): unknown[];
|
|
13
|
+
/**
|
|
14
|
+
* Evaluates a JSONPath against one sampled row, server-side.
|
|
15
|
+
*
|
|
16
|
+
* The path has to be read by the library the query engine reads it with, or the
|
|
17
|
+
* preview would confidently disagree with the column it previews. The row goes
|
|
18
|
+
* up with the request because the caller already has it — re-running someone's
|
|
19
|
+
* backend query on every keystroke would make the preview cost real money.
|
|
20
|
+
*/
|
|
21
|
+
export declare function evaluateJsonPath(request: {
|
|
22
|
+
jsonpath: string;
|
|
23
|
+
source?: string;
|
|
24
|
+
row: unknown;
|
|
25
|
+
}): Promise<JsonPathEvalResult>;
|
|
26
|
+
export declare const JsonPathSampleRowsContext: import('react').Context<unknown[]>;
|
|
27
|
+
//# sourceMappingURL=jsonPathSample.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonPathSample.d.ts","sourceRoot":"","sources":["../../src/profiles/jsonPathSample.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,IAAI,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAMjG,wEAAwE;AACxE,wBAAgB,qBAAqB,IAAI,OAAO,EAAE,CAEjD;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAarF;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,EAAE,CAyB7D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;CACd,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAM9B;AAcD,eAAO,MAAM,yBAAyB,oCAAuC,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
|
2
|
+
import { createContext, useMemo, useContext } from "react";
|
|
3
|
+
import { fetchJSON } from "./connectionBrowserModel.js";
|
|
4
|
+
import { profileApiPath } from "./profileApi.js";
|
|
5
|
+
function useJsonPathSampleRows() {
|
|
6
|
+
return useContext(JsonPathSampleRowsContext);
|
|
7
|
+
}
|
|
8
|
+
function sampleRequestProfile(profile) {
|
|
9
|
+
if (!isRecord(profile)) return null;
|
|
10
|
+
const provider = profile.provider;
|
|
11
|
+
if (!isRecord(provider)) return null;
|
|
12
|
+
const type = typeof provider.type === "string" ? provider.type.trim() : "";
|
|
13
|
+
if (!type) return null;
|
|
14
|
+
const request = {};
|
|
15
|
+
for (const key of SAMPLE_PROFILE_KEYS) {
|
|
16
|
+
if (profile[key] !== void 0) request[key] = profile[key];
|
|
17
|
+
}
|
|
18
|
+
const name = typeof profile.profile === "string" ? profile.profile.trim() : "";
|
|
19
|
+
request.profile = name || "sample";
|
|
20
|
+
return request;
|
|
21
|
+
}
|
|
22
|
+
function useJsonPathSample(profile) {
|
|
23
|
+
const request = useMemo(() => sampleRequestProfile(profile), [profile]);
|
|
24
|
+
const { data } = useQuery({
|
|
25
|
+
queryKey: ["jsonpath-sample", JSON.stringify(request)],
|
|
26
|
+
enabled: request !== null,
|
|
27
|
+
// The sample is a query against someone's backend, so it is fetched once per
|
|
28
|
+
// profile shape and reused by every column's picker rather than re-run as
|
|
29
|
+
// the form re-renders.
|
|
30
|
+
staleTime: Infinity,
|
|
31
|
+
gcTime: 5 * 60 * 1e3,
|
|
32
|
+
retry: false,
|
|
33
|
+
refetchOnWindowFocus: false,
|
|
34
|
+
queryFn: async () => {
|
|
35
|
+
const result = await fetchJSON(
|
|
36
|
+
profileApiPath("profile/sample"),
|
|
37
|
+
{
|
|
38
|
+
method: "POST",
|
|
39
|
+
headers: { "Content-Type": "application/json" },
|
|
40
|
+
body: JSON.stringify({ profile: request, params: {} })
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
return result.rows ?? EMPTY_ROWS;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return data ?? EMPTY_ROWS;
|
|
47
|
+
}
|
|
48
|
+
function evaluateJsonPath(request) {
|
|
49
|
+
return fetchJSON(profileApiPath("profile/sample/jsonpath"), {
|
|
50
|
+
method: "POST",
|
|
51
|
+
headers: { "Content-Type": "application/json" },
|
|
52
|
+
body: JSON.stringify(request)
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const EMPTY_ROWS = [];
|
|
56
|
+
const JsonPathSampleRowsContext = createContext(EMPTY_ROWS);
|
|
57
|
+
const SAMPLE_PROFILE_KEYS = [
|
|
58
|
+
"profile",
|
|
59
|
+
"provider",
|
|
60
|
+
"query",
|
|
61
|
+
"params",
|
|
62
|
+
"imports",
|
|
63
|
+
"namespace"
|
|
64
|
+
];
|
|
65
|
+
function isRecord(value) {
|
|
66
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
JsonPathSampleRowsContext,
|
|
70
|
+
evaluateJsonPath,
|
|
71
|
+
sampleRequestProfile,
|
|
72
|
+
useJsonPathSample,
|
|
73
|
+
useJsonPathSampleRows
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=jsonPathSample.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonPathSample.js","sources":["../../src/profiles/jsonPathSample.ts"],"sourcesContent":["import type { JSONPathEvalResult as JsonPathEvalResult } from \"../components/JSONPathPlayground\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { createContext, useContext, useMemo } from \"react\";\nimport { fetchJSON } from \"./connectionBrowserModel\";\nimport { profileApiPath } from \"./profileApi\";\n\n/** Every sampled row in scope; empty where nothing has been sampled. */\nexport function useJsonPathSampleRows(): unknown[] {\n return useContext(JsonPathSampleRowsContext);\n}\n\nexport function sampleRequestProfile(profile: unknown): Record<string, unknown> | null {\n if (!isRecord(profile)) return null;\n const provider = profile.provider;\n if (!isRecord(provider)) return null;\n const type = typeof provider.type === \"string\" ? provider.type.trim() : \"\";\n if (!type) return null;\n const request: Record<string, unknown> = {};\n for (const key of SAMPLE_PROFILE_KEYS) {\n if (profile[key] !== undefined) request[key] = profile[key];\n }\n const name = typeof profile.profile === \"string\" ? profile.profile.trim() : \"\";\n request.profile = name || \"sample\";\n return request;\n}\n\n/**\n * The rows the picker browses: a read-only sample of `profile`.\n *\n * A profile that cannot be sampled — no provider yet, or a query the backend\n * rejects — yields nothing, which leaves JSONPathField's browse button disabled\n * and the path typed by hand rather than picked.\n */\nexport function useJsonPathSample(profile: unknown): unknown[] {\n const request = useMemo(() => sampleRequestProfile(profile), [profile]);\n const { data } = useQuery({\n queryKey: [\"jsonpath-sample\", JSON.stringify(request)],\n enabled: request !== null,\n // The sample is a query against someone's backend, so it is fetched once per\n // profile shape and reused by every column's picker rather than re-run as\n // the form re-renders.\n staleTime: Infinity,\n gcTime: 5 * 60 * 1000,\n retry: false,\n refetchOnWindowFocus: false,\n queryFn: async () => {\n const result = await fetchJSON<{ rows?: Record<string, unknown>[] }>(\n profileApiPath(\"profile/sample\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ profile: request, params: {} }),\n },\n );\n return result.rows ?? EMPTY_ROWS;\n },\n });\n return data ?? EMPTY_ROWS;\n}\n\n/**\n * Evaluates a JSONPath against one sampled row, server-side.\n *\n * The path has to be read by the library the query engine reads it with, or the\n * preview would confidently disagree with the column it previews. The row goes\n * up with the request because the caller already has it — re-running someone's\n * backend query on every keystroke would make the preview cost real money.\n */\nexport function evaluateJsonPath(request: {\n jsonpath: string;\n source?: string;\n row: unknown;\n}): Promise<JsonPathEvalResult> {\n return fetchJSON<JsonPathEvalResult>(profileApiPath(\"profile/sample/jsonpath\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(request),\n });\n}\n\n// A stable identity so a component reading \"nothing sampled\" does not re-render\n// every parent render on a fresh [].\nconst EMPTY_ROWS: unknown[] = [];\n\n// The rows the JSONPath picker browses, for the surfaces that cannot ask for\n// them themselves.\n//\n// The entity form's extension reads the profile straight off the form root and\n// samples it directly. The standalone profile editor renders its column\n// inspector far from the draft it is editing, so that page samples once here and\n// every column field reads the result — one request per editor rather than one\n// per column, and no query client needed at the leaf.\nexport const JsonPathSampleRowsContext = createContext<unknown[]>(EMPTY_ROWS);\n\n// The keys /profile/sample accepts. It decodes with DisallowUnknownFields, so\n// this is a whitelist rather than a tidy-up: one stray key and the whole request\n// is a 400.\n//\n// `columns`, `aliases` and `ignore` are left out deliberately. Those transforms\n// are the thing the author is still writing — a source column gets renamed and\n// consumed by them — and the picker has to offer the provider's own row shape,\n// not the shape a half-written profile projects out of it.\nconst SAMPLE_PROFILE_KEYS = [\n \"profile\",\n \"provider\",\n \"query\",\n \"params\",\n \"imports\",\n \"namespace\",\n] as const;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\n"],"names":[],"mappings":";;;;AAOO,SAAS,wBAAmC;AACjD,SAAO,WAAW,yBAAyB;AAC7C;AAEO,SAAS,qBAAqB,SAAkD;AACrF,MAAI,CAAC,SAAS,OAAO,EAAG,QAAO;AAC/B,QAAM,WAAW,QAAQ;AACzB,MAAI,CAAC,SAAS,QAAQ,EAAG,QAAO;AAChC,QAAM,OAAO,OAAO,SAAS,SAAS,WAAW,SAAS,KAAK,SAAS;AACxE,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,UAAmC,CAAA;AACzC,aAAW,OAAO,qBAAqB;AACrC,QAAI,QAAQ,GAAG,MAAM,gBAAmB,GAAG,IAAI,QAAQ,GAAG;AAAA,EAC5D;AACA,QAAM,OAAO,OAAO,QAAQ,YAAY,WAAW,QAAQ,QAAQ,SAAS;AAC5E,UAAQ,UAAU,QAAQ;AAC1B,SAAO;AACT;AASO,SAAS,kBAAkB,SAA6B;AAC7D,QAAM,UAAU,QAAQ,MAAM,qBAAqB,OAAO,GAAG,CAAC,OAAO,CAAC;AACtE,QAAM,EAAE,KAAA,IAAS,SAAS;AAAA,IACxB,UAAU,CAAC,mBAAmB,KAAK,UAAU,OAAO,CAAC;AAAA,IACrD,SAAS,YAAY;AAAA;AAAA;AAAA;AAAA,IAIrB,WAAW;AAAA,IACX,QAAQ,IAAI,KAAK;AAAA,IACjB,OAAO;AAAA,IACP,sBAAsB;AAAA,IACtB,SAAS,YAAY;AACnB,YAAM,SAAS,MAAM;AAAA,QACnB,eAAe,gBAAgB;AAAA,QAC/B;AAAA,UACE,QAAQ;AAAA,UACR,SAAS,EAAE,gBAAgB,mBAAA;AAAA,UAC3B,MAAM,KAAK,UAAU,EAAE,SAAS,SAAS,QAAQ,GAAC,CAAG;AAAA,QAAA;AAAA,MACvD;AAEF,aAAO,OAAO,QAAQ;AAAA,IACxB;AAAA,EAAA,CACD;AACD,SAAO,QAAQ;AACjB;AAUO,SAAS,iBAAiB,SAID;AAC9B,SAAO,UAA8B,eAAe,yBAAyB,GAAG;AAAA,IAC9E,QAAQ;AAAA,IACR,SAAS,EAAE,gBAAgB,mBAAA;AAAA,IAC3B,MAAM,KAAK,UAAU,OAAO;AAAA,EAAA,CAC7B;AACH;AAIA,MAAM,aAAwB,CAAA;AAUvB,MAAM,4BAA4B,cAAyB,UAAU;AAU5E,MAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,SAAS,OAAkD;AAClE,SAAO,QAAQ,KAAK,KAAK,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC5E;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
require("react");
|
|
5
|
+
const jsonPathSample = require("./jsonPathSample.cjs");
|
|
6
|
+
function JsonPathProfileProvider({
|
|
7
|
+
profile,
|
|
8
|
+
children
|
|
9
|
+
}) {
|
|
10
|
+
const rows = jsonPathSample.useJsonPathSample(profile);
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsonPathSample.JsonPathSampleRowsContext.Provider, { value: rows, children });
|
|
12
|
+
}
|
|
13
|
+
exports.JsonPathProfileProvider = JsonPathProfileProvider;
|
|
14
|
+
//# sourceMappingURL=jsonPathSampleRow.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonPathSampleRow.cjs","sources":["../../src/profiles/jsonPathSampleRow.tsx"],"sourcesContent":["import { type ReactNode } from \"react\";\nimport { JsonPathSampleRowsContext, useJsonPathSample } from \"./jsonPathSample\";\n\nexport function JsonPathProfileProvider({\n profile,\n children\n}: {\n profile: unknown;\n children: ReactNode;\n}) {\n const rows = useJsonPathSample(profile);\n return (\n <JsonPathSampleRowsContext.Provider value={rows}>\n {children}\n </JsonPathSampleRowsContext.Provider>\n );\n}\n\n"],"names":["useJsonPathSample","JsonPathSampleRowsContext"],"mappings":";;;;;AAGO,SAAS,wBAAwB;AAAA,EACtC;AAAA,EACA;AACF,GAGG;AACD,QAAM,OAAOA,eAAAA,kBAAkB,OAAO;AACtC,wCACGC,eAAAA,0BAA0B,UAA1B,EAAmC,OAAO,MACxC,UACH;AAEJ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonPathSampleRow.d.ts","sourceRoot":"","sources":["../../src/profiles/jsonPathSampleRow.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,wBAAgB,uBAAuB,CAAC,EACtC,OAAO,EACP,QAAQ,EACT,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAOA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { useJsonPathSample, JsonPathSampleRowsContext } from "./jsonPathSample.js";
|
|
4
|
+
function JsonPathProfileProvider({
|
|
5
|
+
profile,
|
|
6
|
+
children
|
|
7
|
+
}) {
|
|
8
|
+
const rows = useJsonPathSample(profile);
|
|
9
|
+
return /* @__PURE__ */ jsx(JsonPathSampleRowsContext.Provider, { value: rows, children });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
JsonPathProfileProvider
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=jsonPathSampleRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonPathSampleRow.js","sources":["../../src/profiles/jsonPathSampleRow.tsx"],"sourcesContent":["import { type ReactNode } from \"react\";\nimport { JsonPathSampleRowsContext, useJsonPathSample } from \"./jsonPathSample\";\n\nexport function JsonPathProfileProvider({\n profile,\n children\n}: {\n profile: unknown;\n children: ReactNode;\n}) {\n const rows = useJsonPathSample(profile);\n return (\n <JsonPathSampleRowsContext.Provider value={rows}>\n {children}\n </JsonPathSampleRowsContext.Provider>\n );\n}\n\n"],"names":[],"mappings":";;;AAGO,SAAS,wBAAwB;AAAA,EACtC;AAAA,EACA;AACF,GAGG;AACD,QAAM,OAAO,kBAAkB,OAAO;AACtC,6BACG,0BAA0B,UAA1B,EAAmC,OAAO,MACxC,UACH;AAEJ;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const string = require("../lib/string.cjs");
|
|
4
|
+
const DEFAULT_BASE = "/api/v1";
|
|
5
|
+
let base = DEFAULT_BASE;
|
|
6
|
+
let schema = null;
|
|
7
|
+
function configureProfiles(options) {
|
|
8
|
+
if (options.basePath !== void 0) {
|
|
9
|
+
const trimmed = string.stripTrailingSlashes(options.basePath.trim());
|
|
10
|
+
if (!trimmed.startsWith("/")) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
`profile API basePath must start with "/", got ${JSON.stringify(options.basePath)}`
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
base = trimmed;
|
|
16
|
+
}
|
|
17
|
+
schema = options.schema;
|
|
18
|
+
}
|
|
19
|
+
function profileApiBase() {
|
|
20
|
+
return base;
|
|
21
|
+
}
|
|
22
|
+
function profileApiPath(suffix) {
|
|
23
|
+
return `${base}/${suffix.replace(/^\/+/, "")}`;
|
|
24
|
+
}
|
|
25
|
+
function profileSchema() {
|
|
26
|
+
if (!schema) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
"profile schema is not configured — call configureProfiles({ schema }) before rendering the profile editor"
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
return schema;
|
|
32
|
+
}
|
|
33
|
+
exports.configureProfiles = configureProfiles;
|
|
34
|
+
exports.profileApiBase = profileApiBase;
|
|
35
|
+
exports.profileApiPath = profileApiPath;
|
|
36
|
+
exports.profileSchema = profileSchema;
|
|
37
|
+
//# sourceMappingURL=profileApi.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileApi.cjs","sources":["../../src/profiles/profileApi.ts"],"sourcesContent":["/**\n * Boot-time configuration: where the profile engine is mounted, and the schema\n * that describes a profile.\n *\n * Both are the host's to supply. The components talk to commons-db's profile\n * service — sampling a draft, evaluating a JSONPath against a sampled row,\n * browsing a connection's catalog — and every host mounts that service\n * somewhere; a library that hardcodes one host's prefix is broken for the next.\n * The schema is generated from commons-db's Go types, so it ships with the\n * server, not with this package: vendoring a copy here would silently drift\n * from the source of truth the server validates against.\n *\n * This is module state rather than a React context on purpose: both values are\n * one per application, fixed before the first render, and read from plain\n * functions (browserBaseUrl, profileSchemaProjection) as well as components.\n * Threading a context through the whole tree would buy nothing a single\n * boot-time call does not.\n */\n\nimport type { JsonSchemaObject } from \"../components/json-schema-form-types\";\nimport { stripTrailingSlashes } from \"../lib/string\";\n\n/** ProfileSchema is commons-db's profile.json, with its $defs preserved. */\nexport type ProfileSchema = JsonSchemaObject & {\n $defs?: Record<string, JsonSchemaObject>;\n};\n\nconst DEFAULT_BASE = \"/api/v1\";\n\nlet base = DEFAULT_BASE;\nlet schema: ProfileSchema | null = null;\n\n/**\n * configureProfiles points the components at a mount and gives them the profile\n * schema. Call it once at startup, before rendering.\n *\n * basePath defaults to /api/v1 and may be omitted by a host that mounts there.\n * schema has no default: the editor cannot describe a profile it has no schema\n * for, and inventing one would disagree with the server that validates it.\n */\nexport function configureProfiles(options: { basePath?: string; schema: ProfileSchema }): void {\n if (options.basePath !== undefined) {\n const trimmed = stripTrailingSlashes(options.basePath.trim());\n if (!trimmed.startsWith(\"/\")) {\n throw new Error(\n `profile API basePath must start with \"/\", got ${JSON.stringify(options.basePath)}`,\n );\n }\n base = trimmed;\n }\n schema = options.schema;\n}\n\n/** profileApiBase is the configured mount point, without a trailing slash. */\nexport function profileApiBase(): string {\n return base;\n}\n\n/**\n * profileApiPath joins a service-relative path onto the mount point, e.g.\n * profileApiPath(\"profile/sample\") -> \"/api/v1/profile/sample\".\n */\nexport function profileApiPath(suffix: string): string {\n return `${base}/${suffix.replace(/^\\/+/, \"\")}`;\n}\n\n/**\n * profileSchema is the configured schema. It throws rather than returning an\n * empty document: a form rendered from a missing schema shows no fields at all,\n * which reads as \"this profile has nothing to configure\" instead of as the\n * setup error it is.\n */\nexport function profileSchema(): ProfileSchema {\n if (!schema) {\n throw new Error(\n \"profile schema is not configured — call configureProfiles({ schema }) before rendering the profile editor\",\n );\n }\n return schema;\n}\n"],"names":["stripTrailingSlashes"],"mappings":";;;AA2BA,MAAM,eAAe;AAErB,IAAI,OAAO;AACX,IAAI,SAA+B;AAU5B,SAAS,kBAAkB,SAA6D;AAC7F,MAAI,QAAQ,aAAa,QAAW;AAClC,UAAM,UAAUA,OAAAA,qBAAqB,QAAQ,SAAS,MAAM;AAC5D,QAAI,CAAC,QAAQ,WAAW,GAAG,GAAG;AAC5B,YAAM,IAAI;AAAA,QACR,iDAAiD,KAAK,UAAU,QAAQ,QAAQ,CAAC;AAAA,MAAA;AAAA,IAErF;AACA,WAAO;AAAA,EACT;AACA,WAAS,QAAQ;AACnB;AAGO,SAAS,iBAAyB;AACvC,SAAO;AACT;AAMO,SAAS,eAAe,QAAwB;AACrD,SAAO,GAAG,IAAI,IAAI,OAAO,QAAQ,QAAQ,EAAE,CAAC;AAC9C;AAQO,SAAS,gBAA+B;AAC7C,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACA,SAAO;AACT;;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { JsonSchemaObject } from '../components/json-schema-form-types';
|
|
2
|
+
/** ProfileSchema is commons-db's profile.json, with its $defs preserved. */
|
|
3
|
+
export type ProfileSchema = JsonSchemaObject & {
|
|
4
|
+
$defs?: Record<string, JsonSchemaObject>;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* configureProfiles points the components at a mount and gives them the profile
|
|
8
|
+
* schema. Call it once at startup, before rendering.
|
|
9
|
+
*
|
|
10
|
+
* basePath defaults to /api/v1 and may be omitted by a host that mounts there.
|
|
11
|
+
* schema has no default: the editor cannot describe a profile it has no schema
|
|
12
|
+
* for, and inventing one would disagree with the server that validates it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function configureProfiles(options: {
|
|
15
|
+
basePath?: string;
|
|
16
|
+
schema: ProfileSchema;
|
|
17
|
+
}): void;
|
|
18
|
+
/** profileApiBase is the configured mount point, without a trailing slash. */
|
|
19
|
+
export declare function profileApiBase(): string;
|
|
20
|
+
/**
|
|
21
|
+
* profileApiPath joins a service-relative path onto the mount point, e.g.
|
|
22
|
+
* profileApiPath("profile/sample") -> "/api/v1/profile/sample".
|
|
23
|
+
*/
|
|
24
|
+
export declare function profileApiPath(suffix: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* profileSchema is the configured schema. It throws rather than returning an
|
|
27
|
+
* empty document: a form rendered from a missing schema shows no fields at all,
|
|
28
|
+
* which reads as "this profile has nothing to configure" instead of as the
|
|
29
|
+
* setup error it is.
|
|
30
|
+
*/
|
|
31
|
+
export declare function profileSchema(): ProfileSchema;
|
|
32
|
+
//# sourceMappingURL=profileApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileApi.d.ts","sourceRoot":"","sources":["../../src/profiles/profileApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAG7E,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC1C,CAAC;AAOF;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,GAAG,IAAI,CAW7F;AAED,8EAA8E;AAC9E,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,aAAa,CAO7C"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { stripTrailingSlashes } from "../lib/string.js";
|
|
2
|
+
const DEFAULT_BASE = "/api/v1";
|
|
3
|
+
let base = DEFAULT_BASE;
|
|
4
|
+
let schema = null;
|
|
5
|
+
function configureProfiles(options) {
|
|
6
|
+
if (options.basePath !== void 0) {
|
|
7
|
+
const trimmed = stripTrailingSlashes(options.basePath.trim());
|
|
8
|
+
if (!trimmed.startsWith("/")) {
|
|
9
|
+
throw new Error(
|
|
10
|
+
`profile API basePath must start with "/", got ${JSON.stringify(options.basePath)}`
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
base = trimmed;
|
|
14
|
+
}
|
|
15
|
+
schema = options.schema;
|
|
16
|
+
}
|
|
17
|
+
function profileApiBase() {
|
|
18
|
+
return base;
|
|
19
|
+
}
|
|
20
|
+
function profileApiPath(suffix) {
|
|
21
|
+
return `${base}/${suffix.replace(/^\/+/, "")}`;
|
|
22
|
+
}
|
|
23
|
+
function profileSchema() {
|
|
24
|
+
if (!schema) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
"profile schema is not configured — call configureProfiles({ schema }) before rendering the profile editor"
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return schema;
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
configureProfiles,
|
|
33
|
+
profileApiBase,
|
|
34
|
+
profileApiPath,
|
|
35
|
+
profileSchema
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=profileApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileApi.js","sources":["../../src/profiles/profileApi.ts"],"sourcesContent":["/**\n * Boot-time configuration: where the profile engine is mounted, and the schema\n * that describes a profile.\n *\n * Both are the host's to supply. The components talk to commons-db's profile\n * service — sampling a draft, evaluating a JSONPath against a sampled row,\n * browsing a connection's catalog — and every host mounts that service\n * somewhere; a library that hardcodes one host's prefix is broken for the next.\n * The schema is generated from commons-db's Go types, so it ships with the\n * server, not with this package: vendoring a copy here would silently drift\n * from the source of truth the server validates against.\n *\n * This is module state rather than a React context on purpose: both values are\n * one per application, fixed before the first render, and read from plain\n * functions (browserBaseUrl, profileSchemaProjection) as well as components.\n * Threading a context through the whole tree would buy nothing a single\n * boot-time call does not.\n */\n\nimport type { JsonSchemaObject } from \"../components/json-schema-form-types\";\nimport { stripTrailingSlashes } from \"../lib/string\";\n\n/** ProfileSchema is commons-db's profile.json, with its $defs preserved. */\nexport type ProfileSchema = JsonSchemaObject & {\n $defs?: Record<string, JsonSchemaObject>;\n};\n\nconst DEFAULT_BASE = \"/api/v1\";\n\nlet base = DEFAULT_BASE;\nlet schema: ProfileSchema | null = null;\n\n/**\n * configureProfiles points the components at a mount and gives them the profile\n * schema. Call it once at startup, before rendering.\n *\n * basePath defaults to /api/v1 and may be omitted by a host that mounts there.\n * schema has no default: the editor cannot describe a profile it has no schema\n * for, and inventing one would disagree with the server that validates it.\n */\nexport function configureProfiles(options: { basePath?: string; schema: ProfileSchema }): void {\n if (options.basePath !== undefined) {\n const trimmed = stripTrailingSlashes(options.basePath.trim());\n if (!trimmed.startsWith(\"/\")) {\n throw new Error(\n `profile API basePath must start with \"/\", got ${JSON.stringify(options.basePath)}`,\n );\n }\n base = trimmed;\n }\n schema = options.schema;\n}\n\n/** profileApiBase is the configured mount point, without a trailing slash. */\nexport function profileApiBase(): string {\n return base;\n}\n\n/**\n * profileApiPath joins a service-relative path onto the mount point, e.g.\n * profileApiPath(\"profile/sample\") -> \"/api/v1/profile/sample\".\n */\nexport function profileApiPath(suffix: string): string {\n return `${base}/${suffix.replace(/^\\/+/, \"\")}`;\n}\n\n/**\n * profileSchema is the configured schema. It throws rather than returning an\n * empty document: a form rendered from a missing schema shows no fields at all,\n * which reads as \"this profile has nothing to configure\" instead of as the\n * setup error it is.\n */\nexport function profileSchema(): ProfileSchema {\n if (!schema) {\n throw new Error(\n \"profile schema is not configured — call configureProfiles({ schema }) before rendering the profile editor\",\n );\n }\n return schema;\n}\n"],"names":[],"mappings":";AA2BA,MAAM,eAAe;AAErB,IAAI,OAAO;AACX,IAAI,SAA+B;AAU5B,SAAS,kBAAkB,SAA6D;AAC7F,MAAI,QAAQ,aAAa,QAAW;AAClC,UAAM,UAAU,qBAAqB,QAAQ,SAAS,MAAM;AAC5D,QAAI,CAAC,QAAQ,WAAW,GAAG,GAAG;AAC5B,YAAM,IAAI;AAAA,QACR,iDAAiD,KAAK,UAAU,QAAQ,QAAQ,CAAC;AAAA,MAAA;AAAA,IAErF;AACA,WAAO;AAAA,EACT;AACA,WAAS,QAAQ;AACnB;AAGO,SAAS,iBAAyB;AACvC,SAAO;AACT;AAMO,SAAS,eAAe,QAAwB;AACrD,SAAO,GAAG,IAAI,IAAI,OAAO,QAAQ,QAAQ,EAAE,CAAC;AAC9C;AAQO,SAAS,gBAA+B;AAC7C,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACA,SAAO;AACT;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const button = require("../components/button.cjs");
|
|
5
|
+
const Icon = require("../data/Icon.cjs");
|
|
6
|
+
const react = require("react");
|
|
7
|
+
const connectionBrowserModel = require("./connectionBrowserModel.cjs");
|
|
8
|
+
const profileBuilderWorkspace = require("./profileBuilderWorkspace.cjs");
|
|
9
|
+
const UiDatabase = require("../icons/components/UiDatabase.cjs");
|
|
10
|
+
const ProfileBuilderAutoOpenContext = react.createContext(false);
|
|
11
|
+
function ProfileBuilderAutoOpen({ children }) {
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ProfileBuilderAutoOpenContext.Provider, { value: true, children });
|
|
13
|
+
}
|
|
14
|
+
function ProfileQueryBuilderField({
|
|
15
|
+
input,
|
|
16
|
+
rootValue,
|
|
17
|
+
onRootChange
|
|
18
|
+
}) {
|
|
19
|
+
var _a;
|
|
20
|
+
const [open, setOpen] = react.useState(false);
|
|
21
|
+
const autoOpen = react.useContext(ProfileBuilderAutoOpenContext);
|
|
22
|
+
const autoOpened = react.useRef(false);
|
|
23
|
+
const connection = ((_a = rootValue.provider) == null ? void 0 : _a.connection) ?? "";
|
|
24
|
+
const connectionID = connectionBrowserModel.savedConnectionID(connection);
|
|
25
|
+
react.useEffect(() => {
|
|
26
|
+
if (!autoOpen || autoOpened.current || !connectionID || !onRootChange) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
autoOpened.current = true;
|
|
30
|
+
setOpen(true);
|
|
31
|
+
}, [autoOpen, connectionID, onRootChange]);
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 space-y-2", children: [
|
|
33
|
+
input,
|
|
34
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
35
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
36
|
+
button.Button,
|
|
37
|
+
{
|
|
38
|
+
type: "button",
|
|
39
|
+
variant: "outline",
|
|
40
|
+
size: "sm",
|
|
41
|
+
disabled: !connectionID || !onRootChange,
|
|
42
|
+
title: connectionID ? "Browse the saved connection and sample rows" : "Choose a saved connection before opening the builder",
|
|
43
|
+
onClick: () => setOpen(true),
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { icon: UiDatabase.UiDatabase, className: "size-4" }),
|
|
46
|
+
"Build from connection"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
!connectionID ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: "Choose a saved connection to browse its catalog and sample rows. Inline URLs can still be configured manually." }) : null
|
|
51
|
+
] }),
|
|
52
|
+
open && connectionID && onRootChange ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
53
|
+
profileBuilderWorkspace.ProfileBuilderWorkspace,
|
|
54
|
+
{
|
|
55
|
+
connectionID,
|
|
56
|
+
rootValue,
|
|
57
|
+
onApply: onRootChange,
|
|
58
|
+
onClose: () => setOpen(false)
|
|
59
|
+
}
|
|
60
|
+
) : null
|
|
61
|
+
] });
|
|
62
|
+
}
|
|
63
|
+
exports.ProfileBuilderAutoOpen = ProfileBuilderAutoOpen;
|
|
64
|
+
exports.ProfileQueryBuilderField = ProfileQueryBuilderField;
|
|
65
|
+
//# sourceMappingURL=profileBuilder.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileBuilder.cjs","sources":["../../src/profiles/profileBuilder.tsx"],"sourcesContent":["import { Button } from \"../components/button\";\nimport { Icon } from \"../data/Icon\";\nimport { UiDatabase } from \"../icons\";\nimport {\n createContext,\n useContext,\n useEffect,\n useRef,\n useState,\n type ReactNode\n} from \"react\";\nimport { savedConnectionID } from \"./connectionBrowserModel\";\nimport {\n ProfileBuilderWorkspace,\n type ProfileDraft\n} from \"./profileBuilderWorkspace\";\n\nconst ProfileBuilderAutoOpenContext = createContext(false);\n\nexport function ProfileBuilderAutoOpen({ children }: { children: ReactNode }) {\n return (\n <ProfileBuilderAutoOpenContext.Provider value>\n {children}\n </ProfileBuilderAutoOpenContext.Provider>\n );\n}\n\nexport function ProfileQueryBuilderField({\n input,\n rootValue,\n onRootChange\n}: {\n input: ReactNode;\n rootValue: ProfileDraft;\n onRootChange?: ((next: Record<string, unknown>) => void) | undefined;\n}) {\n const [open, setOpen] = useState(false);\n const autoOpen = useContext(ProfileBuilderAutoOpenContext);\n const autoOpened = useRef(false);\n const connection = rootValue.provider?.connection ?? \"\";\n const connectionID = savedConnectionID(connection);\n\n useEffect(() => {\n if (!autoOpen || autoOpened.current || !connectionID || !onRootChange) {\n return;\n }\n autoOpened.current = true;\n setOpen(true);\n }, [autoOpen, connectionID, onRootChange]);\n\n return (\n <div className=\"min-w-0 space-y-2\">\n {input}\n <div className=\"flex flex-wrap items-center gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n disabled={!connectionID || !onRootChange}\n title={\n connectionID\n ? \"Browse the saved connection and sample rows\"\n : \"Choose a saved connection before opening the builder\"\n }\n onClick={() => setOpen(true)}\n >\n <Icon icon={UiDatabase} className=\"size-4\" />\n Build from connection\n </Button>\n {!connectionID ? (\n <span className=\"text-xs text-muted-foreground\">\n Choose a saved connection to browse its catalog and sample rows.\n Inline URLs can still be configured manually.\n </span>\n ) : null}\n </div>\n {open && connectionID && onRootChange ? (\n <ProfileBuilderWorkspace\n connectionID={connectionID}\n rootValue={rootValue}\n onApply={onRootChange}\n onClose={() => setOpen(false)}\n />\n ) : null}\n </div>\n );\n}\n"],"names":["createContext","useState","useContext","useRef","savedConnectionID","useEffect","jsxs","Button","jsx","Icon","UiDatabase","ProfileBuilderWorkspace"],"mappings":";;;;;;;;;AAiBA,MAAM,gCAAgCA,MAAAA,cAAc,KAAK;AAElD,SAAS,uBAAuB,EAAE,YAAqC;AAC5E,wCACG,8BAA8B,UAA9B,EAAuC,OAAK,MAC1C,UACH;AAEJ;AAEO,SAAS,yBAAyB;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACF,GAIG;;AACD,QAAM,CAAC,MAAM,OAAO,IAAIC,MAAAA,SAAS,KAAK;AACtC,QAAM,WAAWC,MAAAA,WAAW,6BAA6B;AACzD,QAAM,aAAaC,MAAAA,OAAO,KAAK;AAC/B,QAAM,eAAa,eAAU,aAAV,mBAAoB,eAAc;AACrD,QAAM,eAAeC,uBAAAA,kBAAkB,UAAU;AAEjDC,QAAAA,UAAU,MAAM;AACd,QAAI,CAAC,YAAY,WAAW,WAAW,CAAC,gBAAgB,CAAC,cAAc;AACrE;AAAA,IACF;AACA,eAAW,UAAU;AACrB,YAAQ,IAAI;AAAA,EACd,GAAG,CAAC,UAAU,cAAc,YAAY,CAAC;AAEzC,SACEC,2BAAAA,KAAC,OAAA,EAAI,WAAU,qBACZ,UAAA;AAAA,IAAA;AAAA,IACDA,2BAAAA,KAAC,OAAA,EAAI,WAAU,qCACb,UAAA;AAAA,MAAAA,2BAAAA;AAAAA,QAACC,OAAAA;AAAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,UAAU,CAAC,gBAAgB,CAAC;AAAA,UAC5B,OACE,eACI,gDACA;AAAA,UAEN,SAAS,MAAM,QAAQ,IAAI;AAAA,UAE3B,UAAA;AAAA,YAAAC,2BAAAA,IAACC,KAAAA,MAAA,EAAK,MAAMC,WAAAA,YAAY,WAAU,UAAS;AAAA,YAAE;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,MAG9C,CAAC,eACAF,2BAAAA,IAAC,UAAK,WAAU,iCAAgC,4HAGhD,IACE;AAAA,IAAA,GACN;AAAA,IACC,QAAQ,gBAAgB,eACvBA,2BAAAA;AAAAA,MAACG,wBAAAA;AAAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,SAAS;AAAA,QACT,SAAS,MAAM,QAAQ,KAAK;AAAA,MAAA;AAAA,IAAA,IAE5B;AAAA,EAAA,GACN;AAEJ;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ProfileDraft } from './profileBuilderWorkspace';
|
|
3
|
+
export declare function ProfileBuilderAutoOpen({ children }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function ProfileQueryBuilderField({ input, rootValue, onRootChange }: {
|
|
7
|
+
input: ReactNode;
|
|
8
|
+
rootValue: ProfileDraft;
|
|
9
|
+
onRootChange?: ((next: Record<string, unknown>) => void) | undefined;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=profileBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileBuilder.d.ts","sourceRoot":"","sources":["../../src/profiles/profileBuilder.tsx"],"names":[],"mappings":"AAGA,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,2BAA2B,CAAC;AAInC,wBAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAM3E;AAED,wBAAgB,wBAAwB,CAAC,EACvC,KAAK,EACL,SAAS,EACT,YAAY,EACb,EAAE;IACD,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,YAAY,CAAC;IACxB,YAAY,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACtE,2CAmDA"}
|