@uipath/solution-sdk 1.202.0-preview.137 → 1.202.0-preview.138

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.
package/dist/index.js CHANGED
@@ -8544,7 +8544,7 @@ class TextApiResponse {
8544
8544
  var package_default = {
8545
8545
  name: "@uipath/solution-sdk",
8546
8546
  license: "MIT",
8547
- version: "1.202.0-preview.137",
8547
+ version: "1.202.0-preview.138",
8548
8548
  repository: {
8549
8549
  type: "git",
8550
8550
  url: "https://github.com/UiPath/cli.git",
@@ -17901,4 +17901,4 @@ export {
17901
17901
  uploadOrOverwriteSolution
17902
17902
  };
17903
17903
 
17904
- //# debugId=0922D7C9641F03E864756E2164756E21
17904
+ //# debugId=CE11D385CFED5B9064756E2164756E21
@@ -16788,8 +16788,7 @@ class ToolsFactoryRepository {
16788
16788
  getProjectToolFactory(projectType) {
16789
16789
  const factory = this.projectFactoryMap.get(projectType);
16790
16790
  if (!factory) {
16791
- const known = [...this.projectFactoryMap.keys()].join(", ");
16792
- throw new Error(`Cannot pack project type '${projectType}': no packager is installed for it. ` + `Project types that can be packed: ${known || "none"}.`);
16791
+ throw new Error(`Cannot pack project type '${projectType}': no packager is installed for it.`);
16793
16792
  }
16794
16793
  return factory;
16795
16794
  }
@@ -32433,6 +32432,26 @@ async function findProjectFile2(projectDir) {
32433
32432
  null
32434
32433
  ];
32435
32434
  }
32435
+
32436
+ class ProjectManifestError extends Error {
32437
+ __projectManifestError = true;
32438
+ reason;
32439
+ constructor(message, reason) {
32440
+ super(message);
32441
+ this.name = "ProjectManifestError";
32442
+ this.reason = reason;
32443
+ }
32444
+ }
32445
+ function isProjectManifestError(error) {
32446
+ return !!error && typeof error === "object" && error.__projectManifestError === true;
32447
+ }
32448
+ function isMissingProjectTypeError(error) {
32449
+ return isProjectManifestError(error) && error.reason === "no-project-type";
32450
+ }
32451
+ function lastPathSegment(filePath) {
32452
+ const parts = filePath.split(/[/\\]/);
32453
+ return parts[parts.length - 1] ?? filePath;
32454
+ }
32436
32455
  async function readProjectFile(filePath, useProjectJson) {
32437
32456
  const fs7 = getFileSystem();
32438
32457
  const [readError, rawContent] = await catchError2(fs7.readFile(filePath, "utf-8"));
@@ -32442,7 +32461,7 @@ async function readProjectFile(filePath, useProjectJson) {
32442
32461
  const [parseError, content] = catchError2(() => JSON.parse(rawContent));
32443
32462
  if (parseError) {
32444
32463
  return [
32445
- new Error(`Invalid JSON in project file: ${parseError.message}`),
32464
+ new ProjectManifestError(`Invalid JSON in project file: ${parseError.message}`, "invalid-json"),
32446
32465
  null
32447
32466
  ];
32448
32467
  }
@@ -32457,7 +32476,16 @@ async function readProjectFile(filePath, useProjectJson) {
32457
32476
  }
32458
32477
  ];
32459
32478
  }
32460
- return [new Error(`ProjectType not found in ${filePath}`), null];
32479
+ if (lastPathSegment(filePath) === "uipath.json") {
32480
+ return [
32481
+ new ProjectManifestError(`${filePath} has no 'ProjectType'. A uipath.json is only read as a code-first Functions project, which also needs a 'functions' entry. Other project types are registered from project.uiproj or project.json, not from uipath.json.`, "no-project-type"),
32482
+ null
32483
+ ];
32484
+ }
32485
+ return [
32486
+ new ProjectManifestError(`ProjectType not found in ${filePath}`, "no-project-type"),
32487
+ null
32488
+ ];
32461
32489
  }
32462
32490
  return [null, { content, projectType: normalizeProjectType(projectType) }];
32463
32491
  }
@@ -33280,6 +33308,7 @@ async function resourceRefreshAsync(solutionPath = ".", options = {}) {
33280
33308
  }
33281
33309
  export {
33282
33310
  EntryPointSpecEnhancer,
33311
+ ProjectManifestError,
33283
33312
  addProjectArtifactsToSolutionAsync,
33284
33313
  applyEntryPointEnhancementAsync,
33285
33314
  assertSolutionManifest,
@@ -33293,6 +33322,8 @@ export {
33293
33322
  findProjectFile2 as findProjectFile,
33294
33323
  findResourceByKeyInRcs,
33295
33324
  findResourceInRcs,
33325
+ isMissingProjectTypeError,
33326
+ isProjectManifestError,
33296
33327
  normalizeFolderPath,
33297
33328
  readProjectFile,
33298
33329
  readSolutionFile,
@@ -33308,4 +33339,4 @@ export {
33308
33339
  writeSolutionFile
33309
33340
  };
33310
33341
 
33311
- //# debugId=A122757AB33BF19D64756E2164756E21
33342
+ //# debugId=BE6597D080D5AC2664756E2164756E21
@@ -32,6 +32,35 @@ export interface ParsedSolutionFile {
32
32
  * project.uiproj, project.json, then uipath.json (code-first JS/TS Functions).
33
33
  */
34
34
  export declare function findProjectFile(projectDir: string): Promise<[Error, null] | [null, ProjectFileInfo]>;
35
+ /**
36
+ * Which way the manifest was unusable. `invalid-json` is a syntax error in the
37
+ * file; `no-project-type` is a file that parsed but declares no type. Callers
38
+ * that add guidance need the difference — advice about the wrong manifest
39
+ * makes no sense for a file that is merely mistyped.
40
+ */
41
+ export type ProjectManifestErrorReason = "invalid-json" | "no-project-type";
42
+ /**
43
+ * The manifest was read but is not usable: bad JSON, or no `ProjectType` to
44
+ * act on. Distinct from the raw `fs.readFile` failure `readProjectFile` also
45
+ * returns (EACCES on a file that exists, say) — that one is a local
46
+ * filesystem problem, not bad input, and callers must not classify the two
47
+ * the same way. `__projectManifestError` lets callers duck-type across bundle
48
+ * boundaries where `instanceof` fails.
49
+ */
50
+ export declare class ProjectManifestError extends Error {
51
+ readonly __projectManifestError = true;
52
+ readonly reason: ProjectManifestErrorReason;
53
+ constructor(message: string, reason: ProjectManifestErrorReason);
54
+ }
55
+ /** True when `error` is a {@link ProjectManifestError}, duck-typed. */
56
+ export declare function isProjectManifestError(error: unknown): boolean;
57
+ /**
58
+ * True when the manifest parsed but names no `ProjectType`. Callers gate
59
+ * "this may be the wrong manifest" guidance on this rather than on the file
60
+ * name alone: a `uipath.json` with a JSON typo is a different problem and
61
+ * must keep the parse error as its only advice.
62
+ */
63
+ export declare function isMissingProjectTypeError(error: unknown): boolean;
35
64
  /**
36
65
  * Reads and parses a project manifest, extracting the project type.
37
66
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/solution-sdk",
3
3
  "license": "MIT",
4
- "version": "1.202.0-preview.137",
4
+ "version": "1.202.0-preview.138",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/UiPath/cli.git",
@@ -39,5 +39,5 @@
39
39
  "dist"
40
40
  ],
41
41
  "private": false,
42
- "gitHead": "bbb20a6d3501afc3435a92af9ae2e9f7ab2e34f6"
42
+ "gitHead": "46372d5c4c4ae9352e9457a99e9d5efc1890cb48"
43
43
  }