@flanksource/clicky-ui 0.3.19 → 0.3.21
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/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/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/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 +2 -2
- 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 +2 -2
- 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 +1 -1
- package/dist/components/json-schema-form-types.d.ts.map +1 -1
- 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 +4 -0
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.ts +1 -0
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +4 -0
- package/dist/components.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 +12 -6
- package/dist/data/query-browser/QueryBrowser.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.js +12 -6
- package/dist/data/query-browser/QueryBrowser.js.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.cjs +2 -1
- package/dist/data/query-browser/QueryBrowser.types.cjs.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.d.ts +16 -14
- package/dist/data/query-browser/QueryBrowser.types.d.ts.map +1 -1
- package/dist/data/query-browser/QueryBrowser.types.js +2 -1
- package/dist/data/query-browser/QueryBrowser.types.js.map +1 -1
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -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/styles.css +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const profileWizardModel = require("./profileWizardModel.cjs");
|
|
5
|
+
function useProfileFieldState({
|
|
6
|
+
discovered,
|
|
7
|
+
configured,
|
|
8
|
+
activeName,
|
|
9
|
+
onConfiguredChange,
|
|
10
|
+
onActiveNameChange
|
|
11
|
+
}) {
|
|
12
|
+
const [filter, setFilter] = react.useState({
|
|
13
|
+
query: "",
|
|
14
|
+
type: "",
|
|
15
|
+
selection: "all"
|
|
16
|
+
});
|
|
17
|
+
const available = react.useMemo(
|
|
18
|
+
() => profileWizardModel.availableProfileFields(discovered, configured),
|
|
19
|
+
[configured, discovered]
|
|
20
|
+
);
|
|
21
|
+
const selectedNames = react.useMemo(
|
|
22
|
+
() => new Set(configured.map((field) => field.name)),
|
|
23
|
+
[configured]
|
|
24
|
+
);
|
|
25
|
+
const visibleFields = react.useMemo(
|
|
26
|
+
() => profileWizardModel.filterProfileFields(available, selectedNames, filter),
|
|
27
|
+
[available, filter, selectedNames]
|
|
28
|
+
);
|
|
29
|
+
const types = react.useMemo(
|
|
30
|
+
() => Array.from(
|
|
31
|
+
new Set(available.map((field) => field.type).filter(Boolean))
|
|
32
|
+
).sort(),
|
|
33
|
+
[available]
|
|
34
|
+
);
|
|
35
|
+
const activeField = configured.find((field) => field.name === activeName) ?? available.find((field) => field.name === activeName) ?? configured[0] ?? available[0];
|
|
36
|
+
const activeIndex = activeField ? configured.findIndex((field) => field.name === activeField.name) : -1;
|
|
37
|
+
const setVisibleSelection = (selected) => {
|
|
38
|
+
onConfiguredChange(
|
|
39
|
+
profileWizardModel.applyVisibleFieldSelection(
|
|
40
|
+
available,
|
|
41
|
+
configured,
|
|
42
|
+
new Set(visibleFields.map((field) => field.name)),
|
|
43
|
+
selected
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
const setFieldSelection = (field, selected) => {
|
|
48
|
+
onConfiguredChange(
|
|
49
|
+
profileWizardModel.applyVisibleFieldSelection(
|
|
50
|
+
available,
|
|
51
|
+
configured,
|
|
52
|
+
/* @__PURE__ */ new Set([field.name]),
|
|
53
|
+
selected
|
|
54
|
+
)
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
const patchField = (field, patch) => {
|
|
58
|
+
const { name, ...properties } = patch;
|
|
59
|
+
const updated = typeof name === "string" ? profileWizardModel.patchProfileField(profileWizardModel.renameProfileField(field, name), properties) : profileWizardModel.patchProfileField(field, patch);
|
|
60
|
+
const exists = configured.some((entry) => entry.name === field.name);
|
|
61
|
+
onConfiguredChange(
|
|
62
|
+
exists ? configured.map((entry) => entry.name === field.name ? updated : entry) : [...configured, updated]
|
|
63
|
+
);
|
|
64
|
+
if (typeof name === "string") onActiveNameChange(name);
|
|
65
|
+
};
|
|
66
|
+
const updateActiveField = (patch) => {
|
|
67
|
+
if (activeField) patchField(activeField, patch);
|
|
68
|
+
};
|
|
69
|
+
const addField = () => {
|
|
70
|
+
const names = new Set(available.map((field) => field.name));
|
|
71
|
+
let index = configured.length + 1;
|
|
72
|
+
let name = `column_${index}`;
|
|
73
|
+
while (names.has(name)) name = `column_${++index}`;
|
|
74
|
+
onConfiguredChange([...configured, { name, type: "string" }]);
|
|
75
|
+
onActiveNameChange(name);
|
|
76
|
+
};
|
|
77
|
+
const moveField = (field, offset) => {
|
|
78
|
+
const from = configured.findIndex((entry) => entry.name === field.name);
|
|
79
|
+
const target = from + offset;
|
|
80
|
+
if (from < 0 || target < 0 || target >= configured.length) return;
|
|
81
|
+
const next = [...configured];
|
|
82
|
+
const moved = next[from];
|
|
83
|
+
const displaced = next[target];
|
|
84
|
+
if (!moved || !displaced)
|
|
85
|
+
throw new Error(`cannot move field ${field.name}: index out of range`);
|
|
86
|
+
next[from] = displaced;
|
|
87
|
+
next[target] = moved;
|
|
88
|
+
onConfiguredChange(next);
|
|
89
|
+
};
|
|
90
|
+
const moveActive = (offset) => {
|
|
91
|
+
if (activeField) moveField(activeField, offset);
|
|
92
|
+
};
|
|
93
|
+
const reorderField = (sourceName, targetName) => {
|
|
94
|
+
const next = profileWizardModel.reorderProfileColumns(configured, sourceName, targetName);
|
|
95
|
+
if (next !== configured) onConfiguredChange(next);
|
|
96
|
+
};
|
|
97
|
+
const removeField = (field) => {
|
|
98
|
+
var _a;
|
|
99
|
+
const removedIndex = configured.findIndex((entry) => entry.name === field.name);
|
|
100
|
+
if (removedIndex < 0) return;
|
|
101
|
+
const next = configured.filter((entry) => entry.name !== field.name);
|
|
102
|
+
onConfiguredChange(next);
|
|
103
|
+
if ((activeField == null ? void 0 : activeField.name) === field.name) {
|
|
104
|
+
onActiveNameChange(((_a = next[Math.max(0, removedIndex - 1)]) == null ? void 0 : _a.name) ?? "");
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const removeActive = () => {
|
|
108
|
+
if (activeField) removeField(activeField);
|
|
109
|
+
};
|
|
110
|
+
return {
|
|
111
|
+
available,
|
|
112
|
+
selectedNames,
|
|
113
|
+
visibleFields,
|
|
114
|
+
types,
|
|
115
|
+
filter,
|
|
116
|
+
activeField,
|
|
117
|
+
activeIndex,
|
|
118
|
+
canMoveUp: activeIndex > 0,
|
|
119
|
+
canMoveDown: activeIndex >= 0 && activeIndex < configured.length - 1,
|
|
120
|
+
configuredCount: configured.length,
|
|
121
|
+
setFilter,
|
|
122
|
+
setActiveName: onActiveNameChange,
|
|
123
|
+
setVisibleSelection,
|
|
124
|
+
setFieldSelection,
|
|
125
|
+
patchField,
|
|
126
|
+
updateActiveField,
|
|
127
|
+
addField,
|
|
128
|
+
moveActive,
|
|
129
|
+
moveField,
|
|
130
|
+
reorderField,
|
|
131
|
+
removeField,
|
|
132
|
+
removeActive
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
exports.useProfileFieldState = useProfileFieldState;
|
|
136
|
+
//# sourceMappingURL=profileFieldState.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileFieldState.cjs","sources":["../../src/profiles/profileFieldState.ts"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport {\n applyVisibleFieldSelection,\n availableProfileFields,\n filterProfileFields,\n patchProfileField,\n renameProfileField,\n reorderProfileColumns,\n type Patch,\n type ProfileColumn,\n type ProfileFieldFilter,\n} from \"./profileWizardModel\";\n\nexport type ProfileFieldStateProps = {\n discovered: ProfileColumn[];\n configured: ProfileColumn[];\n activeName: string;\n onConfiguredChange: (columns: ProfileColumn[]) => void;\n onActiveNameChange: (name: string) => void;\n};\n\nexport type ProfileFieldState = ReturnType<typeof useProfileFieldState>;\n\n/**\n * Column editing shared by the wizard's fields step and the editor route.\n *\n * The route splits the list and the inspector into separate Workspace panes,\n * which cannot each own this state, so it lives here and both surfaces read the\n * same derivations rather than re-deriving selection and filtering apart.\n */\nexport function useProfileFieldState({\n discovered,\n configured,\n activeName,\n onConfiguredChange,\n onActiveNameChange,\n}: ProfileFieldStateProps) {\n const [filter, setFilter] = useState<ProfileFieldFilter>({\n query: \"\",\n type: \"\",\n selection: \"all\",\n });\n const available = useMemo(\n () => availableProfileFields(discovered, configured),\n [configured, discovered],\n );\n const selectedNames = useMemo(\n () => new Set(configured.map((field) => field.name)),\n [configured],\n );\n const visibleFields = useMemo(\n () => filterProfileFields(available, selectedNames, filter),\n [available, filter, selectedNames],\n );\n const types = useMemo(\n () =>\n Array.from(\n new Set(available.map((field) => field.type).filter(Boolean)),\n ).sort() as string[],\n [available],\n );\n const activeField =\n configured.find((field) => field.name === activeName) ??\n available.find((field) => field.name === activeName) ??\n configured[0] ??\n available[0];\n const activeIndex = activeField\n ? configured.findIndex((field) => field.name === activeField.name)\n : -1;\n\n const setVisibleSelection = (selected: boolean) => {\n onConfiguredChange(\n applyVisibleFieldSelection(\n available,\n configured,\n new Set(visibleFields.map((field) => field.name)),\n selected,\n ),\n );\n };\n\n const setFieldSelection = (field: ProfileColumn, selected: boolean) => {\n onConfiguredChange(\n applyVisibleFieldSelection(\n available,\n configured,\n new Set([field.name]),\n selected,\n ),\n );\n };\n\n const patchField = (field: ProfileColumn, patch: Patch<ProfileColumn>) => {\n const { name, ...properties } = patch;\n const updated =\n typeof name === \"string\"\n ? patchProfileField(renameProfileField(field, name), properties)\n : patchProfileField(field, patch);\n const exists = configured.some((entry) => entry.name === field.name);\n onConfiguredChange(\n exists\n ? configured.map((entry) => (entry.name === field.name ? updated : entry))\n : [...configured, updated],\n );\n if (typeof name === \"string\") onActiveNameChange(name);\n };\n\n const updateActiveField = (patch: Patch<ProfileColumn>) => {\n if (activeField) patchField(activeField, patch);\n };\n\n const addField = () => {\n const names = new Set(available.map((field) => field.name));\n let index = configured.length + 1;\n let name = `column_${index}`;\n while (names.has(name)) name = `column_${++index}`;\n onConfiguredChange([...configured, { name, type: \"string\" }]);\n onActiveNameChange(name);\n };\n\n const moveField = (field: ProfileColumn, offset: number) => {\n const from = configured.findIndex((entry) => entry.name === field.name);\n const target = from + offset;\n if (from < 0 || target < 0 || target >= configured.length) return;\n const next = [...configured];\n const moved = next[from];\n const displaced = next[target];\n if (!moved || !displaced)\n throw new Error(`cannot move field ${field.name}: index out of range`);\n next[from] = displaced;\n next[target] = moved;\n onConfiguredChange(next);\n };\n\n const moveActive = (offset: number) => {\n if (activeField) moveField(activeField, offset);\n };\n\n /**\n * Drops the dragged field onto the target's position. Only configured fields\n * have a position to move: an unselected field is anchored to the sample, so\n * it is neither a source nor a destination.\n */\n const reorderField = (sourceName: string, targetName: string) => {\n const next = reorderProfileColumns(configured, sourceName, targetName);\n if (next !== configured) onConfiguredChange(next);\n };\n\n const removeField = (field: ProfileColumn) => {\n const removedIndex = configured.findIndex((entry) => entry.name === field.name);\n if (removedIndex < 0) return;\n const next = configured.filter((entry) => entry.name !== field.name);\n onConfiguredChange(next);\n if (activeField?.name === field.name) {\n onActiveNameChange(next[Math.max(0, removedIndex - 1)]?.name ?? \"\");\n }\n };\n\n const removeActive = () => {\n if (activeField) removeField(activeField);\n };\n\n return {\n available,\n selectedNames,\n visibleFields,\n types,\n filter,\n activeField,\n activeIndex,\n canMoveUp: activeIndex > 0,\n canMoveDown: activeIndex >= 0 && activeIndex < configured.length - 1,\n configuredCount: configured.length,\n setFilter,\n setActiveName: onActiveNameChange,\n setVisibleSelection,\n setFieldSelection,\n patchField,\n updateActiveField,\n addField,\n moveActive,\n moveField,\n reorderField,\n removeField,\n removeActive,\n };\n}\n"],"names":["useState","useMemo","availableProfileFields","filterProfileFields","applyVisibleFieldSelection","patchProfileField","renameProfileField","reorderProfileColumns"],"mappings":";;;;AA8BO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA2B;AACzB,QAAM,CAAC,QAAQ,SAAS,IAAIA,eAA6B;AAAA,IACvD,OAAO;AAAA,IACP,MAAM;AAAA,IACN,WAAW;AAAA,EAAA,CACZ;AACD,QAAM,YAAYC,MAAAA;AAAAA,IAChB,MAAMC,mBAAAA,uBAAuB,YAAY,UAAU;AAAA,IACnD,CAAC,Y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a,MAAM;AAAA,EAChD;AAOA,QAAM,eAAe,CAAC,YAAoB,eAAuB;AAC/D,UAAM,OAAOE,mBAAAA,sBAAsB,YAAY,YAAY,UAAU;AACrE,QAAI,SAAS,WAAY,oBAAmB,IAAI;AAAA,EAClD;AAEA,QAAM,cAAc,CAAC,UAAyB;;AAC5C,UAAM,eAAe,WAAW,UAAU,CAAC,UAAU,MAAM,SAAS,MAAM,IAAI;AAC9E,QAAI,eAAe,EAAG;AACtB,UAAM,OAAO,WAAW,OAAO,CAAC,UAAU,MAAM,SAAS,MAAM,IAAI;AACnE,uBAAmB,IAAI;AACvB,SAAI,2CAAa,UAAS,MAAM,MAAM;AACpC,2BAAmB,UAAK,KAAK,IAAI,GAAG,eAAe,CAAC,CAAC,MAAlC,mBAAqC,SAAQ,EAAE;AAAA,IACpE;AAAA,EACF;AAEA,QAAM,eAAe,MAAM;AACzB,QAAI,yBAAyB,WAAW;AAAA,EAC1C;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,cAAc;AAAA,IACzB,aAAa,eAAe,KAAK,cAAc,WAAW,SAAS;AAAA,IACnE,iBAAiB,WAAW;AAAA,IAC5B;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Patch, ProfileColumn, ProfileFieldFilter } from './profileWizardModel';
|
|
2
|
+
export type ProfileFieldStateProps = {
|
|
3
|
+
discovered: ProfileColumn[];
|
|
4
|
+
configured: ProfileColumn[];
|
|
5
|
+
activeName: string;
|
|
6
|
+
onConfiguredChange: (columns: ProfileColumn[]) => void;
|
|
7
|
+
onActiveNameChange: (name: string) => void;
|
|
8
|
+
};
|
|
9
|
+
export type ProfileFieldState = ReturnType<typeof useProfileFieldState>;
|
|
10
|
+
/**
|
|
11
|
+
* Column editing shared by the wizard's fields step and the editor route.
|
|
12
|
+
*
|
|
13
|
+
* The route splits the list and the inspector into separate Workspace panes,
|
|
14
|
+
* which cannot each own this state, so it lives here and both surfaces read the
|
|
15
|
+
* same derivations rather than re-deriving selection and filtering apart.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useProfileFieldState({ discovered, configured, activeName, onConfiguredChange, onActiveNameChange, }: ProfileFieldStateProps): {
|
|
18
|
+
available: ProfileColumn[];
|
|
19
|
+
selectedNames: Set<string>;
|
|
20
|
+
visibleFields: ProfileColumn[];
|
|
21
|
+
types: string[];
|
|
22
|
+
filter: ProfileFieldFilter;
|
|
23
|
+
activeField: ProfileColumn | undefined;
|
|
24
|
+
activeIndex: number;
|
|
25
|
+
canMoveUp: boolean;
|
|
26
|
+
canMoveDown: boolean;
|
|
27
|
+
configuredCount: number;
|
|
28
|
+
setFilter: import('react').Dispatch<import('react').SetStateAction<ProfileFieldFilter>>;
|
|
29
|
+
setActiveName: (name: string) => void;
|
|
30
|
+
setVisibleSelection: (selected: boolean) => void;
|
|
31
|
+
setFieldSelection: (field: ProfileColumn, selected: boolean) => void;
|
|
32
|
+
patchField: (field: ProfileColumn, patch: Patch<ProfileColumn>) => void;
|
|
33
|
+
updateActiveField: (patch: Patch<ProfileColumn>) => void;
|
|
34
|
+
addField: () => void;
|
|
35
|
+
moveActive: (offset: number) => void;
|
|
36
|
+
moveField: (field: ProfileColumn, offset: number) => void;
|
|
37
|
+
reorderField: (sourceName: string, targetName: string) => void;
|
|
38
|
+
removeField: (field: ProfileColumn) => void;
|
|
39
|
+
removeActive: () => void;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=profileFieldState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileFieldState.d.ts","sourceRoot":"","sources":["../../src/profiles/profileFieldState.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACxB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IACvD,kBAAkB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,UAAU,EACV,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,GACnB,EAAE,sBAAsB;;;;;;;;;;;;0BAlBI,MAAM,KAAK,IAAI;oCAoDH,OAAO;+BAWZ,aAAa,YAAY,OAAO;wBAWvC,aAAa,SAAS,KAAK,CAAC,aAAa,CAAC;+BAenC,KAAK,CAAC,aAAa,CAAC;;yBA2B1B,MAAM;uBAdR,aAAa,UAAU,MAAM;+BAuBrB,MAAM,cAAc,MAAM;yBAKhC,aAAa;;EAsC1C"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { useState, useMemo } from "react";
|
|
2
|
+
import { availableProfileFields, filterProfileFields, reorderProfileColumns, patchProfileField, renameProfileField, applyVisibleFieldSelection } from "./profileWizardModel.js";
|
|
3
|
+
function useProfileFieldState({
|
|
4
|
+
discovered,
|
|
5
|
+
configured,
|
|
6
|
+
activeName,
|
|
7
|
+
onConfiguredChange,
|
|
8
|
+
onActiveNameChange
|
|
9
|
+
}) {
|
|
10
|
+
const [filter, setFilter] = useState({
|
|
11
|
+
query: "",
|
|
12
|
+
type: "",
|
|
13
|
+
selection: "all"
|
|
14
|
+
});
|
|
15
|
+
const available = useMemo(
|
|
16
|
+
() => availableProfileFields(discovered, configured),
|
|
17
|
+
[configured, discovered]
|
|
18
|
+
);
|
|
19
|
+
const selectedNames = useMemo(
|
|
20
|
+
() => new Set(configured.map((field) => field.name)),
|
|
21
|
+
[configured]
|
|
22
|
+
);
|
|
23
|
+
const visibleFields = useMemo(
|
|
24
|
+
() => filterProfileFields(available, selectedNames, filter),
|
|
25
|
+
[available, filter, selectedNames]
|
|
26
|
+
);
|
|
27
|
+
const types = useMemo(
|
|
28
|
+
() => Array.from(
|
|
29
|
+
new Set(available.map((field) => field.type).filter(Boolean))
|
|
30
|
+
).sort(),
|
|
31
|
+
[available]
|
|
32
|
+
);
|
|
33
|
+
const activeField = configured.find((field) => field.name === activeName) ?? available.find((field) => field.name === activeName) ?? configured[0] ?? available[0];
|
|
34
|
+
const activeIndex = activeField ? configured.findIndex((field) => field.name === activeField.name) : -1;
|
|
35
|
+
const setVisibleSelection = (selected) => {
|
|
36
|
+
onConfiguredChange(
|
|
37
|
+
applyVisibleFieldSelection(
|
|
38
|
+
available,
|
|
39
|
+
configured,
|
|
40
|
+
new Set(visibleFields.map((field) => field.name)),
|
|
41
|
+
selected
|
|
42
|
+
)
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
const setFieldSelection = (field, selected) => {
|
|
46
|
+
onConfiguredChange(
|
|
47
|
+
applyVisibleFieldSelection(
|
|
48
|
+
available,
|
|
49
|
+
configured,
|
|
50
|
+
/* @__PURE__ */ new Set([field.name]),
|
|
51
|
+
selected
|
|
52
|
+
)
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
const patchField = (field, patch) => {
|
|
56
|
+
const { name, ...properties } = patch;
|
|
57
|
+
const updated = typeof name === "string" ? patchProfileField(renameProfileField(field, name), properties) : patchProfileField(field, patch);
|
|
58
|
+
const exists = configured.some((entry) => entry.name === field.name);
|
|
59
|
+
onConfiguredChange(
|
|
60
|
+
exists ? configured.map((entry) => entry.name === field.name ? updated : entry) : [...configured, updated]
|
|
61
|
+
);
|
|
62
|
+
if (typeof name === "string") onActiveNameChange(name);
|
|
63
|
+
};
|
|
64
|
+
const updateActiveField = (patch) => {
|
|
65
|
+
if (activeField) patchField(activeField, patch);
|
|
66
|
+
};
|
|
67
|
+
const addField = () => {
|
|
68
|
+
const names = new Set(available.map((field) => field.name));
|
|
69
|
+
let index = configured.length + 1;
|
|
70
|
+
let name = `column_${index}`;
|
|
71
|
+
while (names.has(name)) name = `column_${++index}`;
|
|
72
|
+
onConfiguredChange([...configured, { name, type: "string" }]);
|
|
73
|
+
onActiveNameChange(name);
|
|
74
|
+
};
|
|
75
|
+
const moveField = (field, offset) => {
|
|
76
|
+
const from = configured.findIndex((entry) => entry.name === field.name);
|
|
77
|
+
const target = from + offset;
|
|
78
|
+
if (from < 0 || target < 0 || target >= configured.length) return;
|
|
79
|
+
const next = [...configured];
|
|
80
|
+
const moved = next[from];
|
|
81
|
+
const displaced = next[target];
|
|
82
|
+
if (!moved || !displaced)
|
|
83
|
+
throw new Error(`cannot move field ${field.name}: index out of range`);
|
|
84
|
+
next[from] = displaced;
|
|
85
|
+
next[target] = moved;
|
|
86
|
+
onConfiguredChange(next);
|
|
87
|
+
};
|
|
88
|
+
const moveActive = (offset) => {
|
|
89
|
+
if (activeField) moveField(activeField, offset);
|
|
90
|
+
};
|
|
91
|
+
const reorderField = (sourceName, targetName) => {
|
|
92
|
+
const next = reorderProfileColumns(configured, sourceName, targetName);
|
|
93
|
+
if (next !== configured) onConfiguredChange(next);
|
|
94
|
+
};
|
|
95
|
+
const removeField = (field) => {
|
|
96
|
+
var _a;
|
|
97
|
+
const removedIndex = configured.findIndex((entry) => entry.name === field.name);
|
|
98
|
+
if (removedIndex < 0) return;
|
|
99
|
+
const next = configured.filter((entry) => entry.name !== field.name);
|
|
100
|
+
onConfiguredChange(next);
|
|
101
|
+
if ((activeField == null ? void 0 : activeField.name) === field.name) {
|
|
102
|
+
onActiveNameChange(((_a = next[Math.max(0, removedIndex - 1)]) == null ? void 0 : _a.name) ?? "");
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const removeActive = () => {
|
|
106
|
+
if (activeField) removeField(activeField);
|
|
107
|
+
};
|
|
108
|
+
return {
|
|
109
|
+
available,
|
|
110
|
+
selectedNames,
|
|
111
|
+
visibleFields,
|
|
112
|
+
types,
|
|
113
|
+
filter,
|
|
114
|
+
activeField,
|
|
115
|
+
activeIndex,
|
|
116
|
+
canMoveUp: activeIndex > 0,
|
|
117
|
+
canMoveDown: activeIndex >= 0 && activeIndex < configured.length - 1,
|
|
118
|
+
configuredCount: configured.length,
|
|
119
|
+
setFilter,
|
|
120
|
+
setActiveName: onActiveNameChange,
|
|
121
|
+
setVisibleSelection,
|
|
122
|
+
setFieldSelection,
|
|
123
|
+
patchField,
|
|
124
|
+
updateActiveField,
|
|
125
|
+
addField,
|
|
126
|
+
moveActive,
|
|
127
|
+
moveField,
|
|
128
|
+
reorderField,
|
|
129
|
+
removeField,
|
|
130
|
+
removeActive
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
export {
|
|
134
|
+
useProfileFieldState
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=profileFieldState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileFieldState.js","sources":["../../src/profiles/profileFieldState.ts"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport {\n applyVisibleFieldSelection,\n availableProfileFields,\n filterProfileFields,\n patchProfileField,\n renameProfileField,\n reorderProfileColumns,\n type Patch,\n type ProfileColumn,\n type ProfileFieldFilter,\n} from \"./profileWizardModel\";\n\nexport type ProfileFieldStateProps = {\n discovered: ProfileColumn[];\n configured: ProfileColumn[];\n activeName: string;\n onConfiguredChange: (columns: ProfileColumn[]) => void;\n onActiveNameChange: (name: string) => void;\n};\n\nexport type ProfileFieldState = ReturnType<typeof useProfileFieldState>;\n\n/**\n * Column editing shared by the wizard's fields step and the editor route.\n *\n * The route splits the list and the inspector into separate Workspace panes,\n * which cannot each own this state, so it lives here and both surfaces read the\n * same derivations rather than re-deriving selection and filtering apart.\n */\nexport function useProfileFieldState({\n discovered,\n configured,\n activeName,\n onConfiguredChange,\n onActiveNameChange,\n}: ProfileFieldStateProps) {\n const [filter, setFilter] = useState<ProfileFieldFilter>({\n query: \"\",\n type: \"\",\n selection: \"all\",\n });\n const available = useMemo(\n () => availableProfileFields(discovered, configured),\n [configured, discovered],\n );\n const selectedNames = useMemo(\n () => new Set(configured.map((field) => field.name)),\n [configured],\n );\n const visibleFields = useMemo(\n () => filterProfileFields(available, selectedNames, filter),\n [available, filter, selectedNames],\n );\n const types = useMemo(\n () =>\n Array.from(\n new Set(available.map((field) => field.type).filter(Boolean)),\n ).sort() as string[],\n [available],\n );\n const activeField =\n configured.find((field) => field.name === activeName) ??\n available.find((field) => field.name === activeName) ??\n configured[0] ??\n available[0];\n const activeIndex = activeField\n ? configured.findIndex((field) => field.name === activeField.name)\n : -1;\n\n const setVisibleSelection = (selected: boolean) => {\n onConfiguredChange(\n applyVisibleFieldSelection(\n available,\n configured,\n new Set(visibleFields.map((field) => field.name)),\n selected,\n ),\n );\n };\n\n const setFieldSelection = (field: ProfileColumn, selected: boolean) => {\n onConfiguredChange(\n applyVisibleFieldSelection(\n available,\n configured,\n new Set([field.name]),\n selected,\n ),\n );\n };\n\n const patchField = (field: ProfileColumn, patch: Patch<ProfileColumn>) => {\n const { name, ...properties } = patch;\n const updated =\n typeof name === \"string\"\n ? patchProfileField(renameProfileField(field, name), properties)\n : patchProfileField(field, patch);\n const exists = configured.some((entry) => entry.name === field.name);\n onConfiguredChange(\n exists\n ? configured.map((entry) => (entry.name === field.name ? updated : entry))\n : [...configured, updated],\n );\n if (typeof name === \"string\") onActiveNameChange(name);\n };\n\n const updateActiveField = (patch: Patch<ProfileColumn>) => {\n if (activeField) patchField(activeField, patch);\n };\n\n const addField = () => {\n const names = new Set(available.map((field) => field.name));\n let index = configured.length + 1;\n let name = `column_${index}`;\n while (names.has(name)) name = `column_${++index}`;\n onConfiguredChange([...configured, { name, type: \"string\" }]);\n onActiveNameChange(name);\n };\n\n const moveField = (field: ProfileColumn, offset: number) => {\n const from = configured.findIndex((entry) => entry.name === field.name);\n const target = from + offset;\n if (from < 0 || target < 0 || target >= configured.length) return;\n const next = [...configured];\n const moved = next[from];\n const displaced = next[target];\n if (!moved || !displaced)\n throw new Error(`cannot move field ${field.name}: index out of range`);\n next[from] = displaced;\n next[target] = moved;\n onConfiguredChange(next);\n };\n\n const moveActive = (offset: number) => {\n if (activeField) moveField(activeField, offset);\n };\n\n /**\n * Drops the dragged field onto the target's position. Only configured fields\n * have a position to move: an unselected field is anchored to the sample, so\n * it is neither a source nor a destination.\n */\n const reorderField = (sourceName: string, targetName: string) => {\n const next = reorderProfileColumns(configured, sourceName, targetName);\n if (next !== configured) onConfiguredChange(next);\n };\n\n const removeField = (field: ProfileColumn) => {\n const removedIndex = configured.findIndex((entry) => entry.name === field.name);\n if (removedIndex < 0) return;\n const next = configured.filter((entry) => entry.name !== field.name);\n onConfiguredChange(next);\n if (activeField?.name === field.name) {\n onActiveNameChange(next[Math.max(0, removedIndex - 1)]?.name ?? \"\");\n }\n };\n\n const removeActive = () => {\n if (activeField) removeField(activeField);\n };\n\n return {\n available,\n selectedNames,\n visibleFields,\n types,\n filter,\n activeField,\n activeIndex,\n canMoveUp: activeIndex > 0,\n canMoveDown: activeIndex >= 0 && activeIndex < configured.length - 1,\n configuredCount: configured.length,\n setFilter,\n setActiveName: onActiveNameChange,\n setVisibleSelection,\n setFieldSelection,\n patchField,\n updateActiveField,\n addField,\n moveActive,\n moveField,\n reorderField,\n removeField,\n removeActive,\n };\n}\n"],"names":[],"mappings":";;AA8BO,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA2B;AACzB,QAAM,CAAC,QAAQ,SAAS,IAAI,SAA6B;AAAA,IACvD,OAAO;AAAA,IACP,MAAM;AAAA,IACN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,QAAI,YAAa,WAAU,aAAa,MAAM;AAAA,EAChD;AAOA,QAAM,eAAe,CAAC,YAAoB,eAAuB;AAC/D,UAAM,OAAO,sBAAsB,YAAY,YAAY,UAAU;AACrE,QAAI,SAAS,WAAY,oBAAmB,IAAI;AAAA,EAClD;AAEA,QAAM,cAAc,CAAC,UAAyB;;AAC5C,UAAM,eAAe,WAAW,UAAU,CAAC,UAAU,MAAM,SAAS,MAAM,IAAI;AAC9E,QAAI,eAAe,EAAG;AACtB,UAAM,OAAO,WAAW,OAAO,CAAC,UAAU,MAAM,SAAS,MAAM,IAAI;AACnE,uBAAmB,IAAI;AACvB,SAAI,2CAAa,UAAS,MAAM,MAAM;AACpC,2BAAmB,UAAK,KAAK,IAAI,GAAG,eAAe,CAAC,CAAC,MAAlC,mBAAqC,SAAQ,EAAE;AAAA,IACpE;AAAA,EACF;AAEA,QAAM,eAAe,MAAM;AACzB,QAAI,yBAAyB,WAAW;AAAA,EAC1C;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,cAAc;AAAA,IACzB,aAAa,eAAe,KAAK,cAAc,WAAW,SAAS;AAAA,IACnE,iBAAiB,WAAW;AAAA,IAC5B;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const PROFILE_FIELD_TYPES = [
|
|
4
|
+
"string",
|
|
5
|
+
"number",
|
|
6
|
+
"boolean",
|
|
7
|
+
"datetime",
|
|
8
|
+
"duration",
|
|
9
|
+
"bytes",
|
|
10
|
+
"status",
|
|
11
|
+
"health",
|
|
12
|
+
"key_value",
|
|
13
|
+
"key_values",
|
|
14
|
+
"json"
|
|
15
|
+
];
|
|
16
|
+
exports.PROFILE_FIELD_TYPES = PROFILE_FIELD_TYPES;
|
|
17
|
+
//# sourceMappingURL=profileFieldTypes.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileFieldTypes.cjs","sources":["../../src/profiles/profileFieldTypes.ts"],"sourcesContent":["/**\n * The data types a profile field may declare.\n *\n * Kept apart from profileFieldGrid.tsx so that module exports only components\n * (react/only-export-components).\n */\n\nexport const PROFILE_FIELD_TYPES = [\n \"string\",\n \"number\",\n \"boolean\",\n \"datetime\",\n \"duration\",\n \"bytes\",\n \"status\",\n \"health\",\n \"key_value\",\n \"key_values\",\n \"json\",\n] as const;\n"],"names":[],"mappings":";;AAOO,MAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The data types a profile field may declare.
|
|
3
|
+
*
|
|
4
|
+
* Kept apart from profileFieldGrid.tsx so that module exports only components
|
|
5
|
+
* (react/only-export-components).
|
|
6
|
+
*/
|
|
7
|
+
export declare const PROFILE_FIELD_TYPES: readonly ["string", "number", "boolean", "datetime", "duration", "bytes", "status", "health", "key_value", "key_values", "json"];
|
|
8
|
+
//# sourceMappingURL=profileFieldTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileFieldTypes.d.ts","sourceRoot":"","sources":["../../src/profiles/profileFieldTypes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,mBAAmB,kIAYtB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const PROFILE_FIELD_TYPES = [
|
|
2
|
+
"string",
|
|
3
|
+
"number",
|
|
4
|
+
"boolean",
|
|
5
|
+
"datetime",
|
|
6
|
+
"duration",
|
|
7
|
+
"bytes",
|
|
8
|
+
"status",
|
|
9
|
+
"health",
|
|
10
|
+
"key_value",
|
|
11
|
+
"key_values",
|
|
12
|
+
"json"
|
|
13
|
+
];
|
|
14
|
+
export {
|
|
15
|
+
PROFILE_FIELD_TYPES
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=profileFieldTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileFieldTypes.js","sources":["../../src/profiles/profileFieldTypes.ts"],"sourcesContent":["/**\n * The data types a profile field may declare.\n *\n * Kept apart from profileFieldGrid.tsx so that module exports only components\n * (react/only-export-components).\n */\n\nexport const PROFILE_FIELD_TYPES = [\n \"string\",\n \"number\",\n \"boolean\",\n \"datetime\",\n \"duration\",\n \"bytes\",\n \"status\",\n \"health\",\n \"key_value\",\n \"key_values\",\n \"json\",\n] as const;\n"],"names":[],"mappings":"AAOO,MAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const RESERVED_REQUEST_KEYS = [
|
|
4
|
+
"format",
|
|
5
|
+
"scope",
|
|
6
|
+
"page",
|
|
7
|
+
"limit",
|
|
8
|
+
"offset",
|
|
9
|
+
"filename",
|
|
10
|
+
"_download",
|
|
11
|
+
"args",
|
|
12
|
+
"__schema",
|
|
13
|
+
"__lookup",
|
|
14
|
+
"__lookup_filter",
|
|
15
|
+
"__lookup_q"
|
|
16
|
+
];
|
|
17
|
+
const COLUMN_FILTER_PREFIX = "filter.";
|
|
18
|
+
const NATIVE_FILTER_PROVIDERS = ["opensearch", "opentelemetry"];
|
|
19
|
+
function validateProfileParams(params, providerType) {
|
|
20
|
+
var _a;
|
|
21
|
+
const seen = /* @__PURE__ */ new Set();
|
|
22
|
+
for (const param of params ?? []) {
|
|
23
|
+
const name = ((_a = param.name) == null ? void 0 : _a.trim()) ?? "";
|
|
24
|
+
if (!name) return "Every parameter needs a name";
|
|
25
|
+
if (seen.has(name)) return `Parameter name "${name}" is duplicated`;
|
|
26
|
+
seen.add(name);
|
|
27
|
+
if (name.startsWith(COLUMN_FILTER_PREFIX)) {
|
|
28
|
+
return `Parameter "${name}" must not start with "${COLUMN_FILTER_PREFIX}", which is reserved for column filters`;
|
|
29
|
+
}
|
|
30
|
+
const isFilter = param.role === void 0 || param.role === "filter";
|
|
31
|
+
if (isFilter && RESERVED_REQUEST_KEYS.includes(name)) {
|
|
32
|
+
return `Parameter "${name}" collides with a reserved request key and would never receive a value`;
|
|
33
|
+
}
|
|
34
|
+
const error = validateOneParam(param, name, providerType);
|
|
35
|
+
if (error) return error;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
function validateOneParam(param, name, providerType) {
|
|
40
|
+
var _a;
|
|
41
|
+
if (param.type === "list" && param.role !== void 0 && param.role !== "filter") {
|
|
42
|
+
return `Parameter "${name}" is a list, which cannot take the "${param.role}" role`;
|
|
43
|
+
}
|
|
44
|
+
const field = (_a = param.field) == null ? void 0 : _a.trim();
|
|
45
|
+
if (field) {
|
|
46
|
+
if (param.type !== "list") {
|
|
47
|
+
return `Parameter "${name}" sets a field but is not a list; only a list binds to a backend field`;
|
|
48
|
+
}
|
|
49
|
+
if (!NATIVE_FILTER_PROVIDERS.includes(providerType ?? "")) {
|
|
50
|
+
return `Parameter "${name}" binds to field "${field}", but provider "${providerType ?? ""}" applies no native filters, so an excluded value would be dropped`;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (param.type === "list") {
|
|
54
|
+
for (const option of param.options ?? []) {
|
|
55
|
+
if (option.includes(",")) {
|
|
56
|
+
return `Parameter "${name}" option "${option}" contains a comma, which separates values on the wire`;
|
|
57
|
+
}
|
|
58
|
+
if (option.startsWith("!")) {
|
|
59
|
+
return `Parameter "${name}" option "${option}" starts with !, which marks an exclusion on the wire`;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return validateDefault(param, name);
|
|
64
|
+
}
|
|
65
|
+
function validateDefault(param, name) {
|
|
66
|
+
const options = param.options ?? [];
|
|
67
|
+
if (options.length === 0 || param.default === void 0 || param.default === null) return null;
|
|
68
|
+
const chosen = Array.isArray(param.default) ? param.default : [param.default];
|
|
69
|
+
for (const value of chosen) {
|
|
70
|
+
if (typeof value !== "string") continue;
|
|
71
|
+
if (!options.includes(value)) {
|
|
72
|
+
return `Parameter "${name}" default "${value}" is not one of its options`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
exports.validateProfileParams = validateProfileParams;
|
|
78
|
+
//# sourceMappingURL=profileParamModel.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileParamModel.cjs","sources":["../../src/profiles/profileParamModel.ts"],"sourcesContent":["/**\n * Author-time checks on a profile's parameters, mirroring what the server\n * rejects (query.validateParams) so a mistake is caught in the editor rather\n * than on the first run — and so the failures that would otherwise be *silent*\n * are caught at all: a parameter named after a reserved request key simply never\n * receives a value.\n */\n\nimport type { ParamDraft } from \"./profileWizardModel\";\n\n/** Query-string keys the server consumes as transport concerns before params are\n * built (see IsReservedParam in cmd/query/profiles/execution.go). */\nconst RESERVED_REQUEST_KEYS = [\n \"format\",\n \"scope\",\n \"page\",\n \"limit\",\n \"offset\",\n \"filename\",\n \"_download\",\n \"args\",\n \"__schema\",\n \"__lookup\",\n \"__lookup_filter\",\n \"__lookup_q\",\n];\n\nconst COLUMN_FILTER_PREFIX = \"filter.\";\n\n/** Providers that turn include/exclude selections into backend query clauses\n * (query.SupportsNativeFilters). */\nconst NATIVE_FILTER_PROVIDERS = [\"opensearch\", \"opentelemetry\"];\n\nexport function validateProfileParams(\n params: ParamDraft[] | undefined,\n providerType: string | undefined,\n): string | null {\n const seen = new Set<string>();\n for (const param of params ?? []) {\n const name = param.name?.trim() ?? \"\";\n if (!name) return \"Every parameter needs a name\";\n if (seen.has(name)) return `Parameter name \"${name}\" is duplicated`;\n seen.add(name);\n\n if (name.startsWith(COLUMN_FILTER_PREFIX)) {\n return `Parameter \"${name}\" must not start with \"${COLUMN_FILTER_PREFIX}\", which is reserved for column filters`;\n }\n // limit and offset are exactly the keys a profile may rename by claiming\n // their role, so only a plain filter parameter collides.\n const isFilter = param.role === undefined || param.role === \"filter\";\n if (isFilter && RESERVED_REQUEST_KEYS.includes(name)) {\n return `Parameter \"${name}\" collides with a reserved request key and would never receive a value`;\n }\n\n const error = validateOneParam(param, name, providerType);\n if (error) return error;\n }\n return null;\n}\n\nfunction validateOneParam(\n param: ParamDraft,\n name: string,\n providerType: string | undefined,\n): string | null {\n if (param.type === \"list\" && param.role !== undefined && param.role !== \"filter\") {\n return `Parameter \"${name}\" is a list, which cannot take the \"${param.role}\" role`;\n }\n\n const field = param.field?.trim();\n if (field) {\n if (param.type !== \"list\") {\n return `Parameter \"${name}\" sets a field but is not a list; only a list binds to a backend field`;\n }\n if (!NATIVE_FILTER_PROVIDERS.includes(providerType ?? \"\")) {\n return `Parameter \"${name}\" binds to field \"${field}\", but provider \"${providerType ?? \"\"}\" applies no native filters, so an excluded value would be dropped`;\n }\n }\n\n // A list's values travel comma-joined with \"!\" marking an exclusion, and the\n // wire form has no escape — an option carrying either could never be selected.\n if (param.type === \"list\") {\n for (const option of param.options ?? []) {\n if (option.includes(\",\")) {\n return `Parameter \"${name}\" option \"${option}\" contains a comma, which separates values on the wire`;\n }\n if (option.startsWith(\"!\")) {\n return `Parameter \"${name}\" option \"${option}\" starts with !, which marks an exclusion on the wire`;\n }\n }\n }\n\n return validateDefault(param, name);\n}\n\nfunction validateDefault(param: ParamDraft, name: string): string | null {\n const options = param.options ?? [];\n if (options.length === 0 || param.default === undefined || param.default === null) return null;\n\n const chosen = Array.isArray(param.default) ? param.default : [param.default];\n for (const value of chosen) {\n if (typeof value !== \"string\") continue;\n if (!options.includes(value)) {\n return `Parameter \"${name}\" default \"${value}\" is not one of its options`;\n }\n }\n return null;\n}\n"],"names":[],"mappings":";;AAYA,MAAM,wBAAwB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,uBAAuB;AAI7B,MAAM,0BAA0B,CAAC,cAAc,eAAe;AAEvD,SAAS,sBACd,QACA,cACe;;AACf,QAAM,2BAAW,IAAA;AACjB,aAAW,SAAS,UAAU,IAAI;AAChC,UAAM,SAAO,WAAM,SAAN,mBAAY,WAAU;AACnC,QAAI,CAAC,KAAM,QAAO;AAClB,QAAI,KAAK,IAAI,IAAI,EAAG,QAAO,mBAAmB,IAAI;AAClD,SAAK,IAAI,IAAI;AAEb,QAAI,KAAK,WAAW,oBAAoB,GAAG;AACzC,aAAO,cAAc,IAAI,0BAA0B,oBAAoB;AAAA,IACzE;AAGA,UAAM,WAAW,MAAM,SAAS,UAAa,MAAM,SAAS;AAC5D,QAAI,YAAY,sBAAsB,SAAS,IAAI,GAAG;AACpD,aAAO,cAAc,IAAI;AAAA,IAC3B;AAEA,UAAM,QAAQ,iBAAiB,OAAO,MAAM,YAAY;AACxD,QAAI,MAAO,QAAO;AAAA,EACpB;AACA,SAAO;AACT;AAEA,SAAS,iBACP,OACA,MACA,cACe;;AACf,MAAI,MAAM,SAAS,UAAU,MAAM,SAAS,UAAa,MAAM,SAAS,UAAU;AAChF,WAAO,cAAc,IAAI,uCAAuC,MAAM,IAAI;AAAA,EAC5E;AAEA,QAAM,SAAQ,WAAM,UAAN,mBAAa;AAC3B,MAAI,OAAO;AACT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CAsBf"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const RESERVED_REQUEST_KEYS = [
|
|
2
|
+
"format",
|
|
3
|
+
"scope",
|
|
4
|
+
"page",
|
|
5
|
+
"limit",
|
|
6
|
+
"offset",
|
|
7
|
+
"filename",
|
|
8
|
+
"_download",
|
|
9
|
+
"args",
|
|
10
|
+
"__schema",
|
|
11
|
+
"__lookup",
|
|
12
|
+
"__lookup_filter",
|
|
13
|
+
"__lookup_q"
|
|
14
|
+
];
|
|
15
|
+
const COLUMN_FILTER_PREFIX = "filter.";
|
|
16
|
+
const NATIVE_FILTER_PROVIDERS = ["opensearch", "opentelemetry"];
|
|
17
|
+
function validateProfileParams(params, providerType) {
|
|
18
|
+
var _a;
|
|
19
|
+
const seen = /* @__PURE__ */ new Set();
|
|
20
|
+
for (const param of params ?? []) {
|
|
21
|
+
const name = ((_a = param.name) == null ? void 0 : _a.trim()) ?? "";
|
|
22
|
+
if (!name) return "Every parameter needs a name";
|
|
23
|
+
if (seen.has(name)) return `Parameter name "${name}" is duplicated`;
|
|
24
|
+
seen.add(name);
|
|
25
|
+
if (name.startsWith(COLUMN_FILTER_PREFIX)) {
|
|
26
|
+
return `Parameter "${name}" must not start with "${COLUMN_FILTER_PREFIX}", which is reserved for column filters`;
|
|
27
|
+
}
|
|
28
|
+
const isFilter = param.role === void 0 || param.role === "filter";
|
|
29
|
+
if (isFilter && RESERVED_REQUEST_KEYS.includes(name)) {
|
|
30
|
+
return `Parameter "${name}" collides with a reserved request key and would never receive a value`;
|
|
31
|
+
}
|
|
32
|
+
const error = validateOneParam(param, name, providerType);
|
|
33
|
+
if (error) return error;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
function validateOneParam(param, name, providerType) {
|
|
38
|
+
var _a;
|
|
39
|
+
if (param.type === "list" && param.role !== void 0 && param.role !== "filter") {
|
|
40
|
+
return `Parameter "${name}" is a list, which cannot take the "${param.role}" role`;
|
|
41
|
+
}
|
|
42
|
+
const field = (_a = param.field) == null ? void 0 : _a.trim();
|
|
43
|
+
if (field) {
|
|
44
|
+
if (param.type !== "list") {
|
|
45
|
+
return `Parameter "${name}" sets a field but is not a list; only a list binds to a backend field`;
|
|
46
|
+
}
|
|
47
|
+
if (!NATIVE_FILTER_PROVIDERS.includes(providerType ?? "")) {
|
|
48
|
+
return `Parameter "${name}" binds to field "${field}", but provider "${providerType ?? ""}" applies no native filters, so an excluded value would be dropped`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (param.type === "list") {
|
|
52
|
+
for (const option of param.options ?? []) {
|
|
53
|
+
if (option.includes(",")) {
|
|
54
|
+
return `Parameter "${name}" option "${option}" contains a comma, which separates values on the wire`;
|
|
55
|
+
}
|
|
56
|
+
if (option.startsWith("!")) {
|
|
57
|
+
return `Parameter "${name}" option "${option}" starts with !, which marks an exclusion on the wire`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return validateDefault(param, name);
|
|
62
|
+
}
|
|
63
|
+
function validateDefault(param, name) {
|
|
64
|
+
const options = param.options ?? [];
|
|
65
|
+
if (options.length === 0 || param.default === void 0 || param.default === null) return null;
|
|
66
|
+
const chosen = Array.isArray(param.default) ? param.default : [param.default];
|
|
67
|
+
for (const value of chosen) {
|
|
68
|
+
if (typeof value !== "string") continue;
|
|
69
|
+
if (!options.includes(value)) {
|
|
70
|
+
return `Parameter "${name}" default "${value}" is not one of its options`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
validateProfileParams
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=profileParamModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileParamModel.js","sources":["../../src/profiles/profileParamModel.ts"],"sourcesContent":["/**\n * Author-time checks on a profile's parameters, mirroring what the server\n * rejects (query.validateParams) so a mistake is caught in the editor rather\n * than on the first run — and so the failures that would otherwise be *silent*\n * are caught at all: a parameter named after a reserved request key simply never\n * receives a value.\n */\n\nimport type { ParamDraft } from \"./profileWizardModel\";\n\n/** Query-string keys the server consumes as transport concerns before params are\n * built (see IsReservedParam in cmd/query/profiles/execution.go). */\nconst RESERVED_REQUEST_KEYS = [\n \"format\",\n \"scope\",\n \"page\",\n \"limit\",\n \"offset\",\n \"filename\",\n \"_download\",\n \"args\",\n \"__schema\",\n \"__lookup\",\n \"__lookup_filter\",\n \"__lookup_q\",\n];\n\nconst COLUMN_FILTER_PREFIX = \"filter.\";\n\n/** Providers that turn include/exclude selections into backend query clauses\n * (query.SupportsNativeFilters). */\nconst NATIVE_FILTER_PROVIDERS = [\"opensearch\", \"opentelemetry\"];\n\nexport function validateProfileParams(\n params: ParamDraft[] | undefined,\n providerType: string | undefined,\n): string | null {\n const seen = new Set<string>();\n for (const param of params ?? []) {\n const name = param.name?.trim() ?? \"\";\n if (!name) return \"Every parameter needs a name\";\n if (seen.has(name)) return `Parameter name \"${name}\" is duplicated`;\n seen.add(name);\n\n if (name.startsWith(COLUMN_FILTER_PREFIX)) {\n return `Parameter \"${name}\" must not start with \"${COLUMN_FILTER_PREFIX}\", which is reserved for column filters`;\n }\n // limit and offset are exactly the keys a profile may rename by claiming\n // their role, so only a plain filter parameter collides.\n const isFilter = param.role === undefined || param.role === \"filter\";\n if (isFilter && RESERVED_REQUEST_KEYS.includes(name)) {\n return `Parameter \"${name}\" collides with a reserved request key and would never receive a value`;\n }\n\n const error = validateOneParam(param, name, providerType);\n if (error) return error;\n }\n return null;\n}\n\nfunction validateOneParam(\n param: ParamDraft,\n name: string,\n providerType: string | undefined,\n): string | null {\n if (param.type === \"list\" && param.role !== undefined && param.role !== \"filter\") {\n return `Parameter \"${name}\" is a list, which cannot take the \"${param.role}\" role`;\n }\n\n const field = param.field?.trim();\n if (field) {\n if (param.type !== \"list\") {\n return `Parameter \"${name}\" sets a field but is not a list; only a list binds to a backend field`;\n }\n if (!NATIVE_FILTER_PROVIDERS.includes(providerType ?? \"\")) {\n return `Parameter \"${name}\" binds to field \"${field}\", but provider \"${providerType ?? \"\"}\" applies no native filters, so an excluded value would be dropped`;\n }\n }\n\n // A list's values travel comma-joined with \"!\" marking an exclusion, and the\n // wire form has no escape — an option carrying either could never be selected.\n if (param.type === \"list\") {\n for (const option of param.options ?? []) {\n if (option.includes(\",\")) {\n return `Parameter \"${name}\" option \"${option}\" contains a comma, which separates values on the wire`;\n }\n if (option.startsWith(\"!\")) {\n return `Parameter \"${name}\" option \"${option}\" starts with !, which marks an exclusion on the wire`;\n }\n }\n }\n\n return validateDefault(param, name);\n}\n\nfunction validateDefault(param: ParamDraft, name: string): string | null {\n const options = param.options ?? [];\n if (options.length === 0 || param.default === undefined || param.default === null) return null;\n\n const chosen = Array.isArray(param.default) ? param.default : [param.default];\n for (const value of chosen) {\n if (typeof value !== \"string\") continue;\n if (!options.includes(value)) {\n return `Parameter \"${name}\" default \"${value}\" is not one of its options`;\n }\n }\n return null;\n}\n"],"names":[],"mappings":"AAYA,MAAM,wBAAwB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,uBAAuB;AAI7B,MAAM,0BAA0B,CAAC,cAAc,eAAe;AAEvD,SAAS,sBACd,QACA,cACe;AAxBjB;AAyBE,QAAM,2BAAW,IAAA;AACjB,aAAW,SAAS,UAAU,IAAI;AAChC,UAAM,SAAO,WAAM,SAAN,mBAAY,WAAU;AACnC,QAAI,CAAC,KAAM,QAAO;AAClB,QAAI,KAAK,IAAI,IAAI,EAAG,QAAO,mBAAmB,IAAI;AAClD,SAAK,IAAI,IAAI;AAEb,QAAI,KAAK,WAAW,oBAAoB,GAAG;AACzC,aAAO,cAAc,IAAI,0BAA0B,oBAAoB;AAAA,IACzE;AAGA,UAAM,WAAW,MAAM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,CAAC,QAAQ,SAAS,KAAK,GAAG;AAC5B,aAAO,cAAc,IAAI,cAAc,KAAK;AAAA,IAC9C;AAAA,EACF;AACA,SAAO;AACT;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsonPathSample = require("./jsonPathSample.cjs");
|
|
4
|
+
function profileSamplePayload(draft, request) {
|
|
5
|
+
const profile = jsonPathSample.sampleRequestProfile(draft);
|
|
6
|
+
if (!profile) throw new Error("Cannot sample a profile without a provider");
|
|
7
|
+
return {
|
|
8
|
+
profile,
|
|
9
|
+
params: {},
|
|
10
|
+
...request.pagination ? { pagination: request.pagination } : {},
|
|
11
|
+
...request.debug ? { debug: true } : {}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.profileSamplePayload = profileSamplePayload;
|
|
15
|
+
//# sourceMappingURL=profileSamplePayload.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profileSamplePayload.cjs","sources":["../../src/profiles/profileSamplePayload.ts"],"sourcesContent":["import type { QueryBrowserRequest } from \"../data/query-browser/QueryBrowser.types\";\nimport { sampleRequestProfile } from \"./jsonPathSample\";\nimport type { ProfileWizardDraft } from \"./profileWizardModel\";\n\nexport function profileSamplePayload(\n draft: ProfileWizardDraft,\n request: QueryBrowserRequest,\n) {\n const profile = sampleRequestProfile(draft);\n if (!profile) throw new Error(\"Cannot sample a profile without a provider\");\n return {\n profile,\n params: {},\n ...(request.pagination ? { pagination: request.pagination } : {}),\n ...(request.debug ? { debug: true } : {}),\n };\n}\n"],"names":["sampleRequestProfile"],"mappings":";;;AAIO,SAAS,qBACd,OACA,SACA;AACA,QAAM,UAAUA,eAAAA,qBAAqB,KAAK;AAC1C,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,4CAA4C;AAC1E,SAAO;AAAA,IACL;AAAA,IACA,QAAQ,CAAA;AAAA,IACR,GAAI,QAAQ,aAAa,EAAE,YAAY,QAAQ,WAAA,IAAe,CAAA;AAAA,IAC9D,GAAI,QAAQ,QAAQ,EAAE,OAAO,KAAA,IAAS,CAAA;AAAA,EAAC;AAE3C;;"}
|