primitive-admin 1.0.55 → 1.0.57
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/assets/skill/skills/primitive-platform/SKILL.md +230 -2
- package/dist/bin/primitive.js +1 -1
- package/dist/src/commands/database-types.js +4 -4
- package/dist/src/commands/database-types.js.map +1 -1
- package/dist/src/commands/databases.js +5 -5
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.js +2 -2
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/guides.d.ts +15 -12
- package/dist/src/commands/guides.js +22 -15
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/metadata.js +48 -3
- package/dist/src/commands/metadata.js.map +1 -1
- package/dist/src/commands/scripts.d.ts +18 -0
- package/dist/src/commands/scripts.js +59 -5
- package/dist/src/commands/scripts.js.map +1 -1
- package/dist/src/commands/sync-app-settings.d.ts +14 -4
- package/dist/src/commands/sync-app-settings.js +48 -8
- package/dist/src/commands/sync-app-settings.js.map +1 -1
- package/dist/src/commands/sync.d.ts +100 -0
- package/dist/src/commands/sync.js +1578 -402
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/workflows.js +23 -6
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +27 -1
- package/dist/src/lib/api-client.js +25 -2
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.js +4 -0
- package/dist/src/lib/app-settings-descriptor.js.map +1 -1
- package/dist/src/lib/codegen-shared/generatedFiles.d.ts +21 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js +40 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -1
- package/dist/src/lib/codegen-shared/prettierStable.d.ts +262 -0
- package/dist/src/lib/codegen-shared/prettierStable.js +610 -0
- package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -0
- package/dist/src/lib/db-codegen/dbGenerator.js +8 -5
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/db-codegen/dbNaming.d.ts +5 -0
- package/dist/src/lib/db-codegen/dbNaming.js +8 -2
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +17 -2
- package/dist/src/lib/db-codegen/dbTemplates.js +85 -40
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +13 -22
- package/dist/src/lib/db-codegen/dbTsTypes.js +33 -28
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +11 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +11 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -1
- package/dist/src/lib/generated-allowlist.js +7 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -1
- package/dist/src/lib/platform-owned.d.ts +37 -0
- package/dist/src/lib/platform-owned.js +46 -0
- package/dist/src/lib/platform-owned.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbGenerator.d.ts +32 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js +338 -36
- package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +1 -1
- package/dist/src/lib/swift-codegen/dbSwiftTypes.js +1 -1
- package/dist/src/lib/swift-codegen/generator.d.ts +1 -0
- package/dist/src/lib/swift-codegen/generator.js +91 -3
- package/dist/src/lib/swift-codegen/generator.js.map +1 -1
- package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +90 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.js +152 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +222 -10
- package/dist/src/lib/sync-resource-types.js +407 -20
- package/dist/src/lib/sync-resource-types.js.map +1 -1
- package/dist/src/lib/template.d.ts +1 -1
- package/dist/src/lib/template.js +6 -3
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/toml-metadata-config.js +18 -0
- package/dist/src/lib/toml-metadata-config.js.map +1 -1
- package/dist/src/lib/workflow-apply.js +12 -2
- package/dist/src/lib/workflow-apply.js.map +1 -1
- package/dist/src/lib/workflow-codegen/generator.d.ts +9 -0
- package/dist/src/lib/workflow-codegen/generator.js +126 -55
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -1
- package/dist/src/lib/workflow-codegen/invokerIR.d.ts +6 -8
- package/dist/src/lib/workflow-codegen/invokerIR.js +8 -8
- package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -1
- package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +17 -1
- package/dist/src/lib/workflow-codegen/schemaToTs.js +59 -38
- package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -1
- package/dist/src/lib/workflow-payload.d.ts +19 -0
- package/dist/src/lib/workflow-payload.js +21 -0
- package/dist/src/lib/workflow-payload.js.map +1 -1
- package/dist/src/lib/workflow-toml-validator.d.ts +30 -0
- package/dist/src/lib/workflow-toml-validator.js +206 -0
- package/dist/src/lib/workflow-toml-validator.js.map +1 -1
- package/dist/src/types/index.d.ts +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,610 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prettier-default-stable emission helpers for the codegen emitters (#1565).
|
|
3
|
+
*
|
|
4
|
+
* ─────────────────────────── FORMATTING CONTRACT ───────────────────────────
|
|
5
|
+
* Generated `*.generated.ts` output MUST be a fixed point of Prettier's DEFAULT
|
|
6
|
+
* config (printWidth 80, 2-space indent, `trailingComma: "all"`): running
|
|
7
|
+
* `prettier --write` over a freshly generated file must leave it byte-for-byte
|
|
8
|
+
* unchanged.
|
|
9
|
+
*
|
|
10
|
+
* Why it matters: `databases codegen --check` / `workflows codegen --check`
|
|
11
|
+
* compare the emission to what is on disk BYTE-FOR-BYTE
|
|
12
|
+
* (`codegen-shared/generatedFiles.ts`). A consumer whose pipeline runs codegen,
|
|
13
|
+
* then `prettier --write`, then `--check` in CI (the common shape) fails the
|
|
14
|
+
* check the moment the emission is not already prettier-formatted, even though
|
|
15
|
+
* nothing is semantically stale. That is the bug this module fixes.
|
|
16
|
+
*
|
|
17
|
+
* By maintainer decision (#1565) there is NO Prettier dependency anywhere — not
|
|
18
|
+
* at runtime, not as a devDependency, and there is no automated round-trip
|
|
19
|
+
* test. The contract is upheld by this module plus the exact-output unit tests
|
|
20
|
+
* in `cli/tests/unit/codegen-prettier-stable.test.ts`.
|
|
21
|
+
*
|
|
22
|
+
* **If you change an emitter or this module, verify the contract by hand before
|
|
23
|
+
* landing:** regenerate a representative output (a database type with long op
|
|
24
|
+
* names and a projection; a workflow with a long key and a `oneOf` output),
|
|
25
|
+
* run Prettier's default config over the files, and confirm they are unchanged
|
|
26
|
+
* and `--check` still passes.
|
|
27
|
+
*
|
|
28
|
+
* Note "always emit the multi-line shape" is NOT sufficient on its own:
|
|
29
|
+
* Prettier COLLAPSES a broken call/parameter/type-argument list that would fit
|
|
30
|
+
* within 80 columns, so an over-broken construct is just as unstable as an
|
|
31
|
+
* over-long one. It only preserves an author's line break inside an object
|
|
32
|
+
* literal / object type. So the helpers below reproduce Prettier's width
|
|
33
|
+
* decision for the handful of shapes these generators emit, and the emitters
|
|
34
|
+
* always break the object literals (where the break IS preserved).
|
|
35
|
+
* ───────────────────────────────────────────────────────────────────────────
|
|
36
|
+
*/
|
|
37
|
+
/** Prettier's default `printWidth`. */
|
|
38
|
+
export const PRINT_WIDTH = 80;
|
|
39
|
+
/** `level` indentation levels of 2 spaces (Prettier's default `tabWidth`). */
|
|
40
|
+
export function indent(level) {
|
|
41
|
+
return " ".repeat(level);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A TS string literal for `value`, quoted the way Prettier's DEFAULT config
|
|
45
|
+
* would (`singleQuote: false`).
|
|
46
|
+
*
|
|
47
|
+
* `JSON.stringify` is NOT a fixed point: it always double-quotes and escapes
|
|
48
|
+
* every embedded `"`, but Prettier picks the quote that needs FEWER escapes
|
|
49
|
+
* (tie → double), so `JSON.stringify("say \"hi\"")` → `"say \"hi\""` while
|
|
50
|
+
* Prettier emits `'say "hi"'`, and `codegen --check` then fails on a
|
|
51
|
+
* semantically identical file (#1565). This reproduces Prettier's `printString`
|
|
52
|
+
* exactly: start from the canonical `JSON.stringify` escaping (correct for all
|
|
53
|
+
* control characters), count the quotes to choose the enclosing quote, then
|
|
54
|
+
* re-escape for that quote.
|
|
55
|
+
*/
|
|
56
|
+
export function tsStringLiteral(value) {
|
|
57
|
+
// `JSON.stringify` yields a valid double-quoted literal with every necessary
|
|
58
|
+
// escape (`\"`, `\\`, `\n`, `\uXXXX`, …) and no unnecessary ones.
|
|
59
|
+
const rawContent = JSON.stringify(value).slice(1, -1);
|
|
60
|
+
// Prettier counts the quote characters in the raw content and switches to the
|
|
61
|
+
// alternate quote only when the preferred (double) one occurs strictly more
|
|
62
|
+
// often — i.e. when double-quoting would need more escapes.
|
|
63
|
+
let doubleCount = 0;
|
|
64
|
+
let singleCount = 0;
|
|
65
|
+
for (const ch of rawContent) {
|
|
66
|
+
if (ch === '"')
|
|
67
|
+
doubleCount++;
|
|
68
|
+
else if (ch === "'")
|
|
69
|
+
singleCount++;
|
|
70
|
+
}
|
|
71
|
+
const quote = doubleCount > singleCount ? "'" : '"';
|
|
72
|
+
const other = quote === '"' ? "'" : '"';
|
|
73
|
+
// Prettier's `makeString`: unescape the now-enclosing-irrelevant other quote,
|
|
74
|
+
// escape the enclosing quote, and keep every other escape as JSON produced it.
|
|
75
|
+
const body = rawContent.replace(/\\(.)|(["'])/gs, (_match, escaped, bareQuote) => {
|
|
76
|
+
if (escaped !== undefined) {
|
|
77
|
+
// `\"` becomes a bare `"` when single quotes now enclose the literal.
|
|
78
|
+
return escaped === other ? escaped : "\\" + escaped;
|
|
79
|
+
}
|
|
80
|
+
// A bare quote character: escape it only when it is the enclosing quote.
|
|
81
|
+
return bareQuote === quote ? "\\" + bareQuote : bareQuote;
|
|
82
|
+
});
|
|
83
|
+
return `${quote}${body}${quote}`;
|
|
84
|
+
}
|
|
85
|
+
export const atom = (text) => ({ kind: "atom", text });
|
|
86
|
+
export const block = (render) => ({
|
|
87
|
+
kind: "block",
|
|
88
|
+
render,
|
|
89
|
+
});
|
|
90
|
+
export const union = (members) => members.length === 1 ? members[0] : { kind: "union", members };
|
|
91
|
+
export const intersection = (members) => members.length === 1 ? members[0] : { kind: "intersection", members };
|
|
92
|
+
export const generic = (name, args) => ({
|
|
93
|
+
kind: "generic",
|
|
94
|
+
name,
|
|
95
|
+
args,
|
|
96
|
+
});
|
|
97
|
+
export const arrayOf = (element) => ({
|
|
98
|
+
kind: "array",
|
|
99
|
+
element,
|
|
100
|
+
});
|
|
101
|
+
/**
|
|
102
|
+
* An inline-first object type (`{ input: X }`). Unlike `block`, it starts
|
|
103
|
+
* inline and only breaks when it does not fit — which is exactly what Prettier
|
|
104
|
+
* does with an object type the emitter writes on one line.
|
|
105
|
+
*/
|
|
106
|
+
export const objectType = (members) => ({
|
|
107
|
+
kind: "objectType",
|
|
108
|
+
members,
|
|
109
|
+
});
|
|
110
|
+
/**
|
|
111
|
+
* `Record<string, T>` — a two-argument generic, so Prettier breaks it open when
|
|
112
|
+
* a long alias name pushes it past the print width. Never emit it as a plain
|
|
113
|
+
* atom.
|
|
114
|
+
*/
|
|
115
|
+
export const recordOf = (value) => generic("Record", [atom("string"), atom(value)]);
|
|
116
|
+
/** True when an element type needs parentheses before a `[]` suffix. */
|
|
117
|
+
function needsParensAsArrayElement(node) {
|
|
118
|
+
return node.kind === "union" || node.kind === "intersection";
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* True when Prettier hugs the node as a LONE type argument — an identifier /
|
|
122
|
+
* keyword or an object type. `Foo<SomeVeryLongIdentifier>` therefore stays on
|
|
123
|
+
* one line however wide it gets, while `QueryResult<Pick<A, "b">>` (a nested
|
|
124
|
+
* generic argument) breaks its list open.
|
|
125
|
+
*/
|
|
126
|
+
function isHuggableTypeArg(node) {
|
|
127
|
+
return node.kind === "atom" || node.kind === "block";
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* True when an over-width node can break WITHIN itself, keeping its head on the
|
|
131
|
+
* line it starts. A lone identifier, or a generic whose single type argument is
|
|
132
|
+
* hugged (`QueryResult<SomeLongName>`), has no break point — Prettier moves the
|
|
133
|
+
* whole thing below the `=` of a type alias instead.
|
|
134
|
+
*/
|
|
135
|
+
function canBreakInPlace(node) {
|
|
136
|
+
switch (node.kind) {
|
|
137
|
+
case "atom":
|
|
138
|
+
return false;
|
|
139
|
+
case "block":
|
|
140
|
+
case "objectType":
|
|
141
|
+
case "union":
|
|
142
|
+
case "intersection":
|
|
143
|
+
return true;
|
|
144
|
+
case "array":
|
|
145
|
+
return canBreakInPlace(node.element);
|
|
146
|
+
case "generic":
|
|
147
|
+
return node.args.length === 1 && isHuggableTypeArg(node.args[0])
|
|
148
|
+
? canBreakInPlace(node.args[0])
|
|
149
|
+
: true;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/** The width of a string's last line — what a following construct starts from. */
|
|
153
|
+
function lastLineWidth(text) {
|
|
154
|
+
return text.length - (text.lastIndexOf("\n") + 1);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The node's single-line form, or null when it contains a `block` (which is
|
|
158
|
+
* always multi-line and can therefore never render inline).
|
|
159
|
+
*/
|
|
160
|
+
export function inlineType(node) {
|
|
161
|
+
switch (node.kind) {
|
|
162
|
+
case "atom":
|
|
163
|
+
return node.text;
|
|
164
|
+
case "block":
|
|
165
|
+
return null;
|
|
166
|
+
case "union":
|
|
167
|
+
case "intersection": {
|
|
168
|
+
const sep = node.kind === "union" ? " | " : " & ";
|
|
169
|
+
const parts = node.members.map(inlineType);
|
|
170
|
+
return parts.some((p) => p === null) ? null : parts.join(sep);
|
|
171
|
+
}
|
|
172
|
+
case "generic": {
|
|
173
|
+
const parts = node.args.map(inlineType);
|
|
174
|
+
if (parts.some((p) => p === null))
|
|
175
|
+
return null;
|
|
176
|
+
return `${node.name}<${parts.join(", ")}>`;
|
|
177
|
+
}
|
|
178
|
+
case "array": {
|
|
179
|
+
const elem = inlineType(node.element);
|
|
180
|
+
if (elem === null)
|
|
181
|
+
return null;
|
|
182
|
+
return needsParensAsArrayElement(node.element)
|
|
183
|
+
? `(${elem})[]`
|
|
184
|
+
: `${elem}[]`;
|
|
185
|
+
}
|
|
186
|
+
case "objectType":
|
|
187
|
+
return `{ ${node.members.join("; ")} }`;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The width from a node's start to its first break opportunity when it breaks.
|
|
192
|
+
* Prettier's fit test for a construct looks ahead past it to the next place the
|
|
193
|
+
* line COULD break, so an intersection member's decision depends on how much of
|
|
194
|
+
* the following member precedes its own first break.
|
|
195
|
+
*/
|
|
196
|
+
function firstBreakWidth(node) {
|
|
197
|
+
switch (node.kind) {
|
|
198
|
+
case "atom":
|
|
199
|
+
return node.text.length;
|
|
200
|
+
case "block":
|
|
201
|
+
case "objectType":
|
|
202
|
+
return 1; // `{`
|
|
203
|
+
case "union":
|
|
204
|
+
return 0;
|
|
205
|
+
case "array":
|
|
206
|
+
return needsParensAsArrayElement(node.element)
|
|
207
|
+
? 1
|
|
208
|
+
: firstBreakWidth(node.element);
|
|
209
|
+
case "intersection":
|
|
210
|
+
return firstBreakWidth(node.members[0]);
|
|
211
|
+
case "generic":
|
|
212
|
+
return node.args.length === 1 && isHuggableTypeArg(node.args[0])
|
|
213
|
+
? node.name.length + 1 + firstBreakWidth(node.args[0])
|
|
214
|
+
: node.name.length + 1; // `Name<`
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/** True when the node has to break regardless of the available width. */
|
|
218
|
+
function alwaysBreaks(node) {
|
|
219
|
+
return inlineType(node) === null;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Render a type expression the way Prettier's default config would.
|
|
223
|
+
*
|
|
224
|
+
* The returned string's FIRST line carries NO leading indentation — the caller
|
|
225
|
+
* has already positioned the cursor at `col`. Continuation lines are indented
|
|
226
|
+
* relative to `level`.
|
|
227
|
+
*
|
|
228
|
+
* @param node the type expression.
|
|
229
|
+
* @param col 0-based column where the node's first character sits.
|
|
230
|
+
* @param level indentation level for the node's continuation lines.
|
|
231
|
+
* @param reserve characters that follow the node on its closing line (a
|
|
232
|
+
* trailing `;` or `,`), counted in the fit decision so the wrap
|
|
233
|
+
* boundary matches Prettier's exactly.
|
|
234
|
+
*/
|
|
235
|
+
export function printType(node, col, level, reserve = 0) {
|
|
236
|
+
const inline = inlineType(node);
|
|
237
|
+
if (inline !== null && col + inline.length + reserve <= PRINT_WIDTH) {
|
|
238
|
+
return inline;
|
|
239
|
+
}
|
|
240
|
+
switch (node.kind) {
|
|
241
|
+
case "atom":
|
|
242
|
+
// An over-width atom has nowhere to break — Prettier leaves it long too.
|
|
243
|
+
return node.text;
|
|
244
|
+
case "block":
|
|
245
|
+
return node.render(level);
|
|
246
|
+
case "generic": {
|
|
247
|
+
// Prettier HUGS a lone type argument that is an identifier/keyword or an
|
|
248
|
+
// object type — it never breaks the list open, even over-width. Only the
|
|
249
|
+
// argument itself may break (an object type does).
|
|
250
|
+
if (node.args.length === 1 && isHuggableTypeArg(node.args[0])) {
|
|
251
|
+
const inner = printType(node.args[0], col + node.name.length + 1, level, reserve + 1);
|
|
252
|
+
return `${node.name}<${inner}>`;
|
|
253
|
+
}
|
|
254
|
+
// One type argument per line. A type-argument list takes NO trailing
|
|
255
|
+
// comma under Prettier; a non-last argument reserves its separator.
|
|
256
|
+
const inner = node.args
|
|
257
|
+
.map((a, i) => {
|
|
258
|
+
const last = i === node.args.length - 1;
|
|
259
|
+
return (indent(level + 1) +
|
|
260
|
+
printType(a, (level + 1) * 2, level + 1, last ? 0 : 1));
|
|
261
|
+
})
|
|
262
|
+
.join(",\n");
|
|
263
|
+
return `${node.name}<\n${inner}\n${indent(level)}>`;
|
|
264
|
+
}
|
|
265
|
+
case "union":
|
|
266
|
+
return printUnionBroken(node.members, level);
|
|
267
|
+
case "array": {
|
|
268
|
+
// A parenthesized element that overflows breaks inside its parens:
|
|
269
|
+
// `(\n | "a"\n | "b"\n)[]`. A bare element (identifier / generic)
|
|
270
|
+
// breaks in place and keeps the `[]` on its closing line.
|
|
271
|
+
if (!needsParensAsArrayElement(node.element)) {
|
|
272
|
+
return `${printType(node.element, col, level, reserve + 2)}[]`;
|
|
273
|
+
}
|
|
274
|
+
// Prettier prints the parens and a union element's `|` separators as ONE
|
|
275
|
+
// group: once the parens break, the leading-pipe form is forced, so there
|
|
276
|
+
// is no state where the parens break but the members stay inline. A plain
|
|
277
|
+
// `printType` of the element would re-run its own fit test and return the
|
|
278
|
+
// union INLINE whenever it happens to fit at column 2 — emitting
|
|
279
|
+
// `(\n "a" | "b"\n)[]`, which Prettier then rewrites. Force the broken
|
|
280
|
+
// union form here instead so the output is a genuine fixed point.
|
|
281
|
+
const inner = node.element.kind === "union"
|
|
282
|
+
? printUnionBroken(node.element.members, level + 1)
|
|
283
|
+
: printType(node.element, (level + 1) * 2, level + 1);
|
|
284
|
+
return `(\n${indent(level + 1)}${inner}\n${indent(level)})[]`;
|
|
285
|
+
}
|
|
286
|
+
case "intersection": {
|
|
287
|
+
// Prettier keeps intersection members on one line and breaks INSIDE the
|
|
288
|
+
// first member that cannot reach the next break opportunity — so
|
|
289
|
+
// `{ input: Short } & Omit<A, B>` breaks the `Omit<...>` argument list,
|
|
290
|
+
// while a long `{ input: VeryLong }` breaks the object instead and leaves
|
|
291
|
+
// the `Omit<...>` inline on the closing `}` line.
|
|
292
|
+
let cursor = col;
|
|
293
|
+
const parts = [];
|
|
294
|
+
node.members.forEach((m, i) => {
|
|
295
|
+
const sep = i > 0 ? " & " : "";
|
|
296
|
+
cursor += sep.length;
|
|
297
|
+
const last = i === node.members.length - 1;
|
|
298
|
+
// What follows this member before the line could next break.
|
|
299
|
+
const lookahead = last
|
|
300
|
+
? reserve
|
|
301
|
+
: 3 + firstBreakWidth(node.members[i + 1]);
|
|
302
|
+
const rendered = printType(m, cursor, level, lookahead);
|
|
303
|
+
parts.push(sep + rendered);
|
|
304
|
+
cursor = rendered.includes("\n")
|
|
305
|
+
? lastLineWidth(rendered)
|
|
306
|
+
: cursor + rendered.length;
|
|
307
|
+
});
|
|
308
|
+
return parts.join("");
|
|
309
|
+
}
|
|
310
|
+
case "objectType": {
|
|
311
|
+
const members = node.members
|
|
312
|
+
.map((m) => `${indent(level + 1)}${m};`)
|
|
313
|
+
.join("\n");
|
|
314
|
+
return `{\n${members}\n${indent(level)}}`;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Prettier's leading-pipe form for a union that has to break — every member on
|
|
320
|
+
* its own line, whatever their widths. The first line carries no indent (the
|
|
321
|
+
* caller positioned it); the rest are indented to `level`. A member renders one
|
|
322
|
+
* level deeper, since the `| ` prefix is exactly one indent wide.
|
|
323
|
+
*/
|
|
324
|
+
function printUnionBroken(members, level) {
|
|
325
|
+
return members
|
|
326
|
+
.map((m, i) => {
|
|
327
|
+
const head = i === 0 ? "| " : `${indent(level)}| `;
|
|
328
|
+
return head + printType(m, level * 2 + 2, level + 1);
|
|
329
|
+
})
|
|
330
|
+
.join("\n");
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Render `export type <name> = <expr>;` as Prettier would.
|
|
334
|
+
*
|
|
335
|
+
* A union moves below the `=` in leading-pipe form (its own rule). Otherwise
|
|
336
|
+
* the RHS stays on the `=` line if it can REACH ITS FIRST BREAK there — so
|
|
337
|
+
* `= Record<` / `= QueryResult<` stays and breaks its argument list — and
|
|
338
|
+
* moves below the `=` whole when it cannot (`=\n MutationResult;`,
|
|
339
|
+
* `=\n QueryResult<Pick<M, "a">>;`). That is Prettier's "fluid" assignment
|
|
340
|
+
* layout: it fit-tests only up to the right-hand side's first break point, not
|
|
341
|
+
* its whole width.
|
|
342
|
+
*/
|
|
343
|
+
export function renderTypeAlias(name, node) {
|
|
344
|
+
const prefix = `export type ${name} = `;
|
|
345
|
+
if (node.kind === "union") {
|
|
346
|
+
if (!needsHeadBreak(node, prefix.length, 1)) {
|
|
347
|
+
return `${prefix}${inlineType(node)};`;
|
|
348
|
+
}
|
|
349
|
+
// When `export type <name> =` does not itself fit, Prettier switches the
|
|
350
|
+
// assignment to its break-after-operator layout: the header keeps the `=`
|
|
351
|
+
// and the union moves below it.
|
|
352
|
+
if (`export type ${name} =`.length > PRINT_WIDTH) {
|
|
353
|
+
// In that layout the union is measured afresh at its new indent — the
|
|
354
|
+
// over-long header is behind it and no longer constrains it. A union that
|
|
355
|
+
// fits there prints INLINE, with no leading pipes and no blank line
|
|
356
|
+
// (#1565 review cycle 1).
|
|
357
|
+
const inlineUnion = inlineType(node);
|
|
358
|
+
if (inlineUnion !== null &&
|
|
359
|
+
indent(1).length + inlineUnion.length + 1 <= PRINT_WIDTH) {
|
|
360
|
+
return `export type ${name} =\n${indent(1)}${inlineUnion};`;
|
|
361
|
+
}
|
|
362
|
+
// Only when it still does not fit does it break, and then the assignment's
|
|
363
|
+
// indent stacks on top of the union's own — the members land one level
|
|
364
|
+
// deeper, behind a blank line left by the (whitespace-trimmed) empty
|
|
365
|
+
// first line.
|
|
366
|
+
const body = printUnionBroken(node.members, 2);
|
|
367
|
+
return `export type ${name} =\n\n${indent(2)}${body};`;
|
|
368
|
+
}
|
|
369
|
+
const body = printUnionBroken(node.members, 1);
|
|
370
|
+
return `export type ${name} =\n${indent(1)}${body};`;
|
|
371
|
+
}
|
|
372
|
+
const inline = inlineType(node);
|
|
373
|
+
if (inline !== null && prefix.length + inline.length + 1 <= PRINT_WIDTH) {
|
|
374
|
+
return `${prefix}${inline};`;
|
|
375
|
+
}
|
|
376
|
+
const broken = `export type ${name} =\n${indent(1)}${printType(node, 2, 1, 1)};`;
|
|
377
|
+
// A right-hand side with no break point inside it (`unknown`,
|
|
378
|
+
// `QueryResult<Thing>` — a lone hugged type argument) can only stay on the
|
|
379
|
+
// `=` line by fitting there WHOLE, and the inline test above just established
|
|
380
|
+
// it does not. So it always moves below the `=`.
|
|
381
|
+
if (!canBreakInPlace(node))
|
|
382
|
+
return broken;
|
|
383
|
+
// A breakable one only has to reach its first break point (`<` / `{`) on the
|
|
384
|
+
// `=` line; it breaks open from there.
|
|
385
|
+
if (prefix.length + firstBreakWidth(node) > PRINT_WIDTH)
|
|
386
|
+
return broken;
|
|
387
|
+
return `${prefix}${printType(node, prefix.length, 0, 1)};`;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Render an object-type member line (` name?: T;`) at `level` as Prettier
|
|
391
|
+
* would. A union that has to break moves below the `name:`; anything else
|
|
392
|
+
* breaks in place.
|
|
393
|
+
*/
|
|
394
|
+
export function renderMember(level, name, optional, node) {
|
|
395
|
+
const head = `${indent(level)}${name}${optional ? "?" : ""}: `;
|
|
396
|
+
if (needsHeadBreak(node, head.length, 1)) {
|
|
397
|
+
const body = printUnionBroken(node.members, level + 1);
|
|
398
|
+
return `${head.trimEnd()}\n${indent(level + 1)}${body};`;
|
|
399
|
+
}
|
|
400
|
+
return `${head}${printType(node, head.length, level, 1)};`;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* True when a union following a `... = ` / `name: ` prefix must move onto its
|
|
404
|
+
* own indented lines. Only unions do this — a generic, object type, or
|
|
405
|
+
* intersection breaks in place, keeping its head on the prefix's line.
|
|
406
|
+
*/
|
|
407
|
+
function needsHeadBreak(node, col, reserve) {
|
|
408
|
+
if (node.kind !== "union")
|
|
409
|
+
return false;
|
|
410
|
+
if (alwaysBreaks(node))
|
|
411
|
+
return true;
|
|
412
|
+
const inline = inlineType(node);
|
|
413
|
+
return col + inline.length + reserve > PRINT_WIDTH;
|
|
414
|
+
}
|
|
415
|
+
/** A parameter entry's single-line form, or null when its type must break. */
|
|
416
|
+
function paramInline(entry) {
|
|
417
|
+
if (typeof entry === "string")
|
|
418
|
+
return entry;
|
|
419
|
+
const inline = inlineType(entry.type);
|
|
420
|
+
return inline === null ? null : `${entry.name}: ${inline}`;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Render a parenthesized value/parameter list, wrapping to one entry per line
|
|
424
|
+
* (WITH a trailing comma — Prettier's default is `trailingComma: "all"`) when
|
|
425
|
+
* the single-line form would not fit. A `{ name, type }` entry whose type is too
|
|
426
|
+
* wide for its own line breaks INSIDE itself the way Prettier would.
|
|
427
|
+
*
|
|
428
|
+
* `prefix` must include its own leading indentation; `level` is the
|
|
429
|
+
* indentation level of the line `prefix` sits on.
|
|
430
|
+
*/
|
|
431
|
+
export function renderParenList(prefix, entries, tail, level) {
|
|
432
|
+
const inlines = entries.map(paramInline);
|
|
433
|
+
if (inlines.every((e) => e !== null)) {
|
|
434
|
+
const inline = `${prefix}(${inlines.join(", ")})${tail}`;
|
|
435
|
+
if (inline.length <= PRINT_WIDTH)
|
|
436
|
+
return inline;
|
|
437
|
+
}
|
|
438
|
+
const body = entries
|
|
439
|
+
.map((entry) => {
|
|
440
|
+
if (typeof entry === "string")
|
|
441
|
+
return `${indent(level + 1)}${entry},`;
|
|
442
|
+
const head = `${indent(level + 1)}${entry.name}: `;
|
|
443
|
+
return `${head}${printType(entry.type, head.length, level + 1, 1)},`;
|
|
444
|
+
})
|
|
445
|
+
.join("\n");
|
|
446
|
+
return `${prefix}(\n${body}\n${indent(level)})${tail}`;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Render a call whose LAST argument is an object literal, the way Prettier's
|
|
450
|
+
* default config would. Prettier tries three shapes in order and takes the
|
|
451
|
+
* first that fits, so this does too:
|
|
452
|
+
*
|
|
453
|
+
* 1. everything on one line;
|
|
454
|
+
* 2. "last argument expansion" — hug the object literal, keeping the earlier
|
|
455
|
+
* arguments on the call's line and breaking the object's members;
|
|
456
|
+
* 3. one argument per line (with a trailing comma), the object inline.
|
|
457
|
+
*
|
|
458
|
+
* `prefix` (callee + any type arguments) must include its own leading
|
|
459
|
+
* indentation; `level` is the indentation level of the line it sits on. `tail`
|
|
460
|
+
* is whatever follows the closing paren (e.g. `","`) and is counted in every
|
|
461
|
+
* fit decision.
|
|
462
|
+
*
|
|
463
|
+
* `objectMembers` is optional: a call with NO trailing object-literal argument
|
|
464
|
+
* (`define<O>(key, options)`, `subscribe<T>(dbId, key, options)`) passes
|
|
465
|
+
* `undefined`, and then only two shapes apply — everything on one line, or one
|
|
466
|
+
* argument per line — since there is no last-argument object to hug.
|
|
467
|
+
*/
|
|
468
|
+
export function renderCall(prefix, leadingArgs, objectMembers, level, tail = "") {
|
|
469
|
+
// The callee may itself be multi-line (a broken type-argument list); what
|
|
470
|
+
// matters for every fit decision below is the column its last line ends at.
|
|
471
|
+
const calleeWidth = lastLineWidth(prefix);
|
|
472
|
+
// No trailing object literal to hug: Prettier tries one line, then falls
|
|
473
|
+
// straight to one argument per line (with a trailing comma).
|
|
474
|
+
if (objectMembers === undefined) {
|
|
475
|
+
const oneLine = `${prefix}(${leadingArgs.join(", ")})${tail}`;
|
|
476
|
+
if (calleeWidth + oneLine.length - prefix.length <= PRINT_WIDTH) {
|
|
477
|
+
return oneLine;
|
|
478
|
+
}
|
|
479
|
+
const broken = leadingArgs
|
|
480
|
+
.map((a) => `${indent(level + 1)}${a},`)
|
|
481
|
+
.join("\n");
|
|
482
|
+
return `${prefix}(\n${broken}\n${indent(level)})${tail}`;
|
|
483
|
+
}
|
|
484
|
+
const objectInline = `{ ${objectMembers.map(memberInline).join(", ")} }`;
|
|
485
|
+
const args = [...leadingArgs, objectInline];
|
|
486
|
+
const oneLine = `${prefix}(${args.join(", ")})${tail}`;
|
|
487
|
+
if (calleeWidth + oneLine.length - prefix.length <= PRINT_WIDTH) {
|
|
488
|
+
return oneLine;
|
|
489
|
+
}
|
|
490
|
+
const hugHead = `${prefix}(${leadingArgs.map((a) => `${a}, `).join("")}{`;
|
|
491
|
+
if (calleeWidth + hugHead.length - prefix.length <= PRINT_WIDTH) {
|
|
492
|
+
return `${hugHead}\n${objectBody(objectMembers, level)}\n${indent(level)}})${tail}`;
|
|
493
|
+
}
|
|
494
|
+
// One argument per line. The object argument stays inline on its line if it
|
|
495
|
+
// fits there; otherwise it expands too.
|
|
496
|
+
const objectLine = `${indent(level + 1)}${objectInline},`;
|
|
497
|
+
const objectArg = objectLine.length <= PRINT_WIDTH
|
|
498
|
+
? objectLine
|
|
499
|
+
: `${indent(level + 1)}{\n${objectBody(objectMembers, level + 1)}\n${indent(level + 1)}},`;
|
|
500
|
+
const broken = [
|
|
501
|
+
...leadingArgs.map((a) => `${indent(level + 1)}${a},`),
|
|
502
|
+
objectArg,
|
|
503
|
+
].join("\n");
|
|
504
|
+
return `${prefix}(\n${broken}\n${indent(level)})${tail}`;
|
|
505
|
+
}
|
|
506
|
+
/** A member's one-line form (`...opts`, `workflowKey: "x"`). */
|
|
507
|
+
function memberInline(m) {
|
|
508
|
+
return typeof m === "string" ? m : `${m.key}: ${m.value}`;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* An object literal's members, one per line with a trailing comma. A `key:
|
|
512
|
+
* value` line whose value would overflow moves the value onto the next line
|
|
513
|
+
* (Prettier's break-after-operator layout for a property with a string value);
|
|
514
|
+
* a bare entry has no break point and just runs long.
|
|
515
|
+
*/
|
|
516
|
+
function objectBody(members, level) {
|
|
517
|
+
return members
|
|
518
|
+
.map((m) => {
|
|
519
|
+
const line = `${indent(level + 1)}${memberInline(m)},`;
|
|
520
|
+
if (line.length <= PRINT_WIDTH || typeof m === "string")
|
|
521
|
+
return line;
|
|
522
|
+
return `${indent(level + 1)}${m.key}:\n${indent(level + 2)}${m.value},`;
|
|
523
|
+
})
|
|
524
|
+
.join("\n");
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Render an arrow function whose body is a single call ending in an object
|
|
528
|
+
* literal — the shape both codegen factories emit.
|
|
529
|
+
*
|
|
530
|
+
* Prettier keeps the body on the `=>` line only when the WHOLE call fits there
|
|
531
|
+
* on one line; a call that has to break at all moves to its own indented line
|
|
532
|
+
* (it never hugs the object up onto the `=>` line). `head` is the arrow's
|
|
533
|
+
* signature through `=>` (it may itself be multi-line if the parameter list
|
|
534
|
+
* broke); `level` is the indentation level of the body line.
|
|
535
|
+
*/
|
|
536
|
+
export function renderArrowCall(opts) {
|
|
537
|
+
const { head, callee, leadingArgs, objectMembers, level } = opts;
|
|
538
|
+
const tail = opts.tail ?? "";
|
|
539
|
+
const calleeInline = inlineType(callee);
|
|
540
|
+
const args = objectMembers === undefined
|
|
541
|
+
? leadingArgs
|
|
542
|
+
: [...leadingArgs, `{ ${objectMembers.map(memberInline).join(", ")} }`];
|
|
543
|
+
const oneLine = `${calleeInline}(${args.join(", ")})${tail}`;
|
|
544
|
+
if (calleeInline !== null &&
|
|
545
|
+
lastLineWidth(head) + 1 + oneLine.length <= PRINT_WIDTH) {
|
|
546
|
+
return `${head} ${oneLine}`;
|
|
547
|
+
}
|
|
548
|
+
const prefix = indent(level) + printType(callee, level * 2, level, 1);
|
|
549
|
+
return `${head}\n${renderCall(prefix, leadingArgs, objectMembers, level, tail)}`;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Render an object-literal property whose value is an arrow function returning a
|
|
553
|
+
* single call — the shape the database ops factory emits (` <op>: (params, …)
|
|
554
|
+
* => client.databases.executeOperation(…)`).
|
|
555
|
+
*
|
|
556
|
+
* Prettier applies its assignment layout to the `key: value` pair: the arrow
|
|
557
|
+
* stays on the key's line only when it can REACH ITS FIRST BREAK there — the
|
|
558
|
+
* `(` opening its parameter list. When even that `(` does not fit (a property
|
|
559
|
+
* key long enough that `<indent><key>: (` passes the print width), Prettier
|
|
560
|
+
* breaks after the colon and renders the WHOLE arrow — parameter list, return
|
|
561
|
+
* type, and body — one level deeper:
|
|
562
|
+
*
|
|
563
|
+
* aVeryLongOpName:
|
|
564
|
+
* (
|
|
565
|
+
* params: P,
|
|
566
|
+
* options?: OpsCallOptions,
|
|
567
|
+
* ): Promise<R> =>
|
|
568
|
+
* client.databases.executeOperation<R>(
|
|
569
|
+
* databaseId,
|
|
570
|
+
* "aVeryLongOpName",
|
|
571
|
+
* { params, ...options },
|
|
572
|
+
* ),
|
|
573
|
+
*
|
|
574
|
+
* Reproducing that break is what keeps a long-but-legal op name (>= 74
|
|
575
|
+
* characters, with this file's 4-space property indent) prettier-stable.
|
|
576
|
+
*
|
|
577
|
+
* @param level indentation level of the property line.
|
|
578
|
+
* @param key the property key, already quoted if it needs to be.
|
|
579
|
+
* @param params the arrow's parameter list entries.
|
|
580
|
+
* @param signatureTail what follows the parameter list's `)` — e.g.
|
|
581
|
+
* `": Promise<R> =>"`.
|
|
582
|
+
*/
|
|
583
|
+
export function renderArrowProperty(opts) {
|
|
584
|
+
const { level, key, params, signatureTail, callee } = opts;
|
|
585
|
+
const { leadingArgs, objectMembers } = opts;
|
|
586
|
+
const tail = opts.tail ?? "";
|
|
587
|
+
const keyPrefix = `${indent(level)}${key}: `;
|
|
588
|
+
// `+ 1` is the arrow's `(` — its first break opportunity.
|
|
589
|
+
if (keyPrefix.length + 1 > PRINT_WIDTH) {
|
|
590
|
+
const head = renderParenList(indent(level + 1), params, signatureTail, level + 1);
|
|
591
|
+
const body = renderArrowCall({
|
|
592
|
+
head,
|
|
593
|
+
callee,
|
|
594
|
+
leadingArgs,
|
|
595
|
+
objectMembers,
|
|
596
|
+
level: level + 2,
|
|
597
|
+
tail,
|
|
598
|
+
});
|
|
599
|
+
return `${indent(level)}${key}:\n${body}`;
|
|
600
|
+
}
|
|
601
|
+
return renderArrowCall({
|
|
602
|
+
head: renderParenList(keyPrefix, params, signatureTail, level),
|
|
603
|
+
callee,
|
|
604
|
+
leadingArgs,
|
|
605
|
+
objectMembers,
|
|
606
|
+
level: level + 1,
|
|
607
|
+
tail,
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
//# sourceMappingURL=prettierStable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prettierStable.js","sourceRoot":"","sources":["../../../../src/lib/codegen-shared/prettierStable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,uCAAuC;AACvC,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAE9B,8EAA8E;AAC9E,MAAM,UAAU,MAAM,CAAC,KAAa;IAClC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,6EAA6E;IAC7E,kEAAkE;IAClE,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACtD,8EAA8E;IAC9E,4EAA4E;IAC5E,4DAA4D;IAC5D,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;QAC5B,IAAI,EAAE,KAAK,GAAG;YAAE,WAAW,EAAE,CAAC;aACzB,IAAI,EAAE,KAAK,GAAG;YAAE,WAAW,EAAE,CAAC;IACrC,CAAC;IACD,MAAM,KAAK,GAAc,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAC/D,MAAM,KAAK,GAAG,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACxC,8EAA8E;IAC9E,+EAA+E;IAC/E,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAC7B,gBAAgB,EAChB,CAAC,MAAM,EAAE,OAA2B,EAAE,SAA6B,EAAE,EAAE;QACrE,IAAI,OAAO,KA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;QACb,KAAK,EAAE,KAAK,GAAG,CAAC;QAChB,IAAI;KACL,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -19,7 +19,8 @@ import * as path from "path";
|
|
|
19
19
|
import { writeOrCheckGeneratedFiles, } from "../codegen-shared/generatedFiles.js";
|
|
20
20
|
import { describeDbType, } from "./dbTypeIR.js";
|
|
21
21
|
import { resolveRecordInterfaceName, opParamsInterfaceName, opResultAliasName, opsFactoryName, subscriptionsFactoryName, objectPropertyKey, } from "./dbNaming.js";
|
|
22
|
-
import { renderHeader, renderRecordInterface, renderOpParamsInterface, renderOpResultAlias, renderFactories, RESULT_ALIASES_BLOCK, } from "./dbTemplates.js";
|
|
22
|
+
import { renderHeader, renderRecordInterface, renderOpParamsInterface, renderOpResultAlias, renderFactories, fieldNameUnion, RESULT_ALIASES_BLOCK, } from "./dbTemplates.js";
|
|
23
|
+
import { atom, generic } from "../codegen-shared/prettierStable.js";
|
|
23
24
|
export { inferArrayParamElementTypes, inferRequiredRecordFields, } from "./dbTypeIR.js";
|
|
24
25
|
const GENERATED_FILE_SUFFIX = ".generated.ts";
|
|
25
26
|
/**
|
|
@@ -116,11 +117,13 @@ export function renderDbTypeFile(input) {
|
|
|
116
117
|
// known member, so this mapping never fails.
|
|
117
118
|
const factorySubscriptions = ir.subscriptions.map((sub) => {
|
|
118
119
|
const interfaceName = recordInterfaceByModel[sub.modelName];
|
|
120
|
+
// `Pick<Record, "a" | "b">` when the subscription projects fields, else
|
|
121
|
+
// the bare record interface — built as a `TypeNode` (mirroring
|
|
122
|
+
// `queryResultGeneric`'s projection) so the emitter can break it the way
|
|
123
|
+
// Prettier would inside `SubscribeOptions<...>` / `subscribe<...>`.
|
|
119
124
|
const eventType = sub.select && sub.select.length > 0
|
|
120
|
-
?
|
|
121
|
-
|
|
122
|
-
.join(" | ")}>`
|
|
123
|
-
: interfaceName;
|
|
125
|
+
? generic("Pick", [atom(interfaceName), fieldNameUnion(sub.select)])
|
|
126
|
+
: atom(interfaceName);
|
|
124
127
|
return {
|
|
125
128
|
propertyKey: objectPropertyKey(sub.subscriptionKey),
|
|
126
129
|
subscriptionKey: sub.subscriptionKey,
|