@uipath/maestro-builder-sdk 6.102.0 → 6.104.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/api-index.md +20 -18
- package/dist/api-members.md +18 -17
- package/dist/bpmn/check.js +4 -0
- package/dist/case/check.d.ts +1 -1
- package/dist/case/check.js +4 -0
- package/dist/check.js +4 -0
- package/dist/core/connector-checks.d.ts +7 -0
- package/dist/core/connector-checks.js +12 -2
- package/dist/core/entity-schema.d.ts +94 -0
- package/dist/core/entity-schema.js +58 -0
- package/dist/core/event-checks.d.ts +3 -0
- package/dist/core/event-checks.js +17 -3
- package/dist/core/lookup-connection.d.ts +90 -0
- package/dist/core/lookup-connection.js +165 -0
- package/dist/core/lookups.d.ts +26 -0
- package/dist/core/lookups.js +30 -4
- package/dist/core/refusals.d.ts +8 -0
- package/dist/core/refusals.js +8 -0
- package/dist/core/resource-resolution.d.ts +9 -0
- package/dist/nodes/data-fabric/flow/check.js +214 -0
- package/dist/nodes/trigger/flow/check.js +193 -2
- package/dist/nodes/trigger/flow/spec.d.ts +10 -1
- package/dist/registry/prepare/entity-schema.d.ts +40 -0
- package/dist/registry/prepare/entity-schema.js +135 -0
- package/dist/registry/prepare/ledger.js +20 -10
- package/dist/registry/prepare/resources.d.ts +12 -5
- package/dist/registry/prepare/resources.js +26 -4
- package/dist/registry/prepare-cli.js +38 -3
- package/dist/registry/uip/commands.d.ts +19 -0
- package/dist/registry/uip/commands.js +25 -0
- package/package.json +2 -2
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* core/lookup-connection — a recorded lookup id used on a different connection
|
|
3
|
+
* than the one it was resolved on (#1982).
|
|
4
|
+
*
|
|
5
|
+
* A lookup id belongs to one connection. Slack user `U123` exists on the
|
|
6
|
+
* workspace it was looked up in and nowhere else; a Jira issue-type id is valid
|
|
7
|
+
* in one site. `prepare --resolve` records the connection each id came from
|
|
8
|
+
* (`connectionId` on the row in `connectors-local/resolutions.json`), and this
|
|
9
|
+
* module compares it with the connection the step is bound to. Before the
|
|
10
|
+
* field existed, an id resolved on connection A and bound to connection B
|
|
11
|
+
* compiled cleanly and failed at run time, and the skill told the agent to
|
|
12
|
+
* compare the two by hand.
|
|
13
|
+
*
|
|
14
|
+
* `lint`, not `lowering`: the serializer writes exactly the id that was
|
|
15
|
+
* recorded, and some lookups are the same on every connection (Slack's
|
|
16
|
+
* `send_as` sends the word `bot`), so the id is probably wrong, not certainly.
|
|
17
|
+
* The remedy is cheap either way: resolve again on the bound connection.
|
|
18
|
+
*
|
|
19
|
+
* One row cannot serve two connections yet (#2042): rows are keyed
|
|
20
|
+
* `[nodeType, field, by, value]`, not by connection. When two steps use the
|
|
21
|
+
* same row on two different bound connections, re-running `prepare` on one
|
|
22
|
+
* only moves the error to the other, so the message says so and prints no
|
|
23
|
+
* command ({@link lookupConnectionIndex}).
|
|
24
|
+
*
|
|
25
|
+
* Silent when there is nothing to compare: a row without `connectionId` (an
|
|
26
|
+
* older ledger), or a step whose connection does not resolve to a real id (no
|
|
27
|
+
* bindings.json, an undeclared label, a placeholder GUID). The binding rules
|
|
28
|
+
* already report the last two.
|
|
29
|
+
*
|
|
30
|
+
* No `node:` imports: `check` imports this module (FB015).
|
|
31
|
+
*/
|
|
32
|
+
import { type BindingsView } from './binding-messages.js';
|
|
33
|
+
import { type LookupResolution, type LookupResolutions, type LookupToken } from './lookups.js';
|
|
34
|
+
/** The diagnostic code. */
|
|
35
|
+
export declare const LOOKUP_CONNECTION_MISMATCH = "LOOKUP_CONNECTION_MISMATCH";
|
|
36
|
+
/** One resolved lookup on a step: the token, the row it resolved to, and how the message names the field. */
|
|
37
|
+
export interface ResolvedLookupUse {
|
|
38
|
+
token: LookupToken;
|
|
39
|
+
row: LookupResolution;
|
|
40
|
+
/** The field as the author wrote it, e.g. `channel` or `where.parentFolderId`. */
|
|
41
|
+
name: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The connection id a step is bound to, or `undefined` when it does not
|
|
45
|
+
* resolve to a real one. Same reading as `byoaUnverified`: the label through
|
|
46
|
+
* bindings.json, else the label itself when it is already an id.
|
|
47
|
+
*/
|
|
48
|
+
export declare function boundConnectionId(connection: unknown, bindings: Pick<BindingsView, 'resolve'> | undefined): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Which bound connections use each recorded row, across a whole built flow,
|
|
51
|
+
* case or process. Keyed by the row object itself (the ledger's own entry), so
|
|
52
|
+
* an event token found under the event-form key and an activity token under
|
|
53
|
+
* its own key land on the same row when they share one.
|
|
54
|
+
*/
|
|
55
|
+
export type LookupConnectionIndex = ReadonlyMap<LookupResolution, ReadonlySet<string>>;
|
|
56
|
+
/**
|
|
57
|
+
* Build the {@link LookupConnectionIndex} for one built artifact.
|
|
58
|
+
*
|
|
59
|
+
* Family-agnostic, like the rules it feeds: it walks the built object and
|
|
60
|
+
* reads every object that carries a string `connection` beside `inputs` (a
|
|
61
|
+
* connector activity) or `where` (an event subscription) — the same
|
|
62
|
+
* `{ inputs, connection }` and `{ where, connection }` shapes
|
|
63
|
+
* `checkConnectorLookups` and `checkEventResolution` read. Connections are
|
|
64
|
+
* read through bindings.json as {@link boundConnectionId} reads them, and
|
|
65
|
+
* stored lower-cased.
|
|
66
|
+
*
|
|
67
|
+
* @param root - The built flow, case or process.
|
|
68
|
+
* @param resolutions - Everything `prepare --resolve` has recorded.
|
|
69
|
+
* @param bindings - Resolves a `connection:` label to an id.
|
|
70
|
+
*/
|
|
71
|
+
export declare function lookupConnectionIndex(root: unknown, resolutions: LookupResolutions | undefined, bindings: Pick<BindingsView, 'resolve'> | undefined): LookupConnectionIndex;
|
|
72
|
+
/**
|
|
73
|
+
* The LOOKUP_CONNECTION_MISMATCH message for one step, or `undefined` when no
|
|
74
|
+
* recorded lookup on it came from another connection. One message per step,
|
|
75
|
+
* like LOOKUP_UNRESOLVED: the remedy is one `prepare` with every `--resolve`.
|
|
76
|
+
* A row another step uses on a different connection gets no command (see the
|
|
77
|
+
* module header): one row cannot serve two connections yet.
|
|
78
|
+
*
|
|
79
|
+
* @param where - How the message opens (`Connector step "post"`, `trigger`).
|
|
80
|
+
* @param uses - Every resolved lookup on the step.
|
|
81
|
+
* @param connection - The step's `connection:` as authored.
|
|
82
|
+
* @param bindings - Resolves the label to an id.
|
|
83
|
+
* @param command - The `<key> <action-or-event>` the prepare command takes, plus any extra flags (`--object x`).
|
|
84
|
+
* @param index - Which bound connections use each row, file-wide; without it every row reads as used by this step alone.
|
|
85
|
+
*/
|
|
86
|
+
export declare function lookupConnectionMismatch(where: string, uses: readonly ResolvedLookupUse[], connection: unknown, bindings: Pick<BindingsView, 'resolve'> | undefined, command: {
|
|
87
|
+
key: string;
|
|
88
|
+
action: string;
|
|
89
|
+
extra?: readonly string[];
|
|
90
|
+
}, index?: LookupConnectionIndex): string | undefined;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* core/lookup-connection — a recorded lookup id used on a different connection
|
|
3
|
+
* than the one it was resolved on (#1982).
|
|
4
|
+
*
|
|
5
|
+
* A lookup id belongs to one connection. Slack user `U123` exists on the
|
|
6
|
+
* workspace it was looked up in and nowhere else; a Jira issue-type id is valid
|
|
7
|
+
* in one site. `prepare --resolve` records the connection each id came from
|
|
8
|
+
* (`connectionId` on the row in `connectors-local/resolutions.json`), and this
|
|
9
|
+
* module compares it with the connection the step is bound to. Before the
|
|
10
|
+
* field existed, an id resolved on connection A and bound to connection B
|
|
11
|
+
* compiled cleanly and failed at run time, and the skill told the agent to
|
|
12
|
+
* compare the two by hand.
|
|
13
|
+
*
|
|
14
|
+
* `lint`, not `lowering`: the serializer writes exactly the id that was
|
|
15
|
+
* recorded, and some lookups are the same on every connection (Slack's
|
|
16
|
+
* `send_as` sends the word `bot`), so the id is probably wrong, not certainly.
|
|
17
|
+
* The remedy is cheap either way: resolve again on the bound connection.
|
|
18
|
+
*
|
|
19
|
+
* One row cannot serve two connections yet (#2042): rows are keyed
|
|
20
|
+
* `[nodeType, field, by, value]`, not by connection. When two steps use the
|
|
21
|
+
* same row on two different bound connections, re-running `prepare` on one
|
|
22
|
+
* only moves the error to the other, so the message says so and prints no
|
|
23
|
+
* command ({@link lookupConnectionIndex}).
|
|
24
|
+
*
|
|
25
|
+
* Silent when there is nothing to compare: a row without `connectionId` (an
|
|
26
|
+
* older ledger), or a step whose connection does not resolve to a real id (no
|
|
27
|
+
* bindings.json, an undeclared label, a placeholder GUID). The binding rules
|
|
28
|
+
* already report the last two.
|
|
29
|
+
*
|
|
30
|
+
* No `node:` imports: `check` imports this module (FB015).
|
|
31
|
+
*/
|
|
32
|
+
import { GUID_RE, STUB_GUID_RE } from './binding-messages.js';
|
|
33
|
+
import { prepareCommand, resolveFlagArg } from './cli-spelling.js';
|
|
34
|
+
import { isLookupToken, recordedEventResolution, recordedResolution, } from './lookups.js';
|
|
35
|
+
/** The diagnostic code. */
|
|
36
|
+
export const LOOKUP_CONNECTION_MISMATCH = 'LOOKUP_CONNECTION_MISMATCH';
|
|
37
|
+
/**
|
|
38
|
+
* The connection id a step is bound to, or `undefined` when it does not
|
|
39
|
+
* resolve to a real one. Same reading as `byoaUnverified`: the label through
|
|
40
|
+
* bindings.json, else the label itself when it is already an id.
|
|
41
|
+
*/
|
|
42
|
+
export function boundConnectionId(connection, bindings) {
|
|
43
|
+
if (typeof connection !== 'string' || connection === '')
|
|
44
|
+
return undefined;
|
|
45
|
+
const id = bindings?.resolve(connection) ?? connection;
|
|
46
|
+
return GUID_RE.test(id) && !STUB_GUID_RE.test(id) ? id : undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Build the {@link LookupConnectionIndex} for one built artifact.
|
|
50
|
+
*
|
|
51
|
+
* Family-agnostic, like the rules it feeds: it walks the built object and
|
|
52
|
+
* reads every object that carries a string `connection` beside `inputs` (a
|
|
53
|
+
* connector activity) or `where` (an event subscription) — the same
|
|
54
|
+
* `{ inputs, connection }` and `{ where, connection }` shapes
|
|
55
|
+
* `checkConnectorLookups` and `checkEventResolution` read. Connections are
|
|
56
|
+
* read through bindings.json as {@link boundConnectionId} reads them, and
|
|
57
|
+
* stored lower-cased.
|
|
58
|
+
*
|
|
59
|
+
* @param root - The built flow, case or process.
|
|
60
|
+
* @param resolutions - Everything `prepare --resolve` has recorded.
|
|
61
|
+
* @param bindings - Resolves a `connection:` label to an id.
|
|
62
|
+
*/
|
|
63
|
+
export function lookupConnectionIndex(root, resolutions, bindings) {
|
|
64
|
+
const index = new Map();
|
|
65
|
+
if (!resolutions || Object.keys(resolutions).length === 0)
|
|
66
|
+
return index;
|
|
67
|
+
const seen = new WeakSet();
|
|
68
|
+
const add = (row, bound) => {
|
|
69
|
+
if (row?.value === undefined)
|
|
70
|
+
return;
|
|
71
|
+
let ids = index.get(row);
|
|
72
|
+
if (!ids)
|
|
73
|
+
index.set(row, (ids = new Set()));
|
|
74
|
+
ids.add(bound.toLowerCase());
|
|
75
|
+
};
|
|
76
|
+
const tokensIn = (value, found, depth = 0) => {
|
|
77
|
+
if (depth > 16 || value === null || typeof value !== 'object')
|
|
78
|
+
return;
|
|
79
|
+
if (isLookupToken(value)) {
|
|
80
|
+
found.push(value);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
for (const v of Array.isArray(value) ? value : Object.values(value))
|
|
84
|
+
tokensIn(v, found, depth + 1);
|
|
85
|
+
};
|
|
86
|
+
const visit = (value) => {
|
|
87
|
+
if (value === null || typeof value !== 'object' || seen.has(value))
|
|
88
|
+
return;
|
|
89
|
+
seen.add(value);
|
|
90
|
+
if (isLookupToken(value))
|
|
91
|
+
return;
|
|
92
|
+
const o = value;
|
|
93
|
+
const bound = typeof o.connection === 'string' ? boundConnectionId(o.connection, bindings) : undefined;
|
|
94
|
+
if (bound !== undefined) {
|
|
95
|
+
if (o.inputs && typeof o.inputs === 'object') {
|
|
96
|
+
const found = [];
|
|
97
|
+
tokensIn(o.inputs, found);
|
|
98
|
+
for (const token of found)
|
|
99
|
+
add(recordedResolution(token, resolutions), bound);
|
|
100
|
+
}
|
|
101
|
+
if (o.where && typeof o.where === 'object' && !Array.isArray(o.where)) {
|
|
102
|
+
for (const v of Object.values(o.where)) {
|
|
103
|
+
if (isLookupToken(v))
|
|
104
|
+
add(recordedEventResolution(v, resolutions), bound);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
for (const v of Array.isArray(value) ? value : Object.values(o))
|
|
109
|
+
visit(v);
|
|
110
|
+
};
|
|
111
|
+
visit(root);
|
|
112
|
+
return index;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The LOOKUP_CONNECTION_MISMATCH message for one step, or `undefined` when no
|
|
116
|
+
* recorded lookup on it came from another connection. One message per step,
|
|
117
|
+
* like LOOKUP_UNRESOLVED: the remedy is one `prepare` with every `--resolve`.
|
|
118
|
+
* A row another step uses on a different connection gets no command (see the
|
|
119
|
+
* module header): one row cannot serve two connections yet.
|
|
120
|
+
*
|
|
121
|
+
* @param where - How the message opens (`Connector step "post"`, `trigger`).
|
|
122
|
+
* @param uses - Every resolved lookup on the step.
|
|
123
|
+
* @param connection - The step's `connection:` as authored.
|
|
124
|
+
* @param bindings - Resolves the label to an id.
|
|
125
|
+
* @param command - The `<key> <action-or-event>` the prepare command takes, plus any extra flags (`--object x`).
|
|
126
|
+
* @param index - Which bound connections use each row, file-wide; without it every row reads as used by this step alone.
|
|
127
|
+
*/
|
|
128
|
+
export function lookupConnectionMismatch(where, uses, connection, bindings, command, index) {
|
|
129
|
+
const bound = boundConnectionId(connection, bindings);
|
|
130
|
+
if (bound === undefined)
|
|
131
|
+
return undefined;
|
|
132
|
+
const wrong = uses.filter(({ row }) => typeof row.connectionId === 'string' && row.connectionId !== ''
|
|
133
|
+
&& row.connectionId.toLowerCase() !== bound.toLowerCase());
|
|
134
|
+
if (wrong.length === 0)
|
|
135
|
+
return undefined;
|
|
136
|
+
const label = connection;
|
|
137
|
+
const named = label.toLowerCase() === bound.toLowerCase() ? `connection ${bound}` : `connection \`${label}\` (${bound})`;
|
|
138
|
+
const sharedBy = (row) => {
|
|
139
|
+
const ids = index?.get(row);
|
|
140
|
+
return ids && ids.size > 1 ? ids : undefined;
|
|
141
|
+
};
|
|
142
|
+
const shared = wrong.filter(({ row }) => sharedBy(row) !== undefined);
|
|
143
|
+
const fixable = wrong.filter(({ row }) => sharedBy(row) === undefined);
|
|
144
|
+
const describe = ({ token, row, name }) => `\`${name}\` (${token.__lookup.by}=${JSON.stringify(token.__lookup.value)}) was resolved on connection ${row.connectionId}`;
|
|
145
|
+
const parts = [];
|
|
146
|
+
if (fixable.length > 0) {
|
|
147
|
+
const args = fixable.map(({ token }) => resolveFlagArg(token.__lookup.field, token.__lookup.by, String(token.__lookup.value)));
|
|
148
|
+
const head = ` ${prepareCommand(command.key, command.action, ...(command.extra ?? []), '--connection-id', bound)}`;
|
|
149
|
+
const block = [head + ' \\', ...args.map((a, i) => ` --resolve ${a}${i < args.length - 1 ? ' \\' : ''}`)].join('\n');
|
|
150
|
+
parts.push(`${where}: lookup ${fixable.map(describe).join('; ')}, but this step uses ${named}. `
|
|
151
|
+
+ `A lookup id belongs to the connection it was found on, so the recorded `
|
|
152
|
+
+ `${fixable.length === 1 ? 'id' : 'ids'} will likely fail at run time. Resolve again on the bound connection:\n`
|
|
153
|
+
+ block);
|
|
154
|
+
}
|
|
155
|
+
if (shared.length > 0) {
|
|
156
|
+
const all = [...new Set(shared.flatMap(({ row }) => [...sharedBy(row)]))].sort();
|
|
157
|
+
parts.push(`${where}: lookup ${shared.map(describe).join('; ')}, but this step uses ${named}, `
|
|
158
|
+
+ `and steps in this file use the same recorded ${shared.length === 1 ? 'lookup' : 'lookups'} on `
|
|
159
|
+
+ `${all.length} connections (${all.join(', ')}). `
|
|
160
|
+
+ `One resolutions.json row cannot serve two connections yet (#2042), so re-running \`prepare\` on one `
|
|
161
|
+
+ `connection only moves this error to the other step. Bind these steps to one connection, or write `
|
|
162
|
+
+ `the id for one of them by hand.`);
|
|
163
|
+
}
|
|
164
|
+
return parts.join('\n');
|
|
165
|
+
}
|
package/dist/core/lookups.d.ts
CHANGED
|
@@ -171,6 +171,14 @@ export interface LookupResolution {
|
|
|
171
171
|
match: string;
|
|
172
172
|
/** The opaque id the connector wants. */
|
|
173
173
|
value: string;
|
|
174
|
+
/**
|
|
175
|
+
* The Integration Service connection id the lookup was resolved on. A lookup
|
|
176
|
+
* id belongs to one connection: Slack user `U123` on one workspace is nobody
|
|
177
|
+
* on another. `check` compares it with the connection the step is bound to
|
|
178
|
+
* (LOOKUP_CONNECTION_MISMATCH). Absent on a row written before `prepare`
|
|
179
|
+
* recorded it; such a row is not compared.
|
|
180
|
+
*/
|
|
181
|
+
connectionId?: string;
|
|
174
182
|
}
|
|
175
183
|
/** Every recorded resolution, keyed by {@link lookupKey}. */
|
|
176
184
|
export type LookupResolutions = Readonly<Record<string, LookupResolution>>;
|
|
@@ -182,6 +190,15 @@ export type LookupResolutions = Readonly<Record<string, LookupResolution>>;
|
|
|
182
190
|
* @returns The connector-facing id, when this exact `(nodeType, field, by, value)` was resolved.
|
|
183
191
|
*/
|
|
184
192
|
export declare function resolvedValue(token: LookupToken, resolutions: LookupResolutions): string | undefined;
|
|
193
|
+
/**
|
|
194
|
+
* The recorded row for a token, or `undefined` — {@link resolvedValue} with the
|
|
195
|
+
* rest of the row (the connection it was resolved on).
|
|
196
|
+
*
|
|
197
|
+
* @param token - The lookup.
|
|
198
|
+
* @param resolutions - Everything `prepare --resolve` has recorded.
|
|
199
|
+
* @returns The row for this exact `(nodeType, field, by, value)`.
|
|
200
|
+
*/
|
|
201
|
+
export declare function recordedResolution(token: LookupToken, resolutions: LookupResolutions): LookupResolution | undefined;
|
|
185
202
|
/**
|
|
186
203
|
* {@link resolvedValue} for a token on an event's `where`.
|
|
187
204
|
*
|
|
@@ -199,6 +216,15 @@ export declare function resolvedValue(token: LookupToken, resolutions: LookupRes
|
|
|
199
216
|
* @returns The connector-facing id, when either key was resolved.
|
|
200
217
|
*/
|
|
201
218
|
export declare function resolvedEventValue(token: LookupToken, resolutions: LookupResolutions): string | undefined;
|
|
219
|
+
/**
|
|
220
|
+
* The recorded row for a token on an event's `where`, under either key
|
|
221
|
+
* {@link resolvedEventValue} tries, or `undefined`.
|
|
222
|
+
*
|
|
223
|
+
* @param token - The lookup, from either `lookup()` form.
|
|
224
|
+
* @param resolutions - Everything `prepare --resolve` has recorded.
|
|
225
|
+
* @returns The row, own key first, then the event form.
|
|
226
|
+
*/
|
|
227
|
+
export declare function recordedEventResolution(token: LookupToken, resolutions: LookupResolutions): LookupResolution | undefined;
|
|
202
228
|
/**
|
|
203
229
|
* The message for a lookup nothing has resolved — the command that fixes it.
|
|
204
230
|
*
|
package/dist/core/lookups.js
CHANGED
|
@@ -164,8 +164,20 @@ export function lookup(a, b, c) {
|
|
|
164
164
|
* @returns The connector-facing id, when this exact `(nodeType, field, by, value)` was resolved.
|
|
165
165
|
*/
|
|
166
166
|
export function resolvedValue(token, resolutions) {
|
|
167
|
+
return recordedResolution(token, resolutions)?.value;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* The recorded row for a token, or `undefined` — {@link resolvedValue} with the
|
|
171
|
+
* rest of the row (the connection it was resolved on).
|
|
172
|
+
*
|
|
173
|
+
* @param token - The lookup.
|
|
174
|
+
* @param resolutions - Everything `prepare --resolve` has recorded.
|
|
175
|
+
* @returns The row for this exact `(nodeType, field, by, value)`.
|
|
176
|
+
*/
|
|
177
|
+
export function recordedResolution(token, resolutions) {
|
|
167
178
|
const { nodeType, field, by, value } = token.__lookup;
|
|
168
|
-
|
|
179
|
+
const key = lookupKey(nodeType, field, by, value);
|
|
180
|
+
return Object.prototype.hasOwnProperty.call(resolutions, key) ? resolutions[key] : undefined;
|
|
169
181
|
}
|
|
170
182
|
/**
|
|
171
183
|
* The event form of a node type — `uipath.connector.event.<key>.<op>` — for one
|
|
@@ -193,12 +205,26 @@ function eventFormOf(nodeType) {
|
|
|
193
205
|
* @returns The connector-facing id, when either key was resolved.
|
|
194
206
|
*/
|
|
195
207
|
export function resolvedEventValue(token, resolutions) {
|
|
196
|
-
|
|
197
|
-
|
|
208
|
+
return recordedEventResolution(token, resolutions)?.value;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* The recorded row for a token on an event's `where`, under either key
|
|
212
|
+
* {@link resolvedEventValue} tries, or `undefined`.
|
|
213
|
+
*
|
|
214
|
+
* @param token - The lookup, from either `lookup()` form.
|
|
215
|
+
* @param resolutions - Everything `prepare --resolve` has recorded.
|
|
216
|
+
* @returns The row, own key first, then the event form.
|
|
217
|
+
*/
|
|
218
|
+
export function recordedEventResolution(token, resolutions) {
|
|
219
|
+
const own = recordedResolution(token, resolutions);
|
|
220
|
+
if (own?.value !== undefined)
|
|
198
221
|
return own;
|
|
199
222
|
const { nodeType, field, by, value } = token.__lookup;
|
|
200
223
|
const eventForm = eventFormOf(nodeType);
|
|
201
|
-
|
|
224
|
+
if (eventForm === undefined)
|
|
225
|
+
return undefined;
|
|
226
|
+
const key = lookupKey(eventForm, field, by, value);
|
|
227
|
+
return Object.prototype.hasOwnProperty.call(resolutions, key) ? resolutions[key] : undefined;
|
|
202
228
|
}
|
|
203
229
|
/**
|
|
204
230
|
* The message for a lookup nothing has resolved — the command that fixes it.
|
package/dist/core/refusals.d.ts
CHANGED
|
@@ -256,10 +256,13 @@ export declare const REFUSALS: {
|
|
|
256
256
|
readonly CONV_AGENT_SETTINGS_MODE: "lint";
|
|
257
257
|
readonly CUSTOM_FIELDS_UNPREPARED: "lint";
|
|
258
258
|
readonly DANGLING_FLOW: "lowering";
|
|
259
|
+
readonly DATAFABRIC_CHOICE_VALUE: "lint";
|
|
260
|
+
readonly DATAFABRIC_CHOICE_WRITE_VALUE: "lint";
|
|
259
261
|
readonly DATAFABRIC_DELETE_HAS_NO_OUTPUT: "lint";
|
|
260
262
|
readonly DATAFABRIC_EMPTY_SET: "lint";
|
|
261
263
|
readonly DATAFABRIC_EMPTY_VALUES: "lint";
|
|
262
264
|
readonly DATAFABRIC_ENTITY_REF_INVALID: "lowering";
|
|
265
|
+
readonly DATAFABRIC_FIELD_TYPE: "lint";
|
|
263
266
|
readonly DATAFABRIC_FILTER_BLANK_VALUE: "lint";
|
|
264
267
|
readonly DATAFABRIC_FOLDER_NO_RESOURCE_KEY: "lint";
|
|
265
268
|
readonly DATAFABRIC_FROMREAD_MULTIPLE: "lint";
|
|
@@ -267,11 +270,14 @@ export declare const REFUSALS: {
|
|
|
267
270
|
readonly DATAFABRIC_IN_REQUIRES_MULTIPLE: "lint";
|
|
268
271
|
readonly DATAFABRIC_LIMIT_RANGE: "lint";
|
|
269
272
|
readonly DATAFABRIC_NO_ENTITY: "lint";
|
|
273
|
+
readonly DATAFABRIC_NULL_REQUIRED: "lint";
|
|
270
274
|
readonly DATAFABRIC_QUERY_OPTS_WITHOUT_MULTIPLE: "lint";
|
|
271
275
|
readonly DATAFABRIC_RECORD_REF: "lowering";
|
|
276
|
+
readonly DATAFABRIC_REQUIRED_MISSING: "lint";
|
|
272
277
|
readonly DATAFABRIC_RESOURCE_KEY_NO_FOLDER: "lowering";
|
|
273
278
|
readonly DATAFABRIC_RESULT_MODE_VERSION: "lowering";
|
|
274
279
|
readonly DATAFABRIC_SYSTEM_COLUMN: "lint";
|
|
280
|
+
readonly DATAFABRIC_UNKNOWN_FIELD: "lint";
|
|
275
281
|
readonly DEAD_END: "lint";
|
|
276
282
|
readonly DECLARATION_SHAPE: "lowering";
|
|
277
283
|
readonly DECLARATION_TYPE_NOT_FLOW: "lowering";
|
|
@@ -558,6 +564,7 @@ export declare const REFUSALS: {
|
|
|
558
564
|
readonly LIBRARY_REQUIRED: "lowering";
|
|
559
565
|
readonly LIST_OUTPUT_WRAPPER: "lint";
|
|
560
566
|
readonly LOOKUP_ARGS: "lowering";
|
|
567
|
+
readonly LOOKUP_CONNECTION_MISMATCH: "lint";
|
|
561
568
|
readonly LOOKUP_LITERAL_ID: "lint";
|
|
562
569
|
readonly LOOKUP_MISPLACED: "lowering";
|
|
563
570
|
readonly LOOKUP_RUNTIME_VALUE: "lint";
|
|
@@ -673,6 +680,7 @@ export declare const REFUSALS: {
|
|
|
673
680
|
readonly RULE_STAGE_AND_STAGES: "lowering";
|
|
674
681
|
readonly RULE_TASKS_REQUIRED: "lint";
|
|
675
682
|
readonly RULE_UNKNOWN_OPTION: "lowering";
|
|
683
|
+
readonly SCHEDULE_CRON_INVALID: "lint";
|
|
676
684
|
readonly SCHEDULE_CRON_VERSION: "lowering";
|
|
677
685
|
readonly SCHEDULE_INTERVAL_VERSION: "lowering";
|
|
678
686
|
readonly SCHEDULE_NEVER_FIRES: "lint";
|
package/dist/core/refusals.js
CHANGED
|
@@ -330,10 +330,13 @@ export const REFUSALS = {
|
|
|
330
330
|
CONV_AGENT_SETTINGS_MODE: 'lint',
|
|
331
331
|
CUSTOM_FIELDS_UNPREPARED: 'lint',
|
|
332
332
|
DANGLING_FLOW: 'lowering',
|
|
333
|
+
DATAFABRIC_CHOICE_VALUE: 'lint',
|
|
334
|
+
DATAFABRIC_CHOICE_WRITE_VALUE: 'lint',
|
|
333
335
|
DATAFABRIC_DELETE_HAS_NO_OUTPUT: 'lint',
|
|
334
336
|
DATAFABRIC_EMPTY_SET: 'lint',
|
|
335
337
|
DATAFABRIC_EMPTY_VALUES: 'lint',
|
|
336
338
|
DATAFABRIC_ENTITY_REF_INVALID: 'lowering',
|
|
339
|
+
DATAFABRIC_FIELD_TYPE: 'lint',
|
|
337
340
|
DATAFABRIC_FILTER_BLANK_VALUE: 'lint',
|
|
338
341
|
DATAFABRIC_FOLDER_NO_RESOURCE_KEY: 'lint',
|
|
339
342
|
DATAFABRIC_FROMREAD_MULTIPLE: 'lint',
|
|
@@ -341,11 +344,14 @@ export const REFUSALS = {
|
|
|
341
344
|
DATAFABRIC_IN_REQUIRES_MULTIPLE: 'lint',
|
|
342
345
|
DATAFABRIC_LIMIT_RANGE: 'lint',
|
|
343
346
|
DATAFABRIC_NO_ENTITY: 'lint',
|
|
347
|
+
DATAFABRIC_NULL_REQUIRED: 'lint',
|
|
344
348
|
DATAFABRIC_QUERY_OPTS_WITHOUT_MULTIPLE: 'lint',
|
|
345
349
|
DATAFABRIC_RECORD_REF: 'lowering',
|
|
350
|
+
DATAFABRIC_REQUIRED_MISSING: 'lint',
|
|
346
351
|
DATAFABRIC_RESOURCE_KEY_NO_FOLDER: 'lowering',
|
|
347
352
|
DATAFABRIC_RESULT_MODE_VERSION: 'lowering',
|
|
348
353
|
DATAFABRIC_SYSTEM_COLUMN: 'lint',
|
|
354
|
+
DATAFABRIC_UNKNOWN_FIELD: 'lint',
|
|
349
355
|
DEAD_END: 'lint',
|
|
350
356
|
DECLARATION_SHAPE: 'lowering',
|
|
351
357
|
DECLARATION_TYPE_NOT_FLOW: 'lowering',
|
|
@@ -634,6 +640,7 @@ export const REFUSALS = {
|
|
|
634
640
|
LIBRARY_REQUIRED: 'lowering',
|
|
635
641
|
LIST_OUTPUT_WRAPPER: 'lint',
|
|
636
642
|
LOOKUP_ARGS: 'lowering',
|
|
643
|
+
LOOKUP_CONNECTION_MISMATCH: 'lint',
|
|
637
644
|
LOOKUP_LITERAL_ID: 'lint',
|
|
638
645
|
LOOKUP_MISPLACED: 'lowering',
|
|
639
646
|
LOOKUP_RUNTIME_VALUE: 'lint',
|
|
@@ -749,6 +756,7 @@ export const REFUSALS = {
|
|
|
749
756
|
RULE_STAGE_AND_STAGES: 'lowering',
|
|
750
757
|
RULE_TASKS_REQUIRED: 'lint',
|
|
751
758
|
RULE_UNKNOWN_OPTION: 'lowering',
|
|
759
|
+
SCHEDULE_CRON_INVALID: 'lint',
|
|
752
760
|
SCHEDULE_CRON_VERSION: 'lowering',
|
|
753
761
|
SCHEDULE_INTERVAL_VERSION: 'lowering',
|
|
754
762
|
SCHEDULE_NEVER_FIRES: 'lint',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EntityFieldSchema } from './entity-schema.js';
|
|
1
2
|
/** The kind a Data Fabric entity is catalogued under. */
|
|
2
3
|
export declare const ENTITY_KIND = "Entity";
|
|
3
4
|
/**
|
|
@@ -55,6 +56,14 @@ export interface ResourceResolution {
|
|
|
55
56
|
* the author's reference and rebuilds the copy instead of treating it as authored.
|
|
56
57
|
*/
|
|
57
58
|
aliasOf?: string;
|
|
59
|
+
/**
|
|
60
|
+
* For an entity: its columns, as `prepare --entity` read them from the tenant
|
|
61
|
+
* (#1980). `check` validates a step's column names, value types, choice-set
|
|
62
|
+
* values and nullability against them. Absent when the schema could not be
|
|
63
|
+
* read (a solution-authored entity, a failed read) or for a row written
|
|
64
|
+
* before prepare recorded it; `check` then checks no column.
|
|
65
|
+
*/
|
|
66
|
+
fields?: EntityFieldSchema[];
|
|
58
67
|
}
|
|
59
68
|
/** Every recorded resolution, keyed by {@link resourceLedgerKey}. */
|
|
60
69
|
export type ResourceResolutions = Readonly<Record<string, ResourceResolution>>;
|