@uipath/case-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-5v9ajf66.js → authoring-hpkv774c.js} +9 -6
- package/dist/{business-rule-export-mte3gjqv.js → business-rule-export-7m60ye0z.js} +1 -1
- package/dist/{case-debug-solution-projects-d5nrywd2.js → case-debug-solution-projects-r98bjv1q.js} +2 -2
- package/dist/{case-debug-studio-web-service-zdgqr91y.js → case-debug-studio-web-service-164by5nc.js} +4 -4
- package/dist/{case-pack-service-mvnry7t2.js → case-pack-service-e9hpaxcz.js} +4 -4
- package/dist/{case-validate-service-xmh3d9vg.js → case-validate-service-46q8z1g5.js} +1 -1
- package/dist/{connector-enrichment-service-hs2d1a58.js → connector-enrichment-service-f41b9sx4.js} +5 -5
- package/dist/{connector-lookup-service-w01cnanp.js → connector-lookup-service-gmqp0b98.js} +2 -2
- package/dist/{enrichment-service-m0ffmtqp.js → enrichment-service-shefbef3.js} +1 -1
- package/dist/{index-fggth62h.js → index-3dc86891.js} +2 -2
- package/dist/{index-tda80514.js → index-s1qrezrq.js} +2 -2
- package/dist/{index-kw8s47s9.js → index-w89mgx5t.js} +1 -1
- package/dist/{index-50w84ws0.js → index-wkkf2sqh.js} +478 -280
- package/dist/{index-g22j3v6z.js → index-xxtxmc68.js} +3 -3
- package/dist/index.js +1 -1
- package/dist/{init-entry-points-ntx24eyp.js → init-entry-points-3awb07k3.js} +3 -3
- package/dist/{integration-service-fetcher-fv5p07c5.js → integration-service-fetcher-td2m2920.js} +2 -2
- package/dist/{localSolutionDiscovery-qywxfs0x.js → localSolutionDiscovery-p76pkg4h.js} +3 -3
- package/dist/{node-sync-service-7agh1jp4.js → node-sync-service-y0n3255b.js} +3 -3
- package/dist/{out-target-1nf1w27k.js → out-target-6bkd58tt.js} +3 -3
- package/dist/{packager-tool-ddm830vk.js → packager-tool-16rpf7ra.js} +2 -2
- package/dist/{packager-tool-3mjb6s40.js → packager-tool-2w3wbt9e.js} +2 -2
- package/dist/{packager-tool-aynr30c7.js → packager-tool-4400k61z.js} +4 -4
- package/dist/{packager-tool-frw06yrx.js → packager-tool-80h66bdx.js} +1 -1
- package/dist/{packager-tool-15n0wenx.js → packager-tool-8fvsztx3.js} +1 -1
- package/dist/{packager-tool-xbzw78dp.js → packager-tool-bm4k99m1.js} +29 -29
- package/dist/{packager-tool-v3j73vb4.js → packager-tool-cp2e5aye.js} +3 -3
- package/dist/{packager-tool-gz1jqf2g.js → packager-tool-gnmnwhes.js} +1 -1
- package/dist/{packager-tool-7wrh57ja.js → packager-tool-hf72ww3b.js} +1 -1
- package/dist/{packager-tool-064a6zcv.js → packager-tool-xvh87pvm.js} +2 -2
- package/dist/{packager-tool-7fxtbm58.js → packager-tool-y01zn5aw.js} +66 -1
- package/dist/packager-tool.js +2 -2
- package/dist/{project-artifacts-g7d52tje.js → project-artifacts-caeck8ak.js} +1 -1
- package/dist/{resourcesSyncService-rwpdpnay.js → resourcesSyncService-kv0762mc.js} +6 -6
- package/dist/{sdd-resolve-siblings-q08re6nn.js → sdd-resolve-siblings-e9624rb8.js} +2 -2
- package/dist/tool.js +1 -1
- package/dist/{trigger-enrichment-service-r15j96d7.js → trigger-enrichment-service-ey92dgx6.js} +5 -5
- package/package.json +2 -2
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
extractErrorMessage,
|
|
7
7
|
logger
|
|
8
8
|
} from "./packager-tool-j8mnpsv8.js";
|
|
9
|
-
import"./packager-tool-
|
|
9
|
+
import"./packager-tool-y01zn5aw.js";
|
|
10
10
|
import {
|
|
11
11
|
ErrorCodes,
|
|
12
12
|
BadRequestException,
|
|
@@ -20344,139 +20344,6 @@ function findOrphanedDeclarations(resources, bound, boundKeys = new Set) {
|
|
|
20344
20344
|
return !bound.some((b) => b.kind.toLowerCase() === kind && nameSuffixRegex(b.name, false).test(name));
|
|
20345
20345
|
});
|
|
20346
20346
|
}
|
|
20347
|
-
// ../solution-sdk/src/resources/services/project-artifacts-service.ts
|
|
20348
|
-
async function addProjectArtifactsToSolutionAsync(options) {
|
|
20349
|
-
const error = await createProjectInSolutionBuilder(options.solutionDir, options.projectId, options.projectName, normalizeProjectType(options.projectType), options.projectSubType);
|
|
20350
|
-
return error ? artifactFailure(options, error) : { Created: true };
|
|
20351
|
-
}
|
|
20352
|
-
function artifactFailure(options, error) {
|
|
20353
|
-
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.");
|
|
20354
|
-
return { Created: false, Error: error.message };
|
|
20355
|
-
}
|
|
20356
|
-
// ../solution-sdk/src/resources/services/project-template-types.ts
|
|
20357
|
-
var reader;
|
|
20358
|
-
function hasBareTemplateRow(projectType) {
|
|
20359
|
-
reader ??= new EmbeddedProjectConfigurationReader;
|
|
20360
|
-
return reader.getTemplateResourcesByType(projectType, undefined, false).length > 0;
|
|
20361
|
-
}
|
|
20362
|
-
function hasAnyTemplateRow(projectType) {
|
|
20363
|
-
reader ??= new EmbeddedProjectConfigurationReader;
|
|
20364
|
-
const wanted = projectType.toLowerCase();
|
|
20365
|
-
return Object.keys(reader.getAll()).some((row) => {
|
|
20366
|
-
const key = row.toLowerCase();
|
|
20367
|
-
return key === wanted || key.startsWith(`${wanted}_`);
|
|
20368
|
-
});
|
|
20369
|
-
}
|
|
20370
|
-
// ../solution-sdk/src/resources/services/remote-resources.ts
|
|
20371
|
-
function getRemoteResourceClients(services) {
|
|
20372
|
-
return {
|
|
20373
|
-
catalog: services.container.resolve(Tokens.IResourceCatalogClientProxy),
|
|
20374
|
-
importer: services.container.resolve(Tokens.IImportResourceHelper)
|
|
20375
|
-
};
|
|
20376
|
-
}
|
|
20377
|
-
async function findCatalogEntityAsync(catalog, query, match) {
|
|
20378
|
-
let pageCursor;
|
|
20379
|
-
do {
|
|
20380
|
-
const page = await catalog.searchFolderEntities({
|
|
20381
|
-
...query,
|
|
20382
|
-
pageSize: 100,
|
|
20383
|
-
pageCursor
|
|
20384
|
-
});
|
|
20385
|
-
const found = (page.items ?? []).find(match);
|
|
20386
|
-
if (found) {
|
|
20387
|
-
return found;
|
|
20388
|
-
}
|
|
20389
|
-
pageCursor = page.nextPage ?? undefined;
|
|
20390
|
-
} while (pageCursor);
|
|
20391
|
-
return;
|
|
20392
|
-
}
|
|
20393
|
-
async function findCatalogEntitiesAsync(catalog, query, match) {
|
|
20394
|
-
const found = [];
|
|
20395
|
-
let pageCursor;
|
|
20396
|
-
do {
|
|
20397
|
-
const page = await catalog.searchFolderEntities({
|
|
20398
|
-
...query,
|
|
20399
|
-
pageSize: 100,
|
|
20400
|
-
pageCursor
|
|
20401
|
-
});
|
|
20402
|
-
found.push(...(page.items ?? []).filter(match));
|
|
20403
|
-
pageCursor = page.nextPage ?? undefined;
|
|
20404
|
-
} while (pageCursor);
|
|
20405
|
-
return found;
|
|
20406
|
-
}
|
|
20407
|
-
function toResourceReference(entity) {
|
|
20408
|
-
return toCatalogReference({
|
|
20409
|
-
kind: entity.entityType ?? "",
|
|
20410
|
-
type: entity.entitySubType ?? undefined,
|
|
20411
|
-
key: entity.entityKey ?? "",
|
|
20412
|
-
name: entity.entityName ?? undefined,
|
|
20413
|
-
folderPath: entity.fullyQualifiedName ?? undefined,
|
|
20414
|
-
folderKey: entity.folderKey ?? undefined
|
|
20415
|
-
});
|
|
20416
|
-
}
|
|
20417
|
-
function toCatalogReference(reference) {
|
|
20418
|
-
const { folderPath, folderKey, ...rest } = reference;
|
|
20419
|
-
return {
|
|
20420
|
-
...rest,
|
|
20421
|
-
folder: folderPath ? { fullyQualifiedName: folderPath, folderKey } : undefined
|
|
20422
|
-
};
|
|
20423
|
-
}
|
|
20424
|
-
async function exportResourceDefinitionAsync(importer, reference) {
|
|
20425
|
-
const [error, payload] = await catchError2(importer.exportResourceAsync(reference));
|
|
20426
|
-
if (error) {
|
|
20427
|
-
throw withExportStatus(error);
|
|
20428
|
-
}
|
|
20429
|
-
return payload.resourceDefinitions.find((d) => d.key === reference.key);
|
|
20430
|
-
}
|
|
20431
|
-
|
|
20432
|
-
class ResourceExportError extends Error {
|
|
20433
|
-
status;
|
|
20434
|
-
constructor(message, status, cause) {
|
|
20435
|
-
super(message, { cause });
|
|
20436
|
-
this.status = status;
|
|
20437
|
-
this.name = "ResourceExportError";
|
|
20438
|
-
}
|
|
20439
|
-
}
|
|
20440
|
-
function withExportStatus(error) {
|
|
20441
|
-
if (!(error instanceof Error) || !("exceptionData" in error)) {
|
|
20442
|
-
return error;
|
|
20443
|
-
}
|
|
20444
|
-
const data = error.exceptionData;
|
|
20445
|
-
const text = typeof data === "object" && data !== null ? data.errorMessage : undefined;
|
|
20446
|
-
const match = typeof text === "string" ? /^HTTP (\d{3})\b/.exec(text) : null;
|
|
20447
|
-
return match ? new ResourceExportError(error.message, Number(match[1]), error) : error;
|
|
20448
|
-
}
|
|
20449
|
-
function readSpecProperty(spec, name) {
|
|
20450
|
-
if (!spec) {
|
|
20451
|
-
return;
|
|
20452
|
-
}
|
|
20453
|
-
if (spec[name] !== undefined) {
|
|
20454
|
-
return spec[name];
|
|
20455
|
-
}
|
|
20456
|
-
const lower = name.toLowerCase();
|
|
20457
|
-
const key = Object.keys(spec).find((k) => k.toLowerCase() === lower);
|
|
20458
|
-
return key === undefined ? undefined : spec[key];
|
|
20459
|
-
}
|
|
20460
|
-
function readSpecEntryPoints(spec) {
|
|
20461
|
-
const entryPoints = parseJsonString(readSpecProperty(spec, "entryPoints"));
|
|
20462
|
-
if (!Array.isArray(entryPoints) || !entryPoints.every((entry) => entry !== null && typeof entry === "object")) {
|
|
20463
|
-
return;
|
|
20464
|
-
}
|
|
20465
|
-
return entryPoints.map((entry) => ({
|
|
20466
|
-
UniqueId: String(readSpecProperty(entry, "uniqueId") ?? ""),
|
|
20467
|
-
Path: String(readSpecProperty(entry, "path") ?? ""),
|
|
20468
|
-
DisplayName: String(readSpecProperty(entry, "displayName") ?? ""),
|
|
20469
|
-
InputArguments: readSpecProperty(entry, "inputArguments"),
|
|
20470
|
-
OutputArguments: readSpecProperty(entry, "outputArguments")
|
|
20471
|
-
}));
|
|
20472
|
-
}
|
|
20473
|
-
function parseJsonString(raw) {
|
|
20474
|
-
if (typeof raw !== "string") {
|
|
20475
|
-
return raw;
|
|
20476
|
-
}
|
|
20477
|
-
const [error, parsed] = catchError2(() => JSON.parse(raw));
|
|
20478
|
-
return error ? undefined : parsed;
|
|
20479
|
-
}
|
|
20480
20347
|
// ../solution-sdk/src/resources/services/resource-casing.ts
|
|
20481
20348
|
var RESOURCE_FILES_FOLDER_NAME2 = "resources";
|
|
20482
20349
|
function lowerFirstChar(value) {
|
|
@@ -20638,118 +20505,7 @@ function parseResourceHeader(content) {
|
|
|
20638
20505
|
return null;
|
|
20639
20506
|
}
|
|
20640
20507
|
}
|
|
20641
|
-
|
|
20642
|
-
var ROOT_RESOURCE_TYPES = new Set(["resource", "solutionresource"]);
|
|
20643
|
-
var KEY_NOT_FOUND = /^(?:Solution)?Resource with key '([^']+)' was not found$/i;
|
|
20644
|
-
function isResourceKeyNotFound(error, resourceKey) {
|
|
20645
|
-
if (!(error instanceof Error))
|
|
20646
|
-
return false;
|
|
20647
|
-
const typed = error;
|
|
20648
|
-
const sameKey = (key) => key !== undefined && key.toLowerCase() === resourceKey.toLowerCase();
|
|
20649
|
-
if (typeof typed.resourceType === "string" && typeof typed.resourceKey === "string") {
|
|
20650
|
-
return ROOT_RESOURCE_TYPES.has(typed.resourceType.toLowerCase()) && sameKey(typed.resourceKey);
|
|
20651
|
-
}
|
|
20652
|
-
return sameKey(KEY_NOT_FOUND.exec(error.message.trim())?.[1]);
|
|
20653
|
-
}
|
|
20654
|
-
async function refreshArtefactSpecsAsync(builder, configurations) {
|
|
20655
|
-
const resources = new Map;
|
|
20656
|
-
const [loadError, solution] = await catchError2(builder.context.loadAsync());
|
|
20657
|
-
if (loadError || !solution)
|
|
20658
|
-
return resources;
|
|
20659
|
-
for (const configuration of configurations) {
|
|
20660
|
-
const resource = solution.resources.find((r) => r.key === configuration?.key);
|
|
20661
|
-
if (!resource)
|
|
20662
|
-
continue;
|
|
20663
|
-
resources.set(resource.key, resource);
|
|
20664
|
-
if (!resource.projectKey)
|
|
20665
|
-
continue;
|
|
20666
|
-
configuration.spec = await applyEntryPointEnhancementAsync(builder.context, resource, configuration.spec ?? {});
|
|
20667
|
-
}
|
|
20668
|
-
return resources;
|
|
20669
|
-
}
|
|
20670
|
-
async function exportResourceConfigurationsAsync(services, resourceKey, hint = {}) {
|
|
20671
|
-
const { catalog, importer } = getRemoteResourceClients(services);
|
|
20672
|
-
const byKey = (item) => item.entityKey === resourceKey;
|
|
20673
|
-
const entity = (hint.name ? await findCatalogEntityAsync(catalog, { name: hint.name }, byKey) : undefined) ?? await findCatalogEntityAsync(catalog, {}, byKey);
|
|
20674
|
-
if (!entity) {
|
|
20675
|
-
throw new Error(`Resource '${resourceKey}' was not found in the solution or in the resource catalog`);
|
|
20676
|
-
}
|
|
20677
|
-
const payload = await importer.exportResourceAsync(toResourceReference(entity));
|
|
20678
|
-
const definitions = payload.resourceDefinitions ?? [];
|
|
20679
|
-
if (definitions.length === 0) {
|
|
20680
|
-
throw new Error(`FPS export for '${resourceKey}' returned no resource definitions`);
|
|
20681
|
-
}
|
|
20682
|
-
return {
|
|
20683
|
-
resources: definitions.map((d) => ({
|
|
20684
|
-
key: d.key ?? "",
|
|
20685
|
-
spec: d.spec ?? {},
|
|
20686
|
-
locks: d.locks ?? [],
|
|
20687
|
-
apiVersion: d.apiVersion,
|
|
20688
|
-
isOverridable: d.isOverridable,
|
|
20689
|
-
name: d.name ?? "",
|
|
20690
|
-
kind: d.kind ?? "",
|
|
20691
|
-
dependencies: (d.dependencies ?? []).map((dep) => ({
|
|
20692
|
-
kind: dep.kind ?? "",
|
|
20693
|
-
name: dep.name ?? ""
|
|
20694
|
-
}))
|
|
20695
|
-
}))
|
|
20696
|
-
};
|
|
20697
|
-
}
|
|
20698
|
-
async function readLocalAsync(builder, resourceKey, read) {
|
|
20699
|
-
if (!builder)
|
|
20700
|
-
return;
|
|
20701
|
-
const [error, value] = await catchError2(read(builder));
|
|
20702
|
-
if (!error)
|
|
20703
|
-
return { builder, value };
|
|
20704
|
-
if (isResourceKeyNotFound(error, resourceKey))
|
|
20705
|
-
return;
|
|
20706
|
-
throw error;
|
|
20707
|
-
}
|
|
20708
|
-
async function readResourceConfigurationsAsync(services, builder, resourceKey, hint = {}) {
|
|
20709
|
-
const local = await readLocalAsync(builder, resourceKey, (b) => b.getAllConfigurationsAsync(resourceKey));
|
|
20710
|
-
if (!local) {
|
|
20711
|
-
return exportResourceConfigurationsAsync(services, resourceKey, hint);
|
|
20712
|
-
}
|
|
20713
|
-
await refreshArtefactSpecsAsync(local.builder, local.value?.resources ?? []);
|
|
20714
|
-
return local.value;
|
|
20715
|
-
}
|
|
20716
|
-
async function readResourceConfigurationAsync(services, builder, resourceKey) {
|
|
20717
|
-
const local = await readLocalAsync(builder, resourceKey, (b) => b.getConfigurationAsync(resourceKey));
|
|
20718
|
-
if (local) {
|
|
20719
|
-
const configuration = local.value;
|
|
20720
|
-
const resources = await refreshArtefactSpecsAsync(local.builder, [
|
|
20721
|
-
configuration
|
|
20722
|
-
]);
|
|
20723
|
-
return { configuration, resource: resources.get(configuration.key) };
|
|
20724
|
-
}
|
|
20725
|
-
const { resources } = await exportResourceConfigurationsAsync(services, resourceKey);
|
|
20726
|
-
const primary = resources.find((r) => r.key === resourceKey) ?? resources[0];
|
|
20727
|
-
const { key, spec, locks, apiVersion, isOverridable } = primary;
|
|
20728
|
-
return { configuration: { key, spec, locks, apiVersion, isOverridable } };
|
|
20729
|
-
}
|
|
20730
|
-
// ../solution-sdk/src/resources/services/resource-lookup.ts
|
|
20731
|
-
async function findResourcesByNameAsync(services, builder, { kind, name, subTypes, folderKey }) {
|
|
20732
|
-
const same = (a, b) => (a ?? "").toLowerCase() === b.toLowerCase();
|
|
20733
|
-
const ofSubType = (type) => subTypes === undefined || subTypes.some((t) => same(type, t));
|
|
20734
|
-
if (builder) {
|
|
20735
|
-
const solution = await builder.context.loadAsync();
|
|
20736
|
-
const local = solution.resources.filter((r) => same(r.kind, kind) && same(r.name, name) && ofSubType(r.type)).map((r) => ({
|
|
20737
|
-
key: r.key,
|
|
20738
|
-
local: true,
|
|
20739
|
-
folderPath: r.folders?.[0]?.fullyQualifiedName
|
|
20740
|
-
}));
|
|
20741
|
-
if (local.length > 0)
|
|
20742
|
-
return local;
|
|
20743
|
-
}
|
|
20744
|
-
const { catalog } = getRemoteResourceClients(services);
|
|
20745
|
-
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)));
|
|
20746
|
-
return rows.map((row) => ({
|
|
20747
|
-
key: row.entityKey ?? "",
|
|
20748
|
-
local: false,
|
|
20749
|
-
folderPath: row.fullyQualifiedName ?? undefined,
|
|
20750
|
-
folderKey: row.folderKey ?? undefined
|
|
20751
|
-
}));
|
|
20752
|
-
}
|
|
20508
|
+
|
|
20753
20509
|
// ../solution-sdk/src/resources/services/sync-resources-from-bindings.ts
|
|
20754
20510
|
var TYPE_IS_IDENTITY_REPLACE_OPTIONS = new Set([
|
|
20755
20511
|
"SameType",
|
|
@@ -20850,16 +20606,68 @@ function sameResourceSubtype(a, b) {
|
|
|
20850
20606
|
function findSubtypeEntry(list, type) {
|
|
20851
20607
|
return list.find((r) => !!r.type && sameResourceSubtype(r.type, type));
|
|
20852
20608
|
}
|
|
20853
|
-
|
|
20854
|
-
|
|
20855
|
-
|
|
20856
|
-
|
|
20857
|
-
|
|
20858
|
-
|
|
20859
|
-
|
|
20860
|
-
|
|
20861
|
-
|
|
20862
|
-
return
|
|
20609
|
+
var SUBTYPED_BINDING_KINDS = new Set([
|
|
20610
|
+
"asset",
|
|
20611
|
+
"bucket"
|
|
20612
|
+
]);
|
|
20613
|
+
function metadataString(metadata, name) {
|
|
20614
|
+
if (!metadata || typeof metadata !== "object")
|
|
20615
|
+
return;
|
|
20616
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
20617
|
+
if (key.toLowerCase() === name.toLowerCase() && typeof value === "string" && value.trim() !== "") {
|
|
20618
|
+
return value;
|
|
20619
|
+
}
|
|
20620
|
+
}
|
|
20621
|
+
return;
|
|
20622
|
+
}
|
|
20623
|
+
function declaredSubTypes(decoded, resources) {
|
|
20624
|
+
const subTypes = new Map;
|
|
20625
|
+
let document;
|
|
20626
|
+
try {
|
|
20627
|
+
document = JSON.parse(decoded);
|
|
20628
|
+
} catch {
|
|
20629
|
+
return subTypes;
|
|
20630
|
+
}
|
|
20631
|
+
const entries = document?.resources;
|
|
20632
|
+
if (!Array.isArray(entries))
|
|
20633
|
+
return subTypes;
|
|
20634
|
+
const byBinding = new Map;
|
|
20635
|
+
for (const entry of entries) {
|
|
20636
|
+
if (!entry || typeof entry !== "object")
|
|
20637
|
+
continue;
|
|
20638
|
+
const { resource, key, metadata } = entry;
|
|
20639
|
+
if (typeof resource !== "string" || typeof key !== "string" || !SUBTYPED_BINDING_KINDS.has(resource.toLowerCase())) {
|
|
20640
|
+
continue;
|
|
20641
|
+
}
|
|
20642
|
+
const subType = metadataString(metadata, "SubType");
|
|
20643
|
+
if (subType)
|
|
20644
|
+
byBinding.set(`${resource}\x00${key}`, subType);
|
|
20645
|
+
}
|
|
20646
|
+
for (const resource of resources) {
|
|
20647
|
+
const subType = byBinding.get(`${resource.originalResourceType}\x00${resource.bindingKey ?? ""}`);
|
|
20648
|
+
if (subType)
|
|
20649
|
+
subTypes.set(resource, subType);
|
|
20650
|
+
}
|
|
20651
|
+
return subTypes;
|
|
20652
|
+
}
|
|
20653
|
+
async function resolveDeclaredKindMetadata(resolveKindMetadata, kind, type, declaredSubType) {
|
|
20654
|
+
if (type === undefined && declaredSubType !== undefined) {
|
|
20655
|
+
const declared = await resolveKindMetadata(kind, declaredSubType);
|
|
20656
|
+
if (declared?.typeMatched)
|
|
20657
|
+
return declared;
|
|
20658
|
+
}
|
|
20659
|
+
return resolveKindMetadata(kind, type);
|
|
20660
|
+
}
|
|
20661
|
+
function resolveBindingResourceIdentity(binding) {
|
|
20662
|
+
switch (binding.resourceType) {
|
|
20663
|
+
case models_BindingsResourceType.TimeTrigger:
|
|
20664
|
+
return { kind: "trigger", type: "timeTrigger" };
|
|
20665
|
+
case models_BindingsResourceType.AppsTrigger:
|
|
20666
|
+
return {
|
|
20667
|
+
kind: lowerFirstChar(getResourceKindForBinding(binding.resourceType))
|
|
20668
|
+
};
|
|
20669
|
+
default:
|
|
20670
|
+
return {
|
|
20863
20671
|
kind: lowerFirstChar(getResourceKindForBinding(binding.resourceType))
|
|
20864
20672
|
};
|
|
20865
20673
|
}
|
|
@@ -20886,7 +20694,11 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
20886
20694
|
return result;
|
|
20887
20695
|
}
|
|
20888
20696
|
const serializer = services.container.resolve(Tokens.IBindingsMetadataSerializer);
|
|
20889
|
-
const {
|
|
20697
|
+
const {
|
|
20698
|
+
bindings: allBindings,
|
|
20699
|
+
parseErrors,
|
|
20700
|
+
subTypes
|
|
20701
|
+
} = await collectBindings(bindingsJsonFallbackDirs, serializer, bindingSources(solutionDir, paths, uipxProjects, projectBindings));
|
|
20890
20702
|
if (parseErrors.length > 0) {
|
|
20891
20703
|
const detail = parseErrors.map((e) => `${e.path}: ${e.reason}`).join("; ");
|
|
20892
20704
|
throw new Error(`Invalid bindings file — ${detail}`);
|
|
@@ -20924,7 +20736,29 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
20924
20736
|
const resolvedKeys = new Set;
|
|
20925
20737
|
const overwrittenKeys = new Set;
|
|
20926
20738
|
const bindingKey = (kind, name) => `${kind}:${name ?? ""}`.toLowerCase();
|
|
20927
|
-
const
|
|
20739
|
+
const anyFolderSelfProvisioned = new Set;
|
|
20740
|
+
const solutionFolderSelfProvisioned = new Set;
|
|
20741
|
+
for (const r of selfProvisioned ?? []) {
|
|
20742
|
+
(r.solutionFolderOnly ? solutionFolderSelfProvisioned : anyFolderSelfProvisioned).add(bindingKey(r.kind, r.name));
|
|
20743
|
+
}
|
|
20744
|
+
const isSelfProvisioned = (kind, name, folderPath) => {
|
|
20745
|
+
const key = bindingKey(kind, name);
|
|
20746
|
+
return anyFolderSelfProvisioned.has(key) || !normalizeFolderPath(folderPath) && solutionFolderSelfProvisioned.has(key);
|
|
20747
|
+
};
|
|
20748
|
+
const importedThisRun = new Set;
|
|
20749
|
+
let referencedKeys;
|
|
20750
|
+
const coveringResource = async (resources, kind, name, folderPath, selfProvisioned) => {
|
|
20751
|
+
const match = findMatchingLocalResource(resources, kind, name, folderPath);
|
|
20752
|
+
if (!match || !selfProvisioned)
|
|
20753
|
+
return match;
|
|
20754
|
+
referencedKeys ??= readReferencedResourceKeys(services, builder);
|
|
20755
|
+
const referenced = await referencedKeys;
|
|
20756
|
+
const owned = resources.filter((r) => {
|
|
20757
|
+
const key = r.key?.toLowerCase();
|
|
20758
|
+
return !key || !importedThisRun.has(key) && !referenced.has(key);
|
|
20759
|
+
});
|
|
20760
|
+
return findMatchingLocalResource(owned, kind, name, folderPath);
|
|
20761
|
+
};
|
|
20928
20762
|
const recordUnchecked = async (error, kind, name, directCloudKey) => {
|
|
20929
20763
|
if (error) {
|
|
20930
20764
|
const failure = classifyCatalogFailure(error);
|
|
@@ -20952,7 +20786,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
20952
20786
|
continue;
|
|
20953
20787
|
}
|
|
20954
20788
|
const isConnection = isConnectionBinding(binding);
|
|
20955
|
-
const metadata = await resolveKindMetadata
|
|
20789
|
+
const metadata = await resolveDeclaredKindMetadata(resolveKindMetadata, kind, identity.type, subTypes.get(binding));
|
|
20956
20790
|
const name = getResourceName(binding);
|
|
20957
20791
|
const folderPath = getFolderPathProperty(binding).defaultValue;
|
|
20958
20792
|
const directCloudKey = isConnection ? getConnectionKey(binding) : undefined;
|
|
@@ -20962,7 +20796,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
20962
20796
|
if (!isConnection && !name) {
|
|
20963
20797
|
continue;
|
|
20964
20798
|
}
|
|
20965
|
-
|
|
20799
|
+
const selfProvisioned = !isConnection && isSelfProvisioned(kind, name, folderPath);
|
|
20800
|
+
if (!isConnection && !normalizeFolderPath(folderPath) && await coveringResource(solution.resources ?? [], kind, name, folderPath, selfProvisioned)) {
|
|
20966
20801
|
result.skipped++;
|
|
20967
20802
|
logger.info(`Skipping ${kind} "${name}" — an in-solution resource already covers this solution-relative binding`);
|
|
20968
20803
|
continue;
|
|
@@ -20972,7 +20807,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
20972
20807
|
logger.info(`Skipping ${kind} "${name}" — the solution provisions this project itself; its member declaration covers the binding`);
|
|
20973
20808
|
continue;
|
|
20974
20809
|
}
|
|
20975
|
-
if (
|
|
20810
|
+
if (selfProvisioned) {
|
|
20976
20811
|
virtualCandidates.push({
|
|
20977
20812
|
binding,
|
|
20978
20813
|
kind,
|
|
@@ -20980,7 +20815,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
20980
20815
|
metadata,
|
|
20981
20816
|
name,
|
|
20982
20817
|
folderPath,
|
|
20983
|
-
catalogMiss: false
|
|
20818
|
+
catalogMiss: false,
|
|
20819
|
+
selfProvisioned
|
|
20984
20820
|
});
|
|
20985
20821
|
continue;
|
|
20986
20822
|
}
|
|
@@ -21003,7 +20839,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
21003
20839
|
metadata,
|
|
21004
20840
|
name,
|
|
21005
20841
|
folderPath,
|
|
21006
|
-
catalogMiss: true
|
|
20842
|
+
catalogMiss: true,
|
|
20843
|
+
selfProvisioned: false
|
|
21007
20844
|
});
|
|
21008
20845
|
continue;
|
|
21009
20846
|
}
|
|
@@ -21032,6 +20869,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
21032
20869
|
if (rcsMatch.key) {
|
|
21033
20870
|
knownResourceKeys.add(rcsMatch.key.toLowerCase());
|
|
21034
20871
|
overwrittenKeys.add(rcsMatch.key.toLowerCase());
|
|
20872
|
+
importedThisRun.add(rcsMatch.key.toLowerCase());
|
|
21035
20873
|
}
|
|
21036
20874
|
result.imported++;
|
|
21037
20875
|
logger.info(`Imported ${kind} "${rcsMatch.name}" (key: ${rcsMatch.key}) into solution`);
|
|
@@ -21058,7 +20896,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
21058
20896
|
metadata,
|
|
21059
20897
|
name,
|
|
21060
20898
|
folderPath,
|
|
21061
|
-
catalogMiss: false
|
|
20899
|
+
catalogMiss: false,
|
|
20900
|
+
selfProvisioned: false
|
|
21062
20901
|
});
|
|
21063
20902
|
}
|
|
21064
20903
|
const virtualCandidatesSeen = new Set;
|
|
@@ -21070,7 +20909,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
|
|
|
21070
20909
|
return true;
|
|
21071
20910
|
});
|
|
21072
20911
|
for (const candidate of dedupedVirtuals) {
|
|
21073
|
-
const [syncError, created] = await catchError2(createVirtualForBinding(builder, candidate.binding, candidate.kind, candidate.type, candidate.metadata, candidate.name, candidate.folderPath, result, candidate.catalogMiss));
|
|
20912
|
+
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)));
|
|
21074
20913
|
if (syncError) {
|
|
21075
20914
|
logger.warn(`Failed to create virtual ${candidate.kind}/${candidate.name}: ${syncError.message}`);
|
|
21076
20915
|
} else if (created) {
|
|
@@ -21149,6 +20988,16 @@ async function reportOrphanedDeclarations(services, builder, bindings, result) {
|
|
|
21149
20988
|
logger.warn(warning);
|
|
21150
20989
|
}
|
|
21151
20990
|
}
|
|
20991
|
+
async function readReferencedResourceKeys(services, builder) {
|
|
20992
|
+
const overwrites = services.container.resolve(Tokens.IResourceOverwritesService);
|
|
20993
|
+
const [error, entries] = await catchError2(overwrites.getTenantResourceOverwritesAsync(builder.context));
|
|
20994
|
+
if (error) {
|
|
20995
|
+
logger.debug(`Could not read the resource overwrites, so no root resource is known to be an import: ${error.message}`);
|
|
20996
|
+
return new Set;
|
|
20997
|
+
}
|
|
20998
|
+
return new Set(entries.filter((e) => String(e.overwrite?.type) === REFERENCE_OVERWRITE).map((e) => e.solutionResourceKey.toLowerCase()));
|
|
20999
|
+
}
|
|
21000
|
+
var REFERENCE_OVERWRITE = "Reference";
|
|
21152
21001
|
async function isUncheckedBindingCovered(builder, knownResourceKeys, kind, name, directCloudKey) {
|
|
21153
21002
|
if (directCloudKey) {
|
|
21154
21003
|
return knownResourceKeys.has(directCloudKey.toLowerCase());
|
|
@@ -21248,10 +21097,10 @@ async function mintVirtualResource(builder, kind, type, name, metadata) {
|
|
|
21248
21097
|
}
|
|
21249
21098
|
return { resource, finalName: uniqueName };
|
|
21250
21099
|
}
|
|
21251
|
-
async function createVirtualForBinding(builder, _binding, kind, type, metadata, name, folderPath, result, catalogMiss) {
|
|
21100
|
+
async function createVirtualForBinding(builder, _binding, kind, type, metadata, name, folderPath, result, catalogMiss, findCovering) {
|
|
21252
21101
|
const virtualizable = metadata?.virtualizable ?? false;
|
|
21253
21102
|
const preLoadSolution = await builder.context.loadAsync();
|
|
21254
|
-
const alreadyVirtualized =
|
|
21103
|
+
const alreadyVirtualized = await findCovering(preLoadSolution.resources);
|
|
21255
21104
|
if (alreadyVirtualized) {
|
|
21256
21105
|
result.skipped++;
|
|
21257
21106
|
logger.info(`Skipping virtual ${kind} "${name}" — existing resource "${alreadyVirtualized.name}" in solution_folder already covers this binding (requested folder "${folderPath}")`);
|
|
@@ -21313,6 +21162,35 @@ async function findResourceByKeyInRcs(builder, kind, expectedKey, folderPath, pr
|
|
|
21313
21162
|
}
|
|
21314
21163
|
return;
|
|
21315
21164
|
}
|
|
21165
|
+
async function findResourcesByKeysInRcs(builder, kind, keys) {
|
|
21166
|
+
const wanted = new Set([...keys].map((key) => key.toLowerCase()));
|
|
21167
|
+
const found = new Map;
|
|
21168
|
+
let pageCursor;
|
|
21169
|
+
while (found.size < wanted.size) {
|
|
21170
|
+
const result = await builder.searchResourcesAsync(kind, undefined, undefined, pageCursor, 100, undefined, false);
|
|
21171
|
+
for (const folderResources of result.availableResources) {
|
|
21172
|
+
for (const resource of folderResources.resources) {
|
|
21173
|
+
const key = resource.key.toLowerCase();
|
|
21174
|
+
if (!wanted.has(key) || found.has(key))
|
|
21175
|
+
continue;
|
|
21176
|
+
found.set(key, {
|
|
21177
|
+
key: resource.key,
|
|
21178
|
+
name: resource.name,
|
|
21179
|
+
type: resource.type,
|
|
21180
|
+
folder: {
|
|
21181
|
+
fullyQualifiedName: folderResources.fullyQualifiedName,
|
|
21182
|
+
folderKey: folderResources.key,
|
|
21183
|
+
path: folderResources.path
|
|
21184
|
+
}
|
|
21185
|
+
});
|
|
21186
|
+
}
|
|
21187
|
+
}
|
|
21188
|
+
pageCursor = result.nextPage;
|
|
21189
|
+
if (!pageCursor)
|
|
21190
|
+
break;
|
|
21191
|
+
}
|
|
21192
|
+
return found;
|
|
21193
|
+
}
|
|
21316
21194
|
async function searchRcsResources(builder, kind, name) {
|
|
21317
21195
|
const [searchError, matches] = await catchError2(searchRcsResourcesStrict(builder, kind, name));
|
|
21318
21196
|
if (searchError) {
|
|
@@ -21553,6 +21431,17 @@ async function collectBindings(bindingsJsonFallbackDirs, serializer, sources) {
|
|
|
21553
21431
|
const fs = getFileSystem2();
|
|
21554
21432
|
const allBindings = [];
|
|
21555
21433
|
const parseErrors = [];
|
|
21434
|
+
const subTypes = new Map;
|
|
21435
|
+
const collect = (parsed) => {
|
|
21436
|
+
if ("error" in parsed) {
|
|
21437
|
+
parseErrors.push(parsed.error);
|
|
21438
|
+
return;
|
|
21439
|
+
}
|
|
21440
|
+
allBindings.push(...parsed.resources);
|
|
21441
|
+
for (const [binding, subType] of parsed.subTypes) {
|
|
21442
|
+
subTypes.set(binding, subType);
|
|
21443
|
+
}
|
|
21444
|
+
};
|
|
21556
21445
|
for (const { directory: dir, contribution } of sources) {
|
|
21557
21446
|
if (contribution) {
|
|
21558
21447
|
if (contribution.bindings.length === 0)
|
|
@@ -21561,10 +21450,7 @@ async function collectBindings(bindingsJsonFallbackDirs, serializer, sources) {
|
|
|
21561
21450
|
version: "2.0",
|
|
21562
21451
|
resources: contribution.bindings
|
|
21563
21452
|
}), `${dir} (bindings contributed by the project's tool; project ${contribution.projectId})`, serializer);
|
|
21564
|
-
|
|
21565
|
-
parseErrors.push(parsed.error);
|
|
21566
|
-
else
|
|
21567
|
-
allBindings.push(...parsed.resources);
|
|
21453
|
+
collect(parsed);
|
|
21568
21454
|
continue;
|
|
21569
21455
|
}
|
|
21570
21456
|
const v2Path = fs.path.join(dir, "bindings_v2.json");
|
|
@@ -21585,13 +21471,9 @@ async function collectBindings(bindingsJsonFallbackDirs, serializer, sources) {
|
|
|
21585
21471
|
});
|
|
21586
21472
|
continue;
|
|
21587
21473
|
}
|
|
21588
|
-
|
|
21589
|
-
if ("error" in parsed)
|
|
21590
|
-
parseErrors.push(parsed.error);
|
|
21591
|
-
else
|
|
21592
|
-
allBindings.push(...parsed.resources);
|
|
21474
|
+
collect(deserializeBindings(new TextDecoder().decode(content), bindingsPath, serializer));
|
|
21593
21475
|
}
|
|
21594
|
-
return { bindings: allBindings, parseErrors };
|
|
21476
|
+
return { bindings: allBindings, parseErrors, subTypes };
|
|
21595
21477
|
}
|
|
21596
21478
|
function deserializeBindings(decoded, source, serializer) {
|
|
21597
21479
|
let success;
|
|
@@ -21616,7 +21498,8 @@ function deserializeBindings(decoded, source, serializer) {
|
|
|
21616
21498
|
}
|
|
21617
21499
|
};
|
|
21618
21500
|
}
|
|
21619
|
-
|
|
21501
|
+
const resources = metadata?.resources ?? [];
|
|
21502
|
+
return { resources, subTypes: declaredSubTypes(decoded, resources) };
|
|
21620
21503
|
}
|
|
21621
21504
|
async function syncAndLog(solutionDir, projectSubTypes, options) {
|
|
21622
21505
|
const [syncError, syncResult] = await catchError2(syncResourcesFromBindings(solutionDir, undefined, projectSubTypes, options?.projectBindings, options?.selfProvisioned));
|
|
@@ -21637,6 +21520,315 @@ async function syncAndLog(solutionDir, projectSubTypes, options) {
|
|
|
21637
21520
|
}
|
|
21638
21521
|
}
|
|
21639
21522
|
|
|
21523
|
+
// ../solution-sdk/src/resources/services/imported-resources.ts
|
|
21524
|
+
var REFERENCE_OVERWRITE2 = "Reference";
|
|
21525
|
+
async function resolveImportedResourcesAsync(services, builder, resources) {
|
|
21526
|
+
const overwrites = await services.container.resolve(Tokens.IResourceOverwritesService).getTenantResourceOverwritesAsync(builder.context);
|
|
21527
|
+
const tenantNames = new Map;
|
|
21528
|
+
for (const entry of overwrites) {
|
|
21529
|
+
if (String(entry.overwrite?.type) !== REFERENCE_OVERWRITE2)
|
|
21530
|
+
continue;
|
|
21531
|
+
tenantNames.set(entry.solutionResourceKey.toLowerCase(), entry.overwrite?.resourceName || undefined);
|
|
21532
|
+
}
|
|
21533
|
+
const resolved = new Map;
|
|
21534
|
+
const unresolved = new Map;
|
|
21535
|
+
const unchecked = new Set;
|
|
21536
|
+
const byKind = new Map;
|
|
21537
|
+
for (const resource of resources) {
|
|
21538
|
+
const key = resource.key?.toLowerCase();
|
|
21539
|
+
if (!key)
|
|
21540
|
+
continue;
|
|
21541
|
+
if (normalizeFolderPath(resource.folders?.[0]?.fullyQualifiedName)) {
|
|
21542
|
+
continue;
|
|
21543
|
+
}
|
|
21544
|
+
const recorded = tenantNames.has(key);
|
|
21545
|
+
if (!recorded && resource.isArtefactResource)
|
|
21546
|
+
continue;
|
|
21547
|
+
const kind = resource.kind ?? "";
|
|
21548
|
+
byKind.set(kind, [...byKind.get(kind) ?? [], { key, recorded }]);
|
|
21549
|
+
}
|
|
21550
|
+
const reportFailed = (entries, reason) => {
|
|
21551
|
+
for (const { key, recorded } of entries) {
|
|
21552
|
+
if (recorded)
|
|
21553
|
+
unresolved.set(key, reason);
|
|
21554
|
+
else
|
|
21555
|
+
unchecked.add(key);
|
|
21556
|
+
}
|
|
21557
|
+
};
|
|
21558
|
+
let failure;
|
|
21559
|
+
for (const [kind, entries] of byKind) {
|
|
21560
|
+
if (failure) {
|
|
21561
|
+
reportFailed(entries, failure);
|
|
21562
|
+
continue;
|
|
21563
|
+
}
|
|
21564
|
+
const [error, matches] = await catchError2(findResourcesByKeysInRcs(builder, kind, entries.map((entry) => entry.key)));
|
|
21565
|
+
if (error) {
|
|
21566
|
+
const reason = `the Resource Catalog could not be searched: ${error.message}`;
|
|
21567
|
+
reportFailed(entries, reason);
|
|
21568
|
+
if (stopsCatalogLookups(classifyCatalogFailure(error))) {
|
|
21569
|
+
failure = reason;
|
|
21570
|
+
}
|
|
21571
|
+
continue;
|
|
21572
|
+
}
|
|
21573
|
+
for (const { key, recorded } of entries) {
|
|
21574
|
+
const match = matches.get(key);
|
|
21575
|
+
if (match?.folder?.fullyQualifiedName) {
|
|
21576
|
+
resolved.set(key, {
|
|
21577
|
+
name: tenantNames.get(key) ?? match.name,
|
|
21578
|
+
folderPath: match.folder.fullyQualifiedName
|
|
21579
|
+
});
|
|
21580
|
+
} else if (recorded) {
|
|
21581
|
+
unresolved.set(key, "the Resource Catalog no longer lists it");
|
|
21582
|
+
}
|
|
21583
|
+
}
|
|
21584
|
+
}
|
|
21585
|
+
return { resolved, unresolved, unchecked };
|
|
21586
|
+
}
|
|
21587
|
+
// ../solution-sdk/src/resources/services/project-artifacts-service.ts
|
|
21588
|
+
async function addProjectArtifactsToSolutionAsync(options) {
|
|
21589
|
+
const error = await createProjectInSolutionBuilder(options.solutionDir, options.projectId, options.projectName, normalizeProjectType(options.projectType), options.projectSubType);
|
|
21590
|
+
return error ? artifactFailure(options, error) : { Created: true };
|
|
21591
|
+
}
|
|
21592
|
+
function artifactFailure(options, error) {
|
|
21593
|
+
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.");
|
|
21594
|
+
return { Created: false, Error: error.message };
|
|
21595
|
+
}
|
|
21596
|
+
// ../solution-sdk/src/resources/services/project-template-types.ts
|
|
21597
|
+
var reader;
|
|
21598
|
+
function hasBareTemplateRow(projectType) {
|
|
21599
|
+
reader ??= new EmbeddedProjectConfigurationReader;
|
|
21600
|
+
return reader.getTemplateResourcesByType(projectType, undefined, false).length > 0;
|
|
21601
|
+
}
|
|
21602
|
+
function hasAnyTemplateRow(projectType) {
|
|
21603
|
+
reader ??= new EmbeddedProjectConfigurationReader;
|
|
21604
|
+
const wanted = projectType.toLowerCase();
|
|
21605
|
+
return Object.keys(reader.getAll()).some((row) => {
|
|
21606
|
+
const key = row.toLowerCase();
|
|
21607
|
+
return key === wanted || key.startsWith(`${wanted}_`);
|
|
21608
|
+
});
|
|
21609
|
+
}
|
|
21610
|
+
// ../solution-sdk/src/resources/services/remote-resources.ts
|
|
21611
|
+
function getRemoteResourceClients(services) {
|
|
21612
|
+
return {
|
|
21613
|
+
catalog: services.container.resolve(Tokens.IResourceCatalogClientProxy),
|
|
21614
|
+
importer: services.container.resolve(Tokens.IImportResourceHelper)
|
|
21615
|
+
};
|
|
21616
|
+
}
|
|
21617
|
+
async function findCatalogEntityAsync(catalog, query, match) {
|
|
21618
|
+
let pageCursor;
|
|
21619
|
+
do {
|
|
21620
|
+
const page = await catalog.searchFolderEntities({
|
|
21621
|
+
...query,
|
|
21622
|
+
pageSize: 100,
|
|
21623
|
+
pageCursor
|
|
21624
|
+
});
|
|
21625
|
+
const found = (page.items ?? []).find(match);
|
|
21626
|
+
if (found) {
|
|
21627
|
+
return found;
|
|
21628
|
+
}
|
|
21629
|
+
pageCursor = page.nextPage ?? undefined;
|
|
21630
|
+
} while (pageCursor);
|
|
21631
|
+
return;
|
|
21632
|
+
}
|
|
21633
|
+
async function findCatalogEntitiesAsync(catalog, query, match) {
|
|
21634
|
+
const found = [];
|
|
21635
|
+
let pageCursor;
|
|
21636
|
+
do {
|
|
21637
|
+
const page = await catalog.searchFolderEntities({
|
|
21638
|
+
...query,
|
|
21639
|
+
pageSize: 100,
|
|
21640
|
+
pageCursor
|
|
21641
|
+
});
|
|
21642
|
+
found.push(...(page.items ?? []).filter(match));
|
|
21643
|
+
pageCursor = page.nextPage ?? undefined;
|
|
21644
|
+
} while (pageCursor);
|
|
21645
|
+
return found;
|
|
21646
|
+
}
|
|
21647
|
+
function toResourceReference(entity) {
|
|
21648
|
+
return toCatalogReference({
|
|
21649
|
+
kind: entity.entityType ?? "",
|
|
21650
|
+
type: entity.entitySubType ?? undefined,
|
|
21651
|
+
key: entity.entityKey ?? "",
|
|
21652
|
+
name: entity.entityName ?? undefined,
|
|
21653
|
+
folderPath: entity.fullyQualifiedName ?? undefined,
|
|
21654
|
+
folderKey: entity.folderKey ?? undefined
|
|
21655
|
+
});
|
|
21656
|
+
}
|
|
21657
|
+
function toCatalogReference(reference) {
|
|
21658
|
+
const { folderPath, folderKey, ...rest } = reference;
|
|
21659
|
+
return {
|
|
21660
|
+
...rest,
|
|
21661
|
+
folder: folderPath ? { fullyQualifiedName: folderPath, folderKey } : undefined
|
|
21662
|
+
};
|
|
21663
|
+
}
|
|
21664
|
+
async function exportResourceDefinitionAsync(importer, reference) {
|
|
21665
|
+
const [error, payload] = await catchError2(importer.exportResourceAsync(reference));
|
|
21666
|
+
if (error) {
|
|
21667
|
+
throw withExportStatus(error);
|
|
21668
|
+
}
|
|
21669
|
+
return payload.resourceDefinitions.find((d) => d.key === reference.key);
|
|
21670
|
+
}
|
|
21671
|
+
|
|
21672
|
+
class ResourceExportError extends Error {
|
|
21673
|
+
status;
|
|
21674
|
+
constructor(message, status, cause) {
|
|
21675
|
+
super(message, { cause });
|
|
21676
|
+
this.status = status;
|
|
21677
|
+
this.name = "ResourceExportError";
|
|
21678
|
+
}
|
|
21679
|
+
}
|
|
21680
|
+
function withExportStatus(error) {
|
|
21681
|
+
if (!(error instanceof Error) || !("exceptionData" in error)) {
|
|
21682
|
+
return error;
|
|
21683
|
+
}
|
|
21684
|
+
const data = error.exceptionData;
|
|
21685
|
+
const text = typeof data === "object" && data !== null ? data.errorMessage : undefined;
|
|
21686
|
+
const match = typeof text === "string" ? /^HTTP (\d{3})\b/.exec(text) : null;
|
|
21687
|
+
return match ? new ResourceExportError(error.message, Number(match[1]), error) : error;
|
|
21688
|
+
}
|
|
21689
|
+
function readSpecProperty(spec, name) {
|
|
21690
|
+
if (!spec) {
|
|
21691
|
+
return;
|
|
21692
|
+
}
|
|
21693
|
+
if (spec[name] !== undefined) {
|
|
21694
|
+
return spec[name];
|
|
21695
|
+
}
|
|
21696
|
+
const lower = name.toLowerCase();
|
|
21697
|
+
const key = Object.keys(spec).find((k) => k.toLowerCase() === lower);
|
|
21698
|
+
return key === undefined ? undefined : spec[key];
|
|
21699
|
+
}
|
|
21700
|
+
function readSpecEntryPoints(spec) {
|
|
21701
|
+
const entryPoints = parseJsonString(readSpecProperty(spec, "entryPoints"));
|
|
21702
|
+
if (!Array.isArray(entryPoints) || !entryPoints.every((entry) => entry !== null && typeof entry === "object")) {
|
|
21703
|
+
return;
|
|
21704
|
+
}
|
|
21705
|
+
return entryPoints.map((entry) => ({
|
|
21706
|
+
UniqueId: String(readSpecProperty(entry, "uniqueId") ?? ""),
|
|
21707
|
+
Path: String(readSpecProperty(entry, "path") ?? ""),
|
|
21708
|
+
DisplayName: String(readSpecProperty(entry, "displayName") ?? ""),
|
|
21709
|
+
InputArguments: readSpecProperty(entry, "inputArguments"),
|
|
21710
|
+
OutputArguments: readSpecProperty(entry, "outputArguments")
|
|
21711
|
+
}));
|
|
21712
|
+
}
|
|
21713
|
+
function parseJsonString(raw) {
|
|
21714
|
+
if (typeof raw !== "string") {
|
|
21715
|
+
return raw;
|
|
21716
|
+
}
|
|
21717
|
+
const [error, parsed] = catchError2(() => JSON.parse(raw));
|
|
21718
|
+
return error ? undefined : parsed;
|
|
21719
|
+
}
|
|
21720
|
+
// ../solution-sdk/src/resources/services/resource-configurations.ts
|
|
21721
|
+
var ROOT_RESOURCE_TYPES = new Set(["resource", "solutionresource"]);
|
|
21722
|
+
var KEY_NOT_FOUND = /^(?:Solution)?Resource with key '([^']+)' was not found$/i;
|
|
21723
|
+
function isResourceKeyNotFound(error, resourceKey) {
|
|
21724
|
+
if (!(error instanceof Error))
|
|
21725
|
+
return false;
|
|
21726
|
+
const typed = error;
|
|
21727
|
+
const sameKey = (key) => key !== undefined && key.toLowerCase() === resourceKey.toLowerCase();
|
|
21728
|
+
if (typeof typed.resourceType === "string" && typeof typed.resourceKey === "string") {
|
|
21729
|
+
return ROOT_RESOURCE_TYPES.has(typed.resourceType.toLowerCase()) && sameKey(typed.resourceKey);
|
|
21730
|
+
}
|
|
21731
|
+
return sameKey(KEY_NOT_FOUND.exec(error.message.trim())?.[1]);
|
|
21732
|
+
}
|
|
21733
|
+
async function refreshArtefactSpecsAsync(builder, configurations) {
|
|
21734
|
+
const resources = new Map;
|
|
21735
|
+
const [loadError, solution] = await catchError2(builder.context.loadAsync());
|
|
21736
|
+
if (loadError || !solution)
|
|
21737
|
+
return resources;
|
|
21738
|
+
for (const configuration of configurations) {
|
|
21739
|
+
const resource = solution.resources.find((r) => r.key === configuration?.key);
|
|
21740
|
+
if (!resource)
|
|
21741
|
+
continue;
|
|
21742
|
+
resources.set(resource.key, resource);
|
|
21743
|
+
if (!resource.projectKey)
|
|
21744
|
+
continue;
|
|
21745
|
+
configuration.spec = await applyEntryPointEnhancementAsync(builder.context, resource, configuration.spec ?? {});
|
|
21746
|
+
}
|
|
21747
|
+
return resources;
|
|
21748
|
+
}
|
|
21749
|
+
async function exportResourceConfigurationsAsync(services, resourceKey, hint = {}) {
|
|
21750
|
+
const { catalog, importer } = getRemoteResourceClients(services);
|
|
21751
|
+
const byKey = (item) => item.entityKey === resourceKey;
|
|
21752
|
+
const entity = (hint.name ? await findCatalogEntityAsync(catalog, { name: hint.name }, byKey) : undefined) ?? await findCatalogEntityAsync(catalog, {}, byKey);
|
|
21753
|
+
if (!entity) {
|
|
21754
|
+
throw new Error(`Resource '${resourceKey}' was not found in the solution or in the resource catalog`);
|
|
21755
|
+
}
|
|
21756
|
+
const payload = await importer.exportResourceAsync(toResourceReference(entity));
|
|
21757
|
+
const definitions = payload.resourceDefinitions ?? [];
|
|
21758
|
+
if (definitions.length === 0) {
|
|
21759
|
+
throw new Error(`FPS export for '${resourceKey}' returned no resource definitions`);
|
|
21760
|
+
}
|
|
21761
|
+
return {
|
|
21762
|
+
resources: definitions.map((d) => ({
|
|
21763
|
+
key: d.key ?? "",
|
|
21764
|
+
spec: d.spec ?? {},
|
|
21765
|
+
locks: d.locks ?? [],
|
|
21766
|
+
apiVersion: d.apiVersion,
|
|
21767
|
+
isOverridable: d.isOverridable,
|
|
21768
|
+
name: d.name ?? "",
|
|
21769
|
+
kind: d.kind ?? "",
|
|
21770
|
+
dependencies: (d.dependencies ?? []).map((dep) => ({
|
|
21771
|
+
kind: dep.kind ?? "",
|
|
21772
|
+
name: dep.name ?? ""
|
|
21773
|
+
}))
|
|
21774
|
+
}))
|
|
21775
|
+
};
|
|
21776
|
+
}
|
|
21777
|
+
async function readLocalAsync(builder, resourceKey, read) {
|
|
21778
|
+
if (!builder)
|
|
21779
|
+
return;
|
|
21780
|
+
const [error, value] = await catchError2(read(builder));
|
|
21781
|
+
if (!error)
|
|
21782
|
+
return { builder, value };
|
|
21783
|
+
if (isResourceKeyNotFound(error, resourceKey))
|
|
21784
|
+
return;
|
|
21785
|
+
throw error;
|
|
21786
|
+
}
|
|
21787
|
+
async function readResourceConfigurationsAsync(services, builder, resourceKey, hint = {}) {
|
|
21788
|
+
const local = await readLocalAsync(builder, resourceKey, (b) => b.getAllConfigurationsAsync(resourceKey));
|
|
21789
|
+
if (!local) {
|
|
21790
|
+
return exportResourceConfigurationsAsync(services, resourceKey, hint);
|
|
21791
|
+
}
|
|
21792
|
+
await refreshArtefactSpecsAsync(local.builder, local.value?.resources ?? []);
|
|
21793
|
+
return local.value;
|
|
21794
|
+
}
|
|
21795
|
+
async function readResourceConfigurationAsync(services, builder, resourceKey) {
|
|
21796
|
+
const local = await readLocalAsync(builder, resourceKey, (b) => b.getConfigurationAsync(resourceKey));
|
|
21797
|
+
if (local) {
|
|
21798
|
+
const configuration = local.value;
|
|
21799
|
+
const resources = await refreshArtefactSpecsAsync(local.builder, [
|
|
21800
|
+
configuration
|
|
21801
|
+
]);
|
|
21802
|
+
return { configuration, resource: resources.get(configuration.key) };
|
|
21803
|
+
}
|
|
21804
|
+
const { resources } = await exportResourceConfigurationsAsync(services, resourceKey);
|
|
21805
|
+
const primary = resources.find((r) => r.key === resourceKey) ?? resources[0];
|
|
21806
|
+
const { key, spec, locks, apiVersion, isOverridable } = primary;
|
|
21807
|
+
return { configuration: { key, spec, locks, apiVersion, isOverridable } };
|
|
21808
|
+
}
|
|
21809
|
+
// ../solution-sdk/src/resources/services/resource-lookup.ts
|
|
21810
|
+
async function findResourcesByNameAsync(services, builder, { kind, name, subTypes, folderKey }) {
|
|
21811
|
+
const same = (a, b) => (a ?? "").toLowerCase() === b.toLowerCase();
|
|
21812
|
+
const ofSubType = (type) => subTypes === undefined || subTypes.some((t) => same(type, t));
|
|
21813
|
+
if (builder) {
|
|
21814
|
+
const solution = await builder.context.loadAsync();
|
|
21815
|
+
const local = solution.resources.filter((r) => same(r.kind, kind) && same(r.name, name) && ofSubType(r.type)).map((r) => ({
|
|
21816
|
+
key: r.key,
|
|
21817
|
+
local: true,
|
|
21818
|
+
folderPath: r.folders?.[0]?.fullyQualifiedName
|
|
21819
|
+
}));
|
|
21820
|
+
if (local.length > 0)
|
|
21821
|
+
return local;
|
|
21822
|
+
}
|
|
21823
|
+
const { catalog } = getRemoteResourceClients(services);
|
|
21824
|
+
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)));
|
|
21825
|
+
return rows.map((row) => ({
|
|
21826
|
+
key: row.entityKey ?? "",
|
|
21827
|
+
local: false,
|
|
21828
|
+
folderPath: row.fullyQualifiedName ?? undefined,
|
|
21829
|
+
folderKey: row.folderKey ?? undefined
|
|
21830
|
+
}));
|
|
21831
|
+
}
|
|
21640
21832
|
// ../solution-sdk/src/resources/services/resource-refresh-service.ts
|
|
21641
21833
|
async function resourceRefreshAsync(solutionPath = ".", options = {}) {
|
|
21642
21834
|
const fs = getFileSystem2();
|
|
@@ -21675,7 +21867,11 @@ async function resourceRefreshAsync(solutionPath = ".", options = {}) {
|
|
|
21675
21867
|
if (bindingsError) {
|
|
21676
21868
|
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'.`);
|
|
21677
21869
|
}
|
|
21678
|
-
const [
|
|
21870
|
+
const [selfProvisionedError, selfProvisioned] = await catchError2(options.resolveSelfProvisionedAsync?.() ?? Promise.resolve([]));
|
|
21871
|
+
if (selfProvisionedError) {
|
|
21872
|
+
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'.`);
|
|
21873
|
+
}
|
|
21874
|
+
const [syncError, result] = await catchError2(syncResourcesFromBindings(resolvedPath, undefined, projectSubTypes ?? new Map, projectBindings ?? new Map, selfProvisioned?.length ? [...selfProvisioned] : undefined, {
|
|
21679
21875
|
bindingsComplete: !bindingsError && (options.isProjectBindingsComplete?.() ?? true)
|
|
21680
21876
|
}));
|
|
21681
21877
|
if (syncError) {
|
|
@@ -21898,6 +22094,7 @@ export {
|
|
|
21898
22094
|
findProjectFile,
|
|
21899
22095
|
findResourceByKeyInRcs,
|
|
21900
22096
|
findResourceInRcs,
|
|
22097
|
+
findResourcesByKeysInRcs,
|
|
21901
22098
|
findResourcesByNameAsync,
|
|
21902
22099
|
formatResourceSubtypes,
|
|
21903
22100
|
getRemoteResourceClients,
|
|
@@ -21919,6 +22116,7 @@ export {
|
|
|
21919
22116
|
readSpecProperty,
|
|
21920
22117
|
readUipxProjects,
|
|
21921
22118
|
refreshArtefactSpecsAsync,
|
|
22119
|
+
resolveImportedResourcesAsync,
|
|
21922
22120
|
resolveProjectDirFromManifest,
|
|
21923
22121
|
resolveResourceKindMetadata,
|
|
21924
22122
|
resolveSolutionFilePath,
|
|
@@ -21938,4 +22136,4 @@ export {
|
|
|
21938
22136
|
writeSolutionFile
|
|
21939
22137
|
};
|
|
21940
22138
|
|
|
21941
|
-
//# debugId=
|
|
22139
|
+
//# debugId=4D19A415A85B722964756E2164756E21
|