@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.
- package/dist/{archive-extract-x35t9ktj.js → archive-extract-136rn3ja.js} +13 -15
- package/dist/{cleanup-command-service-je9d70vv.js → cleanup-command-service-kadmvyk4.js} +34 -31
- package/dist/deploy-delete-service-xa25k94p.js +23 -0
- package/dist/deploy-run-service-rsedb9hr.js +23 -0
- package/dist/{deploy-status-service-919yn8wn.js → deploy-status-service-nmm8k9fa.js} +72 -62
- package/dist/deploy.js +35 -37
- package/dist/deployment-search-wtbye8v6.js +54 -0
- package/dist/{embedded-file-reader-z4becc02.js → embedded-file-reader-0228j82a.js} +1 -4
- package/dist/feed-resolver-28pfxmky.js +27 -0
- package/dist/feed-scope-failure-d4avsc7j.js +20 -0
- package/dist/feed-session-4skrr620.js +23 -0
- package/dist/first-party-service-n3vva2m4.js +8 -0
- package/dist/governance-options-bevmhh1z.js +19 -0
- package/dist/index-aspmac9f.js +24 -0
- package/dist/index-md8d2ttf.js +60 -0
- package/dist/{index-sby22td6.js → index-nzr4mx5p.js} +2 -22
- package/dist/index-qq4kre7a.js +93 -0
- package/dist/index-t262f2xv.js +16 -0
- package/dist/index.js +33 -34
- package/dist/init.js +18 -21
- package/dist/{jmespath-231m3hyn.js → jmespath-ab6tdc42.js} +1 -1
- package/dist/{js-yaml-88tdqrtd.js → js-yaml-a2bk27p6.js} +1 -3
- package/dist/{list-5fke71jn.js → list-pnggwekk.js} +23 -23
- package/dist/models/pack-command-types.d.ts +3 -1
- package/dist/node-z9c03k2q.js +25 -0
- package/dist/pack-command-service-2txx876d.js +29 -0
- package/dist/{pack-project-ha0pxw3h.js → pack-project-ngwtfgge.js} +33 -40
- package/dist/pack.js +26 -30
- package/dist/package-id-350pep6r.js +11 -0
- package/dist/{packager-tool-5qzgdb66.js → packager-tool-0k205evy.js} +13 -15
- package/dist/{packager-tool-wm0jaz7p.js → packager-tool-0vz19vhv.js} +305 -657
- package/dist/{packager-tool-gs3f3tf7.js → packager-tool-1ctvbx0h.js} +1 -1
- package/dist/{packager-tool-h1tq7bqf.js → packager-tool-41a5axkd.js} +65 -35
- package/dist/packager-tool-8097ps72.js +2307 -0
- package/dist/{packager-tool-1ybnxbp9.js → packager-tool-85f75be3.js} +18 -18
- package/dist/{packager-tool-tx834spe.js → packager-tool-9vrwpgt3.js} +757 -309
- package/dist/{packager-tool-pbmqk39a.js → packager-tool-a7s0gbxs.js} +33 -28
- package/dist/{packager-tool-47wzvqw0.js → packager-tool-aws5w512.js} +6 -6
- package/dist/packager-tool-c64hqa8n.js +106 -0
- package/dist/{packager-tool-5ddtwzva.js → packager-tool-ca5ngmqv.js} +12 -12
- package/dist/{packager-tool-d78ww4hb.js → packager-tool-cp66jc40.js} +51 -48
- package/dist/{packager-tool-6kz1pv9f.js → packager-tool-d1texmvn.js} +828 -338
- package/dist/{packager-tool-cvf46scg.js → packager-tool-daphtc6e.js} +122 -89
- package/dist/{packager-tool-1de529jm.js → packager-tool-epsr41wx.js} +12 -3
- package/dist/packager-tool-f84z7nds.js +130 -0
- package/dist/{packager-tool-45a8fkw0.js → packager-tool-fgk0fkm5.js} +37 -39
- package/dist/{packager-tool-8ptbmmmp.js → packager-tool-fp46ebde.js} +147 -76
- package/dist/{packager-tool-3bwnkjdq.js → packager-tool-fx4ws49n.js} +12 -12
- package/dist/{packager-tool-4pa108k7.js → packager-tool-g8ghm6wk.js} +11 -11
- package/dist/{packager-tool-2t72aez8.js → packager-tool-gpcr8zxf.js} +15 -15
- package/dist/packager-tool-gqb9ytg9.js +290 -0
- package/dist/packager-tool-hrkvdw31.js +280 -0
- package/dist/{packager-tool-056k8w2f.js → packager-tool-hs1kjv0c.js} +75 -9
- package/dist/{packager-tool-2vmz56qh.js → packager-tool-jatbb6c5.js} +184 -33
- package/dist/{packager-tool-f23a485e.js → packager-tool-jfp5mvqm.js} +176 -196
- package/dist/{packager-tool-6ybywxxn.js → packager-tool-m07vyk89.js} +371 -221
- package/dist/{packager-tool-61pwb567.js → packager-tool-ppj5f4y7.js} +6 -7
- package/dist/{packager-tool-t8gh825q.js → packager-tool-qf8753ee.js} +53 -41
- package/dist/{packager-tool-60af1hw2.js → packager-tool-qzcd5c9s.js} +3 -3
- package/dist/packager-tool-rb06drad.js +1178 -0
- package/dist/packager-tool-resolver-td3bhccd.js +20 -0
- package/dist/{packager-tool-dfrk01gn.js → packager-tool-rj2d1g0w.js} +154 -154
- package/dist/{packager-tool-43ahv5mn.js → packager-tool-t39pjz7n.js} +35 -18
- package/dist/{packager-tool-v1f5e8t9.js → packager-tool-vgrswa8p.js} +53 -8
- package/dist/{packager-tool-gyqfs04e.js → packager-tool-vq5fwggb.js} +273 -255
- package/dist/{packager-tool-gmwva4yv.js → packager-tool-vx2c68sb.js} +2 -2
- package/dist/{packager-tool-b2nhscfk.js → packager-tool-wm8nj6e9.js} +18 -18
- package/dist/{packager-tool-amhyxzz6.js → packager-tool-x33sdw6n.js} +16 -16
- package/dist/{packager-tool-97rcgwvv.js → packager-tool-x461tgwy.js} +331 -55
- package/dist/{packager-tool-dnrk1gg6.js → packager-tool-y6efv1f8.js} +356 -298
- package/dist/{packager-tool-wy4fx250.js → packager-tool-yetmzme9.js} +89 -30
- package/dist/packager-tool-z45eej6s.js +74 -0
- package/dist/packager-tool.js +6 -7
- package/dist/prepare-solution-resources-pwnyvtza.js +26 -0
- package/dist/{project-command-utils-t6pmpvq3.js → project-command-utils-zcmbecfy.js} +23 -26
- package/dist/project-contributions-kh9yftvg.js +27 -0
- package/dist/publish.js +17 -17
- package/dist/resource-mutations-mfn5k1hb.js +27 -0
- package/dist/{resource-version-lookup-0e3e2j58.js → resource-version-lookup-6ejh1hwd.js} +20 -23
- package/dist/resource.js +13 -16
- package/dist/{restore-command-service-pzpet021.js → restore-command-service-r7t52t25.js} +37 -34
- package/dist/{run-service-hk8w2h31.js → run-service-xrhg0z2a.js} +144 -66
- package/dist/services/deploy-activate-service.d.ts +2 -1
- package/dist/services/deployment-search-client.d.ts +2 -1
- package/dist/services/deployment-search.d.ts +39 -0
- package/dist/services/feed-resolver.d.ts +13 -1
- package/dist/services/feed-selection.d.ts +8 -5
- package/dist/services/feed-session.d.ts +34 -0
- package/dist/services/install-run.d.ts +92 -0
- package/dist/services/prepare-solution-resources.d.ts +11 -2
- package/dist/services/project-contributions.d.ts +2 -0
- package/dist/services/project-identity-telemetry.d.ts +3 -0
- package/dist/services/publish-service.d.ts +20 -3
- package/dist/services/solution-identity.d.ts +18 -0
- package/dist/ship-telemetry-bkf3800w.js +16 -0
- package/dist/solution-auth-jxcgd2m0.js +10 -0
- package/dist/solution-identity-92h2fbpa.js +19 -0
- package/dist/templates/AGENTS.md +27 -29
- package/dist/tool.js +32 -33
- package/package.json +2 -2
- package/dist/deploy-delete-service-0tm600d1.js +0 -25
- package/dist/deploy-run-service-hne5w17k.js +0 -25
- package/dist/deployment-search-32zvxn35.js +0 -55
- package/dist/feed-resolver-pdeb4wkq.js +0 -28
- package/dist/feed-scope-failure-4baame72.js +0 -19
- package/dist/feed-session-7xqphdrg.js +0 -17
- package/dist/first-party-service-sd8yaf73.js +0 -27
- package/dist/governance-options-bqgv5fte.js +0 -32
- package/dist/index-dqa169gp.js +0 -25
- package/dist/index-prm27bvm.js +0 -138
- package/dist/index-wdndcwab.js +0 -667
- package/dist/node-v7xhqwe2.js +0 -86
- package/dist/pack-command-service-b1v9c8cw.js +0 -35
- package/dist/package-id-rpzgy31w.js +0 -13
- package/dist/packager-tool-53w8skv5.js +0 -262
- package/dist/packager-tool-5edvzz80.js +0 -543
- package/dist/packager-tool-99jaqabz.js +0 -171
- package/dist/packager-tool-9hsmn8th.js +0 -418
- package/dist/packager-tool-azre7mm1.js +0 -182
- package/dist/packager-tool-fn13r8e1.js +0 -188
- package/dist/packager-tool-gdtpsdn7.js +0 -342
- package/dist/packager-tool-qw47eyw7.js +0 -43
- package/dist/packager-tool-resolver-994z3jkj.js +0 -23
- package/dist/packager-tool-tedbebpq.js +0 -5367
- package/dist/packager-tool-x1ah4eez.js +0 -68
- package/dist/prepare-solution-resources-m1djfj62.js +0 -29
- package/dist/project-contributions-79ndycrx.js +0 -32
- package/dist/resource-mutations-c3krjqze.js +0 -36
- package/dist/ship-telemetry-myes7ak5.js +0 -21
- package/dist/solution-auth-aead70sw.js +0 -11
- /package/dist/{packager-tool-act5r386.js → packager-tool-2pxe2r4j.js} +0 -0
- /package/dist/{packager-tool-kkfb5kgn.js → packager-tool-vrqbbh01.js} +0 -0
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getAvailablePublishLocationsV2
|
|
3
|
-
} from "./packager-tool-tedbebpq.js";
|
|
4
|
-
import {
|
|
5
|
-
classifyFeedSession
|
|
6
|
-
} from "./packager-tool-qw47eyw7.js";
|
|
7
|
-
import {
|
|
8
|
-
PersonalWorkspacesApi,
|
|
9
|
-
createOrchestratorConfig
|
|
10
|
-
} from "./packager-tool-8ptbmmmp.js";
|
|
11
|
-
import {
|
|
12
|
-
getLoginStatusAsync
|
|
13
|
-
} from "./packager-tool-43ahv5mn.js";
|
|
14
|
-
import {
|
|
15
|
-
extractErrorDetails
|
|
16
|
-
} from "./packager-tool-6ybywxxn.js";
|
|
17
|
-
|
|
18
|
-
// src/services/personal-workspace-resolver.ts
|
|
19
|
-
async function resolvePersonalWorkspace(options) {
|
|
20
|
-
const config = await createOrchestratorConfig(options);
|
|
21
|
-
const api = new PersonalWorkspacesApi(config);
|
|
22
|
-
const pw = await api.personalWorkspacesGetPersonalWorkspace();
|
|
23
|
-
if (!pw?.key || !pw.name) {
|
|
24
|
-
throw new Error("Personal Workspace not configured for the current user. " + "Enable Personal Workspace in Orchestrator (or sign in as a user that has one), then retry.");
|
|
25
|
-
}
|
|
26
|
-
return { key: pw.key, name: pw.name };
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// src/services/publish-locations-service.ts
|
|
30
|
-
async function resolveStudioWebTarget(options) {
|
|
31
|
-
const loginStatus = await getLoginStatusAsync({
|
|
32
|
-
ensureTokenValidityMinutes: options?.loginValidity,
|
|
33
|
-
envFilePath: options?.envFilePath
|
|
34
|
-
});
|
|
35
|
-
if (loginStatus.loginStatus !== "Logged in" || !loginStatus.accessToken || !loginStatus.baseUrl) {
|
|
36
|
-
throw new Error("Not logged in. Run 'uip login' first.");
|
|
37
|
-
}
|
|
38
|
-
if (!loginStatus.organizationName) {
|
|
39
|
-
throw new Error("Organization name is not available. Re-authenticate with 'uip login'.");
|
|
40
|
-
}
|
|
41
|
-
if (options?.tenant && loginStatus.tenantName && options.tenant.toLowerCase() !== loginStatus.tenantName.toLowerCase()) {
|
|
42
|
-
throw new Error(`Feeds are resolved for the logged-in tenant ('${loginStatus.tenantName}'), so --tenant '${options.tenant}' can't apply here. Switch tenants first with: uip login tenant set ${options.tenant}.`);
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
config: {
|
|
46
|
-
baseUrl: loginStatus.baseUrl,
|
|
47
|
-
authToken: loginStatus.accessToken,
|
|
48
|
-
tenantId: loginStatus.tenantId
|
|
49
|
-
},
|
|
50
|
-
organizationName: loginStatus.organizationName
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function isSelectableFeed(location) {
|
|
54
|
-
switch (location.type) {
|
|
55
|
-
case "Tenant":
|
|
56
|
-
case "Folder":
|
|
57
|
-
return true;
|
|
58
|
-
case "PersonalWorkspace":
|
|
59
|
-
return location.isMyPersonalWorkspace;
|
|
60
|
-
default:
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
async function listSelectablePublishLocations(options) {
|
|
65
|
-
const { config, organizationName } = await resolveStudioWebTarget(options);
|
|
66
|
-
const all = await getAvailablePublishLocationsV2(config, organizationName);
|
|
67
|
-
return all.filter(isSelectableFeed);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// src/services/feed-resolver.ts
|
|
71
|
-
function folderKeyInitOverride(folderKey) {
|
|
72
|
-
return async ({ init }) => ({
|
|
73
|
-
headers: { ...init.headers, "X-UIPATH-FolderKey": folderKey }
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
function feedScopeInitOverride(scope) {
|
|
77
|
-
const { folderKey } = scope;
|
|
78
|
-
if (!folderKey) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
return folderKeyInitOverride(folderKey);
|
|
82
|
-
}
|
|
83
|
-
function feedSelectorFlag(scope) {
|
|
84
|
-
if (!scope || scope.kind === "tenant" || !scope.folderKey) {
|
|
85
|
-
return "";
|
|
86
|
-
}
|
|
87
|
-
return scope.kind === "personal" ? " --personal-workspace" : ` --feed ${scope.folderKey}`;
|
|
88
|
-
}
|
|
89
|
-
function feedResolutionFailureInstructions(options) {
|
|
90
|
-
if (options.personalWorkspace) {
|
|
91
|
-
return "Personal Workspace resolution needs an interactive user session and an enabled Personal Workspace. Log in as a user with a Personal Workspace, or omit --personal-workspace to use the tenant feed.";
|
|
92
|
-
}
|
|
93
|
-
if (options.feed !== undefined) {
|
|
94
|
-
return "List the feeds you can target with: uip solution feeds list.";
|
|
95
|
-
}
|
|
96
|
-
return "Check the selected feed and try again.";
|
|
97
|
-
}
|
|
98
|
-
async function describeFeedResolutionFailureAsync(error, options, session) {
|
|
99
|
-
const details = await extractErrorDetails(error);
|
|
100
|
-
if (options.personalWorkspace && isRefusal(details.context?.httpStatus) && classifyFeedSession(session) === "application") {
|
|
101
|
-
return {
|
|
102
|
-
message: "--personal-workspace needs a user session; this session is an external app, which has no Personal Workspace.",
|
|
103
|
-
instructions: "Run it with a user session that has a Personal Workspace ('uip login'). A client-credentials login cannot target one.",
|
|
104
|
-
errorCode: "permission_denied",
|
|
105
|
-
retry: "RetryWillNotFix",
|
|
106
|
-
context: details.context
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
if (options.feed !== undefined && isRefusal(details.context?.httpStatus) && classifyFeedSession(session) === "application") {
|
|
110
|
-
return {
|
|
111
|
-
message: `--feed '${options.feed}' could not be checked: Studio Web refused this external app the list of publish locations (HTTP ${details.context?.httpStatus}).`,
|
|
112
|
-
instructions: "Give the external application the Studio Web (StudioWebS2S) grants that cover reading publish locations, or run it with a user session ('uip login'). To use the tenant feed, omit --feed.",
|
|
113
|
-
errorCode: "permission_denied",
|
|
114
|
-
retry: "RetryWillNotFix",
|
|
115
|
-
context: details.context
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
return {
|
|
119
|
-
message: details.message,
|
|
120
|
-
instructions: feedResolutionFailureInstructions(options),
|
|
121
|
-
errorCode: details.errorCode,
|
|
122
|
-
retry: details.retry,
|
|
123
|
-
context: details.context
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function isRefusal(status) {
|
|
127
|
-
return status !== undefined && status >= 400 && status < 500 && status !== 408 && status !== 429;
|
|
128
|
-
}
|
|
129
|
-
async function resolveFeedScope(options) {
|
|
130
|
-
const { personalWorkspace, feed } = options;
|
|
131
|
-
if (personalWorkspace && feed !== undefined) {
|
|
132
|
-
throw new Error("Use either --personal-workspace or --feed, not both.");
|
|
133
|
-
}
|
|
134
|
-
if (personalWorkspace) {
|
|
135
|
-
const pw = await resolvePersonalWorkspace({
|
|
136
|
-
tenant: options.tenant,
|
|
137
|
-
loginValidity: options.loginValidity,
|
|
138
|
-
envFilePath: options.envFilePath
|
|
139
|
-
});
|
|
140
|
-
return { kind: "personal", folderKey: pw.key, name: pw.name };
|
|
141
|
-
}
|
|
142
|
-
if (feed !== undefined) {
|
|
143
|
-
return resolveNamedFeed(feed, options);
|
|
144
|
-
}
|
|
145
|
-
return { kind: "tenant" };
|
|
146
|
-
}
|
|
147
|
-
async function resolveNamedFeed(feed, options) {
|
|
148
|
-
const locations = await listSelectablePublishLocations({
|
|
149
|
-
tenant: options.tenant,
|
|
150
|
-
envFilePath: options.envFilePath,
|
|
151
|
-
loginValidity: options.loginValidity
|
|
152
|
-
});
|
|
153
|
-
const match = matchFeed(feed, locations);
|
|
154
|
-
const kind = match.type === "Tenant" ? "tenant" : match.type === "PersonalWorkspace" ? "personal" : "folder";
|
|
155
|
-
if (kind !== "tenant" && !match.key) {
|
|
156
|
-
throw new Error(`Feed '${match.name || feed}' has no folder key in the publish-locations response, so it can't be targeted. Run 'uip solution feeds list' and pick a feed with a Key.`);
|
|
157
|
-
}
|
|
158
|
-
return {
|
|
159
|
-
kind,
|
|
160
|
-
folderKey: kind === "tenant" ? undefined : match.key,
|
|
161
|
-
name: match.name
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
function matchFeed(feed, locations) {
|
|
165
|
-
const byKey = locations.find((location) => location.key === feed);
|
|
166
|
-
if (byKey) {
|
|
167
|
-
return byKey;
|
|
168
|
-
}
|
|
169
|
-
const target = feed.toLowerCase();
|
|
170
|
-
const byName = locations.filter((location) => location.name.toLowerCase() === target);
|
|
171
|
-
if (byName.length === 1) {
|
|
172
|
-
return byName[0];
|
|
173
|
-
}
|
|
174
|
-
if (byName.length > 1) {
|
|
175
|
-
throw new Error(`More than one feed is named '${feed}'. Pass its key instead — ` + "'uip solution feeds list' shows each feed's key.");
|
|
176
|
-
}
|
|
177
|
-
throw new Error(`Feed '${feed}' is not an available publish location. ` + "Run 'uip solution feeds list' to see the feeds you can publish to.");
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export { resolvePersonalWorkspace, listSelectablePublishLocations, folderKeyInitOverride, feedScopeInitOverride, feedSelectorFlag, feedResolutionFailureInstructions, describeFeedResolutionFailureAsync, resolveFeedScope };
|
|
181
|
-
|
|
182
|
-
//# debugId=5F1D84C9922C98B064756E2164756E21
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ProjectPackager,
|
|
3
|
-
ProjectPublisher,
|
|
4
|
-
ToolLogger,
|
|
5
|
-
setGlobalLogHandler
|
|
6
|
-
} from "./packager-tool-wm0jaz7p.js";
|
|
7
|
-
import {
|
|
8
|
-
ToolResult,
|
|
9
|
-
translate
|
|
10
|
-
} from "./packager-tool-pbmqk39a.js";
|
|
11
|
-
import {
|
|
12
|
-
DebugTelemetryProvider,
|
|
13
|
-
NodeContextStorage
|
|
14
|
-
} from "./packager-tool-tx834spe.js";
|
|
15
|
-
import {
|
|
16
|
-
TelemetryService
|
|
17
|
-
} from "./packager-tool-6ybywxxn.js";
|
|
18
|
-
import {
|
|
19
|
-
NodeFileSystem
|
|
20
|
-
} from "./packager-tool-v1f5e8t9.js";
|
|
21
|
-
// ../packager/project-packager/src/base-node-packager-factory.ts
|
|
22
|
-
class BaseNodePackagerFactory {
|
|
23
|
-
dotnetDiscovery;
|
|
24
|
-
getOrCreateFileSystem(config) {
|
|
25
|
-
return config?.fileSystem ?? new NodeFileSystem;
|
|
26
|
-
}
|
|
27
|
-
getOrCreateTelemetryService(config) {
|
|
28
|
-
if (config?.telemetryService) {
|
|
29
|
-
return config.telemetryService;
|
|
30
|
-
}
|
|
31
|
-
const provider = new DebugTelemetryProvider;
|
|
32
|
-
const contextStorage = new NodeContextStorage;
|
|
33
|
-
return new TelemetryService(provider, contextStorage);
|
|
34
|
-
}
|
|
35
|
-
checkDotnetAvailability(logger) {
|
|
36
|
-
if (!this.dotnetDiscovery) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const version = this.dotnetDiscovery.getDotnetVersion();
|
|
40
|
-
if (version) {
|
|
41
|
-
logger.info(translate.t("solutionpackager.dotnet.info.available", {
|
|
42
|
-
version
|
|
43
|
-
}));
|
|
44
|
-
} else {
|
|
45
|
-
logger.warn(translate.t("solutionpackager.dotnet.warnings.notAvailable"));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
configureLogHandler(config) {
|
|
49
|
-
if (config?.logHandler) {
|
|
50
|
-
setGlobalLogHandler(config.logHandler);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
configureLanguage(config) {
|
|
54
|
-
const language = config?.language ?? "en";
|
|
55
|
-
translate.setLocale(language);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// ../packager/project-packager/src/services/dotnet-discovery-service.ts
|
|
59
|
-
import { execSync } from "node:child_process";
|
|
60
|
-
|
|
61
|
-
class DotnetDiscoveryService {
|
|
62
|
-
cachedVersion;
|
|
63
|
-
isDotnetAvailable() {
|
|
64
|
-
return this.getDotnetVersion() !== undefined;
|
|
65
|
-
}
|
|
66
|
-
getDotnetVersion() {
|
|
67
|
-
if (this.cachedVersion !== undefined) {
|
|
68
|
-
return this.cachedVersion;
|
|
69
|
-
}
|
|
70
|
-
try {
|
|
71
|
-
const output = execSync("dotnet --version", {
|
|
72
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
73
|
-
encoding: "utf-8"
|
|
74
|
-
});
|
|
75
|
-
this.cachedVersion = output.trim();
|
|
76
|
-
return this.cachedVersion;
|
|
77
|
-
} catch {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// ../packager/project-packager/src/services/package-sign-service.ts
|
|
84
|
-
import { spawn } from "node:child_process";
|
|
85
|
-
class NodePackageSignService {
|
|
86
|
-
dotnetDiscovery;
|
|
87
|
-
logger;
|
|
88
|
-
constructor(dotnetDiscovery, logger) {
|
|
89
|
-
this.dotnetDiscovery = dotnetDiscovery;
|
|
90
|
-
this.logger = logger;
|
|
91
|
-
}
|
|
92
|
-
async signPackageAsync(packagePath, certificatePath, certificatePassword, timestampServer) {
|
|
93
|
-
return this.signPackagesAsync([packagePath], certificatePath, certificatePassword, timestampServer);
|
|
94
|
-
}
|
|
95
|
-
async signPackagesAsync(packagePaths, certificatePath, certificatePassword, timestampServer) {
|
|
96
|
-
if (packagePaths.length === 0) {
|
|
97
|
-
return ToolResult.success();
|
|
98
|
-
}
|
|
99
|
-
if (!this.dotnetDiscovery.isDotnetAvailable()) {
|
|
100
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.signing.errors.dotnetNotAvailable"));
|
|
101
|
-
}
|
|
102
|
-
const args = [
|
|
103
|
-
"nuget",
|
|
104
|
-
"sign",
|
|
105
|
-
...packagePaths,
|
|
106
|
-
"--certificate-path",
|
|
107
|
-
certificatePath,
|
|
108
|
-
"--overwrite"
|
|
109
|
-
];
|
|
110
|
-
if (certificatePassword) {
|
|
111
|
-
args.push("--certificate-password", certificatePassword);
|
|
112
|
-
}
|
|
113
|
-
if (timestampServer) {
|
|
114
|
-
args.push("--timestamper", timestampServer);
|
|
115
|
-
}
|
|
116
|
-
return new Promise((resolve) => {
|
|
117
|
-
const childProcess = spawn("dotnet", args, {
|
|
118
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
119
|
-
shell: false,
|
|
120
|
-
windowsHide: true
|
|
121
|
-
});
|
|
122
|
-
let stderr = "";
|
|
123
|
-
childProcess.stdout?.on("data", (data) => {
|
|
124
|
-
this.logger.info(data.toString().trim());
|
|
125
|
-
});
|
|
126
|
-
childProcess.stderr?.on("data", (data) => {
|
|
127
|
-
stderr += data.toString();
|
|
128
|
-
});
|
|
129
|
-
childProcess.on("error", (error) => {
|
|
130
|
-
this.logger.error(`Failed to start dotnet process: ${error.message}`);
|
|
131
|
-
resolve(ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Failed to start dotnet process: ${error.message}`));
|
|
132
|
-
});
|
|
133
|
-
childProcess.on("exit", (code) => {
|
|
134
|
-
if (code === 0) {
|
|
135
|
-
this.logger.info(`Successfully signed packages: ${packagePaths.join(", ")}`);
|
|
136
|
-
resolve(ToolResult.success());
|
|
137
|
-
} else {
|
|
138
|
-
const errorMessage = stderr.trim() || `dotnet nuget sign exited with code ${code}`;
|
|
139
|
-
this.logger.error(`Package signing failed: ${errorMessage}`);
|
|
140
|
-
resolve(ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Package signing failed: ${errorMessage}`));
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// ../packager/project-packager/src/node-project-packager-factory.ts
|
|
148
|
-
class NodeProjectPackagerFactory extends BaseNodePackagerFactory {
|
|
149
|
-
async createAsync(config) {
|
|
150
|
-
const logger = new ToolLogger("ProjectPackagerFactory", "Create");
|
|
151
|
-
this.configureLanguage(config);
|
|
152
|
-
this.configureLogHandler(config);
|
|
153
|
-
logger.info("Creating ProjectPackager instance...");
|
|
154
|
-
const fileSystem = this.getOrCreateFileSystem(config);
|
|
155
|
-
const telemetryService = this.getOrCreateTelemetryService(config);
|
|
156
|
-
this.dotnetDiscovery = new DotnetDiscoveryService;
|
|
157
|
-
const packageSignService = new NodePackageSignService(this.dotnetDiscovery, logger);
|
|
158
|
-
const projectPackager = new ProjectPackager(fileSystem, telemetryService, packageSignService);
|
|
159
|
-
this.checkDotnetAvailability(logger);
|
|
160
|
-
logger.info("ProjectPackager created successfully.");
|
|
161
|
-
return projectPackager;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
async function createNodeProjectPackager(options) {
|
|
165
|
-
const factory = new NodeProjectPackagerFactory;
|
|
166
|
-
return factory.createAsync(options);
|
|
167
|
-
}
|
|
168
|
-
// ../packager/project-packager/src/publish/node-project-publisher-factory.ts
|
|
169
|
-
class NodeProjectPublisherFactory extends BaseNodePackagerFactory {
|
|
170
|
-
async createAsync(config) {
|
|
171
|
-
const logger = new ToolLogger("ProjectPublisherFactory", "Create");
|
|
172
|
-
this.configureLanguage(config);
|
|
173
|
-
this.configureLogHandler(config);
|
|
174
|
-
logger.info("Creating ProjectPublisher instance...");
|
|
175
|
-
const fileSystem = this.getOrCreateFileSystem(config);
|
|
176
|
-
this.getOrCreateTelemetryService(config);
|
|
177
|
-
const projectPublisher = new ProjectPublisher(fileSystem);
|
|
178
|
-
logger.info("ProjectPublisher created successfully.");
|
|
179
|
-
return projectPublisher;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
async function createNodeProjectPublisher(options) {
|
|
183
|
-
const factory = new NodeProjectPublisherFactory;
|
|
184
|
-
return factory.createAsync(options);
|
|
185
|
-
}
|
|
186
|
-
export { BaseNodePackagerFactory, DotnetDiscoveryService, NodePackageSignService, createNodeProjectPackager, createNodeProjectPublisher };
|
|
187
|
-
|
|
188
|
-
//# debugId=D4A8E25A7C76BDD464756E2164756E21
|