@uipath/maestro-builder-sdk 6.101.0 → 6.103.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.
Files changed (56) hide show
  1. package/dist/api-index.md +22 -22
  2. package/dist/api-members.md +30 -30
  3. package/dist/core/actions.d.ts +6 -0
  4. package/dist/core/actions.js +7 -0
  5. package/dist/core/binding-messages.d.ts +33 -1
  6. package/dist/core/binding-messages.js +51 -0
  7. package/dist/core/connector-option-keys.d.ts +4 -0
  8. package/dist/core/connector-option-keys.js +9 -0
  9. package/dist/core/entity-schema.d.ts +94 -0
  10. package/dist/core/entity-schema.js +58 -0
  11. package/dist/core/event-subscription.d.ts +8 -0
  12. package/dist/core/event-subscription.js +2 -4
  13. package/dist/core/nodes/node-type.d.ts +25 -0
  14. package/dist/core/nodes/versioned.d.ts +3 -1
  15. package/dist/core/nodes/versioned.js +1 -0
  16. package/dist/core/option-keys.d.ts +62 -0
  17. package/dist/core/option-keys.js +66 -0
  18. package/dist/core/refusals.d.ts +10 -0
  19. package/dist/core/refusals.js +12 -0
  20. package/dist/core/resource-resolution.d.ts +9 -0
  21. package/dist/flow-node-type.d.ts +31 -1
  22. package/dist/flow-option-keys.d.ts +22 -0
  23. package/dist/flow-option-keys.js +33 -0
  24. package/dist/flow-sdk.js +5 -9
  25. package/dist/nodes/agent/flow/inline-agent.js +2 -4
  26. package/dist/nodes/agent/flow/node-type.js +12 -0
  27. package/dist/nodes/ai-patterns/flow/node-type.js +6 -0
  28. package/dist/nodes/connector/flow/event-trigger.js +4 -2
  29. package/dist/nodes/connector/flow/event-wait.js +4 -2
  30. package/dist/nodes/connector/flow/node-type.js +5 -4
  31. package/dist/nodes/connector/flow/raw-node.js +1 -1
  32. package/dist/nodes/conversation/flow/node-type.js +9 -0
  33. package/dist/nodes/data-fabric/flow/check.js +214 -0
  34. package/dist/nodes/data-fabric/flow/verbs.js +10 -0
  35. package/dist/nodes/delay/flow/node-type.js +4 -0
  36. package/dist/nodes/document/flow/ixp.js +4 -0
  37. package/dist/nodes/document/flow/node-type.js +6 -0
  38. package/dist/nodes/hitl/flow/node-type.js +4 -0
  39. package/dist/nodes/http/flow/check.js +55 -0
  40. package/dist/nodes/http/flow/node-type.js +7 -4
  41. package/dist/nodes/process/flow/node-type.js +10 -0
  42. package/dist/nodes/queue/flow/node-type.js +4 -0
  43. package/dist/nodes/script/flow/node-type.js +4 -0
  44. package/dist/nodes/transform/flow/node-type.js +4 -0
  45. package/dist/nodes/trigger/flow/check.js +193 -2
  46. package/dist/nodes/trigger/flow/node-type.js +6 -0
  47. package/dist/nodes/trigger/flow/spec.d.ts +10 -1
  48. package/dist/registry/prepare/entity-schema.d.ts +40 -0
  49. package/dist/registry/prepare/entity-schema.js +135 -0
  50. package/dist/registry/prepare/resources.d.ts +12 -5
  51. package/dist/registry/prepare/resources.js +26 -4
  52. package/dist/registry/prepare-cli.js +38 -3
  53. package/dist/registry/uip/commands.d.ts +19 -0
  54. package/dist/registry/uip/commands.js +25 -0
  55. package/dist/serialize.js +73 -1
  56. package/package.json +2 -2
