@uipath/maestro-builder-sdk 6.18.6 → 6.18.7

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.
@@ -10,6 +10,7 @@
10
10
  import type { BuiltCase } from './case-sdk.js';
11
11
  import { type ConnectorCheckOpts } from '../core/connector-checks.js';
12
12
  import type { EventSubscription } from '../core/actions.js';
13
+ import { type EventCheckOpts } from '../core/event-checks.js';
13
14
  export interface Diagnostic {
14
15
  level: 'error' | 'warning';
15
16
  code: string;
@@ -26,13 +27,13 @@ export interface Diagnostic {
26
27
  * the event, and validates a connector task's inputs and resolves its lookups
27
28
  * through the shared `buildConnectorInputs` (`connectorInputs`, `lookups`,
28
29
  * `resolutions`), and refuses a connection/folder label bindings.json cannot
29
- * turn into a resource key (`bindings`, `bindingLabelRefusal`). It does not
30
- * check BYOA, so that hook stays off until Case compile enforces it.
30
+ * turn into a resource key (`bindings`, `bindingLabelRefusal`), and refuses an
31
+ * event on an unverified BYOA connection (`eventFacts`, `byoa`).
31
32
  *
32
33
  * Every hook fails open: without a library, `check` stays a pure function of the
33
34
  * built model.
34
35
  */
35
- export type CaseCheckOpts = Pick<ConnectorCheckOpts, 'connectorResolveError' | 'connectorInputs' | 'lookups' | 'resolutions' | 'schemaReadiness' | 'bindings'> & {
36
+ export type CaseCheckOpts = Pick<ConnectorCheckOpts, 'connectorResolveError' | 'connectorInputs' | 'lookups' | 'resolutions' | 'schemaReadiness' | 'bindings'> & Pick<EventCheckOpts, 'eventFacts' | 'byoa'> & {
36
37
  /**
37
38
  * What Case `compile` would refuse an event subscription with, or `undefined`
38
39
  * when it resolves: `EVENT_UNKNOWN` (the event is not in the library, or
@@ -298,10 +298,17 @@ function checkLibraryConnectors(built, opts, diags) {
298
298
  const refused = opts.subscriptionError?.(kind, sub);
299
299
  if (refused !== undefined)
300
300
  diags.push({ level: 'error', code: refused.code, message: `${where}: ${refused.message}`, where: at });
301
- // A `where` lookup nobody recorded: Flow's LOOKUP_UNRESOLVED warning, from the
302
- // shared event rules. Only `resolutions` is passed, so nothing else in them fires.
303
301
  checkBindingLabels(where, sub, opts, (code, message) => diags.push({ level: 'error', code, message, where: at }), { key: sub.connector, action: sub.event });
304
- checkEventResolution(sub, where, kind, { resolutions: opts.resolutions ?? {} }, (code, message) => diags.push({ level: 'error', code, message, where: at }), (code, message) => diags.push({ level: 'warning', code, message, where: at }));
302
+ // From the shared event rules, the two Case compile enforces: a `where` lookup
303
+ // nobody recorded (LOOKUP_UNRESOLVED, a warning) and an unverified BYOA
304
+ // connection (EVENT_BYOA_UNVERIFIED). Only their hooks are passed, so nothing
305
+ // else in them fires.
306
+ checkEventResolution(sub, where, kind, {
307
+ resolutions: opts.resolutions ?? {},
308
+ ...(opts.eventFacts ? { eventFacts: opts.eventFacts } : {}),
309
+ ...(opts.byoa ? { byoa: opts.byoa } : {}),
310
+ ...(opts.bindings ? { bindings: opts.bindings } : {}),
311
+ }, (code, message) => diags.push({ level: 'error', code, message, where: at }), (code, message) => diags.push({ level: 'warning', code, message, where: at }));
305
312
  };
306
313
  const rules = (conditions, where) => {
307
314
  for (const c of conditions)
@@ -9,9 +9,8 @@ import type { CaseCheckOpts } from './check.js';
9
9
  * compile's own call), a connector task's field contract and lookups (the
10
10
  * `=`-expression validator Case compile runs), and the schema-readiness warnings.
11
11
  * With `bindings`, the binding-label rules (BINDING_SELF_NAME, BINDING_UNDECLARED),
12
- * which Case `serialize` enforces through the same `bindingLabelRefusal`. The
13
- * BYOA hooks of the shared bag are left out, because Case `serialize` does not
14
- * enforce them.
12
+ * which Case `serialize` enforces through the same `bindingLabelRefusal`, and the
13
+ * BYOA facts and ledger, for the refusal `resolveCaseSubscription` makes.
15
14
  *
16
15
  * @param library - The library `openCliLibrary` returned, or `undefined`.
17
16
  * @param bindings - The project's bindings.json, as compile reads it.
@@ -18,9 +18,8 @@ import { EVENT_GENERIC_NO_OBJECT, GenericEventNoObjectError, resolveCaseSubscrip
18
18
  * compile's own call), a connector task's field contract and lookups (the
19
19
  * `=`-expression validator Case compile runs), and the schema-readiness warnings.
20
20
  * With `bindings`, the binding-label rules (BINDING_SELF_NAME, BINDING_UNDECLARED),
21
- * which Case `serialize` enforces through the same `bindingLabelRefusal`. The
22
- * BYOA hooks of the shared bag are left out, because Case `serialize` does not
23
- * enforce them.
21
+ * which Case `serialize` enforces through the same `bindingLabelRefusal`, and the
22
+ * BYOA facts and ledger, for the refusal `resolveCaseSubscription` makes.
24
23
  *
25
24
  * @param library - The library `openCliLibrary` returned, or `undefined`.
26
25
  * @param bindings - The project's bindings.json, as compile reads it.
@@ -36,6 +35,8 @@ export function caseCheckOpts(library, bindings) {
36
35
  connectorInputs: shared.connectorInputs,
37
36
  lookups: shared.lookups,
38
37
  resolutions: shared.resolutions,
38
+ eventFacts: shared.eventFacts,
39
+ byoa: shared.byoa,
39
40
  schemaReadiness: shared.schemaReadiness,
40
41
  externalDescriptorError: (kind, d) => {
41
42
  let rc;
@@ -890,7 +890,7 @@ function resolvedSubscriptionBag(kind, spec, resolver, elementId, where) {
890
890
  if (!resolver.library)
891
891
  throw new Error(`${kind === 'trigger' ? 'event trigger' : 'wait-for-connector'} needs the connector library — `
892
892
  + `pass { library } to serialize or use uip maestro case compile --library.`);
893
- const rc = resolveCaseSubscription(resolver.library, kind, spec);
893
+ const rc = resolveCaseSubscription(resolver.library, kind, spec, { where, bindings: resolver.bindings });
894
894
  const op = rc.entry.operation ?? {};
895
895
  const context = [io('connectorKey', 'string', { value: rc.connectorKey })];
896
896
  const target = { key: spec.connector, action: spec.event };
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import type { EventSubscription } from '../core/actions.js';
12
12
  import type { Library, ResolvedConnector } from '../core/library.js';
13
+ import type { BindingsView } from '../core/binding-messages.js';
13
14
  /** Check's code for {@link GenericEventNoObjectError}; Flow and BPMN `check` use the same one. */
14
15
  export declare const EVENT_GENERIC_NO_OBJECT = "EVENT_GENERIC_NO_OBJECT";
15
16
  /** A GENERIC event subscription that names no object. */
@@ -24,7 +25,13 @@ export declare class GenericEventNoObjectError extends Error {
24
25
  * @param library - The connector library.
25
26
  * @param kind - `trigger` for an event trigger, `event` for a wait-for-connector task or rule.
26
27
  * @param sub - The authored subscription.
28
+ * @param byoa - Where the subscription is and the bindings, to refuse an
29
+ * unverified BYOA connection; compile passes it, `check` does not (it reports
30
+ * that rule from the shared event rules).
27
31
  * @returns The resolved event.
28
- * @throws What `resolveEvent` throws, or {@link GenericEventNoObjectError}.
32
+ * @throws What `resolveEvent` throws, {@link GenericEventNoObjectError}, or a `ByoaRefusal`.
29
33
  */
30
- export declare function resolveCaseSubscription(library: Library, kind: 'trigger' | 'event', sub: EventSubscription): ResolvedConnector;
34
+ export declare function resolveCaseSubscription(library: Library, kind: 'trigger' | 'event', sub: EventSubscription, byoa?: {
35
+ where: string;
36
+ bindings?: BindingsView;
37
+ }): ResolvedConnector;
@@ -1,4 +1,5 @@
1
1
  import { genericEventObjectRefusal } from '../core/event-checks.js';
2
+ import { ByoaRefusal, byoaUnverified } from '../core/byoa.js';
2
3
  /** Check's code for {@link GenericEventNoObjectError}; Flow and BPMN `check` use the same one. */
3
4
  export const EVENT_GENERIC_NO_OBJECT = 'EVENT_GENERIC_NO_OBJECT';
4
5
  /** A GENERIC event subscription that names no object. */
@@ -17,13 +18,25 @@ function caseObjectOption(object) {
17
18
  * @param library - The connector library.
18
19
  * @param kind - `trigger` for an event trigger, `event` for a wait-for-connector task or rule.
19
20
  * @param sub - The authored subscription.
21
+ * @param byoa - Where the subscription is and the bindings, to refuse an
22
+ * unverified BYOA connection; compile passes it, `check` does not (it reports
23
+ * that rule from the shared event rules).
20
24
  * @returns The resolved event.
21
- * @throws What `resolveEvent` throws, or {@link GenericEventNoObjectError}.
25
+ * @throws What `resolveEvent` throws, {@link GenericEventNoObjectError}, or a `ByoaRefusal`.
22
26
  */
23
- export function resolveCaseSubscription(library, kind, sub) {
27
+ export function resolveCaseSubscription(library, kind, sub, byoa) {
24
28
  const rc = library.resolveEvent(kind, sub.connector, sub.event, sub.version, sub.object);
25
29
  const noObject = genericEventObjectRefusal(rc, sub, caseObjectOption);
26
30
  if (noObject)
27
31
  throw new GenericEventNoObjectError(noObject);
32
+ // A BYOA-only event on a connection `prepare` never checked deploys and never
33
+ // fires (#848). Flow's `refuseUnverifiedByoa` rule and text (`byoaUnverified`);
34
+ // Case `check` reports it from the shared event rules (`eventFacts` / `byoa`).
35
+ if (byoa && typeof library.eventFacts === 'function') {
36
+ const object = typeof sub.object === 'string' && sub.object !== '' ? sub.object : undefined;
37
+ const message = byoaUnverified(byoa.where, { connector: sub.connector, event: sub.event, ...(object ? { object } : {}), connection: sub.connection }, library.eventFacts(sub.connector, sub.event, object), library.byoaVerifications, byoa.bindings);
38
+ if (message)
39
+ throw new ByoaRefusal(message);
40
+ }
28
41
  return rc;
29
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.18.6",
3
+ "version": "6.18.7",
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",
@@ -92,5 +92,5 @@
92
92
  "@types/node": "^22.7.0",
93
93
  "esbuild": "^0.28.1"
94
94
  },
95
- "gitref": "27768f00ecc6986a54deba3c8f327d01ace642f8"
95
+ "gitref": "7dffe3f9de6568ee2673c38faa5046eb7c86eb54"
96
96
  }