@party-stack/ontology-devtools 0.6.2 → 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 -50
- 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 -1
- 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 +25 -8
- package/lib/styles.css +0 -2
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
//#region src/QueryOwners.tsx
|
|
3
|
+
function QueryOwners({ owners }) {
|
|
4
|
+
if (!owners.length) return null;
|
|
5
|
+
const groups = /* @__PURE__ */ new Map();
|
|
6
|
+
for (const owner of owners) {
|
|
7
|
+
const key = JSON.stringify([owner.name, owner.source]);
|
|
8
|
+
const group = groups.get(key);
|
|
9
|
+
if (group) group.count++;
|
|
10
|
+
else groups.set(key, {
|
|
11
|
+
owner,
|
|
12
|
+
count: 1
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
const shown = [...groups.values()].slice(0, 3);
|
|
16
|
+
const remaining = owners.length - shown.reduce((total, group) => total + group.count, 0);
|
|
17
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
18
|
+
className: "ps-query-owners",
|
|
19
|
+
"aria-label": `${owners.length} ${owners.length === 1 ? "component" : "components"}`,
|
|
20
|
+
title: "Hover to highlight · click to scroll to components",
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ jsx("span", {
|
|
23
|
+
className: "ps-query-owner-label",
|
|
24
|
+
children: "Components"
|
|
25
|
+
}),
|
|
26
|
+
shown.map(({ owner, count }) => /* @__PURE__ */ jsxs("span", {
|
|
27
|
+
className: "ps-query-owner-name",
|
|
28
|
+
title: owner.source,
|
|
29
|
+
children: [owner.name, count > 1 && ` ×${count}`]
|
|
30
|
+
}, owner.id)),
|
|
31
|
+
remaining > 0 && /* @__PURE__ */ jsxs("span", {
|
|
32
|
+
className: "ps-query-owner-more",
|
|
33
|
+
children: [
|
|
34
|
+
"and ",
|
|
35
|
+
remaining,
|
|
36
|
+
" other ",
|
|
37
|
+
remaining === 1 ? "component" : "components"
|
|
38
|
+
]
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { QueryOwners };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=QueryOwners.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryOwners.js","names":[],"sources":["../src/QueryOwners.tsx"],"sourcesContent":["import type { DemandOwner } from \"./attribution/registry.js\";\n\nexport function QueryOwners({ owners }: { owners: readonly DemandOwner[] }) {\n if (!owners.length) return null;\n const groups = new Map<string, { owner: DemandOwner; count: number }>();\n for (const owner of owners) {\n const key = JSON.stringify([owner.name, owner.source]);\n const group = groups.get(key);\n if (group) group.count++;\n else groups.set(key, { owner, count: 1 });\n }\n const shown = [...groups.values()].slice(0, 3);\n const remaining = owners.length - shown.reduce((total, group) => total + group.count, 0);\n return (\n <span\n className=\"ps-query-owners\"\n aria-label={`${owners.length} ${owners.length === 1 ? \"component\" : \"components\"}`}\n title=\"Hover to highlight · click to scroll to components\"\n >\n <span className=\"ps-query-owner-label\">Components</span>\n {shown.map(({ owner, count }) => (\n <span className=\"ps-query-owner-name\" key={owner.id} title={owner.source}>\n {owner.name}\n {count > 1 && ` ×${count}`}\n </span>\n ))}\n {remaining > 0 && (\n <span className=\"ps-query-owner-more\">\n and {remaining} other {remaining === 1 ? \"component\" : \"components\"}\n </span>\n )}\n </span>\n );\n}\n"],"mappings":";;AAEA,SAAgB,YAAY,EAAE,UAA8C;CACxE,IAAI,CAAC,OAAO,QAAQ,OAAO;CAC3B,MAAM,yBAAS,IAAI,IAAmD;CACtE,KAAK,MAAM,SAAS,QAAQ;EACxB,MAAM,MAAM,KAAK,UAAU,CAAC,MAAM,MAAM,MAAM,MAAM,CAAC;EACrD,MAAM,QAAQ,OAAO,IAAI,GAAG;EAC5B,IAAI,OAAO,MAAM;OACZ,OAAO,IAAI,KAAK;GAAE;GAAO,OAAO;EAAE,CAAC;CAC5C;CACA,MAAM,QAAQ,CAAC,GAAG,OAAO,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC;CAC7C,MAAM,YAAY,OAAO,SAAS,MAAM,QAAQ,OAAO,UAAU,QAAQ,MAAM,OAAO,CAAC;CACvF,OACI,qBAAC,QAAD;EACI,WAAU;EACV,cAAY,GAAG,OAAO,OAAO,GAAG,OAAO,WAAW,IAAI,cAAc;EACpE,OAAM;EAHV,UAAA;GAKI,oBAAC,QAAD;IAAM,WAAU;IAAuB,UAAA;GAAgB,CAAA;GACtD,MAAM,KAAK,EAAE,OAAO,YACjB,qBAAC,QAAD;IAAM,WAAU;IAAqC,OAAO,MAAM;IAAlE,UAAA,CACK,MAAM,MACN,QAAQ,KAAK,KAAK,OACjB;GAHqC,GAAA,MAAM,EAG3C,CACT;GACA,YAAY,KACT,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA;KAAsC;KAC7B;KAAU;KAAQ,cAAc,IAAI,cAAc;IACrD;;EAER;;AAEd"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Demand, Load } from "./diagnostics.js";
|
|
2
|
+
import { OperandToken, QuerySubject, nullOrderLabel, operandText } from "./QueryTokens.js";
|
|
3
|
+
import { ObjectTypeDef } from "@party-stack/ontology";
|
|
4
|
+
//#region src/QueryPills.d.ts
|
|
5
|
+
type Query$1 = NonNullable<Demand["query"]>;
|
|
6
|
+
type Predicate = NonNullable<Query$1["where"]>;
|
|
7
|
+
export declare function predicateText(predicate: Predicate, object?: ObjectTypeDef): string;
|
|
8
|
+
/** Compiled demand is a compact view of the same portable query renderer. */
|
|
9
|
+
export declare function QueryPills({ query, object, objectType, annotations }: {
|
|
10
|
+
query?: Query$1;
|
|
11
|
+
object?: ObjectTypeDef;
|
|
12
|
+
objectType?: string;
|
|
13
|
+
annotations?: NonNullable<Load["pushdown"]>["predicates"];
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { OperandToken, QuerySubject, nullOrderLabel, operandText };
|
|
17
|
+
//# sourceMappingURL=QueryPills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryPills.d.ts","names":["Query"],"sources":["../src/QueryPills.tsx"],"mappings":";;;;KAOKA,UAAQ,YAAY;KACpB,YAAY,YAAYA;wBAab,cAAc,WAAW,WAAW,SAAS;;wBAmB7C,aACZ,OACA,QACA,YACA;EAEA,QAAQA;EACR,SAAS;EACT;EACA,cAAc,YAAY;oBAC7B,IAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { OperandToken, QuerySubject, nullOrderLabel, operandText } from "./QueryTokens.js";
|
|
2
|
+
import { QueryView } from "./QueryView.js";
|
|
3
|
+
import { subsetQuery } from "./queryIR.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/QueryPills.tsx
|
|
6
|
+
const operators = {
|
|
7
|
+
eq: "=",
|
|
8
|
+
ne: "≠",
|
|
9
|
+
lt: "<",
|
|
10
|
+
lte: "≤",
|
|
11
|
+
gt: ">",
|
|
12
|
+
gte: "≥",
|
|
13
|
+
like: "matches",
|
|
14
|
+
ilike: "matches (ignore case)",
|
|
15
|
+
contains: "contains"
|
|
16
|
+
};
|
|
17
|
+
function predicateText(predicate, object) {
|
|
18
|
+
if (predicate.op === "and" || predicate.op === "or") return predicate.predicates.length ? `(${predicate.predicates.map((item) => predicateText(item, object)).join(predicate.op === "and" ? " AND " : " OR ")})` : predicate.op === "and" ? "All rows" : "No rows";
|
|
19
|
+
if (predicate.op === "not") return `NOT (${predicateText(predicate.predicate, object)})`;
|
|
20
|
+
if (predicate.op === "in") return `${operandText(predicate.left, object)} in [${predicate.values.map((value) => operandText(value)).join(", ")}]`;
|
|
21
|
+
if ((predicate.op === "eq" || predicate.op === "ne") && (predicate.right === null || predicate.right === void 0)) return `${operandText(predicate.left, object)} is${predicate.op === "ne" ? " not" : ""} ${operandText(predicate.right)}`;
|
|
22
|
+
return `${operandText(predicate.left, object)} ${operators[predicate.op]} ${operandText(predicate.right, object)}`;
|
|
23
|
+
}
|
|
24
|
+
/** Compiled demand is a compact view of the same portable query renderer. */
|
|
25
|
+
function QueryPills({ query, object, objectType, annotations }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(QueryView, {
|
|
27
|
+
query: subsetQuery(objectType ?? object?.name ?? "Object", query),
|
|
28
|
+
object,
|
|
29
|
+
showSubject: Boolean(object || objectType),
|
|
30
|
+
compact: true,
|
|
31
|
+
annotations
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { OperandToken, QueryPills, QuerySubject, nullOrderLabel, operandText, predicateText };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=QueryPills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryPills.js","names":[],"sources":["../src/QueryPills.tsx"],"sourcesContent":["import { subsetQuery } from \"./queryIR.js\";\nimport { operandText } from \"./QueryTokens.js\";\nimport { QueryView } from \"./QueryView.js\";\nimport type { Demand, Load } from \"./diagnostics.js\";\nimport type { ObjectTypeDef } from \"@party-stack/ontology\";\n\nexport { operandText, nullOrderLabel, OperandToken, QuerySubject } from \"./QueryTokens.js\";\ntype Query = NonNullable<Demand[\"query\"]>;\ntype Predicate = NonNullable<Query[\"where\"]>;\nconst operators = {\n eq: \"=\",\n ne: \"≠\",\n lt: \"<\",\n lte: \"≤\",\n gt: \">\",\n gte: \"≥\",\n like: \"matches\",\n ilike: \"matches (ignore case)\",\n contains: \"contains\",\n};\n\nexport function predicateText(predicate: Predicate, object?: ObjectTypeDef): string {\n if (predicate.op === \"and\" || predicate.op === \"or\")\n return predicate.predicates.length\n ? `(${predicate.predicates.map((item) => predicateText(item, object)).join(predicate.op === \"and\" ? \" AND \" : \" OR \")})`\n : predicate.op === \"and\"\n ? \"All rows\"\n : \"No rows\";\n if (predicate.op === \"not\") return `NOT (${predicateText(predicate.predicate, object)})`;\n if (predicate.op === \"in\")\n return `${operandText(predicate.left, object)} in [${predicate.values.map((value) => operandText(value)).join(\", \")}]`;\n if (\n (predicate.op === \"eq\" || predicate.op === \"ne\") &&\n (predicate.right === null || predicate.right === undefined)\n )\n return `${operandText(predicate.left, object)} is${predicate.op === \"ne\" ? \" not\" : \"\"} ${operandText(predicate.right)}`;\n return `${operandText(predicate.left, object)} ${operators[predicate.op]} ${operandText(predicate.right, object)}`;\n}\n\n/** Compiled demand is a compact view of the same portable query renderer. */\nexport function QueryPills({\n query,\n object,\n objectType,\n annotations,\n}: {\n query?: Query;\n object?: ObjectTypeDef;\n objectType?: string;\n annotations?: NonNullable<Load[\"pushdown\"]>[\"predicates\"];\n}) {\n return (\n <QueryView\n query={subsetQuery(objectType ?? object?.name ?? \"Object\", query)}\n object={object}\n showSubject={Boolean(object || objectType)}\n compact\n annotations={annotations}\n />\n );\n}\n"],"mappings":";;;;;AASA,MAAM,YAAY;CACd,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,KAAK;CACL,IAAI;CACJ,KAAK;CACL,MAAM;CACN,OAAO;CACP,UAAU;AACd;AAEA,SAAgB,cAAc,WAAsB,QAAgC;CAChF,IAAI,UAAU,OAAO,SAAS,UAAU,OAAO,MAC3C,OAAO,UAAU,WAAW,SACtB,IAAI,UAAU,WAAW,KAAK,SAAS,cAAc,MAAM,MAAM,CAAC,CAAC,CAAC,KAAK,UAAU,OAAO,QAAQ,UAAU,MAAM,EAAE,KACpH,UAAU,OAAO,QACf,aACA;CACZ,IAAI,UAAU,OAAO,OAAO,OAAO,QAAQ,cAAc,UAAU,WAAW,MAAM,EAAE;CACtF,IAAI,UAAU,OAAO,MACjB,OAAO,GAAG,YAAY,UAAU,MAAM,MAAM,EAAE,OAAO,UAAU,OAAO,KAAK,UAAU,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;CACxH,KACK,UAAU,OAAO,QAAQ,UAAU,OAAO,UAC1C,UAAU,UAAU,QAAQ,UAAU,UAAU,KAAA,IAEjD,OAAO,GAAG,YAAY,UAAU,MAAM,MAAM,EAAE,KAAK,UAAU,OAAO,OAAO,SAAS,GAAG,GAAG,YAAY,UAAU,KAAK;CACzH,OAAO,GAAG,YAAY,UAAU,MAAM,MAAM,EAAE,GAAG,UAAU,UAAU,IAAI,GAAG,YAAY,UAAU,OAAO,MAAM;AACnH;;AAGA,SAAgB,WAAW,EACvB,OACA,QACA,YACA,eAMD;CACC,OACI,oBAAC,WAAD;EACI,OAAO,YAAY,cAAc,QAAQ,QAAQ,UAAU,KAAK;EACxD;EACR,aAAa,QAAQ,UAAU,UAAU;EACzC,SAAA;EACa;CAChB,CAAA;AAET"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReplicationDemand, ReplicationLoad } from "./replicationActivity.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { CollectionDemandDiagnostic } from "@party-stack/ontology/tanstack";
|
|
4
|
+
import { ObjectTypeDef } from "@party-stack/ontology";
|
|
5
|
+
//#region src/QueryPushdown.d.ts
|
|
6
|
+
export declare function RequestedQuery({ request, demand, object }: {
|
|
7
|
+
request: CollectionDemandDiagnostic;
|
|
8
|
+
demand: ReplicationDemand;
|
|
9
|
+
object?: ObjectTypeDef;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
export declare function QueryPushdown({ requests, demand, load, object, loadStats, loadError, parentReplica, coveredBy: checkedCoverage, coverageProof: checkedProof, previousLoad, sourceName, checking }: {
|
|
12
|
+
requests: readonly CollectionDemandDiagnostic[];
|
|
13
|
+
demand: ReplicationDemand;
|
|
14
|
+
load?: ReplicationLoad;
|
|
15
|
+
object?: ObjectTypeDef;
|
|
16
|
+
loadStats?: ReactNode;
|
|
17
|
+
loadError?: string;
|
|
18
|
+
parentReplica?: string;
|
|
19
|
+
coveredBy?: ReplicationDemand["coveredBy"];
|
|
20
|
+
coverageProof?: ReplicationDemand["coverageProof"];
|
|
21
|
+
previousLoad?: ReplicationLoad;
|
|
22
|
+
sourceName?: string;
|
|
23
|
+
checking?: boolean;
|
|
24
|
+
}): import("react").JSX.Element;
|
|
25
|
+
//#endregion
|
|
26
|
+
//# sourceMappingURL=QueryPushdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryPushdown.d.ts","names":[],"sources":["../src/QueryPushdown.tsx"],"mappings":";;;;;wBAgGgB,iBACZ,SACA,QACA;EAEA,SAAS;EACT,QAAQ;EACR,SAAS;oBACZ,IAAA;wBAiEe,gBACZ,UACA,QACA,MACA,QACA,WACA,WACA,eACA,WAAW,iBACX,eAAe,cACf,cACA,YACA;EAEA,mBAAmB;EACnB,QAAQ;EACR,OAAO;EACP,SAAS;EACT,YAAY;EACZ;EACA;EACA,YAAY;EACZ,gBAAgB;EAChB,eAAe;EACf;EACA;oBACH,IAAA"}
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { DisclosureSummary } from "./DisclosureSummary.js";
|
|
2
|
+
import { NativeQueryCode } from "./NativeQueryCode.js";
|
|
3
|
+
import { OperandToken, QuerySubject, nullOrderLabel } from "./QueryTokens.js";
|
|
4
|
+
import { demandId } from "./replicationActivity.js";
|
|
5
|
+
import { QueryPills } from "./QueryPills.js";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { IR } from "@tanstack/db";
|
|
9
|
+
//#region src/QueryPushdown.tsx
|
|
10
|
+
const operators = {
|
|
11
|
+
eq: "=",
|
|
12
|
+
gt: ">",
|
|
13
|
+
gte: "≥",
|
|
14
|
+
lt: "<",
|
|
15
|
+
lte: "≤",
|
|
16
|
+
like: "matches",
|
|
17
|
+
ilike: "matches (ignore case)",
|
|
18
|
+
in: "in"
|
|
19
|
+
};
|
|
20
|
+
function Expression({ expression, object, pattern = false }) {
|
|
21
|
+
if (expression.type === "ref") return /* @__PURE__ */ jsx(OperandToken, {
|
|
22
|
+
value: {
|
|
23
|
+
_tag: "Field",
|
|
24
|
+
path: IR.getPropRefPropertyPath(expression)
|
|
25
|
+
},
|
|
26
|
+
object
|
|
27
|
+
});
|
|
28
|
+
if (expression.type === "val") {
|
|
29
|
+
if (Array.isArray(expression.value)) return /* @__PURE__ */ jsxs("span", {
|
|
30
|
+
className: "ps-query-values",
|
|
31
|
+
children: [
|
|
32
|
+
"[",
|
|
33
|
+
expression.value.map((value, index) => /* @__PURE__ */ jsx(Expression, {
|
|
34
|
+
expression: new IR.Value(value),
|
|
35
|
+
object
|
|
36
|
+
}, index)),
|
|
37
|
+
"]"
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
if (expression.value === null || expression.value === void 0 || [
|
|
41
|
+
"string",
|
|
42
|
+
"number",
|
|
43
|
+
"boolean",
|
|
44
|
+
"bigint"
|
|
45
|
+
].includes(typeof expression.value)) return /* @__PURE__ */ jsx(OperandToken, {
|
|
46
|
+
value: expression.value,
|
|
47
|
+
object,
|
|
48
|
+
pattern
|
|
49
|
+
});
|
|
50
|
+
return /* @__PURE__ */ jsx("code", { children: JSON.stringify(expression.value) });
|
|
51
|
+
}
|
|
52
|
+
if (expression.type !== "func") return /* @__PURE__ */ jsx("span", { children: "Unknown expression" });
|
|
53
|
+
const { name, args } = expression;
|
|
54
|
+
if (name === "and" || name === "or" || name === "not") return /* @__PURE__ */ jsxs("div", {
|
|
55
|
+
className: "ps-query-group",
|
|
56
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
57
|
+
className: "ps-query-connector",
|
|
58
|
+
children: name.toUpperCase()
|
|
59
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
60
|
+
className: "ps-query-branches",
|
|
61
|
+
children: args.map((arg, index) => /* @__PURE__ */ jsx(Expression, {
|
|
62
|
+
expression: arg,
|
|
63
|
+
object
|
|
64
|
+
}, index))
|
|
65
|
+
})]
|
|
66
|
+
});
|
|
67
|
+
return /* @__PURE__ */ jsx("div", {
|
|
68
|
+
className: "ps-query-comparison",
|
|
69
|
+
children: operators[name] && args.length === 2 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
70
|
+
/* @__PURE__ */ jsx(Expression, {
|
|
71
|
+
expression: args[0],
|
|
72
|
+
object
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ jsx("span", {
|
|
75
|
+
className: "ps-query-operator",
|
|
76
|
+
children: operators[name]
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ jsx(Expression, {
|
|
79
|
+
expression: args[1],
|
|
80
|
+
object,
|
|
81
|
+
pattern: name === "like" || name === "ilike"
|
|
82
|
+
})
|
|
83
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
84
|
+
/* @__PURE__ */ jsxs("span", {
|
|
85
|
+
className: "ps-query-operator",
|
|
86
|
+
children: [name, "("]
|
|
87
|
+
}),
|
|
88
|
+
args.map((arg, index) => /* @__PURE__ */ jsxs("span", { children: [index > 0 && ", ", /* @__PURE__ */ jsx(Expression, {
|
|
89
|
+
expression: arg,
|
|
90
|
+
object
|
|
91
|
+
})] }, index)),
|
|
92
|
+
/* @__PURE__ */ jsx("span", {
|
|
93
|
+
className: "ps-query-operator",
|
|
94
|
+
children: ")"
|
|
95
|
+
})
|
|
96
|
+
] })
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function RequestedQuery({ request, demand, object }) {
|
|
100
|
+
const query = request.requested;
|
|
101
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
102
|
+
className: "ps-query-expression",
|
|
103
|
+
"aria-label": "Requested query",
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsxs("div", {
|
|
106
|
+
className: "ps-query-sentence",
|
|
107
|
+
children: [/* @__PURE__ */ jsx(QuerySubject, {
|
|
108
|
+
object,
|
|
109
|
+
objectType: demand.objectType
|
|
110
|
+
}), query?.where ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
111
|
+
className: "ps-query-keyword",
|
|
112
|
+
children: "where"
|
|
113
|
+
}), /* @__PURE__ */ jsx(Expression, {
|
|
114
|
+
expression: query.where,
|
|
115
|
+
object
|
|
116
|
+
})] }) : /* @__PURE__ */ jsx("span", {
|
|
117
|
+
className: "ps-query-keyword",
|
|
118
|
+
children: "— all rows"
|
|
119
|
+
})]
|
|
120
|
+
}),
|
|
121
|
+
query?.orderBy?.map((order, index) => /* @__PURE__ */ jsxs("div", {
|
|
122
|
+
className: "ps-query-clause",
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ jsx("span", {
|
|
125
|
+
className: "ps-query-keyword",
|
|
126
|
+
children: "order by"
|
|
127
|
+
}),
|
|
128
|
+
/* @__PURE__ */ jsx(Expression, {
|
|
129
|
+
expression: order.expression,
|
|
130
|
+
object
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ jsxs("span", {
|
|
133
|
+
className: "ps-query-operator",
|
|
134
|
+
children: [order.compareOptions.direction === "desc" ? "descending" : "ascending", nullOrderLabel(order.compareOptions)]
|
|
135
|
+
})
|
|
136
|
+
]
|
|
137
|
+
}, index)),
|
|
138
|
+
query?.limit !== void 0 && /* @__PURE__ */ jsxs("div", {
|
|
139
|
+
className: "ps-query-clause",
|
|
140
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
141
|
+
className: "ps-query-keyword",
|
|
142
|
+
children: "limit"
|
|
143
|
+
}), /* @__PURE__ */ jsx(OperandToken, { value: query.limit })]
|
|
144
|
+
}),
|
|
145
|
+
query?.offset !== void 0 && /* @__PURE__ */ jsxs("div", {
|
|
146
|
+
className: "ps-query-clause",
|
|
147
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
148
|
+
className: "ps-query-keyword",
|
|
149
|
+
children: "offset"
|
|
150
|
+
}), /* @__PURE__ */ jsx(OperandToken, { value: query.offset })]
|
|
151
|
+
}),
|
|
152
|
+
query?.cursor && /* @__PURE__ */ jsxs("div", {
|
|
153
|
+
className: "ps-query-clause",
|
|
154
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
155
|
+
className: "ps-query-keyword",
|
|
156
|
+
children: "cursor"
|
|
157
|
+
}), /* @__PURE__ */ jsx(Expression, {
|
|
158
|
+
expression: new IR.Func("or", [query.cursor.whereFrom, query.cursor.whereCurrent]),
|
|
159
|
+
object
|
|
160
|
+
})]
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function formatInterval(ms) {
|
|
166
|
+
if (ms === void 0) return "configured interval";
|
|
167
|
+
if (ms % 6e4 === 0) return `${ms / 6e4} ${ms === 6e4 ? "minute" : "minutes"}`;
|
|
168
|
+
if (ms % 1e3 === 0) return `${ms / 1e3} ${ms === 1e3 ? "second" : "seconds"}`;
|
|
169
|
+
return `${ms} ms`;
|
|
170
|
+
}
|
|
171
|
+
function StepNote({ label, children }) {
|
|
172
|
+
return /* @__PURE__ */ jsxs("p", {
|
|
173
|
+
className: "ps-query-step-note",
|
|
174
|
+
children: [
|
|
175
|
+
/* @__PURE__ */ jsxs("strong", { children: [label, ":"] }),
|
|
176
|
+
" ",
|
|
177
|
+
children
|
|
178
|
+
]
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function QueryPushdown({ requests, demand, load, object, loadStats, loadError, parentReplica, coveredBy: checkedCoverage, coverageProof: checkedProof, previousLoad, sourceName, checking = false }) {
|
|
182
|
+
const preserved = requests.every((request) => (request.filterExact ?? request.exact) === true);
|
|
183
|
+
const incompleteFilter = requests.some((request) => (request.filterExact ?? request.exact) === false);
|
|
184
|
+
const localOrder = requests.some((request) => request.orderExact === false);
|
|
185
|
+
const localLimit = requests.some((request) => request.requested?.limit !== void 0 && request.query?.limit === void 0);
|
|
186
|
+
const localSteps = [
|
|
187
|
+
incompleteFilter && "This tab filters the replica’s response to finish evaluating the query.",
|
|
188
|
+
localOrder && "This tab sorts the replica’s response.",
|
|
189
|
+
localLimit && "This tab applies the query limit to the replica’s response."
|
|
190
|
+
].filter((step) => typeof step === "string");
|
|
191
|
+
const queryId = demandId(demand);
|
|
192
|
+
const [lastCheck, setLastCheck] = useState({
|
|
193
|
+
queryId,
|
|
194
|
+
coveredBy: checkedCoverage,
|
|
195
|
+
coverageProof: checkedProof,
|
|
196
|
+
refresh: checkedProof
|
|
197
|
+
});
|
|
198
|
+
if (lastCheck.queryId !== queryId || !checking && (lastCheck.coveredBy !== checkedCoverage || lastCheck.coverageProof !== checkedProof)) setLastCheck({
|
|
199
|
+
queryId,
|
|
200
|
+
coveredBy: checkedCoverage,
|
|
201
|
+
coverageProof: checkedProof,
|
|
202
|
+
refresh: checkedProof ?? (lastCheck.queryId === queryId ? lastCheck.refresh : void 0)
|
|
203
|
+
});
|
|
204
|
+
const coveredBy = checking && lastCheck.queryId === queryId ? lastCheck.coveredBy : checkedCoverage;
|
|
205
|
+
const coverageProof = checking && lastCheck.queryId === queryId ? lastCheck.coverageProof : checkedProof;
|
|
206
|
+
const refreshProof = coverageProof ?? (lastCheck.queryId === queryId ? lastCheck.refresh : void 0);
|
|
207
|
+
const displayedLoad = load?.outcome === "running" ? previousLoad ?? load : load;
|
|
208
|
+
const plan = displayedLoad?.pushdown ?? previousLoad?.pushdown;
|
|
209
|
+
const source = plan?.source ?? sourceName ?? "Source";
|
|
210
|
+
const sourceReplica = parentReplica ? `${parentReplica} replica` : "Tab replica";
|
|
211
|
+
const reused = Boolean(coveredBy);
|
|
212
|
+
const sameQuery = coveredBy && demandId(coveredBy) === demandId(demand);
|
|
213
|
+
const coverageReason = coverageProof && {
|
|
214
|
+
collection: sameQuery ? "This query previously loaded the complete collection." : "Complete collection; includes every matching row.",
|
|
215
|
+
query: sameQuery ? "Previously loaded complete result of the same query or primary-key lookup." : "A previously loaded complete result covers this request.",
|
|
216
|
+
"primary-key": "Requested primary key is present in this maintained result."
|
|
217
|
+
}[coverageProof.reason];
|
|
218
|
+
const residualFilter = plan?.predicates.some((term) => term.execution !== "source");
|
|
219
|
+
const filterStatus = plan?.predicates.length ? plan.predicates.every((term) => term.execution === "source") ? incompleteFilter ? `Fully pushed down to ${source}; this tab still evaluates the remaining conditions.` : `Fully pushed down to ${source}.` : plan.predicates.every((term) => term.execution === "adapter" || term.execution === "engine") ? `Not pushed down to ${source}.` : `Partly pushed down to ${source}.` : (load?.subset?.query ?? demand.query)?.where ? "Pushdown not reported." : "No filter requested.";
|
|
220
|
+
const evaluator = plan?.predicates.some((term) => term.execution === "engine") || plan?.sorting === "engine" || plan?.pagination === "engine" ? "query engine" : "adapter";
|
|
221
|
+
const adapterSteps = [
|
|
222
|
+
residualFilter && `The ${evaluator} filters ${source}’s response to finish evaluating the query.`,
|
|
223
|
+
plan?.rechecksFilter && !residualFilter && load?.fetchedRows !== void 0 && load.rows !== void 0 && load.fetchedRows !== load.rows && `The ${evaluator} also checks returned rows against the filter.`,
|
|
224
|
+
(plan?.sorting === "adapter" || plan?.sorting === "engine") && `The ${evaluator} sorts the returned rows.`,
|
|
225
|
+
(plan?.pagination === "adapter" || plan?.pagination === "engine") && `The ${evaluator} applies the query limit or pagination before returning rows to the ${sourceReplica}.`
|
|
226
|
+
].filter((step) => typeof step === "string");
|
|
227
|
+
const refreshDescription = refreshProof && /* @__PURE__ */ jsx("span", {
|
|
228
|
+
className: "ps-query-refresh",
|
|
229
|
+
children: refreshProof.maintainedBy === "journal" ? "Refreshed through journal catch-up." : refreshProof.maintainedBy === "poll" ? `Refreshed by polling every ${formatInterval(refreshProof.pollIntervalMs)}.` : refreshProof.maintainedBy === "snapshot" ? "Reused a recent snapshot." : "Refreshed by source change notifications."
|
|
230
|
+
});
|
|
231
|
+
const sourceDetails = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
232
|
+
/* @__PURE__ */ jsx(StepNote, {
|
|
233
|
+
label: "Filter",
|
|
234
|
+
children: displayedLoad ? plan ? filterStatus : "Pushdown not reported." : "No pushdown recorded for this query."
|
|
235
|
+
}),
|
|
236
|
+
plan && displayedLoad && /* @__PURE__ */ jsx(QueryPills, {
|
|
237
|
+
query: displayedLoad.subset?.query ?? demand.query,
|
|
238
|
+
object,
|
|
239
|
+
annotations: plan.predicates
|
|
240
|
+
}),
|
|
241
|
+
adapterSteps.map((step) => /* @__PURE__ */ jsx("p", {
|
|
242
|
+
className: "ps-query-step-note",
|
|
243
|
+
children: step
|
|
244
|
+
}, step)),
|
|
245
|
+
/* @__PURE__ */ jsxs(StepNote, {
|
|
246
|
+
label: "Data",
|
|
247
|
+
children: [displayedLoad ? loadStats : "No source load recorded for this query.", refreshDescription && /* @__PURE__ */ jsxs(Fragment, { children: [" · ", refreshDescription] })]
|
|
248
|
+
}),
|
|
249
|
+
displayedLoad?.error && /* @__PURE__ */ jsx("p", {
|
|
250
|
+
className: "ps-query-residual",
|
|
251
|
+
children: displayedLoad.error.message
|
|
252
|
+
}),
|
|
253
|
+
plan?.native && /* @__PURE__ */ jsxs("details", {
|
|
254
|
+
className: "ps-query-native",
|
|
255
|
+
children: [/* @__PURE__ */ jsxs(DisclosureSummary, { children: [
|
|
256
|
+
"Native query (",
|
|
257
|
+
plan.native.language.toUpperCase(),
|
|
258
|
+
")"
|
|
259
|
+
] }), /* @__PURE__ */ jsx(NativeQueryCode, {
|
|
260
|
+
language: plan.native.language,
|
|
261
|
+
text: plan.native.text
|
|
262
|
+
})]
|
|
263
|
+
})
|
|
264
|
+
] });
|
|
265
|
+
const replicaOutcome = loadError ? /* @__PURE__ */ jsxs(StepNote, {
|
|
266
|
+
label: "Data",
|
|
267
|
+
children: ["Diagnostics disconnected: ", loadError]
|
|
268
|
+
}) : coveredBy ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(StepNote, {
|
|
269
|
+
label: "Data",
|
|
270
|
+
children: sameQuery ? "Reused this query’s previous result; no upstream request needed." : "Satisfied by local coverage; no upstream request needed."
|
|
271
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
272
|
+
className: "ps-query-data-details",
|
|
273
|
+
children: /* @__PURE__ */ jsxs("section", {
|
|
274
|
+
className: "ps-query-data-section",
|
|
275
|
+
"aria-label": "Coverage",
|
|
276
|
+
children: [
|
|
277
|
+
/* @__PURE__ */ jsx("h5", { children: "Coverage" }),
|
|
278
|
+
coverageReason && /* @__PURE__ */ jsx("p", {
|
|
279
|
+
className: "ps-query-step-note",
|
|
280
|
+
children: coverageReason
|
|
281
|
+
}),
|
|
282
|
+
!sameQuery && /* @__PURE__ */ jsx(QueryPills, {
|
|
283
|
+
query: coveredBy.query,
|
|
284
|
+
object,
|
|
285
|
+
objectType: demand.objectType
|
|
286
|
+
})
|
|
287
|
+
]
|
|
288
|
+
})
|
|
289
|
+
})] }) : load ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(StepNote, {
|
|
290
|
+
label: "Data",
|
|
291
|
+
children: load.outcome === "running" ? `Requesting from ${source}.` : `Requested from ${source}.`
|
|
292
|
+
}), displayedLoad?.outcome === "success" && displayedLoad.complete && /* @__PURE__ */ jsx("div", {
|
|
293
|
+
className: "ps-query-data-details",
|
|
294
|
+
children: /* @__PURE__ */ jsxs("section", {
|
|
295
|
+
className: "ps-query-data-section",
|
|
296
|
+
"aria-label": "Coverage",
|
|
297
|
+
children: [/* @__PURE__ */ jsx("h5", { children: "Coverage" }), /* @__PURE__ */ jsx("p", {
|
|
298
|
+
className: "ps-query-step-note",
|
|
299
|
+
children: "Complete result from the last source load."
|
|
300
|
+
})]
|
|
301
|
+
})
|
|
302
|
+
})] }) : /* @__PURE__ */ jsx(StepNote, {
|
|
303
|
+
label: "Data",
|
|
304
|
+
children: "No recorded source load. Coverage could not be determined."
|
|
305
|
+
});
|
|
306
|
+
return /* @__PURE__ */ jsxs("details", {
|
|
307
|
+
className: "ps-query-pushdown",
|
|
308
|
+
children: [/* @__PURE__ */ jsx(DisclosureSummary, { children: "Query path" }), /* @__PURE__ */ jsxs("div", {
|
|
309
|
+
className: "ps-query-execution",
|
|
310
|
+
"aria-label": "Query execution",
|
|
311
|
+
children: [
|
|
312
|
+
/* @__PURE__ */ jsxs("section", {
|
|
313
|
+
className: "ps-query-step",
|
|
314
|
+
"data-stage-state": !parentReplica && checking && load?.outcome !== "running" ? "active" : !parentReplica && reused ? "cached" : "ready",
|
|
315
|
+
children: [
|
|
316
|
+
/* @__PURE__ */ jsxs("h4", { children: [/* @__PURE__ */ jsx("span", {
|
|
317
|
+
"aria-hidden": true,
|
|
318
|
+
children: "1"
|
|
319
|
+
}), "Tab replica"] }),
|
|
320
|
+
/* @__PURE__ */ jsx(StepNote, {
|
|
321
|
+
label: "Filter",
|
|
322
|
+
children: requests.length === 0 ? "Translation not reported." : preserved ? demand.query?.where || requests.some((request) => request.requested?.where) ? "Unchanged." : "No filter requested." : incompleteFilter ? "Broadened; remaining conditions evaluated in this tab." : "Translation not reported."
|
|
323
|
+
}),
|
|
324
|
+
requests.length === 0 || !preserved || localOrder || localLimit ? /* @__PURE__ */ jsx(QueryPills, {
|
|
325
|
+
query: demand.query,
|
|
326
|
+
object
|
|
327
|
+
}) : null,
|
|
328
|
+
localSteps.map((step) => /* @__PURE__ */ jsx("p", {
|
|
329
|
+
className: "ps-query-step-note",
|
|
330
|
+
children: step
|
|
331
|
+
}, step)),
|
|
332
|
+
parentReplica ? /* @__PURE__ */ jsxs(StepNote, {
|
|
333
|
+
label: "Data",
|
|
334
|
+
children: [
|
|
335
|
+
"Live demand forwarded to the ",
|
|
336
|
+
sourceReplica,
|
|
337
|
+
"."
|
|
338
|
+
]
|
|
339
|
+
}) : replicaOutcome
|
|
340
|
+
]
|
|
341
|
+
}),
|
|
342
|
+
parentReplica && /* @__PURE__ */ jsxs("section", {
|
|
343
|
+
className: "ps-query-step",
|
|
344
|
+
"data-stage-state": checking && load?.outcome !== "running" ? "active" : reused ? "cached" : "ready",
|
|
345
|
+
children: [
|
|
346
|
+
/* @__PURE__ */ jsxs("h4", { children: [/* @__PURE__ */ jsx("span", {
|
|
347
|
+
"aria-hidden": true,
|
|
348
|
+
children: "2"
|
|
349
|
+
}), sourceReplica] }),
|
|
350
|
+
/* @__PURE__ */ jsx(StepNote, {
|
|
351
|
+
label: "Filter",
|
|
352
|
+
children: demand.query?.where ? "Unchanged." : "No filter requested."
|
|
353
|
+
}),
|
|
354
|
+
replicaOutcome
|
|
355
|
+
]
|
|
356
|
+
}),
|
|
357
|
+
/* @__PURE__ */ jsxs("section", {
|
|
358
|
+
className: "ps-query-step",
|
|
359
|
+
"data-stage-state": load?.outcome === "running" ? "active" : reused ? "skipped" : "ready",
|
|
360
|
+
"data-source-state": loadError ? "unknown" : load?.outcome === "running" ? "refreshing" : reused ? "cached" : load ? "requested" : "unknown",
|
|
361
|
+
children: [/* @__PURE__ */ jsxs("h4", { children: [
|
|
362
|
+
/* @__PURE__ */ jsx("span", {
|
|
363
|
+
"aria-hidden": true,
|
|
364
|
+
children: parentReplica ? 3 : 2
|
|
365
|
+
}),
|
|
366
|
+
source,
|
|
367
|
+
/* @__PURE__ */ jsx("span", {
|
|
368
|
+
className: "ps-query-source-status",
|
|
369
|
+
children: loadError ? "Status unavailable" : load?.outcome === "running" ? "Source request in progress" : checking ? "Checking replica coverage" : reused ? "Skipped · replica cache hit" : load?.outcome === "failure" ? "Source request failed" : load?.outcome === "interrupted" ? "Source request cancelled" : load ? "Source request completed" : "No recorded load"
|
|
370
|
+
})
|
|
371
|
+
] }), sourceDetails]
|
|
372
|
+
})
|
|
373
|
+
]
|
|
374
|
+
})]
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
//#endregion
|
|
378
|
+
export { QueryPushdown, RequestedQuery };
|
|
379
|
+
|
|
380
|
+
//# sourceMappingURL=QueryPushdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryPushdown.js","names":[],"sources":["../src/QueryPushdown.tsx"],"sourcesContent":["import { IR } from \"@tanstack/db\";\nimport { useState, type ReactNode } from \"react\";\nimport { DisclosureSummary } from \"./DisclosureSummary.js\";\nimport { NativeQueryCode } from \"./NativeQueryCode.js\";\nimport { OperandToken, QueryPills, QuerySubject, nullOrderLabel } from \"./QueryPills.js\";\nimport { demandId } from \"./replicationActivity.js\";\nimport type { ReplicationLoad, ReplicationDemand } from \"./replicationActivity.js\";\nimport type { ObjectTypeDef } from \"@party-stack/ontology\";\nimport type { CollectionDemandDiagnostic } from \"@party-stack/ontology/tanstack\";\n\nconst operators: Readonly<Record<string, string>> = {\n eq: \"=\",\n gt: \">\",\n gte: \"≥\",\n lt: \"<\",\n lte: \"≤\",\n like: \"matches\",\n ilike: \"matches (ignore case)\",\n in: \"in\",\n};\nfunction Expression({\n expression,\n object,\n pattern = false,\n}: {\n expression: IR.BasicExpression;\n object?: ObjectTypeDef;\n pattern?: boolean;\n}) {\n if (expression.type === \"ref\")\n return (\n <OperandToken\n value={{ _tag: \"Field\", path: IR.getPropRefPropertyPath(expression) }}\n object={object}\n />\n );\n if (expression.type === \"val\") {\n if (Array.isArray(expression.value))\n return (\n <span className=\"ps-query-values\">\n [\n {expression.value.map((value, index) => (\n <Expression key={index} expression={new IR.Value(value)} object={object} />\n ))}\n ]\n </span>\n );\n if (\n expression.value === null ||\n expression.value === undefined ||\n [\"string\", \"number\", \"boolean\", \"bigint\"].includes(typeof expression.value)\n )\n return <OperandToken value={expression.value} object={object} pattern={pattern} />;\n return <code>{JSON.stringify(expression.value)}</code>;\n }\n if (expression.type !== \"func\") return <span>Unknown expression</span>;\n const { name, args } = expression;\n if (name === \"and\" || name === \"or\" || name === \"not\")\n return (\n <div className=\"ps-query-group\">\n <span className=\"ps-query-connector\">{name.toUpperCase()}</span>\n <div className=\"ps-query-branches\">\n {args.map((arg, index) => (\n <Expression key={index} expression={arg} object={object} />\n ))}\n </div>\n </div>\n );\n return (\n <div className=\"ps-query-comparison\">\n {operators[name] && args.length === 2 ? (\n <>\n <Expression expression={args[0]!} object={object} />\n <span className=\"ps-query-operator\">{operators[name]}</span>\n <Expression\n expression={args[1]!}\n object={object}\n pattern={name === \"like\" || name === \"ilike\"}\n />\n </>\n ) : (\n <>\n <span className=\"ps-query-operator\">{name}(</span>\n {args.map((arg, index) => (\n <span key={index}>\n {index > 0 && \", \"}\n <Expression expression={arg} object={object} />\n </span>\n ))}\n <span className=\"ps-query-operator\">)</span>\n </>\n )}\n </div>\n );\n}\n\nexport function RequestedQuery({\n request,\n demand,\n object,\n}: {\n request: CollectionDemandDiagnostic;\n demand: ReplicationDemand;\n object?: ObjectTypeDef;\n}) {\n const query = request.requested;\n return (\n <div className=\"ps-query-expression\" aria-label=\"Requested query\">\n <div className=\"ps-query-sentence\">\n <QuerySubject object={object} objectType={demand.objectType} />\n {query?.where ? (\n <>\n <span className=\"ps-query-keyword\">where</span>\n <Expression expression={query.where} object={object} />\n </>\n ) : (\n <span className=\"ps-query-keyword\">— all rows</span>\n )}\n </div>\n {query?.orderBy?.map((order, index) => (\n <div className=\"ps-query-clause\" key={index}>\n <span className=\"ps-query-keyword\">order by</span>\n <Expression expression={order.expression} object={object} />\n <span className=\"ps-query-operator\">\n {order.compareOptions.direction === \"desc\" ? \"descending\" : \"ascending\"}\n {nullOrderLabel(order.compareOptions)}\n </span>\n </div>\n ))}\n {query?.limit !== undefined && (\n <div className=\"ps-query-clause\">\n <span className=\"ps-query-keyword\">limit</span>\n <OperandToken value={query.limit} />\n </div>\n )}\n {query?.offset !== undefined && (\n <div className=\"ps-query-clause\">\n <span className=\"ps-query-keyword\">offset</span>\n <OperandToken value={query.offset} />\n </div>\n )}\n {query?.cursor && (\n <div className=\"ps-query-clause\">\n <span className=\"ps-query-keyword\">cursor</span>\n <Expression\n expression={new IR.Func(\"or\", [query.cursor.whereFrom, query.cursor.whereCurrent])}\n object={object}\n />\n </div>\n )}\n </div>\n );\n}\n\nfunction formatInterval(ms: number | undefined) {\n if (ms === undefined) return \"configured interval\";\n if (ms % 60_000 === 0) return `${ms / 60_000} ${ms === 60_000 ? \"minute\" : \"minutes\"}`;\n if (ms % 1000 === 0) return `${ms / 1000} ${ms === 1000 ? \"second\" : \"seconds\"}`;\n return `${ms} ms`;\n}\n\nfunction StepNote({ label, children }: { label: \"Filter\" | \"Data\"; children: ReactNode }) {\n return (\n <p className=\"ps-query-step-note\">\n <strong>{label}:</strong> {children}\n </p>\n );\n}\n\nexport function QueryPushdown({\n requests,\n demand,\n load,\n object,\n loadStats,\n loadError,\n parentReplica,\n coveredBy: checkedCoverage,\n coverageProof: checkedProof,\n previousLoad,\n sourceName,\n checking = false,\n}: {\n requests: readonly CollectionDemandDiagnostic[];\n demand: ReplicationDemand;\n load?: ReplicationLoad;\n object?: ObjectTypeDef;\n loadStats?: ReactNode;\n loadError?: string;\n parentReplica?: string;\n coveredBy?: ReplicationDemand[\"coveredBy\"];\n coverageProof?: ReplicationDemand[\"coverageProof\"];\n previousLoad?: ReplicationLoad;\n sourceName?: string;\n checking?: boolean;\n}) {\n const preserved = requests.every((request) => (request.filterExact ?? request.exact) === true);\n const incompleteFilter = requests.some((request) => (request.filterExact ?? request.exact) === false);\n const localOrder = requests.some((request) => request.orderExact === false);\n const localLimit = requests.some(\n (request) => request.requested?.limit !== undefined && request.query?.limit === undefined\n );\n const localSteps = [\n incompleteFilter && \"This tab filters the replica’s response to finish evaluating the query.\",\n localOrder && \"This tab sorts the replica’s response.\",\n localLimit && \"This tab applies the query limit to the replica’s response.\",\n ].filter((step): step is string => typeof step === \"string\");\n const queryId = demandId(demand);\n const [lastCheck, setLastCheck] = useState({\n queryId,\n coveredBy: checkedCoverage,\n coverageProof: checkedProof,\n refresh: checkedProof,\n });\n // Keep the last completed decision visible while a refresh is being checked.\n if (\n lastCheck.queryId !== queryId ||\n (!checking && (lastCheck.coveredBy !== checkedCoverage || lastCheck.coverageProof !== checkedProof))\n ) {\n setLastCheck({\n queryId,\n coveredBy: checkedCoverage,\n coverageProof: checkedProof,\n refresh: checkedProof ?? (lastCheck.queryId === queryId ? lastCheck.refresh : undefined),\n });\n }\n const coveredBy = checking && lastCheck.queryId === queryId ? lastCheck.coveredBy : checkedCoverage;\n const coverageProof = checking && lastCheck.queryId === queryId ? lastCheck.coverageProof : checkedProof;\n const refreshProof = coverageProof ?? (lastCheck.queryId === queryId ? lastCheck.refresh : undefined);\n const displayedLoad = load?.outcome === \"running\" ? (previousLoad ?? load) : load;\n const plan = displayedLoad?.pushdown ?? previousLoad?.pushdown;\n const source = plan?.source ?? sourceName ?? \"Source\";\n const sourceReplica = parentReplica ? `${parentReplica} replica` : \"Tab replica\";\n const reused = Boolean(coveredBy);\n const sameQuery = coveredBy && demandId(coveredBy) === demandId(demand);\n const coverageReason =\n coverageProof &&\n {\n collection: sameQuery\n ? \"This query previously loaded the complete collection.\"\n : \"Complete collection; includes every matching row.\",\n query: sameQuery\n ? \"Previously loaded complete result of the same query or primary-key lookup.\"\n : \"A previously loaded complete result covers this request.\",\n \"primary-key\": \"Requested primary key is present in this maintained result.\",\n }[coverageProof.reason];\n const residualFilter = plan?.predicates.some((term) => term.execution !== \"source\");\n const filterStatus = plan?.predicates.length\n ? plan.predicates.every((term) => term.execution === \"source\")\n ? incompleteFilter\n ? `Fully pushed down to ${source}; this tab still evaluates the remaining conditions.`\n : `Fully pushed down to ${source}.`\n : plan.predicates.every((term) => term.execution === \"adapter\" || term.execution === \"engine\")\n ? `Not pushed down to ${source}.`\n : `Partly pushed down to ${source}.`\n : (load?.subset?.query ?? demand.query)?.where\n ? \"Pushdown not reported.\"\n : \"No filter requested.\";\n const evaluator =\n plan?.predicates.some((term) => term.execution === \"engine\") ||\n plan?.sorting === \"engine\" ||\n plan?.pagination === \"engine\"\n ? \"query engine\"\n : \"adapter\";\n const adapterSteps = [\n residualFilter && `The ${evaluator} filters ${source}’s response to finish evaluating the query.`,\n plan?.rechecksFilter &&\n !residualFilter &&\n load?.fetchedRows !== undefined &&\n load.rows !== undefined &&\n load.fetchedRows !== load.rows &&\n `The ${evaluator} also checks returned rows against the filter.`,\n (plan?.sorting === \"adapter\" || plan?.sorting === \"engine\") &&\n `The ${evaluator} sorts the returned rows.`,\n (plan?.pagination === \"adapter\" || plan?.pagination === \"engine\") &&\n `The ${evaluator} applies the query limit or pagination before returning rows to the ${sourceReplica}.`,\n ].filter((step): step is string => typeof step === \"string\");\n const refreshDescription = refreshProof && (\n <span className=\"ps-query-refresh\">\n {refreshProof.maintainedBy === \"journal\"\n ? \"Refreshed through journal catch-up.\"\n : refreshProof.maintainedBy === \"poll\"\n ? `Refreshed by polling every ${formatInterval(refreshProof.pollIntervalMs)}.`\n : refreshProof.maintainedBy === \"snapshot\"\n ? \"Reused a recent snapshot.\"\n : \"Refreshed by source change notifications.\"}\n </span>\n );\n const sourceDetails = (\n <>\n <StepNote label=\"Filter\">\n {displayedLoad\n ? plan\n ? filterStatus\n : \"Pushdown not reported.\"\n : \"No pushdown recorded for this query.\"}\n </StepNote>\n {plan && displayedLoad && (\n <QueryPills\n query={displayedLoad.subset?.query ?? demand.query}\n object={object}\n annotations={plan.predicates}\n />\n )}\n {adapterSteps.map((step) => (\n <p className=\"ps-query-step-note\" key={step}>\n {step}\n </p>\n ))}\n <StepNote label=\"Data\">\n {displayedLoad ? loadStats : \"No source load recorded for this query.\"}\n {refreshDescription && <> · {refreshDescription}</>}\n </StepNote>\n {displayedLoad?.error && <p className=\"ps-query-residual\">{displayedLoad.error.message}</p>}\n {plan?.native && (\n <details className=\"ps-query-native\">\n <DisclosureSummary>Native query ({plan.native.language.toUpperCase()})</DisclosureSummary>\n <NativeQueryCode language={plan.native.language} text={plan.native.text} />\n </details>\n )}\n </>\n );\n const replicaOutcome = loadError ? (\n <StepNote label=\"Data\">Diagnostics disconnected: {loadError}</StepNote>\n ) : coveredBy ? (\n <>\n <StepNote label=\"Data\">\n {sameQuery\n ? \"Reused this query’s previous result; no upstream request needed.\"\n : \"Satisfied by local coverage; no upstream request needed.\"}\n </StepNote>\n <div className=\"ps-query-data-details\">\n <section className=\"ps-query-data-section\" aria-label=\"Coverage\">\n <h5>Coverage</h5>\n {coverageReason && <p className=\"ps-query-step-note\">{coverageReason}</p>}\n {!sameQuery && (\n <QueryPills query={coveredBy.query} object={object} objectType={demand.objectType} />\n )}\n </section>\n </div>\n </>\n ) : load ? (\n <>\n <StepNote label=\"Data\">\n {load.outcome === \"running\" ? `Requesting from ${source}.` : `Requested from ${source}.`}\n </StepNote>\n {displayedLoad?.outcome === \"success\" && displayedLoad.complete && (\n <div className=\"ps-query-data-details\">\n <section className=\"ps-query-data-section\" aria-label=\"Coverage\">\n <h5>Coverage</h5>\n <p className=\"ps-query-step-note\">Complete result from the last source load.</p>\n </section>\n </div>\n )}\n </>\n ) : (\n <StepNote label=\"Data\">No recorded source load. Coverage could not be determined.</StepNote>\n );\n return (\n <details className=\"ps-query-pushdown\">\n <DisclosureSummary>Query path</DisclosureSummary>\n <div className=\"ps-query-execution\" aria-label=\"Query execution\">\n <section\n className=\"ps-query-step\"\n data-stage-state={\n !parentReplica && checking && load?.outcome !== \"running\"\n ? \"active\"\n : !parentReplica && reused\n ? \"cached\"\n : \"ready\"\n }\n >\n <h4>\n <span aria-hidden>1</span>Tab replica\n </h4>\n <StepNote label=\"Filter\">\n {requests.length === 0\n ? \"Translation not reported.\"\n : preserved\n ? demand.query?.where || requests.some((request) => request.requested?.where)\n ? \"Unchanged.\"\n : \"No filter requested.\"\n : incompleteFilter\n ? \"Broadened; remaining conditions evaluated in this tab.\"\n : \"Translation not reported.\"}\n </StepNote>\n {requests.length === 0 || !preserved || localOrder || localLimit ? (\n <QueryPills query={demand.query} object={object} />\n ) : null}\n {localSteps.map((step) => (\n <p className=\"ps-query-step-note\" key={step}>\n {step}\n </p>\n ))}\n {parentReplica ? (\n <StepNote label=\"Data\">Live demand forwarded to the {sourceReplica}.</StepNote>\n ) : (\n replicaOutcome\n )}\n </section>\n {parentReplica && (\n <section\n className=\"ps-query-step\"\n data-stage-state={\n checking && load?.outcome !== \"running\" ? \"active\" : reused ? \"cached\" : \"ready\"\n }\n >\n <h4>\n <span aria-hidden>2</span>\n {sourceReplica}\n </h4>\n <StepNote label=\"Filter\">\n {demand.query?.where ? \"Unchanged.\" : \"No filter requested.\"}\n </StepNote>\n {replicaOutcome}\n </section>\n )}\n <section\n className=\"ps-query-step\"\n data-stage-state={load?.outcome === \"running\" ? \"active\" : reused ? \"skipped\" : \"ready\"}\n data-source-state={\n loadError\n ? \"unknown\"\n : load?.outcome === \"running\"\n ? \"refreshing\"\n : reused\n ? \"cached\"\n : load\n ? \"requested\"\n : \"unknown\"\n }\n >\n <h4>\n <span aria-hidden>{parentReplica ? 3 : 2}</span>\n {source}\n <span className=\"ps-query-source-status\">\n {loadError\n ? \"Status unavailable\"\n : load?.outcome === \"running\"\n ? \"Source request in progress\"\n : checking\n ? \"Checking replica coverage\"\n : reused\n ? \"Skipped · replica cache hit\"\n : load?.outcome === \"failure\"\n ? \"Source request failed\"\n : load?.outcome === \"interrupted\"\n ? \"Source request cancelled\"\n : load\n ? \"Source request completed\"\n : \"No recorded load\"}\n </span>\n </h4>\n {sourceDetails}\n </section>\n </div>\n </details>\n );\n}\n"],"mappings":";;;;;;;;;AAUA,MAAM,YAA8C;CAChD,IAAI;CACJ,IAAI;CACJ,KAAK;CACL,IAAI;CACJ,KAAK;CACL,MAAM;CACN,OAAO;CACP,IAAI;AACR;AACA,SAAS,WAAW,EAChB,YACA,QACA,UAAU,SAKX;CACC,IAAI,WAAW,SAAS,OACpB,OACI,oBAAC,cAAD;EACI,OAAO;GAAE,MAAM;GAAS,MAAM,GAAG,uBAAuB,UAAU;EAAE;EAC5D;CACX,CAAA;CAET,IAAI,WAAW,SAAS,OAAO;EAC3B,IAAI,MAAM,QAAQ,WAAW,KAAK,GAC9B,OACI,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA;IAAkC;IAE7B,WAAW,MAAM,KAAK,OAAO,UAC1B,oBAAC,YAAD;KAAwB,YAAY,IAAI,GAAG,MAAM,KAAK;KAAW;IAAS,GAAzD,KAAyD,CAC7E;IAAE;GAED;;EAEd,IACI,WAAW,UAAU,QACrB,WAAW,UAAU,KAAA,KACrB;GAAC;GAAU;GAAU;GAAW;EAAQ,CAAC,CAAC,SAAS,OAAO,WAAW,KAAK,GAE1E,OAAO,oBAAC,cAAD;GAAc,OAAO,WAAW;GAAe;GAAiB;EAAU,CAAA;EACrF,OAAO,oBAAC,QAAD,EAAA,UAAO,KAAK,UAAU,WAAW,KAAK,EAAQ,CAAA;CACzD;CACA,IAAI,WAAW,SAAS,QAAQ,OAAO,oBAAC,QAAD,EAAA,UAAM,qBAAwB,CAAA;CACrE,MAAM,EAAE,MAAM,SAAS;CACvB,IAAI,SAAS,SAAS,SAAS,QAAQ,SAAS,OAC5C,O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ACA;MACJ,CAAA;MACT,SAAS,WAAW,KAAK,CAAC,aAAa,cAAc,aAClD,oBAAC,YAAD;OAAY,OAAO,OAAO;OAAe;MAAS,CAAA,IAClD;MACH,WAAW,KAAK,SACb,oBAAC,KAAD;OAAG,WAAU;OACR,UAAA;MACF,GAFoC,IAEpC,CACN;MACA,gBACG,qBAAC,UAAD;OAAU,OAAM;OAAhB,UAAA;QAAuB;QAA8B;QAAc;OAAW;MAE9E,CAAA,IAAA;KAEC;;IACR,iBACG,qBAAC,WAAD;KACI,WAAU;KACV,oBACI,YAAY,MAAM,YAAY,YAAY,WAAW,SAAS,WAAW;KAHjF,UAAA;MAMI,qBAAC,MAAD,EAAA,UAAA,CACI,oBAAC,QAAD;OAAM,eAAA;OAAY,UAAA;MAAO,CAAA,GACxB,aACD,EAAA,CAAA;MACJ,oBAAC,UAAD;OAAU,OAAM;OACX,UAAA,OAAO,OAAO,QAAQ,eAAe;MAChC,CAAA;MACT;KACI;;IAEb,qBAAC,WAAD;KACI,WAAU;KACV,oBAAkB,MAAM,YAAY,YAAY,WAAW,SAAS,YAAY;KAChF,qBACI,YACM,YACA,MAAM,YAAY,YAChB,eACA,SACE,WACA,OACE,cACA;KAZpB,UAAA,CAeI,qBAAC,MAAD,EAAA,UAAA;MACI,oBAAC,QAAD;OAAM,eAAA;OAAa,UAAA,gBAAgB,IAAI;MAAQ,CAAA;MAC9C;MACD,oBAAC,QAAD;OAAM,WAAU;OACX,UAAA,YACK,uBACA,MAAM,YAAY,YAChB,+BACA,WACE,8BACA,SACE,gCACA,MAAM,YAAY,YAChB,0BACA,MAAM,YAAY,gBAChB,6BACA,OACE,6BACA;MAChB,CAAA;KACN,EAAA,CAAA,GACH,aACI;;GACR;EACA,CAAA,CAAA;;AAEjB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Demand } from "./diagnostics.js";
|
|
2
|
+
import { ObjectTypeDef } from "@party-stack/ontology";
|
|
3
|
+
//#region src/QueryTokens.d.ts
|
|
4
|
+
type Query$1 = NonNullable<Demand["query"]>;
|
|
5
|
+
type Predicate = NonNullable<Query$1["where"]>;
|
|
6
|
+
export type QueryOperand = Extract<Predicate, {
|
|
7
|
+
left: unknown;
|
|
8
|
+
}>["left"];
|
|
9
|
+
export declare function operandText(value: unknown, object?: ObjectTypeDef): string;
|
|
10
|
+
export declare function nullOrderLabel(order: {
|
|
11
|
+
direction?: string;
|
|
12
|
+
nulls?: string;
|
|
13
|
+
}): string;
|
|
14
|
+
export declare function OperandToken({ value, object, pattern }: {
|
|
15
|
+
value: unknown;
|
|
16
|
+
object?: ObjectTypeDef;
|
|
17
|
+
pattern?: boolean;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
export declare function QuerySubject({ object, objectType }: {
|
|
20
|
+
object?: ObjectTypeDef;
|
|
21
|
+
objectType?: string;
|
|
22
|
+
}): import("react").JSX.Element | null;
|
|
23
|
+
//#endregion
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=QueryTokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryTokens.d.ts","names":["Query"],"sources":["../src/QueryTokens.tsx"],"mappings":";;;KAIKA,UAAQ,YAAY;KACpB,YAAY,YAAYA;YACjB,eAAe,QAAQ;EAAa;;wBAEhC,YAAY,gBAAgB,SAAS;wBAoBrC,eAAe;EAAS;EAAoB;;wBAK5C,eACZ,OACA,QACA;EAEA;EACA,SAAS;EACT;oBACH,IAAA;wBAyCe,eAAe,QAAQ;EAAgB,SAAS;EAAe;oBAAqB,IAAA"}
|