@hypequery/datasets 0.30.0 → 0.32.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/dist/client-contract/build-from-deployment.d.ts +8 -0
- package/dist/client-contract/build-from-deployment.d.ts.map +1 -1
- package/dist/client-contract/build-from-deployment.js +1 -1
- package/dist/client-contract/deployment-annotations.d.ts +8 -2
- package/dist/client-contract/deployment-annotations.d.ts.map +1 -1
- package/dist/client-contract/deployment-annotations.js +37 -7
- package/dist/cloud-publication.d.ts +37 -0
- package/dist/cloud-publication.d.ts.map +1 -0
- package/dist/cloud-publication.js +46 -0
- package/dist/cloud-publishing.d.ts +14 -1
- package/dist/cloud-publishing.d.ts.map +1 -1
- package/dist/cloud-publishing.js +16 -0
- package/dist/codegen/cloud-source.d.ts +8 -0
- package/dist/codegen/cloud-source.d.ts.map +1 -0
- package/dist/codegen/cloud-source.js +90 -0
- package/dist/codegen/dataset-source.d.ts +19 -0
- package/dist/codegen/dataset-source.d.ts.map +1 -0
- package/dist/codegen/dataset-source.js +223 -0
- package/dist/codegen/errors.d.ts +11 -0
- package/dist/codegen/errors.d.ts.map +1 -0
- package/dist/codegen/errors.js +15 -0
- package/dist/codegen/formula-source.d.ts +8 -0
- package/dist/codegen/formula-source.d.ts.map +1 -0
- package/dist/codegen/formula-source.js +83 -0
- package/dist/codegen/index.d.ts +28 -0
- package/dist/codegen/index.d.ts.map +1 -0
- package/dist/codegen/index.js +67 -0
- package/dist/codegen/utils/declaration-order.d.ts +9 -0
- package/dist/codegen/utils/declaration-order.d.ts.map +1 -0
- package/dist/codegen/utils/declaration-order.js +28 -0
- package/dist/codegen/utils/member-order.d.ts +17 -0
- package/dist/codegen/utils/member-order.d.ts.map +1 -0
- package/dist/codegen/utils/member-order.js +52 -0
- package/dist/codegen/utils/naming.d.ts +7 -0
- package/dist/codegen/utils/naming.d.ts.map +1 -0
- package/dist/codegen/utils/naming.js +22 -0
- package/dist/codegen/utils/source-writer.d.ts +35 -0
- package/dist/codegen/utils/source-writer.d.ts.map +1 -0
- package/dist/codegen/utils/source-writer.js +121 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/utils/agent-catalog-projection.d.ts +9 -0
- package/dist/utils/agent-catalog-projection.d.ts.map +1 -1
- package/dist/utils/agent-catalog-projection.js +18 -3
- package/package.json +11 -3
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A contract holds something `dataset()` code can't express, so exporting it
|
|
3
|
+
* would change the model. Export refuses rather than writing an approximation
|
|
4
|
+
* (decision 0020 §3); each such feature needs authoring support first.
|
|
5
|
+
*/
|
|
6
|
+
export class ContractExportError extends Error {
|
|
7
|
+
dataset;
|
|
8
|
+
feature;
|
|
9
|
+
constructor(dataset, feature, detail) {
|
|
10
|
+
super(`Cannot export ${feature} on dataset "${dataset}": ${detail}`);
|
|
11
|
+
this.name = 'ContractExportError';
|
|
12
|
+
this.dataset = dataset;
|
|
13
|
+
this.feature = feature;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ProtocolExpression } from '@hypequery/protocol';
|
|
2
|
+
export interface FormulaSource {
|
|
3
|
+
readonly code: string;
|
|
4
|
+
/** Helpers from `@hypequery/datasets` the formula calls. */
|
|
5
|
+
readonly helpers: ReadonlySet<string>;
|
|
6
|
+
}
|
|
7
|
+
export declare function formulaSource(expression: ProtocolExpression, aliases: readonly string[], unsupported: (reason: string) => Error): FormulaSource;
|
|
8
|
+
//# sourceMappingURL=formula-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formula-source.d.ts","sourceRoot":"","sources":["../../src/codegen/formula-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAiB9D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACvC;AAED,wBAAgB,aAAa,CAC3B,UAAU,EAAE,kBAAkB,EAC9B,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,KAAK,GACrC,aAAa,CA0Ef"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { isBindingName, literal } from './utils/source-writer.js';
|
|
2
|
+
/**
|
|
3
|
+
* A derived measure's formula as the arrow function an author writes:
|
|
4
|
+
* `({ revenue, orders }) => divide(revenue, nullIfZero(orders))`.
|
|
5
|
+
*
|
|
6
|
+
* It accepts exactly the grammar `protocol-rehydrate-derivation.ts` rebuilds
|
|
7
|
+
* through `formulas.ts`, so the code calls the same helpers that produced the
|
|
8
|
+
* contract and its SQL is byte-identical. Anything else is refused.
|
|
9
|
+
*/
|
|
10
|
+
const BINARY = new Set(['add', 'subtract', 'multiply', 'divide']);
|
|
11
|
+
/** Every helper a formula can call: an input destructured under one of these names would hide it. */
|
|
12
|
+
const HELPERS = new Set([...BINARY, 'nullIfZero', 'floor', 'ceil', 'round', 'coalesce']);
|
|
13
|
+
export function formulaSource(expression, aliases, unsupported) {
|
|
14
|
+
const helpers = new Set();
|
|
15
|
+
const known = new Set(aliases);
|
|
16
|
+
const referenced = new Set();
|
|
17
|
+
// `({ revenue, orders }) => …` where every input can be a binding that hides
|
|
18
|
+
// no helper; otherwise `(inputs) => divide(inputs.divide, …)`.
|
|
19
|
+
const destructure = aliases.every(alias => isBindingName(alias) && !HELPERS.has(alias));
|
|
20
|
+
const reference = (name) => {
|
|
21
|
+
if (!known.has(name))
|
|
22
|
+
return literal(name);
|
|
23
|
+
referenced.add(name);
|
|
24
|
+
return destructure ? name : `inputs[${literal(name)}]`;
|
|
25
|
+
};
|
|
26
|
+
const numeric = (value, what) => {
|
|
27
|
+
if (value.kind !== 'literal' || typeof value.value !== 'number') {
|
|
28
|
+
throw unsupported(`${what} must be a numeric literal`);
|
|
29
|
+
}
|
|
30
|
+
return literal(value.value);
|
|
31
|
+
};
|
|
32
|
+
const arity = (args, expected, name) => {
|
|
33
|
+
if (args.length !== expected) {
|
|
34
|
+
throw unsupported(`"${name}" takes ${expected} argument(s), received ${args.length}`);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const operand = (value) => {
|
|
38
|
+
switch (value.kind) {
|
|
39
|
+
case 'reference':
|
|
40
|
+
return reference(String(value.name));
|
|
41
|
+
case 'binary':
|
|
42
|
+
if (!BINARY.has(value.operator)) {
|
|
43
|
+
throw unsupported(`unsupported operator "${value.operator}"`);
|
|
44
|
+
}
|
|
45
|
+
helpers.add(value.operator);
|
|
46
|
+
return `${value.operator}(${operand(value.left)}, ${operand(value.right)})`;
|
|
47
|
+
case 'call': {
|
|
48
|
+
const name = String(value.function);
|
|
49
|
+
helpers.add(name);
|
|
50
|
+
switch (name) {
|
|
51
|
+
case 'nullIfZero':
|
|
52
|
+
case 'floor':
|
|
53
|
+
case 'ceil':
|
|
54
|
+
arity(value.args, 1, name);
|
|
55
|
+
return `${name}(${operand(value.args[0])})`;
|
|
56
|
+
case 'round':
|
|
57
|
+
arity(value.args, 2, name);
|
|
58
|
+
return `round(${operand(value.args[0])}, ${numeric(value.args[1], 'a "round" precision')})`;
|
|
59
|
+
case 'coalesce': {
|
|
60
|
+
arity(value.args, 2, name);
|
|
61
|
+
const fallback = value.args[1];
|
|
62
|
+
const second = fallback.kind === 'literal'
|
|
63
|
+
? numeric(fallback, 'a "coalesce" fallback literal')
|
|
64
|
+
: operand(fallback);
|
|
65
|
+
return `coalesce(${operand(value.args[0])}, ${second})`;
|
|
66
|
+
}
|
|
67
|
+
default:
|
|
68
|
+
throw unsupported(`unsupported function "${name}"`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
default:
|
|
72
|
+
throw unsupported(`a formula cannot contain a "${value.kind}" expression here`);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
if (expression.kind === 'reference') {
|
|
76
|
+
throw unsupported('a formula must combine its inputs rather than name one');
|
|
77
|
+
}
|
|
78
|
+
const body = operand(expression);
|
|
79
|
+
const parameter = destructure
|
|
80
|
+
? referenced.size === 0 ? '()' : `({ ${aliases.filter(alias => referenced.has(alias)).join(', ')} })`
|
|
81
|
+
: referenced.size === 0 ? '()' : '(inputs)';
|
|
82
|
+
return { code: `${parameter} => ${body}`, helpers };
|
|
83
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@hypequery/datasets/codegen`: a deployment contract as the TypeScript that
|
|
3
|
+
* builds it (decision 0020 §3).
|
|
4
|
+
*
|
|
5
|
+
* The output is idiomatic `dataset()` code, a `datasets.ts` and the
|
|
6
|
+
* `cloud.ts` entrypoint `hypequery deploy` reads, and `publishToCloud` over it
|
|
7
|
+
* builds the same contract as the input, with its members in name order (the
|
|
8
|
+
* only order code produces; see `canonicalMemberOrder`). That round trip is
|
|
9
|
+
* the guarantee: anything the authoring API can't reproduce exactly is
|
|
10
|
+
* refused with `ContractExportError` instead of being approximated.
|
|
11
|
+
*/
|
|
12
|
+
import { canonicalMemberOrder } from './utils/member-order.js';
|
|
13
|
+
import { ContractExportError } from './errors.js';
|
|
14
|
+
export { ContractExportError, canonicalMemberOrder };
|
|
15
|
+
export interface GenerateDatasetSourceOptions {
|
|
16
|
+
/** Comment lines at the top of each file, without `//`. */
|
|
17
|
+
readonly header?: readonly string[];
|
|
18
|
+
/** Module the code imports from; `@hypequery/datasets` unless a test points it elsewhere. */
|
|
19
|
+
readonly importSource?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface GeneratedDatasetSource {
|
|
22
|
+
/** File path relative to the output directory, and its contents. */
|
|
23
|
+
readonly files: Readonly<Record<'datasets.ts' | 'cloud.ts', string>>;
|
|
24
|
+
/** The file `hypequery deploy` takes. */
|
|
25
|
+
readonly entrypoint: 'cloud.ts';
|
|
26
|
+
}
|
|
27
|
+
export declare function generateDatasetSource(contract: unknown, options?: GenerateDatasetSourceOptions): GeneratedDatasetSource;
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,CAAC;AAErD,MAAM,WAAW,4BAA4B;IAC3C,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,6FAA6F;IAC7F,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,sBAAsB;IACrC,oEAAoE;IACpE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,aAAa,GAAG,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IACrE,yCAAyC;IACzC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;CACjC;AAOD,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,OAAO,EACjB,OAAO,GAAE,4BAAiC,GACzC,sBAAsB,CAgDxB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@hypequery/datasets/codegen`: a deployment contract as the TypeScript that
|
|
3
|
+
* builds it (decision 0020 §3).
|
|
4
|
+
*
|
|
5
|
+
* The output is idiomatic `dataset()` code, a `datasets.ts` and the
|
|
6
|
+
* `cloud.ts` entrypoint `hypequery deploy` reads, and `publishToCloud` over it
|
|
7
|
+
* builds the same contract as the input, with its members in name order (the
|
|
8
|
+
* only order code produces; see `canonicalMemberOrder`). That round trip is
|
|
9
|
+
* the guarantee: anything the authoring API can't reproduce exactly is
|
|
10
|
+
* refused with `ContractExportError` instead of being approximated.
|
|
11
|
+
*/
|
|
12
|
+
import { validateProtocolDeploymentContract } from '@hypequery/protocol';
|
|
13
|
+
import { compareStrings } from '../utils/canonical-json.js';
|
|
14
|
+
import { cloudSource } from './cloud-source.js';
|
|
15
|
+
import { datasetSource } from './dataset-source.js';
|
|
16
|
+
import { declarationOrder } from './utils/declaration-order.js';
|
|
17
|
+
import { canonicalMemberOrder } from './utils/member-order.js';
|
|
18
|
+
import { datasetConstantNames } from './utils/naming.js';
|
|
19
|
+
import { ContractExportError } from './errors.js';
|
|
20
|
+
import { literal, propertyKey } from './utils/source-writer.js';
|
|
21
|
+
export { ContractExportError, canonicalMemberOrder };
|
|
22
|
+
const DEFAULT_HEADER = [
|
|
23
|
+
'Generated by hypequery from a deployment contract.',
|
|
24
|
+
'This code is now the source of the model: edit it here and deploy with `npx hypequery deploy`.',
|
|
25
|
+
];
|
|
26
|
+
export function generateDatasetSource(contract, options = {}) {
|
|
27
|
+
// Code can only produce members in name order (see `canonicalMemberOrder`).
|
|
28
|
+
const validated = canonicalMemberOrder(validateProtocolDeploymentContract(contract));
|
|
29
|
+
const importSource = options.importSource ?? '@hypequery/datasets';
|
|
30
|
+
// A line break in a header line would end its comment, so each piece gets its own `//`.
|
|
31
|
+
const header = (options.header ?? DEFAULT_HEADER)
|
|
32
|
+
.flatMap(line => line.split(/\r\n|[\n\r\u2028\u2029]/))
|
|
33
|
+
.map(line => `// ${line}`.trimEnd())
|
|
34
|
+
.join('\n');
|
|
35
|
+
const datasets = validated.datasets;
|
|
36
|
+
if (!datasets.some(dataset => dataset.endpoint !== undefined)) {
|
|
37
|
+
throw new ContractExportError(String(datasets[0]?.name ?? '(none)'), 'the deployment', 'publishToCloud needs at least one dataset with an endpoint');
|
|
38
|
+
}
|
|
39
|
+
const constants = datasetConstantNames(datasets.map(dataset => String(dataset.name)));
|
|
40
|
+
const order = declarationOrder(datasets);
|
|
41
|
+
const earlier = new Set();
|
|
42
|
+
const sources = order.map(dataset => {
|
|
43
|
+
const source = datasetSource(dataset, constants, new Set(earlier));
|
|
44
|
+
earlier.add(String(dataset.name));
|
|
45
|
+
return source;
|
|
46
|
+
});
|
|
47
|
+
const imports = [...new Set(sources.flatMap(source => [...source.imports]))]
|
|
48
|
+
.sort((left, right) => compareStrings(left.replace(/^type /, ''), right.replace(/^type /, '')));
|
|
49
|
+
const registry = datasets
|
|
50
|
+
.filter(dataset => dataset.endpoint !== undefined)
|
|
51
|
+
.map(dataset => ` ${propertyKey(String(dataset.name))}: ${constants.get(String(dataset.name))},`);
|
|
52
|
+
const datasetsFile = [
|
|
53
|
+
header,
|
|
54
|
+
'',
|
|
55
|
+
`import { ${imports.join(', ')} } from ${literal(importSource)};`,
|
|
56
|
+
'',
|
|
57
|
+
sources.map(source => source.code).join('\n'),
|
|
58
|
+
'/** The datasets published with an endpoint. */',
|
|
59
|
+
registry.length > 0 ? `export const datasets = {\n${registry.join('\n')}\n};` : 'export const datasets = {};',
|
|
60
|
+
'',
|
|
61
|
+
].join('\n');
|
|
62
|
+
const cloud = cloudSource(datasets, constants, importSource);
|
|
63
|
+
return {
|
|
64
|
+
files: { 'datasets.ts': datasetsFile, 'cloud.ts': `${header}\n\n${cloud.code}` },
|
|
65
|
+
entrypoint: 'cloud.ts',
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ProtocolDeploymentDataset } from '@hypequery/protocol';
|
|
2
|
+
/**
|
|
3
|
+
* The order datasets are declared in: each after the targets of its to-one
|
|
4
|
+
* relationships (`belongsTo`, `hasOne`), so TypeScript infers the target
|
|
5
|
+
* first, ties by name. Datasets in a to-one cycle follow by name; the edges
|
|
6
|
+
* that then point down the file are annotated where they're written.
|
|
7
|
+
*/
|
|
8
|
+
export declare function declarationOrder(datasets: readonly ProtocolDeploymentDataset[]): ProtocolDeploymentDataset[];
|
|
9
|
+
//# sourceMappingURL=declaration-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declaration-order.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/declaration-order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAIrE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,SAAS,yBAAyB,EAAE,GAC7C,yBAAyB,EAAE,CAoB7B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { byName } from '../../utils/by-name.js';
|
|
2
|
+
/**
|
|
3
|
+
* The order datasets are declared in: each after the targets of its to-one
|
|
4
|
+
* relationships (`belongsTo`, `hasOne`), so TypeScript infers the target
|
|
5
|
+
* first, ties by name. Datasets in a to-one cycle follow by name; the edges
|
|
6
|
+
* that then point down the file are annotated where they're written.
|
|
7
|
+
*/
|
|
8
|
+
export function declarationOrder(datasets) {
|
|
9
|
+
const sorted = [...datasets].sort((left, right) => byName({ name: String(left.name) }, { name: String(right.name) }));
|
|
10
|
+
const names = new Set(sorted.map(dataset => String(dataset.name)));
|
|
11
|
+
const needs = new Map(sorted.map(dataset => [
|
|
12
|
+
String(dataset.name),
|
|
13
|
+
new Set(dataset.relationships
|
|
14
|
+
.filter(item => item.kind !== 'hasMany' && String(item.target) !== String(dataset.name) && names.has(String(item.target)))
|
|
15
|
+
.map(item => String(item.target))),
|
|
16
|
+
]));
|
|
17
|
+
const placed = new Set();
|
|
18
|
+
const order = [];
|
|
19
|
+
while (order.length < sorted.length) {
|
|
20
|
+
const ready = sorted.find(dataset => !placed.has(String(dataset.name))
|
|
21
|
+
&& [...(needs.get(String(dataset.name)) ?? [])].every(target => placed.has(target)))
|
|
22
|
+
// Only a cycle is left: take the first by name, and its edges are annotated.
|
|
23
|
+
?? sorted.find(dataset => !placed.has(String(dataset.name)));
|
|
24
|
+
placed.add(String(ready.name));
|
|
25
|
+
order.push(ready);
|
|
26
|
+
}
|
|
27
|
+
return order;
|
|
28
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ProtocolDeploymentContract } from '@hypequery/protocol';
|
|
2
|
+
/**
|
|
3
|
+
* A contract with its named members in the order `dataset()` code produces
|
|
4
|
+
* them: datasets, dimensions, filters and relationships by name, and base
|
|
5
|
+
* measures by name followed by derived measures by name. The lists the
|
|
6
|
+
* adapter sorts inside a member are sorted too: `examples`, `synonyms` and SQL
|
|
7
|
+
* `dependencies` (all duplicate-free once validated).
|
|
8
|
+
*
|
|
9
|
+
* Code can't keep any other order, because `protocol-adapter.ts` sorts these
|
|
10
|
+
* lists, so nothing in a contract depends on it. Cloud's editor appends
|
|
11
|
+
* members as they're added, so exporting a Cloud model gives code whose
|
|
12
|
+
* contract equals this, not always the input byte for byte. Any other order
|
|
13
|
+
* inside a member (filter operators, relationship keys, `uses`, `defaults`)
|
|
14
|
+
* is kept.
|
|
15
|
+
*/
|
|
16
|
+
export declare function canonicalMemberOrder(contract: ProtocolDeploymentContract): ProtocolDeploymentContract;
|
|
17
|
+
//# sourceMappingURL=member-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-order.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/member-order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAK3B,MAAM,qBAAqB,CAAC;AAsB7B;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,0BAA0B,GAAG,0BAA0B,CAuBrG"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { byName } from '../../utils/by-name.js';
|
|
2
|
+
import { compareStrings } from '../../utils/canonical-json.js';
|
|
3
|
+
const sorted = (values) => [...values].sort((left, right) => compareStrings(String(left), String(right)));
|
|
4
|
+
/** `examples` and `synonyms` sorted, as `snapshotSemanticMetadata` writes them. */
|
|
5
|
+
function metadataOrder(item) {
|
|
6
|
+
return {
|
|
7
|
+
...item,
|
|
8
|
+
...(item.examples !== undefined ? { examples: sorted(item.examples) } : {}),
|
|
9
|
+
...(item.synonyms !== undefined ? { synonyms: sorted(item.synonyms) } : {}),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/** SQL `dependencies` sorted, as `protocol-adapter.ts` writes them. */
|
|
13
|
+
function sqlOrder(expression) {
|
|
14
|
+
return { ...expression, dependencies: sorted(expression.dependencies) };
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A contract with its named members in the order `dataset()` code produces
|
|
18
|
+
* them: datasets, dimensions, filters and relationships by name, and base
|
|
19
|
+
* measures by name followed by derived measures by name. The lists the
|
|
20
|
+
* adapter sorts inside a member are sorted too: `examples`, `synonyms` and SQL
|
|
21
|
+
* `dependencies` (all duplicate-free once validated).
|
|
22
|
+
*
|
|
23
|
+
* Code can't keep any other order, because `protocol-adapter.ts` sorts these
|
|
24
|
+
* lists, so nothing in a contract depends on it. Cloud's editor appends
|
|
25
|
+
* members as they're added, so exporting a Cloud model gives code whose
|
|
26
|
+
* contract equals this, not always the input byte for byte. Any other order
|
|
27
|
+
* inside a member (filter operators, relationship keys, `uses`, `defaults`)
|
|
28
|
+
* is kept.
|
|
29
|
+
*/
|
|
30
|
+
export function canonicalMemberOrder(contract) {
|
|
31
|
+
const named = (items) => [...items].sort((left, right) => byName({ name: String(left.name) }, { name: String(right.name) }));
|
|
32
|
+
const isDerived = (measure) => 'kind' in measure && measure.kind === 'derived';
|
|
33
|
+
return {
|
|
34
|
+
...contract,
|
|
35
|
+
datasets: named(contract.datasets).map((dataset) => ({
|
|
36
|
+
...metadataOrder(dataset),
|
|
37
|
+
dimensions: named(dataset.dimensions).map(dimension => ({
|
|
38
|
+
...metadataOrder(dimension),
|
|
39
|
+
source: dimension.source.kind === 'sql-expression' ? sqlOrder(dimension.source) : dimension.source,
|
|
40
|
+
})),
|
|
41
|
+
measures: [
|
|
42
|
+
...named(dataset.measures.filter(measure => !isDerived(measure))).map(measure => {
|
|
43
|
+
const ordered = metadataOrder(measure);
|
|
44
|
+
return 'sql' in ordered && ordered.sql !== undefined ? { ...ordered, sql: sqlOrder(ordered.sql) } : ordered;
|
|
45
|
+
}),
|
|
46
|
+
...named(dataset.measures.filter(isDerived)).map(metadataOrder),
|
|
47
|
+
],
|
|
48
|
+
filters: named(dataset.filters).map(metadataOrder),
|
|
49
|
+
relationships: named(dataset.relationships),
|
|
50
|
+
})),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The exported constant for each dataset, as `generate:datasets` names them:
|
|
3
|
+
* `order_items` → `OrderItemsDataset`. Names that collide or can't be a
|
|
4
|
+
* binding get a numeric suffix, so every dataset has exactly one constant.
|
|
5
|
+
*/
|
|
6
|
+
export declare function datasetConstantNames(names: readonly string[]): ReadonlyMap<string, string>;
|
|
7
|
+
//# sourceMappingURL=naming.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naming.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/naming.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAa1F"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isBindingName } from './source-writer.js';
|
|
2
|
+
/**
|
|
3
|
+
* The exported constant for each dataset, as `generate:datasets` names them:
|
|
4
|
+
* `order_items` → `OrderItemsDataset`. Names that collide or can't be a
|
|
5
|
+
* binding get a numeric suffix, so every dataset has exactly one constant.
|
|
6
|
+
*/
|
|
7
|
+
export function datasetConstantNames(names) {
|
|
8
|
+
const used = new Set();
|
|
9
|
+
const result = new Map();
|
|
10
|
+
for (const name of [...names].sort()) {
|
|
11
|
+
const words = name.split(/[^A-Za-z0-9]+/).filter(Boolean);
|
|
12
|
+
let base = `${words.map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('')}Dataset`;
|
|
13
|
+
if (!isBindingName(base) || /^[0-9]/.test(base))
|
|
14
|
+
base = `Dataset${base}`;
|
|
15
|
+
let candidate = base;
|
|
16
|
+
for (let suffix = 2; used.has(candidate); suffix += 1)
|
|
17
|
+
candidate = `${base}${suffix}`;
|
|
18
|
+
used.add(candidate);
|
|
19
|
+
result.set(name, candidate);
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writes JavaScript values as TypeScript source, the way a person would type
|
|
3
|
+
* them: single-quoted strings, bare keys where they are identifiers, short
|
|
4
|
+
* collections on one line. Output is deterministic for the same input, which
|
|
5
|
+
* is what lets exported code be compared byte for byte.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Source text to place as-is, such as `dimension.string()` or a formula. A
|
|
9
|
+
* class rather than a tagged object, so no plain object (say, a dimensions
|
|
10
|
+
* map with a member named like the tag) can pass for one.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Code {
|
|
13
|
+
readonly text: string;
|
|
14
|
+
constructor(text: string);
|
|
15
|
+
}
|
|
16
|
+
export declare function code(text: string): Code;
|
|
17
|
+
/** True when `name` can be a variable or destructured binding. */
|
|
18
|
+
export declare function isBindingName(name: string): boolean;
|
|
19
|
+
/** Single-quoted, or double-quoted when that avoids escaping an apostrophe (as Prettier does). */
|
|
20
|
+
export declare function stringLiteral(value: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* An object key: bare when it is an identifier. `__proto__` is computed
|
|
23
|
+
* (`['__proto__']`): bare or quoted, it would set the object's prototype
|
|
24
|
+
* instead of creating a property.
|
|
25
|
+
*/
|
|
26
|
+
export declare function propertyKey(key: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* `value` as source at `indent` (the current line's indentation). Objects and
|
|
29
|
+
* arrays go on one line when that fits in `LINE` columns and holds no nested
|
|
30
|
+
* multi-line value; otherwise one entry per line.
|
|
31
|
+
*/
|
|
32
|
+
export declare function literal(value: unknown, indent?: string): string;
|
|
33
|
+
/** `name(arg, …)`, dropping trailing `undefined` arguments. */
|
|
34
|
+
export declare function call(name: string, args: readonly unknown[], indent?: string): Code;
|
|
35
|
+
//# sourceMappingURL=source-writer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-writer.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/source-writer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,qBAAa,IAAI;IACf,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM;CAGzB;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEvC;AAgBD,kEAAkE;AAClE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,kGAAkG;AAClG,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAenD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG/C;AAID;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,SAAK,GAAG,MAAM,CAiC3D;AAED,+DAA+D;AAC/D,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,OAAO,EAAE,EAAE,MAAM,SAAK,GAAG,IAAI,CAI9E"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writes JavaScript values as TypeScript source, the way a person would type
|
|
3
|
+
* them: single-quoted strings, bare keys where they are identifiers, short
|
|
4
|
+
* collections on one line. Output is deterministic for the same input, which
|
|
5
|
+
* is what lets exported code be compared byte for byte.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Source text to place as-is, such as `dimension.string()` or a formula. A
|
|
9
|
+
* class rather than a tagged object, so no plain object (say, a dimensions
|
|
10
|
+
* map with a member named like the tag) can pass for one.
|
|
11
|
+
*/
|
|
12
|
+
export class Code {
|
|
13
|
+
text;
|
|
14
|
+
constructor(text) {
|
|
15
|
+
this.text = text;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function code(text) {
|
|
19
|
+
return new Code(text);
|
|
20
|
+
}
|
|
21
|
+
function isCode(value) {
|
|
22
|
+
return value instanceof Code;
|
|
23
|
+
}
|
|
24
|
+
const IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
25
|
+
const RESERVED = new Set([
|
|
26
|
+
'break', 'case', 'catch', 'class', 'const', 'continue', 'debugger', 'default', 'delete', 'do',
|
|
27
|
+
'else', 'enum', 'export', 'extends', 'false', 'finally', 'for', 'function', 'if', 'import', 'in',
|
|
28
|
+
'instanceof', 'new', 'null', 'return', 'super', 'switch', 'this', 'throw', 'true', 'try',
|
|
29
|
+
'typeof', 'var', 'void', 'while', 'with', 'yield', 'let', 'static', 'implements', 'interface',
|
|
30
|
+
'package', 'private', 'protected', 'public', 'await', 'arguments', 'eval',
|
|
31
|
+
]);
|
|
32
|
+
/** True when `name` can be a variable or destructured binding. */
|
|
33
|
+
export function isBindingName(name) {
|
|
34
|
+
return IDENTIFIER.test(name) && !RESERVED.has(name);
|
|
35
|
+
}
|
|
36
|
+
/** Single-quoted, or double-quoted when that avoids escaping an apostrophe (as Prettier does). */
|
|
37
|
+
export function stringLiteral(value) {
|
|
38
|
+
const quote = value.includes("'") && !value.includes('"') ? '"' : "'";
|
|
39
|
+
let out = quote;
|
|
40
|
+
for (const char of value) {
|
|
41
|
+
const point = char.codePointAt(0);
|
|
42
|
+
if (char === '\\')
|
|
43
|
+
out += '\\\\';
|
|
44
|
+
else if (char === quote)
|
|
45
|
+
out += `\\${quote}`;
|
|
46
|
+
else if (char === '\n')
|
|
47
|
+
out += '\\n';
|
|
48
|
+
else if (char === '\r')
|
|
49
|
+
out += '\\r';
|
|
50
|
+
else if (char === '\t')
|
|
51
|
+
out += '\\t';
|
|
52
|
+
else if (point < 0x20 || point === 0x7f || point === 0x2028 || point === 0x2029) {
|
|
53
|
+
out += `\\u${point.toString(16).padStart(4, '0')}`;
|
|
54
|
+
}
|
|
55
|
+
else
|
|
56
|
+
out += char;
|
|
57
|
+
}
|
|
58
|
+
return `${out}${quote}`;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* An object key: bare when it is an identifier. `__proto__` is computed
|
|
62
|
+
* (`['__proto__']`): bare or quoted, it would set the object's prototype
|
|
63
|
+
* instead of creating a property.
|
|
64
|
+
*/
|
|
65
|
+
export function propertyKey(key) {
|
|
66
|
+
if (key === '__proto__')
|
|
67
|
+
return `[${stringLiteral(key)}]`;
|
|
68
|
+
return IDENTIFIER.test(key) ? key : stringLiteral(key);
|
|
69
|
+
}
|
|
70
|
+
const LINE = 100;
|
|
71
|
+
/**
|
|
72
|
+
* `value` as source at `indent` (the current line's indentation). Objects and
|
|
73
|
+
* arrays go on one line when that fits in `LINE` columns and holds no nested
|
|
74
|
+
* multi-line value; otherwise one entry per line.
|
|
75
|
+
*/
|
|
76
|
+
export function literal(value, indent = '') {
|
|
77
|
+
if (isCode(value))
|
|
78
|
+
return value.text;
|
|
79
|
+
if (value === null)
|
|
80
|
+
return 'null';
|
|
81
|
+
if (typeof value === 'string')
|
|
82
|
+
return stringLiteral(value);
|
|
83
|
+
if (typeof value === 'boolean')
|
|
84
|
+
return String(value);
|
|
85
|
+
if (typeof value === 'number') {
|
|
86
|
+
if (!Number.isFinite(value))
|
|
87
|
+
throw new Error(`Cannot write ${value} as a literal.`);
|
|
88
|
+
return Object.is(value, -0) ? '-0' : String(value);
|
|
89
|
+
}
|
|
90
|
+
const inner = `${indent} `;
|
|
91
|
+
if (Array.isArray(value)) {
|
|
92
|
+
if (value.length === 0)
|
|
93
|
+
return '[]';
|
|
94
|
+
const items = value.map(item => literal(item, inner));
|
|
95
|
+
const flat = `[${items.join(', ')}]`;
|
|
96
|
+
if (!flat.includes('\n') && indent.length + flat.length <= LINE)
|
|
97
|
+
return flat;
|
|
98
|
+
return `[\n${items.map(item => `${inner}${item},`).join('\n')}\n${indent}]`;
|
|
99
|
+
}
|
|
100
|
+
if (typeof value === 'object') {
|
|
101
|
+
const entries = Object.entries(value).filter(([, item]) => item !== undefined);
|
|
102
|
+
if (entries.length === 0)
|
|
103
|
+
return '{}';
|
|
104
|
+
// `{ datasets }` rather than `{ datasets: datasets }`.
|
|
105
|
+
const items = entries.map(([key, item]) => (isCode(item) && item.text === key && IDENTIFIER.test(key) && key !== '__proto__'
|
|
106
|
+
? key
|
|
107
|
+
: `${propertyKey(key)}: ${literal(item, inner)}`));
|
|
108
|
+
const flat = `{ ${items.join(', ')} }`;
|
|
109
|
+
if (!flat.includes('\n') && indent.length + flat.length <= LINE)
|
|
110
|
+
return flat;
|
|
111
|
+
return `{\n${items.map(item => `${inner}${item},`).join('\n')}\n${indent}}`;
|
|
112
|
+
}
|
|
113
|
+
throw new Error(`Cannot write a ${typeof value} as a literal.`);
|
|
114
|
+
}
|
|
115
|
+
/** `name(arg, …)`, dropping trailing `undefined` arguments. */
|
|
116
|
+
export function call(name, args, indent = '') {
|
|
117
|
+
const kept = [...args];
|
|
118
|
+
while (kept.length > 0 && kept[kept.length - 1] === undefined)
|
|
119
|
+
kept.pop();
|
|
120
|
+
return code(`${name}(${kept.map(arg => literal(arg, indent)).join(', ')})`);
|
|
121
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export type { BuildProtocolDeploymentContractOptions } from './protocol-deployme
|
|
|
28
28
|
export { rehydrateProtocolDeploymentContract } from './protocol-rehydrate.js';
|
|
29
29
|
export type { BuildProtocolDatasetContractOptions } from './protocol-adapter.js';
|
|
30
30
|
export { publishToCloud } from './cloud-publishing.js';
|
|
31
|
+
export { defineBusinessContext, defineCloudPublication } from './cloud-publication.js';
|
|
32
|
+
export type { BusinessContextInput, CloudPublication, CloudPublicationOptions, } from './cloud-publication.js';
|
|
31
33
|
export { buildClientContract } from './client-contract/build-from-deployment.js';
|
|
32
34
|
export type { BuildClientContractOptions, ClientContractCapabilities } from './client-contract/build-from-deployment.js';
|
|
33
35
|
export type { ClientContractProfile } from './client-contract/deployment-profile.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAGxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAC7D,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,GAC5D,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,KAAK,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAG9G,OAAO,EACL,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAC/B,UAAU,EAAE,QAAQ,EACpB,KAAK,EAAE,KAAK,EAAE,IAAI,GACnB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,EAAE,EAAE,GAA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B,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,SAAS,EACT,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,kBAAkB,EAAE,wBAAwB,EAAE,6BAA6B,GAC5E,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AACvH,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,7 @@ export { buildProtocolDeploymentContract } from './protocol-deployment-adapter.j
|
|
|
33
33
|
export { assertDeployable } from './utils/deployable-formulas.js';
|
|
34
34
|
export { rehydrateProtocolDeploymentContract } from './protocol-rehydrate.js';
|
|
35
35
|
export { publishToCloud } from './cloud-publishing.js';
|
|
36
|
+
export { defineBusinessContext, defineCloudPublication } from './cloud-publication.js';
|
|
36
37
|
export { buildClientContract } from './client-contract/build-from-deployment.js';
|
|
37
38
|
export { buildDatasetClientContract } from './client-contract/build-from-datasets.js';
|
|
38
39
|
// Portable native execution of a semantic invocation (decision 0005).
|
|
@@ -28,6 +28,8 @@ export interface RecordShapedDataset extends SemanticMetadata {
|
|
|
28
28
|
readonly timeKey?: string;
|
|
29
29
|
readonly dimensions: Readonly<Record<string, SemanticMetadata & {
|
|
30
30
|
readonly type: FieldType;
|
|
31
|
+
/** The column a dimension reads, when it differs from its name. */
|
|
32
|
+
readonly column?: string;
|
|
31
33
|
readonly label?: string;
|
|
32
34
|
readonly description?: string;
|
|
33
35
|
readonly filterable: boolean;
|
|
@@ -77,6 +79,13 @@ export declare function optionalText<T extends {
|
|
|
77
79
|
/** Reduces a limits object to the four keys the agent-safe catalog publishes. */
|
|
78
80
|
export declare function normalizedLimits(limits: DatasetLimits | undefined): DatasetLimits;
|
|
79
81
|
export declare function datasetDescription(name: string, description?: string): string;
|
|
82
|
+
/**
|
|
83
|
+
* The published dimension a dataset's `timeKey` refers to. `timeKey` names a
|
|
84
|
+
* column, so it matches a dimension by name or by the column the dimension
|
|
85
|
+
* reads (`occurredAt` over `occurred_at`). Null when no published dimension
|
|
86
|
+
* reads it, so the agent is never pointed at a field it cannot select.
|
|
87
|
+
*/
|
|
88
|
+
export declare function timeDimensionName(timeKey: string | undefined, dimensions: RecordShapedDataset['dimensions'], published: ReadonlySet<string>): string | null;
|
|
80
89
|
/** Projects a `DatasetCatalog` or `ContractDataset` — they share one shape. */
|
|
81
90
|
export declare function recordDatasetToAgentDataset(dataset: RecordShapedDataset): AgentCatalogDataset;
|
|
82
91
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-catalog-projection.d.ts","sourceRoot":"","sources":["../../src/utils/agent-catalog-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACjG;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,KAAK,EACV,mBAAmB,EAGpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAIrB;;;;;;GAMG;AACH,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC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