@@ -0,0 +1,94 @@
1
+ /**
2
+ * A Data Fabric entity's columns, as `registry prepare --entity` records them
3
+ * beside the entity's keys in the resource ledger (#1980).
4
+ *
5
+ * Data Fabric DROPS a column it does not know instead of rejecting it, and only
6
+ * logs a write it refuses, so a typo in a filter, a sort, a `set` key or a
7
+ * choice-set label validates clean and runs green. The schema is tenant data:
8
+ * nothing offline can tell a real column from a typo. `prepare` reads it once
9
+ * (`uip df entities get`, and `uip df choice-sets list-values` for each choice
10
+ * set) and `check` reads it from the ledger, the way it reads the keys.
11
+ *
12
+ * This module is the portable half: the recorded shape and the lookup `check`
13
+ * makes. Reading the tenant is `registry/prepare/entity-schema.ts`'s.
14
+ */
15
+ import { type EntityRef, type ResourceResolution, type ResourceResolutions } from './resource-resolution.js';
16
+ /** One value of a choice set: the label an author sees, and the number Data Fabric stores and compares. */
17
+ export interface EntityChoiceValue {
18
+ /** The value's name, e.g. `'Active'`. */
19
+ name: string;
20
+ /** Its display name, when it differs from the name. */
21
+ displayName?: string;
22
+ /** What a filter compares and a write stores: `0`, `1`, … */
23
+ numberId: number;
24
+ }
25
+ /** One column of a Data Fabric entity, as `prepare` recorded it. */
26
+ export interface EntityFieldSchema {
27
+ /** The column's name, exactly as Data Fabric spells it (names are case-sensitive). */
28
+ name: string;
29
+ /** Its display name, when it differs from the name. */
30
+ displayName?: string;
31
+ /**
32
+ * Data Fabric's type name, `FieldDataType.Name`: `STRING`, `MULTILINE_TEXT`,
33
+ * `INTEGER`, `DECIMAL`, `BOOLEAN`, `DATE`, `DATETIME_WITH_TZ`, `UUID`,
34
+ * `RELATIONSHIP`, `CHOICE_SET_SINGLE`, `CHOICE_SET_MULTIPLE`, `FILE`, …
35
+ */
36
+ type: string;
37
+ /** `IsRequired`: Data Fabric rejects a write that sends null for this column. */
38
+ required: boolean;
39
+ /** A column Data Fabric assigns (`Id`, `CreateTime`, …): never writable. */
40
+ system?: true;
41
+ /** The column has a server default, so an insert may leave it out. */
42
+ hasDefault?: true;
43
+ /** A unique or primary-key column. */
44
+ unique?: true;
45
+ /** A file column: the native family cannot write it. */
46
+ attachment?: true;
47
+ /** An auto-number column, which Data Fabric assigns. */
48
+ autoNumber?: true;
49
+ /** The longest text the column holds, for a text type. */
50
+ lengthLimit?: number;
51
+ /** For a `RELATIONSHIP` column: the related entity, and the display column the reference carries. */
52
+ reference?: {
53
+ entity: string;
54
+ entityId?: string;
55
+ displayField?: string;
56
+ };
57
+ /** For a choice-set column: the set, and its values when `prepare` could read them. */
58
+ choiceSet?: {
59
+ name: string;
60
+ id: string;
61
+ values?: EntityChoiceValue[];
62
+ };
63
+ }
64
+ /** Where a step's entity lives, as the step names it. */
65
+ export interface EntityScopeRef {
66
+ entity: string | EntityRef;
67
+ folderKey?: string;
68
+ }
69
+ /** The recorded schema for a step's entity, and the row it came from. */
70
+ export interface RecordedEntitySchema {
71
+ fields: readonly EntityFieldSchema[];
72
+ row: ResourceResolution;
73
+ }
74
+ /**
75
+ * The schema `prepare --entity` recorded for the entity a step names, or
76
+ * `undefined` when there is none to trust.
77
+ *
78
+ * - `{ name, folder }` reads its own row ({@link lookupResource}), the one
79
+ * `compile` takes its keys from.
80
+ * - A plain name reads the fresh `Entity` rows of that name whose scope is the
81
+ * step's: the row with the step's `folderKey`, or a tenant-level row when the
82
+ * step has none. Exactly one distinct entity must match; two (a name in two
83
+ * folders, recorded under different references) is no answer, never a guess.
84
+ *
85
+ * A row older than one session counts as absent, as it does for the keys: an
86
+ * entity edited since would be judged by its old columns.
87
+ *
88
+ * @param resources - The ledger rows `check` was given.
89
+ * @param scope - The step's `entity` and `folderKey`.
90
+ * @param now - The clock, for freshness.
91
+ */
92
+ export declare function recordedEntitySchema(resources: ResourceResolutions | undefined, scope: EntityScopeRef, now?: number): RecordedEntitySchema | undefined;
93
+ /** The column named exactly `name`, or `undefined`. */
94
+ export declare function entityField(fields: readonly EntityFieldSchema[], name: string): EntityFieldSchema | undefined;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * A Data Fabric entity's columns, as `registry prepare --entity` records them
3
+ * beside the entity's keys in the resource ledger (#1980).
4
+ *
5
+ * Data Fabric DROPS a column it does not know instead of rejecting it, and only
6
+ * logs a write it refuses, so a typo in a filter, a sort, a `set` key or a
7
+ * choice-set label validates clean and runs green. The schema is tenant data:
8
+ * nothing offline can tell a real column from a typo. `prepare` reads it once
9
+ * (`uip df entities get`, and `uip df choice-sets list-values` for each choice
10
+ * set) and `check` reads it from the ledger, the way it reads the keys.
11
+ *
12
+ * This module is the portable half: the recorded shape and the lookup `check`
13
+ * makes. Reading the tenant is `registry/prepare/entity-schema.ts`'s.
14
+ */
15
+ import { ENTITY_KIND, entityResource, isEntityRef, lookupResource, resourceRowIsFresh, } from './resource-resolution.js';
16
+ /**
17
+ * The schema `prepare --entity` recorded for the entity a step names, or
18
+ * `undefined` when there is none to trust.
19
+ *
20
+ * - `{ name, folder }` reads its own row ({@link lookupResource}), the one
21
+ * `compile` takes its keys from.
22
+ * - A plain name reads the fresh `Entity` rows of that name whose scope is the
23
+ * step's: the row with the step's `folderKey`, or a tenant-level row when the
24
+ * step has none. Exactly one distinct entity must match; two (a name in two
25
+ * folders, recorded under different references) is no answer, never a guess.
26
+ *
27
+ * A row older than one session counts as absent, as it does for the keys: an
28
+ * entity edited since would be judged by its old columns.
29
+ *
30
+ * @param resources - The ledger rows `check` was given.
31
+ * @param scope - The step's `entity` and `folderKey`.
32
+ * @param now - The clock, for freshness.
33
+ */
34
+ export function recordedEntitySchema(resources, scope, now = Date.now()) {
35
+ if (resources === undefined)
36
+ return undefined;
37
+ if (isEntityRef(scope.entity)) {
38
+ const row = lookupResource(resources, entityResource(scope.entity), now);
39
+ return row?.fields !== undefined ? { fields: row.fields, row } : undefined;
40
+ }
41
+ const name = scope.entity;
42
+ const matches = new Map();
43
+ for (const row of Object.values(resources)) {
44
+ if (row.kind !== ENTITY_KIND || row.name !== name || row.fields === undefined || !resourceRowIsFresh(row, now))
45
+ continue;
46
+ const sameScope = scope.folderKey !== undefined ? row.folderKey === scope.folderKey : row.scope === 'tenant';
47
+ if (sameScope)
48
+ matches.set(row.folderKey ?? '', row);
49
+ }
50
+ if (matches.size !== 1)
51
+ return undefined;
52
+ const row = [...matches.values()][0];
53
+ return { fields: row.fields, row };
54
+ }
55
+ /** The column named exactly `name`, or `undefined`. */
56
+ export function entityField(fields, name) {
57
+ return fields.find((f) => f.name === name);
58
+ }
@@ -21,6 +21,14 @@ export interface EventEmitEnv {
21
21
  readonly bindings?: BindingsView;
22
22
  /** A connection or folder label to the key the node carries, with compile's refusals and warnings. */
23
23
  resolveBinding(name: string | undefined, attribute: 'connection' | 'folder', where: string, target?: PrepareTarget): string | undefined;
24
+ /** Both labels of a subscription's pair, resolved and judged as one (BINDING_CONNECTION_IS_FOLDER). */
25
+ resolveBindingPair(labels: {
26
+ connection?: string;
27
+ folder?: string;
28
+ }, where: string, target?: PrepareTarget): {
29
+ connectionId: string | undefined;
30
+ folderKey: string | undefined;
31
+ };
24
32
  }
