@uipath/solution-tool 1.205.0-preview.281 → 1.206.0-preview.282

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 (132) hide show
  1. package/dist/{archive-extract-x35t9ktj.js → archive-extract-136rn3ja.js} +13 -15
  2. package/dist/{cleanup-command-service-je9d70vv.js → cleanup-command-service-kadmvyk4.js} +34 -31
  3. package/dist/deploy-delete-service-xa25k94p.js +23 -0
  4. package/dist/deploy-run-service-rsedb9hr.js +23 -0
  5. package/dist/{deploy-status-service-919yn8wn.js → deploy-status-service-nmm8k9fa.js} +72 -62
  6. package/dist/deploy.js +35 -37
  7. package/dist/deployment-search-wtbye8v6.js +54 -0
  8. package/dist/{embedded-file-reader-z4becc02.js → embedded-file-reader-0228j82a.js} +1 -4
  9. package/dist/feed-resolver-28pfxmky.js +27 -0
  10. package/dist/feed-scope-failure-d4avsc7j.js +20 -0
  11. package/dist/feed-session-4skrr620.js +23 -0
  12. package/dist/first-party-service-n3vva2m4.js +8 -0
  13. package/dist/governance-options-bevmhh1z.js +19 -0
  14. package/dist/index-aspmac9f.js +24 -0
  15. package/dist/index-md8d2ttf.js +60 -0
  16. package/dist/{index-sby22td6.js → index-nzr4mx5p.js} +2 -22
  17. package/dist/index-qq4kre7a.js +93 -0
  18. package/dist/index-t262f2xv.js +16 -0
  19. package/dist/index.js +33 -34
  20. package/dist/init.js +18 -21
  21. package/dist/{jmespath-231m3hyn.js → jmespath-ab6tdc42.js} +1 -1
  22. package/dist/{js-yaml-88tdqrtd.js → js-yaml-a2bk27p6.js} +1 -3
  23. package/dist/{list-5fke71jn.js → list-pnggwekk.js} +23 -23
  24. package/dist/models/pack-command-types.d.ts +3 -1
  25. package/dist/node-z9c03k2q.js +25 -0
  26. package/dist/pack-command-service-2txx876d.js +29 -0
  27. package/dist/{pack-project-ha0pxw3h.js → pack-project-ngwtfgge.js} +33 -40
  28. package/dist/pack.js +26 -30
  29. package/dist/package-id-350pep6r.js +11 -0
  30. package/dist/{packager-tool-5qzgdb66.js → packager-tool-0k205evy.js} +13 -15
  31. package/dist/{packager-tool-wm0jaz7p.js → packager-tool-0vz19vhv.js} +305 -657
  32. package/dist/{packager-tool-gs3f3tf7.js → packager-tool-1ctvbx0h.js} +1 -1
  33. package/dist/{packager-tool-h1tq7bqf.js → packager-tool-41a5axkd.js} +65 -35
  34. package/dist/packager-tool-8097ps72.js +2307 -0
  35. package/dist/{packager-tool-1ybnxbp9.js → packager-tool-85f75be3.js} +18 -18
  36. package/dist/{packager-tool-tx834spe.js → packager-tool-9vrwpgt3.js} +757 -309
  37. package/dist/{packager-tool-pbmqk39a.js → packager-tool-a7s0gbxs.js} +33 -28
  38. package/dist/{packager-tool-47wzvqw0.js → packager-tool-aws5w512.js} +6 -6
  39. package/dist/packager-tool-c64hqa8n.js +106 -0
  40. package/dist/{packager-tool-5ddtwzva.js → packager-tool-ca5ngmqv.js} +12 -12
  41. package/dist/{packager-tool-d78ww4hb.js → packager-tool-cp66jc40.js} +51 -48
  42. package/dist/{packager-tool-6kz1pv9f.js → packager-tool-d1texmvn.js} +828 -338
  43. package/dist/{packager-tool-cvf46scg.js → packager-tool-daphtc6e.js} +122 -89
  44. package/dist/{packager-tool-1de529jm.js → packager-tool-epsr41wx.js} +12 -3
  45. package/dist/packager-tool-f84z7nds.js +130 -0
  46. package/dist/{packager-tool-45a8fkw0.js → packager-tool-fgk0fkm5.js} +37 -39
  47. package/dist/{packager-tool-8ptbmmmp.js → packager-tool-fp46ebde.js} +147 -76
  48. package/dist/{packager-tool-3bwnkjdq.js → packager-tool-fx4ws49n.js} +12 -12
  49. package/dist/{packager-tool-4pa108k7.js → packager-tool-g8ghm6wk.js} +11 -11
  50. package/dist/{packager-tool-2t72aez8.js → packager-tool-gpcr8zxf.js} +15 -15
  51. package/dist/packager-tool-gqb9ytg9.js +290 -0
  52. package/dist/packager-tool-hrkvdw31.js +280 -0
  53. package/dist/{packager-tool-056k8w2f.js → packager-tool-hs1kjv0c.js} +75 -9
  54. package/dist/{packager-tool-2vmz56qh.js → packager-tool-jatbb6c5.js} +184 -33
  55. package/dist/{packager-tool-f23a485e.js → packager-tool-jfp5mvqm.js} +176 -196
  56. package/dist/{packager-tool-6ybywxxn.js → packager-tool-m07vyk89.js} +371 -221
  57. package/dist/{packager-tool-61pwb567.js → packager-tool-ppj5f4y7.js} +6 -7
  58. package/dist/{packager-tool-t8gh825q.js → packager-tool-qf8753ee.js} +53 -41
  59. package/dist/{packager-tool-60af1hw2.js → packager-tool-qzcd5c9s.js} +3 -3
  60. package/dist/packager-tool-rb06drad.js +1178 -0
  61. package/dist/packager-tool-resolver-td3bhccd.js +20 -0
  62. package/dist/{packager-tool-dfrk01gn.js → packager-tool-rj2d1g0w.js} +154 -154
  63. package/dist/{packager-tool-43ahv5mn.js → packager-tool-t39pjz7n.js} +35 -18
  64. package/dist/{packager-tool-v1f5e8t9.js → packager-tool-vgrswa8p.js} +53 -8
  65. package/dist/{packager-tool-gyqfs04e.js → packager-tool-vq5fwggb.js} +273 -255
  66. package/dist/{packager-tool-gmwva4yv.js → packager-tool-vx2c68sb.js} +2 -2
  67. package/dist/{packager-tool-b2nhscfk.js → packager-tool-wm8nj6e9.js} +18 -18
  68. package/dist/{packager-tool-amhyxzz6.js → packager-tool-x33sdw6n.js} +16 -16
  69. package/dist/{packager-tool-97rcgwvv.js → packager-tool-x461tgwy.js} +331 -55
  70. package/dist/{packager-tool-dnrk1gg6.js → packager-tool-y6efv1f8.js} +356 -298
  71. package/dist/{packager-tool-wy4fx250.js → packager-tool-yetmzme9.js} +89 -30
  72. package/dist/packager-tool-z45eej6s.js +74 -0
  73. package/dist/packager-tool.js +6 -7
  74. package/dist/prepare-solution-resources-pwnyvtza.js +26 -0
  75. package/dist/{project-command-utils-t6pmpvq3.js → project-command-utils-zcmbecfy.js} +23 -26
  76. package/dist/project-contributions-kh9yftvg.js +27 -0
  77. package/dist/publish.js +17 -17
  78. package/dist/resource-mutations-mfn5k1hb.js +27 -0
  79. package/dist/{resource-version-lookup-0e3e2j58.js → resource-version-lookup-6ejh1hwd.js} +20 -23
  80. package/dist/resource.js +13 -16
  81. package/dist/{restore-command-service-pzpet021.js → restore-command-service-r7t52t25.js} +37 -34
  82. package/dist/{run-service-hk8w2h31.js → run-service-xrhg0z2a.js} +144 -66
  83. package/dist/services/deploy-activate-service.d.ts +2 -1
  84. package/dist/services/deployment-search-client.d.ts +2 -1
  85. package/dist/services/deployment-search.d.ts +39 -0
  86. package/dist/services/feed-resolver.d.ts +13 -1
  87. package/dist/services/feed-selection.d.ts +8 -5
  88. package/dist/services/feed-session.d.ts +34 -0
  89. package/dist/services/install-run.d.ts +92 -0
  90. package/dist/services/prepare-solution-resources.d.ts +11 -2
  91. package/dist/services/project-contributions.d.ts +2 -0
  92. package/dist/services/project-identity-telemetry.d.ts +3 -0
  93. package/dist/services/publish-service.d.ts +20 -3
  94. package/dist/services/solution-identity.d.ts +18 -0
  95. package/dist/ship-telemetry-bkf3800w.js +16 -0
  96. package/dist/solution-auth-jxcgd2m0.js +10 -0
  97. package/dist/solution-identity-92h2fbpa.js +19 -0
  98. package/dist/templates/AGENTS.md +27 -29
  99. package/dist/tool.js +32 -33
  100. package/package.json +2 -2
  101. package/dist/deploy-delete-service-0tm600d1.js +0 -25
  102. package/dist/deploy-run-service-hne5w17k.js +0 -25
  103. package/dist/deployment-search-32zvxn35.js +0 -55
  104. package/dist/feed-resolver-pdeb4wkq.js +0 -28
  105. package/dist/feed-scope-failure-4baame72.js +0 -19
  106. package/dist/feed-session-7xqphdrg.js +0 -17
  107. package/dist/first-party-service-sd8yaf73.js +0 -27
  108. package/dist/governance-options-bqgv5fte.js +0 -32
  109. package/dist/index-dqa169gp.js +0 -25
  110. package/dist/index-prm27bvm.js +0 -138
  111. package/dist/index-wdndcwab.js +0 -667
  112. package/dist/node-v7xhqwe2.js +0 -86
  113. package/dist/pack-command-service-b1v9c8cw.js +0 -35
  114. package/dist/package-id-rpzgy31w.js +0 -13
  115. package/dist/packager-tool-53w8skv5.js +0 -262
  116. package/dist/packager-tool-5edvzz80.js +0 -543
  117. package/dist/packager-tool-99jaqabz.js +0 -171
  118. package/dist/packager-tool-9hsmn8th.js +0 -418
  119. package/dist/packager-tool-azre7mm1.js +0 -182
  120. package/dist/packager-tool-fn13r8e1.js +0 -188
  121. package/dist/packager-tool-gdtpsdn7.js +0 -342
  122. package/dist/packager-tool-qw47eyw7.js +0 -43
  123. package/dist/packager-tool-resolver-994z3jkj.js +0 -23
  124. package/dist/packager-tool-tedbebpq.js +0 -5367
  125. package/dist/packager-tool-x1ah4eez.js +0 -68
  126. package/dist/prepare-solution-resources-m1djfj62.js +0 -29
  127. package/dist/project-contributions-79ndycrx.js +0 -32
  128. package/dist/resource-mutations-c3krjqze.js +0 -36
  129. package/dist/ship-telemetry-myes7ak5.js +0 -21
  130. package/dist/solution-auth-aead70sw.js +0 -11
  131. /package/dist/{packager-tool-act5r386.js → packager-tool-2pxe2r4j.js} +0 -0
  132. /package/dist/{packager-tool-kkfb5kgn.js → packager-tool-vrqbbh01.js} +0 -0
