@uipath/maestro-builder-sdk 6.104.1 → 6.105.1

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 (35) hide show
  1. package/dist/bpmn/check-cli.js +2 -2
  2. package/dist/bpmn/decompile-cli.js +2 -3
  3. package/dist/bpmn/merge-cli.js +2 -3
  4. package/dist/case/decompile-cli.js +2 -3
  5. package/dist/check.js +3 -2
  6. package/dist/core/cli-library.d.ts +8 -0
  7. package/dist/core/cli-library.js +17 -3
  8. package/dist/core/library-cache.d.ts +7 -1
  9. package/dist/core/library-cache.js +23 -2
  10. package/dist/core/library.d.ts +1 -1
  11. package/dist/core/library.js +8 -3
  12. package/dist/core/refusals.d.ts +1 -0
  13. package/dist/core/refusals.js +1 -0
  14. package/dist/decompile-cli.js +6 -3
  15. package/dist/decompile-stamp.d.ts +7 -0
  16. package/dist/decompile-stamp.js +4 -1
  17. package/dist/flow-node-type.d.ts +2 -0
  18. package/dist/merge-cli.js +23 -8
  19. package/dist/nodes/connector/flow/node-type.js +9 -3
  20. package/dist/nodes/data-fabric/flow/check.d.ts +14 -0
  21. package/dist/nodes/data-fabric/flow/check.js +65 -0
  22. package/dist/nodes/data-fabric/flow/family.js +5 -2
  23. package/dist/registry/fetch/fetch-connectors.d.ts +8 -0
  24. package/dist/registry/fetch/fetch-connectors.js +32 -9
  25. package/dist/registry/fetch/fetch-definitions.d.ts +17 -0
  26. package/dist/registry/fetch/fetch-definitions.js +54 -9
  27. package/dist/registry/fetch/flow-requests.d.ts +16 -5
  28. package/dist/registry/fetch/flow-requests.js +28 -7
  29. package/dist/registry/fetch/with-fetched-definitions.d.ts +8 -0
  30. package/dist/registry/fetch/with-fetched-definitions.js +45 -18
  31. package/dist/registry/prepare/overlay.js +4 -1
  32. package/dist/registry/pull-cli.d.ts +6 -1
  33. package/dist/registry/pull-cli.js +33 -6
  34. package/dist/registry/search-cli.js +29 -4
  35. package/package.json +2 -2
@@ -34,7 +34,7 @@ import { sourceTypeDiagnostics } from './source-types.js';
34
34
  import { graphModel, renderGraph } from './graph.js';
35
35
  import { Bindings } from '../core/bindings.js';
36
36
  import { connectorCheckOpts, openCliLibrary } from '../core/cli-library.js';
37
- import { fetchDefinitionsEnabled } from '../registry/fetch/fetch-definitions.js';
37
+ import { fetchesDefinitions } from '../registry/fetch/with-fetched-definitions.js';
38
38
  import { withFetchedDefinitions } from '../registry/fetch/with-fetched-definitions.js';
39
39
  import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
40
40
  import { ensureTypeScriptRuntime } from '../node-runtime.js';
