@uipath/project-packager 1.1.4 → 1.1.10

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,1857 @@
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
+ ConsoleTelemetryProvider as ConsoleTelemetryProvider2,
820
+ NodeContextStorage as NodeContextStorage2,
821
+ TelemetryService as TelemetryService2
822
+ } from "@uipath/telemetry/node";
823
+
824
+ // src/base-node-packager-factory.ts
825
+ import { execSync } from "node:child_process";
826
+ import { NodeFileSystem } from "@uipath/filesystem";
827
+ import { translate } from "@uipath/solutionpackager-tool-core";
828
+ import {
829
+ ConsoleTelemetryProvider,
830
+ NodeContextStorage,
831
+ TelemetryService
832
+ } from "@uipath/telemetry/node";
833
+
834
+ // src/services/tool-logger.ts
835
+ import {
836
+ LogLevel,
837
+ LogMessage
838
+ } from "@uipath/solutionpackager-tool-core";
839
+ var globalLogHandler = (logMessage) => {
840
+ const formattedMessage = logMessage.toFormattedString();
841
+ switch (logMessage.logLevel) {
842
+ case LogLevel.Debug:
843
+ console.debug(formattedMessage);
844
+ break;
845
+ case LogLevel.Info:
846
+ console.info(formattedMessage);
847
+ break;
848
+ case LogLevel.Warn:
849
+ console.warn(formattedMessage);
850
+ break;
851
+ case LogLevel.Error:
852
+ console.error(formattedMessage);
853
+ break;
854
+ }
855
+ };
856
+ function setGlobalLogHandler(handler) {
857
+ globalLogHandler = handler;
189
858
  }
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
859
+
860
+ class ToolLogger {
861
+ source;
862
+ sourceTarget;
863
+ constructor(source, sourceTarget) {
864
+ this.source = source;
865
+ this.sourceTarget = sourceTarget;
866
+ }
867
+ debug(message, options) {
868
+ const logMessage = new LogMessage(message, LogLevel.Debug, {
869
+ source: this.source,
870
+ sourceTarget: this.sourceTarget,
871
+ ...options
872
+ });
873
+ globalLogHandler(logMessage);
874
+ }
875
+ info(message, options) {
876
+ const logMessage = new LogMessage(message, LogLevel.Info, {
877
+ source: this.source,
878
+ sourceTarget: this.sourceTarget,
879
+ ...options
880
+ });
881
+ globalLogHandler(logMessage);
882
+ }
883
+ warn(message, options) {
884
+ const logMessage = new LogMessage(message, LogLevel.Warn, {
885
+ source: this.source,
886
+ sourceTarget: this.sourceTarget,
887
+ ...options
888
+ });
889
+ globalLogHandler(logMessage);
890
+ }
891
+ error(message, options) {
892
+ const logMessage = new LogMessage(message, LogLevel.Error, {
893
+ source: this.source,
894
+ sourceTarget: this.sourceTarget,
895
+ ...options
896
+ });
897
+ globalLogHandler(logMessage);
898
+ }
899
+ progress(message, options) {
900
+ const logMessage = new LogMessage(message, LogLevel.Info, {
901
+ source: this.source,
902
+ sourceTarget: this.sourceTarget,
903
+ ...options
196
904
  });
197
- else obj[key] = value;
198
- return obj;
905
+ globalLogHandler(logMessage);
906
+ }
907
+ log(message, logLevel, options) {
908
+ const logMessage = new LogMessage(message, logLevel, {
909
+ source: this.source,
910
+ sourceTarget: this.sourceTarget,
911
+ ...options
912
+ });
913
+ globalLogHandler(logMessage);
914
+ }
915
+ logMessage(message) {
916
+ globalLogHandler(message);
917
+ }
199
918
  }
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);
919
+
920
+ // src/base-node-packager-factory.ts
921
+ class BaseNodePackagerFactory {
922
+ getOrCreateFileSystem(config) {
923
+ return config?.fileSystem ?? new NodeFileSystem;
924
+ }
925
+ getOrCreateTelemetryService(config) {
926
+ if (config?.telemetryService) {
927
+ return config.telemetryService;
928
+ }
929
+ const provider = new ConsoleTelemetryProvider;
930
+ const contextStorage = new NodeContextStorage;
931
+ return new TelemetryService(provider, contextStorage);
932
+ }
933
+ checkDotnetAvailability(logger) {
934
+ logger.info("Checking for dotnet CLI availability...");
935
+ try {
936
+ execSync("dotnet --version", {
937
+ stdio: ["ignore", "pipe", "ignore"]
938
+ });
939
+ logger.info("dotnet CLI is available.");
940
+ } catch {
941
+ logger.error("dotnet CLI is not available. Workflow compiler functionality and package signing will not be available.");
942
+ }
943
+ }
944
+ configureLogHandler(config) {
945
+ if (config?.logHandler) {
946
+ setGlobalLogHandler(config.logHandler);
216
947
  }
948
+ }
949
+ configureLanguage(config) {
950
+ const language = config?.language ?? "en";
951
+ translate.setLocale(language);
952
+ }
217
953
  }
218
- class ProjectRestoreOptions extends PackagerParameters {
954
+ // src/models/packager-parameters.ts
955
+ import {
956
+ LogLevel as LogLevel2
957
+ } from "@uipath/solutionpackager-tool-core";
958
+ var RulesConfigFileType;
959
+ ((RulesConfigFileType2) => {
960
+ RulesConfigFileType2["Default"] = "Default";
961
+ RulesConfigFileType2["AutomationOps"] = "AutomationOps";
962
+ RulesConfigFileType2["Studio"] = "Studio";
963
+ })(RulesConfigFileType ||= {});
964
+
965
+ class PackagerParameters {
966
+ inputPath;
967
+ logLevel = LogLevel2.Warn;
968
+ outputPath;
969
+ targetFramework;
970
+ excludeConfiguredSources = false;
971
+ nuGetSourcesConfigPath;
972
+ detailedLogPath;
973
+ connection;
974
+ workflowCompilerVersion;
219
975
  }
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;
976
+ // src/models/project-restore-options.ts
977
+ class ProjectRestoreOptions extends PackagerParameters {
229
978
  }
979
+
980
+ // src/models/project-validate-options.ts
230
981
  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
- }
982
+ validateOptions = {
983
+ skipAnalyze: false,
984
+ governanceFileType: "Default" /* Default */
985
+ };
237
986
  }
987
+
988
+ // src/models/project-build-options.ts
238
989
  class ProjectBuildOptions extends ProjectValidateOptions {
239
990
  }
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
- }
991
+ // src/models/project-pack-options.ts
250
992
  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;
