@uipath/maestro-sdk 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.
package/dist/index.js CHANGED
@@ -282,7 +282,7 @@ function rotr(value, bits) {
282
282
  return (value >>> bits | value << 32 - bits) >>> 0;
283
283
  }
284
284
  function sha256Words(input) {
285
- const bytes = new TextEncoder().encode(input);
285
+ const bytes = typeof input === "string" ? new TextEncoder().encode(input) : input;
286
286
  const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
287
287
  const buffer = new Uint8Array(paddedLength);
288
288
  buffer.set(bytes);
@@ -12102,6 +12102,7 @@ var init_command_attribution = __esm(() => {
12102
12102
  ["uipath-maestro-bpmn", "uipath-maestro-case", "uipath-maestro-flow"]
12103
12103
  ],
12104
12104
  ["agenthub", "build", ["uipath-mcp-servers"]],
12105
+ ["ontology", "build", ["uipath-ontology"]],
12105
12106
  ["solution", "build", ["uipath-planner", "uipath-solution"]],
12106
12107
  ["platform", "operate", ["uipath-platform"]],
12107
12108
  ["quality", "troubleshoot", ["uipath-review"]],
@@ -12142,6 +12143,7 @@ var init_command_attribution = __esm(() => {
12142
12143
  ["test-manager", "operate", ["uip.tm"]],
12143
12144
  ["vertical-solutions", "build", ["uip.vss"]],
12144
12145
  ["data-fabric", "operate", ["uip.df"]],
12146
+ ["ontology", "build", ["uip.ont"]],
12145
12147
  ["integration-service", "build", ["uip.is"]],
12146
12148
  ["orchestrator", "operate", ["uip.or"]],
12147
12149
  [
@@ -144975,7 +144977,7 @@ var init_package = __esm(() => {
144975
144977
  name: "@uipath/integrationservice-sdk",
144976
144978
  author: "UiPath",
144977
144979
  license: "SEE LICENSE IN LICENSE.txt",
144978
- version: "1.207.0-preview.338",
144980
+ version: "1.207.0-preview.340",
144979
144981
  repository: {
144980
144982
  type: "git",
144981
144983
  url: "https://github.com/UiPath/cli.git",
@@ -153653,6 +153655,131 @@ var init_models3 = __esm(() => {
153653
153655
  });
153654
153656
  // ../packager/packager-core/src/package-descriptor/index.ts
153655
153657
  var init_package_descriptor = () => {};
153658
+
153659
+ // ../packager/packager-core/src/resource-declarations/languages.ts
153660
+ function resourceDeclarationsPaths(language) {
153661
+ const name = RESOURCE_DECLARATIONS_FILE_NAMES[language];
153662
+ return [name, `src/${name}`];
153663
+ }
153664
+ var RESOURCE_DECLARATIONS_FILE_NAMES;
153665
+ var init_languages = __esm(() => {
153666
+ RESOURCE_DECLARATIONS_FILE_NAMES = {
153667
+ typescript: "uipath_resources.ts",
153668
+ python: "uipath_resources.py"
153669
+ };
153670
+ });
153671
+
153672
+ // ../packager/packager-core/src/resource-declarations/scanner.ts
153673
+ var closingIndexOf;
153674
+ var init_scanner = __esm(() => {
153675
+ closingIndexOf = new Map;
153676
+ });
153677
+
153678
+ // ../packager/packager-core/src/resource-declarations/declarations.ts
153679
+ var RESOURCE_DECLARATIONS_FILE_NAME, RESOURCE_DECLARATIONS_PATHS, MAX_RESOURCE_DECLARATIONS_LENGTH;
153680
+ var init_declarations = __esm(() => {
153681
+ init_languages();
153682
+ init_scanner();
153683
+ RESOURCE_DECLARATIONS_FILE_NAME = RESOURCE_DECLARATIONS_FILE_NAMES.typescript;
153684
+ RESOURCE_DECLARATIONS_PATHS = resourceDeclarationsPaths("typescript");
153685
+ MAX_RESOURCE_DECLARATIONS_LENGTH = 1024 * 1024;
153686
+ });
153687
+
153688
+ // ../packager/packager-core/src/resource-declarations/bindings.ts
153689
+ var init_bindings = __esm(() => {
153690
+ init_declarations();
153691
+ });
153692
+
153693
+ // ../packager/packager-core/src/resource-declarations/editor.ts
153694
+ var RESERVED_IDENTIFIERS, SUB_TYPES_BY_KIND;
153695
+ var init_editor = __esm(() => {
153696
+ init_bindings();
153697
+ init_declarations();
153698
+ init_scanner();
153699
+ RESERVED_IDENTIFIERS = new Set([
153700
+ "constructor",
153701
+ "prototype",
153702
+ "name",
153703
+ "length",
153704
+ "caller",
153705
+ "arguments"
153706
+ ]);
153707
+ SUB_TYPES_BY_KIND = {
153708
+ asset: new Set(["text", "integer", "bool", "credential", "secret", "json"]),
153709
+ bucket: new Set(["orchestrator", "amazon", "azure"])
153710
+ };
153711
+ });
153712
+
153713
+ // ../packager/packager-core/src/resource-declarations/python.ts
153714
+ var PYTHON_KEYWORDS;
153715
+ var init_python = __esm(() => {
153716
+ init_bindings();
153717
+ init_declarations();
153718
+ init_editor();
153719
+ init_languages();
153720
+ init_scanner();
153721
+ PYTHON_KEYWORDS = new Set([
153722
+ "and",
153723
+ "as",
153724
+ "assert",
153725
+ "async",
153726
+ "await",
153727
+ "break",
153728
+ "class",
153729
+ "continue",
153730
+ "def",
153731
+ "del",
153732
+ "elif",
153733
+ "else",
153734
+ "except",
153735
+ "finally",
153736
+ "for",
153737
+ "from",
153738
+ "global",
153739
+ "if",
153740
+ "import",
153741
+ "in",
153742
+ "is",
153743
+ "lambda",
153744
+ "nonlocal",
153745
+ "not",
153746
+ "or",
153747
+ "pass",
153748
+ "raise",
153749
+ "return",
153750
+ "try",
153751
+ "while",
153752
+ "with",
153753
+ "yield"
153754
+ ]);
153755
+ });
153756
+
153757
+ // ../packager/packager-core/src/resource-declarations/source.ts
153758
+ var init_source = __esm(() => {
153759
+ init_bindings();
153760
+ init_declarations();
153761
+ init_editor();
153762
+ init_languages();
153763
+ init_python();
153764
+ });
153765
+
153766
+ // ../packager/packager-core/src/resource-declarations/project.ts
153767
+ var init_project = __esm(() => {
153768
+ init_bindings();
153769
+ init_declarations();
153770
+ init_source();
153771
+ });
153772
+
153773
+ // ../packager/packager-core/src/resource-declarations/index.ts
153774
+ var init_resource_declarations = __esm(() => {
153775
+ init_bindings();
153776
+ init_declarations();
153777
+ init_editor();
153778
+ init_languages();
153779
+ init_project();
153780
+ init_python();
153781
+ init_source();
153782
+ });
153656
153783
  // ../packager/packager-core/src/services/project-id.ts
153657
153784
  var init_project_id = () => {};
153658
153785
 
@@ -153748,6 +153875,7 @@ var init_src5 = __esm(() => {
153748
153875
  init_i18n();
153749
153876
  init_models3();
153750
153877
  init_package_descriptor();
153878
+ init_resource_declarations();
153751
153879
  init_services();
153752
153880
  });
153753
153881
 
@@ -160518,7 +160646,7 @@ var init_binding_overwrites_mapping_handler = __esm(() => {
160518
160646
  });
160519
160647
 
160520
160648
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/index.js
160521
- var init_bindings = __esm(() => {
160649
+ var init_bindings2 = __esm(() => {
160522
160650
  init_models5();
160523
160651
  init_bindings_metadata_serializer();
160524
160652
  init_bindings_requests();
@@ -161680,7 +161808,7 @@ var init_solution_builder = __esm(() => {
161680
161808
  init_detach_resource_file_command();
161681
161809
  init_exceptions();
161682
161810
  init_internal();
161683
- init_bindings();
161811
+ init_bindings2();
161684
161812
  init_solution();
161685
161813
  SolutionBuilder = class SolutionBuilder {
161686
161814
  dispose() {
@@ -173365,7 +173493,7 @@ function isGuid3(value) {
173365
173493
  }
173366
173494
  var BINDINGS_RESOLUTION_BATCH_SIZE = 10;
173367
173495
  var init_get_exportable_items_based_on_bindings_handler = __esm(() => {
173368
- init_bindings();
173496
+ init_bindings2();
173369
173497
  init_resource_subtype_mapper();
173370
173498
  init_exceptions();
173371
173499
  });
@@ -174977,7 +175105,7 @@ var init_container = __esm(() => {
174977
175105
  init_mediator2();
174978
175106
  init_resource_builder();
174979
175107
  init_handlers();
174980
- init_bindings();
175108
+ init_bindings2();
174981
175109
  init_solution();
174982
175110
  init_feature_flag_provider();
174983
175111
  init_clients();
@@ -181243,152 +181371,14 @@ var init_local_resource_matcher = __esm(() => {
181243
181371
  ORPHAN_CHECKED_KINDS = new Set(["process", "app"]);
181244
181372
  });
181245
181373
 
181246
- // ../solution-sdk/src/resources/services/project-artifacts-service.ts
181247
- async function addProjectArtifactsToSolutionAsync(options) {
181248
- const error = await createProjectInSolutionBuilder(options.solutionDir, options.projectId, options.projectName, normalizeProjectType(options.projectType), options.projectSubType);
181249
- return error ? artifactFailure(options, error) : { Created: true };
181250
- }
181251
- function artifactFailure(options, error) {
181252
- 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.");
181253
- return { Created: false, Error: error.message };
181254
- }
181255
- var init_project_artifacts_service = __esm(() => {
181256
- init_src2();
181257
- init_solution_file();
181258
- init_project_utils();
181259
- });
181260
-
181261
- // ../solution-sdk/src/resources/services/project-template-types.ts
181262
- function hasBareTemplateRow(projectType) {
181263
- reader ??= new EmbeddedProjectConfigurationReader;
181264
- return reader.getTemplateResourcesByType(projectType, undefined, false).length > 0;
181265
- }
181266
- function hasAnyTemplateRow(projectType) {
181267
- reader ??= new EmbeddedProjectConfigurationReader;
181268
- const wanted = projectType.toLowerCase();
181269
- return Object.keys(reader.getAll()).some((row) => {
181270
- const key = row.toLowerCase();
181271
- return key === wanted || key.startsWith(`${wanted}_`);
181272
- });
181273
- }
181274
- var reader;
181275
- var init_project_template_types = __esm(() => {
181276
- init_config2();
181374
+ // ../../node_modules/@uipath/resource-builder-sdk/dist/entries/bindings.js
181375
+ var init_bindings3 = __esm(() => {
181376
+ init_bindings2();
181277
181377
  });
181278
181378
 
181279
- // ../solution-sdk/src/resources/services/remote-resources.ts
181280
- function getRemoteResourceClients(services) {
181281
- return {
181282
- catalog: services.container.resolve(Tokens.IResourceCatalogClientProxy),
181283
- importer: services.container.resolve(Tokens.IImportResourceHelper)
181284
- };
181285
- }
181286
- async function findCatalogEntityAsync(catalog, query, match) {
181287
- let pageCursor;
181288
- do {
181289
- const page = await catalog.searchFolderEntities({
181290
- ...query,
181291
- pageSize: 100,
181292
- pageCursor
181293
- });
181294
- const found = (page.items ?? []).find(match);
181295
- if (found) {
181296
- return found;
181297
- }
181298
- pageCursor = page.nextPage ?? undefined;
181299
- } while (pageCursor);
181300
- return;
181301
- }
181302
- async function findCatalogEntitiesAsync(catalog, query, match) {
181303
- const found = [];
181304
- let pageCursor;
181305
- do {
181306
- const page = await catalog.searchFolderEntities({
181307
- ...query,
181308
- pageSize: 100,
181309
- pageCursor
181310
- });
181311
- found.push(...(page.items ?? []).filter(match));
181312
- pageCursor = page.nextPage ?? undefined;
181313
- } while (pageCursor);
181314
- return found;
181315
- }
181316
- function toResourceReference(entity) {
181317
- return toCatalogReference({
181318
- kind: entity.entityType ?? "",
181319
- type: entity.entitySubType ?? undefined,
181320
- key: entity.entityKey ?? "",
181321
- name: entity.entityName ?? undefined,
181322
- folderPath: entity.fullyQualifiedName ?? undefined,
181323
- folderKey: entity.folderKey ?? undefined
181324
- });
181325
- }
181326
- function toCatalogReference(reference) {
181327
- const { folderPath, folderKey, ...rest } = reference;
181328
- return {
181329
- ...rest,
181330
- folder: folderPath ? { fullyQualifiedName: folderPath, folderKey } : undefined
181331
- };
181332
- }
181333
- async function exportResourceDefinitionAsync(importer, reference) {
181334
- const [error, payload] = await catchError(importer.exportResourceAsync(reference));
181335
- if (error) {
181336
- throw withExportStatus(error);
181337
- }
181338
- return payload.resourceDefinitions.find((d) => d.key === reference.key);
181339
- }
181340
- function withExportStatus(error) {
181341
- if (!(error instanceof Error) || !("exceptionData" in error)) {
181342
- return error;
181343
- }
181344
- const data = error.exceptionData;
181345
- const text = typeof data === "object" && data !== null ? data.errorMessage : undefined;
181346
- const match = typeof text === "string" ? /^HTTP (\d{3})\b/.exec(text) : null;
181347
- return match ? new ResourceExportError(error.message, Number(match[1]), error) : error;
181348
- }
181349
- function readSpecProperty(spec, name) {
181350
- if (!spec) {
181351
- return;
181352
- }
181353
- if (spec[name] !== undefined) {
181354
- return spec[name];
181355
- }
181356
- const lower = name.toLowerCase();
181357
- const key = Object.keys(spec).find((k) => k.toLowerCase() === lower);
181358
- return key === undefined ? undefined : spec[key];
181359
- }
181360
- function readSpecEntryPoints(spec) {
181361
- const entryPoints = parseJsonString(readSpecProperty(spec, "entryPoints"));
181362
- if (!Array.isArray(entryPoints) || !entryPoints.every((entry) => entry !== null && typeof entry === "object")) {
181363
- return;
181364
- }
181365
- return entryPoints.map((entry) => ({
181366
- UniqueId: String(readSpecProperty(entry, "uniqueId") ?? ""),
181367
- Path: String(readSpecProperty(entry, "path") ?? ""),
181368
- DisplayName: String(readSpecProperty(entry, "displayName") ?? ""),
181369
- InputArguments: readSpecProperty(entry, "inputArguments"),
181370
- OutputArguments: readSpecProperty(entry, "outputArguments")
181371
- }));
181372
- }
181373
- function parseJsonString(raw) {
181374
- if (typeof raw !== "string") {
181375
- return raw;
181376
- }
181377
- const [error, parsed] = catchError(() => JSON.parse(raw));
181378
- return error ? undefined : parsed;
181379
- }
181380
- var ResourceExportError;
181381
- var init_remote_resources = __esm(() => {
181382
- init_src2();
181383
- init_service_tokens();
181384
- ResourceExportError = class ResourceExportError extends Error {
181385
- status;
181386
- constructor(message, status, cause) {
181387
- super(message, { cause });
181388
- this.status = status;
181389
- this.name = "ResourceExportError";
181390
- }
181391
- };
181379
+ // ../../node_modules/@uipath/resource-builder-sdk/dist/mappings/index.js
181380
+ var init_mappings = __esm(() => {
181381
+ init_resource_subtype_mapper();
181392
181382
  });
181393
181383
 
181394
181384
  // ../solution-sdk/src/resources/services/resource-casing.ts
@@ -181557,186 +181547,6 @@ var init_resource_casing = __esm(() => {
181557
181547
  init_src();
181558
181548
  });
181559
181549
 
181560
- // ../solution-sdk/src/resources/services/resource-configurations.ts
181561
- function isResourceKeyNotFound(error, resourceKey) {
181562
- if (!(error instanceof Error))
181563
- return false;
181564
- const typed = error;
181565
- const sameKey = (key) => key !== undefined && key.toLowerCase() === resourceKey.toLowerCase();
181566
- if (typeof typed.resourceType === "string" && typeof typed.resourceKey === "string") {
181567
- return ROOT_RESOURCE_TYPES.has(typed.resourceType.toLowerCase()) && sameKey(typed.resourceKey);
181568
- }
181569
- return sameKey(KEY_NOT_FOUND.exec(error.message.trim())?.[1]);
181570
- }
181571
- async function refreshArtefactSpecsAsync(builder, configurations) {
181572
- const resources = new Map;
181573
- const [loadError, solution] = await catchError(builder.context.loadAsync());
181574
- if (loadError || !solution)
181575
- return resources;
181576
- for (const configuration of configurations) {
181577
- const resource = solution.resources.find((r) => r.key === configuration?.key);
181578
- if (!resource)
181579
- continue;
181580
- resources.set(resource.key, resource);
181581
- if (!resource.projectKey)
181582
- continue;
181583
- configuration.spec = await applyEntryPointEnhancementAsync(builder.context, resource, configuration.spec ?? {});
181584
- }
181585
- return resources;
181586
- }
181587
- async function exportResourceConfigurationsAsync(services, resourceKey, hint = {}) {
181588
- const { catalog, importer } = getRemoteResourceClients(services);
181589
- const byKey = (item) => item.entityKey === resourceKey;
181590
- const entity = (hint.name ? await findCatalogEntityAsync(catalog, { name: hint.name }, byKey) : undefined) ?? await findCatalogEntityAsync(catalog, {}, byKey);
181591
- if (!entity) {
181592
- throw new Error(`Resource '${resourceKey}' was not found in the solution or in the resource catalog`);
181593
- }
181594
- const payload = await importer.exportResourceAsync(toResourceReference(entity));
181595
- const definitions = payload.resourceDefinitions ?? [];
181596
- if (definitions.length === 0) {
181597
- throw new Error(`FPS export for '${resourceKey}' returned no resource definitions`);
181598
- }
181599
- return {
181600
- resources: definitions.map((d) => ({
181601
- key: d.key ?? "",
181602
- spec: d.spec ?? {},
181603
- locks: d.locks ?? [],
181604
- apiVersion: d.apiVersion,
181605
- isOverridable: d.isOverridable,
181606
- name: d.name ?? "",
181607
- kind: d.kind ?? "",
181608
- dependencies: (d.dependencies ?? []).map((dep) => ({
181609
- kind: dep.kind ?? "",
181610
- name: dep.name ?? ""
181611
- }))
181612
- }))
181613
- };
181614
- }
181615
- async function readLocalAsync(builder, resourceKey, read) {
181616
- if (!builder)
181617
- return;
181618
- const [error, value] = await catchError(read(builder));
181619
- if (!error)
181620
- return { builder, value };
181621
- if (isResourceKeyNotFound(error, resourceKey))
181622
- return;
181623
- throw error;
181624
- }
181625
- async function readResourceConfigurationsAsync(services, builder, resourceKey, hint = {}) {
181626
- const local = await readLocalAsync(builder, resourceKey, (b) => b.getAllConfigurationsAsync(resourceKey));
181627
- if (!local) {
181628
- return exportResourceConfigurationsAsync(services, resourceKey, hint);
181629
- }
181630
- await refreshArtefactSpecsAsync(local.builder, local.value?.resources ?? []);
181631
- return local.value;
181632
- }
181633
- async function readResourceConfigurationAsync(services, builder, resourceKey) {
181634
- const local = await readLocalAsync(builder, resourceKey, (b) => b.getConfigurationAsync(resourceKey));
181635
- if (local) {
181636
- const configuration = local.value;
181637
- const resources = await refreshArtefactSpecsAsync(local.builder, [
181638
- configuration
181639
- ]);
181640
- return { configuration, resource: resources.get(configuration.key) };
181641
- }
181642
- const { resources } = await exportResourceConfigurationsAsync(services, resourceKey);
181643
- const primary = resources.find((r) => r.key === resourceKey) ?? resources[0];
181644
- const { key, spec, locks, apiVersion, isOverridable } = primary;
181645
- return { configuration: { key, spec, locks, apiVersion, isOverridable } };
181646
- }
181647
- var ROOT_RESOURCE_TYPES, KEY_NOT_FOUND;
181648
- var init_resource_configurations = __esm(() => {
181649
- init_src2();
181650
- init_entry_point_spec_enhancer();
181651
- init_remote_resources();
181652
- ROOT_RESOURCE_TYPES = new Set(["resource", "solutionresource"]);
181653
- KEY_NOT_FOUND = /^(?:Solution)?Resource with key '([^']+)' was not found$/i;
181654
- });
181655
-
181656
- // ../solution-sdk/src/resources/services/resource-lookup.ts
181657
- async function findResourcesByNameAsync(services, builder, { kind, name, subTypes, folderKey }) {
181658
- const same = (a, b) => (a ?? "").toLowerCase() === b.toLowerCase();
181659
- const ofSubType = (type) => subTypes === undefined || subTypes.some((t) => same(type, t));
181660
- if (builder) {
181661
- const solution = await builder.context.loadAsync();
181662
- const local = solution.resources.filter((r) => same(r.kind, kind) && same(r.name, name) && ofSubType(r.type)).map((r) => ({
181663
- key: r.key,
181664
- local: true,
181665
- folderPath: r.folders?.[0]?.fullyQualifiedName
181666
- }));
181667
- if (local.length > 0)
181668
- return local;
181669
- }
181670
- const { catalog } = getRemoteResourceClients(services);
181671
- 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)));
181672
- return rows.map((row) => ({
181673
- key: row.entityKey ?? "",
181674
- local: false,
181675
- folderPath: row.fullyQualifiedName ?? undefined,
181676
- folderKey: row.folderKey ?? undefined
181677
- }));
181678
- }
181679
- var init_resource_lookup = __esm(() => {
181680
- init_remote_resources();
181681
- });
181682
-
181683
- // ../solution-sdk/src/resources/services/resource-name.ts
181684
- function hasControlChar(value) {
181685
- for (let i = 0;i < value.length; i++) {
181686
- if (value.charCodeAt(i) < 32)
181687
- return true;
181688
- }
181689
- return false;
181690
- }
181691
- function hasUnsafeNameChars(name) {
181692
- return UNSAFE_NAME_CHARS.test(name) || hasControlChar(name);
181693
- }
181694
- function validateResourceName(name, options = {}) {
181695
- const optionName = options.optionName ?? "--name";
181696
- if (name.trim() === "") {
181697
- return {
181698
- ok: false,
181699
- message: `${optionName} must not be blank`,
181700
- instructions: "Pass a non-empty resource name."
181701
- };
181702
- }
181703
- if (name.length > MAX_RESOURCE_NAME_LENGTH) {
181704
- return {
181705
- ok: false,
181706
- message: `${optionName} exceeds the ${MAX_RESOURCE_NAME_LENGTH}-character limit (got ${name.length})`,
181707
- instructions: "Shorten the resource name. Orchestrator name limits are kind-specific (queues cap at 50, assets at 256)."
181708
- };
181709
- }
181710
- if (hasUnsafeNameChars(name)) {
181711
- return {
181712
- ok: false,
181713
- message: `${optionName} contains unsafe characters`,
181714
- instructions: 'Resource names cannot contain path separators (/, \\), control characters, or any of: : * ? " < > |'
181715
- };
181716
- }
181717
- return { ok: true };
181718
- }
181719
- function assertValidResourceName(name, options = {}) {
181720
- const result = validateResourceName(name, options);
181721
- if (!result.ok) {
181722
- throw new Error(`${result.message}. ${result.instructions}`);
181723
- }
181724
- }
181725
- var MAX_RESOURCE_NAME_LENGTH = 256, UNSAFE_NAME_CHARS;
181726
- var init_resource_name = __esm(() => {
181727
- UNSAFE_NAME_CHARS = /[\\/:*?"<>|]/;
181728
- });
181729
-
181730
- // ../../node_modules/@uipath/resource-builder-sdk/dist/entries/bindings.js
181731
- var init_bindings2 = __esm(() => {
181732
- init_bindings();
181733
- });
181734
-
181735
- // ../../node_modules/@uipath/resource-builder-sdk/dist/mappings/index.js
181736
- var init_mappings = __esm(() => {
181737
- init_resource_subtype_mapper();
181738
- });
181739
-
181740
181550
  // ../solution-sdk/src/resources/services/sync-resources-from-bindings.ts
181741
181551
  function placeholderForType(type) {
181742
181552
  switch ((type ?? "string").toLowerCase()) {
@@ -181828,6 +181638,54 @@ function sameResourceSubtype(a, b) {
181828
181638
  function findSubtypeEntry(list, type) {
181829
181639
  return list.find((r) => !!r.type && sameResourceSubtype(r.type, type));
181830
181640
  }
181641
+ function metadataString(metadata, name) {
181642
+ if (!metadata || typeof metadata !== "object")
181643
+ return;
181644
+ for (const [key, value] of Object.entries(metadata)) {
181645
+ if (key.toLowerCase() === name.toLowerCase() && typeof value === "string" && value.trim() !== "") {
181646
+ return value;
181647
+ }
181648
+ }
181649
+ return;
181650
+ }
181651
+ function declaredSubTypes(decoded, resources) {
181652
+ const subTypes = new Map;
181653
+ let document2;
181654
+ try {
181655
+ document2 = JSON.parse(decoded);
181656
+ } catch {
181657
+ return subTypes;
181658
+ }
181659
+ const entries = document2?.resources;
181660
+ if (!Array.isArray(entries))
181661
+ return subTypes;
181662
+ const byBinding = new Map;
181663
+ for (const entry of entries) {
181664
+ if (!entry || typeof entry !== "object")
181665
+ continue;
181666
+ const { resource, key, metadata } = entry;
181667
+ if (typeof resource !== "string" || typeof key !== "string" || !SUBTYPED_BINDING_KINDS.has(resource.toLowerCase())) {
181668
+ continue;
181669
+ }
181670
+ const subType = metadataString(metadata, "SubType");
181671
+ if (subType)
181672
+ byBinding.set(`${resource}\x00${key}`, subType);
181673
+ }
181674
+ for (const resource of resources) {
181675
+ const subType = byBinding.get(`${resource.originalResourceType}\x00${resource.bindingKey ?? ""}`);
181676
+ if (subType)
181677
+ subTypes.set(resource, subType);
181678
+ }
181679
+ return subTypes;
181680
+ }
181681
+ async function resolveDeclaredKindMetadata(resolveKindMetadata, kind, type, declaredSubType) {
181682
+ if (type === undefined && declaredSubType !== undefined) {
181683
+ const declared = await resolveKindMetadata(kind, declaredSubType);
181684
+ if (declared?.typeMatched)
181685
+ return declared;
181686
+ }
181687
+ return resolveKindMetadata(kind, type);
181688
+ }
181831
181689
  function resolveBindingResourceIdentity(binding) {
181832
181690
  switch (binding.resourceType) {
181833
181691
  case models_BindingsResourceType.TimeTrigger:
@@ -181864,7 +181722,11 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181864
181722
  return result;
181865
181723
  }
181866
181724
  const serializer = services.container.resolve(Tokens.IBindingsMetadataSerializer);
181867
- const { bindings: allBindings, parseErrors } = await collectBindings2(bindingsJsonFallbackDirs, serializer, bindingSources(solutionDir, paths, uipxProjects, projectBindings));
181725
+ const {
181726
+ bindings: allBindings,
181727
+ parseErrors,
181728
+ subTypes
181729
+ } = await collectBindings2(bindingsJsonFallbackDirs, serializer, bindingSources(solutionDir, paths, uipxProjects, projectBindings));
181868
181730
  if (parseErrors.length > 0) {
181869
181731
  const detail = parseErrors.map((e) => `${e.path}: ${e.reason}`).join("; ");
181870
181732
  throw new Error(`Invalid bindings file — ${detail}`);
@@ -181902,7 +181764,29 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181902
181764
  const resolvedKeys = new Set;
181903
181765
  const overwrittenKeys = new Set;
181904
181766
  const bindingKey = (kind, name) => `${kind}:${name ?? ""}`.toLowerCase();
181905
- const selfProvisionedKeys = new Set((selfProvisioned ?? []).map((r) => bindingKey(r.kind, r.name)));
181767
+ const anyFolderSelfProvisioned = new Set;
181768
+ const solutionFolderSelfProvisioned = new Set;
181769
+ for (const r of selfProvisioned ?? []) {
181770
+ (r.solutionFolderOnly ? solutionFolderSelfProvisioned : anyFolderSelfProvisioned).add(bindingKey(r.kind, r.name));
181771
+ }
181772
+ const isSelfProvisioned = (kind, name, folderPath) => {
181773
+ const key = bindingKey(kind, name);
181774
+ return anyFolderSelfProvisioned.has(key) || !normalizeFolderPath(folderPath) && solutionFolderSelfProvisioned.has(key);
181775
+ };
181776
+ const importedThisRun = new Set;
181777
+ let referencedKeys;
181778
+ const coveringResource = async (resources, kind, name, folderPath, selfProvisioned) => {
181779
+ const match = findMatchingLocalResource(resources, kind, name, folderPath);
181780
+ if (!match || !selfProvisioned)
181781
+ return match;
181782
+ referencedKeys ??= readReferencedResourceKeys(services, builder);
181783
+ const referenced = await referencedKeys;
181784
+ const owned = resources.filter((r) => {
181785
+ const key = r.key?.toLowerCase();
181786
+ return !key || !importedThisRun.has(key) && !referenced.has(key);
181787
+ });
181788
+ return findMatchingLocalResource(owned, kind, name, folderPath);
181789
+ };
181906
181790
  const recordUnchecked = async (error, kind, name, directCloudKey) => {
181907
181791
  if (error) {
181908
181792
  const failure = classifyCatalogFailure(error);
@@ -181930,7 +181814,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181930
181814
  continue;
181931
181815
  }
181932
181816
  const isConnection = isConnectionBinding(binding);
181933
- const metadata = await resolveKindMetadata(kind, identity.type);
181817
+ const metadata = await resolveDeclaredKindMetadata(resolveKindMetadata, kind, identity.type, subTypes.get(binding));
181934
181818
  const name = getResourceName(binding);
181935
181819
  const folderPath = getFolderPathProperty(binding).defaultValue;
181936
181820
  const directCloudKey = isConnection ? getConnectionKey(binding) : undefined;
@@ -181940,7 +181824,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181940
181824
  if (!isConnection && !name) {
181941
181825
  continue;
181942
181826
  }
181943
- if (!isConnection && !normalizeFolderPath(folderPath) && findMatchingLocalResource(solution.resources ?? [], kind, name, folderPath)) {
181827
+ const selfProvisioned = !isConnection && isSelfProvisioned(kind, name, folderPath);
181828
+ if (!isConnection && !normalizeFolderPath(folderPath) && await coveringResource(solution.resources ?? [], kind, name, folderPath, selfProvisioned)) {
181944
181829
  result.skipped++;
181945
181830
  logger.info(`Skipping ${kind} "${name}" — an in-solution resource already covers this solution-relative binding`);
181946
181831
  continue;
@@ -181950,7 +181835,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181950
181835
  logger.info(`Skipping ${kind} "${name}" — the solution provisions this project itself; its member declaration covers the binding`);
181951
181836
  continue;
181952
181837
  }
181953
- if (!isConnection && selfProvisionedKeys.has(bindingKey(kind, name))) {
181838
+ if (selfProvisioned) {
181954
181839
  virtualCandidates.push({
181955
181840
  binding,
181956
181841
  kind,
@@ -181958,7 +181843,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181958
181843
  metadata,
181959
181844
  name,
181960
181845
  folderPath,
181961
- catalogMiss: false
181846
+ catalogMiss: false,
181847
+ selfProvisioned
181962
181848
  });
181963
181849
  continue;
181964
181850
  }
@@ -181981,7 +181867,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181981
181867
  metadata,
181982
181868
  name,
181983
181869
  folderPath,
181984
- catalogMiss: true
181870
+ catalogMiss: true,
181871
+ selfProvisioned: false
181985
181872
  });
181986
181873
  continue;
181987
181874
  }
@@ -182010,6 +181897,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
182010
181897
  if (rcsMatch.key) {
182011
181898
  knownResourceKeys.add(rcsMatch.key.toLowerCase());
182012
181899
  overwrittenKeys.add(rcsMatch.key.toLowerCase());
181900
+ importedThisRun.add(rcsMatch.key.toLowerCase());
182013
181901
  }
182014
181902
  result.imported++;
182015
181903
  logger.info(`Imported ${kind} "${rcsMatch.name}" (key: ${rcsMatch.key}) into solution`);
@@ -182036,7 +181924,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
182036
181924
  metadata,
182037
181925
  name,
182038
181926
  folderPath,
182039
- catalogMiss: false
181927
+ catalogMiss: false,
181928
+ selfProvisioned: false
182040
181929
  });
182041
181930
  }
182042
181931
  const virtualCandidatesSeen = new Set;
@@ -182048,7 +181937,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
182048
181937
  return true;
182049
181938
  });
182050
181939
  for (const candidate of dedupedVirtuals) {
182051
- const [syncError, created] = await catchError(createVirtualForBinding(builder, candidate.binding, candidate.kind, candidate.type, candidate.metadata, candidate.name, candidate.folderPath, result, candidate.catalogMiss));
181940
+ const [syncError, created] = await catchError(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)));
182052
181941
  if (syncError) {
182053
181942
  logger.warn(`Failed to create virtual ${candidate.kind}/${candidate.name}: ${syncError.message}`);
182054
181943
  } else if (created) {
@@ -182127,6 +182016,15 @@ async function reportOrphanedDeclarations(services, builder, bindings, result) {
182127
182016
  logger.warn(warning);
182128
182017
  }
182129
182018
  }
182019
+ async function readReferencedResourceKeys(services, builder) {
182020
+ const overwrites = services.container.resolve(Tokens.IResourceOverwritesService);
182021
+ const [error, entries] = await catchError(overwrites.getTenantResourceOverwritesAsync(builder.context));
182022
+ if (error) {
182023
+ logger.debug(`Could not read the resource overwrites, so no root resource is known to be an import: ${error.message}`);
182024
+ return new Set;
182025
+ }
182026
+ return new Set(entries.filter((e) => String(e.overwrite?.type) === REFERENCE_OVERWRITE).map((e) => e.solutionResourceKey.toLowerCase()));
182027
+ }
182130
182028
  async function isUncheckedBindingCovered(builder, knownResourceKeys, kind, name, directCloudKey) {
182131
182029
  if (directCloudKey) {
182132
182030
  return knownResourceKeys.has(directCloudKey.toLowerCase());
@@ -182226,10 +182124,10 @@ async function mintVirtualResource(builder, kind, type, name, metadata) {
182226
182124
  }
182227
182125
  return { resource, finalName: uniqueName };
182228
182126
  }
182229
- async function createVirtualForBinding(builder, _binding, kind, type, metadata, name, folderPath, result, catalogMiss) {
182127
+ async function createVirtualForBinding(builder, _binding, kind, type, metadata, name, folderPath, result, catalogMiss, findCovering) {
182230
182128
  const virtualizable = metadata?.virtualizable ?? false;
182231
182129
  const preLoadSolution = await builder.context.loadAsync();
182232
- const alreadyVirtualized = findMatchingLocalResource(preLoadSolution.resources, kind, name, undefined);
182130
+ const alreadyVirtualized = await findCovering(preLoadSolution.resources);
182233
182131
  if (alreadyVirtualized) {
182234
182132
  result.skipped++;
182235
182133
  logger.info(`Skipping virtual ${kind} "${name}" — existing resource "${alreadyVirtualized.name}" in solution_folder already covers this binding (requested folder "${folderPath}")`);
@@ -182291,6 +182189,35 @@ async function findResourceByKeyInRcs(builder, kind, expectedKey, folderPath, pr
182291
182189
  }
182292
182190
  return;
182293
182191
  }
182192
+ async function findResourcesByKeysInRcs(builder, kind, keys) {
182193
+ const wanted = new Set([...keys].map((key) => key.toLowerCase()));
182194
+ const found = new Map;
182195
+ let pageCursor;
182196
+ while (found.size < wanted.size) {
182197
+ const result = await builder.searchResourcesAsync(kind, undefined, undefined, pageCursor, 100, undefined, false);
182198
+ for (const folderResources of result.availableResources) {
182199
+ for (const resource of folderResources.resources) {
182200
+ const key = resource.key.toLowerCase();
182201
+ if (!wanted.has(key) || found.has(key))
182202
+ continue;
182203
+ found.set(key, {
182204
+ key: resource.key,
182205
+ name: resource.name,
182206
+ type: resource.type,
182207
+ folder: {
182208
+ fullyQualifiedName: folderResources.fullyQualifiedName,
182209
+ folderKey: folderResources.key,
182210
+ path: folderResources.path
182211
+ }
182212
+ });
182213
+ }
182214
+ }
182215
+ pageCursor = result.nextPage;
182216
+ if (!pageCursor)
182217
+ break;
182218
+ }
182219
+ return found;
182220
+ }
182294
182221
  async function searchRcsResources(builder, kind, name) {
182295
182222
  const [searchError, matches] = await catchError(searchRcsResourcesStrict(builder, kind, name));
182296
182223
  if (searchError) {
@@ -182531,6 +182458,17 @@ async function collectBindings2(bindingsJsonFallbackDirs, serializer, sources) {
182531
182458
  const fs = getFileSystem();
182532
182459
  const allBindings = [];
182533
182460
  const parseErrors = [];
182461
+ const subTypes = new Map;
182462
+ const collect = (parsed) => {
182463
+ if ("error" in parsed) {
182464
+ parseErrors.push(parsed.error);
182465
+ return;
182466
+ }
182467
+ allBindings.push(...parsed.resources);
182468
+ for (const [binding, subType] of parsed.subTypes) {
182469
+ subTypes.set(binding, subType);
182470
+ }
182471
+ };
182534
182472
  for (const { directory: dir, contribution } of sources) {
182535
182473
  if (contribution) {
182536
182474
  if (contribution.bindings.length === 0)
@@ -182539,10 +182477,7 @@ async function collectBindings2(bindingsJsonFallbackDirs, serializer, sources) {
182539
182477
  version: "2.0",
182540
182478
  resources: contribution.bindings
182541
182479
  }), `${dir} (bindings contributed by the project's tool; project ${contribution.projectId})`, serializer);
182542
- if ("error" in parsed)
182543
- parseErrors.push(parsed.error);
182544
- else
182545
- allBindings.push(...parsed.resources);
182480
+ collect(parsed);
182546
182481
  continue;
182547
182482
  }
182548
182483
  const v2Path = fs.path.join(dir, "bindings_v2.json");
@@ -182563,13 +182498,9 @@ async function collectBindings2(bindingsJsonFallbackDirs, serializer, sources) {
182563
182498
  });
182564
182499
  continue;
182565
182500
  }
182566
- const parsed = deserializeBindings(new TextDecoder().decode(content), bindingsPath, serializer);
182567
- if ("error" in parsed)
182568
- parseErrors.push(parsed.error);
182569
- else
182570
- allBindings.push(...parsed.resources);
182501
+ collect(deserializeBindings(new TextDecoder().decode(content), bindingsPath, serializer));
182571
182502
  }
182572
- return { bindings: allBindings, parseErrors };
182503
+ return { bindings: allBindings, parseErrors, subTypes };
182573
182504
  }
182574
182505
  function deserializeBindings(decoded, source, serializer) {
182575
182506
  let success;
@@ -182594,7 +182525,8 @@ function deserializeBindings(decoded, source, serializer) {
182594
182525
  }
182595
182526
  };
182596
182527
  }
182597
- return { resources: metadata?.resources ?? [] };
182528
+ const resources = metadata?.resources ?? [];
182529
+ return { resources, subTypes: declaredSubTypes(decoded, resources) };
182598
182530
  }
182599
182531
  async function syncAndLog(solutionDir, projectSubTypes, options) {
182600
182532
  const [syncError, syncResult] = await catchError(syncResourcesFromBindings(solutionDir, undefined, projectSubTypes, options?.projectBindings, options?.selfProvisioned));
@@ -182614,11 +182546,11 @@ async function syncAndLog(solutionDir, projectSubTypes, options) {
182614
182546
  throw new CatalogLookupError(syncResult.catalogLookupFailure, syncResult.unresolved);
182615
182547
  }
182616
182548
  }
182617
- var TYPE_IS_IDENTITY_REPLACE_OPTIONS, BINDINGS_JSON_FALLBACK_TYPES, IMPLICIT_CONNECTION2 = "ImplicitConnection", OverwriteRefreshError;
182549
+ var TYPE_IS_IDENTITY_REPLACE_OPTIONS, BINDINGS_JSON_FALLBACK_TYPES, IMPLICIT_CONNECTION2 = "ImplicitConnection", OverwriteRefreshError, SUBTYPED_BINDING_KINDS, REFERENCE_OVERWRITE = "Reference";
182618
182550
  var init_sync_resources_from_bindings = __esm(() => {
182619
182551
  init_src2();
182620
182552
  init_src();
182621
- init_bindings2();
182553
+ init_bindings3();
182622
182554
  init_mappings();
182623
182555
  init_solution2();
182624
182556
  init_service_tokens();
@@ -182635,6 +182567,400 @@ var init_sync_resources_from_bindings = __esm(() => {
182635
182567
  BINDINGS_JSON_FALLBACK_TYPES = new Set(["agent", "function"]);
182636
182568
  OverwriteRefreshError = class OverwriteRefreshError extends Error {
182637
182569
  };
182570
+ SUBTYPED_BINDING_KINDS = new Set([
182571
+ "asset",
182572
+ "bucket"
182573
+ ]);
182574
+ });
182575
+
182576
+ // ../solution-sdk/src/resources/services/imported-resources.ts
182577
+ async function resolveImportedResourcesAsync(services, builder, resources) {
182578
+ const overwrites = await services.container.resolve(Tokens.IResourceOverwritesService).getTenantResourceOverwritesAsync(builder.context);
182579
+ const tenantNames = new Map;
182580
+ for (const entry of overwrites) {
182581
+ if (String(entry.overwrite?.type) !== REFERENCE_OVERWRITE2)
182582
+ continue;
182583
+ tenantNames.set(entry.solutionResourceKey.toLowerCase(), entry.overwrite?.resourceName || undefined);
182584
+ }
182585
+ const resolved = new Map;
182586
+ const unresolved = new Map;
182587
+ const unchecked = new Set;
182588
+ const byKind = new Map;
182589
+ for (const resource of resources) {
182590
+ const key = resource.key?.toLowerCase();
182591
+ if (!key)
182592
+ continue;
182593
+ if (normalizeFolderPath(resource.folders?.[0]?.fullyQualifiedName)) {
182594
+ continue;
182595
+ }
182596
+ const recorded = tenantNames.has(key);
182597
+ if (!recorded && resource.isArtefactResource)
182598
+ continue;
182599
+ const kind = resource.kind ?? "";
182600
+ byKind.set(kind, [...byKind.get(kind) ?? [], { key, recorded }]);
182601
+ }
182602
+ const reportFailed = (entries, reason) => {
182603
+ for (const { key, recorded } of entries) {
182604
+ if (recorded)
182605
+ unresolved.set(key, reason);
182606
+ else
182607
+ unchecked.add(key);
182608
+ }
182609
+ };
182610
+ let failure;
182611
+ for (const [kind, entries] of byKind) {
182612
+ if (failure) {
182613
+ reportFailed(entries, failure);
182614
+ continue;
182615
+ }
182616
+ const [error, matches] = await catchError(findResourcesByKeysInRcs(builder, kind, entries.map((entry) => entry.key)));
182617
+ if (error) {
182618
+ const reason = `the Resource Catalog could not be searched: ${error.message}`;
182619
+ reportFailed(entries, reason);
182620
+ if (stopsCatalogLookups(classifyCatalogFailure(error))) {
182621
+ failure = reason;
182622
+ }
182623
+ continue;
182624
+ }
182625
+ for (const { key, recorded } of entries) {
182626
+ const match = matches.get(key);
182627
+ if (match?.folder?.fullyQualifiedName) {
182628
+ resolved.set(key, {
182629
+ name: tenantNames.get(key) ?? match.name,
182630
+ folderPath: match.folder.fullyQualifiedName
182631
+ });
182632
+ } else if (recorded) {
182633
+ unresolved.set(key, "the Resource Catalog no longer lists it");
182634
+ }
182635
+ }
182636
+ }
182637
+ return { resolved, unresolved, unchecked };
182638
+ }
182639
+ var REFERENCE_OVERWRITE2 = "Reference";
182640
+ var init_imported_resources = __esm(() => {
182641
+ init_src2();
182642
+ init_service_tokens();
182643
+ init_catalog_lookup_failure();
182644
+ init_local_resource_matcher();
182645
+ init_sync_resources_from_bindings();
182646
+ });
182647
+
182648
+ // ../solution-sdk/src/resources/services/project-artifacts-service.ts
182649
+ async function addProjectArtifactsToSolutionAsync(options) {
182650
+ const error = await createProjectInSolutionBuilder(options.solutionDir, options.projectId, options.projectName, normalizeProjectType(options.projectType), options.projectSubType);
182651
+ return error ? artifactFailure(options, error) : { Created: true };
182652
+ }
182653
+ function artifactFailure(options, error) {
182654
+ 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.");
182655
+ return { Created: false, Error: error.message };
182656
+ }
182657
+ var init_project_artifacts_service = __esm(() => {
182658
+ init_src2();
182659
+ init_solution_file();
182660
+ init_project_utils();
182661
+ });
182662
+
182663
+ // ../solution-sdk/src/resources/services/project-template-types.ts
182664
+ function hasBareTemplateRow(projectType) {
182665
+ reader ??= new EmbeddedProjectConfigurationReader;
182666
+ return reader.getTemplateResourcesByType(projectType, undefined, false).length > 0;
182667
+ }
182668
+ function hasAnyTemplateRow(projectType) {
182669
+ reader ??= new EmbeddedProjectConfigurationReader;
182670
+ const wanted = projectType.toLowerCase();
182671
+ return Object.keys(reader.getAll()).some((row) => {
182672
+ const key = row.toLowerCase();
182673
+ return key === wanted || key.startsWith(`${wanted}_`);
182674
+ });
182675
+ }
182676
+ var reader;
182677
+ var init_project_template_types = __esm(() => {
182678
+ init_config2();
182679
+ });
182680
+
182681
+ // ../solution-sdk/src/resources/services/remote-resources.ts
182682
+ function getRemoteResourceClients(services) {
182683
+ return {
182684
+ catalog: services.container.resolve(Tokens.IResourceCatalogClientProxy),
182685
+ importer: services.container.resolve(Tokens.IImportResourceHelper)
182686
+ };
182687
+ }
182688
+ async function findCatalogEntityAsync(catalog, query, match) {
182689
+ let pageCursor;
182690
+ do {
182691
+ const page = await catalog.searchFolderEntities({
182692
+ ...query,
182693
+ pageSize: 100,
182694
+ pageCursor
182695
+ });
182696
+ const found = (page.items ?? []).find(match);
182697
+ if (found) {
182698
+ return found;
182699
+ }
182700
+ pageCursor = page.nextPage ?? undefined;
182701
+ } while (pageCursor);
182702
+ return;
182703
+ }
182704
+ async function findCatalogEntitiesAsync(catalog, query, match) {
182705
+ const found = [];
182706
+ let pageCursor;
182707
+ do {
182708
+ const page = await catalog.searchFolderEntities({
182709
+ ...query,
182710
+ pageSize: 100,
182711
+ pageCursor
182712
+ });
182713
+ found.push(...(page.items ?? []).filter(match));
182714
+ pageCursor = page.nextPage ?? undefined;
182715
+ } while (pageCursor);
182716
+ return found;
182717
+ }
182718
+ function toResourceReference(entity) {
182719
+ return toCatalogReference({
182720
+ kind: entity.entityType ?? "",
182721
+ type: entity.entitySubType ?? undefined,
182722
+ key: entity.entityKey ?? "",
182723
+ name: entity.entityName ?? undefined,
182724
+ folderPath: entity.fullyQualifiedName ?? undefined,
182725
+ folderKey: entity.folderKey ?? undefined
182726
+ });
182727
+ }
182728
+ function toCatalogReference(reference) {
182729
+ const { folderPath, folderKey, ...rest } = reference;
182730
+ return {
182731
+ ...rest,
182732
+ folder: folderPath ? { fullyQualifiedName: folderPath, folderKey } : undefined
182733
+ };
182734
+ }
182735
+ async function exportResourceDefinitionAsync(importer, reference) {
182736
+ const [error, payload] = await catchError(importer.exportResourceAsync(reference));
182737
+ if (error) {
182738
+ throw withExportStatus(error);
182739
+ }
182740
+ return payload.resourceDefinitions.find((d) => d.key === reference.key);
182741
+ }
182742
+ function withExportStatus(error) {
182743
+ if (!(error instanceof Error) || !("exceptionData" in error)) {
182744
+ return error;
182745
+ }
182746
+ const data = error.exceptionData;
182747
+ const text = typeof data === "object" && data !== null ? data.errorMessage : undefined;
182748
+ const match = typeof text === "string" ? /^HTTP (\d{3})\b/.exec(text) : null;
182749
+ return match ? new ResourceExportError(error.message, Number(match[1]), error) : error;
182750
+ }
182751
+ function readSpecProperty(spec, name) {
182752
+ if (!spec) {
182753
+ return;
182754
+ }
182755
+ if (spec[name] !== undefined) {
182756
+ return spec[name];
182757
+ }
182758
+ const lower = name.toLowerCase();
182759
+ const key = Object.keys(spec).find((k) => k.toLowerCase() === lower);
182760
+ return key === undefined ? undefined : spec[key];
182761
+ }
182762
+ function readSpecEntryPoints(spec) {
182763
+ const entryPoints = parseJsonString(readSpecProperty(spec, "entryPoints"));
182764
+ if (!Array.isArray(entryPoints) || !entryPoints.every((entry) => entry !== null && typeof entry === "object")) {
182765
+ return;
182766
+ }
182767
+ return entryPoints.map((entry) => ({
182768
+ UniqueId: String(readSpecProperty(entry, "uniqueId") ?? ""),
182769
+ Path: String(readSpecProperty(entry, "path") ?? ""),
182770
+ DisplayName: String(readSpecProperty(entry, "displayName") ?? ""),
182771
+ InputArguments: readSpecProperty(entry, "inputArguments"),
182772
+ OutputArguments: readSpecProperty(entry, "outputArguments")
182773
+ }));
182774
+ }
182775
+ function parseJsonString(raw) {
182776
+ if (typeof raw !== "string") {
182777
+ return raw;
182778
+ }
182779
+ const [error, parsed] = catchError(() => JSON.parse(raw));
182780
+ return error ? undefined : parsed;
182781
+ }
182782
+ var ResourceExportError;
182783
+ var init_remote_resources = __esm(() => {
182784
+ init_src2();
182785
+ init_service_tokens();
182786
+ ResourceExportError = class ResourceExportError extends Error {
182787
+ status;
182788
+ constructor(message, status, cause) {
182789
+ super(message, { cause });
182790
+ this.status = status;
182791
+ this.name = "ResourceExportError";
182792
+ }
182793
+ };
182794
+ });
182795
+
182796
+ // ../solution-sdk/src/resources/services/resource-configurations.ts
182797
+ function isResourceKeyNotFound(error, resourceKey) {
182798
+ if (!(error instanceof Error))
182799
+ return false;
182800
+ const typed = error;
182801
+ const sameKey = (key) => key !== undefined && key.toLowerCase() === resourceKey.toLowerCase();
182802
+ if (typeof typed.resourceType === "string" && typeof typed.resourceKey === "string") {
182803
+ return ROOT_RESOURCE_TYPES.has(typed.resourceType.toLowerCase()) && sameKey(typed.resourceKey);
182804
+ }
182805
+ return sameKey(KEY_NOT_FOUND.exec(error.message.trim())?.[1]);
182806
+ }
182807
+ async function refreshArtefactSpecsAsync(builder, configurations) {
182808
+ const resources = new Map;
182809
+ const [loadError, solution] = await catchError(builder.context.loadAsync());
182810
+ if (loadError || !solution)
182811
+ return resources;
182812
+ for (const configuration of configurations) {
182813
+ const resource = solution.resources.find((r) => r.key === configuration?.key);
182814
+ if (!resource)
182815
+ continue;
182816
+ resources.set(resource.key, resource);
182817
+ if (!resource.projectKey)
182818
+ continue;
182819
+ configuration.spec = await applyEntryPointEnhancementAsync(builder.context, resource, configuration.spec ?? {});
182820
+ }
182821
+ return resources;
182822
+ }
182823
+ async function exportResourceConfigurationsAsync(services, resourceKey, hint = {}) {
182824
+ const { catalog, importer } = getRemoteResourceClients(services);
182825
+ const byKey = (item) => item.entityKey === resourceKey;
182826
+ const entity = (hint.name ? await findCatalogEntityAsync(catalog, { name: hint.name }, byKey) : undefined) ?? await findCatalogEntityAsync(catalog, {}, byKey);
182827
+ if (!entity) {
182828
+ throw new Error(`Resource '${resourceKey}' was not found in the solution or in the resource catalog`);
182829
+ }
182830
+ const payload = await importer.exportResourceAsync(toResourceReference(entity));
182831
+ const definitions = payload.resourceDefinitions ?? [];
182832
+ if (definitions.length === 0) {
182833
+ throw new Error(`FPS export for '${resourceKey}' returned no resource definitions`);
182834
+ }
182835
+ return {
182836
+ resources: definitions.map((d) => ({
182837
+ key: d.key ?? "",
182838
+ spec: d.spec ?? {},
182839
+ locks: d.locks ?? [],
182840
+ apiVersion: d.apiVersion,
182841
+ isOverridable: d.isOverridable,
182842
+ name: d.name ?? "",
182843
+ kind: d.kind ?? "",
182844
+ dependencies: (d.dependencies ?? []).map((dep) => ({
182845
+ kind: dep.kind ?? "",
182846
+ name: dep.name ?? ""
182847
+ }))
182848
+ }))
182849
+ };
182850
+ }
182851
+ async function readLocalAsync(builder, resourceKey, read) {
182852
+ if (!builder)
182853
+ return;
182854
+ const [error, value] = await catchError(read(builder));
182855
+ if (!error)
182856
+ return { builder, value };
182857
+ if (isResourceKeyNotFound(error, resourceKey))
182858
+ return;
182859
+ throw error;
182860
+ }
182861
+ async function readResourceConfigurationsAsync(services, builder, resourceKey, hint = {}) {
182862
+ const local = await readLocalAsync(builder, resourceKey, (b) => b.getAllConfigurationsAsync(resourceKey));
182863
+ if (!local) {
182864
+ return exportResourceConfigurationsAsync(services, resourceKey, hint);
182865
+ }
182866
+ await refreshArtefactSpecsAsync(local.builder, local.value?.resources ?? []);
182867
+ return local.value;
182868
+ }
182869
+ async function readResourceConfigurationAsync(services, builder, resourceKey) {
182870
+ const local = await readLocalAsync(builder, resourceKey, (b) => b.getConfigurationAsync(resourceKey));
182871
+ if (local) {
182872
+ const configuration = local.value;
182873
+ const resources = await refreshArtefactSpecsAsync(local.builder, [
182874
+ configuration
182875
+ ]);
182876
+ return { configuration, resource: resources.get(configuration.key) };
182877
+ }
182878
+ const { resources } = await exportResourceConfigurationsAsync(services, resourceKey);
182879
+ const primary = resources.find((r) => r.key === resourceKey) ?? resources[0];
182880
+ const { key, spec, locks, apiVersion, isOverridable } = primary;
182881
+ return { configuration: { key, spec, locks, apiVersion, isOverridable } };
182882
+ }
182883
+ var ROOT_RESOURCE_TYPES, KEY_NOT_FOUND;
182884
+ var init_resource_configurations = __esm(() => {
182885
+ init_src2();
182886
+ init_entry_point_spec_enhancer();
182887
+ init_remote_resources();
182888
+ ROOT_RESOURCE_TYPES = new Set(["resource", "solutionresource"]);
182889
+ KEY_NOT_FOUND = /^(?:Solution)?Resource with key '([^']+)' was not found$/i;
182890
+ });
182891
+
182892
+ // ../solution-sdk/src/resources/services/resource-lookup.ts
182893
+ async function findResourcesByNameAsync(services, builder, { kind, name, subTypes, folderKey }) {
182894
+ const same = (a, b) => (a ?? "").toLowerCase() === b.toLowerCase();
182895
+ const ofSubType = (type) => subTypes === undefined || subTypes.some((t) => same(type, t));
182896
+ if (builder) {
182897
+ const solution = await builder.context.loadAsync();
182898
+ const local = solution.resources.filter((r) => same(r.kind, kind) && same(r.name, name) && ofSubType(r.type)).map((r) => ({
182899
+ key: r.key,
182900
+ local: true,
182901
+ folderPath: r.folders?.[0]?.fullyQualifiedName
182902
+ }));
182903
+ if (local.length > 0)
182904
+ return local;
182905
+ }
182906
+ const { catalog } = getRemoteResourceClients(services);
182907
+ 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)));
182908
+ return rows.map((row) => ({
182909
+ key: row.entityKey ?? "",
182910
+ local: false,
182911
+ folderPath: row.fullyQualifiedName ?? undefined,
182912
+ folderKey: row.folderKey ?? undefined
182913
+ }));
182914
+ }
182915
+ var init_resource_lookup = __esm(() => {
182916
+ init_remote_resources();
182917
+ });
182918
+
182919
+ // ../solution-sdk/src/resources/services/resource-name.ts
182920
+ function hasControlChar(value) {
182921
+ for (let i = 0;i < value.length; i++) {
182922
+ if (value.charCodeAt(i) < 32)
182923
+ return true;
182924
+ }
182925
+ return false;
182926
+ }
182927
+ function hasUnsafeNameChars(name) {
182928
+ return UNSAFE_NAME_CHARS.test(name) || hasControlChar(name);
182929
+ }
182930
+ function validateResourceName(name, options = {}) {
182931
+ const optionName = options.optionName ?? "--name";
182932
+ if (name.trim() === "") {
182933
+ return {
182934
+ ok: false,
182935
+ message: `${optionName} must not be blank`,
182936
+ instructions: "Pass a non-empty resource name."
182937
+ };
182938
+ }
182939
+ if (name.length > MAX_RESOURCE_NAME_LENGTH) {
182940
+ return {
182941
+ ok: false,
182942
+ message: `${optionName} exceeds the ${MAX_RESOURCE_NAME_LENGTH}-character limit (got ${name.length})`,
182943
+ instructions: "Shorten the resource name. Orchestrator name limits are kind-specific (queues cap at 50, assets at 256)."
182944
+ };
182945
+ }
182946
+ if (hasUnsafeNameChars(name)) {
182947
+ return {
182948
+ ok: false,
182949
+ message: `${optionName} contains unsafe characters`,
182950
+ instructions: 'Resource names cannot contain path separators (/, \\), control characters, or any of: : * ? " < > |'
182951
+ };
182952
+ }
182953
+ return { ok: true };
182954
+ }
182955
+ function assertValidResourceName(name, options = {}) {
182956
+ const result = validateResourceName(name, options);
182957
+ if (!result.ok) {
182958
+ throw new Error(`${result.message}. ${result.instructions}`);
182959
+ }
182960
+ }
182961
+ var MAX_RESOURCE_NAME_LENGTH = 256, UNSAFE_NAME_CHARS;
182962
+ var init_resource_name = __esm(() => {
182963
+ UNSAFE_NAME_CHARS = /[\\/:*?"<>|]/;
182638
182964
  });
182639
182965
 
182640
182966
  // ../solution-sdk/src/resources/services/resource-refresh-service.ts
@@ -182675,7 +183001,11 @@ async function resourceRefreshAsync(solutionPath = ".", options = {}) {
182675
183001
  if (bindingsError) {
182676
183002
  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'.`);
182677
183003
  }
182678
- const [syncError, result] = await catchError(syncResourcesFromBindings(resolvedPath, undefined, projectSubTypes ?? new Map, projectBindings ?? new Map, undefined, {
183004
+ const [selfProvisionedError, selfProvisioned] = await catchError(options.resolveSelfProvisionedAsync?.() ?? Promise.resolve([]));
183005
+ if (selfProvisionedError) {
183006
+ 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'.`);
183007
+ }
183008
+ const [syncError, result] = await catchError(syncResourcesFromBindings(resolvedPath, undefined, projectSubTypes ?? new Map, projectBindings ?? new Map, selfProvisioned?.length ? [...selfProvisioned] : undefined, {
182679
183009
  bindingsComplete: !bindingsError && (options.isProjectBindingsComplete?.() ?? true)
182680
183010
  }));
182681
183011
  if (syncError) {
@@ -182918,6 +183248,7 @@ __export(exports_resources, {
182918
183248
  findProjectFile: () => findProjectFile,
182919
183249
  findResourceByKeyInRcs: () => findResourceByKeyInRcs,
182920
183250
  findResourceInRcs: () => findResourceInRcs,
183251
+ findResourcesByKeysInRcs: () => findResourcesByKeysInRcs,
182921
183252
  findResourcesByNameAsync: () => findResourcesByNameAsync,
182922
183253
  formatResourceSubtypes: () => formatResourceSubtypes,
182923
183254
  getRemoteResourceClients: () => getRemoteResourceClients,
@@ -182939,6 +183270,7 @@ __export(exports_resources, {
182939
183270
  readSpecProperty: () => readSpecProperty,
182940
183271
  readUipxProjects: () => readUipxProjects,
182941
183272
  refreshArtefactSpecsAsync: () => refreshArtefactSpecsAsync,
183273
+ resolveImportedResourcesAsync: () => resolveImportedResourcesAsync,
182942
183274
  resolveProjectDirFromManifest: () => resolveProjectDirFromManifest,
182943
183275
  resolveResourceKindMetadata: () => resolveResourceKindMetadata,
182944
183276
  resolveSolutionFilePath: () => resolveSolutionFilePath,
@@ -182963,6 +183295,7 @@ var init_resources = __esm(() => {
182963
183295
  init_project_utils();
182964
183296
  init_resource_builder_init();
182965
183297
  init_entry_point_spec_enhancer();
183298
+ init_imported_resources();
182966
183299
  init_local_resource_matcher();
182967
183300
  init_project_artifacts_service();
182968
183301
  init_project_template_types();
@@ -288905,4 +289238,4 @@ export {
288905
289238
  withPimsCall
288906
289239
  };
288907
289240
 
288908
- //# debugId=9BD086C9FD64EDCC64756E2164756E21
289241
+ //# debugId=24C063A661F38ADE64756E2164756E21