@uipath/project-packager 1.1.5 → 1.1.15

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/node.js CHANGED
@@ -1,915 +1,1887 @@
1
- import { I18nManager, LogLevel, LogMessage, NugetPackager, Path, ProjectTypes, TemporaryStorageService, ToolErrorCodes, ToolResult, ZipService, toolsFactoryRepository, translate } from "@uipath/solutionpackager-tool-core";
2
- import { ConsoleTelemetryProvider, NodeContextStorage, TelemetryService } from "@uipath/telemetry/node";
3
- import { execSync, spawn } from "node:child_process";
4
- import { NodeFileSystem } from "@uipath/filesystem";
5
- var de_namespaceObject = JSON.parse('{"solutionpackager":{"projectLoader":{"errors":{"pathRequired":"Project directory path is required","noProjectFile":"No {projectFile} or {manifestFile} found in directory: {path}","readFailed":"Failed to read project file: {path}","invalidProject":"Invalid project file: {path}. Missing ProjectType field."}},"validator":{"errors":{"destinationNotDefined":"Destination path is not defined","governanceRequired":"Governance file path is required when governance file type is not Default","governanceFileInfo":"Unable to get file information: {path}","governanceInvalidFile":"Governance file path is not a valid file: {path}"}},"packager":{"errors":{"failedToGetStreams":"Cannot get package streams from failed result. Error code: {errorCode}, message: {message}","failedToReadPackage":"Failed to read package file: {path}"}},"signing":{"errors":{"dotnetNotAvailable":"dotnet CLI is not available. Package signing requires dotnet CLI to be installed."},"info":{"dotnetNotAvailable":"dotnet CLI is not available. Cannot sign package."}}}}');
6
- const en = {
7
- solutionpackager: {
8
- projectLoader: {
9
- errors: {
10
- pathRequired: "Project directory path is required",
11
- noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
12
- readFailed: "Failed to read project file: {path}",
13
- invalidProject: "Invalid project file: {path}. Missing ProjectType field."
14
- }
15
- },
16
- validator: {
17
- errors: {
18
- destinationNotDefined: "Destination path is not defined",
19
- governanceRequired: "Governance file path is required when governance file type is not Default",
20
- governanceFileInfo: "Unable to get file information: {path}",
21
- governanceInvalidFile: "Governance file path is not a valid file: {path}"
22
- }
23
- },
24
- packager: {
25
- errors: {
26
- failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
27
- failedToReadPackage: "Failed to read package file: {path}"
28
- }
29
- },
30
- signing: {
31
- errors: {
32
- dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
33
- },
34
- info: {
35
- dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
36
- }
37
- }
1
+ // src/i18n/index.ts
2
+ import { I18nManager } from "@uipath/solutionpackager-tool-core";
3
+ // src/i18n/locales/de.json
4
+ var de_default = {
5
+ solutionpackager: {
6
+ projectLoader: {
7
+ errors: {
8
+ pathRequired: "Project directory path is required",
9
+ noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
10
+ readFailed: "Failed to read project file: {path}",
11
+ invalidProject: "Invalid project file: {path}. Missing ProjectType field."
12
+ }
13
+ },
14
+ validator: {
15
+ errors: {
16
+ destinationNotDefined: "Destination path is not defined",
17
+ governanceRequired: "Governance file path is required when governance file type is not Default",
18
+ governanceFileInfo: "Unable to get file information: {path}",
19
+ governanceInvalidFile: "Governance file path is not a valid file: {path}"
20
+ }
21
+ },
22
+ packager: {
23
+ errors: {
24
+ failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
25
+ failedToReadPackage: "Failed to read package file: {path}"
26
+ }
27
+ },
28
+ governance: {
29
+ info: {
30
+ alreadyProvided: "Governance policy file already provided, skipping download.",
31
+ saved: "Governance policy saved to {path}",
32
+ downloading: "Downloading governance policy from {url}",
33
+ noPolicyFound: "No governance policy found for this configuration.",
34
+ responseNotJson: "Policy response is not JSON, treating as no policy.",
35
+ licenseStatus: "AcquireLicense returned {status}, using {fallback}.",
36
+ licenseResponse: "AcquireLicense: isLicensed={isLicensed}, robotType={robotType}",
37
+ licenseFailed: "AcquireLicense failed: {error}. Using {fallback}."
38
+ },
39
+ errors: {
40
+ connectionIncomplete: "Connection info incomplete, falling back to Default governance.",
41
+ failedToGetPolicy: "Failed to download governance policy: {content}",
42
+ failedToSave: "Failed to save governance policy: {error}. Falling back to Default governance.",
43
+ failedToDownload: "Failed to download governance policy: {error}. Falling back to Default governance."
44
+ }
45
+ },
46
+ signing: {
47
+ errors: {
48
+ dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
49
+ },
50
+ info: {
51
+ dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
52
+ }
38
53
  }
54
+ }
39
55
  };
40
- var es_namespaceObject = JSON.parse('{"solutionpackager":{"projectLoader":{"errors":{"pathRequired":"Project directory path is required","noProjectFile":"No {projectFile} or {manifestFile} found in directory: {path}","readFailed":"Failed to read project file: {path}","invalidProject":"Invalid project file: {path}. Missing ProjectType field."}},"validator":{"errors":{"destinationNotDefined":"Destination path is not defined","governanceRequired":"Governance file path is required when governance file type is not Default","governanceFileInfo":"Unable to get file information: {path}","governanceInvalidFile":"Governance file path is not a valid file: {path}"}},"packager":{"errors":{"failedToGetStreams":"Cannot get package streams from failed result. Error code: {errorCode}, message: {message}","failedToReadPackage":"Failed to read package file: {path}"}},"signing":{"errors":{"dotnetNotAvailable":"dotnet CLI is not available. Package signing requires dotnet CLI to be installed."},"info":{"dotnetNotAvailable":"dotnet CLI is not available. Cannot sign package."}}}}');
41
- var es_MX_namespaceObject = JSON.parse('{"solutionpackager":{"projectLoader":{"errors":{"pathRequired":"Project directory path is required","noProjectFile":"No {projectFile} or {manifestFile} found in directory: {path}","readFailed":"Failed to read project file: {path}","invalidProject":"Invalid project file: {path}. Missing ProjectType field."}},"validator":{"errors":{"destinationNotDefined":"Destination path is not defined","governanceRequired":"Governance file path is required when governance file type is not Default","governanceFileInfo":"Unable to get file information: {path}","governanceInvalidFile":"Governance file path is not a valid file: {path}"}},"packager":{"errors":{"failedToGetStreams":"Cannot get package streams from failed result. Error code: {errorCode}, message: {message}","failedToReadPackage":"Failed to read package file: {path}"}},"signing":{"errors":{"dotnetNotAvailable":"dotnet CLI is not available. Package signing requires dotnet CLI to be installed."},"info":{"dotnetNotAvailable":"dotnet CLI is not available. Cannot sign package."}}}}');
42
- var fr_namespaceObject = JSON.parse('{"solutionpackager":{"projectLoader":{"errors":{"pathRequired":"Project directory path is required","noProjectFile":"No {projectFile} or {manifestFile} found in directory: {path}","readFailed":"Failed to read project file: {path}","invalidProject":"Invalid project file: {path}. Missing ProjectType field."}},"validator":{"errors":{"destinationNotDefined":"Destination path is not defined","governanceRequired":"Governance file path is required when governance file type is not Default","governanceFileInfo":"Unable to get file information: {path}","governanceInvalidFile":"Governance file path is not a valid file: {path}"}},"packager":{"errors":{"failedToGetStreams":"Cannot get package streams from failed result. Error code: {errorCode}, message: {message}","failedToReadPackage":"Failed to read package file: {path}"}},"signing":{"errors":{"dotnetNotAvailable":"dotnet CLI is not available. Package signing requires dotnet CLI to be installed."},"info":{"dotnetNotAvailable":"dotnet CLI is not available. Cannot sign package."}}}}');
43
- var ja_namespaceObject = JSON.parse('{"solutionpackager":{"projectLoader":{"errors":{"pathRequired":"Project directory path is required","noProjectFile":"No {projectFile} or {manifestFile} found in directory: {path}","readFailed":"Failed to read project file: {path}","invalidProject":"Invalid project file: {path}. Missing ProjectType field."}},"validator":{"errors":{"destinationNotDefined":"Destination path is not defined","governanceRequired":"Governance file path is required when governance file type is not Default","governanceFileInfo":"Unable to get file information: {path}","governanceInvalidFile":"Governance file path is not a valid file: {path}"}},"packager":{"errors":{"failedToGetStreams":"Cannot get package streams from failed result. Error code: {errorCode}, message: {message}","failedToReadPackage":"Failed to read package file: {path}"}},"signing":{"errors":{"dotnetNotAvailable":"dotnet CLI is not available. Package signing requires dotnet CLI to be installed."},"info":{"dotnetNotAvailable":"dotnet CLI is not available. Cannot sign package."}}}}');
44
- var ko_namespaceObject = JSON.parse('{"solutionpackager":{"projectLoader":{"errors":{"pathRequired":"Project directory path is required","noProjectFile":"No {projectFile} or {manifestFile} found in directory: {path}","readFailed":"Failed to read project file: {path}","invalidProject":"Invalid project file: {path}. Missing ProjectType field."}},"validator":{"errors":{"destinationNotDefined":"Destination path is not defined","governanceRequired":"Governance file path is required when governance file type is not Default","governanceFileInfo":"Unable to get file information: {path}","governanceInvalidFile":"Governance file path is not a valid file: {path}"}},"packager":{"errors":{"failedToGetStreams":"Cannot get package streams from failed result. Error code: {errorCode}, message: {message}","failedToReadPackage":"Failed to read package file: {path}"}},"signing":{"errors":{"dotnetNotAvailable":"dotnet CLI is not available. Package signing requires dotnet CLI to be installed."},"info":{"dotnetNotAvailable":"dotnet CLI is not available. Cannot sign package."}}}}');
45
- var pt_namespaceObject = JSON.parse('{"solutionpackager":{"projectLoader":{"errors":{"pathRequired":"Project directory path is required","noProjectFile":"No {projectFile} or {manifestFile} found in directory: {path}","readFailed":"Failed to read project file: {path}","invalidProject":"Invalid project file: {path}. Missing ProjectType field."}},"validator":{"errors":{"destinationNotDefined":"Destination path is not defined","governanceRequired":"Governance file path is required when governance file type is not Default","governanceFileInfo":"Unable to get file information: {path}","governanceInvalidFile":"Governance file path is not a valid file: {path}"}},"packager":{"errors":{"failedToGetStreams":"Cannot get package streams from failed result. Error code: {errorCode}, message: {message}","failedToReadPackage":"Failed to read package file: {path}"}},"signing":{"errors":{"dotnetNotAvailable":"dotnet CLI is not available. Package signing requires dotnet CLI to be installed."},"info":{"dotnetNotAvailable":"dotnet CLI is not available. Cannot sign package."}}}}');
46
- var pt_BR_namespaceObject = JSON.parse('{"solutionpackager":{"projectLoader":{"errors":{"pathRequired":"Project directory path is required","noProjectFile":"No {projectFile} or {manifestFile} found in directory: {path}","readFailed":"Failed to read project file: {path}","invalidProject":"Invalid project file: {path}. Missing ProjectType field."}},"validator":{"errors":{"destinationNotDefined":"Destination path is not defined","governanceRequired":"Governance file path is required when governance file type is not Default","governanceFileInfo":"Unable to get file information: {path}","governanceInvalidFile":"Governance file path is not a valid file: {path}"}},"packager":{"errors":{"failedToGetStreams":"Cannot get package streams from failed result. Error code: {errorCode}, message: {message}","failedToReadPackage":"Failed to read package file: {path}"}},"signing":{"errors":{"dotnetNotAvailable":"dotnet CLI is not available. Package signing requires dotnet CLI to be installed."},"info":{"dotnetNotAvailable":"dotnet CLI is not available. Cannot sign package."}}}}');
47
- var ro_namespaceObject = JSON.parse('{"solutionpackager":{"projectLoader":{"errors":{"pathRequired":"Project directory path is required","noProjectFile":"No {projectFile} or {manifestFile} found in directory: {path}","readFailed":"Failed to read project file: {path}","invalidProject":"Invalid project file: {path}. Missing ProjectType field."}},"validator":{"errors":{"destinationNotDefined":"Destination path is not defined","governanceRequired":"Governance file path is required when governance file type is not Default","governanceFileInfo":"Unable to get file information: {path}","governanceInvalidFile":"Governance file path is not a valid file: {path}"}},"packager":{"errors":{"failedToGetStreams":"Cannot get package streams from failed result. Error code: {errorCode}, message: {message}","failedToReadPackage":"Failed to read package file: {path}"}},"signing":{"errors":{"dotnetNotAvailable":"dotnet CLI is not available. Package signing requires dotnet CLI to be installed."},"info":{"dotnetNotAvailable":"dotnet CLI is not available. Cannot sign package."}}}}');
48
- var ru_namespaceObject = JSON.parse('{"solutionpackager":{"projectLoader":{"errors":{"pathRequired":"Project directory path is required","noProjectFile":"No {projectFile} or {manifestFile} found in directory: {path}","readFailed":"Failed to read project file: {path}","invalidProject":"Invalid project file: {path}. Missing ProjectType field."}},"validator":{"errors":{"destinationNotDefined":"Destination path is not defined","governanceRequired":"Governance file path is required when governance file type is not Default","governanceFileInfo":"Unable to get file information: {path}","governanceInvalidFile":"Governance file path is not a valid file: {path}"}},"packager":{"errors":{"failedToGetStreams":"Cannot get package streams from failed result. Error code: {errorCode}, message: {message}","failedToReadPackage":"Failed to read package file: {path}"}},"signing":{"errors":{"dotnetNotAvailable":"dotnet CLI is not available. Package signing requires dotnet CLI to be installed."},"info":{"dotnetNotAvailable":"dotnet CLI is not available. Cannot sign package."}}}}');
49
- var tr_namespaceObject = JSON.parse('{"solutionpackager":{"projectLoader":{"errors":{"pathRequired":"Project directory path is required","noProjectFile":"No {projectFile} or {manifestFile} found in directory: {path}","readFailed":"Failed to read project file: {path}","invalidProject":"Invalid project file: {path}. Missing ProjectType field."}},"validator":{"errors":{"destinationNotDefined":"Destination path is not defined","governanceRequired":"Governance file path is required when governance file type is not Default","governanceFileInfo":"Unable to get file information: {path}","governanceInvalidFile":"Governance file path is not a valid file: {path}"}},"packager":{"errors":{"failedToGetStreams":"Cannot get package streams from failed result. Error code: {errorCode}, message: {message}","failedToReadPackage":"Failed to read package file: {path}"}},"signing":{"errors":{"dotnetNotAvailable":"dotnet CLI is not available. Package signing requires dotnet CLI to be installed."},"info":{"dotnetNotAvailable":"dotnet CLI is not available. Cannot sign package."}}}}');
50
- var zh_CN_namespaceObject = JSON.parse('{"solutionpackager":{"projectLoader":{"errors":{"pathRequired":"Project directory path is required","noProjectFile":"No {projectFile} or {manifestFile} found in directory: {path}","readFailed":"Failed to read project file: {path}","invalidProject":"Invalid project file: {path}. Missing ProjectType field."}},"validator":{"errors":{"destinationNotDefined":"Destination path is not defined","governanceRequired":"Governance file path is required when governance file type is not Default","governanceFileInfo":"Unable to get file information: {path}","governanceInvalidFile":"Governance file path is not a valid file: {path}"}},"packager":{"errors":{"failedToGetStreams":"Cannot get package streams from failed result. Error code: {errorCode}, message: {message}","failedToReadPackage":"Failed to read package file: {path}"}},"signing":{"errors":{"dotnetNotAvailable":"dotnet CLI is not available. Package signing requires dotnet CLI to be installed."},"info":{"dotnetNotAvailable":"dotnet CLI is not available. Cannot sign package."}}}}');
51
- var zh_TW_namespaceObject = JSON.parse('{"solutionpackager":{"projectLoader":{"errors":{"pathRequired":"Project directory path is required","noProjectFile":"No {projectFile} or {manifestFile} found in directory: {path}","readFailed":"Failed to read project file: {path}","invalidProject":"Invalid project file: {path}. Missing ProjectType field."}},"validator":{"errors":{"destinationNotDefined":"Destination path is not defined","governanceRequired":"Governance file path is required when governance file type is not Default","governanceFileInfo":"Unable to get file information: {path}","governanceInvalidFile":"Governance file path is not a valid file: {path}"}},"packager":{"errors":{"failedToGetStreams":"Cannot get package streams from failed result. Error code: {errorCode}, message: {message}","failedToReadPackage":"Failed to read package file: {path}"}},"signing":{"errors":{"dotnetNotAvailable":"dotnet CLI is not available. Package signing requires dotnet CLI to be installed."},"info":{"dotnetNotAvailable":"dotnet CLI is not available. Cannot sign package."}}}}');
52
- var zu_namespaceObject = JSON.parse('{"solutionpackager":{"projectLoader":{"errors":{"pathRequired":"Project directory path is required","noProjectFile":"No {projectFile} or {manifestFile} found in directory: {path}","readFailed":"Failed to read project file: {path}","invalidProject":"Invalid project file: {path}. Missing ProjectType field."}},"validator":{"errors":{"destinationNotDefined":"Destination path is not defined","governanceRequired":"Governance file path is required when governance file type is not Default","governanceFileInfo":"Unable to get file information: {path}","governanceInvalidFile":"Governance file path is not a valid file: {path}"}},"packager":{"errors":{"failedToGetStreams":"Cannot get package streams from failed result. Error code: {errorCode}, message: {message}","failedToReadPackage":"Failed to read package file: {path}"}},"signing":{"errors":{"dotnetNotAvailable":"dotnet CLI is not available. Package signing requires dotnet CLI to be installed."},"info":{"dotnetNotAvailable":"dotnet CLI is not available. Cannot sign package."}}}}');
53
- I18nManager.registerTranslations("en", en);
54
- I18nManager.registerTranslations("de", de_namespaceObject);
55
- I18nManager.registerTranslations("es", es_namespaceObject);
56
- I18nManager.registerTranslations("es-MX", es_MX_namespaceObject);
57
- I18nManager.registerTranslations("fr", fr_namespaceObject);
58
- I18nManager.registerTranslations("ja", ja_namespaceObject);
59
- I18nManager.registerTranslations("ko", ko_namespaceObject);
60
- I18nManager.registerTranslations("pt", pt_namespaceObject);
61
- I18nManager.registerTranslations("pt-BR", pt_BR_namespaceObject);
62
- I18nManager.registerTranslations("ro", ro_namespaceObject);
63
- I18nManager.registerTranslations("ru", ru_namespaceObject);
64
- I18nManager.registerTranslations("tr", tr_namespaceObject);
65
- I18nManager.registerTranslations("zh-CN", zh_CN_namespaceObject);
66
- I18nManager.registerTranslations("zh-TW", zh_TW_namespaceObject);
67
- I18nManager.registerTranslations("zu", zu_namespaceObject);
68
- function _define_property(obj, key, value) {
69
- if (key in obj) Object.defineProperty(obj, key, {
70
- value: value,
71
- enumerable: true,
72
- configurable: true,
73
- writable: true
74
- });
75
- else obj[key] = value;
76
- return obj;
77
- }
78
- let globalLogHandler = (logMessage)=>{
79
- const formattedMessage = logMessage.toFormattedString();
80
- switch(logMessage.logLevel){
81
- case LogLevel.Debug:
82
- console.debug(formattedMessage);
83
- break;
84
- case LogLevel.Info:
85
- console.info(formattedMessage);
86
- break;
87
- case LogLevel.Warn:
88
- console.warn(formattedMessage);
89
- break;
90
- case LogLevel.Error:
91
- console.error(formattedMessage);
92
- break;
56
+
57
+ // src/i18n/locales/en.ts
58
+ var en = {
59
+ solutionpackager: {
60
+ projectLoader: {
61
+ errors: {
62
+ pathRequired: "Project directory path is required",
63
+ noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
64
+ readFailed: "Failed to read project file: {path}",
65
+ invalidProject: "Invalid project file: {path}. Missing ProjectType field."
66
+ }
67
+ },
68
+ validator: {
69
+ errors: {
70
+ destinationNotDefined: "Destination path is not defined",
71
+ governanceRequired: "Governance file path is required when governance file type is not Default",
72
+ governanceFileInfo: "Unable to get file information: {path}",
73
+ governanceInvalidFile: "Governance file path is not a valid file: {path}"
74
+ }
75
+ },
76
+ packager: {
77
+ errors: {
78
+ failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
79
+ failedToReadPackage: "Failed to read package file: {path}"
80
+ }
81
+ },
82
+ governance: {
83
+ info: {
84
+ alreadyProvided: "Governance policy file already provided, skipping download.",
85
+ saved: "Governance policy saved to {path}",
86
+ downloading: "Downloading governance policy from {url}",
87
+ noPolicyFound: "No governance policy found for this configuration.",
88
+ responseNotJson: "Policy response is not JSON, treating as no policy.",
89
+ licenseStatus: "AcquireLicense returned {status}, using {fallback}.",
90
+ licenseResponse: "AcquireLicense: isLicensed={isLicensed}, robotType={robotType}",
91
+ licenseFailed: "AcquireLicense failed: {error}. Using {fallback}."
92
+ },
93
+ errors: {
94
+ connectionIncomplete: "Connection info incomplete, falling back to Default governance.",
95
+ failedToGetPolicy: "Failed to download governance policy: {content}",
96
+ failedToSave: "Failed to save governance policy: {error}. Falling back to Default governance.",
97
+ failedToDownload: "Failed to download governance policy: {error}. Falling back to Default governance."
98
+ }
99
+ },
100
+ signing: {
101
+ errors: {
102
+ dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
103
+ },
104
+ info: {
105
+ dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
106
+ }
93
107
  }
108
+ }
94
109
  };
95
- function setGlobalLogHandler(handler) {
96
- globalLogHandler = handler;
97
- }
98
- class ToolLogger {
99
- debug(message, options) {
100
- const logMessage = new LogMessage(message, LogLevel.Debug, {
101
- source: this.source,
102
- sourceTarget: this.sourceTarget,
103
- ...options
104
- });
105
- globalLogHandler(logMessage);
110
+ // src/i18n/locales/es.json
111
+ var es_default = {
112
+ solutionpackager: {
113
+ projectLoader: {
114
+ errors: {
115
+ pathRequired: "Project directory path is required",
116
+ noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
117
+ readFailed: "Failed to read project file: {path}",
118
+ invalidProject: "Invalid project file: {path}. Missing ProjectType field."
119
+ }
120
+ },
121
+ validator: {
122
+ errors: {
123
+ destinationNotDefined: "Destination path is not defined",
124
+ governanceRequired: "Governance file path is required when governance file type is not Default",
125
+ governanceFileInfo: "Unable to get file information: {path}",
126
+ governanceInvalidFile: "Governance file path is not a valid file: {path}"
127
+ }
128
+ },
129
+ packager: {
130
+ errors: {
131
+ failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
132
+ failedToReadPackage: "Failed to read package file: {path}"
133
+ }
134
+ },
135
+ governance: {
136
+ info: {
137
+ alreadyProvided: "Governance policy file already provided, skipping download.",
138
+ saved: "Governance policy saved to {path}",
139
+ downloading: "Downloading governance policy from {url}",
140
+ noPolicyFound: "No governance policy found for this configuration.",
141
+ responseNotJson: "Policy response is not JSON, treating as no policy.",
142
+ licenseStatus: "AcquireLicense returned {status}, using {fallback}.",
143
+ licenseResponse: "AcquireLicense: isLicensed={isLicensed}, robotType={robotType}",
144
+ licenseFailed: "AcquireLicense failed: {error}. Using {fallback}."
145
+ },
146
+ errors: {
147
+ connectionIncomplete: "Connection info incomplete, falling back to Default governance.",
148
+ failedToGetPolicy: "Failed to download governance policy: {content}",
149
+ failedToSave: "Failed to save governance policy: {error}. Falling back to Default governance.",
150
+ failedToDownload: "Failed to download governance policy: {error}. Falling back to Default governance."
151
+ }
152
+ },
153
+ signing: {
154
+ errors: {
155
+ dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
156
+ },
157
+ info: {
158
+ dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
159
+ }
106
160
  }
107
- info(message, options) {
108
- const logMessage = new LogMessage(message, LogLevel.Info, {
109
- source: this.source,
110
- sourceTarget: this.sourceTarget,
111
- ...options
112
- });
113
- globalLogHandler(logMessage);
161
+ }
162
+ };
163
+ // src/i18n/locales/es-MX.json
164
+ var es_MX_default = {
165
+ solutionpackager: {
166
+ projectLoader: {
167
+ errors: {
168
+ pathRequired: "Project directory path is required",
169
+ noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
170
+ readFailed: "Failed to read project file: {path}",
171
+ invalidProject: "Invalid project file: {path}. Missing ProjectType field."
172
+ }
173
+ },
174
+ validator: {
175
+ errors: {
176
+ destinationNotDefined: "Destination path is not defined",
177
+ governanceRequired: "Governance file path is required when governance file type is not Default",
178
+ governanceFileInfo: "Unable to get file information: {path}",
179
+ governanceInvalidFile: "Governance file path is not a valid file: {path}"
180
+ }
181
+ },
182
+ packager: {
183
+ errors: {
184
+ failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
185
+ failedToReadPackage: "Failed to read package file: {path}"
186
+ }
187
+ },
188
+ governance: {
189
+ info: {
190
+ alreadyProvided: "Governance policy file already provided, skipping download.",
191
+ saved: "Governance policy saved to {path}",
192
+ downloading: "Downloading governance policy from {url}",
193
+ noPolicyFound: "No governance policy found for this configuration.",
194
+ responseNotJson: "Policy response is not JSON, treating as no policy.",
195
+ licenseStatus: "AcquireLicense returned {status}, using {fallback}.",
196
+ licenseResponse: "AcquireLicense: isLicensed={isLicensed}, robotType={robotType}",
197
+ licenseFailed: "AcquireLicense failed: {error}. Using {fallback}."
198
+ },
199
+ errors: {
200
+ connectionIncomplete: "Connection info incomplete, falling back to Default governance.",
201
+ failedToGetPolicy: "Failed to download governance policy: {content}",
202
+ failedToSave: "Failed to save governance policy: {error}. Falling back to Default governance.",
203
+ failedToDownload: "Failed to download governance policy: {error}. Falling back to Default governance."
204
+ }
205
+ },
206
+ signing: {
207
+ errors: {
208
+ dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
209
+ },
210
+ info: {
211
+ dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
212
+ }
114
213
  }
115
- warn(message, options) {
116
- const logMessage = new LogMessage(message, LogLevel.Warn, {
117
- source: this.source,
118
- sourceTarget: this.sourceTarget,
119
- ...options
120
- });
121
- globalLogHandler(logMessage);
214
+ }
215
+ };
216
+ // src/i18n/locales/fr.json
217
+ var fr_default = {
218
+ solutionpackager: {
219
+ projectLoader: {
220
+ errors: {
221
+ pathRequired: "Project directory path is required",
222
+ noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
223
+ readFailed: "Failed to read project file: {path}",
224
+ invalidProject: "Invalid project file: {path}. Missing ProjectType field."
225
+ }
226
+ },
227
+ validator: {
228
+ errors: {
229
+ destinationNotDefined: "Destination path is not defined",
230
+ governanceRequired: "Governance file path is required when governance file type is not Default",
231
+ governanceFileInfo: "Unable to get file information: {path}",
232
+ governanceInvalidFile: "Governance file path is not a valid file: {path}"
233
+ }
234
+ },
235
+ packager: {
236
+ errors: {
237
+ failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
238
+ failedToReadPackage: "Failed to read package file: {path}"
239
+ }
240
+ },
241
+ governance: {
242
+ info: {
243
+ alreadyProvided: "Governance policy file already provided, skipping download.",
244
+ saved: "Governance policy saved to {path}",
245
+ downloading: "Downloading governance policy from {url}",
246
+ noPolicyFound: "No governance policy found for this configuration.",
247
+ responseNotJson: "Policy response is not JSON, treating as no policy.",
248
+ licenseStatus: "AcquireLicense returned {status}, using {fallback}.",
249
+ licenseResponse: "AcquireLicense: isLicensed={isLicensed}, robotType={robotType}",
250
+ licenseFailed: "AcquireLicense failed: {error}. Using {fallback}."
251
+ },
252
+ errors: {
253
+ connectionIncomplete: "Connection info incomplete, falling back to Default governance.",
254
+ failedToGetPolicy: "Failed to download governance policy: {content}",
255
+ failedToSave: "Failed to save governance policy: {error}. Falling back to Default governance.",
256
+ failedToDownload: "Failed to download governance policy: {error}. Falling back to Default governance."
257
+ }
258
+ },
259
+ signing: {
260
+ errors: {
261
+ dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
262
+ },
263
+ info: {
264
+ dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
265
+ }
122
266
  }
123
- error(message, options) {
124
- const logMessage = new LogMessage(message, LogLevel.Error, {
125
- source: this.source,
126
- sourceTarget: this.sourceTarget,
127
- ...options
128
- });
129
- globalLogHandler(logMessage);
267
+ }
268
+ };
269
+ // src/i18n/locales/ja.json
270
+ var ja_default = {
271
+ solutionpackager: {
272
+ projectLoader: {
273
+ errors: {
274
+ pathRequired: "Project directory path is required",
275
+ noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
276
+ readFailed: "Failed to read project file: {path}",
277
+ invalidProject: "Invalid project file: {path}. Missing ProjectType field."
278
+ }
279
+ },
280
+ validator: {
281
+ errors: {
282
+ destinationNotDefined: "Destination path is not defined",
283
+ governanceRequired: "Governance file path is required when governance file type is not Default",
284
+ governanceFileInfo: "Unable to get file information: {path}",
285
+ governanceInvalidFile: "Governance file path is not a valid file: {path}"
286
+ }
287
+ },
288
+ packager: {
289
+ errors: {
290
+ failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
291
+ failedToReadPackage: "Failed to read package file: {path}"
292
+ }
293
+ },
294
+ governance: {
295
+ info: {
296
+ alreadyProvided: "Governance policy file already provided, skipping download.",
297
+ saved: "Governance policy saved to {path}",
298
+ downloading: "Downloading governance policy from {url}",
299
+ noPolicyFound: "No governance policy found for this configuration.",
300
+ responseNotJson: "Policy response is not JSON, treating as no policy.",
301
+ licenseStatus: "AcquireLicense returned {status}, using {fallback}.",
302
+ licenseResponse: "AcquireLicense: isLicensed={isLicensed}, robotType={robotType}",
303
+ licenseFailed: "AcquireLicense failed: {error}. Using {fallback}."
304
+ },
305
+ errors: {
306
+ connectionIncomplete: "Connection info incomplete, falling back to Default governance.",
307
+ failedToGetPolicy: "Failed to download governance policy: {content}",
308
+ failedToSave: "Failed to save governance policy: {error}. Falling back to Default governance.",
309
+ failedToDownload: "Failed to download governance policy: {error}. Falling back to Default governance."
310
+ }
311
+ },
312
+ signing: {
313
+ errors: {
314
+ dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
315
+ },
316
+ info: {
317
+ dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
318
+ }
130
319
  }
131
- progress(message, options) {
132
- const logMessage = new LogMessage(message, LogLevel.Info, {
133
- source: this.source,
134
- sourceTarget: this.sourceTarget,
135
- ...options
136
- });
137
- globalLogHandler(logMessage);
320
+ }
321
+ };
322
+ // src/i18n/locales/ko.json
323
+ var ko_default = {
324
+ solutionpackager: {
325
+ projectLoader: {
326
+ errors: {
327
+ pathRequired: "Project directory path is required",
328
+ noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
329
+ readFailed: "Failed to read project file: {path}",
330
+ invalidProject: "Invalid project file: {path}. Missing ProjectType field."
331
+ }
332
+ },
333
+ validator: {
334
+ errors: {
335
+ destinationNotDefined: "Destination path is not defined",
336
+ governanceRequired: "Governance file path is required when governance file type is not Default",
337
+ governanceFileInfo: "Unable to get file information: {path}",
338
+ governanceInvalidFile: "Governance file path is not a valid file: {path}"
339
+ }
340
+ },
341
+ packager: {
342
+ errors: {
343
+ failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
344
+ failedToReadPackage: "Failed to read package file: {path}"
345
+ }
346
+ },
347
+ governance: {
348
+ info: {
349
+ alreadyProvided: "Governance policy file already provided, skipping download.",
350
+ saved: "Governance policy saved to {path}",
351
+ downloading: "Downloading governance policy from {url}",
352
+ noPolicyFound: "No governance policy found for this configuration.",
353
+ responseNotJson: "Policy response is not JSON, treating as no policy.",
354
+ licenseStatus: "AcquireLicense returned {status}, using {fallback}.",
355
+ licenseResponse: "AcquireLicense: isLicensed={isLicensed}, robotType={robotType}",
356
+ licenseFailed: "AcquireLicense failed: {error}. Using {fallback}."
357
+ },
358
+ errors: {
359
+ connectionIncomplete: "Connection info incomplete, falling back to Default governance.",
360
+ failedToGetPolicy: "Failed to download governance policy: {content}",
361
+ failedToSave: "Failed to save governance policy: {error}. Falling back to Default governance.",
362
+ failedToDownload: "Failed to download governance policy: {error}. Falling back to Default governance."
363
+ }
364
+ },
365
+ signing: {
366
+ errors: {
367
+ dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
368
+ },
369
+ info: {
370
+ dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
371
+ }
138
372
  }
139
- log(message, logLevel, options) {
140
- const logMessage = new LogMessage(message, logLevel, {
141
- source: this.source,
142
- sourceTarget: this.sourceTarget,
143
- ...options
144
- });
145
- globalLogHandler(logMessage);
373
+ }
374
+ };
375
+ // src/i18n/locales/pt.json
376
+ var pt_default = {
377
+ solutionpackager: {
378
+ projectLoader: {
379
+ errors: {
380
+ pathRequired: "Project directory path is required",
381
+ noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
382
+ readFailed: "Failed to read project file: {path}",
383
+ invalidProject: "Invalid project file: {path}. Missing ProjectType field."
384
+ }
385
+ },
386
+ validator: {
387
+ errors: {
388
+ destinationNotDefined: "Destination path is not defined",
389
+ governanceRequired: "Governance file path is required when governance file type is not Default",
390
+ governanceFileInfo: "Unable to get file information: {path}",
391
+ governanceInvalidFile: "Governance file path is not a valid file: {path}"
392
+ }
393
+ },
394
+ packager: {
395
+ errors: {
396
+ failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
397
+ failedToReadPackage: "Failed to read package file: {path}"
398
+ }
399
+ },
400
+ governance: {
401
+ info: {
402
+ alreadyProvided: "Governance policy file already provided, skipping download.",
403
+ saved: "Governance policy saved to {path}",
404
+ downloading: "Downloading governance policy from {url}",
405
+ noPolicyFound: "No governance policy found for this configuration.",
406
+ responseNotJson: "Policy response is not JSON, treating as no policy.",
407
+ licenseStatus: "AcquireLicense returned {status}, using {fallback}.",
408
+ licenseResponse: "AcquireLicense: isLicensed={isLicensed}, robotType={robotType}",
409
+ licenseFailed: "AcquireLicense failed: {error}. Using {fallback}."
410
+ },
411
+ errors: {
412
+ connectionIncomplete: "Connection info incomplete, falling back to Default governance.",
413
+ failedToGetPolicy: "Failed to download governance policy: {content}",
414
+ failedToSave: "Failed to save governance policy: {error}. Falling back to Default governance.",
415
+ failedToDownload: "Failed to download governance policy: {error}. Falling back to Default governance."
416
+ }
417
+ },
418
+ signing: {
419
+ errors: {
420
+ dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
421
+ },
422
+ info: {
423
+ dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
424
+ }
146
425
  }
147
- logMessage(message) {
148
- globalLogHandler(message);
426
+ }
427
+ };
428
+ // src/i18n/locales/pt-BR.json
429
+ var pt_BR_default = {
430
+ solutionpackager: {
431
+ projectLoader: {
432
+ errors: {
433
+ pathRequired: "Project directory path is required",
434
+ noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
435
+ readFailed: "Failed to read project file: {path}",
436
+ invalidProject: "Invalid project file: {path}. Missing ProjectType field."
437
+ }
438
+ },
439
+ validator: {
440
+ errors: {
441
+ destinationNotDefined: "Destination path is not defined",
442
+ governanceRequired: "Governance file path is required when governance file type is not Default",
443
+ governanceFileInfo: "Unable to get file information: {path}",
444
+ governanceInvalidFile: "Governance file path is not a valid file: {path}"
445
+ }
446
+ },
447
+ packager: {
448
+ errors: {
449
+ failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
450
+ failedToReadPackage: "Failed to read package file: {path}"
451
+ }
452
+ },
453
+ governance: {
454
+ info: {
455
+ alreadyProvided: "Governance policy file already provided, skipping download.",
456
+ saved: "Governance policy saved to {path}",
457
+ downloading: "Downloading governance policy from {url}",
458
+ noPolicyFound: "No governance policy found for this configuration.",
459
+ responseNotJson: "Policy response is not JSON, treating as no policy.",
460
+ licenseStatus: "AcquireLicense returned {status}, using {fallback}.",
461
+ licenseResponse: "AcquireLicense: isLicensed={isLicensed}, robotType={robotType}",
462
+ licenseFailed: "AcquireLicense failed: {error}. Using {fallback}."
463
+ },
464
+ errors: {
465
+ connectionIncomplete: "Connection info incomplete, falling back to Default governance.",
466
+ failedToGetPolicy: "Failed to download governance policy: {content}",
467
+ failedToSave: "Failed to save governance policy: {error}. Falling back to Default governance.",
468
+ failedToDownload: "Failed to download governance policy: {error}. Falling back to Default governance."
469
+ }
470
+ },
471
+ signing: {
472
+ errors: {
473
+ dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
474
+ },
475
+ info: {
476
+ dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
477
+ }
149
478
  }
150
- constructor(source, sourceTarget){
151
- _define_property(this, "source", void 0);
152
- _define_property(this, "sourceTarget", void 0);
153
- this.source = source;
154
- this.sourceTarget = sourceTarget;
479
+ }
480
+ };
481
+ // src/i18n/locales/ro.json
482
+ var ro_default = {
483
+ solutionpackager: {
484
+ projectLoader: {
485
+ errors: {
486
+ pathRequired: "Project directory path is required",
487
+ noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
488
+ readFailed: "Failed to read project file: {path}",
489
+ invalidProject: "Invalid project file: {path}. Missing ProjectType field."
490
+ }
491
+ },
492
+ validator: {
493
+ errors: {
494
+ destinationNotDefined: "Destination path is not defined",
495
+ governanceRequired: "Governance file path is required when governance file type is not Default",
496
+ governanceFileInfo: "Unable to get file information: {path}",
497
+ governanceInvalidFile: "Governance file path is not a valid file: {path}"
498
+ }
499
+ },
500
+ packager: {
501
+ errors: {
502
+ failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
503
+ failedToReadPackage: "Failed to read package file: {path}"
504
+ }
505
+ },
506
+ governance: {
507
+ info: {
508
+ alreadyProvided: "Governance policy file already provided, skipping download.",
509
+ saved: "Governance policy saved to {path}",
510
+ downloading: "Downloading governance policy from {url}",
511
+ noPolicyFound: "No governance policy found for this configuration.",
512
+ responseNotJson: "Policy response is not JSON, treating as no policy.",
513
+ licenseStatus: "AcquireLicense returned {status}, using {fallback}.",
514
+ licenseResponse: "AcquireLicense: isLicensed={isLicensed}, robotType={robotType}",
515
+ licenseFailed: "AcquireLicense failed: {error}. Using {fallback}."
516
+ },
517
+ errors: {
518
+ connectionIncomplete: "Connection info incomplete, falling back to Default governance.",
519
+ failedToGetPolicy: "Failed to download governance policy: {content}",
520
+ failedToSave: "Failed to save governance policy: {error}. Falling back to Default governance.",
521
+ failedToDownload: "Failed to download governance policy: {error}. Falling back to Default governance."
522
+ }
523
+ },
524
+ signing: {
525
+ errors: {
526
+ dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
527
+ },
528
+ info: {
529
+ dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
530
+ }
155
531
  }
156
- }
157
- class BaseNodePackagerFactory {
158
- getOrCreateFileSystem(config) {
159
- return config?.fileSystem ?? new NodeFileSystem();
160
- }
161
- getOrCreateTelemetryService(config) {
162
- if (config?.telemetryService) return config.telemetryService;
163
- const provider = new ConsoleTelemetryProvider();
164
- const contextStorage = new NodeContextStorage();
165
- return new TelemetryService(provider, contextStorage);
166
- }
167
- checkDotnetAvailability(logger) {
168
- logger.info("Checking for dotnet CLI availability...");
169
- try {
170
- execSync("dotnet --version", {
171
- stdio: [
172
- "ignore",
173
- "pipe",
174
- "ignore"
175
- ]
176
- });
177
- logger.info("dotnet CLI is available.");
178
- } catch {
179
- logger.error("dotnet CLI is not available. Workflow compiler functionality and package signing will not be available.");
180
- }
532
+ }
533
+ };
534
+ // src/i18n/locales/ru.json
535
+ var ru_default = {
536
+ solutionpackager: {
537
+ projectLoader: {
538
+ errors: {
539
+ pathRequired: "Project directory path is required",
540
+ noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
541
+ readFailed: "Failed to read project file: {path}",
542
+ invalidProject: "Invalid project file: {path}. Missing ProjectType field."
543
+ }
544
+ },
545
+ validator: {
546
+ errors: {
547
+ destinationNotDefined: "Destination path is not defined",
548
+ governanceRequired: "Governance file path is required when governance file type is not Default",
549
+ governanceFileInfo: "Unable to get file information: {path}",
550
+ governanceInvalidFile: "Governance file path is not a valid file: {path}"
551
+ }
552
+ },
553
+ packager: {
554
+ errors: {
555
+ failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
556
+ failedToReadPackage: "Failed to read package file: {path}"
557
+ }
558
+ },
559
+ governance: {
560
+ info: {
561
+ alreadyProvided: "Governance policy file already provided, skipping download.",
562
+ saved: "Governance policy saved to {path}",
563
+ downloading: "Downloading governance policy from {url}",
564
+ noPolicyFound: "No governance policy found for this configuration.",
565
+ responseNotJson: "Policy response is not JSON, treating as no policy.",
566
+ licenseStatus: "AcquireLicense returned {status}, using {fallback}.",
567
+ licenseResponse: "AcquireLicense: isLicensed={isLicensed}, robotType={robotType}",
568
+ licenseFailed: "AcquireLicense failed: {error}. Using {fallback}."
569
+ },
570
+ errors: {
571
+ connectionIncomplete: "Connection info incomplete, falling back to Default governance.",
572
+ failedToGetPolicy: "Failed to download governance policy: {content}",
573
+ failedToSave: "Failed to save governance policy: {error}. Falling back to Default governance.",
574
+ failedToDownload: "Failed to download governance policy: {error}. Falling back to Default governance."
575
+ }
576
+ },
577
+ signing: {
578
+ errors: {
579
+ dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
580
+ },
581
+ info: {
582
+ dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
583
+ }
181
584
  }
182
- configureLogHandler(config) {
183
- if (config?.logHandler) setGlobalLogHandler(config.logHandler);
585
+ }
586
+ };
587
+ // src/i18n/locales/tr.json
588
+ var tr_default = {
589
+ solutionpackager: {
590
+ projectLoader: {
591
+ errors: {
592
+ pathRequired: "Project directory path is required",
593
+ noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
594
+ readFailed: "Failed to read project file: {path}",
595
+ invalidProject: "Invalid project file: {path}. Missing ProjectType field."
596
+ }
597
+ },
598
+ validator: {
599
+ errors: {
600
+ destinationNotDefined: "Destination path is not defined",
601
+ governanceRequired: "Governance file path is required when governance file type is not Default",
602
+ governanceFileInfo: "Unable to get file information: {path}",
603
+ governanceInvalidFile: "Governance file path is not a valid file: {path}"
604
+ }
605
+ },
606
+ packager: {
607
+ errors: {
608
+ failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
609
+ failedToReadPackage: "Failed to read package file: {path}"
610
+ }
611
+ },
612
+ governance: {
613
+ info: {
614
+ alreadyProvided: "Governance policy file already provided, skipping download.",
615
+ saved: "Governance policy saved to {path}",
616
+ downloading: "Downloading governance policy from {url}",
617
+ noPolicyFound: "No governance policy found for this configuration.",
618
+ responseNotJson: "Policy response is not JSON, treating as no policy.",
619
+ licenseStatus: "AcquireLicense returned {status}, using {fallback}.",
620
+ licenseResponse: "AcquireLicense: isLicensed={isLicensed}, robotType={robotType}",
621
+ licenseFailed: "AcquireLicense failed: {error}. Using {fallback}."
622
+ },
623
+ errors: {
624
+ connectionIncomplete: "Connection info incomplete, falling back to Default governance.",
625
+ failedToGetPolicy: "Failed to download governance policy: {content}",
626
+ failedToSave: "Failed to save governance policy: {error}. Falling back to Default governance.",
627
+ failedToDownload: "Failed to download governance policy: {error}. Falling back to Default governance."
628
+ }
629
+ },
630
+ signing: {
631
+ errors: {
632
+ dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
633
+ },
634
+ info: {
635
+ dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
636
+ }
637
+ }
638
+ }
639
+ };
640
+ // src/i18n/locales/zh-CN.json
641
+ var zh_CN_default = {
642
+ solutionpackager: {
643
+ projectLoader: {
644
+ errors: {
645
+ pathRequired: "Project directory path is required",
646
+ noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
647
+ readFailed: "Failed to read project file: {path}",
648
+ invalidProject: "Invalid project file: {path}. Missing ProjectType field."
649
+ }
650
+ },
651
+ validator: {
652
+ errors: {
653
+ destinationNotDefined: "Destination path is not defined",
654
+ governanceRequired: "Governance file path is required when governance file type is not Default",
655
+ governanceFileInfo: "Unable to get file information: {path}",
656
+ governanceInvalidFile: "Governance file path is not a valid file: {path}"
657
+ }
658
+ },
659
+ packager: {
660
+ errors: {
661
+ failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
662
+ failedToReadPackage: "Failed to read package file: {path}"
663
+ }
664
+ },
665
+ governance: {
666
+ info: {
667
+ alreadyProvided: "Governance policy file already provided, skipping download.",
668
+ saved: "Governance policy saved to {path}",
669
+ downloading: "Downloading governance policy from {url}",
670
+ noPolicyFound: "No governance policy found for this configuration.",
671
+ responseNotJson: "Policy response is not JSON, treating as no policy.",
672
+ licenseStatus: "AcquireLicense returned {status}, using {fallback}.",
673
+ licenseResponse: "AcquireLicense: isLicensed={isLicensed}, robotType={robotType}",
674
+ licenseFailed: "AcquireLicense failed: {error}. Using {fallback}."
675
+ },
676
+ errors: {
677
+ connectionIncomplete: "Connection info incomplete, falling back to Default governance.",
678
+ failedToGetPolicy: "Failed to download governance policy: {content}",
679
+ failedToSave: "Failed to save governance policy: {error}. Falling back to Default governance.",
680
+ failedToDownload: "Failed to download governance policy: {error}. Falling back to Default governance."
681
+ }
682
+ },
683
+ signing: {
684
+ errors: {
685
+ dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
686
+ },
687
+ info: {
688
+ dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
689
+ }
690
+ }
691
+ }
692
+ };
693
+ // src/i18n/locales/zh-TW.json
694
+ var zh_TW_default = {
695
+ solutionpackager: {
696
+ projectLoader: {
697
+ errors: {
698
+ pathRequired: "Project directory path is required",
699
+ noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
700
+ readFailed: "Failed to read project file: {path}",
701
+ invalidProject: "Invalid project file: {path}. Missing ProjectType field."
702
+ }
703
+ },
704
+ validator: {
705
+ errors: {
706
+ destinationNotDefined: "Destination path is not defined",
707
+ governanceRequired: "Governance file path is required when governance file type is not Default",
708
+ governanceFileInfo: "Unable to get file information: {path}",
709
+ governanceInvalidFile: "Governance file path is not a valid file: {path}"
710
+ }
711
+ },
712
+ packager: {
713
+ errors: {
714
+ failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
715
+ failedToReadPackage: "Failed to read package file: {path}"
716
+ }
717
+ },
718
+ governance: {
719
+ info: {
720
+ alreadyProvided: "Governance policy file already provided, skipping download.",
721
+ saved: "Governance policy saved to {path}",
722
+ downloading: "Downloading governance policy from {url}",
723
+ noPolicyFound: "No governance policy found for this configuration.",
724
+ responseNotJson: "Policy response is not JSON, treating as no policy.",
725
+ licenseStatus: "AcquireLicense returned {status}, using {fallback}.",
726
+ licenseResponse: "AcquireLicense: isLicensed={isLicensed}, robotType={robotType}",
727
+ licenseFailed: "AcquireLicense failed: {error}. Using {fallback}."
728
+ },
729
+ errors: {
730
+ connectionIncomplete: "Connection info incomplete, falling back to Default governance.",
731
+ failedToGetPolicy: "Failed to download governance policy: {content}",
732
+ failedToSave: "Failed to save governance policy: {error}. Falling back to Default governance.",
733
+ failedToDownload: "Failed to download governance policy: {error}. Falling back to Default governance."
734
+ }
735
+ },
736
+ signing: {
737
+ errors: {
738
+ dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
739
+ },
740
+ info: {
741
+ dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
742
+ }
184
743
  }
185
- configureLanguage(config) {
186
- const language = config?.language ?? "en";
187
- translate.setLocale(language);
744
+ }
745
+ };
746
+ // src/i18n/locales/zu.json
747
+ var zu_default = {
748
+ solutionpackager: {
749
+ projectLoader: {
750
+ errors: {
751
+ pathRequired: "Project directory path is required",
752
+ noProjectFile: "No {projectFile} or {manifestFile} found in directory: {path}",
753
+ readFailed: "Failed to read project file: {path}",
754
+ invalidProject: "Invalid project file: {path}. Missing ProjectType field."
755
+ }
756
+ },
757
+ validator: {
758
+ errors: {
759
+ destinationNotDefined: "Destination path is not defined",
760
+ governanceRequired: "Governance file path is required when governance file type is not Default",
761
+ governanceFileInfo: "Unable to get file information: {path}",
762
+ governanceInvalidFile: "Governance file path is not a valid file: {path}"
763
+ }
764
+ },
765
+ packager: {
766
+ errors: {
767
+ failedToGetStreams: "Cannot get package streams from failed result. Error code: {errorCode}, message: {message}",
768
+ failedToReadPackage: "Failed to read package file: {path}"
769
+ }
770
+ },
771
+ governance: {
772
+ info: {
773
+ alreadyProvided: "Governance policy file already provided, skipping download.",
774
+ saved: "Governance policy saved to {path}",
775
+ downloading: "Downloading governance policy from {url}",
776
+ noPolicyFound: "No governance policy found for this configuration.",
777
+ responseNotJson: "Policy response is not JSON, treating as no policy.",
778
+ licenseStatus: "AcquireLicense returned {status}, using {fallback}.",
779
+ licenseResponse: "AcquireLicense: isLicensed={isLicensed}, robotType={robotType}",
780
+ licenseFailed: "AcquireLicense failed: {error}. Using {fallback}."
781
+ },
782
+ errors: {
783
+ connectionIncomplete: "Connection info incomplete, falling back to Default governance.",
784
+ failedToGetPolicy: "Failed to download governance policy: {content}",
785
+ failedToSave: "Failed to save governance policy: {error}. Falling back to Default governance.",
786
+ failedToDownload: "Failed to download governance policy: {error}. Falling back to Default governance."
787
+ }
788
+ },
789
+ signing: {
790
+ errors: {
791
+ dotnetNotAvailable: "dotnet CLI is not available. Package signing requires dotnet CLI to be installed."
792
+ },
793
+ info: {
794
+ dotnetNotAvailable: "dotnet CLI is not available. Cannot sign package."
795
+ }
188
796
  }
797
+ }
798
+ };
799
+
800
+ // src/i18n/index.ts
801
+ I18nManager.registerTranslations("en", en);
802
+ I18nManager.registerTranslations("de", de_default);
803
+ I18nManager.registerTranslations("es", es_default);
804
+ I18nManager.registerTranslations("es-MX", es_MX_default);
805
+ I18nManager.registerTranslations("fr", fr_default);
806
+ I18nManager.registerTranslations("ja", ja_default);
807
+ I18nManager.registerTranslations("ko", ko_default);
808
+ I18nManager.registerTranslations("pt", pt_default);
809
+ I18nManager.registerTranslations("pt-BR", pt_BR_default);
810
+ I18nManager.registerTranslations("ro", ro_default);
811
+ I18nManager.registerTranslations("ru", ru_default);
812
+ I18nManager.registerTranslations("tr", tr_default);
813
+ I18nManager.registerTranslations("zh-CN", zh_CN_default);
814
+ I18nManager.registerTranslations("zh-TW", zh_TW_default);
815
+ I18nManager.registerTranslations("zu", zu_default);
816
+
817
+ // src/node.ts
818
+ import {
819
+ DebugTelemetryProvider as DebugTelemetryProvider2,
820
+ NodeContextStorage as NodeContextStorage2,
821
+ TelemetryService as TelemetryService2
822
+ } from "@uipath/common";
823
+ import { ConsoleTelemetryProvider } from "@uipath/common/telemetry";
824
+
825
+ // src/base-node-packager-factory.ts
826
+ import { execSync } from "node:child_process";
827
+ import {
828
+ DebugTelemetryProvider,
829
+ NodeContextStorage,
830
+ TelemetryService
831
+ } from "@uipath/common";
832
+ import { NodeFileSystem } from "@uipath/filesystem";
833
+ import { translate } from "@uipath/solutionpackager-tool-core";
834
+
835
+ // src/services/tool-logger.ts
836
+ import {
837
+ LogLevel,
838
+ LogMessage
839
+ } from "@uipath/solutionpackager-tool-core";
840
+ var globalLogHandler = (logMessage) => {
841
+ const formattedMessage = logMessage.toFormattedString();
842
+ switch (logMessage.logLevel) {
843
+ case LogLevel.Debug:
844
+ console.debug(formattedMessage);
845
+ break;
846
+ case LogLevel.Info:
847
+ console.info(formattedMessage);
848
+ break;
849
+ case LogLevel.Warn:
850
+ console.warn(formattedMessage);
851
+ break;
852
+ case LogLevel.Error:
853
+ console.error(formattedMessage);
854
+ break;
855
+ }
856
+ };
857
+ function setGlobalLogHandler(handler) {
858
+ globalLogHandler = handler;
189
859
  }
190
- function packager_parameters_define_property(obj, key, value) {
191
- if (key in obj) Object.defineProperty(obj, key, {
192
- value: value,
193
- enumerable: true,
194
- configurable: true,
195
- writable: true
860
+
861
+ class ToolLogger {
862
+ source;
863
+ sourceTarget;
864
+ constructor(source, sourceTarget) {
865
+ this.source = source;
866
+ this.sourceTarget = sourceTarget;
867
+ }
868
+ debug(message, options) {
869
+ const logMessage = new LogMessage(message, LogLevel.Debug, {
870
+ source: this.source,
871
+ sourceTarget: this.sourceTarget,
872
+ ...options
873
+ });
874
+ globalLogHandler(logMessage);
875
+ }
876
+ info(message, options) {
877
+ const logMessage = new LogMessage(message, LogLevel.Info, {
878
+ source: this.source,
879
+ sourceTarget: this.sourceTarget,
880
+ ...options
881
+ });
882
+ globalLogHandler(logMessage);
883
+ }
884
+ warn(message, options) {
885
+ const logMessage = new LogMessage(message, LogLevel.Warn, {
886
+ source: this.source,
887
+ sourceTarget: this.sourceTarget,
888
+ ...options
889
+ });
890
+ globalLogHandler(logMessage);
891
+ }
892
+ error(message, options) {
893
+ const logMessage = new LogMessage(message, LogLevel.Error, {
894
+ source: this.source,
895
+ sourceTarget: this.sourceTarget,
896
+ ...options
897
+ });
898
+ globalLogHandler(logMessage);
899
+ }
900
+ progress(message, options) {
901
+ const logMessage = new LogMessage(message, LogLevel.Info, {
902
+ source: this.source,
903
+ sourceTarget: this.sourceTarget,
904
+ ...options
196
905
  });
197
- else obj[key] = value;
198
- return obj;
906
+ globalLogHandler(logMessage);
907
+ }
908
+ log(message, logLevel, options) {
909
+ const logMessage = new LogMessage(message, logLevel, {
910
+ source: this.source,
911
+ sourceTarget: this.sourceTarget,
912
+ ...options
913
+ });
914
+ globalLogHandler(logMessage);
915
+ }
916
+ logMessage(message) {
917
+ globalLogHandler(message);
918
+ }
199
919
  }
200
- var packager_parameters_RulesConfigFileType = /*#__PURE__*/ function(RulesConfigFileType) {
201
- RulesConfigFileType["Default"] = "Default";
202
- RulesConfigFileType["AutomationOps"] = "AutomationOps";
203
- RulesConfigFileType["Studio"] = "Studio";
204
- return RulesConfigFileType;
205
- }({});
206
- class PackagerParameters {
207
- constructor(){
208
- packager_parameters_define_property(this, "inputPath", void 0);
209
- packager_parameters_define_property(this, "logLevel", LogLevel.Warn);
210
- packager_parameters_define_property(this, "outputPath", void 0);
211
- packager_parameters_define_property(this, "targetFramework", void 0);
212
- packager_parameters_define_property(this, "excludeConfiguredSources", false);
213
- packager_parameters_define_property(this, "nuGetSourcesConfigPath", void 0);
214
- packager_parameters_define_property(this, "detailedLogPath", void 0);
215
- packager_parameters_define_property(this, "connection", void 0);
920
+
921
+ // src/base-node-packager-factory.ts
922
+ class BaseNodePackagerFactory {
923
+ getOrCreateFileSystem(config) {
924
+ return config?.fileSystem ?? new NodeFileSystem;
925
+ }
926
+ getOrCreateTelemetryService(config) {
927
+ if (config?.telemetryService) {
928
+ return config.telemetryService;
929
+ }
930
+ const provider = new DebugTelemetryProvider;
931
+ const contextStorage = new NodeContextStorage;
932
+ return new TelemetryService(provider, contextStorage);
933
+ }
934
+ checkDotnetAvailability(logger) {
935
+ logger.info("Checking for dotnet CLI availability...");
936
+ try {
937
+ execSync("dotnet --version", {
938
+ stdio: ["ignore", "pipe", "ignore"]
939
+ });
940
+ logger.info("dotnet CLI is available.");
941
+ } catch {
942
+ logger.error("dotnet CLI is not available. Workflow compiler functionality and package signing will not be available.");
216
943
  }
944
+ }
945
+ configureLogHandler(config) {
946
+ if (config?.logHandler) {
947
+ setGlobalLogHandler(config.logHandler);
948
+ }
949
+ }
950
+ configureLanguage(config) {
951
+ const language = config?.language ?? "en";
952
+ translate.setLocale(language);
953
+ }
217
954
  }
218
- class ProjectRestoreOptions extends PackagerParameters {
955
+ // src/models/packager-parameters.ts
956
+ import {
957
+ LogLevel as LogLevel2
958
+ } from "@uipath/solutionpackager-tool-core";
959
+ var RulesConfigFileType;
960
+ ((RulesConfigFileType2) => {
961
+ RulesConfigFileType2["Default"] = "Default";
962
+ RulesConfigFileType2["AutomationOps"] = "AutomationOps";
963
+ RulesConfigFileType2["Studio"] = "Studio";
964
+ })(RulesConfigFileType ||= {});
965
+
966
+ class PackagerParameters {
967
+ inputPath;
968
+ downloadUrl;
969
+ logLevel = LogLevel2.Warn;
970
+ outputPath;
971
+ targetFramework;
972
+ excludeConfiguredSources = false;
973
+ nuGetSourcesConfigPath;
974
+ detailedLogPath;
975
+ connection;
976
+ workflowCompilerVersion;
219
977
  }
220
- function project_validate_options_define_property(obj, key, value) {
221
- if (key in obj) Object.defineProperty(obj, key, {
222
- value: value,
223
- enumerable: true,
224
- configurable: true,
225
- writable: true
226
- });
227
- else obj[key] = value;
228
- return obj;
978
+ // src/models/project-restore-options.ts
979
+ class ProjectRestoreOptions extends PackagerParameters {
229
980
  }
981
+
982
+ // src/models/project-validate-options.ts
230
983
  class ProjectValidateOptions extends ProjectRestoreOptions {
231
- constructor(...args){
232
- super(...args), project_validate_options_define_property(this, "validateOptions", {
233
- skipAnalyze: false,
234
- governanceFileType: packager_parameters_RulesConfigFileType.Default
235
- });
236
- }
984
+ validateOptions = {
985
+ skipAnalyze: false,
986
+ skipValidate: false,
987
+ governanceFileType: "Default" /* Default */
988
+ };
237
989
  }
990
+
991
+ // src/models/project-build-options.ts
238
992
  class ProjectBuildOptions extends ProjectValidateOptions {
239
993
  }
240
- function project_pack_options_define_property(obj, key, value) {
241
- if (key in obj) Object.defineProperty(obj, key, {
242
- value: value,
243
- enumerable: true,
244
- configurable: true,
245
- writable: true
246
- });
247
- else obj[key] = value;
248
- return obj;
249
- }
994
+ // src/models/project-pack-options.ts
250
995
  class ProjectPackOptions extends ProjectBuildOptions {
251
- constructor(...args){
252
- super(...args), project_pack_options_define_property(this, "destinationPath", void 0), project_pack_options_define_property(this, "package", void 0), project_pack_options_define_property(this, "signingInfo", void 0), project_pack_options_define_property(this, "packOptions", void 0);
253
- }
254
- }
255
- function package_sign_service_define_property(obj, key, value) {
256
- if (key in obj) Object.defineProperty(obj, key, {
257
- value: value,
258
- enumerable: true,
259
- configurable: true,
260
- writable: true
261
- });
262
- else obj[key] = value;
263
- return obj;
996
+ destinationPath;
997
+ package;
998
+ signingInfo;
999
+ packOptions;
264
1000
  }
1001
+ // src/services/package-sign-service.ts
1002
+ import { execSync as execSync2, spawn } from "node:child_process";
1003
+ import {
1004
+ ToolErrorCodes,
1005
+ ToolResult,
1006
+ translate as translate2
1007
+ } from "@uipath/solutionpackager-tool-core";
1008
+
265
1009
  class NodePackageSignService {
266
- async signPackageAsync(packagePath, certificatePath, certificatePassword, timestampServer) {
267
- if (!this.checkAvailable()) {
268
- this.logger.error(translate.t("solutionpackager.signing.info.dotnetNotAvailable"));
269
- return ToolResult.error(ToolErrorCodes.InternalError, translate.t("solutionpackager.signing.errors.dotnetNotAvailable"));
270
- }
271
- const args = [
272
- "nuget",
273
- "sign",
274
- packagePath,
275
- "--certificate-path",
276
- certificatePath,
277
- "--overwrite"
278
- ];
279
- if (certificatePassword) args.push("--certificate-password", certificatePassword);
280
- if (timestampServer) args.push("--timestamper", timestampServer);
281
- return new Promise((resolve)=>{
282
- const childProcess = spawn("dotnet", args, {
283
- stdio: [
284
- "ignore",
285
- "pipe",
286
- "pipe"
287
- ],
288
- shell: false,
289
- windowsHide: true
290
- });
291
- let stderr = "";
292
- childProcess.stdout?.on("data", (data)=>{
293
- this.logger.info(data.toString().trim());
294
- });
295
- childProcess.stderr?.on("data", (data)=>{
296
- stderr += data.toString();
297
- });
298
- childProcess.on("error", (error)=>{
299
- this.logger.error(`Failed to start dotnet process: ${error.message}`);
300
- resolve(ToolResult.error(ToolErrorCodes.InternalError, `Failed to start dotnet process: ${error.message}`));
301
- });
302
- childProcess.on("exit", (code)=>{
303
- if (0 === code) {
304
- this.logger.info(`Successfully signed package: ${packagePath}`);
305
- resolve(ToolResult.success());
306
- } else {
307
- const errorMessage = stderr.trim() || `dotnet nuget sign exited with code ${code}`;
308
- this.logger.error(`Package signing failed: ${errorMessage}`);
309
- resolve(ToolResult.error(ToolErrorCodes.InternalError, `Package signing failed: ${errorMessage}`));
310
- }
311
- });
312
- });
1010
+ logger;
1011
+ constructor(logger) {
1012
+ this.logger = logger;
1013
+ }
1014
+ async signPackageAsync(packagePath, certificatePath, certificatePassword, timestampServer) {
1015
+ if (!this.checkAvailable()) {
1016
+ this.logger.error(translate2.t("solutionpackager.signing.info.dotnetNotAvailable"));
1017
+ return ToolResult.error(ToolErrorCodes.InternalError, translate2.t("solutionpackager.signing.errors.dotnetNotAvailable"));
313
1018
  }
314
- checkAvailable() {
315
- try {
316
- const output = execSync("dotnet nuget --version", {
317
- stdio: [
318
- "ignore",
319
- "pipe",
320
- "ignore"
321
- ],
322
- encoding: "utf-8"
323
- });
324
- this.logger.info(`dotnet CLI found, version ${output.trim()}`);
325
- return true;
326
- } catch {
327
- return false;
328
- }
1019
+ const args = [
1020
+ "nuget",
1021
+ "sign",
1022
+ packagePath,
1023
+ "--certificate-path",
1024
+ certificatePath,
1025
+ "--overwrite"
1026
+ ];
1027
+ if (certificatePassword) {
1028
+ args.push("--certificate-password", certificatePassword);
329
1029
  }
330
- constructor(logger){
331
- package_sign_service_define_property(this, "logger", void 0);
332
- this.logger = logger;
1030
+ if (timestampServer) {
1031
+ args.push("--timestamper", timestampServer);
333
1032
  }
334
- }
335
- var telemetry_names_TelemetryNames = /*#__PURE__*/ function(TelemetryNames) {
336
- TelemetryNames["ProjectToolPack"] = "ProjectPackager.Tool.Pack";
337
- TelemetryNames["ProjectToolRestore"] = "ProjectPackager.Tool.Restore";
338
- TelemetryNames["ProjectToolValidate"] = "ProjectPackager.Tool.Validate";
339
- TelemetryNames["ProjectToolBuild"] = "ProjectPackager.Tool.Build";
340
- TelemetryNames["ProjectPackagerPack"] = "ProjectPackager.Pack";
341
- TelemetryNames["ProjectPackagerRestore"] = "ProjectPackager.Restore";
342
- TelemetryNames["ProjectPackagerValidate"] = "ProjectPackager.Validate";
343
- TelemetryNames["ProjectPackagerBuild"] = "ProjectPackager.Build";
344
- TelemetryNames["ProjectPackagerProjectLoaded"] = "ProjectPackager.ProjectLoaded";
345
- return TelemetryNames;
346
- }({});
347
- function pack_service_define_property(obj, key, value) {
348
- if (key in obj) Object.defineProperty(obj, key, {
349
- value: value,
350
- enumerable: true,
351
- configurable: true,
352
- writable: true
1033
+ return new Promise((resolve) => {
1034
+ const childProcess = spawn("dotnet", args, {
1035
+ stdio: ["ignore", "pipe", "pipe"],
1036
+ shell: false,
1037
+ windowsHide: true
1038
+ });
1039
+ let stderr = "";
1040
+ childProcess.stdout?.on("data", (data) => {
1041
+ this.logger.info(data.toString().trim());
1042
+ });
1043
+ childProcess.stderr?.on("data", (data) => {
1044
+ stderr += data.toString();
1045
+ });
1046
+ childProcess.on("error", (error) => {
1047
+ this.logger.error(`Failed to start dotnet process: ${error.message}`);
1048
+ resolve(ToolResult.error(ToolErrorCodes.InternalError, `Failed to start dotnet process: ${error.message}`));
1049
+ });
1050
+ childProcess.on("exit", (code) => {
1051
+ if (code === 0) {
1052
+ this.logger.info(`Successfully signed package: ${packagePath}`);
1053
+ resolve(ToolResult.success());
1054
+ } else {
1055
+ const errorMessage = stderr.trim() || `dotnet nuget sign exited with code ${code}`;
1056
+ this.logger.error(`Package signing failed: ${errorMessage}`);
1057
+ resolve(ToolResult.error(ToolErrorCodes.InternalError, `Package signing failed: ${errorMessage}`));
1058
+ }
1059
+ });
353
1060
  });
354
- else obj[key] = value;
355
- return obj;
1061
+ }
1062
+ checkAvailable() {
1063
+ try {
1064
+ const output = execSync2("dotnet nuget --version", {
1065
+ stdio: ["ignore", "pipe", "ignore"],
1066
+ encoding: "utf-8"
1067
+ });
1068
+ this.logger.info(`dotnet CLI found, version ${output.trim()}`);
1069
+ return true;
1070
+ } catch {
1071
+ return false;
1072
+ }
1073
+ }
356
1074
  }
357
- class PackService {
358
- sanitizePackageId(packageId) {
359
- packageId = packageId.trim();
360
- packageId = packageId.replace(this.spacesDotRegex, ".");
361
- packageId = packageId.replace(this.dotDashRegex, "-");
362
- packageId = packageId.replace(this.disallowedCharsRegex, "_");
363
- if (packageId.length > this.MaxPackageIdLength) throw new Error(`Package id ${packageId} exceeds the characters limit of ${this.MaxPackageIdLength}`);
364
- return packageId;
365
- }
366
- constructor(){
367
- pack_service_define_property(this, "disallowedCharsRegex", /[^\w.-]/g);
368
- pack_service_define_property(this, "spacesDotRegex", /[\s.]+/g);
369
- pack_service_define_property(this, "dotDashRegex", /\.*[-:]\.*/g);
370
- pack_service_define_property(this, "MaxPackageIdLength", 100);
1075
+
1076
+ // src/services/project-packager.ts
1077
+ import {
1078
+ toolsFactoryRepository as defaultToolsFactoryRepository,
1079
+ NugetPackager,
1080
+ Path as Path3,
1081
+ TargetFramework,
1082
+ TemporaryStorageService,
1083
+ ToolErrorCodes as ToolErrorCodes4,
1084
+ ToolResult as ToolResult4,
1085
+ translate as translate6,
1086
+ ZipService
1087
+ } from "@uipath/solutionpackager-tool-core";
1088
+
1089
+ // src/telemetry-names.ts
1090
+ var TelemetryNames;
1091
+ ((TelemetryNames2) => {
1092
+ TelemetryNames2["ProjectToolPack"] = "ProjectPackager.Tool.Pack";
1093
+ TelemetryNames2["ProjectToolRestore"] = "ProjectPackager.Tool.Restore";
1094
+ TelemetryNames2["ProjectToolValidate"] = "ProjectPackager.Tool.Validate";
1095
+ TelemetryNames2["ProjectToolBuild"] = "ProjectPackager.Tool.Build";
1096
+ TelemetryNames2["ProjectPackagerPack"] = "ProjectPackager.Pack";
1097
+ TelemetryNames2["ProjectPackagerRestore"] = "ProjectPackager.Restore";
1098
+ TelemetryNames2["ProjectPackagerValidate"] = "ProjectPackager.Validate";
1099
+ TelemetryNames2["ProjectPackagerBuild"] = "ProjectPackager.Build";
1100
+ TelemetryNames2["ProjectPackagerProjectLoaded"] = "ProjectPackager.ProjectLoaded";
1101
+ })(TelemetryNames ||= {});
1102
+
1103
+ // src/services/governance-policy-service.ts
1104
+ import {
1105
+ Path,
1106
+ toRelativeUrl,
1107
+ translate as translate3
1108
+ } from "@uipath/solutionpackager-tool-core";
1109
+ var LICENSE_TYPES = {
1110
+ NoLicense: "NoLicense",
1111
+ Development: "Development",
1112
+ Attended: "Attended",
1113
+ Unattended: "Unattended",
1114
+ StudioX: "StudioX",
1115
+ StudioPro: "StudioPro",
1116
+ AutomationKit: "AutomationKit"
1117
+ };
1118
+ var DEFAULT_PROFILE_KEY = "StudioWeb";
1119
+ var ACQUIRE_LICENSE_PATH = "/orchestrator_/api/StudioWeb/AcquireLicense";
1120
+ var GOVERNANCE_SUBFOLDER = "governance";
1121
+ var GOVERNANCE_FILE_NAME = "governance-policy.json";
1122
+ var errorMessage = (error) => error instanceof Error ? error.message : String(error);
1123
+ var t = (key, params) => translate3.t(`solutionpackager.governance.${key}`, params);
1124
+
1125
+ class GovernancePolicyService {
1126
+ fileSystem;
1127
+ temporaryStorage;
1128
+ fetchFn;
1129
+ logger = new ToolLogger("GovernancePolicyService", "ResolvePolicy");
1130
+ constructor(fileSystem, temporaryStorage, fetchFn = fetch.bind(globalThis)) {
1131
+ this.fileSystem = fileSystem;
1132
+ this.temporaryStorage = temporaryStorage;
1133
+ this.fetchFn = fetchFn;
1134
+ }
1135
+ async resolveGovernancePolicyAsync(validateOptions, connectionInfo, cancellationToken) {
1136
+ if (validateOptions.governanceFileType !== "AutomationOps" /* AutomationOps */) {
1137
+ return;
1138
+ }
1139
+ if (validateOptions.governanceFilePath) {
1140
+ this.logger.info(t("info.alreadyProvided"));
1141
+ return;
1142
+ }
1143
+ const cloudUrl = connectionInfo?.cloudUrl;
1144
+ const organizationId = connectionInfo?.organizationId;
1145
+ const tenantId = connectionInfo?.tenantId;
1146
+ const accessToken = connectionInfo?.accessToken;
1147
+ if (!cloudUrl || !organizationId || !tenantId || !accessToken) {
1148
+ this.logger.warn(t("errors.connectionIncomplete"));
1149
+ validateOptions.governanceFileType = "Default" /* Default */;
1150
+ return;
1151
+ }
1152
+ const profileKey = validateOptions.profileKey ?? DEFAULT_PROFILE_KEY;
1153
+ const orchestratorUrl = toRelativeUrl(cloudUrl);
1154
+ const licenseType = await this.resolveLicenseTypeAsync(profileKey, orchestratorUrl, accessToken, cancellationToken);
1155
+ const policy = await this.downloadPolicyAsync(organizationId, tenantId, accessToken, licenseType, profileKey, cancellationToken);
1156
+ if (!policy) {
1157
+ validateOptions.governanceFileType = "Default" /* Default */;
1158
+ return;
1159
+ }
1160
+ try {
1161
+ const dir = await this.temporaryStorage.getTempSubfolderPathAsync(GOVERNANCE_SUBFOLDER);
1162
+ const filePath = Path.join(dir, GOVERNANCE_FILE_NAME);
1163
+ await this.fileSystem.writeFile(filePath, policy);
1164
+ this.logger.info(t("info.saved", { path: filePath }));
1165
+ validateOptions.governanceFilePath = filePath;
1166
+ } catch (error) {
1167
+ this.logger.warn(t("errors.failedToSave", {
1168
+ error: errorMessage(error)
1169
+ }));
1170
+ validateOptions.governanceFileType = "Default" /* Default */;
371
1171
  }
1172
+ }
1173
+ async downloadPolicyAsync(organizationId, tenantId, accessToken, licenseType, profileKey, cancellationToken) {
1174
+ const policyUrl = `/${organizationId}/roboticsops_` + `/api/Policy/license/${licenseType}/product/${profileKey}/tenant/${tenantId}`;
1175
+ this.logger.info(t("info.downloading", { url: policyUrl }));
1176
+ try {
1177
+ const response = await this.fetchFn(policyUrl, {
1178
+ headers: {
1179
+ Authorization: `Bearer ${accessToken}`,
1180
+ AccountId: organizationId
1181
+ },
1182
+ signal: cancellationToken
1183
+ });
1184
+ if (response.status === 204 || response.status === 404) {
1185
+ this.logger.info(t("info.noPolicyFound"));
1186
+ return null;
1187
+ }
1188
+ if (!response.ok) {
1189
+ const body = await response.text();
1190
+ this.logger.warn(t("errors.failedToGetPolicy", { content: body }));
1191
+ return null;
1192
+ }
1193
+ const content = await response.text();
1194
+ if (!content?.trimStart().startsWith("{")) {
1195
+ this.logger.info(t("info.responseNotJson"));
1196
+ return null;
1197
+ }
1198
+ return content;
1199
+ } catch (error) {
1200
+ this.logger.warn(t("errors.failedToDownload", {
1201
+ error: errorMessage(error)
1202
+ }));
1203
+ return null;
1204
+ }
1205
+ }
1206
+ async resolveLicenseTypeAsync(profileKey, orchestratorUrl, accessToken, cancellationToken) {
1207
+ const isStudioWeb = profileKey === DEFAULT_PROFILE_KEY;
1208
+ const fallback = isStudioWeb ? LICENSE_TYPES.NoLicense : LICENSE_TYPES.Development;
1209
+ try {
1210
+ const response = await this.fetchFn(`${orchestratorUrl}${ACQUIRE_LICENSE_PATH}`, {
1211
+ method: "POST",
1212
+ headers: { Authorization: `Bearer ${accessToken}` },
1213
+ signal: cancellationToken
1214
+ });
1215
+ if (!response.ok) {
1216
+ this.logger.info(t("info.licenseStatus", {
1217
+ status: response.status,
1218
+ fallback
1219
+ }));
1220
+ return fallback;
1221
+ }
1222
+ const { isLicensed, robotType } = await response.json();
1223
+ this.logger.info(t("info.licenseResponse", {
1224
+ isLicensed: String(isLicensed),
1225
+ robotType: String(robotType)
1226
+ }));
1227
+ if (!isLicensed || !robotType) {
1228
+ return fallback;
1229
+ }
1230
+ if (isStudioWeb) {
1231
+ return robotType === LICENSE_TYPES.AutomationKit ? LICENSE_TYPES.AutomationKit : LICENSE_TYPES.NoLicense;
1232
+ }
1233
+ return robotType;
1234
+ } catch (error) {
1235
+ this.logger.info(t("info.licenseFailed", {
1236
+ error: errorMessage(error),
1237
+ fallback
1238
+ }));
1239
+ return fallback;
1240
+ }
1241
+ }
372
1242
  }
373
- function packager_parameters_validator_define_property(obj, key, value) {
374
- if (key in obj) Object.defineProperty(obj, key, {
375
- value: value,
376
- enumerable: true,
377
- configurable: true,
378
- writable: true
379
- });
380
- else obj[key] = value;
381
- return obj;
1243
+
1244
+ // src/services/pack-service.ts
1245
+ class PackService {
1246
+ disallowedCharsRegex = /[^\w.-]/g;
1247
+ spacesDotRegex = /[\s.]+/g;
1248
+ dotDashRegex = /\.{0,10}[-:]\.{0,10}/g;
1249
+ MaxPackageIdLength = 100;
1250
+ sanitizePackageId(packageId) {
1251
+ packageId = packageId.trim();
1252
+ packageId = packageId.replace(this.spacesDotRegex, ".");
1253
+ packageId = packageId.replace(this.dotDashRegex, "-");
1254
+ packageId = packageId.replace(this.disallowedCharsRegex, "_");
1255
+ if (packageId.length > this.MaxPackageIdLength) {
1256
+ throw new Error(`Package id ${packageId} exceeds the characters limit of ${this.MaxPackageIdLength}`);
1257
+ }
1258
+ return packageId;
1259
+ }
382
1260
  }
1261
+
1262
+ // src/services/packager-parameters-validator.ts
1263
+ import {
1264
+ ToolErrorCodes as ToolErrorCodes2,
1265
+ ToolResult as ToolResult2,
1266
+ translate as translate4
1267
+ } from "@uipath/solutionpackager-tool-core";
383
1268
  class PackagerParametersValidator {
384
- async validateAsync(_options, _cancellationToken) {
385
- return ToolResult.success();
386
- }
387
- validateDestinationPath(destinationPath) {
388
- if (!destinationPath) {
389
- const error = translate.t("solutionpackager.validator.errors.destinationNotDefined");
390
- this.logger.error(error);
391
- return ToolResult.error(ToolErrorCodes.InternalError, error);
392
- }
393
- return ToolResult.success();
1269
+ logger;
1270
+ fileSystem;
1271
+ constructor(logger, fileSystem) {
1272
+ this.logger = logger;
1273
+ this.fileSystem = fileSystem;
1274
+ }
1275
+ async validateAsync(_options, _cancellationToken) {
1276
+ return ToolResult2.success();
1277
+ }
1278
+ validateDestinationPath(destinationPath) {
1279
+ if (!destinationPath) {
1280
+ const error = translate4.t("solutionpackager.validator.errors.destinationNotDefined");
1281
+ this.logger.error(error);
1282
+ return ToolResult2.error(ToolErrorCodes2.InternalError, error);
394
1283
  }
395
- async validateGovernanceOptions(validateOptions) {
396
- if (validateOptions.governanceFileType === packager_parameters_RulesConfigFileType.Default) {
397
- if (validateOptions.governanceFilePath) this.logger.warn(`Governance file path '${validateOptions.governanceFilePath}' will be ignored when governance file type is Default`);
398
- return ToolResult.success();
399
- }
400
- if (!validateOptions.governanceFilePath) {
401
- const error = translate.t("solutionpackager.validator.errors.governanceRequired");
402
- this.logger.error(error);
403
- return ToolResult.error(ToolErrorCodes.InternalError, error);
404
- }
405
- try {
406
- const stat = await this.fileSystem.stat(validateOptions.governanceFilePath);
407
- if (!stat) {
408
- const error = translate.t("solutionpackager.validator.errors.governanceFileInfo", {
409
- path: validateOptions.governanceFilePath
410
- });
411
- this.logger.error(error);
412
- return ToolResult.error(ToolErrorCodes.InternalError, error);
413
- }
414
- if (stat.isDirectory()) {
415
- const error = translate.t("solutionpackager.validator.errors.governanceInvalidFile", {
416
- path: validateOptions.governanceFilePath
417
- });
418
- this.logger.error(error);
419
- return ToolResult.error(ToolErrorCodes.InternalError, error);
420
- }
421
- } catch (error) {
422
- const errorMessage = error instanceof Error ? error.message : String(error);
423
- const errorLog = `Governance file not found or inaccessible: ${validateOptions.governanceFilePath}. Error: ${errorMessage}`;
424
- this.logger.error(errorLog);
425
- return ToolResult.error(ToolErrorCodes.InternalError, errorLog);
426
- }
427
- this.logger.info(`Using Studio governance file: ${validateOptions.governanceFilePath}`);
428
- return ToolResult.success();
1284
+ return ToolResult2.success();
1285
+ }
1286
+ async validateGovernanceOptions(validateOptions) {
1287
+ if (validateOptions.governanceFileType === "Default" /* Default */) {
1288
+ if (validateOptions.governanceFilePath) {
1289
+ this.logger.warn(`Governance file path '${validateOptions.governanceFilePath}' will be ignored when governance file type is Default`);
1290
+ }
1291
+ return ToolResult2.success();
429
1292
  }
430
- constructor(logger, fileSystem){
431
- packager_parameters_validator_define_property(this, "logger", void 0);
432
- packager_parameters_validator_define_property(this, "fileSystem", void 0);
433
- this.logger = logger;
434
- this.fileSystem = fileSystem;
1293
+ if (!validateOptions.governanceFilePath) {
1294
+ const error = translate4.t("solutionpackager.validator.errors.governanceRequired");
1295
+ this.logger.error(error);
1296
+ return ToolResult2.error(ToolErrorCodes2.InternalError, error);
435
1297
  }
436
- }
437
- class ProjectBuildOptionsValidator extends PackagerParametersValidator {
438
- async validateAsync(options, _cancellationToken) {
439
- return await this.validateGovernanceOptions(options.validateOptions);
1298
+ try {
1299
+ const stat = await this.fileSystem.stat(validateOptions.governanceFilePath);
1300
+ if (!stat) {
1301
+ const error = translate4.t("solutionpackager.validator.errors.governanceFileInfo", {
1302
+ path: validateOptions.governanceFilePath
1303
+ });
1304
+ this.logger.error(error);
1305
+ return ToolResult2.error(ToolErrorCodes2.InternalError, error);
1306
+ }
1307
+ if (stat.isDirectory()) {
1308
+ const error = translate4.t("solutionpackager.validator.errors.governanceInvalidFile", {
1309
+ path: validateOptions.governanceFilePath
1310
+ });
1311
+ this.logger.error(error);
1312
+ return ToolResult2.error(ToolErrorCodes2.InternalError, error);
1313
+ }
1314
+ } catch (error) {
1315
+ const errorMessage2 = error instanceof Error ? error.message : String(error);
1316
+ const errorLog = `Governance file not found or inaccessible: ${validateOptions.governanceFilePath}. Error: ${errorMessage2}`;
1317
+ this.logger.error(errorLog);
1318
+ return ToolResult2.error(ToolErrorCodes2.InternalError, errorLog);
440
1319
  }
1320
+ this.logger.info(`Using Studio governance file: ${validateOptions.governanceFilePath}`);
1321
+ return ToolResult2.success();
1322
+ }
441
1323
  }
442
- function project_loader_define_property(obj, key, value) {
443
- if (key in obj) Object.defineProperty(obj, key, {
444
- value: value,
445
- enumerable: true,
446
- configurable: true,
447
- writable: true
448
- });
449
- else obj[key] = value;
450
- return obj;
1324
+
1325
+ // src/services/project-build-options-validator.ts
1326
+ class ProjectBuildOptionsValidator extends PackagerParametersValidator {
1327
+ async validateAsync(options, _cancellationToken) {
1328
+ return await this.validateGovernanceOptions(options.validateOptions);
1329
+ }
451
1330
  }
1331
+
1332
+ // src/services/project-loader.ts
1333
+ import {
1334
+ Path as Path2,
1335
+ ProjectTypes,
1336
+ translate as translate5
1337
+ } from "@uipath/solutionpackager-tool-core";
1338
+
452
1339
  class ProjectLoader {
453
- async loadProject(projectPath) {
454
- if (!projectPath) throw new Error(translate.t("solutionpackager.projectLoader.errors.pathRequired"));
455
- const projectFilePath = Path.join(projectPath, ProjectLoader.ProjectFileName);
456
- const projectFileExists = await this.fileSystem.exists(projectFilePath);
457
- if (projectFileExists) return await this.loadFromProjectFile(projectPath, projectFilePath);
458
- const webAppManifestPath = Path.join(projectPath, ProjectLoader.WebAppManifestFileName);
459
- const webAppManifestExists = await this.fileSystem.exists(webAppManifestPath);
460
- if (webAppManifestExists) return this.loadFromWebAppManifest(projectPath, webAppManifestPath);
461
- throw new Error(translate.t("solutionpackager.projectLoader.errors.noProjectFile", {
462
- projectFile: ProjectLoader.ProjectFileName,
463
- manifestFile: ProjectLoader.WebAppManifestFileName,
464
- path: projectPath
465
- }));
1340
+ fileSystem;
1341
+ static ProjectFileName = "project.uiproj";
1342
+ static WebAppManifestFileName = "webAppManifest.json";
1343
+ constructor(fileSystem) {
1344
+ this.fileSystem = fileSystem;
1345
+ }
1346
+ async loadProject(projectPath) {
1347
+ if (!projectPath) {
1348
+ throw new Error(translate5.t("solutionpackager.projectLoader.errors.pathRequired"));
466
1349
  }
467
- async loadFromProjectFile(projectPath, projectFilePath) {
468
- const fileContent = await this.fileSystem.readFile(projectFilePath);
469
- if (!fileContent) throw new Error(translate.t("solutionpackager.projectLoader.errors.readFailed", {
470
- path: projectFilePath
471
- }));
472
- const json = "string" == typeof fileContent ? fileContent : new TextDecoder("utf-8").decode(fileContent);
473
- const projectData = JSON.parse(json);
474
- const projectType = projectData?.ProjectType || projectData?.type;
475
- if (!projectData || !projectType) throw new Error(translate.t("solutionpackager.projectLoader.errors.invalidProject", {
476
- path: projectFilePath
477
- }));
478
- return {
479
- type: projectType,
480
- name: projectData.Name || Path.basename(projectPath),
481
- projectPath,
482
- projectFilePath
483
- };
1350
+ const projectFilePath = Path2.join(projectPath, ProjectLoader.ProjectFileName);
1351
+ const projectFileExists = await this.fileSystem.exists(projectFilePath);
1352
+ if (projectFileExists) {
1353
+ return await this.loadFromProjectFile(projectPath, projectFilePath);
484
1354
  }
485
- loadFromWebAppManifest(projectPath, webAppManifestPath) {
486
- const folderName = Path.basename(projectPath);
487
- return {
488
- type: ProjectTypes.AppV2,
489
- name: folderName,
490
- projectPath,
491
- projectFilePath: webAppManifestPath
492
- };
1355
+ const webAppManifestPath = Path2.join(projectPath, ProjectLoader.WebAppManifestFileName);
1356
+ const webAppManifestExists = await this.fileSystem.exists(webAppManifestPath);
1357
+ if (webAppManifestExists) {
1358
+ return this.loadFromWebAppManifest(projectPath, webAppManifestPath);
493
1359
  }
494
- constructor(fileSystem){
495
- project_loader_define_property(this, "fileSystem", void 0);
496
- this.fileSystem = fileSystem;
1360
+ throw new Error(translate5.t("solutionpackager.projectLoader.errors.noProjectFile", {
1361
+ projectFile: ProjectLoader.ProjectFileName,
1362
+ manifestFile: ProjectLoader.WebAppManifestFileName,
1363
+ path: projectPath
1364
+ }));
1365
+ }
1366
+ async loadFromProjectFile(projectPath, projectFilePath) {
1367
+ const fileContent = await this.fileSystem.readFile(projectFilePath);
1368
+ if (!fileContent) {
1369
+ throw new Error(translate5.t("solutionpackager.projectLoader.errors.readFailed", {
1370
+ path: projectFilePath
1371
+ }));
497
1372
  }
1373
+ const json = typeof fileContent === "string" ? fileContent : new TextDecoder("utf-8").decode(fileContent);
1374
+ const projectData = JSON.parse(json);
1375
+ const projectType = projectData?.ProjectType || projectData?.type;
1376
+ if (!projectData || !projectType) {
1377
+ throw new Error(translate5.t("solutionpackager.projectLoader.errors.invalidProject", {
1378
+ path: projectFilePath
1379
+ }));
1380
+ }
1381
+ return {
1382
+ type: projectType,
1383
+ name: projectData.Name || Path2.basename(projectPath),
1384
+ projectPath,
1385
+ projectFilePath
1386
+ };
1387
+ }
1388
+ loadFromWebAppManifest(projectPath, webAppManifestPath) {
1389
+ const folderName = Path2.basename(projectPath);
1390
+ return {
1391
+ type: ProjectTypes.AppV2,
1392
+ name: folderName,
1393
+ projectPath,
1394
+ projectFilePath: webAppManifestPath
1395
+ };
1396
+ }
498
1397
  }
499
- project_loader_define_property(ProjectLoader, "ProjectFileName", "project.uiproj");
500
- project_loader_define_property(ProjectLoader, "WebAppManifestFileName", "webAppManifest.json");
501
- function project_pack_options_builder_define_property(obj, key, value) {
502
- if (key in obj) Object.defineProperty(obj, key, {
503
- value: value,
504
- enumerable: true,
505
- configurable: true,
506
- writable: true
507
- });
508
- else obj[key] = value;
509
- return obj;
510
- }
1398
+
1399
+ // src/services/project-pack-options-builder.ts
511
1400
  class ProjectPackOptionsBuilder {
512
- async buildProjectPackOptions(parameters, project) {
513
- if (!parameters.outputPath) throw new Error("Output path is required for Pack command");
514
- await this.fileSystem.mkdir(parameters.outputPath);
515
- const packageId = parameters.package.id && "" !== parameters.package.id.trim() ? parameters.package.id : project.name;
516
- const packageInfo = {
517
- ...parameters.package,
518
- id: this.packService.sanitizePackageId(packageId)
519
- };
520
- return {
521
- projectPath: project.projectPath,
522
- excludeConfiguredSources: parameters.excludeConfiguredSources ?? false,
523
- nuGetSourcesConfigPath: parameters.nuGetSourcesConfigPath,
524
- logLevel: parameters.logLevel,
525
- skipAnalyze: parameters.validateOptions.skipAnalyze,
526
- skipValidate: false,
527
- detailedLogPath: parameters.detailedLogPath,
528
- policyFilePath: parameters.validateOptions.governanceFilePath,
529
- policyFileType: parameters.validateOptions.governanceFileType,
530
- outputPath: parameters.outputPath,
531
- outputType: void 0,
532
- projectType: project.type,
533
- package: packageInfo,
534
- skipDependencyOptimization: parameters.packOptions?.skipDependencyOptimization ?? false,
535
- includeSources: parameters.packOptions?.includeSources ?? false,
536
- splitPackages: parameters.packOptions?.splitPackages ?? false
537
- };
538
- }
539
- constructor(packService, fileSystem){
540
- project_pack_options_builder_define_property(this, "packService", void 0);
541
- project_pack_options_builder_define_property(this, "fileSystem", void 0);
542
- this.packService = packService;
543
- this.fileSystem = fileSystem;
1401
+ packService;
1402
+ fileSystem;
1403
+ constructor(packService, fileSystem) {
1404
+ this.packService = packService;
1405
+ this.fileSystem = fileSystem;
1406
+ }
1407
+ async buildProjectPackOptions(parameters, project) {
1408
+ if (!parameters.outputPath) {
1409
+ throw new Error("Output path is required for Pack command");
544
1410
  }
1411
+ await this.fileSystem.mkdir(parameters.outputPath);
1412
+ const packageId = !parameters.package.id || parameters.package.id.trim() === "" ? project.name : parameters.package.id;
1413
+ const packageInfo = {
1414
+ ...parameters.package,
1415
+ id: this.packService.sanitizePackageId(packageId)
1416
+ };
1417
+ return {
1418
+ projectPath: project.projectPath,
1419
+ excludeConfiguredSources: parameters.excludeConfiguredSources ?? false,
1420
+ nuGetSourcesConfigPath: parameters.nuGetSourcesConfigPath,
1421
+ logLevel: parameters.logLevel,
1422
+ skipAnalyze: parameters.validateOptions.skipAnalyze,
1423
+ skipValidate: parameters.validateOptions.skipValidate,
1424
+ detailedLogPath: parameters.detailedLogPath,
1425
+ policyFilePath: parameters.validateOptions.governanceFilePath,
1426
+ policyFileType: parameters.validateOptions.governanceFileType,
1427
+ outputPath: parameters.outputPath,
1428
+ outputType: undefined,
1429
+ projectType: project.type,
1430
+ package: packageInfo,
1431
+ skipDependencyOptimization: parameters.packOptions?.skipDependencyOptimization ?? false,
1432
+ includeSources: parameters.packOptions?.includeSources ?? false,
1433
+ splitPackages: parameters.packOptions?.splitPackages ?? false
1434
+ };
1435
+ }
545
1436
  }
1437
+
1438
+ // src/services/project-pack-options-validator.ts
546
1439
  class ProjectPackOptionsValidator extends ProjectBuildOptionsValidator {
547
- async validateAsync(options, cancellationToken) {
548
- const destinationResult = this.validateDestinationPath(options.destinationPath);
549
- if (!destinationResult.isSuccess) return destinationResult;
550
- return await super.validateAsync(options, cancellationToken);
1440
+ async validateAsync(options, cancellationToken) {
1441
+ const destinationResult = this.validateDestinationPath(options.destinationPath);
1442
+ if (!destinationResult.isSuccess) {
1443
+ return destinationResult;
551
1444
  }
1445
+ return await super.validateAsync(options, cancellationToken);
1446
+ }
552
1447
  }
553
- function project_tool_executor_define_property(obj, key, value) {
554
- if (key in obj) Object.defineProperty(obj, key, {
555
- value: value,
556
- enumerable: true,
557
- configurable: true,
558
- writable: true
559
- });
560
- else obj[key] = value;
561
- return obj;
562
- }
1448
+
1449
+ // src/services/project-tool-executor.ts
1450
+ import {
1451
+ ToolErrorCodes as ToolErrorCodes3,
1452
+ ToolResult as ToolResult3
1453
+ } from "@uipath/solutionpackager-tool-core";
563
1454
  class ProjectToolExecutor {
564
- async restoreAsync(options, project, context, cancellationToken) {
565
- return await this.executeToolOperationAsync(project, context, (tool)=>this.telemetry.trackDependencyOperation(telemetry_names_TelemetryNames.ProjectToolRestore, project.Type, async ()=>tool.restoreAsync(options, cancellationToken), {
566
- projectId: project.Id,
567
- projectType: project.Type
568
- }));
569
- }
570
- async validateAsync(options, project, context, cancellationToken) {
571
- return await this.executeToolOperationAsync(project, context, (tool)=>this.telemetry.trackDependencyOperation(telemetry_names_TelemetryNames.ProjectToolValidate, project.Type, async ()=>tool.validateAsync(options, cancellationToken), {
572
- projectId: project.Id,
573
- projectType: project.Type
574
- }));
575
- }
576
- async buildAsync(options, project, context, cancellationToken) {
577
- return await this.executeToolOperationAsync(project, context, (tool)=>this.telemetry.trackDependencyOperation(telemetry_names_TelemetryNames.ProjectToolBuild, project.Type, async ()=>tool.buildAsync(options, cancellationToken), {
578
- projectId: project.Id,
579
- projectType: project.Type
580
- }));
581
- }
582
- async packAsync(options, project, context, signingInfo, cancellationToken) {
583
- return await this.executeToolOperationAsync(project, context, async (tool)=>{
584
- const result = await this.telemetry.trackDependencyOperation(telemetry_names_TelemetryNames.ProjectToolPack, project.Type, async ()=>await tool.packAsync(options, cancellationToken), {
585
- projectId: project.Id,
586
- projectType: project.Type
587
- });
588
- if (result.isSuccess && signingInfo?.certificatePath && result.packages.length > 0) {
589
- const signResult = await this.signPackagesAsync(result.packages, signingInfo);
590
- if (!signResult.isSuccess) return signResult;
591
- }
592
- return result;
593
- });
594
- }
595
- async executeToolOperationAsync(project, context, operation) {
596
- try {
597
- const tool = await this.toolsFactory.createProjectToolAsync(project, context);
598
- try {
599
- return await operation(tool);
600
- } finally{
601
- const disposeResult = tool.dispose();
602
- if (disposeResult instanceof Promise) await disposeResult;
603
- }
604
- } catch (error) {
605
- return ToolResult.error(ToolErrorCodes.InternalError, error instanceof Error ? error.message : String(error));
1455
+ toolsFactory;
1456
+ telemetry;
1457
+ packageSignService;
1458
+ constructor(toolsFactory, telemetry, packageSignService) {
1459
+ this.toolsFactory = toolsFactory;
1460
+ this.telemetry = telemetry;
1461
+ this.packageSignService = packageSignService;
1462
+ }
1463
+ async restoreAsync(options, project, context, cancellationToken) {
1464
+ return await this.executeToolOperationAsync(project, context, (tool) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Restore" /* ProjectToolRestore */, project.Type, async () => tool.restoreAsync(options, cancellationToken), {
1465
+ projectId: project.Id,
1466
+ projectType: project.Type
1467
+ }));
1468
+ }
1469
+ async validateAsync(options, project, context, cancellationToken) {
1470
+ return await this.executeToolOperationAsync(project, context, (tool) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Validate" /* ProjectToolValidate */, project.Type, async () => tool.validateAsync(options, cancellationToken), {
1471
+ projectId: project.Id,
1472
+ projectType: project.Type
1473
+ }));
1474
+ }
1475
+ async buildAsync(options, project, context, cancellationToken) {
1476
+ return await this.executeToolOperationAsync(project, context, (tool) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Build" /* ProjectToolBuild */, project.Type, async () => tool.buildAsync(options, cancellationToken), {
1477
+ projectId: project.Id,
1478
+ projectType: project.Type
1479
+ }));
1480
+ }
1481
+ async packAsync(options, project, context, signingInfo, cancellationToken) {
1482
+ return await this.executeToolOperationAsync(project, context, async (tool) => {
1483
+ const result = await this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Pack" /* ProjectToolPack */, project.Type, async () => {
1484
+ return await tool.packAsync(options, cancellationToken);
1485
+ }, {
1486
+ projectId: project.Id,
1487
+ projectType: project.Type
1488
+ });
1489
+ if (result.isSuccess && signingInfo?.certificatePath && result.packages.length > 0) {
1490
+ const signResult = await this.signPackagesAsync(result.packages, signingInfo);
1491
+ if (!signResult.isSuccess) {
1492
+ return signResult;
1493
+ }
1494
+ }
1495
+ return result;
1496
+ });
1497
+ }
1498
+ async executeToolOperationAsync(project, context, operation) {
1499
+ try {
1500
+ const tool = await this.toolsFactory.createProjectToolAsync(project, context);
1501
+ try {
1502
+ return await operation(tool);
1503
+ } finally {
1504
+ const disposeResult = tool.dispose();
1505
+ if (disposeResult instanceof Promise) {
1506
+ await disposeResult;
606
1507
  }
1508
+ }
1509
+ } catch (error) {
1510
+ return ToolResult3.error(ToolErrorCodes3.InternalError, error instanceof Error ? error.message : String(error));
607
1511
  }
608
- async signPackagesAsync(packages, signingInfo) {
609
- if (!this.packageSignService) return ToolResult.error(ToolErrorCodes.InternalError, "Package signing is required but signing service is not available. Package signing requires dotnet CLI to be installed in Node.js environment.");
610
- const certificatePath = signingInfo.certificatePath;
611
- const signResults = await Promise.all(packages.map((packagePath)=>this.packageSignService?.signPackageAsync(packagePath, certificatePath, signingInfo.certificatePassword, signingInfo.timestampServer)));
612
- const failedResult = signResults.find((result)=>result && !result.isSuccess);
613
- if (failedResult) return failedResult;
614
- return ToolResult.success();
615
- }
616
- constructor(toolsFactory, telemetry, packageSignService){
617
- project_tool_executor_define_property(this, "toolsFactory", void 0);
618
- project_tool_executor_define_property(this, "telemetry", void 0);
619
- project_tool_executor_define_property(this, "packageSignService", void 0);
620
- this.toolsFactory = toolsFactory;
621
- this.telemetry = telemetry;
622
- this.packageSignService = packageSignService;
1512
+ }
1513
+ async signPackagesAsync(packages, signingInfo) {
1514
+ if (!this.packageSignService) {
1515
+ return ToolResult3.error(ToolErrorCodes3.InternalError, "Package signing is required but signing service is not available. Package signing requires dotnet CLI to be installed in Node.js environment.");
623
1516
  }
624
- }
625
- class ProjectValidateOptionsValidator extends PackagerParametersValidator {
626
- async validateAsync(options, _cancellationToken) {
627
- return await this.validateGovernanceOptions(options.validateOptions);
1517
+ const certificatePath = signingInfo.certificatePath;
1518
+ const signResults = await Promise.all(packages.map((packagePath) => this.packageSignService?.signPackageAsync(packagePath, certificatePath, signingInfo.certificatePassword, signingInfo.timestampServer)));
1519
+ const failedResult = signResults.find((result) => result && !result.isSuccess);
1520
+ if (failedResult) {
1521
+ return failedResult;
628
1522
  }
1523
+ return ToolResult3.success();
1524
+ }
629
1525
  }
630
- function tools_factory_define_property(obj, key, value) {
631
- if (key in obj) Object.defineProperty(obj, key, {
632
- value: value,
633
- enumerable: true,
634
- configurable: true,
635
- writable: true
636
- });
637
- else obj[key] = value;
638
- return obj;
1526
+
1527
+ // src/services/project-validate-options-validator.ts
1528
+ class ProjectValidateOptionsValidator extends PackagerParametersValidator {
1529
+ async validateAsync(options, _cancellationToken) {
1530
+ return await this.validateGovernanceOptions(options.validateOptions);
1531
+ }
639
1532
  }
1533
+
1534
+ // src/services/tools-factory.ts
640
1535
  class ToolsFactory {
641
- async createSolutionToolAsync(solutionName) {
642
- const logger = new ToolLogger("ResourceBuilder", solutionName);
643
- const factory = this.repository.getSolutionToolFactory();
644
- return await factory.createAsync(logger, this.fileSystem);
645
- }
646
- async createProjectToolAsync(project, context) {
647
- const sourceTarget = getSourceTarget();
648
- const logger = new ToolLogger(project.Type, sourceTarget);
649
- if (!project.ProjectPath) throw new Error(`Project path not set for project: ${project.Id}`);
650
- const factory = this.repository.getProjectToolFactory(project.Type);
651
- return await factory.createAsync(logger, this.fileSystem, context);
652
- function getSourceTarget() {
653
- const segments = project.ProjectRelativePath.split(/[/\\]/);
654
- if (segments.length > 1) return segments[0];
655
- return project.Id;
656
- }
1536
+ repository;
1537
+ fileSystem;
1538
+ constructor(repository, fileSystem) {
1539
+ this.repository = repository;
1540
+ this.fileSystem = fileSystem;
1541
+ }
1542
+ async createSolutionToolAsync(solutionName) {
1543
+ const logger = new ToolLogger("ResourceBuilder", solutionName);
1544
+ const factory = this.repository.getSolutionToolFactory();
1545
+ return await factory.createAsync(logger, this.fileSystem);
1546
+ }
1547
+ async createProjectToolAsync(project, context) {
1548
+ const sourceTarget = getSourceTarget();
1549
+ const logger = new ToolLogger(project.Type, sourceTarget);
1550
+ if (!project.ProjectPath) {
1551
+ throw new Error(`Project path not set for project: ${project.Id}`);
657
1552
  }
658
- constructor(repository, fileSystem){
659
- tools_factory_define_property(this, "repository", void 0);
660
- tools_factory_define_property(this, "fileSystem", void 0);
661
- this.repository = repository;
662
- this.fileSystem = fileSystem;
1553
+ const factory = this.repository.getProjectToolFactory(project.Type);
1554
+ return await factory.createAsync(logger, this.fileSystem, context);
1555
+ function getSourceTarget() {
1556
+ const segments = project.ProjectRelativePath.split(/[/\\]/);
1557
+ if (segments.length > 1) {
1558
+ return segments[0];
1559
+ }
1560
+ return project.Id;
663
1561
  }
1562
+ }
664
1563
  }
665
- function project_packager_define_property(obj, key, value) {
666
- if (key in obj) Object.defineProperty(obj, key, {
667
- value: value,
668
- enumerable: true,
669
- configurable: true,
670
- writable: true
671
- });
672
- else obj[key] = value;
673
- return obj;
674
- }
1564
+
1565
+ // src/services/project-packager.ts
675
1566
  class ProjectPackager {
676
- async canPackProjectAsync(projectPath) {
677
- const project = await this.projectLoader.loadProject(projectPath);
678
- return this.repository.canHandleProject(project.type);
1567
+ fileSystem;
1568
+ telemetryService;
1569
+ packageSignService;
1570
+ repository;
1571
+ temporaryStorage;
1572
+ zipService;
1573
+ logger;
1574
+ optionsBuilder;
1575
+ toolsFactory;
1576
+ projectExecutor;
1577
+ projectLoader;
1578
+ validateOptionsValidator;
1579
+ buildOptionsValidator;
1580
+ packOptionsValidator;
1581
+ nugetPackager;
1582
+ governancePolicyService;
1583
+ constructor(fileSystem, telemetryService, packageSignService) {
1584
+ this.fileSystem = fileSystem;
1585
+ this.telemetryService = telemetryService;
1586
+ this.packageSignService = packageSignService;
1587
+ this.repository = defaultToolsFactoryRepository;
1588
+ this.temporaryStorage = new TemporaryStorageService(this.fileSystem);
1589
+ this.zipService = new ZipService(this.fileSystem);
1590
+ this.nugetPackager = new NugetPackager(this.fileSystem);
1591
+ this.logger = new ToolLogger("ProjectPackager", "PackProject");
1592
+ this.validateOptionsValidator = new ProjectValidateOptionsValidator(this.logger, this.fileSystem);
1593
+ this.buildOptionsValidator = new ProjectBuildOptionsValidator(this.logger, this.fileSystem);
1594
+ this.packOptionsValidator = new ProjectPackOptionsValidator(this.logger, this.fileSystem);
1595
+ const packService = new PackService;
1596
+ this.optionsBuilder = new ProjectPackOptionsBuilder(packService, this.fileSystem);
1597
+ this.toolsFactory = new ToolsFactory(this.repository, this.fileSystem);
1598
+ this.projectExecutor = new ProjectToolExecutor(this.toolsFactory, this.telemetryService, this.packageSignService);
1599
+ this.projectLoader = new ProjectLoader(this.fileSystem);
1600
+ this.governancePolicyService = new GovernancePolicyService(this.fileSystem, this.temporaryStorage);
1601
+ }
1602
+ async canPackProjectAsync(projectPath) {
1603
+ const project = await this.projectLoader.loadProject(projectPath);
1604
+ return this.repository.canHandleProject(project.type);
1605
+ }
1606
+ async setupAsync(input, operationId) {
1607
+ this.telemetryService.setOperationId(operationId);
1608
+ await this.temporaryStorage.cleanup();
1609
+ if (typeof input === "string") {
1610
+ return input;
679
1611
  }
680
- async setupAsync(input, operationId) {
681
- this.telemetryService.setOperationId(operationId);
682
- await this.temporaryStorage.cleanup();
683
- if ("string" == typeof input) return input;
684
- const inputPath = await this.temporaryStorage.getTempSubfolderPathAsync("input");
685
- await this.zipService.extractAsync(input, inputPath);
686
- const entries = await this.fileSystem.readdir(inputPath);
687
- if (1 === entries.length) {
688
- const innerPath = Path.join(inputPath, entries[0]);
689
- const stat = await this.fileSystem.stat(innerPath);
690
- if (stat?.isDirectory()) return innerPath;
1612
+ const inputPath = await this.temporaryStorage.getTempSubfolderPathAsync("input");
1613
+ await this.zipService.extractAsync(input, inputPath);
1614
+ const entries = await this.fileSystem.readdir(inputPath);
1615
+ if (entries.length === 1) {
1616
+ const innerPath = Path3.join(inputPath, entries[0]);
1617
+ const stat = await this.fileSystem.stat(innerPath);
1618
+ if (stat?.isDirectory()) {
1619
+ return innerPath;
1620
+ }
1621
+ }
1622
+ return inputPath;
1623
+ }
1624
+ async restoreProjectAsync(options, cancellationToken) {
1625
+ return await this.executeProjectOperationAsync(options, "Restore", "ProjectPackager.Restore" /* ProjectPackagerRestore */, async (uiPathProject, loadedProject) => {
1626
+ const restoreOptions = {
1627
+ projectPath: loadedProject.projectPath,
1628
+ excludeConfiguredSources: options.excludeConfiguredSources ?? false,
1629
+ nuGetSourcesConfigPath: options.nuGetSourcesConfigPath,
1630
+ logLevel: options.logLevel,
1631
+ outputPath: options.outputPath
1632
+ };
1633
+ return await this.projectExecutor.restoreAsync(restoreOptions, uiPathProject, undefined, cancellationToken);
1634
+ }, cancellationToken);
1635
+ }
1636
+ async validateProjectAsync(options, cancellationToken) {
1637
+ await this.governancePolicyService.resolveGovernancePolicyAsync(options.validateOptions, options.connection, cancellationToken);
1638
+ const validationResult = await this.validateOptionsValidator.validateAsync(options, cancellationToken);
1639
+ if (!validationResult.isSuccess) {
1640
+ return validationResult;
1641
+ }
1642
+ return await this.executeProjectOperationAsync(options, "Validate", "ProjectPackager.Validate" /* ProjectPackagerValidate */, async (uiPathProject, loadedProject) => {
1643
+ const validateOptions = {
1644
+ projectPath: loadedProject.projectPath,
1645
+ excludeConfiguredSources: options.excludeConfiguredSources ?? false,
1646
+ nuGetSourcesConfigPath: options.nuGetSourcesConfigPath,
1647
+ logLevel: options.logLevel,
1648
+ skipAnalyze: options.validateOptions.skipAnalyze,
1649
+ skipValidate: options.validateOptions.skipValidate,
1650
+ defaultSeverity: options.validateOptions.defaultSeverity,
1651
+ detailedLogPath: options.detailedLogPath,
1652
+ policyFilePath: options.validateOptions.governanceFilePath,
1653
+ policyFileType: options.validateOptions.governanceFileType
1654
+ };
1655
+ const context = this.createOperationContext(options, uiPathProject);
1656
+ return await this.projectExecutor.validateAsync(validateOptions, uiPathProject, context, cancellationToken);
1657
+ }, cancellationToken);
1658
+ }
1659
+ async buildProjectAsync(options, cancellationToken) {
1660
+ await this.governancePolicyService.resolveGovernancePolicyAsync(options.validateOptions, options.connection, cancellationToken);
1661
+ const validationResult = await this.buildOptionsValidator.validateAsync(options, cancellationToken);
1662
+ if (!validationResult.isSuccess) {
1663
+ return validationResult;
1664
+ }
1665
+ return await this.executeProjectOperationAsync(options, "Build", "ProjectPackager.Build" /* ProjectPackagerBuild */, async (uiPathProject, loadedProject) => {
1666
+ if (!options.outputPath) {
1667
+ options.outputPath = await this.temporaryStorage.getTempSubfolderPathAsync("output");
1668
+ }
1669
+ const buildOptions = {
1670
+ projectPath: loadedProject.projectPath,
1671
+ excludeConfiguredSources: options.excludeConfiguredSources ?? false,
1672
+ nuGetSourcesConfigPath: options.nuGetSourcesConfigPath,
1673
+ logLevel: options.logLevel,
1674
+ skipAnalyze: options.validateOptions.skipAnalyze,
1675
+ skipValidate: options.validateOptions.skipValidate,
1676
+ detailedLogPath: options.detailedLogPath,
1677
+ policyFilePath: options.validateOptions.governanceFilePath,
1678
+ policyFileType: options.validateOptions.governanceFileType,
1679
+ outputPath: options.outputPath,
1680
+ outputType: undefined,
1681
+ projectType: uiPathProject.Type
1682
+ };
1683
+ return await this.projectExecutor.buildAsync(buildOptions, uiPathProject, undefined, cancellationToken);
1684
+ }, cancellationToken);
1685
+ }
1686
+ async packProjectAsync(options, cancellationToken) {
1687
+ return await this.telemetryService.trackRequest("ProjectPackager.Pack" /* ProjectPackagerPack */, async () => {
1688
+ try {
1689
+ await this.governancePolicyService.resolveGovernancePolicyAsync(options.validateOptions, options.connection, cancellationToken);
1690
+ let result = await this.packOptionsValidator.validateAsync(options, cancellationToken);
1691
+ if (!result.isSuccess) {
1692
+ return result;
691
1693
  }
692
- return inputPath;
693
- }
694
- async restoreProjectAsync(options, cancellationToken) {
695
- return await this.executeProjectOperationAsync(options, "Restore", telemetry_names_TelemetryNames.ProjectPackagerRestore, async (uiPathProject, loadedProject)=>{
696
- const restoreOptions = {
697
- projectPath: loadedProject.projectPath,
698
- excludeConfiguredSources: options.excludeConfiguredSources ?? false,
699
- nuGetSourcesConfigPath: options.nuGetSourcesConfigPath,
700
- logLevel: options.logLevel,
701
- outputPath: options.outputPath
702
- };
703
- return await this.projectExecutor.restoreAsync(restoreOptions, uiPathProject, void 0, cancellationToken);
704
- }, cancellationToken);
705
- }
706
- async validateProjectAsync(options, cancellationToken) {
707
- const validationResult = await this.validateOptionsValidator.validateAsync(options, cancellationToken);
708
- if (!validationResult.isSuccess) return validationResult;
709
- return await this.executeProjectOperationAsync(options, "Validate", telemetry_names_TelemetryNames.ProjectPackagerValidate, async (uiPathProject, loadedProject)=>{
710
- const validateOptions = {
711
- projectPath: loadedProject.projectPath,
712
- excludeConfiguredSources: options.excludeConfiguredSources ?? false,
713
- nuGetSourcesConfigPath: options.nuGetSourcesConfigPath,
714
- logLevel: options.logLevel,
715
- skipAnalyze: options.validateOptions.skipAnalyze,
716
- defaultSeverity: options.validateOptions.defaultSeverity,
717
- detailedLogPath: options.detailedLogPath,
718
- policyFilePath: options.validateOptions.governanceFilePath,
719
- policyFileType: options.validateOptions.governanceFileType
720
- };
721
- return await this.projectExecutor.validateAsync(validateOptions, uiPathProject, void 0, cancellationToken);
722
- }, cancellationToken);
723
- }
724
- async buildProjectAsync(options, cancellationToken) {
725
- const validationResult = await this.buildOptionsValidator.validateAsync(options, cancellationToken);
726
- if (!validationResult.isSuccess) return validationResult;
727
- return await this.executeProjectOperationAsync(options, "Build", telemetry_names_TelemetryNames.ProjectPackagerBuild, async (uiPathProject, loadedProject)=>{
728
- if (!options.outputPath) options.outputPath = await this.temporaryStorage.getTempSubfolderPathAsync("output");
729
- const buildOptions = {
730
- projectPath: loadedProject.projectPath,
731
- excludeConfiguredSources: options.excludeConfiguredSources ?? false,
732
- nuGetSourcesConfigPath: options.nuGetSourcesConfigPath,
733
- logLevel: options.logLevel,
734
- skipAnalyze: options.validateOptions.skipAnalyze,
735
- skipValidate: false,
736
- detailedLogPath: options.detailedLogPath,
737
- policyFilePath: options.validateOptions.governanceFilePath,
738
- policyFileType: options.validateOptions.governanceFileType,
739
- outputPath: options.outputPath,
740
- outputType: void 0,
741
- projectType: uiPathProject.Type
742
- };
743
- return await this.projectExecutor.buildAsync(buildOptions, uiPathProject, void 0, cancellationToken);
744
- }, cancellationToken);
745
- }
746
- async packProjectAsync(options, cancellationToken) {
747
- return await this.telemetryService.trackRequest(telemetry_names_TelemetryNames.ProjectPackagerPack, async ()=>{
748
- try {
749
- let result = await this.packOptionsValidator.validateAsync(options, cancellationToken);
750
- if (!result.isSuccess) return result;
751
- if (!options.outputPath) options.outputPath = await this.temporaryStorage.getTempSubfolderPathAsync("output");
752
- const loadedProject = await this.projectLoader.loadProject(options.inputPath);
753
- this.telemetryService.trackEvent(telemetry_names_TelemetryNames.ProjectPackagerProjectLoaded, {
754
- projectId: loadedProject.name
755
- });
756
- const projectPackOptions = await this.optionsBuilder.buildProjectPackOptions(options, loadedProject);
757
- const uiPathProject = {
758
- Type: loadedProject.type,
759
- ProjectRelativePath: Path.basename(loadedProject.projectFilePath),
760
- ProjectPath: loadedProject.projectPath,
761
- Id: loadedProject.name
762
- };
763
- result = await this.projectExecutor.packAsync(projectPackOptions, uiPathProject, void 0, options.signingInfo, cancellationToken);
764
- if (result.isSuccess && result.packages.length > 0) {
765
- const destinationPackages = await this.copyPackagesToDestination(result.packages, options.destinationPath, projectPackOptions.package);
766
- result = new ToolResult(ToolErrorCodes.Success, void 0, destinationPackages);
767
- }
768
- if (result.isSuccess) this.logger.info(`Project pack completed successfully. Packages: ${result.packages.join(", ")}`);
769
- else this.logger.error(`Project pack failed with error code ${result.errorCode}: ${result.message}`);
770
- return result;
771
- } catch (error) {
772
- const errorMessage = error instanceof Error ? error.message : String(error);
773
- this.logger.error(`Processing error: ${errorMessage}`);
774
- return ToolResult.error(ToolErrorCodes.InternalError, `Project pack failed: ${errorMessage}`);
775
- } finally{
776
- await this.temporaryStorage.cleanup();
777
- }
778
- });
1694
+ if (!options.outputPath) {
1695
+ options.outputPath = await this.temporaryStorage.getTempSubfolderPathAsync("output");
1696
+ }
1697
+ const loadedProject = await this.projectLoader.loadProject(options.inputPath);
1698
+ this.telemetryService.trackEvent("ProjectPackager.ProjectLoaded" /* ProjectPackagerProjectLoaded */, { projectId: loadedProject.name });
1699
+ const projectPackOptions = await this.optionsBuilder.buildProjectPackOptions(options, loadedProject);
1700
+ const uiPathProject = {
1701
+ Type: loadedProject.type,
1702
+ ProjectRelativePath: Path3.basename(loadedProject.projectFilePath),
1703
+ ProjectPath: loadedProject.projectPath,
1704
+ Id: loadedProject.name
1705
+ };
1706
+ const context = this.createOperationContext(options, uiPathProject);
1707
+ result = await this.projectExecutor.packAsync(projectPackOptions, uiPathProject, context, options.signingInfo, cancellationToken);
1708
+ if (result.isSuccess && result.packages.length > 0) {
1709
+ const destinationPackages = await this.copyPackagesToDestination(result.packages, options.destinationPath, projectPackOptions.package);
1710
+ result = new ToolResult4(ToolErrorCodes4.Success, undefined, destinationPackages);
1711
+ }
1712
+ if (result.isSuccess) {
1713
+ this.logger.info(`Project pack completed successfully. Packages: ${result.packages.join(", ")}`);
1714
+ } else {
1715
+ this.logger.error(`Project pack failed with error code ${result.errorCode}: ${result.message}`);
1716
+ }
1717
+ return result;
1718
+ } catch (error) {
1719
+ const errorMessage2 = error instanceof Error ? error.message : String(error);
1720
+ this.logger.error(`Processing error: ${errorMessage2}`);
1721
+ return ToolResult4.error(ToolErrorCodes4.InternalError, `Project pack failed: ${errorMessage2}`);
1722
+ } finally {
1723
+ await this.temporaryStorage.cleanup();
1724
+ }
1725
+ });
1726
+ }
1727
+ async getPackageStreamsAsync(result) {
1728
+ if (!result.isSuccess) {
1729
+ throw new Error(translate6.t("solutionpackager.packager.errors.failedToGetStreams", {
1730
+ errorCode: result.errorCode,
1731
+ message: result.message ?? ""
1732
+ }));
1733
+ }
1734
+ if (!result.packages || result.packages.length === 0) {
1735
+ return [];
779
1736
  }
780
- async getPackageStreamsAsync(result) {
781
- if (!result.isSuccess) throw new Error(translate.t("solutionpackager.packager.errors.failedToGetStreams", {
782
- errorCode: result.errorCode,
783
- message: result.message ?? ""
1737
+ const packageStreams = [];
1738
+ for (const packagePath of result.packages) {
1739
+ const data = await this.fileSystem.readFile(packagePath);
1740
+ if (!data) {
1741
+ throw new Error(translate6.t("solutionpackager.packager.errors.failedToReadPackage", {
1742
+ path: packagePath
784
1743
  }));
785
- if (!result.packages || 0 === result.packages.length) return [];
786
- const packageStreams = [];
787
- for (const packagePath of result.packages){
788
- const data = await this.fileSystem.readFile(packagePath);
789
- if (!data) throw new Error(translate.t("solutionpackager.packager.errors.failedToReadPackage", {
790
- path: packagePath
791
- }));
792
- const name = packagePath.split(/[\\/]/).pop() || packagePath;
793
- packageStreams.push({
794
- name,
795
- data
796
- });
1744
+ }
1745
+ const name = packagePath.split(/[\\/]/).pop() || packagePath;
1746
+ packageStreams.push({ name, data });
1747
+ }
1748
+ return packageStreams;
1749
+ }
1750
+ async executeProjectOperationAsync(options, operationName, telemetryName, operation, _cancellationToken) {
1751
+ return await this.telemetryService.trackRequest(telemetryName, async () => {
1752
+ try {
1753
+ const loadedProject = await this.projectLoader.loadProject(options.inputPath);
1754
+ const uiPathProject = {
1755
+ Type: loadedProject.type,
1756
+ ProjectRelativePath: Path3.basename(loadedProject.projectFilePath),
1757
+ ProjectPath: loadedProject.projectPath,
1758
+ Id: loadedProject.name
1759
+ };
1760
+ const operationResult = await operation(uiPathProject, loadedProject);
1761
+ if (operationResult.isSuccess) {
1762
+ this.logger.info(`Project ${operationName.toLowerCase()} completed successfully.`);
1763
+ } else {
1764
+ this.logger.error(`Project ${operationName.toLowerCase()} failed with error code ${operationResult.errorCode}: ${operationResult.message}`);
797
1765
  }
798
- return packageStreams;
799
- }
800
- async executeProjectOperationAsync(options, operationName, telemetryName, operation, cancellationToken) {
801
- return await this.telemetryService.trackRequest(telemetryName, async ()=>{
802
- try {
803
- const loadedProject = await this.projectLoader.loadProject(options.inputPath);
804
- const uiPathProject = {
805
- Type: loadedProject.type,
806
- ProjectRelativePath: Path.basename(loadedProject.projectFilePath),
807
- ProjectPath: loadedProject.projectPath,
808
- Id: loadedProject.name
809
- };
810
- const operationResult = await operation(uiPathProject, loadedProject);
811
- if (operationResult.isSuccess) this.logger.info(`Project ${operationName.toLowerCase()} completed successfully.`);
812
- else this.logger.error(`Project ${operationName.toLowerCase()} failed with error code ${operationResult.errorCode}: ${operationResult.message}`);
813
- return operationResult;
814
- } catch (error) {
815
- const errorMessage = error instanceof Error ? error.message : String(error);
816
- this.logger.error(`Processing error: ${errorMessage}`);
817
- return ToolResult.error(ToolErrorCodes.InternalError, `Project ${operationName.toLowerCase()} failed: ${errorMessage}`);
818
- } finally{
819
- await this.temporaryStorage.cleanup();
820
- }
821
- });
1766
+ return operationResult;
1767
+ } catch (error) {
1768
+ const errorMessage2 = error instanceof Error ? error.message : String(error);
1769
+ this.logger.error(`Processing error: ${errorMessage2}`);
1770
+ return ToolResult4.error(ToolErrorCodes4.InternalError, `Project ${operationName.toLowerCase()} failed: ${errorMessage2}`);
1771
+ } finally {
1772
+ await this.temporaryStorage.cleanup();
1773
+ }
1774
+ });
1775
+ }
1776
+ createOperationContext(options, uiPathProject) {
1777
+ return {
1778
+ id: crypto.randomUUID(),
1779
+ projects: [uiPathProject],
1780
+ downloadUrl: options.downloadUrl,
1781
+ targetFramework: options.targetFramework ?? TargetFramework.Portable,
1782
+ connection: options.connection,
1783
+ logger: this.logger,
1784
+ workflowCompilerVersion: options.workflowCompilerVersion
1785
+ };
1786
+ }
1787
+ async findNupkgInParentDir(packagePath) {
1788
+ const dirName = Path3.basename(packagePath);
1789
+ const parentDir = Path3.dirname(packagePath);
1790
+ const parentFiles = await this.fileSystem.readdir(parentDir);
1791
+ const matchingFiles = parentFiles.filter((f) => f.endsWith(".nupkg") && f.startsWith(`${dirName}.`));
1792
+ return { dir: parentDir, files: matchingFiles };
1793
+ }
1794
+ async copyFileToDestination(sourcePath, destinationPath) {
1795
+ const fileName = Path3.basename(sourcePath);
1796
+ const destPath = Path3.join(destinationPath, fileName);
1797
+ const data = await this.fileSystem.readFile(sourcePath);
1798
+ if (!data) {
1799
+ throw new Error(translate6.t("solutionpackager.packager.errors.failedToReadPackage", { path: sourcePath }));
822
1800
  }
823
- async copyPackagesToDestination(packagePaths, destinationPath, packageInfo) {
824
- await this.fileSystem.mkdir(destinationPath);
825
- const destinationPackages = [];
826
- for (const packagePath of packagePaths){
827
- const stat = await this.fileSystem.stat(packagePath);
828
- if (stat?.isDirectory()) {
829
- const files = await this.fileSystem.readdir(packagePath);
830
- const nupkgFiles = files.filter((f)=>f.endsWith(".nupkg"));
831
- if (nupkgFiles.length > 0) for (const nupkgFile of nupkgFiles){
832
- const filePath = Path.join(packagePath, nupkgFile);
833
- const destPath = Path.join(destinationPath, nupkgFile);
834
- const data = await this.fileSystem.readFile(filePath);
835
- if (!data) throw new Error(translate.t("solutionpackager.packager.errors.failedToReadPackage", {
836
- path: filePath
837
- }));
838
- await this.fileSystem.writeFile(destPath, data);
839
- destinationPackages.push(destPath);
840
- }
841
- else {
842
- const nupkgFileName = `${packageInfo.id}.${packageInfo.version}.nupkg`;
843
- const destPath = Path.join(destinationPath, nupkgFileName);
844
- const packResult = await this.nugetPackager.packAsync(packagePath, packageInfo, destPath);
845
- destinationPackages.push(packResult.outputPath);
846
- }
847
- } else {
848
- const fileName = packagePath.split(/[\\/]/).pop() || packagePath;
849
- const destPath = Path.join(destinationPath, fileName);
850
- const data = await this.fileSystem.readFile(packagePath);
851
- if (!data) throw new Error(translate.t("solutionpackager.packager.errors.failedToReadPackage", {
852
- path: packagePath
853
- }));
854
- await this.fileSystem.writeFile(destPath, data);
855
- destinationPackages.push(destPath);
1801
+ await this.fileSystem.writeFile(destPath, data);
1802
+ return destPath;
1803
+ }
1804
+ async copyPackagesToDestination(packagePaths, destinationPath, packageInfo) {
1805
+ await this.fileSystem.mkdir(destinationPath);
1806
+ const destinationPackages = [];
1807
+ for (const packagePath of packagePaths) {
1808
+ const stat = await this.fileSystem.stat(packagePath);
1809
+ if (stat?.isDirectory()) {
1810
+ const files = await this.fileSystem.readdir(packagePath);
1811
+ const nupkgFiles = files.filter((f) => f.endsWith(".nupkg"));
1812
+ if (nupkgFiles.length > 0) {
1813
+ for (const nupkgFile of nupkgFiles) {
1814
+ const filePath = Path3.join(packagePath, nupkgFile);
1815
+ const dest = await this.copyFileToDestination(filePath, destinationPath);
1816
+ destinationPackages.push(dest);
1817
+ }
1818
+ } else {
1819
+ const parent = await this.findNupkgInParentDir(packagePath);
1820
+ if (parent.files.length > 0) {
1821
+ for (const nupkgFile of parent.files) {
1822
+ const filePath = Path3.join(parent.dir, nupkgFile);
1823
+ const dest = await this.copyFileToDestination(filePath, destinationPath);
1824
+ destinationPackages.push(dest);
856
1825
  }
1826
+ } else {
1827
+ const nupkgFileName = `${packageInfo.id}.${packageInfo.version}.nupkg`;
1828
+ const destPath = Path3.join(destinationPath, nupkgFileName);
1829
+ const packResult = await this.nugetPackager.packAsync(packagePath, packageInfo, destPath);
1830
+ destinationPackages.push(packResult.outputPath);
1831
+ }
857
1832
  }
858
- return destinationPackages;
859
- }
860
- constructor(fileSystem, telemetryService, packageSignService){
861
- project_packager_define_property(this, "fileSystem", void 0);
862
- project_packager_define_property(this, "telemetryService", void 0);
863
- project_packager_define_property(this, "packageSignService", void 0);
864
- project_packager_define_property(this, "repository", void 0);
865
- project_packager_define_property(this, "temporaryStorage", void 0);
866
- project_packager_define_property(this, "zipService", void 0);
867
- project_packager_define_property(this, "logger", void 0);
868
- project_packager_define_property(this, "optionsBuilder", void 0);
869
- project_packager_define_property(this, "toolsFactory", void 0);
870
- project_packager_define_property(this, "projectExecutor", void 0);
871
- project_packager_define_property(this, "projectLoader", void 0);
872
- project_packager_define_property(this, "validateOptionsValidator", void 0);
873
- project_packager_define_property(this, "buildOptionsValidator", void 0);
874
- project_packager_define_property(this, "packOptionsValidator", void 0);
875
- project_packager_define_property(this, "nugetPackager", void 0);
876
- this.fileSystem = fileSystem;
877
- this.telemetryService = telemetryService;
878
- this.packageSignService = packageSignService;
879
- this.repository = toolsFactoryRepository;
880
- this.temporaryStorage = new TemporaryStorageService(this.fileSystem);
881
- this.zipService = new ZipService(this.fileSystem);
882
- this.nugetPackager = new NugetPackager(this.fileSystem);
883
- this.logger = new ToolLogger("ProjectPackager", "PackProject");
884
- this.validateOptionsValidator = new ProjectValidateOptionsValidator(this.logger, this.fileSystem);
885
- this.buildOptionsValidator = new ProjectBuildOptionsValidator(this.logger, this.fileSystem);
886
- this.packOptionsValidator = new ProjectPackOptionsValidator(this.logger, this.fileSystem);
887
- const packService = new PackService();
888
- this.optionsBuilder = new ProjectPackOptionsBuilder(packService, this.fileSystem);
889
- this.toolsFactory = new ToolsFactory(this.repository, this.fileSystem);
890
- this.projectExecutor = new ProjectToolExecutor(this.toolsFactory, this.telemetryService, this.packageSignService);
891
- this.projectLoader = new ProjectLoader(this.fileSystem);
1833
+ } else {
1834
+ const dest = await this.copyFileToDestination(packagePath, destinationPath);
1835
+ destinationPackages.push(dest);
1836
+ }
892
1837
  }
1838
+ return destinationPackages;
1839
+ }
893
1840
  }
1841
+
1842
+ // src/node-project-packager-factory.ts
894
1843
  class NodeProjectPackagerFactory extends BaseNodePackagerFactory {
895
- async createAsync(config) {
896
- const logger = new ToolLogger("ProjectPackagerFactory", "Create");
897
- this.configureLanguage(config);
898
- this.configureLogHandler(config);
899
- logger.info("Creating ProjectPackager instance...");
900
- const fileSystem = this.getOrCreateFileSystem(config);
901
- const telemetryService = this.getOrCreateTelemetryService(config);
902
- const packageSignService = new NodePackageSignService(logger);
903
- const projectPackager = new ProjectPackager(fileSystem, telemetryService, packageSignService);
904
- this.checkDotnetAvailability(logger);
905
- logger.info("ProjectPackager created successfully.");
906
- return projectPackager;
907
- }
1844
+ async createAsync(config) {
1845
+ const logger = new ToolLogger("ProjectPackagerFactory", "Create");
1846
+ this.configureLanguage(config);
1847
+ this.configureLogHandler(config);
1848
+ logger.info("Creating ProjectPackager instance...");
1849
+ const fileSystem = this.getOrCreateFileSystem(config);
1850
+ const telemetryService = this.getOrCreateTelemetryService(config);
1851
+ const packageSignService = new NodePackageSignService(logger);
1852
+ const projectPackager = new ProjectPackager(fileSystem, telemetryService, packageSignService);
1853
+ this.checkDotnetAvailability(logger);
1854
+ logger.info("ProjectPackager created successfully.");
1855
+ return projectPackager;
1856
+ }
908
1857
  }
909
1858
  async function createNodeProjectPackager(options) {
910
- const factory = new NodeProjectPackagerFactory();
911
- return factory.createAsync(options);
1859
+ const factory = new NodeProjectPackagerFactory;
1860
+ return factory.createAsync(options);
912
1861
  }
913
- export { BaseNodePackagerFactory, ConsoleTelemetryProvider, NodeContextStorage, NodePackageSignService, PackService, PackagerParameters, PackagerParametersValidator, ProjectBuildOptions, ProjectBuildOptionsValidator, ProjectLoader, ProjectPackOptions, ProjectPackager, ProjectRestoreOptions, ProjectToolExecutor, ProjectValidateOptions, ProjectValidateOptionsValidator, packager_parameters_RulesConfigFileType as RulesConfigFileType, telemetry_names_TelemetryNames as TelemetryNames, TelemetryService, ToolLogger, ToolsFactory, createNodeProjectPackager, setGlobalLogHandler };
914
-
915
- //# sourceMappingURL=node.js.map
1862
+ export {
1863
+ setGlobalLogHandler,
1864
+ createNodeProjectPackager,
1865
+ ToolsFactory,
1866
+ ToolLogger,
1867
+ TelemetryService2 as TelemetryService,
1868
+ TelemetryNames,
1869
+ RulesConfigFileType,
1870
+ ProjectValidateOptionsValidator,
1871
+ ProjectValidateOptions,
1872
+ ProjectToolExecutor,
1873
+ ProjectRestoreOptions,
1874
+ ProjectPackager,
1875
+ ProjectPackOptions,
1876
+ ProjectLoader,
1877
+ ProjectBuildOptionsValidator,
1878
+ ProjectBuildOptions,
1879
+ PackagerParametersValidator,
1880
+ PackagerParameters,
1881
+ PackService,
1882
+ NodePackageSignService,
1883
+ NodeContextStorage2 as NodeContextStorage,
1884
+ DebugTelemetryProvider2 as DebugTelemetryProvider,
1885
+ ConsoleTelemetryProvider,
1886
+ BaseNodePackagerFactory
1887
+ };