@uipath/api-workflow-tool 1.205.0-preview.277 → 1.206.0-preview.279
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/dist/THIRD-PARTY-NOTICES.md +64 -3
- package/dist/applicationinsights-web-8m26566f.js +17209 -0
- package/dist/executor-tool.js +7 -9
- package/dist/index-1wp4j95a.js +10 -0
- package/dist/index-3d09whjq.js +11 -0
- package/dist/{index-waq4trz1.js → index-njewr1c3.js} +5040 -2961
- package/dist/{index-h8cph72k.js → index-nzr4mx5p.js} +2 -22
- package/dist/index.js +14 -15
- package/dist/index.umd.min-ttg1qc0x.js +7814 -0
- package/dist/{jmespath-e4a59c8w.js → jmespath-wwym30dp.js} +1 -1
- package/dist/js-yaml-0c4svjwq.js +36 -0
- package/dist/{node-0aex431z.js → node-zecqtv6e.js} +13 -90
- package/dist/{packager-tool-bgy9gdsp.js → packager-tool-2ckhrf4j.js} +128 -15
- package/dist/{packager-tool-kh3aq9n7.js → packager-tool-2wwd7kp4.js} +920 -903
- package/dist/{packager-tool-xak3m9vd.js → packager-tool-3hcrfsc1.js} +762 -384
- package/dist/{packager-tool-0aacqssr.js → packager-tool-5b6vjjp3.js} +371 -371
- package/dist/{packager-tool-d3w0wn6k.js → packager-tool-5gce5wfd.js} +16 -16
- package/dist/{packager-tool-f7zta1kg.js → packager-tool-61bdk9sn.js} +203 -156
- package/dist/{packager-tool-1yh8g550.js → packager-tool-6an893wm.js} +12 -3
- package/dist/{packager-tool-646qm7dh.js → packager-tool-km68yge6.js} +62 -586
- package/dist/{packager-tool-evd1kzq2.js → packager-tool-qhv22qaj.js} +809 -380
- package/dist/packager-tool-rqprykf5.js +15 -0
- package/dist/{packager-tool-h29ph2zm.js → packager-tool-w1asrkzg.js} +361 -205
- package/dist/packager-tool.js +6 -6
- package/dist/tool.js +13 -14
- package/package.json +2 -2
- package/dist/index-a8veczhw.js +0 -72
- package/dist/index.umd.min-fqefd9kn.js +0 -7814
- package/dist/js-yaml-69tsdrrf.js +0 -37
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
|
-
I18nManager,
|
|
3
|
-
LogMessage,
|
|
4
|
-
NugetPackager,
|
|
5
2
|
Path,
|
|
6
|
-
ProjectTool,
|
|
7
3
|
TemporaryStorageService,
|
|
8
|
-
ToolResult,
|
|
9
4
|
ZipService,
|
|
5
|
+
I18nManager,
|
|
6
|
+
translate,
|
|
10
7
|
normalizeIgnoredRules,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
LogMessage,
|
|
9
|
+
ToolResult,
|
|
10
|
+
NugetPackager,
|
|
11
|
+
ProjectTool,
|
|
12
|
+
toolsFactoryRepository
|
|
13
|
+
} from "./packager-tool-61bdk9sn.js";
|
|
14
14
|
import {
|
|
15
|
+
ProjectDimensions,
|
|
15
16
|
PackagerDimensions,
|
|
16
|
-
|
|
17
|
+
projectKey,
|
|
18
|
+
PROJECT_IDENTITY_LOOKUP_BUDGET_MS,
|
|
19
|
+
withinProjectIdentityBudget,
|
|
20
|
+
catchError,
|
|
17
21
|
carriedInstructions,
|
|
18
|
-
|
|
19
|
-
} from "./packager-tool-
|
|
22
|
+
isProjectTelemetryDisabled
|
|
23
|
+
} from "./packager-tool-qhv22qaj.js";
|
|
20
24
|
// ../packager/project-packager/src/i18n/locales/de.json
|
|
21
25
|
var de_default = {
|
|
22
26
|
solutionpackager: {
|
|
@@ -1406,7 +1410,9 @@ var globalLogHandler = (logMessage) => {
|
|
|
1406
1410
|
}
|
|
1407
1411
|
};
|
|
1408
1412
|
function setGlobalLogHandler(handler) {
|
|
1413
|
+
const previous = globalLogHandler;
|
|
1409
1414
|
globalLogHandler = handler;
|
|
1415
|
+
return previous;
|
|
1410
1416
|
}
|
|
1411
1417
|
|
|
1412
1418
|
class ToolLogger {
|
|
@@ -1470,13 +1476,6 @@ class ToolLogger {
|
|
|
1470
1476
|
}
|
|
1471
1477
|
|
|
1472
1478
|
// ../packager/project-packager/src/models/packager-parameters.ts
|
|
1473
|
-
var RulesConfigFileType;
|
|
1474
|
-
((RulesConfigFileType2) => {
|
|
1475
|
-
RulesConfigFileType2["Default"] = "Default";
|
|
1476
|
-
RulesConfigFileType2["AutomationOps"] = "AutomationOps";
|
|
1477
|
-
RulesConfigFileType2["Studio"] = "Studio";
|
|
1478
|
-
})(RulesConfigFileType ||= {});
|
|
1479
|
-
|
|
1480
1479
|
class PackagerParameters {
|
|
1481
1480
|
inputPath;
|
|
1482
1481
|
downloadUrl;
|
|
@@ -1511,38 +1510,16 @@ class ProjectValidateOptions extends ProjectRestoreOptions {
|
|
|
1511
1510
|
// ../packager/project-packager/src/models/project-build-options.ts
|
|
1512
1511
|
class ProjectBuildOptions extends ProjectValidateOptions {
|
|
1513
1512
|
outputType;
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
// ../packager/project-packager/src/models/project-cleanup-options.ts
|
|
1517
|
-
class ProjectCleanupOptions extends PackagerParameters {
|
|
1518
|
-
dryRun = false;
|
|
1519
|
-
skipImports = false;
|
|
1520
|
-
lockKey;
|
|
1513
|
+
activitiesRootCategory;
|
|
1521
1514
|
}
|
|
1522
1515
|
|
|
1523
1516
|
// ../packager/project-packager/src/models/project-pack-options.ts
|
|
1524
|
-
class
|
|
1517
|
+
class ProjectPackOptions2 extends ProjectBuildOptions {
|
|
1525
1518
|
destinationPath;
|
|
1526
1519
|
package;
|
|
1527
1520
|
signingInfo;
|
|
1528
1521
|
packOptions;
|
|
1529
1522
|
}
|
|
1530
|
-
// ../packager/project-packager/src/telemetry-names.ts
|
|
1531
|
-
var TelemetryNames;
|
|
1532
|
-
((TelemetryNames2) => {
|
|
1533
|
-
TelemetryNames2["ProjectToolPack"] = "ProjectPackager.Tool.Pack";
|
|
1534
|
-
TelemetryNames2["ProjectToolRestore"] = "ProjectPackager.Tool.Restore";
|
|
1535
|
-
TelemetryNames2["ProjectToolValidate"] = "ProjectPackager.Tool.Validate";
|
|
1536
|
-
TelemetryNames2["ProjectToolBuild"] = "ProjectPackager.Tool.Build";
|
|
1537
|
-
TelemetryNames2["ProjectToolCleanup"] = "ProjectPackager.Tool.Cleanup";
|
|
1538
|
-
TelemetryNames2["ProjectPackagerPack"] = "ProjectPackager.Pack";
|
|
1539
|
-
TelemetryNames2["ProjectPackagerRestore"] = "ProjectPackager.Restore";
|
|
1540
|
-
TelemetryNames2["ProjectPackagerValidate"] = "ProjectPackager.Validate";
|
|
1541
|
-
TelemetryNames2["ProjectPackagerBuild"] = "ProjectPackager.Build";
|
|
1542
|
-
TelemetryNames2["ProjectPackagerCleanup"] = "ProjectPackager.Cleanup";
|
|
1543
|
-
TelemetryNames2["ProjectPackagerProjectLoaded"] = "ProjectPackager.ProjectLoaded";
|
|
1544
|
-
})(TelemetryNames ||= {});
|
|
1545
|
-
|
|
1546
1523
|
// ../gov/aops-policy-sdk/generated/src/runtime.ts
|
|
1547
1524
|
var BASE_PATH = "http://localhost".replace(/\/+$/, "");
|
|
1548
1525
|
|
|
@@ -3162,7 +3139,7 @@ var package_default = {
|
|
|
3162
3139
|
name: "@uipath/project-packager",
|
|
3163
3140
|
author: "UiPath",
|
|
3164
3141
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
3165
|
-
version: "1.
|
|
3142
|
+
version: "1.206.0-preview.279",
|
|
3166
3143
|
description: "UiPath Project Packager - core library for packing individual UiPath projects",
|
|
3167
3144
|
type: "module",
|
|
3168
3145
|
main: "./dist/index.js",
|
|
@@ -3235,14 +3212,6 @@ var package_default = {
|
|
|
3235
3212
|
};
|
|
3236
3213
|
|
|
3237
3214
|
// ../packager/project-packager/src/services/governance-policy-service.ts
|
|
3238
|
-
class GovernancePolicyError extends Error {
|
|
3239
|
-
instructions;
|
|
3240
|
-
name = "GovernancePolicyError";
|
|
3241
|
-
constructor(message, instructions) {
|
|
3242
|
-
super(message);
|
|
3243
|
-
this.instructions = instructions;
|
|
3244
|
-
}
|
|
3245
|
-
}
|
|
3246
3215
|
var LICENSE_TYPES = {
|
|
3247
3216
|
NoLicense: "NoLicense",
|
|
3248
3217
|
Development: "Development",
|
|
@@ -3464,10 +3433,6 @@ async function resolveProducedNupkgsAsync(fileSystem, packagePath) {
|
|
|
3464
3433
|
|
|
3465
3434
|
// ../packager/project-packager/src/services/pack-service.ts
|
|
3466
3435
|
var PACKAGE_ID_TOO_LONG = "PACKAGE_ID_TOO_LONG";
|
|
3467
|
-
function isPackageIdTooLongError(error) {
|
|
3468
|
-
return error instanceof Error && error.code === PACKAGE_ID_TOO_LONG;
|
|
3469
|
-
}
|
|
3470
|
-
|
|
3471
3436
|
class PackService {
|
|
3472
3437
|
disallowedCharsRegex = /[^\p{L}\p{N}_.-]/gu;
|
|
3473
3438
|
spacesDotRegex = /[\s.]+/g;
|
|
@@ -3600,8 +3565,8 @@ class PackagerParametersValidator {
|
|
|
3600
3565
|
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, error);
|
|
3601
3566
|
}
|
|
3602
3567
|
} catch (error) {
|
|
3603
|
-
const
|
|
3604
|
-
const errorLog = `Governance file not found or inaccessible: ${validateOptions.governanceFilePath}. Error: ${
|
|
3568
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
3569
|
+
const errorLog = `Governance file not found or inaccessible: ${validateOptions.governanceFilePath}. Error: ${errorMessage}`;
|
|
3605
3570
|
this.logger.error(errorLog);
|
|
3606
3571
|
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, errorLog);
|
|
3607
3572
|
}
|
|
@@ -3691,6 +3656,8 @@ class ProjectLoader {
|
|
|
3691
3656
|
}
|
|
3692
3657
|
|
|
3693
3658
|
// ../packager/project-packager/src/services/project-tool-executor.ts
|
|
3659
|
+
var observerTimedOut = (phase) => () => new ToolLogger("ProjectToolExecutor", "ProjectActivity").debug(`project activity (${phase}) skipped: no answer within ${PROJECT_IDENTITY_LOOKUP_BUDGET_MS} ms`);
|
|
3660
|
+
|
|
3694
3661
|
class ProjectToolExecutor {
|
|
3695
3662
|
toolsFactory;
|
|
3696
3663
|
telemetry;
|
|
@@ -3699,36 +3666,44 @@ class ProjectToolExecutor {
|
|
|
3699
3666
|
this.telemetry = telemetry;
|
|
3700
3667
|
}
|
|
3701
3668
|
async restoreAsync(options, project, context, cancellationToken) {
|
|
3702
|
-
return await this.executeToolOperationAsync(project, context, (tool) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Restore" /* ProjectToolRestore */, project.Type, async () => tool.restoreAsync(options, cancellationToken),
|
|
3703
|
-
[PackagerDimensions.ProjectId]: project.Id,
|
|
3704
|
-
[PackagerDimensions.ProjectType]: project.Type
|
|
3705
|
-
}));
|
|
3669
|
+
return await this.executeToolOperationAsync(project, context, (tool, properties) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Restore" /* ProjectToolRestore */, project.Type, async () => tool.restoreAsync(options, cancellationToken), properties));
|
|
3706
3670
|
}
|
|
3707
3671
|
async validateAsync(options, project, context, cancellationToken) {
|
|
3708
|
-
return await this.executeToolOperationAsync(project, context, (tool) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Validate" /* ProjectToolValidate */, project.Type, async () => tool.validateAsync(options, cancellationToken),
|
|
3709
|
-
[PackagerDimensions.ProjectId]: project.Id,
|
|
3710
|
-
[PackagerDimensions.ProjectType]: project.Type
|
|
3711
|
-
}));
|
|
3672
|
+
return await this.executeToolOperationAsync(project, context, (tool, properties) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Validate" /* ProjectToolValidate */, project.Type, async () => tool.validateAsync(options, cancellationToken), properties));
|
|
3712
3673
|
}
|
|
3713
3674
|
async buildAsync(options, project, context, cancellationToken) {
|
|
3714
|
-
return await this.executeToolOperationAsync(project, context, (tool) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Build" /* ProjectToolBuild */, project.Type, async () => tool.buildAsync(options, cancellationToken),
|
|
3715
|
-
[PackagerDimensions.ProjectId]: project.Id,
|
|
3716
|
-
[PackagerDimensions.ProjectType]: project.Type
|
|
3717
|
-
}));
|
|
3675
|
+
return await this.executeToolOperationAsync(project, context, (tool, properties) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Build" /* ProjectToolBuild */, project.Type, async () => tool.buildAsync(options, cancellationToken), properties));
|
|
3718
3676
|
}
|
|
3719
3677
|
async packAsync(options, project, context, cancellationToken) {
|
|
3720
|
-
return await this.executeToolOperationAsync(project, context, async (tool) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Pack" /* ProjectToolPack */, project.Type, async () => tool.packAsync(options, cancellationToken),
|
|
3721
|
-
[PackagerDimensions.ProjectId]: project.Id,
|
|
3722
|
-
[PackagerDimensions.ProjectType]: project.Type
|
|
3723
|
-
}));
|
|
3678
|
+
return await this.executeToolOperationAsync(project, context, async (tool, properties) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Pack" /* ProjectToolPack */, project.Type, async () => tool.packAsync(options, cancellationToken), properties));
|
|
3724
3679
|
}
|
|
3725
3680
|
async cleanupAsync(options, project, context, cancellationToken) {
|
|
3726
|
-
return await this.executeToolOperationAsync(project, context, (tool) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Cleanup" /* ProjectToolCleanup */, project.Type, async () => tool.cleanupAsync(options, cancellationToken),
|
|
3727
|
-
[PackagerDimensions.ProjectId]: project.Id,
|
|
3728
|
-
[PackagerDimensions.ProjectType]: project.Type
|
|
3729
|
-
}));
|
|
3681
|
+
return await this.executeToolOperationAsync(project, context, (tool, properties) => this.telemetry.trackDependencyOperation("ProjectPackager.Tool.Cleanup" /* ProjectToolCleanup */, project.Type, async () => tool.cleanupAsync(options, cancellationToken), properties));
|
|
3730
3682
|
}
|
|
3731
3683
|
async executeToolOperationAsync(project, context, operation) {
|
|
3684
|
+
const solutionKey = context?.solutionId ? projectKey(context.solutionId) : undefined;
|
|
3685
|
+
const identity = solutionKey && !isProjectTelemetryDisabled() ? {
|
|
3686
|
+
[ProjectDimensions.SolutionKey]: solutionKey,
|
|
3687
|
+
[ProjectDimensions.SolutionProjectKey]: projectKey(project.Id)
|
|
3688
|
+
} : {};
|
|
3689
|
+
const properties = {
|
|
3690
|
+
[PackagerDimensions.ProjectId]: project.Id,
|
|
3691
|
+
[PackagerDimensions.ProjectType]: project.Type,
|
|
3692
|
+
...identity
|
|
3693
|
+
};
|
|
3694
|
+
return this.observeToolOperationAsync(project, context, (tool) => operation(tool, properties));
|
|
3695
|
+
}
|
|
3696
|
+
async observeToolOperationAsync(project, context, operation) {
|
|
3697
|
+
if (!context?.projectActivity) {
|
|
3698
|
+
return this.runToolOperationAsync(project, context, operation);
|
|
3699
|
+
}
|
|
3700
|
+
const observe = context.projectActivity;
|
|
3701
|
+
await withinProjectIdentityBudget(Promise.resolve().then(() => observe(project, "before", undefined, context.solutionId)).catch(() => {}), observerTimedOut("before"));
|
|
3702
|
+
const result = await this.runToolOperationAsync(project, context, operation);
|
|
3703
|
+
await withinProjectIdentityBudget(Promise.resolve().then(() => observe(project, "after", result.isSuccess, context.solutionId)).catch(() => {}), observerTimedOut("after"));
|
|
3704
|
+
return result;
|
|
3705
|
+
}
|
|
3706
|
+
async runToolOperationAsync(project, context, operation) {
|
|
3732
3707
|
try {
|
|
3733
3708
|
const tool = await this.toolsFactory.createProjectToolAsync(project, context);
|
|
3734
3709
|
try {
|
|
@@ -3817,6 +3792,7 @@ class ProjectPackOptionsBuilder {
|
|
|
3817
3792
|
policyFileType: parameters.validateOptions.governanceFileType,
|
|
3818
3793
|
outputPath: parameters.outputPath,
|
|
3819
3794
|
outputType: parameters.outputType,
|
|
3795
|
+
activitiesRootCategory: parameters.activitiesRootCategory,
|
|
3820
3796
|
projectType: project.type,
|
|
3821
3797
|
package: packageInfo,
|
|
3822
3798
|
skipDependencyOptimization: parameters.packOptions?.skipDependencyOptimization ?? false,
|
|
@@ -3962,6 +3938,7 @@ class ProjectPackager {
|
|
|
3962
3938
|
policyFileType: options.validateOptions.governanceFileType,
|
|
3963
3939
|
outputPath: options.outputPath,
|
|
3964
3940
|
outputType: options.outputType,
|
|
3941
|
+
activitiesRootCategory: options.activitiesRootCategory,
|
|
3965
3942
|
projectType: uiPathProject.Type
|
|
3966
3943
|
};
|
|
3967
3944
|
const context = this.createOperationContext(options, uiPathProject);
|
|
@@ -4005,9 +3982,9 @@ class ProjectPackager {
|
|
|
4005
3982
|
}
|
|
4006
3983
|
return result;
|
|
4007
3984
|
} catch (error) {
|
|
4008
|
-
const
|
|
4009
|
-
this.logger.error(`Processing error: ${
|
|
4010
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Project pack failed: ${
|
|
3985
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
3986
|
+
this.logger.error(`Processing error: ${errorMessage}`);
|
|
3987
|
+
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Project pack failed: ${errorMessage}`, carriedInstructions(error));
|
|
4011
3988
|
} finally {
|
|
4012
3989
|
await this.temporaryStorage.cleanup();
|
|
4013
3990
|
}
|
|
@@ -4072,9 +4049,9 @@ class ProjectPackager {
|
|
|
4072
4049
|
}
|
|
4073
4050
|
return operationResult;
|
|
4074
4051
|
} catch (error) {
|
|
4075
|
-
const
|
|
4076
|
-
this.logger.error(`Processing error: ${
|
|
4077
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Project ${operationName.toLowerCase()} failed: ${
|
|
4052
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
4053
|
+
this.logger.error(`Processing error: ${errorMessage}`);
|
|
4054
|
+
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Project ${operationName.toLowerCase()} failed: ${errorMessage}`);
|
|
4078
4055
|
} finally {
|
|
4079
4056
|
await this.temporaryStorage.cleanup();
|
|
4080
4057
|
}
|
|
@@ -4130,510 +4107,9 @@ class ProjectPackager {
|
|
|
4130
4107
|
}
|
|
4131
4108
|
}
|
|
4132
4109
|
|
|
4133
|
-
// ../packager/project-packager/src/publish/models/publish-options.ts
|
|
4134
|
-
var PublishDestinationKind;
|
|
4135
|
-
((PublishDestinationKind2) => {
|
|
4136
|
-
PublishDestinationKind2["LocalFolder"] = "LocalFolder";
|
|
4137
|
-
PublishDestinationKind2["NugetFeed"] = "NugetFeed";
|
|
4138
|
-
PublishDestinationKind2["OrchestratorPersonalWorkspace"] = "OrchestratorPersonalWorkspace";
|
|
4139
|
-
PublishDestinationKind2["OrchestratorTenantProcesses"] = "OrchestratorTenantProcesses";
|
|
4140
|
-
PublishDestinationKind2["OrchestratorSharedLibraries"] = "OrchestratorSharedLibraries";
|
|
4141
|
-
PublishDestinationKind2["OrchestratorCustom"] = "OrchestratorCustom";
|
|
4142
|
-
})(PublishDestinationKind ||= {});
|
|
4143
|
-
|
|
4144
|
-
class ProjectPublishOptions {
|
|
4145
|
-
packagePaths;
|
|
4146
|
-
destination;
|
|
4147
|
-
constructor(packagePaths, destination) {
|
|
4148
|
-
this.packagePaths = packagePaths;
|
|
4149
|
-
this.destination = destination;
|
|
4150
|
-
}
|
|
4151
|
-
}
|
|
4152
|
-
|
|
4153
|
-
// ../packager/project-packager/src/publish/services/local-folder-publisher.ts
|
|
4154
|
-
class LocalFolderPublisher {
|
|
4155
|
-
fileSystem;
|
|
4156
|
-
logger;
|
|
4157
|
-
constructor(fileSystem) {
|
|
4158
|
-
this.fileSystem = fileSystem;
|
|
4159
|
-
this.logger = new ToolLogger("ProjectPublisher", "LocalFolder");
|
|
4160
|
-
}
|
|
4161
|
-
async publishAsync(packagePaths, destination) {
|
|
4162
|
-
const overwrite = destination.overwrite ?? true;
|
|
4163
|
-
if (!destination.folderPath) {
|
|
4164
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.localFolderRequired"));
|
|
4165
|
-
}
|
|
4166
|
-
if (!await this.fileSystem.exists(destination.folderPath)) {
|
|
4167
|
-
await this.fileSystem.mkdir(destination.folderPath);
|
|
4168
|
-
}
|
|
4169
|
-
const written = [];
|
|
4170
|
-
for (const sourcePath of packagePaths) {
|
|
4171
|
-
const fileName = this.fileSystem.path.basename(sourcePath);
|
|
4172
|
-
const destPath = this.fileSystem.path.join(destination.folderPath, fileName);
|
|
4173
|
-
if (!overwrite && await this.fileSystem.exists(destPath)) {
|
|
4174
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.localFolderFileExists", { path: destPath }));
|
|
4175
|
-
}
|
|
4176
|
-
const data = await this.fileSystem.readFile(sourcePath);
|
|
4177
|
-
if (!data) {
|
|
4178
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.failedToReadPackage", { path: sourcePath }));
|
|
4179
|
-
}
|
|
4180
|
-
await this.fileSystem.writeFile(destPath, data);
|
|
4181
|
-
written.push(destPath);
|
|
4182
|
-
this.logger.info(`Copied package to ${destPath}`);
|
|
4183
|
-
}
|
|
4184
|
-
return new ToolResult("SUCCESS" /* Success */, undefined, written);
|
|
4185
|
-
}
|
|
4186
|
-
}
|
|
4187
|
-
|
|
4188
|
-
// ../packager/project-packager/src/publish/services/nuget-feed-publisher.ts
|
|
4189
|
-
var NUGET_V3_PACKAGE_PUBLISH_TYPE = "PackagePublish/2.0.0";
|
|
4190
|
-
|
|
4191
|
-
class NugetFeedPublisher {
|
|
4192
|
-
fileSystem;
|
|
4193
|
-
logger;
|
|
4194
|
-
constructor(fileSystem) {
|
|
4195
|
-
this.fileSystem = fileSystem;
|
|
4196
|
-
this.logger = new ToolLogger("ProjectPublisher", "NugetFeed");
|
|
4197
|
-
}
|
|
4198
|
-
async publishAsync(packagePaths, destination) {
|
|
4199
|
-
if (!destination.feedUrl) {
|
|
4200
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.nugetFeedUrlRequired"));
|
|
4201
|
-
}
|
|
4202
|
-
let pushUrl;
|
|
4203
|
-
try {
|
|
4204
|
-
pushUrl = await this.resolvePushUrl(destination.feedUrl, destination.apiKey);
|
|
4205
|
-
} catch (error) {
|
|
4206
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
4207
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.nugetPushUrlResolutionFailed", { feedUrl: destination.feedUrl, message }));
|
|
4208
|
-
}
|
|
4209
|
-
const published = [];
|
|
4210
|
-
for (const packagePath of packagePaths) {
|
|
4211
|
-
const data = await this.fileSystem.readFile(packagePath);
|
|
4212
|
-
if (!data) {
|
|
4213
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.failedToReadPackage", { path: packagePath }));
|
|
4214
|
-
}
|
|
4215
|
-
const fileName = this.fileSystem.path.basename(packagePath);
|
|
4216
|
-
const form = new FormData;
|
|
4217
|
-
form.append("package", new Blob([data], {
|
|
4218
|
-
type: "application/octet-stream"
|
|
4219
|
-
}), fileName);
|
|
4220
|
-
const headers = {};
|
|
4221
|
-
if (destination.apiKey) {
|
|
4222
|
-
headers["X-NuGet-ApiKey"] = destination.apiKey;
|
|
4223
|
-
}
|
|
4224
|
-
this.logger.info(`Pushing ${fileName} to ${pushUrl}`);
|
|
4225
|
-
const response = await fetch(pushUrl, {
|
|
4226
|
-
method: "PUT",
|
|
4227
|
-
headers,
|
|
4228
|
-
body: form
|
|
4229
|
-
});
|
|
4230
|
-
if (!response.ok) {
|
|
4231
|
-
const body = await this.safeReadBody(response);
|
|
4232
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.nugetPushFailed", {
|
|
4233
|
-
fileName,
|
|
4234
|
-
status: response.status,
|
|
4235
|
-
statusText: response.statusText,
|
|
4236
|
-
body: body ? ` - ${body}` : ""
|
|
4237
|
-
}));
|
|
4238
|
-
}
|
|
4239
|
-
published.push(packagePath);
|
|
4240
|
-
this.logger.info(`Pushed ${fileName} successfully.`);
|
|
4241
|
-
}
|
|
4242
|
-
return new ToolResult("SUCCESS" /* Success */, undefined, published);
|
|
4243
|
-
}
|
|
4244
|
-
async resolvePushUrl(feedUrl, apiKey) {
|
|
4245
|
-
let end = feedUrl.length;
|
|
4246
|
-
while (end > 0 && feedUrl.charCodeAt(end - 1) === 47)
|
|
4247
|
-
end--;
|
|
4248
|
-
const trimmed = feedUrl.slice(0, end);
|
|
4249
|
-
if (/\/api\/v2\/package\/?$/i.test(trimmed)) {
|
|
4250
|
-
return trimmed;
|
|
4251
|
-
}
|
|
4252
|
-
if (/\.json$/i.test(trimmed)) {
|
|
4253
|
-
return this.resolveFromServiceIndex(trimmed, apiKey);
|
|
4254
|
-
}
|
|
4255
|
-
return `${trimmed}/api/v2/package`;
|
|
4256
|
-
}
|
|
4257
|
-
async resolveFromServiceIndex(serviceIndexUrl, apiKey) {
|
|
4258
|
-
const headers = { Accept: "application/json" };
|
|
4259
|
-
if (apiKey) {
|
|
4260
|
-
headers["X-NuGet-ApiKey"] = apiKey;
|
|
4261
|
-
}
|
|
4262
|
-
const response = await fetch(serviceIndexUrl, { headers });
|
|
4263
|
-
if (!response.ok) {
|
|
4264
|
-
throw new Error(`service index returned ${response.status} ${response.statusText}`);
|
|
4265
|
-
}
|
|
4266
|
-
const index = await response.json();
|
|
4267
|
-
const resource = index.resources?.find((r) => r["@type"] === NUGET_V3_PACKAGE_PUBLISH_TYPE);
|
|
4268
|
-
if (!resource?.["@id"]) {
|
|
4269
|
-
throw new Error(`service index has no ${NUGET_V3_PACKAGE_PUBLISH_TYPE} resource`);
|
|
4270
|
-
}
|
|
4271
|
-
return resource["@id"];
|
|
4272
|
-
}
|
|
4273
|
-
async safeReadBody(response) {
|
|
4274
|
-
try {
|
|
4275
|
-
const text = await response.text();
|
|
4276
|
-
return text.slice(0, 500);
|
|
4277
|
-
} catch {
|
|
4278
|
-
return "";
|
|
4279
|
-
}
|
|
4280
|
-
}
|
|
4281
|
-
}
|
|
4282
|
-
|
|
4283
|
-
// ../packager/project-packager/src/publish/services/orchestrator-feed-types.ts
|
|
4284
|
-
var PackageFeedDtoPurposeEnum = {
|
|
4285
|
-
Undefined: "Undefined",
|
|
4286
|
-
Processes: "Processes",
|
|
4287
|
-
Libraries: "Libraries",
|
|
4288
|
-
PersonalWorkspace: "PersonalWorkspace",
|
|
4289
|
-
FolderHierarchy: "FolderHierarchy"
|
|
4290
|
-
};
|
|
4291
|
-
var PackageFeedDtoAuthenticationTypeEnum = {
|
|
4292
|
-
Secure: "Secure",
|
|
4293
|
-
ApiKey: "ApiKey",
|
|
4294
|
-
Basic: "Basic"
|
|
4295
|
-
};
|
|
4296
|
-
var ExtendedFolderDtoFeedTypeEnum = {
|
|
4297
|
-
Undefined: "Undefined",
|
|
4298
|
-
Processes: "Processes",
|
|
4299
|
-
Libraries: "Libraries",
|
|
4300
|
-
PersonalWorkspace: "PersonalWorkspace",
|
|
4301
|
-
FolderHierarchy: "FolderHierarchy"
|
|
4302
|
-
};
|
|
4303
|
-
|
|
4304
4110
|
// ../packager/project-packager/src/publish/services/orchestrator-feeds-service.ts
|
|
4305
|
-
var HEADER_TENANT_ID = "X-UIPATH-TenantId";
|
|
4306
|
-
var FEEDS_PATH = "/api/PackageFeeds/GetFeeds";
|
|
4307
|
-
var FOLDERS_PATH = "/api/FoldersNavigation/GetAllFoldersForCurrentUser";
|
|
4308
4111
|
var SDK_USER_AGENT = `${package_default.name.replace(/^@uipath\//, "")}/${package_default.version}`;
|
|
4309
4112
|
|
|
4310
|
-
|
|
4311
|
-
logger;
|
|
4312
|
-
constructor() {
|
|
4313
|
-
this.logger = new ToolLogger("OrchestratorFeedsService", "Feeds");
|
|
4314
|
-
}
|
|
4315
|
-
async getAccessibleFeedsAsync(connection) {
|
|
4316
|
-
this.ensureOrchestratorUrl(connection);
|
|
4317
|
-
this.logger.info(`Fetching accessible feeds from ${connection.orchestratorUrl}`);
|
|
4318
|
-
try {
|
|
4319
|
-
const json = await orchestratorGet(connection, FEEDS_PATH);
|
|
4320
|
-
return Array.isArray(json) ? json : [];
|
|
4321
|
-
} catch (error) {
|
|
4322
|
-
const { status, statusText, body } = await describeResponseError(error);
|
|
4323
|
-
throw new Error(translate.t("solutionpackager.publish.errors.getAccessibleFeedsFailed", { status, statusText, body }));
|
|
4324
|
-
}
|
|
4325
|
-
}
|
|
4326
|
-
async getFoldersForCurrentUserAsync(connection) {
|
|
4327
|
-
this.ensureOrchestratorUrl(connection);
|
|
4328
|
-
this.logger.info(`Fetching folders from ${connection.orchestratorUrl}`);
|
|
4329
|
-
try {
|
|
4330
|
-
const json = await orchestratorGet(connection, FOLDERS_PATH);
|
|
4331
|
-
return Array.isArray(json) ? json.map(mapExtendedFolder) : [];
|
|
4332
|
-
} catch (error) {
|
|
4333
|
-
const { status, statusText, body } = await describeResponseError(error);
|
|
4334
|
-
throw new Error(translate.t("solutionpackager.publish.errors.getFoldersForCurrentUserFailed", { status, statusText, body }));
|
|
4335
|
-
}
|
|
4336
|
-
}
|
|
4337
|
-
ensureOrchestratorUrl(connection) {
|
|
4338
|
-
if (!connection.orchestratorUrl) {
|
|
4339
|
-
throw new Error(translate.t("solutionpackager.publish.errors.orchestratorUrlRequired"));
|
|
4340
|
-
}
|
|
4341
|
-
}
|
|
4342
|
-
}
|
|
4343
|
-
function mapExtendedFolder(json) {
|
|
4344
|
-
return {
|
|
4345
|
-
isSelectable: json.IsSelectable,
|
|
4346
|
-
hasChildren: json.HasChildren,
|
|
4347
|
-
level: json.Level,
|
|
4348
|
-
key: json.Key,
|
|
4349
|
-
displayName: json.DisplayName,
|
|
4350
|
-
fullyQualifiedName: json.FullyQualifiedName,
|
|
4351
|
-
description: json.Description,
|
|
4352
|
-
folderType: json.FolderType,
|
|
4353
|
-
isPersonal: json.IsPersonal,
|
|
4354
|
-
provisionType: json.ProvisionType,
|
|
4355
|
-
permissionModel: json.PermissionModel,
|
|
4356
|
-
parentId: json.ParentId,
|
|
4357
|
-
parentKey: json.ParentKey,
|
|
4358
|
-
feedType: json.FeedType,
|
|
4359
|
-
id: json.Id
|
|
4360
|
-
};
|
|
4361
|
-
}
|
|
4362
|
-
|
|
4363
|
-
class OrchestratorResponseError extends Error {
|
|
4364
|
-
response;
|
|
4365
|
-
constructor(response) {
|
|
4366
|
-
super(`Orchestrator request failed with status ${response.status}.`);
|
|
4367
|
-
this.response = response;
|
|
4368
|
-
this.name = "OrchestratorResponseError";
|
|
4369
|
-
}
|
|
4370
|
-
}
|
|
4371
|
-
async function orchestratorGet(connection, relativePath) {
|
|
4372
|
-
const url = `${normalizeOrchestratorBasePath(connection.orchestratorUrl)}${relativePath}`;
|
|
4373
|
-
const response = await fetch(url, {
|
|
4374
|
-
method: "GET",
|
|
4375
|
-
headers: buildHeaders(connection)
|
|
4376
|
-
});
|
|
4377
|
-
if (!response.ok) {
|
|
4378
|
-
throw new OrchestratorResponseError(response);
|
|
4379
|
-
}
|
|
4380
|
-
const text = await response.text();
|
|
4381
|
-
if (text === "" || text === "null") {
|
|
4382
|
-
return null;
|
|
4383
|
-
}
|
|
4384
|
-
return JSON.parse(text);
|
|
4385
|
-
}
|
|
4386
|
-
function buildHeaders(connection) {
|
|
4387
|
-
const headers = {};
|
|
4388
|
-
if (connection.accessToken) {
|
|
4389
|
-
headers.Authorization = `Bearer ${connection.accessToken}`;
|
|
4390
|
-
}
|
|
4391
|
-
if (connection.tenantId) {
|
|
4392
|
-
headers[HEADER_TENANT_ID] = connection.tenantId;
|
|
4393
|
-
}
|
|
4394
|
-
return addSdkUserAgentHeader(headers, SDK_USER_AGENT);
|
|
4395
|
-
}
|
|
4396
|
-
function normalizeOrchestratorBasePath(orchestratorUrl) {
|
|
4397
|
-
let end = orchestratorUrl.length;
|
|
4398
|
-
while (end > 0 && orchestratorUrl.charCodeAt(end - 1) === 47)
|
|
4399
|
-
end--;
|
|
4400
|
-
const trimmed = orchestratorUrl.slice(0, end);
|
|
4401
|
-
return /\/orchestrator_$/i.test(trimmed) ? trimmed : `${trimmed}/orchestrator_`;
|
|
4402
|
-
}
|
|
4403
|
-
async function describeResponseError(error) {
|
|
4404
|
-
const response = error?.response;
|
|
4405
|
-
if (response) {
|
|
4406
|
-
let body = "";
|
|
4407
|
-
try {
|
|
4408
|
-
body = (await response.text()).slice(0, 500);
|
|
4409
|
-
} catch {
|
|
4410
|
-
body = "";
|
|
4411
|
-
}
|
|
4412
|
-
return {
|
|
4413
|
-
status: response.status,
|
|
4414
|
-
statusText: response.statusText,
|
|
4415
|
-
body: body ? ` - ${body}` : ""
|
|
4416
|
-
};
|
|
4417
|
-
}
|
|
4418
|
-
const cause = error?.cause;
|
|
4419
|
-
const message = cause instanceof Error ? cause.message : error instanceof Error ? error.message : String(error);
|
|
4420
|
-
return { status: "?", statusText: message, body: "" };
|
|
4421
|
-
}
|
|
4422
|
-
|
|
4423
|
-
// ../packager/project-packager/src/publish/services/orchestrator-publisher.ts
|
|
4424
|
-
var HEADER_FOLDER_ID = "X-UIPATH-OrganizationUnitId";
|
|
4425
|
-
var HEADER_TENANT_ID2 = "X-UIPATH-TenantId";
|
|
4426
|
-
var HEADER_NUGET_API_KEY = "X-NuGet-ApiKey";
|
|
4427
|
-
var ORCHESTRATOR_RELATIVE_URL = "/orchestrator_";
|
|
4428
|
-
var PROCESSES_UPLOAD_PATH = "/odata/Processes/UiPath.Server.Configuration.OData.UploadPackage";
|
|
4429
|
-
var LIBRARIES_UPLOAD_PATH = "/odata/Libraries/UiPath.Server.Configuration.OData.UploadPackage";
|
|
4430
|
-
|
|
4431
|
-
class OrchestratorPublisher {
|
|
4432
|
-
fileSystem;
|
|
4433
|
-
logger;
|
|
4434
|
-
feedsService;
|
|
4435
|
-
constructor(fileSystem, feedsService) {
|
|
4436
|
-
this.fileSystem = fileSystem;
|
|
4437
|
-
this.logger = new ToolLogger("ProjectPublisher", "Orchestrator");
|
|
4438
|
-
this.feedsService = feedsService ?? new OrchestratorFeedsService;
|
|
4439
|
-
}
|
|
4440
|
-
async publishAsync(packagePaths, destination) {
|
|
4441
|
-
if (packagePaths.length === 0) {
|
|
4442
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.orchestratorNoPackages"));
|
|
4443
|
-
}
|
|
4444
|
-
if (destination.kind === "OrchestratorCustom" /* OrchestratorCustom */) {
|
|
4445
|
-
if (!destination.publishUrl) {
|
|
4446
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.orchestratorCustomPublishUrlRequired"));
|
|
4447
|
-
}
|
|
4448
|
-
this.logger.info(`Publishing ${packagePaths.length} package(s) to ${destination.publishUrl} (custom)`);
|
|
4449
|
-
return this.postPackages(packagePaths, destination.publishUrl, this.buildCustomHeaders(destination));
|
|
4450
|
-
}
|
|
4451
|
-
if (!destination.connectionInfo?.cloudUrl) {
|
|
4452
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.orchestratorCloudUrlRequired"));
|
|
4453
|
-
}
|
|
4454
|
-
const orchestratorUrl = this.deriveOrchestratorUrl(destination.connectionInfo);
|
|
4455
|
-
let feed;
|
|
4456
|
-
try {
|
|
4457
|
-
feed = await this.resolveFeed(destination, orchestratorUrl);
|
|
4458
|
-
} catch (error) {
|
|
4459
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
4460
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.orchestratorFeedResolutionFailed", { message }));
|
|
4461
|
-
}
|
|
4462
|
-
const targetUrl = this.buildPublishUrl(orchestratorUrl, feed);
|
|
4463
|
-
const headers = this.buildHeaders(destination, feed);
|
|
4464
|
-
this.logger.info(`Publishing ${packagePaths.length} package(s) to ${targetUrl} (feed ${feed.name}, ${feed.purpose})`);
|
|
4465
|
-
return this.postPackages(packagePaths, targetUrl, headers);
|
|
4466
|
-
}
|
|
4467
|
-
async postPackages(packagePaths, targetUrl, headers) {
|
|
4468
|
-
const form = new FormData;
|
|
4469
|
-
for (const packagePath of packagePaths) {
|
|
4470
|
-
const data = await this.fileSystem.readFile(packagePath);
|
|
4471
|
-
if (!data) {
|
|
4472
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.failedToReadPackage", { path: packagePath }));
|
|
4473
|
-
}
|
|
4474
|
-
const fileName = this.fileSystem.path.basename(packagePath);
|
|
4475
|
-
form.append("file", new Blob([data], {
|
|
4476
|
-
type: "application/octet-stream"
|
|
4477
|
-
}), fileName);
|
|
4478
|
-
}
|
|
4479
|
-
const response = await fetch(targetUrl, {
|
|
4480
|
-
method: "POST",
|
|
4481
|
-
headers,
|
|
4482
|
-
body: form
|
|
4483
|
-
});
|
|
4484
|
-
if (!response.ok) {
|
|
4485
|
-
const body = await this.safeReadBody(response);
|
|
4486
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.orchestratorPublishFailed", {
|
|
4487
|
-
status: response.status,
|
|
4488
|
-
statusText: response.statusText,
|
|
4489
|
-
body: body ? ` - ${body}` : ""
|
|
4490
|
-
}));
|
|
4491
|
-
}
|
|
4492
|
-
this.logger.info("Orchestrator publish completed.");
|
|
4493
|
-
return new ToolResult("SUCCESS" /* Success */, undefined, packagePaths);
|
|
4494
|
-
}
|
|
4495
|
-
async resolveFeed(destination, orchestratorUrl) {
|
|
4496
|
-
const connection = {
|
|
4497
|
-
orchestratorUrl,
|
|
4498
|
-
accessToken: destination.connectionInfo.accessToken,
|
|
4499
|
-
tenantId: destination.connectionInfo.tenantId
|
|
4500
|
-
};
|
|
4501
|
-
const feeds = await this.feedsService.getAccessibleFeedsAsync(connection);
|
|
4502
|
-
if (destination.kind === "OrchestratorPersonalWorkspace" /* OrchestratorPersonalWorkspace */) {
|
|
4503
|
-
const folders = await this.feedsService.getFoldersForCurrentUserAsync(connection);
|
|
4504
|
-
const personalFolder = folders.find((f) => f.feedType === ExtendedFolderDtoFeedTypeEnum.PersonalWorkspace);
|
|
4505
|
-
if (!personalFolder) {
|
|
4506
|
-
const foldersDebug = folders.length === 0 ? "<none>" : folders.map((f) => `${f.displayName} (id=${f.id}, feedType=${f.feedType})`).join(", ");
|
|
4507
|
-
throw new Error(translate.t("solutionpackager.publish.errors.orchestratorPersonalWorkspaceFolderNotFound", { folders: foldersDebug }));
|
|
4508
|
-
}
|
|
4509
|
-
if (personalFolder.id == null) {
|
|
4510
|
-
throw new Error(`Personal-workspace folder "${personalFolder.displayName}" has no id; cannot resolve its feed.`);
|
|
4511
|
-
}
|
|
4512
|
-
const match2 = feeds.find((f) => f.folderId === personalFolder.id);
|
|
4513
|
-
if (!match2) {
|
|
4514
|
-
this.throwFeedNotFound(destination, feeds);
|
|
4515
|
-
}
|
|
4516
|
-
return match2;
|
|
4517
|
-
}
|
|
4518
|
-
const expectedPurpose = destination.kind === "OrchestratorSharedLibraries" /* OrchestratorSharedLibraries */ ? PackageFeedDtoPurposeEnum.Libraries : PackageFeedDtoPurposeEnum.Processes;
|
|
4519
|
-
const match = feeds.find((f) => f.purpose === expectedPurpose && f.folderId == null);
|
|
4520
|
-
if (!match) {
|
|
4521
|
-
this.throwFeedNotFound(destination, feeds);
|
|
4522
|
-
}
|
|
4523
|
-
return match;
|
|
4524
|
-
}
|
|
4525
|
-
throwFeedNotFound(destination, feeds) {
|
|
4526
|
-
const available = feeds.length === 0 ? "<none>" : feeds.map((f) => `${f.name} (purpose=${f.purpose}, folderId=${f.folderId ?? "null"})`).join(", ");
|
|
4527
|
-
throw new Error(translate.t("solutionpackager.publish.errors.orchestratorFeedNotFound", {
|
|
4528
|
-
kind: destination.kind,
|
|
4529
|
-
available
|
|
4530
|
-
}));
|
|
4531
|
-
}
|
|
4532
|
-
buildPublishUrl(orchestratorUrl, feed) {
|
|
4533
|
-
const baseUrl = feed.publishUrl ? feed.publishUrl : `${orchestratorUrl}${feed.purpose === PackageFeedDtoPurposeEnum.Libraries ? LIBRARIES_UPLOAD_PATH : PROCESSES_UPLOAD_PATH}`;
|
|
4534
|
-
const parsed = new URL(baseUrl);
|
|
4535
|
-
if (feed.id) {
|
|
4536
|
-
parsed.searchParams.set("feedId", feed.id);
|
|
4537
|
-
}
|
|
4538
|
-
return parsed.toString();
|
|
4539
|
-
}
|
|
4540
|
-
deriveOrchestratorUrl(connectionInfo) {
|
|
4541
|
-
const raw = connectionInfo.cloudUrl ?? "";
|
|
4542
|
-
let end = raw.length;
|
|
4543
|
-
while (end > 0 && raw.charCodeAt(end - 1) === 47)
|
|
4544
|
-
end--;
|
|
4545
|
-
return `${raw.slice(0, end)}${ORCHESTRATOR_RELATIVE_URL}`;
|
|
4546
|
-
}
|
|
4547
|
-
buildHeaders(destination, feed) {
|
|
4548
|
-
const headers = this.buildAuthHeaders(destination.connectionInfo);
|
|
4549
|
-
const folderHeader = destination.kind === "OrchestratorSharedLibraries" /* OrchestratorSharedLibraries */ ? destination.folderId : feed.folderId;
|
|
4550
|
-
if (folderHeader != null) {
|
|
4551
|
-
headers[HEADER_FOLDER_ID] = String(folderHeader);
|
|
4552
|
-
}
|
|
4553
|
-
if (feed.authenticationType === PackageFeedDtoAuthenticationTypeEnum.ApiKey && feed.apiKey) {
|
|
4554
|
-
headers[HEADER_NUGET_API_KEY] = feed.apiKey;
|
|
4555
|
-
}
|
|
4556
|
-
return headers;
|
|
4557
|
-
}
|
|
4558
|
-
buildCustomHeaders(destination) {
|
|
4559
|
-
const headers = this.buildAuthHeaders(destination.connectionInfo);
|
|
4560
|
-
if (destination.folderId != null) {
|
|
4561
|
-
headers[HEADER_FOLDER_ID] = String(destination.folderId);
|
|
4562
|
-
}
|
|
4563
|
-
if (destination.apiKey) {
|
|
4564
|
-
headers[HEADER_NUGET_API_KEY] = destination.apiKey;
|
|
4565
|
-
}
|
|
4566
|
-
return headers;
|
|
4567
|
-
}
|
|
4568
|
-
buildAuthHeaders(connectionInfo) {
|
|
4569
|
-
const headers = {};
|
|
4570
|
-
if (connectionInfo.accessToken) {
|
|
4571
|
-
headers.Authorization = `Bearer ${connectionInfo.accessToken}`;
|
|
4572
|
-
}
|
|
4573
|
-
if (connectionInfo.tenantId) {
|
|
4574
|
-
headers[HEADER_TENANT_ID2] = connectionInfo.tenantId;
|
|
4575
|
-
}
|
|
4576
|
-
return headers;
|
|
4577
|
-
}
|
|
4578
|
-
async safeReadBody(response) {
|
|
4579
|
-
try {
|
|
4580
|
-
const text = await response.text();
|
|
4581
|
-
return text.slice(0, 500);
|
|
4582
|
-
} catch {
|
|
4583
|
-
return "";
|
|
4584
|
-
}
|
|
4585
|
-
}
|
|
4586
|
-
}
|
|
4587
|
-
|
|
4588
|
-
// ../packager/project-packager/src/publish/services/project-publisher.ts
|
|
4589
|
-
class ProjectPublisher {
|
|
4590
|
-
fileSystem;
|
|
4591
|
-
logger;
|
|
4592
|
-
localFolderPublisher;
|
|
4593
|
-
nugetFeedPublisher;
|
|
4594
|
-
orchestratorPublisher;
|
|
4595
|
-
constructor(fileSystem, publishers) {
|
|
4596
|
-
this.fileSystem = fileSystem;
|
|
4597
|
-
this.logger = new ToolLogger("ProjectPublisher", "Publish");
|
|
4598
|
-
this.localFolderPublisher = publishers?.localFolder ?? new LocalFolderPublisher(fileSystem);
|
|
4599
|
-
this.nugetFeedPublisher = publishers?.nugetFeed ?? new NugetFeedPublisher(fileSystem);
|
|
4600
|
-
this.orchestratorPublisher = publishers?.orchestrator ?? new OrchestratorPublisher(fileSystem);
|
|
4601
|
-
}
|
|
4602
|
-
async publishAsync(options) {
|
|
4603
|
-
if (!options.packagePaths || options.packagePaths.length === 0) {
|
|
4604
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.atLeastOnePackage"));
|
|
4605
|
-
}
|
|
4606
|
-
for (const path of options.packagePaths) {
|
|
4607
|
-
if (!await this.fileSystem.exists(path)) {
|
|
4608
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.packageNotFound", { path }));
|
|
4609
|
-
}
|
|
4610
|
-
}
|
|
4611
|
-
try {
|
|
4612
|
-
const destination = options.destination;
|
|
4613
|
-
switch (destination.kind) {
|
|
4614
|
-
case "LocalFolder" /* LocalFolder */:
|
|
4615
|
-
return await this.localFolderPublisher.publishAsync(options.packagePaths, destination);
|
|
4616
|
-
case "NugetFeed" /* NugetFeed */:
|
|
4617
|
-
return await this.nugetFeedPublisher.publishAsync(options.packagePaths, destination);
|
|
4618
|
-
case "OrchestratorPersonalWorkspace" /* OrchestratorPersonalWorkspace */:
|
|
4619
|
-
case "OrchestratorTenantProcesses" /* OrchestratorTenantProcesses */:
|
|
4620
|
-
case "OrchestratorSharedLibraries" /* OrchestratorSharedLibraries */:
|
|
4621
|
-
case "OrchestratorCustom" /* OrchestratorCustom */:
|
|
4622
|
-
return await this.orchestratorPublisher.publishAsync(options.packagePaths, destination);
|
|
4623
|
-
default: {
|
|
4624
|
-
const exhaustive = destination;
|
|
4625
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, translate.t("solutionpackager.publish.errors.unknownDestination", { destination: JSON.stringify(exhaustive) }));
|
|
4626
|
-
}
|
|
4627
|
-
}
|
|
4628
|
-
} catch (error) {
|
|
4629
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
4630
|
-
const localized = translate.t("solutionpackager.publish.errors.publishFailed", { message });
|
|
4631
|
-
this.logger.error(localized);
|
|
4632
|
-
return ToolResult.error("INTERNAL_ERROR" /* InternalError */, localized);
|
|
4633
|
-
}
|
|
4634
|
-
}
|
|
4635
|
-
}
|
|
4636
|
-
|
|
4637
|
-
export { setGlobalLogHandler, ToolLogger, RulesConfigFileType, PackagerParameters, ProjectRestoreOptions, ProjectValidateOptions, ProjectBuildOptions, ProjectCleanupOptions, ProjectPackOptions, TelemetryNames, resolvePolicyAsync, GovernancePolicyError, GovernancePolicyService, resolveProducedNupkgsAsync, PACKAGE_ID_TOO_LONG, isPackageIdTooLongError, PackService, signNupkgsAsync, PackagerParametersValidator, ProjectBuildOptionsValidator, ProjectLoader, ProjectToolExecutor, ProjectValidateOptionsValidator, ToolsFactory, ProjectPackager, PublishDestinationKind, ProjectPublishOptions, ProjectPublisher };
|
|
4113
|
+
export { setGlobalLogHandler, ToolLogger, ProjectPackOptions2, ProjectPackager };
|
|
4638
4114
|
|
|
4639
|
-
//# debugId=
|
|
4115
|
+
//# debugId=ECECF850280DF20564756E2164756E21
|