@uipath/flow-tool 1.207.0-preview.338 → 1.207.0-preview.340

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.
Files changed (108) hide show
  1. package/dist/{authoring-r7hdnt8y.js → authoring-syxhgs5e.js} +4 -4
  2. package/dist/{binding-service-50s6sqps.js → binding-service-h4287b02.js} +22 -22
  3. package/dist/{connector-service-r7apxz2a.js → connector-service-wy9gysbt.js} +23 -23
  4. package/dist/{conversion-A2KZVSOA-0f1p12my.js → conversion-A2KZVSOA-qh48jhq2.js} +3 -3
  5. package/dist/{de-HF4GJ4EK-NX7YTOSY-bzez55qj.js → de-HF4GJ4EK-NX7YTOSY-1pcd7t77.js} +1 -1
  6. package/dist/{debug-http-client-fypqjmfs.js → debug-http-client-336wqvy7.js} +3 -3
  7. package/dist/{debug-service-zv5hj0cx.js → debug-service-wmwry5mr.js} +4 -4
  8. package/dist/{edge-service-r1vctgeb.js → edge-service-5jn345fg.js} +6 -6
  9. package/dist/{en-ETY46SDS-RI6EZCN6-p6sjx06w.js → en-ETY46SDS-RI6EZCN6-wvewdtzc.js} +1 -1
  10. package/dist/{en-JZXY3PYE-6p690z75.js → en-JZXY3PYE-wsj8x04s.js} +1 -1
  11. package/dist/{en-LQHKFSEY-pg4a7yeg.js → en-LQHKFSEY-tr47zb1h.js} +1 -1
  12. package/dist/{es-IYP2OLUY-7SKYGF6A-fc758sep.js → es-IYP2OLUY-7SKYGF6A-q99s44mj.js} +1 -1
  13. package/dist/{es-MX-D2MN3U37-D74A6FRL-re45xjx5.js → es-MX-D2MN3U37-D74A6FRL-1905f9v1.js} +1 -1
  14. package/dist/{flow-api-83nejsaj.js → flow-api-c5kkwedg.js} +8 -8
  15. package/dist/{flow-debug-service-dvwx629z.js → flow-debug-service-v16agrd4.js} +16 -16
  16. package/dist/{flow-eval-node-target-97dtxzxp.js → flow-eval-node-target-ejd936cx.js} +7 -7
  17. package/dist/{flow-eval-run-api-g6sphtf3.js → flow-eval-run-api-8eg1kgm6.js} +3 -3
  18. package/dist/{flow-eval-run-service-b2dae385.js → flow-eval-run-service-trv0b5j7.js} +20 -20
  19. package/dist/{flow-eval-service-y45kfzsz.js → flow-eval-service-mhse1pxh.js} +11 -11
  20. package/dist/{flow-init-sdk-source-2416smf4.js → flow-init-sdk-source-7ja24n7j.js} +4 -4
  21. package/dist/{flow-init-service-jg81vtz0.js → flow-init-service-26t76mhx.js} +10 -10
  22. package/dist/{flow-io-pj1326wn.js → flow-io-t3fk0td3.js} +6 -6
  23. package/dist/{flow-migrate-service-nv2etmkz.js → flow-migrate-service-qyb2knbf.js} +6 -6
  24. package/dist/{flow-pack-service-rjys162b.js → flow-pack-service-s6jv0a1c.js} +16 -16
  25. package/dist/flow-validate-service-5bshd6a9.js +49 -0
  26. package/dist/{fr-NISALSPL-3ANDQPI3-p17kyn3e.js → fr-NISALSPL-3ANDQPI3-aek7xrz6.js} +1 -1
  27. package/dist/{governance-fetcher-1pz08046.js → governance-fetcher-5pax5jec.js} +4 -4
  28. package/dist/{hitl-service-4kz2s0ev.js → hitl-service-49hxp3f4.js} +6 -6
  29. package/dist/{index-gyse9mag.js → index-1j1mtdxq.js} +3 -3
  30. package/dist/{index-4j1d6n3h.js → index-2c8scp7k.js} +4 -4
  31. package/dist/{index-vrx6wxcb.js → index-4reb51vh.js} +4 -4
  32. package/dist/{index-qq2ydvw9.js → index-9nj8zkpt.js} +12 -12
  33. package/dist/{index-hfyvarhr.js → index-jc0jjx67.js} +482 -284
  34. package/dist/{index-9rsxrx2z.js → index-nsqw6vfh.js} +3 -3
  35. package/dist/{index-apy50fda.js → index-x7dk3yye.js} +3 -3
  36. package/dist/index.js +9 -9
  37. package/dist/init.js +10 -10
  38. package/dist/{inline-entity-resolver-c1r8sjkr.js → inline-entity-resolver-yxyzbsrs.js} +6 -6
  39. package/dist/{input-reader-3zvbsn6a.js → input-reader-y6xz2gas.js} +3 -3
  40. package/dist/{integration-service-fetcher-ma9njgrm.js → integration-service-fetcher-rrzwqqgn.js} +3 -3
  41. package/dist/{ja-HTS2Q4YG-7Q6WUI6H-6gf215z6.js → ja-HTS2Q4YG-7Q6WUI6H-vav1z6ax.js} +1 -1
  42. package/dist/{json-input-pj18qjt0.js → json-input-ak9md3nk.js} +4 -4
  43. package/dist/{ko-3JFGTMNY-VT6UQ3IS-nv610mc7.js → ko-3JFGTMNY-VT6UQ3IS-zcr0t8c0.js} +1 -1
  44. package/dist/{library-option-ea9s7nex.js → library-option-7gavp1pk.js} +4 -4
  45. package/dist/{maestro-automate-entry-gac8anz3.js → maestro-automate-entry-ce1vgwj7.js} +2 -2
  46. package/dist/{node-m54r4vb8.js → node-j50gmmfz.js} +4 -4
  47. package/dist/{node-service-6akbn6tm.js → node-service-anqft3z6.js} +22 -22
  48. package/dist/{node-sync-service-tv111q9w.js → node-sync-service-d072z9wb.js} +6 -6
  49. package/dist/{packager-tool-9pnxybwa.js → packager-tool-00nzecde.js} +2 -2
  50. package/dist/{packager-tool-9kt42w8w.js → packager-tool-1n2fb8pv.js} +14 -14
  51. package/dist/{packager-tool-w6j23zen.js → packager-tool-21gm0vqv.js} +4 -4
  52. package/dist/{packager-tool-p7pm85f1.js → packager-tool-2jr692h5.js} +3 -3
  53. package/dist/{packager-tool-qnwrc9e0.js → packager-tool-2pa62eb5.js} +66 -1
  54. package/dist/{packager-tool-mvzswn9n.js → packager-tool-344vj3a5.js} +2 -2
  55. package/dist/{packager-tool-vv9rd0bk.js → packager-tool-846sdxba.js} +4 -4
  56. package/dist/{packager-tool-gjjr2a2w.js → packager-tool-9c6rekf0.js} +1 -1
  57. package/dist/{packager-tool-bcsjm5hv.js → packager-tool-9ds76yce.js} +4 -2
  58. package/dist/{packager-tool-bsa2ydkx.js → packager-tool-a7xesvn9.js} +3 -3
  59. package/dist/{packager-tool-y3f3skaq.js → packager-tool-agbm89we.js} +20 -20
  60. package/dist/{packager-tool-j5yynggz.js → packager-tool-ajhcsym0.js} +2 -2
  61. package/dist/{packager-tool-pmmm327s.js → packager-tool-b52xtf9j.js} +3 -3
  62. package/dist/{packager-tool-9phnawzn.js → packager-tool-c16yfa9x.js} +64 -64
  63. package/dist/{packager-tool-rcjtmknf.js → packager-tool-cvyqcm99.js} +3 -3
  64. package/dist/{packager-tool-35tcc5wm.js → packager-tool-e694ecmx.js} +2 -2
  65. package/dist/{packager-tool-7re5d8aq.js → packager-tool-fq5c0ncs.js} +2 -2
  66. package/dist/{packager-tool-az1s2z5b.js → packager-tool-g7v00xbz.js} +1 -1
  67. package/dist/{packager-tool-sab2kad3.js → packager-tool-g8m33pvz.js} +5 -5
  68. package/dist/{packager-tool-bn09xgy8.js → packager-tool-gwq49dm6.js} +2 -2
  69. package/dist/{packager-tool-byp60gm2.js → packager-tool-h5f9x5vd.js} +7 -7
  70. package/dist/{packager-tool-qx8wvedy.js → packager-tool-h5r4t26q.js} +1 -1
  71. package/dist/{packager-tool-bavqhk05.js → packager-tool-hajyr4x8.js} +2 -2
  72. package/dist/{packager-tool-hytbyq2n.js → packager-tool-jbg9ge86.js} +2 -2
  73. package/dist/{packager-tool-9pqd99gz.js → packager-tool-jpqg09aa.js} +5 -5
  74. package/dist/{packager-tool-xwv19dgh.js → packager-tool-kj33kq0y.js} +14 -14
  75. package/dist/{packager-tool-gq4yxf3f.js → packager-tool-m524y1h3.js} +2 -2
  76. package/dist/{packager-tool-kh1taypp.js → packager-tool-mrqp3dg2.js} +1 -1
  77. package/dist/{packager-tool-4g8f5v36.js → packager-tool-mwp8g13x.js} +1 -1
  78. package/dist/{packager-tool-5x8ne2zs.js → packager-tool-n8tqqa37.js} +5 -5
  79. package/dist/{packager-tool-xgvp8a8g.js → packager-tool-q0dzcaf3.js} +1 -1
  80. package/dist/{packager-tool-7d6y5paj.js → packager-tool-r6zjvy17.js} +3 -3
  81. package/dist/{packager-tool-y87yv0a6.js → packager-tool-rng1fver.js} +6 -6
  82. package/dist/{packager-tool-1br7expd.js → packager-tool-rz64c2f6.js} +4 -4
  83. package/dist/{packager-tool-jjnfwfd4.js → packager-tool-smjjnpz0.js} +1 -1
  84. package/dist/{packager-tool-4hn7v05x.js → packager-tool-ts24f7zm.js} +2 -2
  85. package/dist/{packager-tool-zgzpqfcs.js → packager-tool-wb64rgfa.js} +1 -1
  86. package/dist/{packager-tool-eyjtznrj.js → packager-tool-wmxfkbv6.js} +2 -2
  87. package/dist/{packager-tool-cwyafxxh.js → packager-tool-x5vef65f.js} +12 -12
  88. package/dist/{packager-tool-7wpb19zf.js → packager-tool-y9txswen.js} +1 -1
  89. package/dist/{packager-tool-pagq6h49.js → packager-tool-zb5dztpv.js} +5 -5
  90. package/dist/packager-tool.js +4 -4
  91. package/dist/{provision-node-service-wtn6j00a.js → provision-node-service-vcfja2ey.js} +8 -8
  92. package/dist/{pt-BR-7H7BP5DT-IOHWNCIU-5dfesj85.js → pt-BR-7H7BP5DT-IOHWNCIU-nfrdjt9h.js} +1 -1
  93. package/dist/{pt-QWGSZKMD-RTKSQCYA-t7g0kkbp.js → pt-QWGSZKMD-RTKSQCYA-2x9nbj2m.js} +1 -1
  94. package/dist/{ro-B7G474JK-Q3BAA4S3-8njq5e6p.js → ro-B7G474JK-Q3BAA4S3-paa38jte.js} +1 -1
  95. package/dist/{ru-GSCT4ARZ-6OTD7JLB-tz6mt7t9.js → ru-GSCT4ARZ-6OTD7JLB-me5ymbam.js} +1 -1
  96. package/dist/{schema-document-service-c64krmpw.js → schema-document-service-e0tcvbzq.js} +8 -8
  97. package/dist/{serialization-7CB4AREI-wq0sdzga.js → serialization-7CB4AREI-b0hr3ktj.js} +2 -2
  98. package/dist/{solution-discovery-v5qatmz2.js → solution-discovery-dz4ey3ct.js} +3 -3
  99. package/dist/{tidy-service-yctd2n8h.js → tidy-service-2qn6mj22.js} +6 -6
  100. package/dist/tool.js +9 -9
  101. package/dist/{tr-FX7WCKK2-CEOTUJRD-yw2gwm3b.js → tr-FX7WCKK2-CEOTUJRD-mejm8g5n.js} +1 -1
  102. package/dist/validation.js +27 -27
  103. package/dist/{variable-service-wd0pqse9.js → variable-service-ccmxp4w2.js} +6 -6
  104. package/dist/{wait-for-flow-job-r9xjdjea.js → wait-for-flow-job-cssjqmt1.js} +8 -8
  105. package/dist/{zh-CN-NCMB6YM5-BB2LRIMQ-t1n5md1k.js → zh-CN-NCMB6YM5-BB2LRIMQ-3ncp54h7.js} +1 -1
  106. package/dist/{zh-TW-UNIEJPLE-ECGOEPYS-vvedvyf0.js → zh-TW-UNIEJPLE-ECGOEPYS-3dyspwj1.js} +1 -1
  107. package/package.json +2 -2
  108. package/dist/flow-validate-service-7zjd80nr.js +0 -49