25
33
  /** What `registry prepare` takes for an event subscription: its connector key and curated event name. */
26
34
  export declare function eventTarget(sub: {
@@ -79,8 +79,7 @@ export function libraryRequiredForEvent(env, sub, nodeId, site, call) {
79
79
  }
80
80
  eventFilterReads(sub.filters, nodeId);
81
81
  requireBindingPair(site, sub, eventTarget(sub));
82
- const connection = env.resolveBinding(sub.connection, 'connection', `event node "${nodeId}"`, eventTarget(sub));
83
- env.resolveBinding(sub.folder, 'folder', `event node "${nodeId}"`, eventTarget(sub));
82
+ const { connectionId: connection } = env.resolveBindingPair(sub, `event node "${nodeId}"`, eventTarget(sub));
84
83
  const connector = eventTarget(sub)?.key;
85
84
  if (connection !== undefined && connector !== undefined)
86
85
  use = { connector, connection };
@@ -271,8 +270,7 @@ export function eventDetail(rc, sub, nodeId, env, site, opts = {}) {
271
270
  // An unbound draft the canvas saved (`opts.unbound`, a draft compile) is written with no connection, as the file has it.
272
271
  if (!opts.unbound)
273
272
  requireBindingPair(site, sub, eventTarget(sub));
274
- const conn = env.resolveBinding(sub.connection, 'connection', `event node "${nodeId}"`, eventTarget(sub));
275
- const folder = env.resolveBinding(sub.folder, 'folder', `event node "${nodeId}"`, eventTarget(sub));
273
+ const { connectionId: conn, folderKey: folder } = env.resolveBindingPair(sub, `event node "${nodeId}"`, eventTarget(sub));
276
274
  const op = (rc.entry?.operation ?? {});
277
275
  // A GENERIC event with no `object` would carry `objectName: ""`: it validates
278
276
  // and the platform's dispatcher refuses it. Refused here, at the layer that
@@ -141,6 +141,13 @@ export interface ErrorHandlerCheckContext {
141
141
  readonly step: string;
142
142
  report(code: string, message: string, suggestion?: string): void;
143
143
  }
144
+ /**
145
+ * The option objects of a spec (`inputs`, a trigger's `appearance`) and every key
146
+ * each may carry. See {@link NodeType.optionKeys}.
147
+ */
148
+ export type OptionKeyLists<Spec> = {
149
+ readonly [F in keyof Spec]?: readonly string[];
150
+ };
144
151
  /** One node type at one version, for one artifact. See the module header. */
145
152
  export interface NodeType<Spec, Serialized, Ctx extends ArtifactContexts> {
146
153
  /** The spec discriminator, e.g. `'dataFabricRead'`. Unique within the artifact's registry. */
@@ -151,6 +158,24 @@ export interface NodeType<Spec, Serialized, Ctx extends ArtifactContexts> {
151
158
  readonly version: string;
152
159
  /** The public factory that produces this spec, e.g. `'dataFabricRead'`. */
153
160
  readonly factory: string;
161
+ /**
162
+ * The option objects of this type's spec, each with every key it may carry
163
+ * (builder-sdk#1990). The artifact's serializer refuses any other key (Flow:
164
+ * FLOW_UNKNOWN_OPTION), because it would drop it: for instance
165
+ * `http({ url, managed: true, retryCont: 2 })` would compile with no retry.
166
+ * Build each list with `declareKeys<T>()` (`core/option-keys.ts`), which `tsc`
167
+ * holds to the option type, so the list cannot drift from it:
168
+ *
169
+ * ```ts
170
+ * optionKeys: { inputs: declareKeys<HttpInputs>({ url: true, method: true, ... }) }
171
+ * ```
172
+ *
173
+ * Omit it, or a field, and that object stays open: a connector's `inputs` (the
174
+ * connector's own fields, which its library checks), or a node-type
175
+ * package's spec. On a versioned type, declare it once on the
176
+ * `VersionedNodeType`: the option types are the kind's, not a version's.
177
+ */
178
+ readonly optionKeys?: OptionKeyLists<Spec>;
154
179
  /** Where the definition comes from; decides who answers `errorPort` (see below). */
155
180
  readonly definition: DefinitionSource;
156
181
  /**
@@ -7,7 +7,7 @@
7
7
  * is a new entry (usually a subclass of the previous one), so adding it cannot
8
8
  * change how a node at an older version serializes, deserializes or prints.
9
9
  */
10
- import type { ArtifactContexts, NodeType } from './node-type.js';
10
+ import type { ArtifactContexts, NodeType, OptionKeyLists } from './node-type.js';
11
11
  export interface VersionedNodeType<Spec, Serialized, Ctx extends ArtifactContexts,
12
12
  /** The implementation type: an artifact's own extension of NodeType, when it has one. */
13
13
  Impl extends NodeType<Spec, Serialized, Ctx> = NodeType<Spec, Serialized, Ctx>> {
@@ -45,6 +45,8 @@ Impl extends NodeType<Spec, Serialized, Ctx> = NodeType<Spec, Serialized, Ctx>>
45
45
  readonly defaultVersion: string;
46
46
  /** Every registered version → its implementation. Keys equal each entry's `version`. */
47
47
  readonly versions: Readonly<Record<string, Impl>>;
48
+ /** The option keys of the kind's spec, for every version (see NodeType.optionKeys). */
49
+ readonly optionKeys?: OptionKeyLists<Spec>;
48
50
  /**
49
51
  * The version a spec needs when the author named none (`requested` undefined),
50
52
  * e.g. a read that sets `resultMode` needs `core.datafabric.read@1.4`. Omit it
@@ -16,6 +16,7 @@ export function asVersioned(t) {
16
16
  defaultVersion: one.version,
17
17
  versions: { [one.version]: one },
18
18
  ...(one.matches ? { matches: (spec) => one.matches(spec) } : {}),
19
+ ...(one.optionKeys ? { optionKeys: one.optionKeys } : {}),
19
20
  };
20
21
  }
21
22
  /**
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Option keys: the keys an author may put in a builder's option object, and the
3
+ * refusal for any other key (builder-sdk#1990).
4
+ *
5
+ * Why it exists: an authored `.flow.ts` runs with its types erased
6
+ * (`--experimental-strip-types`), so TypeScript's own "Object literal may only
7
+ * specify known properties" never fires. Without this, a key the SDK does not
8
+ * know was dropped with no word: `http({ url, managed: true, retryCont: 2 })`
9
+ * compiled with no retry, and an option a NEWER SDK added (`inlineAgent({ tools })`
10
+ * on an SDK that predates `tools`) compiled the node without the feature.
11
+ *
12
+ * Two halves:
13
+ *
14
+ * - {@link declareKeys} turns an object literal into the key list. Its parameter
15
+ * type requires EVERY key of the option type and admits NO other, so the list
16
+ * cannot drift from the type: adding `retryDelay?: string` to `HttpInputs`
17
+ * and not to the list is a `tsc` error in `npm run build`.
18
+ * - {@link unknownOptionRefusal} compares one option object with its list and
19
+ * returns the `FLOW_UNKNOWN_OPTION` refusal, with the nearest known key as
20
+ * the suggestion.
21
+ *
22
+ * The refusal is class `lowering` (core/refusals.ts): the serializer would drop
23
+ * the key, so `compile` must not write the file without it
24
+ * (docs/CHECK_COMPILE_CONTRACT_DESIGN.md §3.1), and `check` reports it through
25
+ * the serializer's collect mode, on the step that carries it.
26
+ */
27
+ import { CompileRefusal } from './compile-refusal.js';
28
+ /** Every key of every member of a union: `keyof (A | B)` is only the keys they share. */
29
+ export type KeysOfUnion<T> = T extends unknown ? keyof T : never;
30
+ /**
31
+ * An object literal that names each option key of `T` once, as `true`: no key
32
+ * missing (the mapped keys are required) and no key extra (an object literal's
33
+ * excess-property check). For instance, for `{ a: string; b?: number }`:
34
+ *
35
+ * ```ts
36
+ * declareKeys<{ a: string; b?: number }>({ a: true, b: true }) // ok
37
+ * declareKeys<{ a: string; b?: number }>({ a: true }) // tsc: 'b' is missing
38
+ * declareKeys<{ a: string; b?: number }>({ a: true, b: true, c: true }) // tsc: 'c' is not a key
39
+ * ```
40
+ */
41
+ export type OptionKeySet<T> = {
42
+ readonly [K in KeysOfUnion<T> & string]-?: true;
43
+ };
44
+ /**
45
+ * The option keys of `T`, as a list, checked against `T` by `tsc` (see
46
+ * {@link OptionKeySet}). Declare a family's list with it, never by hand.
47
+ */
48
+ export declare function declareKeys<T>(keys: OptionKeySet<T>): readonly string[];
49
+ /**
50
+ * The FLOW_UNKNOWN_OPTION refusal for the first key of `bag` that is not in
51
+ * `known`, or `undefined` when every key is known. A key whose value is
52
+ * `undefined` is skipped: it sets nothing, so nothing is dropped. Anything that
53
+ * is not a plain object (an array, an `Expr`, a missing bag) is not judged here.
54
+ *
55
+ * `call` names the option object as the author wrote it, e.g. `http()` or
56
+ * `.loop() options`; `where` places it, e.g. `step "fetch"`.
57
+ *
58
+ * For instance `unknownOptionRefusal({ url: 'x', retryCont: 2 }, HTTP_KEYS, 'http()', 'step "fetch"')`
59
+ * reads `step "fetch": http() has no option "retryCont". This SDK knows: …`, with the
60
+ * suggestion `retryCount` (the CLI prints it as `(did you mean "retryCount"?)`).
61
+ */
62
+ export declare function unknownOptionRefusal(bag: unknown, known: readonly string[], call: string, where: string): CompileRefusal | undefined;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Option keys: the keys an author may put in a builder's option object, and the
3
+ * refusal for any other key (builder-sdk#1990).
4
+ *
5
+ * Why it exists: an authored `.flow.ts` runs with its types erased
6
+ * (`--experimental-strip-types`), so TypeScript's own "Object literal may only
7
+ * specify known properties" never fires. Without this, a key the SDK does not
8
+ * know was dropped with no word: `http({ url, managed: true, retryCont: 2 })`
9
+ * compiled with no retry, and an option a NEWER SDK added (`inlineAgent({ tools })`
10
+ * on an SDK that predates `tools`) compiled the node without the feature.
11
+ *
12
+ * Two halves:
13
+ *
14
+ * - {@link declareKeys} turns an object literal into the key list. Its parameter
15
+ * type requires EVERY key of the option type and admits NO other, so the list
16
+ * cannot drift from the type: adding `retryDelay?: string` to `HttpInputs`
17
+ * and not to the list is a `tsc` error in `npm run build`.
18
+ * - {@link unknownOptionRefusal} compares one option object with its list and
19
+ * returns the `FLOW_UNKNOWN_OPTION` refusal, with the nearest known key as
20
+ * the suggestion.
21
+ *
22
+ * The refusal is class `lowering` (core/refusals.ts): the serializer would drop
23
+ * the key, so `compile` must not write the file without it
24
+ * (docs/CHECK_COMPILE_CONTRACT_DESIGN.md §3.1), and `check` reports it through
25
+ * the serializer's collect mode, on the step that carries it.
26
+ */
27
+ import { CompileRefusal } from './compile-refusal.js';
28
+ import { nearestName } from './edit-distance.js';
29
+ import { PACKAGE_NAME } from '../package-name.js';
30
+ /**
31
+ * The option keys of `T`, as a list, checked against `T` by `tsc` (see
32
+ * {@link OptionKeySet}). Declare a family's list with it, never by hand.
33
+ */
34
+ export function declareKeys(keys) {
35
+ return Object.freeze(Object.keys(keys));
36
+ }
37
+ /**
38
+ * The FLOW_UNKNOWN_OPTION refusal for the first key of `bag` that is not in
39
+ * `known`, or `undefined` when every key is known. A key whose value is
40
+ * `undefined` is skipped: it sets nothing, so nothing is dropped. Anything that
41
+ * is not a plain object (an array, an `Expr`, a missing bag) is not judged here.
42
+ *
43
+ * `call` names the option object as the author wrote it, e.g. `http()` or
44
+ * `.loop() options`; `where` places it, e.g. `step "fetch"`.
45
+ *
46
+ * For instance `unknownOptionRefusal({ url: 'x', retryCont: 2 }, HTTP_KEYS, 'http()', 'step "fetch"')`
47
+ * reads `step "fetch": http() has no option "retryCont". This SDK knows: …`, with the
48
+ * suggestion `retryCount` (the CLI prints it as `(did you mean "retryCount"?)`).
49
+ */
50
+ export function unknownOptionRefusal(bag, known, call, where) {
51
+ if (bag === null || typeof bag !== 'object' || Array.isArray(bag))
52
+ return undefined;
53
+ const proto = Object.getPrototypeOf(bag);
54
+ if (proto !== Object.prototype && proto !== null)
55
+ return undefined;
56
+ const unknown = Object.keys(bag).filter((k) => !known.includes(k) && bag[k] !== undefined);
57
+ if (unknown.length === 0)
58
+ return undefined;
59
+ const key = unknown[0];
60
+ const nearest = nearestName(key, [...known]);
61
+ const others = unknown.length > 1 ? ` (and ${unknown.slice(1).map((k) => `"${k}"`).join(', ')})` : '';
62
+ return new CompileRefusal('FLOW_UNKNOWN_OPTION', `${where}: ${call} has no option "${key}"${others}.`
63
+ + ` This SDK knows: ${known.length > 0 ? known.join(', ') : '(none)'}. An unknown option would be dropped `
64
+ + 'from the compiled flow, so it is refused: fix the spelling, remove it, or, if a newer SDK added it, '
65
+ + `upgrade ${PACKAGE_NAME}.`, nearest);
66
+ }
@@ -57,6 +57,7 @@ export declare const REFUSALS: {
57
57
  readonly ARM_SCOPED_OUTPUT_READ: "lint";
58
58
  readonly ASSIGNMENT_NOT_ALLOWED: "lint";
59
59
  readonly BAD_DEFAULT: "lint";
60
+ readonly BINDING_CONNECTION_IS_FOLDER: "draft";
60
61
  readonly BINDING_CONNECTION_TWO_FOLDERS: "lowering";
61
62
  readonly BINDING_MISSING: "draft";
62
63
  readonly BINDING_PLACEHOLDER_UNRESOLVED: "draft";
@@ -255,10 +256,13 @@ export declare const REFUSALS: {
255
256
  readonly CONV_AGENT_SETTINGS_MODE: "lint";
256
257
  readonly CUSTOM_FIELDS_UNPREPARED: "lint";
257
258
  readonly DANGLING_FLOW: "lowering";
259
+ readonly DATAFABRIC_CHOICE_VALUE: "lint";
260
+ readonly DATAFABRIC_CHOICE_WRITE_VALUE: "lint";
258
261
  readonly DATAFABRIC_DELETE_HAS_NO_OUTPUT: "lint";
259
262
  readonly DATAFABRIC_EMPTY_SET: "lint";
260
263
  readonly DATAFABRIC_EMPTY_VALUES: "lint";
261
264
  readonly DATAFABRIC_ENTITY_REF_INVALID: "lowering";
265
+ readonly DATAFABRIC_FIELD_TYPE: "lint";
262
266
  readonly DATAFABRIC_FILTER_BLANK_VALUE: "lint";
263
267
  readonly DATAFABRIC_FOLDER_NO_RESOURCE_KEY: "lint";
264
268
  readonly DATAFABRIC_FROMREAD_MULTIPLE: "lint";
@@ -266,11 +270,14 @@ export declare const REFUSALS: {
266
270
  readonly DATAFABRIC_IN_REQUIRES_MULTIPLE: "lint";
267
271
  readonly DATAFABRIC_LIMIT_RANGE: "lint";
268
272
  readonly DATAFABRIC_NO_ENTITY: "lint";
273
+ readonly DATAFABRIC_NULL_REQUIRED: "lint";
269
274
  readonly DATAFABRIC_QUERY_OPTS_WITHOUT_MULTIPLE: "lint";
270
275
  readonly DATAFABRIC_RECORD_REF: "lowering";
276
+ readonly DATAFABRIC_REQUIRED_MISSING: "lint";
271
277
  readonly DATAFABRIC_RESOURCE_KEY_NO_FOLDER: "lowering";
272
278
  readonly DATAFABRIC_RESULT_MODE_VERSION: "lowering";
273
279
  readonly DATAFABRIC_SYSTEM_COLUMN: "lint";
280
+ readonly DATAFABRIC_UNKNOWN_FIELD: "lint";
274
281
  readonly DEAD_END: "lint";
275
282
  readonly DECLARATION_SHAPE: "lowering";
276
283
  readonly DECLARATION_TYPE_NOT_FLOW: "lowering";
@@ -360,6 +367,7 @@ export declare const REFUSALS: {
360
367
  readonly FLOW_OUT_OF_END: "lint";
361
368
  readonly FLOW_PROCESS_EMPTY_DATA: "lint";
362
369
  readonly FLOW_SOURCE_NOT_FOUND: "lowering";
370
+ readonly FLOW_UNKNOWN_OPTION: "lowering";
363
371
  readonly FOLDER_BINDING_KEYED_BY_FOLDER: "lint";
364
372
  readonly FOLDER_BINDING_UNPAIRED: "lint";
365
373
  readonly FORM_TRIGGER_NO_INPUTS: "lint";
@@ -447,6 +455,7 @@ export declare const REFUSALS: {
447
455
  readonly HTTP_BRANCH_UNKNOWN: "lint";
448
456
  readonly HTTP_MANAGED_BINDING_INCOMPLETE: "lowering";
449
457
  readonly HTTP_MANAGED_REQUIRED: "lowering";
458
+ readonly HTTP_LITERAL_SECRET_HEADER: "lint";
450
459
  readonly HTTP_MANUAL_V1: "lint";
451
460
  readonly HTTP_ONERROR_V1: "lint";
452
461
  readonly HTTP_READ_NOT_OUTPUT: "lint";
@@ -670,6 +679,7 @@ export declare const REFUSALS: {
670
679
  readonly RULE_STAGE_AND_STAGES: "lowering";
671
680
  readonly RULE_TASKS_REQUIRED: "lint";
672
681
  readonly RULE_UNKNOWN_OPTION: "lowering";
682
+ readonly SCHEDULE_CRON_INVALID: "lint";
673
683
  readonly SCHEDULE_CRON_VERSION: "lowering";
674
684
  readonly SCHEDULE_INTERVAL_VERSION: "lowering";
675
685
  readonly SCHEDULE_NEVER_FIRES: "lint";
@@ -106,6 +106,7 @@ export const REFUSALS = {
106
106
  ARM_SCOPED_OUTPUT_READ: 'lint',
107
107
  ASSIGNMENT_NOT_ALLOWED: 'lint',
108
108
  BAD_DEFAULT: 'lint',
109
+ BINDING_CONNECTION_IS_FOLDER: 'draft',
109
110
  BINDING_CONNECTION_TWO_FOLDERS: 'lowering',
110
111
  BINDING_MISSING: 'draft',
111
112
  BINDING_PLACEHOLDER_UNRESOLVED: 'draft',
@@ -329,10 +330,13 @@ export const REFUSALS = {
329
330
  CONV_AGENT_SETTINGS_MODE: 'lint',
330
331
  CUSTOM_FIELDS_UNPREPARED: 'lint',
331
332
  DANGLING_FLOW: 'lowering',
333
+ DATAFABRIC_CHOICE_VALUE: 'lint',
334
+ DATAFABRIC_CHOICE_WRITE_VALUE: 'lint',
332
335
  DATAFABRIC_DELETE_HAS_NO_OUTPUT: 'lint',
333
336
  DATAFABRIC_EMPTY_SET: 'lint',
334
337
  DATAFABRIC_EMPTY_VALUES: 'lint',
335
338
  DATAFABRIC_ENTITY_REF_INVALID: 'lowering',
339
+ DATAFABRIC_FIELD_TYPE: 'lint',
336
340
  DATAFABRIC_FILTER_BLANK_VALUE: 'lint',
337
341
  DATAFABRIC_FOLDER_NO_RESOURCE_KEY: 'lint',
338
342
  DATAFABRIC_FROMREAD_MULTIPLE: 'lint',
@@ -340,11 +344,14 @@ export const REFUSALS = {
340
344
  DATAFABRIC_IN_REQUIRES_MULTIPLE: 'lint',
341
345
  DATAFABRIC_LIMIT_RANGE: 'lint',
342
346
  DATAFABRIC_NO_ENTITY: 'lint',
347
+ DATAFABRIC_NULL_REQUIRED: 'lint',
343
348
  DATAFABRIC_QUERY_OPTS_WITHOUT_MULTIPLE: 'lint',
344
349
  DATAFABRIC_RECORD_REF: 'lowering',
350
+ DATAFABRIC_REQUIRED_MISSING: 'lint',
345
351
  DATAFABRIC_RESOURCE_KEY_NO_FOLDER: 'lowering',
346
352
  DATAFABRIC_RESULT_MODE_VERSION: 'lowering',
347
353
  DATAFABRIC_SYSTEM_COLUMN: 'lint',
354
+ DATAFABRIC_UNKNOWN_FIELD: 'lint',
348
355
  DEAD_END: 'lint',
349
356
  DECLARATION_SHAPE: 'lowering',
350
357
  DECLARATION_TYPE_NOT_FLOW: 'lowering',
@@ -434,6 +441,9 @@ export const REFUSALS = {
434
441
  FLOW_OUT_OF_END: 'lint',
435
442
  FLOW_PROCESS_EMPTY_DATA: 'lint',
436
443
  FLOW_SOURCE_NOT_FOUND: 'lowering',
444
+ // A builder option key the SDK does not know (builder-sdk#1990): the
445
+ // serializer would drop it, so it is refused (core/option-keys.ts).
446
+ FLOW_UNKNOWN_OPTION: 'lowering',
437
447
  FOLDER_BINDING_KEYED_BY_FOLDER: 'lint',
438
448
  FOLDER_BINDING_UNPAIRED: 'lint',
439
449
  FORM_TRIGGER_NO_INPUTS: 'lint',
@@ -521,6 +531,7 @@ export const REFUSALS = {
521
531
  HTTP_BRANCH_UNKNOWN: 'lint',
522
532
  HTTP_MANAGED_BINDING_INCOMPLETE: 'lowering',
523
533
  HTTP_MANAGED_REQUIRED: 'lowering',
534
+ HTTP_LITERAL_SECRET_HEADER: 'lint',
524
535
  HTTP_MANUAL_V1: 'lint',
525
536
  HTTP_ONERROR_V1: 'lint',
526
537
  HTTP_READ_NOT_OUTPUT: 'lint',
@@ -744,6 +755,7 @@ export const REFUSALS = {
744
755
  RULE_STAGE_AND_STAGES: 'lowering',
745
756
  RULE_TASKS_REQUIRED: 'lint',
746
757
  RULE_UNKNOWN_OPTION: 'lowering',
758
+ SCHEDULE_CRON_INVALID: 'lint',
747
759
  SCHEDULE_CRON_VERSION: 'lowering',
748
760
  SCHEDULE_INTERVAL_VERSION: 'lowering',
749
761
  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>>;
@@ -10,7 +10,7 @@
10
10
  * each context below is the whole of what a node type can see.
11
11
  */
12
12
  import type { ResourceResolutions } from './core/resource-resolution.js';
13
- import type { ArtifactContexts, FactoryCall, NodeType } from './core/nodes/node-type.js';
13
+ import type { ArtifactContexts, FactoryCall, NodeType, OptionKeyLists } from './core/nodes/node-type.js';
14
14
  import type { VersionedNodeType } from './core/nodes/versioned.js';
15
15
  import type { DiagnosticCatalog, NodeFamily, Placement } from './core/nodes/family.js';
16
16
  import type { DefinitionReference, NodeContribution } from './core/node-classes.js';
@@ -187,6 +187,23 @@ export interface FlowSerializeContext {
187
187
  key: string;
188
188
  action?: string;
189
189
  }): string | undefined;
190
+ /**
191
+ * Both halves of a node's `{ connection, folder }` pair, each resolved as
192
+ * {@link resolveBinding} does, and then the pair itself judged: one label for
193
+ * both, or two labels that resolve to one real key, throws
194
+ * `BINDING_CONNECTION_IS_FOLDER` (#1968). Resolve a pair through here rather
195
+ * than two `resolveBinding` calls, so no site can skip that rule.
196
+ */
197
+ resolveBindingPair(labels: {
198
+ connection?: string;
199
+ folder?: string;
200
+ }, where: string, target?: {
201
+ key: string;
202
+ action?: string;
203
+ }): {
204
+ connectionId: string | undefined;
205
+ folderKey: string | undefined;
206
+ };
190
207
  /**
191
208
  * Hoist the Integration Service connection pair a definition's `model`
192
209
  * references (`<bindings.NAME>` for its connection id and folder key), deduped
@@ -709,6 +726,17 @@ export interface FlowTriggerSerializeContext {
709
726
  key: string;
710
727
  action?: string;
711
728
  }): string | undefined;
729
+ /** A node's connection and folder labels resolved as a pair, as `FlowSerializeContext.resolveBindingPair`. */
730
+ resolveBindingPair(labels: {
731
+ connection?: string;
732
+ folder?: string;
733
+ }, where: string, target?: {
734
+ key: string;
735
+ action?: string;
736
+ }): {
737
+ connectionId: string | undefined;
738
+ folderKey: string | undefined;
739
+ };
712
740
  /** Hoist the connection pair a definition's `model` references, as `FlowSerializeContext.bindConnection`. */
713
741
  bindConnection(o: {
714
742
  model: unknown;
@@ -776,6 +804,8 @@ export interface FlowTriggerType<Spec> {
776
804
  /** The factory call an author writes; `.trigger()`'s `{ version, label }` are the pipeline's. */
777
805
  print(spec: Spec, ctx: FlowPrintContext): FactoryCall;
778
806
  check?(spec: Spec, ctx: FlowTriggerCheckContext): void;
807
+ /** As a step's `optionKeys` (core/nodes/node-type.ts): for instance `scheduled()`'s `inputs`, `conversationTrigger()`'s `appearance`. */
808
+ readonly optionKeys?: OptionKeyLists<Spec>;
779
809
  }
780
810
  /** A family's start triggers, registered apart from its steps (FLOW_TRIGGER_TYPES). */
781
811
  export interface FlowTriggerFamily {
@@ -0,0 +1,22 @@
1
+ import type { Step } from './flow-sdk.js';
2
+ /** Every `Step` kind that carries an `options` object. */
3
+ type KindWithOptions = {
4
+ [K in Step['kind']]: 'options' extends keyof Extract<Step, {
5
+ kind: K;
6
+ }> ? K : never;
7
+ }[Step['kind']];
8
+ /** One builder method's options: how a message names it, and its keys. */
9
+ export interface StepOptionKeys {
10
+ /** The method as the author calls it, e.g. `.loop()`. */
11
+ readonly call: string;
12
+ readonly keys: readonly string[];
13
+ }
14
+ /** The option keys of each builder method, by the kind of step it makes. */
15
+ export declare const STEP_OPTION_KEYS: {
16
+ readonly [K in KindWithOptions]: StepOptionKeys;
17
+ };
18
+ /** The option keys of `.trigger(spec, options)`. */
19
+ export declare const TRIGGER_OPTION_KEYS: readonly string[];
20
+ /** The option keys of `.entryPoint(id, trigger, options)`. */
21
+ export declare const ENTRY_POINT_OPTION_KEYS: readonly string[];
22
+ export {};
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The option keys of the Flow builder's own methods: `.step()`, `.branch()`,
3
+ * `.loop()`, `.parallel()`, … and `.trigger()` (builder-sdk#1990). A node type's
4
+ * spec objects (`http()`'s inputs) declare theirs on the type (`optionKeys`,
5
+ * flow-node-type.ts); these are the structural steps', which no family owns.
6
+ *
7
+ * Each list is a `declareKeys<T>()` of the method's options type, so `tsc` holds
8
+ * the list to the type: a new `LoopOptions` field that is not listed here fails
9
+ * `npm run build`. The table is keyed by every `Step` kind that has `options`,
10
+ * so a new step kind with options needs a row too.
11
+ */
12
+ import { declareKeys } from './core/option-keys.js';
13
+ /** The option keys of each builder method, by the kind of step it makes. */
14
+ export const STEP_OPTION_KEYS = {
15
+ action: { call: '.step()', keys: declareKeys({ version: true, updates: true, label: true, draft: true }) },
16
+ branch: { call: '.branch()', keys: declareKeys({ version: true, updates: true, label: true, draft: true }) },
17
+ switch: { call: '.switch()', keys: declareKeys({ version: true, updates: true, label: true }) },
18
+ stepSwitch: { call: '.stepSwitch()', keys: declareKeys({ version: true, updates: true, label: true }) },
19
+ loop: {
20
+ call: '.loop()',
21
+ keys: declareKeys({ version: true, updates: true, label: true, parallel: true, completionCondition: true, breakEnabled: true }),
22
+ },
23
+ doWhile: { call: '.doWhile()', keys: declareKeys({ version: true, updates: true, label: true, limit: true, breakEnabled: true }) },
24
+ parallel: { call: '.parallel()', keys: declareKeys({ version: true, updates: true, label: true, fork: true }) },
25
+ terminate: { call: '.terminate()', keys: declareKeys({ version: true, updates: true, label: true }) },
26
+ return: { call: '.return()', keys: declareKeys({ version: true, updates: true, label: true, name: true }) },
27
+ };
28
+ /** The option keys of `.trigger(spec, options)`. */
29
+ export const TRIGGER_OPTION_KEYS = declareKeys({ version: true, updates: true, label: true });
30
+ /** The option keys of `.entryPoint(id, trigger, options)`. */
31
+ export const ENTRY_POINT_OPTION_KEYS = declareKeys({
32
+ version: true, updates: true, label: true, inputs: true,
33
+ });