@uipath/api-workflow-tool 1.203.0-preview.203 → 1.204.0-preview.206
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/executor-tool.js +4 -2
- package/dist/index-zp7vrgty.js +72 -0
- package/dist/index.js +7 -5
- package/dist/node-mw4mcxv5.js +246 -0
- package/dist/packager-tool-1n0det9t.js +514 -0
- package/dist/{packager-tool-jccpttsx.js → packager-tool-3m7z169b.js} +231 -54
- package/dist/packager-tool-4mxzf9gt.js +4627 -0
- package/dist/packager-tool-69mfq5g8.js +1501 -0
- package/dist/{packager-tool-6se0wnbx.js → packager-tool-fm7ese0m.js} +475 -470
- package/dist/{packager-tool-myc90a0t.js → packager-tool-m4jcr834.js} +2909 -8561
- package/dist/packager-tool-z58p51e2.js +4809 -0
- package/dist/packager-tool.js +2 -2
- package/dist/tool.js +7 -5
- package/package.json +2 -2
- package/dist/index-zem2t5ty.js +0 -15474
- package/dist/node-b4azqgya.js +0 -16492
- package/dist/packager-tool-k9wheprx.js +0 -1378
|
@@ -1,3 +1,252 @@
|
|
|
1
|
+
// ../packager/packager-core/src/services/tools-factory-repository.ts
|
|
2
|
+
class ToolsFactoryRepository {
|
|
3
|
+
projectFactoryMap = new Map;
|
|
4
|
+
solutionFactory = null;
|
|
5
|
+
registerProjectToolFactory(factory) {
|
|
6
|
+
for (const type of factory.supportedTypes) {
|
|
7
|
+
const existing = this.projectFactoryMap.get(type);
|
|
8
|
+
if (existing) {
|
|
9
|
+
if (existing.constructor?.name !== factory.constructor?.name) {
|
|
10
|
+
console.warn(`Tool factory conflict for project type '${type}': ` + `'${existing.constructor?.name}' already registered, ` + `ignoring '${factory.constructor?.name}'.`);
|
|
11
|
+
}
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
this.projectFactoryMap.set(type, factory);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
registerSolutionToolFactory(factory) {
|
|
18
|
+
this.solutionFactory = factory;
|
|
19
|
+
}
|
|
20
|
+
getSolutionToolFactory() {
|
|
21
|
+
if (!this.solutionFactory) {
|
|
22
|
+
throw new Error("No solution tool factory is registered");
|
|
23
|
+
}
|
|
24
|
+
return this.solutionFactory;
|
|
25
|
+
}
|
|
26
|
+
canHandleProject(projectType) {
|
|
27
|
+
return this.projectFactoryMap.has(projectType);
|
|
28
|
+
}
|
|
29
|
+
getProjectToolFactory(projectType) {
|
|
30
|
+
const factory = this.projectFactoryMap.get(projectType);
|
|
31
|
+
if (!factory) {
|
|
32
|
+
throw new Error(`Cannot pack project type '${projectType}': no packager is installed for it.`);
|
|
33
|
+
}
|
|
34
|
+
return factory;
|
|
35
|
+
}
|
|
36
|
+
reset() {
|
|
37
|
+
this.projectFactoryMap.clear();
|
|
38
|
+
this.solutionFactory = null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
var REGISTRY_KEY = Symbol.for("@uipath/solutionpackager-tool-core/toolsFactoryRepository");
|
|
42
|
+
var _global = globalThis;
|
|
43
|
+
if (!_global[REGISTRY_KEY]) {
|
|
44
|
+
_global[REGISTRY_KEY] = new ToolsFactoryRepository;
|
|
45
|
+
}
|
|
46
|
+
var toolsFactoryRepository = _global[REGISTRY_KEY];
|
|
47
|
+
|
|
48
|
+
// ../packager/packager-core/src/filesystem/path.ts
|
|
49
|
+
class Path {
|
|
50
|
+
static normalize(path) {
|
|
51
|
+
return path.replace(/\\/g, "/").replace(/\/+/g, "/");
|
|
52
|
+
}
|
|
53
|
+
static join(...segments) {
|
|
54
|
+
return Path.normalize(segments.filter((s) => s.length > 0).join("/"));
|
|
55
|
+
}
|
|
56
|
+
static dirname(path) {
|
|
57
|
+
const normalized = Path.normalize(path).replace(/\/$/, "");
|
|
58
|
+
if (normalized === "")
|
|
59
|
+
return ".";
|
|
60
|
+
const lastSlash = normalized.lastIndexOf("/");
|
|
61
|
+
if (lastSlash === -1)
|
|
62
|
+
return ".";
|
|
63
|
+
if (lastSlash === 0)
|
|
64
|
+
return "/";
|
|
65
|
+
return normalized.substring(0, lastSlash);
|
|
66
|
+
}
|
|
67
|
+
static basename(path) {
|
|
68
|
+
const normalized = Path.normalize(path).replace(/\/$/, "");
|
|
69
|
+
if (normalized === "")
|
|
70
|
+
return "";
|
|
71
|
+
const lastSlash = normalized.lastIndexOf("/");
|
|
72
|
+
return lastSlash >= 0 ? normalized.substring(lastSlash + 1) : normalized;
|
|
73
|
+
}
|
|
74
|
+
static extname(path) {
|
|
75
|
+
const base = Path.basename(path);
|
|
76
|
+
const lastDot = base.lastIndexOf(".");
|
|
77
|
+
if (lastDot === -1 || lastDot === 0 || lastDot === base.length - 1) {
|
|
78
|
+
return "";
|
|
79
|
+
}
|
|
80
|
+
return base.substring(lastDot);
|
|
81
|
+
}
|
|
82
|
+
static async walkDirectory(fs, rootPath, currentRelativePath = "") {
|
|
83
|
+
const entries = [];
|
|
84
|
+
const absolutePath = currentRelativePath ? Path.join(rootPath, currentRelativePath) : rootPath;
|
|
85
|
+
const items = await fs.readdir(absolutePath);
|
|
86
|
+
for (const item of items) {
|
|
87
|
+
const itemRelativePath = currentRelativePath ? Path.join(currentRelativePath, item) : item;
|
|
88
|
+
const itemAbsolutePath = Path.join(rootPath, itemRelativePath);
|
|
89
|
+
const stat = await fs.stat(itemAbsolutePath);
|
|
90
|
+
if (stat?.isDirectory()) {
|
|
91
|
+
const subEntries = await Path.walkDirectory(fs, rootPath, itemRelativePath);
|
|
92
|
+
entries.push(...subEntries);
|
|
93
|
+
} else if (stat?.isFile()) {
|
|
94
|
+
entries.push({
|
|
95
|
+
relativePath: Path.normalize(itemRelativePath),
|
|
96
|
+
absolutePath: Path.normalize(itemAbsolutePath)
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return entries;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ../packager/packager-core/src/models/nuget-constants.ts
|
|
105
|
+
var NugetConstants = {
|
|
106
|
+
OutputFolderName: "bundle",
|
|
107
|
+
ContentFolderName: "content",
|
|
108
|
+
OperateFileName: "operate.json",
|
|
109
|
+
EntryPointsFileName: "entry-points.json",
|
|
110
|
+
PackageDescriptorFileName: "package-descriptor.json",
|
|
111
|
+
BindingsV2FileName: "bindings_v2.json",
|
|
112
|
+
BindingsFileId: "bindings.json"
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// ../packager/packager-core/src/services/project-id.ts
|
|
116
|
+
var OPERATE_FILE = "operate.json";
|
|
117
|
+
var PROJECT_FILE = "project.json";
|
|
118
|
+
function isNonEmptyString(value) {
|
|
119
|
+
return typeof value === "string" && value.length > 0;
|
|
120
|
+
}
|
|
121
|
+
async function readJsonObject(fs, filePath) {
|
|
122
|
+
let content;
|
|
123
|
+
try {
|
|
124
|
+
content = await fs.readFile(filePath, "utf-8");
|
|
125
|
+
} catch {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (content === null) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
const parsed = JSON.parse(content);
|
|
133
|
+
if (parsed === null || typeof parsed !== "object") {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
return parsed;
|
|
137
|
+
} catch {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async function writeJsonObject(fs, filePath, data) {
|
|
142
|
+
await fs.writeFile(filePath, `${JSON.stringify(data, null, 2)}
|
|
143
|
+
`);
|
|
144
|
+
}
|
|
145
|
+
async function ensureProjectId(projectPath, fs) {
|
|
146
|
+
const operatePath = Path.join(projectPath, OPERATE_FILE);
|
|
147
|
+
const operateExists = await fs.exists(operatePath);
|
|
148
|
+
if (operateExists) {
|
|
149
|
+
const operate = await readJsonObject(fs, operatePath);
|
|
150
|
+
if (operate && isNonEmptyString(operate.projectId)) {
|
|
151
|
+
return operate.projectId;
|
|
152
|
+
}
|
|
153
|
+
if (operate) {
|
|
154
|
+
const id = crypto.randomUUID();
|
|
155
|
+
await writeJsonObject(fs, operatePath, {
|
|
156
|
+
...operate,
|
|
157
|
+
projectId: id
|
|
158
|
+
});
|
|
159
|
+
return id;
|
|
160
|
+
}
|
|
161
|
+
return crypto.randomUUID();
|
|
162
|
+
}
|
|
163
|
+
const projectFilePath = Path.join(projectPath, PROJECT_FILE);
|
|
164
|
+
const projectFileExists = await fs.exists(projectFilePath);
|
|
165
|
+
if (projectFileExists) {
|
|
166
|
+
const projectFile = await readJsonObject(fs, projectFilePath);
|
|
167
|
+
if (projectFile && isNonEmptyString(projectFile.projectId)) {
|
|
168
|
+
return projectFile.projectId;
|
|
169
|
+
}
|
|
170
|
+
if (projectFile) {
|
|
171
|
+
const id = crypto.randomUUID();
|
|
172
|
+
await writeJsonObject(fs, projectFilePath, {
|
|
173
|
+
...projectFile,
|
|
174
|
+
projectId: id
|
|
175
|
+
});
|
|
176
|
+
return id;
|
|
177
|
+
}
|
|
178
|
+
return crypto.randomUUID();
|
|
179
|
+
}
|
|
180
|
+
return crypto.randomUUID();
|
|
181
|
+
}
|
|
182
|
+
async function ensureProjectIdInOperateFile(operateFilePath, fallbackProjectId, fs) {
|
|
183
|
+
if (!await fs.exists(operateFilePath)) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const parsed = await readJsonObject(fs, operateFilePath);
|
|
187
|
+
if (!parsed) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (isNonEmptyString(parsed.projectId)) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
await writeJsonObject(fs, operateFilePath, {
|
|
194
|
+
...parsed,
|
|
195
|
+
projectId: fallbackProjectId
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
async function writeOrBackfillOperateProjectId(operateFilePath, projectId, fs, createIfMissing) {
|
|
199
|
+
if (await fs.exists(operateFilePath)) {
|
|
200
|
+
await ensureProjectIdInOperateFile(operateFilePath, projectId, fs);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
await createIfMissing();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// ../packager/packager-core/src/services/content-operate-file.ts
|
|
207
|
+
var OPERATE_SCHEMA = "https://cloud.uipath.com/draft/2024-12/operate";
|
|
208
|
+
async function resolveEntryPointMain(fs, sourceFolder) {
|
|
209
|
+
const entryPointsFilePath = Path.join(sourceFolder, NugetConstants.EntryPointsFileName);
|
|
210
|
+
if (!await fs.exists(entryPointsFilePath)) {
|
|
211
|
+
return "";
|
|
212
|
+
}
|
|
213
|
+
const content = await fs.readFile(entryPointsFilePath);
|
|
214
|
+
if (!content) {
|
|
215
|
+
return "";
|
|
216
|
+
}
|
|
217
|
+
try {
|
|
218
|
+
const parsed = JSON.parse(new TextDecoder().decode(content));
|
|
219
|
+
return parsed.entryPoints?.[0]?.filePath ?? "";
|
|
220
|
+
} catch {
|
|
221
|
+
return "";
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
async function writeContentOperateFile(fs, params) {
|
|
225
|
+
const operateFilePath = Path.join(params.contentFolder, NugetConstants.OperateFileName);
|
|
226
|
+
await writeOrBackfillOperateProjectId(operateFilePath, params.projectId, fs, async () => {
|
|
227
|
+
const main = await resolveEntryPointMain(fs, params.contentFolder);
|
|
228
|
+
const operateFileModel = {
|
|
229
|
+
$schema: OPERATE_SCHEMA,
|
|
230
|
+
contentType: params.contentType,
|
|
231
|
+
projectId: params.projectId,
|
|
232
|
+
main,
|
|
233
|
+
targetFramework: "Portable",
|
|
234
|
+
runtimeOptions: {
|
|
235
|
+
isAttended: false,
|
|
236
|
+
requiresUserInteraction: false
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
await fs.writeFile(operateFilePath, JSON.stringify(operateFileModel, null, 2));
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
async function ensureContentOperateFile(fs, params) {
|
|
243
|
+
const projectId = params.projectStorageId ?? await ensureProjectId(params.projectPath, fs);
|
|
244
|
+
await writeContentOperateFile(fs, {
|
|
245
|
+
contentFolder: params.contentFolder,
|
|
246
|
+
projectId,
|
|
247
|
+
contentType: params.contentType
|
|
248
|
+
});
|
|
249
|
+
}
|
|
1
250
|
// ../../node_modules/fflate/esm/index.mjs
|
|
2
251
|
import { createRequire } from "module";
|
|
3
252
|
var require2 = createRequire("/");
|
|
@@ -910,62 +1159,193 @@ function unzipSync(data, opts) {
|
|
|
910
1159
|
return files;
|
|
911
1160
|
}
|
|
912
1161
|
|
|
913
|
-
// ../packager/packager-core/
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
return
|
|
917
|
-
}
|
|
918
|
-
static join(...segments) {
|
|
919
|
-
return Path.normalize(segments.filter((s) => s.length > 0).join("/"));
|
|
1162
|
+
// ../packager/packager-core/src/services/nuget-packager.ts
|
|
1163
|
+
function escapeXml(str) {
|
|
1164
|
+
if (str === null || str === undefined) {
|
|
1165
|
+
return "";
|
|
920
1166
|
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
1167
|
+
return String(str).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1168
|
+
}
|
|
1169
|
+
function optionalElement(name, value) {
|
|
1170
|
+
if (value === undefined || value === "")
|
|
1171
|
+
return "";
|
|
1172
|
+
return ` <${name}>${escapeXml(value)}</${name}>
|
|
1173
|
+
`;
|
|
1174
|
+
}
|
|
1175
|
+
function generateDependenciesXml(dependencies) {
|
|
1176
|
+
if (!dependencies || dependencies.length === 0)
|
|
1177
|
+
return "";
|
|
1178
|
+
const deps = dependencies.map((d) => ` <dependency id="${escapeXml(d.id)}" version="${escapeXml(d.version)}" />`).join(`
|
|
1179
|
+
`);
|
|
1180
|
+
return ` <dependencies>
|
|
1181
|
+
${deps}
|
|
1182
|
+
</dependencies>
|
|
1183
|
+
`;
|
|
1184
|
+
}
|
|
1185
|
+
function generateRepositoryXml(packageInfo) {
|
|
1186
|
+
if (!packageInfo.repositoryType || !packageInfo.repositoryUrl)
|
|
1187
|
+
return "";
|
|
1188
|
+
let repoXml = ` <repository type="${escapeXml(packageInfo.repositoryType)}" url="${escapeXml(packageInfo.repositoryUrl)}"`;
|
|
1189
|
+
if (packageInfo.repositoryBranch) {
|
|
1190
|
+
repoXml += ` branch="${escapeXml(packageInfo.repositoryBranch)}"`;
|
|
931
1191
|
}
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
if (normalized === "")
|
|
935
|
-
return "";
|
|
936
|
-
const lastSlash = normalized.lastIndexOf("/");
|
|
937
|
-
return lastSlash >= 0 ? normalized.substring(lastSlash + 1) : normalized;
|
|
1192
|
+
if (packageInfo.repositoryCommit) {
|
|
1193
|
+
repoXml += ` commit="${escapeXml(packageInfo.repositoryCommit)}"`;
|
|
938
1194
|
}
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1195
|
+
repoXml += ` />
|
|
1196
|
+
`;
|
|
1197
|
+
return repoXml;
|
|
1198
|
+
}
|
|
1199
|
+
function generateNuspecXml(packageInfo) {
|
|
1200
|
+
const author = packageInfo.author?.trim() || "UiPath";
|
|
1201
|
+
const description = packageInfo.description?.trim() || "Created by UiPath";
|
|
1202
|
+
const title = packageInfo.title?.trim() || packageInfo.id;
|
|
1203
|
+
const requireLicenseAcceptance = packageInfo.requireLicenseAcceptance === true ? "true" : "false";
|
|
1204
|
+
const releaseNotes = packageInfo.releaseNotes ?? "";
|
|
1205
|
+
const xml = `\uFEFF<?xml version="1.0" encoding="utf-8"?>
|
|
1206
|
+
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
|
1207
|
+
<metadata>
|
|
1208
|
+
<id>${escapeXml(packageInfo.id)}</id>
|
|
1209
|
+
<version>${escapeXml(packageInfo.version)}</version>
|
|
1210
|
+
<title>${escapeXml(title)}</title>
|
|
1211
|
+
<authors>${escapeXml(author)}</authors>
|
|
1212
|
+
<requireLicenseAcceptance>${requireLicenseAcceptance}</requireLicenseAcceptance>
|
|
1213
|
+
<description>${escapeXml(description)}</description>
|
|
1214
|
+
<releaseNotes>${escapeXml(releaseNotes)}</releaseNotes>
|
|
1215
|
+
${optionalElement("tags", packageInfo.tags)}${optionalElement("iconUrl", packageInfo.iconUrl)}${optionalElement("projectUrl", packageInfo.projectUrl)}${optionalElement("licenseUrl", packageInfo.licenseUrl)}${optionalElement("copyright", packageInfo.copyright)}${generateRepositoryXml(packageInfo)}${generateDependenciesXml(packageInfo.dependencies)} </metadata>
|
|
1216
|
+
</package>
|
|
1217
|
+
`;
|
|
1218
|
+
return xml;
|
|
1219
|
+
}
|
|
1220
|
+
function generatePsmdcpXml(packageInfo) {
|
|
1221
|
+
const author = packageInfo.author?.trim() || "UiPath";
|
|
1222
|
+
const description = packageInfo.description?.trim() || "Created by UiPath";
|
|
1223
|
+
return `<?xml version="1.0" encoding="utf-8"?>
|
|
1224
|
+
<coreProperties xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.openxmlformats.org/package/2006/metadata/core-properties">
|
|
1225
|
+
<dc:creator>${escapeXml(author)}</dc:creator>
|
|
1226
|
+
<dc:description>${escapeXml(description)}</dc:description>
|
|
1227
|
+
<dc:identifier>${escapeXml(packageInfo.id)}</dc:identifier>
|
|
1228
|
+
<version>${escapeXml(packageInfo.version)}</version>
|
|
1229
|
+
<keywords></keywords>
|
|
1230
|
+
<lastModifiedBy>NuGet.Packaging, Version=6.12.1.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35;.NET 5.0</lastModifiedBy>
|
|
1231
|
+
</coreProperties>`;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
class NugetPackager {
|
|
1235
|
+
fileSystem;
|
|
1236
|
+
constructor(fileSystem) {
|
|
1237
|
+
this.fileSystem = fileSystem;
|
|
946
1238
|
}
|
|
947
|
-
|
|
948
|
-
const
|
|
949
|
-
const
|
|
950
|
-
const
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
1239
|
+
async packAsync(rootPath, packageInfo, outputPath) {
|
|
1240
|
+
const normalizedOutputPath = Path.normalize(outputPath);
|
|
1241
|
+
const nuspecXml = generateNuspecXml(packageInfo);
|
|
1242
|
+
const nuspecFileName = `${packageInfo.id}.nuspec`;
|
|
1243
|
+
const fileEntries = await Path.walkDirectory(this.fileSystem, rootPath);
|
|
1244
|
+
const zipContents = {};
|
|
1245
|
+
const encoder = new TextEncoder;
|
|
1246
|
+
const psmdcpId = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967296).toString(16).padStart(8, "0")).join("");
|
|
1247
|
+
const psmdcpFileName = `${psmdcpId}.psmdcp`;
|
|
1248
|
+
const psmdcpPath = `package/services/metadata/core-properties/${psmdcpFileName}`;
|
|
1249
|
+
const contentTypesXml = `<?xml version="1.0" encoding="utf-8"?>
|
|
1250
|
+
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
1251
|
+
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
|
|
1252
|
+
<Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
|
|
1253
|
+
<Default Extension="uiproj" ContentType="application/octet" />
|
|
1254
|
+
<Default Extension="json" ContentType="application/octet" />
|
|
1255
|
+
<Default Extension="nuspec" ContentType="application/octet" />
|
|
1256
|
+
</Types>`;
|
|
1257
|
+
zipContents["[Content_Types].xml"] = encoder.encode(contentTypesXml);
|
|
1258
|
+
const manifestRelId = `R${Date.now().toString(16).toUpperCase()}`;
|
|
1259
|
+
const corePropsRelId = `R${(Date.now() + 1).toString(16).toUpperCase()}`;
|
|
1260
|
+
const relsXml = `<?xml version="1.0" encoding="utf-8"?>
|
|
1261
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
1262
|
+
<Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/${nuspecFileName}" Id="${manifestRelId}" />
|
|
1263
|
+
<Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/${psmdcpPath}" Id="${corePropsRelId}" />
|
|
1264
|
+
</Relationships>`;
|
|
1265
|
+
zipContents["_rels/.rels"] = encoder.encode(relsXml);
|
|
1266
|
+
zipContents[psmdcpPath] = encoder.encode(generatePsmdcpXml(packageInfo));
|
|
1267
|
+
zipContents[nuspecFileName] = encoder.encode(nuspecXml);
|
|
1268
|
+
for (const entry of fileEntries) {
|
|
1269
|
+
const content = await this.fileSystem.readFile(entry.absolutePath);
|
|
1270
|
+
if (content !== null) {
|
|
1271
|
+
zipContents[entry.relativePath] = content;
|
|
963
1272
|
}
|
|
964
1273
|
}
|
|
965
|
-
|
|
1274
|
+
const zippedData = zipSync(zipContents);
|
|
1275
|
+
await this.fileSystem.writeFile(normalizedOutputPath, zippedData);
|
|
1276
|
+
return {
|
|
1277
|
+
outputPath: normalizedOutputPath
|
|
1278
|
+
};
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
// ../packager/packager-core/src/models/tool-result.ts
|
|
1282
|
+
class ToolResult {
|
|
1283
|
+
errorCode;
|
|
1284
|
+
message;
|
|
1285
|
+
packages;
|
|
1286
|
+
details;
|
|
1287
|
+
instructions;
|
|
1288
|
+
constructor(errorCode, message, packages = [], instructions) {
|
|
1289
|
+
this.errorCode = errorCode;
|
|
1290
|
+
this.message = message;
|
|
1291
|
+
this.packages = packages;
|
|
1292
|
+
this.instructions = instructions;
|
|
1293
|
+
}
|
|
1294
|
+
get isSuccess() {
|
|
1295
|
+
return this.errorCode === "SUCCESS" /* Success */;
|
|
1296
|
+
}
|
|
1297
|
+
static success() {
|
|
1298
|
+
return new ToolResult("SUCCESS" /* Success */);
|
|
1299
|
+
}
|
|
1300
|
+
static error(errorCode, message, instructions) {
|
|
1301
|
+
return new ToolResult(errorCode, message, [], instructions);
|
|
966
1302
|
}
|
|
967
1303
|
}
|
|
968
1304
|
|
|
1305
|
+
// ../packager/packager-core/src/services/project-tool.ts
|
|
1306
|
+
class ProjectTool {
|
|
1307
|
+
fileSystem;
|
|
1308
|
+
logger;
|
|
1309
|
+
static ProjectFileName = "project.uiproj";
|
|
1310
|
+
constructor(fileSystem, logger) {
|
|
1311
|
+
this.fileSystem = fileSystem;
|
|
1312
|
+
this.logger = logger;
|
|
1313
|
+
}
|
|
1314
|
+
async restoreAsync(_options, _cancellationToken) {
|
|
1315
|
+
this.logger.info("Restore operation is a noop");
|
|
1316
|
+
return ToolResult.success();
|
|
1317
|
+
}
|
|
1318
|
+
async validateAsync(_options, _cancellationToken) {
|
|
1319
|
+
this.logger.info("Validate operation is a noop");
|
|
1320
|
+
return ToolResult.success();
|
|
1321
|
+
}
|
|
1322
|
+
async buildAsync(_options, _cancellationToken) {
|
|
1323
|
+
this.logger.info("Build operation is a noop");
|
|
1324
|
+
return ToolResult.success();
|
|
1325
|
+
}
|
|
1326
|
+
async packAsync(_options, _cancellationToken) {
|
|
1327
|
+
this.logger.info("Pack operation is a noop");
|
|
1328
|
+
return ToolResult.success();
|
|
1329
|
+
}
|
|
1330
|
+
async cleanupAsync(_options, _cancellationToken) {
|
|
1331
|
+
this.logger.info("Cleanup operation is a noop");
|
|
1332
|
+
return ToolResult.success();
|
|
1333
|
+
}
|
|
1334
|
+
async getUiProjectAsync(projectPath) {
|
|
1335
|
+
const filePath = Path.join(projectPath, ProjectTool.ProjectFileName);
|
|
1336
|
+
if (!await this.fileSystem.exists(filePath)) {
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1339
|
+
const raw = await this.fileSystem.readFile(filePath);
|
|
1340
|
+
if (!raw) {
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
const json = typeof raw === "string" ? raw : new TextDecoder("utf-8").decode(raw);
|
|
1344
|
+
return JSON.parse(json);
|
|
1345
|
+
}
|
|
1346
|
+
async dispose() {}
|
|
1347
|
+
}
|
|
1348
|
+
// ../packager/packager-core/src/filesystem/temporary-storage-service.ts
|
|
969
1349
|
class TemporaryStorageService {
|
|
970
1350
|
fileSystem;
|
|
971
1351
|
_tempFolderPath = null;
|
|
@@ -1011,7 +1391,7 @@ class TemporaryStorageService {
|
|
|
1011
1391
|
} catch {}
|
|
1012
1392
|
}
|
|
1013
1393
|
}
|
|
1014
|
-
|
|
1394
|
+
// ../packager/packager-core/src/filesystem/zip-service.ts
|
|
1015
1395
|
class ZipService {
|
|
1016
1396
|
fileSystem;
|
|
1017
1397
|
constructor(fileSystem) {
|
|
@@ -1069,6 +1449,7 @@ class ZipService {
|
|
|
1069
1449
|
return zipSync(entries, { level: 6 });
|
|
1070
1450
|
}
|
|
1071
1451
|
}
|
|
1452
|
+
// ../packager/packager-core/src/i18n/types.ts
|
|
1072
1453
|
function isPluralForm(value) {
|
|
1073
1454
|
return typeof value === "object" && value !== null && "other" in value;
|
|
1074
1455
|
}
|
|
@@ -1099,6 +1480,7 @@ function selectPluralForm(forms, count) {
|
|
|
1099
1480
|
return forms.other;
|
|
1100
1481
|
}
|
|
1101
1482
|
|
|
1483
|
+
// ../packager/packager-core/src/i18n/i18n-manager.ts
|
|
1102
1484
|
class I18nManager {
|
|
1103
1485
|
static translations = {};
|
|
1104
1486
|
static currentLocale = "en";
|
|
@@ -1210,6 +1592,8 @@ class I18nManager {
|
|
|
1210
1592
|
return result;
|
|
1211
1593
|
}
|
|
1212
1594
|
}
|
|
1595
|
+
|
|
1596
|
+
// ../packager/packager-core/src/i18n/locales/de.ts
|
|
1213
1597
|
var de = {
|
|
1214
1598
|
toolCore: {
|
|
1215
1599
|
errors: {
|
|
@@ -1250,6 +1634,8 @@ var de = {
|
|
|
1250
1634
|
}
|
|
1251
1635
|
}
|
|
1252
1636
|
};
|
|
1637
|
+
|
|
1638
|
+
// ../packager/packager-core/src/i18n/locales/en.ts
|
|
1253
1639
|
var en = {
|
|
1254
1640
|
toolCore: {
|
|
1255
1641
|
errors: {
|
|
@@ -1290,6 +1676,8 @@ var en = {
|
|
|
1290
1676
|
}
|
|
1291
1677
|
}
|
|
1292
1678
|
};
|
|
1679
|
+
|
|
1680
|
+
// ../packager/packager-core/src/i18n/locales/es.ts
|
|
1293
1681
|
var es = {
|
|
1294
1682
|
toolCore: {
|
|
1295
1683
|
errors: {
|
|
@@ -1330,6 +1718,8 @@ var es = {
|
|
|
1330
1718
|
}
|
|
1331
1719
|
}
|
|
1332
1720
|
};
|
|
1721
|
+
|
|
1722
|
+
// ../packager/packager-core/src/i18n/locales/es-MX.ts
|
|
1333
1723
|
var es_MX = {
|
|
1334
1724
|
toolCore: {
|
|
1335
1725
|
errors: {
|
|
@@ -1370,6 +1760,8 @@ var es_MX = {
|
|
|
1370
1760
|
}
|
|
1371
1761
|
}
|
|
1372
1762
|
};
|
|
1763
|
+
|
|
1764
|
+
// ../packager/packager-core/src/i18n/locales/fr.ts
|
|
1373
1765
|
var fr = {
|
|
1374
1766
|
toolCore: {
|
|
1375
1767
|
errors: {
|
|
@@ -1410,6 +1802,8 @@ var fr = {
|
|
|
1410
1802
|
}
|
|
1411
1803
|
}
|
|
1412
1804
|
};
|
|
1805
|
+
|
|
1806
|
+
// ../packager/packager-core/src/i18n/locales/ja.ts
|
|
1413
1807
|
var ja = {
|
|
1414
1808
|
toolCore: {
|
|
1415
1809
|
errors: {
|
|
@@ -1450,6 +1844,8 @@ var ja = {
|
|
|
1450
1844
|
}
|
|
1451
1845
|
}
|
|
1452
1846
|
};
|
|
1847
|
+
|
|
1848
|
+
// ../packager/packager-core/src/i18n/locales/ko.ts
|
|
1453
1849
|
var ko = {
|
|
1454
1850
|
toolCore: {
|
|
1455
1851
|
errors: {
|
|
@@ -1490,6 +1886,8 @@ var ko = {
|
|
|
1490
1886
|
}
|
|
1491
1887
|
}
|
|
1492
1888
|
};
|
|
1889
|
+
|
|
1890
|
+
// ../packager/packager-core/src/i18n/locales/pt.ts
|
|
1493
1891
|
var pt = {
|
|
1494
1892
|
toolCore: {
|
|
1495
1893
|
errors: {
|
|
@@ -1530,6 +1928,8 @@ var pt = {
|
|
|
1530
1928
|
}
|
|
1531
1929
|
}
|
|
1532
1930
|
};
|
|
1931
|
+
|
|
1932
|
+
// ../packager/packager-core/src/i18n/locales/pt-BR.ts
|
|
1533
1933
|
var pt_BR = {
|
|
1534
1934
|
toolCore: {
|
|
1535
1935
|
errors: {
|
|
@@ -1570,6 +1970,8 @@ var pt_BR = {
|
|
|
1570
1970
|
}
|
|
1571
1971
|
}
|
|
1572
1972
|
};
|
|
1973
|
+
|
|
1974
|
+
// ../packager/packager-core/src/i18n/locales/ro.ts
|
|
1573
1975
|
var ro = {
|
|
1574
1976
|
toolCore: {
|
|
1575
1977
|
errors: {
|
|
@@ -1610,6 +2012,8 @@ var ro = {
|
|
|
1610
2012
|
}
|
|
1611
2013
|
}
|
|
1612
2014
|
};
|
|
2015
|
+
|
|
2016
|
+
// ../packager/packager-core/src/i18n/locales/ru.ts
|
|
1613
2017
|
var ru = {
|
|
1614
2018
|
toolCore: {
|
|
1615
2019
|
errors: {
|
|
@@ -1650,6 +2054,8 @@ var ru = {
|
|
|
1650
2054
|
}
|
|
1651
2055
|
}
|
|
1652
2056
|
};
|
|
2057
|
+
|
|
2058
|
+
// ../packager/packager-core/src/i18n/locales/tr.ts
|
|
1653
2059
|
var tr = {
|
|
1654
2060
|
toolCore: {
|
|
1655
2061
|
errors: {
|
|
@@ -1690,6 +2096,8 @@ var tr = {
|
|
|
1690
2096
|
}
|
|
1691
2097
|
}
|
|
1692
2098
|
};
|
|
2099
|
+
|
|
2100
|
+
// ../packager/packager-core/src/i18n/locales/zh-CN.ts
|
|
1693
2101
|
var zh_CN = {
|
|
1694
2102
|
toolCore: {
|
|
1695
2103
|
errors: {
|
|
@@ -1730,6 +2138,8 @@ var zh_CN = {
|
|
|
1730
2138
|
}
|
|
1731
2139
|
}
|
|
1732
2140
|
};
|
|
2141
|
+
|
|
2142
|
+
// ../packager/packager-core/src/i18n/locales/zh-TW.ts
|
|
1733
2143
|
var zh_TW = {
|
|
1734
2144
|
toolCore: {
|
|
1735
2145
|
errors: {
|
|
@@ -1770,6 +2180,8 @@ var zh_TW = {
|
|
|
1770
2180
|
}
|
|
1771
2181
|
}
|
|
1772
2182
|
};
|
|
2183
|
+
|
|
2184
|
+
// ../packager/packager-core/src/i18n/locales/zu.ts
|
|
1773
2185
|
var zu = {
|
|
1774
2186
|
toolCore: {
|
|
1775
2187
|
errors: {
|
|
@@ -1811,6 +2223,7 @@ var zu = {
|
|
|
1811
2223
|
}
|
|
1812
2224
|
};
|
|
1813
2225
|
|
|
2226
|
+
// ../packager/packager-core/src/i18n/translation-service.ts
|
|
1814
2227
|
class TranslationService {
|
|
1815
2228
|
static instance;
|
|
1816
2229
|
currentLocale = "en";
|
|
@@ -1841,6 +2254,8 @@ class TranslationService {
|
|
|
1841
2254
|
}
|
|
1842
2255
|
}
|
|
1843
2256
|
var translate = TranslationService.getInstance();
|
|
2257
|
+
|
|
2258
|
+
// ../packager/packager-core/src/i18n/index.ts
|
|
1844
2259
|
I18nManager.registerTranslations("en", en);
|
|
1845
2260
|
I18nManager.registerTranslations("de", de);
|
|
1846
2261
|
I18nManager.registerTranslations("es", es);
|
|
@@ -1857,19 +2272,12 @@ I18nManager.registerTranslations("zh-cn", zh_CN);
|
|
|
1857
2272
|
I18nManager.registerTranslations("zh-tw", zh_TW);
|
|
1858
2273
|
I18nManager.registerTranslations("zu", zu);
|
|
1859
2274
|
I18nManager.setLocale("en");
|
|
1860
|
-
|
|
1861
|
-
(
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
((LogLevel2) => {
|
|
1867
|
-
LogLevel2["Debug"] = "Debug";
|
|
1868
|
-
LogLevel2["Info"] = "Information";
|
|
1869
|
-
LogLevel2["Warn"] = "Warning";
|
|
1870
|
-
LogLevel2["Error"] = "Error";
|
|
1871
|
-
})(LogLevel ||= {});
|
|
1872
|
-
|
|
2275
|
+
// ../packager/packager-core/src/models/ignored-rules.ts
|
|
2276
|
+
function normalizeIgnoredRules(ignoredRules) {
|
|
2277
|
+
const rules = (ignoredRules ?? []).flatMap((rule) => rule.split(",")).map((rule) => rule.trim()).filter((rule) => rule.length > 0);
|
|
2278
|
+
return [...new Set(rules)];
|
|
2279
|
+
}
|
|
2280
|
+
// ../packager/packager-core/src/models/log-message.ts
|
|
1873
2281
|
class LogMessage {
|
|
1874
2282
|
message;
|
|
1875
2283
|
logLevel;
|
|
@@ -1912,15 +2320,15 @@ class LogMessage {
|
|
|
1912
2320
|
case "Verbose":
|
|
1913
2321
|
case "Trace":
|
|
1914
2322
|
case "Debug":
|
|
1915
|
-
return "Debug"
|
|
2323
|
+
return "Debug" /* Debug */;
|
|
1916
2324
|
case "Warn":
|
|
1917
2325
|
case "Warning":
|
|
1918
|
-
return "Warning"
|
|
2326
|
+
return "Warning" /* Warn */;
|
|
1919
2327
|
case "Error":
|
|
1920
2328
|
case "Critical":
|
|
1921
|
-
return "Error"
|
|
2329
|
+
return "Error" /* Error */;
|
|
1922
2330
|
default:
|
|
1923
|
-
return "Information"
|
|
2331
|
+
return "Information" /* Info */;
|
|
1924
2332
|
}
|
|
1925
2333
|
}
|
|
1926
2334
|
toFormattedString() {
|
|
@@ -1956,409 +2364,6 @@ class LogMessage {
|
|
|
1956
2364
|
return parts.join(" ");
|
|
1957
2365
|
}
|
|
1958
2366
|
}
|
|
1959
|
-
|
|
1960
|
-
OutputFolderName: "bundle",
|
|
1961
|
-
ContentFolderName: "content",
|
|
1962
|
-
OperateFileName: "operate.json",
|
|
1963
|
-
EntryPointsFileName: "entry-points.json",
|
|
1964
|
-
PackageDescriptorFileName: "package-descriptor.json",
|
|
1965
|
-
BindingsV2FileName: "bindings_v2.json",
|
|
1966
|
-
BindingsFileId: "bindings.json"
|
|
1967
|
-
};
|
|
1968
|
-
var PackJobTargetKind;
|
|
1969
|
-
((PackJobTargetKind2) => {
|
|
1970
|
-
PackJobTargetKind2["Serverless"] = "Serverless";
|
|
1971
|
-
PackJobTargetKind2["LocalRobot"] = "LocalRobot";
|
|
1972
|
-
})(PackJobTargetKind ||= {});
|
|
1973
|
-
var ProjectTypes;
|
|
1974
|
-
((ProjectTypes2) => {
|
|
1975
|
-
ProjectTypes2["Agent"] = "Agent";
|
|
1976
|
-
ProjectTypes2["Api"] = "Api";
|
|
1977
|
-
ProjectTypes2["BusinessRules"] = "BusinessRules";
|
|
1978
|
-
ProjectTypes2["Connector"] = "Connector";
|
|
1979
|
-
ProjectTypes2["CaseManagement"] = "CaseManagement";
|
|
1980
|
-
ProjectTypes2["Flow"] = "Flow";
|
|
1981
|
-
ProjectTypes2["Function"] = "Function";
|
|
1982
|
-
ProjectTypes2["ProcessOrchestration"] = "ProcessOrchestration";
|
|
1983
|
-
ProjectTypes2["Process"] = "Process";
|
|
1984
|
-
ProjectTypes2["Library"] = "Library";
|
|
1985
|
-
ProjectTypes2["WebApp"] = "WebApp";
|
|
1986
|
-
ProjectTypes2["Tests"] = "Tests";
|
|
1987
|
-
ProjectTypes2["AppV2"] = "AppV2";
|
|
1988
|
-
})(ProjectTypes ||= {});
|
|
1989
|
-
var TargetFramework;
|
|
1990
|
-
((TargetFramework2) => {
|
|
1991
|
-
TargetFramework2["Portable"] = "Portable";
|
|
1992
|
-
TargetFramework2["Windows"] = "Windows";
|
|
1993
|
-
})(TargetFramework ||= {});
|
|
1994
|
-
var ToolErrorCodes;
|
|
1995
|
-
((ToolErrorCodes2) => {
|
|
1996
|
-
ToolErrorCodes2["Success"] = "SUCCESS";
|
|
1997
|
-
ToolErrorCodes2["InternalError"] = "INTERNAL_ERROR";
|
|
1998
|
-
ToolErrorCodes2["Canceled"] = "CANCELED";
|
|
1999
|
-
})(ToolErrorCodes ||= {});
|
|
2000
|
-
|
|
2001
|
-
class ToolResult {
|
|
2002
|
-
errorCode;
|
|
2003
|
-
message;
|
|
2004
|
-
packages;
|
|
2005
|
-
details;
|
|
2006
|
-
instructions;
|
|
2007
|
-
constructor(errorCode, message, packages = [], instructions) {
|
|
2008
|
-
this.errorCode = errorCode;
|
|
2009
|
-
this.message = message;
|
|
2010
|
-
this.packages = packages;
|
|
2011
|
-
this.instructions = instructions;
|
|
2012
|
-
}
|
|
2013
|
-
get isSuccess() {
|
|
2014
|
-
return this.errorCode === "SUCCESS";
|
|
2015
|
-
}
|
|
2016
|
-
static success() {
|
|
2017
|
-
return new ToolResult("SUCCESS");
|
|
2018
|
-
}
|
|
2019
|
-
static error(errorCode, message, instructions) {
|
|
2020
|
-
return new ToolResult(errorCode, message, [], instructions);
|
|
2021
|
-
}
|
|
2022
|
-
}
|
|
2023
|
-
var OPERATE_FILE = "operate.json";
|
|
2024
|
-
var PROJECT_FILE = "project.json";
|
|
2025
|
-
function isNonEmptyString(value) {
|
|
2026
|
-
return typeof value === "string" && value.length > 0;
|
|
2027
|
-
}
|
|
2028
|
-
async function readJsonObject(fs, filePath) {
|
|
2029
|
-
let content;
|
|
2030
|
-
try {
|
|
2031
|
-
content = await fs.readFile(filePath, "utf-8");
|
|
2032
|
-
} catch {
|
|
2033
|
-
return;
|
|
2034
|
-
}
|
|
2035
|
-
if (content === null) {
|
|
2036
|
-
return;
|
|
2037
|
-
}
|
|
2038
|
-
try {
|
|
2039
|
-
const parsed = JSON.parse(content);
|
|
2040
|
-
if (parsed === null || typeof parsed !== "object") {
|
|
2041
|
-
return;
|
|
2042
|
-
}
|
|
2043
|
-
return parsed;
|
|
2044
|
-
} catch {
|
|
2045
|
-
return;
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
async function writeJsonObject(fs, filePath, data) {
|
|
2049
|
-
await fs.writeFile(filePath, `${JSON.stringify(data, null, 2)}
|
|
2050
|
-
`);
|
|
2051
|
-
}
|
|
2052
|
-
async function ensureProjectId(projectPath, fs) {
|
|
2053
|
-
const operatePath = Path.join(projectPath, OPERATE_FILE);
|
|
2054
|
-
const operateExists = await fs.exists(operatePath);
|
|
2055
|
-
if (operateExists) {
|
|
2056
|
-
const operate = await readJsonObject(fs, operatePath);
|
|
2057
|
-
if (operate && isNonEmptyString(operate.projectId)) {
|
|
2058
|
-
return operate.projectId;
|
|
2059
|
-
}
|
|
2060
|
-
if (operate) {
|
|
2061
|
-
const id = crypto.randomUUID();
|
|
2062
|
-
await writeJsonObject(fs, operatePath, {
|
|
2063
|
-
...operate,
|
|
2064
|
-
projectId: id
|
|
2065
|
-
});
|
|
2066
|
-
return id;
|
|
2067
|
-
}
|
|
2068
|
-
return crypto.randomUUID();
|
|
2069
|
-
}
|
|
2070
|
-
const projectFilePath = Path.join(projectPath, PROJECT_FILE);
|
|
2071
|
-
const projectFileExists = await fs.exists(projectFilePath);
|
|
2072
|
-
if (projectFileExists) {
|
|
2073
|
-
const projectFile = await readJsonObject(fs, projectFilePath);
|
|
2074
|
-
if (projectFile && isNonEmptyString(projectFile.projectId)) {
|
|
2075
|
-
return projectFile.projectId;
|
|
2076
|
-
}
|
|
2077
|
-
if (projectFile) {
|
|
2078
|
-
const id = crypto.randomUUID();
|
|
2079
|
-
await writeJsonObject(fs, projectFilePath, {
|
|
2080
|
-
...projectFile,
|
|
2081
|
-
projectId: id
|
|
2082
|
-
});
|
|
2083
|
-
return id;
|
|
2084
|
-
}
|
|
2085
|
-
return crypto.randomUUID();
|
|
2086
|
-
}
|
|
2087
|
-
return crypto.randomUUID();
|
|
2088
|
-
}
|
|
2089
|
-
async function ensureProjectIdInOperateFile(operateFilePath, fallbackProjectId, fs) {
|
|
2090
|
-
if (!await fs.exists(operateFilePath)) {
|
|
2091
|
-
return;
|
|
2092
|
-
}
|
|
2093
|
-
const parsed = await readJsonObject(fs, operateFilePath);
|
|
2094
|
-
if (!parsed) {
|
|
2095
|
-
return;
|
|
2096
|
-
}
|
|
2097
|
-
if (isNonEmptyString(parsed.projectId)) {
|
|
2098
|
-
return;
|
|
2099
|
-
}
|
|
2100
|
-
await writeJsonObject(fs, operateFilePath, {
|
|
2101
|
-
...parsed,
|
|
2102
|
-
projectId: fallbackProjectId
|
|
2103
|
-
});
|
|
2104
|
-
}
|
|
2105
|
-
async function writeOrBackfillOperateProjectId(operateFilePath, projectId, fs, createIfMissing) {
|
|
2106
|
-
if (await fs.exists(operateFilePath)) {
|
|
2107
|
-
await ensureProjectIdInOperateFile(operateFilePath, projectId, fs);
|
|
2108
|
-
return;
|
|
2109
|
-
}
|
|
2110
|
-
await createIfMissing();
|
|
2111
|
-
}
|
|
2112
|
-
var OPERATE_SCHEMA = "https://cloud.uipath.com/draft/2024-12/operate";
|
|
2113
|
-
async function resolveEntryPointMain(fs, sourceFolder) {
|
|
2114
|
-
const entryPointsFilePath = Path.join(sourceFolder, NugetConstants.EntryPointsFileName);
|
|
2115
|
-
if (!await fs.exists(entryPointsFilePath)) {
|
|
2116
|
-
return "";
|
|
2117
|
-
}
|
|
2118
|
-
const content = await fs.readFile(entryPointsFilePath);
|
|
2119
|
-
if (!content) {
|
|
2120
|
-
return "";
|
|
2121
|
-
}
|
|
2122
|
-
try {
|
|
2123
|
-
const parsed = JSON.parse(new TextDecoder().decode(content));
|
|
2124
|
-
return parsed.entryPoints?.[0]?.filePath ?? "";
|
|
2125
|
-
} catch {
|
|
2126
|
-
return "";
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
async function writeContentOperateFile(fs, params) {
|
|
2130
|
-
const operateFilePath = Path.join(params.contentFolder, NugetConstants.OperateFileName);
|
|
2131
|
-
await writeOrBackfillOperateProjectId(operateFilePath, params.projectId, fs, async () => {
|
|
2132
|
-
const main = await resolveEntryPointMain(fs, params.contentFolder);
|
|
2133
|
-
const operateFileModel = {
|
|
2134
|
-
$schema: OPERATE_SCHEMA,
|
|
2135
|
-
contentType: params.contentType,
|
|
2136
|
-
projectId: params.projectId,
|
|
2137
|
-
main,
|
|
2138
|
-
targetFramework: "Portable",
|
|
2139
|
-
runtimeOptions: {
|
|
2140
|
-
isAttended: false,
|
|
2141
|
-
requiresUserInteraction: false
|
|
2142
|
-
}
|
|
2143
|
-
};
|
|
2144
|
-
await fs.writeFile(operateFilePath, JSON.stringify(operateFileModel, null, 2));
|
|
2145
|
-
});
|
|
2146
|
-
}
|
|
2147
|
-
async function ensureContentOperateFile(fs, params) {
|
|
2148
|
-
const projectId = params.projectStorageId ?? await ensureProjectId(params.projectPath, fs);
|
|
2149
|
-
await writeContentOperateFile(fs, {
|
|
2150
|
-
contentFolder: params.contentFolder,
|
|
2151
|
-
projectId,
|
|
2152
|
-
contentType: params.contentType
|
|
2153
|
-
});
|
|
2154
|
-
}
|
|
2155
|
-
function escapeXml(str) {
|
|
2156
|
-
if (str === null || str === undefined) {
|
|
2157
|
-
return "";
|
|
2158
|
-
}
|
|
2159
|
-
return String(str).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2160
|
-
}
|
|
2161
|
-
function optionalElement(name, value) {
|
|
2162
|
-
if (value === undefined || value === "")
|
|
2163
|
-
return "";
|
|
2164
|
-
return ` <${name}>${escapeXml(value)}</${name}>
|
|
2165
|
-
`;
|
|
2166
|
-
}
|
|
2167
|
-
function generateDependenciesXml(dependencies) {
|
|
2168
|
-
if (!dependencies || dependencies.length === 0)
|
|
2169
|
-
return "";
|
|
2170
|
-
const deps = dependencies.map((d) => ` <dependency id="${escapeXml(d.id)}" version="${escapeXml(d.version)}" />`).join(`
|
|
2171
|
-
`);
|
|
2172
|
-
return ` <dependencies>
|
|
2173
|
-
${deps}
|
|
2174
|
-
</dependencies>
|
|
2175
|
-
`;
|
|
2176
|
-
}
|
|
2177
|
-
function generateRepositoryXml(packageInfo) {
|
|
2178
|
-
if (!packageInfo.repositoryType || !packageInfo.repositoryUrl)
|
|
2179
|
-
return "";
|
|
2180
|
-
let repoXml = ` <repository type="${escapeXml(packageInfo.repositoryType)}" url="${escapeXml(packageInfo.repositoryUrl)}"`;
|
|
2181
|
-
if (packageInfo.repositoryBranch) {
|
|
2182
|
-
repoXml += ` branch="${escapeXml(packageInfo.repositoryBranch)}"`;
|
|
2183
|
-
}
|
|
2184
|
-
if (packageInfo.repositoryCommit) {
|
|
2185
|
-
repoXml += ` commit="${escapeXml(packageInfo.repositoryCommit)}"`;
|
|
2186
|
-
}
|
|
2187
|
-
repoXml += ` />
|
|
2188
|
-
`;
|
|
2189
|
-
return repoXml;
|
|
2190
|
-
}
|
|
2191
|
-
function generateNuspecXml(packageInfo) {
|
|
2192
|
-
const author = packageInfo.author?.trim() || "UiPath";
|
|
2193
|
-
const description = packageInfo.description?.trim() || "Created by UiPath";
|
|
2194
|
-
const title = packageInfo.title?.trim() || packageInfo.id;
|
|
2195
|
-
const requireLicenseAcceptance = packageInfo.requireLicenseAcceptance === true ? "true" : "false";
|
|
2196
|
-
const releaseNotes = packageInfo.releaseNotes ?? "";
|
|
2197
|
-
const xml = `\uFEFF<?xml version="1.0" encoding="utf-8"?>
|
|
2198
|
-
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
|
2199
|
-
<metadata>
|
|
2200
|
-
<id>${escapeXml(packageInfo.id)}</id>
|
|
2201
|
-
<version>${escapeXml(packageInfo.version)}</version>
|
|
2202
|
-
<title>${escapeXml(title)}</title>
|
|
2203
|
-
<authors>${escapeXml(author)}</authors>
|
|
2204
|
-
<requireLicenseAcceptance>${requireLicenseAcceptance}</requireLicenseAcceptance>
|
|
2205
|
-
<description>${escapeXml(description)}</description>
|
|
2206
|
-
<releaseNotes>${escapeXml(releaseNotes)}</releaseNotes>
|
|
2207
|
-
${optionalElement("tags", packageInfo.tags)}${optionalElement("iconUrl", packageInfo.iconUrl)}${optionalElement("projectUrl", packageInfo.projectUrl)}${optionalElement("licenseUrl", packageInfo.licenseUrl)}${optionalElement("copyright", packageInfo.copyright)}${generateRepositoryXml(packageInfo)}${generateDependenciesXml(packageInfo.dependencies)} </metadata>
|
|
2208
|
-
</package>
|
|
2209
|
-
`;
|
|
2210
|
-
return xml;
|
|
2211
|
-
}
|
|
2212
|
-
function generatePsmdcpXml(packageInfo) {
|
|
2213
|
-
const author = packageInfo.author?.trim() || "UiPath";
|
|
2214
|
-
const description = packageInfo.description?.trim() || "Created by UiPath";
|
|
2215
|
-
return `<?xml version="1.0" encoding="utf-8"?>
|
|
2216
|
-
<coreProperties xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.openxmlformats.org/package/2006/metadata/core-properties">
|
|
2217
|
-
<dc:creator>${escapeXml(author)}</dc:creator>
|
|
2218
|
-
<dc:description>${escapeXml(description)}</dc:description>
|
|
2219
|
-
<dc:identifier>${escapeXml(packageInfo.id)}</dc:identifier>
|
|
2220
|
-
<version>${escapeXml(packageInfo.version)}</version>
|
|
2221
|
-
<keywords></keywords>
|
|
2222
|
-
<lastModifiedBy>NuGet.Packaging, Version=6.12.1.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35;.NET 5.0</lastModifiedBy>
|
|
2223
|
-
</coreProperties>`;
|
|
2224
|
-
}
|
|
2225
|
-
|
|
2226
|
-
class NugetPackager {
|
|
2227
|
-
fileSystem;
|
|
2228
|
-
constructor(fileSystem) {
|
|
2229
|
-
this.fileSystem = fileSystem;
|
|
2230
|
-
}
|
|
2231
|
-
async packAsync(rootPath, packageInfo, outputPath) {
|
|
2232
|
-
const normalizedOutputPath = Path.normalize(outputPath);
|
|
2233
|
-
const nuspecXml = generateNuspecXml(packageInfo);
|
|
2234
|
-
const nuspecFileName = `${packageInfo.id}.nuspec`;
|
|
2235
|
-
const fileEntries = await Path.walkDirectory(this.fileSystem, rootPath);
|
|
2236
|
-
const zipContents = {};
|
|
2237
|
-
const encoder = new TextEncoder;
|
|
2238
|
-
const psmdcpId = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967296).toString(16).padStart(8, "0")).join("");
|
|
2239
|
-
const psmdcpFileName = `${psmdcpId}.psmdcp`;
|
|
2240
|
-
const psmdcpPath = `package/services/metadata/core-properties/${psmdcpFileName}`;
|
|
2241
|
-
const contentTypesXml = `<?xml version="1.0" encoding="utf-8"?>
|
|
2242
|
-
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
2243
|
-
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
|
|
2244
|
-
<Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
|
|
2245
|
-
<Default Extension="uiproj" ContentType="application/octet" />
|
|
2246
|
-
<Default Extension="json" ContentType="application/octet" />
|
|
2247
|
-
<Default Extension="nuspec" ContentType="application/octet" />
|
|
2248
|
-
</Types>`;
|
|
2249
|
-
zipContents["[Content_Types].xml"] = encoder.encode(contentTypesXml);
|
|
2250
|
-
const manifestRelId = `R${Date.now().toString(16).toUpperCase()}`;
|
|
2251
|
-
const corePropsRelId = `R${(Date.now() + 1).toString(16).toUpperCase()}`;
|
|
2252
|
-
const relsXml = `<?xml version="1.0" encoding="utf-8"?>
|
|
2253
|
-
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
2254
|
-
<Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/${nuspecFileName}" Id="${manifestRelId}" />
|
|
2255
|
-
<Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/${psmdcpPath}" Id="${corePropsRelId}" />
|
|
2256
|
-
</Relationships>`;
|
|
2257
|
-
zipContents["_rels/.rels"] = encoder.encode(relsXml);
|
|
2258
|
-
zipContents[psmdcpPath] = encoder.encode(generatePsmdcpXml(packageInfo));
|
|
2259
|
-
zipContents[nuspecFileName] = encoder.encode(nuspecXml);
|
|
2260
|
-
for (const entry of fileEntries) {
|
|
2261
|
-
const content = await this.fileSystem.readFile(entry.absolutePath);
|
|
2262
|
-
if (content !== null) {
|
|
2263
|
-
zipContents[entry.relativePath] = content;
|
|
2264
|
-
}
|
|
2265
|
-
}
|
|
2266
|
-
const zippedData = zipSync(zipContents);
|
|
2267
|
-
await this.fileSystem.writeFile(normalizedOutputPath, zippedData);
|
|
2268
|
-
return {
|
|
2269
|
-
outputPath: normalizedOutputPath
|
|
2270
|
-
};
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
|
|
2274
|
-
class ProjectTool {
|
|
2275
|
-
fileSystem;
|
|
2276
|
-
logger;
|
|
2277
|
-
static ProjectFileName = "project.uiproj";
|
|
2278
|
-
constructor(fileSystem, logger) {
|
|
2279
|
-
this.fileSystem = fileSystem;
|
|
2280
|
-
this.logger = logger;
|
|
2281
|
-
}
|
|
2282
|
-
async restoreAsync(_options, _cancellationToken) {
|
|
2283
|
-
this.logger.info("Restore operation is a noop");
|
|
2284
|
-
return ToolResult.success();
|
|
2285
|
-
}
|
|
2286
|
-
async validateAsync(_options, _cancellationToken) {
|
|
2287
|
-
this.logger.info("Validate operation is a noop");
|
|
2288
|
-
return ToolResult.success();
|
|
2289
|
-
}
|
|
2290
|
-
async buildAsync(_options, _cancellationToken) {
|
|
2291
|
-
this.logger.info("Build operation is a noop");
|
|
2292
|
-
return ToolResult.success();
|
|
2293
|
-
}
|
|
2294
|
-
async packAsync(_options, _cancellationToken) {
|
|
2295
|
-
this.logger.info("Pack operation is a noop");
|
|
2296
|
-
return ToolResult.success();
|
|
2297
|
-
}
|
|
2298
|
-
async cleanupAsync(_options, _cancellationToken) {
|
|
2299
|
-
this.logger.info("Cleanup operation is a noop");
|
|
2300
|
-
return ToolResult.success();
|
|
2301
|
-
}
|
|
2302
|
-
async getUiProjectAsync(projectPath) {
|
|
2303
|
-
const filePath = Path.join(projectPath, ProjectTool.ProjectFileName);
|
|
2304
|
-
if (!await this.fileSystem.exists(filePath)) {
|
|
2305
|
-
return;
|
|
2306
|
-
}
|
|
2307
|
-
const raw = await this.fileSystem.readFile(filePath);
|
|
2308
|
-
if (!raw) {
|
|
2309
|
-
return;
|
|
2310
|
-
}
|
|
2311
|
-
const json = typeof raw === "string" ? raw : new TextDecoder("utf-8").decode(raw);
|
|
2312
|
-
return JSON.parse(json);
|
|
2313
|
-
}
|
|
2314
|
-
async dispose() {}
|
|
2315
|
-
}
|
|
2316
|
-
class ToolsFactoryRepository {
|
|
2317
|
-
projectFactoryMap = new Map;
|
|
2318
|
-
solutionFactory = null;
|
|
2319
|
-
registerProjectToolFactory(factory) {
|
|
2320
|
-
for (const type of factory.supportedTypes) {
|
|
2321
|
-
const existing = this.projectFactoryMap.get(type);
|
|
2322
|
-
if (existing) {
|
|
2323
|
-
if (existing.constructor?.name !== factory.constructor?.name) {
|
|
2324
|
-
console.warn(`Tool factory conflict for project type '${type}': ` + `'${existing.constructor?.name}' already registered, ` + `ignoring '${factory.constructor?.name}'.`);
|
|
2325
|
-
}
|
|
2326
|
-
continue;
|
|
2327
|
-
}
|
|
2328
|
-
this.projectFactoryMap.set(type, factory);
|
|
2329
|
-
}
|
|
2330
|
-
}
|
|
2331
|
-
registerSolutionToolFactory(factory) {
|
|
2332
|
-
this.solutionFactory = factory;
|
|
2333
|
-
}
|
|
2334
|
-
getSolutionToolFactory() {
|
|
2335
|
-
if (!this.solutionFactory) {
|
|
2336
|
-
throw new Error("No solution tool factory is registered");
|
|
2337
|
-
}
|
|
2338
|
-
return this.solutionFactory;
|
|
2339
|
-
}
|
|
2340
|
-
canHandleProject(projectType) {
|
|
2341
|
-
return this.projectFactoryMap.has(projectType);
|
|
2342
|
-
}
|
|
2343
|
-
getProjectToolFactory(projectType) {
|
|
2344
|
-
const factory = this.projectFactoryMap.get(projectType);
|
|
2345
|
-
if (!factory) {
|
|
2346
|
-
throw new Error(`Cannot pack project type '${projectType}': no packager is installed for it.`);
|
|
2347
|
-
}
|
|
2348
|
-
return factory;
|
|
2349
|
-
}
|
|
2350
|
-
reset() {
|
|
2351
|
-
this.projectFactoryMap.clear();
|
|
2352
|
-
this.solutionFactory = null;
|
|
2353
|
-
}
|
|
2354
|
-
}
|
|
2355
|
-
var REGISTRY_KEY = Symbol.for("@uipath/solutionpackager-tool-core/toolsFactoryRepository");
|
|
2356
|
-
var _global = globalThis;
|
|
2357
|
-
if (!_global[REGISTRY_KEY]) {
|
|
2358
|
-
_global[REGISTRY_KEY] = new ToolsFactoryRepository;
|
|
2359
|
-
}
|
|
2360
|
-
var toolsFactoryRepository = _global[REGISTRY_KEY];
|
|
2361
|
-
|
|
2362
|
-
export { Path, TemporaryStorageService, ZipService, I18nManager, translate, LogLevel, LogMessage, NugetConstants, ProjectTypes, TargetFramework, ToolErrorCodes, ToolResult, ensureContentOperateFile, NugetPackager, ProjectTool, toolsFactoryRepository };
|
|
2367
|
+
export { Path, TemporaryStorageService, ZipService, I18nManager, translate, normalizeIgnoredRules, LogMessage, NugetConstants, ToolResult, ensureContentOperateFile, NugetPackager, ProjectTool, toolsFactoryRepository };
|
|
2363
2368
|
|
|
2364
|
-
//# debugId=
|
|
2369
|
+
//# debugId=5EA341A43E99A2D364756E2164756E21
|