993
+ destinationPath;
994
+ package;
995
+ signingInfo;
996
+ packOptions;
264
997
  }
998
+ // src/services/package-sign-service.ts
999
+ import { execSync as execSync2, spawn } from "node:child_process";
1000
+ import {
1001
+ ToolErrorCodes,
1002
+ ToolResult,
1003
+ translate as translate2
1004
+ } from "@uipath/solutionpackager-tool-core";
1005
+
265
1006
  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
- });
1007
+ logger;
1008
+ constructor(logger) {
1009
+ this.logger = logger;
1010
+ }
1011
+ async signPackageAsync(packagePath, certificatePath, certificatePassword, timestampServer) {
1012
+ if (!this.checkAvailable()) {
1013
+ this.logger.error(translate2.t("solutionpackager.signing.info.dotnetNotAvailable"));
1014
+ return ToolResult.error(ToolErrorCodes.InternalError, translate2.t("solutionpackager.signing.errors.dotnetNotAvailable"));
313
1015
  }
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
- }
1016
+ const args = [
1017
+ "nuget",
1018
+ "sign",
1019
+ packagePath,
1020
+ "--certificate-path",
1021
+ certificatePath,
1022
+ "--overwrite"
1023
+ ];
1024
+ if (certificatePassword) {
1025
+ args.push("--certificate-password", certificatePassword);
329
1026
  }