@@ -3,12 +3,12 @@ import {
3
3
  } from "./packager-tool-1db1wqdy.js";
4
4
  import {
5
5
  catchError2
6
- } from "./packager-tool-4hn7v05x.js";
6
+ } from "./packager-tool-ts24f7zm.js";
7
7
  import {
8
8
  extractErrorMessage,
9
9
  logger
10
- } from "./packager-tool-bcsjm5hv.js";
11
- import"./packager-tool-qnwrc9e0.js";
10
+ } from "./packager-tool-9ds76yce.js";
11
+ import"./packager-tool-2pa62eb5.js";
12
12
  import {
13
13
  ErrorCodes,
14
14
  BadRequestException,
@@ -66,7 +66,7 @@ import {
66
66
  import {
67
67
  UsersApi2,
68
68
  createApiClient2
69
- } from "./packager-tool-eyjtznrj.js";
69
+ } from "./packager-tool-wmxfkbv6.js";
70
70
  import {
71
71
  getSolutionAuthContext2
72
72
  } from "./packager-tool-qtz83h01.js";
@@ -79,7 +79,7 @@ import {
79
79
  hasUnsafeNameChars2,
80
80
  validateResourceName2,
81
81
  assertValidResourceName2
82
- } from "./packager-tool-mvzswn9n.js";
82
+ } from "./packager-tool-344vj3a5.js";
83
83
  import {
84
84
  isGuid
85
85
  } from "./packager-tool-1yew22sn.js";
