@uipath/packager-tool-webapp 1.204.0-preview.231 → 1.204.0-preview.234

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.
@@ -22,7 +22,7 @@
22
22
  * runtime.
23
23
  */
24
24
  export { describeActionApp } from "./describe-action-app.js";
25
- export { ACTION_SCHEMA_FILE_NAME, isActionApp, loadWebAppManifest, WEBAPP_MANIFEST_FILE_NAME, type WebAppManifestLoad, } from "./manifest-helpers.js";
26
- export { parseActionSchema } from "./parse.js";
25
+ export { ACTION_SCHEMA_FILE_NAME, isActionApp, loadWebAppManifest, readProjectName, WEBAPP_MANIFEST_FILE_NAME, type WebAppManifestLoad, } from "./manifest-helpers.js";
26
+ export { parseActionSchema, validateActionSchema } from "./parse.js";
27
27
  export { type JsonActionSchema, JsonActionSchemaValidator, JsonDataType, JsonFormatType, type JsonSchemaProperty, JsonSchemaPropertySchema, type ParsedActionPropertySchema, type ParsedActionSchema, VBDataType, VbArgumentCollectionType, VbArgumentDataTypeNamespace, } from "./types.js";
28
28
  export { WebAppContributingToolFactory } from "./webapp-contributing-tool-factory.js";
@@ -3,6 +3,9 @@ import { catchError as catchError2 } from "@uipath/common";
3
3
 
4
4
  // src/action-schema/manifest-helpers.ts
5
5
  import { catchError } from "@uipath/common";
6
+ import {
7
+ ProjectTool
8
+ } from "@uipath/solutionpackager-tool-core";
6
9
 
7
10
  // src/models/webapp-manifest.ts
8
11
  var WebAppVariantType;
@@ -62,6 +65,15 @@ function appSubTypeFor(manifest) {
62
65
  const row = SUBTYPE_BY_VARIANT[manifest?.type ?? "Coded" /* Coded */];
63
66
  return isActionApp(manifest) ? row.action : row.app;
64
67
  }
68
+ async function readProjectName(fs, projectDir, fallbackName) {
69
+ const uiprojPath = fs.path.join(projectDir, ProjectTool.ProjectFileName);
70
+ const [readError, raw] = await catchError(fs.readFile(uiprojPath, "utf-8"));
71
+ if (readError || !raw)
72
+ return fallbackName;
73
+ const [parseError, parsed] = catchError(() => JSON.parse(raw));
74
+ const name = parseError ? undefined : parsed?.Name;
75
+ return typeof name === "string" && name.length > 0 ? name : fallbackName;
76
+ }
65
77
 
66
78
  // src/action-schema/parse.ts
67
79
  import { z as z2 } from "zod";
@@ -157,10 +169,16 @@ var JsonActionSchemaValidator = z.object({
157
169
  });
158
170
 
159
171
  // src/action-schema/parse.ts