330
- constructor(logger){
331
- package_sign_service_define_property(this, "logger", void 0);
332
- this.logger = logger;
1027
+ if (timestampServer) {
1028
+ args.push("--timestamper", timestampServer);
333
1029
  }
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
1030
+ return new Promise((resolve) => {
1031
+ const childProcess = spawn("dotnet", args, {
1032
+ stdio: ["ignore", "pipe", "pipe"],
1033
+ shell: false,
1034
+ windowsHide: true
1035
+ });
1036
+ let stderr = "";
1037
+ childProcess.stdout?.on("data", (data) => {
1038
+ this.logger.info(data.toString().trim());
1039
+ });
1040
+ childProcess.stderr?.on("data", (data) => {
1041
+ stderr += data.toString();
1042
+ });
1043
+ childProcess.on("error", (error) => {
1044
+ this.logger.error(`Failed to start dotnet process: ${error.message}`);
1045
+ resolve(ToolResult.error(ToolErrorCodes.InternalError, `Failed to start dotnet process: ${error.message}`));
1046
+ });
1047
+ childProcess.on("exit", (code) => {
1048
+ if (code === 0) {
1049
+ this.logger.info(`Successfully signed package: ${packagePath}`);
1050
+ resolve(ToolResult.success());
1051
+ } else {
1052
+ const errorMessage = stderr.trim() || `dotnet nuget sign exited with code ${code}`;
1053
+ this.logger.error(`Package signing failed: ${errorMessage}`);
1054
+ resolve(ToolResult.error(ToolErrorCodes.InternalError, `Package signing failed: ${errorMessage}`));
1055
+ }
1056
+ });
353
1057
  });
354
- else obj[key] = value;
355
- return obj;
1058
+ }
1059
+ checkAvailable() {
1060
+ try {
1061
+ const output = execSync2("dotnet nuget --version", {
1062
+ stdio: ["ignore", "pipe", "ignore"],
1063
+ encoding: "utf-8"
1064
+ });
1065
+ this.logger.info(`dotnet CLI found, version ${output.trim()}`);
1066
+ return true;
1067
+ } catch {
1068
+ return false;
1069
+ }
1070
+ }
356
1071
  }
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);
1072
+
1073
+ // src/services/project-packager.ts
1074
+ import {
1075
+ toolsFactoryRepository as defaultToolsFactoryRepository,
1076
+ NugetPackager,
1077
+ Path as Path3,
1078
+ TemporaryStorageService,
1079
+ ToolErrorCodes as ToolErrorCodes4,
1080
+ ToolResult as ToolResult4,
1081
+ translate as translate6,
1082
+ ZipService
1083
+ } from "@uipath/solutionpackager-tool-core";
1084
+
1085
+ // src/telemetry-names.ts
1086
+ var TelemetryNames;
1087
+ ((TelemetryNames2) => {
1088
+ TelemetryNames2["ProjectToolPack"] = "ProjectPackager.Tool.Pack";
1089
+ TelemetryNames2["ProjectToolRestore"] = "ProjectPackager.Tool.Restore";
1090
+ TelemetryNames2["ProjectToolValidate"] = "ProjectPackager.Tool.Validate";
1091
+ TelemetryNames2["ProjectToolBuild"] = "ProjectPackager.Tool.Build";
1092
+ TelemetryNames2["ProjectPackagerPack"] = "ProjectPackager.Pack";
1093
+ TelemetryNames2["ProjectPackagerRestore"] = "ProjectPackager.Restore";
1094
+ TelemetryNames2["ProjectPackagerValidate"] = "ProjectPackager.Validate";
1095
+ TelemetryNames2["ProjectPackagerBuild"] = "ProjectPackager.Build";
1096
+ TelemetryNames2["ProjectPackagerProjectLoaded"] = "ProjectPackager.ProjectLoaded";
1097
+ })(TelemetryNames ||= {});
1098
+
1099
+ // src/services/governance-policy-service.ts
1100
+ import {
1101
+ Path,
1102
+ toRelativeUrl,
1103
+ translate as translate3
1104
+ } from "@uipath/solutionpackager-tool-core";
1105
+ var LICENSE_TYPES = {
1106
+ NoLicense: "NoLicense",
1107
+ Development: "Development",
1108
+ Attended: "Attended",
1109
+ Unattended: "Unattended",
1110
+ StudioX: "StudioX",
1111
+ StudioPro: "StudioPro",
1112
+ AutomationKit: "AutomationKit"
1113
+ };
1114
+ var DEFAULT_PROFILE_KEY = "StudioWeb";
1115
+ var ACQUIRE_LICENSE_PATH = "/orchestrator_/api/StudioWeb/AcquireLicense";
1116
+ var GOVERNANCE_SUBFOLDER = "governance";
1117
+ var GOVERNANCE_FILE_NAME = "governance-policy.json";
1118
+ var errorMessage = (error) => error instanceof Error ? error.message : String(error);
1119
+ var t = (key, params) => translate3.t(`solutionpackager.governance.${key}`, params);
1120
+
1121
+ class GovernancePolicyService {
1122
+ fileSystem;
1123
+ temporaryStorage;
1124
+ fetchFn;
1125
+ logger = new ToolLogger("GovernancePolicyService", "ResolvePolicy");
1126
+ constructor(fileSystem, temporaryStorage, fetchFn = fetch.bind(globalThis)) {
1127
+ this.fileSystem = fileSystem;
1128
+ this.temporaryStorage = temporaryStorage;
1129
+ this.fetchFn = fetchFn;
1130
+ }
1131
+ async resolveGovernancePolicyAsync(validateOptions, connectionInfo, cancellationToken) {
1132
+ if (validateOptions.governanceFileType !== "AutomationOps" /* AutomationOps */) {
1133
+ return;
1134
+ }
1135
+ if (validateOptions.governanceFilePath) {
1136
+ this.logger.info(t("info.alreadyProvided"));
1137
+ return;
1138
+ }
1139
+ const cloudUrl = connectionInfo?.cloudUrl;
1140
+ const organizationId = connectionInfo?.organizationId;
1141
+ const tenantId = connectionInfo?.tenantId;
1142
+ const accessToken = connectionInfo?.accessToken;
1143
+ if (!cloudUrl || !organizationId || !tenantId || !accessToken) {
1144
+ this.logger.warn(t("errors.connectionIncomplete"));
1145
+ validateOptions.governanceFileType = "Default" /* Default */;
1146
+ return;
371
1147
  }
1148
+ const profileKey = validateOptions.profileKey ?? DEFAULT_PROFILE_KEY;
1149
+ const orchestratorUrl = toRelativeUrl(cloudUrl);
1150
+ const licenseType = await this.resolveLicenseTypeAsync(profileKey, orchestratorUrl, accessToken, cancellationToken);
1151
+ const policy = await this.downloadPolicyAsync(organizationId, tenantId, accessToken, licenseType, profileKey, cancellationToken);
1152
+ if (!policy) {
1153
+ validateOptions.governanceFileType = "Default" /* Default */;
1154
+ return;
1155
+ }
1156
+ try {
1157
+ const dir = await this.temporaryStorage.getTempSubfolderPathAsync(GOVERNANCE_SUBFOLDER);
1158
+ const filePath = Path.join(dir, GOVERNANCE_FILE_NAME);
1159
+ await this.fileSystem.writeFile(filePath, policy);
1160
+ this.logger.info(t("info.saved", { path: filePath }));
1161
+ validateOptions.governanceFilePath = filePath;
1162
+ } catch (error) {
1163
+ this.logger.warn(t("errors.failedToSave", {
1164
+ error: errorMessage(error)
1165
+ }));
1166
+ validateOptions.governanceFileType = "Default" /* Default */;
1167
+ }
1168
+ }
1169
+ async downloadPolicyAsync(organizationId, tenantId, accessToken, licenseType, profileKey, cancellationToken) {
1170
+ const policyUrl = `/${organizationId}/roboticsops_` + `/api/Policy/license/${licenseType}/product/${profileKey}/tenant/${tenantId}`;
1171
+ this.logger.info(t("info.downloading", { url: policyUrl }));
1172
+ try {
1173
+ const response = await this.fetchFn(policyUrl, {
1174
+ headers: {
1175
+ Authorization: `Bearer ${accessToken}`,
1176
+ AccountId: organizationId
1177
+ },
1178
+ signal: cancellationToken
1179
+ });
1180
+ if (response.status === 204 || response.status === 404) {
1181
+ this.logger.info(t("info.noPolicyFound"));
1182
+ return null;
1183
+ }
1184
+ if (!response.ok) {
1185
+ const body = await response.text();
1186
+ this.logger.warn(t("errors.failedToGetPolicy", { content: body }));
1187
+ return null;
1188
+ }
1189
+ const content = await response.text();
1190
+ if (!content?.trimStart().startsWith("{")) {
1191
+ this.logger.info(t("info.responseNotJson"));
1192
+ return null;
1193
+ }
1194
+ return content;
1195
+ } catch (error) {
1196
+ this.logger.warn(t("errors.failedToDownload", {
1197
+ error: errorMessage(error)
1198
+ }));
1199
+ return null;
1200
+ }
1201
+ }
1202
+ async resolveLicenseTypeAsync(profileKey, orchestratorUrl, accessToken, cancellationToken) {
1203
+ const isStudioWeb = profileKey === DEFAULT_PROFILE_KEY;
1204
+ const fallback = isStudioWeb ? LICENSE_TYPES.NoLicense : LICENSE_TYPES.Development;
1205
+ try {
1206
+ const response = await this.fetchFn(`${orchestratorUrl}${ACQUIRE_LICENSE_PATH}`, {
1207
+ method: "POST",
1208
+ headers: { Authorization: `Bearer ${accessToken}` },
1209
+ signal: cancellationToken
1210
+ });
1211
+ if (!response.ok) {
1212
+ this.logger.info(t("info.licenseStatus", {
1213
+ status: response.status,
1214
+ fallback
1215
+ }));
1216
+ return fallback;
1217
+ }
1218
+ const { isLicensed, robotType } = await response.json();
1219
+ this.logger.info(t("info.licenseResponse", {
1220
+ isLicensed: String(isLicensed),
1221
+ robotType: String(robotType)
1222
+ }));
1223
+ if (!isLicensed || !robotType) {
1224
+ return fallback;
1225
+ }
1226
+ if (isStudioWeb) {
1227
+ return robotType === LICENSE_TYPES.AutomationKit ? LICENSE_TYPES.AutomationKit : LICENSE_TYPES.NoLicense;
1228
+ }
1229
+ return robotType;
1230
+ } catch (error) {
1231
+ this.logger.info(t("info.licenseFailed", {
1232
+ error: errorMessage(error),
1233
+ fallback
1234
+ }));
1235
+ return fallback;
1236
+ }
1237
+ }
372
1238
  }
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;
1239
+
1240
+ // src/services/pack-service.ts
1241
+ class PackService {
1242
+ disallowedCharsRegex = /[^\w.-]/g;
1243
+ spacesDotRegex = /[\s.]+/g;
1244
+ dotDashRegex = /\.{0,10}[-:]\.{0,10}/g;
1245
+ MaxPackageIdLength = 100;
1246
+ sanitizePackageId(packageId) {
1247
+ packageId = packageId.trim();
1248
+ packageId = packageId.replace(this.spacesDotRegex, ".");
1249
+ packageId = packageId.replace(this.dotDashRegex, "-");
1250
+ packageId = packageId.replace(this.disallowedCharsRegex, "_");
1251
+ if (packageId.length > this.MaxPackageIdLength) {
1252
+ throw new Error(`Package id ${packageId} exceeds the characters limit of ${this.MaxPackageIdLength}`);
1253
+ }
1254
+ return packageId;
1255
+ }
382
1256
  }
