@flanksource/clicky-ui 0.3.42 → 0.3.43
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/data/version-info.cjs +2 -2
- package/dist/data/version-info.js +2 -2
- package/dist/profiles/fields/profileFieldFilterEditor.cjs +5 -2
- package/dist/profiles/fields/profileFieldFilterEditor.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldFilterEditor.js +5 -2
- package/dist/profiles/fields/profileFieldFilterEditor.js.map +1 -1
- package/dist/profiles/fields/profileFieldIcons.cjs +2 -0
- package/dist/profiles/fields/profileFieldIcons.cjs.map +1 -1
- package/dist/profiles/fields/profileFieldIcons.d.ts.map +1 -1
- package/dist/profiles/fields/profileFieldIcons.js +2 -0
- package/dist/profiles/fields/profileFieldIcons.js.map +1 -1
- package/dist/profiles/wizard/profileWizardModel.cjs +1 -0
- package/dist/profiles/wizard/profileWizardModel.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizardModel.d.ts +3 -0
- package/dist/profiles/wizard/profileWizardModel.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizardModel.js +1 -0
- package/dist/profiles/wizard/profileWizardModel.js.map +1 -1
- package/package.json +1 -1
|
@@ -15,9 +15,9 @@ function detectMode() {
|
|
|
15
15
|
}
|
|
16
16
|
function getVersionInfo() {
|
|
17
17
|
return {
|
|
18
|
-
commit: read(() => "
|
|
18
|
+
commit: read(() => "199317e2", ""),
|
|
19
19
|
tag: read(() => "clicky-ui@0.3.41", ""),
|
|
20
|
-
date: read(() => "2026-10-
|
|
20
|
+
date: read(() => "2026-10-01T12:38:49.651Z", ""),
|
|
21
21
|
dirty: read(() => true, false),
|
|
22
22
|
mode: detectMode()
|
|
23
23
|
};
|
|
@@ -13,9 +13,9 @@ function detectMode() {
|
|
|
13
13
|
}
|
|
14
14
|
function getVersionInfo() {
|
|
15
15
|
return {
|
|
16
|
-
commit: read(() => "
|
|
16
|
+
commit: read(() => "199317e2", ""),
|
|
17
17
|
tag: read(() => "clicky-ui@0.3.41", ""),
|
|
18
|
-
date: read(() => "2026-10-
|
|
18
|
+
date: read(() => "2026-10-01T12:38:08.390Z", ""),
|
|
19
19
|
dirty: read(() => true, false),
|
|
20
20
|
mode: detectMode()
|
|
21
21
|
};
|
|
@@ -30,7 +30,7 @@ function ProfileFieldFilterEditor({
|
|
|
30
30
|
const state = filter.disabled || filter.kind === "none" ? "off" : filter.kind || "auto";
|
|
31
31
|
const effectiveKind = state === "auto" ? profileWizardModel.inferredFilterKind(field) : state;
|
|
32
32
|
const enabled = state !== "off" && effectiveKind !== "none";
|
|
33
|
-
const picksFromAList = effectiveKind
|
|
33
|
+
const picksFromAList = selectsValues(effectiveKind);
|
|
34
34
|
const supportsMultiple = picksFromAList || effectiveKind === "exact";
|
|
35
35
|
const enumerated = (((_a = filter.options) == null ? void 0 : _a.length) ?? 0) > 0;
|
|
36
36
|
const looksUp = picksFromAList && !enumerated && (filter.lookup ?? true);
|
|
@@ -187,8 +187,11 @@ function ProfileFieldFilterEditor({
|
|
|
187
187
|
] }) : null
|
|
188
188
|
] });
|
|
189
189
|
}
|
|
190
|
+
function selectsValues(kind) {
|
|
191
|
+
return kind === "terms" || kind === "match";
|
|
192
|
+
}
|
|
190
193
|
function filterForKind(filter, kind) {
|
|
191
|
-
if (kind
|
|
194
|
+
if (selectsValues(kind)) return filter;
|
|
192
195
|
if (kind === "exact") {
|
|
193
196
|
return profileWizardModel.patchColumnFilter(filter, {
|
|
194
197
|
options: void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileFieldFilterEditor.cjs","sources":["../../../src/profiles/fields/profileFieldFilterEditor.tsx"],"sourcesContent":["import {\n UiDatabase,\n UiListChecks,\n UiListDashes,\n UiListOrdered,\n UiMagicWand,\n UiProhibit,\n} from \"../../icons\";\nimport { EditorField, inputClassName } from \"./profileFieldControls\";\nimport { profileFilterKindIcon } from \"./profileFieldIcons\";\nimport {\n inferredFilterKind,\n patchColumnFilter,\n PROFILE_FILTER_DEFAULT_LIMIT,\n PROFILE_FILTER_KIND_OPTIONS,\n PROFILE_FILTER_MAX_LIMIT,\n type Patch,\n type ProfileColumn,\n type ProfileColumnFilter,\n} from \"../wizard/profileWizardModel\";\n\ntype FilterState = \"auto\" | \"off\" | string;\n\nconst FILTER_SEGMENTS = [\n { value: \"auto\", label: \"Auto\", icon: <UiMagicWand /> },\n { value: \"off\", label: \"Off\", icon: <UiProhibit /> },\n ...PROFILE_FILTER_KIND_OPTIONS.filter(\n (option) => option.value !== \"none\",\n ).map((option) => ({\n ...option,\n icon: profileFilterKindIcon(option.value),\n })),\n] as const;\n\nexport function ProfileFieldFilterEditor({\n field,\n columns,\n onChange,\n}: {\n field: ProfileColumn;\n columns: 1 | 2;\n onChange: (patch: Patch<ProfileColumn>) => void;\n}) {\n const filter = field.filter ?? {};\n const state: FilterState =\n filter.disabled || filter.kind === \"none\" ? \"off\" : filter.kind || \"auto\";\n const effectiveKind = state === \"auto\" ? inferredFilterKind(field) : state;\n const enabled = state !== \"off\" && effectiveKind !== \"none\";\n const picksFromAList = effectiveKind === \"terms\";\n const supportsMultiple = picksFromAList || effectiveKind === \"exact\";\n const enumerated = (filter.options?.length ?? 0) > 0;\n const looksUp = picksFromAList && !enumerated && (filter.lookup ?? true);\n const wide = columns === 2 ? \"sm:col-span-2\" : \"\";\n\n const set = (patch: Patch<ProfileColumnFilter>) =>\n onChange({ filter: patchColumnFilter(field.filter, patch) });\n const selectState = (next: FilterState) => {\n if (next === \"off\") {\n set({\n disabled: true,\n kind: filter.kind === \"none\" ? undefined : filter.kind,\n });\n return;\n }\n const kind = next === \"auto\" ? inferredFilterKind(field) : next;\n const selected = patchColumnFilter(filter, {\n disabled: undefined,\n kind: next === \"auto\" ? undefined : next,\n });\n onChange({ filter: filterForKind(selected, kind) });\n };\n\n return (\n <section className={`grid gap-4 ${wide}`} aria-label=\"Filtering\">\n <div className=\"grid gap-1.5\">\n <span className=\"text-sm font-medium\">Filter type</span>\n <div\n role=\"radiogroup\"\n aria-label=\"Filter type\"\n className=\"flex flex-wrap gap-1 rounded-md border bg-muted/30 p-1\"\n >\n {FILTER_SEGMENTS.map((segment) => {\n const selected = state === segment.value;\n return (\n <label\n key={segment.value}\n title={segment.label}\n className={`flex h-9 cursor-pointer items-center gap-1.5 rounded px-2 text-xs transition-colors focus-within:ring-2 focus-within:ring-primary/30 ${\n selected\n ? \"bg-background font-medium text-foreground shadow-sm\"\n : \"text-muted-foreground hover:bg-background/70 hover:text-foreground\"\n }`}\n >\n <input\n type=\"radio\"\n name={`filter-type-${field.name}`}\n value={segment.value}\n checked={selected}\n aria-label={segment.label}\n className=\"sr-only\"\n onChange={() => selectState(segment.value)}\n />\n <span className=\"text-[15px]\">{segment.icon}</span>\n <span>{segment.label}</span>\n </label>\n );\n })}\n </div>\n <span className=\"text-xs text-muted-foreground\">\n Auto derives the control from the data type; choose a type to override it.\n </span>\n </div>\n\n {enabled ? (\n <div className={`grid gap-4 ${columns === 2 ? \"sm:grid-cols-2\" : \"\"}`}>\n <EditorField\n label=\"Backend field\"\n icon={<UiDatabase />}\n help=\"The indexed field for a document store, or the result column for SQL; blank infers it from the column.\"\n >\n <input\n aria-label=\"Backend field\"\n value={filter.field ?? \"\"}\n className={inputClassName}\n placeholder={field.source || field.name}\n onChange={(event) =>\n set({ field: event.target.value || undefined })\n }\n />\n </EditorField>\n {picksFromAList ? (\n <>\n <div className={wide}>\n <EditorField\n label=\"Values\"\n icon={<UiListDashes />}\n help=\"Comma-separated values to offer instead of asking the backend; leave blank to enumerate from the data.\"\n >\n <input\n aria-label=\"Values\"\n value={(filter.options ?? []).join(\", \")}\n className={inputClassName}\n placeholder=\"Ask the backend\"\n onChange={(event) =>\n set({ options: parseFilterOptions(event.target.value) })\n }\n />\n </EditorField>\n </div>\n <label className=\"flex items-center gap-2 text-sm font-medium\">\n <input\n type=\"checkbox\"\n checked={looksUp}\n disabled={enumerated}\n onChange={(event) => set({ lookup: event.target.checked })}\n />\n <span\n className={enumerated ? \"text-muted-foreground\" : undefined}\n >\n {enumerated\n ? \"Values are listed above\"\n : \"Look values up from the data\"}\n </span>\n </label>\n <EditorField\n label=\"Values offered\"\n icon={<UiListOrdered />}\n help={`How many distinct values the control lists before the rest have to be typed. Blank uses ${PROFILE_FILTER_DEFAULT_LIMIT}.`}\n >\n <input\n aria-label=\"Values offered\"\n type=\"number\"\n min={1}\n max={PROFILE_FILTER_MAX_LIMIT}\n value={filter.limit ?? \"\"}\n disabled={!looksUp}\n className={inputClassName}\n placeholder={String(PROFILE_FILTER_DEFAULT_LIMIT)}\n onChange={(event) =>\n set({\n limit: event.target.value\n ? Number(event.target.value)\n : undefined,\n })\n }\n />\n </EditorField>\n </>\n ) : null}\n {supportsMultiple ? (\n <label className=\"flex items-center gap-2 text-sm font-medium\">\n <input\n type=\"checkbox\"\n checked={filter.multi ?? true}\n onChange={(event) => set({ multi: event.target.checked })}\n />\n <UiListChecks className=\"text-[15px] text-muted-foreground\" />\n Allow several values at once\n </label>\n ) : null}\n </div>\n ) : null}\n </section>\n );\n}\n\nfunction filterForKind(\n filter: ProfileColumnFilter | undefined,\n kind: string,\n): ProfileColumnFilter | undefined {\n if (kind === \"terms\") return filter;\n if (kind === \"exact\") {\n return patchColumnFilter(filter, {\n options: undefined,\n lookup: undefined,\n limit: undefined,\n });\n }\n return patchColumnFilter(filter, {\n options: undefined,\n lookup: undefined,\n limit: undefined,\n multi: undefined,\n });\n}\n\nfunction parseFilterOptions(raw: string): string[] | undefined {\n const values = raw\n .split(\",\")\n .map((value) => value.trim())\n .filter(Boolean);\n return values.length ? values : undefined;\n}\n"],"names":["jsx","UiMagicWand","UiProhibit","PROFILE_FILTER_KIND_OPTIONS","profileFilterKindIcon","inferredFilterKind","patchColumnFilter","jsxs","EditorField","UiDatabase","inputClassName","Fragment","UiListDashes","UiListOrdered","PROFILE_FILTER_DEFAULT_LIMIT","PROFILE_FILTER_MAX_LIMIT","UiListChecks"],"mappings":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,cACP,QACA,MACiC;AACjC,MAAI,SAAS,QAAS,QAAO;AAC7B,MAAI,SAAS,SAAS;AACpB,WAAOV,mBAAAA,kBAAkB,QAAQ;AAAA,MAC/B,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,OAAO;AAAA,IAAA,CACR;AAAA,EACH;AACA,SAAOA,mBAAAA,kBAAkB,QAAQ;AAAA,IAC/B,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,OAAO;AAAA,EAAA,CACR;AACH;AAEA,SAAS,mBAAmB,KAAmC;AAC7D,QAAM,SAAS,IACZ,MAAM,GAAG,EACT,IAAI,CAAC,UAAU,MAAM,KAAA,CAAM,EAC3B,OAAO,OAAO;AACjB,SAAO,OAAO,SAAS,SAAS;AAClC;;"}
|
|
1
|
+
{"version":3,"file":"profileFieldFilterEditor.cjs","sources":["../../../src/profiles/fields/profileFieldFilterEditor.tsx"],"sourcesContent":["import {\n UiDatabase,\n UiListChecks,\n UiListDashes,\n UiListOrdered,\n UiMagicWand,\n UiProhibit,\n} from \"../../icons\";\nimport { EditorField, inputClassName } from \"./profileFieldControls\";\nimport { profileFilterKindIcon } from \"./profileFieldIcons\";\nimport {\n inferredFilterKind,\n patchColumnFilter,\n PROFILE_FILTER_DEFAULT_LIMIT,\n PROFILE_FILTER_KIND_OPTIONS,\n PROFILE_FILTER_MAX_LIMIT,\n type Patch,\n type ProfileColumn,\n type ProfileColumnFilter,\n} from \"../wizard/profileWizardModel\";\n\ntype FilterState = \"auto\" | \"off\" | string;\n\nconst FILTER_SEGMENTS = [\n { value: \"auto\", label: \"Auto\", icon: <UiMagicWand /> },\n { value: \"off\", label: \"Off\", icon: <UiProhibit /> },\n ...PROFILE_FILTER_KIND_OPTIONS.filter(\n (option) => option.value !== \"none\",\n ).map((option) => ({\n ...option,\n icon: profileFilterKindIcon(option.value),\n })),\n] as const;\n\nexport function ProfileFieldFilterEditor({\n field,\n columns,\n onChange,\n}: {\n field: ProfileColumn;\n columns: 1 | 2;\n onChange: (patch: Patch<ProfileColumn>) => void;\n}) {\n const filter = field.filter ?? {};\n const state: FilterState =\n filter.disabled || filter.kind === \"none\" ? \"off\" : filter.kind || \"auto\";\n const effectiveKind = state === \"auto\" ? inferredFilterKind(field) : state;\n const enabled = state !== \"off\" && effectiveKind !== \"none\";\n const picksFromAList = selectsValues(effectiveKind);\n const supportsMultiple = picksFromAList || effectiveKind === \"exact\";\n const enumerated = (filter.options?.length ?? 0) > 0;\n const looksUp = picksFromAList && !enumerated && (filter.lookup ?? true);\n const wide = columns === 2 ? \"sm:col-span-2\" : \"\";\n\n const set = (patch: Patch<ProfileColumnFilter>) =>\n onChange({ filter: patchColumnFilter(field.filter, patch) });\n const selectState = (next: FilterState) => {\n if (next === \"off\") {\n set({\n disabled: true,\n kind: filter.kind === \"none\" ? undefined : filter.kind,\n });\n return;\n }\n const kind = next === \"auto\" ? inferredFilterKind(field) : next;\n const selected = patchColumnFilter(filter, {\n disabled: undefined,\n kind: next === \"auto\" ? undefined : next,\n });\n onChange({ filter: filterForKind(selected, kind) });\n };\n\n return (\n <section className={`grid gap-4 ${wide}`} aria-label=\"Filtering\">\n <div className=\"grid gap-1.5\">\n <span className=\"text-sm font-medium\">Filter type</span>\n <div\n role=\"radiogroup\"\n aria-label=\"Filter type\"\n className=\"flex flex-wrap gap-1 rounded-md border bg-muted/30 p-1\"\n >\n {FILTER_SEGMENTS.map((segment) => {\n const selected = state === segment.value;\n return (\n <label\n key={segment.value}\n title={segment.label}\n className={`flex h-9 cursor-pointer items-center gap-1.5 rounded px-2 text-xs transition-colors focus-within:ring-2 focus-within:ring-primary/30 ${\n selected\n ? \"bg-background font-medium text-foreground shadow-sm\"\n : \"text-muted-foreground hover:bg-background/70 hover:text-foreground\"\n }`}\n >\n <input\n type=\"radio\"\n name={`filter-type-${field.name}`}\n value={segment.value}\n checked={selected}\n aria-label={segment.label}\n className=\"sr-only\"\n onChange={() => selectState(segment.value)}\n />\n <span className=\"text-[15px]\">{segment.icon}</span>\n <span>{segment.label}</span>\n </label>\n );\n })}\n </div>\n <span className=\"text-xs text-muted-foreground\">\n Auto derives the control from the data type; choose a type to override it.\n </span>\n </div>\n\n {enabled ? (\n <div className={`grid gap-4 ${columns === 2 ? \"sm:grid-cols-2\" : \"\"}`}>\n <EditorField\n label=\"Backend field\"\n icon={<UiDatabase />}\n help=\"The indexed field for a document store, or the result column for SQL; blank infers it from the column.\"\n >\n <input\n aria-label=\"Backend field\"\n value={filter.field ?? \"\"}\n className={inputClassName}\n placeholder={field.source || field.name}\n onChange={(event) =>\n set({ field: event.target.value || undefined })\n }\n />\n </EditorField>\n {picksFromAList ? (\n <>\n <div className={wide}>\n <EditorField\n label=\"Values\"\n icon={<UiListDashes />}\n help=\"Comma-separated values to offer instead of asking the backend; leave blank to enumerate from the data.\"\n >\n <input\n aria-label=\"Values\"\n value={(filter.options ?? []).join(\", \")}\n className={inputClassName}\n placeholder=\"Ask the backend\"\n onChange={(event) =>\n set({ options: parseFilterOptions(event.target.value) })\n }\n />\n </EditorField>\n </div>\n <label className=\"flex items-center gap-2 text-sm font-medium\">\n <input\n type=\"checkbox\"\n checked={looksUp}\n disabled={enumerated}\n onChange={(event) => set({ lookup: event.target.checked })}\n />\n <span\n className={enumerated ? \"text-muted-foreground\" : undefined}\n >\n {enumerated\n ? \"Values are listed above\"\n : \"Look values up from the data\"}\n </span>\n </label>\n <EditorField\n label=\"Values offered\"\n icon={<UiListOrdered />}\n help={`How many distinct values the control lists before the rest have to be typed. Blank uses ${PROFILE_FILTER_DEFAULT_LIMIT}.`}\n >\n <input\n aria-label=\"Values offered\"\n type=\"number\"\n min={1}\n max={PROFILE_FILTER_MAX_LIMIT}\n value={filter.limit ?? \"\"}\n disabled={!looksUp}\n className={inputClassName}\n placeholder={String(PROFILE_FILTER_DEFAULT_LIMIT)}\n onChange={(event) =>\n set({\n limit: event.target.value\n ? Number(event.target.value)\n : undefined,\n })\n }\n />\n </EditorField>\n </>\n ) : null}\n {supportsMultiple ? (\n <label className=\"flex items-center gap-2 text-sm font-medium\">\n <input\n type=\"checkbox\"\n checked={filter.multi ?? true}\n onChange={(event) => set({ multi: event.target.checked })}\n />\n <UiListChecks className=\"text-[15px] text-muted-foreground\" />\n Allow several values at once\n </label>\n ) : null}\n </div>\n ) : null}\n </section>\n );\n}\n\n/** Whether kind picks values from a list — values, or the patterns a value\n * matches — and so takes options, a lookup and several values at once.\n * Mirrors query.ColumnFilterKind.selectsValues. */\nfunction selectsValues(kind: string): boolean {\n return kind === \"terms\" || kind === \"match\";\n}\n\nfunction filterForKind(\n filter: ProfileColumnFilter | undefined,\n kind: string,\n): ProfileColumnFilter | undefined {\n if (selectsValues(kind)) return filter;\n if (kind === \"exact\") {\n return patchColumnFilter(filter, {\n options: undefined,\n lookup: undefined,\n limit: undefined,\n });\n }\n return patchColumnFilter(filter, {\n options: undefined,\n lookup: undefined,\n limit: undefined,\n multi: undefined,\n });\n}\n\nfunction parseFilterOptions(raw: string): string[] | undefined {\n const values = raw\n .split(\",\")\n .map((value) => value.trim())\n .filter(Boolean);\n return values.length ? values : undefined;\n}\n"],"names":["jsx","UiMagicWand","UiProhibit","PROFILE_FILTER_KIND_OPTIONS","profileFilterKindIcon","inferredFilterKind","patchColumnFilter","jsxs","EditorField","UiDatabase","inputClassName","Fragment","UiListDashes","UiListOrdered","PROFILE_FILTER_DEFAULT_LIMIT","PROFILE_FILTER_MAX_LIMIT","UiListChecks"],"mappings":";;;;;;;;;;;;AAuBA,MAAM,kBAAkB;AAAA,EACtB,EAAE,OAAO,QAAQ,OAAO,QAAQ,MAAMA,2BAAAA,IAACC,2BAAY,EAAA;AAAA,EACnD,EAAE,OAAO,OAAO,OAAO,OAAO,MAAMD,2BAAAA,IAACE,yBAAW,EAAA;AAAA,EAChD,GAAGC,mBAAAA,4BAA4B;AAAA,IAC7B,CAAC,WAAW,OAAO,UAAU;AAAA,EAAA,EAC7B,IAAI,CAAC,YAAY;AAAA,IACjB,GAAG;AAAA,IACH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AQ;AAAA,IACR,OAAO;AAAA,IACP,OAAO;AAAA,EAAA,CACR;AACH;AAEA,SAAS,mBAAmB,KAAmC;AAC7D,QAAM,SAAS,IACZ,MAAM,GAAG,EACT,IAAI,CAAC,UAAU,MAAM,KAAA,CAAM,EAC3B,OAAO,OAAO;AACjB,SAAO,OAAO,SAAS,SAAS;AAClC;;"}
|
|
@@ -28,7 +28,7 @@ function ProfileFieldFilterEditor({
|
|
|
28
28
|
const state = filter.disabled || filter.kind === "none" ? "off" : filter.kind || "auto";
|
|
29
29
|
const effectiveKind = state === "auto" ? inferredFilterKind(field) : state;
|
|
30
30
|
const enabled = state !== "off" && effectiveKind !== "none";
|
|
31
|
-
const picksFromAList = effectiveKind
|
|
31
|
+
const picksFromAList = selectsValues(effectiveKind);
|
|
32
32
|
const supportsMultiple = picksFromAList || effectiveKind === "exact";
|
|
33
33
|
const enumerated = (((_a = filter.options) == null ? void 0 : _a.length) ?? 0) > 0;
|
|
34
34
|
const looksUp = picksFromAList && !enumerated && (filter.lookup ?? true);
|
|
@@ -185,8 +185,11 @@ function ProfileFieldFilterEditor({
|
|
|
185
185
|
] }) : null
|
|
186
186
|
] });
|
|
187
187
|
}
|
|
188
|
+
function selectsValues(kind) {
|
|
189
|
+
return kind === "terms" || kind === "match";
|
|
190
|
+
}
|
|
188
191
|
function filterForKind(filter, kind) {
|
|
189
|
-
if (kind
|
|
192
|
+
if (selectsValues(kind)) return filter;
|
|
190
193
|
if (kind === "exact") {
|
|
191
194
|
return patchColumnFilter(filter, {
|
|
192
195
|
options: void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileFieldFilterEditor.js","sources":["../../../src/profiles/fields/profileFieldFilterEditor.tsx"],"sourcesContent":["import {\n UiDatabase,\n UiListChecks,\n UiListDashes,\n UiListOrdered,\n UiMagicWand,\n UiProhibit,\n} from \"../../icons\";\nimport { EditorField, inputClassName } from \"./profileFieldControls\";\nimport { profileFilterKindIcon } from \"./profileFieldIcons\";\nimport {\n inferredFilterKind,\n patchColumnFilter,\n PROFILE_FILTER_DEFAULT_LIMIT,\n PROFILE_FILTER_KIND_OPTIONS,\n PROFILE_FILTER_MAX_LIMIT,\n type Patch,\n type ProfileColumn,\n type ProfileColumnFilter,\n} from \"../wizard/profileWizardModel\";\n\ntype FilterState = \"auto\" | \"off\" | string;\n\nconst FILTER_SEGMENTS = [\n { value: \"auto\", label: \"Auto\", icon: <UiMagicWand /> },\n { value: \"off\", label: \"Off\", icon: <UiProhibit /> },\n ...PROFILE_FILTER_KIND_OPTIONS.filter(\n (option) => option.value !== \"none\",\n ).map((option) => ({\n ...option,\n icon: profileFilterKindIcon(option.value),\n })),\n] as const;\n\nexport function ProfileFieldFilterEditor({\n field,\n columns,\n onChange,\n}: {\n field: ProfileColumn;\n columns: 1 | 2;\n onChange: (patch: Patch<ProfileColumn>) => void;\n}) {\n const filter = field.filter ?? {};\n const state: FilterState =\n filter.disabled || filter.kind === \"none\" ? \"off\" : filter.kind || \"auto\";\n const effectiveKind = state === \"auto\" ? inferredFilterKind(field) : state;\n const enabled = state !== \"off\" && effectiveKind !== \"none\";\n const picksFromAList = effectiveKind === \"terms\";\n const supportsMultiple = picksFromAList || effectiveKind === \"exact\";\n const enumerated = (filter.options?.length ?? 0) > 0;\n const looksUp = picksFromAList && !enumerated && (filter.lookup ?? true);\n const wide = columns === 2 ? \"sm:col-span-2\" : \"\";\n\n const set = (patch: Patch<ProfileColumnFilter>) =>\n onChange({ filter: patchColumnFilter(field.filter, patch) });\n const selectState = (next: FilterState) => {\n if (next === \"off\") {\n set({\n disabled: true,\n kind: filter.kind === \"none\" ? undefined : filter.kind,\n });\n return;\n }\n const kind = next === \"auto\" ? inferredFilterKind(field) : next;\n const selected = patchColumnFilter(filter, {\n disabled: undefined,\n kind: next === \"auto\" ? undefined : next,\n });\n onChange({ filter: filterForKind(selected, kind) });\n };\n\n return (\n <section className={`grid gap-4 ${wide}`} aria-label=\"Filtering\">\n <div className=\"grid gap-1.5\">\n <span className=\"text-sm font-medium\">Filter type</span>\n <div\n role=\"radiogroup\"\n aria-label=\"Filter type\"\n className=\"flex flex-wrap gap-1 rounded-md border bg-muted/30 p-1\"\n >\n {FILTER_SEGMENTS.map((segment) => {\n const selected = state === segment.value;\n return (\n <label\n key={segment.value}\n title={segment.label}\n className={`flex h-9 cursor-pointer items-center gap-1.5 rounded px-2 text-xs transition-colors focus-within:ring-2 focus-within:ring-primary/30 ${\n selected\n ? \"bg-background font-medium text-foreground shadow-sm\"\n : \"text-muted-foreground hover:bg-background/70 hover:text-foreground\"\n }`}\n >\n <input\n type=\"radio\"\n name={`filter-type-${field.name}`}\n value={segment.value}\n checked={selected}\n aria-label={segment.label}\n className=\"sr-only\"\n onChange={() => selectState(segment.value)}\n />\n <span className=\"text-[15px]\">{segment.icon}</span>\n <span>{segment.label}</span>\n </label>\n );\n })}\n </div>\n <span className=\"text-xs text-muted-foreground\">\n Auto derives the control from the data type; choose a type to override it.\n </span>\n </div>\n\n {enabled ? (\n <div className={`grid gap-4 ${columns === 2 ? \"sm:grid-cols-2\" : \"\"}`}>\n <EditorField\n label=\"Backend field\"\n icon={<UiDatabase />}\n help=\"The indexed field for a document store, or the result column for SQL; blank infers it from the column.\"\n >\n <input\n aria-label=\"Backend field\"\n value={filter.field ?? \"\"}\n className={inputClassName}\n placeholder={field.source || field.name}\n onChange={(event) =>\n set({ field: event.target.value || undefined })\n }\n />\n </EditorField>\n {picksFromAList ? (\n <>\n <div className={wide}>\n <EditorField\n label=\"Values\"\n icon={<UiListDashes />}\n help=\"Comma-separated values to offer instead of asking the backend; leave blank to enumerate from the data.\"\n >\n <input\n aria-label=\"Values\"\n value={(filter.options ?? []).join(\", \")}\n className={inputClassName}\n placeholder=\"Ask the backend\"\n onChange={(event) =>\n set({ options: parseFilterOptions(event.target.value) })\n }\n />\n </EditorField>\n </div>\n <label className=\"flex items-center gap-2 text-sm font-medium\">\n <input\n type=\"checkbox\"\n checked={looksUp}\n disabled={enumerated}\n onChange={(event) => set({ lookup: event.target.checked })}\n />\n <span\n className={enumerated ? \"text-muted-foreground\" : undefined}\n >\n {enumerated\n ? \"Values are listed above\"\n : \"Look values up from the data\"}\n </span>\n </label>\n <EditorField\n label=\"Values offered\"\n icon={<UiListOrdered />}\n help={`How many distinct values the control lists before the rest have to be typed. Blank uses ${PROFILE_FILTER_DEFAULT_LIMIT}.`}\n >\n <input\n aria-label=\"Values offered\"\n type=\"number\"\n min={1}\n max={PROFILE_FILTER_MAX_LIMIT}\n value={filter.limit ?? \"\"}\n disabled={!looksUp}\n className={inputClassName}\n placeholder={String(PROFILE_FILTER_DEFAULT_LIMIT)}\n onChange={(event) =>\n set({\n limit: event.target.value\n ? Number(event.target.value)\n : undefined,\n })\n }\n />\n </EditorField>\n </>\n ) : null}\n {supportsMultiple ? (\n <label className=\"flex items-center gap-2 text-sm font-medium\">\n <input\n type=\"checkbox\"\n checked={filter.multi ?? true}\n onChange={(event) => set({ multi: event.target.checked })}\n />\n <UiListChecks className=\"text-[15px] text-muted-foreground\" />\n Allow several values at once\n </label>\n ) : null}\n </div>\n ) : null}\n </section>\n );\n}\n\nfunction filterForKind(\n filter: ProfileColumnFilter | undefined,\n kind: string,\n): ProfileColumnFilter | undefined {\n if (kind === \"terms\") return filter;\n if (kind === \"exact\") {\n return patchColumnFilter(filter, {\n options: undefined,\n lookup: undefined,\n limit: undefined,\n });\n }\n return patchColumnFilter(filter, {\n options: undefined,\n lookup: undefined,\n limit: undefined,\n multi: undefined,\n });\n}\n\nfunction parseFilterOptions(raw: string): string[] | undefined {\n const values = raw\n .split(\",\")\n .map((value) => value.trim())\n .filter(Boolean);\n return values.length ? values : undefined;\n}\n"],"names":[],"mappings":";;;;;;;;;;AAuBA,MAAM,kBAAkB;AAAA,EACtB,EAAE,OAAO,QAAQ,OAAO,QAAQ,MAAM,oBAAC,eAAY,EAAA;AAAA,EACnD,EAAE,OAAO,OAAO,OAAO,OAAO,MAAM,oBAAC,cAAW,EAAA;AAA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U,CAAC;AAAA,gBACX,WAAW;AAAA,gBACX,aAAa,OAAO,4BAA4B;AAAA,gBAChD,UAAU,CAAC,UACT,IAAI;AAAA,kBACF,OAAO,MAAM,OAAO,QAChB,OAAO,MAAM,OAAO,KAAK,IACzB;AAAA,gBAAA,CACL;AAAA,cAAA;AAAA,YAAA;AAAA,UAEL;AAAA,QAAA;AAAA,MACF,EAAA,CACF,IACE;AAAA,MACH,mBACC,qBAAC,SAAA,EAAM,WAAU,+CACf,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAS,OAAO,SAAS;AAAA,YACzB,UAAU,CAAC,UAAU,IAAI,EAAE,OAAO,MAAM,OAAO,QAAA,CAAS;AAAA,UAAA;AAAA,QAAA;AAAA,QAE1D,oBAAC,cAAA,EAAa,WAAU,oCAAA,CAAoC;AAAA,QAAE;AAAA,MAAA,EAAA,CAEhE,IACE;AAAA,IAAA,EAAA,CACN,IACE;AAAA,EAAA,GACN;AAEJ;AAEA,SAAS,cACP,QACA,MACiC;AACjC,MAAI,SAAS,QAAS,QAAO;AAC7B,MAAI,SAAS,SAAS;AACpB,WAAO,kBAAkB,QAAQ;AAAA,MAC/B,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,OAAO;AAAA,IAAA,CACR;AAAA,EACH;AACA,SAAO,kBAAkB,QAAQ;AAAA,IAC/B,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,OAAO;AAAA,EAAA,CACR;AACH;AAEA,SAAS,mBAAmB,KAAmC;AAC7D,QAAM,SAAS,IACZ,MAAM,GAAG,EACT,IAAI,CAAC,UAAU,MAAM,KAAA,CAAM,EAC3B,OAAO,OAAO;AACjB,SAAO,OAAO,SAAS,SAAS;AAClC;"}
|
|
1
|
+
{"version":3,"file":"profileFieldFilterEditor.js","sources":["../../../src/profiles/fields/profileFieldFilterEditor.tsx"],"sourcesContent":["import {\n UiDatabase,\n UiListChecks,\n UiListDashes,\n UiListOrdered,\n UiMagicWand,\n UiProhibit,\n} from \"../../icons\";\nimport { EditorField, inputClassName } from \"./profileFieldControls\";\nimport { profileFilterKindIcon } from \"./profileFieldIcons\";\nimport {\n inferredFilterKind,\n patchColumnFilter,\n PROFILE_FILTER_DEFAULT_LIMIT,\n PROFILE_FILTER_KIND_OPTIONS,\n PROFILE_FILTER_MAX_LIMIT,\n type Patch,\n type ProfileColumn,\n type ProfileColumnFilter,\n} from \"../wizard/profileWizardModel\";\n\ntype FilterState = \"auto\" | \"off\" | string;\n\nconst FILTER_SEGMENTS = [\n { value: \"auto\", label: \"Auto\", icon: <UiMagicWand /> },\n { value: \"off\", label: \"Off\", icon: <UiProhibit /> },\n ...PROFILE_FILTER_KIND_OPTIONS.filter(\n (option) => option.value !== \"none\",\n ).map((option) => ({\n ...option,\n icon: profileFilterKindIcon(option.value),\n })),\n] as const;\n\nexport function ProfileFieldFilterEditor({\n field,\n columns,\n onChange,\n}: {\n field: ProfileColumn;\n columns: 1 | 2;\n onChange: (patch: Patch<ProfileColumn>) => void;\n}) {\n const filter = field.filter ?? {};\n const state: FilterState =\n filter.disabled || filter.kind === \"none\" ? \"off\" : filter.kind || \"auto\";\n const effectiveKind = state === \"auto\" ? inferredFilterKind(field) : state;\n const enabled = state !== \"off\" && effectiveKind !== \"none\";\n const picksFromAList = selectsValues(effectiveKind);\n const supportsMultiple = picksFromAList || effectiveKind === \"exact\";\n const enumerated = (filter.options?.length ?? 0) > 0;\n const looksUp = picksFromAList && !enumerated && (filter.lookup ?? true);\n const wide = columns === 2 ? \"sm:col-span-2\" : \"\";\n\n const set = (patch: Patch<ProfileColumnFilter>) =>\n onChange({ filter: patchColumnFilter(field.filter, patch) });\n const selectState = (next: FilterState) => {\n if (next === \"off\") {\n set({\n disabled: true,\n kind: filter.kind === \"none\" ? undefined : filter.kind,\n });\n return;\n }\n const kind = next === \"auto\" ? inferredFilterKind(field) : next;\n const selected = patchColumnFilter(filter, {\n disabled: undefined,\n kind: next === \"auto\" ? undefined : next,\n });\n onChange({ filter: filterForKind(selected, kind) });\n };\n\n return (\n <section className={`grid gap-4 ${wide}`} aria-label=\"Filtering\">\n <div className=\"grid gap-1.5\">\n <span className=\"text-sm font-medium\">Filter type</span>\n <div\n role=\"radiogroup\"\n aria-label=\"Filter type\"\n className=\"flex flex-wrap gap-1 rounded-md border bg-muted/30 p-1\"\n >\n {FILTER_SEGMENTS.map((segment) => {\n const selected = state === segment.value;\n return (\n <label\n key={segment.value}\n title={segment.label}\n className={`flex h-9 cursor-pointer items-center gap-1.5 rounded px-2 text-xs transition-colors focus-within:ring-2 focus-within:ring-primary/30 ${\n selected\n ? \"bg-background font-medium text-foreground shadow-sm\"\n : \"text-muted-foreground hover:bg-background/70 hover:text-foreground\"\n }`}\n >\n <input\n type=\"radio\"\n name={`filter-type-${field.name}`}\n value={segment.value}\n checked={selected}\n aria-label={segment.label}\n className=\"sr-only\"\n onChange={() => selectState(segment.value)}\n />\n <span className=\"text-[15px]\">{segment.icon}</span>\n <span>{segment.label}</span>\n </label>\n );\n })}\n </div>\n <span className=\"text-xs text-muted-foreground\">\n Auto derives the control from the data type; choose a type to override it.\n </span>\n </div>\n\n {enabled ? (\n <div className={`grid gap-4 ${columns === 2 ? \"sm:grid-cols-2\" : \"\"}`}>\n <EditorField\n label=\"Backend field\"\n icon={<UiDatabase />}\n help=\"The indexed field for a document store, or the result column for SQL; blank infers it from the column.\"\n >\n <input\n aria-label=\"Backend field\"\n value={filter.field ?? \"\"}\n className={inputClassName}\n placeholder={field.source || field.name}\n onChange={(event) =>\n set({ field: event.target.value || undefined })\n }\n />\n </EditorField>\n {picksFromAList ? (\n <>\n <div className={wide}>\n <EditorField\n label=\"Values\"\n icon={<UiListDashes />}\n help=\"Comma-separated values to offer instead of asking the backend; leave blank to enumerate from the data.\"\n >\n <input\n aria-label=\"Values\"\n value={(filter.options ?? []).join(\", \")}\n className={inputClassName}\n placeholder=\"Ask the backend\"\n onChange={(event) =>\n set({ options: parseFilterOptions(event.target.value) })\n }\n />\n </EditorField>\n </div>\n <label className=\"flex items-center gap-2 text-sm font-medium\">\n <input\n type=\"checkbox\"\n checked={looksUp}\n disabled={enumerated}\n onChange={(event) => set({ lookup: event.target.checked })}\n />\n <span\n className={enumerated ? \"text-muted-foreground\" : undefined}\n >\n {enumerated\n ? \"Values are listed above\"\n : \"Look values up from the data\"}\n </span>\n </label>\n <EditorField\n label=\"Values offered\"\n icon={<UiListOrdered />}\n help={`How many distinct values the control lists before the rest have to be typed. Blank uses ${PROFILE_FILTER_DEFAULT_LIMIT}.`}\n >\n <input\n aria-label=\"Values offered\"\n type=\"number\"\n min={1}\n max={PROFILE_FILTER_MAX_LIMIT}\n value={filter.limit ?? \"\"}\n disabled={!looksUp}\n className={inputClassName}\n placeholder={String(PROFILE_FILTER_DEFAULT_LIMIT)}\n onChange={(event) =>\n set({\n limit: event.target.value\n ? Number(event.target.value)\n : undefined,\n })\n }\n />\n </EditorField>\n </>\n ) : null}\n {supportsMultiple ? (\n <label className=\"flex items-center gap-2 text-sm font-medium\">\n <input\n type=\"checkbox\"\n checked={filter.multi ?? true}\n onChange={(event) => set({ multi: event.target.checked })}\n />\n <UiListChecks className=\"text-[15px] text-muted-foreground\" />\n Allow several values at once\n </label>\n ) : null}\n </div>\n ) : null}\n </section>\n );\n}\n\n/** Whether kind picks values from a list — values, or the patterns a value\n * matches — and so takes options, a lookup and several values at once.\n * Mirrors query.ColumnFilterKind.selectsValues. */\nfunction selectsValues(kind: string): boolean {\n return kind === \"terms\" || kind === \"match\";\n}\n\nfunction filterForKind(\n filter: ProfileColumnFilter | undefined,\n kind: string,\n): ProfileColumnFilter | undefined {\n if (selectsValues(kind)) return filter;\n if (kind === \"exact\") {\n return patchColumnFilter(filter, {\n options: undefined,\n lookup: undefined,\n limit: undefined,\n });\n }\n return patchColumnFilter(filter, {\n options: undefined,\n lookup: undefined,\n limit: undefined,\n multi: undefined,\n });\n}\n\nfunction parseFilterOptions(raw: string): string[] | undefined {\n const values = raw\n .split(\",\")\n .map((value) => value.trim())\n .filter(Boolean);\n return values.length ? values : undefined;\n}\n"],"names":[],"mappings":";;;;;;;;;;AAuBA,MAAM,kBAAkB;AAAA,EACtB,EAAE,OAAO,QAAQ,OAAO,QAAQ,MAAM,oBAAC,eAAY,EAAA;AAAA,EACnD,EAAE,OAAO,OAAO,OAAO,OAAO,MAAM,oBAAC,cAAW,EAAA;AAAA,EAChD,GAAG,4BAA4B;AAAA,IAC7B,CAAC,WAAW,OAAO,UAAU;AAAA,EAAA,EAC7B,IAAI,CAAC,YAAY;AAAA,IACjB,GAAG;AAAA,IACH,MAAM,sBAAsB,OAAO,KAAK;AAAA,EAAA,EACxC;AACJ;AAEO,SAAS,yBAAyB;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACF,GAIG;;AACD,QAAM,SAAS,MAAM,UAAU,CAAA;AAC/B,QAAM,QACJ,OAAO,YAAY,OAAO,SAAS,SAAS,QAAQ,OAAO,QAAQ;AACrE,QAAM,gBAAgB,UAAU,SAAS,mBAAmB,KAAK,IAAI;AACrE,QAAM,UAAU,UAAU,SAAS,kBAAkB;AACrD,QAAM,iBAAiB,cAAc,aAAa;AAClD,QAAM,mBAAmB,kBAAkB,kBAAkB;AAC7D,QAAM,gBAAc,YAAO,YAAP,mBAAgB,WAAU,KAAK;AACnD,QAAM,UAAU,kBAAkB,CAAC,eAAe,OAAO,UAAU;AACnE,QAAM,OAAO,YAAY,IAAI,kBAAkB;AAE/C,QAAM,MAAM,CAAC,UACX,SAAS,EAAE,QAAQ,kBAAkB,MAAM,QAAQ,KAAK,GAAG;AAC7D,QAAM,cAAc,CAAC,SAAsB;AACzC,QAAI,SAAS,OAAO;AAClB,UAAI;AAAA,QACF,UAAU;AAAA,QACV,MAAM,OAAO,SAAS,SAAS,SAAY,OAAO;AAAA,MAAA,CACnD;AACD;AAAA,IACF;AACA,UAAM,OAAO,SAAS,SAAS,mBAAmB,KAAK,IAAI;AAC3D,UAAM,WAA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IACR,OAAO;AAAA,IACP,OAAO;AAAA,EAAA,CACR;AACH;AAEA,SAAS,mBAAmB,KAAmC;AAC7D,QAAM,SAAS,IACZ,MAAM,GAAG,EACT,IAAI,CAAC,UAAU,MAAM,KAAA,CAAM,EAC3B,OAAO,OAAO;AACjB,SAAO,OAAO,SAAS,SAAS;AAClC;"}
|
|
@@ -23,6 +23,7 @@ const UiListChecks = require("../../icons/components/UiListChecks.cjs");
|
|
|
23
23
|
const UiProhibit = require("../../icons/components/UiProhibit.cjs");
|
|
24
24
|
const UiSliders = require("../../icons/components/UiSliders.cjs");
|
|
25
25
|
const UiFingerprint = require("../../icons/components/UiFingerprint.cjs");
|
|
26
|
+
const UiAsterisk = require("../../icons/components/UiAsterisk.cjs");
|
|
26
27
|
const TYPE_ICONS = {
|
|
27
28
|
string: /* @__PURE__ */ jsxRuntime.jsx(UiCursorText.UiCursorText, {}),
|
|
28
29
|
number: /* @__PURE__ */ jsxRuntime.jsx(UiSigma.UiSigma, {}),
|
|
@@ -38,6 +39,7 @@ const TYPE_ICONS = {
|
|
|
38
39
|
};
|
|
39
40
|
const FILTER_KIND_ICONS = {
|
|
40
41
|
terms: /* @__PURE__ */ jsxRuntime.jsx(UiListChecks.UiListChecks, {}),
|
|
42
|
+
match: /* @__PURE__ */ jsxRuntime.jsx(UiAsterisk.UiAsterisk, {}),
|
|
41
43
|
exact: /* @__PURE__ */ jsxRuntime.jsx(UiFingerprint.UiFingerprint, {}),
|
|
42
44
|
range: /* @__PURE__ */ jsxRuntime.jsx(UiSliders.UiSliders, {}),
|
|
43
45
|
duration: /* @__PURE__ */ jsxRuntime.jsx(UiTimer.UiTimer, {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileFieldIcons.cjs","sources":["../../../src/profiles/fields/profileFieldIcons.tsx"],"sourcesContent":["/**\n * The glyphs a profile column's enums render with, and the Combobox options\n * built from them.\n *\n * The params editor gets these from the schema (`x-enum-icons`); the column\n * editor is hand-rolled, so its vocabulary lives here instead — one place both\n * the grid and the inspector read, rather than an icon picked twice.\n */\n\nimport type { ReactNode } from \"react\";\nimport type { ComboboxOption } from \"../../components/combobox-types\";\n// Monochrome UI glyphs only: the symbol icons (UiString, UiJson, UiField, …)\n// carry hardcoded IDE colours, which read as stray dots beside a form label.\nimport {\n UiActivity,\n UiBraces,\n UiCalendar,\n UiChartPie,\n UiClock,\n UiColumns,\n UiCurrencyDollar,\n UiCursorText,\n UiFingerprint,\n UiHardDrive,\n UiListChecks,\n UiListDashes,\n UiProhibit,\n UiPulse,\n UiShieldCheck,\n UiSigma,\n UiSliders,\n UiTag,\n UiTimer,\n UiToggleOn,\n} from \"../../icons\";\nimport { PROFILE_FIELD_TYPES } from \"./profileFieldTypes\";\nimport {\n PROFILE_COLUMN_FORMAT_OPTIONS,\n PROFILE_COLUMN_UNIT_OPTIONS,\n PROFILE_FILTER_KIND_OPTIONS,\n} from \"../wizard/profileWizardModel\";\n\nconst TYPE_ICONS: Record<string, ReactNode> = {\n string: <UiCursorText />,\n number: <UiSigma />,\n boolean: <UiToggleOn />,\n datetime: <UiCalendar />,\n duration: <UiTimer />,\n bytes: <UiHardDrive />,\n status: <UiPulse />,\n health: <UiShieldCheck />,\n key_value: <UiTag />,\n key_values: <UiListDashes />,\n json: <UiBraces />,\n};\n\n// A filter borrows the glyph of the type that infers it — duration from\n// UiTimer, date from UiCalendar — so the Type and the control it implies read\n// as one thing. Time keeps the clock, which is what makes the date/date-and-\n// time split legible at a glance.\nconst FILTER_KIND_ICONS: Record<string, ReactNode> = {\n terms: <UiListChecks />,\n exact: <UiFingerprint />,\n range: <UiSliders />,\n duration: <UiTimer />,\n date: <UiCalendar />,\n time: <UiClock />,\n boolean: <UiToggleOn />,\n text: <UiCursorText />,\n none: <UiProhibit />,\n};\n\nconst ROLE_ICONS: Record<string, ReactNode> = {\n timestamp: <UiClock />,\n tags: <UiTag />,\n status: <UiPulse />,\n};\n\nconst FORMAT_ICONS: Record<string, ReactNode> = {\n date: <UiCalendar />,\n float: <UiSigma />,\n duration: <UiTimer />,\n bytes: <UiHardDrive />,\n currency: <UiCurrencyDollar />,\n};\n\nconst UNIT_ICONS: Record<string, ReactNode> = {\n none: <UiSigma />,\n short: <UiSigma />,\n percent: <UiChartPie />,\n percentunit: <UiChartPie />,\n bytes: <UiHardDrive />,\n decbytes: <UiHardDrive />,\n Bps: <UiActivity />,\n binBps: <UiActivity />,\n ms: <UiTimer />,\n s: <UiTimer />,\n};\n\nexport function profileTypeIcon(type?: string): ReactNode {\n return (type && TYPE_ICONS[type]) ?? <UiColumns />;\n}\n\nexport function profileFilterKindIcon(kind: string): ReactNode {\n return FILTER_KIND_ICONS[kind] ?? <UiListChecks />;\n}\n\nexport const profileTypeOptions: ComboboxOption[] = PROFILE_FIELD_TYPES.map((type) => ({\n value: type,\n label: type,\n icon: TYPE_ICONS[type],\n}));\n\nexport const profileRoleOptions: ComboboxOption[] = [\n { value: \"timestamp\", label: \"Timestamp\", icon: ROLE_ICONS[\"timestamp\"] },\n { value: \"tags\", label: \"Tags\", icon: ROLE_ICONS[\"tags\"] },\n { value: \"status\", label: \"Status\", icon: ROLE_ICONS[\"status\"] },\n];\n\nexport const profileFormatOptions: ComboboxOption[] = PROFILE_COLUMN_FORMAT_OPTIONS.map(\n (option) => ({ ...option, icon: FORMAT_ICONS[option.value] }),\n);\n\nexport const profileUnitOptions: ComboboxOption[] = PROFILE_COLUMN_UNIT_OPTIONS.map(\n (option) => ({ ...option, icon: UNIT_ICONS[option.value] }),\n);\n\nexport const profileFilterKindOptions: ComboboxOption[] = PROFILE_FILTER_KIND_OPTIONS.map(\n (option) => ({ ...option, icon: FILTER_KIND_ICONS[option.value] }),\n);\n"],"names":["UiCursorText","UiSigma","UiToggleOn","UiCalendar","UiTimer","UiHardDrive","UiPulse","UiShieldCheck","UiTag","UiListDashes","UiBraces","UiListChecks","UiFingerprint","UiSliders","UiClock","UiProhibit","UiCurrencyDollar","UiChartPie","UiActivity","UiColumns","jsx","PROFILE_FIELD_TYPES","PROFILE_COLUMN_FORMAT_OPTIONS","PROFILE_COLUMN_UNIT_OPTIONS","PROFILE_FILTER_KIND_OPTIONS"],"mappings":"
|
|
1
|
+
{"version":3,"file":"profileFieldIcons.cjs","sources":["../../../src/profiles/fields/profileFieldIcons.tsx"],"sourcesContent":["/**\n * The glyphs a profile column's enums render with, and the Combobox options\n * built from them.\n *\n * The params editor gets these from the schema (`x-enum-icons`); the column\n * editor is hand-rolled, so its vocabulary lives here instead — one place both\n * the grid and the inspector read, rather than an icon picked twice.\n */\n\nimport type { ReactNode } from \"react\";\nimport type { ComboboxOption } from \"../../components/combobox-types\";\n// Monochrome UI glyphs only: the symbol icons (UiString, UiJson, UiField, …)\n// carry hardcoded IDE colours, which read as stray dots beside a form label.\nimport {\n UiActivity,\n UiAsterisk,\n UiBraces,\n UiCalendar,\n UiChartPie,\n UiClock,\n UiColumns,\n UiCurrencyDollar,\n UiCursorText,\n UiFingerprint,\n UiHardDrive,\n UiListChecks,\n UiListDashes,\n UiProhibit,\n UiPulse,\n UiShieldCheck,\n UiSigma,\n UiSliders,\n UiTag,\n UiTimer,\n UiToggleOn,\n} from \"../../icons\";\nimport { PROFILE_FIELD_TYPES } from \"./profileFieldTypes\";\nimport {\n PROFILE_COLUMN_FORMAT_OPTIONS,\n PROFILE_COLUMN_UNIT_OPTIONS,\n PROFILE_FILTER_KIND_OPTIONS,\n} from \"../wizard/profileWizardModel\";\n\nconst TYPE_ICONS: Record<string, ReactNode> = {\n string: <UiCursorText />,\n number: <UiSigma />,\n boolean: <UiToggleOn />,\n datetime: <UiCalendar />,\n duration: <UiTimer />,\n bytes: <UiHardDrive />,\n status: <UiPulse />,\n health: <UiShieldCheck />,\n key_value: <UiTag />,\n key_values: <UiListDashes />,\n json: <UiBraces />,\n};\n\n// A filter borrows the glyph of the type that infers it — duration from\n// UiTimer, date from UiCalendar — so the Type and the control it implies read\n// as one thing. Time keeps the clock, which is what makes the date/date-and-\n// time split legible at a glance.\nconst FILTER_KIND_ICONS: Record<string, ReactNode> = {\n terms: <UiListChecks />,\n match: <UiAsterisk />,\n exact: <UiFingerprint />,\n range: <UiSliders />,\n duration: <UiTimer />,\n date: <UiCalendar />,\n time: <UiClock />,\n boolean: <UiToggleOn />,\n text: <UiCursorText />,\n none: <UiProhibit />,\n};\n\nconst ROLE_ICONS: Record<string, ReactNode> = {\n timestamp: <UiClock />,\n tags: <UiTag />,\n status: <UiPulse />,\n};\n\nconst FORMAT_ICONS: Record<string, ReactNode> = {\n date: <UiCalendar />,\n float: <UiSigma />,\n duration: <UiTimer />,\n bytes: <UiHardDrive />,\n currency: <UiCurrencyDollar />,\n};\n\nconst UNIT_ICONS: Record<string, ReactNode> = {\n none: <UiSigma />,\n short: <UiSigma />,\n percent: <UiChartPie />,\n percentunit: <UiChartPie />,\n bytes: <UiHardDrive />,\n decbytes: <UiHardDrive />,\n Bps: <UiActivity />,\n binBps: <UiActivity />,\n ms: <UiTimer />,\n s: <UiTimer />,\n};\n\nexport function profileTypeIcon(type?: string): ReactNode {\n return (type && TYPE_ICONS[type]) ?? <UiColumns />;\n}\n\nexport function profileFilterKindIcon(kind: string): ReactNode {\n return FILTER_KIND_ICONS[kind] ?? <UiListChecks />;\n}\n\nexport const profileTypeOptions: ComboboxOption[] = PROFILE_FIELD_TYPES.map((type) => ({\n value: type,\n label: type,\n icon: TYPE_ICONS[type],\n}));\n\nexport const profileRoleOptions: ComboboxOption[] = [\n { value: \"timestamp\", label: \"Timestamp\", icon: ROLE_ICONS[\"timestamp\"] },\n { value: \"tags\", label: \"Tags\", icon: ROLE_ICONS[\"tags\"] },\n { value: \"status\", label: \"Status\", icon: ROLE_ICONS[\"status\"] },\n];\n\nexport const profileFormatOptions: ComboboxOption[] = PROFILE_COLUMN_FORMAT_OPTIONS.map(\n (option) => ({ ...option, icon: FORMAT_ICONS[option.value] }),\n);\n\nexport const profileUnitOptions: ComboboxOption[] = PROFILE_COLUMN_UNIT_OPTIONS.map(\n (option) => ({ ...option, icon: UNIT_ICONS[option.value] }),\n);\n\nexport const profileFilterKindOptions: ComboboxOption[] = PROFILE_FILTER_KIND_OPTIONS.map(\n (option) => ({ ...option, icon: FILTER_KIND_ICONS[option.value] }),\n);\n"],"names":["UiCursorText","UiSigma","UiToggleOn","UiCalendar","UiTimer","UiHardDrive","UiPulse","UiShieldCheck","UiTag","UiListDashes","UiBraces","UiListChecks","UiAsterisk","UiFingerprint","UiSliders","UiClock","UiProhibit","UiCurrencyDollar","UiChartPie","UiActivity","UiColumns","jsx","PROFILE_FIELD_TYPES","PROFILE_COLUMN_FORMAT_OPTIONS","PROFILE_COLUMN_UNIT_OPTIONS","PROFILE_FILTER_KIND_OPTIONS"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,aAAwC;AAAA,EAC5C,uCAASA,aAAAA,cAAA,EAAa;AAAA,EACtB,uCAASC,QAAAA,SAAA,EAAQ;AAAA,EACjB,wCAAUC,WAAAA,YAAA,EAAW;AAAA,EACrB,yCAAWC,WAAAA,YAAA,EAAW;AAAA,EACtB,yCAAWC,QAAAA,SAAA,EAAQ;AAAA,EACnB,sCAAQC,YAAAA,aAAA,EAAY;AAAA,EACpB,uCAASC,QAAAA,SAAA,EAAQ;AAAA,EACjB,uCAASC,SAAAA,eAAA,EAAc;AAAA,EACvB,0CAAYC,MAAAA,OAAA,EAAM;AAAA,EAClB,2CAAaC,aAAAA,cAAA,EAAa;AAAA,EAC1B,qCAAOC,SAAAA,UAAA,CAAA,CAAS;AAClB;AAMA,MAAM,oBAA+C;AAAA,EACnD,sCAAQC,aAAAA,cAAA,EAAa;AAAA,EACrB,sCAAQC,WAAAA,YAAA,EAAW;AAAA,EACnB,sCAAQC,cAAAA,eAAA,EAAc;AAAA,EACtB,sCAAQC,UAAAA,WAAA,EAAU;AAAA,EAClB,yCAAWV,QAAAA,SAAA,EAAQ;AAAA,EACnB,qCAAOD,WAAAA,YAAA,EAAW;AAAA,EAClB,qCAAOY,QA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AAA,EACrF,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM,WAAW,IAAI;AACvB,EAAE;AAEK,MAAM,qBAAuC;AAAA,EAClD,EAAE,OAAO,aAAa,OAAO,aAAa,MAAM,WAAW,WAAW,EAAA;AAAA,EACtE,EAAE,OAAO,QAAQ,OAAO,QAAQ,MAAM,WAAW,MAAM,EAAA;AAAA,EACvD,EAAE,OAAO,UAAU,OAAO,UAAU,MAAM,WAAW,QAAQ,EAAA;AAC/D;AAEO,MAAM,uBAAyCC,mBAAAA,8BAA8B;AAAA,EAClF,CAAC,YAAY,EAAE,GAAG,QAAQ,MAAM,aAAa,OAAO,KAAK,EAAA;AAC3D;AAEO,MAAM,qBAAuCC,mBAAAA,4BAA4B;AAAA,EAC9E,CAAC,YAAY,EAAE,GAAG,QAAQ,MAAM,WAAW,OAAO,KAAK,EAAA;AACzD;AAE0DC,mBAAAA,4BAA4B;AAAA,EACpF,CAAC,YAAY,EAAE,GAAG,QAAQ,MAAM,kBAAkB,OAAO,KAAK,EAAA;AAChE;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileFieldIcons.d.ts","sourceRoot":"","sources":["../../../src/profiles/fields/profileFieldIcons.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"profileFieldIcons.d.ts","sourceRoot":"","sources":["../../../src/profiles/fields/profileFieldIcons.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AA2FtE,wBAAgB,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAExD;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAE7D;AAED,eAAO,MAAM,kBAAkB,EAAE,cAAc,EAI5C,CAAC;AAEJ,eAAO,MAAM,kBAAkB,EAAE,cAAc,EAI9C,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,cAAc,EAEhD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAAc,EAE9C,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,cAAc,EAEpD,CAAC"}
|
|
@@ -21,6 +21,7 @@ import { UiListChecks } from "../../icons/components/UiListChecks.js";
|
|
|
21
21
|
import { UiProhibit } from "../../icons/components/UiProhibit.js";
|
|
22
22
|
import { UiSliders } from "../../icons/components/UiSliders.js";
|
|
23
23
|
import { UiFingerprint } from "../../icons/components/UiFingerprint.js";
|
|
24
|
+
import { UiAsterisk } from "../../icons/components/UiAsterisk.js";
|
|
24
25
|
const TYPE_ICONS = {
|
|
25
26
|
string: /* @__PURE__ */ jsx(UiCursorText, {}),
|
|
26
27
|
number: /* @__PURE__ */ jsx(UiSigma, {}),
|
|
@@ -36,6 +37,7 @@ const TYPE_ICONS = {
|
|
|
36
37
|
};
|
|
37
38
|
const FILTER_KIND_ICONS = {
|
|
38
39
|
terms: /* @__PURE__ */ jsx(UiListChecks, {}),
|
|
40
|
+
match: /* @__PURE__ */ jsx(UiAsterisk, {}),
|
|
39
41
|
exact: /* @__PURE__ */ jsx(UiFingerprint, {}),
|
|
40
42
|
range: /* @__PURE__ */ jsx(UiSliders, {}),
|
|
41
43
|
duration: /* @__PURE__ */ jsx(UiTimer, {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileFieldIcons.js","sources":["../../../src/profiles/fields/profileFieldIcons.tsx"],"sourcesContent":["/**\n * The glyphs a profile column's enums render with, and the Combobox options\n * built from them.\n *\n * The params editor gets these from the schema (`x-enum-icons`); the column\n * editor is hand-rolled, so its vocabulary lives here instead — one place both\n * the grid and the inspector read, rather than an icon picked twice.\n */\n\nimport type { ReactNode } from \"react\";\nimport type { ComboboxOption } from \"../../components/combobox-types\";\n// Monochrome UI glyphs only: the symbol icons (UiString, UiJson, UiField, …)\n// carry hardcoded IDE colours, which read as stray dots beside a form label.\nimport {\n UiActivity,\n UiBraces,\n UiCalendar,\n UiChartPie,\n UiClock,\n UiColumns,\n UiCurrencyDollar,\n UiCursorText,\n UiFingerprint,\n UiHardDrive,\n UiListChecks,\n UiListDashes,\n UiProhibit,\n UiPulse,\n UiShieldCheck,\n UiSigma,\n UiSliders,\n UiTag,\n UiTimer,\n UiToggleOn,\n} from \"../../icons\";\nimport { PROFILE_FIELD_TYPES } from \"./profileFieldTypes\";\nimport {\n PROFILE_COLUMN_FORMAT_OPTIONS,\n PROFILE_COLUMN_UNIT_OPTIONS,\n PROFILE_FILTER_KIND_OPTIONS,\n} from \"../wizard/profileWizardModel\";\n\nconst TYPE_ICONS: Record<string, ReactNode> = {\n string: <UiCursorText />,\n number: <UiSigma />,\n boolean: <UiToggleOn />,\n datetime: <UiCalendar />,\n duration: <UiTimer />,\n bytes: <UiHardDrive />,\n status: <UiPulse />,\n health: <UiShieldCheck />,\n key_value: <UiTag />,\n key_values: <UiListDashes />,\n json: <UiBraces />,\n};\n\n// A filter borrows the glyph of the type that infers it — duration from\n// UiTimer, date from UiCalendar — so the Type and the control it implies read\n// as one thing. Time keeps the clock, which is what makes the date/date-and-\n// time split legible at a glance.\nconst FILTER_KIND_ICONS: Record<string, ReactNode> = {\n terms: <UiListChecks />,\n exact: <UiFingerprint />,\n range: <UiSliders />,\n duration: <UiTimer />,\n date: <UiCalendar />,\n time: <UiClock />,\n boolean: <UiToggleOn />,\n text: <UiCursorText />,\n none: <UiProhibit />,\n};\n\nconst ROLE_ICONS: Record<string, ReactNode> = {\n timestamp: <UiClock />,\n tags: <UiTag />,\n status: <UiPulse />,\n};\n\nconst FORMAT_ICONS: Record<string, ReactNode> = {\n date: <UiCalendar />,\n float: <UiSigma />,\n duration: <UiTimer />,\n bytes: <UiHardDrive />,\n currency: <UiCurrencyDollar />,\n};\n\nconst UNIT_ICONS: Record<string, ReactNode> = {\n none: <UiSigma />,\n short: <UiSigma />,\n percent: <UiChartPie />,\n percentunit: <UiChartPie />,\n bytes: <UiHardDrive />,\n decbytes: <UiHardDrive />,\n Bps: <UiActivity />,\n binBps: <UiActivity />,\n ms: <UiTimer />,\n s: <UiTimer />,\n};\n\nexport function profileTypeIcon(type?: string): ReactNode {\n return (type && TYPE_ICONS[type]) ?? <UiColumns />;\n}\n\nexport function profileFilterKindIcon(kind: string): ReactNode {\n return FILTER_KIND_ICONS[kind] ?? <UiListChecks />;\n}\n\nexport const profileTypeOptions: ComboboxOption[] = PROFILE_FIELD_TYPES.map((type) => ({\n value: type,\n label: type,\n icon: TYPE_ICONS[type],\n}));\n\nexport const profileRoleOptions: ComboboxOption[] = [\n { value: \"timestamp\", label: \"Timestamp\", icon: ROLE_ICONS[\"timestamp\"] },\n { value: \"tags\", label: \"Tags\", icon: ROLE_ICONS[\"tags\"] },\n { value: \"status\", label: \"Status\", icon: ROLE_ICONS[\"status\"] },\n];\n\nexport const profileFormatOptions: ComboboxOption[] = PROFILE_COLUMN_FORMAT_OPTIONS.map(\n (option) => ({ ...option, icon: FORMAT_ICONS[option.value] }),\n);\n\nexport const profileUnitOptions: ComboboxOption[] = PROFILE_COLUMN_UNIT_OPTIONS.map(\n (option) => ({ ...option, icon: UNIT_ICONS[option.value] }),\n);\n\nexport const profileFilterKindOptions: ComboboxOption[] = PROFILE_FILTER_KIND_OPTIONS.map(\n (option) => ({ ...option, icon: FILTER_KIND_ICONS[option.value] }),\n);\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profileFieldIcons.js","sources":["../../../src/profiles/fields/profileFieldIcons.tsx"],"sourcesContent":["/**\n * The glyphs a profile column's enums render with, and the Combobox options\n * built from them.\n *\n * The params editor gets these from the schema (`x-enum-icons`); the column\n * editor is hand-rolled, so its vocabulary lives here instead — one place both\n * the grid and the inspector read, rather than an icon picked twice.\n */\n\nimport type { ReactNode } from \"react\";\nimport type { ComboboxOption } from \"../../components/combobox-types\";\n// Monochrome UI glyphs only: the symbol icons (UiString, UiJson, UiField, …)\n// carry hardcoded IDE colours, which read as stray dots beside a form label.\nimport {\n UiActivity,\n UiAsterisk,\n UiBraces,\n UiCalendar,\n UiChartPie,\n UiClock,\n UiColumns,\n UiCurrencyDollar,\n UiCursorText,\n UiFingerprint,\n UiHardDrive,\n UiListChecks,\n UiListDashes,\n UiProhibit,\n UiPulse,\n UiShieldCheck,\n UiSigma,\n UiSliders,\n UiTag,\n UiTimer,\n UiToggleOn,\n} from \"../../icons\";\nimport { PROFILE_FIELD_TYPES } from \"./profileFieldTypes\";\nimport {\n PROFILE_COLUMN_FORMAT_OPTIONS,\n PROFILE_COLUMN_UNIT_OPTIONS,\n PROFILE_FILTER_KIND_OPTIONS,\n} from \"../wizard/profileWizardModel\";\n\nconst TYPE_ICONS: Record<string, ReactNode> = {\n string: <UiCursorText />,\n number: <UiSigma />,\n boolean: <UiToggleOn />,\n datetime: <UiCalendar />,\n duration: <UiTimer />,\n bytes: <UiHardDrive />,\n status: <UiPulse />,\n health: <UiShieldCheck />,\n key_value: <UiTag />,\n key_values: <UiListDashes />,\n json: <UiBraces />,\n};\n\n// A filter borrows the glyph of the type that infers it — duration from\n// UiTimer, date from UiCalendar — so the Type and the control it implies read\n// as one thing. Time keeps the clock, which is what makes the date/date-and-\n// time split legible at a glance.\nconst FILTER_KIND_ICONS: Record<string, ReactNode> = {\n terms: <UiListChecks />,\n match: <UiAsterisk />,\n exact: <UiFingerprint />,\n range: <UiSliders />,\n duration: <UiTimer />,\n date: <UiCalendar />,\n time: <UiClock />,\n boolean: <UiToggleOn />,\n text: <UiCursorText />,\n none: <UiProhibit />,\n};\n\nconst ROLE_ICONS: Record<string, ReactNode> = {\n timestamp: <UiClock />,\n tags: <UiTag />,\n status: <UiPulse />,\n};\n\nconst FORMAT_ICONS: Record<string, ReactNode> = {\n date: <UiCalendar />,\n float: <UiSigma />,\n duration: <UiTimer />,\n bytes: <UiHardDrive />,\n currency: <UiCurrencyDollar />,\n};\n\nconst UNIT_ICONS: Record<string, ReactNode> = {\n none: <UiSigma />,\n short: <UiSigma />,\n percent: <UiChartPie />,\n percentunit: <UiChartPie />,\n bytes: <UiHardDrive />,\n decbytes: <UiHardDrive />,\n Bps: <UiActivity />,\n binBps: <UiActivity />,\n ms: <UiTimer />,\n s: <UiTimer />,\n};\n\nexport function profileTypeIcon(type?: string): ReactNode {\n return (type && TYPE_ICONS[type]) ?? <UiColumns />;\n}\n\nexport function profileFilterKindIcon(kind: string): ReactNode {\n return FILTER_KIND_ICONS[kind] ?? <UiListChecks />;\n}\n\nexport const profileTypeOptions: ComboboxOption[] = PROFILE_FIELD_TYPES.map((type) => ({\n value: type,\n label: type,\n icon: TYPE_ICONS[type],\n}));\n\nexport const profileRoleOptions: ComboboxOption[] = [\n { value: \"timestamp\", label: \"Timestamp\", icon: ROLE_ICONS[\"timestamp\"] },\n { value: \"tags\", label: \"Tags\", icon: ROLE_ICONS[\"tags\"] },\n { value: \"status\", label: \"Status\", icon: ROLE_ICONS[\"status\"] },\n];\n\nexport const profileFormatOptions: ComboboxOption[] = PROFILE_COLUMN_FORMAT_OPTIONS.map(\n (option) => ({ ...option, icon: FORMAT_ICONS[option.value] }),\n);\n\nexport const profileUnitOptions: ComboboxOption[] = PROFILE_COLUMN_UNIT_OPTIONS.map(\n (option) => ({ ...option, icon: UNIT_ICONS[option.value] }),\n);\n\nexport const profileFilterKindOptions: ComboboxOption[] = PROFILE_FILTER_KIND_OPTIONS.map(\n (option) => ({ ...option, icon: FILTER_KIND_ICONS[option.value] }),\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,aAAwC;AAAA,EAC5C,4BAAS,cAAA,EAAa;AAAA,EACtB,4BAAS,SAAA,EAAQ;AAAA,EACjB,6BAAU,YAAA,EAAW;AAAA,E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AA,EAAQ;AAAA,EACb,uBAAI,SAAA,CAAA,CAAQ;AACd;AAEO,SAAS,gBAAgB,MAA0B;AACxD,UAAQ,QAAQ,WAAW,IAAI,0BAAO,WAAA,EAAU;AAClD;AAEO,SAAS,sBAAsB,MAAyB;AAC7D,SAAO,kBAAkB,IAAI,KAAK,oBAAC,cAAA,CAAA,CAAa;AAClD;AAEO,MAAM,qBAAuC,oBAAoB,IAAI,CAAC,UAAU;AAAA,EACrF,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM,WAAW,IAAI;AACvB,EAAE;AAEK,MAAM,qBAAuC;AAAA,EAClD,EAAE,OAAO,aAAa,OAAO,aAAa,MAAM,WAAW,WAAW,EAAA;AAAA,EACtE,EAAE,OAAO,QAAQ,OAAO,QAAQ,MAAM,WAAW,MAAM,EAAA;AAAA,EACvD,EAAE,OAAO,UAAU,OAAO,UAAU,MAAM,WAAW,QAAQ,EAAA;AAC/D;AAEO,MAAM,uBAAyC,8BAA8B;AAAA,EAClF,CAAC,YAAY,EAAE,GAAG,QAAQ,MAAM,aAAa,OAAO,KAAK,EAAA;AAC3D;AAEO,MAAM,qBAAuC,4BAA4B;AAAA,EAC9E,CAAC,YAAY,EAAE,GAAG,QAAQ,MAAM,WAAW,OAAO,KAAK,EAAA;AACzD;AAE0D,4BAA4B;AAAA,EACpF,CAAC,YAAY,EAAE,GAAG,QAAQ,MAAM,kBAAkB,OAAO,KAAK,EAAA;AAChE;"}
|
|
@@ -95,6 +95,7 @@ function applyVisibleFieldSelection(discovered, configured, visibleNames, select
|
|
|
95
95
|
}
|
|
96
96
|
const PROFILE_FILTER_KIND_OPTIONS = [
|
|
97
97
|
{ value: "terms", label: "Value list" },
|
|
98
|
+
{ value: "match", label: "Pattern list" },
|
|
98
99
|
{ value: "exact", label: "Exact match" },
|
|
99
100
|
{ value: "text", label: "Text search" },
|
|
100
101
|
{ value: "range", label: "Numeric range" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileWizardModel.cjs","sources":["../../../src/profiles/wizard/profileWizardModel.ts"],"sourcesContent":["import type { JsonSchemaObject } from \"../../components/json-schema-form-types\";\nimport { profileSchema } from \"../profileApi\";\nimport type { ProfileRowLimits } from \"../connections/connectionBrowserModel\";\n\n/** How a column is filtered at the backend; every field overrides an inference\n * the server would otherwise make from the column itself. */\nexport type ProfileColumnFilter = {\n /** Backend field the selection applies to; blank infers it from the column. */\n field?: string;\n /** Nested mapping containing the backend field. */\n nested?: string;\n /** Constants that pin the matching nested entry. */\n where?: Record<string, string>;\n /** terms, range, time, boolean, text or none; blank infers it from the type. */\n kind?: string;\n /** Enumerated values, replacing the backend lookup. */\n options?: string[];\n /** Ask the backend for this field's distinct values. */\n lookup?: boolean;\n /** How many of those values the control offers before the rest are typed for. */\n limit?: number;\n /** Allow several values at once. */\n multi?: boolean;\n /** Offer no filter while keeping the column rendered. */\n disabled?: boolean;\n};\n\n/**\n * A patch of T: every key optional, and explicitly settable to `undefined` to\n * clear it.\n *\n * Not Partial<T>. Under `exactOptionalPropertyTypes` an optional key may be\n * absent but not present-and-undefined, and \"clear this field\" — which is what\n * every editor control sends when its input goes empty — is precisely a present\n * `undefined`. The patch appliers drop those keys; the type has to permit them.\n */\nexport type Patch<T> = { [K in keyof T]?: T[K] | undefined };\n\n/**\n * Applies a patch, removing the keys it clears instead of leaving them present\n * and undefined.\n *\n * Spreading a patch would keep them, and these objects are serialized to the\n * server, where a present `field: undefined` is a key to interpret rather than\n * an absent one.\n */\nexport function applyPatch<T extends object>(value: T, patch: Patch<T>): T {\n const next = { ...value };\n for (const [key, entry] of Object.entries(patch)) {\n if (entry === undefined) delete next[key as keyof T];\n else next[key as keyof T] = entry as T[keyof T];\n }\n return next;\n}\n\nexport type ProfileColumn = {\n name: string;\n source?: string;\n label?: string;\n type?: string;\n kind?: string;\n format?: string;\n unit?: string;\n width?: number;\n cel?: string;\n /** Path computing the value, rooted at the row or at `source` when set. */\n jsonpath?: string;\n hidden?: boolean;\n filter?: ProfileColumnFilter;\n [key: string]: unknown;\n};\n\nexport type ProfileProvider = {\n type?: string;\n connection?: string;\n options?: Record<string, unknown>;\n [key: string]: unknown;\n};\n\n/** The parameter types the profile schema accepts. */\nexport type ParamDraftType =\n | \"string\"\n | \"number\"\n | \"boolean\"\n | \"date\"\n | \"datetime\"\n | \"duration\"\n | \"enum\"\n | \"list\";\n\n/** filter, limit, offset, time-from or time-to; empty behaves as filter. */\nexport type ParamDraftRole =\n | \"filter\"\n | \"limit\"\n | \"offset\"\n | \"time-from\"\n | \"time-to\";\n\nexport type ParamDraft = {\n name?: string | undefined;\n label?: string | undefined;\n type?: ParamDraftType | undefined;\n role?: ParamDraftRole | undefined;\n default?: unknown | undefined;\n options?: string[] | undefined;\n required?: boolean | undefined;\n description?: string | undefined;\n /** Value rewrite; {value} is the supplied value. */\n template?: string | undefined;\n /** Backend field a list parameter filters on. Setting it lets a value be\n * excluded as well as included; it requires an OpenSearch-backed provider. */\n field?: string | undefined;\n};\n\n/** PARAM_TYPES_WITH_OPTIONS are the types whose values come from a fixed set, so\n * the editor offers an options picker for them. */\nexport const PARAM_TYPES_WITH_OPTIONS: ParamDraftType[] = [\"enum\", \"list\"];\n\nexport function paramHasOptions(param: ParamDraft): boolean {\n return (\n param.type !== undefined && PARAM_TYPES_WITH_OPTIONS.includes(param.type)\n );\n}\n\nexport type ProfileWizardDraft = Record<string, unknown> & {\n namespace?: string | undefined;\n profile?: string | undefined;\n /** Overrides the sidebar/picker glyph the provider type would otherwise give. */\n icon?: string | undefined;\n provider?: ProfileProvider | undefined;\n query?: string | undefined;\n columns?: ProfileColumn[] | undefined;\n /** The inputs a run binds — by name in the query, the provider options or the\n * connection. The query workspace previews against their defaults. */\n params?: ParamDraft[] | undefined;\n /** The row caps this profile sets for itself; unset ones take their default. */\n limits?: ProfileRowLimits | undefined;\n};\n\n/**\n * A profile that caps nothing carries no block at all, so the defaults are what\n * it inherits rather than what it froze at the moment it was edited. Both draft\n * hosts write the caps through this, so neither can leave an empty map behind.\n */\nexport function withProfileLimits<T extends ProfileWizardDraft>(\n draft: T,\n limits: ProfileRowLimits | undefined,\n): T {\n const next = { ...draft };\n if (limits) next.limits = limits;\n else delete next.limits;\n return next;\n}\n\nexport type ProfileFieldFilter = {\n query: string;\n type: string;\n selection: \"all\" | \"selected\" | \"unselected\";\n};\n\nexport const PROFILE_COLUMN_FORMAT_OPTIONS = [\n { value: \"date\", label: \"Date/time\" },\n { value: \"float\", label: \"Number\" },\n { value: \"duration\", label: \"Duration\" },\n { value: \"bytes\", label: \"Bytes\" },\n { value: \"currency\", label: \"Currency\" },\n] as const;\n\nexport const PROFILE_COLUMN_UNIT_OPTIONS = [\n { value: \"none\", label: \"Compact count\" },\n { value: \"short\", label: \"Short number\" },\n { value: \"percent\", label: \"Percent (0-100)\" },\n { value: \"percentunit\", label: \"Percent (0-1)\" },\n { value: \"bytes\", label: \"Bytes (IEC)\" },\n { value: \"decbytes\", label: \"Bytes (SI)\" },\n { value: \"Bps\", label: \"Bytes/sec\" },\n { value: \"binBps\", label: \"Binary bytes/sec\" },\n { value: \"ms\", label: \"Milliseconds\" },\n { value: \"s\", label: \"Seconds\" },\n] as const;\n\nexport const profileWizardSteps = [\n { id: \"source\", label: \"Choose source\", description: \"Connection\" },\n { id: \"query\", label: \"Explore & sample\", description: \"Query\" },\n { id: \"fields\", label: \"Name & shape\", description: \"Fields\" },\n { id: \"review\", label: \"Review\", description: \"Save\" },\n] as const;\n\nexport function filterProfileFields(\n fields: ProfileColumn[],\n selectedNames: Set<string>,\n filter: ProfileFieldFilter,\n): ProfileColumn[] {\n const query = filter.query.trim().toLowerCase();\n return fields.filter((field) => {\n const selected = selectedNames.has(field.name);\n if (filter.selection === \"selected\" && !selected) return false;\n if (filter.selection === \"unselected\" && selected) return false;\n if (filter.type && field.type !== filter.type) return false;\n if (!query) return true;\n return `${field.name} ${field.label ?? \"\"}`.toLowerCase().includes(query);\n });\n}\n\n/**\n * Every field the editors can show, each in its configured form. A discovered\n * field is a snapshot of what the source reported — the configured one carries\n * the user's edits, so it is the only version safe to render into a control or\n * to patch on top of.\n *\n * The configuration owns the order, because it is the order the profile renders\n * its columns in and the one the user drags rows into. A discovered field that\n * was never configured (not selected, or dropped from the profile) has no place\n * of its own, so it keeps the one it had: it is anchored just after whichever\n * configured field preceded it in the sample.\n */\nexport function availableProfileFields(\n discovered: ProfileColumn[],\n configured: ProfileColumn[],\n): ProfileColumn[] {\n const configuredByName = new Map(\n configured.map((field) => [field.name, field]),\n );\n const configuredBySource = new Map(\n configured\n .filter((field) => field.source)\n .map((field) => [field.source as string, field]),\n );\n const ordered = [...configured];\n let anchor = 0;\n for (const field of discovered) {\n const match =\n configuredByName.get(field.name) ?? configuredBySource.get(field.name);\n if (match) {\n anchor = ordered.indexOf(match) + 1;\n continue;\n }\n ordered.splice(anchor, 0, field);\n anchor += 1;\n }\n return ordered;\n}\n\n/**\n * Moves the named column onto the target's position, shifting the columns\n * between them — the drop semantics the field grid's row drag needs. Columns\n * are addressed by name because a drag only ever carries the row's identity.\n * A name that is not configured has no position, so the order is returned\n * unchanged rather than guessed at.\n */\nexport function reorderProfileColumns(\n columns: ProfileColumn[],\n sourceName: string,\n targetName: string,\n): ProfileColumn[] {\n const from = columns.findIndex((column) => column.name === sourceName);\n const to = columns.findIndex((column) => column.name === targetName);\n if (from < 0 || to < 0 || from === to) return columns;\n const next = [...columns];\n next.splice(to, 0, ...next.splice(from, 1));\n return next;\n}\n\n/**\n * Selects or deselects the named fields, keeping the configured order intact —\n * a re-selected field returns to where the grid already showed it rather than\n * to the back of the list or to its position in the sample.\n */\nexport function applyVisibleFieldSelection(\n discovered: ProfileColumn[],\n configured: ProfileColumn[],\n visibleNames: Set<string>,\n selected: boolean,\n): ProfileColumn[] {\n const selectedNames = new Set(configured.map((field) => field.name));\n for (const name of visibleNames) {\n if (selected) selectedNames.add(name);\n else selectedNames.delete(name);\n }\n return availableProfileFields(discovered, configured).filter((field) =>\n selectedNames.has(field.name),\n );\n}\n\n/** The control kinds a column filter can render as, with the server's own\n * wording. Mirrors query.ColumnFilterKindValues() and the x-enum-labels the\n * profile schema carries for them. */\nexport const PROFILE_FILTER_KIND_OPTIONS = [\n { value: \"terms\", label: \"Value list\" },\n { value: \"exact\", label: \"Exact match\" },\n { value: \"text\", label: \"Text search\" },\n { value: \"range\", label: \"Numeric range\" },\n { value: \"duration\", label: \"Duration range\" },\n { value: \"date\", label: \"Date range\" },\n { value: \"time\", label: \"Date & time range\" },\n { value: \"boolean\", label: \"Boolean\" },\n { value: \"none\", label: \"Not filterable\" },\n] as const;\n\n/** The server's own default, so an unset limit can be shown for what it does.\n * Mirrors query.DefaultFilterLookupLimit. */\nexport const PROFILE_FILTER_DEFAULT_LIMIT = 50;\n\n/** Mirrors query.MaxFilterLookupLimit — the largest head a lookup will serve. */\nexport const PROFILE_FILTER_MAX_LIMIT = 200;\n\n/**\n * Merges one filter knob into a column's filter block, dropping the block once\n * nothing is left in it.\n *\n * The distinction matters on save: `filter: {}` is a declaration that declares\n * nothing, and the server reads a present-but-empty block differently from an\n * absent one — unchecking the last box has to mean \"infer this again\", not\n * \"override it with silence\".\n */\nexport function patchColumnFilter(\n filter: ProfileColumnFilter | undefined,\n patch: Patch<ProfileColumnFilter>,\n): ProfileColumnFilter | undefined {\n const merged = Object.fromEntries(\n Object.entries({ ...filter, ...patch }).filter(\n ([, value]) => value !== undefined,\n ),\n ) as ProfileColumnFilter;\n return Object.keys(merged).length ? merged : undefined;\n}\n\n/** What the server picks for a column that declares no filter kind. Mirrors\n * columnFilterKindFor; text and date are absent there on purpose, so they are\n * here too. Bytes stays a plain range: a size literal has two bases, so \"5MB\"\n * would mean two different numbers. */\nexport function inferredFilterKind(column: ProfileColumn): string {\n switch (column.type) {\n case \"number\":\n case \"bytes\":\n return \"range\";\n case \"duration\":\n return \"duration\";\n case \"datetime\":\n return \"time\";\n case \"boolean\":\n return \"boolean\";\n case \"uuid\":\n return \"exact\";\n case \"key_value\":\n case \"key_values\":\n case \"json\":\n return \"none\";\n default:\n return \"terms\";\n }\n}\n\nexport function patchProfileField(\n field: ProfileColumn,\n patch: Patch<ProfileColumn>,\n): ProfileColumn {\n return Object.fromEntries(\n Object.entries({ ...field, ...patch }).filter(\n ([, value]) => value !== undefined,\n ),\n ) as ProfileColumn;\n}\n\nexport function renameProfileField(\n field: ProfileColumn,\n name: string,\n): ProfileColumn {\n const source = field.source ?? (field.cel ? undefined : field.name);\n return patchProfileField(field, {\n name,\n source: source === name ? undefined : source,\n });\n}\n\n/**\n * The connection type carried in a lookup option's label.\n *\n * The server renders each option as `\"<name> (<type>)\"`, so the parenthesised\n * suffix is the **connection** type — not the query provider that reads it. The\n * two coincide often enough (`opensearch`, `loki`, `postgres`) that using one as\n * the other looks correct, and they diverge for exactly the cloud and cluster\n * log backends: an `aws` connection is read by `cloudwatch`, `kubernetes` by\n * `k8s`, `azure` by `azureloganalytics`. Resolving one to the other is\n * providerTypesForConnectionType's job, and it uses the schema rather than a\n * second copy of that mapping.\n */\nexport function connectionTypeFromLabel(label: string): string | null {\n const match = label.match(/\\(([^()]+)\\)\\s*$/);\n return match?.[1]?.trim() || null;\n}\n\n/**\n * The query providers the profile schema says can read this connection type,\n * most specific first, or empty when nothing can read it.\n *\n * The authority is the schema the server already ships: the connection field's\n * lookup scope carries provider → connection types, so inverting it here keeps\n * one mapping rather than a client-side duplicate that can drift.\n */\nexport function providerTypesForConnectionType(\n connectionType: string,\n): string[] {\n const scope = providerConnectionScope();\n const candidates = Object.keys(scope)\n .filter((provider) => scope[provider]?.includes(connectionType))\n .sort();\n if (candidates.length <= 1) return candidates;\n // A provider keyed exactly as the connection type is the one named for it.\n const exact = candidates.find((provider) => provider === connectionType);\n if (exact) return [exact];\n // Otherwise drop the dialect-agnostic umbrella, so `sql_server` resolves to\n // `sqlserver` instead of tying with the generic `sql`. A genuine tie —\n // `google_cloud`, read by both `gcpcloudlogging` and `bigquery` — survives as\n // a list for the caller to disambiguate.\n const specific = candidates.filter((provider) => provider !== \"sql\");\n return specific.length === 1 ? specific : candidates;\n}\n\nfunction providerConnectionScope(): Record<string, string[]> {\n const provider = profileSchema().properties?.provider as\n | JsonSchemaObject\n | undefined;\n const connection = provider?.properties?.connection as\n | JsonSchemaObject\n | undefined;\n const lookup = connection?.[\"x-clicky-lookup\"] as\n | { scope?: { map?: unknown } }\n | undefined;\n const map = lookup?.scope?.map;\n if (!map || typeof map !== \"object\") {\n throw new Error(\n \"profile schema is missing provider.connection x-clicky-lookup.scope.map — the wizard cannot resolve a provider for a connection without it\",\n );\n }\n return map as Record<string, string[]>;\n}\n\nexport function profileConnectionID(value: string): string | null {\n const prefix = \"connection://\";\n if (!value.startsWith(prefix)) return null;\n return value.slice(prefix.length).trim() || null;\n}\n\nexport function profileWizardErrorMessage(\n error: unknown,\n fallback: string,\n): string {\n return error instanceof Error && error.message.trim()\n ? error.message.trim()\n : fallback;\n}\n\n/**\n * A profile says what to fetch either as a raw query or as a structured search\n * specification — never both, which is why this is an either/or rather than a\n * check on `query` alone.\n */\nexport function profileWizardHasQuery(draft: ProfileWizardDraft): boolean {\n return Boolean(\n draft.query?.trim() || draft.provider?.options?.search !== undefined,\n );\n}\n\nexport function profileWizardStepReady(\n step: (typeof profileWizardSteps)[number][\"id\"],\n draft: ProfileWizardDraft,\n discovered: ProfileColumn[],\n): boolean {\n if (step === \"source\") {\n return Boolean(draft.provider?.connection && draft.provider.type);\n }\n if (step === \"query\") {\n return Boolean(profileWizardHasQuery(draft) && discovered.length > 0);\n }\n if (step === \"fields\") {\n return Boolean(draft.profile?.trim() && draft.columns?.length);\n }\n return (\n Boolean(draft.profile?.trim() && draft.provider?.connection) &&\n discovered.length > 0\n );\n}\n"],"names":["profileSchema"],"mappings":";;;AA8CO,SAAS,WAA6B,OAAU,OAAoB;AACzE,QAAM,OAAO,EAAE,GAAG,MAAA;AAClB,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAChD,QAAI,UAAU,OA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,gBAAAA,gBAAgB,eAAhBA,mBAA4B;AAG7C,QAAM,cAAa,0CAAU,eAAV,mBAAsB;AAGzC,QAAM,SAAS,yCAAa;AAG5B,QAAM,OAAM,sCAAQ,UAAR,mBAAe;AAC3B,MAAI,CAAC,OAAO,OAAO,QAAQ,UAAU;AACnC,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACA,SAAO;AACT;AAEO,SAAS,oBAAoB,OAA8B;AAChE,QAAM,SAAS;AACf,MAAI,CAAC,MAAM,WAAW,MAAM,EAAG,QAAO;AACtC,SAAO,MAAM,MAAM,OAAO,MAAM,EAAE,UAAU;AAC9C;AAEO,SAAS,0BACd,OACA,UACQ;AACR,SAAO,iBAAiB,SAAS,MAAM,QAAQ,SAC3C,MAAM,QAAQ,KAAA,IACd;AACN;AAOO,SAAS,sBAAsB,OAAoC;;AACxE,SAAO;AAAA,MACL,WAAM,UAAN,mBAAa,aAAU,iBAAM,aAAN,mBAAgB,YAAhB,mBAAyB,YAAW;AAAA,EAAA;AAE/D;AAEO,SAAS,uBACd,MACA,OACA,YACS;;AACT,MAAI,SAAS,UAAU;AACrB,WAAO,UAAQ,WAAM,aAAN,mBAAgB,eAAc,MAAM,SAAS,IAAI;AAAA,EAClE;AACA,MAAI,SAAS,SAAS;AACpB,WAAO,QAAQ,sBAAsB,KAAK,KAAK,WAAW,SAAS,CAAC;AAAA,EACtE;AACA,MAAI,SAAS,UAAU;AACrB,WAAO,UAAQ,WAAM,YAAN,mBAAe,aAAU,WAAM,YAAN,mBAAe,OAAM;AAAA,EAC/D;AACA,SACE,UAAQ,WAAM,YAAN,mBAAe,aAAU,WAAM,aAAN,mBAAgB,WAAU,KAC3D,WAAW,SAAS;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"profileWizardModel.cjs","sources":["../../../src/profiles/wizard/profileWizardModel.ts"],"sourcesContent":["import type { JsonSchemaObject } from \"../../components/json-schema-form-types\";\nimport { profileSchema } from \"../profileApi\";\nimport type { ProfileRowLimits } from \"../connections/connectionBrowserModel\";\n\n/** How a column is filtered at the backend; every field overrides an inference\n * the server would otherwise make from the column itself. */\nexport type ProfileColumnFilter = {\n /** Backend field the selection applies to; blank infers it from the column. */\n field?: string;\n /** Nested mapping containing the backend field. */\n nested?: string;\n /** Constants that pin the matching nested entry. */\n where?: Record<string, string>;\n /** terms, range, time, boolean, text or none; blank infers it from the type. */\n kind?: string;\n /** Enumerated values, replacing the backend lookup. */\n options?: string[];\n /** Ask the backend for this field's distinct values. */\n lookup?: boolean;\n /** How many of those values the control offers before the rest are typed for. */\n limit?: number;\n /** Allow several values at once. */\n multi?: boolean;\n /** Offer no filter while keeping the column rendered. */\n disabled?: boolean;\n};\n\n/**\n * A patch of T: every key optional, and explicitly settable to `undefined` to\n * clear it.\n *\n * Not Partial<T>. Under `exactOptionalPropertyTypes` an optional key may be\n * absent but not present-and-undefined, and \"clear this field\" — which is what\n * every editor control sends when its input goes empty — is precisely a present\n * `undefined`. The patch appliers drop those keys; the type has to permit them.\n */\nexport type Patch<T> = { [K in keyof T]?: T[K] | undefined };\n\n/**\n * Applies a patch, removing the keys it clears instead of leaving them present\n * and undefined.\n *\n * Spreading a patch would keep them, and these objects are serialized to the\n * server, where a present `field: undefined` is a key to interpret rather than\n * an absent one.\n */\nexport function applyPatch<T extends object>(value: T, patch: Patch<T>): T {\n const next = { ...value };\n for (const [key, entry] of Object.entries(patch)) {\n if (entry === undefined) delete next[key as keyof T];\n else next[key as keyof T] = entry as T[keyof T];\n }\n return next;\n}\n\nexport type ProfileColumn = {\n name: string;\n source?: string;\n label?: string;\n type?: string;\n kind?: string;\n format?: string;\n unit?: string;\n width?: number;\n cel?: string;\n /** Path computing the value, rooted at the row or at `source` when set. */\n jsonpath?: string;\n hidden?: boolean;\n filter?: ProfileColumnFilter;\n [key: string]: unknown;\n};\n\nexport type ProfileProvider = {\n type?: string;\n connection?: string;\n options?: Record<string, unknown>;\n [key: string]: unknown;\n};\n\n/** The parameter types the profile schema accepts. */\nexport type ParamDraftType =\n | \"string\"\n | \"number\"\n | \"boolean\"\n | \"date\"\n | \"datetime\"\n | \"duration\"\n | \"enum\"\n | \"list\";\n\n/** filter, limit, offset, time-from or time-to; empty behaves as filter. */\nexport type ParamDraftRole =\n | \"filter\"\n | \"limit\"\n | \"offset\"\n | \"time-from\"\n | \"time-to\";\n\nexport type ParamDraft = {\n name?: string | undefined;\n label?: string | undefined;\n type?: ParamDraftType | undefined;\n role?: ParamDraftRole | undefined;\n default?: unknown | undefined;\n options?: string[] | undefined;\n required?: boolean | undefined;\n description?: string | undefined;\n /** Value rewrite; {value} is the supplied value. */\n template?: string | undefined;\n /** Backend field a list parameter filters on. Setting it lets a value be\n * excluded as well as included; it requires an OpenSearch-backed provider. */\n field?: string | undefined;\n};\n\n/** PARAM_TYPES_WITH_OPTIONS are the types whose values come from a fixed set, so\n * the editor offers an options picker for them. */\nexport const PARAM_TYPES_WITH_OPTIONS: ParamDraftType[] = [\"enum\", \"list\"];\n\nexport function paramHasOptions(param: ParamDraft): boolean {\n return (\n param.type !== undefined && PARAM_TYPES_WITH_OPTIONS.includes(param.type)\n );\n}\n\nexport type ProfileWizardDraft = Record<string, unknown> & {\n namespace?: string | undefined;\n profile?: string | undefined;\n /** Overrides the sidebar/picker glyph the provider type would otherwise give. */\n icon?: string | undefined;\n provider?: ProfileProvider | undefined;\n query?: string | undefined;\n columns?: ProfileColumn[] | undefined;\n /** The inputs a run binds — by name in the query, the provider options or the\n * connection. The query workspace previews against their defaults. */\n params?: ParamDraft[] | undefined;\n /** The row caps this profile sets for itself; unset ones take their default. */\n limits?: ProfileRowLimits | undefined;\n};\n\n/**\n * A profile that caps nothing carries no block at all, so the defaults are what\n * it inherits rather than what it froze at the moment it was edited. Both draft\n * hosts write the caps through this, so neither can leave an empty map behind.\n */\nexport function withProfileLimits<T extends ProfileWizardDraft>(\n draft: T,\n limits: ProfileRowLimits | undefined,\n): T {\n const next = { ...draft };\n if (limits) next.limits = limits;\n else delete next.limits;\n return next;\n}\n\nexport type ProfileFieldFilter = {\n query: string;\n type: string;\n selection: \"all\" | \"selected\" | \"unselected\";\n};\n\nexport const PROFILE_COLUMN_FORMAT_OPTIONS = [\n { value: \"date\", label: \"Date/time\" },\n { value: \"float\", label: \"Number\" },\n { value: \"duration\", label: \"Duration\" },\n { value: \"bytes\", label: \"Bytes\" },\n { value: \"currency\", label: \"Currency\" },\n] as const;\n\nexport const PROFILE_COLUMN_UNIT_OPTIONS = [\n { value: \"none\", label: \"Compact count\" },\n { value: \"short\", label: \"Short number\" },\n { value: \"percent\", label: \"Percent (0-100)\" },\n { value: \"percentunit\", label: \"Percent (0-1)\" },\n { value: \"bytes\", label: \"Bytes (IEC)\" },\n { value: \"decbytes\", label: \"Bytes (SI)\" },\n { value: \"Bps\", label: \"Bytes/sec\" },\n { value: \"binBps\", label: \"Binary bytes/sec\" },\n { value: \"ms\", label: \"Milliseconds\" },\n { value: \"s\", label: \"Seconds\" },\n] as const;\n\nexport const profileWizardSteps = [\n { id: \"source\", label: \"Choose source\", description: \"Connection\" },\n { id: \"query\", label: \"Explore & sample\", description: \"Query\" },\n { id: \"fields\", label: \"Name & shape\", description: \"Fields\" },\n { id: \"review\", label: \"Review\", description: \"Save\" },\n] as const;\n\nexport function filterProfileFields(\n fields: ProfileColumn[],\n selectedNames: Set<string>,\n filter: ProfileFieldFilter,\n): ProfileColumn[] {\n const query = filter.query.trim().toLowerCase();\n return fields.filter((field) => {\n const selected = selectedNames.has(field.name);\n if (filter.selection === \"selected\" && !selected) return false;\n if (filter.selection === \"unselected\" && selected) return false;\n if (filter.type && field.type !== filter.type) return false;\n if (!query) return true;\n return `${field.name} ${field.label ?? \"\"}`.toLowerCase().includes(query);\n });\n}\n\n/**\n * Every field the editors can show, each in its configured form. A discovered\n * field is a snapshot of what the source reported — the configured one carries\n * the user's edits, so it is the only version safe to render into a control or\n * to patch on top of.\n *\n * The configuration owns the order, because it is the order the profile renders\n * its columns in and the one the user drags rows into. A discovered field that\n * was never configured (not selected, or dropped from the profile) has no place\n * of its own, so it keeps the one it had: it is anchored just after whichever\n * configured field preceded it in the sample.\n */\nexport function availableProfileFields(\n discovered: ProfileColumn[],\n configured: ProfileColumn[],\n): ProfileColumn[] {\n const configuredByName = new Map(\n configured.map((field) => [field.name, field]),\n );\n const configuredBySource = new Map(\n configured\n .filter((field) => field.source)\n .map((field) => [field.source as string, field]),\n );\n const ordered = [...configured];\n let anchor = 0;\n for (const field of discovered) {\n const match =\n configuredByName.get(field.name) ?? configuredBySource.get(field.name);\n if (match) {\n anchor = ordered.indexOf(match) + 1;\n continue;\n }\n ordered.splice(anchor, 0, field);\n anchor += 1;\n }\n return ordered;\n}\n\n/**\n * Moves the named column onto the target's position, shifting the columns\n * between them — the drop semantics the field grid's row drag needs. Columns\n * are addressed by name because a drag only ever carries the row's identity.\n * A name that is not configured has no position, so the order is returned\n * unchanged rather than guessed at.\n */\nexport function reorderProfileColumns(\n columns: ProfileColumn[],\n sourceName: string,\n targetName: string,\n): ProfileColumn[] {\n const from = columns.findIndex((column) => column.name === sourceName);\n const to = columns.findIndex((column) => column.name === targetName);\n if (from < 0 || to < 0 || from === to) return columns;\n const next = [...columns];\n next.splice(to, 0, ...next.splice(from, 1));\n return next;\n}\n\n/**\n * Selects or deselects the named fields, keeping the configured order intact —\n * a re-selected field returns to where the grid already showed it rather than\n * to the back of the list or to its position in the sample.\n */\nexport function applyVisibleFieldSelection(\n discovered: ProfileColumn[],\n configured: ProfileColumn[],\n visibleNames: Set<string>,\n selected: boolean,\n): ProfileColumn[] {\n const selectedNames = new Set(configured.map((field) => field.name));\n for (const name of visibleNames) {\n if (selected) selectedNames.add(name);\n else selectedNames.delete(name);\n }\n return availableProfileFields(discovered, configured).filter((field) =>\n selectedNames.has(field.name),\n );\n}\n\n/** The control kinds a column filter can render as, with the server's own\n * wording. Mirrors query.ColumnFilterKindValues() and the x-enum-labels the\n * profile schema carries for them. */\nexport const PROFILE_FILTER_KIND_OPTIONS = [\n { value: \"terms\", label: \"Value list\" },\n { value: \"match\", label: \"Pattern list\" },\n { value: \"exact\", label: \"Exact match\" },\n { value: \"text\", label: \"Text search\" },\n { value: \"range\", label: \"Numeric range\" },\n { value: \"duration\", label: \"Duration range\" },\n { value: \"date\", label: \"Date range\" },\n { value: \"time\", label: \"Date & time range\" },\n { value: \"boolean\", label: \"Boolean\" },\n { value: \"none\", label: \"Not filterable\" },\n] as const;\n\n/** The server's own default, so an unset limit can be shown for what it does.\n * Mirrors query.DefaultFilterLookupLimit. */\nexport const PROFILE_FILTER_DEFAULT_LIMIT = 50;\n\n/** Mirrors query.MaxFilterLookupLimit — the largest head a lookup will serve. */\nexport const PROFILE_FILTER_MAX_LIMIT = 200;\n\n/**\n * Merges one filter knob into a column's filter block, dropping the block once\n * nothing is left in it.\n *\n * The distinction matters on save: `filter: {}` is a declaration that declares\n * nothing, and the server reads a present-but-empty block differently from an\n * absent one — unchecking the last box has to mean \"infer this again\", not\n * \"override it with silence\".\n */\nexport function patchColumnFilter(\n filter: ProfileColumnFilter | undefined,\n patch: Patch<ProfileColumnFilter>,\n): ProfileColumnFilter | undefined {\n const merged = Object.fromEntries(\n Object.entries({ ...filter, ...patch }).filter(\n ([, value]) => value !== undefined,\n ),\n ) as ProfileColumnFilter;\n return Object.keys(merged).length ? merged : undefined;\n}\n\n/** What the server picks for a column that declares no filter kind. Mirrors\n * columnFilterKindFor; text and date are absent there on purpose, so they are\n * here too. Bytes stays a plain range: a size literal has two bases, so \"5MB\"\n * would mean two different numbers. */\nexport function inferredFilterKind(column: ProfileColumn): string {\n switch (column.type) {\n case \"number\":\n case \"bytes\":\n return \"range\";\n case \"duration\":\n return \"duration\";\n case \"datetime\":\n return \"time\";\n case \"boolean\":\n return \"boolean\";\n case \"uuid\":\n return \"exact\";\n case \"key_value\":\n case \"key_values\":\n case \"json\":\n return \"none\";\n default:\n return \"terms\";\n }\n}\n\nexport function patchProfileField(\n field: ProfileColumn,\n patch: Patch<ProfileColumn>,\n): ProfileColumn {\n return Object.fromEntries(\n Object.entries({ ...field, ...patch }).filter(\n ([, value]) => value !== undefined,\n ),\n ) as ProfileColumn;\n}\n\nexport function renameProfileField(\n field: ProfileColumn,\n name: string,\n): ProfileColumn {\n const source = field.source ?? (field.cel ? undefined : field.name);\n return patchProfileField(field, {\n name,\n source: source === name ? undefined : source,\n });\n}\n\n/**\n * The connection type carried in a lookup option's label.\n *\n * The server renders each option as `\"<name> (<type>)\"`, so the parenthesised\n * suffix is the **connection** type — not the query provider that reads it. The\n * two coincide often enough (`opensearch`, `loki`, `postgres`) that using one as\n * the other looks correct, and they diverge for exactly the cloud and cluster\n * log backends: an `aws` connection is read by `cloudwatch`, `kubernetes` by\n * `k8s`, `azure` by `azureloganalytics`. Resolving one to the other is\n * providerTypesForConnectionType's job, and it uses the schema rather than a\n * second copy of that mapping.\n */\nexport function connectionTypeFromLabel(label: string): string | null {\n const match = label.match(/\\(([^()]+)\\)\\s*$/);\n return match?.[1]?.trim() || null;\n}\n\n/**\n * The query providers the profile schema says can read this connection type,\n * most specific first, or empty when nothing can read it.\n *\n * The authority is the schema the server already ships: the connection field's\n * lookup scope carries provider → connection types, so inverting it here keeps\n * one mapping rather than a client-side duplicate that can drift.\n */\nexport function providerTypesForConnectionType(\n connectionType: string,\n): string[] {\n const scope = providerConnectionScope();\n const candidates = Object.keys(scope)\n .filter((provider) => scope[provider]?.includes(connectionType))\n .sort();\n if (candidates.length <= 1) return candidates;\n // A provider keyed exactly as the connection type is the one named for it.\n const exact = candidates.find((provider) => provider === connectionType);\n if (exact) return [exact];\n // Otherwise drop the dialect-agnostic umbrella, so `sql_server` resolves to\n // `sqlserver` instead of tying with the generic `sql`. A genuine tie —\n // `google_cloud`, read by both `gcpcloudlogging` and `bigquery` — survives as\n // a list for the caller to disambiguate.\n const specific = candidates.filter((provider) => provider !== \"sql\");\n return specific.length === 1 ? specific : candidates;\n}\n\nfunction providerConnectionScope(): Record<string, string[]> {\n const provider = profileSchema().properties?.provider as\n | JsonSchemaObject\n | undefined;\n const connection = provider?.properties?.connection as\n | JsonSchemaObject\n | undefined;\n const lookup = connection?.[\"x-clicky-lookup\"] as\n | { scope?: { map?: unknown } }\n | undefined;\n const map = lookup?.scope?.map;\n if (!map || typeof map !== \"object\") {\n throw new Error(\n \"profile schema is missing provider.connection x-clicky-lookup.scope.map — the wizard cannot resolve a provider for a connection without it\",\n );\n }\n return map as Record<string, string[]>;\n}\n\nexport function profileConnectionID(value: string): string | null {\n const prefix = \"connection://\";\n if (!value.startsWith(prefix)) return null;\n return value.slice(prefix.length).trim() || null;\n}\n\nexport function profileWizardErrorMessage(\n error: unknown,\n fallback: string,\n): string {\n return error instanceof Error && error.message.trim()\n ? error.message.trim()\n : fallback;\n}\n\n/**\n * A profile says what to fetch either as a raw query or as a structured search\n * specification — never both, which is why this is an either/or rather than a\n * check on `query` alone.\n */\nexport function profileWizardHasQuery(draft: ProfileWizardDraft): boolean {\n return Boolean(\n draft.query?.trim() || draft.provider?.options?.search !== undefined,\n );\n}\n\nexport function profileWizardStepReady(\n step: (typeof profileWizardSteps)[number][\"id\"],\n draft: ProfileWizardDraft,\n discovered: ProfileColumn[],\n): boolean {\n if (step === \"source\") {\n return Boolean(draft.provider?.connection && draft.provider.type);\n }\n if (step === \"query\") {\n return Boolean(profileWizardHasQuery(draft) && discovered.length > 0);\n }\n if (step === \"fields\") {\n return Boolean(draft.profile?.trim() && draft.columns?.length);\n }\n return (\n Boolean(draft.profile?.trim() && draft.provider?.connection) &&\n discovered.length > 0\n );\n}\n"],"names":["profileSchema"],"mappings":";;;AA8CO,SAAS,WAA6B,OAAU,OAAoB;AACzE,QAAM,OAAO,EAAE,GAAG,MAAA;AAClB,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAChD,QAAI,UAAU,OAAW,QAAO,KAAK,GAAc;AAAA,QAC9C,MAAK,GAAc,IAAI;AAAA,EAC9B;AACA,SAAO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;AAG7C,QAAM,cAAa,0CAAU,eAAV,mBAAsB;AAGzC,QAAM,SAAS,yCAAa;AAG5B,QAAM,OAAM,sCAAQ,UAAR,mBAAe;AAC3B,MAAI,CAAC,OAAO,OAAO,QAAQ,UAAU;AACnC,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACA,SAAO;AACT;AAEO,SAAS,oBAAoB,OAA8B;AAChE,QAAM,SAAS;AACf,MAAI,CAAC,MAAM,WAAW,MAAM,EAAG,QAAO;AACtC,SAAO,MAAM,MAAM,OAAO,MAAM,EAAE,UAAU;AAC9C;AAEO,SAAS,0BACd,OACA,UACQ;AACR,SAAO,iBAAiB,SAAS,MAAM,QAAQ,SAC3C,MAAM,QAAQ,KAAA,IACd;AACN;AAOO,SAAS,sBAAsB,OAAoC;;AACxE,SAAO;AAAA,MACL,WAAM,UAAN,mBAAa,aAAU,iBAAM,aAAN,mBAAgB,YAAhB,mBAAyB,YAAW;AAAA,EAAA;AAE/D;AAEO,SAAS,uBACd,MACA,OACA,YACS;;AACT,MAAI,SAAS,UAAU;AACrB,WAAO,UAAQ,WAAM,aAAN,mBAAgB,eAAc,MAAM,SAAS,IAAI;AAAA,EAClE;AACA,MAAI,SAAS,SAAS;AACpB,WAAO,QAAQ,sBAAsB,KAAK,KAAK,WAAW,SAAS,CAAC;AAAA,EACtE;AACA,MAAI,SAAS,UAAU;AACrB,WAAO,UAAQ,WAAM,YAAN,mBAAe,aAAU,WAAM,YAAN,mBAAe,OAAM;AAAA,EAC/D;AACA,SACE,UAAQ,WAAM,YAAN,mBAAe,aAAU,WAAM,aAAN,mBAAgB,WAAU,KAC3D,WAAW,SAAS;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -210,6 +210,9 @@ export declare function applyVisibleFieldSelection(discovered: ProfileColumn[],
|
|
|
210
210
|
export declare const PROFILE_FILTER_KIND_OPTIONS: readonly [{
|
|
211
211
|
readonly value: "terms";
|
|
212
212
|
readonly label: "Value list";
|
|
213
|
+
}, {
|
|
214
|
+
readonly value: "match";
|
|
215
|
+
readonly label: "Pattern list";
|
|
213
216
|
}, {
|
|
214
217
|
readonly value: "exact";
|
|
215
218
|
readonly label: "Exact match";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileWizardModel.d.ts","sourceRoot":"","sources":["../../../src/profiles/wizard/profileWizardModel.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAE9E;8DAC8D;AAC9D,MAAM,MAAM,mBAAmB,GAAG;IAChC,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,gFAAgF;IAChF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,wDAAwD;IACxD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;CAAE,CAAC;AAE7D;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAOzE;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,C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,QAAQ,EAAE,MAAM,GACf,MAAM,CAIR;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAIxE;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAC/C,KAAK,EAAE,kBAAkB,EACzB,UAAU,EAAE,aAAa,EAAE,GAC1B,OAAO,CAcT"}
|
|
@@ -93,6 +93,7 @@ function applyVisibleFieldSelection(discovered, configured, visibleNames, select
|
|
|
93
93
|
}
|
|
94
94
|
const PROFILE_FILTER_KIND_OPTIONS = [
|
|
95
95
|
{ value: "terms", label: "Value list" },
|
|
96
|
+
{ value: "match", label: "Pattern list" },
|
|
96
97
|
{ value: "exact", label: "Exact match" },
|
|
97
98
|
{ value: "text", label: "Text search" },
|
|
98
99
|
{ value: "range", label: "Numeric range" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileWizardModel.js","sources":["../../../src/profiles/wizard/profileWizardModel.ts"],"sourcesContent":["import type { JsonSchemaObject } from \"../../components/json-schema-form-types\";\nimport { profileSchema } from \"../profileApi\";\nimport type { ProfileRowLimits } from \"../connections/connectionBrowserModel\";\n\n/** How a column is filtered at the backend; every field overrides an inference\n * the server would otherwise make from the column itself. */\nexport type ProfileColumnFilter = {\n /** Backend field the selection applies to; blank infers it from the column. */\n field?: string;\n /** Nested mapping containing the backend field. */\n nested?: string;\n /** Constants that pin the matching nested entry. */\n where?: Record<string, string>;\n /** terms, range, time, boolean, text or none; blank infers it from the type. */\n kind?: string;\n /** Enumerated values, replacing the backend lookup. */\n options?: string[];\n /** Ask the backend for this field's distinct values. */\n lookup?: boolean;\n /** How many of those values the control offers before the rest are typed for. */\n limit?: number;\n /** Allow several values at once. */\n multi?: boolean;\n /** Offer no filter while keeping the column rendered. */\n disabled?: boolean;\n};\n\n/**\n * A patch of T: every key optional, and explicitly settable to `undefined` to\n * clear it.\n *\n * Not Partial<T>. Under `exactOptionalPropertyTypes` an optional key may be\n * absent but not present-and-undefined, and \"clear this field\" — which is what\n * every editor control sends when its input goes empty — is precisely a present\n * `undefined`. The patch appliers drop those keys; the type has to permit them.\n */\nexport type Patch<T> = { [K in keyof T]?: T[K] | undefined };\n\n/**\n * Applies a patch, removing the keys it clears instead of leaving them present\n * and undefined.\n *\n * Spreading a patch would keep them, and these objects are serialized to the\n * server, where a present `field: undefined` is a key to interpret rather than\n * an absent one.\n */\nexport function applyPatch<T extends object>(value: T, patch: Patch<T>): T {\n const next = { ...value };\n for (const [key, entry] of Object.entries(patch)) {\n if (entry === undefined) delete next[key as keyof T];\n else next[key as keyof T] = entry as T[keyof T];\n }\n return next;\n}\n\nexport type ProfileColumn = {\n name: string;\n source?: string;\n label?: string;\n type?: string;\n kind?: string;\n format?: string;\n unit?: string;\n width?: number;\n cel?: string;\n /** Path computing the value, rooted at the row or at `source` when set. */\n jsonpath?: string;\n hidden?: boolean;\n filter?: ProfileColumnFilter;\n [key: string]: unknown;\n};\n\nexport type ProfileProvider = {\n type?: string;\n connection?: string;\n options?: Record<string, unknown>;\n [key: string]: unknown;\n};\n\n/** The parameter types the profile schema accepts. */\nexport type ParamDraftType =\n | \"string\"\n | \"number\"\n | \"boolean\"\n | \"date\"\n | \"datetime\"\n | \"duration\"\n | \"enum\"\n | \"list\";\n\n/** filter, limit, offset, time-from or time-to; empty behaves as filter. */\nexport type ParamDraftRole =\n | \"filter\"\n | \"limit\"\n | \"offset\"\n | \"time-from\"\n | \"time-to\";\n\nexport type ParamDraft = {\n name?: string | undefined;\n label?: string | undefined;\n type?: ParamDraftType | undefined;\n role?: ParamDraftRole | undefined;\n default?: unknown | undefined;\n options?: string[] | undefined;\n required?: boolean | undefined;\n description?: string | undefined;\n /** Value rewrite; {value} is the supplied value. */\n template?: string | undefined;\n /** Backend field a list parameter filters on. Setting it lets a value be\n * excluded as well as included; it requires an OpenSearch-backed provider. */\n field?: string | undefined;\n};\n\n/** PARAM_TYPES_WITH_OPTIONS are the types whose values come from a fixed set, so\n * the editor offers an options picker for them. */\nexport const PARAM_TYPES_WITH_OPTIONS: ParamDraftType[] = [\"enum\", \"list\"];\n\nexport function paramHasOptions(param: ParamDraft): boolean {\n return (\n param.type !== undefined && PARAM_TYPES_WITH_OPTIONS.includes(param.type)\n );\n}\n\nexport type ProfileWizardDraft = Record<string, unknown> & {\n namespace?: string | undefined;\n profile?: string | undefined;\n /** Overrides the sidebar/picker glyph the provider type would otherwise give. */\n icon?: string | undefined;\n provider?: ProfileProvider | undefined;\n query?: string | undefined;\n columns?: ProfileColumn[] | undefined;\n /** The inputs a run binds — by name in the query, the provider options or the\n * connection. The query workspace previews against their defaults. */\n params?: ParamDraft[] | undefined;\n /** The row caps this profile sets for itself; unset ones take their default. */\n limits?: ProfileRowLimits | undefined;\n};\n\n/**\n * A profile that caps nothing carries no block at all, so the defaults are what\n * it inherits rather than what it froze at the moment it was edited. Both draft\n * hosts write the caps through this, so neither can leave an empty map behind.\n */\nexport function withProfileLimits<T extends ProfileWizardDraft>(\n draft: T,\n limits: ProfileRowLimits | undefined,\n): T {\n const next = { ...draft };\n if (limits) next.limits = limits;\n else delete next.limits;\n return next;\n}\n\nexport type ProfileFieldFilter = {\n query: string;\n type: string;\n selection: \"all\" | \"selected\" | \"unselected\";\n};\n\nexport const PROFILE_COLUMN_FORMAT_OPTIONS = [\n { value: \"date\", label: \"Date/time\" },\n { value: \"float\", label: \"Number\" },\n { value: \"duration\", label: \"Duration\" },\n { value: \"bytes\", label: \"Bytes\" },\n { value: \"currency\", label: \"Currency\" },\n] as const;\n\nexport const PROFILE_COLUMN_UNIT_OPTIONS = [\n { value: \"none\", label: \"Compact count\" },\n { value: \"short\", label: \"Short number\" },\n { value: \"percent\", label: \"Percent (0-100)\" },\n { value: \"percentunit\", label: \"Percent (0-1)\" },\n { value: \"bytes\", label: \"Bytes (IEC)\" },\n { value: \"decbytes\", label: \"Bytes (SI)\" },\n { value: \"Bps\", label: \"Bytes/sec\" },\n { value: \"binBps\", label: \"Binary bytes/sec\" },\n { value: \"ms\", label: \"Milliseconds\" },\n { value: \"s\", label: \"Seconds\" },\n] as const;\n\nexport const profileWizardSteps = [\n { id: \"source\", label: \"Choose source\", description: \"Connection\" },\n { id: \"query\", label: \"Explore & sample\", description: \"Query\" },\n { id: \"fields\", label: \"Name & shape\", description: \"Fields\" },\n { id: \"review\", label: \"Review\", description: \"Save\" },\n] as const;\n\nexport function filterProfileFields(\n fields: ProfileColumn[],\n selectedNames: Set<string>,\n filter: ProfileFieldFilter,\n): ProfileColumn[] {\n const query = filter.query.trim().toLowerCase();\n return fields.filter((field) => {\n const selected = selectedNames.has(field.name);\n if (filter.selection === \"selected\" && !selected) return false;\n if (filter.selection === \"unselected\" && selected) return false;\n if (filter.type && field.type !== filter.type) return false;\n if (!query) return true;\n return `${field.name} ${field.label ?? \"\"}`.toLowerCase().includes(query);\n });\n}\n\n/**\n * Every field the editors can show, each in its configured form. A discovered\n * field is a snapshot of what the source reported — the configured one carries\n * the user's edits, so it is the only version safe to render into a control or\n * to patch on top of.\n *\n * The configuration owns the order, because it is the order the profile renders\n * its columns in and the one the user drags rows into. A discovered field that\n * was never configured (not selected, or dropped from the profile) has no place\n * of its own, so it keeps the one it had: it is anchored just after whichever\n * configured field preceded it in the sample.\n */\nexport function availableProfileFields(\n discovered: ProfileColumn[],\n configured: ProfileColumn[],\n): ProfileColumn[] {\n const configuredByName = new Map(\n configured.map((field) => [field.name, field]),\n );\n const configuredBySource = new Map(\n configured\n .filter((field) => field.source)\n .map((field) => [field.source as string, field]),\n );\n const ordered = [...configured];\n let anchor = 0;\n for (const field of discovered) {\n const match =\n configuredByName.get(field.name) ?? configuredBySource.get(field.name);\n if (match) {\n anchor = ordered.indexOf(match) + 1;\n continue;\n }\n ordered.splice(anchor, 0, field);\n anchor += 1;\n }\n return ordered;\n}\n\n/**\n * Moves the named column onto the target's position, shifting the columns\n * between them — the drop semantics the field grid's row drag needs. Columns\n * are addressed by name because a drag only ever carries the row's identity.\n * A name that is not configured has no position, so the order is returned\n * unchanged rather than guessed at.\n */\nexport function reorderProfileColumns(\n columns: ProfileColumn[],\n sourceName: string,\n targetName: string,\n): ProfileColumn[] {\n const from = columns.findIndex((column) => column.name === sourceName);\n const to = columns.findIndex((column) => column.name === targetName);\n if (from < 0 || to < 0 || from === to) return columns;\n const next = [...columns];\n next.splice(to, 0, ...next.splice(from, 1));\n return next;\n}\n\n/**\n * Selects or deselects the named fields, keeping the configured order intact —\n * a re-selected field returns to where the grid already showed it rather than\n * to the back of the list or to its position in the sample.\n */\nexport function applyVisibleFieldSelection(\n discovered: ProfileColumn[],\n configured: ProfileColumn[],\n visibleNames: Set<string>,\n selected: boolean,\n): ProfileColumn[] {\n const selectedNames = new Set(configured.map((field) => field.name));\n for (const name of visibleNames) {\n if (selected) selectedNames.add(name);\n else selectedNames.delete(name);\n }\n return availableProfileFields(discovered, configured).filter((field) =>\n selectedNames.has(field.name),\n );\n}\n\n/** The control kinds a column filter can render as, with the server's own\n * wording. Mirrors query.ColumnFilterKindValues() and the x-enum-labels the\n * profile schema carries for them. */\nexport const PROFILE_FILTER_KIND_OPTIONS = [\n { value: \"terms\", label: \"Value list\" },\n { value: \"exact\", label: \"Exact match\" },\n { value: \"text\", label: \"Text search\" },\n { value: \"range\", label: \"Numeric range\" },\n { value: \"duration\", label: \"Duration range\" },\n { value: \"date\", label: \"Date range\" },\n { value: \"time\", label: \"Date & time range\" },\n { value: \"boolean\", label: \"Boolean\" },\n { value: \"none\", label: \"Not filterable\" },\n] as const;\n\n/** The server's own default, so an unset limit can be shown for what it does.\n * Mirrors query.DefaultFilterLookupLimit. */\nexport const PROFILE_FILTER_DEFAULT_LIMIT = 50;\n\n/** Mirrors query.MaxFilterLookupLimit — the largest head a lookup will serve. */\nexport const PROFILE_FILTER_MAX_LIMIT = 200;\n\n/**\n * Merges one filter knob into a column's filter block, dropping the block once\n * nothing is left in it.\n *\n * The distinction matters on save: `filter: {}` is a declaration that declares\n * nothing, and the server reads a present-but-empty block differently from an\n * absent one — unchecking the last box has to mean \"infer this again\", not\n * \"override it with silence\".\n */\nexport function patchColumnFilter(\n filter: ProfileColumnFilter | undefined,\n patch: Patch<ProfileColumnFilter>,\n): ProfileColumnFilter | undefined {\n const merged = Object.fromEntries(\n Object.entries({ ...filter, ...patch }).filter(\n ([, value]) => value !== undefined,\n ),\n ) as ProfileColumnFilter;\n return Object.keys(merged).length ? merged : undefined;\n}\n\n/** What the server picks for a column that declares no filter kind. Mirrors\n * columnFilterKindFor; text and date are absent there on purpose, so they are\n * here too. Bytes stays a plain range: a size literal has two bases, so \"5MB\"\n * would mean two different numbers. */\nexport function inferredFilterKind(column: ProfileColumn): string {\n switch (column.type) {\n case \"number\":\n case \"bytes\":\n return \"range\";\n case \"duration\":\n return \"duration\";\n case \"datetime\":\n return \"time\";\n case \"boolean\":\n return \"boolean\";\n case \"uuid\":\n return \"exact\";\n case \"key_value\":\n case \"key_values\":\n case \"json\":\n return \"none\";\n default:\n return \"terms\";\n }\n}\n\nexport function patchProfileField(\n field: ProfileColumn,\n patch: Patch<ProfileColumn>,\n): ProfileColumn {\n return Object.fromEntries(\n Object.entries({ ...field, ...patch }).filter(\n ([, value]) => value !== undefined,\n ),\n ) as ProfileColumn;\n}\n\nexport function renameProfileField(\n field: ProfileColumn,\n name: string,\n): ProfileColumn {\n const source = field.source ?? (field.cel ? undefined : field.name);\n return patchProfileField(field, {\n name,\n source: source === name ? undefined : source,\n });\n}\n\n/**\n * The connection type carried in a lookup option's label.\n *\n * The server renders each option as `\"<name> (<type>)\"`, so the parenthesised\n * suffix is the **connection** type — not the query provider that reads it. The\n * two coincide often enough (`opensearch`, `loki`, `postgres`) that using one as\n * the other looks correct, and they diverge for exactly the cloud and cluster\n * log backends: an `aws` connection is read by `cloudwatch`, `kubernetes` by\n * `k8s`, `azure` by `azureloganalytics`. Resolving one to the other is\n * providerTypesForConnectionType's job, and it uses the schema rather than a\n * second copy of that mapping.\n */\nexport function connectionTypeFromLabel(label: string): string | null {\n const match = label.match(/\\(([^()]+)\\)\\s*$/);\n return match?.[1]?.trim() || null;\n}\n\n/**\n * The query providers the profile schema says can read this connection type,\n * most specific first, or empty when nothing can read it.\n *\n * The authority is the schema the server already ships: the connection field's\n * lookup scope carries provider → connection types, so inverting it here keeps\n * one mapping rather than a client-side duplicate that can drift.\n */\nexport function providerTypesForConnectionType(\n connectionType: string,\n): string[] {\n const scope = providerConnectionScope();\n const candidates = Object.keys(scope)\n .filter((provider) => scope[provider]?.includes(connectionType))\n .sort();\n if (candidates.length <= 1) return candidates;\n // A provider keyed exactly as the connection type is the one named for it.\n const exact = candidates.find((provider) => provider === connectionType);\n if (exact) return [exact];\n // Otherwise drop the dialect-agnostic umbrella, so `sql_server` resolves to\n // `sqlserver` instead of tying with the generic `sql`. A genuine tie —\n // `google_cloud`, read by both `gcpcloudlogging` and `bigquery` — survives as\n // a list for the caller to disambiguate.\n const specific = candidates.filter((provider) => provider !== \"sql\");\n return specific.length === 1 ? specific : candidates;\n}\n\nfunction providerConnectionScope(): Record<string, string[]> {\n const provider = profileSchema().properties?.provider as\n | JsonSchemaObject\n | undefined;\n const connection = provider?.properties?.connection as\n | JsonSchemaObject\n | undefined;\n const lookup = connection?.[\"x-clicky-lookup\"] as\n | { scope?: { map?: unknown } }\n | undefined;\n const map = lookup?.scope?.map;\n if (!map || typeof map !== \"object\") {\n throw new Error(\n \"profile schema is missing provider.connection x-clicky-lookup.scope.map — the wizard cannot resolve a provider for a connection without it\",\n );\n }\n return map as Record<string, string[]>;\n}\n\nexport function profileConnectionID(value: string): string | null {\n const prefix = \"connection://\";\n if (!value.startsWith(prefix)) return null;\n return value.slice(prefix.length).trim() || null;\n}\n\nexport function profileWizardErrorMessage(\n error: unknown,\n fallback: string,\n): string {\n return error instanceof Error && error.message.trim()\n ? error.message.trim()\n : fallback;\n}\n\n/**\n * A profile says what to fetch either as a raw query or as a structured search\n * specification — never both, which is why this is an either/or rather than a\n * check on `query` alone.\n */\nexport function profileWizardHasQuery(draft: ProfileWizardDraft): boolean {\n return Boolean(\n draft.query?.trim() || draft.provider?.options?.search !== undefined,\n );\n}\n\nexport function profileWizardStepReady(\n step: (typeof profileWizardSteps)[number][\"id\"],\n draft: ProfileWizardDraft,\n discovered: ProfileColumn[],\n): boolean {\n if (step === \"source\") {\n return Boolean(draft.provider?.connection && draft.provider.type);\n }\n if (step === \"query\") {\n return Boolean(profileWizardHasQuery(draft) && discovered.length > 0);\n }\n if (step === \"fields\") {\n return Boolean(draft.profile?.trim() && draft.columns?.length);\n }\n return (\n Boolean(draft.profile?.trim() && draft.provider?.connection) &&\n discovered.length > 0\n );\n}\n"],"names":[],"mappings":";AA8CO,SAAS,WAA6B,OAAU,OAAoB;AACzE,QAAM,OAAO,EAAE,GAAG,MAAA;AAClB,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAChD,QAAI,UAAU,OAAW,QAAO,KAAK,GAAc;AAAA,QAC9C,MAAK,GAAc,IAAI;AAAA,EAC9B;AACA,SAAO;AACT;AA+DO,MAAM,2BAA6C,CAAC,QAAQ,MAAM;AAElE,SAAS,gBAAgB,OAA4B;AAC1D,SACE,MAAM,SAAS,UAAa,yBAAyB,SAAS,MAAM,IAAI;AAE5E;AAsBO,SAAS,kBACd,OACA,QACG;AACH,QAAM,OAAO,EAAE,GAAG,MAAA;AAClB,MAAI,aAAa,SAAS;AAAA,cACd,KAAK;AACjB,SAAO;AACT;AAQO,MAAM,gCAAgC;AAAA,EAC3C,EAAE,OAAO,QAAQ,OAAO,YAAA;AAAA,EACxB,EAAE,OAAO,SAAS,OAAO,SAAA;AAAA,EACzB,EAAE,OAAO,YAAY,OAAO,WAAA;AAAA,EAC5B,EAAE,OAAO,SAAS,OAAO,QAAA;AAAA,EACzB,EAAE,OAAO,YAAY,OAAO,WAAA;AAC9B;AAEO,MAAM,8BAA8B;AAAA,EACzC,EAAE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AW;AAAA,EAAA;AAE/D;AAEO,SAAS,uBACd,MACA,OACA,YACS;;AACT,MAAI,SAAS,UAAU;AACrB,WAAO,UAAQ,WAAM,aAAN,mBAAgB,eAAc,MAAM,SAAS,IAAI;AAAA,EAClE;AACA,MAAI,SAAS,SAAS;AACpB,WAAO,QAAQ,sBAAsB,KAAK,KAAK,WAAW,SAAS,CAAC;AAAA,EACtE;AACA,MAAI,SAAS,UAAU;AACrB,WAAO,UAAQ,WAAM,YAAN,mBAAe,aAAU,WAAM,YAAN,mBAAe,OAAM;AAAA,EAC/D;AACA,SACE,UAAQ,WAAM,YAAN,mBAAe,aAAU,WAAM,aAAN,mBAAgB,WAAU,KAC3D,WAAW,SAAS;AAExB;"}
|
|
1
|
+
{"version":3,"file":"profileWizardModel.js","sources":["../../../src/profiles/wizard/profileWizardModel.ts"],"sourcesContent":["import type { JsonSchemaObject } from \"../../components/json-schema-form-types\";\nimport { profileSchema } from \"../profileApi\";\nimport type { ProfileRowLimits } from \"../connections/connectionBrowserModel\";\n\n/** How a column is filtered at the backend; every field overrides an inference\n * the server would otherwise make from the column itself. */\nexport type ProfileColumnFilter = {\n /** Backend field the selection applies to; blank infers it from the column. */\n field?: string;\n /** Nested mapping containing the backend field. */\n nested?: string;\n /** Constants that pin the matching nested entry. */\n where?: Record<string, string>;\n /** terms, range, time, boolean, text or none; blank infers it from the type. */\n kind?: string;\n /** Enumerated values, replacing the backend lookup. */\n options?: string[];\n /** Ask the backend for this field's distinct values. */\n lookup?: boolean;\n /** How many of those values the control offers before the rest are typed for. */\n limit?: number;\n /** Allow several values at once. */\n multi?: boolean;\n /** Offer no filter while keeping the column rendered. */\n disabled?: boolean;\n};\n\n/**\n * A patch of T: every key optional, and explicitly settable to `undefined` to\n * clear it.\n *\n * Not Partial<T>. Under `exactOptionalPropertyTypes` an optional key may be\n * absent but not present-and-undefined, and \"clear this field\" — which is what\n * every editor control sends when its input goes empty — is precisely a present\n * `undefined`. The patch appliers drop those keys; the type has to permit them.\n */\nexport type Patch<T> = { [K in keyof T]?: T[K] | undefined };\n\n/**\n * Applies a patch, removing the keys it clears instead of leaving them present\n * and undefined.\n *\n * Spreading a patch would keep them, and these objects are serialized to the\n * server, where a present `field: undefined` is a key to interpret rather than\n * an absent one.\n */\nexport function applyPatch<T extends object>(value: T, patch: Patch<T>): T {\n const next = { ...value };\n for (const [key, entry] of Object.entries(patch)) {\n if (entry === undefined) delete next[key as keyof T];\n else next[key as keyof T] = entry as T[keyof T];\n }\n return next;\n}\n\nexport type ProfileColumn = {\n name: string;\n source?: string;\n label?: string;\n type?: string;\n kind?: string;\n format?: string;\n unit?: string;\n width?: number;\n cel?: string;\n /** Path computing the value, rooted at the row or at `source` when set. */\n jsonpath?: string;\n hidden?: boolean;\n filter?: ProfileColumnFilter;\n [key: string]: unknown;\n};\n\nexport type ProfileProvider = {\n type?: string;\n connection?: string;\n options?: Record<string, unknown>;\n [key: string]: unknown;\n};\n\n/** The parameter types the profile schema accepts. */\nexport type ParamDraftType =\n | \"string\"\n | \"number\"\n | \"boolean\"\n | \"date\"\n | \"datetime\"\n | \"duration\"\n | \"enum\"\n | \"list\";\n\n/** filter, limit, offset, time-from or time-to; empty behaves as filter. */\nexport type ParamDraftRole =\n | \"filter\"\n | \"limit\"\n | \"offset\"\n | \"time-from\"\n | \"time-to\";\n\nexport type ParamDraft = {\n name?: string | undefined;\n label?: string | undefined;\n type?: ParamDraftType | undefined;\n role?: ParamDraftRole | undefined;\n default?: unknown | undefined;\n options?: string[] | undefined;\n required?: boolean | undefined;\n description?: string | undefined;\n /** Value rewrite; {value} is the supplied value. */\n template?: string | undefined;\n /** Backend field a list parameter filters on. Setting it lets a value be\n * excluded as well as included; it requires an OpenSearch-backed provider. */\n field?: string | undefined;\n};\n\n/** PARAM_TYPES_WITH_OPTIONS are the types whose values come from a fixed set, so\n * the editor offers an options picker for them. */\nexport const PARAM_TYPES_WITH_OPTIONS: ParamDraftType[] = [\"enum\", \"list\"];\n\nexport function paramHasOptions(param: ParamDraft): boolean {\n return (\n param.type !== undefined && PARAM_TYPES_WITH_OPTIONS.includes(param.type)\n );\n}\n\nexport type ProfileWizardDraft = Record<string, unknown> & {\n namespace?: string | undefined;\n profile?: string | undefined;\n /** Overrides the sidebar/picker glyph the provider type would otherwise give. */\n icon?: string | undefined;\n provider?: ProfileProvider | undefined;\n query?: string | undefined;\n columns?: ProfileColumn[] | undefined;\n /** The inputs a run binds — by name in the query, the provider options or the\n * connection. The query workspace previews against their defaults. */\n params?: ParamDraft[] | undefined;\n /** The row caps this profile sets for itself; unset ones take their default. */\n limits?: ProfileRowLimits | undefined;\n};\n\n/**\n * A profile that caps nothing carries no block at all, so the defaults are what\n * it inherits rather than what it froze at the moment it was edited. Both draft\n * hosts write the caps through this, so neither can leave an empty map behind.\n */\nexport function withProfileLimits<T extends ProfileWizardDraft>(\n draft: T,\n limits: ProfileRowLimits | undefined,\n): T {\n const next = { ...draft };\n if (limits) next.limits = limits;\n else delete next.limits;\n return next;\n}\n\nexport type ProfileFieldFilter = {\n query: string;\n type: string;\n selection: \"all\" | \"selected\" | \"unselected\";\n};\n\nexport const PROFILE_COLUMN_FORMAT_OPTIONS = [\n { value: \"date\", label: \"Date/time\" },\n { value: \"float\", label: \"Number\" },\n { value: \"duration\", label: \"Duration\" },\n { value: \"bytes\", label: \"Bytes\" },\n { value: \"currency\", label: \"Currency\" },\n] as const;\n\nexport const PROFILE_COLUMN_UNIT_OPTIONS = [\n { value: \"none\", label: \"Compact count\" },\n { value: \"short\", label: \"Short number\" },\n { value: \"percent\", label: \"Percent (0-100)\" },\n { value: \"percentunit\", label: \"Percent (0-1)\" },\n { value: \"bytes\", label: \"Bytes (IEC)\" },\n { value: \"decbytes\", label: \"Bytes (SI)\" },\n { value: \"Bps\", label: \"Bytes/sec\" },\n { value: \"binBps\", label: \"Binary bytes/sec\" },\n { value: \"ms\", label: \"Milliseconds\" },\n { value: \"s\", label: \"Seconds\" },\n] as const;\n\nexport const profileWizardSteps = [\n { id: \"source\", label: \"Choose source\", description: \"Connection\" },\n { id: \"query\", label: \"Explore & sample\", description: \"Query\" },\n { id: \"fields\", label: \"Name & shape\", description: \"Fields\" },\n { id: \"review\", label: \"Review\", description: \"Save\" },\n] as const;\n\nexport function filterProfileFields(\n fields: ProfileColumn[],\n selectedNames: Set<string>,\n filter: ProfileFieldFilter,\n): ProfileColumn[] {\n const query = filter.query.trim().toLowerCase();\n return fields.filter((field) => {\n const selected = selectedNames.has(field.name);\n if (filter.selection === \"selected\" && !selected) return false;\n if (filter.selection === \"unselected\" && selected) return false;\n if (filter.type && field.type !== filter.type) return false;\n if (!query) return true;\n return `${field.name} ${field.label ?? \"\"}`.toLowerCase().includes(query);\n });\n}\n\n/**\n * Every field the editors can show, each in its configured form. A discovered\n * field is a snapshot of what the source reported — the configured one carries\n * the user's edits, so it is the only version safe to render into a control or\n * to patch on top of.\n *\n * The configuration owns the order, because it is the order the profile renders\n * its columns in and the one the user drags rows into. A discovered field that\n * was never configured (not selected, or dropped from the profile) has no place\n * of its own, so it keeps the one it had: it is anchored just after whichever\n * configured field preceded it in the sample.\n */\nexport function availableProfileFields(\n discovered: ProfileColumn[],\n configured: ProfileColumn[],\n): ProfileColumn[] {\n const configuredByName = new Map(\n configured.map((field) => [field.name, field]),\n );\n const configuredBySource = new Map(\n configured\n .filter((field) => field.source)\n .map((field) => [field.source as string, field]),\n );\n const ordered = [...configured];\n let anchor = 0;\n for (const field of discovered) {\n const match =\n configuredByName.get(field.name) ?? configuredBySource.get(field.name);\n if (match) {\n anchor = ordered.indexOf(match) + 1;\n continue;\n }\n ordered.splice(anchor, 0, field);\n anchor += 1;\n }\n return ordered;\n}\n\n/**\n * Moves the named column onto the target's position, shifting the columns\n * between them — the drop semantics the field grid's row drag needs. Columns\n * are addressed by name because a drag only ever carries the row's identity.\n * A name that is not configured has no position, so the order is returned\n * unchanged rather than guessed at.\n */\nexport function reorderProfileColumns(\n columns: ProfileColumn[],\n sourceName: string,\n targetName: string,\n): ProfileColumn[] {\n const from = columns.findIndex((column) => column.name === sourceName);\n const to = columns.findIndex((column) => column.name === targetName);\n if (from < 0 || to < 0 || from === to) return columns;\n const next = [...columns];\n next.splice(to, 0, ...next.splice(from, 1));\n return next;\n}\n\n/**\n * Selects or deselects the named fields, keeping the configured order intact —\n * a re-selected field returns to where the grid already showed it rather than\n * to the back of the list or to its position in the sample.\n */\nexport function applyVisibleFieldSelection(\n discovered: ProfileColumn[],\n configured: ProfileColumn[],\n visibleNames: Set<string>,\n selected: boolean,\n): ProfileColumn[] {\n const selectedNames = new Set(configured.map((field) => field.name));\n for (const name of visibleNames) {\n if (selected) selectedNames.add(name);\n else selectedNames.delete(name);\n }\n return availableProfileFields(discovered, configured).filter((field) =>\n selectedNames.has(field.name),\n );\n}\n\n/** The control kinds a column filter can render as, with the server's own\n * wording. Mirrors query.ColumnFilterKindValues() and the x-enum-labels the\n * profile schema carries for them. */\nexport const PROFILE_FILTER_KIND_OPTIONS = [\n { value: \"terms\", label: \"Value list\" },\n { value: \"match\", label: \"Pattern list\" },\n { value: \"exact\", label: \"Exact match\" },\n { value: \"text\", label: \"Text search\" },\n { value: \"range\", label: \"Numeric range\" },\n { value: \"duration\", label: \"Duration range\" },\n { value: \"date\", label: \"Date range\" },\n { value: \"time\", label: \"Date & time range\" },\n { value: \"boolean\", label: \"Boolean\" },\n { value: \"none\", label: \"Not filterable\" },\n] as const;\n\n/** The server's own default, so an unset limit can be shown for what it does.\n * Mirrors query.DefaultFilterLookupLimit. */\nexport const PROFILE_FILTER_DEFAULT_LIMIT = 50;\n\n/** Mirrors query.MaxFilterLookupLimit — the largest head a lookup will serve. */\nexport const PROFILE_FILTER_MAX_LIMIT = 200;\n\n/**\n * Merges one filter knob into a column's filter block, dropping the block once\n * nothing is left in it.\n *\n * The distinction matters on save: `filter: {}` is a declaration that declares\n * nothing, and the server reads a present-but-empty block differently from an\n * absent one — unchecking the last box has to mean \"infer this again\", not\n * \"override it with silence\".\n */\nexport function patchColumnFilter(\n filter: ProfileColumnFilter | undefined,\n patch: Patch<ProfileColumnFilter>,\n): ProfileColumnFilter | undefined {\n const merged = Object.fromEntries(\n Object.entries({ ...filter, ...patch }).filter(\n ([, value]) => value !== undefined,\n ),\n ) as ProfileColumnFilter;\n return Object.keys(merged).length ? merged : undefined;\n}\n\n/** What the server picks for a column that declares no filter kind. Mirrors\n * columnFilterKindFor; text and date are absent there on purpose, so they are\n * here too. Bytes stays a plain range: a size literal has two bases, so \"5MB\"\n * would mean two different numbers. */\nexport function inferredFilterKind(column: ProfileColumn): string {\n switch (column.type) {\n case \"number\":\n case \"bytes\":\n return \"range\";\n case \"duration\":\n return \"duration\";\n case \"datetime\":\n return \"time\";\n case \"boolean\":\n return \"boolean\";\n case \"uuid\":\n return \"exact\";\n case \"key_value\":\n case \"key_values\":\n case \"json\":\n return \"none\";\n default:\n return \"terms\";\n }\n}\n\nexport function patchProfileField(\n field: ProfileColumn,\n patch: Patch<ProfileColumn>,\n): ProfileColumn {\n return Object.fromEntries(\n Object.entries({ ...field, ...patch }).filter(\n ([, value]) => value !== undefined,\n ),\n ) as ProfileColumn;\n}\n\nexport function renameProfileField(\n field: ProfileColumn,\n name: string,\n): ProfileColumn {\n const source = field.source ?? (field.cel ? undefined : field.name);\n return patchProfileField(field, {\n name,\n source: source === name ? undefined : source,\n });\n}\n\n/**\n * The connection type carried in a lookup option's label.\n *\n * The server renders each option as `\"<name> (<type>)\"`, so the parenthesised\n * suffix is the **connection** type — not the query provider that reads it. The\n * two coincide often enough (`opensearch`, `loki`, `postgres`) that using one as\n * the other looks correct, and they diverge for exactly the cloud and cluster\n * log backends: an `aws` connection is read by `cloudwatch`, `kubernetes` by\n * `k8s`, `azure` by `azureloganalytics`. Resolving one to the other is\n * providerTypesForConnectionType's job, and it uses the schema rather than a\n * second copy of that mapping.\n */\nexport function connectionTypeFromLabel(label: string): string | null {\n const match = label.match(/\\(([^()]+)\\)\\s*$/);\n return match?.[1]?.trim() || null;\n}\n\n/**\n * The query providers the profile schema says can read this connection type,\n * most specific first, or empty when nothing can read it.\n *\n * The authority is the schema the server already ships: the connection field's\n * lookup scope carries provider → connection types, so inverting it here keeps\n * one mapping rather than a client-side duplicate that can drift.\n */\nexport function providerTypesForConnectionType(\n connectionType: string,\n): string[] {\n const scope = providerConnectionScope();\n const candidates = Object.keys(scope)\n .filter((provider) => scope[provider]?.includes(connectionType))\n .sort();\n if (candidates.length <= 1) return candidates;\n // A provider keyed exactly as the connection type is the one named for it.\n const exact = candidates.find((provider) => provider === connectionType);\n if (exact) return [exact];\n // Otherwise drop the dialect-agnostic umbrella, so `sql_server` resolves to\n // `sqlserver` instead of tying with the generic `sql`. A genuine tie —\n // `google_cloud`, read by both `gcpcloudlogging` and `bigquery` — survives as\n // a list for the caller to disambiguate.\n const specific = candidates.filter((provider) => provider !== \"sql\");\n return specific.length === 1 ? specific : candidates;\n}\n\nfunction providerConnectionScope(): Record<string, string[]> {\n const provider = profileSchema().properties?.provider as\n | JsonSchemaObject\n | undefined;\n const connection = provider?.properties?.connection as\n | JsonSchemaObject\n | undefined;\n const lookup = connection?.[\"x-clicky-lookup\"] as\n | { scope?: { map?: unknown } }\n | undefined;\n const map = lookup?.scope?.map;\n if (!map || typeof map !== \"object\") {\n throw new Error(\n \"profile schema is missing provider.connection x-clicky-lookup.scope.map — the wizard cannot resolve a provider for a connection without it\",\n );\n }\n return map as Record<string, string[]>;\n}\n\nexport function profileConnectionID(value: string): string | null {\n const prefix = \"connection://\";\n if (!value.startsWith(prefix)) return null;\n return value.slice(prefix.length).trim() || null;\n}\n\nexport function profileWizardErrorMessage(\n error: unknown,\n fallback: string,\n): string {\n return error instanceof Error && error.message.trim()\n ? error.message.trim()\n : fallback;\n}\n\n/**\n * A profile says what to fetch either as a raw query or as a structured search\n * specification — never both, which is why this is an either/or rather than a\n * check on `query` alone.\n */\nexport function profileWizardHasQuery(draft: ProfileWizardDraft): boolean {\n return Boolean(\n draft.query?.trim() || draft.provider?.options?.search !== undefined,\n );\n}\n\nexport function profileWizardStepReady(\n step: (typeof profileWizardSteps)[number][\"id\"],\n draft: ProfileWizardDraft,\n discovered: ProfileColumn[],\n): boolean {\n if (step === \"source\") {\n return Boolean(draft.provider?.connection && draft.provider.type);\n }\n if (step === \"query\") {\n return Boolean(profileWizardHasQuery(draft) && discovered.length > 0);\n }\n if (step === \"fields\") {\n return Boolean(draft.profile?.trim() && draft.columns?.length);\n }\n return (\n Boolean(draft.profile?.trim() && draft.provider?.connection) &&\n discovered.length > 0\n );\n}\n"],"names":[],"mappings":";AA8CO,SAAS,WAA6B,OAAU,OAAoB;AACzE,QAAM,OAAO,EAAE,GAAG,MAAA;AAClB,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAChD,QAAI,UAAU,OAAW,QAAO,KAAK,GAAc;AAAA,QAC9C,MAAK,GAAc,IAAI;AAAA,EAC9B;AACA,SAAO;AACT;AA+DO,MAAM,2BAA6C,CAAC,QAAQ,MAAM;AAElE,SAAS,gBAAgB,OAA4B;AAC1D,SACE,MAAM,SAAS,UAAa,yBAAyB,SAAS,MAAM,IAAI;AAE5E;AAsBO,SAAS,kBACd,OACA,QACG;AACH,QAAM,OAAO,EAAE,GAAG,MAAA;AAClB,MAAI,aAAa,SAAS;AAAA,cACd,KAAK;AACjB,SAAO;AACT;AAQO,MAAM,gCAAgC;AAAA,EAC3C,EAAE,OAAO,QAAQ,OAAO,YAAA;AAAA,EACxB,EAAE,OAAO,SAAS,OAAO,SAAA;AAAA,EACzB,EAAE,OAAO,YAAY,OAAO,WAAA;AAAA,EAC5B,EAAE,OAAO,SAAS,OAAO,QAAA;AAAA,EACzB,EAAE,OAAO,YAAY,OAAO,WAAA;AAC9B;AAEO,MAAM,8BAA8B;AAAA,EACzC,EAAE,OAAO,QAAQ,OAAO,gBAAA;AAAA,EACxB,EAAE,OAAO,SAAS,OAAO,eAAA;AAAA,EACzB,EAAE,OAAO,WAAW,OAAO,kBAAA;AAAA,EAC3B,E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WAAO,UAAQ,WAAM,aAAN,mBAAgB,eAAc,MAAM,SAAS,IAAI;AAAA,EAClE;AACA,MAAI,SAAS,SAAS;AACpB,WAAO,QAAQ,sBAAsB,KAAK,KAAK,WAAW,SAAS,CAAC;AAAA,EACtE;AACA,MAAI,SAAS,UAAU;AACrB,WAAO,UAAQ,WAAM,YAAN,mBAAe,aAAU,WAAM,YAAN,mBAAe,OAAM;AAAA,EAC/D;AACA,SACE,UAAQ,WAAM,YAAN,mBAAe,aAAU,WAAM,aAAN,mBAAgB,WAAU,KAC3D,WAAW,SAAS;AAExB;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flanksource/clicky-ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.43",
|
|
4
4
|
"description": "Flanksource Clicky UI — React component library built on shadcn/ui with light/dark and density theming.",
|
|
5
5
|
"homepage": "https://github.com/flanksource/clicky-ui#readme",
|
|
6
6
|
"bugs": "https://github.com/flanksource/clicky-ui/issues",
|