@@ -90,7 +90,7 @@ export async function run(argv) {
90
90
  let baselineBuilt;
91
91
  if (original !== undefined) {
92
92
  try {
93
- const library = openCliLibrary(argv, { always: fetchDefinitionsEnabled() });
93
+ const library = openCliLibrary(argv, { always: fetchesDefinitions(argv) });
94
94
  baselineBuilt = await buildOriginal(original, {
95
95
  ...(library ? { library } : {}),
96
96
  source: readFileSync(file, 'utf8'),
@@ -45,8 +45,7 @@ import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
45
45
  import { decompilePipeline } from './decompile-pipeline.js';
46
46
  import { sourceDigest, stampSource } from './decompile-stamp.js';
47
47
  import { openCliLibrary } from '../core/cli-library.js';
48
- import { fetchDefinitionsEnabled } from '../registry/fetch/fetch-definitions.js';
49
- import { fetchMissedBy } from '../registry/fetch/with-fetched-definitions.js';
48
+ import { fetchMissedBy, fetchesDefinitions } from '../registry/fetch/with-fetched-definitions.js';
50
49
  import { BPMN_IMPORT } from '../package-name.js';
51
50
  import { fileURLToPath } from 'node:url';
52
51
  /**
@@ -108,7 +107,7 @@ export async function run(argv) {
108
107
  if (connectors === 'lift') {
109
108
  await fetchMissedBy(argv, (probe) => decompilePipeline(xml, { importSpecifier, style, keepFlowIds, keepUnusedBindings, sdkEntry, library: probe }), { who: 'decompile' });
110
109
  }
111
- const library = connectors === 'lift' ? openCliLibrary(argv, { always: fetchDefinitionsEnabled() }) : undefined;
110
+ const library = connectors === 'lift' ? openCliLibrary(argv, { always: fetchesDefinitions(argv) }) : undefined;
112
111
  const { source, pruned, connectors: connectorSummary, lifted, fallback } = await decompilePipeline(xml, {
113
112
  importSpecifier, style, keepFlowIds, keepUnusedBindings, sdkEntry, ...(library ? { library } : {}),
114
113
  });
@@ -48,8 +48,7 @@ import { loadBuiltBpmn } from './load.js';
48
48
  import { serialize } from './serialize.js';
49
49
  import { Bindings } from '../core/bindings.js';
50
50
  import { openCliLibrary } from '../core/cli-library.js';
51
- import { fetchDefinitionsEnabled } from '../registry/fetch/fetch-definitions.js';
52
- import { fetchMissedBy } from '../registry/fetch/with-fetched-definitions.js';
51
+ import { fetchMissedBy, fetchesDefinitions } from '../registry/fetch/with-fetched-definitions.js';
53
52
  import { FETCHED_PROVENANCE } from '../core/library.js';
54
53
  import { readCliResources } from '../registry/prepare/resources.js';
55
54
  import { ensureTypeScriptRuntime } from '../node-runtime.js';
@@ -157,7 +156,7 @@ async function compileSides(argv, editedPath, originalPath, original, explicitBa
157
156
  ...(decompiled !== undefined ? [deriveBaseline(original, { serialize: probeOpts, ...stampedDecompile(decompiled, probe) })] : []),
158
157
  ]);
159
158
  }, { who: 'bpmn-merge' });
160
- const library = openCliLibrary(argv, { always: fetchDefinitionsEnabled() });
159
+ const library = openCliLibrary(argv, { always: fetchesDefinitions(argv) });
161
160
  const opts = { ...base, ...(library ? { library } : {}) };
162
161
  // Two catches, as `compile` has them, so a broken source fails here exactly as it
163
162
  // fails there. While the source loads, only a builder refusal is printed by its code;
@@ -28,8 +28,7 @@
28
28
  import { reportResult } from '../cli-result.js';
29
29
  import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
30
30
  import { openCliLibrary } from '../core/cli-library.js';
31
- import { fetchDefinitionsEnabled } from '../registry/fetch/fetch-definitions.js';
32
- import { fetchMissedBy } from '../registry/fetch/with-fetched-definitions.js';
31
+ import { fetchMissedBy, fetchesDefinitions } from '../registry/fetch/with-fetched-definitions.js';
33
32
  import { resolveLibraryDir } from '../core/library-cache.js';
34
33
  import { basename, join, resolve } from 'node:path';
35
34
  import { defaultOverlayDir, defaultSourceOut, workDirBeside, workPath, writeSource } from '../workdir.js';
@@ -81,7 +80,7 @@ export async function run(argv) {
81
80
  await fetchMissedBy(argv, (probe) => run(probe), { who: 'case-decompile' });
82
81
  // A fetch may have created the overlay: look again, so the pipeline helper records it.
83
82
  overlayDir = flagValue(argv, '--connectors-local') ?? defaultOverlayDir();
84
- const library = openCliLibrary(argv, { always: fetchDefinitionsEnabled() });
83
+ const library = openCliLibrary(argv, { always: fetchesDefinitions(argv) });
85
84
  let result;
86
85
  if (!library)
87
86
  result = run(undefined);
package/dist/check.js CHANGED
@@ -798,7 +798,7 @@ function checkFlow(built, ancestors, opts = {}) {
798
798
  }
799
799
  }
800
800
  reportUnreachableHitlOutcomes(hitlChoiceNoPorts, exprs, diags);
801
- checkRegisteredFamilies(registeredSteps, unresolvedSteps, stepNames, diags);
801
+ checkRegisteredFamilies(registeredSteps, unresolvedSteps, stepNames, diags, opts);
802
802
  checkPackageNodes(registeredSteps, diags);
803
803
  // Entry points: valid triggers. An id that collides with a step, the trigger
804
804
  // or another entry point (or is `start` while `.triggerId()` renames the
@@ -2547,7 +2547,7 @@ function checkPackageNodes(steps, diags) {
2547
2547
  });
2548
2548
  }
2549
2549
  /** Run each registered family's own rules over all of its placements in this flow. */
2550
- function checkRegisteredFamilies(steps, unresolved, stepNames, diags) {
2550
+ function checkRegisteredFamilies(steps, unresolved, stepNames, diags, opts) {
2551
2551
  const byFamily = new Map();
2552
2552
  for (const placed of steps.values()) {
2553
2553
  const list = byFamily.get(placed.entry.family.id) ?? [];
@@ -2563,6 +2563,7 @@ function checkRegisteredFamilies(steps, unresolved, stepNames, diags) {
2563
2563
  hasStep: (step) => stepNames.has(step),
2564
2564
  placementOf: (step) => steps.get(step)?.placement,
2565
2565
  versionUnresolved: (step) => unresolved.has(step),
2566
+ options: opts,
2566
2567
  };
2567
2568
  family.check(placed.map((p) => p.placement), ctx);
2568
2569
  }
@@ -24,6 +24,14 @@ import type { EventCheckOpts } from './event-checks.js';
24
24
  * environment and the pulled cache) fall back to the overlay alone.
25
25
  */
26
26
  export declare function openCliLibrary(argv: readonly string[], opts?: CliLibraryOpts): Library | undefined;
27
+ /**
28
+ * Whether this invocation has a pre-cache library: one named by `--library`
29
+ * (even one that is not there, which {@link openCliLibrary} refuses), or a
30
+ * default (the environment, the pulled cache) with an index. Only without one
31
+ * is a missing definition fetched through `uip`: an operation a pulled library
32
+ * lacks is refused as it always was.
33
+ */
34
+ export declare function hasPulledLibrary(argv: readonly string[]): boolean;
27
35
  /** {@link openCliLibrary}'s options: the miss hooks it passes on, and whether to open an empty library. */
28
36
  export interface CliLibraryOpts extends Pick<LibraryOpts, 'onMiss' | 'missNote' | 'hide' | 'onConnectorMiss'> {
29
37
  always?: boolean;
@@ -43,9 +43,7 @@ import { connectorInputErrors, connectorResourceRefusals } from './connector-inp
43
43
  * environment and the pulled cache) fall back to the overlay alone.
44
44
  */
45
45
  export function openCliLibrary(argv, opts = {}) {
46
- // Through the reader, not `existsSync`: a host's reader serves a library that is on no disk.
47
- const read = defaultReadText();
48
- const hasIndex = (dir) => dir !== undefined && read(join(dir, 'index.json')) !== undefined;
46
+ const hasIndex = indexReader();
49
47
  const named = flagValue(argv, '--library');
50
48
  if (named !== undefined && !hasIndex(named))
51
49
  return new Library(named, { overlayDir: flagValue(argv, '--connectors-local') ?? defaultOverlayDir() });
@@ -58,6 +56,22 @@ export function openCliLibrary(argv, opts = {}) {
58
56
  return new Library(undefined, { overlayDir, ...hooks });
59
57
  return always ? new Library(undefined, hooks) : undefined;
60
58
  }
59
+ /** Whether `dir` holds a library index. Through the reader, not `existsSync`: a host's reader serves a library that is on no disk. */
60
+ function indexReader() {
61
+ const read = defaultReadText();
62
+ return (dir) => dir !== undefined && read(join(dir, 'index.json')) !== undefined;
63
+ }
64
+ /**
65
+ * Whether this invocation has a pre-cache library: one named by `--library`
66
+ * (even one that is not there, which {@link openCliLibrary} refuses), or a
67
+ * default (the environment, the pulled cache) with an index. Only without one
68
+ * is a missing definition fetched through `uip`: an operation a pulled library
69
+ * lacks is refused as it always was.
70
+ */
71
+ export function hasPulledLibrary(argv) {
72
+ const named = flagValue(argv, '--library');
73
+ return named !== undefined || indexReader()(resolveLibraryDir(undefined));
74
+ }
61
75
  /**
62
76
  * The connector half of a family's check options, from a library the CLI already
63
77
  * opened.
@@ -47,7 +47,13 @@ export declare function resolveCachedMarkdown(root?: string): string | undefined
47
47
  * The library a command should use: what the caller named, else the environment,
48
48
  * else the cache. Every compile entry point resolves through this so `pull` and
49
49
  * `compile` cannot disagree about where the library is — they did, and a library
50
- * written by `pull` was invisible to the SDK's own compile.
50
+ * written by `pull` was invisible to the SDK's own compile. An empty
51
+ * FLOW_SDK_LIBRARY_JSON is unset, not a library at the working directory.
52
+ *
53
+ * An environment value that names no index gives way to a pulled cache, as
54
+ * `registry pull` reads it: otherwise a stale variable would hide a library on
55
+ * disk, and a missing definition would be fetched beside it. With no cache it is
56
+ * returned as before (the overlay alone, or a host's reader, then answers).
51
57
  */
52
58
  export declare function resolveLibraryDir(named?: string): string | undefined;
53
59
  /** What `current` points at, for reporting. */
@@ -1,6 +1,7 @@
1
1
  import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
2
2
  import { homedir } from "node:os";
3
3
  import { join } from "node:path";
4
+ import { defaultReadText } from "./read-text.js";
4
5
  /**
5
6
  * Where the connector library lives.
6
7
  *
@@ -65,10 +66,30 @@ export function resolveCachedMarkdown(root = libraryCacheRoot()) {
65
66
  * The library a command should use: what the caller named, else the environment,
66
67
  * else the cache. Every compile entry point resolves through this so `pull` and
67
68
  * `compile` cannot disagree about where the library is — they did, and a library
68
- * written by `pull` was invisible to the SDK's own compile.
69
+ * written by `pull` was invisible to the SDK's own compile. An empty
70
+ * FLOW_SDK_LIBRARY_JSON is unset, not a library at the working directory.
71
+ *
72
+ * An environment value that names no index gives way to a pulled cache, as
73
+ * `registry pull` reads it: otherwise a stale variable would hide a library on
74
+ * disk, and a missing definition would be fetched beside it. With no cache it is
75
+ * returned as before (the overlay alone, or a host's reader, then answers).
69
76
  */
70
77
  export function resolveLibraryDir(named) {
71
- return named ?? process.env.FLOW_SDK_LIBRARY_JSON ?? resolveCachedLibrary();
78
+ if (named !== undefined)
79
+ return named;
80
+ const env = process.env.FLOW_SDK_LIBRARY_JSON || undefined;
81
+ if (env !== undefined && !hasIndexThroughReader(env))
82
+ return resolveCachedLibrary() ?? env;
83
+ return env ?? resolveCachedLibrary();
84
+ }
85
+ /** Whether `dir` holds an index, through the host's reader when one is set (a library on no disk). */
86
+ function hasIndexThroughReader(dir) {
87
+ try {
88
+ return defaultReadText()(join(dir, "index.json")) !== undefined;
89
+ }
90
+ catch {
91
+ return hasIndex(dir);
92
+ }
72
93
  }
73
94
  /** What `current` points at, for reporting. */
74
95
  export function currentEntrySha(root = libraryCacheRoot()) {
@@ -574,9 +574,9 @@ export declare class Library {
574
574
  * connection (`objectFromDiscovery`), which only `prepare --object` can fill.
575
575
  */
576
576
  private variantMissing;
577
- /** Whether any layer indexes `nodeType` (at `version`, when one is asked for). */
578
577
  /** {@link LibraryOpts.onConnectorMiss}, for a wire of `connectorKey` no layer could identify. */
579
578
  private noteConnectorMiss;
579
+ /** Whether any layer indexes `nodeType` (at `version`, when one is asked for). */
580
580
  private carries;
581
581
  /** The connector key is in no entry at all. */
582
582
  private noConnector;
@@ -25,6 +25,8 @@ export { ConnectorResolveError } from './connector-resolve-error.js';
25
25
  * as prepared.
26
26
  */
27
27
  export const FETCHED_PROVENANCE = 'uip-fetch';
28
+ /** The closing advice of a miss's description, which a caller's `missNote` replaces. */
29
+ const PULL_ADVICE = / If the (?:operation|connector|event) is newer than the library, refresh it with `[^`]+`\./;
28
30
  export class Library {
29
31
  layers = [];
30
32
  /** The LIST-ENVELOPE LEDGER, overlay first so a prepared entry can add a row. */
@@ -780,9 +782,12 @@ export class Library {
780
782
  + `the library index (\`index.json\`), and remember the two namespaces: `
781
783
  + `\`…connector.trigger.…\` starts a flow, \`…connector.event.…\` waits mid-flow.`
782
784
  : '';
785
+ // A caller's note says why it is missing (the tenant does not serve it, uip
786
+ // cannot be asked, merge hides it): it replaces the advice to pull, which
787
+ // cannot help there.
788
+ const described = this.describeMiss(nodeType, version, objectName);
783
789
  throw new ConnectorResolveError('CONNECTOR_NOT_IN_LIBRARY', `connector not in library: ${nodeType}${version ? '@' + version : ''}.${hint}`
784
- + this.describeMiss(nodeType, version, objectName)
785
- + (note ? ` ${note}` : ''));
790
+ + (note ? `${described.replace(PULL_ADVICE, '')} ${note}` : described));
786
791
  }
787
792
  /**
788
793
  * Turn a lookup miss into something actionable: which operations this connector
@@ -852,11 +857,11 @@ export class Library {
852
857
  const wanted = objectName.toLowerCase();
853
858
  return !rows.some((row) => typeof row.objectName === 'string' && row.objectName.toLowerCase() === wanted);
854
859
  }
855
- /** Whether any layer indexes `nodeType` (at `version`, when one is asked for). */
856
860
  /** {@link LibraryOpts.onConnectorMiss}, for a wire of `connectorKey` no layer could identify. */
857
861
  noteConnectorMiss(connectorKey) {
858
862
  this.onConnectorMiss?.(connectorKey);
859
863
  }
864
+ /** Whether any layer indexes `nodeType` (at `version`, when one is asked for). */
860
865
  carries(nodeType, version) {
861
866
  return this.layers.some((l) => l.entries.some((e) => e.nodeType === nodeType && (!version || e.version === version)));
862
867
  }
@@ -269,6 +269,7 @@ export declare const REFUSALS: {
269
269
  readonly DATAFABRIC_FROMREAD_UNKNOWN: "lint";
270
270
  readonly DATAFABRIC_IN_REQUIRES_MULTIPLE: "lint";
271
271
  readonly DATAFABRIC_LIMIT_RANGE: "lint";
272
+ readonly DATAFABRIC_LONG_TEXT_PREVIEW: "lint";
272
273
  readonly DATAFABRIC_NO_ENTITY: "lint";
273
274
  readonly DATAFABRIC_NULL_REQUIRED: "lint";
274
275
  readonly DATAFABRIC_QUERY_OPTS_WITHOUT_MULTIPLE: "lint";
@@ -343,6 +343,7 @@ export const REFUSALS = {
343
343
  DATAFABRIC_FROMREAD_UNKNOWN: 'lint',
344
344
  DATAFABRIC_IN_REQUIRES_MULTIPLE: 'lint',
345
345
  DATAFABRIC_LIMIT_RANGE: 'lint',
346
+ DATAFABRIC_LONG_TEXT_PREVIEW: 'lint',
346
347
  DATAFABRIC_NO_ENTITY: 'lint',
347
348
  DATAFABRIC_NULL_REQUIRED: 'lint',
348
349
  DATAFABRIC_QUERY_OPTS_WITHOUT_MULTIPLE: 'lint',
@@ -39,7 +39,7 @@ import { PACKAGE_NAME } from './package-name.js';
39
39
  import { commentText } from './core/comment-text.js';
40
40
  import { loadNodePackages } from './node-packages.js';
41
41
  import { pipelineFrontDoor } from './registry/uip/pipeline-front-door.js';
42
- import { flowConnectorRequests } from './registry/fetch/flow-requests.js';
42
+ import { flowConnectorRequests, lackedToken } from './registry/fetch/flow-requests.js';
43
43
  import { openWithFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
44
44
  import { fetchableNodeType } from './registry/fetch/fetch-definitions.js';
45
45
  /** Derive a PascalCase base name from the flow name/id for the default output file. */
@@ -102,9 +102,11 @@ export async function run(argv) {
102
102
  // What the library lacked as decompile saw it: those operations are carried
103
103
  // from the file. Recorded in the stamp, so `flow merge` can hide them again and
104
104
  // derive the same source even after they have been fetched (decompile-stamp.ts).
105
+ // Per object: a generic operation held for one object can lack another. With
106
+ // no library at all the stamp says so instead (`no-library`).
105
107
  const lacked = library === undefined ? [] : [...new Set(flowConnectorRequests(flow)
106
- .map((r) => r.nodeType)
107
- .filter((nodeType) => !library.indexes(nodeType) && !library.indexes(fetchableNodeType(nodeType))))].sort();
108
+ .filter((r) => !library.indexes(r.nodeType, r.objectName) && !library.indexes(fetchableNodeType(r.nodeType), r.objectName))
109
+ .map(lackedToken))].sort();
108
110
  const ts = decompileFlowFile(pos, flow, {
109
111
  importSpecifier: flagValue(argv, '--import') ?? PACKAGE_NAME,
110
112
  ...(library ? { library } : {}),
@@ -127,6 +129,7 @@ export async function run(argv) {
127
129
  packages: packages.loaded.map((p) => p.package),
128
130
  lacked,
129
131
  fetch: true,
132
+ noLibrary: library === undefined,
130
133
  });
131
134
  const out = flagValue(argv, '-o') ?? defaultSourceOut(`${baseName(flow)}.flow.ts`);
132
135
  writeSource(out, stamped);
@@ -24,6 +24,13 @@ export interface FlowDecompileStamp {
24
24
  * library such a decompile saw.
25
25
  */
26
26
  fetch: boolean;
27
+ /**
28
+ * The decompile opened no library at all (the `no-library` token): nothing
29
+ * pulled or fetched, and fetching off. Such a decompile writes another source
30
+ * than one whose library lacks an operation, so `flow merge` decompiles the
31
+ * baseline with no library too.
32
+ */
33
+ noLibrary: boolean;
27
34
  }
28
35
  /** The stamp line, without a line terminator. */
29
36
  export declare function formatFlowStamp(stamp: FlowDecompileStamp): string;
@@ -32,6 +32,7 @@ export function formatFlowStamp(stamp) {
32
32
  ...(stamp.packages.length > 0 ? [`packages=${stamp.packages.join(',')}`] : []),
33
33
  ...(stamp.lacked.length > 0 ? [`lacked=${stamp.lacked.join(',')}`] : []),
34
34
  ...(stamp.fetch ? ['fetch'] : []),
35
+ ...(stamp.noLibrary ? ['no-library'] : []),
35
36
  ],
36
37
  });
37
38
  }
@@ -51,7 +52,7 @@ export function readFlowStamp(source) {
51
52
  if (read === undefined || 'error' in read)
52
53
  return read;
53
54
  const { line } = read;
54
- const stamp = { file: read.file, sha256: read.sha256, scripts: 'function', strict: false, packages: [], lacked: [], fetch: false };
55
+ const stamp = { file: read.file, sha256: read.sha256, scripts: 'function', strict: false, packages: [], lacked: [], fetch: false, noLibrary: false };
55
56
  const seen = new Set();
56
57
  for (const token of read.options) {
57
58
  const [key, value] = token.split('=', 2);
@@ -68,6 +69,8 @@ export function readFlowStamp(source) {
68
69
  stamp.lacked = value.split(',');
69
70
  else if (key === 'fetch' && value === undefined)
70
71
  stamp.fetch = true;
72
+ else if (key === 'no-library' && value === undefined)
73
+ stamp.noLibrary = true;
71
74
  else
72
75
  return { error: `unknown option \`${token}\`: ${line}` };
73
76
  }
@@ -517,6 +517,8 @@ export interface FlowFamilyCheckContext {
517
517
  * reports it, so a rule about it should stay silent rather than say it is missing.
518
518
  */
519
519
  versionUnresolved(step: string): boolean;
520
+ /** The options `check` was called with (the resource ledger among them). */
521
+ readonly options: CheckOpts;
520
522
  }
521
523
  export interface FlowContexts extends ArtifactContexts {
522
524
  serialize: FlowSerializeContext;
package/dist/merge-cli.js CHANGED
@@ -87,11 +87,12 @@ import { readFlowFile } from './decompile-file.js';
87
87
  import { readFlowStamp, restampFlowSource, sourceDigest, STAMP_MARKER } from './decompile-stamp.js';
88
88
  import { ensureTypeScriptRuntime } from './node-runtime.js';
89
89
  import { flowCheckOpts, openCliLibrary } from './cli-library.js';
90
+ import { hasPulledLibrary } from './core/cli-library.js';
90
91
  import { FETCHED_PROVENANCE } from './core/library.js';
91
92
  import { readNodeCatalog } from './node-catalog-files.js';
92
- import { flowConnectorRequests, hidesLacked } from './registry/fetch/flow-requests.js';
93
- import { fetchDefinitionsEnabled } from './registry/fetch/fetch-definitions.js';
94
- import { openWithFetchedDefinitions, withFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
93
+ import { flowConnectorRequests, hidesLacked, lacksNodeType } from './registry/fetch/flow-requests.js';
94
+ import { fetchableNodeType } from './registry/fetch/fetch-definitions.js';
95
+ import { fetchesDefinitions, openWithFetchedDefinitions, withFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
95
96
  import { Bindings } from './bindings.js';
96
97
  import { defaultBindingsFile } from './workdir.js';
97
98
  import { loadNodePackages } from './node-packages.js';
@@ -298,7 +299,7 @@ export async function run(argv) {
298
299
  ? openCliLibrary(argv, {
299
300
  always: true,
300
301
  hide,
301
- missNote: (nodeType) => (hidesLacked(lacked)({ nodeType })
302
+ missNote: (nodeType) => (lacksNodeType(lacked, nodeType)
302
303
  ? 'This source carries it from the file it was decompiled from; '
303
304
  + 'to compile a step against the tenant’s definition, decompile the original again.'
304
305
  : undefined),
@@ -347,7 +348,12 @@ export async function run(argv) {
347
348
  // Decompiled as the stamp records, so the baseline is built from the source the
348
349
  // author started from; without a stamp, with decompile's defaults.
349
350
  // The library decompile carried connector operations against: the one compile opens.
350
- const decompileOpts = { ...(stamp ? { scripts: stamp.scripts, strict: stamp.strict } : {}), ...(library ? { library } : {}) };
351
+ // A decompile that had no library at all is reproduced with none; both sides
352
+ // still compile against `library`.
353
+ const decompileLibrary = stamp?.noLibrary ? undefined : library;
354
+ // `library` is always named, `undefined` included: `baselineFromOriginal` sets the
355
+ // compile library first, and only an explicit key overrides it.
356
+ const decompileOpts = { ...(stamp ? { scripts: stamp.scripts, strict: stamp.strict } : {}), library: decompileLibrary };
351
357
  let baselineCompile;
352
358
  if (derivedFrom) {
353
359
  try {
@@ -372,7 +378,14 @@ export async function run(argv) {
372
378
  const packages = stamp.packages.length > 0 ? ', or a node-type package it loads,' : '';
373
379
  return refuseMerge('MERGE_ORIGINAL_CHANGED', `${name}${packages} changed since ${basename(editedPath)} was decompiled from ${stamp.file === name ? 'it' : stamp.file}: `
374
380
  + `decompiling it now gives a different source (sha256 ${stamp.sha256} recorded, ${actual} now). `
375
- + `Merging would read those changes as the edit's deletions and revert them, so nothing was written. ${redoAdvice(derivedFrom)}`);
381
+ + `Merging would read those changes as the edit's deletions and revert them, so nothing was written. `
382
+ // A stamp from before fetching existed, with no pulled library now: the
383
+ // library that decompile read may be what is gone, not the original.
384
+ + (preFetch && !hasPulledLibrary(argv)
385
+ ? 'This source was decompiled by an SDK that did not fetch through uip, likely against a pulled library that is no longer here: '
386
+ + 'pass it with --library (or run `uip maestro registry pull`), or decompile the original again. '
387
+ : '')
388
+ + redoAdvice(derivedFrom));
376
389
  }
377
390
  }
378
391
  const baselineSidecars = baselineCompile?.sidecars;
@@ -609,10 +622,12 @@ async function mergeLibrary(argv, originalPath, editedSource) {
609
622
  // edit added still says why it could not be fetched.
610
623
  const notes = new Map();
611
624
  const library = await openWithFetchedDefinitions(argv, flowConnectorRequests(original), { who: 'flow-merge', notes });
612
- if (editedSource === undefined || !fetchDefinitionsEnabled())
625
+ if (editedSource === undefined || !fetchesDefinitions(argv))
613
626
  return library;
614
627
  // A recording pass only, its result discarded: the merge compiles with the
615
628
  // library opened after it, which reads whatever it fetched.
616
629
  await withFetchedDefinitions(argv, (pass) => compileSourceDraftTolerant(editedSource, { library: pass, nodeCatalog: readNodeCatalog() }), { who: 'flow-merge', notes });
617
- return openWithFetchedDefinitions(argv, flowConnectorRequests(original), { who: 'flow-merge', notes });
630
+ // Opened only: both steps above asked for everything, and asking again for
631
+ // what the tenant does not serve would repeat the uip calls and the notes.
632
+ return openCliLibrary(argv, { always: true, missNote: (nodeType) => notes.get(fetchableNodeType(nodeType)) });
618
633
  }
@@ -425,13 +425,19 @@ const connector10 = {
425
425
  deserialize: (node, ctx) => liftConnector(node, ctx),
426
426
  isDraft: (node, definition) => isConnectorDraft(node, definition),
427
427
  // An operation the decompile's library has no entry for is carried from the
428
- // file, when its saved detail describes one compile can rebuild.
428
+ // file, when its saved detail describes one compile can rebuild. Per object: a
429
+ // generic operation held for another object still lacks this one, as the
430
+ // stamp's `lacked=` records it.
429
431
  carriesFromFile: (node, library) => {
430
432
  const n = node;
431
- if (typeof n.type !== 'string' || splitOperation(n.type) === undefined || library.indexes(n.type))
433
+ if (typeof n.type !== 'string' || splitOperation(n.type) === undefined)
432
434
  return false;
433
435
  const detail = n.inputs?.detail;
434
- return !!detail && typeof detail === 'object' && carriedOperationOf(detail) !== undefined;
436
+ if (!detail || typeof detail !== 'object')
437
+ return false;
438
+ if (library.indexes(n.type, liftedObject(detail)))
439
+ return false;
440
+ return carriedOperationOf(detail) !== undefined;
435
441
  },
436
442
  print: (spec, ctx) => printConnector(spec, ctx),
437
443
  check: (spec, ctx) => ctx.connector(spec),
@@ -11,3 +11,17 @@ export declare function checkWrite(inputs: DataFabricDeleteInputs, ctx: FlowChec
11
11
  * selector, so they share the check: the step must be a read, and not a list.
12
12
  */
13
13
  export declare function checkFromRead(placements: readonly Placement[], ctx: FlowFamilyCheckContext): void;
14
+ /**
15
+ * DATAFABRIC_LONG_TEXT_PREVIEW: a write whose value is a long-text column read
16
+ * from a native Data Fabric step.
17
+ *
18
+ * Every native path that publishes a record — a read (one or many, `Id` filter
19
+ * included) and a create's own output — is a Data Service QUERY, and a query
20
+ * returns a long-text value as its first 10,000 characters plus
21
+ * `...[Truncated]`, with no flag (#954: 15,551 characters written, 10,014 read
22
+ * back). Writing that value into a create or an update stores the cut text over
23
+ * the whole one, and the run passes. Only the column's type says it can happen,
24
+ * so the rule needs the schema `prepare --entity` records for the SOURCE step's
25
+ * entity (#1980). A warning: a value that is in fact short is written whole.
26
+ */
27
+ export declare function checkLongTextWriteback(placements: readonly Placement[], ctx: FlowFamilyCheckContext): void;
@@ -7,6 +7,7 @@
7
7
  import { entityPrepareCommand, } from '../../../core/resource-resolution.js';
8
8
  import { Expr } from '../../../core/expr.js';
9
9
  import { nearestName } from '../../../core/edit-distance.js';
10
+ import { prepareCommand } from '../../../core/cli-spelling.js';
10
11
  import { entityField, recordedEntitySchema, } from '../../../core/entity-schema.js';
11
12
  export const DATA_FABRIC_DIAGNOSTICS = {
12
13
  DATAFABRIC_NO_ENTITY: { severity: 'error', summary: 'a verb names no entity' },
@@ -28,6 +29,7 @@ export const DATA_FABRIC_DIAGNOSTICS = {
28
29
  DATAFABRIC_CHOICE_WRITE_VALUE: { severity: 'warning', summary: "a choice-set write literal that is not one of the set's numberIds" },
29
30
  DATAFABRIC_NULL_REQUIRED: { severity: 'error', summary: 'an update that blanks a non-nullable column' },
30
31
  DATAFABRIC_REQUIRED_MISSING: { severity: 'error', summary: 'a create that leaves a mandatory column out' },
32
+ DATAFABRIC_LONG_TEXT_PREVIEW: { severity: 'warning', summary: 'a long-text value read from a Data Fabric step written back' },
31
33
  };
32
34
  function checkEntity(inputs, ctx) {
33
35
  // An object is `{ name, folder }`, whose shape the serializer judges
@@ -385,3 +387,66 @@ function checkValue(field, value, where, operator, schema, ctx) {
385
387
  : 'Data Fabric rejects the value and the engine only logs the rejection, so the write runs green without it.')
386
388
  + provenance(schema), `a literal like ${shape.example}, or an expression that produces one`);
387
389
  }
390
+ // ─── Long text written back (#954) ─────────────────────────────────────────────
391
+ /** The length a Data Service query cuts a long-text value to, before it appends `...[Truncated]`. */
392
+ const PREVIEW_LENGTH = 10_000;
393
+ /**
394
+ * A long-text column whose value can be longer than the query preview:
395
+ * `MULTILINE_TEXT` above 10,000 characters, or `MULTILINE_MAX`.
396
+ */
397
+ function previewedColumn(field) {
398
+ return field.type.startsWith('MULTILINE') && (field.lengthLimit === undefined || field.lengthLimit > PREVIEW_LENGTH);
399
+ }
400
+ /** `$vars.<step>.output.<field>`, `.output[0].<field>` and `.output.results[i].<field>`, as `[step, field]`. */
401
+ const OUTPUT_FIELD = /\$vars\.([A-Za-z_$][\w$]*)\.output(?:\.results)?(?:\[[^\]]*\])?\.([A-Za-z_$][\w$]*)/g;
402
+ /**
403
+ * DATAFABRIC_LONG_TEXT_PREVIEW: a write whose value is a long-text column read
404
+ * from a native Data Fabric step.
405
+ *
406
+ * Every native path that publishes a record — a read (one or many, `Id` filter
407
+ * included) and a create's own output — is a Data Service QUERY, and a query
408
+ * returns a long-text value as its first 10,000 characters plus
409
+ * `...[Truncated]`, with no flag (#954: 15,551 characters written, 10,014 read
410
+ * back). Writing that value into a create or an update stores the cut text over
411
+ * the whole one, and the run passes. Only the column's type says it can happen,
412
+ * so the rule needs the schema `prepare --entity` records for the SOURCE step's
413
+ * entity (#1980). A warning: a value that is in fact short is written whole.
414
+ */
415
+ export function checkLongTextWriteback(placements, ctx) {
416
+ for (const p of placements) {
417
+ if (p.kind !== 'dataFabricUpdate' && p.kind !== 'dataFabricCreate')
418
+ continue;
419
+ const inputs = p.spec.inputs;
420
+ const option = p.kind === 'dataFabricUpdate' ? 'set' : 'values';
421
+ const values = (p.kind === 'dataFabricUpdate' ? inputs?.set : inputs?.values) ?? {};
422
+ for (const [column, value] of Object.entries(values)) {
423
+ if (!(value instanceof Expr))
424
+ continue;
425
+ for (const [, source, name] of value.js.matchAll(OUTPUT_FIELD)) {
426
+ const from = ctx.placementOf(source);
427
+ if (from?.kind !== 'dataFabricRead' && from?.kind !== 'dataFabricCreate')
428
+ continue;
429
+ const fromInputs = from.spec.inputs;
430
+ if (fromInputs?.entity === undefined)
431
+ continue;
432
+ const schema = recordedEntitySchema(ctx.options.resources, {
433
+ entity: fromInputs.entity, ...(fromInputs.folderKey !== undefined ? { folderKey: fromInputs.folderKey } : {}),
434
+ });
435
+ const field = schema && entityField(schema.fields, name);
436
+ if (field === undefined || !previewedColumn(field))
437
+ continue;
438
+ const entity = String(fromInputs.entity.name ?? fromInputs.entity);
439
+ ctx.report(p.step, 'DATAFABRIC_LONG_TEXT_PREVIEW', `"${p.step}" writes { ${option} } ${JSON.stringify(column)} from "${source}"'s ${JSON.stringify(name)}, a long-text `
440
+ + `(${field.type}${field.lengthLimit !== undefined ? `, up to ${field.lengthLimit} characters` : ''}) column of entity ${JSON.stringify(entity)}. `
441
+ + `A native Data Fabric ${from.kind === 'dataFabricRead' ? 'read' : 'create'} publishes the record as a query returns it, `
442
+ + `which cuts a long-text value to its first ${PREVIEW_LENGTH.toLocaleString('en-US')} characters and appends "...[Truncated]", with no flag — `
443
+ + 'so a longer value is written back cut, and the run passes.', from.kind === 'dataFabricCreate'
444
+ ? `write the value "${source}" was given instead of its output`
445
+ // The operation is not in the shipped library and its fields depend
446
+ // on `entityName`, so the connector call needs its prepare first.
447
+ : `read the record whole: run ${prepareCommand('uipath-uipath-dataservice', 'get-entity-record-by-id', '-f', `entityName=${entity}`)}, `
448
+ + `then connector('uipath-uipath-dataservice', 'get-entity-record-by-id', { entityName: '${entity}', recordId: … }, BIND), and write from that step`);
449
+ }
450
+ }
451
+ }
452
+ }
@@ -1,9 +1,12 @@
1
- import { checkFromRead, DATA_FABRIC_DIAGNOSTICS } from './check.js';
1
+ import { checkFromRead, checkLongTextWriteback, DATA_FABRIC_DIAGNOSTICS } from './check.js';
2
2
  import { dataFabricCreate, dataFabricDelete, dataFabricRead, dataFabricUpdate } from './verbs.js';
3
3
  export const dataFabricFlowFamily = {
4
4
  id: 'data-fabric',
5
5
  title: 'Data Fabric',
6
6
  types: [dataFabricRead, dataFabricCreate, dataFabricUpdate, dataFabricDelete],
7
7
  diagnostics: DATA_FABRIC_DIAGNOSTICS,
8
- check: checkFromRead,
8
+ check: (placements, ctx) => {
9
+ checkFromRead(placements, ctx);
10
+ checkLongTextWriteback(placements, ctx);
11
+ },
9
12
  };
@@ -8,8 +8,16 @@ export interface FetchConnectorsOptions {
8
8
  client?: UipClient;
9
9
  reporter?: Reporter;
10
10
  timeoutMs?: number;
11
+ /** Parallel catalog lookups. */
12
+ concurrency?: number;
11
13
  /** Node types not to fetch: the ones a library layer already holds. */
12
14
  skip?: (nodeType: string) => boolean;
15
+ /**
16
+ * Regenerate the typed `<key>.ts` modules (the default, for `pull`). A
17
+ * decompile or merge passes `false`: it names an operation by strings, and must
18
+ * not rewrite a module the author edited or `prepare --import` wrote.
19
+ */
20
+ modules?: boolean;
13
21
  }
14
22
  export interface FetchConnectorsResult extends FetchDefinitionsResult {
15
23
  /** Connector keys the tenant's catalog lists nothing for, sorted. */