1257
+
1258
+ // src/services/packager-parameters-validator.ts
1259
+ import {
1260
+ ToolErrorCodes as ToolErrorCodes2,
1261
+ ToolResult as ToolResult2,
1262
+ translate as translate4
1263
+ } from "@uipath/solutionpackager-tool-core";
383
1264
  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();
1265
+ logger;
1266
+ fileSystem;
1267
+ constructor(logger, fileSystem) {
1268
+ this.logger = logger;
1269
+ this.fileSystem = fileSystem;
1270
+ }
1271
+ async validateAsync(_options, _cancellationToken) {
1272
+ return ToolResult2.success();
1273
+ }
1274
+ validateDestinationPath(destinationPath) {
1275
+ if (!destinationPath) {
1276
+ const error = translate4.t("solutionpackager.validator.errors.destinationNotDefined");
1277
+ this.logger.error(error);
1278
+ return ToolResult2.error(ToolErrorCodes2.InternalError, error);
394
1279
  }
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();
1280
+ return ToolResult2.success();
1281
+ }
1282
+ async validateGovernanceOptions(validateOptions) {
1283
+ if (validateOptions.governanceFileType === "Default" /* Default */) {
1284
+ if (validateOptions.governanceFilePath) {
1285
+ this.logger.warn(`Governance file path '${validateOptions.governanceFilePath}' will be ignored when governance file type is Default`);
1286
+ }
1287
+ return ToolResult2.success();
429
1288
  }
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;
1289
+ if (!validateOptions.governanceFilePath) {
1290
+ const error = translate4.t("solutionpackager.validator.errors.governanceRequired");
1291
+ this.logger.error(error);
1292
+ return ToolResult2.error(ToolErrorCodes2.InternalError, error);
435
1293
  }
436
- }
437
- class ProjectBuildOptionsValidator extends PackagerParametersValidator {
438
- async validateAsync(options, _cancellationToken) {
439
- return await this.validateGovernanceOptions(options.validateOptions);
1294
+ try {
1295
+ const stat = await this.fileSystem.stat(validateOptions.governanceFilePath);
1296
+ if (!stat) {
1297
+ const error = translate4.t("solutionpackager.validator.errors.governanceFileInfo", {
1298
+ path: validateOptions.governanceFilePath
1299
+ });
1300
+ this.logger.error(error);
1301
+ return ToolResult2.error(ToolErrorCodes2.InternalError, error);
1302
+ }
1303
+ if (stat.isDirectory()) {
1304
+ const error = translate4.t("solutionpackager.validator.errors.governanceInvalidFile", {
1305
+ path: validateOptions.governanceFilePath
1306
+ });
1307
+ this.logger.error(error);
1308
+ return ToolResult2.error(ToolErrorCodes2.InternalError, error);
1309
+ }
1310
+ } catch (error) {
1311
+ const errorMessage2 = error instanceof Error ? error.message : String(error);
1312
+ const errorLog = `Governance file not found or inaccessible: ${validateOptions.governanceFilePath}. Error: ${errorMessage2}`;
1313
+ this.logger.error(errorLog);
1314
+ return ToolResult2.error(ToolErrorCodes2.InternalError, errorLog);
440
1315
  }
1316
+ this.logger.info(`Using Studio governance file: ${validateOptions.governanceFilePath}`);
1317
+ return ToolResult2.success();
1318
+ }
441
1319
  }
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;
1320
+
1321
+ // src/services/project-build-options-validator.ts
1322
+ class ProjectBuildOptionsValidator extends PackagerParametersValidator {
1323
+ async validateAsync(options, _cancellationToken) {
1324
+ return await this.validateGovernanceOptions(options.validateOptions);
1325
+ }
451
1326
  }
1327
+
1328
+ // src/services/project-loader.ts
1329
+ import {
1330
+ Path as Path2,
1331
+ ProjectTypes,
1332
+ translate as translate5
1333
+ } from "@uipath/solutionpackager-tool-core";
1334
+
452
1335
  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
- }));
1336
+ fileSystem;
1337
+ static ProjectFileName = "project.uiproj";
1338
+ static WebAppManifestFileName = "webAppManifest.json";
1339
+ constructor(fileSystem) {
1340
+ this.fileSystem = fileSystem;
1341
+ }
1342
+ async loadProject(projectPath) {
1343
+ if (!projectPath) {
1344
+ throw new Error(translate5.t("solutionpackager.projectLoader.errors.pathRequired"));
466
1345
  }
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
- };
1346
+ const projectFilePath = Path2.join(projectPath, ProjectLoader.ProjectFileName);
1347
+ const projectFileExists = await this.fileSystem.exists(projectFilePath);
1348
+ if (projectFileExists) {
1349
+ return await this.loadFromProjectFile(projectPath, projectFilePath);
484
1350
  }
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
- };
1351
+ const webAppManifestPath = Path2.join(projectPath, ProjectLoader.WebAppManifestFileName);
1352
+ const webAppManifestExists = await this.fileSystem.exists(webAppManifestPath);
1353
+ if (webAppManifestExists) {
1354
+ return this.loadFromWebAppManifest(projectPath, webAppManifestPath);
493
1355
  }
494
- constructor(fileSystem){
495
- project_loader_define_property(this, "fileSystem", void 0);
496
- this.fileSystem = fileSystem;
1356
+ throw new Error(translate5.t("solutionpackager.projectLoader.errors.noProjectFile", {
1357
+ projectFile: ProjectLoader.ProjectFileName,
1358
+ manifestFile: ProjectLoader.WebAppManifestFileName,
1359
+ path: projectPath
1360
+ }));
1361
+ }
1362
+ async loadFromProjectFile(projectPath, projectFilePath) {
1363
+ const fileContent = await this.fileSystem.readFile(projectFilePath);
1364
+ if (!fileContent) {
1365
+ throw new Error(translate5.t("solutionpackager.projectLoader.errors.readFailed", {
1366
+ path: projectFilePath
1367
+ }));
497
1368
  }
1369
+ const json = typeof fileContent === "string" ? fileContent : new TextDecoder("utf-8").decode(fileContent);
1370
+ const projectData = JSON.parse(json);
1371
+ const projectType = projectData?.ProjectType || projectData?.type;
1372
+ if (!projectData || !projectType) {
1373
+ throw new Error(translate5.t("solutionpackager.projectLoader.errors.invalidProject", {
1374
+ path: projectFilePath
1375
+ }));
1376
+ }
1377
+ return {
1378
+ type: projectType,
1379
+ name: projectData.Name || Path2.basename(projectPath),
1380
+ projectPath,
1381
+ projectFilePath
1382
+ };
1383
+ }
1384
+ loadFromWebAppManifest(projectPath, webAppManifestPath) {
1385
+ const folderName = Path2.basename(projectPath);
1386
+ return {
1387
+ type: ProjectTypes.AppV2,
1388
+ name: folderName,
1389
+ projectPath,
1390
+ projectFilePath: webAppManifestPath
1391
+ };
1392
+ }
498
1393
  }
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
- }
1394
+
1395
+ // src/services/project-pack-options-builder.ts
511
1396
  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;