@@ -1,171 +0,0 @@
1
- import {
2
- PackService
3
- } from "./packager-tool-wm0jaz7p.js";
4
- import {
5
- Path
6
- } from "./packager-tool-pbmqk39a.js";
7
- // ../packager/solution-packager/src/services/package-id-reader.ts
8
- var legacySolutionResourcesFileName = "resources.json";
9
-
10
- class PackageIdReader {
11
- fileSystem;
12
- packService;
13
- projectTypesToFolderNameMapping = {
14
- processorchestration: "processOrchestration",
15
- casemanagement: "caseManagement",
16
- agent: "agent",
17
- api: "api",
18
- webapp: "webApp",
19
- process: "process",
20
- flow: "flow"
21
- };
22
- static projectTypeMap = {
23
- process: "Rpa",
24
- library: "Lib",
25
- tests: "Tests",
26
- webapp: "App",
27
- processorchestration: "Agentic",
28
- casemanagement: "Case",
29
- api: "Api",
30
- agent: "Agent",
31
- flow: "Flow"
32
- };
33
- constructor(fileSystem, packService) {
34
- this.fileSystem = fileSystem;
35
- this.packService = packService;
36
- }
37
- async read(project, solutionPath, solutionName) {
38
- try {
39
- if (!solutionPath || solutionPath.trim() === "") {
40
- return this.defaultToProjectFolder(project, solutionPath, solutionName);
41
- }
42
- return await this.readFromResourcesDirectory(project, solutionPath) || await this.readFromLegacyResourcesJson(project, solutionPath) || this.defaultToProjectFolder(project, solutionPath, solutionName);
43
- } catch (ex) {
44
- console.error("Error reading package ID:", ex);
45
- return this.defaultToProjectFolder(project, solutionPath, solutionName);
46
- }
47
- }
48
- defaultToProjectFolder(project, solutionPath, solutionName) {
49
- const projectFolderName = Path.dirname(project.ProjectRelativePath);
50
- const id = this.packService.sanitizePackageId(projectFolderName);
51
- return this.getPackageId(id, project, solutionPath, solutionName);
52
- }
53
- getPackageId(rootPackageId, project, solutionPath, solutionName) {
54
- const packageId = this.composePackageId(rootPackageId, project, solutionPath, solutionName);
55
- return this.packService.sanitizePackageId(packageId);
56
- }
57
- composePackageId(rootPackageId, project, solutionPath, solutionName) {
58
- if (!solutionName && (!solutionPath || solutionPath.trim() === "")) {
59
- return rootPackageId;
60
- }
61
- const resolvedSolutionName = solutionName || this.deriveSolutionName(solutionPath);
62
- const parts = [resolvedSolutionName];
63
- if (project.Type) {
64
- parts.push(PackageIdReader.normalizeProjectType(project.Type));
65
- }
66
- parts.push(rootPackageId);
67
- return parts.join(".");
68
- }
69
- static normalizeProjectType(projectType) {
70
- const normalizedKey = projectType.toLowerCase();
71
- return PackageIdReader.projectTypeMap[normalizedKey] || projectType;
72
- }
73
- deriveSolutionName(solutionPath) {
74
- const ext = Path.extname(solutionPath);
75
- const base = Path.basename(solutionPath);
76
- return ext ? base.substring(0, base.length - ext.length) : base;
77
- }
78
- async readFromLegacyResourcesJson(project, solutionPath) {
79
- const resourcesFilePath = Path.join(solutionPath, legacySolutionResourcesFileName);
80
- const exists = await this.fileSystem.exists(resourcesFilePath);
81
- if (!exists) {
82
- return null;
83
- }
84
- const data = await this.fileSystem.readFile(resourcesFilePath);
85
- if (!data) {
86
- return null;
87
- }
88
- const json = new TextDecoder().decode(data);
89
- return this.getProjectIdFromJson(project, json);
90
- }
91
- getProjectIdFromJson(project, json) {
92
- try {
93
- const jsonObject = JSON.parse(json);
94
- const resources = this.getProperty(jsonObject, "resources");
95
- if (!Array.isArray(resources)) {
96
- return null;
97
- }
98
- const resource = resources.find((r) => {
99
- const projectKey = this.getProperty(r, "projectKey");
100
- const kind = this.getProperty(r, "kind");
101
- return projectKey === project.Id && typeof kind === "string" && kind.toLowerCase() === "process";
102
- });
103
- if (!resource) {
104
- return null;
105
- }
106
- const spec = this.getProperty(resource, "spec");
107
- if (!spec) {
108
- return null;
109
- }
110
- const packageName = this.getProperty(spec, "packageName");
111
- if (!packageName || typeof packageName !== "string" || packageName.trim() === "") {
112
- return null;
113
- }
114
- return packageName;
115
- } catch (ex) {
116
- console.error("Error parsing legacy resources JSON:", ex);
117
- return null;
118
- }
119
- }
120
- async readFromResourcesDirectory(project, solutionPath) {
121
- const projectTypeLower = project.Type.toLowerCase();
122
- const projectTypeFolder = this.projectTypesToFolderNameMapping[projectTypeLower] || Path.dirname(project.ProjectRelativePath);
123
- const processDirectory = Path.join(solutionPath, "resources", "solution_folder", "process", projectTypeFolder);
124
- const stats = await this.fileSystem.stat(processDirectory);
125
- if (!stats?.isDirectory()) {
126
- return null;
127
- }
128
- const files = await this.fileSystem.readdir(processDirectory);
129
- const jsonFiles = files.filter((f) => f.endsWith(".json")).map((f) => Path.join(processDirectory, f));
130
- for (const jsonFile of jsonFiles) {
131
- try {
132
- const data = await this.fileSystem.readFile(jsonFile);
133
- if (!data) {
134
- continue;
135
- }
136
- const json = new TextDecoder().decode(data);
137
- const jsonObject = JSON.parse(json);
138
- const resource = this.getProperty(jsonObject, "resource");
139
- const projectKey = this.getProperty(resource, "projectKey");
140
- if (projectKey === project.Id) {
141
- const spec = this.getProperty(resource, "spec");
142
- const packageName = this.getProperty(spec, "packageName");
143
- if (typeof packageName !== "string" || packageName.trim() === "") {
144
- return null;
145
- }
146
- return packageName;
147
- }
148
- } catch (ex) {
149
- console.error("Error reading resource file:", jsonFile, ex);
150
- }
151
- }
152
- return null;
153
- }
154
- getProperty(obj, propertyName) {
155
- if (!obj || typeof obj !== "object") {
156
- return null;
157
- }
158
- const keys = Object.keys(obj);
159
- const matchingKey = keys.find((key) => key.toLowerCase() === propertyName.toLowerCase());
160
- return matchingKey ? obj[matchingKey] : null;
161
- }
162
- }
163
- async function readMemberPackageIdAsync(fileSystem, project, solutionPath, solutionName) {
164
- const packService = new PackService;
165
- const packageId = await new PackageIdReader(fileSystem, packService).read(project, solutionPath, solutionName);
166
- return packageId ? packService.sanitizePackageId(packageId) : packageId;
167
- }
168
-
169
- export { PackageIdReader, readMemberPackageIdAsync };
170
-
171
- //# debugId=95D09CBD9B00686D64756E2164756E21
@@ -1,418 +0,0 @@
1
- import {
2
- Configuration,
3
- PipelinesApi
4
- } from "./packager-tool-97rcgwvv.js";
5
- import {
6
- Configuration as Configuration2,
7
- DeploymentSearchItemDto2FromJSON,
8
- DeploymentsApi,
9
- SearchApi
10
- } from "./packager-tool-tedbebpq.js";
11
- import {
12
- classifyFeedSession
13
- } from "./packager-tool-qw47eyw7.js";
14
- import {
15
- resolveSessionIdentity
16
- } from "./packager-tool-43ahv5mn.js";
17
- import {
18
- httpStatusOf,
19
- logger
20
- } from "./packager-tool-tx834spe.js";
21
- import {
22
- catchError
23
- } from "./packager-tool-6ybywxxn.js";
24
-
25
- // ../solution-sdk/src/legacy-deployment-search-v3.ts
26
- var LEGACY_V3_SEARCH_ROUTE = "POST /api/v3/search/deployments";
27
- async function searchDeploymentsLegacyV3(auth, query, scope) {
28
- const api = new SearchApi(new Configuration2({
29
- basePath: auth.basePath,
30
- accessToken: auth.accessToken
31
- }));
32
- const response = await api.searchSearchDeployments22Raw({ deploymentsSearchRequest2: toLegacyV3Request(query) }, scope);
33
- return response.raw.json();
34
- }
35
- function toLegacyV3Request(query) {
36
- return {
37
- searchTerm: query.searchTerm ?? query.deploymentName ?? query.packageName,
38
- packageName: query.packageName,
39
- ...query.targetFolderName ? { targetFolderName: query.targetFolderName } : {},
40
- take: query.take,
41
- skip: query.skip,
42
- orderByColumn: query.orderByColumn,
43
- orderByDirection: query.orderByDirection,
44
- operationStatuses: query.operationStatuses ?? [],
45
- activationStatuses: query.activationStatuses ?? []
46
- };
47
- }
48
-
49
- // ../solution-sdk/src/pipelines-route.ts
50
- async function isMissingPipelinesRoute(error) {
51
- const status = httpStatusOf(error);
52
- if (status === 405) {
53
- return true;
54
- }
55
- if (status !== 404 || !error || typeof error !== "object") {
56
- return false;
57
- }
58
- if (!("response" in error)) {
59
- return true;
60
- }
61
- const response = error.response;
62
- if (!(response instanceof Response)) {
63
- return false;
64
- }
65
- const [readError, body] = await catchError((async () => response.clone().text())());
66
- if (readError) {
67
- return false;
68
- }
69
- return body.trim() === "";
70
- }
71
- function isApplicationSession(auth) {
72
- const identity = auth.identity ?? resolveSessionIdentity(auth.accessToken);
73
- return identity?.type === "Application";
74
- }
75
- function notAPage(route, what, options) {
76
- return new Error(`${route} answered with ${what}.`, options);
77
- }
78
- function parseSearchPage(body, route, kind) {
79
- if (!body || typeof body !== "object" || Array.isArray(body)) {
80
- throw notAPage(route, `a body that is not a page of ${kind.plural}`);
81
- }
82
- const values = "values" in body ? body.values : undefined;
83
- if (values !== undefined && values !== null && !Array.isArray(values)) {
84
- throw notAPage(route, `\`values\` that is not a list of ${kind.plural}`);
85
- }
86
- const rows = Array.isArray(values) ? values : [];
87
- const count = "count" in body && typeof body.count === "number" && body.count >= 0 ? body.count : undefined;
88
- return { count, values: rows.map((row) => parseRow(row, route, kind)) };
89
- }
90
- function parseRow(row, route, kind) {
91
- const what = `a row that is not a ${kind.singular}`;
92
- if (!row || typeof row !== "object" || Array.isArray(row)) {
93
- throw notAPage(route, what);
94
- }
95
- if (kind.isRow && !kind.isRow(row)) {
96
- throw notAPage(route, what);
97
- }
98
- const [error, parsed] = catchError(() => kind.fromJSON(row));
99
- if (error) {
100
- throw notAPage(route, what, { cause: error });
101
- }
102
- return parsed;
103
- }
104
-
105
- // ../solution-sdk/src/deployment-search.ts
106
- var PIPELINES_SEARCH_ROUTE = "POST /v1/pipelines/deployments/search";
107
-
108
- class DeploymentSearchNeedsUserSessionError extends Error {
109
- constructor() {
110
- super("This server's deployment search reads user sessions only; an application (client-credentials) login cannot read it. Sign in with 'uip login' to use it.");
111
- this.name = "DeploymentSearchNeedsUserSessionError";
112
- }
113
- }
114
- var serversWithoutPipelinesSearch = new Set;
115
- var DEPLOYMENT_ROWS = {
116
- singular: "deployment",
117
- plural: "deployments",
118
- fromJSON: DeploymentSearchItemDto2FromJSON
119
- };
120
- async function searchDeploymentsPage(auth, query, scope) {
121
- if (!serversWithoutPipelinesSearch.has(auth.basePath)) {
122
- const [error, body2] = await catchError(searchViaPipelines(auth, query, scope));
123
- if (!error) {
124
- return {
125
- ...parseSearchPage(body2, PIPELINES_SEARCH_ROUTE, DEPLOYMENT_ROWS),
126
- source: "pipelines"
127
- };
128
- }
129
- if (!await isMissingPipelinesRoute(error)) {
130
- throw error;
131
- }
132
- serversWithoutPipelinesSearch.add(auth.basePath);
133
- logger.debug(`${PIPELINES_SEARCH_ROUTE} is not served at ${auth.basePath}; using the deprecated ${LEGACY_V3_SEARCH_ROUTE}.`);
134
- }
135
- if (isApplicationSession(auth)) {
136
- throw new DeploymentSearchNeedsUserSessionError;
137
- }
138
- const body = await searchDeploymentsLegacyV3(auth, query, scope);
139
- return {
140
- ...parseSearchPage(body, LEGACY_V3_SEARCH_ROUTE, DEPLOYMENT_ROWS),
141
- source: "legacy-v3"
142
- };
143
- }
144
- async function searchViaPipelines(auth, query, scope) {
145
- const api = new PipelinesApi(new Configuration({
146
- basePath: auth.basePath,
147
- accessToken: auth.accessToken
148
- }));
149
- const response = await api.pipelinesSearchDeploymentsRaw({
150
- pipelineDeploymentsSearchRequest: {
151
- take: query.take,
152
- skip: query.skip,
153
- deploymentName: query.deploymentName,
154
- packageName: query.packageName,
155
- targetFolderName: query.targetFolderName,
156
- searchTerm: query.searchTerm,
157
- orderByColumn: query.orderByColumn,
158
- orderByDirection: query.orderByDirection,
159
- operationStatuses: query.operationStatuses,
160
- activationStatuses: query.activationStatuses
161
- }
162
- }, scope);
163
- return response.raw.json();
164
- }
165
- // src/services/http-status.ts
166
- function isAuthRefusal(error) {
167
- const status = httpStatusOf(error);
168
- return status === 401 || status === 403;
169
- }
170
-
171
- // src/services/deployment-search.ts
172
- async function readDeploymentByKeyAsync(auth, deploymentKey, options = {}) {
173
- if (!options.solutionsOnly) {
174
- const api = new PipelinesApi(new Configuration({
175
- basePath: auth.basePath,
176
- accessToken: auth.accessToken
177
- }));
178
- const [error, info] = await catchError(api.pipelinesGetDeploymentByKey({ key: deploymentKey }));
179
- if (!error) {
180
- return info ? fromPipelinesRecord(info) : undefined;
181
- }
182
- if (httpStatusOf(error) !== 404) {
183
- throw error;
184
- }
185
- }
186
- if (classifyFeedSession(auth) !== "user") {
187
- return;
188
- }
189
- return readDeploymentByKeyViaSolutionsAsync(auth, deploymentKey, options.scope);
190
- }
191
- function fromPipelinesRecord(info) {
192
- return {
193
- deploymentKey: info.deploymentKey,
194
- operationStatus: info.operationStatus,
195
- installedRootFolderKey: info.installedRootFolderKey,
196
- source: "pipelines"
197
- };
198
- }
199
- async function readDeploymentByKeyViaSolutionsAsync(auth, deploymentKey, scope) {
200
- const api = new DeploymentsApi(new Configuration2({
201
- basePath: auth.basePath,
202
- accessToken: auth.accessToken
203
- }));
204
- const [error, row] = await catchError(api.deploymentsGetByKey({ deploymentKey }, scope));
205
- if (error) {
206
- if (httpStatusOf(error) === 404) {
207
- return;
208
- }
209
- throw error;
210
- }
211
- return row ? {
212
- deploymentKey: row.key,
213
- operationStatus: row.operationStatus,
214
- installedRootFolderKey: row.installedRootFolderKey,
215
- source: "solutions"
216
- } : undefined;
217
- }
218
- async function findDeploymentByName(auth, deploymentName, scope) {
219
- return newestDeploymentRow(await findDeploymentsByName(auth, deploymentName, scope));
220
- }
221
- async function findLiveDeploymentByName(auth, deploymentName, scope) {
222
- const newest = await findDeploymentByName(auth, deploymentName, scope);
223
- return isCompletedUninstall(newest) ? undefined : newest;
224
- }
225
- function isCompletedUninstall(row) {
226
- return row?.operation === "Uninstall" && row.operationStatus === "Successful";
227
- }
228
- async function findDeploymentsByPackageName(auth, packageName, options = {}) {
229
- const take = 50;
230
- const maxPages = 20;
231
- const matches = [];
232
- for (let page = 0, skip = 0;page < maxPages; page++) {
233
- const result = await searchDeploymentsPage(auth, { packageName, take, skip }, options.scope);
234
- const values = result.values ?? [];
235
- for (const deployment of values) {
236
- if (deployment.packageName === packageName && (options.folderPath === undefined || deployment.folderPath === options.folderPath)) {
237
- matches.push(deployment);
238
- }
239
- }
240
- if (values.length < take) {
241
- break;
242
- }
243
- skip += values.length;
244
- }
245
- return matches;
246
- }
247
- async function findCurrentDeploymentAsync(auth, deployment, scope) {
248
- const installKey = deployment.installDeploymentKey ?? deployment.key;
249
- const rows = await findDeploymentsByPackageName(auth, deployment.packageName, { scope });
250
- return rows.find((row) => (row.installDeploymentKey ?? row.key) === installKey);
251
- }
252
- function blocksRedeploy(deployment) {
253
- if (deployment.operationStatus === "InProgress") {
254
- return true;
255
- }
256
- if (deployment.operationStatus === "Successful") {
257
- return deployment.operation !== "Uninstall";
258
- }
259
- if (deployment.operationStatus === "Draft" || deployment.operationStatus === "Failed" || deployment.operationStatus === "FailedRollback") {
260
- return deployment.operation !== undefined && deployment.operation !== null && deployment.operation !== "Install";
261
- }
262
- return false;
263
- }
264
- var MAX_LISTED_DEPLOYMENTS = 5;
265
- function formatExistingDeployments(deployments, folderByKey) {
266
- const described = deployments.slice(0, MAX_LISTED_DEPLOYMENTS).map((deployment) => {
267
- const resolved = deployment.installedRootFolderKey ? folderByKey?.get(deployment.installedRootFolderKey) : undefined;
268
- const folder = resolved ?? deployment.folderPath ?? "an unknown folder";
269
- const current = deployment.currentPackageVersion ?? deployment.packageVersion ?? "an unknown version";
270
- const target = deployment.targetPackageVersion ?? deployment.newPackageVersionAvailable;
271
- const version = target && target !== current ? `${current} → ${target}` : current;
272
- const state = [
273
- deployment.operation,
274
- deployment.operationStatus,
275
- deployment.activationStatus
276
- ].filter((part) => part !== undefined && part !== null).join("/");
277
- return `'${deployment.name}' in ${folder} (version ${version}${state ? `, ${state}` : ""})`;
278
- }).join("; ");
279
- const remaining = deployments.length - MAX_LISTED_DEPLOYMENTS;
280
- return remaining > 0 ? `${described}; and ${remaining} more (see: uip solution deploy list)` : described;
281
- }
282
- async function findDeploymentsByName(auth, deploymentName, scope) {
283
- const matches = [];
284
- const take = 50;
285
- for (let skip = 0;; ) {
286
- const result = await searchDeploymentsPage(auth, { deploymentName, take, skip }, scope);
287
- const values = result.values ?? [];
288
- matches.push(...values.filter((deployment) => deployment.name === deploymentName));
289
- skip += values.length;
290
- const total = result.count;
291
- if (values.length < take || typeof total === "number" && skip >= total || skip >= MAX_SEARCH_ROWS) {
292
- return matches;
293
- }
294
- }
295
- }
296
- var MAX_SEARCH_ROWS = 5000;
297
- async function findDeploymentBestEffort(auth, deploymentName, scope, prefer = {}) {
298
- const [lookupError, rows] = await catchError(findDeploymentsByName(auth, deploymentName, scope));
299
- if (lookupError || !rows) {
300
- return;
301
- }
302
- if (prefer.deploymentKey) {
303
- return rows.find((row) => row.key === prefer.deploymentKey && row.operation !== "Uninstall");
304
- }
305
- const candidates = rows.filter((row) => row.operation !== "Uninstall");
306
- return candidates.sort((a, b) => creationMillis(b) - creationMillis(a))[0];
307
- }
308
- function newestDeploymentRow(rows) {
309
- return [...rows].sort((a, b) => creationMillis(b) - creationMillis(a))[0];
310
- }
311
- function creationMillis(row) {
312
- const millis = row.deploymentCreationTime ? new Date(row.deploymentCreationTime).getTime() : Number.NaN;
313
- return Number.isFinite(millis) ? millis : 0;
314
- }
315
- async function isPipelineDeploymentNotFoundError(error) {
316
- if (!error || typeof error !== "object") {
317
- return false;
318
- }
319
- const response = error.response;
320
- if (!response || typeof response !== "object") {
321
- return false;
322
- }
323
- const status = response.status;
324
- if (status !== 404) {
325
- return false;
326
- }
327
- const [bodyError, body] = await catchError(response.clone().text());
328
- if (bodyError || !body) {
329
- return false;
330
- }
331
- return body.includes("PipelineDeploymentNotFound");
332
- }
333
- function interpretFailedDeployPoll(deployment) {
334
- if (!deployment) {
335
- return;
336
- }
337
- if (deployment.operationStatus === "Failed" || deployment.operationStatus === "FailedRollback") {
338
- return {
339
- kind: "DeployFailed",
340
- operationStatus: deployment.operationStatus
341
- };
342
- }
343
- if (deployment.operationStatus !== "Successful") {
344
- return;
345
- }
346
- switch (deployment.activationStatus) {
347
- case "Active":
348
- return { kind: "Active", instanceId: deployment.instanceId };
349
- case "NeedsSetupToActivate":
350
- return { kind: "NeedsSetupToActivate" };
351
- case "ReadyToActivate":
352
- case "Inactive":
353
- return { kind: "ReadyToActivate" };
354
- case "ActivationFailed":
355
- return { kind: "ActivationFailed" };
356
- default:
357
- return;
358
- }
359
- }
360
- function mapOperationStatusToPipelineStatus(operationStatus) {
361
- switch (operationStatus) {
362
- case "Successful":
363
- return "DeploymentSucceeded";
364
- case "Failed":
365
- case "FailedRollback":
366
- case "Draft":
367
- return "DeploymentFailed";
368
- default:
369
- return;
370
- }
371
- }
372
- function deploymentToTerminalPipelineResult(deployment) {
373
- const status = mapOperationStatusToPipelineStatus(deployment.operationStatus);
374
- if (!status) {
375
- return;
376
- }
377
- return {
378
- status,
379
- validationResult: { validationErrors: [], conflictErrors: [] },
380
- deploymentKey: deployment.key,
381
- configurationKey: deployment.configurationKey,
382
- instanceId: deployment.instanceId,
383
- conflictFixingErrors: [],
384
- deploymentScheduleErrors: []
385
- };
386
- }
387
- async function resolveInstalledFolder(deployment, requested, resolveFolderByKey) {
388
- const fallback = {
389
- folderName: requested.folderName,
390
- folderPath: requested.folderPath,
391
- requestedMatched: true
392
- };
393
- const pathFor = (name, path) => path ?? (requested.parentFolderPath ? `${requested.parentFolderPath}/${name}` : name);
394
- const folderKey = deployment?.installedRootFolderKey;
395
- if (folderKey && resolveFolderByKey) {
396
- const [lookupError, folder] = await catchError(resolveFolderByKey(folderKey));
397
- if (!lookupError && folder?.name) {
398
- return {
399
- folderName: folder.name,
400
- folderPath: pathFor(folder.name, folder.path ?? deployment?.folderPath ?? undefined),
401
- requestedMatched: folder.name === requested.folderName
402
- };
403
- }
404
- }
405
- const resolvedName = deployment?.installedRootFolderName;
406
- if (resolvedName) {
407
- return {
408
- folderName: resolvedName,
409
- folderPath: pathFor(resolvedName, deployment?.folderPath ?? undefined),
410
- requestedMatched: resolvedName === requested.folderName
411
- };
412
- }
413
- return fallback;
414
- }
415
-
416
- export { isMissingPipelinesRoute, isApplicationSession, parseSearchPage, DeploymentSearchNeedsUserSessionError, searchDeploymentsPage, isAuthRefusal, readDeploymentByKeyAsync, readDeploymentByKeyViaSolutionsAsync, findDeploymentByName, findLiveDeploymentByName, isCompletedUninstall, findDeploymentsByPackageName, findCurrentDeploymentAsync, blocksRedeploy, MAX_LISTED_DEPLOYMENTS, formatExistingDeployments, findDeploymentsByName, findDeploymentBestEffort, newestDeploymentRow, isPipelineDeploymentNotFoundError, interpretFailedDeployPoll, mapOperationStatusToPipelineStatus, deploymentToTerminalPipelineResult, resolveInstalledFolder };
417
-
418
- //# debugId=FCF9A6B25A39008364756E2164756E21