@uipath/uipath-extensions-sdk 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +64 -14
  2. package/dist/adopt.d.ts +6 -0
  3. package/dist/adopt.js +462 -101
  4. package/dist/adopt.js.map +1 -1
  5. package/dist/cli.js +42 -7
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/build-check.d.ts +2 -2
  8. package/dist/commands/build-check.js +43 -18
  9. package/dist/commands/build-check.js.map +1 -1
  10. package/dist/commands/new.d.ts +1 -0
  11. package/dist/commands/new.js +44 -2
  12. package/dist/commands/new.js.map +1 -1
  13. package/dist/commands/pack.d.ts +12 -0
  14. package/dist/commands/pack.js +96 -30
  15. package/dist/commands/pack.js.map +1 -1
  16. package/dist/commands/submit.d.ts +41 -1
  17. package/dist/commands/submit.js +484 -23
  18. package/dist/commands/submit.js.map +1 -1
  19. package/dist/commands/upload.d.ts +4 -0
  20. package/dist/commands/upload.js +98 -26
  21. package/dist/commands/upload.js.map +1 -1
  22. package/dist/commands/validate-python.d.ts +15 -0
  23. package/dist/commands/validate-python.js +334 -0
  24. package/dist/commands/validate-python.js.map +1 -0
  25. package/dist/commands/validate.js +2 -1
  26. package/dist/commands/validate.js.map +1 -1
  27. package/dist/connector.d.ts +23 -0
  28. package/dist/connector.js +258 -0
  29. package/dist/connector.js.map +1 -0
  30. package/dist/github.d.ts +6 -0
  31. package/dist/github.js +12 -0
  32. package/dist/github.js.map +1 -1
  33. package/dist/index.d.ts +2 -2
  34. package/dist/index.js.map +1 -1
  35. package/dist/lib.d.ts +4 -1
  36. package/dist/lib.js +307 -27
  37. package/dist/lib.js.map +1 -1
  38. package/dist/pyproject.d.ts +1 -0
  39. package/dist/pyproject.js +16 -0
  40. package/dist/pyproject.js.map +1 -0
  41. package/dist/python-source.d.ts +25 -0
  42. package/dist/python-source.js +359 -0
  43. package/dist/python-source.js.map +1 -0
  44. package/dist/registrationFile.d.ts +10 -0
  45. package/dist/registrationFile.js +51 -1
  46. package/dist/registrationFile.js.map +1 -1
  47. package/dist/sourceWalk.d.ts +2 -1
  48. package/dist/sourceWalk.js +5 -3
  49. package/dist/sourceWalk.js.map +1 -1
  50. package/dist/symlinkProblem.d.ts +1 -0
  51. package/dist/symlinkProblem.js +25 -0
  52. package/dist/symlinkProblem.js.map +1 -0
  53. package/dist/verdict.d.ts +6 -0
  54. package/dist/verdict.js +13 -0
  55. package/dist/verdict.js.map +1 -0
  56. package/package.json +6 -2
