@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.
@@ -1225,7 +1225,7 @@ function rotr(value, bits) {
1225
1225
  return (value >>> bits | value << 32 - bits) >>> 0;
1226
1226
  }
1227
1227
  function sha256Words(input) {
1228
- const bytes = new TextEncoder().encode(input);
1228
+ const bytes = typeof input === "string" ? new TextEncoder().encode(input) : input;
1229
1229
  const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
1230
1230
  const buffer = new Uint8Array(paddedLength);
1231
1231
  buffer.set(bytes);
@@ -11929,6 +11929,7 @@ var init_command_attribution = __esm(() => {
11929
11929
  ["uipath-maestro-bpmn", "uipath-maestro-case", "uipath-maestro-flow"]
11930
11930
  ],
11931
11931
  ["agenthub", "build", ["uipath-mcp-servers"]],
11932
+ ["ontology", "build", ["uipath-ontology"]],
11932
11933
  ["solution", "build", ["uipath-planner", "uipath-solution"]],
11933
11934
  ["platform", "operate", ["uipath-platform"]],
11934
11935
  ["quality", "troubleshoot", ["uipath-review"]],
@@ -11969,6 +11970,7 @@ var init_command_attribution = __esm(() => {
11969
11970
  ["test-manager", "operate", ["uip.tm"]],
11970
11971
  ["vertical-solutions", "build", ["uip.vss"]],
11971
11972
  ["data-fabric", "operate", ["uip.df"]],
11973
+ ["ontology", "build", ["uip.ont"]],
11972
11974
  ["integration-service", "build", ["uip.is"]],
11973
11975
  ["orchestrator", "operate", ["uip.or"]],
11974
11976
  [
@@ -144811,7 +144813,7 @@ var init_package = __esm(() => {
144811
144813
  name: "@uipath/integrationservice-sdk",
144812
144814
  author: "UiPath",
144813
144815
  license: "SEE LICENSE IN LICENSE.txt",
144814
- version: "1.207.0-preview.338",
144816
+ version: "1.207.0-preview.340",
144815
144817
  repository: {
144816
144818
  type: "git",
144817
144819
  url: "https://github.com/UiPath/cli.git",
@@ -153585,6 +153587,131 @@ var init_models3 = __esm(() => {
153585
153587
  });
153586
153588
  // ../packager/packager-core/src/package-descriptor/index.ts
153587
153589
  var init_package_descriptor = () => {};
153590
+
153591
+ // ../packager/packager-core/src/resource-declarations/languages.ts
153592
+ function resourceDeclarationsPaths(language) {
153593
+ const name = RESOURCE_DECLARATIONS_FILE_NAMES[language];
153594
+ return [name, `src/${name}`];
153595
+ }
153596
+ var RESOURCE_DECLARATIONS_FILE_NAMES;
153597
+ var init_languages = __esm(() => {
153598
+ RESOURCE_DECLARATIONS_FILE_NAMES = {
153599
+ typescript: "uipath_resources.ts",
153600
+ python: "uipath_resources.py"
153601
+ };
153602
+ });
153603
+
153604
+ // ../packager/packager-core/src/resource-declarations/scanner.ts
153605
+ var closingIndexOf;
153606
+ var init_scanner = __esm(() => {
153607
+ closingIndexOf = new Map;
153608
+ });
153609
+
153610
+ // ../packager/packager-core/src/resource-declarations/declarations.ts
153611
+ var RESOURCE_DECLARATIONS_FILE_NAME, RESOURCE_DECLARATIONS_PATHS, MAX_RESOURCE_DECLARATIONS_LENGTH;
153612
+ var init_declarations = __esm(() => {
153613
+ init_languages();
153614
+ init_scanner();
153615
+ RESOURCE_DECLARATIONS_FILE_NAME = RESOURCE_DECLARATIONS_FILE_NAMES.typescript;
153616
+ RESOURCE_DECLARATIONS_PATHS = resourceDeclarationsPaths("typescript");
153617
+ MAX_RESOURCE_DECLARATIONS_LENGTH = 1024 * 1024;
153618
+ });
153619
+
153620
+ // ../packager/packager-core/src/resource-declarations/bindings.ts
153621
+ var init_bindings = __esm(() => {
153622
+ init_declarations();
153623
+ });
153624
+
153625
+ // ../packager/packager-core/src/resource-declarations/editor.ts
153626
+ var RESERVED_IDENTIFIERS, SUB_TYPES_BY_KIND;
153627
+ var init_editor = __esm(() => {
153628
+ init_bindings();
153629
+ init_declarations();
153630
+ init_scanner();
153631
+ RESERVED_IDENTIFIERS = new Set([
153632
+ "constructor",
153633
+ "prototype",
153634
+ "name",
153635
+ "length",
153636
+ "caller",
153637
+ "arguments"
153638
+ ]);
153639
+ SUB_TYPES_BY_KIND = {
153640
+ asset: new Set(["text", "integer", "bool", "credential", "secret", "json"]),
153641
+ bucket: new Set(["orchestrator", "amazon", "azure"])
153642
+ };
153643
+ });
153644
+
153645
+ // ../packager/packager-core/src/resource-declarations/python.ts
153646
+ var PYTHON_KEYWORDS;
153647
+ var init_python = __esm(() => {
153648
+ init_bindings();
153649
+ init_declarations();
153650
+ init_editor();
153651
+ init_languages();
153652
+ init_scanner();
153653
+ PYTHON_KEYWORDS = new Set([
153654
+ "and",
153655
+ "as",
153656
+ "assert",
153657
+ "async",
153658
+ "await",
153659
+ "break",
153660
+ "class",
153661
+ "continue",
153662
+ "def",
153663
+ "del",
153664
+ "elif",
153665
+ "else",
153666
+ "except",
153667
+ "finally",
153668
+ "for",
153669
+ "from",
153670
+ "global",
153671
+ "if",
153672
+ "import",
153673
+ "in",
153674
+ "is",
153675
+ "lambda",
153676
+ "nonlocal",
153677
+ "not",
153678
+ "or",
153679
+ "pass",
153680
+ "raise",
153681
+ "return",
153682
+ "try",
153683
+ "while",
153684
+ "with",
153685
+ "yield"
153686
+ ]);
153687
+ });
153688
+
153689
+ // ../packager/packager-core/src/resource-declarations/source.ts
153690
+ var init_source = __esm(() => {
153691
+ init_bindings();
153692
+ init_declarations();
153693
+ init_editor();
153694
+ init_languages();
153695
+ init_python();
153696
+ });
153697
+
153698
+ // ../packager/packager-core/src/resource-declarations/project.ts
153699
+ var init_project = __esm(() => {
153700
+ init_bindings();
153701
+ init_declarations();
153702
+ init_source();
153703
+ });
153704
+
153705
+ // ../packager/packager-core/src/resource-declarations/index.ts
153706
+ var init_resource_declarations = __esm(() => {
153707
+ init_bindings();
153708
+ init_declarations();
153709
+ init_editor();
153710
+ init_languages();
153711
+ init_project();
153712
+ init_python();
153713
+ init_source();
153714
+ });
153588
153715
  // ../packager/packager-core/src/services/project-id.ts
153589
153716
  var init_project_id = () => {};
153590
153717
 
@@ -153680,6 +153807,7 @@ var init_src5 = __esm(() => {
153680
153807
  init_i18n();
153681
153808
  init_models3();
153682
153809
  init_package_descriptor();
153810
+ init_resource_declarations();
153683
153811
  init_services();
153684
153812
  });
153685
153813
 
@@ -160450,7 +160578,7 @@ var init_binding_overwrites_mapping_handler = __esm(() => {
160450
160578
  });
160451
160579
 
160452
160580
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/index.js
160453
- var init_bindings = __esm(() => {
160581
+ var init_bindings2 = __esm(() => {
160454
160582
  init_models5();
160455
160583
  init_bindings_metadata_serializer();
160456
160584
  init_bindings_requests();
@@ -161612,7 +161740,7 @@ var init_solution_builder = __esm(() => {
161612
161740
  init_detach_resource_file_command();
161613
161741
  init_exceptions();
161614
161742
  init_internal();
161615
- init_bindings();
161743
+ init_bindings2();
161616
161744
  init_solution();
161617
161745
  SolutionBuilder = class SolutionBuilder {
161618
161746
  dispose() {
@@ -173297,7 +173425,7 @@ function isGuid3(value) {
173297
173425
  }
173298
173426
  var BINDINGS_RESOLUTION_BATCH_SIZE = 10;
173299
173427
  var init_get_exportable_items_based_on_bindings_handler = __esm(() => {
173300
- init_bindings();
173428
+ init_bindings2();
173301
173429
  init_resource_subtype_mapper();
173302
173430
  init_exceptions();
173303
173431
  });
@@ -174909,7 +175037,7 @@ var init_container = __esm(() => {
174909
175037
  init_mediator2();
174910
175038
  init_resource_builder();
174911
175039
  init_handlers();
174912
- init_bindings();
175040
+ init_bindings2();
174913
175041
  init_solution();
174914
175042
  init_feature_flag_provider();
174915
175043
  init_clients();
@@ -181175,152 +181303,14 @@ var init_local_resource_matcher = __esm(() => {
181175
181303
  ORPHAN_CHECKED_KINDS = new Set(["process", "app"]);
181176
181304
  });
181177
181305
 
181178
- // ../solution-sdk/src/resources/services/project-artifacts-service.ts
181179
- async function addProjectArtifactsToSolutionAsync(options) {
181180
- const error = await createProjectInSolutionBuilder(options.solutionDir, options.projectId, options.projectName, normalizeProjectType(options.projectType), options.projectSubType);
181181
- return error ? artifactFailure(options, error) : { Created: true };
181182
- }
181183
- function artifactFailure(options, error) {
181184
- 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.");
181185
- return { Created: false, Error: error.message };
181186
- }
181187
- var init_project_artifacts_service = __esm(() => {
181188
- init_src2();
181189
- init_solution_file();
181190
- init_project_utils();
181191
- });
181192
-
181193
- // ../solution-sdk/src/resources/services/project-template-types.ts
181194
- function hasBareTemplateRow(projectType) {
181195
- reader ??= new EmbeddedProjectConfigurationReader;
181196
- return reader.getTemplateResourcesByType(projectType, undefined, false).length > 0;
181197
- }
181198
- function hasAnyTemplateRow(projectType) {
181199
- reader ??= new EmbeddedProjectConfigurationReader;
181200
- const wanted = projectType.toLowerCase();
181201
- return Object.keys(reader.getAll()).some((row) => {
181202
- const key = row.toLowerCase();
181203
- return key === wanted || key.startsWith(`${wanted}_`);
181204
- });
181205
- }
181206
- var reader;
181207
- var init_project_template_types = __esm(() => {
181208
- init_config2();
181306
+ // ../../node_modules/@uipath/resource-builder-sdk/dist/entries/bindings.js
181307
+ var init_bindings3 = __esm(() => {
181308
+ init_bindings2();
181209
181309
  });
181210
181310
 
181211
- // ../solution-sdk/src/resources/services/remote-resources.ts
181212
- function getRemoteResourceClients(services) {
181213
- return {
181214
- catalog: services.container.resolve(Tokens.IResourceCatalogClientProxy),
181215
- importer: services.container.resolve(Tokens.IImportResourceHelper)
181216
- };
181217
- }
181218
- async function findCatalogEntityAsync(catalog, query, match) {
181219
- let pageCursor;
181220
- do {
181221
- const page = await catalog.searchFolderEntities({
181222
- ...query,
181223
- pageSize: 100,
181224
- pageCursor
181225
- });
181226
- const found = (page.items ?? []).find(match);
181227
- if (found) {
181228
- return found;
181229
- }
181230
- pageCursor = page.nextPage ?? undefined;
181231
- } while (pageCursor);
181232
- return;
181233
- }
181234
- async function findCatalogEntitiesAsync(catalog, query, match) {
181235
- const found = [];
181236
- let pageCursor;
181237
- do {
181238
- const page = await catalog.searchFolderEntities({
181239
- ...query,
181240
- pageSize: 100,
181241
- pageCursor
181242
- });
181243
- found.push(...(page.items ?? []).filter(match));
181244
- pageCursor = page.nextPage ?? undefined;
181245
- } while (pageCursor);
181246
- return found;
181247
- }
181248
- function toResourceReference(entity) {
181249
- return toCatalogReference({
181250
- kind: entity.entityType ?? "",
181251
- type: entity.entitySubType ?? undefined,
181252
- key: entity.entityKey ?? "",
181253
- name: entity.entityName ?? undefined,
181254
- folderPath: entity.fullyQualifiedName ?? undefined,
181255
- folderKey: entity.folderKey ?? undefined
181256
- });
181257
- }
181258
- function toCatalogReference(reference) {
181259
- const { folderPath, folderKey, ...rest } = reference;
181260
- return {
181261
- ...rest,
181262
- folder: folderPath ? { fullyQualifiedName: folderPath, folderKey } : undefined
181263
- };
181264
- }
181265
- async function exportResourceDefinitionAsync(importer, reference) {
181266
- const [error, payload] = await catchError(importer.exportResourceAsync(reference));
181267
- if (error) {
181268
- throw withExportStatus(error);
181269
- }
181270
- return payload.resourceDefinitions.find((d) => d.key === reference.key);
181271
- }
181272
- function withExportStatus(error) {
181273
- if (!(error instanceof Error) || !("exceptionData" in error)) {
181274
- return error;
181275
- }
181276
- const data = error.exceptionData;
181277
- const text = typeof data === "object" && data !== null ? data.errorMessage : undefined;
181278
- const match = typeof text === "string" ? /^HTTP (\d{3})\b/.exec(text) : null;
181279
- return match ? new ResourceExportError(error.message, Number(match[1]), error) : error;
181280
- }
181281
- function readSpecProperty(spec, name) {
181282
- if (!spec) {
181283
- return;
181284
- }
181285
- if (spec[name] !== undefined) {
181286
- return spec[name];
181287
- }
181288
- const lower = name.toLowerCase();
181289
- const key = Object.keys(spec).find((k) => k.toLowerCase() === lower);
181290
- return key === undefined ? undefined : spec[key];
181291
- }
181292
- function readSpecEntryPoints(spec) {
181293
- const entryPoints = parseJsonString(readSpecProperty(spec, "entryPoints"));
181294
- if (!Array.isArray(entryPoints) || !entryPoints.every((entry) => entry !== null && typeof entry === "object")) {
181295
- return;
181296
- }
181297
- return entryPoints.map((entry) => ({
181298
- UniqueId: String(readSpecProperty(entry, "uniqueId") ?? ""),
181299
- Path: String(readSpecProperty(entry, "path") ?? ""),
181300
- DisplayName: String(readSpecProperty(entry, "displayName") ?? ""),
181301
- InputArguments: readSpecProperty(entry, "inputArguments"),
181302
- OutputArguments: readSpecProperty(entry, "outputArguments")
181303
- }));
181304
- }
181305
- function parseJsonString(raw) {
181306
- if (typeof raw !== "string") {
181307
- return raw;
181308
- }
181309
- const [error, parsed] = catchError(() => JSON.parse(raw));
181310
- return error ? undefined : parsed;
181311
- }
181312
- var ResourceExportError;
181313
- var init_remote_resources = __esm(() => {
181314
- init_src2();
181315
- init_service_tokens();
181316
- ResourceExportError = class ResourceExportError extends Error {
181317
- status;
181318
- constructor(message, status, cause) {
181319
- super(message, { cause });
181320
- this.status = status;
181321
- this.name = "ResourceExportError";
181322
- }
181323
- };
181311
+ // ../../node_modules/@uipath/resource-builder-sdk/dist/mappings/index.js
181312
+ var init_mappings = __esm(() => {
181313
+ init_resource_subtype_mapper();
181324
181314
  });
181325
181315
 
181326
181316
  // ../solution-sdk/src/resources/services/resource-casing.ts
@@ -181489,186 +181479,6 @@ var init_resource_casing = __esm(() => {
181489
181479
  init_src();
181490
181480
  });
181491
181481
 
181492
- // ../solution-sdk/src/resources/services/resource-configurations.ts
181493
- function isResourceKeyNotFound(error, resourceKey) {
181494
- if (!(error instanceof Error))
181495
- return false;
181496
- const typed = error;
181497
- const sameKey = (key) => key !== undefined && key.toLowerCase() === resourceKey.toLowerCase();
181498
- if (typeof typed.resourceType === "string" && typeof typed.resourceKey === "string") {
181499
- return ROOT_RESOURCE_TYPES.has(typed.resourceType.toLowerCase()) && sameKey(typed.resourceKey);
181500
- }
181501
- return sameKey(KEY_NOT_FOUND.exec(error.message.trim())?.[1]);
181502
- }
181503
- async function refreshArtefactSpecsAsync(builder, configurations) {
181504
- const resources = new Map;
181505
- const [loadError, solution] = await catchError(builder.context.loadAsync());
181506
- if (loadError || !solution)
181507
- return resources;
181508
- for (const configuration of configurations) {
181509
- const resource = solution.resources.find((r) => r.key === configuration?.key);
181510
- if (!resource)
181511
- continue;
181512
- resources.set(resource.key, resource);
181513
- if (!resource.projectKey)
181514
- continue;
181515
- configuration.spec = await applyEntryPointEnhancementAsync(builder.context, resource, configuration.spec ?? {});
181516
- }
181517
- return resources;
181518
- }
181519
- async function exportResourceConfigurationsAsync(services, resourceKey, hint = {}) {
181520
- const { catalog, importer } = getRemoteResourceClients(services);
181521
- const byKey = (item) => item.entityKey === resourceKey;
181522
- const entity = (hint.name ? await findCatalogEntityAsync(catalog, { name: hint.name }, byKey) : undefined) ?? await findCatalogEntityAsync(catalog, {}, byKey);
181523
- if (!entity) {
181524
- throw new Error(`Resource '${resourceKey}' was not found in the solution or in the resource catalog`);
181525
- }
181526
- const payload = await importer.exportResourceAsync(toResourceReference(entity));
181527
- const definitions = payload.resourceDefinitions ?? [];
181528
- if (definitions.length === 0) {
181529
- throw new Error(`FPS export for '${resourceKey}' returned no resource definitions`);
181530
- }
181531
- return {
181532
- resources: definitions.map((d) => ({
181533
- key: d.key ?? "",
181534
- spec: d.spec ?? {},
181535
- locks: d.locks ?? [],
181536
- apiVersion: d.apiVersion,
181537
- isOverridable: d.isOverridable,
181538
- name: d.name ?? "",
181539
- kind: d.kind ?? "",
181540
- dependencies: (d.dependencies ?? []).map((dep) => ({
181541
- kind: dep.kind ?? "",
181542
- name: dep.name ?? ""
181543
- }))
181544
- }))
181545
- };
181546
- }
181547
- async function readLocalAsync(builder, resourceKey, read) {
181548
- if (!builder)
181549
- return;
181550
- const [error, value] = await catchError(read(builder));
181551
- if (!error)
181552
- return { builder, value };
181553
- if (isResourceKeyNotFound(error, resourceKey))
181554
- return;
181555
- throw error;
181556
- }
181557
- async function readResourceConfigurationsAsync(services, builder, resourceKey, hint = {}) {
181558
- const local = await readLocalAsync(builder, resourceKey, (b) => b.getAllConfigurationsAsync(resourceKey));
181559
- if (!local) {
181560
- return exportResourceConfigurationsAsync(services, resourceKey, hint);
181561
- }
181562
- await refreshArtefactSpecsAsync(local.builder, local.value?.resources ?? []);
181563
- return local.value;
181564
- }
181565
- async function readResourceConfigurationAsync(services, builder, resourceKey) {
181566
- const local = await readLocalAsync(builder, resourceKey, (b) => b.getConfigurationAsync(resourceKey));
181567
- if (local) {
181568
- const configuration = local.value;
181569
- const resources = await refreshArtefactSpecsAsync(local.builder, [
181570
- configuration
181571
- ]);
181572
- return { configuration, resource: resources.get(configuration.key) };
181573
- }
181574
- const { resources } = await exportResourceConfigurationsAsync(services, resourceKey);
181575
- const primary = resources.find((r) => r.key === resourceKey) ?? resources[0];
181576
- const { key, spec, locks, apiVersion, isOverridable } = primary;
181577
- return { configuration: { key, spec, locks, apiVersion, isOverridable } };
181578
- }
181579
- var ROOT_RESOURCE_TYPES, KEY_NOT_FOUND;
181580
- var init_resource_configurations = __esm(() => {
181581
- init_src2();
181582
- init_entry_point_spec_enhancer();
181583
- init_remote_resources();
181584
- ROOT_RESOURCE_TYPES = new Set(["resource", "solutionresource"]);
181585
- KEY_NOT_FOUND = /^(?:Solution)?Resource with key '([^']+)' was not found$/i;
181586
- });
181587
-
181588
- // ../solution-sdk/src/resources/services/resource-lookup.ts
181589
- async function findResourcesByNameAsync(services, builder, { kind, name, subTypes, folderKey }) {
181590
- const same = (a, b) => (a ?? "").toLowerCase() === b.toLowerCase();
181591
- const ofSubType = (type) => subTypes === undefined || subTypes.some((t) => same(type, t));
181592
- if (builder) {
181593
- const solution = await builder.context.loadAsync();
181594
- const local = solution.resources.filter((r) => same(r.kind, kind) && same(r.name, name) && ofSubType(r.type)).map((r) => ({
181595
- key: r.key,
181596
- local: true,
181597
- folderPath: r.folders?.[0]?.fullyQualifiedName
181598
- }));
181599
- if (local.length > 0)
181600
- return local;
181601
- }
181602
- const { catalog } = getRemoteResourceClients(services);
181603
- 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)));
181604
- return rows.map((row) => ({
181605
- key: row.entityKey ?? "",
181606
- local: false,
181607
- folderPath: row.fullyQualifiedName ?? undefined,
181608
- folderKey: row.folderKey ?? undefined
181609
- }));
181610
- }
181611
- var init_resource_lookup = __esm(() => {
181612
- init_remote_resources();
181613
- });
181614
-
181615
- // ../solution-sdk/src/resources/services/resource-name.ts
181616
- function hasControlChar(value) {
181617
- for (let i = 0;i < value.length; i++) {
181618
- if (value.charCodeAt(i) < 32)
181619
- return true;
181620
- }
181621
- return false;
181622
- }
181623
- function hasUnsafeNameChars(name) {
181624
- return UNSAFE_NAME_CHARS.test(name) || hasControlChar(name);
181625
- }
181626
- function validateResourceName(name, options = {}) {
181627
- const optionName = options.optionName ?? "--name";
181628
- if (name.trim() === "") {
181629
- return {
181630
- ok: false,
181631
- message: `${optionName} must not be blank`,
181632
- instructions: "Pass a non-empty resource name."
181633
- };
181634
- }
181635
- if (name.length > MAX_RESOURCE_NAME_LENGTH) {
181636
- return {
181637
- ok: false,
181638
- message: `${optionName} exceeds the ${MAX_RESOURCE_NAME_LENGTH}-character limit (got ${name.length})`,
181639
- instructions: "Shorten the resource name. Orchestrator name limits are kind-specific (queues cap at 50, assets at 256)."
181640
- };
181641
- }
181642
- if (hasUnsafeNameChars(name)) {
181643
- return {
181644
- ok: false,
181645
- message: `${optionName} contains unsafe characters`,
181646
- instructions: 'Resource names cannot contain path separators (/, \\), control characters, or any of: : * ? " < > |'
181647
- };
181648
- }
181649
- return { ok: true };
181650
- }
181651
- function assertValidResourceName(name, options = {}) {
181652
- const result = validateResourceName(name, options);
181653
- if (!result.ok) {
181654
- throw new Error(`${result.message}. ${result.instructions}`);
181655
- }
181656
- }
181657
- var MAX_RESOURCE_NAME_LENGTH = 256, UNSAFE_NAME_CHARS;
181658
- var init_resource_name = __esm(() => {
181659
- UNSAFE_NAME_CHARS = /[\\/:*?"<>|]/;
181660
- });
181661
-
181662
- // ../../node_modules/@uipath/resource-builder-sdk/dist/entries/bindings.js
181663
- var init_bindings2 = __esm(() => {
181664
- init_bindings();
181665
- });
181666
-
181667
- // ../../node_modules/@uipath/resource-builder-sdk/dist/mappings/index.js
181668
- var init_mappings = __esm(() => {
181669
- init_resource_subtype_mapper();
181670
- });
181671
-
181672
181482
  // ../solution-sdk/src/resources/services/sync-resources-from-bindings.ts
181673
181483
  function placeholderForType(type) {
181674
181484
  switch ((type ?? "string").toLowerCase()) {
@@ -181760,6 +181570,54 @@ function sameResourceSubtype(a, b) {
181760
181570
  function findSubtypeEntry(list, type) {
181761
181571
  return list.find((r) => !!r.type && sameResourceSubtype(r.type, type));
181762
181572
  }
181573
+ function metadataString(metadata, name) {
181574
+ if (!metadata || typeof metadata !== "object")
181575
+ return;
181576
+ for (const [key, value] of Object.entries(metadata)) {
181577
+ if (key.toLowerCase() === name.toLowerCase() && typeof value === "string" && value.trim() !== "") {
181578
+ return value;
181579
+ }
181580
+ }
181581
+ return;
181582
+ }
181583
+ function declaredSubTypes(decoded, resources) {
181584
+ const subTypes = new Map;
181585
+ let document2;
181586
+ try {
181587
+ document2 = JSON.parse(decoded);
181588
+ } catch {
181589
+ return subTypes;
181590
+ }
181591
+ const entries = document2?.resources;
181592
+ if (!Array.isArray(entries))
181593
+ return subTypes;
181594
+ const byBinding = new Map;
181595
+ for (const entry of entries) {
181596
+ if (!entry || typeof entry !== "object")
181597
+ continue;
181598
+ const { resource, key, metadata } = entry;
181599
+ if (typeof resource !== "string" || typeof key !== "string" || !SUBTYPED_BINDING_KINDS.has(resource.toLowerCase())) {
181600
+ continue;
181601
+ }
181602
+ const subType = metadataString(metadata, "SubType");
181603
+ if (subType)
181604
+ byBinding.set(`${resource}\x00${key}`, subType);
181605
+ }
181606
+ for (const resource of resources) {
181607
+ const subType = byBinding.get(`${resource.originalResourceType}\x00${resource.bindingKey ?? ""}`);
181608
+ if (subType)
181609
+ subTypes.set(resource, subType);
181610
+ }
181611
+ return subTypes;
181612
+ }
181613
+ async function resolveDeclaredKindMetadata(resolveKindMetadata, kind, type, declaredSubType) {
181614
+ if (type === undefined && declaredSubType !== undefined) {
181615
+ const declared = await resolveKindMetadata(kind, declaredSubType);
181616
+ if (declared?.typeMatched)
181617
+ return declared;
181618
+ }
181619
+ return resolveKindMetadata(kind, type);
181620
+ }
181763
181621
  function resolveBindingResourceIdentity(binding) {
181764
181622
  switch (binding.resourceType) {
181765
181623
  case models_BindingsResourceType.TimeTrigger:
@@ -181796,7 +181654,11 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181796
181654
  return result;
181797
181655
  }
181798
181656
  const serializer = services.container.resolve(Tokens.IBindingsMetadataSerializer);
181799
- const { bindings: allBindings, parseErrors } = await collectBindings(bindingsJsonFallbackDirs, serializer, bindingSources(solutionDir, paths, uipxProjects, projectBindings));
181657
+ const {
181658
+ bindings: allBindings,
181659
+ parseErrors,
181660
+ subTypes
181661
+ } = await collectBindings(bindingsJsonFallbackDirs, serializer, bindingSources(solutionDir, paths, uipxProjects, projectBindings));
181800
181662
  if (parseErrors.length > 0) {
181801
181663
  const detail = parseErrors.map((e) => `${e.path}: ${e.reason}`).join("; ");
181802
181664
  throw new Error(`Invalid bindings file — ${detail}`);
@@ -181834,7 +181696,29 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181834
181696
  const resolvedKeys = new Set;
181835
181697
  const overwrittenKeys = new Set;
181836
181698
  const bindingKey = (kind, name) => `${kind}:${name ?? ""}`.toLowerCase();
181837
- const selfProvisionedKeys = new Set((selfProvisioned ?? []).map((r) => bindingKey(r.kind, r.name)));
181699
+ const anyFolderSelfProvisioned = new Set;
181700
+ const solutionFolderSelfProvisioned = new Set;
181701
+ for (const r of selfProvisioned ?? []) {
181702
+ (r.solutionFolderOnly ? solutionFolderSelfProvisioned : anyFolderSelfProvisioned).add(bindingKey(r.kind, r.name));
181703
+ }
181704
+ const isSelfProvisioned = (kind, name, folderPath) => {
181705
+ const key = bindingKey(kind, name);
181706
+ return anyFolderSelfProvisioned.has(key) || !normalizeFolderPath(folderPath) && solutionFolderSelfProvisioned.has(key);
181707
+ };
181708
+ const importedThisRun = new Set;
181709
+ let referencedKeys;
181710
+ const coveringResource = async (resources, kind, name, folderPath, selfProvisioned) => {
181711
+ const match = findMatchingLocalResource(resources, kind, name, folderPath);
181712
+ if (!match || !selfProvisioned)
181713
+ return match;
181714
+ referencedKeys ??= readReferencedResourceKeys(services, builder);
181715
+ const referenced = await referencedKeys;
181716
+ const owned = resources.filter((r) => {
181717
+ const key = r.key?.toLowerCase();
181718
+ return !key || !importedThisRun.has(key) && !referenced.has(key);
181719
+ });
181720
+ return findMatchingLocalResource(owned, kind, name, folderPath);
181721
+ };
181838
181722
  const recordUnchecked = async (error, kind, name, directCloudKey) => {
181839
181723
  if (error) {
181840
181724
  const failure = classifyCatalogFailure(error);
@@ -181862,7 +181746,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181862
181746
  continue;
181863
181747
  }
181864
181748
  const isConnection = isConnectionBinding(binding);
181865
- const metadata = await resolveKindMetadata(kind, identity.type);
181749
+ const metadata = await resolveDeclaredKindMetadata(resolveKindMetadata, kind, identity.type, subTypes.get(binding));
181866
181750
  const name = getResourceName(binding);
181867
181751
  const folderPath = getFolderPathProperty(binding).defaultValue;
181868
181752
  const directCloudKey = isConnection ? getConnectionKey(binding) : undefined;
@@ -181872,7 +181756,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181872
181756
  if (!isConnection && !name) {
181873
181757
  continue;
181874
181758
  }
181875
- if (!isConnection && !normalizeFolderPath(folderPath) && findMatchingLocalResource(solution.resources ?? [], kind, name, folderPath)) {
181759
+ const selfProvisioned = !isConnection && isSelfProvisioned(kind, name, folderPath);
181760
+ if (!isConnection && !normalizeFolderPath(folderPath) && await coveringResource(solution.resources ?? [], kind, name, folderPath, selfProvisioned)) {
181876
181761
  result.skipped++;
181877
181762
  logger.info(`Skipping ${kind} "${name}" — an in-solution resource already covers this solution-relative binding`);
181878
181763
  continue;
@@ -181882,7 +181767,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181882
181767
  logger.info(`Skipping ${kind} "${name}" — the solution provisions this project itself; its member declaration covers the binding`);
181883
181768
  continue;
181884
181769
  }
181885
- if (!isConnection && selfProvisionedKeys.has(bindingKey(kind, name))) {
181770
+ if (selfProvisioned) {
181886
181771
  virtualCandidates.push({
181887
181772
  binding,
181888
181773
  kind,
@@ -181890,7 +181775,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181890
181775
  metadata,
181891
181776
  name,
181892
181777
  folderPath,
181893
- catalogMiss: false
181778
+ catalogMiss: false,
181779
+ selfProvisioned
181894
181780
  });
181895
181781
  continue;
181896
181782
  }
@@ -181913,7 +181799,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181913
181799
  metadata,
181914
181800
  name,
181915
181801
  folderPath,
181916
- catalogMiss: true
181802
+ catalogMiss: true,
181803
+ selfProvisioned: false
181917
181804
  });
181918
181805
  continue;
181919
181806
  }
@@ -181942,6 +181829,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181942
181829
  if (rcsMatch.key) {
181943
181830
  knownResourceKeys.add(rcsMatch.key.toLowerCase());
181944
181831
  overwrittenKeys.add(rcsMatch.key.toLowerCase());
181832
+ importedThisRun.add(rcsMatch.key.toLowerCase());
181945
181833
  }
181946
181834
  result.imported++;
181947
181835
  logger.info(`Imported ${kind} "${rcsMatch.name}" (key: ${rcsMatch.key}) into solution`);
@@ -181968,7 +181856,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181968
181856
  metadata,
181969
181857
  name,
181970
181858
  folderPath,
181971
- catalogMiss: false
181859
+ catalogMiss: false,
181860
+ selfProvisioned: false
181972
181861
  });
181973
181862
  }
181974
181863
  const virtualCandidatesSeen = new Set;
@@ -181980,7 +181869,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
181980
181869
  return true;
181981
181870
  });
181982
181871
  for (const candidate of dedupedVirtuals) {
181983
- const [syncError, created] = await catchError(createVirtualForBinding(builder, candidate.binding, candidate.kind, candidate.type, candidate.metadata, candidate.name, candidate.folderPath, result, candidate.catalogMiss));
181872
+ 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)));
181984
181873
  if (syncError) {
181985
181874
  logger.warn(`Failed to create virtual ${candidate.kind}/${candidate.name}: ${syncError.message}`);
181986
181875
  } else if (created) {
@@ -182059,6 +181948,15 @@ async function reportOrphanedDeclarations(services, builder, bindings, result) {
182059
181948
  logger.warn(warning);
182060
181949
  }
182061
181950
  }
181951
+ async function readReferencedResourceKeys(services, builder) {
181952
+ const overwrites = services.container.resolve(Tokens.IResourceOverwritesService);
181953
+ const [error, entries] = await catchError(overwrites.getTenantResourceOverwritesAsync(builder.context));
181954
+ if (error) {
181955
+ logger.debug(`Could not read the resource overwrites, so no root resource is known to be an import: ${error.message}`);
181956
+ return new Set;
181957
+ }
181958
+ return new Set(entries.filter((e) => String(e.overwrite?.type) === REFERENCE_OVERWRITE).map((e) => e.solutionResourceKey.toLowerCase()));
181959
+ }
182062
181960
  async function isUncheckedBindingCovered(builder, knownResourceKeys, kind, name, directCloudKey) {
182063
181961
  if (directCloudKey) {
182064
181962
  return knownResourceKeys.has(directCloudKey.toLowerCase());
@@ -182158,10 +182056,10 @@ async function mintVirtualResource(builder, kind, type, name, metadata) {
182158
182056
  }
182159
182057
  return { resource, finalName: uniqueName };
182160
182058
  }
182161
- async function createVirtualForBinding(builder, _binding, kind, type, metadata, name, folderPath, result, catalogMiss) {
182059
+ async function createVirtualForBinding(builder, _binding, kind, type, metadata, name, folderPath, result, catalogMiss, findCovering) {
182162
182060
  const virtualizable = metadata?.virtualizable ?? false;
182163
182061
  const preLoadSolution = await builder.context.loadAsync();
182164
- const alreadyVirtualized = findMatchingLocalResource(preLoadSolution.resources, kind, name, undefined);
182062
+ const alreadyVirtualized = await findCovering(preLoadSolution.resources);
182165
182063
  if (alreadyVirtualized) {
182166
182064
  result.skipped++;
182167
182065
  logger.info(`Skipping virtual ${kind} "${name}" — existing resource "${alreadyVirtualized.name}" in solution_folder already covers this binding (requested folder "${folderPath}")`);
@@ -182223,6 +182121,35 @@ async function findResourceByKeyInRcs(builder, kind, expectedKey, folderPath, pr
182223
182121
  }
182224
182122
  return;
182225
182123
  }
182124
+ async function findResourcesByKeysInRcs(builder, kind, keys) {
182125
+ const wanted = new Set([...keys].map((key) => key.toLowerCase()));
182126
+ const found = new Map;
182127
+ let pageCursor;
182128
+ while (found.size < wanted.size) {
182129
+ const result = await builder.searchResourcesAsync(kind, undefined, undefined, pageCursor, 100, undefined, false);
182130
+ for (const folderResources of result.availableResources) {
182131
+ for (const resource of folderResources.resources) {
182132
+ const key = resource.key.toLowerCase();
182133
+ if (!wanted.has(key) || found.has(key))
182134
+ continue;
182135
+ found.set(key, {
182136
+ key: resource.key,
182137
+ name: resource.name,
182138
+ type: resource.type,
182139
+ folder: {
182140
+ fullyQualifiedName: folderResources.fullyQualifiedName,
182141
+ folderKey: folderResources.key,
182142
+ path: folderResources.path
182143
+ }
182144
+ });
182145
+ }
182146
+ }
182147
+ pageCursor = result.nextPage;
182148
+ if (!pageCursor)
182149
+ break;
182150
+ }
182151
+ return found;
182152
+ }
182226
182153
  async function searchRcsResources(builder, kind, name) {
182227
182154
  const [searchError, matches] = await catchError(searchRcsResourcesStrict(builder, kind, name));
182228
182155
  if (searchError) {
@@ -182463,6 +182390,17 @@ async function collectBindings(bindingsJsonFallbackDirs, serializer, sources) {
182463
182390
  const fs = getFileSystem();
182464
182391
  const allBindings = [];
182465
182392
  const parseErrors = [];
182393
+ const subTypes = new Map;
182394
+ const collect = (parsed) => {
182395
+ if ("error" in parsed) {
182396
+ parseErrors.push(parsed.error);
182397
+ return;
182398
+ }
182399
+ allBindings.push(...parsed.resources);
182400
+ for (const [binding, subType] of parsed.subTypes) {
182401
+ subTypes.set(binding, subType);
182402
+ }
182403
+ };
182466
182404
  for (const { directory: dir, contribution } of sources) {
182467
182405
  if (contribution) {
182468
182406
  if (contribution.bindings.length === 0)
@@ -182471,10 +182409,7 @@ async function collectBindings(bindingsJsonFallbackDirs, serializer, sources) {
182471
182409
  version: "2.0",
182472
182410
  resources: contribution.bindings
182473
182411
  }), `${dir} (bindings contributed by the project's tool; project ${contribution.projectId})`, serializer);
182474
- if ("error" in parsed)
182475
- parseErrors.push(parsed.error);
182476
- else
182477
- allBindings.push(...parsed.resources);
182412
+ collect(parsed);
182478
182413
  continue;
182479
182414
  }
182480
182415
  const v2Path = fs.path.join(dir, "bindings_v2.json");
@@ -182495,13 +182430,9 @@ async function collectBindings(bindingsJsonFallbackDirs, serializer, sources) {
182495
182430
  });
182496
182431
  continue;
182497
182432
  }
182498
- const parsed = deserializeBindings(new TextDecoder().decode(content), bindingsPath, serializer);
182499
- if ("error" in parsed)
182500
- parseErrors.push(parsed.error);
182501
- else
182502
- allBindings.push(...parsed.resources);
182433
+ collect(deserializeBindings(new TextDecoder().decode(content), bindingsPath, serializer));
182503
182434
  }
182504
- return { bindings: allBindings, parseErrors };
182435
+ return { bindings: allBindings, parseErrors, subTypes };
182505
182436
  }
182506
182437
  function deserializeBindings(decoded, source, serializer) {
182507
182438
  let success;
@@ -182526,7 +182457,8 @@ function deserializeBindings(decoded, source, serializer) {
182526
182457
  }
182527
182458
  };
182528
182459
  }
182529
- return { resources: metadata?.resources ?? [] };
182460
+ const resources = metadata?.resources ?? [];
182461
+ return { resources, subTypes: declaredSubTypes(decoded, resources) };
182530
182462
  }
182531
182463
  async function syncAndLog(solutionDir, projectSubTypes, options) {
182532
182464
  const [syncError, syncResult] = await catchError(syncResourcesFromBindings(solutionDir, undefined, projectSubTypes, options?.projectBindings, options?.selfProvisioned));
@@ -182546,11 +182478,11 @@ async function syncAndLog(solutionDir, projectSubTypes, options) {
182546
182478
  throw new CatalogLookupError(syncResult.catalogLookupFailure, syncResult.unresolved);
182547
182479
  }
182548
182480
  }
182549
- var TYPE_IS_IDENTITY_REPLACE_OPTIONS, BINDINGS_JSON_FALLBACK_TYPES, IMPLICIT_CONNECTION2 = "ImplicitConnection", OverwriteRefreshError;
182481
+ var TYPE_IS_IDENTITY_REPLACE_OPTIONS, BINDINGS_JSON_FALLBACK_TYPES, IMPLICIT_CONNECTION2 = "ImplicitConnection", OverwriteRefreshError, SUBTYPED_BINDING_KINDS, REFERENCE_OVERWRITE = "Reference";
182550
182482
  var init_sync_resources_from_bindings = __esm(() => {
182551
182483
  init_src2();
182552
182484
  init_src();
182553
- init_bindings2();
182485
+ init_bindings3();
182554
182486
  init_mappings();
182555
182487
  init_solution2();
182556
182488
  init_service_tokens();
@@ -182567,6 +182499,400 @@ var init_sync_resources_from_bindings = __esm(() => {
182567
182499
  BINDINGS_JSON_FALLBACK_TYPES = new Set(["agent", "function"]);
182568
182500
  OverwriteRefreshError = class OverwriteRefreshError extends Error {
182569
182501
  };
182502
+ SUBTYPED_BINDING_KINDS = new Set([
182503
+ "asset",
182504
+ "bucket"
182505
+ ]);
182506
+ });
182507
+
182508
+ // ../solution-sdk/src/resources/services/imported-resources.ts
182509
+ async function resolveImportedResourcesAsync(services, builder, resources) {
182510
+ const overwrites = await services.container.resolve(Tokens.IResourceOverwritesService).getTenantResourceOverwritesAsync(builder.context);
182511
+ const tenantNames = new Map;
182512
+ for (const entry of overwrites) {
182513
+ if (String(entry.overwrite?.type) !== REFERENCE_OVERWRITE2)
182514
+ continue;
182515
+ tenantNames.set(entry.solutionResourceKey.toLowerCase(), entry.overwrite?.resourceName || undefined);
182516
+ }
182517
+ const resolved = new Map;
182518
+ const unresolved = new Map;
182519
+ const unchecked = new Set;
182520
+ const byKind = new Map;
182521
+ for (const resource of resources) {
182522
+ const key = resource.key?.toLowerCase();
182523
+ if (!key)
182524
+ continue;
182525
+ if (normalizeFolderPath(resource.folders?.[0]?.fullyQualifiedName)) {
182526
+ continue;
182527
+ }
182528
+ const recorded = tenantNames.has(key);
182529
+ if (!recorded && resource.isArtefactResource)
182530
+ continue;
182531
+ const kind = resource.kind ?? "";
182532
+ byKind.set(kind, [...byKind.get(kind) ?? [], { key, recorded }]);
182533
+ }
182534
+ const reportFailed = (entries, reason) => {
182535
+ for (const { key, recorded } of entries) {
182536
+ if (recorded)
182537
+ unresolved.set(key, reason);
182538
+ else
182539
+ unchecked.add(key);
182540
+ }
182541
+ };
182542
+ let failure;
182543
+ for (const [kind, entries] of byKind) {
182544
+ if (failure) {
182545
+ reportFailed(entries, failure);
182546
+ continue;
182547
+ }
182548
+ const [error, matches] = await catchError(findResourcesByKeysInRcs(builder, kind, entries.map((entry) => entry.key)));
182549
+ if (error) {
182550
+ const reason = `the Resource Catalog could not be searched: ${error.message}`;
182551
+ reportFailed(entries, reason);
182552
+ if (stopsCatalogLookups(classifyCatalogFailure(error))) {
182553
+ failure = reason;
182554
+ }
182555
+ continue;
182556
+ }
182557
+ for (const { key, recorded } of entries) {
182558
+ const match = matches.get(key);
182559
+ if (match?.folder?.fullyQualifiedName) {
182560
+ resolved.set(key, {
182561
+ name: tenantNames.get(key) ?? match.name,
182562
+ folderPath: match.folder.fullyQualifiedName
182563
+ });
182564
+ } else if (recorded) {
182565
+ unresolved.set(key, "the Resource Catalog no longer lists it");
182566
+ }
182567
+ }
182568
+ }
182569
+ return { resolved, unresolved, unchecked };
182570
+ }
182571
+ var REFERENCE_OVERWRITE2 = "Reference";
182572
+ var init_imported_resources = __esm(() => {
182573
+ init_src2();
182574
+ init_service_tokens();
182575
+ init_catalog_lookup_failure();
182576
+ init_local_resource_matcher();
182577
+ init_sync_resources_from_bindings();
182578
+ });
182579
+
182580
+ // ../solution-sdk/src/resources/services/project-artifacts-service.ts
182581
+ async function addProjectArtifactsToSolutionAsync(options) {
182582
+ const error = await createProjectInSolutionBuilder(options.solutionDir, options.projectId, options.projectName, normalizeProjectType(options.projectType), options.projectSubType);
182583
+ return error ? artifactFailure(options, error) : { Created: true };
182584
+ }
182585
+ function artifactFailure(options, error) {
182586
+ 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.");
182587
+ return { Created: false, Error: error.message };
182588
+ }
182589
+ var init_project_artifacts_service = __esm(() => {
182590
+ init_src2();
182591
+ init_solution_file();
182592
+ init_project_utils();
182593
+ });
182594
+
182595
+ // ../solution-sdk/src/resources/services/project-template-types.ts
182596
+ function hasBareTemplateRow(projectType) {
182597
+ reader ??= new EmbeddedProjectConfigurationReader;
182598
+ return reader.getTemplateResourcesByType(projectType, undefined, false).length > 0;
182599
+ }
182600
+ function hasAnyTemplateRow(projectType) {
182601
+ reader ??= new EmbeddedProjectConfigurationReader;
182602
+ const wanted = projectType.toLowerCase();
182603
+ return Object.keys(reader.getAll()).some((row) => {
182604
+ const key = row.toLowerCase();
182605
+ return key === wanted || key.startsWith(`${wanted}_`);
182606
+ });
182607
+ }
182608
+ var reader;
182609
+ var init_project_template_types = __esm(() => {
182610
+ init_config2();
182611
+ });
182612
+
182613
+ // ../solution-sdk/src/resources/services/remote-resources.ts
182614
+ function getRemoteResourceClients(services) {
182615
+ return {
182616
+ catalog: services.container.resolve(Tokens.IResourceCatalogClientProxy),
182617
+ importer: services.container.resolve(Tokens.IImportResourceHelper)
182618
+ };
182619
+ }
182620
+ async function findCatalogEntityAsync(catalog, query, match) {
182621
+ let pageCursor;
182622
+ do {
182623
+ const page = await catalog.searchFolderEntities({
182624
+ ...query,
182625
+ pageSize: 100,
182626
+ pageCursor
182627
+ });
182628
+ const found = (page.items ?? []).find(match);
182629
+ if (found) {
182630
+ return found;
182631
+ }
182632
+ pageCursor = page.nextPage ?? undefined;
182633
+ } while (pageCursor);
182634
+ return;
182635
+ }
182636
+ async function findCatalogEntitiesAsync(catalog, query, match) {
182637
+ const found = [];
182638
+ let pageCursor;
182639
+ do {
182640
+ const page = await catalog.searchFolderEntities({
182641
+ ...query,
182642
+ pageSize: 100,
182643
+ pageCursor
182644
+ });
182645
+ found.push(...(page.items ?? []).filter(match));
182646
+ pageCursor = page.nextPage ?? undefined;
182647
+ } while (pageCursor);
182648
+ return found;
182649
+ }
182650
+ function toResourceReference(entity) {
182651
+ return toCatalogReference({
182652
+ kind: entity.entityType ?? "",
182653
+ type: entity.entitySubType ?? undefined,
182654
+ key: entity.entityKey ?? "",
182655
+ name: entity.entityName ?? undefined,
182656
+ folderPath: entity.fullyQualifiedName ?? undefined,
182657
+ folderKey: entity.folderKey ?? undefined
182658
+ });
182659
+ }
182660
+ function toCatalogReference(reference) {
182661
+ const { folderPath, folderKey, ...rest } = reference;
182662
+ return {
182663
+ ...rest,
182664
+ folder: folderPath ? { fullyQualifiedName: folderPath, folderKey } : undefined
182665
+ };
182666
+ }
182667
+ async function exportResourceDefinitionAsync(importer, reference) {
182668
+ const [error, payload] = await catchError(importer.exportResourceAsync(reference));
182669
+ if (error) {
182670
+ throw withExportStatus(error);
182671
+ }
182672
+ return payload.resourceDefinitions.find((d) => d.key === reference.key);
182673
+ }
182674
+ function withExportStatus(error) {
182675
+ if (!(error instanceof Error) || !("exceptionData" in error)) {
182676
+ return error;
182677
+ }
182678
+ const data = error.exceptionData;
182679
+ const text = typeof data === "object" && data !== null ? data.errorMessage : undefined;
182680
+ const match = typeof text === "string" ? /^HTTP (\d{3})\b/.exec(text) : null;
182681
+ return match ? new ResourceExportError(error.message, Number(match[1]), error) : error;
182682
+ }
182683
+ function readSpecProperty(spec, name) {
182684
+ if (!spec) {
182685
+ return;
182686
+ }
182687
+ if (spec[name] !== undefined) {
182688
+ return spec[name];
182689
+ }
182690
+ const lower = name.toLowerCase();
182691
+ const key = Object.keys(spec).find((k) => k.toLowerCase() === lower);
182692
+ return key === undefined ? undefined : spec[key];
182693
+ }
182694
+ function readSpecEntryPoints(spec) {
182695
+ const entryPoints = parseJsonString(readSpecProperty(spec, "entryPoints"));
182696
+ if (!Array.isArray(entryPoints) || !entryPoints.every((entry) => entry !== null && typeof entry === "object")) {
182697
+ return;
182698
+ }
182699
+ return entryPoints.map((entry) => ({
182700
+ UniqueId: String(readSpecProperty(entry, "uniqueId") ?? ""),
182701
+ Path: String(readSpecProperty(entry, "path") ?? ""),
182702
+ DisplayName: String(readSpecProperty(entry, "displayName") ?? ""),
182703
+ InputArguments: readSpecProperty(entry, "inputArguments"),
182704
+ OutputArguments: readSpecProperty(entry, "outputArguments")
182705
+ }));
182706
+ }
182707
+ function parseJsonString(raw) {
182708
+ if (typeof raw !== "string") {
182709
+ return raw;
182710
+ }
182711
+ const [error, parsed] = catchError(() => JSON.parse(raw));
182712
+ return error ? undefined : parsed;
182713
+ }
182714
+ var ResourceExportError;
182715
+ var init_remote_resources = __esm(() => {
182716
+ init_src2();
182717
+ init_service_tokens();
182718
+ ResourceExportError = class ResourceExportError extends Error {
182719
+ status;
182720
+ constructor(message, status, cause) {
182721
+ super(message, { cause });
182722
+ this.status = status;
182723
+ this.name = "ResourceExportError";
182724
+ }
182725
+ };
182726
+ });
182727
+
182728
+ // ../solution-sdk/src/resources/services/resource-configurations.ts
182729
+ function isResourceKeyNotFound(error, resourceKey) {
182730
+ if (!(error instanceof Error))
182731
+ return false;
182732
+ const typed = error;
182733
+ const sameKey = (key) => key !== undefined && key.toLowerCase() === resourceKey.toLowerCase();
182734
+ if (typeof typed.resourceType === "string" && typeof typed.resourceKey === "string") {
182735
+ return ROOT_RESOURCE_TYPES.has(typed.resourceType.toLowerCase()) && sameKey(typed.resourceKey);
182736
+ }
182737
+ return sameKey(KEY_NOT_FOUND.exec(error.message.trim())?.[1]);
182738
+ }
182739
+ async function refreshArtefactSpecsAsync(builder, configurations) {
182740
+ const resources = new Map;
182741
+ const [loadError, solution] = await catchError(builder.context.loadAsync());
182742
+ if (loadError || !solution)
182743
+ return resources;
182744
+ for (const configuration of configurations) {
182745
+ const resource = solution.resources.find((r) => r.key === configuration?.key);
182746
+ if (!resource)
182747
+ continue;
182748
+ resources.set(resource.key, resource);
182749
+ if (!resource.projectKey)
182750
+ continue;
182751
+ configuration.spec = await applyEntryPointEnhancementAsync(builder.context, resource, configuration.spec ?? {});
182752
+ }
182753
+ return resources;
182754
+ }
182755
+ async function exportResourceConfigurationsAsync(services, resourceKey, hint = {}) {
182756
+ const { catalog, importer } = getRemoteResourceClients(services);
182757
+ const byKey = (item) => item.entityKey === resourceKey;
182758
+ const entity = (hint.name ? await findCatalogEntityAsync(catalog, { name: hint.name }, byKey) : undefined) ?? await findCatalogEntityAsync(catalog, {}, byKey);
182759
+ if (!entity) {
182760
+ throw new Error(`Resource '${resourceKey}' was not found in the solution or in the resource catalog`);
182761
+ }
182762
+ const payload = await importer.exportResourceAsync(toResourceReference(entity));
182763
+ const definitions = payload.resourceDefinitions ?? [];
182764
+ if (definitions.length === 0) {
182765
+ throw new Error(`FPS export for '${resourceKey}' returned no resource definitions`);
182766
+ }
182767
+ return {
182768
+ resources: definitions.map((d) => ({
182769
+ key: d.key ?? "",
182770
+ spec: d.spec ?? {},
182771
+ locks: d.locks ?? [],
182772
+ apiVersion: d.apiVersion,
182773
+ isOverridable: d.isOverridable,
182774
+ name: d.name ?? "",
182775
+ kind: d.kind ?? "",
182776
+ dependencies: (d.dependencies ?? []).map((dep) => ({
182777
+ kind: dep.kind ?? "",
182778
+ name: dep.name ?? ""
182779
+ }))
182780
+ }))
182781
+ };
182782
+ }
182783
+ async function readLocalAsync(builder, resourceKey, read) {
182784
+ if (!builder)
182785
+ return;
182786
+ const [error, value] = await catchError(read(builder));
182787
+ if (!error)
182788
+ return { builder, value };
182789
+ if (isResourceKeyNotFound(error, resourceKey))
182790
+ return;
182791
+ throw error;
182792
+ }
182793
+ async function readResourceConfigurationsAsync(services, builder, resourceKey, hint = {}) {
182794
+ const local = await readLocalAsync(builder, resourceKey, (b) => b.getAllConfigurationsAsync(resourceKey));
182795
+ if (!local) {
182796
+ return exportResourceConfigurationsAsync(services, resourceKey, hint);
182797
+ }
182798
+ await refreshArtefactSpecsAsync(local.builder, local.value?.resources ?? []);
182799
+ return local.value;
182800
+ }
182801
+ async function readResourceConfigurationAsync(services, builder, resourceKey) {
182802
+ const local = await readLocalAsync(builder, resourceKey, (b) => b.getConfigurationAsync(resourceKey));
182803
+ if (local) {
182804
+ const configuration = local.value;
182805
+ const resources = await refreshArtefactSpecsAsync(local.builder, [
182806
+ configuration
182807
+ ]);
182808
+ return { configuration, resource: resources.get(configuration.key) };
182809
+ }
182810
+ const { resources } = await exportResourceConfigurationsAsync(services, resourceKey);
182811
+ const primary = resources.find((r) => r.key === resourceKey) ?? resources[0];
182812
+ const { key, spec, locks, apiVersion, isOverridable } = primary;
182813
+ return { configuration: { key, spec, locks, apiVersion, isOverridable } };
182814
+ }
182815
+ var ROOT_RESOURCE_TYPES, KEY_NOT_FOUND;
182816
+ var init_resource_configurations = __esm(() => {
182817
+ init_src2();
182818
+ init_entry_point_spec_enhancer();
182819
+ init_remote_resources();
182820
+ ROOT_RESOURCE_TYPES = new Set(["resource", "solutionresource"]);
182821
+ KEY_NOT_FOUND = /^(?:Solution)?Resource with key '([^']+)' was not found$/i;
182822
+ });
182823
+
182824
+ // ../solution-sdk/src/resources/services/resource-lookup.ts
182825
+ async function findResourcesByNameAsync(services, builder, { kind, name, subTypes, folderKey }) {
182826
+ const same = (a, b) => (a ?? "").toLowerCase() === b.toLowerCase();
182827
+ const ofSubType = (type) => subTypes === undefined || subTypes.some((t) => same(type, t));
182828
+ if (builder) {
182829
+ const solution = await builder.context.loadAsync();
182830
+ const local = solution.resources.filter((r) => same(r.kind, kind) && same(r.name, name) && ofSubType(r.type)).map((r) => ({
182831
+ key: r.key,
182832
+ local: true,
182833
+ folderPath: r.folders?.[0]?.fullyQualifiedName
182834
+ }));
182835
+ if (local.length > 0)
182836
+ return local;
182837
+ }
182838
+ const { catalog } = getRemoteResourceClients(services);
182839
+ 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)));
182840
+ return rows.map((row) => ({
182841
+ key: row.entityKey ?? "",
182842
+ local: false,
182843
+ folderPath: row.fullyQualifiedName ?? undefined,
182844
+ folderKey: row.folderKey ?? undefined
182845
+ }));
182846
+ }
182847
+ var init_resource_lookup = __esm(() => {
182848
+ init_remote_resources();
182849
+ });
182850
+
182851
+ // ../solution-sdk/src/resources/services/resource-name.ts
182852
+ function hasControlChar(value) {
182853
+ for (let i = 0;i < value.length; i++) {
182854
+ if (value.charCodeAt(i) < 32)
182855
+ return true;
182856
+ }
182857
+ return false;
182858
+ }
182859
+ function hasUnsafeNameChars(name) {
182860
+ return UNSAFE_NAME_CHARS.test(name) || hasControlChar(name);
182861
+ }
182862
+ function validateResourceName(name, options = {}) {
182863
+ const optionName = options.optionName ?? "--name";
182864
+ if (name.trim() === "") {
182865
+ return {
182866
+ ok: false,
182867
+ message: `${optionName} must not be blank`,
182868
+ instructions: "Pass a non-empty resource name."
182869
+ };
182870
+ }
182871
+ if (name.length > MAX_RESOURCE_NAME_LENGTH) {
182872
+ return {
182873
+ ok: false,
182874
+ message: `${optionName} exceeds the ${MAX_RESOURCE_NAME_LENGTH}-character limit (got ${name.length})`,
182875
+ instructions: "Shorten the resource name. Orchestrator name limits are kind-specific (queues cap at 50, assets at 256)."
182876
+ };
182877
+ }
182878
+ if (hasUnsafeNameChars(name)) {
182879
+ return {
182880
+ ok: false,
182881
+ message: `${optionName} contains unsafe characters`,
182882
+ instructions: 'Resource names cannot contain path separators (/, \\), control characters, or any of: : * ? " < > |'
182883
+ };
182884
+ }
182885
+ return { ok: true };
182886
+ }
182887
+ function assertValidResourceName(name, options = {}) {
182888
+ const result = validateResourceName(name, options);
182889
+ if (!result.ok) {
182890
+ throw new Error(`${result.message}. ${result.instructions}`);
182891
+ }
182892
+ }
182893
+ var MAX_RESOURCE_NAME_LENGTH = 256, UNSAFE_NAME_CHARS;
182894
+ var init_resource_name = __esm(() => {
182895
+ UNSAFE_NAME_CHARS = /[\\/:*?"<>|]/;
182570
182896
  });
182571
182897
 
182572
182898
  // ../solution-sdk/src/resources/services/resource-refresh-service.ts
@@ -182607,7 +182933,11 @@ async function resourceRefreshAsync(solutionPath = ".", options = {}) {
182607
182933
  if (bindingsError) {
182608
182934
  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'.`);
182609
182935
  }
182610
- const [syncError, result] = await catchError(syncResourcesFromBindings(resolvedPath, undefined, projectSubTypes ?? new Map, projectBindings ?? new Map, undefined, {
182936
+ const [selfProvisionedError, selfProvisioned] = await catchError(options.resolveSelfProvisionedAsync?.() ?? Promise.resolve([]));
182937
+ if (selfProvisionedError) {
182938
+ 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'.`);
182939
+ }
182940
+ const [syncError, result] = await catchError(syncResourcesFromBindings(resolvedPath, undefined, projectSubTypes ?? new Map, projectBindings ?? new Map, selfProvisioned?.length ? [...selfProvisioned] : undefined, {
182611
182941
  bindingsComplete: !bindingsError && (options.isProjectBindingsComplete?.() ?? true)
182612
182942
  }));
182613
182943
  if (syncError) {
@@ -182850,6 +183180,7 @@ __export(exports_resources, {
182850
183180
  findProjectFile: () => findProjectFile,
182851
183181
  findResourceByKeyInRcs: () => findResourceByKeyInRcs,
182852
183182
  findResourceInRcs: () => findResourceInRcs,
183183
+ findResourcesByKeysInRcs: () => findResourcesByKeysInRcs,
182853
183184
  findResourcesByNameAsync: () => findResourcesByNameAsync,
182854
183185
  formatResourceSubtypes: () => formatResourceSubtypes,
182855
183186
  getRemoteResourceClients: () => getRemoteResourceClients,
@@ -182871,6 +183202,7 @@ __export(exports_resources, {
182871
183202
  readSpecProperty: () => readSpecProperty,
182872
183203
  readUipxProjects: () => readUipxProjects,
182873
183204
  refreshArtefactSpecsAsync: () => refreshArtefactSpecsAsync,
183205
+ resolveImportedResourcesAsync: () => resolveImportedResourcesAsync,
182874
183206
  resolveProjectDirFromManifest: () => resolveProjectDirFromManifest,
182875
183207
  resolveResourceKindMetadata: () => resolveResourceKindMetadata,
182876
183208
  resolveSolutionFilePath: () => resolveSolutionFilePath,
@@ -182895,6 +183227,7 @@ var init_resources = __esm(() => {
182895
183227
  init_project_utils();
182896
183228
  init_resource_builder_init();
182897
183229
  init_entry_point_spec_enhancer();
183230
+ init_imported_resources();
182898
183231
  init_local_resource_matcher();
182899
183232
  init_project_artifacts_service();
182900
183233
  init_project_template_types();
@@ -264760,4 +265093,4 @@ export {
264760
265093
  shownRows
264761
265094
  };
264762
265095
 
264763
- //# debugId=A868F39DA1AEB28C64756E2164756E21
265096
+ //# debugId=EECD4FDCA8FB780C64756E2164756E21