@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.
@@ -1121,7 +1121,7 @@ var init_package = __esm(() => {
1121
1121
  name: "@uipath/integrationservice-sdk",
1122
1122
  author: "UiPath",
1123
1123
  license: "SEE LICENSE IN LICENSE.txt",
1124
- version: "1.207.0-preview.338",
1124
+ version: "1.207.0-preview.340",
1125
1125
  repository: {
1126
1126
  type: "git",
1127
1127
  url: "https://github.com/UiPath/cli.git",
@@ -11506,7 +11506,7 @@ function rotr(value, bits) {
11506
11506
  return (value >>> bits | value << 32 - bits) >>> 0;
11507
11507
  }
11508
11508
  function sha256Words(input) {
11509
- const bytes = new TextEncoder().encode(input);
11509
+ const bytes = typeof input === "string" ? new TextEncoder().encode(input) : input;
11510
11510
  const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
11511
11511
  const buffer = new Uint8Array(paddedLength);
11512
11512
  buffer.set(bytes);
@@ -22159,6 +22159,7 @@ var init_command_attribution = __esm(() => {
22159
22159
  ["uipath-maestro-bpmn", "uipath-maestro-case", "uipath-maestro-flow"]
22160
22160
  ],
22161
22161
  ["agenthub", "build", ["uipath-mcp-servers"]],
22162
+ ["ontology", "build", ["uipath-ontology"]],
22162
22163
  ["solution", "build", ["uipath-planner", "uipath-solution"]],
22163
22164
  ["platform", "operate", ["uipath-platform"]],
22164
22165
  ["quality", "troubleshoot", ["uipath-review"]],
@@ -22199,6 +22200,7 @@ var init_command_attribution = __esm(() => {
22199
22200
  ["test-manager", "operate", ["uip.tm"]],
22200
22201
  ["vertical-solutions", "build", ["uip.vss"]],
22201
22202
  ["data-fabric", "operate", ["uip.df"]],
22203
+ ["ontology", "build", ["uip.ont"]],
22202
22204
  ["integration-service", "build", ["uip.is"]],
22203
22205
  ["orchestrator", "operate", ["uip.or"]],
22204
22206
  [
@@ -24224,6 +24226,131 @@ var init_models3 = __esm(() => {
24224
24226
  });
24225
24227
  // ../packager/packager-core/src/package-descriptor/index.ts
24226
24228
  var init_package_descriptor = () => {};
24229
+
24230
+ // ../packager/packager-core/src/resource-declarations/languages.ts
24231
+ function resourceDeclarationsPaths(language) {
24232
+ const name = RESOURCE_DECLARATIONS_FILE_NAMES[language];
24233
+ return [name, `src/${name}`];
24234
+ }
24235
+ var RESOURCE_DECLARATIONS_FILE_NAMES;
24236
+ var init_languages = __esm(() => {
24237
+ RESOURCE_DECLARATIONS_FILE_NAMES = {
24238
+ typescript: "uipath_resources.ts",
24239
+ python: "uipath_resources.py"
24240
+ };
24241
+ });
24242
+
24243
+ // ../packager/packager-core/src/resource-declarations/scanner.ts
24244
+ var closingIndexOf;
24245
+ var init_scanner = __esm(() => {
24246
+ closingIndexOf = new Map;
24247
+ });
24248
+
24249
+ // ../packager/packager-core/src/resource-declarations/declarations.ts
24250
+ var RESOURCE_DECLARATIONS_FILE_NAME, RESOURCE_DECLARATIONS_PATHS, MAX_RESOURCE_DECLARATIONS_LENGTH;
24251
+ var init_declarations = __esm(() => {
24252
+ init_languages();
24253
+ init_scanner();
24254
+ RESOURCE_DECLARATIONS_FILE_NAME = RESOURCE_DECLARATIONS_FILE_NAMES.typescript;
24255
+ RESOURCE_DECLARATIONS_PATHS = resourceDeclarationsPaths("typescript");
24256
+ MAX_RESOURCE_DECLARATIONS_LENGTH = 1024 * 1024;
24257
+ });
24258
+
24259
+ // ../packager/packager-core/src/resource-declarations/bindings.ts
24260
+ var init_bindings = __esm(() => {
24261
+ init_declarations();
24262
+ });
24263
+
24264
+ // ../packager/packager-core/src/resource-declarations/editor.ts
24265
+ var RESERVED_IDENTIFIERS, SUB_TYPES_BY_KIND;
24266
+ var init_editor = __esm(() => {
24267
+ init_bindings();
24268
+ init_declarations();
24269
+ init_scanner();
24270
+ RESERVED_IDENTIFIERS = new Set([
24271
+ "constructor",
24272
+ "prototype",
24273
+ "name",
24274
+ "length",
24275
+ "caller",
24276
+ "arguments"
24277
+ ]);
24278
+ SUB_TYPES_BY_KIND = {
24279
+ asset: new Set(["text", "integer", "bool", "credential", "secret", "json"]),
24280
+ bucket: new Set(["orchestrator", "amazon", "azure"])
24281
+ };
24282
+ });
24283
+
24284
+ // ../packager/packager-core/src/resource-declarations/python.ts
24285
+ var PYTHON_KEYWORDS;
24286
+ var init_python = __esm(() => {
24287
+ init_bindings();
24288
+ init_declarations();
24289
+ init_editor();
24290
+ init_languages();
24291
+ init_scanner();
24292
+ PYTHON_KEYWORDS = new Set([
24293
+ "and",
24294
+ "as",
24295
+ "assert",
24296
+ "async",
24297
+ "await",
24298
+ "break",
24299
+ "class",
24300
+ "continue",
24301
+ "def",
24302
+ "del",
24303
+ "elif",
24304
+ "else",
24305
+ "except",
24306
+ "finally",
24307
+ "for",
24308
+ "from",
24309
+ "global",
24310
+ "if",
24311
+ "import",
24312
+ "in",
24313
+ "is",
24314
+ "lambda",
24315
+ "nonlocal",
24316
+ "not",
24317
+ "or",
24318
+ "pass",
24319
+ "raise",
24320
+ "return",
24321
+ "try",
24322
+ "while",
24323
+ "with",
24324
+ "yield"
24325
+ ]);
24326
+ });
24327
+
24328
+ // ../packager/packager-core/src/resource-declarations/source.ts
24329
+ var init_source = __esm(() => {
24330
+ init_bindings();
24331
+ init_declarations();
24332
+ init_editor();
24333
+ init_languages();
24334
+ init_python();
24335
+ });
24336
+
24337
+ // ../packager/packager-core/src/resource-declarations/project.ts
24338
+ var init_project = __esm(() => {
24339
+ init_bindings();
24340
+ init_declarations();
24341
+ init_source();
24342
+ });
24343
+
24344
+ // ../packager/packager-core/src/resource-declarations/index.ts
24345
+ var init_resource_declarations = __esm(() => {
24346
+ init_bindings();
24347
+ init_declarations();
24348
+ init_editor();
24349
+ init_languages();
24350
+ init_project();
24351
+ init_python();
24352
+ init_source();
24353
+ });
24227
24354
  // ../packager/packager-core/src/services/project-id.ts
24228
24355
  var init_project_id = () => {};
24229
24356
 
@@ -24319,6 +24446,7 @@ var init_src5 = __esm(() => {
24319
24446
  init_i18n();
24320
24447
  init_models3();
24321
24448
  init_package_descriptor();
24449
+ init_resource_declarations();
24322
24450
  init_services();
24323
24451
  });
24324
24452
 
@@ -31089,7 +31217,7 @@ var init_binding_overwrites_mapping_handler = __esm(() => {
31089
31217
  });
31090
31218
 
31091
31219
  // ../../node_modules/@uipath/resource-builder-sdk/dist/bindings/index.js
31092
- var init_bindings = __esm(() => {
31220
+ var init_bindings2 = __esm(() => {
31093
31221
  init_models5();
31094
31222
  init_bindings_metadata_serializer();
31095
31223
  init_bindings_requests();
@@ -32251,7 +32379,7 @@ var init_solution_builder = __esm(() => {
32251
32379
  init_detach_resource_file_command();
32252
32380
  init_exceptions();
32253
32381
  init_internal();
32254
- init_bindings();
32382
+ init_bindings2();
32255
32383
  init_solution();
32256
32384
  SolutionBuilder = class SolutionBuilder {
32257
32385
  dispose() {
@@ -43936,7 +44064,7 @@ function isGuid3(value) {
43936
44064
  }
43937
44065
  var BINDINGS_RESOLUTION_BATCH_SIZE = 10;
43938
44066
  var init_get_exportable_items_based_on_bindings_handler = __esm(() => {
43939
- init_bindings();
44067
+ init_bindings2();
43940
44068
  init_resource_subtype_mapper();
43941
44069
  init_exceptions();
43942
44070
  });
@@ -45548,7 +45676,7 @@ var init_container = __esm(() => {
45548
45676
  init_mediator2();
45549
45677
  init_resource_builder();
45550
45678
  init_handlers();
45551
- init_bindings();
45679
+ init_bindings2();
45552
45680
  init_solution();
45553
45681
  init_feature_flag_provider();
45554
45682
  init_clients();
@@ -51814,152 +51942,14 @@ var init_local_resource_matcher = __esm(() => {
51814
51942
  ORPHAN_CHECKED_KINDS = new Set(["process", "app"]);
51815
51943
  });
51816
51944
 
51817
- // ../solution-sdk/src/resources/services/project-artifacts-service.ts
51818
- async function addProjectArtifactsToSolutionAsync(options) {
51819
- const error = await createProjectInSolutionBuilder(options.solutionDir, options.projectId, options.projectName, normalizeProjectType(options.projectType), options.projectSubType);
51820
- return error ? artifactFailure(options, error) : { Created: true };
51821
- }
51822
- function artifactFailure(options, error) {
51823
- 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.");
51824
- return { Created: false, Error: error.message };
51825
- }
51826
- var init_project_artifacts_service = __esm(() => {
51827
- init_src4();
51828
- init_solution_file();
51829
- init_project_utils();
51830
- });
51831
-
51832
- // ../solution-sdk/src/resources/services/project-template-types.ts
51833
- function hasBareTemplateRow(projectType) {
51834
- reader ??= new EmbeddedProjectConfigurationReader;
51835
- return reader.getTemplateResourcesByType(projectType, undefined, false).length > 0;
51836
- }
51837
- function hasAnyTemplateRow(projectType) {
51838
- reader ??= new EmbeddedProjectConfigurationReader;
51839
- const wanted = projectType.toLowerCase();
51840
- return Object.keys(reader.getAll()).some((row) => {
51841
- const key = row.toLowerCase();
51842
- return key === wanted || key.startsWith(`${wanted}_`);
51843
- });
51844
- }
51845
- var reader;
51846
- var init_project_template_types = __esm(() => {
51847
- init_config2();
51945
+ // ../../node_modules/@uipath/resource-builder-sdk/dist/entries/bindings.js
51946
+ var init_bindings3 = __esm(() => {
51947
+ init_bindings2();
51848
51948
  });
51849
51949
 
51850
- // ../solution-sdk/src/resources/services/remote-resources.ts
51851
- function getRemoteResourceClients(services) {
51852
- return {
51853
- catalog: services.container.resolve(Tokens.IResourceCatalogClientProxy),
51854
- importer: services.container.resolve(Tokens.IImportResourceHelper)
51855
- };
51856
- }
51857
- async function findCatalogEntityAsync(catalog, query, match) {
51858
- let pageCursor;
51859
- do {
51860
- const page = await catalog.searchFolderEntities({
51861
- ...query,
51862
- pageSize: 100,
51863
- pageCursor
51864
- });
51865
- const found = (page.items ?? []).find(match);
51866
- if (found) {
51867
- return found;
51868
- }
51869
- pageCursor = page.nextPage ?? undefined;
51870
- } while (pageCursor);
51871
- return;
51872
- }
51873
- async function findCatalogEntitiesAsync(catalog, query, match) {
51874
- const found = [];
51875
- let pageCursor;
51876
- do {
51877
- const page = await catalog.searchFolderEntities({
51878
- ...query,
51879
- pageSize: 100,
51880
- pageCursor
51881
- });
51882
- found.push(...(page.items ?? []).filter(match));
51883
- pageCursor = page.nextPage ?? undefined;
51884
- } while (pageCursor);
51885
- return found;
51886
- }
51887
- function toResourceReference(entity) {
51888
- return toCatalogReference({
51889
- kind: entity.entityType ?? "",
51890
- type: entity.entitySubType ?? undefined,
51891
- key: entity.entityKey ?? "",
51892
- name: entity.entityName ?? undefined,
51893
- folderPath: entity.fullyQualifiedName ?? undefined,
51894
- folderKey: entity.folderKey ?? undefined
51895
- });
51896
- }
51897
- function toCatalogReference(reference) {
51898
- const { folderPath, folderKey, ...rest } = reference;
51899
- return {
51900
- ...rest,
51901
- folder: folderPath ? { fullyQualifiedName: folderPath, folderKey } : undefined
51902
- };
51903
- }
51904
- async function exportResourceDefinitionAsync(importer, reference) {
51905
- const [error, payload] = await catchError2(importer.exportResourceAsync(reference));
51906
- if (error) {
51907
- throw withExportStatus(error);
51908
- }
51909
- return payload.resourceDefinitions.find((d) => d.key === reference.key);
51910
- }
51911
- function withExportStatus(error) {
51912
- if (!(error instanceof Error) || !("exceptionData" in error)) {
51913
- return error;
51914
- }
51915
- const data = error.exceptionData;
51916
- const text = typeof data === "object" && data !== null ? data.errorMessage : undefined;
51917
- const match = typeof text === "string" ? /^HTTP (\d{3})\b/.exec(text) : null;
51918
- return match ? new ResourceExportError(error.message, Number(match[1]), error) : error;
51919
- }
51920
- function readSpecProperty(spec, name) {
51921
- if (!spec) {
51922
- return;
51923
- }
51924
- if (spec[name] !== undefined) {
51925
- return spec[name];
51926
- }
51927
- const lower = name.toLowerCase();
51928
- const key = Object.keys(spec).find((k) => k.toLowerCase() === lower);
51929
- return key === undefined ? undefined : spec[key];
51930
- }
51931
- function readSpecEntryPoints(spec) {
51932
- const entryPoints = parseJsonString(readSpecProperty(spec, "entryPoints"));
51933
- if (!Array.isArray(entryPoints) || !entryPoints.every((entry) => entry !== null && typeof entry === "object")) {
51934
- return;
51935
- }
51936
- return entryPoints.map((entry) => ({
51937
- UniqueId: String(readSpecProperty(entry, "uniqueId") ?? ""),
51938
- Path: String(readSpecProperty(entry, "path") ?? ""),
51939
- DisplayName: String(readSpecProperty(entry, "displayName") ?? ""),
51940
- InputArguments: readSpecProperty(entry, "inputArguments"),
51941
- OutputArguments: readSpecProperty(entry, "outputArguments")
51942
- }));
51943
- }
51944
- function parseJsonString(raw) {
51945
- if (typeof raw !== "string") {
51946
- return raw;
51947
- }
51948
- const [error, parsed] = catchError2(() => JSON.parse(raw));
51949
- return error ? undefined : parsed;
51950
- }
51951
- var ResourceExportError;
51952
- var init_remote_resources = __esm(() => {
51953
- init_src4();
51954
- init_service_tokens();
51955
- ResourceExportError = class ResourceExportError extends Error {
51956
- status;
51957
- constructor(message, status, cause) {
51958
- super(message, { cause });
51959
- this.status = status;
51960
- this.name = "ResourceExportError";
51961
- }
51962
- };
51950
+ // ../../node_modules/@uipath/resource-builder-sdk/dist/mappings/index.js
51951
+ var init_mappings = __esm(() => {
51952
+ init_resource_subtype_mapper();
51963
51953
  });
51964
51954
 
51965
51955
  // ../solution-sdk/src/resources/services/resource-casing.ts
@@ -52128,186 +52118,6 @@ var init_resource_casing = __esm(() => {
52128
52118
  init_src2();
52129
52119
  });
52130
52120
 
52131
- // ../solution-sdk/src/resources/services/resource-configurations.ts
52132
- function isResourceKeyNotFound(error, resourceKey) {
52133
- if (!(error instanceof Error))
52134
- return false;
52135
- const typed = error;
52136
- const sameKey = (key) => key !== undefined && key.toLowerCase() === resourceKey.toLowerCase();
52137
- if (typeof typed.resourceType === "string" && typeof typed.resourceKey === "string") {
52138
- return ROOT_RESOURCE_TYPES.has(typed.resourceType.toLowerCase()) && sameKey(typed.resourceKey);
52139
- }
52140
- return sameKey(KEY_NOT_FOUND.exec(error.message.trim())?.[1]);
52141
- }
52142
- async function refreshArtefactSpecsAsync(builder, configurations) {
52143
- const resources = new Map;
52144
- const [loadError, solution] = await catchError2(builder.context.loadAsync());
52145
- if (loadError || !solution)
52146
- return resources;
52147
- for (const configuration of configurations) {
52148
- const resource = solution.resources.find((r) => r.key === configuration?.key);
52149
- if (!resource)
52150
- continue;
52151
- resources.set(resource.key, resource);
52152
- if (!resource.projectKey)
52153
- continue;
52154
- configuration.spec = await applyEntryPointEnhancementAsync(builder.context, resource, configuration.spec ?? {});
52155
- }
52156
- return resources;
52157
- }
52158
- async function exportResourceConfigurationsAsync(services, resourceKey, hint = {}) {
52159
- const { catalog, importer } = getRemoteResourceClients(services);
52160
- const byKey = (item) => item.entityKey === resourceKey;
52161
- const entity = (hint.name ? await findCatalogEntityAsync(catalog, { name: hint.name }, byKey) : undefined) ?? await findCatalogEntityAsync(catalog, {}, byKey);
52162
- if (!entity) {
52163
- throw new Error(`Resource '${resourceKey}' was not found in the solution or in the resource catalog`);
52164
- }
52165
- const payload = await importer.exportResourceAsync(toResourceReference(entity));
52166
- const definitions = payload.resourceDefinitions ?? [];
52167
- if (definitions.length === 0) {
52168
- throw new Error(`FPS export for '${resourceKey}' returned no resource definitions`);
52169
- }
52170
- return {
52171
- resources: definitions.map((d) => ({
52172
- key: d.key ?? "",
52173
- spec: d.spec ?? {},
52174
- locks: d.locks ?? [],
52175
- apiVersion: d.apiVersion,
52176
- isOverridable: d.isOverridable,
52177
- name: d.name ?? "",
52178
- kind: d.kind ?? "",
52179
- dependencies: (d.dependencies ?? []).map((dep) => ({
52180
- kind: dep.kind ?? "",
52181
- name: dep.name ?? ""
52182
- }))
52183
- }))
52184
- };
52185
- }
52186
- async function readLocalAsync(builder, resourceKey, read) {
52187
- if (!builder)
52188
- return;
52189
- const [error, value] = await catchError2(read(builder));
52190
- if (!error)
52191
- return { builder, value };
52192
- if (isResourceKeyNotFound(error, resourceKey))
52193
- return;
52194
- throw error;
52195
- }
52196
- async function readResourceConfigurationsAsync(services, builder, resourceKey, hint = {}) {
52197
- const local = await readLocalAsync(builder, resourceKey, (b) => b.getAllConfigurationsAsync(resourceKey));
52198
- if (!local) {
52199
- return exportResourceConfigurationsAsync(services, resourceKey, hint);
52200
- }
52201
- await refreshArtefactSpecsAsync(local.builder, local.value?.resources ?? []);
52202
- return local.value;
52203
- }
52204
- async function readResourceConfigurationAsync(services, builder, resourceKey) {
52205
- const local = await readLocalAsync(builder, resourceKey, (b) => b.getConfigurationAsync(resourceKey));
52206
- if (local) {
52207
- const configuration = local.value;
52208
- const resources = await refreshArtefactSpecsAsync(local.builder, [
52209
- configuration
52210
- ]);
52211
- return { configuration, resource: resources.get(configuration.key) };
52212
- }
52213
- const { resources } = await exportResourceConfigurationsAsync(services, resourceKey);
52214
- const primary = resources.find((r) => r.key === resourceKey) ?? resources[0];
52215
- const { key, spec, locks, apiVersion, isOverridable } = primary;
52216
- return { configuration: { key, spec, locks, apiVersion, isOverridable } };
52217
- }
52218
- var ROOT_RESOURCE_TYPES, KEY_NOT_FOUND;
52219
- var init_resource_configurations = __esm(() => {
52220
- init_src4();
52221
- init_entry_point_spec_enhancer();
52222
- init_remote_resources();
52223
- ROOT_RESOURCE_TYPES = new Set(["resource", "solutionresource"]);
52224
- KEY_NOT_FOUND = /^(?:Solution)?Resource with key '([^']+)' was not found$/i;
52225
- });
52226
-
52227
- // ../solution-sdk/src/resources/services/resource-lookup.ts
52228
- async function findResourcesByNameAsync(services, builder, { kind, name, subTypes, folderKey }) {
52229
- const same = (a, b) => (a ?? "").toLowerCase() === b.toLowerCase();
52230
- const ofSubType = (type) => subTypes === undefined || subTypes.some((t) => same(type, t));
52231
- if (builder) {
52232
- const solution = await builder.context.loadAsync();
52233
- const local = solution.resources.filter((r) => same(r.kind, kind) && same(r.name, name) && ofSubType(r.type)).map((r) => ({
52234
- key: r.key,
52235
- local: true,
52236
- folderPath: r.folders?.[0]?.fullyQualifiedName
52237
- }));
52238
- if (local.length > 0)
52239
- return local;
52240
- }
52241
- const { catalog } = getRemoteResourceClients(services);
52242
- 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)));
52243
- return rows.map((row) => ({
52244
- key: row.entityKey ?? "",
52245
- local: false,
52246
- folderPath: row.fullyQualifiedName ?? undefined,
52247
- folderKey: row.folderKey ?? undefined
52248
- }));
52249
- }
52250
- var init_resource_lookup = __esm(() => {
52251
- init_remote_resources();
52252
- });
52253
-
52254
- // ../solution-sdk/src/resources/services/resource-name.ts
52255
- function hasControlChar(value) {
52256
- for (let i = 0;i < value.length; i++) {
52257
- if (value.charCodeAt(i) < 32)
52258
- return true;
52259
- }
52260
- return false;
52261
- }
52262
- function hasUnsafeNameChars(name) {
52263
- return UNSAFE_NAME_CHARS.test(name) || hasControlChar(name);
52264
- }
52265
- function validateResourceName(name, options = {}) {
52266
- const optionName = options.optionName ?? "--name";
52267
- if (name.trim() === "") {
52268
- return {
52269
- ok: false,
52270
- message: `${optionName} must not be blank`,
52271
- instructions: "Pass a non-empty resource name."
52272
- };
52273
- }
52274
- if (name.length > MAX_RESOURCE_NAME_LENGTH) {
52275
- return {
52276
- ok: false,
52277
- message: `${optionName} exceeds the ${MAX_RESOURCE_NAME_LENGTH}-character limit (got ${name.length})`,
52278
- instructions: "Shorten the resource name. Orchestrator name limits are kind-specific (queues cap at 50, assets at 256)."
52279
- };
52280
- }
52281
- if (hasUnsafeNameChars(name)) {
52282
- return {
52283
- ok: false,
52284
- message: `${optionName} contains unsafe characters`,
52285
- instructions: 'Resource names cannot contain path separators (/, \\), control characters, or any of: : * ? " < > |'
52286
- };
52287
- }
52288
- return { ok: true };
52289
- }
52290
- function assertValidResourceName(name, options = {}) {
52291
- const result = validateResourceName(name, options);
52292
- if (!result.ok) {
52293
- throw new Error(`${result.message}. ${result.instructions}`);
52294
- }
52295
- }
52296
- var MAX_RESOURCE_NAME_LENGTH = 256, UNSAFE_NAME_CHARS;
52297
- var init_resource_name = __esm(() => {
52298
- UNSAFE_NAME_CHARS = /[\\/:*?"<>|]/;
52299
- });
52300
-
52301
- // ../../node_modules/@uipath/resource-builder-sdk/dist/entries/bindings.js
52302
- var init_bindings2 = __esm(() => {
52303
- init_bindings();
52304
- });
52305
-
52306
- // ../../node_modules/@uipath/resource-builder-sdk/dist/mappings/index.js
52307
- var init_mappings = __esm(() => {
52308
- init_resource_subtype_mapper();
52309
- });
52310
-
52311
52121
  // ../solution-sdk/src/resources/services/sync-resources-from-bindings.ts
52312
52122
  function placeholderForType(type) {
52313
52123
  switch ((type ?? "string").toLowerCase()) {
@@ -52399,6 +52209,54 @@ function sameResourceSubtype(a, b) {
52399
52209
  function findSubtypeEntry(list, type) {
52400
52210
  return list.find((r) => !!r.type && sameResourceSubtype(r.type, type));
52401
52211
  }
52212
+ function metadataString(metadata, name) {
52213
+ if (!metadata || typeof metadata !== "object")
52214
+ return;
52215
+ for (const [key, value] of Object.entries(metadata)) {
52216
+ if (key.toLowerCase() === name.toLowerCase() && typeof value === "string" && value.trim() !== "") {
52217
+ return value;
52218
+ }
52219
+ }
52220
+ return;
52221
+ }
52222
+ function declaredSubTypes(decoded, resources) {
52223
+ const subTypes = new Map;
52224
+ let document2;
52225
+ try {
52226
+ document2 = JSON.parse(decoded);
52227
+ } catch {
52228
+ return subTypes;
52229
+ }
52230
+ const entries = document2?.resources;
52231
+ if (!Array.isArray(entries))
52232
+ return subTypes;
52233
+ const byBinding = new Map;
52234
+ for (const entry of entries) {
52235
+ if (!entry || typeof entry !== "object")
52236
+ continue;
52237
+ const { resource, key, metadata } = entry;
52238
+ if (typeof resource !== "string" || typeof key !== "string" || !SUBTYPED_BINDING_KINDS.has(resource.toLowerCase())) {
52239
+ continue;
52240
+ }
52241
+ const subType = metadataString(metadata, "SubType");
52242
+ if (subType)
52243
+ byBinding.set(`${resource}\x00${key}`, subType);
52244
+ }
52245
+ for (const resource of resources) {
52246
+ const subType = byBinding.get(`${resource.originalResourceType}\x00${resource.bindingKey ?? ""}`);
52247
+ if (subType)
52248
+ subTypes.set(resource, subType);
52249
+ }
52250
+ return subTypes;
52251
+ }
52252
+ async function resolveDeclaredKindMetadata(resolveKindMetadata, kind, type, declaredSubType) {
52253
+ if (type === undefined && declaredSubType !== undefined) {
52254
+ const declared = await resolveKindMetadata(kind, declaredSubType);
52255
+ if (declared?.typeMatched)
52256
+ return declared;
52257
+ }
52258
+ return resolveKindMetadata(kind, type);
52259
+ }
52402
52260
  function resolveBindingResourceIdentity(binding) {
52403
52261
  switch (binding.resourceType) {
52404
52262
  case models_BindingsResourceType.TimeTrigger:
@@ -52435,7 +52293,11 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
52435
52293
  return result;
52436
52294
  }
52437
52295
  const serializer = services.container.resolve(Tokens.IBindingsMetadataSerializer);
52438
- const { bindings: allBindings, parseErrors } = await collectBindings(bindingsJsonFallbackDirs, serializer, bindingSources(solutionDir, paths, uipxProjects, projectBindings));
52296
+ const {
52297
+ bindings: allBindings,
52298
+ parseErrors,
52299
+ subTypes
52300
+ } = await collectBindings(bindingsJsonFallbackDirs, serializer, bindingSources(solutionDir, paths, uipxProjects, projectBindings));
52439
52301
  if (parseErrors.length > 0) {
52440
52302
  const detail = parseErrors.map((e) => `${e.path}: ${e.reason}`).join("; ");
52441
52303
  throw new Error(`Invalid bindings file — ${detail}`);
@@ -52473,7 +52335,29 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
52473
52335
  const resolvedKeys = new Set;
52474
52336
  const overwrittenKeys = new Set;
52475
52337
  const bindingKey = (kind, name) => `${kind}:${name ?? ""}`.toLowerCase();
52476
- const selfProvisionedKeys = new Set((selfProvisioned ?? []).map((r) => bindingKey(r.kind, r.name)));
52338
+ const anyFolderSelfProvisioned = new Set;
52339
+ const solutionFolderSelfProvisioned = new Set;
52340
+ for (const r of selfProvisioned ?? []) {
52341
+ (r.solutionFolderOnly ? solutionFolderSelfProvisioned : anyFolderSelfProvisioned).add(bindingKey(r.kind, r.name));
52342
+ }
52343
+ const isSelfProvisioned = (kind, name, folderPath) => {
52344
+ const key = bindingKey(kind, name);
52345
+ return anyFolderSelfProvisioned.has(key) || !normalizeFolderPath(folderPath) && solutionFolderSelfProvisioned.has(key);
52346
+ };
52347
+ const importedThisRun = new Set;
52348
+ let referencedKeys;
52349
+ const coveringResource = async (resources, kind, name, folderPath, selfProvisioned) => {
52350
+ const match = findMatchingLocalResource(resources, kind, name, folderPath);
52351
+ if (!match || !selfProvisioned)
52352
+ return match;
52353
+ referencedKeys ??= readReferencedResourceKeys(services, builder);
52354
+ const referenced = await referencedKeys;
52355
+ const owned = resources.filter((r) => {
52356
+ const key = r.key?.toLowerCase();
52357
+ return !key || !importedThisRun.has(key) && !referenced.has(key);
52358
+ });
52359
+ return findMatchingLocalResource(owned, kind, name, folderPath);
52360
+ };
52477
52361
  const recordUnchecked = async (error, kind, name, directCloudKey) => {
52478
52362
  if (error) {
52479
52363
  const failure = classifyCatalogFailure(error);
@@ -52501,7 +52385,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
52501
52385
  continue;
52502
52386
  }
52503
52387
  const isConnection = isConnectionBinding(binding);
52504
- const metadata = await resolveKindMetadata(kind, identity.type);
52388
+ const metadata = await resolveDeclaredKindMetadata(resolveKindMetadata, kind, identity.type, subTypes.get(binding));
52505
52389
  const name = getResourceName(binding);
52506
52390
  const folderPath = getFolderPathProperty(binding).defaultValue;
52507
52391
  const directCloudKey = isConnection ? getConnectionKey(binding) : undefined;
@@ -52511,7 +52395,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
52511
52395
  if (!isConnection && !name) {
52512
52396
  continue;
52513
52397
  }
52514
- if (!isConnection && !normalizeFolderPath(folderPath) && findMatchingLocalResource(solution.resources ?? [], kind, name, folderPath)) {
52398
+ const selfProvisioned = !isConnection && isSelfProvisioned(kind, name, folderPath);
52399
+ if (!isConnection && !normalizeFolderPath(folderPath) && await coveringResource(solution.resources ?? [], kind, name, folderPath, selfProvisioned)) {
52515
52400
  result.skipped++;
52516
52401
  logger.info(`Skipping ${kind} "${name}" — an in-solution resource already covers this solution-relative binding`);
52517
52402
  continue;
@@ -52521,7 +52406,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
52521
52406
  logger.info(`Skipping ${kind} "${name}" — the solution provisions this project itself; its member declaration covers the binding`);
52522
52407
  continue;
52523
52408
  }
52524
- if (!isConnection && selfProvisionedKeys.has(bindingKey(kind, name))) {
52409
+ if (selfProvisioned) {
52525
52410
  virtualCandidates.push({
52526
52411
  binding,
52527
52412
  kind,
@@ -52529,7 +52414,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
52529
52414
  metadata,
52530
52415
  name,
52531
52416
  folderPath,
52532
- catalogMiss: false
52417
+ catalogMiss: false,
52418
+ selfProvisioned
52533
52419
  });
52534
52420
  continue;
52535
52421
  }
@@ -52552,7 +52438,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
52552
52438
  metadata,
52553
52439
  name,
52554
52440
  folderPath,
52555
- catalogMiss: true
52441
+ catalogMiss: true,
52442
+ selfProvisioned: false
52556
52443
  });
52557
52444
  continue;
52558
52445
  }
@@ -52581,6 +52468,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
52581
52468
  if (rcsMatch.key) {
52582
52469
  knownResourceKeys.add(rcsMatch.key.toLowerCase());
52583
52470
  overwrittenKeys.add(rcsMatch.key.toLowerCase());
52471
+ importedThisRun.add(rcsMatch.key.toLowerCase());
52584
52472
  }
52585
52473
  result.imported++;
52586
52474
  logger.info(`Imported ${kind} "${rcsMatch.name}" (key: ${rcsMatch.key}) into solution`);
@@ -52607,7 +52495,8 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
52607
52495
  metadata,
52608
52496
  name,
52609
52497
  folderPath,
52610
- catalogMiss: false
52498
+ catalogMiss: false,
52499
+ selfProvisioned: false
52611
52500
  });
52612
52501
  }
52613
52502
  const virtualCandidatesSeen = new Set;
@@ -52619,7 +52508,7 @@ async function syncResourcesFromBindings(solutionDir, projectPaths, projectSubTy
52619
52508
  return true;
52620
52509
  });
52621
52510
  for (const candidate of dedupedVirtuals) {
52622
- const [syncError, created] = await catchError2(createVirtualForBinding(builder, candidate.binding, candidate.kind, candidate.type, candidate.metadata, candidate.name, candidate.folderPath, result, candidate.catalogMiss));
52511
+ const [syncError, created] = await catchError2(createVirtualForBinding(builder, candidate.binding, candidate.kind, candidate.type, candidate.metadata, candidate.name, candidate.folderPath, result, candidate.catalogMiss, (resources) => coveringResource(resources, candidate.kind, candidate.name, undefined, candidate.selfProvisioned)));
52623
52512
  if (syncError) {
52624
52513
  logger.warn(`Failed to create virtual ${candidate.kind}/${candidate.name}: ${syncError.message}`);
52625
52514
  } else if (created) {
@@ -52698,6 +52587,15 @@ async function reportOrphanedDeclarations(services, builder, bindings, result) {
52698
52587
  logger.warn(warning);
52699
52588
  }
52700
52589
  }
52590
+ async function readReferencedResourceKeys(services, builder) {
52591
+ const overwrites = services.container.resolve(Tokens.IResourceOverwritesService);
52592
+ const [error, entries] = await catchError2(overwrites.getTenantResourceOverwritesAsync(builder.context));
52593
+ if (error) {
52594
+ logger.debug(`Could not read the resource overwrites, so no root resource is known to be an import: ${error.message}`);
52595
+ return new Set;
52596
+ }
52597
+ return new Set(entries.filter((e) => String(e.overwrite?.type) === REFERENCE_OVERWRITE).map((e) => e.solutionResourceKey.toLowerCase()));
52598
+ }
52701
52599
  async function isUncheckedBindingCovered(builder, knownResourceKeys, kind, name, directCloudKey) {
52702
52600
  if (directCloudKey) {
52703
52601
  return knownResourceKeys.has(directCloudKey.toLowerCase());
@@ -52797,10 +52695,10 @@ async function mintVirtualResource(builder, kind, type, name, metadata) {
52797
52695
  }
52798
52696
  return { resource, finalName: uniqueName };
52799
52697
  }
52800
- async function createVirtualForBinding(builder, _binding, kind, type, metadata, name, folderPath, result, catalogMiss) {
52698
+ async function createVirtualForBinding(builder, _binding, kind, type, metadata, name, folderPath, result, catalogMiss, findCovering) {
52801
52699
  const virtualizable = metadata?.virtualizable ?? false;
52802
52700
  const preLoadSolution = await builder.context.loadAsync();
52803
- const alreadyVirtualized = findMatchingLocalResource(preLoadSolution.resources, kind, name, undefined);
52701
+ const alreadyVirtualized = await findCovering(preLoadSolution.resources);
52804
52702
  if (alreadyVirtualized) {
52805
52703
  result.skipped++;
52806
52704
  logger.info(`Skipping virtual ${kind} "${name}" — existing resource "${alreadyVirtualized.name}" in solution_folder already covers this binding (requested folder "${folderPath}")`);
@@ -52862,6 +52760,35 @@ async function findResourceByKeyInRcs(builder, kind, expectedKey, folderPath, pr
52862
52760
  }
52863
52761
  return;
52864
52762
  }
52763
+ async function findResourcesByKeysInRcs(builder, kind, keys) {
52764
+ const wanted = new Set([...keys].map((key) => key.toLowerCase()));
52765
+ const found = new Map;
52766
+ let pageCursor;
52767
+ while (found.size < wanted.size) {
52768
+ const result = await builder.searchResourcesAsync(kind, undefined, undefined, pageCursor, 100, undefined, false);
52769
+ for (const folderResources of result.availableResources) {
52770
+ for (const resource of folderResources.resources) {
52771
+ const key = resource.key.toLowerCase();
52772
+ if (!wanted.has(key) || found.has(key))
52773
+ continue;
52774
+ found.set(key, {
52775
+ key: resource.key,
52776
+ name: resource.name,
52777
+ type: resource.type,
52778
+ folder: {
52779
+ fullyQualifiedName: folderResources.fullyQualifiedName,
52780
+ folderKey: folderResources.key,
52781
+ path: folderResources.path
52782
+ }
52783
+ });
52784
+ }
52785
+ }
52786
+ pageCursor = result.nextPage;
52787
+ if (!pageCursor)
52788
+ break;
52789
+ }
52790
+ return found;
52791
+ }
52865
52792
  async function searchRcsResources(builder, kind, name) {
52866
52793
  const [searchError, matches] = await catchError2(searchRcsResourcesStrict(builder, kind, name));
52867
52794
  if (searchError) {
@@ -53102,6 +53029,17 @@ async function collectBindings(bindingsJsonFallbackDirs, serializer, sources) {
53102
53029
  const fs = getFileSystem();
53103
53030
  const allBindings = [];
53104
53031
  const parseErrors = [];
53032
+ const subTypes = new Map;
53033
+ const collect = (parsed) => {
53034
+ if ("error" in parsed) {
53035
+ parseErrors.push(parsed.error);
53036
+ return;
53037
+ }
53038
+ allBindings.push(...parsed.resources);
53039
+ for (const [binding, subType] of parsed.subTypes) {
53040
+ subTypes.set(binding, subType);
53041
+ }
53042
+ };
53105
53043
  for (const { directory: dir, contribution } of sources) {
53106
53044
  if (contribution) {
53107
53045
  if (contribution.bindings.length === 0)
@@ -53110,10 +53048,7 @@ async function collectBindings(bindingsJsonFallbackDirs, serializer, sources) {
53110
53048
  version: "2.0",
53111
53049
  resources: contribution.bindings
53112
53050
  }), `${dir} (bindings contributed by the project's tool; project ${contribution.projectId})`, serializer);
53113
- if ("error" in parsed)
53114
- parseErrors.push(parsed.error);
53115
- else
53116
- allBindings.push(...parsed.resources);
53051
+ collect(parsed);
53117
53052
  continue;
53118
53053
  }
53119
53054
  const v2Path = fs.path.join(dir, "bindings_v2.json");
@@ -53134,13 +53069,9 @@ async function collectBindings(bindingsJsonFallbackDirs, serializer, sources) {
53134
53069
  });
53135
53070
  continue;
53136
53071
  }
53137
- const parsed = deserializeBindings(new TextDecoder().decode(content), bindingsPath, serializer);
53138
- if ("error" in parsed)
53139
- parseErrors.push(parsed.error);
53140
- else
53141
- allBindings.push(...parsed.resources);
53072
+ collect(deserializeBindings(new TextDecoder().decode(content), bindingsPath, serializer));
53142
53073
  }
53143
- return { bindings: allBindings, parseErrors };
53074
+ return { bindings: allBindings, parseErrors, subTypes };
53144
53075
  }
53145
53076
  function deserializeBindings(decoded, source, serializer) {
53146
53077
  let success;
@@ -53165,7 +53096,8 @@ function deserializeBindings(decoded, source, serializer) {
53165
53096
  }
53166
53097
  };
53167
53098
  }
53168
- return { resources: metadata?.resources ?? [] };
53099
+ const resources = metadata?.resources ?? [];
53100
+ return { resources, subTypes: declaredSubTypes(decoded, resources) };
53169
53101
  }
53170
53102
  async function syncAndLog(solutionDir, projectSubTypes, options) {
53171
53103
  const [syncError, syncResult] = await catchError2(syncResourcesFromBindings(solutionDir, undefined, projectSubTypes, options?.projectBindings, options?.selfProvisioned));
@@ -53185,11 +53117,11 @@ async function syncAndLog(solutionDir, projectSubTypes, options) {
53185
53117
  throw new CatalogLookupError(syncResult.catalogLookupFailure, syncResult.unresolved);
53186
53118
  }
53187
53119
  }
53188
- var TYPE_IS_IDENTITY_REPLACE_OPTIONS, BINDINGS_JSON_FALLBACK_TYPES, IMPLICIT_CONNECTION2 = "ImplicitConnection", OverwriteRefreshError;
53120
+ var TYPE_IS_IDENTITY_REPLACE_OPTIONS, BINDINGS_JSON_FALLBACK_TYPES, IMPLICIT_CONNECTION2 = "ImplicitConnection", OverwriteRefreshError, SUBTYPED_BINDING_KINDS, REFERENCE_OVERWRITE = "Reference";
53189
53121
  var init_sync_resources_from_bindings = __esm(() => {
53190
53122
  init_src4();
53191
53123
  init_src2();
53192
- init_bindings2();
53124
+ init_bindings3();
53193
53125
  init_mappings();
53194
53126
  init_solution2();
53195
53127
  init_service_tokens();
@@ -53206,6 +53138,400 @@ var init_sync_resources_from_bindings = __esm(() => {
53206
53138
  BINDINGS_JSON_FALLBACK_TYPES = new Set(["agent", "function"]);
53207
53139
  OverwriteRefreshError = class OverwriteRefreshError extends Error {
53208
53140
  };
53141
+ SUBTYPED_BINDING_KINDS = new Set([
53142
+ "asset",
53143
+ "bucket"
53144
+ ]);
53145
+ });
53146
+
53147
+ // ../solution-sdk/src/resources/services/imported-resources.ts
53148
+ async function resolveImportedResourcesAsync(services, builder, resources) {
53149
+ const overwrites = await services.container.resolve(Tokens.IResourceOverwritesService).getTenantResourceOverwritesAsync(builder.context);
53150
+ const tenantNames = new Map;
53151
+ for (const entry of overwrites) {
53152
+ if (String(entry.overwrite?.type) !== REFERENCE_OVERWRITE2)
53153
+ continue;
53154
+ tenantNames.set(entry.solutionResourceKey.toLowerCase(), entry.overwrite?.resourceName || undefined);
53155
+ }
53156
+ const resolved = new Map;
53157
+ const unresolved = new Map;
53158
+ const unchecked = new Set;
53159
+ const byKind = new Map;
53160
+ for (const resource of resources) {
53161
+ const key = resource.key?.toLowerCase();
53162
+ if (!key)
53163
+ continue;
53164
+ if (normalizeFolderPath(resource.folders?.[0]?.fullyQualifiedName)) {
53165
+ continue;
53166
+ }
53167
+ const recorded = tenantNames.has(key);
53168
+ if (!recorded && resource.isArtefactResource)
53169
+ continue;
53170
+ const kind = resource.kind ?? "";
53171
+ byKind.set(kind, [...byKind.get(kind) ?? [], { key, recorded }]);
53172
+ }
53173
+ const reportFailed = (entries, reason) => {
53174
+ for (const { key, recorded } of entries) {
53175
+ if (recorded)
53176
+ unresolved.set(key, reason);
53177
+ else
53178
+ unchecked.add(key);
53179
+ }
53180
+ };
53181
+ let failure;
53182
+ for (const [kind, entries] of byKind) {
53183
+ if (failure) {
53184
+ reportFailed(entries, failure);
53185
+ continue;
53186
+ }
53187
+ const [error, matches] = await catchError2(findResourcesByKeysInRcs(builder, kind, entries.map((entry) => entry.key)));
53188
+ if (error) {
53189
+ const reason = `the Resource Catalog could not be searched: ${error.message}`;
53190
+ reportFailed(entries, reason);
53191
+ if (stopsCatalogLookups(classifyCatalogFailure(error))) {
53192
+ failure = reason;
53193
+ }
53194
+ continue;
53195
+ }
53196
+ for (const { key, recorded } of entries) {
53197
+ const match = matches.get(key);
53198
+ if (match?.folder?.fullyQualifiedName) {
53199
+ resolved.set(key, {
53200
+ name: tenantNames.get(key) ?? match.name,
53201
+ folderPath: match.folder.fullyQualifiedName
53202
+ });
53203
+ } else if (recorded) {
53204
+ unresolved.set(key, "the Resource Catalog no longer lists it");
53205
+ }
53206
+ }
53207
+ }
53208
+ return { resolved, unresolved, unchecked };
53209
+ }
53210
+ var REFERENCE_OVERWRITE2 = "Reference";
53211
+ var init_imported_resources = __esm(() => {
53212
+ init_src4();
53213
+ init_service_tokens();
53214
+ init_catalog_lookup_failure();
53215
+ init_local_resource_matcher();
53216
+ init_sync_resources_from_bindings();
53217
+ });
53218
+
53219
+ // ../solution-sdk/src/resources/services/project-artifacts-service.ts
53220
+ async function addProjectArtifactsToSolutionAsync(options) {
53221
+ const error = await createProjectInSolutionBuilder(options.solutionDir, options.projectId, options.projectName, normalizeProjectType(options.projectType), options.projectSubType);
53222
+ return error ? artifactFailure(options, error) : { Created: true };
53223
+ }
53224
+ function artifactFailure(options, error) {
53225
+ 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.");
53226
+ return { Created: false, Error: error.message };
53227
+ }
53228
+ var init_project_artifacts_service = __esm(() => {
53229
+ init_src4();
53230
+ init_solution_file();
53231
+ init_project_utils();
53232
+ });
53233
+
53234
+ // ../solution-sdk/src/resources/services/project-template-types.ts
53235
+ function hasBareTemplateRow(projectType) {
53236
+ reader ??= new EmbeddedProjectConfigurationReader;
53237
+ return reader.getTemplateResourcesByType(projectType, undefined, false).length > 0;
53238
+ }
53239
+ function hasAnyTemplateRow(projectType) {
53240
+ reader ??= new EmbeddedProjectConfigurationReader;
53241
+ const wanted = projectType.toLowerCase();
53242
+ return Object.keys(reader.getAll()).some((row) => {
53243
+ const key = row.toLowerCase();
53244
+ return key === wanted || key.startsWith(`${wanted}_`);
53245
+ });
53246
+ }
53247
+ var reader;
53248
+ var init_project_template_types = __esm(() => {
53249
+ init_config2();
53250
+ });
53251
+
53252
+ // ../solution-sdk/src/resources/services/remote-resources.ts
53253
+ function getRemoteResourceClients(services) {
53254
+ return {
53255
+ catalog: services.container.resolve(Tokens.IResourceCatalogClientProxy),
53256
+ importer: services.container.resolve(Tokens.IImportResourceHelper)
53257
+ };
53258
+ }
53259
+ async function findCatalogEntityAsync(catalog, query, match) {
53260
+ let pageCursor;
53261
+ do {
53262
+ const page = await catalog.searchFolderEntities({
53263
+ ...query,
53264
+ pageSize: 100,
53265
+ pageCursor
53266
+ });
53267
+ const found = (page.items ?? []).find(match);
53268
+ if (found) {
53269
+ return found;
53270
+ }
53271
+ pageCursor = page.nextPage ?? undefined;
53272
+ } while (pageCursor);
53273
+ return;
53274
+ }
53275
+ async function findCatalogEntitiesAsync(catalog, query, match) {
53276
+ const found = [];
53277
+ let pageCursor;
53278
+ do {
53279
+ const page = await catalog.searchFolderEntities({
53280
+ ...query,
53281
+ pageSize: 100,
53282
+ pageCursor
53283
+ });
53284
+ found.push(...(page.items ?? []).filter(match));
53285
+ pageCursor = page.nextPage ?? undefined;
53286
+ } while (pageCursor);
53287
+ return found;
53288
+ }
53289
+ function toResourceReference(entity) {
53290
+ return toCatalogReference({
53291
+ kind: entity.entityType ?? "",
53292
+ type: entity.entitySubType ?? undefined,
53293
+ key: entity.entityKey ?? "",
53294
+ name: entity.entityName ?? undefined,
53295
+ folderPath: entity.fullyQualifiedName ?? undefined,
53296
+ folderKey: entity.folderKey ?? undefined
53297
+ });
53298
+ }
53299
+ function toCatalogReference(reference) {
53300
+ const { folderPath, folderKey, ...rest } = reference;
53301
+ return {
53302
+ ...rest,
53303
+ folder: folderPath ? { fullyQualifiedName: folderPath, folderKey } : undefined
53304
+ };
53305
+ }
53306
+ async function exportResourceDefinitionAsync(importer, reference) {
53307
+ const [error, payload] = await catchError2(importer.exportResourceAsync(reference));
53308
+ if (error) {
53309
+ throw withExportStatus(error);
53310
+ }
53311
+ return payload.resourceDefinitions.find((d) => d.key === reference.key);
53312
+ }
53313
+ function withExportStatus(error) {
53314
+ if (!(error instanceof Error) || !("exceptionData" in error)) {
53315
+ return error;
53316
+ }
53317
+ const data = error.exceptionData;
53318
+ const text = typeof data === "object" && data !== null ? data.errorMessage : undefined;
53319
+ const match = typeof text === "string" ? /^HTTP (\d{3})\b/.exec(text) : null;
53320
+ return match ? new ResourceExportError(error.message, Number(match[1]), error) : error;
53321
+ }
53322
+ function readSpecProperty(spec, name) {
53323
+ if (!spec) {
53324
+ return;
53325
+ }
53326
+ if (spec[name] !== undefined) {
53327
+ return spec[name];
53328
+ }
53329
+ const lower = name.toLowerCase();
53330
+ const key = Object.keys(spec).find((k) => k.toLowerCase() === lower);
53331
+ return key === undefined ? undefined : spec[key];
53332
+ }
53333
+ function readSpecEntryPoints(spec) {
53334
+ const entryPoints = parseJsonString(readSpecProperty(spec, "entryPoints"));
53335
+ if (!Array.isArray(entryPoints) || !entryPoints.every((entry) => entry !== null && typeof entry === "object")) {
53336
+ return;
53337
+ }
53338
+ return entryPoints.map((entry) => ({
53339
+ UniqueId: String(readSpecProperty(entry, "uniqueId") ?? ""),
53340
+ Path: String(readSpecProperty(entry, "path") ?? ""),
53341
+ DisplayName: String(readSpecProperty(entry, "displayName") ?? ""),
53342
+ InputArguments: readSpecProperty(entry, "inputArguments"),
53343
+ OutputArguments: readSpecProperty(entry, "outputArguments")
53344
+ }));
53345
+ }
53346
+ function parseJsonString(raw) {
53347
+ if (typeof raw !== "string") {
53348
+ return raw;
53349
+ }
53350
+ const [error, parsed] = catchError2(() => JSON.parse(raw));
53351
+ return error ? undefined : parsed;
53352
+ }
53353
+ var ResourceExportError;
53354
+ var init_remote_resources = __esm(() => {
53355
+ init_src4();
53356
+ init_service_tokens();
53357
+ ResourceExportError = class ResourceExportError extends Error {
53358
+ status;
53359
+ constructor(message, status, cause) {
53360
+ super(message, { cause });
53361
+ this.status = status;
53362
+ this.name = "ResourceExportError";
53363
+ }
53364
+ };
53365
+ });
53366
+
53367
+ // ../solution-sdk/src/resources/services/resource-configurations.ts
53368
+ function isResourceKeyNotFound(error, resourceKey) {
53369
+ if (!(error instanceof Error))
53370
+ return false;
53371
+ const typed = error;
53372
+ const sameKey = (key) => key !== undefined && key.toLowerCase() === resourceKey.toLowerCase();
53373
+ if (typeof typed.resourceType === "string" && typeof typed.resourceKey === "string") {
53374
+ return ROOT_RESOURCE_TYPES.has(typed.resourceType.toLowerCase()) && sameKey(typed.resourceKey);
53375
+ }
53376
+ return sameKey(KEY_NOT_FOUND.exec(error.message.trim())?.[1]);
53377
+ }
53378
+ async function refreshArtefactSpecsAsync(builder, configurations) {
53379
+ const resources = new Map;
53380
+ const [loadError, solution] = await catchError2(builder.context.loadAsync());
53381
+ if (loadError || !solution)
53382
+ return resources;
53383
+ for (const configuration of configurations) {
53384
+ const resource = solution.resources.find((r) => r.key === configuration?.key);
53385
+ if (!resource)
53386
+ continue;
53387
+ resources.set(resource.key, resource);
53388
+ if (!resource.projectKey)
53389
+ continue;
53390
+ configuration.spec = await applyEntryPointEnhancementAsync(builder.context, resource, configuration.spec ?? {});
53391
+ }
53392
+ return resources;
53393
+ }
53394
+ async function exportResourceConfigurationsAsync(services, resourceKey, hint = {}) {
53395
+ const { catalog, importer } = getRemoteResourceClients(services);
53396
+ const byKey = (item) => item.entityKey === resourceKey;
53397
+ const entity = (hint.name ? await findCatalogEntityAsync(catalog, { name: hint.name }, byKey) : undefined) ?? await findCatalogEntityAsync(catalog, {}, byKey);
53398
+ if (!entity) {
53399
+ throw new Error(`Resource '${resourceKey}' was not found in the solution or in the resource catalog`);
53400
+ }
53401
+ const payload = await importer.exportResourceAsync(toResourceReference(entity));
53402
+ const definitions = payload.resourceDefinitions ?? [];
53403
+ if (definitions.length === 0) {
53404
+ throw new Error(`FPS export for '${resourceKey}' returned no resource definitions`);
53405
+ }
53406
+ return {
53407
+ resources: definitions.map((d) => ({
53408
+ key: d.key ?? "",
53409
+ spec: d.spec ?? {},
53410
+ locks: d.locks ?? [],
53411
+ apiVersion: d.apiVersion,
53412
+ isOverridable: d.isOverridable,
53413
+ name: d.name ?? "",
53414
+ kind: d.kind ?? "",
53415
+ dependencies: (d.dependencies ?? []).map((dep) => ({
53416
+ kind: dep.kind ?? "",
53417
+ name: dep.name ?? ""
53418
+ }))
53419
+ }))
53420
+ };
53421
+ }
53422
+ async function readLocalAsync(builder, resourceKey, read) {
53423
+ if (!builder)
53424
+ return;
53425
+ const [error, value] = await catchError2(read(builder));
53426
+ if (!error)
53427
+ return { builder, value };
53428
+ if (isResourceKeyNotFound(error, resourceKey))
53429
+ return;
53430
+ throw error;
53431
+ }
53432
+ async function readResourceConfigurationsAsync(services, builder, resourceKey, hint = {}) {
53433
+ const local = await readLocalAsync(builder, resourceKey, (b) => b.getAllConfigurationsAsync(resourceKey));
53434
+ if (!local) {
53435
+ return exportResourceConfigurationsAsync(services, resourceKey, hint);
53436
+ }
53437
+ await refreshArtefactSpecsAsync(local.builder, local.value?.resources ?? []);
53438
+ return local.value;
53439
+ }
53440
+ async function readResourceConfigurationAsync(services, builder, resourceKey) {
53441
+ const local = await readLocalAsync(builder, resourceKey, (b) => b.getConfigurationAsync(resourceKey));
53442
+ if (local) {
53443
+ const configuration = local.value;
53444
+ const resources = await refreshArtefactSpecsAsync(local.builder, [
53445
+ configuration
53446
+ ]);
53447
+ return { configuration, resource: resources.get(configuration.key) };
53448
+ }
53449
+ const { resources } = await exportResourceConfigurationsAsync(services, resourceKey);
53450
+ const primary = resources.find((r) => r.key === resourceKey) ?? resources[0];
53451
+ const { key, spec, locks, apiVersion, isOverridable } = primary;
53452
+ return { configuration: { key, spec, locks, apiVersion, isOverridable } };
53453
+ }
53454
+ var ROOT_RESOURCE_TYPES, KEY_NOT_FOUND;
53455
+ var init_resource_configurations = __esm(() => {
53456
+ init_src4();
53457
+ init_entry_point_spec_enhancer();
53458
+ init_remote_resources();
53459
+ ROOT_RESOURCE_TYPES = new Set(["resource", "solutionresource"]);
53460
+ KEY_NOT_FOUND = /^(?:Solution)?Resource with key '([^']+)' was not found$/i;
53461
+ });
53462
+
53463
+ // ../solution-sdk/src/resources/services/resource-lookup.ts
53464
+ async function findResourcesByNameAsync(services, builder, { kind, name, subTypes, folderKey }) {
53465
+ const same = (a, b) => (a ?? "").toLowerCase() === b.toLowerCase();
53466
+ const ofSubType = (type) => subTypes === undefined || subTypes.some((t) => same(type, t));
53467
+ if (builder) {
53468
+ const solution = await builder.context.loadAsync();
53469
+ const local = solution.resources.filter((r) => same(r.kind, kind) && same(r.name, name) && ofSubType(r.type)).map((r) => ({
53470
+ key: r.key,
53471
+ local: true,
53472
+ folderPath: r.folders?.[0]?.fullyQualifiedName
53473
+ }));
53474
+ if (local.length > 0)
53475
+ return local;
53476
+ }
53477
+ const { catalog } = getRemoteResourceClients(services);
53478
+ 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)));
53479
+ return rows.map((row) => ({
53480
+ key: row.entityKey ?? "",
53481
+ local: false,
53482
+ folderPath: row.fullyQualifiedName ?? undefined,
53483
+ folderKey: row.folderKey ?? undefined
53484
+ }));
53485
+ }
53486
+ var init_resource_lookup = __esm(() => {
53487
+ init_remote_resources();
53488
+ });
53489
+
53490
+ // ../solution-sdk/src/resources/services/resource-name.ts
53491
+ function hasControlChar(value) {
53492
+ for (let i = 0;i < value.length; i++) {
53493
+ if (value.charCodeAt(i) < 32)
53494
+ return true;
53495
+ }
53496
+ return false;
53497
+ }
53498
+ function hasUnsafeNameChars(name) {
53499
+ return UNSAFE_NAME_CHARS.test(name) || hasControlChar(name);
53500
+ }
53501
+ function validateResourceName(name, options = {}) {
53502
+ const optionName = options.optionName ?? "--name";
53503
+ if (name.trim() === "") {
53504
+ return {
53505
+ ok: false,
53506
+ message: `${optionName} must not be blank`,
53507
+ instructions: "Pass a non-empty resource name."
53508
+ };
53509
+ }
53510
+ if (name.length > MAX_RESOURCE_NAME_LENGTH) {
53511
+ return {
53512
+ ok: false,
53513
+ message: `${optionName} exceeds the ${MAX_RESOURCE_NAME_LENGTH}-character limit (got ${name.length})`,
53514
+ instructions: "Shorten the resource name. Orchestrator name limits are kind-specific (queues cap at 50, assets at 256)."
53515
+ };
53516
+ }
53517
+ if (hasUnsafeNameChars(name)) {
53518
+ return {
53519
+ ok: false,
53520
+ message: `${optionName} contains unsafe characters`,
53521
+ instructions: 'Resource names cannot contain path separators (/, \\), control characters, or any of: : * ? " < > |'
53522
+ };
53523
+ }
53524
+ return { ok: true };
53525
+ }
53526
+ function assertValidResourceName(name, options = {}) {
53527
+ const result = validateResourceName(name, options);
53528
+ if (!result.ok) {
53529
+ throw new Error(`${result.message}. ${result.instructions}`);
53530
+ }
53531
+ }
53532
+ var MAX_RESOURCE_NAME_LENGTH = 256, UNSAFE_NAME_CHARS;
53533
+ var init_resource_name = __esm(() => {
53534
+ UNSAFE_NAME_CHARS = /[\\/:*?"<>|]/;
53209
53535
  });
53210
53536
 
53211
53537
  // ../solution-sdk/src/resources/services/resource-refresh-service.ts
@@ -53246,7 +53572,11 @@ async function resourceRefreshAsync(solutionPath = ".", options = {}) {
53246
53572
  if (bindingsError) {
53247
53573
  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'.`);
53248
53574
  }
53249
- const [syncError, result] = await catchError2(syncResourcesFromBindings(resolvedPath, undefined, projectSubTypes ?? new Map, projectBindings ?? new Map, undefined, {
53575
+ const [selfProvisionedError, selfProvisioned] = await catchError2(options.resolveSelfProvisionedAsync?.() ?? Promise.resolve([]));
53576
+ if (selfProvisionedError) {
53577
+ 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'.`);
53578
+ }
53579
+ const [syncError, result] = await catchError2(syncResourcesFromBindings(resolvedPath, undefined, projectSubTypes ?? new Map, projectBindings ?? new Map, selfProvisioned?.length ? [...selfProvisioned] : undefined, {
53250
53580
  bindingsComplete: !bindingsError && (options.isProjectBindingsComplete?.() ?? true)
53251
53581
  }));
53252
53582
  if (syncError) {
@@ -53489,6 +53819,7 @@ __export(exports_resources, {
53489
53819
  findProjectFile: () => findProjectFile,
53490
53820
  findResourceByKeyInRcs: () => findResourceByKeyInRcs,
53491
53821
  findResourceInRcs: () => findResourceInRcs,
53822
+ findResourcesByKeysInRcs: () => findResourcesByKeysInRcs,
53492
53823
  findResourcesByNameAsync: () => findResourcesByNameAsync,
53493
53824
  formatResourceSubtypes: () => formatResourceSubtypes,
53494
53825
  getRemoteResourceClients: () => getRemoteResourceClients,
@@ -53510,6 +53841,7 @@ __export(exports_resources, {
53510
53841
  readSpecProperty: () => readSpecProperty,
53511
53842
  readUipxProjects: () => readUipxProjects,
53512
53843
  refreshArtefactSpecsAsync: () => refreshArtefactSpecsAsync,
53844
+ resolveImportedResourcesAsync: () => resolveImportedResourcesAsync,
53513
53845
  resolveProjectDirFromManifest: () => resolveProjectDirFromManifest,
53514
53846
  resolveResourceKindMetadata: () => resolveResourceKindMetadata,
53515
53847
  resolveSolutionFilePath: () => resolveSolutionFilePath,
@@ -53534,6 +53866,7 @@ var init_resources = __esm(() => {
53534
53866
  init_project_utils();
53535
53867
  init_resource_builder_init();
53536
53868
  init_entry_point_spec_enhancer();
53869
+ init_imported_resources();
53537
53870
  init_local_resource_matcher();
53538
53871
  init_project_artifacts_service();
53539
53872
  init_project_template_types();
@@ -265184,4 +265517,4 @@ export {
265184
265517
  studioCatalogTypeCache
265185
265518
  };
265186
265519
 
265187
- //# debugId=12ABF9BC3AC90FBF64756E2164756E21
265520
+ //# debugId=6F1A9354A4CDE78064756E2164756E21