@@ -0,0 +1,334 @@
1
+ import { constants } from "node:fs";
2
+ import { copyFile, lstat, mkdir, mkdtemp, rm, writeFile, } from "node:fs/promises";
3
+ import { tmpdir } from "node:os";
4
+ import { basename, dirname, join } from "node:path";
5
+ import { stripVTControlCharacters } from "node:util";
6
+ import { buildManifest, DEFAULT_POLICY, defaultExec, ICON_PATH, loadTemplate, PYTHON_AGENT_GATES, pythonFunctionArchiveProblems, pythonFunctionSecretFindings, readPackedEntries, readTomlFile, runGates, secretFindings, } from "@uipath/uipath-extensions-gates";
7
+ import { SaxesParser } from "saxes";
8
+ import { PythonFunctionError, packConfig, readJsonObject, readPythonFunctionSource, record, } from "../python-source.js";
9
+ import { withoutControls } from "../registrationFile.js";
10
+ import { UipMissingError } from "../uip.js";
11
+ const descriptorPath = "content/package-descriptor.json";
12
+ const packageGate = "python-function-package";
13
+ const authoringCheck = "python-function-release-policy";
14
+ const coreMetadata = /^(?:\.\/)?package\/services\/metadata\/core-properties\/[a-f0-9]+\.psmdcp$/i;
15
+ function result(id, messages) {
16
+ return {
17
+ id,
18
+ status: messages.length ? "fail" : "pass",
19
+ findings: messages.map((message) => ({
20
+ gate: id,
21
+ severity: "error",
22
+ message,
23
+ })),
24
+ };
25
+ }
26
+ function nuspecProblem(bytes, { name, version }) {
27
+ const invalid = "the package nuspec must be well-formed XML without a DTD";
28
+ const mismatch = "the package nuspec must match the Python project name and version";
29
+ try {
30
+ const xml = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
31
+ if (xml.includes("<!"))
32
+ return invalid;
33
+ const parser = new SaxesParser({ xmlns: true });
34
+ const path = [];
35
+ const values = new Map();
36
+ let field;
37
+ let wrongShape = false;
38
+ parser.on("opentag", (tag) => {
39
+ if (field !== undefined)
40
+ wrongShape = true;
41
+ path.push(tag);
42
+ if (tag.local !== "id" && tag.local !== "version")
43
+ return;
44
+ const [root, metadata] = path;
45
+ if (path.length !== 3 ||
46
+ root?.local !== "package" ||
47
+ metadata?.local !== "metadata" ||
48
+ root.uri !== metadata.uri ||
49
+ tag.uri !== root.uri ||
50
+ values.has(tag.local)) {
51
+ wrongShape = true;
52
+ return;
53
+ }
54
+ field = tag.local;
55
+ values.set(field, "");
56
+ });
57
+ parser.on("text", (text) => {
58
+ if (field !== undefined)
59
+ values.set(field, values.get(field) + text);
60
+ });
61
+ parser.on("closetag", () => {
62
+ if (path.length === 3)
63
+ field = undefined;
64
+ path.pop();
65
+ });
66
+ parser.write(xml).close();
67
+ return wrongShape ||
68
+ values.get("id") !== name ||
69
+ values.get("version") !== version
70
+ ? mismatch
71
+ : undefined;
72
+ }
73
+ catch {
74
+ return invalid;
75
+ }
76
+ }
77
+ function packageArchiveProblem(files, staged, source) {
78
+ const problems = [];
79
+ const seen = new Set();
80
+ const nuspec = `${source.name}.nuspec`;
81
+ for (const path of Object.keys(files)) {
82
+ const folded = path.replace(/^\.\//, "").toLowerCase();
83
+ if (seen.has(folded))
84
+ problems.push(`the package has two paths named ${path} ignoring case`);
85
+ seen.add(folded);
86
+ if (path !== nuspec &&
87
+ path !== "[Content_Types].xml" &&
88
+ path !== "_rels/.rels" &&
89
+ path !== descriptorPath &&
90
+ path !== "content/operate.json" &&
91
+ path !== "content/bindings_v2.json" &&
92
+ !coreMetadata.test(path) &&
93
+ !(path.startsWith("content/") &&
94
+ staged.snapshot.has(path.slice("content/".length)))) {
95
+ problems.push(`unexpected file in the Python function package: ${path}`);
96
+ }
97
+ }
98
+ for (const [path, bytes] of staged.snapshot) {
99
+ const packed = files[`content/${path}`];
100
+ if (!packed || !Buffer.from(bytes).equals(packed)) {
101
+ problems.push(`packed ${path} is missing or differs from the staged source`);
102
+ }
103
+ }
104
+ const metadataProblem = nuspecProblem(files[nuspec], source);
105
+ if (metadataProblem !== undefined)
106
+ problems.push(metadataProblem);
107
+ try {
108
+ problems.push(...pythonFunctionArchiveProblems(files, {
109
+ projectId: staged.config.id,
110
+ functionName: source.functionName,
111
+ }));
112
+ }
113
+ catch (error) {
114
+ throw new PythonFunctionError(error.message);
115
+ }
116
+ return problems;
117
+ }
118
+ async function stageSource(source, root) {
119
+ const config = packConfig(readJsonObject(source.files.get("uipath.json"), "uipath.json"));
120
+ if (typeof config.id !== "string" ||
121
+ !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(config.id)) {
122
+ throw new PythonFunctionError("uipath.json needs a project ID; run uip function init first");
123
+ }
124
+ const bindings = readJsonObject(source.files.get("bindings.json"), "bindings.json");
125
+ if (!Array.isArray(bindings.resources) || bindings.resources.length !== 0) {
126
+ throw new PythonFunctionError("Python functions must have no resource bindings");
127
+ }
128
+ // The original source has already passed the scanner. The native packer
129
+ // normalizes CRLF and lone CR. Latin-1 keeps every other byte unchanged.
130
+ const snapshot = new Map([...source.files].map(([path, bytes]) => [
131
+ path,
132
+ path === ICON_PATH
133
+ ? bytes
134
+ : Buffer.from(Buffer.from(bytes).toString("latin1").replace(/\r\n?/g, "\n"), "latin1"),
135
+ ]));
136
+ const configBytes = Buffer.from(`${JSON.stringify(config, null, 2)}\n`);
137
+ if (pythonFunctionSecretFindings("uipath.json", configBytes).length) {
138
+ throw new PythonFunctionError("uipath.json contains a possible credential");
139
+ }
140
+ snapshot.set("uipath.json", configBytes);
141
+ for (const [path, bytes] of snapshot) {
142
+ const dest = join(root, path);
143
+ await mkdir(dirname(dest), { recursive: true, mode: 0o700 });
144
+ await writeFile(dest, bytes, { flag: "wx", mode: 0o600 });
145
+ }
146
+ const nupkgPath = join(root, ".uipath", `${source.name}.${source.version}.nupkg`);
147
+ return { root, nupkgPath, config, snapshot };
148
+ }
149
+ function diagnosticSuffix(result) {
150
+ const text = withoutControls(stripVTControlCharacters(result.stderr.trim() || result.stdout.trim())).trim();
151
+ if (!text)
152
+ return "";
153
+ if (/:\/\/[^\s/]+@/.test(text) ||
154
+ secretFindings("tool-output.txt", Buffer.from(text)).length) {
155
+ return ": tool output omitted because it may contain a credential";
156
+ }
157
+ return text.length > 2000 ? `: ...${text.slice(-2000)}` : `: ${text}`;
158
+ }
159
+ async function requireMatchingLock(staged, exec) {
160
+ const pyproject = await readTomlFile(join(staged.root, "pyproject.toml"));
161
+ if ("error" in pyproject)
162
+ throw new PythonFunctionError(`pyproject.toml: ${pyproject.error}`);
163
+ const cutoff = record(record(pyproject.value.tool)?.uv)?.["exclude-newer"];
164
+ if (cutoff !== undefined &&
165
+ cutoff !== false &&
166
+ (typeof cutoff !== "string" || !cutoff.trim() || cutoff.includes("\0"))) {
167
+ throw new PythonFunctionError("[tool.uv] exclude-newer must be a nonempty string or false");
168
+ }
169
+ let checked;
170
+ try {
171
+ checked = await exec("uv", [
172
+ "lock",
173
+ "--check",
174
+ "--offline",
175
+ "--no-build",
176
+ "--no-config",
177
+ // Preserve only the project cutoff without loading ambient uv config.
178
+ ...(typeof cutoff === "string" ? [`--exclude-newer=${cutoff}`] : []),
179
+ "--no-python-downloads",
180
+ "--no-cache",
181
+ "--project",
182
+ staged.root,
183
+ ], { cwd: staged.root, timeout: 60_000 });
184
+ }
185
+ catch (error) {
186
+ if (error.code === "ENOENT") {
187
+ throw new PythonFunctionError("uv is required to check the Python lockfile");
188
+ }
189
+ throw error;
190
+ }
191
+ if (checked.timedOut)
192
+ throw new PythonFunctionError("the offline uv lock check timed out");
193
+ if (checked.code !== 0) {
194
+ throw new PythonFunctionError(`uv could not verify that uv.lock matches pyproject.toml; run uv lock and try again${diagnosticSuffix(checked)}`);
195
+ }
196
+ }
197
+ async function runPythonPack(staged, exec) {
198
+ let invoked;
199
+ try {
200
+ // The staged config includes the checked lock bytes; do not let the Python tool resolve dependencies.
201
+ invoked = await exec("uip", ["function", "pack", "--nolock"], {
202
+ cwd: staged.root,
203
+ timeout: 120_000,
204
+ });
205
+ }
206
+ catch (error) {
207
+ if (error.code === "ENOENT")
208
+ throw new UipMissingError();
209
+ throw error;
210
+ }
211
+ if (invoked.timedOut)
212
+ throw new PythonFunctionError("uip function pack timed out");
213
+ if (invoked.code !== 0) {
214
+ throw new PythonFunctionError(`uip function pack exited with code ${invoked.code}${diagnosticSuffix(invoked)}`);
215
+ }
216
+ if (!(await lstat(staged.nupkgPath).catch(() => undefined))?.isFile()) {
217
+ throw new PythonFunctionError("uip function pack returned without creating a fresh .nupkg; run uip function init first");
218
+ }
219
+ }
220
+ export async function validatePythonFunction(options) {
221
+ if (options.mode !== undefined && options.mode !== "local") {
222
+ throw new PythonFunctionError("Python function extensions are only validated locally; catalog checks are not enabled");
223
+ }
224
+ const source = await readPythonFunctionSource(options.projectDir);
225
+ const root = await mkdtemp(join(tmpdir(), "python-function-extension-"));
226
+ const cleanup = () => rm(root, { recursive: true, force: true });
227
+ try {
228
+ const staged = await stageSource(source, root);
229
+ const template = await loadTemplate(root);
230
+ const entrypoints = readJsonObject(source.files.get("entry-points.json"), "entry-points.json");
231
+ const first = Array.isArray(entrypoints.entryPoints) &&
232
+ record(entrypoints.entryPoints[0]);
233
+ if (!Array.isArray(entrypoints.entryPoints) ||
234
+ entrypoints.entryPoints.length !== 1 ||
235
+ !first ||
236
+ first.type !== "function" ||
237
+ first.filePath !== source.functionName ||
238
+ record(first.input)?.type !== "object" ||
239
+ record(first.output)?.type !== "object") {
240
+ throw new PythonFunctionError("entry-points.json must match the configured Python function; run uip function init again");
241
+ }
242
+ const manifest = buildManifest(template, first, source.version);
243
+ if (manifest.credential.inputs.length !== 0) {
244
+ throw new PythonFunctionError("Python function extensions do not support connection inputs yet");
245
+ }
246
+ const uv = PYTHON_AGENT_GATES.filter((gate) => gate.id === "uv-lockfile");
247
+ if (uv.length !== 1)
248
+ throw new PythonFunctionError("the Python dependency lock gate is unavailable");
249
+ const report = await runGates({
250
+ rootDir: root,
251
+ mode: "local",
252
+ manifest,
253
+ packageJson: undefined,
254
+ policy: DEFAULT_POLICY,
255
+ }, uv);
256
+ if (report.results.some(({ status }) => status !== "pass")) {
257
+ throw new PythonFunctionError(report.results
258
+ .flatMap(({ findings }) => findings)
259
+ .map(({ message }) => message)
260
+ .join("\n") || "the Python dependency lock check did not pass");
261
+ }
262
+ const exec = options.exec ?? defaultExec;
263
+ await requireMatchingLock(staged, exec);
264
+ await runPythonPack(staged, exec);
265
+ const archive = await readPackedEntries(staged.nupkgPath);
266
+ const problems = packageArchiveProblem(archive, staged, source);
267
+ const packed = {
268
+ kind: "function",
269
+ nupkgPath: staged.nupkgPath,
270
+ packageId: source.name,
271
+ version: source.version,
272
+ };
273
+ return {
274
+ packed,
275
+ entryPoint: source.functionName,
276
+ cleanup,
277
+ report: {
278
+ ...report,
279
+ results: [
280
+ ...report.results,
281
+ result(packageGate, problems),
282
+ {
283
+ id: authoringCheck,
284
+ status: "review",
285
+ findings: [
286
+ {
287
+ gate: authoringCheck,
288
+ severity: "review",
289
+ message: "Local package checks do not approve Python source, PyPI provenance, or catalog publishing.",
290
+ },
291
+ ],
292
+ },
293
+ ],
294
+ },
295
+ };
296
+ }
297
+ catch (error) {
298
+ await cleanup();
299
+ throw error;
300
+ }
301
+ }
302
+ export async function packPythonFunction(options) {
303
+ if (options.version !== undefined) {
304
+ throw new PythonFunctionError("change the Python package version in pyproject.toml and refresh uv.lock before packing");
305
+ }
306
+ const checked = await validatePythonFunction(options);
307
+ try {
308
+ const errors = checked.report.results.filter((gate) => gate.status === "fail");
309
+ if (errors.length) {
310
+ throw new PythonFunctionError(errors
311
+ .flatMap((gate) => gate.findings)
312
+ .map((finding) => finding.message)
313
+ .join("\n"));
314
+ }
315
+ const dir = join(options.projectDir, ".uipath");
316
+ await mkdir(dir, { recursive: true, mode: 0o700 });
317
+ if (!(await lstat(dir)).isDirectory())
318
+ throw new PythonFunctionError(".uipath must be a regular directory");
319
+ const nupkgPath = join(dir, basename(checked.packed.nupkgPath));
320
+ try {
321
+ await copyFile(checked.packed.nupkgPath, nupkgPath, constants.COPYFILE_EXCL);
322
+ }
323
+ catch (error) {
324
+ if (error.code !== "EEXIST")
325
+ throw error;
326
+ throw new PythonFunctionError("a package already exists at this version; move it away or bump the version before packing again");
327
+ }
328
+ return { ...checked.packed, nupkgPath };
329
+ }
330
+ finally {
331
+ await checked.cleanup();
332
+ }
333
+ }
334
+ //# sourceMappingURL=validate-python.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-python.js","sourceRoot":"","sources":["../../src/commands/validate-python.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EACL,QAAQ,EACR,KAAK,EACL,KAAK,EACL,OAAO,EACP,EAAE,EACF,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EACL,aAAa,EACb,cAAc,EACd,WAAW,EAKX,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,6BAA6B,EAC7B,4BAA4B,EAC5B,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,cAAc,GACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,WAAW,EAAmB,MAAM,OAAO,CAAC;AACrD,OAAO,EACL,mBAAmB,EAEnB,UAAU,EACV,cAAc,EACd,wBAAwB,EACxB,MAAM,GACP,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe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AC,IAAI,CAAC,QAAQ,CAAC;iBAChC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;iBACjC,IAAI,CAAC,IAAI,CAAC,CACd,CAAC;QACJ,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAChD,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE;YACnC,MAAM,IAAI,mBAAmB,CAAC,qCAAqC,CAAC,CAAC;QACvE,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAChE,IAAI,CAAC;YACH,MAAM,QAAQ,CACZ,OAAO,CAAC,MAAM,CAAC,SAAS,EACxB,SAAS,EACT,SAAS,CAAC,aAAa,CACxB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;gBAAE,MAAM,KAAK,CAAC;YACpE,MAAM,IAAI,mBAAmB,CAC3B,iGAAiG,CAClG,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC;IAC1C,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { defaultExec, } from "@uipath/uipath-extensions-gates";
2
+ import { allMet } from "../verdict.js";
2
3
  import { checkProject } from "./build-check.js";
3
4
  export async function validate(options) {
4
5
  const { packed, report } = await checkProject({
@@ -10,7 +11,7 @@ export async function validate(options) {
10
11
  return {
11
12
  report,
12
13
  manifestPath: packed.nupkgPath,
13
- ok: report.results.every((result) => result.status !== "fail"),
14
+ ok: allMet(report.results),
14
15
  };
15
16
  }
16
17
  //# sourceMappingURL=validate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAGZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAchD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,OAAwB;IAExB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC;QAC5C,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,WAAW;QACjC,IAAI,EAAE,OAAO;QACb,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,SAAS,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;KACvD,CAAC,CAAC;IACH,OAAO;QACL,MAAM;QACN,YAAY,EAAE,MAAM,CAAC,SAAS;QAC9B,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC;KAC/D,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAGZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAchD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,OAAwB;IAExB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC;QAC5C,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,WAAW;QACjC,IAAI,EAAE,OAAO;QACb,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,SAAS,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;KACvD,CAAC,CAAC;IACH,OAAO;QACL,MAAM;QACN,YAAY,EAAE,MAAM,CAAC,SAAS;QAC9B,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;KAC3B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { type ConnectorFile, type GateReport, isConnectorProject } from "@uipath/uipath-extensions-gates";
2
+ import type { AdoptPlan } from "./lib.js";
3
+ export { isConnectorProject };
4
+ export declare const CONNECTOR_NAME_PREFIX = "uipath-extensions.";
5
+ export declare function connectorPackageId(id: string | undefined): string;
6
+ export declare function withConnectorKey(files: ConnectorFile[], id: string): {
7
+ files: ConnectorFile[];
8
+ key: string;
9
+ changed: string[];
10
+ };
11
+ export declare function withConnectorVersion(files: ConnectorFile[], version: string): ConnectorFile[];
12
+ export declare function planConnectorAdopt(dir: string, id?: string): Promise<AdoptPlan>;
13
+ export declare function validateConnector(options: {
14
+ projectDir: string;
15
+ mode?: "local" | "ci" | "source";
16
+ archive?: Uint8Array;
17
+ expectedVersion?: string;
18
+ nodeId?: string;
19
+ previousVersions?: string[];
20
+ }): Promise<{
21
+ report: GateReport;
22
+ ok: boolean;
23
+ }>;
@@ -0,0 +1,258 @@
1
+ import { lstat, readFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { assetsProblem, CONNECTOR_DIR, CONNECTOR_ELEMENT, CONNECTOR_METADATA, ConnectorError, connectorFacts, connectorIdParts, connectorKeyFor, ICON_PATH, isConnectorProject, MANIFEST_FILE, MAX_DESCRIPTION_LENGTH, MAX_LABEL_LENGTH, MAX_TAG_LENGTH, MAX_TAGS, packageNameProblem, readConnectorFiles, readLibraryVersion, rewriteConnectorKey, runConnectorGates, secretFindings, } from "@uipath/uipath-extensions-gates";
4
+ import { DEFAULT_ICON_BASE64 } from "./defaultIcon.js";
5
+ import { exists } from "./exists.js";
6
+ import { allMet } from "./verdict.js";
7
+ export { isConnectorProject };
8
+ export const CONNECTOR_NAME_PREFIX = "uipath-extensions.";
9
+ const DEFAULT_LICENSE = "MIT";
10
+ const TAG_SEGMENT = /[^a-z0-9]+/g;
11
+ const TEMPLATE_PLACEHOLDER = "TODO";
12
+ const clip = (text, max) => {
13
+ const clipped = text.replace(/[<>]/g, "").trim().slice(0, max).trim();
14
+ return clipped === TEMPLATE_PLACEHOLDER ? "" : clipped;
15
+ };
16
+ function tagOf(category) {
17
+ const tag = category
18
+ .toLowerCase()
19
+ .replace(TAG_SEGMENT, "-")
20
+ .replace(/^-+|-+$/g, "")
21
+ .slice(0, MAX_TAG_LENGTH)
22
+ .replace(/-+$/g, "");
23
+ return tag === "" ? undefined : tag;
24
+ }
25
+ export function connectorPackageId(id) {
26
+ if (id === undefined || id.trim() === "") {
27
+ throw new ConnectorError("a connector has no package.json, so pass the node id as <publisher>.<name>");
28
+ }
29
+ connectorIdParts(id);
30
+ const packageId = `${CONNECTOR_NAME_PREFIX}${id.trim()}`;
31
+ const problem = packageNameProblem(packageId);
32
+ if (problem)
33
+ throw new ConnectorError(problem);
34
+ return packageId;
35
+ }
36
+ const decoder = new TextDecoder("utf-8", { fatal: true });
37
+ function keySources(files) {
38
+ try {
39
+ const { key, element } = connectorFacts(files);
40
+ const inner = typeof element.metadata === "object" &&
41
+ element.metadata !== null &&
42
+ !Array.isArray(element.metadata)
43
+ ? element.metadata.key
44
+ : undefined;
45
+ return [key, ...(typeof inner === "string" ? [inner] : [])];
46
+ }
47
+ catch (error) {
48
+ if (!(error instanceof ConnectorError))
49
+ throw error;
50
+ return [];
51
+ }
52
+ }
53
+ // Rewrites every copy of the connector's old key, and of its design- twin, to the key of the node id.
54
+ export function withConnectorKey(files, id) {
55
+ const key = connectorKeyFor(id);
56
+ let out = files;
57
+ const changed = new Set();
58
+ for (const from of keySources(files)) {
59
+ const step = rewriteConnectorKey(out, from, key);
60
+ out = step.files;
61
+ for (const path of step.changed)
62
+ changed.add(path);
63
+ }
64
+ return { files: out, key, changed: [...changed] };
65
+ }
66
+ const VERSION_FIELDS = {
67
+ [CONNECTOR_METADATA]: "latestVersion",
68
+ [CONNECTOR_ELEMENT]: "version",
69
+ };
70
+ const escaped = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
71
+ // Sets latestVersion, and the version element.json carries, as text edits that keep every other byte.
72
+ export function withConnectorVersion(files, version) {
73
+ return files.map((file) => {
74
+ const field = VERSION_FIELDS[file.path];
75
+ if (field === undefined)
76
+ return file;
77
+ let text;
78
+ let data;
79
+ try {
80
+ text = decoder.decode(file.content);
81
+ data = JSON.parse(text);
82
+ }
83
+ catch {
84
+ throw new ConnectorError(`${file.path} is not UTF-8 JSON`);
85
+ }
86
+ const current = typeof data === "object" && data !== null && !Array.isArray(data)
87
+ ? data[field]
88
+ : undefined;
89
+ if (current === undefined && field === "version")
90
+ return file;
91
+ if (typeof current !== "string") {
92
+ throw new ConnectorError(`${file.path} has no string ${field}`);
93
+ }
94
+ if (current === version)
95
+ return file;
96
+ const pattern = new RegExp(`("${field}"\\s*:\\s*)"${escaped(current)}"`, "g");
97
+ const count = text.match(pattern)?.length ?? 0;
98
+ if (count !== 1) {
99
+ throw new ConnectorError(`${file.path} holds ${count} "${field}" fields with the value ${JSON.stringify(current)}, so the version cannot be set. Set it to ${version} by hand`);
100
+ }
101
+ return {
102
+ ...file,
103
+ content: new TextEncoder().encode(text.replace(pattern, (_match, head) => `${head}"${version}"`)),
104
+ };
105
+ });
106
+ }
107
+ function reportExtraAssets(plan, files) {
108
+ const problem = assetsProblem([
109
+ ...files.map((file) => file.path),
110
+ ...plan.writes.map((write) => write.path),
111
+ ]);
112
+ if (problem !== undefined) {
113
+ plan.reports.push({ path: "assets/", problem: `is refused, ${problem}` });
114
+ }
115
+ }
116
+ export async function planConnectorAdopt(dir, id) {
117
+ const plan = {
118
+ writes: [],
119
+ reports: [],
120
+ errors: [],
121
+ generated: [],
122
+ };
123
+ const { files, problems } = await readConnectorFiles(dir);
124
+ for (const problem of problems) {
125
+ plan.reports.push({ path: CONNECTOR_DIR, problem });
126
+ }
127
+ if (id !== undefined) {
128
+ try {
129
+ connectorKeyFor(id);
130
+ }
131
+ catch (error) {
132
+ if (!(error instanceof ConnectorError))
133
+ throw error;
134
+ plan.errors.push(error.message);
135
+ }
136
+ }
137
+ if (plan.errors.length > 0)
138
+ return plan;
139
+ const hasIcon = await exists(join(dir, ICON_PATH));
140
+ const existing = await lstat(join(dir, MANIFEST_FILE)).catch(() => undefined);
141
+ if (existing !== undefined) {
142
+ if (existing.isFile())
143
+ await repairIcon(plan, dir, hasIcon);
144
+ reportExtraAssets(plan, files);
145
+ return plan;
146
+ }
147
+ let facts;
148
+ try {
149
+ facts = connectorFacts(files);
150
+ }
151
+ catch (error) {
152
+ if (!(error instanceof ConnectorError))
153
+ throw error;
154
+ plan.errors.push(error.message);
155
+ return plan;
156
+ }
157
+ const label = clip(facts.name, MAX_LABEL_LENGTH) || "Connector";
158
+ const description = clip(facts.description ?? "", MAX_DESCRIPTION_LENGTH) ||
159
+ `Integration Service connector for ${label}.`;
160
+ const tags = [
161
+ ...new Set(facts.categories
162
+ .map(tagOf)
163
+ .filter((tag) => tag !== undefined)),
164
+ ].slice(0, MAX_TAGS);
165
+ const template = {
166
+ schema: 2,
167
+ license: DEFAULT_LICENSE,
168
+ display: { label, description, icon: ICON_PATH },
169
+ tags,
170
+ };
171
+ const after = `${JSON.stringify(template, null, 2)}\n`;
172
+ if (secretFindings(MANIFEST_FILE, new TextEncoder().encode(after)).length > 0) {
173
+ plan.errors.push("the connector name, description or categories hold a secret-shaped value, so adopt wrote nothing. Edit element.json and element-metadata.json first");
174
+ return plan;
175
+ }
176
+ plan.writes.push({ path: MANIFEST_FILE, before: null, after });
177
+ plan.generated = [
178
+ ...(plan.generated ?? []),
179
+ { field: "license", value: DEFAULT_LICENSE },
180
+ { field: "display.label", value: label },
181
+ { field: "display.description", value: description },
182
+ { field: "tags", value: JSON.stringify(tags) },
183
+ { field: "display.icon", value: ICON_PATH },
184
+ ];
185
+ if (!hasIcon) {
186
+ plan.writes.push(defaultIconWrite());
187
+ plan.generated.push(defaultIconGenerated());
188
+ }
189
+ reportExtraAssets(plan, files);
190
+ return plan;
191
+ }
192
+ const defaultIconWrite = () => ({
193
+ path: ICON_PATH,
194
+ before: null,
195
+ after: DEFAULT_ICON_BASE64,
196
+ encoding: "base64",
197
+ });
198
+ const defaultIconGenerated = () => ({
199
+ field: ICON_PATH,
200
+ value: "a default icon, replace it with your own",
201
+ });
202
+ async function repairIcon(plan, dir, hasIcon) {
203
+ const text = await readFile(join(dir, MANIFEST_FILE), "utf8").catch(() => undefined);
204
+ if (text === undefined)
205
+ return;
206
+ let template;
207
+ try {
208
+ template = JSON.parse(text);
209
+ }
210
+ catch {
211
+ return;
212
+ }
213
+ if (typeof template !== "object" ||
214
+ template === null ||
215
+ Array.isArray(template)) {
216
+ return;
217
+ }
218
+ const record = template;
219
+ const display = record.display;
220
+ if (record.schema !== 2 ||
221
+ typeof display !== "object" ||
222
+ display === null ||
223
+ Array.isArray(display) ||
224
+ display.icon !== undefined) {
225
+ return;
226
+ }
227
+ plan.writes.push({
228
+ path: MANIFEST_FILE,
229
+ before: text,
230
+ after: `${JSON.stringify({ ...record, display: { ...display, icon: ICON_PATH } }, null, 2)}\n`,
231
+ });
232
+ const generated = plan.generated ?? [];
233
+ generated.push({ field: "display.icon", value: ICON_PATH });
234
+ if (!hasIcon) {
235
+ plan.writes.push(defaultIconWrite());
236
+ generated.push(defaultIconGenerated());
237
+ }
238
+ plan.generated = generated;
239
+ }
240
+ export async function validateConnector(options) {
241
+ const report = await runConnectorGates({
242
+ rootDir: options.projectDir,
243
+ mode: options.mode ?? "local",
244
+ ...(options.archive && { archive: options.archive }),
245
+ ...(options.expectedVersion !== undefined && {
246
+ expectedVersion: options.expectedVersion,
247
+ }),
248
+ ...(options.nodeId !== undefined && { nodeId: options.nodeId }),
249
+ ...(options.previousVersions !== undefined && {
250
+ previousVersions: options.previousVersions,
251
+ }),
252
+ }, readLibraryVersion());
253
+ return {
254
+ report,
255
+ ok: allMet(report.results),
256
+ };
257
+ }
258
+ //# sourceMappingURL=connector.js.map