1397
+ packService;
1398
+ fileSystem;
1399
+ constructor(packService, fileSystem) {
1400
+ this.packService = packService;
1401
+ this.fileSystem = fileSystem;
1402
+ }
1403
+ async buildProjectPackOptions(parameters, project) {
1404
+ if (!parameters.outputPath) {
1405
+ throw new Error("Output path is required for Pack command");
544
1406
  }
1407
+ await this.fileSystem.mkdir(parameters.outputPath);
1408
+ const packageId = !parameters.package.id || parameters.package.id.trim() === "" ? project.name : parameters.package.id;
1409
+ const packageInfo = {
1410
+ ...parameters.package,
1411
+ id: this.packService.sanitizePackageId(packageId)
1412
+ };
1413
+ return {
1414
+ projectPath: project.projectPath,
1415
+ excludeConfiguredSources: parameters.excludeConfiguredSources ?? false,
1416
+ nuGetSourcesConfigPath: parameters.nuGetSourcesConfigPath,
1417
+ logLevel: parameters.logLevel,
1418
+ skipAnalyze: parameters.validateOptions.skipAnalyze,
1419
+ skipValidate: false,
1420
+ detailedLogPath: parameters.detailedLogPath,
1421
+ policyFilePath: parameters.validateOptions.governanceFilePath,
1422
+ policyFileType: parameters.validateOptions.governanceFileType,
1423
+ outputPath: parameters.outputPath,
1424
+ outputType: undefined,
1425
+ projectType: project.type,
1426
+ package: packageInfo,
1427
+ skipDependencyOptimization: parameters.packOptions?.skipDependencyOptimization ?? false,
1428
+ includeSources: parameters.packOptions?.includeSources ?? false,
1429
+ splitPackages: parameters.packOptions?.splitPackages ?? false
1430
+ };
1431
+ }
545
1432
  }
1433
+
1434
+ // src/services/project-pack-options-validator.ts
546
1435
  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);
1436
+ async validateAsync(options, cancellationToken) {
1437
+ const destinationResult = this.validateDestinationPath(options.destinationPath);
1438
+ if (!destinationResult.isSuccess) {
1439
+ return destinationResult;
551
1440
  }
1441
+ return await super.validateAsync(options, cancellationToken);
1442
+ }
552
1443
  }
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
- }
1444
+
1445
+ // src/services/project-tool-executor.ts
1446
+ import {
1447
+ ToolErrorCodes as ToolErrorCodes3,
1448
+ ToolResult as ToolResult3
1449
+ } from "@uipath/solutionpackager-tool-core";
563
1450
  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));
1451
+ toolsFactory;
1452
+ telemetry;
1453
+ packageSignService;
1454
+ constructor(toolsFactory, telemetry, packageSignService) {
1455
+ this.toolsFactory = toolsFactory;
1456
+ this.telemetry = telemetry;
1457
+ this.packageSignService = packageSignService;
1458
+ }
1459
+ async restoreAsync(options, project, context, cancellationToken) {
1460
+ return await this.executeToolOperationAsync(project, context, (tool) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Restore" /* ProjectToolRestore */, project.Type, async () => tool.restoreAsync(options, cancellationToken), {
1461
+ projectId: project.Id,
1462
+ projectType: project.Type
1463
+ }));
1464
+ }
1465
+ async validateAsync(options, project, context, cancellationToken) {
1466
+ return await this.executeToolOperationAsync(project, context, (tool) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Validate" /* ProjectToolValidate */, project.Type, async () => tool.validateAsync(options, cancellationToken), {
1467
+ projectId: project.Id,
1468
+ projectType: project.Type
1469
+ }));
1470
+ }
1471
+ async buildAsync(options, project, context, cancellationToken) {
1472
+ return await this.executeToolOperationAsync(project, context, (tool) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Build" /* ProjectToolBuild */, project.Type, async () => tool.buildAsync(options, cancellationToken), {
1473
+ projectId: project.Id,
1474
+ projectType: project.Type
1475
+ }));
1476
+ }
1477
+ async packAsync(options, project, context, signingInfo, cancellationToken) {
1478
+ return await this.executeToolOperationAsync(project, context, async (tool) => {
1479
+ const result = await this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Pack" /* ProjectToolPack */, project.Type, async () => {
1480
+ return await tool.packAsync(options, cancellationToken);
1481
+ }, {
1482
+ projectId: project.Id,
1483
+ projectType: project.Type
1484
+ });
1485
+ if (result.isSuccess && signingInfo?.certificatePath && result.packages.length > 0) {
1486
+ const signResult = await this.signPackagesAsync(result.packages, signingInfo);
1487
+ if (!signResult.isSuccess) {
1488
+ return signResult;
606
1489
  }
1490
+ }
1491
+ return result;
1492
+ });
1493
+ }
1494
+ async executeToolOperationAsync(project, context, operation) {
1495
+ try {
1496
+ const tool = await this.toolsFactory.createProjectToolAsync(project, context);
1497
+ try {
1498
+ return await operation(tool);
1499
+ } finally {
1500
+ const disposeResult = tool.dispose();
1501
+ if (disposeResult instanceof Promise) {
1502
+ await disposeResult;
1503
+ }
1504
+ }
1505
+ } catch (error) {
1506
+ return ToolResult3.error(ToolErrorCodes3.InternalError, error instanceof Error ? error.message : String(error));
607
1507
  }
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;
1508
+ }
1509
+ async signPackagesAsync(packages, signingInfo) {
1510
+ if (!this.packageSignService) {
1511
+ 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
1512
  }
624
- }
625
- class ProjectValidateOptionsValidator extends PackagerParametersValidator {
626
- async validateAsync(options, _cancellationToken) {
627
- return await this.validateGovernanceOptions(options.validateOptions);
1513
+ const certificatePath = signingInfo.certificatePath;
1514
+ const signResults = await Promise.all(packages.map((packagePath) => this.packageSignService?.signPackageAsync(packagePath, certificatePath, signingInfo.certificatePassword, signingInfo.timestampServer)));
1515
+ const failedResult = signResults.find((result) => result && !result.isSuccess);
1516
+ if (failedResult) {
1517
+ return failedResult;
628
1518
  }
1519
+ return ToolResult3.success();
1520
+ }
629
1521
  }
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;
1522
+
1523
+ // src/services/project-validate-options-validator.ts
1524
+ class ProjectValidateOptionsValidator extends PackagerParametersValidator {
1525
+ async validateAsync(options, _cancellationToken) {
1526
+ return await this.validateGovernanceOptions(options.validateOptions);
1527
+ }
639
1528
  }