@@ -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
- // ../solution-sdk/src/resources/services/resource-configurations.ts
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
- function resolveBindingResourceIdentity(binding) {
20856
- switch (binding.resourceType) {
20857
- case models_BindingsResourceType.TimeTrigger:
20858
- return { kind: "trigger", type: "timeTrigger" };
20859
- case models_BindingsResourceType.AppsTrigger:
20860
- return {
20861
- kind: lowerFirstChar(getResourceKindForBinding(binding.resourceType))
20862
- };
20863
- default:
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 { bindings: allBindings, parseErrors } = await collectBindings(bindingsJsonFallbackDirs, serializer, bindingSources(solutionDir, paths, uipxProjects, projectBindings));
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 selfProvisionedKeys = new Set((selfProvisioned ?? []).map((r) => bindingKey(r.kind, r.name)));
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(kind, identity.type);
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
- if (!isConnection && !normalizeFolderPath(folderPath) && findMatchingLocalResource(solution.resources ?? [], kind, name, folderPath)) {
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 (!isConnection && selfProvisionedKeys.has(bindingKey(kind, name))) {
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 = findMatchingLocalResource(preLoadSolution.resources, kind, name, undefined);
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
- if ("error" in parsed)
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
- const parsed = deserializeBindings(new TextDecoder().decode(content), bindingsPath, serializer);
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
- return { resources: metadata?.resources ?? [] };
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 [syncError, result] = await catchError2(syncResourcesFromBindings(resolvedPath, undefined, projectSubTypes ?? new Map, projectBindings ?? new Map, undefined, {
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=066FBD14533CF47164756E2164756E21
22141
+ //# debugId=13269D22A738BF3264756E2164756E21