160
- function parseActionSchema(raw) {
172
+ function parseActionSchema(raw, appName) {
173
+ if (typeof appName !== "string" || appName.length === 0) {
174
+ throw new Error("parseActionSchema needs the app name to derive the schema key.");
175
+ }
161
176
  const parsed = JSON.parse(raw);
162
177
  const validated = validate(parsed);
163
- return transformToParsedSchema(validated);
178
+ return transformToParsedSchema(validated, appName);
179
+ }
180
+ function validateActionSchema(raw) {
181
+ transformSections(validate(JSON.parse(raw)));
164
182
  }
165
183
  function validate(schema) {
166
184
  try {
@@ -250,7 +268,7 @@ function transformProperty(path, name, propDef) {
250
268
  properties
251
269
  };
252
270
  }
253
- function transformToParsedSchema(schema) {
271
+ function transformSections(schema) {
254
272
  const transformSection = (section, sectionName) => section?.properties ? Object.keys(section.properties).map((name) => transformProperty(`${sectionName}.${name}`, name, section.properties[name])) : [];
255
273
  const outcomes = schema.outcomes?.properties ? Object.keys(schema.outcomes.properties).map((name) => ({
256
274
  name,
@@ -263,17 +281,22 @@ function transformToParsedSchema(schema) {
263
281
  version: 0
264
282
  })) : [];
265
283
  return {
266
- key: deterministicUuid("root"),
267
- version: 0,
268
- description: "Action Schema",
269
- id: `ID${deterministicUuid("root.id").replace(/-/g, "")}`,
270
- name: "ActionSchema",
271
284
  inputs: transformSection(schema.inputs, "inputs"),
272
285
  outputs: transformSection(schema.outputs, "outputs"),
273
286
  inOuts: transformSection(schema.inOuts, "inOuts"),
274
287
  outcomes
275
288
  };
276
289
  }
290
+ function transformToParsedSchema(schema, appName) {
291
+ return {
292
+ key: deterministicUuid(`root:${appName}`),
293
+ version: 0,
294
+ description: "Action Schema",
295
+ id: `ID${deterministicUuid(`root.id:${appName}`).replace(/-/g, "")}`,
296
+ name: "ActionSchema",
297
+ ...transformSections(schema)
298
+ };
299
+ }
277
300
 
278
301
  // src/action-schema/describe-action-app.ts
279
302
  var ARTEFACT_KIND_APP = "app";
@@ -331,7 +354,8 @@ async function describeActionApp(projectDir, fs) {
331
354
  ]
332
355
  };
333
356
  }
334
- const [parseError, parsed] = catchError2(() => parseActionSchema(raw));
357
+ const appName = await readProjectName(fs, projectDir, fs.path.basename(projectDir));
358
+ const [parseError, parsed] = catchError2(() => parseActionSchema(raw, appName));
335
359
  if (parseError) {
336
360
  return {
337
361
  projectSubType,
@@ -362,7 +386,7 @@ import {
362
386
  // src/webapp-tool.ts
363
387
  import {
364
388
  Path as Path5,
365
- ProjectTool,
389
+ ProjectTool as ProjectTool2,
366
390
  TemporaryStorageService,
367
391
  ToolErrorCodes,
368
392
  ToolResult
@@ -893,7 +917,7 @@ class VariantStrategyFactory {
893
917
  }
894
918
 
895
919
  // src/webapp-tool.ts
896
- class WebAppTool extends ProjectTool {
920
+ class WebAppTool extends ProjectTool2 {
897
921
  _temporaryStorage;
898
922
  _tempBuildFolder = null;
899
923
  constructor(fileSystem, logger) {
@@ -1057,7 +1081,9 @@ export {
1057
1081
  describeActionApp,
1058
1082
  isActionApp,
1059
1083
  loadWebAppManifest,
1060
- parseActionSchema
1084
+ parseActionSchema,
1085
+ readProjectName,
1086
+ validateActionSchema
1061
1087
  };
1062
1088
 
1063
- //# debugId=891902301953E23F64756E2164756E21
1089
+ //# debugId=E7C8B1E2C5B0339C64756E2164756E21
@@ -1,4 +1,4 @@
1
- import type { IFileSystem } from "@uipath/solutionpackager-tool-core";
1
+ import { type IFileSystem } from "@uipath/solutionpackager-tool-core";
2
2
  import { WEBAPP_MANIFEST_FILE_NAME, type WebAppManifest } from "../models/webapp-manifest.js";
3
3
  /**
4
4
  * Well-known file names owned by the AppV2 domain. `WEBAPP_MANIFEST_FILE_NAME`
@@ -43,3 +43,8 @@ export declare function isActionApp(manifest: WebAppManifest | null): boolean;
43
43
  * folder with no manifest is a legacy standalone coded app.
44
44
  */
45
45
  export declare function appSubTypeFor(manifest: WebAppManifest | null): string;
46
+ /**
47
+ * The name the solution gives this project's app resource: `Name` from
48
+ * `project.uiproj`, else `fallbackName`.
49
+ */
50
+ export declare function readProjectName(fs: IFileSystem, projectDir: string, fallbackName: string): Promise<string>;
@@ -4,5 +4,12 @@ import { type ParsedActionSchema } from "./types.js";
4
4
  * (not `crypto.randomUUID`) — the reconcile idempotency check and the BPMN
5
5
  * bindings that pin to those keys both depend on the same input producing
6
6
  * the same output. Throws on JSON / Zod / unsupported-type failures.
7
+ * The root key is also seeded with `appName`: the Apps service uses it as the
8
+ * app's action definition id, which must be unique per tenant.
7
9
  */
8
- export declare function parseActionSchema(raw: string): ParsedActionSchema;
10
+ export declare function parseActionSchema(raw: string, appName: string): ParsedActionSchema;
11
+ /**
12
+ * Runs every check `parseActionSchema` runs, without building the root key.
13
+ * Throws on JSON / Zod / unsupported-type failures.
14
+ */
15
+ export declare function validateActionSchema(raw: string): void;
@@ -92,3 +92,5 @@ export interface ParsedActionSchema {
92
92
  outcomes: ParsedActionPropertySchema[];
93
93
  version: number;
94
94
  }
95
+ /** The four argument sections of a `ParsedActionSchema`, without the root key and id. */
96
+ export type ParsedActionSections = Pick<ParsedActionSchema, "inputs" | "outputs" | "inOuts" | "outcomes">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/packager-tool-webapp",
3
- "version": "1.204.0-preview.231",
3
+ "version": "1.204.0-preview.234",
4
4
  "description": "UiPath WebApp tool implementation",
5
5
  "type": "module",
6
6
  "exports": {
@@ -26,5 +26,5 @@
26
26
  "@uipath/solutionpackager-tool-core": "1.204.0",
27
27
  "zod": "^4.3.6"
28
28
  },
29
- "gitHead": "a75cd0b4c6a30cd917a0ccf10a1b372e1df27d99"
29
+ "gitHead": "20760959da681d6401e58ee964314711cfb9bfde"
30
30
  }