@uipath/flow-tool 1.207.0-preview.337 → 1.207.0-preview.339
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/{authoring-r2x0t903.js → authoring-r7hdnt8y.js} +1 -1
- package/dist/{binding-service-j6efk28d.js → binding-service-xxva2d2r.js} +11 -11
- package/dist/{connector-service-hsr2tbty.js → connector-service-yp1t9qrd.js} +12 -12
- package/dist/{conversion-A2KZVSOA-8mzr9ax3.js → conversion-A2KZVSOA-vtqh3f47.js} +3 -3
- package/dist/{de-HF4GJ4EK-NX7YTOSY-emm7wqbp.js → de-HF4GJ4EK-NX7YTOSY-x48f8np6.js} +1 -1
- package/dist/{edge-service-m9s3c88x.js → edge-service-has5fajz.js} +4 -4
- package/dist/{en-ETY46SDS-RI6EZCN6-8zdt81m1.js → en-ETY46SDS-RI6EZCN6-52py7kmt.js} +1 -1
- package/dist/{en-JZXY3PYE-m7qy4mmn.js → en-JZXY3PYE-vpdbrjst.js} +1 -1
- package/dist/{en-LQHKFSEY-rc8k6qkw.js → en-LQHKFSEY-rpascv2j.js} +1 -1
- package/dist/{es-IYP2OLUY-7SKYGF6A-155knsr5.js → es-IYP2OLUY-7SKYGF6A-zhdh6aqa.js} +1 -1
- package/dist/{es-MX-D2MN3U37-D74A6FRL-nww1acj4.js → es-MX-D2MN3U37-D74A6FRL-jy0w9s5r.js} +1 -1
- package/dist/{flow-debug-service-wtmqb686.js → flow-debug-service-s9qf5e0r.js} +9 -9
- package/dist/{flow-eval-node-target-76cderdj.js → flow-eval-node-target-jb1p75xh.js} +4 -4
- package/dist/{flow-eval-run-service-157vzf5n.js → flow-eval-run-service-3sx62re2.js} +10 -10
- package/dist/{flow-eval-service-6zn4dppx.js → flow-eval-service-xeqfqapq.js} +5 -5
- package/dist/{flow-init-sdk-source-09jag89a.js → flow-init-sdk-source-2416smf4.js} +2 -2
- package/dist/{flow-init-service-fzykw8en.js → flow-init-service-j1780f17.js} +6 -6
- package/dist/{flow-io-mpd1wmz6.js → flow-io-wrwc49xf.js} +4 -4
- package/dist/{flow-migrate-service-d10mx4eq.js → flow-migrate-service-rzdk9vbt.js} +4 -4
- package/dist/{flow-pack-service-qap4gysw.js → flow-pack-service-a0p6x64f.js} +11 -11
- package/dist/{flow-validate-service-ckjzvbh8.js → flow-validate-service-typrqjc0.js} +15 -15
- package/dist/{fr-NISALSPL-3ANDQPI3-5b6cq3mk.js → fr-NISALSPL-3ANDQPI3-p93cg90d.js} +1 -1
- package/dist/{governance-fetcher-eyf6fj1y.js → governance-fetcher-v9t9bxdf.js} +2 -2
- package/dist/{hitl-service-ajzak5hq.js → hitl-service-8mczzbr7.js} +4 -4
- package/dist/{index-apy50fda.js → index-2qkp1b3q.js} +1 -1
- package/dist/{index-t2vjrxxy.js → index-4j1d6n3h.js} +1 -1
- package/dist/{index-fcdhf3dw.js → index-ghn0kgfz.js} +1 -1
- package/dist/{index-azkp8txc.js → index-qm1r0rep.js} +3 -3
- package/dist/{index-7e1303hk.js → index-tgjhmqsc.js} +3 -3
- package/dist/{index-hfyvarhr.js → index-tm9snnsm.js} +478 -280
- package/dist/index.js +2 -2
- package/dist/init.js +6 -6
- package/dist/{inline-entity-resolver-1928m0zp.js → inline-entity-resolver-n1et99ps.js} +4 -4
- package/dist/{integration-service-fetcher-n72ecybw.js → integration-service-fetcher-aqcm035s.js} +1 -1
- package/dist/{ja-HTS2Q4YG-7Q6WUI6H-f7pb4f9y.js → ja-HTS2Q4YG-7Q6WUI6H-zgwyee9k.js} +1 -1
- package/dist/{ko-3JFGTMNY-VT6UQ3IS-pwkfc70q.js → ko-3JFGTMNY-VT6UQ3IS-3rfd93vq.js} +1 -1
- package/dist/{library-option-v7xqc99b.js → library-option-ea9s7nex.js} +1 -1
- package/dist/{maestro-automate-entry-gac8anz3.js → maestro-automate-entry-ce1vgwj7.js} +2 -2
- package/dist/{node-dpc7j5sf.js → node-peg8zvqe.js} +2 -2
- package/dist/{node-service-05d6f4sm.js → node-service-kwfdncbx.js} +11 -11
- package/dist/{node-sync-service-5p4xxdpv.js → node-sync-service-dfq35ctq.js} +2 -2
- package/dist/{packager-tool-mnbn9056.js → packager-tool-0rryx3tk.js} +7 -7
- package/dist/{packager-tool-qnwrc9e0.js → packager-tool-2pa62eb5.js} +66 -1
- package/dist/{packager-tool-2k035zby.js → packager-tool-3fg12xnp.js} +1 -1
- package/dist/{packager-tool-16n9jpe4.js → packager-tool-412ww9ea.js} +2 -2
- package/dist/{packager-tool-7j7skzme.js → packager-tool-565eknsc.js} +2 -2
- package/dist/{packager-tool-vsvm3njz.js → packager-tool-6ywz78j7.js} +20 -20
- package/dist/{packager-tool-6jq0v1g0.js → packager-tool-8mrwkx81.js} +1 -1
- package/dist/{packager-tool-3rykxb29.js → packager-tool-9j0m8302.js} +1 -1
- package/dist/{packager-tool-amtaajca.js → packager-tool-bspxst7b.js} +1 -1
- package/dist/{packager-tool-ew50d3bt.js → packager-tool-cg0pgwzv.js} +2 -2
- package/dist/{packager-tool-7ttdksgf.js → packager-tool-f8bm92tb.js} +1 -1
- package/dist/{packager-tool-101mhjz6.js → packager-tool-fm4cydch.js} +3 -3
- package/dist/{packager-tool-az1s2z5b.js → packager-tool-g7v00xbz.js} +1 -1
- package/dist/{packager-tool-fh3rf0x2.js → packager-tool-gwwrpa18.js} +5 -5
- package/dist/{packager-tool-yv0tdh6n.js → packager-tool-j3pg4mka.js} +1 -1
- package/dist/{packager-tool-mjx04n2j.js → packager-tool-jmkzrwtq.js} +1 -1
- package/dist/{packager-tool-0hm5k4g7.js → packager-tool-k85ryhcj.js} +2 -2
- package/dist/{packager-tool-dtw9z9c2.js → packager-tool-qkdn9w30.js} +8 -8
- package/dist/{packager-tool-n0g16fe9.js → packager-tool-sef1x8sc.js} +2 -2
- package/dist/{packager-tool-t792myx3.js → packager-tool-tevzzy52.js} +4 -4
- package/dist/{packager-tool-qxe6zpgd.js → packager-tool-tj2bfpj1.js} +4 -4
- package/dist/{packager-tool-wxd8b611.js → packager-tool-tz9ggcqv.js} +44 -44
- package/dist/{packager-tool-93mhy1fc.js → packager-tool-w6j23zen.js} +10 -7
- package/dist/{packager-tool-81xbzr84.js → packager-tool-w9wwq8ct.js} +1 -1
- package/dist/{packager-tool-yk4ngadx.js → packager-tool-wsrvvx3t.js} +3 -3
- package/dist/packager-tool.js +4 -4
- package/dist/{provision-node-service-bcz9t7ds.js → provision-node-service-v83hgejs.js} +6 -6
- package/dist/{pt-BR-7H7BP5DT-IOHWNCIU-gqfnv1cp.js → pt-BR-7H7BP5DT-IOHWNCIU-tbpxbqtp.js} +1 -1
- package/dist/{pt-QWGSZKMD-RTKSQCYA-74stww7x.js → pt-QWGSZKMD-RTKSQCYA-n6vpeg2g.js} +1 -1
- package/dist/{ro-B7G474JK-Q3BAA4S3-y5zbgh2z.js → ro-B7G474JK-Q3BAA4S3-v6jfcvgg.js} +1 -1
- package/dist/{ru-GSCT4ARZ-6OTD7JLB-f7hcf8m9.js → ru-GSCT4ARZ-6OTD7JLB-htm5289f.js} +1 -1
- package/dist/{schema-document-service-vyhhy83f.js → schema-document-service-4s3fgrpa.js} +6 -6
- package/dist/{serialization-7CB4AREI-xgs0x85x.js → serialization-7CB4AREI-6tfarkej.js} +2 -2
- package/dist/{tidy-service-akkr00c6.js → tidy-service-k4bq3w34.js} +4 -4
- package/dist/tool.js +2 -2
- package/dist/{tr-FX7WCKK2-CEOTUJRD-n1kvfkd7.js → tr-FX7WCKK2-CEOTUJRD-apgyc6x6.js} +1 -1
- package/dist/validation.js +15 -15
- package/dist/{variable-service-3dk3r0zh.js → variable-service-bve95ytd.js} +4 -4
- package/dist/{zh-CN-NCMB6YM5-BB2LRIMQ-s682ts0x.js → zh-CN-NCMB6YM5-BB2LRIMQ-2whgrsad.js} +1 -1
- package/dist/{zh-TW-UNIEJPLE-ECGOEPYS-c6zk5zrb.js → zh-TW-UNIEJPLE-ECGOEPYS-3yb11twv.js} +1 -1
- package/package.json +2 -2
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
extractErrorMessage,
|
|
9
9
|
logger
|
|
10
10
|
} from "./packager-tool-bcsjm5hv.js";
|
|
11
|
-
import"./packager-tool-
|
|
11
|
+
import"./packager-tool-2pa62eb5.js";
|
|
12
12
|
import {
|
|
13
13
|
ErrorCodes,
|
|
14
14
|
BadRequestException,
|
|
@@ -20346,139 +20346,6 @@ function findOrphanedDeclarations(resources, bound, boundKeys = new Set) {
|
|
|
20346
20346
|
return !bound.some((b) => b.kind.toLowerCase() === kind && nameSuffixRegex(b.name, false).test(name));
|
|
20347
20347
|
});
|
|
20348
20348
|
}
|
|
20349
|
-
// ../solution-sdk/src/resources/services/project-artifacts-service.ts
|
|
20350
|
-
async function addProjectArtifactsToSolutionAsync(options) {
|
|
20351
|
-
const error = await createProjectInSolutionBuilder(options.solutionDir, options.projectId, options.projectName, normalizeProjectType(options.projectType), options.projectSubType);
|
|
20352
|
-
return error ? artifactFailure(options, error) : { Created: true };
|
|
20353
|
-
}
|
|
20354
|
-
function artifactFailure(options, error) {
|
|
20355
|
-
logger.warn(`Solution artifact-resource generation failed for project "${options.projectName}": ${error.message}. ` + "The project was created and registered, but 'uip solution pack' may omit its resource. " + "Re-run init with --force to retry, or run 'uip solution projects add' to finish setup.");
|
|
20356
|
-
return { Created: false, Error: error.message };
|
|
20357
|
-
}
|
|
20358
|
-
// ../solution-sdk/src/resources/services/project-template-types.ts
|
|
20359
|
-
var reader;
|
|
20360
|
-
function hasBareTemplateRow(projectType) {
|
|
20361
|
-
reader ??= new EmbeddedProjectConfigurationReader;
|
|
20362
|
-
return reader.getTemplateResourcesByType(projectType, undefined, false).length > 0;
|
|
20363
|
-
}
|
|
20364
|
-
function hasAnyTemplateRow(projectType) {
|
|
20365
|
-
reader ??= new EmbeddedProjectConfigurationReader;
|
|
20366
|
-
const wanted = projectType.toLowerCase();
|
|
20367
|
-
return Object.keys(reader.getAll()).some((row) => {
|
|
20368
|
-
const key = row.toLowerCase();
|
|
20369
|
-
return key === wanted || key.startsWith(`${wanted}_`);
|
|
20370
|
-
});
|
|
20371
|
-
}
|
|
20372
|
-
// ../solution-sdk/src/resources/services/remote-resources.ts
|
|
20373
|
-
function getRemoteResourceClients(services) {
|
|
20374
|
-
return {
|
|
20375
|
-
catalog: services.container.resolve(Tokens.IResourceCatalogClientProxy),
|
|
20376
|
-
importer: services.container.resolve(Tokens.IImportResourceHelper)
|
|
20377
|
-
};
|
|
20378
|
-
}
|
|
20379
|
-
async function findCatalogEntityAsync(catalog, query, match) {
|
|
20380
|
-
let pageCursor;
|
|
20381
|
-
do {
|
|
20382
|
-
const page = await catalog.searchFolderEntities({
|
|
20383
|
-
...query,
|
|
20384
|
-
pageSize: 100,
|
|
20385
|
-
pageCursor
|
|
20386
|
-
});
|
|
20387
|
-
const found = (page.items ?? []).find(match);
|
|
20388
|
-
if (found) {
|
|
20389
|
-
return found;
|
|
20390
|
-
}
|
|
20391
|
-
pageCursor = page.nextPage ?? undefined;
|
|
20392
|
-
} while (pageCursor);
|
|
20393
|
-
return;
|
|
20394
|
-
}
|
|
20395
|
-
async function findCatalogEntitiesAsync(catalog, query, match) {
|
|
20396
|
-
const found = [];
|
|
20397
|
-
let pageCursor;
|
|
20398
|
-
do {
|
|
20399
|
-
const page = await catalog.searchFolderEntities({
|
|
20400
|
-
...query,
|
|
20401
|
-
pageSize: 100,
|
|
20402
|
-
pageCursor
|
|
20403
|
-
});
|
|
20404
|
-
found.push(...(page.items ?? []).filter(match));
|
|
20405
|
-
pageCursor = page.nextPage ?? undefined;
|
|
20406
|
-
} while (pageCursor);
|
|
20407
|
-
return found;
|
|
20408
|
-
}
|
|
20409
|
-
function toResourceReference(entity) {
|
|
20410
|
-
return toCatalogReference({
|
|
20411
|
-
kind: entity.entityType ?? "",
|
|
20412
|
-
type: entity.entitySubType ?? undefined,
|
|
20413
|
-
key: entity.entityKey ?? "",
|
|
20414
|
-
name: entity.entityName ?? undefined,
|
|
20415
|
-
folderPath: entity.fullyQualifiedName ?? undefined,
|
|
20416
|
-
folderKey: entity.folderKey ?? undefined
|
|
20417
|
-
});
|
|
20418
|
-
}
|
|
20419
|
-
function toCatalogReference(reference) {
|
|
20420
|
-
const { folderPath, folderKey, ...rest } = reference;
|
|
20421
|
-
return {
|
|
20422
|
-
...rest,
|
|
20423
|
-
folder: folderPath ? { fullyQualifiedName: folderPath, folderKey } : undefined
|
|
20424
|
-
};
|
|
20425
|
-
}
|
|
20426
|
-
async function exportResourceDefinitionAsync(importer, reference) {
|
|
20427
|
-
const [error, payload] = await catchError2(importer.exportResourceAsync(reference));
|
|
20428
|
-
if (error) {
|
|
20429
|
-
throw withExportStatus(error);
|
|
20430
|
-
}
|
|
20431
|
-
return payload.resourceDefinitions.find((d) => d.key === reference.key);
|
|
20432
|
-
}
|
|
20433
|
-
|
|
20434
|
-
class ResourceExportError extends Error {
|
|
20435
|
-
status;
|
|
20436
|
-
constructor(message, status, cause) {
|
|
20437
|
-
super(message, { cause });
|
|
20438
|
-
this.status = status;
|
|
20439
|
-
this.name = "ResourceExportError";
|
|
20440
|
-
}
|
|
20441
|
-
}
|
|
20442
|
-
function withExportStatus(error) {
|
|
20443
|
-
if (!(error instanceof Error) || !("exceptionData" in error)) {
|
|
20444
|
-
return error;
|
|
20445
|
-
}
|
|
20446
|
-
const data = error.exceptionData;
|
|
20447
|
-
const text = typeof data === "object" && data !== null ? data.errorMessage : undefined;
|
|
20448
|
-
const match = typeof text === "string" ? /^HTTP (\d{3})\b/.exec(text) : null;
|
|
20449
|
-
return match ? new ResourceExportError(error.message, Number(match[1]), error) : error;
|
|
20450
|
-
}
|
|
20451
|
-
function readSpecProperty(spec, name) {
|
|
20452
|
-
if (!spec) {
|
|
20453
|
-
return;
|
|
20454
|
-
}
|
|
20455
|
-
if (spec[name] !== undefined) {
|
|
20456
|
-
return spec[name];
|
|
20457
|
-
}
|
|
20458
|
-
const lower = name.toLowerCase();
|
|
20459
|
-
const key = Object.keys(spec).find((k) => k.toLowerCase() === lower);
|
|
20460
|
-
return key === undefined ? undefined : spec[key];
|
|
20461
|
-
}
|
|
20462
|
-
function readSpecEntryPoints(spec) {
|
|
20463
|
-
const entryPoints = parseJsonString(readSpecProperty(spec, "entryPoints"));
|
|
20464
|
-
if (!Array.isArray(entryPoints) || !entryPoints.every((entry) => entry !== null && typeof entry === "object")) {
|
|
20465
|
-
return;
|
|
20466
|
-
}
|
|
20467
|
-
return entryPoints.map((entry) => ({
|
|
20468
|
-
UniqueId: String(readSpecProperty(entry, "uniqueId") ?? ""),
|
|
20469
|
-
Path: String(readSpecProperty(entry, "path") ?? ""),
|
|
20470
|
-
DisplayName: String(readSpecProperty(entry, "displayName") ?? ""),
|
|
20471
|
-
InputArguments: readSpecProperty(entry, "inputArguments"),
|
|
20472
|
-
OutputArguments: readSpecProperty(entry, "outputArguments")
|
|
20473
|
-
}));
|
|
20474
|
-
}
|
|
20475
|
-
function parseJsonString(raw) {
|
|
20476
|
-
if (typeof raw !== "string") {
|
|
20477
|
-
return raw;
|
|
20478
|
-
}
|
|
20479
|
-
const [error, parsed] = catchError2(() => JSON.parse(raw));
|
|
20480
|
-
return error ? undefined : parsed;
|
|
20481
|
-
}
|
|
20482
20349
|
// ../solution-sdk/src/resources/services/resource-casing.ts
|
|
20483
20350
|
var RESOURCE_FILES_FOLDER_NAME2 = "resources";
|
|
20484
20351
|
function lowerFirstChar(value) {
|
|
@@ -20640,118 +20507,7 @@ function parseResourceHeader(content) {
|
|
|
20640
20507
|
return null;
|
|
20641
20508
|
}
|
|
20642
20509
|
}
|
|
20643
|
-
|
|
20644
|
-
var ROOT_RESOURCE_TYPES = new Set(["resource", "solutionresource"]);
|
|
20645
|
-
var KEY_NOT_FOUND = /^(?:Solution)?Resource with key '([^']+)' was not found$/i;
|
|
20646
|
-
function isResourceKeyNotFound(error, resourceKey) {
|
|
20647
|
-
if (!(error instanceof Error))
|
|
20648
|
-
return false;
|
|
20649
|
-
const typed = error;
|
|
20650
|
-
const sameKey = (key) => key !== undefined && key.toLowerCase() === resourceKey.toLowerCase();
|
|
20651
|
-
if (typeof typed.resourceType === "string" && typeof typed.resourceKey === "string") {
|
|
20652
|
-
return ROOT_RESOURCE_TYPES.has(typed.resourceType.toLowerCase()) && sameKey(typed.resourceKey);
|
|
20653
|
-
}
|
|
20654
|
-
return sameKey(KEY_NOT_FOUND.exec(error.message.trim())?.[1]);
|
|
20655
|
-
}
|
|
20656
|
-
async function refreshArtefactSpecsAsync(builder, configurations) {
|
|
20657
|
-
const resources = new Map;
|
|
20658
|
-
const [loadError, solution] = await catchError2(builder.context.loadAsync());
|
|
20659
|
-
if (loadError || !solution)
|
|
20660
|
-
return resources;
|
|
20661
|
-
for (const configuration of configurations) {
|
|
20662
|
-
const resource = solution.resources.find((r) => r.key === configuration?.key);
|
|
20663
|
-
if (!resource)
|
|
20664
|
-
continue;
|
|
20665
|
-
resources.set(resource.key, resource);
|
|
20666
|
-
if (!resource.projectKey)
|
|
20667
|
-
continue;
|
|
20668
|
-
configuration.spec = await applyEntryPointEnhancementAsync(builder.context, resource, configuration.spec ?? {});
|
|
20669
|
-
}
|
|
20670
|
-
return resources;
|
|
20671
|
-
}
|
|
20672
|
-
async function exportResourceConfigurationsAsync(services, resourceKey, hint = {}) {
|
|
20673
|
-
const { catalog, importer } = getRemoteResourceClients(services);
|
|
20674
|
-
const byKey = (item) => item.entityKey === resourceKey;
|
|
20675
|
-
const entity = (hint.name ? await findCatalogEntityAsync(catalog, { name: hint.name }, byKey) : undefined) ?? await findCatalogEntityAsync(catalog, {}, byKey);
|
|
20676
|
-
if (!entity) {
|
|
20677
|
-
throw new Error(`Resource '${resourceKey}' was not found in the solution or in the resource catalog`);
|
|
20678
|
-
}
|
|
20679
|
-
const payload = await importer.exportResourceAsync(toResourceReference(entity));
|
|
20680
|
-
const definitions = payload.resourceDefinitions ?? [];
|
|
20681
|
-
if (definitions.length === 0) {
|
|
20682
|
-
throw new Error(`FPS export for '${resourceKey}' returned no resource definitions`);
|
|
20683
|
-
}
|
|
20684
|
-
return {
|
|
20685
|
-
resources: definitions.map((d) => ({
|
|
20686
|
-
key: d.key ?? "",
|
|
20687
|
-
spec: d.spec ?? {},
|
|
20688
|
-
locks: d.locks ?? [],
|
|
20689
|
-
apiVersion: d.apiVersion,
|
|
20690
|
-
isOverridable: d.isOverridable,
|
|
20691
|
-
name: d.name ?? "",
|
|
20692
|
-
kind: d.kind ?? "",
|
|
20693
|
-
dependencies: (d.dependencies ?? []).map((dep) => ({
|
|
20694
|
-
kind: dep.kind ?? "",
|
|
20695
|
-
name: dep.name ?? ""
|
|
20696
|
-
}))
|
|
20697
|
-
}))
|
|
20698
|
-
};
|
|
20699
|
-
}
|
|
20700
|
-
async function readLocalAsync(builder, resourceKey, read) {
|
|
20701
|
-
if (!builder)
|
|
20702
|
-
return;
|
|
20703
|
-
const [error, value] = await catchError2(read(builder));
|
|
20704
|
-
if (!error)
|
|
20705
|
-
return { builder, value };
|
|
20706
|
-
if (isResourceKeyNotFound(error, resourceKey))
|
|
20707
|
-
return;
|
|
20708
|
-
throw error;
|
|
20709
|
-
}
|
|
20710
|
-
async function readResourceConfigurationsAsync(services, builder, resourceKey, hint = {}) {
|
|
20711
|
-
const local = await readLocalAsync(builder, resourceKey, (b) => b.getAllConfigurationsAsync(resourceKey));
|
|
20712
|
-
if (!local) {
|
|
20713
|
-
return exportResourceConfigurationsAsync(services, resourceKey, hint);
|
|
20714
|
-
}
|
|
20715
|
-
await refreshArtefactSpecsAsync(local.builder, local.value?.resources ?? []);
|
|
20716
|
-
return local.value;
|
|
20717
|
-
}
|
|
20718
|
-
async function readResourceConfigurationAsync(services, builder, resourceKey) {
|
|
20719
|
-
const local = await readLocalAsync(builder, resourceKey, (b) => b.getConfigurationAsync(resourceKey));
|
|
20720
|
-
if (local) {
|
|
20721
|
-
const configuration = local.value;
|
|
20722
|
-
const resources = await refreshArtefactSpecsAsync(local.builder, [
|
|
20723
|
-
configuration
|
|
20724
|
-
]);
|
|
20725
|
-
return { configuration, resource: resources.get(configuration.key) };
|
|
20726
|
-
}
|
|
20727
|
-
const { resources } = await exportResourceConfigurationsAsync(services, resourceKey);
|
|
20728
|
-
const primary = resources.find((r) => r.key === resourceKey) ?? resources[0];
|
|
20729
|
-
const { key, spec, locks, apiVersion, isOverridable } = primary;
|
|
20730
|
-
return { configuration: { key, spec, locks, apiVersion, isOverridable } };
|
|
20731
|
-
}
|
|
20732
|
-
// ../solution-sdk/src/resources/services/resource-lookup.ts
|
|
20733
|
-
async function findResourcesByNameAsync(services, builder, { kind, name, subTypes, folderKey }) {
|
|
20734
|
-
const same = (a, b) => (a ?? "").toLowerCase() === b.toLowerCase();
|
|
20735
|
-
const ofSubType = (type) => subTypes === undefined || subTypes.some((t) => same(type, t));
|
|
20736
|
-
if (builder) {
|
|
20737
|
-
const solution = await builder.context.loadAsync();
|
|
20738
|
-
const local = solution.resources.filter((r) => same(r.kind, kind) && same(r.name, name) && ofSubType(r.type)).map((r) => ({
|
|
20739
|
-
key: r.key,
|
|
20740
|
-
local: true,
|
|
20741
|
-
folderPath: r.folders?.[0]?.fullyQualifiedName
|
|
20742
|
-
}));
|
|
20743
|
-
if (local.length > 0)
|
|
20744
|
-
return local;
|
|
20745
|
-
}
|
|
20746
|
-
const { catalog } = getRemoteResourceClients(services);
|
|
20747
|
-
const rows = await findCatalogEntitiesAsync(catalog, { name, entityTypes: [kind] }, (row) => same(row.entityType, kind) && same(row.entityName, name) && ofSubType(row.entitySubType) && (folderKey === undefined || same(row.folderKey, folderKey)));
|
|
20748
|
-
return rows.map((row) => ({
|
|
20749
|
-
key: row.entityKey ?? "",
|
|
20750
|
-
local: false,
|
|
20751
|
-
folderPath: row.fullyQualifiedName ?? undefined,
|
|
20752
|
-
folderKey: row.folderKey ?? undefined
|
|
20753
|
-
}));
|
|
20754
|
-
}
|
|
20510
|
+
|
|
20755
20511
|
// ../solution-sdk/src/resources/services/sync-resources-from-bindings.ts
|
|
20756
20512
|
var TYPE_IS_IDENTITY_REPLACE_OPTIONS = new Set([
|
|
20757
20513
|
"SameType",
|
|
@@ -20852,16 +20608,68 @@ function sameResourceSubtype(a, b) {
|
|
|
20852
20608
|
function findSubtypeEntry(list, type) {
|
|
20853
20609
|
return list.find((r) => !!r.type && sameResourceSubtype(r.type, type));
|
|
20854
20610
|
}
|
|
20855
|
-
|
|
20856
|
-
|
|
20857
|
-
|
|
20858
|
-
|
|
20859
|
-
|
|
20860
|
-
|
|
20861
|
-
|
|
20862
|
-
|
|
20863
|
-
|
|
20864
|
-
return
|
|
20611
|
+
var SUBTYPED_BINDING_KINDS = new Set([
|
|
20612
|
+
"asset",
|
|
20613
|
+
"bucket"
|
|
20614
|
+
]);
|
|
20615
|
+
function metadataString(metadata, name) {
|
|
20616
|
+
if (!metadata || typeof metadata !== "object")
|
|
20617
|
+
return;
|
|
20618
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
20619
|
+
if (key.toLowerCase() === name.toLowerCase() && typeof value === "string" && value.trim() !== "") {
|
|
20620
|
+
return value;
|
|
20621
|
+
}
|
|
20622
|
+
}
|
|
20623
|
+
return;
|
|
20624
|
+
}
|
|
20625
|
+
function declaredSubTypes(decoded, resources) {
|
|
20626
|
+
const subTypes = new Map;
|
|
20627
|
+
let document;
|
|
20628
|
+
try {
|
|
20629
|
+
document = JSON.parse(decoded);
|
|
20630
|
+
} catch {
|
|
20631
|
+
return subTypes;
|
|
20632
|
+
}
|
|
20633
|
+
const entries = document?.resources;
|
|
20634
|
+
if (!Array.isArray(entries))
|
|
20635
|
+
return subTypes;
|
|
20636
|
+
const byBinding = new Map;
|
|
20637
|
+
for (const entry of entries) {
|
|
20638
|
+
if (!entry || typeof entry !== "object")
|
|
20639
|
+
continue;
|
|
20640
|
+
const { resource, key, metadata } = entry;
|
|
20641
|
+
if (typeof resource !== "string" || typeof key !== "string" || !SUBTYPED_BINDING_KINDS.has(resource.toLowerCase())) {
|
|
20642
|
+
continue;
|
|
20643
|
+
}
|
|
20644
|
+
const subType = metadataString(metadata, "SubType");
|
|
20645
|
+
if (subType)
|
|
20646
|
+
byBinding.set(`${resource}\x00${key}`, subType);
|
|
20647
|
+
}
|
|
20648
|
+
for (const resource of resources) {
|
|
20649
|
+
const subType = byBinding.get(`${resource.originalResourceType}\x00${resource.bindingKey ?? ""}`);
|
|
20650
|
+
if (subType)
|
|
20651
|
+
subTypes.set(resource, subType);
|
|
20652
|
+
}
|
|
20653
|
+
return subTypes;
|
|
20654
|
+
}
|
|
20655
|
+
async function resolveDeclaredKindMetadata(resolveKindMetadata, kind, type, declaredSubType) {
|
|
20656
|
+
if (type === undefined && declaredSubType !== undefined) {
|
|
20657
|
+
const declared = await resolveKindMetadata(kind, declaredSubType);
|
|
20658
|
+
if (declared?.typeMatched)
|
|
20659
|
+
return declared;
|
|
20660
|
+
}
|
|
20661
|
+
return resolveKindMetadata(kind, type);
|
|
20662
|
+
}
|
|
20663
|
+
function resolveBindingResourceIdentity(binding) {
|
|
20664
|
+
switch (binding.resourceType) {
|
|
20665
|
+
case models_BindingsResourceType.TimeTrigger:
|
|
20666
|
+
return { kind: "trigger", type: "timeTrigger" };
|
|
20667
|
+
case models_BindingsResourceType.AppsTrigger:
|
|
20668
|
+
return {
|
|
20669
|
+
kind: lowerFirstChar(getResourceKindForBinding(binding.resourceType))
|
|
20670
|
+
};
|
|
20671
|
+
default:
|
|
20672
|
+
return {
|
|
20865
20673
|
kind: lowerFirstChar(getResourceKindForBinding(binding.resourceType))
|
|
20866
20674
|
};
|
|
20867
20675
|
}
|
|
@@ -20888,7 +20696,11 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
20888
20696
|
return result;
|
|
20889
20697
|
}
|
|
20890
20698
|
const serializer = services.container.resolve(Tokens.IBindingsMetadataSerializer);
|
|
20891
|
-
const {
|
|
20699
|
+
const {
|
|
20700
|
+
bindings: allBindings,
|
|
20701
|
+
parseErrors,
|
|
20702
|
+
subTypes
|
|
20703
|
+
} = await collectBindings(bindingsJsonFallbackDirs, serializer, bindingSources(solutionDir, paths, uipxProjects, projectBindings));
|
|
20892
20704
|
if (parseErrors.length > 0) {
|
|
20893
20705
|
const detail = parseErrors.map((e) => `${e.path}: ${e.reason}`).join("; ");
|
|
20894
20706
|
throw new Error(`Invalid bindings file — ${detail}`);
|
|
@@ -20926,7 +20738,29 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
20926
20738
|
const resolvedKeys = new Set;
|
|
20927
20739
|
const overwrittenKeys = new Set;
|
|
20928
20740
|
const bindingKey = (kind, name) => `${kind}:${name ?? ""}`.toLowerCase();
|
|
20929
|
-
const
|
|
20741
|
+
const anyFolderSelfProvisioned = new Set;
|
|
20742
|
+
const solutionFolderSelfProvisioned = new Set;
|
|
20743
|
+
for (const r of selfProvisioned ?? []) {
|
|
20744
|
+
(r.solutionFolderOnly ? solutionFolderSelfProvisioned : anyFolderSelfProvisioned).add(bindingKey(r.kind, r.name));
|
|
20745
|
+
}
|
|
20746
|
+
const isSelfProvisioned = (kind, name, folderPath) => {
|
|
20747
|
+
const key = bindingKey(kind, name);
|
|
20748
|
+
return anyFolderSelfProvisioned.has(key) || !normalizeFolderPath(folderPath) && solutionFolderSelfProvisioned.has(key);
|
|
20749
|
+
};
|
|
20750
|
+
const importedThisRun = new Set;
|
|
20751
|
+
let referencedKeys;
|
|
20752
|
+
const coveringResource = async (resources, kind, name, folderPath, selfProvisioned) => {
|
|
20753
|
+
const match = findMatchingLocalResource(resources, kind, name, folderPath);
|
|
20754
|
+
if (!match || !selfProvisioned)
|
|
20755
|
+
return match;
|
|
20756
|
+
referencedKeys ??= readReferencedResourceKeys(services, builder);
|
|
20757
|
+
const referenced = await referencedKeys;
|
|
20758
|
+
const owned = resources.filter((r) => {
|
|
20759
|
+
const key = r.key?.toLowerCase();
|
|
20760
|
+
return !key || !importedThisRun.has(key) && !referenced.has(key);
|
|
20761
|
+
});
|
|
20762
|
+
return findMatchingLocalResource(owned, kind, name, folderPath);
|
|
20763
|
+
};
|
|
20930
20764
|
const recordUnchecked = async (error, kind, name, directCloudKey) => {
|
|
20931
20765
|
if (error) {
|
|
20932
20766
|
const failure = classifyCatalogFailure(error);
|
|
@@ -20954,7 +20788,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
20954
20788
|
continue;
|
|
20955
20789
|
}
|
|
20956
20790
|
const isConnection = isConnectionBinding(binding);
|
|
20957
|
-
const metadata = await resolveKindMetadata
|
|
20791
|
+
const metadata = await resolveDeclaredKindMetadata(resolveKindMetadata, kind, identity.type, subTypes.get(binding));
|
|
20958
20792
|
const name = getResourceName(binding);
|
|
20959
20793
|
const folderPath = getFolderPathProperty(binding).defaultValue;
|
|
20960
20794
|
const directCloudKey = isConnection ? getConnectionKey(binding) : undefined;
|
|
@@ -20964,7 +20798,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
20964
20798
|
if (!isConnection && !name) {
|
|
20965
20799
|
continue;
|
|
20966
20800
|
}
|
|
20967
|
-
|
|
20801
|
+
const selfProvisioned = !isConnection && isSelfProvisioned(kind, name, folderPath);
|
|
20802
|
+
if (!isConnection && !normalizeFolderPath(folderPath) && await coveringResource(solution.resources ?? [], kind, name, folderPath, selfProvisioned)) {
|
|
20968
20803
|
result.skipped++;
|
|
20969
20804
|
logger.info(`Skipping ${kind} "${name}" — an in-solution resource already covers this solution-relative binding`);
|
|
20970
20805
|
continue;
|
|
@@ -20974,7 +20809,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
20974
20809
|
logger.info(`Skipping ${kind} "${name}" — the solution provisions this project itself; its member declaration covers the binding`);
|
|
20975
20810
|
continue;
|
|
20976
20811
|
}
|
|
20977
|
-
if (
|
|
20812
|
+
if (selfProvisioned) {
|
|
20978
20813
|
virtualCandidates.push({
|
|
20979
20814
|
binding,
|
|
20980
20815
|
kind,
|
|
@@ -20982,7 +20817,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
20982
20817
|
metadata,
|
|
20983
20818
|
name,
|
|
20984
20819
|
folderPath,
|
|
20985
|
-
catalogMiss: false
|
|
20820
|
+
catalogMiss: false,
|
|
20821
|
+
selfProvisioned
|
|
20986
20822
|
});
|
|
20987
20823
|
continue;
|
|
20988
20824
|
}
|
|
@@ -21005,7 +20841,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
21005
20841
|
metadata,
|
|
21006
20842
|
name,
|
|
21007
20843
|
folderPath,
|
|
21008
|
-
catalogMiss: true
|
|
20844
|
+
catalogMiss: true,
|
|
20845
|
+
selfProvisioned: false
|
|
21009
20846
|
});
|
|
21010
20847
|
continue;
|
|
21011
20848
|
}
|
|
@@ -21034,6 +20871,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
21034
20871
|
if (rcsMatch.key) {
|
|
21035
20872
|
knownResourceKeys.add(rcsMatch.key.toLowerCase());
|
|
21036
20873
|
overwrittenKeys.add(rcsMatch.key.toLowerCase());
|
|
20874
|
+
importedThisRun.add(rcsMatch.key.toLowerCase());
|
|
21037
20875
|
}
|
|
21038
20876
|
result.imported++;
|
|
21039
20877
|
logger.info(`Imported ${kind} "${rcsMatch.name}" (key: ${rcsMatch.key}) into solution`);
|
|
@@ -21060,7 +20898,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
21060
20898
|
metadata,
|
|
21061
20899
|
name,
|
|
21062
20900
|
folderPath,
|
|
21063
|
-
catalogMiss: false
|
|
20901
|
+
catalogMiss: false,
|
|
20902
|
+
selfProvisioned: false
|
|
21064
20903
|
});
|
|
21065
20904
|
}
|
|
21066
20905
|
const virtualCandidatesSeen = new Set;
|
|
@@ -21072,7 +20911,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
21072
20911
|
return true;
|
|
21073
20912
|
});
|
|
21074
20913
|
for (const candidate of dedupedVirtuals) {
|
|
21075
|
-
const [syncError, created] = await catchError2(createVirtualForBinding(builder, candidate.binding, candidate.kind, candidate.type, candidate.metadata, candidate.name, candidate.folderPath, result, candidate.catalogMiss));
|
|
20914
|
+
const [syncError, created] = await catchError2(createVirtualForBinding(builder, candidate.binding, candidate.kind, candidate.type, candidate.metadata, candidate.name, candidate.folderPath, result, candidate.catalogMiss, (resources) => coveringResource(resources, candidate.kind, candidate.name, undefined, candidate.selfProvisioned)));
|
|
21076
20915
|
if (syncError) {
|
|
21077
20916
|
logger.warn(`Failed to create virtual ${candidate.kind}/${candidate.name}: ${syncError.message}`);
|
|
21078
20917
|
} else if (created) {
|
|
@@ -21151,6 +20990,16 @@ async function reportOrphanedDeclarations(services, builder, bindings, result) {
|
|
|
21151
20990
|
logger.warn(warning);
|
|
21152
20991
|
}
|
|
21153
20992
|
}
|
|
20993
|
+
async function readReferencedResourceKeys(services, builder) {
|
|
20994
|
+
const overwrites = services.container.resolve(Tokens.IResourceOverwritesService);
|
|
20995
|
+
const [error, entries] = await catchError2(overwrites.getTenantResourceOverwritesAsync(builder.context));
|
|
20996
|
+
if (error) {
|
|
20997
|
+
logger.debug(`Could not read the resource overwrites, so no root resource is known to be an import: ${error.message}`);
|
|
20998
|
+
return new Set;
|
|
20999
|
+
}
|
|
21000
|
+
return new Set(entries.filter((e) => String(e.overwrite?.type) === REFERENCE_OVERWRITE).map((e) => e.solutionResourceKey.toLowerCase()));
|
|
21001
|
+
}
|
|
21002
|
+
var REFERENCE_OVERWRITE = "Reference";
|
|
21154
21003
|
async function isUncheckedBindingCovered(builder, knownResourceKeys, kind, name, directCloudKey) {
|
|
21155
21004
|
if (directCloudKey) {
|
|
21156
21005
|
return knownResourceKeys.has(directCloudKey.toLowerCase());
|
|
@@ -21250,10 +21099,10 @@ async function mintVirtualResource(builder, kind, type, name, metadata) {
|
|
|
21250
21099
|
}
|
|
21251
21100
|
return { resource, finalName: uniqueName };
|
|
21252
21101
|
}
|
|
21253
|
-
async function createVirtualForBinding(builder, _binding, kind, type, metadata, name, folderPath, result, catalogMiss) {
|
|
21102
|
+
async function createVirtualForBinding(builder, _binding, kind, type, metadata, name, folderPath, result, catalogMiss, findCovering) {
|
|
21254
21103
|
const virtualizable = metadata?.virtualizable ?? false;
|
|
21255
21104
|
const preLoadSolution = await builder.context.loadAsync();
|
|
21256
|
-
const alreadyVirtualized =
|
|
21105
|
+
const alreadyVirtualized = await findCovering(preLoadSolution.resources);
|
|
21257
21106
|
if (alreadyVirtualized) {
|
|
21258
21107
|
result.skipped++;
|
|
21259
21108
|
logger.info(`Skipping virtual ${kind} "${name}" — existing resource "${alreadyVirtualized.name}" in solution_folder already covers this binding (requested folder "${folderPath}")`);
|
|
@@ -21315,6 +21164,35 @@ async function findResourceByKeyInRcs(builder, kind, expectedKey, folderPath, pr
|
|
|
21315
21164
|
}
|
|
21316
21165
|
return;
|
|
21317
21166
|
}
|
|
21167
|
+
async function findResourcesByKeysInRcs(builder, kind, keys) {
|
|
21168
|
+
const wanted = new Set([...keys].map((key) => key.toLowerCase()));
|
|
21169
|
+
const found = new Map;
|
|
21170
|
+
let pageCursor;
|
|
21171
|
+
while (found.size < wanted.size) {
|
|
21172
|
+
const result = await builder.searchResourcesAsync(kind, undefined, undefined, pageCursor, 100, undefined, false);
|
|
21173
|
+
for (const folderResources of result.availableResources) {
|
|
21174
|
+
for (const resource of folderResources.resources) {
|
|
21175
|
+
const key = resource.key.toLowerCase();
|
|
21176
|
+
if (!wanted.has(key) || found.has(key))
|
|
21177
|
+
continue;
|
|
21178
|
+
found.set(key, {
|
|
21179
|
+
key: resource.key,
|
|
21180
|
+
name: resource.name,
|
|
21181
|
+
type: resource.type,
|
|
21182
|
+
folder: {
|
|
21183
|
+
fullyQualifiedName: folderResources.fullyQualifiedName,
|
|
21184
|
+
folderKey: folderResources.key,
|
|
21185
|
+
path: folderResources.path
|
|
21186
|
+
}
|
|
21187
|
+
});
|
|
21188
|
+
}
|
|
21189
|
+
}
|
|
21190
|
+
pageCursor = result.nextPage;
|
|
21191
|
+
if (!pageCursor)
|
|
21192
|
+
break;
|
|
21193
|
+
}
|
|
21194
|
+
return found;
|
|
21195
|
+
}
|
|
21318
21196
|
async function searchRcsResources(builder, kind, name) {
|
|
21319
21197
|
const [searchError, matches] = await catchError2(searchRcsResourcesStrict(builder, kind, name));
|
|
21320
21198
|
if (searchError) {
|
|
@@ -21555,6 +21433,17 @@ async function collectBindings(bindingsJsonFallbackDirs, serializer, sources) {
|
|
|
21555
21433
|
const fs = getFileSystem();
|
|
21556
21434
|
const allBindings = [];
|
|
21557
21435
|
const parseErrors = [];
|
|
21436
|
+
const subTypes = new Map;
|
|
21437
|
+
const collect = (parsed) => {
|
|
21438
|
+
if ("error" in parsed) {
|
|
21439
|
+
parseErrors.push(parsed.error);
|
|
21440
|
+
return;
|
|
21441
|
+
}
|
|
21442
|
+
allBindings.push(...parsed.resources);
|
|
21443
|
+
for (const [binding, subType] of parsed.subTypes) {
|
|
21444
|
+
subTypes.set(binding, subType);
|
|
21445
|
+
}
|
|
21446
|
+
};
|
|
21558
21447
|
for (const { directory: dir, contribution } of sources) {
|
|
21559
21448
|
if (contribution) {
|
|
21560
21449
|
if (contribution.bindings.length === 0)
|
|
@@ -21563,10 +21452,7 @@ async function collectBindings(bindingsJsonFallbackDirs, serializer, sources) {
|
|
|
21563
21452
|
version: "2.0",
|
|
21564
21453
|
resources: contribution.bindings
|
|
21565
21454
|
}), `${dir} (bindings contributed by the project's tool; project ${contribution.projectId})`, serializer);
|
|
21566
|
-
|
|
21567
|
-
parseErrors.push(parsed.error);
|
|
21568
|
-
else
|
|
21569
|
-
allBindings.push(...parsed.resources);
|
|
21455
|
+
collect(parsed);
|
|
21570
21456
|
continue;
|
|
21571
21457
|
}
|
|
21572
21458
|
const v2Path = fs.path.join(dir, "bindings_v2.json");
|
|
@@ -21587,13 +21473,9 @@ async function collectBindings(bindingsJsonFallbackDirs, serializer, sources) {
|
|
|
21587
21473
|
});
|
|
21588
21474
|
continue;
|
|
21589
21475
|
}
|
|
21590
|
-
|
|
21591
|
-
if ("error" in parsed)
|
|
21592
|
-
parseErrors.push(parsed.error);
|
|
21593
|
-
else
|
|
21594
|
-
allBindings.push(...parsed.resources);
|
|
21476
|
+
collect(deserializeBindings(new TextDecoder().decode(content), bindingsPath, serializer));
|
|
21595
21477
|
}
|
|
21596
|
-
return { bindings: allBindings, parseErrors };
|
|
21478
|
+
return { bindings: allBindings, parseErrors, subTypes };
|
|
21597
21479
|
}
|
|
21598
21480
|
function deserializeBindings(decoded, source, serializer) {
|
|
21599
21481
|
let success;
|
|
@@ -21618,7 +21500,8 @@ function deserializeBindings(decoded, source, serializer) {
|
|
|
21618
21500
|
}
|
|
21619
21501
|
};
|
|
21620
21502
|
}
|
|
21621
|
-
|
|
21503
|
+
const resources = metadata?.resources ?? [];
|
|
21504
|
+
return { resources, subTypes: declaredSubTypes(decoded, resources) };
|
|
21622
21505
|
}
|
|
21623
21506
|
async function syncAndLog(solutionDir, projectSubTypes, options) {
|
|
21624
21507
|
const [syncError, syncResult] = await catchError2(syncResourcesFromBindings(solutionDir, undefined, projectSubTypes, options?.projectBindings, options?.selfProvisioned));
|
|
@@ -21639,6 +21522,315 @@ async function syncAndLog(solutionDir, projectSubTypes, options) {
|
|
|
21639
21522
|
}
|
|
21640
21523
|
}
|
|
21641
21524
|
|
|
21525
|
+
// ../solution-sdk/src/resources/services/imported-resources.ts
|
|
21526
|
+
var REFERENCE_OVERWRITE2 = "Reference";
|
|
21527
|
+
async function resolveImportedResourcesAsync(services, builder, resources) {
|
|
21528
|
+
const overwrites = await services.container.resolve(Tokens.IResourceOverwritesService).getTenantResourceOverwritesAsync(builder.context);
|
|
21529
|
+
const tenantNames = new Map;
|
|
21530
|
+
for (const entry of overwrites) {
|
|
21531
|
+
if (String(entry.overwrite?.type) !== REFERENCE_OVERWRITE2)
|
|
21532
|
+
continue;
|
|
21533
|
+
tenantNames.set(entry.solutionResourceKey.toLowerCase(), entry.overwrite?.resourceName || undefined);
|
|
21534
|
+
}
|
|
21535
|
+
const resolved = new Map;
|
|
21536
|
+
const unresolved = new Map;
|
|
21537
|
+
const unchecked = new Set;
|
|
21538
|
+
const byKind = new Map;
|
|
21539
|
+
for (const resource of resources) {
|
|
21540
|
+
const key = resource.key?.toLowerCase();
|
|
21541
|
+
if (!key)
|
|
21542
|
+
continue;
|
|
21543
|
+
if (normalizeFolderPath(resource.folders?.[0]?.fullyQualifiedName)) {
|
|
21544
|
+
continue;
|
|
21545
|
+
}
|
|
21546
|
+
const recorded = tenantNames.has(key);
|
|
21547
|
+
if (!recorded && resource.isArtefactResource)
|
|
21548
|
+
continue;
|
|
21549
|
+
const kind = resource.kind ?? "";
|
|
21550
|
+
byKind.set(kind, [...byKind.get(kind) ?? [], { key, recorded }]);
|
|
21551
|
+
}
|
|
21552
|
+
const reportFailed = (entries, reason) => {
|
|
21553
|
+
for (const { key, recorded } of entries) {
|
|
21554
|
+
if (recorded)
|
|
21555
|
+
unresolved.set(key, reason);
|
|
21556
|
+
else
|
|
21557
|
+
unchecked.add(key);
|
|
21558
|
+
}
|
|
21559
|
+
};
|
|
21560
|
+
let failure;
|
|
21561
|
+
for (const [kind, entries] of byKind) {
|
|
21562
|
+
if (failure) {
|
|
21563
|
+
reportFailed(entries, failure);
|
|
21564
|
+
continue;
|
|
21565
|
+
}
|
|
21566
|
+
const [error, matches] = await catchError2(findResourcesByKeysInRcs(builder, kind, entries.map((entry) => entry.key)));
|
|
21567
|
+
if (error) {
|
|
21568
|
+
const reason = `the Resource Catalog could not be searched: ${error.message}`;
|
|
21569
|
+
reportFailed(entries, reason);
|
|
21570
|
+
if (stopsCatalogLookups(classifyCatalogFailure(error))) {
|
|
21571
|
+
failure = reason;
|
|
21572
|
+
}
|
|
21573
|
+
continue;
|
|
21574
|
+
}
|
|
21575
|
+
for (const { key, recorded } of entries) {
|
|
21576
|
+
const match = matches.get(key);
|
|
21577
|
+
if (match?.folder?.fullyQualifiedName) {
|
|
21578
|
+
resolved.set(key, {
|
|
21579
|
+
name: tenantNames.get(key) ?? match.name,
|
|
21580
|
+
folderPath: match.folder.fullyQualifiedName
|
|
21581
|
+
});
|
|
21582
|
+
} else if (recorded) {
|
|
21583
|
+
unresolved.set(key, "the Resource Catalog no longer lists it");
|
|
21584
|
+
}
|
|
21585
|
+
}
|
|
21586
|
+
}
|
|
21587
|
+
return { resolved, unresolved, unchecked };
|
|
21588
|
+
}
|
|
21589
|
+
// ../solution-sdk/src/resources/services/project-artifacts-service.ts
|
|
21590
|
+
async function addProjectArtifactsToSolutionAsync(options) {
|
|
21591
|
+
const error = await createProjectInSolutionBuilder(options.solutionDir, options.projectId, options.projectName, normalizeProjectType(options.projectType), options.projectSubType);
|
|
21592
|
+
return error ? artifactFailure(options, error) : { Created: true };
|
|
21593
|
+
}
|
|
21594
|
+
function artifactFailure(options, error) {
|
|
21595
|
+
logger.warn(`Solution artifact-resource generation failed for project "${options.projectName}": ${error.message}. ` + "The project was created and registered, but 'uip solution pack' may omit its resource. " + "Re-run init with --force to retry, or run 'uip solution projects add' to finish setup.");
|
|
21596
|
+
return { Created: false, Error: error.message };
|
|
21597
|
+
}
|
|
21598
|
+
// ../solution-sdk/src/resources/services/project-template-types.ts
|
|
21599
|
+
var reader;
|
|
21600
|
+
function hasBareTemplateRow(projectType) {
|
|
21601
|
+
reader ??= new EmbeddedProjectConfigurationReader;
|
|
21602
|
+
return reader.getTemplateResourcesByType(projectType, undefined, false).length > 0;
|
|
21603
|
+
}
|
|
21604
|
+
function hasAnyTemplateRow(projectType) {
|
|
21605
|
+
reader ??= new EmbeddedProjectConfigurationReader;
|
|
21606
|
+
const wanted = projectType.toLowerCase();
|
|
21607
|
+
return Object.keys(reader.getAll()).some((row) => {
|
|
21608
|
+
const key = row.toLowerCase();
|
|
21609
|
+
return key === wanted || key.startsWith(`${wanted}_`);
|
|
21610
|
+
});
|
|
21611
|
+
}
|
|
21612
|
+
// ../solution-sdk/src/resources/services/remote-resources.ts
|
|
21613
|
+
function getRemoteResourceClients(services) {
|
|
21614
|
+
return {
|
|
21615
|
+
catalog: services.container.resolve(Tokens.IResourceCatalogClientProxy),
|
|
21616
|
+
importer: services.container.resolve(Tokens.IImportResourceHelper)
|
|
21617
|
+
};
|
|
21618
|
+
}
|
|
21619
|
+
async function findCatalogEntityAsync(catalog, query, match) {
|
|
21620
|
+
let pageCursor;
|
|
21621
|
+
do {
|
|
21622
|
+
const page = await catalog.searchFolderEntities({
|
|
21623
|
+
...query,
|
|
21624
|
+
pageSize: 100,
|
|
21625
|
+
pageCursor
|
|
21626
|
+
});
|
|
21627
|
+
const found = (page.items ?? []).find(match);
|
|
21628
|
+
if (found) {
|
|
21629
|
+
return found;
|
|
21630
|
+
}
|
|
21631
|
+
pageCursor = page.nextPage ?? undefined;
|
|
21632
|
+
} while (pageCursor);
|
|
21633
|
+
return;
|
|
21634
|
+
}
|
|
21635
|
+
async function findCatalogEntitiesAsync(catalog, query, match) {
|
|
21636
|
+
const found = [];
|
|
21637
|
+
let pageCursor;
|
|
21638
|
+
do {
|
|
21639
|
+
const page = await catalog.searchFolderEntities({
|
|
21640
|
+
...query,
|
|
21641
|
+
pageSize: 100,
|
|
21642
|
+
pageCursor
|
|
21643
|
+
});
|
|
21644
|
+
found.push(...(page.items ?? []).filter(match));
|
|
21645
|
+
pageCursor = page.nextPage ?? undefined;
|
|
21646
|
+
} while (pageCursor);
|
|
21647
|
+
return found;
|
|
21648
|
+
}
|
|
21649
|
+
function toResourceReference(entity) {
|
|
21650
|
+
return toCatalogReference({
|
|
21651
|
+
kind: entity.entityType ?? "",
|
|
21652
|
+
type: entity.entitySubType ?? undefined,
|
|
21653
|
+
key: entity.entityKey ?? "",
|
|
21654
|
+
name: entity.entityName ?? undefined,
|
|
21655
|
+
folderPath: entity.fullyQualifiedName ?? undefined,
|
|
21656
|
+
folderKey: entity.folderKey ?? undefined
|
|
21657
|
+
});
|
|
21658
|
+
}
|
|
21659
|
+
function toCatalogReference(reference) {
|
|
21660
|
+
const { folderPath, folderKey, ...rest } = reference;
|
|
21661
|
+
return {
|
|
21662
|
+
...rest,
|
|
21663
|
+
folder: folderPath ? { fullyQualifiedName: folderPath, folderKey } : undefined
|
|
21664
|
+
};
|
|
21665
|
+
}
|
|
21666
|
+
async function exportResourceDefinitionAsync(importer, reference) {
|
|
21667
|
+
const [error, payload] = await catchError2(importer.exportResourceAsync(reference));
|
|
21668
|
+
if (error) {
|
|
21669
|
+
throw withExportStatus(error);
|
|
21670
|
+
}
|
|
21671
|
+
return payload.resourceDefinitions.find((d) => d.key === reference.key);
|
|
21672
|
+
}
|
|
21673
|
+
|
|
21674
|
+
class ResourceExportError extends Error {
|
|
21675
|
+
status;
|
|
21676
|
+
constructor(message, status, cause) {
|
|
21677
|
+
super(message, { cause });
|
|
21678
|
+
this.status = status;
|
|
21679
|
+
this.name = "ResourceExportError";
|
|
21680
|
+
}
|
|
21681
|
+
}
|
|
21682
|
+
function withExportStatus(error) {
|
|
21683
|
+
if (!(error instanceof Error) || !("exceptionData" in error)) {
|
|
21684
|
+
return error;
|
|
21685
|
+
}
|
|
21686
|
+
const data = error.exceptionData;
|
|
21687
|
+
const text = typeof data === "object" && data !== null ? data.errorMessage : undefined;
|
|
21688
|
+
const match = typeof text === "string" ? /^HTTP (\d{3})\b/.exec(text) : null;
|
|
21689
|
+
return match ? new ResourceExportError(error.message, Number(match[1]), error) : error;
|
|
21690
|
+
}
|
|
21691
|
+
function readSpecProperty(spec, name) {
|
|
21692
|
+
if (!spec) {
|
|
21693
|
+
return;
|
|
21694
|
+
}
|
|
21695
|
+
if (spec[name] !== undefined) {
|
|
21696
|
+
return spec[name];
|
|
21697
|
+
}
|
|
21698
|
+
const lower = name.toLowerCase();
|
|
21699
|
+
const key = Object.keys(spec).find((k) => k.toLowerCase() === lower);
|
|
21700
|
+
return key === undefined ? undefined : spec[key];
|
|
21701
|
+
}
|
|
21702
|
+
function readSpecEntryPoints(spec) {
|
|
21703
|
+
const entryPoints = parseJsonString(readSpecProperty(spec, "entryPoints"));
|
|
21704
|
+
if (!Array.isArray(entryPoints) || !entryPoints.every((entry) => entry !== null && typeof entry === "object")) {
|
|
21705
|
+
return;
|
|
21706
|
+
}
|
|
21707
|
+
return entryPoints.map((entry) => ({
|
|
21708
|
+
UniqueId: String(readSpecProperty(entry, "uniqueId") ?? ""),
|
|
21709
|
+
Path: String(readSpecProperty(entry, "path") ?? ""),
|
|
21710
|
+
DisplayName: String(readSpecProperty(entry, "displayName") ?? ""),
|
|
21711
|
+
InputArguments: readSpecProperty(entry, "inputArguments"),
|
|
21712
|
+
OutputArguments: readSpecProperty(entry, "outputArguments")
|
|
21713
|
+
}));
|
|
21714
|
+
}
|
|
21715
|
+
function parseJsonString(raw) {
|
|
21716
|
+
if (typeof raw !== "string") {
|
|
21717
|
+
return raw;
|
|
21718
|
+
}
|
|
21719
|
+
const [error, parsed] = catchError2(() => JSON.parse(raw));
|
|
21720
|
+
return error ? undefined : parsed;
|
|
21721
|
+
}
|
|
21722
|
+
// ../solution-sdk/src/resources/services/resource-configurations.ts
|
|
21723
|
+
var ROOT_RESOURCE_TYPES = new Set(["resource", "solutionresource"]);
|
|
21724
|
+
var KEY_NOT_FOUND = /^(?:Solution)?Resource with key '([^']+)' was not found$/i;
|
|
21725
|
+
function isResourceKeyNotFound(error, resourceKey) {
|
|
21726
|
+
if (!(error instanceof Error))
|
|
21727
|
+
return false;
|
|
21728
|
+
const typed = error;
|
|
21729
|
+
const sameKey = (key) => key !== undefined && key.toLowerCase() === resourceKey.toLowerCase();
|
|
21730
|
+
if (typeof typed.resourceType === "string" && typeof typed.resourceKey === "string") {
|
|
21731
|
+
return ROOT_RESOURCE_TYPES.has(typed.resourceType.toLowerCase()) && sameKey(typed.resourceKey);
|
|
21732
|
+
}
|
|
21733
|
+
return sameKey(KEY_NOT_FOUND.exec(error.message.trim())?.[1]);
|
|
21734
|
+
}
|
|
21735
|
+
async function refreshArtefactSpecsAsync(builder, configurations) {
|
|
21736
|
+
const resources = new Map;
|
|
21737
|
+
const [loadError, solution] = await catchError2(builder.context.loadAsync());
|
|
21738
|
+
if (loadError || !solution)
|
|
21739
|
+
return resources;
|
|
21740
|
+
for (const configuration of configurations) {
|
|
21741
|
+
const resource = solution.resources.find((r) => r.key === configuration?.key);
|
|
21742
|
+
if (!resource)
|
|
21743
|
+
continue;
|
|
21744
|
+
resources.set(resource.key, resource);
|
|
21745
|
+
if (!resource.projectKey)
|
|
21746
|
+
continue;
|
|
21747
|
+
configuration.spec = await applyEntryPointEnhancementAsync(builder.context, resource, configuration.spec ?? {});
|
|
21748
|
+
}
|
|
21749
|
+
return resources;
|
|
21750
|
+
}
|
|
21751
|
+
async function exportResourceConfigurationsAsync(services, resourceKey, hint = {}) {
|
|
21752
|
+
const { catalog, importer } = getRemoteResourceClients(services);
|
|
21753
|
+
const byKey = (item) => item.entityKey === resourceKey;
|
|
21754
|
+
const entity = (hint.name ? await findCatalogEntityAsync(catalog, { name: hint.name }, byKey) : undefined) ?? await findCatalogEntityAsync(catalog, {}, byKey);
|
|
21755
|
+
if (!entity) {
|
|
21756
|
+
throw new Error(`Resource '${resourceKey}' was not found in the solution or in the resource catalog`);
|
|
21757
|
+
}
|
|
21758
|
+
const payload = await importer.exportResourceAsync(toResourceReference(entity));
|
|
21759
|
+
const definitions = payload.resourceDefinitions ?? [];
|
|
21760
|
+
if (definitions.length === 0) {
|
|
21761
|
+
throw new Error(`FPS export for '${resourceKey}' returned no resource definitions`);
|
|
21762
|
+
}
|
|
21763
|
+
return {
|
|
21764
|
+
resources: definitions.map((d) => ({
|
|
21765
|
+
key: d.key ?? "",
|
|
21766
|
+
spec: d.spec ?? {},
|
|
21767
|
+
locks: d.locks ?? [],
|
|
21768
|
+
apiVersion: d.apiVersion,
|
|
21769
|
+
isOverridable: d.isOverridable,
|
|
21770
|
+
name: d.name ?? "",
|
|
21771
|
+
kind: d.kind ?? "",
|
|
21772
|
+
dependencies: (d.dependencies ?? []).map((dep) => ({
|
|
21773
|
+
kind: dep.kind ?? "",
|
|
21774
|
+
name: dep.name ?? ""
|
|
21775
|
+
}))
|
|
21776
|
+
}))
|
|
21777
|
+
};
|
|
21778
|
+
}
|
|
21779
|
+
async function readLocalAsync(builder, resourceKey, read) {
|
|
21780
|
+
if (!builder)
|
|
21781
|
+
return;
|
|
21782
|
+
const [error, value] = await catchError2(read(builder));
|
|
21783
|
+
if (!error)
|
|
21784
|
+
return { builder, value };
|
|
21785
|
+
if (isResourceKeyNotFound(error, resourceKey))
|
|
21786
|
+
return;
|
|
21787
|
+
throw error;
|
|
21788
|
+
}
|
|
21789
|
+
async function readResourceConfigurationsAsync(services, builder, resourceKey, hint = {}) {
|
|
21790
|
+
const local = await readLocalAsync(builder, resourceKey, (b) => b.getAllConfigurationsAsync(resourceKey));
|
|
21791
|
+
if (!local) {
|
|
21792
|
+
return exportResourceConfigurationsAsync(services, resourceKey, hint);
|
|
21793
|
+
}
|
|
21794
|
+
await refreshArtefactSpecsAsync(local.builder, local.value?.resources ?? []);
|
|
21795
|
+
return local.value;
|
|
21796
|
+
}
|
|
21797
|
+
async function readResourceConfigurationAsync(services, builder, resourceKey) {
|
|
21798
|
+
const local = await readLocalAsync(builder, resourceKey, (b) => b.getConfigurationAsync(resourceKey));
|
|
21799
|
+
if (local) {
|
|
21800
|
+
const configuration = local.value;
|
|
21801
|
+
const resources = await refreshArtefactSpecsAsync(local.builder, [
|
|
21802
|
+
configuration
|
|
21803
|
+
]);
|
|
21804
|
+
return { configuration, resource: resources.get(configuration.key) };
|
|
21805
|
+
}
|
|
21806
|
+
const { resources } = await exportResourceConfigurationsAsync(services, resourceKey);
|
|
21807
|
+
const primary = resources.find((r) => r.key === resourceKey) ?? resources[0];
|
|
21808
|
+
const { key, spec, locks, apiVersion, isOverridable } = primary;
|
|
21809
|
+
return { configuration: { key, spec, locks, apiVersion, isOverridable } };
|
|
21810
|
+
}
|
|
21811
|
+
// ../solution-sdk/src/resources/services/resource-lookup.ts
|
|
21812
|
+
async function findResourcesByNameAsync(services, builder, { kind, name, subTypes, folderKey }) {
|
|
21813
|
+
const same = (a, b) => (a ?? "").toLowerCase() === b.toLowerCase();
|
|
21814
|
+
const ofSubType = (type) => subTypes === undefined || subTypes.some((t) => same(type, t));
|
|
21815
|
+
if (builder) {
|
|
21816
|
+
const solution = await builder.context.loadAsync();
|
|
21817
|
+
const local = solution.resources.filter((r) => same(r.kind, kind) && same(r.name, name) && ofSubType(r.type)).map((r) => ({
|
|
21818
|
+
key: r.key,
|
|
21819
|
+
local: true,
|
|
21820
|
+
folderPath: r.folders?.[0]?.fullyQualifiedName
|
|
21821
|
+
}));
|
|
21822
|
+
if (local.length > 0)
|
|
21823
|
+
return local;
|
|
21824
|
+
}
|
|
21825
|
+
const { catalog } = getRemoteResourceClients(services);
|
|
21826
|
+
const rows = await findCatalogEntitiesAsync(catalog, { name, entityTypes: [kind] }, (row) => same(row.entityType, kind) && same(row.entityName, name) && ofSubType(row.entitySubType) && (folderKey === undefined || same(row.folderKey, folderKey)));
|
|
21827
|
+
return rows.map((row) => ({
|
|
21828
|
+
key: row.entityKey ?? "",
|
|
21829
|
+
local: false,
|
|
21830
|
+
folderPath: row.fullyQualifiedName ?? undefined,
|
|
21831
|
+
folderKey: row.folderKey ?? undefined
|
|
21832
|
+
}));
|
|
21833
|
+
}
|
|
21642
21834
|
// ../solution-sdk/src/resources/services/resource-refresh-service.ts
|
|
21643
21835
|
async function resourceRefreshAsync(solutionPath = ".", options = {}) {
|
|
21644
21836
|
const fs = getFileSystem();
|
|
@@ -21677,7 +21869,11 @@ async function resourceRefreshAsync(solutionPath = ".", options = {}) {
|
|
|
21677
21869
|
if (bindingsError) {
|
|
21678
21870
|
resolverWarnings.push(`Could not read the bindings projects contribute: ${bindingsError.message}. Those projects were synced from any bindings_v2.json on disk instead; fix the tool install and re-run 'uip solution resources refresh'.`);
|
|
21679
21871
|
}
|
|
21680
|
-
const [
|
|
21872
|
+
const [selfProvisionedError, selfProvisioned] = await catchError2(options.resolveSelfProvisionedAsync?.() ?? Promise.resolve([]));
|
|
21873
|
+
if (selfProvisionedError) {
|
|
21874
|
+
resolverWarnings.push(`Could not read the resources projects say the solution creates: ${selfProvisionedError.message}. They were looked up in the Resource Catalog instead; fix the tool install and re-run 'uip solution resources refresh'.`);
|
|
21875
|
+
}
|
|
21876
|
+
const [syncError, result] = await catchError2(syncResourcesFromBindings(resolvedPath, undefined, projectSubTypes ?? new Map, projectBindings ?? new Map, selfProvisioned?.length ? [...selfProvisioned] : undefined, {
|
|
21681
21877
|
bindingsComplete: !bindingsError && (options.isProjectBindingsComplete?.() ?? true)
|
|
21682
21878
|
}));
|
|
21683
21879
|
if (syncError) {
|
|
@@ -21900,6 +22096,7 @@ export {
|
|
|
21900
22096
|
findProjectFile,
|
|
21901
22097
|
findResourceByKeyInRcs,
|
|
21902
22098
|
findResourceInRcs,
|
|
22099
|
+
findResourcesByKeysInRcs,
|
|
21903
22100
|
findResourcesByNameAsync,
|
|
21904
22101
|
formatResourceSubtypes,
|
|
21905
22102
|
getRemoteResourceClients,
|
|
@@ -21921,6 +22118,7 @@ export {
|
|
|
21921
22118
|
readSpecProperty,
|
|
21922
22119
|
readUipxProjects,
|
|
21923
22120
|
refreshArtefactSpecsAsync,
|
|
22121
|
+
resolveImportedResourcesAsync,
|
|
21924
22122
|
resolveProjectDirFromManifest,
|
|
21925
22123
|
resolveResourceKindMetadata,
|
|
21926
22124
|
resolveSolutionFilePath,
|
|
@@ -21940,4 +22138,4 @@ export {
|
|
|
21940
22138
|
writeSolutionFile
|
|
21941
22139
|
};
|
|
21942
22140
|
|
|
21943
|
-
//# debugId=
|
|
22141
|
+
//# debugId=13269D22A738BF3264756E2164756E21
|