@uipath/maestro-builder-sdk 6.120.11 → 6.120.12
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 +10 -9
- package/dist/api-members.md +15 -15
- package/dist/case/decompile.d.ts +6 -0
- package/dist/case/decompile.js +97 -21
- package/dist/case/preserve.d.ts +17 -3
- package/dist/case/preserve.js +11 -3
- package/dist/case/serialize.js +112 -18
- package/dist/case/subscription.js +2 -0
- package/dist/core/actions.d.ts +22 -7
- package/dist/core/event-filters.d.ts +68 -6
- package/dist/core/event-filters.js +120 -12
- package/package.json +2 -2
package/dist/api-index.md
CHANGED
|
@@ -146,7 +146,7 @@ could hand you spans for a version you do not have.
|
|
|
146
146
|
| `ErrorEnvelopeField` | type | `dist/core/expr.d.ts:142-152` | Supporting types | The fields a failure envelope carries. |
|
|
147
147
|
| `EscalationRef` | interface | `dist/core/actions.d.ts:828-894` | Supporting types | One escalation an inline agent may raise — an Action Center app task a human completes (the `coded-action-app` variant,… |
|
|
148
148
|
| `EventFilter` | type | `dist/core/actions.d.ts:1056-1107` | Supporting types | One filter condition on the event payload. |
|
|
149
|
-
| `EventSubscription` | interface | `dist/core/actions.d.ts:
|
|
149
|
+
| `EventSubscription` | interface | `dist/core/actions.d.ts:1196-1237` | Option shapes | What a connector event subscribes to. |
|
|
150
150
|
| `Expr` | class | `dist/core/expr.d.ts:11-21` | Supporting types | A Flow expression. |
|
|
151
151
|
| `FieldMapping` | interface | `dist/nodes/transform/flow/spec.d.ts:27-34` | Supporting types | 3 field(s) |
|
|
152
152
|
| `FilterCondition` | type | `dist/nodes/transform/flow/spec.d.ts:10-11` | Supporting types | Comparison a filter rule applies to a field. |
|
|
@@ -295,7 +295,7 @@ could hand you spans for a version you do not have.
|
|
|
295
295
|
| `triggerDescriptor` | function | `dist/core/connectors.d.ts:152-164` | Generated descriptors | Brand a trigger descriptor literal with its where/output types. |
|
|
296
296
|
| `TriggerDescriptor` | type | `dist/core/connectors.d.ts:143-151` | Generated descriptors | A generated, typed connector-trigger descriptor: TriggerMeta branded with phantom `where`/output types. |
|
|
297
297
|
| `TriggerMeta` | interface | `dist/core/connectors.d.ts:133-142` | Generated descriptors | Runtime metadata a generated trigger descriptor carries. |
|
|
298
|
-
| `TriggerOptions` | interface | `dist/core/actions.d.ts:
|
|
298
|
+
| `TriggerOptions` | interface | `dist/core/actions.d.ts:1148-1195` | Option shapes | The typed `onEvent`/`waitForEvent` options — everything an EventSubscription carries except `connector`/`event`, which… |
|
|
299
299
|
| `TriggerSpec` | type | `dist/nodes/trigger/flow/spec.d.ts:81-100` | Supporting types | What starts the flow. |
|
|
300
300
|
| `TypeDesc` | type | `dist/core/expr.d.ts:404` | Supporting types | |
|
|
301
301
|
| `types` | const | `dist/core/expr.d.ts:388-403` | Expressions and types | Variable type descriptors (map to Flow variable `type` values). |
|
|
@@ -308,14 +308,14 @@ could hand you spans for a version you do not have.
|
|
|
308
308
|
| `VoiceAgentInputs` | interface | `dist/nodes/agent/flow/spec.d.ts:145-183` | Option shapes | What `voiceAgent()` takes: the agent's instructions, the call it joins, how it sounds, and the resources it attaches… |
|
|
309
309
|
| `VoiceSettings` | interface | `dist/nodes/agent/flow/spec.d.ts:122-144` | Supporting types | The audio settings a voice agent speaks with. |
|
|
310
310
|
| `voiceTrigger` | function | `dist/nodes/trigger/flow/factories.d.ts:104-134` | Actions | Start the flow when a phone call comes IN (`core.trigger.voice`). |
|
|
311
|
-
| `waitForEvent` | function | `dist/core/actions.d.ts:
|
|
312
|
-
| `waitForEvent` | function | `dist/core/actions.d.ts:
|
|
311
|
+
| `waitForEvent` | function | `dist/core/actions.d.ts:1247-1282` | Actions | Wait mid-flow until a connector event fires, then continue with its payload — the typed form, where a generated trigger… |
|
|
312
|
+
| `waitForEvent` | function | `dist/core/actions.d.ts:1283-1290` | Actions | Stringly form, for an event with no prepared module. |
|
|
313
313
|
| `waitForMessage` | function | `dist/nodes/conversation/flow/factories.d.ts:27-43` | Actions | PAUSE until the person sends their next message (`uipath.conversational.wait-for-message`) — a catch event, like… |
|
|
314
314
|
| `WaitForMessageInputs` | interface | `dist/nodes/conversation/flow/spec.d.ts:28-36` | Option shapes | 2 field(s) |
|
|
315
315
|
|
|
316
316
|
## `@uipath/maestro-builder-sdk/case`
|
|
317
317
|
|
|
318
|
-
|
|
318
|
+
106 symbol(s). Import from `@uipath/maestro-builder-sdk/case`.
|
|
319
319
|
|
|
320
320
|
| Symbol | Kind | Declaration | Area | Summary |
|
|
321
321
|
| --- | --- | --- | --- | --- |
|
|
@@ -347,7 +347,7 @@ could hand you spans for a version you do not have.
|
|
|
347
347
|
| `CaseBuilder` | class | `dist/case/case-sdk.d.ts:1868-2157` | Builders | 18 member(s) |
|
|
348
348
|
| `CaseConnectorOpts` | interface | `dist/case/case-sdk.d.ts:524-547` | Option shapes | TaskBuilder.connector's options: the Flow `connector()` options, plus the fields a decompiled task carries. |
|
|
349
349
|
| `CaseDocumentExtractionSpec` | interface | `dist/case/case-sdk.d.ts:620-665` | Supporting types | A document-extraction task's IXP deployment and inputs (`.documentExtraction()`). |
|
|
350
|
-
| `CaseEventFilter` | type | `dist/core/actions.d.ts:1108-
|
|
350
|
+
| `CaseEventFilter` | type | `dist/core/actions.d.ts:1108-1147` | Supporting types | A Case event filter: an EventFilter, a text test or equality whose value is computed at runtime from a Case expression… |
|
|
351
351
|
| `CaseEventSubscription` | type | `dist/case/case-sdk.d.ts:492-499` | Option shapes | A Case wait's connector subscription: an EventSubscription whose `filters` may compare against a case expression… |
|
|
352
352
|
| `CaseHttpRequestSpec` | interface | `dist/case/case-sdk.d.ts:568-610` | Supporting types | An HTTP request task's request (`.httpRequest()`). |
|
|
353
353
|
| `CaseLayout` | interface | `dist/case/case-sdk.d.ts:1149-1160` | Supporting types | Optional Case designer layout, keyed by author-level stage and trigger names. |
|
|
@@ -373,8 +373,9 @@ could hand you spans for a version you do not have.
|
|
|
373
373
|
| `EscalationRecipient` | interface | `dist/case/case-sdk.d.ts:186-193` | Supporting types | Who an escalation notifies. |
|
|
374
374
|
| `EscalationTrigger` | type | `dist/case/case-sdk.d.ts:184-185` | Supporting types | When an escalation fires: as the deadline approaches (`at-risk`) or once it passes (`sla-breached`). |
|
|
375
375
|
| `EventFilter` | type | `dist/core/actions.d.ts:1056-1107` | Supporting types | One filter condition on the event payload. |
|
|
376
|
-
| `EventFilterExpression` | interface | `dist/core/event-filters.d.ts:
|
|
377
|
-
| `
|
|
376
|
+
| `EventFilterExpression` | interface | `dist/core/event-filters.d.ts:186-201` | Supporting types | A filter value computed at runtime: the field is compared against a Case expression, `=vars.<path>` or… |
|
|
377
|
+
| `EventFilterList` | type | `dist/core/event-filters.d.ts:175-183` | Supporting types | The values an `isOneOf` filter (Case only) matches: all numbers, or all strings. |
|
|
378
|
+
| `EventSubscription` | interface | `dist/core/actions.d.ts:1196-1237` | Option shapes | What a connector event subscribes to. |
|
|
378
379
|
| `eventTrigger` | function | `dist/case/case-sdk.d.ts:379-389` | Case authoring | An Integration Service **event** trigger — an external event (a new row, an email, a webhook) starts the case. |
|
|
379
380
|
| `eventTrigger` | function | `dist/case/case-sdk.d.ts:390-396` | Case authoring | An Integration Service event trigger in placeholder or stringly-resolved form. |
|
|
380
381
|
| `EventTriggerOpts` | interface | `dist/case/case-sdk.d.ts:326-366` | Option shapes | 5 field(s) |
|
|
@@ -417,7 +418,7 @@ could hand you spans for a version you do not have.
|
|
|
417
418
|
| `toUser` | function | `dist/case/case-sdk.d.ts:217-232` | Case authoring | An escalation recipient that is a single user. |
|
|
418
419
|
| `TriggerDescriptor` | type | `dist/core/connectors.d.ts:143-151` | Supporting types | A generated, typed connector-trigger descriptor: TriggerMeta branded with phantom `where`/output types. |
|
|
419
420
|
| `TriggerMeta` | interface | `dist/core/connectors.d.ts:133-142` | Supporting types | Runtime metadata a generated trigger descriptor carries. |
|
|
420
|
-
| `TriggerOptions` | interface | `dist/core/actions.d.ts:
|
|
421
|
+
| `TriggerOptions` | interface | `dist/core/actions.d.ts:1148-1195` | Option shapes | The typed `onEvent`/`waitForEvent` options — everything an EventSubscription carries except `connector`/`event`, which… |
|
|
421
422
|
| `TypeDesc` | type | `dist/core/expr.d.ts:404` | Supporting types | |
|
|
422
423
|
| `UnresolvedReferenceTaskKind` | type | `dist/case/case-sdk.d.ts:461-470` | Supporting types | Task kinds that the Case schema permits as unresolved skeletons: the published-resource kinds, `action` (a human task… |
|
|
423
424
|
| `WaitConnectorPlaceholderSpec` | interface | `dist/case/case-sdk.d.ts:471-486` | Supporting types | A `wait-for-connector` subscription: suspend on an Integration Service event. |
|
package/dist/api-members.md
CHANGED
|
@@ -172,18 +172,18 @@ not find it either.
|
|
|
172
172
|
| `connection` | property | `ConnectorOpts` | `dist/core/actions.d.ts:19-23` |
|
|
173
173
|
| `connection` | property | `ConnectorToolRef` | `dist/core/actions.d.ts:697-704` |
|
|
174
174
|
| `connection` | property | `DataServiceOpts` | `dist/bpmn/bpmn-sdk.d.ts:1269-1275` |
|
|
175
|
-
| `connection` | property | `EventSubscription` | `dist/core/actions.d.ts:
|
|
175
|
+
| `connection` | property | `EventSubscription` | `dist/core/actions.d.ts:1229-1233` |
|
|
176
176
|
| `connection` | property | `ExternalTaskOptions` | `dist/case/case-sdk.d.ts:715-716` |
|
|
177
177
|
| `connection` | property | `ExternalTaskOpts` | `dist/bpmn/bpmn-sdk.d.ts:1746-1747` |
|
|
178
178
|
| `connection` | property | `HttpOpts` | `dist/bpmn/bpmn-sdk.d.ts:1332-1360` |
|
|
179
179
|
| `connection` | property | `HttpRequestConnector` | `dist/case/case-sdk.d.ts:615-616` |
|
|
180
|
-
| `connection` | property | `TriggerOptions` | `dist/core/actions.d.ts:
|
|
180
|
+
| `connection` | property | `TriggerOptions` | `dist/core/actions.d.ts:1186-1190` |
|
|
181
181
|
| `connectionId` | property | `LookupResolution` | `dist/core/lookups.d.ts:174-181` |
|
|
182
182
|
| `connections` | property | `HitlRecipient` | `dist/nodes/hitl/flow/spec.d.ts:70-74` |
|
|
183
183
|
| `connector` | property | `BuiltTask` | `dist/case/case-sdk.d.ts:1001` |
|
|
184
184
|
| `connector` | property | `CaseHttpRequestSpec` | `dist/case/case-sdk.d.ts:605-609` |
|
|
185
185
|
| `connector` | property | `ConnectorToolRef` | `dist/core/actions.d.ts:682-683` |
|
|
186
|
-
| `connector` | property | `EventSubscription` | `dist/core/actions.d.ts:
|
|
186
|
+
| `connector` | property | `EventSubscription` | `dist/core/actions.d.ts:1198-1199` |
|
|
187
187
|
| `connector` | property | `ExternalTaskSpecData` | `dist/case/case-sdk.d.ts:743-744` |
|
|
188
188
|
| `connector` | property | `FlowActionSpecs` | `dist/core/actions.d.ts:948-972` |
|
|
189
189
|
| `connector` | property | `RuleOpts` | `dist/case/case-sdk.d.ts:65-71` |
|
|
@@ -378,7 +378,7 @@ not find it either.
|
|
|
378
378
|
| `escalation` | property | `RuleOpts` | `dist/case/case-sdk.d.ts:78-84` |
|
|
379
379
|
| `escalations` | property | `BuiltSla` | `dist/case/case-sdk.d.ts:278` |
|
|
380
380
|
| `escalations` | property | `SlaOpts` | `dist/case/case-sdk.d.ts:268-269` |
|
|
381
|
-
| `event` | property | `EventSubscription` | `dist/core/actions.d.ts:
|
|
381
|
+
| `event` | property | `EventSubscription` | `dist/core/actions.d.ts:1200-1201` |
|
|
382
382
|
| `event` | property | `ExternalTaskOptions` | `dist/case/case-sdk.d.ts:728-733` |
|
|
383
383
|
| `event` | property | `ExternalTaskSpecData` | `dist/case/case-sdk.d.ts:741-742` |
|
|
384
384
|
| `event` | property | `TriggerMeta` | `dist/core/connectors.d.ts:137-138` |
|
|
@@ -407,7 +407,7 @@ not find it either.
|
|
|
407
407
|
| `exponentialBase` | property | `TaskRetryPolicy` | `dist/case/case-sdk.d.ts:944-945` |
|
|
408
408
|
| `exposeError` | property | `HitlInputs` | `dist/nodes/hitl/flow/spec.d.ts:379-385` |
|
|
409
409
|
| `expression` | property | `BuiltSla` | `dist/case/case-sdk.d.ts:276-277` |
|
|
410
|
-
| `expression` | property | `EventFilterExpression` | `dist/core/event-filters.d.ts:
|
|
410
|
+
| `expression` | property | `EventFilterExpression` | `dist/core/event-filters.d.ts:199-200` |
|
|
411
411
|
| `expression` | property | `RuleOpts` | `dist/case/case-sdk.d.ts:93-94` |
|
|
412
412
|
| `expression` | property | `WhenExpression` | `dist/case/case-sdk.d.ts:168-169` |
|
|
413
413
|
| `external` | property | `BuiltTask` | `dist/case/case-sdk.d.ts:1002-1003` |
|
|
@@ -438,8 +438,8 @@ not find it either.
|
|
|
438
438
|
| `filter` | property | `ConnectorEventOpts` | `dist/bpmn/bpmn-sdk.d.ts:1682-1697` |
|
|
439
439
|
| `filters` | property | `ConnectorEventOpts` | `dist/bpmn/bpmn-sdk.d.ts:1698-1713` |
|
|
440
440
|
| `filters` | property | `DataFabricReadInputs` | `dist/nodes/data-fabric/flow/spec.d.ts:85-86` |
|
|
441
|
-
| `filters` | property | `EventSubscription` | `dist/core/actions.d.ts:
|
|
442
|
-
| `filters` | property | `TriggerOptions` | `dist/core/actions.d.ts:
|
|
441
|
+
| `filters` | property | `EventSubscription` | `dist/core/actions.d.ts:1227-1228` |
|
|
442
|
+
| `filters` | property | `TriggerOptions` | `dist/core/actions.d.ts:1184-1185` |
|
|
443
443
|
| `flavour` | property | `AgentInputs` | `dist/nodes/process/flow/spec.d.ts:536-550` |
|
|
444
444
|
| `flowIds` | method | `ScopeBuilder` | `dist/bpmn/bpmn-sdk.d.ts:3407-3450` |
|
|
445
445
|
| `flowMode` | method | `ScopeBuilder` | `dist/bpmn/bpmn-sdk.d.ts:2347-2386` |
|
|
@@ -454,7 +454,7 @@ not find it either.
|
|
|
454
454
|
| `folder` | property | `ConnectorToolRef` | `dist/core/actions.d.ts:705-710` |
|
|
455
455
|
| `folder` | property | `DataServiceOpts` | `dist/bpmn/bpmn-sdk.d.ts:1276-1288` |
|
|
456
456
|
| `folder` | property | `EntityRef` | `dist/core/resource-resolution.d.ts:27-28` |
|
|
457
|
-
| `folder` | property | `EventSubscription` | `dist/core/actions.d.ts:
|
|
457
|
+
| `folder` | property | `EventSubscription` | `dist/core/actions.d.ts:1234-1235` |
|
|
458
458
|
| `folder` | property | `ExternalTaskOptions` | `dist/case/case-sdk.d.ts:717-718` |
|
|
459
459
|
| `folder` | property | `ExternalTaskOpts` | `dist/bpmn/bpmn-sdk.d.ts:1748-1749` |
|
|
460
460
|
| `folder` | property | `HttpOpts` | `dist/bpmn/bpmn-sdk.d.ts:1361-1362` |
|
|
@@ -462,7 +462,7 @@ not find it either.
|
|
|
462
462
|
| `folder` | property | `OrchestratorOpts` | `dist/bpmn/bpmn-sdk.d.ts:1424-1425` |
|
|
463
463
|
| `folder` | property | `QueueItemOpts` | `dist/bpmn/bpmn-sdk.d.ts:1490-1491` |
|
|
464
464
|
| `folder` | property | `ResourceRef` | `dist/core/resource-resolution.d.ts:16-17` |
|
|
465
|
-
| `folder` | property | `TriggerOptions` | `dist/core/actions.d.ts:
|
|
465
|
+
| `folder` | property | `TriggerOptions` | `dist/core/actions.d.ts:1191-1192` |
|
|
466
466
|
| `folderKey` | property | `AgentMemoryRef` | `dist/core/actions.d.ts:603-604` |
|
|
467
467
|
| `folderKey` | property | `CaseDocumentExtractionSpec` | `dist/case/case-sdk.d.ts:639-644` |
|
|
468
468
|
| `folderKey` | property | `ContextIndexRef` | `dist/core/actions.d.ts:914-915` |
|
|
@@ -853,9 +853,9 @@ not find it either.
|
|
|
853
853
|
| `object` | property | `ConnectorEventOpts` | `dist/bpmn/bpmn-sdk.d.ts:1672-1681` |
|
|
854
854
|
| `object` | property | `ConnectorOpts` | `dist/core/actions.d.ts:26-58` |
|
|
855
855
|
| `object` | property | `ConnectorToolRef` | `dist/core/actions.d.ts:688-689` |
|
|
856
|
-
| `object` | property | `EventSubscription` | `dist/core/actions.d.ts:
|
|
856
|
+
| `object` | property | `EventSubscription` | `dist/core/actions.d.ts:1221-1226` |
|
|
857
857
|
| `object` | property | `EventTriggerOpts` | `dist/case/case-sdk.d.ts:336-349` |
|
|
858
|
-
| `object` | property | `TriggerOptions` | `dist/core/actions.d.ts:
|
|
858
|
+
| `object` | property | `TriggerOptions` | `dist/core/actions.d.ts:1173-1183` |
|
|
859
859
|
| `objectName` | property | `ConnectorMeta` | `dist/core/connectors.d.ts:79-88` |
|
|
860
860
|
| `objectName` | property | `LookupSpec` | `dist/core/lookups.d.ts:23-24` |
|
|
861
861
|
| `objectName` | property | `SelectNextStageSpec` | `dist/case/case-sdk.d.ts:405-406` |
|
|
@@ -1366,12 +1366,12 @@ not find it either.
|
|
|
1366
1366
|
| `version` | property | `ConnectorMeta` | `dist/core/connectors.d.ts:76` |
|
|
1367
1367
|
| `version` | property | `ConnectorOpts` | `dist/core/actions.d.ts:17-18` |
|
|
1368
1368
|
| `version` | property | `ConnectorToolRef` | `dist/core/actions.d.ts:686-687` |
|
|
1369
|
-
| `version` | property | `EventSubscription` | `dist/core/actions.d.ts:
|
|
1369
|
+
| `version` | property | `EventSubscription` | `dist/core/actions.d.ts:1236` |
|
|
1370
1370
|
| `version` | property | `ExternalTaskOpts` | `dist/bpmn/bpmn-sdk.d.ts:1750-1751` |
|
|
1371
1371
|
| `version` | method | `FlowBuilder` | `dist/flow-sdk.d.ts:1480-1493` |
|
|
1372
1372
|
| `version` | property | `NodeOptions` | `dist/flow-sdk.d.ts:256-263` |
|
|
1373
1373
|
| `version` | property | `TriggerMeta` | `dist/core/connectors.d.ts:139` |
|
|
1374
|
-
| `version` | property | `TriggerOptions` | `dist/core/actions.d.ts:
|
|
1374
|
+
| `version` | property | `TriggerOptions` | `dist/core/actions.d.ts:1193-1194` |
|
|
1375
1375
|
| `versions` | method | `NodeCatalog` | `dist/core/node-catalog.d.ts:15-16` |
|
|
1376
1376
|
| `versionTag` | property | `IxpExtractInputs` | `dist/nodes/document/flow/spec.d.ts:207-208` |
|
|
1377
1377
|
| `versionTag` | property | `IxpToolRef` | `dist/core/actions.d.ts:816-817` |
|
|
@@ -1393,8 +1393,8 @@ not find it either.
|
|
|
1393
1393
|
| `when` | property | `FormFieldCondition` | `dist/core/actions.d.ts:136-137` |
|
|
1394
1394
|
| `when` | property | `SlaOpts` | `dist/case/case-sdk.d.ts:261-267` |
|
|
1395
1395
|
| `when` | property | `SwitchArm` | `dist/flow-sdk.d.ts:221-226` |
|
|
1396
|
-
| `where` | property | `EventSubscription` | `dist/core/actions.d.ts:
|
|
1397
|
-
| `where` | property | `TriggerOptions` | `dist/core/actions.d.ts:
|
|
1396
|
+
| `where` | property | `EventSubscription` | `dist/core/actions.d.ts:1202-1220` |
|
|
1397
|
+
| `where` | property | `TriggerOptions` | `dist/core/actions.d.ts:1155-1172` |
|
|
1398
1398
|
| `width` | property | `CaseNodeLayout` | `dist/case/case-sdk.d.ts:1142-1143` |
|
|
1399
1399
|
| `width` | property | `StickyNote` | `dist/flow-sdk.d.ts:708-709` |
|
|
1400
1400
|
| `x` | property | `StickyNote` | `dist/flow-sdk.d.ts:704-705` |
|
package/dist/case/decompile.d.ts
CHANGED
|
@@ -254,6 +254,12 @@ type Preservation = {
|
|
|
254
254
|
name: string;
|
|
255
255
|
trigger: string;
|
|
256
256
|
}>;
|
|
257
|
+
triggerlessInArgs?: Array<{
|
|
258
|
+
name: string;
|
|
259
|
+
elementId: string;
|
|
260
|
+
trigger: string;
|
|
261
|
+
companion?: string;
|
|
262
|
+
}>;
|
|
257
263
|
omitMetadata?: Array<'caseAppEnabled' | 'caseIdentifierType' | 'publishVersion' | 'intsvcActivityConfig'>;
|
|
258
264
|
publishVersion?: number;
|
|
259
265
|
nodeFields?: Record<string, Record<string, unknown>>;
|
package/dist/case/decompile.js
CHANGED
|
@@ -19,7 +19,7 @@ import { CASE_FORMAT_PROFILE, CASE_SCHEMA_VERSIONS } from './format-profile.js';
|
|
|
19
19
|
import { EXTERNAL_TASK_CONTEXT, EXTERNAL_TASK_EVENT_CONTEXT, externalDescriptorRefusal, externalEventRefusal, externalServiceType, isExternalExecutionMode, libraryExecution } from './external.js';
|
|
20
20
|
import { compareSchemaVersions, preserveSchemaVersion } from '../schema-version.js';
|
|
21
21
|
import { ownEntry } from '../core/own-entry.js';
|
|
22
|
-
import {
|
|
22
|
+
import { eventFilterExpressionOf, eventFilterFromTreeLeaf, eventFilterJmes, eventFilterOperator, eventFilterProblem, EXPRESSION_FILTER_OPERATORS, filterExprFromLeaf } from '../core/event-filters.js';
|
|
23
23
|
import { CASE_FILTER_SPELLING, caseSubscriptionBody, caseSubscriptionOwners } from './subscription.js';
|
|
24
24
|
import { CASE_NODE_CANVAS_FIELDS, CASE_NODE_LAYOUT_FIELDS, isTypedInputField, isUnrestorableSlotId, planElementIds, PRESERVED_STAGE_DATA_KEYS, PRESERVED_TRIGGER_DATA_KEYS, RESOURCE_INPUT_WRITTEN, RESOURCE_OUTPUT_WRITTEN, CASE_EMPTY_LISTS, STAGE_EMPTY_LISTS, TASK_EMPTY_LISTS, taskFingerprint, PRESERVED_ACTION_DATA_KEYS, TYPED_TRIGGER_DISPLAY_KEYS, } from './preserve.js';
|
|
25
25
|
import { stableId } from '../core/stable-id.js';
|
|
@@ -346,10 +346,13 @@ function checkSubscriptionSlots(body, rc, owner) {
|
|
|
346
346
|
/**
|
|
347
347
|
* The designer's filter tree as authored `filters` leaves, with each leaf's
|
|
348
348
|
* structural read (for the match expression). Every operator the serializer
|
|
349
|
-
* writes (`EVENT_FILTER_OPERATORS
|
|
350
|
-
* `IsEmpty`,
|
|
349
|
+
* writes (`EVENT_FILTER_OPERATORS`, and Case's `CASE_EVENT_FILTER_OPERATORS`:
|
|
350
|
+
* `IsOneOf`, `IsEmpty`, `IsNotEmpty`) reads back; any other operator (`In`,
|
|
351
|
+
* `IsNotOneOf`, a date alias such as `DateTimeEquals`) is refused. `expression`
|
|
352
|
+
* is the plan's match expression, which says whether an `IsOneOf` compared
|
|
353
|
+
* numbers.
|
|
351
354
|
*/
|
|
352
|
-
function subscriptionFilters(config, owner) {
|
|
355
|
+
function subscriptionFilters(config, owner, expression) {
|
|
353
356
|
const tree = config?.filter;
|
|
354
357
|
if (tree === null || tree === undefined)
|
|
355
358
|
return { reads: [] };
|
|
@@ -359,9 +362,9 @@ function subscriptionFilters(config, owner) {
|
|
|
359
362
|
const reads = tree.filters.map((entry) => {
|
|
360
363
|
// A value computed at runtime: the field compared against a case expression.
|
|
361
364
|
if (entry?.value?.isLiteral === false) {
|
|
362
|
-
const read = eventFilterFromTreeLeaf(entry ?? {});
|
|
365
|
+
const read = eventFilterFromTreeLeaf(entry ?? {}, 'case');
|
|
363
366
|
const computed = filterExprFromLeaf(entry.value);
|
|
364
|
-
if (!read ||
|
|
367
|
+
if (!read || eventFilterOperator(read.operator)?.designer !== entry.operator
|
|
365
368
|
|| !EXPRESSION_FILTER_OPERATORS.has(read.operator))
|
|
366
369
|
throw new Error(`${owner} has an expression-valued subscription filter under an operator the SDK does not author.`);
|
|
367
370
|
if (!computed)
|
|
@@ -369,15 +372,30 @@ function subscriptionFilters(config, owner) {
|
|
|
369
372
|
forms.add(computed.form);
|
|
370
373
|
return { field: read.field, operator: read.operator, value: '', expression: computed.expression };
|
|
371
374
|
}
|
|
372
|
-
const read = eventFilterFromTreeLeaf(entry ?? {});
|
|
375
|
+
const read = eventFilterFromTreeLeaf(entry ?? {}, 'case');
|
|
373
376
|
const raw = entry?.value?.value;
|
|
377
|
+
const kind = read !== undefined ? eventFilterOperator(read.operator)?.kind : undefined;
|
|
374
378
|
// Only an operator compile writes back under the same designer name: a
|
|
375
379
|
// date alias (`DateTimeEquals`) would come back as `Equals`.
|
|
376
|
-
// A boolean test (`Is`
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
+
// A boolean or presence test (`Is`, `IsNot`, `IsEmpty`, `IsNotEmpty`)
|
|
381
|
+
// carries no value; an `IsOneOf` list carries text values with their JSON
|
|
382
|
+
// as `rawString`, as compile writes it; every other leaf carries a literal.
|
|
383
|
+
const valueless = kind === 'boolean' || kind === 'presence';
|
|
384
|
+
const written = valueless ? entry.value === null
|
|
385
|
+
: kind === 'list' ? entry.value?.isLiteral === true && entry.value?.rawString === JSON.stringify(raw)
|
|
386
|
+
&& Object.keys(entry.value).length === 3
|
|
387
|
+
: ['string', 'number', 'boolean'].includes(typeof raw);
|
|
388
|
+
if (!read || eventFilterOperator(read.operator)?.designer !== entry.operator || !written)
|
|
380
389
|
throw new Error(`${owner} has an unsupported subscription filter operator.`);
|
|
390
|
+
// The tree stores an `IsOneOf` list as text either way; the match expression
|
|
391
|
+
// says whether the designer compared the values as numbers (`[5]`, a choice
|
|
392
|
+
// set) or as text (`["5"]`). The whole expression is checked after this.
|
|
393
|
+
if (kind === 'list' && expression !== undefined) {
|
|
394
|
+
const numbers = read.value.map(Number);
|
|
395
|
+
const numeric = numbers.every((n, i) => Number.isFinite(n) && String(n) === read.value[i]);
|
|
396
|
+
if (numeric && expression.includes(eventFilterJmes({ ...read, value: numbers })))
|
|
397
|
+
read.value = numbers;
|
|
398
|
+
}
|
|
381
399
|
// A leaf compile would refuse (a plain string under an ordering operator, an
|
|
382
400
|
// ambiguous backslash) is refused here, not one step later on generated source.
|
|
383
401
|
const problem = eventFilterProblem(read);
|
|
@@ -451,7 +469,7 @@ function preservedSubscriptionFilters(plan) {
|
|
|
451
469
|
try {
|
|
452
470
|
body = subscriptionBody(bag, key);
|
|
453
471
|
const config = encodedSubscriptionConfig(contextMap(bag), key);
|
|
454
|
-
const read = subscriptionFilters(config, key);
|
|
472
|
+
const read = subscriptionFilters(config, key, body.expression);
|
|
455
473
|
spelling = subscriptionFilterSpelling(body, read.leafForm);
|
|
456
474
|
tree = config?.filter;
|
|
457
475
|
reads = read.reads;
|
|
@@ -535,7 +553,7 @@ function resolvedSubscriptionSource(bag, owner, kind, refs) {
|
|
|
535
553
|
});
|
|
536
554
|
const body = subscriptionBody(bag, owner);
|
|
537
555
|
const where = body.where;
|
|
538
|
-
const { leaves: filters, reads, leafForm } = subscriptionFilters(config, owner);
|
|
556
|
+
const { leaves: filters, reads, leafForm } = subscriptionFilters(config, owner, body.expression);
|
|
539
557
|
const rc = refs.library.resolveEvent(kind, identity.key, identity.event, identity.version, identity.object);
|
|
540
558
|
checkSubscriptionSlots(body, rc, owner);
|
|
541
559
|
if (body.expression !== undefined || leafForm !== undefined)
|
|
@@ -1459,6 +1477,12 @@ function outputTargetOf(row) {
|
|
|
1459
1477
|
* For example `{ displayName: 'echoIn', title: 'echoIn' }`.
|
|
1460
1478
|
* - `omit: ['target']`: an extract the Designer saved with no `target`
|
|
1461
1479
|
* (compile writes `target: "=<id>"` on every extract).
|
|
1480
|
+
* - `omit` on an input: the fields compile writes on every input (`id`,
|
|
1481
|
+
* `var`, `elementId`) that it was saved without. Studio Web saves some
|
|
1482
|
+
* inputs with no id (`{ name, value, elementId, type, displayName }`), and
|
|
1483
|
+
* compile used to mint one, a variable the plan never had. An output's
|
|
1484
|
+
* `elementId` is not carried this way: compile always writes it, since the
|
|
1485
|
+
* converter reads none of a task's outputs without it (#1419).
|
|
1462
1486
|
* - `target: 'var' | 'originalVar'`: an extract whose `target` names its
|
|
1463
1487
|
* variable or its original variable rather than its id (`outputTargetOf`).
|
|
1464
1488
|
*
|
|
@@ -1495,7 +1519,10 @@ function resourceRowShape(task, row, side) {
|
|
|
1495
1519
|
// variable, `=<var>`); any other target is behavior no builder call writes.
|
|
1496
1520
|
if (side === 'outputs' && row.target !== undefined && row.target !== `=${row.id}` && outputTargetOf(row) === undefined)
|
|
1497
1521
|
throw new Error(`${task.type} task "${task.displayName ?? task.id ?? '?'}" output "${row.name ?? '?'}" has unsupported target ${JSON.stringify(row.target)} (compile writes "=${row.id}").`);
|
|
1498
|
-
const
|
|
1522
|
+
const absent = side === 'outputs'
|
|
1523
|
+
? (row.target === undefined ? ['target'] : [])
|
|
1524
|
+
: ['id', 'var', 'elementId'].filter((key) => row[key] === undefined);
|
|
1525
|
+
const omit = absent.length ? { omit: absent } : {};
|
|
1499
1526
|
const targetOf = side === 'outputs' ? outputTargetOf(row) : undefined;
|
|
1500
1527
|
return { ...(Object.keys(fields).length ? { fields } : {}), ...omit, ...(targetOf ? { target: targetOf } : {}) };
|
|
1501
1528
|
}
|
|
@@ -1918,8 +1945,8 @@ function reassignedOwnNameTargets(plan) {
|
|
|
1918
1945
|
* root lanes back afterwards. The Case Designer keeps the two orders apart:
|
|
1919
1946
|
* an In-arg added to the trigger later can sit before older ones on the
|
|
1920
1947
|
* trigger and after them in `variables.inputs`. Declaring In-args in bridge
|
|
1921
|
-
* order keeps both.
|
|
1922
|
-
*
|
|
1948
|
+
* order keeps both. An In-arg no bridge row reads keeps its root position;
|
|
1949
|
+
* the bridged ones are ordered around it.
|
|
1923
1950
|
*
|
|
1924
1951
|
* Example: `variables.inputs` is `[a, b, c]` and the trigger's bridge rows read
|
|
1925
1952
|
* `[c, a, b]`; the source declares `.input({ c })`, `.input({ a })`, `.input({ b })`.
|
|
@@ -1939,11 +1966,17 @@ function inArgsInBridgeOrder(plan) {
|
|
|
1939
1966
|
if (slot !== undefined && !position.has(slot))
|
|
1940
1967
|
position.set(slot, index);
|
|
1941
1968
|
});
|
|
1942
|
-
|
|
1943
|
-
|
|
1969
|
+
// An In-arg no bridge row reads (`unbridgedInArgs`) keeps its slot: compile
|
|
1970
|
+
// drops its row again, so its place among the `.input()` calls orders no
|
|
1971
|
+
// row. The bridged ones are put in bridge order in the other slots. Before,
|
|
1972
|
+
// one unbridged In-arg kept the whole trigger in root order, and compile
|
|
1973
|
+
// wrote every bridge row of that trigger in root order.
|
|
1974
|
+
const bridged = slots.filter((index) => typeof inputs[index].id === 'string' && position.has(inputs[index].id));
|
|
1975
|
+
if (bridged.length < 2)
|
|
1944
1976
|
continue;
|
|
1945
|
-
const ordered =
|
|
1946
|
-
|
|
1977
|
+
const ordered = bridged.map((index) => inputs[index])
|
|
1978
|
+
.sort((a, b) => position.get(a.id) - position.get(b.id));
|
|
1979
|
+
bridged.forEach((slot, index) => { inputs[slot] = ordered[index]; });
|
|
1947
1980
|
}
|
|
1948
1981
|
return inputs;
|
|
1949
1982
|
}
|
|
@@ -1964,6 +1997,45 @@ function unbridgedInArgs(plan) {
|
|
|
1964
1997
|
return rows.some((row) => row?.source === `=vars.${input.id}`) ? [] : [{ name: input.name, trigger: node.id }];
|
|
1965
1998
|
});
|
|
1966
1999
|
}
|
|
2000
|
+
/**
|
|
2001
|
+
* In-args saved with an `elementId` that names no trigger of the plan (a task's
|
|
2002
|
+
* element id, or one no element has), each with that `elementId`, the trigger
|
|
2003
|
+
* the source's bare `.input()` binds it to, and the saved `elementId` of the
|
|
2004
|
+
* root row of its name, when the plan has one.
|
|
2005
|
+
*
|
|
2006
|
+
* No trigger fills such an In-arg: the plan has no bridge row for it and
|
|
2007
|
+
* usually no companion. Compile binds every In-arg to a trigger, adding both,
|
|
2008
|
+
* and a same-name root variable becomes its companion, which the trigger then
|
|
2009
|
+
* overwrites at start. Example: `{ id: "appVendor", name: "vendorNumber",
|
|
2010
|
+
* elementId: "Stage_x-t1" }` beside a root `{ name: "vendorNumber", default:
|
|
2011
|
+
* "16", elementId: "root" }`. An In-arg an own-name output already writes
|
|
2012
|
+
* through a controlled alias (`originalVar == id`) is left to compile.
|
|
2013
|
+
*/
|
|
2014
|
+
function triggerlessInArgs(plan) {
|
|
2015
|
+
const triggers = (plan.nodes ?? []).filter(isTrigger);
|
|
2016
|
+
if (!triggers.length)
|
|
2017
|
+
return [];
|
|
2018
|
+
const triggerIds = new Set(triggers.map((node) => node.id));
|
|
2019
|
+
const primary = implicitInArgTrigger(triggers.map(isTimerTrigger));
|
|
2020
|
+
const trigger = triggers[primary ?? 0]?.id;
|
|
2021
|
+
if (typeof trigger !== 'string')
|
|
2022
|
+
return [];
|
|
2023
|
+
const aliased = reassignedOwnNameTargets(plan);
|
|
2024
|
+
const inputs = plan.variables?.inputs ?? [];
|
|
2025
|
+
return inputs.flatMap((input) => {
|
|
2026
|
+
if (typeof input.elementId !== 'string' || triggerIds.has(input.elementId) || !input.name || typeof input.id !== 'string')
|
|
2027
|
+
return [];
|
|
2028
|
+
if (aliased.has(input.name) || inputs.filter((other) => other.name === input.name).length > 1)
|
|
2029
|
+
return [];
|
|
2030
|
+
const roots = (plan.variables?.inputOutputs ?? []).filter((row) => row.name === input.name);
|
|
2031
|
+
if (roots.length > 1)
|
|
2032
|
+
return [];
|
|
2033
|
+
const companion = roots[0]?.elementId;
|
|
2034
|
+
if (roots.length === 1 && typeof companion !== 'string')
|
|
2035
|
+
return [];
|
|
2036
|
+
return [{ name: input.name, elementId: input.elementId, trigger, ...(companion !== undefined ? { companion } : {}) }];
|
|
2037
|
+
});
|
|
2038
|
+
}
|
|
1967
2039
|
function emitVariables(out, depth, plan, triggerNameById, triggerIsTimer) {
|
|
1968
2040
|
const variables = plan.variables ?? {};
|
|
1969
2041
|
const produced = producedVariableNames(plan);
|
|
@@ -1974,7 +2046,8 @@ function emitVariables(out, depth, plan, triggerNameById, triggerIsTimer) {
|
|
|
1974
2046
|
// the primary trigger, which is what this source recompiles to. When the
|
|
1975
2047
|
// case has no primary trigger a bare `.input()` is refused
|
|
1976
2048
|
// (CASE_IN_ARG_UNBOUND), so the source names the first trigger and says so.
|
|
1977
|
-
|
|
2049
|
+
// So is one whose `elementId` names no trigger (`triggerlessInArgs`).
|
|
2050
|
+
if (!from && implicitInArgTrigger(triggerIsTimer) === undefined) {
|
|
1978
2051
|
from = triggerNameById.values().next().value;
|
|
1979
2052
|
out.line(depth, `// The source document left In-arg "${commentText(input.name)}" unbound and the case has no primary trigger; it is bound to the first trigger here (builder-sdk#1368).`);
|
|
1980
2053
|
}
|
|
@@ -3217,6 +3290,9 @@ export function collectPreservation(plan) {
|
|
|
3217
3290
|
const unbridged = unbridgedInArgs(plan);
|
|
3218
3291
|
if (unbridged.length)
|
|
3219
3292
|
preservation.unbridgedInArgs = unbridged;
|
|
3293
|
+
const triggerless = triggerlessInArgs(plan);
|
|
3294
|
+
if (triggerless.length)
|
|
3295
|
+
preservation.triggerlessInArgs = triggerless;
|
|
3220
3296
|
if (Object.keys(variableFields).length)
|
|
3221
3297
|
preservation.variableFields = variableFields;
|
|
3222
3298
|
if (Object.keys(legacyVariableDefaults).length)
|
package/dist/case/preserve.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type PreservedConnectorContext } from './connector-saved-context.js';
|
|
2
2
|
import { type PreservedConnectorRows } from './connector-saved-rows.js';
|
|
3
3
|
import type { BuiltCase } from './case-sdk.js';
|
|
4
|
-
import type { ReadEventFilter } from '../core/event-filters.js';
|
|
4
|
+
import type { EventFilterList, ReadEventFilter } from '../core/event-filters.js';
|
|
5
5
|
import { type CustomRowShape } from './custom-output-shape.js';
|
|
6
6
|
import { Bindings } from '../core/bindings.js';
|
|
7
7
|
import type { BindingsView } from '../core/binding-messages.js';
|
|
@@ -249,7 +249,7 @@ interface StageIdentity {
|
|
|
249
249
|
/** The resource the rows' `fields` / `omit` describe; they are applied only while the task still names it. */
|
|
250
250
|
resource?: ResourceTaskIdentity;
|
|
251
251
|
/** `elementId` only for an action form input whose row names another element than its task. `canonicalId: true`: an action form input saved with the schema migration's `canonicalId`, a copy of its id. `target`: the slot an action form input was saved with (`"bodyField"`), which compile does not write. `fields`: a resource task row's Designer fields compile does not write (`displayName`, `title`, `body`, ...). */
|
|
252
|
-
/** `omit` on an action form input: the fields compile writes that it was saved without (`type`; `var`, `elementId` on a row with an id). `taskElementId: true`: the row was saved with its task's `elementId`; compile writes back the task's final `elementId` (see `elementId` above). An action form input with no id, which compile writes with no `elementId`, carries it whenever its `elementId` is the task's. */
|
|
252
|
+
/** `omit` on an action form input: the fields compile writes that it was saved without (`type`; `var`, `elementId` on a row with an id). `taskElementId: true`: the row was saved with its task's `elementId`; compile writes back the task's final `elementId` (see `elementId` above). An action form input with no id, which compile writes with no `elementId`, carries it whenever its `elementId` is the task's. On a resource task input: the fields compile writes (`id`, `var`, `elementId`) it was saved without. */
|
|
253
253
|
inputs?: Array<{
|
|
254
254
|
name: string;
|
|
255
255
|
id?: string;
|
|
@@ -418,6 +418,20 @@ export interface CaseJsonPreservation {
|
|
|
418
418
|
name: string;
|
|
419
419
|
trigger: string;
|
|
420
420
|
}>;
|
|
421
|
+
/**
|
|
422
|
+
* In-args saved with an `elementId` that names no trigger (a task's element
|
|
423
|
+
* id, or one no element has), so no trigger fills them. Compile binds every
|
|
424
|
+
* In-arg to a trigger; while one is still bound to `trigger` (the one its
|
|
425
|
+
* bare `.input()` binds to), it gets its saved `elementId` back, loses the
|
|
426
|
+
* bridge row, and the root row of its name is keyed back to `companion`
|
|
427
|
+
* (its saved `elementId`), or removed when the plan had none.
|
|
428
|
+
*/
|
|
429
|
+
triggerlessInArgs?: Array<{
|
|
430
|
+
name: string;
|
|
431
|
+
elementId: string;
|
|
432
|
+
trigger: string;
|
|
433
|
+
companion?: string;
|
|
434
|
+
}>;
|
|
421
435
|
/**
|
|
422
436
|
* Opaque V30 layout side-car. Decompile folds a node's inline
|
|
423
437
|
* {@link CASE_NODE_LAYOUT_FIELDS} into it, the platform's disk form.
|
|
@@ -673,7 +687,7 @@ export interface CaseJsonPreservation {
|
|
|
673
687
|
export interface PreservedFilterLeafId {
|
|
674
688
|
field: string;
|
|
675
689
|
operator: string;
|
|
676
|
-
value: string | number | boolean | {
|
|
690
|
+
value: string | number | boolean | EventFilterList | {
|
|
677
691
|
expression: string;
|
|
678
692
|
};
|
|
679
693
|
uiId: string | null;
|
package/dist/case/preserve.js
CHANGED
|
@@ -355,6 +355,13 @@ export function caseJsonPreservationErrors(payload) {
|
|
|
355
355
|
&& (!Array.isArray(payload.unbridgedInArgs) || !payload.unbridgedInArgs.every((entry) => entry !== null && typeof entry === 'object'
|
|
356
356
|
&& typeof entry.name === 'string' && entry.name !== '' && typeof entry.trigger === 'string' && entry.trigger !== '')))
|
|
357
357
|
errors.push('preserved "unbridgedInArgs" must be an array of { name, trigger } with non-empty strings');
|
|
358
|
+
if (payload.triggerlessInArgs !== undefined
|
|
359
|
+
&& (!Array.isArray(payload.triggerlessInArgs) || !payload.triggerlessInArgs.every((entry) => entry !== null && typeof entry === 'object'
|
|
360
|
+
&& typeof entry.name === 'string' && entry.name !== '' && typeof entry.elementId === 'string' && entry.elementId !== ''
|
|
361
|
+
&& typeof entry.trigger === 'string' && entry.trigger !== '' && entry.elementId !== entry.trigger
|
|
362
|
+
&& (entry.companion === undefined || (typeof entry.companion === 'string' && entry.companion !== ''))
|
|
363
|
+
&& Object.keys(entry).every((key) => ['name', 'elementId', 'trigger', 'companion'].includes(key)))))
|
|
364
|
+
errors.push('preserved "triggerlessInArgs" must be an array of { name, elementId, trigger, companion? } with non-empty strings, elementId not the trigger');
|
|
358
365
|
if (payload.legacyTriggerIds !== undefined
|
|
359
366
|
&& (!Array.isArray(payload.legacyTriggerIds) || !payload.legacyTriggerIds.every((id) => typeof id === 'string')))
|
|
360
367
|
errors.push('preserved "legacyTriggerIds" must be an array of trigger id strings');
|
|
@@ -379,9 +386,10 @@ export function caseJsonPreservationErrors(payload) {
|
|
|
379
386
|
errors.push(`task "${task.name}" ${side} "${row.name}" field "${field}" is owned by the typed Case serializer`);
|
|
380
387
|
for (const field of row.omit ?? [])
|
|
381
388
|
// `target` (a resource extract or an action form output),
|
|
382
|
-
// `_jsonSchema` / `elementId` (an action form output, #1636),
|
|
383
|
-
// `type` / `var` / `elementId` (an action form input)
|
|
384
|
-
|
|
389
|
+
// `_jsonSchema` / `elementId` (an action form output, #1636),
|
|
390
|
+
// `type` / `var` / `elementId` (an action form input), and
|
|
391
|
+
// `id` / `var` / `elementId` (a resource input).
|
|
392
|
+
if (side === 'output' ? !(field === 'target' || field === '_jsonSchema' || field === 'elementId') : !(field === 'type' || field === 'id' || field === 'var' || field === 'elementId'))
|
|
385
393
|
errors.push(`task "${task.name}" ${side} "${row.name}" omits "${String(field)}", which is not an omittable field`);
|
|
386
394
|
}
|
|
387
395
|
}
|
package/dist/case/serialize.js
CHANGED
|
@@ -594,10 +594,21 @@ export function applyPreservation(result, preservation, options = {}) {
|
|
|
594
594
|
const variables = result.variables;
|
|
595
595
|
for (const [lane, order] of Object.entries(preservation.variableOrder ?? {})) {
|
|
596
596
|
const rows = variables[lane] ?? [];
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
597
|
+
// Each name holds its rows in compile order, and the n-th time `order` lists
|
|
598
|
+
// a name takes the n-th row: two variables can share a name (two In-args
|
|
599
|
+
// both named `PRODUCER`), and a one-row-per-name map put the last of them
|
|
600
|
+
// in both places, so the first was lost from the plan.
|
|
601
|
+
const byName = new Map();
|
|
602
|
+
for (const row of rows) {
|
|
603
|
+
const name = String(row.name ?? '');
|
|
604
|
+
byName.set(name, [...(byName.get(name) ?? []), row]);
|
|
605
|
+
}
|
|
606
|
+
const ordered = (order ?? []).flatMap((name) => {
|
|
607
|
+
const row = byName.get(name)?.shift();
|
|
608
|
+
return row ? [row] : [];
|
|
609
|
+
});
|
|
610
|
+
const placed = new Set(ordered);
|
|
611
|
+
variables[lane] = [...ordered, ...rows.filter((row) => !placed.has(row))];
|
|
601
612
|
}
|
|
602
613
|
let elementIds;
|
|
603
614
|
for (const [lane, byName] of Object.entries(preservation.variableFields ?? {})) {
|
|
@@ -690,6 +701,7 @@ export function applyPreservation(result, preservation, options = {}) {
|
|
|
690
701
|
if (!Object.keys(bag).length)
|
|
691
702
|
delete node.data[CASE_FORMAT_PROFILE.triggerBagField];
|
|
692
703
|
}
|
|
704
|
+
restoreTriggerlessInArgs(result, preservation.triggerlessInArgs);
|
|
693
705
|
for (const name of preservation.omitInputDefaults ?? []) {
|
|
694
706
|
const row = (variables.inputs ?? []).find((candidate) => candidate.name === name);
|
|
695
707
|
if (row?.default === '')
|
|
@@ -1286,6 +1298,8 @@ function restoreNoTasks(data, spelling) {
|
|
|
1286
1298
|
else
|
|
1287
1299
|
data.tasks = [];
|
|
1288
1300
|
}
|
|
1301
|
+
/** The fields compile writes on a resource task's input that the row can be saved without (decompile's `resourceRowShape`). */
|
|
1302
|
+
const RESOURCE_INPUT_OMITTABLE = new Set(['id', 'var', 'elementId']);
|
|
1289
1303
|
/**
|
|
1290
1304
|
* A task entry condition's saved `isInterrupting`, and the absence of a name
|
|
1291
1305
|
* it was saved with (`ConditionIdentity`), by position. The name goes only
|
|
@@ -1448,7 +1462,7 @@ function applyPreservedIdentities(result, preservation, warn) {
|
|
|
1448
1462
|
// it was saved without (`omit`), put back on the row of the same name after
|
|
1449
1463
|
// the id renames. Example: `{ name: 'echoIn', fields: { displayName: 'echoIn',
|
|
1450
1464
|
// title: 'echoIn' } }` gives the compiled `echoIn` row both back.
|
|
1451
|
-
const carryRowShape = (row, wanted) => {
|
|
1465
|
+
const carryRowShape = (row, wanted, input = false) => {
|
|
1452
1466
|
if (!row || row.name !== wanted.name || (!wanted.fields && !wanted.omit && !wanted.target && wanted.originalVar === undefined && wanted.noAlias !== true))
|
|
1453
1467
|
return;
|
|
1454
1468
|
// An own-name row the Designer saved without the controlled alias compile
|
|
@@ -1464,9 +1478,12 @@ function applyPreservedIdentities(result, preservation, warn) {
|
|
|
1464
1478
|
for (const [key, value] of Object.entries(wanted.fields ?? {}))
|
|
1465
1479
|
if (!Object.prototype.hasOwnProperty.call(row, key))
|
|
1466
1480
|
row[key] = structuredClone(value);
|
|
1481
|
+
// An extract saved with no `target`, and a resource input saved without
|
|
1482
|
+
// a field compile writes on every input (`resourceRowShape`), stay so.
|
|
1483
|
+
// An output's other `omit` entries are an action form row's (`takeOutputRows`).
|
|
1467
1484
|
for (const key of wanted.omit ?? [])
|
|
1468
|
-
if (key === 'target')
|
|
1469
|
-
delete row
|
|
1485
|
+
if (input ? RESOURCE_INPUT_OMITTABLE.has(key) : key === 'target')
|
|
1486
|
+
delete row[key];
|
|
1470
1487
|
});
|
|
1471
1488
|
// Two Designer spellings, applied once every row id is final:
|
|
1472
1489
|
// - An own-name row (`id == var`) saved with the variable it wrote before a
|
|
@@ -1807,7 +1824,7 @@ function applyPreservedIdentities(result, preservation, warn) {
|
|
|
1807
1824
|
return;
|
|
1808
1825
|
}
|
|
1809
1826
|
takeRow(input, row.id, false);
|
|
1810
|
-
carryRowShape(input, rowShape(row));
|
|
1827
|
+
carryRowShape(input, rowShape(row), true);
|
|
1811
1828
|
});
|
|
1812
1829
|
// A non-action task's row `fields` / `omit` are a resource's (only
|
|
1813
1830
|
// decompile's `resourceRowShape` writes them), so they need the same
|
|
@@ -1864,9 +1881,14 @@ function applyPreservedIdentities(result, preservation, warn) {
|
|
|
1864
1881
|
// `variableKeys`) get the Designer's name back, and so does each custom row
|
|
1865
1882
|
// that assigns one, which the Designer labels with the variable's name.
|
|
1866
1883
|
const renamedVariables = new Map();
|
|
1867
|
-
for (const [lane, rows] of Object.entries(identities.variables ?? {}))
|
|
1884
|
+
for (const [lane, rows] of Object.entries(identities.variables ?? {})) {
|
|
1885
|
+
// The n-th identity row of a name restores the n-th variable of that name:
|
|
1886
|
+
// two variables can share a name (see `emitVariables`' `companionId`).
|
|
1887
|
+
const claimed = new Set();
|
|
1868
1888
|
(rows ?? []).forEach((row) => {
|
|
1869
|
-
let variable = variables[lane]?.find((candidate) => candidate.name === row.name);
|
|
1889
|
+
let variable = variables[lane]?.find((candidate) => candidate.name === row.name && !claimed.has(candidate));
|
|
1890
|
+
if (variable)
|
|
1891
|
+
claimed.add(variable);
|
|
1870
1892
|
if (!variable && lane === 'inputOutputs' && typeof row.id === 'string') {
|
|
1871
1893
|
variable = variables[lane]?.find((candidate) => candidate.id === row.id && candidate.name === row.id);
|
|
1872
1894
|
if (variable) {
|
|
@@ -1881,6 +1903,7 @@ function applyPreservedIdentities(result, preservation, warn) {
|
|
|
1881
1903
|
return;
|
|
1882
1904
|
take(variable, row.id);
|
|
1883
1905
|
});
|
|
1906
|
+
}
|
|
1884
1907
|
if (renamedVariables.size)
|
|
1885
1908
|
for (const row of [...planOutputRows(result, stages), ...triggerOutputRows(nodes)])
|
|
1886
1909
|
if (row?.custom === true && row.name === row.var && renamedVariables.has(row.var))
|
|
@@ -2206,8 +2229,26 @@ function emitVariables(vars, ids, triggerNodeByRef, triggerNodes, triggers, coll
|
|
|
2206
2229
|
throw new CompileRefusal('CASE_VAR_DESCRIPTION_NOT_STRING', `Case variable "${vd.name}" has a non-string description.`);
|
|
2207
2230
|
return { description: vd.description };
|
|
2208
2231
|
};
|
|
2209
|
-
|
|
2210
|
-
|
|
2232
|
+
// A companion's id is the variable's name. Two variables can share a name (a
|
|
2233
|
+
// Designer case with two In-args both named `PRODUCER`, on ids `producer` and
|
|
2234
|
+
// `producer2`): each still takes its own companion id, else both compile to
|
|
2235
|
+
// `id: "PRODUCER"` and the payload's id restore (`take`, keyed by id) cannot
|
|
2236
|
+
// tell them apart, so the second one's references collapse onto the first.
|
|
2237
|
+
const companionIds = new Set(vars.map((vd) => vd.name));
|
|
2238
|
+
const namesSeen = new Set();
|
|
2239
|
+
const companionIdOf = (vd) => {
|
|
2240
|
+
if (!namesSeen.has(vd.name)) {
|
|
2241
|
+
namesSeen.add(vd.name);
|
|
2242
|
+
return vd.name;
|
|
2243
|
+
}
|
|
2244
|
+
let id = '';
|
|
2245
|
+
for (let n = 2; companionIds.has((id = `${vd.name}_${n}`)); n++)
|
|
2246
|
+
;
|
|
2247
|
+
companionIds.add(id);
|
|
2248
|
+
return id;
|
|
2249
|
+
};
|
|
2250
|
+
const readableCompanion = (vd, declares, id) => ({
|
|
2251
|
+
id,
|
|
2211
2252
|
name: vd.name,
|
|
2212
2253
|
type: vd.type,
|
|
2213
2254
|
...encodedDefault(vd),
|
|
@@ -2217,6 +2258,7 @@ function emitVariables(vars, ids, triggerNodeByRef, triggerNodes, triggers, coll
|
|
|
2217
2258
|
});
|
|
2218
2259
|
for (const vd of vars) {
|
|
2219
2260
|
const slotId = ids.make('v', 8, `var:${vd.name}`);
|
|
2261
|
+
const varId = companionIdOf(vd);
|
|
2220
2262
|
const entry = {
|
|
2221
2263
|
id: slotId,
|
|
2222
2264
|
name: vd.name,
|
|
@@ -2226,7 +2268,7 @@ function emitVariables(vars, ids, triggerNodeByRef, triggerNodes, triggers, coll
|
|
|
2226
2268
|
// converter's end event finds that companion by `output.var` alone
|
|
2227
2269
|
// (PO.Frontend `buildOutputArgEndEventData`); a slot without it is dropped
|
|
2228
2270
|
// from the end event, so the case finishes with the output never written.
|
|
2229
|
-
...(vd.direction === 'out' ? { var:
|
|
2271
|
+
...(vd.direction === 'out' ? { var: varId } : {}),
|
|
2230
2272
|
// A trigger-bound In-arg always carries a default, `""` when none was
|
|
2231
2273
|
// authored. It is written here, ahead of a structured var's schema, so
|
|
2232
2274
|
// `{ type }` and `{ type, default: "" }` emit the same bytes and a
|
|
@@ -2270,16 +2312,16 @@ function emitVariables(vars, ids, triggerNodeByRef, triggerNodes, triggers, coll
|
|
|
2270
2312
|
entry.required = vd.required;
|
|
2271
2313
|
}
|
|
2272
2314
|
inputs.push(entry);
|
|
2273
|
-
inputOutputs.push({ id:
|
|
2274
|
-
appendTriggerBridge(node, { name: vd.name, type: vd.type, source: `=vars.${slotId}`, var:
|
|
2315
|
+
inputOutputs.push({ id: varId, name: vd.name, type: vd.type, elementId: node.id, ...jsonSchemaFields(vd) });
|
|
2316
|
+
appendTriggerBridge(node, { name: vd.name, type: vd.type, source: `=vars.${slotId}`, var: varId });
|
|
2275
2317
|
}
|
|
2276
2318
|
else if (vd.direction === 'out') {
|
|
2277
2319
|
outputs.push(entry); // formal declaration
|
|
2278
|
-
inputOutputs.push(readableCompanion(vd, false)); // …made readable as `vars.<name>`
|
|
2320
|
+
inputOutputs.push(readableCompanion(vd, false, varId)); // …made readable as `vars.<name>`
|
|
2279
2321
|
}
|
|
2280
2322
|
else {
|
|
2281
2323
|
// inout: the root companion IS its declaration (nothing references the slot).
|
|
2282
|
-
inputOutputs.push(readableCompanion(vd, true));
|
|
2324
|
+
inputOutputs.push(readableCompanion(vd, true, varId));
|
|
2283
2325
|
}
|
|
2284
2326
|
}
|
|
2285
2327
|
const out = { inputOutputs };
|
|
@@ -3103,7 +3145,6 @@ function ruleOutputRows(conditions) {
|
|
|
3103
3145
|
const bag = CASE_FORMAT_PROFILE.waitConnectorRuleBagField;
|
|
3104
3146
|
return (conditions ?? []).flatMap((condition) => (condition?.rules ?? []).flat().flatMap((rule) => rule?.[bag]?.outputs ?? []));
|
|
3105
3147
|
}
|
|
3106
|
-
/** Every output row in the plan: stage and task rule rows, task rows, and case-exit rule rows. */
|
|
3107
3148
|
/** Every wait-for-connector rule's own output row in the plan: stage and task conditions, and the case exit rules. */
|
|
3108
3149
|
function planRuleOutputRows(result, stages) {
|
|
3109
3150
|
return [
|
|
@@ -3115,6 +3156,59 @@ function planRuleOutputRows(result, stages) {
|
|
|
3115
3156
|
...ruleOutputRows(result.metadata?.caseExitRules),
|
|
3116
3157
|
].filter((row) => row && typeof row === 'object');
|
|
3117
3158
|
}
|
|
3159
|
+
/**
|
|
3160
|
+
* Put back each In-arg saved bound to no trigger (`triggerlessInArgs` in
|
|
3161
|
+
* decompile.ts) while the source still binds it to the trigger its bare
|
|
3162
|
+
* `.input()` binds to: its saved `elementId`, no bridge row on that trigger,
|
|
3163
|
+
* and the root row of its name as it was saved: re-keyed to its saved
|
|
3164
|
+
* `elementId`, or, when the plan had none, gone. A controlled alias
|
|
3165
|
+
* (`originalVar == id`) that compile wrote on an own-name output only because
|
|
3166
|
+
* that companion existed goes with it.
|
|
3167
|
+
*
|
|
3168
|
+
* An edit that renames the In-arg or binds it to another trigger gets
|
|
3169
|
+
* compile's binding.
|
|
3170
|
+
*/
|
|
3171
|
+
function restoreTriggerlessInArgs(result, entries) {
|
|
3172
|
+
if (!entries?.length)
|
|
3173
|
+
return;
|
|
3174
|
+
const variables = result.variables;
|
|
3175
|
+
const nodes = result.nodes;
|
|
3176
|
+
const removed = new Set();
|
|
3177
|
+
for (const { name, elementId, trigger, companion } of entries) {
|
|
3178
|
+
const matching = (variables.inputs ?? []).filter((candidate) => candidate.name === name);
|
|
3179
|
+
const input = matching[0];
|
|
3180
|
+
if (matching.length !== 1 || !input || typeof input.id !== 'string' || input.elementId !== trigger)
|
|
3181
|
+
continue;
|
|
3182
|
+
const node = nodes.find((candidate) => candidate.id === trigger);
|
|
3183
|
+
if (!node)
|
|
3184
|
+
continue;
|
|
3185
|
+
const roots = (variables.inputOutputs ?? []).filter((row) => row.name === name);
|
|
3186
|
+
if (roots.length !== 1 || roots[0].elementId !== trigger)
|
|
3187
|
+
continue;
|
|
3188
|
+
input.elementId = elementId;
|
|
3189
|
+
const bag = node.data?.[CASE_FORMAT_PROFILE.triggerBagField];
|
|
3190
|
+
if (Array.isArray(bag?.outputs)) {
|
|
3191
|
+
bag.outputs = bag.outputs.filter((row) => row?.source !== `=vars.${input.id}`);
|
|
3192
|
+
if (!bag.outputs.length)
|
|
3193
|
+
delete bag.outputs;
|
|
3194
|
+
if (!Object.keys(bag).length)
|
|
3195
|
+
delete node.data[CASE_FORMAT_PROFILE.triggerBagField];
|
|
3196
|
+
}
|
|
3197
|
+
if (companion !== undefined)
|
|
3198
|
+
roots[0].elementId = companion;
|
|
3199
|
+
else {
|
|
3200
|
+
variables.inputOutputs = (variables.inputOutputs ?? []).filter((row) => row !== roots[0]);
|
|
3201
|
+
removed.add(name);
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
if (!removed.size)
|
|
3205
|
+
return;
|
|
3206
|
+
const stages = nodes.filter((node) => String(node.type ?? '').endsWith('Stage'));
|
|
3207
|
+
for (const row of planOutputRows(result, stages))
|
|
3208
|
+
if (typeof row?.id === 'string' && removed.has(row.id) && row.var === row.id && row.originalVar === row.id)
|
|
3209
|
+
delete row.originalVar;
|
|
3210
|
+
}
|
|
3211
|
+
/** Every output row in the plan: stage and task rule rows, task rows, and case-exit rule rows. */
|
|
3118
3212
|
function planOutputRows(result, stages) {
|
|
3119
3213
|
return [
|
|
3120
3214
|
...stages.flatMap((stage) => [
|
|
@@ -151,6 +151,8 @@ export function caseSubscriptionBody(rc, where, conditions, elementId, spelling
|
|
|
151
151
|
const literals = [
|
|
152
152
|
...Object.values(eventParameters).map(String),
|
|
153
153
|
...conditions.filter((c) => c.expression === undefined && typeof c.value === 'string').map((c) => String(c.value)),
|
|
154
|
+
// An `isOneOf` list's text values sit in the expression too.
|
|
155
|
+
...conditions.flatMap((c) => (Array.isArray(c.value) ? c.value.filter((v) => typeof v === 'string') : [])),
|
|
154
156
|
];
|
|
155
157
|
for (const literal of literals) {
|
|
156
158
|
const problem = literalProblem(literal, computed);
|
package/dist/core/actions.d.ts
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Expr } from './expr.js';
|
|
11
11
|
import type { LookupToken } from './lookups.js';
|
|
12
|
-
import type { EventFilterExpression } from './event-filters.js';
|
|
13
|
-
export type { EventFilterExpression } from './event-filters.js';
|
|
12
|
+
import type { EventFilterExpression, EventFilterList } from './event-filters.js';
|
|
13
|
+
export type { EventFilterExpression, EventFilterList } from './event-filters.js';
|
|
14
14
|
import { type ConnectorDescriptor, type TriggerDescriptor } from './connectors.js';
|
|
15
15
|
import type { CarriedConnectorOperation } from './carried-connector-operation.js';
|
|
16
16
|
export interface ConnectorOpts {
|
|
@@ -1106,20 +1106,35 @@ export type EventFilter = {
|
|
|
1106
1106
|
isNot: true;
|
|
1107
1107
|
});
|
|
1108
1108
|
/**
|
|
1109
|
-
* A Case event filter: an {@link EventFilter},
|
|
1109
|
+
* A Case event filter: an {@link EventFilter}, a text test or equality whose
|
|
1110
1110
|
* value is computed at runtime from a Case expression ({@link EventFilterExpression}):
|
|
1111
|
-
* `{ expression: '=vars.<path>' }` or `{ expression: '=js:<expression>' }
|
|
1111
|
+
* `{ expression: '=vars.<path>' }` or `{ expression: '=js:<expression>' }`,
|
|
1112
|
+
* or one of the Case designer's own tests:
|
|
1112
1113
|
*
|
|
1113
|
-
*
|
|
1114
|
-
*
|
|
1114
|
+
* - `isOneOf`: the field is one of the listed values ({@link EventFilterList}).
|
|
1115
|
+
* Numbers compare as numbers (`` contains(`[0,5]`, Status) ``, a choice
|
|
1116
|
+
* set's option values), strings as text. On an array field (`decision[*]`)
|
|
1117
|
+
* it matches an element (`` decision[?contains(`[1]`, @)] ``);
|
|
1118
|
+
* - `isEmpty: true` / `isNotEmpty: true`: the field has no value / has one
|
|
1119
|
+
* (`not_null(reviewDate, '')!=''`).
|
|
1120
|
+
*
|
|
1121
|
+
* The expression form is for a wait-for-connector task or rule only; an event
|
|
1122
|
+
* trigger refuses it, because its subscription registers before any case exists.
|
|
1115
1123
|
* Flow and BPMN filters are {@link EventFilter}.
|
|
1116
1124
|
*
|
|
1117
1125
|
* @remarks
|
|
1118
|
-
* `{ field: 'Id', equals: { expression: '=vars.request.Id' } }
|
|
1126
|
+
* `{ field: 'Id', equals: { expression: '=vars.request.Id' } }`,
|
|
1127
|
+
* `{ field: 'Status', isOneOf: [0, 5] }`, `{ field: 'reviewDate', isNotEmpty: true }`.
|
|
1119
1128
|
*/
|
|
1120
1129
|
export type CaseEventFilter = EventFilter | ({
|
|
1121
1130
|
field: string;
|
|
1122
1131
|
} & ({
|
|
1132
|
+
isOneOf: EventFilterList;
|
|
1133
|
+
} | {
|
|
1134
|
+
isEmpty: true;
|
|
1135
|
+
} | {
|
|
1136
|
+
isNotEmpty: true;
|
|
1137
|
+
} | {
|
|
1123
1138
|
contains: EventFilterExpression;
|
|
1124
1139
|
} | {
|
|
1125
1140
|
startsWith: EventFilterExpression;
|
|
@@ -111,7 +111,51 @@ export declare const EVENT_FILTER_OPERATORS: {
|
|
|
111
111
|
readonly jmes: "!=";
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
|
-
|
|
114
|
+
/**
|
|
115
|
+
* The Case designer's operators beyond {@link EVENT_FILTER_OPERATORS}, read and
|
|
116
|
+
* written in the `'case'` dialect only. Studio Web's Case canvas offers them on
|
|
117
|
+
* a Data Fabric entity event, and its filter compiler (`@uipath/maestro-sdk`
|
|
118
|
+
* `JmesHelper._buildJmesPathExpression`) lowers them as:
|
|
119
|
+
*
|
|
120
|
+
* | authored | designer operator | JMESPath |
|
|
121
|
+
* |--------------------------------|-------------------|--------------------------------------------|
|
|
122
|
+
* | `isOneOf: [5, 6]` (numbers) | `IsOneOf` | `` contains(`[5,6]`, f) `` |
|
|
123
|
+
* | `isOneOf: ['a', 'b']` (text) | `IsOneOf` | `` contains(`["a","b"]`, f) `` |
|
|
124
|
+
* | `isOneOf: [1]` on `f[*]` | `IsOneOf` | `` f[?contains(`[1]`, @)] `` |
|
|
125
|
+
* | `isEmpty: true` | `IsEmpty` | `not_null(f, '')==''` |
|
|
126
|
+
* | `isNotEmpty: true` | `IsNotEmpty` | `not_null(f, '')!=''` |
|
|
127
|
+
*
|
|
128
|
+
* The designer decides numbers or text from the field's type (a choice set's
|
|
129
|
+
* option values are numbers); offline the SDK has no field types, so the
|
|
130
|
+
* authored values decide, as they do for a date. The canvas tree stores the
|
|
131
|
+
* values as text either way (`value: ["5"]`). Flow and BPMN do not read these
|
|
132
|
+
* keys: their designers' saved shape is not measured.
|
|
133
|
+
*/
|
|
134
|
+
export declare const CASE_EVENT_FILTER_OPERATORS: {
|
|
135
|
+
readonly isOneOf: {
|
|
136
|
+
readonly designer: "IsOneOf";
|
|
137
|
+
readonly kind: "list";
|
|
138
|
+
readonly jmes: "contains";
|
|
139
|
+
};
|
|
140
|
+
readonly isEmpty: {
|
|
141
|
+
readonly designer: "IsEmpty";
|
|
142
|
+
readonly kind: "presence";
|
|
143
|
+
readonly jmes: "==";
|
|
144
|
+
};
|
|
145
|
+
readonly isNotEmpty: {
|
|
146
|
+
readonly designer: "IsNotEmpty";
|
|
147
|
+
readonly kind: "presence";
|
|
148
|
+
readonly jmes: "!=";
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
export type EventFilterOperatorKey = keyof typeof EVENT_FILTER_OPERATORS | keyof typeof CASE_EVENT_FILTER_OPERATORS;
|
|
152
|
+
type EventFilterOperatorSpec = {
|
|
153
|
+
designer: string;
|
|
154
|
+
kind: 'function' | 'comparison' | 'boolean' | 'list' | 'presence';
|
|
155
|
+
jmes: string;
|
|
156
|
+
};
|
|
157
|
+
/** The spec of an operator key, from either table; `undefined` for any other key. */
|
|
158
|
+
export declare function eventFilterOperator(key: string): EventFilterOperatorSpec | undefined;
|
|
115
159
|
/** One authored filter, read structurally: which operator, and its value. */
|
|
116
160
|
export interface ReadEventFilter {
|
|
117
161
|
field: string;
|
|
@@ -121,13 +165,24 @@ export interface ReadEventFilter {
|
|
|
121
165
|
* (`expression` set) it is the text the lowering splices in its place: `''`
|
|
122
166
|
* as read, a `{var_0}` or `${vars.x}` placeholder when Case lowers it.
|
|
123
167
|
*/
|
|
124
|
-
value: string | number | boolean;
|
|
168
|
+
value: string | number | boolean | EventFilterList;
|
|
125
169
|
/**
|
|
126
170
|
* The JavaScript the field is compared against, evaluated at runtime (Case
|
|
127
171
|
* only): `vars.response.Id` for an authored `{ expression: '=vars.response.Id' }`.
|
|
128
172
|
*/
|
|
129
173
|
expression?: string;
|
|
130
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* The values an `isOneOf` filter (Case only) matches: all numbers, or all
|
|
177
|
+
* strings. Numbers are compared as numbers (`` contains(`[5,6]`, f) ``), text as
|
|
178
|
+
* text (`` contains(`["a","b"]`, f) ``).
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* const filter = { field: 'Status', isOneOf: [0, 5] };
|
|
182
|
+
*/
|
|
183
|
+
export type EventFilterList = readonly number[] | readonly string[];
|
|
184
|
+
/** Whether a value is an {@link EventFilterList}: a non-empty array of all numbers or all strings. */
|
|
185
|
+
export declare function isEventFilterList(value: unknown): value is EventFilterList;
|
|
131
186
|
/**
|
|
132
187
|
* A filter value computed at runtime: the field is compared against a Case
|
|
133
188
|
* expression, `=vars.<path>` or `=js:<expression>`, the same spelling every
|
|
@@ -254,9 +309,12 @@ export declare function eventFilterJmes(read: ReadEventFilter): string;
|
|
|
254
309
|
* `{ "rawString": "=js:(vars.request.Id)", "isLiteral": false, "value": "=js:(vars.request.Id)" }`.
|
|
255
310
|
*/
|
|
256
311
|
export type EventFilterLeafForm = 'path' | 'js';
|
|
257
|
-
/**
|
|
312
|
+
/**
|
|
313
|
+
* A tree leaf's `value`: a literal, an expression (`isLiteral: false`), `null`
|
|
314
|
+
* for a boolean or presence test, or an `isOneOf` list (always text, `["5"]`).
|
|
315
|
+
*/
|
|
258
316
|
export type EventFilterTreeValue = {
|
|
259
|
-
value: string | number | boolean;
|
|
317
|
+
value: string | number | boolean | readonly string[];
|
|
260
318
|
rawString: string;
|
|
261
319
|
isLiteral: boolean;
|
|
262
320
|
} | null;
|
|
@@ -272,7 +330,10 @@ export declare function eventFilterTreeLeaf(read: ReadEventFilter, form?: EventF
|
|
|
272
330
|
};
|
|
273
331
|
/**
|
|
274
332
|
* Read a designer tree leaf back into the authored key + value (decompile).
|
|
275
|
-
* Returns `undefined` for an operator this SDK does not author (`In`, `
|
|
333
|
+
* Returns `undefined` for an operator this SDK does not author (`In`, `DateTimeEquals` as its own key, …).
|
|
334
|
+
* The `'case'` dialect also reads {@link CASE_EVENT_FILTER_OPERATORS}; an
|
|
335
|
+
* `isOneOf` list reads back as the tree's text values (the caller decides
|
|
336
|
+
* whether the plan's expression compared them as numbers).
|
|
276
337
|
*/
|
|
277
338
|
export declare function eventFilterFromTreeLeaf(leaf: {
|
|
278
339
|
id?: unknown;
|
|
@@ -280,7 +341,7 @@ export declare function eventFilterFromTreeLeaf(leaf: {
|
|
|
280
341
|
value?: {
|
|
281
342
|
value?: unknown;
|
|
282
343
|
} | null;
|
|
283
|
-
}): ReadEventFilter | undefined;
|
|
344
|
+
}, dialect?: EventFilterDialect): ReadEventFilter | undefined;
|
|
284
345
|
/**
|
|
285
346
|
* Read an expression-valued tree leaf (`isLiteral: false`) back: its JavaScript
|
|
286
347
|
* and the form the plan spelled it in, or `undefined` when the leaf is not one
|
|
@@ -290,3 +351,4 @@ export declare function filterExprFromLeaf(value: unknown): {
|
|
|
290
351
|
expression: string;
|
|
291
352
|
form: EventFilterLeafForm;
|
|
292
353
|
} | undefined;
|
|
354
|
+
export {};
|
|
@@ -72,6 +72,44 @@ export const EVENT_FILTER_OPERATORS = {
|
|
|
72
72
|
is: { designer: 'Is', kind: 'boolean', jmes: '==' },
|
|
73
73
|
isNot: { designer: 'IsNot', kind: 'boolean', jmes: '!=' },
|
|
74
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* The Case designer's operators beyond {@link EVENT_FILTER_OPERATORS}, read and
|
|
77
|
+
* written in the `'case'` dialect only. Studio Web's Case canvas offers them on
|
|
78
|
+
* a Data Fabric entity event, and its filter compiler (`@uipath/maestro-sdk`
|
|
79
|
+
* `JmesHelper._buildJmesPathExpression`) lowers them as:
|
|
80
|
+
*
|
|
81
|
+
* | authored | designer operator | JMESPath |
|
|
82
|
+
* |--------------------------------|-------------------|--------------------------------------------|
|
|
83
|
+
* | `isOneOf: [5, 6]` (numbers) | `IsOneOf` | `` contains(`[5,6]`, f) `` |
|
|
84
|
+
* | `isOneOf: ['a', 'b']` (text) | `IsOneOf` | `` contains(`["a","b"]`, f) `` |
|
|
85
|
+
* | `isOneOf: [1]` on `f[*]` | `IsOneOf` | `` f[?contains(`[1]`, @)] `` |
|
|
86
|
+
* | `isEmpty: true` | `IsEmpty` | `not_null(f, '')==''` |
|
|
87
|
+
* | `isNotEmpty: true` | `IsNotEmpty` | `not_null(f, '')!=''` |
|
|
88
|
+
*
|
|
89
|
+
* The designer decides numbers or text from the field's type (a choice set's
|
|
90
|
+
* option values are numbers); offline the SDK has no field types, so the
|
|
91
|
+
* authored values decide, as they do for a date. The canvas tree stores the
|
|
92
|
+
* values as text either way (`value: ["5"]`). Flow and BPMN do not read these
|
|
93
|
+
* keys: their designers' saved shape is not measured.
|
|
94
|
+
*/
|
|
95
|
+
export const CASE_EVENT_FILTER_OPERATORS = {
|
|
96
|
+
isOneOf: { designer: 'IsOneOf', kind: 'list', jmes: 'contains' },
|
|
97
|
+
isEmpty: { designer: 'IsEmpty', kind: 'presence', jmes: '==' },
|
|
98
|
+
isNotEmpty: { designer: 'IsNotEmpty', kind: 'presence', jmes: '!=' },
|
|
99
|
+
};
|
|
100
|
+
/** The spec of an operator key, from either table; `undefined` for any other key. */
|
|
101
|
+
export function eventFilterOperator(key) {
|
|
102
|
+
return ownEntry(EVENT_FILTER_OPERATORS, key) ?? ownEntry(CASE_EVENT_FILTER_OPERATORS, key);
|
|
103
|
+
}
|
|
104
|
+
/** The operator keys a dialect reads: Case reads {@link CASE_EVENT_FILTER_OPERATORS} too. */
|
|
105
|
+
function operatorKeys(dialect) {
|
|
106
|
+
return [
|
|
107
|
+
...Object.keys(EVENT_FILTER_OPERATORS),
|
|
108
|
+
...(dialect === 'case' ? Object.keys(CASE_EVENT_FILTER_OPERATORS) : []),
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
/** The `[*]` marker the designer puts in an array field's name (`boardDecision[*]`, `items[*].sku`). */
|
|
112
|
+
const FIELD_ARRAY_MARKER = '[*]';
|
|
75
113
|
/** The designer operator names that come back as each authored key on decompile. */
|
|
76
114
|
const DESIGNER_TO_KEY = {
|
|
77
115
|
Contains: 'contains',
|
|
@@ -92,6 +130,17 @@ const DESIGNER_TO_KEY = {
|
|
|
92
130
|
Is: 'is',
|
|
93
131
|
IsNot: 'isNot',
|
|
94
132
|
};
|
|
133
|
+
/** The Case-only designer names ({@link CASE_EVENT_FILTER_OPERATORS}). */
|
|
134
|
+
const CASE_DESIGNER_TO_KEY = {
|
|
135
|
+
IsOneOf: 'isOneOf',
|
|
136
|
+
IsEmpty: 'isEmpty',
|
|
137
|
+
IsNotEmpty: 'isNotEmpty',
|
|
138
|
+
};
|
|
139
|
+
/** Whether a value is an {@link EventFilterList}: a non-empty array of all numbers or all strings. */
|
|
140
|
+
export function isEventFilterList(value) {
|
|
141
|
+
return Array.isArray(value) && value.length > 0
|
|
142
|
+
&& (value.every((v) => typeof v === 'string') || value.every((v) => typeof v === 'number'));
|
|
143
|
+
}
|
|
95
144
|
/** The operators an expression-valued filter takes: the ones that compare a string. */
|
|
96
145
|
export const EXPRESSION_FILTER_OPERATORS = new Set([
|
|
97
146
|
'contains', 'startsWith', 'endsWith', 'equals', 'notEquals',
|
|
@@ -127,10 +176,15 @@ export function eventFilterExpressionOf(source) {
|
|
|
127
176
|
*/
|
|
128
177
|
export function readEventFilter(leaf, dialect = 'flow') {
|
|
129
178
|
const f = (leaf ?? {});
|
|
130
|
-
const keys =
|
|
179
|
+
const keys = operatorKeys(dialect).filter((k) => f[k] !== undefined);
|
|
131
180
|
if (keys.length !== 1)
|
|
132
181
|
return { keys };
|
|
133
182
|
const value = f[keys[0]];
|
|
183
|
+
if (eventFilterOperator(keys[0])?.kind === 'list') {
|
|
184
|
+
if (!isEventFilterList(value))
|
|
185
|
+
return { keys };
|
|
186
|
+
return { keys, read: { field: String(f.field ?? ''), operator: keys[0], value } };
|
|
187
|
+
}
|
|
134
188
|
if (isEventFilterExpression(value)) {
|
|
135
189
|
const source = eventFilterExpressionSource(value.expression);
|
|
136
190
|
if (dialect !== 'case' || source === undefined)
|
|
@@ -144,7 +198,7 @@ export function readEventFilter(leaf, dialect = 'flow') {
|
|
|
144
198
|
/** Why an expression-valued filter leaf is refused, for the artifact that reads it. */
|
|
145
199
|
export function eventFilterExpressionRefusal(leaf, dialect = 'flow') {
|
|
146
200
|
const f = (leaf ?? {});
|
|
147
|
-
const key =
|
|
201
|
+
const key = operatorKeys(dialect).find((k) => f[k] !== undefined) ?? 'equals';
|
|
148
202
|
const expression = f[key]?.expression;
|
|
149
203
|
if (dialect !== 'case')
|
|
150
204
|
return `\`${key}: { expression }\` (a filter value computed at runtime) is supported in Case only; this artifact's `
|
|
@@ -216,7 +270,27 @@ export function isIsoDateString(value) {
|
|
|
216
270
|
* value with a backslash the engines read differently (`jmesStringProblem`).
|
|
217
271
|
*/
|
|
218
272
|
export function eventFilterProblem(read) {
|
|
219
|
-
const op =
|
|
273
|
+
const op = eventFilterOperator(read.operator);
|
|
274
|
+
if (op.kind === 'list') {
|
|
275
|
+
if (read.expression !== undefined || !isEventFilterList(read.value))
|
|
276
|
+
return `\`${read.operator}\` takes a non-empty list of numbers or of strings (\`${read.operator}: [0, 5]\`, `
|
|
277
|
+
+ `\`${read.operator}: ['Open', 'Closed']\`) — got ${JSON.stringify(read.expression !== undefined ? { expression: read.expression } : read.value)}.`;
|
|
278
|
+
const bad = read.value.find((v) => typeof v === 'number' ? !Number.isFinite(v) : /["\\`]/.test(v));
|
|
279
|
+
if (bad !== undefined)
|
|
280
|
+
return `\`${read.operator}\` value ${JSON.stringify(bad)} cannot be written: the designer splices each value unescaped `
|
|
281
|
+
+ `into a JMESPath list literal, so a number must be finite and text must have no double quote, backslash or `
|
|
282
|
+
+ `backtick.`;
|
|
283
|
+
return undefined;
|
|
284
|
+
}
|
|
285
|
+
if (op.kind === 'presence') {
|
|
286
|
+
if (read.value !== true)
|
|
287
|
+
return `\`${read.operator}\` tests whether a field has a value, so its value is always \`true\` (\`${read.operator}: true\`) — got `
|
|
288
|
+
+ `${JSON.stringify(read.value)}.`;
|
|
289
|
+
if (read.field.includes(FIELD_ARRAY_MARKER))
|
|
290
|
+
return `\`${read.operator}\` on an array field (\`${read.field}\`) has no spelling the designer writes correctly. `
|
|
291
|
+
+ `Test the array's own field, or match an element with \`isOneOf\`.`;
|
|
292
|
+
return undefined;
|
|
293
|
+
}
|
|
220
294
|
if (read.expression !== undefined) {
|
|
221
295
|
if (!EXPRESSION_FILTER_OPERATORS.has(read.operator))
|
|
222
296
|
return `\`${read.operator}\` does not take an expression value: only ${[...EXPRESSION_FILTER_OPERATORS].join(', ')} `
|
|
@@ -290,14 +364,34 @@ export function jmesStringProblem(value) {
|
|
|
290
364
|
}
|
|
291
365
|
/** The JMESPath literal for one filter value, per the designer's `_formatLiteral`. */
|
|
292
366
|
function jmesLiteral(value) {
|
|
367
|
+
if (typeof value === 'object')
|
|
368
|
+
throw new Error('internal SDK error: a list filter value has no scalar JMESPath literal.');
|
|
293
369
|
return typeof value === 'string' ? jmesString(value) : `\`${JSON.stringify(value)}\``;
|
|
294
370
|
}
|
|
371
|
+
/**
|
|
372
|
+
* An `isOneOf` filter as the designer writes it (`JmesHelper._composeInExpression`):
|
|
373
|
+
* the values as a JSON list literal, numbers bare and text double-quoted, then
|
|
374
|
+
* `contains(<list>, f)`; on an array field (`f[*]`, `f[*].sub`) the element
|
|
375
|
+
* test `f[?contains(<list>, @)]` (`composeArrayInExpression`).
|
|
376
|
+
*/
|
|
377
|
+
function isOneOfJmes(field, values) {
|
|
378
|
+
const list = `\`[${values.map((v) => (typeof v === 'number' ? String(v) : `"${v}"`)).join(',')}]\``;
|
|
379
|
+
const marker = field.lastIndexOf(FIELD_ARRAY_MARKER);
|
|
380
|
+
if (marker < 0)
|
|
381
|
+
return `contains(${list}, ${field})`;
|
|
382
|
+
const sub = field.slice(marker + FIELD_ARRAY_MARKER.length).replace(/^\.+|\.+$/g, '');
|
|
383
|
+
return `${field.slice(0, marker)}[?contains(${list}, ${sub || '@'})]`;
|
|
384
|
+
}
|
|
295
385
|
/**
|
|
296
386
|
* The JMESPath condition for one filter — the grammar the designer emits,
|
|
297
387
|
* without the outer parentheses (the caller groups conditions).
|
|
298
388
|
*/
|
|
299
389
|
export function eventFilterJmes(read) {
|
|
300
|
-
const op =
|
|
390
|
+
const op = eventFilterOperator(read.operator);
|
|
391
|
+
if (op.kind === 'list')
|
|
392
|
+
return isOneOfJmes(read.field, read.value);
|
|
393
|
+
if (op.kind === 'presence')
|
|
394
|
+
return `not_null(${read.field}, '')${op.jmes}''`;
|
|
301
395
|
if (op.kind === 'boolean')
|
|
302
396
|
return `${read.field}${op.jmes}\`true\``;
|
|
303
397
|
if (op.kind === 'function')
|
|
@@ -312,33 +406,47 @@ export function eventFilterJmes(read) {
|
|
|
312
406
|
* filter (Case) carries `isLiteral: false` in the `form` its plan used.
|
|
313
407
|
*/
|
|
314
408
|
export function eventFilterTreeLeaf(read, form = 'path') {
|
|
315
|
-
|
|
316
|
-
|
|
409
|
+
const op = eventFilterOperator(read.operator);
|
|
410
|
+
if (op.kind === 'boolean' || op.kind === 'presence')
|
|
411
|
+
return { id: read.field, operator: op.designer, value: null };
|
|
412
|
+
if (op.kind === 'list') {
|
|
413
|
+
const values = read.value.map(String);
|
|
414
|
+
return { id: read.field, operator: op.designer, value: { value: values, rawString: JSON.stringify(values), isLiteral: true } };
|
|
415
|
+
}
|
|
317
416
|
if (read.expression !== undefined) {
|
|
318
417
|
const value = form === 'js' ? `=js:(${read.expression})` : read.expression;
|
|
319
418
|
return {
|
|
320
419
|
id: read.field,
|
|
321
|
-
operator:
|
|
420
|
+
operator: op.designer,
|
|
322
421
|
value: { value, rawString: form === 'js' ? value : JSON.stringify(value), isLiteral: false },
|
|
323
422
|
};
|
|
324
423
|
}
|
|
325
424
|
return {
|
|
326
425
|
id: read.field,
|
|
327
|
-
operator:
|
|
426
|
+
operator: op.designer,
|
|
328
427
|
value: { value: read.value, rawString: JSON.stringify(read.value), isLiteral: true },
|
|
329
428
|
};
|
|
330
429
|
}
|
|
331
430
|
/**
|
|
332
431
|
* Read a designer tree leaf back into the authored key + value (decompile).
|
|
333
|
-
* Returns `undefined` for an operator this SDK does not author (`In`, `
|
|
432
|
+
* Returns `undefined` for an operator this SDK does not author (`In`, `DateTimeEquals` as its own key, …).
|
|
433
|
+
* The `'case'` dialect also reads {@link CASE_EVENT_FILTER_OPERATORS}; an
|
|
434
|
+
* `isOneOf` list reads back as the tree's text values (the caller decides
|
|
435
|
+
* whether the plan's expression compared them as numbers).
|
|
334
436
|
*/
|
|
335
|
-
export function eventFilterFromTreeLeaf(leaf) {
|
|
437
|
+
export function eventFilterFromTreeLeaf(leaf, dialect = 'flow') {
|
|
336
438
|
const op = String(leaf?.operator ?? '');
|
|
337
|
-
const key = ownEntry(DESIGNER_TO_KEY, op);
|
|
439
|
+
const key = ownEntry(DESIGNER_TO_KEY, op) ?? (dialect === 'case' ? ownEntry(CASE_DESIGNER_TO_KEY, op) : undefined);
|
|
338
440
|
if (!key || typeof leaf?.id !== 'string')
|
|
339
441
|
return undefined;
|
|
340
|
-
|
|
442
|
+
const kind = eventFilterOperator(key).kind;
|
|
443
|
+
if (kind === 'boolean' || kind === 'presence')
|
|
341
444
|
return { field: leaf.id, operator: key, value: true };
|
|
445
|
+
if (kind === 'list') {
|
|
446
|
+
const values = leaf.value?.value;
|
|
447
|
+
return Array.isArray(values) && values.length > 0 && values.every((v) => typeof v === 'string')
|
|
448
|
+
? { field: leaf.id, operator: key, value: values } : undefined;
|
|
449
|
+
}
|
|
342
450
|
const raw = leaf.value?.value;
|
|
343
451
|
const value = typeof raw === 'number' || typeof raw === 'boolean' ? raw : String(raw ?? '');
|
|
344
452
|
return { field: leaf.id, operator: key, value };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.120.
|
|
3
|
+
"version": "6.120.12",
|
|
4
4
|
"description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://docs.uipath.com/maestro",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"@types/node": "^22.7.0",
|
|
125
125
|
"esbuild": "^0.28.1"
|
|
126
126
|
},
|
|
127
|
-
"gitref": "
|
|
127
|
+
"gitref": "e13203349421d4dad00a32436c1c29eb0b547534"
|
|
128
128
|
}
|