@elaraai/e3-ui 1.0.83 → 1.0.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/bind/data.d.ts +4 -3
- package/dist/src/bind/data.d.ts.map +1 -1
- package/dist/src/bind/data.js +4 -3
- package/dist/src/bind/data.js.map +1 -1
- package/dist/src/bind/record.d.ts +234 -6
- package/dist/src/bind/record.d.ts.map +1 -1
- package/dist/src/bind/record.js +250 -7
- package/dist/src/bind/record.js.map +1 -1
- package/dist/src/bind/sources.d.ts +148 -0
- package/dist/src/bind/sources.d.ts.map +1 -0
- package/dist/src/bind/sources.js +116 -0
- package/dist/src/bind/sources.js.map +1 -0
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +4 -1
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +11 -1
- package/dist/src/internal.js.map +1 -1
- package/dist/src/query/builder.d.ts +3257 -0
- package/dist/src/query/builder.d.ts.map +1 -0
- package/dist/src/query/builder.js +126 -0
- package/dist/src/query/builder.js.map +1 -0
- package/dist/src/query/index.d.ts +108 -0
- package/dist/src/query/index.d.ts.map +1 -0
- package/dist/src/query/index.js +76 -0
- package/dist/src/query/index.js.map +1 -0
- package/dist/src/query/library.d.ts +3241 -0
- package/dist/src/query/library.d.ts.map +1 -0
- package/dist/src/query/library.js +114 -0
- package/dist/src/query/library.js.map +1 -0
- package/dist/src/query/queries.d.ts +4696 -0
- package/dist/src/query/queries.d.ts.map +1 -0
- package/dist/src/query/queries.js +129 -0
- package/dist/src/query/queries.js.map +1 -0
- package/dist/src/query/saved.d.ts +72 -0
- package/dist/src/query/saved.d.ts.map +1 -0
- package/dist/src/query/saved.js +84 -0
- package/dist/src/query/saved.js.map +1 -0
- package/dist/src/query/steps.d.ts +613 -0
- package/dist/src/query/steps.d.ts.map +1 -0
- package/dist/src/query/steps.js +316 -0
- package/dist/src/query/steps.js.map +1 -0
- package/dist/src/query/types.d.ts +444 -0
- package/dist/src/query/types.d.ts.map +1 -0
- package/dist/src/query/types.js +113 -0
- package/dist/src/query/types.js.map +1 -0
- package/dist/src/studio/builder.d.ts +3123 -0
- package/dist/src/studio/builder.d.ts.map +1 -0
- package/dist/src/studio/builder.js +115 -0
- package/dist/src/studio/builder.js.map +1 -0
- package/dist/src/studio/canvas.d.ts +83 -0
- package/dist/src/studio/canvas.d.ts.map +1 -0
- package/dist/src/studio/canvas.js +71 -0
- package/dist/src/studio/canvas.js.map +1 -0
- package/dist/src/studio/component.d.ts +178 -0
- package/dist/src/studio/component.d.ts.map +1 -0
- package/dist/src/studio/component.js +189 -0
- package/dist/src/studio/component.js.map +1 -0
- package/dist/src/studio/index.d.ts +104 -0
- package/dist/src/studio/index.d.ts.map +1 -0
- package/dist/src/studio/index.js +75 -0
- package/dist/src/studio/index.js.map +1 -0
- package/dist/src/studio/inspector.d.ts +208 -0
- package/dist/src/studio/inspector.d.ts.map +1 -0
- package/dist/src/studio/inspector.js +155 -0
- package/dist/src/studio/inspector.js.map +1 -0
- package/dist/src/studio/library.d.ts +3506 -0
- package/dist/src/studio/library.d.ts.map +1 -0
- package/dist/src/studio/library.js +245 -0
- package/dist/src/studio/library.js.map +1 -0
- package/dist/src/studio/page.d.ts +305 -0
- package/dist/src/studio/page.d.ts.map +1 -0
- package/dist/src/studio/page.js +105 -0
- package/dist/src/studio/page.js.map +1 -0
- package/dist/src/studio/pages.d.ts +10929 -0
- package/dist/src/studio/pages.d.ts.map +1 -0
- package/dist/src/studio/pages.js +502 -0
- package/dist/src/studio/pages.js.map +1 -0
- package/dist/src/studio/palette.d.ts +179 -0
- package/dist/src/studio/palette.d.ts.map +1 -0
- package/dist/src/studio/palette.js +120 -0
- package/dist/src/studio/palette.js.map +1 -0
- package/dist/src/studio/publish.d.ts +397 -0
- package/dist/src/studio/publish.d.ts.map +1 -0
- package/dist/src/studio/publish.js +198 -0
- package/dist/src/studio/publish.js.map +1 -0
- package/dist/src/ui.d.ts +16 -3
- package/dist/src/ui.d.ts.map +1 -1
- package/dist/src/ui.js +21 -1
- package/dist/src/ui.js.map +1 -1
- package/dist/test/bind/data/data.examples.d.ts +76 -1
- package/dist/test/bind/data/data.examples.d.ts.map +1 -1
- package/dist/test/bind/data/data.examples.js +176 -3
- package/dist/test/bind/data/data.examples.js.map +1 -1
- package/dist/test/bind/func/func.examples.d.ts +8 -0
- package/dist/test/bind/func/func.examples.d.ts.map +1 -1
- package/dist/test/bind/func/func.examples.js +4 -3
- package/dist/test/bind/func/func.examples.js.map +1 -1
- package/dist/test/bind/record/record.examples.d.ts +65 -1
- package/dist/test/bind/record/record.examples.d.ts.map +1 -1
- package/dist/test/bind/record/record.examples.js +21 -3
- package/dist/test/bind/record/record.examples.js.map +1 -1
- package/dist/test/query/query.examples.d.ts +5022 -0
- package/dist/test/query/query.examples.d.ts.map +1 -0
- package/dist/test/query/query.examples.js +467 -0
- package/dist/test/query/query.examples.js.map +1 -0
- package/dist/test/studio/component.examples.d.ts +7 -0
- package/dist/test/studio/component.examples.d.ts.map +1 -0
- package/dist/test/studio/component.examples.js +46 -0
- package/dist/test/studio/component.examples.js.map +1 -0
- package/dist/test/studio/page.examples.d.ts +7 -0
- package/dist/test/studio/page.examples.d.ts.map +1 -0
- package/dist/test/studio/page.examples.js +64 -0
- package/dist/test/studio/page.examples.js.map +1 -0
- package/dist/test/studio/studio.examples.d.ts +1766 -0
- package/dist/test/studio/studio.examples.d.ts.map +1 -0
- package/dist/test/studio/studio.examples.js +354 -0
- package/dist/test/studio/studio.examples.js.map +1 -0
- package/package.json +9 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/query/queries.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EACH,SAAS,EACT,iBAAiB,EACjB,QA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BrB,CAAC;AAMF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;EAI7B,CAAC;AAEH,wEAAwE;AACxE,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuBrB,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The saved queries (#935) — the record handle the builder and the query
|
|
7
|
+
* library read and write through, the patch a save commits, and whether a
|
|
8
|
+
* saved query's data sources are bound where it would open.
|
|
9
|
+
*
|
|
10
|
+
* A save is one patch through the record's patch mutation, computed in East as
|
|
11
|
+
* the diff of the entries it writes, before and after. A patch carries what it
|
|
12
|
+
* changes as it was, so a save drafted on a stale entry fails the record's
|
|
13
|
+
* check, and nothing is overwritten.
|
|
14
|
+
*
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
*/
|
|
17
|
+
import { ArrayType, AsyncFunctionType, DictType, East, FunctionType, NullType, OptionType, PatchType, StringType, StructType, VariantType, dictPatchOpsType, none, some, variant, } from "@elaraai/east";
|
|
18
|
+
import { RecordCommitInfoType } from "@elaraai/e3-types";
|
|
19
|
+
import { RecordOutcomeType } from "../bind/record.js";
|
|
20
|
+
import { QueryRootEntryType, SavedQueriesType, SavedQueryType } from "./types.js";
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// The record, bound
|
|
23
|
+
// ============================================================================
|
|
24
|
+
/** The saved queries record's patch — what every write is. */
|
|
25
|
+
export const SavedQueriesPatchType = PatchType(SavedQueriesType);
|
|
26
|
+
/**
|
|
27
|
+
* The saved queries record, bound with its patch — what the builder and the
|
|
28
|
+
* query library read and write through: the bound record's `read`, its
|
|
29
|
+
* `history`, and its patch write awaited. Their factories take these from
|
|
30
|
+
* `Record.bind(queries, [queriesPatch])`, as Studio's take the pages record.
|
|
31
|
+
*
|
|
32
|
+
* @property read - The record's current state
|
|
33
|
+
* @property history - Its commit chain, newest first — who changed a query last, for a conflict's words
|
|
34
|
+
* @property commit - Its patch write, awaited: a request id and the patch, answered by the outcome
|
|
35
|
+
*/
|
|
36
|
+
export const QueriesHandleType = StructType({
|
|
37
|
+
read: FunctionType([], SavedQueriesType),
|
|
38
|
+
history: FunctionType([], OptionType(ArrayType(RecordCommitInfoType))),
|
|
39
|
+
commit: StructType({
|
|
40
|
+
patch: AsyncFunctionType([StringType, SavedQueriesPatchType], RecordOutcomeType),
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
// ============================================================================
|
|
44
|
+
// A save
|
|
45
|
+
// ============================================================================
|
|
46
|
+
/**
|
|
47
|
+
* One saved query's operation in a patch of the record by name — the type
|
|
48
|
+
* `dictPatchOpsType` gives, which the patch system applies, typed.
|
|
49
|
+
*/
|
|
50
|
+
const SavedQueryOpType = dictPatchOpsType(SavedQueryType);
|
|
51
|
+
/**
|
|
52
|
+
* Saves a query: the patch of the entries it writes, by name.
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* - A query never saved (`open` is `none`) inserts its entry, so a name
|
|
56
|
+
* another write took first is a conflict.
|
|
57
|
+
* - A save under the open query's own name updates its entry, by the diff of
|
|
58
|
+
* the entry as it was and as it is saved.
|
|
59
|
+
* - A save of the open query under a new name renames it: the patch removes
|
|
60
|
+
* the open entry and inserts the new one, in the same patch.
|
|
61
|
+
*
|
|
62
|
+
* `saved` is the record as the edit began. The patch carries the open entry
|
|
63
|
+
* as `saved` holds it, so a save drafted on an entry another write changed or
|
|
64
|
+
* removed since is a conflict naming it, and nothing is overwritten — every
|
|
65
|
+
* save writes `saved_at`, so any save of the entry since is one. The patch is
|
|
66
|
+
* always by name, never a replacement of the whole record.
|
|
67
|
+
*/
|
|
68
|
+
export const saveQuery = East.function([SavedQueriesType, OptionType(StringType), SavedQueryType], SavedQueriesPatchType, ($, saved, open, next) => {
|
|
69
|
+
const ops = $.let(new Map(), DictType(StringType, SavedQueryOpType));
|
|
70
|
+
// The open entry as the edit began: updated under its own name, or
|
|
71
|
+
// removed when the save renames it.
|
|
72
|
+
$.match(open, {
|
|
73
|
+
some: ($2, key) => {
|
|
74
|
+
$2.match(saved.tryGet(key), {
|
|
75
|
+
some: ($3, entry) => {
|
|
76
|
+
$3.if(key.equal(next.name), ($4) => {
|
|
77
|
+
$4(ops.insert(key, variant("update", East.diff(entry, next))));
|
|
78
|
+
}).else(($4) => {
|
|
79
|
+
$4(ops.insert(key, variant("delete", entry)));
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
// The entry under its name, unless it is the open one's, updated above.
|
|
86
|
+
$.if(ops.has(next.name).not(), ($2) => {
|
|
87
|
+
$2(ops.insert(next.name, variant("insert", next)));
|
|
88
|
+
});
|
|
89
|
+
return variant("patch", ops);
|
|
90
|
+
});
|
|
91
|
+
// ============================================================================
|
|
92
|
+
// Where a saved query opens
|
|
93
|
+
// ============================================================================
|
|
94
|
+
/**
|
|
95
|
+
* Whether a saved query's data sources are bound where it would open.
|
|
96
|
+
*
|
|
97
|
+
* @property bound - Each data source it reads is bound here, by the same name and at the same path
|
|
98
|
+
* @property elsewhere - One it reads is bound here under its name, but at another path: the saved entry, `{ name, path }`
|
|
99
|
+
* @property missing - No data source here has the name of one it reads: the name
|
|
100
|
+
*/
|
|
101
|
+
export const QueryRootBoundType = VariantType({
|
|
102
|
+
bound: NullType,
|
|
103
|
+
elsewhere: QueryRootEntryType,
|
|
104
|
+
missing: StringType,
|
|
105
|
+
});
|
|
106
|
+
/**
|
|
107
|
+
* Whether a saved query opens where these data sources are bound: each entry
|
|
108
|
+
* of its root must be one of them, by the same name and at the same path, so
|
|
109
|
+
* it never reads another page's dataset of the same name. When one is not,
|
|
110
|
+
* the first that is not, and why.
|
|
111
|
+
*/
|
|
112
|
+
export const rootBound = East.function([SavedQueryType, ArrayType(QueryRootEntryType)], QueryRootBoundType, ($, saved, bound) => {
|
|
113
|
+
const result = $.let(variant("bound", null), QueryRootBoundType);
|
|
114
|
+
$.for(saved.root, ($2, entry) => {
|
|
115
|
+
$2.if(result.hasTag("bound"), ($3) => {
|
|
116
|
+
const here = $3.let(bound.firstMap((_$4, b) => b.name.equal(entry.name).ifElse(() => East.value(some(b), OptionType(QueryRootEntryType)), () => East.value(none, OptionType(QueryRootEntryType)))));
|
|
117
|
+
$3.match(here, {
|
|
118
|
+
none: ($4) => { $4.assign(result, variant("missing", entry.name)); },
|
|
119
|
+
some: ($4, b) => {
|
|
120
|
+
$4.if(East.notEqual(b.path, entry.path), ($5) => {
|
|
121
|
+
$5.assign(result, variant("elsewhere", entry));
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
return result;
|
|
128
|
+
});
|
|
129
|
+
//# sourceMappingURL=queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/query/queries.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EACH,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,IAAI,EACJ,Y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EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBACpE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;oBACZ,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE;wBAC5C,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;oBACnD,CAAC,CAAC,CAAC;gBACP,CAAC;aACJ,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAClB,CAAC,CACJ,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* `Query.value` (#1138) — the value of the saved queries record a solution
|
|
7
|
+
* ships: each query it writes inline, checked against the data sources it may
|
|
8
|
+
* read when the package is built.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
import { type ValueTypeOf } from "@elaraai/east";
|
|
13
|
+
import type { DatasetDef, TaskDef } from "@elaraai/e3";
|
|
14
|
+
import type { SavedQueriesType } from "./types.js";
|
|
15
|
+
/**
|
|
16
|
+
* A query a solution saves, as it writes one.
|
|
17
|
+
*
|
|
18
|
+
* @property name - Its name, which is its key in the record
|
|
19
|
+
* @property jq - Its program, as jq text
|
|
20
|
+
* @property description - One sentence, at most 140 characters; omitted, the sentence generated from its steps shows instead
|
|
21
|
+
* @property savedAt - When it was saved
|
|
22
|
+
*/
|
|
23
|
+
export interface SavedQueryInput {
|
|
24
|
+
/** Its name, which is its key in the record. */
|
|
25
|
+
readonly name: string;
|
|
26
|
+
/** Its program, as jq text. */
|
|
27
|
+
readonly jq: string;
|
|
28
|
+
/** One sentence, at most 140 characters; omitted, the sentence generated from its steps shows instead. */
|
|
29
|
+
readonly description?: string;
|
|
30
|
+
/** When it was saved. */
|
|
31
|
+
readonly savedAt: Date;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The saved queries record's value — every query a solution ships in it, by
|
|
35
|
+
* name — what it declares the record with.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* - **The data sources** are named as a query reads them (`orders` for
|
|
39
|
+
* `.orders`), each a dataset or a task — the dataset or task `Data.bind`
|
|
40
|
+
* takes, whose path and type it reads. A query opens where each data source
|
|
41
|
+
* it reads is bound by the same name, at the same path.
|
|
42
|
+
* - **Each query is checked** against the whole root, a struct of the data
|
|
43
|
+
* sources in the order given, as the builder checks a query it saves: one
|
|
44
|
+
* that does not check fails the build, with the checker's words. Its root
|
|
45
|
+
* is the data sources it reads, in that order.
|
|
46
|
+
* - **A saved query keeps its program** as written, and no types: they are
|
|
47
|
+
* what checking it against its data sources gives.
|
|
48
|
+
*
|
|
49
|
+
* @param sources - The data sources the queries may read: each name, as a query reads it, to its dataset or task
|
|
50
|
+
* @param queries - The queries, each its name, its jq, its description and when it was saved ({@link SavedQueryInput})
|
|
51
|
+
* @returns The saved queries, by name: a value of the record's type, `Query.Types.Saved`
|
|
52
|
+
* @throws {Error} When a data source's name is not a jq identifier; when a
|
|
53
|
+
* query does not check, naming it and saying why; when two queries have one
|
|
54
|
+
* name; and when a description holds more than 140 characters
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { ArrayType, FloatType, IntegerType, StructType, variant } from "@elaraai/east";
|
|
59
|
+
* import { Query } from "@elaraai/e3-ui";
|
|
60
|
+
* import e3 from "@elaraai/e3";
|
|
61
|
+
*
|
|
62
|
+
* const orders = e3.input("orders", ArrayType(StructType({ id: IntegerType, total: FloatType })), variant("value", []));
|
|
63
|
+
*
|
|
64
|
+
* // The record ships with one query, checked against `orders` when the package builds.
|
|
65
|
+
* export const queries = e3.record("queries", Query.Types.Saved, Query.value({ orders }, [
|
|
66
|
+
* { name: "Big orders", jq: ".orders | map(select(.total >= 1000))", savedAt: new Date("2026-10-01T09:00:00Z") },
|
|
67
|
+
* ]));
|
|
68
|
+
* export const queriesPatch = e3.mutation.patch(queries);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export declare function savedQueriesValue(sources: Readonly<Record<string, DatasetDef | TaskDef>>, queries: readonly SavedQueryInput[]): ValueTypeOf<typeof SavedQueriesType>;
|
|
72
|
+
//# sourceMappingURL=saved.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saved.d.ts","sourceRoot":"","sources":["../../../src/query/saved.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAqF,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACpI,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,YAAY,CAAC;AAKnE;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC5B,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,0GAA0G;IAC1G,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,yBAAyB;IACzB,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,iBAAiB,CAC7B,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC,EACvD,OAAO,EAAE,SAAS,eAAe,EAAE,GACpC,WAAW,CAAC,OAAO,gBAAgB,CAAC,CA6BtC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* `Query.value` (#1138) — the value of the saved queries record a solution
|
|
7
|
+
* ships: each query it writes inline, checked against the data sources it may
|
|
8
|
+
* read when the package is built.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
import { SortedMap, StringType, StructType, checkJq, compareFor, none, some } from "@elaraai/east";
|
|
13
|
+
import { assertRootField } from "../bind/sources.js";
|
|
14
|
+
/** The most characters a saved query's description holds, as the builder's Save… popover takes it. */
|
|
15
|
+
const DESCRIPTION_MAX = 140;
|
|
16
|
+
/**
|
|
17
|
+
* The saved queries record's value — every query a solution ships in it, by
|
|
18
|
+
* name — what it declares the record with.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* - **The data sources** are named as a query reads them (`orders` for
|
|
22
|
+
* `.orders`), each a dataset or a task — the dataset or task `Data.bind`
|
|
23
|
+
* takes, whose path and type it reads. A query opens where each data source
|
|
24
|
+
* it reads is bound by the same name, at the same path.
|
|
25
|
+
* - **Each query is checked** against the whole root, a struct of the data
|
|
26
|
+
* sources in the order given, as the builder checks a query it saves: one
|
|
27
|
+
* that does not check fails the build, with the checker's words. Its root
|
|
28
|
+
* is the data sources it reads, in that order.
|
|
29
|
+
* - **A saved query keeps its program** as written, and no types: they are
|
|
30
|
+
* what checking it against its data sources gives.
|
|
31
|
+
*
|
|
32
|
+
* @param sources - The data sources the queries may read: each name, as a query reads it, to its dataset or task
|
|
33
|
+
* @param queries - The queries, each its name, its jq, its description and when it was saved ({@link SavedQueryInput})
|
|
34
|
+
* @returns The saved queries, by name: a value of the record's type, `Query.Types.Saved`
|
|
35
|
+
* @throws {Error} When a data source's name is not a jq identifier; when a
|
|
36
|
+
* query does not check, naming it and saying why; when two queries have one
|
|
37
|
+
* name; and when a description holds more than 140 characters
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { ArrayType, FloatType, IntegerType, StructType, variant } from "@elaraai/east";
|
|
42
|
+
* import { Query } from "@elaraai/e3-ui";
|
|
43
|
+
* import e3 from "@elaraai/e3";
|
|
44
|
+
*
|
|
45
|
+
* const orders = e3.input("orders", ArrayType(StructType({ id: IntegerType, total: FloatType })), variant("value", []));
|
|
46
|
+
*
|
|
47
|
+
* // The record ships with one query, checked against `orders` when the package builds.
|
|
48
|
+
* export const queries = e3.record("queries", Query.Types.Saved, Query.value({ orders }, [
|
|
49
|
+
* { name: "Big orders", jq: ".orders | map(select(.total >= 1000))", savedAt: new Date("2026-10-01T09:00:00Z") },
|
|
50
|
+
* ]));
|
|
51
|
+
* export const queriesPatch = e3.mutation.patch(queries);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export function savedQueriesValue(sources, queries) {
|
|
55
|
+
// A task's data is its output dataset; a dataset is its own.
|
|
56
|
+
const datasets = Object.entries(sources).map(([name, def]) => {
|
|
57
|
+
assertRootField("Query.value", name);
|
|
58
|
+
return { name, dataset: def.kind === "task" ? def.output : def };
|
|
59
|
+
});
|
|
60
|
+
const root = StructType(Object.fromEntries(datasets.map(({ name, dataset }) => [name, dataset.type])));
|
|
61
|
+
const saved = new SortedMap([], compareFor(StringType));
|
|
62
|
+
for (const query of queries) {
|
|
63
|
+
if (saved.has(query.name)) {
|
|
64
|
+
throw new Error(`Query.value: "${query.name}" is saved twice — a saved query's name is its key in the record`);
|
|
65
|
+
}
|
|
66
|
+
if (query.description !== undefined && query.description.length > DESCRIPTION_MAX) {
|
|
67
|
+
throw new Error(`Query.value: "${query.name}"'s description is ${query.description.length} characters — a description holds at most ${DESCRIPTION_MAX}`);
|
|
68
|
+
}
|
|
69
|
+
const checked = checkJq(query.jq, root, { root: true });
|
|
70
|
+
if (checked.program === null) {
|
|
71
|
+
const problems = checked.diagnostics.filter(d => d.severity.type === "error").map(d => d.message);
|
|
72
|
+
throw new Error(`Query.value: "${query.name}" does not check — ${problems.join(" ")}`);
|
|
73
|
+
}
|
|
74
|
+
saved.set(query.name, {
|
|
75
|
+
name: query.name,
|
|
76
|
+
description: query.description === undefined ? none : some(query.description),
|
|
77
|
+
program: checked.program,
|
|
78
|
+
root: datasets.filter(({ name }) => checked.reads.includes(name)).map(({ name, dataset }) => ({ name, path: dataset.path })),
|
|
79
|
+
saved_at: query.savedAt,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return saved;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=saved.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saved.js","sourceRoot":"","sources":["../../../src/query/saved.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAmC,MAAM,eAAe,CAAC;AAEpI,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,sGAAsG;AACtG,MAAM,eAAe,GAAG,GAAG,CAAC;AAqB5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,UAAU,iBAAiB,CAC7B,OAAuD,EACvD,OAAmC;IAEnC,6DAA6D;IAC7D,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE;QACzD,eAAe,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,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