@uipath/packager-tool-functions 1.206.0-preview.299 → 1.206.1-preview.301

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.
@@ -7,11 +7,11 @@ those licences require.
7
7
 
8
8
  1 bundled dependency:
9
9
 
10
- - @uipath/coded-functions-js-packager@0.1.12 — SEE LICENSE IN LICENSE.txt
10
+ - @uipath/coded-functions-js-packager@0.2.1 — SEE LICENSE IN LICENSE.txt
11
11
 
12
12
  ---
13
13
 
14
- ## @uipath/coded-functions-js-packager@0.1.12
14
+ ## @uipath/coded-functions-js-packager@0.2.1
15
15
 
16
16
  SPDX: SEE LICENSE IN LICENSE.txt
17
17
 
package/dist/index.js CHANGED
@@ -105,6 +105,14 @@ function ifsProjectFileReader(fs, projectPath) {
105
105
  }
106
106
  };
107
107
  }
108
+ var TARGET_RUNTIMES = new Set(["javascript", "javascript-server"]);
109
+ function parseUipathJson(raw) {
110
+ const uipathJson = JSON.parse(raw);
111
+ if (uipathJson.targetRuntime !== undefined && !TARGET_RUNTIMES.has(uipathJson.targetRuntime)) {
112
+ throw new Error(`uipath.json sets targetRuntime "${uipathJson.targetRuntime}". Set it to "javascript" or "javascript-server".`);
113
+ }
114
+ return uipathJson;
115
+ }
108
116
  var EXCLUDED_NAMES = new Set([
109
117
  "node_modules",
110
118
  ".git",
@@ -124,7 +132,7 @@ async function buildFunctionsPackage(fs, options) {
124
132
  if (!uipathJsonRaw) {
125
133
  throw new Error("uipath.json not found. Run 'uipath-functions init' first.");
126
134
  }
127
- const uipathJson = JSON.parse(uipathJsonRaw);
135
+ const uipathJson = parseUipathJson(uipathJsonRaw);
128
136
  const entryPointsRaw = await fs.readFile(fs.path.join(projectPath, "entry-points.json"), "utf-8");
129
137
  if (!entryPointsRaw) {
130
138
  throw new Error("entry-points.json not found. Run 'uipath-functions pack' to generate it.");
@@ -137,7 +145,9 @@ async function buildFunctionsPackage(fs, options) {
137
145
  const bindings = JSON.parse(bindingsRaw);
138
146
  const packageJsonRaw = await fs.readFile(fs.path.join(projectPath, "package.json"), "utf-8");
139
147
  const packageDependencies = packageJsonRaw ? JSON.parse(packageJsonRaw).dependencies ?? {} : {};
140
- const targetRuntime = detectRuntime(uipathJson.functions);
148
+ const targetRuntime = uipathJson.targetRuntime ?? "javascript";
149
+ if (targetRuntime === "javascript-server")
150
+ assertEveryFunctionRouted(entryPoints, bindings);
141
151
  const detection = detectPackageManager(await probeLockFiles(ifsProjectFileReader(fs, projectPath)));
142
152
  if (detection.kind !== "found") {
143
153
  const { problem, remedyCommand } = describeDependencyProblem(detection);
@@ -181,17 +191,12 @@ async function buildFunctionsPackage(fs, options) {
181
191
  }
182
192
  await fs.writeFile(fs.path.join(contentPath, "package-descriptor.json"), JSON.stringify(packageDescriptor, null, 2));
183
193
  }
184
- function detectRuntime(functions) {
185
- if (!functions)
186
- return "javascript";
187
- const first = Object.values(functions)[0];
188
- if (!first)
189
- return "javascript";
190
- const filePath = first.split(":")[0] ?? "";
191
- const ext = filePath.slice(filePath.lastIndexOf("."));
192
- if (ext === ".py")
193
- return "python";
194
- return "javascript";
194
+ function assertEveryFunctionRouted(entryPoints, bindings) {
195
+ const routed = new Set(bindings.resources.filter((r) => r.resource === "HttpTrigger").map((r) => r.value?.EntryPointUniqueId?.DefaultValue));
196
+ const unrouted = entryPoints.entryPoints.filter((ep) => ep.type === "function" && !routed.has(ep.uniqueId));
197
+ if (unrouted.length > 0) {
198
+ throw new Error(`uipath.json sets targetRuntime "javascript-server", which serves every function over HTTP, but ` + `these functions have no method and path: ${unrouted.map((ep) => ep.filePath).join(", ")}. Give each ` + `a method and a path, or set targetRuntime to "javascript".`);
199
+ }
195
200
  }
196
201
  async function copyProjectFiles(fs, sourcePath, destPath, lockFile, packOptions) {
197
202
  const extraExcludedDirs = new Set(packOptions?.directoriesExcluded ?? []);
@@ -597,4 +602,4 @@ export {
597
602
  languageFromFunctionsMap
598
603
  };
599
604
 
600
- //# debugId=E8D8AF5256EEC3C664756E2164756E21
605
+ //# debugId=83B765F3B0AD704764756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/packager-tool-functions",
3
- "version": "1.206.0-preview.299",
3
+ "version": "1.206.1-preview.301",
4
4
  "description": "UiPath Functions tool implementation",
5
5
  "type": "module",
6
6
  "exports": {
@@ -24,5 +24,5 @@
24
24
  "peerDependencies": {
25
25
  "@uipath/solutionpackager-tool-core": "1.206.0"
26
26
  },
27
- "gitHead": "7747c1e464d7283806f4d9e331b28f9877cc856d"
27
+ "gitHead": "078afc3ef7ebf4c38353ee0059e321acf16a350d"
28
28
  }