1529
+
1530
+ // src/services/tools-factory.ts
640
1531
  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
- }
1532
+ repository;
1533
+ fileSystem;
1534
+ constructor(repository, fileSystem) {
1535
+ this.repository = repository;
1536
+ this.fileSystem = fileSystem;
1537
+ }
1538
+ async createSolutionToolAsync(solutionName) {
1539
+ const logger = new ToolLogger("ResourceBuilder", solutionName);
1540
+ const factory = this.repository.getSolutionToolFactory();
1541
+ return await factory.createAsync(logger, this.fileSystem);
1542
+ }
1543
+ async createProjectToolAsync(project, context) {
1544
+ const sourceTarget = getSourceTarget();
1545
+ const logger = new ToolLogger(project.Type, sourceTarget);
1546
+ if (!project.ProjectPath) {
1547
+ throw new Error(`Project path not set for project: ${project.Id}`);
657
1548
  }
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;
1549
+ const factory = this.repository.getProjectToolFactory(project.Type);
1550
+ return await factory.createAsync(logger, this.fileSystem, context);
1551
+ function getSourceTarget() {
1552
+ const segments = project.ProjectRelativePath.split(/[/\\]/);
1553
+ if (segments.length > 1) {
1554
+ return segments[0];
1555
+ }
1556
+ return project.Id;
663
1557
  }
1558
+ }
664
1559
  }
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
- }
1560
+
1561
+ // src/services/project-packager.ts
675
1562
  class ProjectPackager {
676
- async canPackProjectAsync(projectPath) {
677
- const project = await this.projectLoader.loadProject(projectPath);
678
- return this.repository.canHandleProject(project.type);
1563
+ fileSystem;
1564
+ telemetryService;
1565
+ packageSignService;
1566
+ repository;
1567
+ temporaryStorage;
1568
+ zipService;
1569
+ logger;
1570
+ optionsBuilder;
1571
+ toolsFactory;
1572
+ projectExecutor;
1573
+ projectLoader;
1574
+ validateOptionsValidator;
1575
+ buildOptionsValidator;
1576
+ packOptionsValidator;
1577
+ nugetPackager;
1578
+ governancePolicyService;
1579
+ constructor(fileSystem, telemetryService, packageSignService) {
1580
+ this.fileSystem = fileSystem;
1581
+ this.telemetryService = telemetryService;
1582
+ this.packageSignService = packageSignService;
1583
+ this.repository = defaultToolsFactoryRepository;
1584
+ this.temporaryStorage = new TemporaryStorageService(this.fileSystem);
1585
+ this.zipService = new ZipService(this.fileSystem);
1586
+ this.nugetPackager = new NugetPackager(this.fileSystem);
1587
+ this.logger = new ToolLogger("ProjectPackager", "PackProject");
1588
+ this.validateOptionsValidator = new ProjectValidateOptionsValidator(this.logger, this.fileSystem);
1589
+ this.buildOptionsValidator = new ProjectBuildOptionsValidator(this.logger, this.fileSystem);
1590
+ this.packOptionsValidator = new ProjectPackOptionsValidator(this.logger, this.fileSystem);
1591
+ const packService = new PackService;
1592
+ this.optionsBuilder = new ProjectPackOptionsBuilder(packService, this.fileSystem);
1593
+ this.toolsFactory = new ToolsFactory(this.repository, this.fileSystem);
1594
+ this.projectExecutor = new ProjectToolExecutor(this.toolsFactory, this.telemetryService, this.packageSignService);
1595
+ this.projectLoader = new ProjectLoader(this.fileSystem);
1596
+ this.governancePolicyService = new GovernancePolicyService(this.fileSystem, this.temporaryStorage);
1597
+ }
1598
+ async canPackProjectAsync(projectPath) {
1599
+ const project = await this.projectLoader.loadProject(projectPath);
1600
+ return this.repository.canHandleProject(project.type);
1601
+ }
1602
+ async setupAsync(input, operationId) {
1603
+ this.telemetryService.setOperationId(operationId);
1604
+ await this.temporaryStorage.cleanup();
1605
+ if (typeof input === "string") {
1606
+ return input;
679
1607
  }
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;
1608
+ const inputPath = await this.temporaryStorage.getTempSubfolderPathAsync("input");
1609
+ await this.zipService.extractAsync(input, inputPath);
1610
+ const entries = await this.fileSystem.readdir(inputPath);
1611
+ if (entries.length === 1) {
1612
+ const innerPath = Path3.join(inputPath, entries[0]);
1613
+ const stat = await this.fileSystem.stat(innerPath);
1614
+ if (stat?.isDirectory()) {
1615
+ return innerPath;
1616
+ }
1617
+ }
1618
+ return inputPath;
1619
+ }
1620
+ async restoreProjectAsync(options, cancellationToken) {
1621
+ return await this.executeProjectOperationAsync(options, "Restore", "ProjectPackager.Restore" /* ProjectPackagerRestore */, async (uiPathProject, loadedProject) => {
1622
+ const restoreOptions = {
1623
+ projectPath: loadedProject.projectPath,
1624
+ excludeConfiguredSources: options.excludeConfiguredSources ?? false,
1625
+ nuGetSourcesConfigPath: options.nuGetSourcesConfigPath,
1626
+ logLevel: options.logLevel,
1627
+ outputPath: options.outputPath
1628
+ };
1629
+ return await this.projectExecutor.restoreAsync(restoreOptions, uiPathProject, undefined, cancellationToken);
1630
+ }, cancellationToken);
1631
+ }
1632
+ async validateProjectAsync(options, cancellationToken) {
1633
+ await this.governancePolicyService.resolveGovernancePolicyAsync(options.validateOptions, options.connection, cancellationToken);
1634
+ const validationResult = await this.validateOptionsValidator.validateAsync(options, cancellationToken);
1635
+ if (!validationResult.isSuccess) {
1636
+ return validationResult;
1637
+ }
1638
+ return await this.executeProjectOperationAsync(options, "Validate", "ProjectPackager.Validate" /* ProjectPackagerValidate */, async (uiPathProject, loadedProject) => {
1639
+ const validateOptions = {
1640
+ projectPath: loadedProject.projectPath,
1641
+ excludeConfiguredSources: options.excludeConfiguredSources ?? false,
1642
+ nuGetSourcesConfigPath: options.nuGetSourcesConfigPath,
1643
+ logLevel: options.logLevel,
1644
+ skipAnalyze: options.validateOptions.skipAnalyze,
1645
+ defaultSeverity: options.validateOptions.defaultSeverity,
1646
+ detailedLogPath: options.detailedLogPath,
1647
+ policyFilePath: options.validateOptions.governanceFilePath,
1648
+ policyFileType: options.validateOptions.governanceFileType
1649
+ };
1650
+ return await this.projectExecutor.validateAsync(validateOptions, uiPathProject, undefined, cancellationToken);
1651
+ }, cancellationToken);
1652
+ }
1653
+ async buildProjectAsync(options, cancellationToken) {
1654
+ await this.governancePolicyService.resolveGovernancePolicyAsync(options.validateOptions, options.connection, cancellationToken);
1655
+ const validationResult = await this.buildOptionsValidator.validateAsync(options, cancellationToken);
1656
+ if (!validationResult.isSuccess) {
1657
+ return validationResult;
1658
+ }
1659
+ return await this.executeProjectOperationAsync(options, "Build", "ProjectPackager.Build" /* ProjectPackagerBuild */, async (uiPathProject, loadedProject) => {
1660
+ if (!options.outputPath) {
1661
+ options.outputPath = await this.temporaryStorage.getTempSubfolderPathAsync("output");
1662
+ }
1663
+ const buildOptions = {
1664
+ projectPath: loadedProject.projectPath,
1665
+ excludeConfiguredSources: options.excludeConfiguredSources ?? false,
1666
+ nuGetSourcesConfigPath: options.nuGetSourcesConfigPath,
1667
+ logLevel: options.logLevel,
1668
+ skipAnalyze: options.validateOptions.skipAnalyze,
1669
+ skipValidate: false,
1670
+ detailedLogPath: options.detailedLogPath,
1671
+ policyFilePath: options.validateOptions.governanceFilePath,
1672
+ policyFileType: options.validateOptions.governanceFileType,
1673
+ outputPath: options.outputPath,
1674
+ outputType: undefined,
1675
+ projectType: uiPathProject.Type
1676
+ };
1677
+ return await this.projectExecutor.buildAsync(buildOptions, uiPathProject, undefined, cancellationToken);
1678
+ }, cancellationToken);
1679
+ }
1680
+ async packProjectAsync(options, cancellationToken) {
1681
+ return await this.telemetryService.trackRequest("ProjectPackager.Pack" /* ProjectPackagerPack */, async () => {
1682
+ try {
1683
+ await this.governancePolicyService.resolveGovernancePolicyAsync(options.validateOptions, options.connection, cancellationToken);
1684
+ let result = await this.packOptionsValidator.validateAsync(options, cancellationToken);
1685
+ if (!result.isSuccess) {
1686
+ return result;
691
1687
  }
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
- });
1688
+ if (!options.outputPath) {
1689
+ options.outputPath = await this.temporaryStorage.getTempSubfolderPathAsync("output");
1690
+ }
1691
+ const loadedProject = await this.projectLoader.loadProject(options.inputPath);
1692
+ this.telemetryService.trackEvent("ProjectPackager.ProjectLoaded" /* ProjectPackagerProjectLoaded */, { projectId: loadedProject.name });
1693
+ const projectPackOptions = await this.optionsBuilder.buildProjectPackOptions(options, loadedProject);
1694
+ const uiPathProject = {
1695
+ Type: loadedProject.type,
1696
+ ProjectRelativePath: Path3.basename(loadedProject.projectFilePath),
1697
+ ProjectPath: loadedProject.projectPath,
1698
+ Id: loadedProject.name
1699
+ };
1700
+ result = await this.projectExecutor.packAsync(projectPackOptions, uiPathProject, undefined, options.signingInfo, cancellationToken);
1701
+ if (result.isSuccess && result.packages.length > 0) {
1702
+ const destinationPackages = await this.copyPackagesToDestination(result.packages, options.destinationPath, projectPackOptions.package);
1703
+ result = new ToolResult4(ToolErrorCodes4.Success, undefined, destinationPackages);
1704
+ }
1705
+ if (result.isSuccess) {
1706
+ this.logger.info(`Project pack completed successfully. Packages: ${result.packages.join(", ")}`);
1707
+ } else {
1708
+ this.logger.error(`Project pack failed with error code ${result.errorCode}: ${result.message}`);
1709
+ }
1710
+ return result;
1711
+ } catch (error) {
1712
+ const errorMessage2 = error instanceof Error ? error.message : String(error);
1713
+ this.logger.error(`Processing error: ${errorMessage2}`);
1714
+ return ToolResult4.error(ToolErrorCodes4.InternalError, `Project pack failed: ${errorMessage2}`);
1715
+ } finally {
1716
+ await this.temporaryStorage.cleanup();
1717
+ }
1718
+ });
1719
+ }
1720
+ async getPackageStreamsAsync(result) {
1721
+ if (!result.isSuccess) {
1722
+ throw new Error(translate6.t("solutionpackager.packager.errors.failedToGetStreams", {
1723
+ errorCode: result.errorCode,
1724
+ message: result.message ?? ""
1725
+ }));
1726
+ }
1727
+ if (!result.packages || result.packages.length === 0) {
1728
+ return [];
779
1729
  }
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 ?? ""
1730
+ const packageStreams = [];
1731
+ for (const packagePath of result.packages) {
1732
+ const data = await this.fileSystem.readFile(packagePath);
1733
+ if (!data) {
1734
+ throw new Error(translate6.t("solutionpackager.packager.errors.failedToReadPackage", {
1735
+ path: packagePath
784
1736
  }));
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
- });
797
- }
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
- });
1737
+ }
1738
+ const name = packagePath.split(/[\\/]/).pop() || packagePath;
1739
+ packageStreams.push({ name, data });
822
1740
  }
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);
1741
+ return packageStreams;
1742
+ }
1743
+ async executeProjectOperationAsync(options, operationName, telemetryName, operation, _cancellationToken) {
1744
+ return await this.telemetryService.trackRequest(telemetryName, async () => {
1745
+ try {
1746
+ const loadedProject = await this.projectLoader.loadProject(options.inputPath);
1747
+ const uiPathProject = {
1748
+ Type: loadedProject.type,
1749
+ ProjectRelativePath: Path3.basename(loadedProject.projectFilePath),
1750
+ ProjectPath: loadedProject.projectPath,
1751
+ Id: loadedProject.name
1752
+ };
1753
+ const operationResult = await operation(uiPathProject, loadedProject);
1754
+ if (operationResult.isSuccess) {
1755
+ this.logger.info(`Project ${operationName.toLowerCase()} completed successfully.`);
1756
+ } else {
1757
+ this.logger.error(`Project ${operationName.toLowerCase()} failed with error code ${operationResult.errorCode}: ${operationResult.message}`);
1758
+ }
1759
+ return operationResult;
1760
+ } catch (error) {
1761
+ const errorMessage2 = error instanceof Error ? error.message : String(error);
1762
+ this.logger.error(`Processing error: ${errorMessage2}`);
1763
+ return ToolResult4.error(ToolErrorCodes4.InternalError, `Project ${operationName.toLowerCase()} failed: ${errorMessage2}`);
1764
+ } finally {
1765
+ await this.temporaryStorage.cleanup();
1766
+ }
1767
+ });
1768
+ }
1769
+ async copyPackagesToDestination(packagePaths, destinationPath, packageInfo) {
1770
+ await this.fileSystem.mkdir(destinationPath);
1771
+ const destinationPackages = [];
1772
+ for (const packagePath of packagePaths) {
1773
+ const stat = await this.fileSystem.stat(packagePath);
1774
+ if (stat?.isDirectory()) {
1775
+ const files = await this.fileSystem.readdir(packagePath);
1776
+ const nupkgFiles = files.filter((f) => f.endsWith(".nupkg"));
1777
+ if (nupkgFiles.length > 0) {
1778
+ for (const nupkgFile of nupkgFiles) {
1779
+ const filePath = Path3.join(packagePath, nupkgFile);
1780
+ const destPath = Path3.join(destinationPath, nupkgFile);
1781
+ const data = await this.fileSystem.readFile(filePath);
1782
+ if (!data) {
1783
+ throw new Error(translate6.t("solutionpackager.packager.errors.failedToReadPackage", {
1784
+ path: filePath
1785
+ }));
856
1786
  }
1787
+ await this.fileSystem.writeFile(destPath, data);
1788
+ destinationPackages.push(destPath);
1789
+ }
1790
+ } else {
1791
+ const nupkgFileName = `${packageInfo.id}.${packageInfo.version}.nupkg`;
1792
+ const destPath = Path3.join(destinationPath, nupkgFileName);
1793
+ const packResult = await this.nugetPackager.packAsync(packagePath, packageInfo, destPath);
1794
+ destinationPackages.push(packResult.outputPath);
857
1795
  }
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);
1796
+ } else {
1797
+ const fileName = packagePath.split(/[\\/]/).pop() || packagePath;
1798
+ const destPath = Path3.join(destinationPath, fileName);
1799
+ const data = await this.fileSystem.readFile(packagePath);
1800
+ if (!data) {
1801
+ throw new Error(translate6.t("solutionpackager.packager.errors.failedToReadPackage", {
1802
+ path: packagePath
1803
+ }));
1804
+ }
1805
+ await this.fileSystem.writeFile(destPath, data);
1806
+ destinationPackages.push(destPath);
1807
+ }
892
1808
  }
