@party-stack/ontology-devtools 0.6.1 → 0.7.0
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/README.md +195 -0
- package/lib/DisclosureSummary.d.ts +7 -0
- package/lib/DisclosureSummary.d.ts.map +1 -0
- package/lib/DisclosureSummary.js +20 -0
- package/lib/DisclosureSummary.js.map +1 -0
- package/lib/NativeQueryCode.d.ts +7 -0
- package/lib/NativeQueryCode.d.ts.map +1 -0
- package/lib/NativeQueryCode.js +35 -0
- package/lib/NativeQueryCode.js.map +1 -0
- package/lib/OntologyDevtools.d.ts +11 -49
- package/lib/OntologyDevtools.d.ts.map +1 -1
- package/lib/OntologyDevtools.js +310 -626
- package/lib/OntologyDevtools.js.map +1 -1
- package/lib/OntologyIcons.d.ts +14 -0
- package/lib/OntologyIcons.d.ts.map +1 -0
- package/lib/OntologyIcons.js +22 -0
- package/lib/OntologyIcons.js.map +1 -0
- package/lib/PanelBoundary.d.ts +10 -0
- package/lib/PanelBoundary.d.ts.map +1 -0
- package/lib/PanelBoundary.js +67 -0
- package/lib/PanelBoundary.js.map +1 -0
- package/lib/Pinned.d.ts +14 -0
- package/lib/Pinned.d.ts.map +1 -0
- package/lib/Pinned.js +142 -0
- package/lib/Pinned.js.map +1 -0
- package/lib/PinnedFamily.d.ts +13 -0
- package/lib/PinnedFamily.d.ts.map +1 -0
- package/lib/PinnedFamily.js +105 -0
- package/lib/PinnedFamily.js.map +1 -0
- package/lib/Queries.d.ts +12 -0
- package/lib/Queries.d.ts.map +1 -0
- package/lib/Queries.js +147 -0
- package/lib/Queries.js.map +1 -0
- package/lib/QueryOwners.d.ts +7 -0
- package/lib/QueryOwners.d.ts.map +1 -0
- package/lib/QueryOwners.js +46 -0
- package/lib/QueryOwners.js.map +1 -0
- package/lib/QueryPills.d.ts +17 -0
- package/lib/QueryPills.d.ts.map +1 -0
- package/lib/QueryPills.js +37 -0
- package/lib/QueryPills.js.map +1 -0
- package/lib/QueryPushdown.d.ts +26 -0
- package/lib/QueryPushdown.d.ts.map +1 -0
- package/lib/QueryPushdown.js +380 -0
- package/lib/QueryPushdown.js.map +1 -0
- package/lib/QueryTokens.d.ts +25 -0
- package/lib/QueryTokens.d.ts.map +1 -0
- package/lib/QueryTokens.js +49 -0
- package/lib/QueryTokens.js.map +1 -0
- package/lib/QueryView.d.ts +37 -0
- package/lib/QueryView.d.ts.map +1 -0
- package/lib/QueryView.js +547 -0
- package/lib/QueryView.js.map +1 -0
- package/lib/SchemaView.d.ts +8 -0
- package/lib/SchemaView.d.ts.map +1 -0
- package/lib/SchemaView.js +213 -0
- package/lib/SchemaView.js.map +1 -0
- package/lib/Storage.d.ts +17 -0
- package/lib/Storage.d.ts.map +1 -0
- package/lib/Storage.js +205 -0
- package/lib/Storage.js.map +1 -0
- package/lib/Tracing.d.ts +7 -0
- package/lib/Tracing.d.ts.map +1 -0
- package/lib/Tracing.js +344 -0
- package/lib/Tracing.js.map +1 -0
- package/lib/attribution/Highlight.d.ts +9 -0
- package/lib/attribution/Highlight.d.ts.map +1 -0
- package/lib/attribution/Highlight.js +73 -0
- package/lib/attribution/Highlight.js.map +1 -0
- package/lib/attribution/index.d.ts +12 -0
- package/lib/attribution/index.d.ts.map +1 -0
- package/lib/attribution/index.js +31 -0
- package/lib/attribution/index.js.map +1 -0
- package/lib/attribution/registry.d.ts +16 -0
- package/lib/attribution/registry.d.ts.map +1 -0
- package/lib/attribution/registry.js +31 -0
- package/lib/attribution/registry.js.map +1 -0
- package/lib/attribution/tanstack.d.ts +11 -0
- package/lib/attribution/tanstack.d.ts.map +1 -0
- package/lib/attribution/tanstack.js +81 -0
- package/lib/attribution/tanstack.js.map +1 -0
- package/lib/chrome.d.ts +9 -0
- package/lib/chrome.d.ts.map +1 -0
- package/lib/chrome.js +41 -0
- package/lib/chrome.js.map +1 -0
- package/lib/diagnostics.d.ts +15 -0
- package/lib/diagnostics.d.ts.map +1 -0
- package/lib/diagnostics.js +31 -0
- package/lib/diagnostics.js.map +1 -0
- package/lib/index.d.ts +4 -2
- package/lib/index.js +3 -2
- package/lib/plugin.d.ts +11 -0
- package/lib/plugin.d.ts.map +1 -0
- package/lib/plugin.js +62 -0
- package/lib/plugin.js.map +1 -0
- package/lib/queryIR.d.ts +9 -0
- package/lib/queryIR.d.ts.map +1 -0
- package/lib/queryIR.js +69 -0
- package/lib/queryIR.js.map +1 -0
- package/lib/replicationActivity.d.ts +52 -0
- package/lib/replicationActivity.d.ts.map +1 -0
- package/lib/replicationActivity.js +54 -0
- package/lib/replicationActivity.js.map +1 -0
- package/lib/schemaLayout.d.ts +35 -0
- package/lib/schemaLayout.d.ts.map +1 -0
- package/lib/schemaLayout.js +75 -0
- package/lib/schemaLayout.js.map +1 -0
- package/lib/styles.js +6 -0
- package/lib/styles.js.map +1 -0
- package/lib/traceTimeline.d.ts +15 -0
- package/lib/traceTimeline.d.ts.map +1 -0
- package/lib/traceTimeline.js +36 -0
- package/lib/traceTimeline.js.map +1 -0
- package/lib/traceWaterfall.d.ts +25 -0
- package/lib/traceWaterfall.d.ts.map +1 -0
- package/lib/traceWaterfall.js +70 -0
- package/lib/traceWaterfall.js.map +1 -0
- package/lib/typeDisplayName.d.ts +5 -0
- package/lib/typeDisplayName.d.ts.map +1 -0
- package/lib/typeDisplayName.js +28 -0
- package/lib/typeDisplayName.js.map +1 -0
- package/lib/types.d.ts +17 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +1 -0
- package/lib/vite/index.d.ts +18 -0
- package/lib/vite/index.d.ts.map +1 -0
- package/lib/vite/index.js +148 -0
- package/lib/vite/index.js.map +1 -0
- package/package.json +26 -9
- package/lib/styles.css +0 -2
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ObjectTypeIcon } from "./OntologyIcons.js";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/QueryTokens.tsx
|
|
4
|
+
function operandText(value, object) {
|
|
5
|
+
if (value === void 0) return "undefined";
|
|
6
|
+
if (value === null) return "null";
|
|
7
|
+
if (typeof value === "object" && "_tag" in value && value._tag === "Field" && "path" in value) return value.path.map((part, index) => index === 0 ? object?.properties.find((property) => property.name === part)?.displayName ?? part : part).join(".");
|
|
8
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
9
|
+
if (typeof value === "bigint") return `${value}n`;
|
|
10
|
+
if (value instanceof Date) return value.toISOString();
|
|
11
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
12
|
+
if (typeof value === "symbol") return value.toString();
|
|
13
|
+
if (typeof value === "function") return "[Function]";
|
|
14
|
+
return JSON.stringify(value);
|
|
15
|
+
}
|
|
16
|
+
function nullOrderLabel(order) {
|
|
17
|
+
const defaultNulls = order.direction === "desc" ? "last" : "first";
|
|
18
|
+
return order.nulls && order.nulls !== defaultNulls ? ` · nulls ${order.nulls}` : "";
|
|
19
|
+
}
|
|
20
|
+
function OperandToken({ value, object, pattern = false }) {
|
|
21
|
+
const field = typeof value === "object" && value !== null && "_tag" in value && value._tag === "Field";
|
|
22
|
+
return /* @__PURE__ */ jsx("span", {
|
|
23
|
+
className: field ? "ps-query-field" : value === null || value === void 0 ? "ps-query-special" : "ps-query-literal",
|
|
24
|
+
title: field ? `Field: ${operandText(value)}` : value === void 0 ? "Missing field or JavaScript undefined; distinct from null" : value === null ? "Explicit null value; distinct from an undefined field" : void 0,
|
|
25
|
+
children: pattern && typeof value === "string" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26
|
+
"\"",
|
|
27
|
+
value.split(/([%_])/u).map((part, index) => part === "%" || part === "_" ? /* @__PURE__ */ jsx("span", {
|
|
28
|
+
className: "ps-query-wildcard",
|
|
29
|
+
title: part === "%" ? "Any sequence of characters" : "One character",
|
|
30
|
+
children: part
|
|
31
|
+
}, index) : /* @__PURE__ */ jsx("span", { children: JSON.stringify(part).slice(1, -1) }, index)),
|
|
32
|
+
"\""
|
|
33
|
+
] }) : operandText(value, object)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function QuerySubject({ object, objectType }) {
|
|
37
|
+
if (!object && !objectType) return null;
|
|
38
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
39
|
+
className: "ps-query-subject",
|
|
40
|
+
children: [object && /* @__PURE__ */ jsx(ObjectTypeIcon, {
|
|
41
|
+
className: "ps-query-object-icon",
|
|
42
|
+
objectType: object
|
|
43
|
+
}), /* @__PURE__ */ jsx("strong", { children: object?.pluralDisplayName ?? objectType })]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { OperandToken, QuerySubject, nullOrderLabel, operandText };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=QueryTokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryTokens.js","names":[],"sources":["../src/QueryTokens.tsx"],"sourcesContent":["import { ObjectTypeIcon } from \"./OntologyIcons.js\";\nimport type { Demand } from \"./diagnostics.js\";\nimport type { ObjectTypeDef } from \"@party-stack/ontology\";\n\ntype Query = NonNullable<Demand[\"query\"]>;\ntype Predicate = NonNullable<Query[\"where\"]>;\nexport type QueryOperand = Extract<Predicate, { left: unknown }>[\"left\"];\n\nexport function operandText(value: unknown, object?: ObjectTypeDef): string {\n if (value === undefined) return \"undefined\";\n if (value === null) return \"null\";\n if (typeof value === \"object\" && \"_tag\" in value && value._tag === \"Field\" && \"path\" in value)\n return (value.path as string[])\n .map((part, index) =>\n index === 0\n ? (object?.properties.find((property) => property.name === part)?.displayName ?? part)\n : part\n )\n .join(\".\");\n if (typeof value === \"string\") return JSON.stringify(value);\n if (typeof value === \"bigint\") return `${value}n`;\n if (value instanceof Date) return value.toISOString();\n if (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n if (typeof value === \"symbol\") return value.toString();\n if (typeof value === \"function\") return \"[Function]\";\n return JSON.stringify(value);\n}\n\nexport function nullOrderLabel(order: { direction?: string; nulls?: string }): string {\n const defaultNulls = order.direction === \"desc\" ? \"last\" : \"first\";\n return order.nulls && order.nulls !== defaultNulls ? ` · nulls ${order.nulls}` : \"\";\n}\n\nexport function OperandToken({\n value,\n object,\n pattern = false,\n}: {\n value: unknown;\n object?: ObjectTypeDef;\n pattern?: boolean;\n}) {\n const field = typeof value === \"object\" && value !== null && \"_tag\" in value && value._tag === \"Field\";\n const special = value === null || value === undefined;\n return (\n <span\n className={field ? \"ps-query-field\" : special ? \"ps-query-special\" : \"ps-query-literal\"}\n title={\n field\n ? `Field: ${operandText(value)}`\n : value === undefined\n ? \"Missing field or JavaScript undefined; distinct from null\"\n : value === null\n ? \"Explicit null value; distinct from an undefined field\"\n : undefined\n }\n >\n {pattern && typeof value === \"string\" ? (\n <>\n "\n {value.split(/([%_])/u).map((part, index) =>\n part === \"%\" || part === \"_\" ? (\n <span\n className=\"ps-query-wildcard\"\n title={part === \"%\" ? \"Any sequence of characters\" : \"One character\"}\n key={index}\n >\n {part}\n </span>\n ) : (\n <span key={index}>{JSON.stringify(part).slice(1, -1)}</span>\n )\n )}\n "\n </>\n ) : (\n operandText(value, object)\n )}\n </span>\n );\n}\n\nexport function QuerySubject({ object, objectType }: { object?: ObjectTypeDef; objectType?: string }) {\n if (!object && !objectType) return null;\n return (\n <span className=\"ps-query-subject\">\n {object && <ObjectTypeIcon className=\"ps-query-object-icon\" objectType={object} />}\n <strong>{object?.pluralDisplayName ?? objectType}</strong>\n </span>\n );\n}\n"],"mappings":";;;AAQA,SAAgB,YAAY,OAAgB,QAAgC;CACxE,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,IAAI,UAAU,MAAM,OAAO;CAC3B,IAAI,OAAO,UAAU,YAAY,UAAU,SAAS,MAAM,SAAS,WAAW,UAAU,OACpF,OAAQ,MAAM,KACT,KAAK,MAAM,UACR,UAAU,IACH,QAAQ,WAAW,MAAM,aAAa,SAAS,SAAS,IAAI,CAAC,EAAE,eAAe,OAC/E,IACV,CAAC,CACA,KAAK,GAAG;CACjB,IAAI,OAAO,UAAU,UAAU,OAAO,KAAK,UAAU,KAAK;CAC1D,IAAI,OAAO,UAAU,UAAU,OAAO,GAAG,MAAM;CAC/C,IAAI,iBAAiB,MAAM,OAAO,MAAM,YAAY;CACpD,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW,OAAO,OAAO,KAAK;CAChF,IAAI,OAAO,UAAU,UAAU,OAAO,MAAM,SAAS;CACrD,IAAI,OAAO,UAAU,YAAY,OAAO;CACxC,OAAO,KAAK,UAAU,KAAK;AAC/B;AAEA,SAAgB,eAAe,OAAuD;CAClF,MAAM,eAAe,MAAM,cAAc,SAAS,SAAS;CAC3D,OAAO,MAAM,SAAS,MAAM,UAAU,eAAe,YAAY,MAAM,UAAU;AACrF;AAEA,SAAgB,aAAa,EACzB,OACA,QACA,UAAU,SAKX;CACC,MAAM,QAAQ,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,SAAS,MAAM,SAAS;CAE/F,OACI,oBAAC,QAAD;EACI,WAAW,QAAQ,mBAHX,UAAU,QAAQ,UAAU,KAAA,IAGY,qBAAqB;EACrE,OACI,QACM,UAAU,YAAY,KAAK,MAC3B,UAAU,KAAA,IACR,8DACA,UAAU,OACR,0DACA,KAAA;EAGb,UAAA,WAAW,OAAO,UAAU,WACzB,qBAAA,UAAA,EAAA,UAAA;GAAE;GAEG,MAAM,MAAM,SAAS,CAAC,CAAC,KAAK,MAAM,UAC/B,SAAS,OAAO,SAAS,MACrB,oBAAC,QAAD;IACI,WAAU;IACV,OAAO,SAAS,MAAM,+BAA+B;IAGpD,UAAA;GACC,GAHG,KAGH,IAEN,oBAAC,QAAD,EAAA,UAAmB,KAAK,UAAU,IAAI,CAAC,CAAC,MAAM,GAAG,EAAE,EAAQ,GAAhD,KAAgD,CAEnE;GAAE;EAEJ,EAAA,CAAA,IAEF,YAAY,OAAO,MAAM;CAE3B,CAAA;AAEd;AAEA,SAAgB,aAAa,EAAE,QAAQ,cAA+D;CAClG,IAAI,CAAC,UAAU,CAAC,YAAY,OAAO;CACnC,OACI,qBAAC,QAAD;EAAM,WAAU;EAAhB,UAAA,CACK,UAAU,oBAAC,gBAAD;GAAgB,WAAU;GAAuB,YAAY;EAAS,CAAA,GACjF,oBAAC,UAAD,EAAA,UAAS,QAAQ,qBAAqB,WAAmB,CAAA,CACvD;;AAEd"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Load } from "./diagnostics.js";
|
|
2
|
+
import { Expression, ObjectTypeDef, OntologyIR, Query, QueryDocument } from "@party-stack/ontology";
|
|
3
|
+
//#region src/QueryView.d.ts
|
|
4
|
+
type Scope = Readonly<Record<string, ObjectTypeDef | undefined>>;
|
|
5
|
+
type Annotations = NonNullable<Load["pushdown"]>["predicates"];
|
|
6
|
+
interface ExpressionProps {
|
|
7
|
+
expression: Expression;
|
|
8
|
+
scope?: Scope;
|
|
9
|
+
ir?: OntologyIR;
|
|
10
|
+
compactBinding?: string;
|
|
11
|
+
annotations?: Annotations;
|
|
12
|
+
path?: readonly number[];
|
|
13
|
+
pattern?: boolean;
|
|
14
|
+
showFields?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** All portable expression variants retain their structure, including correlated queries. */
|
|
17
|
+
export declare function QueryExpression({ expression, scope, ir, compactBinding, annotations, path, pattern, showFields }: ExpressionProps): import("react").JSX.Element;
|
|
18
|
+
export declare function QueryView({ query, ir, object, scope, label, cardinality, compact, showSubject, showFields, annotations }: {
|
|
19
|
+
query: Query;
|
|
20
|
+
ir?: OntologyIR;
|
|
21
|
+
object?: ObjectTypeDef;
|
|
22
|
+
scope?: Scope;
|
|
23
|
+
label?: string;
|
|
24
|
+
cardinality?: "one" | "many";
|
|
25
|
+
compact?: boolean;
|
|
26
|
+
showSubject?: boolean;
|
|
27
|
+
showFields?: boolean;
|
|
28
|
+
annotations?: Annotations;
|
|
29
|
+
}): import("react").JSX.Element;
|
|
30
|
+
export declare function QueryDocumentView({ query, ir, showFields }: {
|
|
31
|
+
query: QueryDocument;
|
|
32
|
+
ir: OntologyIR;
|
|
33
|
+
showFields?: boolean;
|
|
34
|
+
}): import("react").JSX.Element;
|
|
35
|
+
//#endregion
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=QueryView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryView.d.ts","names":[],"sources":["../src/QueryView.tsx"],"mappings":";;;KAiBK,QAAQ,SAAS,eAAe;KAChC,cAAc,YAAY;UACrB;EACN,YAAY;EACZ,QAAQ;EACR,KAAK;EACL;EACA,cAAc;EACd;EACA;EACA;;;wBA2CY,kBACZ,YACA,OACA,IACA,gBACA,aACA,MACA,SACA,cACD,kCAAe,IAAA;wBAkUF,YACZ,OACA,IACA,QACA,OACA,OACA,aACA,SACA,aACA,YACA;EAEA,OAAO;EACP,KAAK;EACL,SAAS;EACT,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA,cAAc;oBACjB,IAAA;wBAyHe,oBACZ,OACA,IACA;EAEA,OAAO;EACP,IAAI;EACJ;oBACH,IAAA"}
|
package/lib/QueryView.js
ADDED
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
import { DisclosureSummary } from "./DisclosureSummary.js";
|
|
2
|
+
import { ObjectTypeIcon } from "./OntologyIcons.js";
|
|
3
|
+
import { typeDisplayName } from "./typeDisplayName.js";
|
|
4
|
+
import { OperandToken, QuerySubject, nullOrderLabel } from "./QueryTokens.js";
|
|
5
|
+
import { Link2 } from "lucide-react";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Fragment as Fragment$1 } from "react";
|
|
8
|
+
import { isRelatedFromForeignKeySource, resolveRelatedLink } from "@party-stack/ontology/utils";
|
|
9
|
+
//#region src/QueryView.tsx
|
|
10
|
+
const operators = {
|
|
11
|
+
eq: "=",
|
|
12
|
+
ne: "≠",
|
|
13
|
+
lt: "<",
|
|
14
|
+
lte: "≤",
|
|
15
|
+
gt: ">",
|
|
16
|
+
gte: "≥",
|
|
17
|
+
in: "in",
|
|
18
|
+
contains: "contains",
|
|
19
|
+
like: "matches",
|
|
20
|
+
ilike: "matches (ignore case)",
|
|
21
|
+
add: "+",
|
|
22
|
+
subtract: "−",
|
|
23
|
+
multiply: "×",
|
|
24
|
+
divide: "÷"
|
|
25
|
+
};
|
|
26
|
+
function isBinary(expression) {
|
|
27
|
+
return expression.kind in operators;
|
|
28
|
+
}
|
|
29
|
+
const executionLabels = {
|
|
30
|
+
source: "Pushed down",
|
|
31
|
+
candidate: "Approximate pushdown",
|
|
32
|
+
adapter: "Not pushed down",
|
|
33
|
+
engine: "Not pushed down"
|
|
34
|
+
};
|
|
35
|
+
const executionDescriptions = {
|
|
36
|
+
source: "Translated to a native source condition; the adapter may also verify returned rows.",
|
|
37
|
+
candidate: "The source narrows candidates; the adapter evaluates the exact condition.",
|
|
38
|
+
engine: "Evaluated by the query engine after loading candidates.",
|
|
39
|
+
adapter: "Evaluated in the adapter; this condition was not sent to the source."
|
|
40
|
+
};
|
|
41
|
+
function fieldPath(expression) {
|
|
42
|
+
if (expression.kind !== "getAt") return {
|
|
43
|
+
root: expression,
|
|
44
|
+
path: []
|
|
45
|
+
};
|
|
46
|
+
const parent = fieldPath(expression.value.source);
|
|
47
|
+
return {
|
|
48
|
+
root: parent.root,
|
|
49
|
+
path: [...parent.path, ...expression.value.path]
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** All portable expression variants retain their structure, including correlated queries. */
|
|
53
|
+
function QueryExpression({ expression, scope = {}, ir, compactBinding, annotations, path = [], pattern, showFields = true }) {
|
|
54
|
+
const child = (value, index = 0, childPattern = false) => /* @__PURE__ */ jsx(QueryExpression, {
|
|
55
|
+
expression: value,
|
|
56
|
+
scope,
|
|
57
|
+
ir,
|
|
58
|
+
compactBinding,
|
|
59
|
+
annotations,
|
|
60
|
+
path: [...path, index],
|
|
61
|
+
pattern: childPattern,
|
|
62
|
+
showFields
|
|
63
|
+
});
|
|
64
|
+
if (expression.kind === "literal") {
|
|
65
|
+
const value = expression.value.value;
|
|
66
|
+
if (Array.isArray(value)) return /* @__PURE__ */ jsxs("div", {
|
|
67
|
+
className: "ps-query-values",
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ jsx("span", {
|
|
70
|
+
className: "ps-query-operator",
|
|
71
|
+
children: "["
|
|
72
|
+
}),
|
|
73
|
+
value.map((item, index) => /* @__PURE__ */ jsx(QueryExpression, { expression: {
|
|
74
|
+
kind: "literal",
|
|
75
|
+
value: { value: item }
|
|
76
|
+
} }, index)),
|
|
77
|
+
/* @__PURE__ */ jsx("span", {
|
|
78
|
+
className: "ps-query-operator",
|
|
79
|
+
children: "]"
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
if (value !== null && typeof value === "object" && !(value instanceof Date)) return /* @__PURE__ */ jsx("div", {
|
|
84
|
+
className: "ps-query-branches",
|
|
85
|
+
children: Object.entries(value).map(([name, item]) => /* @__PURE__ */ jsxs("div", {
|
|
86
|
+
className: "ps-query-selection",
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsx("span", {
|
|
89
|
+
className: "ps-query-output",
|
|
90
|
+
children: name
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ jsx("span", {
|
|
93
|
+
className: "ps-query-operator",
|
|
94
|
+
children: ":"
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ jsx(QueryExpression, { expression: {
|
|
97
|
+
kind: "literal",
|
|
98
|
+
value: { value: item }
|
|
99
|
+
} })
|
|
100
|
+
]
|
|
101
|
+
}, name))
|
|
102
|
+
});
|
|
103
|
+
return /* @__PURE__ */ jsx(OperandToken, {
|
|
104
|
+
value,
|
|
105
|
+
pattern
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (expression.kind === "getAt") {
|
|
109
|
+
const { root, path: fields } = fieldPath(expression);
|
|
110
|
+
if (root.kind === "localReference" || root.kind === "contextReference" || root.kind === "inputReference") {
|
|
111
|
+
const object = root.kind === "localReference" ? scope[root.value.name] : void 0;
|
|
112
|
+
const name = fields.map((field, index) => index === 0 ? object?.properties.find((property) => property.name === field)?.displayName ?? field : field).join(".");
|
|
113
|
+
const prefix = root.kind === "localReference" ? root.value.name === compactBinding ? "" : `${root.value.name}.` : `${root.kind === "inputReference" ? "input" : "context"}.${root.value.name}.`;
|
|
114
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
115
|
+
className: "ps-query-field",
|
|
116
|
+
children: [prefix, name]
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
120
|
+
className: "ps-query-comparison",
|
|
121
|
+
children: [child(expression.value.source), /* @__PURE__ */ jsxs("span", {
|
|
122
|
+
className: "ps-query-field",
|
|
123
|
+
children: [".", expression.value.path.join(".")]
|
|
124
|
+
})]
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if (expression.kind === "localReference" || expression.kind === "contextReference" || expression.kind === "inputReference") return /* @__PURE__ */ jsxs("span", {
|
|
128
|
+
className: "ps-query-field",
|
|
129
|
+
children: [expression.kind === "localReference" ? "" : expression.kind === "contextReference" ? "context." : "input.", expression.value.name]
|
|
130
|
+
});
|
|
131
|
+
if (expression.kind === "and" || expression.kind === "or" || expression.kind === "not") {
|
|
132
|
+
const terms = expression.kind === "not" ? [expression.value.expression] : expression.value.expressions;
|
|
133
|
+
if (!terms.length) return /* @__PURE__ */ jsx("span", {
|
|
134
|
+
className: "ps-query-keyword",
|
|
135
|
+
children: expression.kind === "and" ? "All rows" : "No rows"
|
|
136
|
+
});
|
|
137
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
138
|
+
className: "ps-query-group",
|
|
139
|
+
"aria-label": expression.kind.toUpperCase(),
|
|
140
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
141
|
+
className: "ps-query-connector",
|
|
142
|
+
children: expression.kind.toUpperCase()
|
|
143
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
144
|
+
className: "ps-query-branches",
|
|
145
|
+
children: terms.map((term, index) => /* @__PURE__ */ jsx(Fragment$1, { children: child(term, index) }, index))
|
|
146
|
+
})]
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
if (isBinary(expression)) {
|
|
150
|
+
const execution = annotations?.find((annotation) => annotation.path.length === path.length && annotation.path.every((part, index) => part === path[index]))?.execution;
|
|
151
|
+
const nullish = (expression.kind === "eq" || expression.kind === "ne") && expression.value.right.kind === "literal" && (expression.value.right.value.value === null || expression.value.right.value.value === void 0);
|
|
152
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
153
|
+
className: "ps-query-comparison",
|
|
154
|
+
"data-execution": execution,
|
|
155
|
+
children: [
|
|
156
|
+
child(expression.value.left),
|
|
157
|
+
/* @__PURE__ */ jsx("span", {
|
|
158
|
+
className: "ps-query-operator",
|
|
159
|
+
children: nullish ? expression.kind === "ne" ? "is not" : "is" : operators[expression.kind]
|
|
160
|
+
}),
|
|
161
|
+
child(expression.value.right, 1, expression.kind === "like" || expression.kind === "ilike"),
|
|
162
|
+
execution && /* @__PURE__ */ jsx("span", {
|
|
163
|
+
className: "ps-query-execution-label",
|
|
164
|
+
title: executionDescriptions[execution],
|
|
165
|
+
children: executionLabels[execution]
|
|
166
|
+
})
|
|
167
|
+
]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
switch (expression.kind) {
|
|
171
|
+
case "lookup": return /* @__PURE__ */ jsxs("div", {
|
|
172
|
+
className: "ps-query-comparison",
|
|
173
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
174
|
+
className: "ps-query-operator",
|
|
175
|
+
children: "lookup"
|
|
176
|
+
}), child(expression.value.reference)]
|
|
177
|
+
});
|
|
178
|
+
case "related": return /* @__PURE__ */ jsxs("div", {
|
|
179
|
+
className: "ps-query-comparison",
|
|
180
|
+
children: [
|
|
181
|
+
child(expression.value.source),
|
|
182
|
+
/* @__PURE__ */ jsx("span", {
|
|
183
|
+
className: "ps-query-operator",
|
|
184
|
+
children: "→"
|
|
185
|
+
}),
|
|
186
|
+
/* @__PURE__ */ jsx("span", {
|
|
187
|
+
className: "ps-query-field",
|
|
188
|
+
children: expression.value.link
|
|
189
|
+
})
|
|
190
|
+
]
|
|
191
|
+
});
|
|
192
|
+
case "concat":
|
|
193
|
+
case "coalesce": return /* @__PURE__ */ jsxs("div", {
|
|
194
|
+
className: "ps-query-group",
|
|
195
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
196
|
+
className: "ps-query-connector",
|
|
197
|
+
children: expression.kind
|
|
198
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
199
|
+
className: "ps-query-branches",
|
|
200
|
+
children: expression.value.expressions.map((value, index) => /* @__PURE__ */ jsx(Fragment$1, { children: child(value, index) }, index))
|
|
201
|
+
})]
|
|
202
|
+
});
|
|
203
|
+
case "struct": return /* @__PURE__ */ jsx("div", {
|
|
204
|
+
className: "ps-query-branches",
|
|
205
|
+
children: expression.value.fields.map((field, index) => /* @__PURE__ */ jsxs("div", {
|
|
206
|
+
className: "ps-query-clause",
|
|
207
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
208
|
+
className: "ps-query-output",
|
|
209
|
+
children: field.name
|
|
210
|
+
}), child(field.value, index)]
|
|
211
|
+
}, index))
|
|
212
|
+
});
|
|
213
|
+
case "map": return /* @__PURE__ */ jsxs("div", {
|
|
214
|
+
className: "ps-query-group",
|
|
215
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
216
|
+
className: "ps-query-connector",
|
|
217
|
+
children: "map"
|
|
218
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
219
|
+
className: "ps-query-branches",
|
|
220
|
+
children: [child(expression.value.source), /* @__PURE__ */ jsxs("div", {
|
|
221
|
+
className: "ps-query-clause",
|
|
222
|
+
children: [
|
|
223
|
+
/* @__PURE__ */ jsx("span", {
|
|
224
|
+
className: "ps-query-field",
|
|
225
|
+
children: expression.value.binding
|
|
226
|
+
}),
|
|
227
|
+
/* @__PURE__ */ jsx("span", {
|
|
228
|
+
className: "ps-query-operator",
|
|
229
|
+
children: "→"
|
|
230
|
+
}),
|
|
231
|
+
/* @__PURE__ */ jsx(QueryExpression, {
|
|
232
|
+
expression: expression.value.body,
|
|
233
|
+
scope: {
|
|
234
|
+
...scope,
|
|
235
|
+
[expression.value.binding]: void 0
|
|
236
|
+
},
|
|
237
|
+
ir,
|
|
238
|
+
compactBinding
|
|
239
|
+
})
|
|
240
|
+
]
|
|
241
|
+
})]
|
|
242
|
+
})]
|
|
243
|
+
});
|
|
244
|
+
case "uuid":
|
|
245
|
+
case "now": return /* @__PURE__ */ jsxs("span", {
|
|
246
|
+
className: "ps-query-field",
|
|
247
|
+
children: [expression.kind, "()"]
|
|
248
|
+
});
|
|
249
|
+
case "case": return /* @__PURE__ */ jsxs("div", {
|
|
250
|
+
className: "ps-query-group",
|
|
251
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
252
|
+
className: "ps-query-connector",
|
|
253
|
+
children: "CASE"
|
|
254
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
255
|
+
className: "ps-query-branches",
|
|
256
|
+
children: [expression.value.branches.map((branch, index) => /* @__PURE__ */ jsxs("div", {
|
|
257
|
+
className: "ps-query-clause",
|
|
258
|
+
children: [
|
|
259
|
+
/* @__PURE__ */ jsx("span", {
|
|
260
|
+
className: "ps-query-keyword",
|
|
261
|
+
children: "when"
|
|
262
|
+
}),
|
|
263
|
+
child(branch.condition, index),
|
|
264
|
+
/* @__PURE__ */ jsx("span", {
|
|
265
|
+
className: "ps-query-keyword",
|
|
266
|
+
children: "then"
|
|
267
|
+
}),
|
|
268
|
+
child(branch.result, index)
|
|
269
|
+
]
|
|
270
|
+
}, index)), /* @__PURE__ */ jsxs("div", {
|
|
271
|
+
className: "ps-query-clause",
|
|
272
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
273
|
+
className: "ps-query-keyword",
|
|
274
|
+
children: "else"
|
|
275
|
+
}), child(expression.value.else)]
|
|
276
|
+
})]
|
|
277
|
+
})]
|
|
278
|
+
});
|
|
279
|
+
case "exists": return /* @__PURE__ */ jsxs("div", {
|
|
280
|
+
className: "ps-query-group",
|
|
281
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
282
|
+
className: "ps-query-connector",
|
|
283
|
+
children: "EXISTS"
|
|
284
|
+
}), /* @__PURE__ */ jsx(QueryView, {
|
|
285
|
+
query: expression.value.query,
|
|
286
|
+
ir,
|
|
287
|
+
scope,
|
|
288
|
+
showFields
|
|
289
|
+
})]
|
|
290
|
+
});
|
|
291
|
+
default: return expression;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
function Selections({ select, ir, scope, showFields }) {
|
|
295
|
+
const visible = select.filter((selection) => showFields || hasQueryNode(selection));
|
|
296
|
+
if (!visible.length) return null;
|
|
297
|
+
return /* @__PURE__ */ jsx("div", {
|
|
298
|
+
className: "ps-query-selections",
|
|
299
|
+
children: visible.map((selection, index) => {
|
|
300
|
+
switch (selection.kind) {
|
|
301
|
+
case "sub": return /* @__PURE__ */ jsx(QueryView, {
|
|
302
|
+
query: selection.value.query,
|
|
303
|
+
label: selection.value.name,
|
|
304
|
+
cardinality: selection.value.cardinality,
|
|
305
|
+
ir,
|
|
306
|
+
scope,
|
|
307
|
+
showFields
|
|
308
|
+
}, index);
|
|
309
|
+
case "field": return /* @__PURE__ */ jsxs("div", {
|
|
310
|
+
className: "ps-query-selection",
|
|
311
|
+
children: [
|
|
312
|
+
/* @__PURE__ */ jsx("span", {
|
|
313
|
+
className: "ps-query-output",
|
|
314
|
+
children: selection.value.name
|
|
315
|
+
}),
|
|
316
|
+
/* @__PURE__ */ jsx("span", {
|
|
317
|
+
className: "ps-query-operator",
|
|
318
|
+
children: "←"
|
|
319
|
+
}),
|
|
320
|
+
/* @__PURE__ */ jsx(QueryExpression, {
|
|
321
|
+
expression: selection.value.expression,
|
|
322
|
+
scope,
|
|
323
|
+
ir
|
|
324
|
+
})
|
|
325
|
+
]
|
|
326
|
+
}, index);
|
|
327
|
+
case "selectCase": return /* @__PURE__ */ jsxs("div", {
|
|
328
|
+
className: "ps-query-selection-case",
|
|
329
|
+
children: [selection.value.branches.map((branch, branchIndex) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
|
|
330
|
+
className: "ps-query-clause",
|
|
331
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
332
|
+
className: "ps-query-connector",
|
|
333
|
+
children: "WHEN"
|
|
334
|
+
}), /* @__PURE__ */ jsx(QueryExpression, {
|
|
335
|
+
expression: branch.condition,
|
|
336
|
+
scope,
|
|
337
|
+
ir,
|
|
338
|
+
showFields
|
|
339
|
+
})]
|
|
340
|
+
}), /* @__PURE__ */ jsx(Selections, {
|
|
341
|
+
select: branch.select,
|
|
342
|
+
ir,
|
|
343
|
+
scope,
|
|
344
|
+
showFields
|
|
345
|
+
})] }, branchIndex)), selection.value.else && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
|
|
346
|
+
className: "ps-query-connector",
|
|
347
|
+
children: "ELSE"
|
|
348
|
+
}), /* @__PURE__ */ jsx(Selections, {
|
|
349
|
+
select: selection.value.else,
|
|
350
|
+
ir,
|
|
351
|
+
scope,
|
|
352
|
+
showFields
|
|
353
|
+
})] })]
|
|
354
|
+
}, index);
|
|
355
|
+
}
|
|
356
|
+
})
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function hasQueryNode(selection) {
|
|
360
|
+
return selection.kind === "sub" || selection.kind === "selectCase" && (selection.value.branches.some((branch) => branch.select.some(hasQueryNode)) || (selection.value.else?.some(hasQueryNode) ?? false));
|
|
361
|
+
}
|
|
362
|
+
function QueryView({ query, ir, object, scope = {}, label, cardinality, compact = false, showSubject = true, showFields = true, annotations }) {
|
|
363
|
+
const relation = query.from.source.related;
|
|
364
|
+
const owner = relation?.source.kind === "localReference" ? scope[relation.source.value.name] : void 0;
|
|
365
|
+
const link = ir && owner && relation && resolveRelatedLink(ir, owner.name, relation.link);
|
|
366
|
+
const endpoint = link && owner && relation ? isRelatedFromForeignKeySource(link, owner.name, relation.link) ? link.target : link.source : void 0;
|
|
367
|
+
const target = endpoint?.objectType ?? query.from.source.objectType;
|
|
368
|
+
const type = object ?? ir?.objectTypes.find((type) => type.name === target);
|
|
369
|
+
const bindings = {
|
|
370
|
+
...scope,
|
|
371
|
+
[query.from.binding]: type
|
|
372
|
+
};
|
|
373
|
+
const expressionProps = {
|
|
374
|
+
scope: bindings,
|
|
375
|
+
ir,
|
|
376
|
+
compactBinding: compact ? query.from.binding : void 0,
|
|
377
|
+
showFields
|
|
378
|
+
};
|
|
379
|
+
const subject = showSubject && /* @__PURE__ */ jsx(QuerySubject, {
|
|
380
|
+
object: type,
|
|
381
|
+
objectType: target ?? "Related objects"
|
|
382
|
+
});
|
|
383
|
+
const clauses = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
384
|
+
relation && /* @__PURE__ */ jsxs("div", {
|
|
385
|
+
className: "ps-query-relation",
|
|
386
|
+
children: [
|
|
387
|
+
/* @__PURE__ */ jsx("span", {
|
|
388
|
+
className: "ps-query-keyword",
|
|
389
|
+
children: "From"
|
|
390
|
+
}),
|
|
391
|
+
/* @__PURE__ */ jsxs("span", {
|
|
392
|
+
className: "ps-query-relation-origin",
|
|
393
|
+
children: [owner && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ObjectTypeIcon, {
|
|
394
|
+
className: "ps-query-object-icon",
|
|
395
|
+
objectType: owner
|
|
396
|
+
}), /* @__PURE__ */ jsx("span", { children: owner.displayName ?? owner.name })] }), /* @__PURE__ */ jsx(QueryExpression, {
|
|
397
|
+
expression: relation.source,
|
|
398
|
+
scope,
|
|
399
|
+
ir
|
|
400
|
+
})]
|
|
401
|
+
}),
|
|
402
|
+
/* @__PURE__ */ jsx("span", {
|
|
403
|
+
className: "ps-query-keyword",
|
|
404
|
+
children: "via"
|
|
405
|
+
}),
|
|
406
|
+
/* @__PURE__ */ jsxs("span", {
|
|
407
|
+
className: "ps-query-link",
|
|
408
|
+
title: relation.source.kind === "localReference" ? `${relation.source.value.name}.${relation.link}${target ? ` → ${target}` : ""}` : relation.link,
|
|
409
|
+
children: [/* @__PURE__ */ jsx(Link2, {
|
|
410
|
+
size: 13,
|
|
411
|
+
"aria-hidden": true
|
|
412
|
+
}), endpoint?.displayName ?? relation.link]
|
|
413
|
+
})
|
|
414
|
+
]
|
|
415
|
+
}),
|
|
416
|
+
query.where ? /* @__PURE__ */ jsxs("div", {
|
|
417
|
+
className: compact ? "ps-query-sentence" : "ps-query-clause",
|
|
418
|
+
children: [
|
|
419
|
+
compact && subject,
|
|
420
|
+
/* @__PURE__ */ jsx("span", {
|
|
421
|
+
className: "ps-query-keyword",
|
|
422
|
+
children: "where"
|
|
423
|
+
}),
|
|
424
|
+
/* @__PURE__ */ jsx(QueryExpression, {
|
|
425
|
+
...expressionProps,
|
|
426
|
+
expression: query.where,
|
|
427
|
+
annotations
|
|
428
|
+
})
|
|
429
|
+
]
|
|
430
|
+
}) : !relation ? /* @__PURE__ */ jsxs("div", {
|
|
431
|
+
className: "ps-query-sentence",
|
|
432
|
+
children: [compact && subject, /* @__PURE__ */ jsx("span", {
|
|
433
|
+
className: "ps-query-keyword",
|
|
434
|
+
children: compact && showSubject ? "— all rows" : "All rows"
|
|
435
|
+
})]
|
|
436
|
+
}) : null,
|
|
437
|
+
query.orderBy?.map((order, index) => /* @__PURE__ */ jsxs("div", {
|
|
438
|
+
className: "ps-query-clause",
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ jsx("span", {
|
|
441
|
+
className: "ps-query-keyword",
|
|
442
|
+
children: "order by"
|
|
443
|
+
}),
|
|
444
|
+
/* @__PURE__ */ jsx(QueryExpression, {
|
|
445
|
+
...expressionProps,
|
|
446
|
+
expression: order.expression
|
|
447
|
+
}),
|
|
448
|
+
/* @__PURE__ */ jsxs("span", {
|
|
449
|
+
className: "ps-query-operator",
|
|
450
|
+
children: [order.direction === "desc" ? "descending" : "ascending", nullOrderLabel(order)]
|
|
451
|
+
})
|
|
452
|
+
]
|
|
453
|
+
}, index)),
|
|
454
|
+
query.page?.limit !== void 0 && /* @__PURE__ */ jsxs("div", {
|
|
455
|
+
className: "ps-query-clause",
|
|
456
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
457
|
+
className: "ps-query-keyword",
|
|
458
|
+
children: "limit"
|
|
459
|
+
}), /* @__PURE__ */ jsx(OperandToken, { value: query.page.limit })]
|
|
460
|
+
}),
|
|
461
|
+
query.page?.offset !== void 0 && /* @__PURE__ */ jsxs("div", {
|
|
462
|
+
className: "ps-query-clause",
|
|
463
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
464
|
+
className: "ps-query-keyword",
|
|
465
|
+
children: "offset"
|
|
466
|
+
}), /* @__PURE__ */ jsx(OperandToken, { value: query.page.offset })]
|
|
467
|
+
}),
|
|
468
|
+
query.page?.after && /* @__PURE__ */ jsxs("div", {
|
|
469
|
+
className: "ps-query-clause",
|
|
470
|
+
children: [
|
|
471
|
+
/* @__PURE__ */ jsx("span", {
|
|
472
|
+
className: "ps-query-keyword",
|
|
473
|
+
children: "after"
|
|
474
|
+
}),
|
|
475
|
+
/* @__PURE__ */ jsx(OperandToken, { value: query.page.after.key }),
|
|
476
|
+
/* @__PURE__ */ jsx("div", {
|
|
477
|
+
className: "ps-query-values",
|
|
478
|
+
children: query.page.after.values.map((value, index) => /* @__PURE__ */ jsx(OperandToken, { value }, index))
|
|
479
|
+
})
|
|
480
|
+
]
|
|
481
|
+
})
|
|
482
|
+
] });
|
|
483
|
+
if (compact) return /* @__PURE__ */ jsx("div", {
|
|
484
|
+
className: "ps-query-expression",
|
|
485
|
+
children: clauses
|
|
486
|
+
});
|
|
487
|
+
return /* @__PURE__ */ jsxs("details", {
|
|
488
|
+
className: "ps-query-node",
|
|
489
|
+
open: true,
|
|
490
|
+
children: [/* @__PURE__ */ jsxs(DisclosureSummary, { children: [
|
|
491
|
+
label && /* @__PURE__ */ jsx("span", {
|
|
492
|
+
className: "ps-query-output",
|
|
493
|
+
children: label
|
|
494
|
+
}),
|
|
495
|
+
subject,
|
|
496
|
+
/* @__PURE__ */ jsxs("span", {
|
|
497
|
+
className: "ps-query-binding",
|
|
498
|
+
children: ["as ", query.from.binding]
|
|
499
|
+
}),
|
|
500
|
+
cardinality && /* @__PURE__ */ jsx("span", {
|
|
501
|
+
className: "ps-query-cardinality",
|
|
502
|
+
children: cardinality
|
|
503
|
+
}),
|
|
504
|
+
query.from.source.ontology && /* @__PURE__ */ jsxs("span", {
|
|
505
|
+
className: "ps-query-binding",
|
|
506
|
+
children: ["in ", query.from.source.ontology]
|
|
507
|
+
})
|
|
508
|
+
] }), /* @__PURE__ */ jsxs("div", {
|
|
509
|
+
className: "ps-query-node-body",
|
|
510
|
+
children: [clauses, /* @__PURE__ */ jsx(Selections, {
|
|
511
|
+
select: query.select,
|
|
512
|
+
ir,
|
|
513
|
+
scope: bindings,
|
|
514
|
+
showFields
|
|
515
|
+
})]
|
|
516
|
+
})]
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
function QueryDocumentView({ query, ir, showFields = true }) {
|
|
520
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
521
|
+
className: "ps-query-document",
|
|
522
|
+
"aria-label": "Pinned query graph",
|
|
523
|
+
children: [query.inputs && query.inputs.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
524
|
+
className: "ps-query-input-definitions",
|
|
525
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
526
|
+
className: "ps-query-keyword",
|
|
527
|
+
children: "inputs"
|
|
528
|
+
}), query.inputs.map((input) => /* @__PURE__ */ jsxs("span", {
|
|
529
|
+
className: "ps-query-field",
|
|
530
|
+
children: [
|
|
531
|
+
input.name,
|
|
532
|
+
": ",
|
|
533
|
+
typeDisplayName(input.type)
|
|
534
|
+
]
|
|
535
|
+
}, input.name))]
|
|
536
|
+
}), /* @__PURE__ */ jsx(Selections, {
|
|
537
|
+
select: query.select,
|
|
538
|
+
ir,
|
|
539
|
+
scope: {},
|
|
540
|
+
showFields
|
|
541
|
+
})]
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
//#endregion
|
|
545
|
+
export { QueryDocumentView, QueryExpression, QueryView };
|
|
546
|
+
|
|
547
|
+
//# sourceMappingURL=QueryView.js.map
|