@uipath/solutionpackager-tool-core 1.196.0 → 1.197.0-preview.64
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/index.js +143 -1
- package/dist/services/index.d.ts +3 -0
- package/package.json +29 -38
package/dist/index.js
CHANGED
|
@@ -93,7 +93,7 @@ class TemporaryStorageService {
|
|
|
93
93
|
} catch {
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
-
const
|
|
96
|
+
const _pathToCleanup = this._tempFolderPath;
|
|
97
97
|
await this.fileSystem.rm(this._tempFolderPath);
|
|
98
98
|
this._tempFolderPath = null;
|
|
99
99
|
} catch {}
|
|
@@ -1156,6 +1156,141 @@ class ToolResult {
|
|
|
1156
1156
|
function createDefaultBindingsVersion() {
|
|
1157
1157
|
return { major: 2, minor: 0 };
|
|
1158
1158
|
}
|
|
1159
|
+
// src/services/project-id.ts
|
|
1160
|
+
var OPERATE_FILE = "operate.json";
|
|
1161
|
+
var PROJECT_FILE = "project.json";
|
|
1162
|
+
function isNonEmptyString(value) {
|
|
1163
|
+
return typeof value === "string" && value.length > 0;
|
|
1164
|
+
}
|
|
1165
|
+
async function readJsonObject(fs, filePath) {
|
|
1166
|
+
let content;
|
|
1167
|
+
try {
|
|
1168
|
+
content = await fs.readFile(filePath, "utf-8");
|
|
1169
|
+
} catch {
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
if (content === null) {
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
try {
|
|
1176
|
+
const parsed = JSON.parse(content);
|
|
1177
|
+
if (parsed === null || typeof parsed !== "object") {
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
return parsed;
|
|
1181
|
+
} catch {
|
|
1182
|
+
return;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
async function writeJsonObject(fs, filePath, data) {
|
|
1186
|
+
await fs.writeFile(filePath, `${JSON.stringify(data, null, 2)}
|
|
1187
|
+
`);
|
|
1188
|
+
}
|
|
1189
|
+
async function ensureProjectId(projectPath, fs) {
|
|
1190
|
+
const operatePath = Path.join(projectPath, OPERATE_FILE);
|
|
1191
|
+
const operateExists = await fs.exists(operatePath);
|
|
1192
|
+
if (operateExists) {
|
|
1193
|
+
const operate = await readJsonObject(fs, operatePath);
|
|
1194
|
+
if (operate && isNonEmptyString(operate.projectId)) {
|
|
1195
|
+
return operate.projectId;
|
|
1196
|
+
}
|
|
1197
|
+
if (operate) {
|
|
1198
|
+
const id = crypto.randomUUID();
|
|
1199
|
+
await writeJsonObject(fs, operatePath, {
|
|
1200
|
+
...operate,
|
|
1201
|
+
projectId: id
|
|
1202
|
+
});
|
|
1203
|
+
return id;
|
|
1204
|
+
}
|
|
1205
|
+
return crypto.randomUUID();
|
|
1206
|
+
}
|
|
1207
|
+
const projectFilePath = Path.join(projectPath, PROJECT_FILE);
|
|
1208
|
+
const projectFileExists = await fs.exists(projectFilePath);
|
|
1209
|
+
if (projectFileExists) {
|
|
1210
|
+
const projectFile = await readJsonObject(fs, projectFilePath);
|
|
1211
|
+
if (projectFile && isNonEmptyString(projectFile.projectId)) {
|
|
1212
|
+
return projectFile.projectId;
|
|
1213
|
+
}
|
|
1214
|
+
if (projectFile) {
|
|
1215
|
+
const id = crypto.randomUUID();
|
|
1216
|
+
await writeJsonObject(fs, projectFilePath, {
|
|
1217
|
+
...projectFile,
|
|
1218
|
+
projectId: id
|
|
1219
|
+
});
|
|
1220
|
+
return id;
|
|
1221
|
+
}
|
|
1222
|
+
return crypto.randomUUID();
|
|
1223
|
+
}
|
|
1224
|
+
return crypto.randomUUID();
|
|
1225
|
+
}
|
|
1226
|
+
async function ensureProjectIdInOperateFile(operateFilePath, fallbackProjectId, fs) {
|
|
1227
|
+
if (!await fs.exists(operateFilePath)) {
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
const parsed = await readJsonObject(fs, operateFilePath);
|
|
1231
|
+
if (!parsed) {
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
if (isNonEmptyString(parsed.projectId)) {
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
await writeJsonObject(fs, operateFilePath, {
|
|
1238
|
+
...parsed,
|
|
1239
|
+
projectId: fallbackProjectId
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1242
|
+
async function writeOrBackfillOperateProjectId(operateFilePath, projectId, fs, createIfMissing) {
|
|
1243
|
+
if (await fs.exists(operateFilePath)) {
|
|
1244
|
+
await ensureProjectIdInOperateFile(operateFilePath, projectId, fs);
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1247
|
+
await createIfMissing();
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
// src/services/content-operate-file.ts
|
|
1251
|
+
var OPERATE_SCHEMA = "https://cloud.uipath.com/draft/2024-12/operate";
|
|
1252
|
+
async function resolveEntryPointMain(fs, sourceFolder) {
|
|
1253
|
+
const entryPointsFilePath = Path.join(sourceFolder, NugetConstants.EntryPointsFileName);
|
|
1254
|
+
if (!await fs.exists(entryPointsFilePath)) {
|
|
1255
|
+
return "";
|
|
1256
|
+
}
|
|
1257
|
+
const content = await fs.readFile(entryPointsFilePath);
|
|
1258
|
+
if (!content) {
|
|
1259
|
+
return "";
|
|
1260
|
+
}
|
|
1261
|
+
try {
|
|
1262
|
+
const parsed = JSON.parse(new TextDecoder().decode(content));
|
|
1263
|
+
return parsed.entryPoints?.[0]?.filePath ?? "";
|
|
1264
|
+
} catch {
|
|
1265
|
+
return "";
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
async function writeContentOperateFile(fs, params) {
|
|
1269
|
+
const operateFilePath = Path.join(params.contentFolder, NugetConstants.OperateFileName);
|
|
1270
|
+
await writeOrBackfillOperateProjectId(operateFilePath, params.projectId, fs, async () => {
|
|
1271
|
+
const main = await resolveEntryPointMain(fs, params.contentFolder);
|
|
1272
|
+
const operateFileModel = {
|
|
1273
|
+
$schema: OPERATE_SCHEMA,
|
|
1274
|
+
contentType: params.contentType,
|
|
1275
|
+
projectId: params.projectId,
|
|
1276
|
+
main,
|
|
1277
|
+
targetFramework: "Portable",
|
|
1278
|
+
runtimeOptions: {
|
|
1279
|
+
isAttended: false,
|
|
1280
|
+
requiresUserInteraction: false
|
|
1281
|
+
}
|
|
1282
|
+
};
|
|
1283
|
+
await fs.writeFile(operateFilePath, JSON.stringify(operateFileModel, null, 2));
|
|
1284
|
+
});
|
|
1285
|
+
}
|
|
1286
|
+
async function ensureContentOperateFile(fs, params) {
|
|
1287
|
+
const projectId = params.projectStorageId ?? await ensureProjectId(params.projectPath, fs);
|
|
1288
|
+
await writeContentOperateFile(fs, {
|
|
1289
|
+
contentFolder: params.contentFolder,
|
|
1290
|
+
projectId,
|
|
1291
|
+
contentType: params.contentType
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1159
1294
|
// src/services/nuget-packager.ts
|
|
1160
1295
|
import { zipSync as zipSync2 } from "fflate";
|
|
1161
1296
|
function escapeXml(str) {
|
|
@@ -1388,9 +1523,14 @@ if (!_global[REGISTRY_KEY]) {
|
|
|
1388
1523
|
}
|
|
1389
1524
|
var toolsFactoryRepository = _global[REGISTRY_KEY];
|
|
1390
1525
|
export {
|
|
1526
|
+
writeOrBackfillOperateProjectId,
|
|
1527
|
+
writeContentOperateFile,
|
|
1391
1528
|
translate,
|
|
1392
1529
|
toolsFactoryRepository,
|
|
1393
1530
|
toRelativeUrl,
|
|
1531
|
+
ensureProjectIdInOperateFile,
|
|
1532
|
+
ensureProjectId,
|
|
1533
|
+
ensureContentOperateFile,
|
|
1394
1534
|
createDefaultBindingsVersion,
|
|
1395
1535
|
ZipService,
|
|
1396
1536
|
TranslationService,
|
|
@@ -1410,3 +1550,5 @@ export {
|
|
|
1410
1550
|
I18nManager,
|
|
1411
1551
|
BuildConfiguration
|
|
1412
1552
|
};
|
|
1553
|
+
|
|
1554
|
+
//# debugId=E5FDBA39F2E268FE64756E2164756E21
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
export type { BuildContentOperateFileParams, ContentOperateFileParams, } from "./content-operate-file.js";
|
|
2
|
+
export { ensureContentOperateFile, writeContentOperateFile, } from "./content-operate-file.js";
|
|
1
3
|
export type { INugetPackager, NugetPackagerResult } from "./nuget-packager.js";
|
|
2
4
|
export { NugetPackager } from "./nuget-packager.js";
|
|
5
|
+
export { ensureProjectId, ensureProjectIdInOperateFile, writeOrBackfillOperateProjectId, } from "./project-id.js";
|
|
3
6
|
export type { ProjectOperationContext } from "./project-operation-context.js";
|
|
4
7
|
export { ProjectTool } from "./project-tool.js";
|
|
5
8
|
export type { IProjectToolFactory } from "./project-tool-factory.js";
|
package/package.json
CHANGED
|
@@ -1,40 +1,31 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"@vitest/coverage-v8": "^4.1.6",
|
|
32
|
-
"typescript": "^6.0.2",
|
|
33
|
-
"vitest": "^4.1.6"
|
|
34
|
-
},
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"@uipath/filesystem": "1.196.0",
|
|
37
|
-
"fflate": "^0.8.2"
|
|
38
|
-
},
|
|
39
|
-
"gitHead": "bed2b46f1ec33a47a7dcae2e6d4b7ab99bd06981"
|
|
2
|
+
"name": "@uipath/solutionpackager-tool-core",
|
|
3
|
+
"version": "1.197.0-preview.64",
|
|
4
|
+
"description": "UiPath contracts for solution packager tools",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"default": "./dist/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"author": "",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/UiPath/cli.git",
|
|
21
|
+
"directory": "packages/packager/packager-core"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"registry": "https://registry.npmjs.org/"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@uipath/filesystem": "1.197.0",
|
|
28
|
+
"fflate": "^0.8.2"
|
|
29
|
+
},
|
|
30
|
+
"gitHead": "3977b977945bf519336258da69fd271433eaaef4"
|
|
40
31
|
}
|