1809
+ return destinationPackages;
1810
+ }
893
1811
  }
1812
+
1813
+ // src/node-project-packager-factory.ts
894
1814
  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
- }
1815
+ async createAsync(config) {
1816
+ const logger = new ToolLogger("ProjectPackagerFactory", "Create");
1817
+ this.configureLanguage(config);
1818
+ this.configureLogHandler(config);
1819
+ logger.info("Creating ProjectPackager instance...");
1820
+ const fileSystem = this.getOrCreateFileSystem(config);
1821
+ const telemetryService = this.getOrCreateTelemetryService(config);
1822
+ const packageSignService = new NodePackageSignService(logger);
1823
+ const projectPackager = new ProjectPackager(fileSystem, telemetryService, packageSignService);
1824
+ this.checkDotnetAvailability(logger);
1825
+ logger.info("ProjectPackager created successfully.");
1826
+ return projectPackager;
1827
+ }
908
1828
  }
909
1829
  async function createNodeProjectPackager(options) {
910
- const factory = new NodeProjectPackagerFactory();
911
- return factory.createAsync(options);
1830
+ const factory = new NodeProjectPackagerFactory;
1831
+ return factory.createAsync(options);
912
1832
  }
913
- export { BaseNodePackagerFactory, ConsoleTelemetryProvider, NodeContextStorage, NodePackageSignService, PackService, PackagerParameters, PackagerParametersValidator, ProjectBuildOptions, ProjectBuildOptionsValidator, ProjectLoader, ProjectPackOptions, ProjectPackager, ProjectRestoreOptions, ProjectToolExecutor, ProjectValidateOptions, ProjectValidateOptionsValidator, TelemetryService, ToolLogger, ToolsFactory, createNodeProjectPackager, packager_parameters_RulesConfigFileType as RulesConfigFileType, setGlobalLogHandler, telemetry_names_TelemetryNames as TelemetryNames };
914
-
915
- //# sourceMappingURL=node.js.map
1833
+ export {
1834
+ setGlobalLogHandler,
1835
+ createNodeProjectPackager,
1836
+ ToolsFactory,
1837
+ ToolLogger,
1838
+ TelemetryService2 as TelemetryService,
1839
+ TelemetryNames,
1840
+ RulesConfigFileType,
1841
+ ProjectValidateOptionsValidator,
1842
+ ProjectValidateOptions,
1843
+ ProjectToolExecutor,
1844
+ ProjectRestoreOptions,
1845
+ ProjectPackager,
1846
+ ProjectPackOptions,
1847
+ ProjectLoader,
1848
+ ProjectBuildOptionsValidator,
1849
+ ProjectBuildOptions,
1850
+ PackagerParametersValidator,
1851
+ PackagerParameters,
1852
+ PackService,
1853
+ NodePackageSignService,
1854
+ NodeContextStorage2 as NodeContextStorage,
1855
+ ConsoleTelemetryProvider2 as ConsoleTelemetryProvider,
1856
+ BaseNodePackagerFactory
1857
+ };