@backstage/integration 1.5.1-next.0 → 1.6.0
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/CHANGELOG.md +21 -0
- package/dist/index.cjs.js +153 -54
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.esm.js +153 -55
- package/dist/index.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -738,6 +738,7 @@ declare class GerritIntegration implements ScmIntegration {
|
|
|
738
738
|
*
|
|
739
739
|
* Gitiles url:
|
|
740
740
|
* https://g.com/optional_path/\{project\}/+/refs/heads/\{branch\}/\{filePath\}
|
|
741
|
+
* https://g.com/a/optional_path/\{project\}/+/refs/heads/\{branch\}/\{filePath\}
|
|
741
742
|
*
|
|
742
743
|
*
|
|
743
744
|
* @param url - An URL pointing to a file stored in git.
|
|
@@ -748,6 +749,16 @@ declare function parseGerritGitilesUrl(config: GerritIntegrationConfig, url: str
|
|
|
748
749
|
filePath: string;
|
|
749
750
|
project: string;
|
|
750
751
|
};
|
|
752
|
+
/**
|
|
753
|
+
* Build a Gerrit Gitiles archive url that targets a specific branch and path
|
|
754
|
+
*
|
|
755
|
+
* @param config - A Gerrit provider config.
|
|
756
|
+
* @param project - The name of the git project
|
|
757
|
+
* @param branch - The branch we will target.
|
|
758
|
+
* @param filePath - The absolute file path.
|
|
759
|
+
* @public
|
|
760
|
+
*/
|
|
761
|
+
declare function buildGerritGitilesArchiveUrl(config: GerritIntegrationConfig, project: string, branch: string, filePath: string): string;
|
|
751
762
|
/**
|
|
752
763
|
* Return the url to get branch info from the Gerrit API.
|
|
753
764
|
*
|
|
@@ -1475,4 +1486,4 @@ declare class ScmIntegrations implements ScmIntegrationRegistry {
|
|
|
1475
1486
|
resolveEditUrl(url: string): string;
|
|
1476
1487
|
}
|
|
1477
1488
|
|
|
1478
|
-
export { AwsS3Integration, AwsS3IntegrationConfig, AzureClientSecretCredential, AzureCredential, AzureIntegration, AzureIntegrationConfig, AzureManagedIdentityCredential, BitbucketCloudIntegration, BitbucketCloudIntegrationConfig, BitbucketIntegration, BitbucketIntegrationConfig, BitbucketServerIntegration, BitbucketServerIntegrationConfig, DefaultGithubCredentialsProvider, DefaultGitlabCredentialsProvider, GerritIntegration, GerritIntegrationConfig, GitHubIntegration, GitHubIntegrationConfig, GitLabIntegration, GitLabIntegrationConfig, GiteaIntegration, GiteaIntegrationConfig, GithubAppConfig, GithubAppCredentialsMux, GithubCredentialType, GithubCredentials, GithubCredentialsProvider, GithubIntegration, GithubIntegrationConfig, GitlabCredentials, GitlabCredentialsProvider, GoogleGcsIntegrationConfig, IntegrationsByType, ScmIntegration, ScmIntegrationRegistry, ScmIntegrations, ScmIntegrationsFactory, ScmIntegrationsGroup, SingleInstanceGithubCredentialsProvider, defaultScmResolveUrl, getAzureCommitsUrl, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketCloudDefaultBranch, getBitbucketCloudDownloadUrl, getBitbucketCloudFileFetchUrl, getBitbucketCloudRequestOptions, getBitbucketDefaultBranch, getBitbucketDownloadUrl, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getBitbucketServerDefaultBranch, getBitbucketServerDownloadUrl, getBitbucketServerFileFetchUrl, getBitbucketServerRequestOptions, getGerritBranchApiUrl, getGerritCloneRepoUrl, getGerritFileContentsApiUrl, getGerritProjectsApiUrl, getGerritRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabIntegrationRelativePath, getGitLabRequestOptions, getGiteaFileContentsUrl, getGiteaRequestOptions, getGithubFileFetchUrl, parseGerritGitilesUrl, parseGerritJsonResponse, readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketCloudIntegrationConfig, readBitbucketCloudIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readBitbucketServerIntegrationConfig, readBitbucketServerIntegrationConfigs, readGerritIntegrationConfig, readGerritIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs, readGiteaConfig, readGithubIntegrationConfig, readGithubIntegrationConfigs, readGoogleGcsIntegrationConfig, replaceGitHubUrlType, replaceGitLabUrlType, replaceGithubUrlType };
|
|
1489
|
+
export { AwsS3Integration, AwsS3IntegrationConfig, AzureClientSecretCredential, AzureCredential, AzureIntegration, AzureIntegrationConfig, AzureManagedIdentityCredential, BitbucketCloudIntegration, BitbucketCloudIntegrationConfig, BitbucketIntegration, BitbucketIntegrationConfig, BitbucketServerIntegration, BitbucketServerIntegrationConfig, DefaultGithubCredentialsProvider, DefaultGitlabCredentialsProvider, GerritIntegration, GerritIntegrationConfig, GitHubIntegration, GitHubIntegrationConfig, GitLabIntegration, GitLabIntegrationConfig, GiteaIntegration, GiteaIntegrationConfig, GithubAppConfig, GithubAppCredentialsMux, GithubCredentialType, GithubCredentials, GithubCredentialsProvider, GithubIntegration, GithubIntegrationConfig, GitlabCredentials, GitlabCredentialsProvider, GoogleGcsIntegrationConfig, IntegrationsByType, ScmIntegration, ScmIntegrationRegistry, ScmIntegrations, ScmIntegrationsFactory, ScmIntegrationsGroup, SingleInstanceGithubCredentialsProvider, buildGerritGitilesArchiveUrl, defaultScmResolveUrl, getAzureCommitsUrl, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketCloudDefaultBranch, getBitbucketCloudDownloadUrl, getBitbucketCloudFileFetchUrl, getBitbucketCloudRequestOptions, getBitbucketDefaultBranch, getBitbucketDownloadUrl, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getBitbucketServerDefaultBranch, getBitbucketServerDownloadUrl, getBitbucketServerFileFetchUrl, getBitbucketServerRequestOptions, getGerritBranchApiUrl, getGerritCloneRepoUrl, getGerritFileContentsApiUrl, getGerritProjectsApiUrl, getGerritRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabIntegrationRelativePath, getGitLabRequestOptions, getGiteaFileContentsUrl, getGiteaRequestOptions, getGithubFileFetchUrl, parseGerritGitilesUrl, parseGerritJsonResponse, readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketCloudIntegrationConfig, readBitbucketCloudIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readBitbucketServerIntegrationConfig, readBitbucketServerIntegrationConfigs, readGerritIntegrationConfig, readGerritIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs, readGiteaConfig, readGithubIntegrationConfig, readGithubIntegrationConfigs, readGoogleGcsIntegrationConfig, replaceGitHubUrlType, replaceGitLabUrlType, replaceGithubUrlType };
|
package/dist/index.esm.js
CHANGED
|
@@ -112,7 +112,13 @@ function readAwsS3IntegrationConfigs(configs) {
|
|
|
112
112
|
return result;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
var __defProp$c = Object.defineProperty;
|
|
116
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
117
|
+
var __publicField$c = (obj, key, value) => {
|
|
118
|
+
__defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
119
|
+
return value;
|
|
120
|
+
};
|
|
121
|
+
const _AwsS3Integration = class _AwsS3Integration {
|
|
116
122
|
constructor(integrationConfig) {
|
|
117
123
|
this.integrationConfig = integrationConfig;
|
|
118
124
|
}
|
|
@@ -133,8 +139,7 @@ const _AwsS3Integration = class {
|
|
|
133
139
|
return url;
|
|
134
140
|
}
|
|
135
141
|
};
|
|
136
|
-
|
|
137
|
-
AwsS3Integration.factory = ({ config }) => {
|
|
142
|
+
__publicField$c(_AwsS3Integration, "factory", ({ config }) => {
|
|
138
143
|
var _a;
|
|
139
144
|
const configs = readAwsS3IntegrationConfigs(
|
|
140
145
|
(_a = config.getOptionalConfigArray("integrations.awsS3")) != null ? _a : []
|
|
@@ -143,7 +148,8 @@ AwsS3Integration.factory = ({ config }) => {
|
|
|
143
148
|
configs.map((c) => new _AwsS3Integration(c)),
|
|
144
149
|
(i) => i.config.host
|
|
145
150
|
);
|
|
146
|
-
};
|
|
151
|
+
});
|
|
152
|
+
let AwsS3Integration = _AwsS3Integration;
|
|
147
153
|
|
|
148
154
|
var __accessCheck = (obj, member, msg) => {
|
|
149
155
|
if (!member.has(obj))
|
|
@@ -165,7 +171,7 @@ var __privateSet = (obj, member, value, setter) => {
|
|
|
165
171
|
};
|
|
166
172
|
var _origin, _owner, _project, _repo, _path, _ref, _baseUrl;
|
|
167
173
|
const VERSION_PREFIX_GIT_BRANCH = "GB";
|
|
168
|
-
const _AzureUrl = class {
|
|
174
|
+
const _AzureUrl = class _AzureUrl {
|
|
169
175
|
constructor(origin, owner, project, repo, path, ref) {
|
|
170
176
|
__privateAdd(this, _origin, void 0);
|
|
171
177
|
__privateAdd(this, _owner, void 0);
|
|
@@ -325,7 +331,6 @@ const _AzureUrl = class {
|
|
|
325
331
|
return __privateGet(this, _ref);
|
|
326
332
|
}
|
|
327
333
|
};
|
|
328
|
-
let AzureUrl = _AzureUrl;
|
|
329
334
|
_origin = new WeakMap();
|
|
330
335
|
_owner = new WeakMap();
|
|
331
336
|
_project = new WeakMap();
|
|
@@ -333,6 +338,7 @@ _repo = new WeakMap();
|
|
|
333
338
|
_path = new WeakMap();
|
|
334
339
|
_ref = new WeakMap();
|
|
335
340
|
_baseUrl = new WeakMap();
|
|
341
|
+
let AzureUrl = _AzureUrl;
|
|
336
342
|
|
|
337
343
|
const AZURE_HOST = "dev.azure.com";
|
|
338
344
|
const isAzureClientSecretCredential = (credential) => {
|
|
@@ -381,7 +387,13 @@ function readAzureIntegrationConfigs(configs) {
|
|
|
381
387
|
return result;
|
|
382
388
|
}
|
|
383
389
|
|
|
384
|
-
|
|
390
|
+
var __defProp$b = Object.defineProperty;
|
|
391
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
392
|
+
var __publicField$b = (obj, key, value) => {
|
|
393
|
+
__defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
394
|
+
return value;
|
|
395
|
+
};
|
|
396
|
+
const _AzureIntegration = class _AzureIntegration {
|
|
385
397
|
constructor(integrationConfig) {
|
|
386
398
|
this.integrationConfig = integrationConfig;
|
|
387
399
|
}
|
|
@@ -426,8 +438,7 @@ const _AzureIntegration = class {
|
|
|
426
438
|
return url;
|
|
427
439
|
}
|
|
428
440
|
};
|
|
429
|
-
|
|
430
|
-
AzureIntegration.factory = ({ config }) => {
|
|
441
|
+
__publicField$b(_AzureIntegration, "factory", ({ config }) => {
|
|
431
442
|
var _a;
|
|
432
443
|
const configs = readAzureIntegrationConfigs(
|
|
433
444
|
(_a = config.getOptionalConfigArray("integrations.azure")) != null ? _a : []
|
|
@@ -436,7 +447,8 @@ AzureIntegration.factory = ({ config }) => {
|
|
|
436
447
|
configs.map((c) => new _AzureIntegration(c)),
|
|
437
448
|
(i) => i.config.host
|
|
438
449
|
);
|
|
439
|
-
};
|
|
450
|
+
});
|
|
451
|
+
let AzureIntegration = _AzureIntegration;
|
|
440
452
|
|
|
441
453
|
function getAzureFileFetchUrl(url) {
|
|
442
454
|
return AzureUrl.fromRepoUrl(url).toFileUrl();
|
|
@@ -514,7 +526,13 @@ function readBitbucketIntegrationConfigs(configs) {
|
|
|
514
526
|
return result;
|
|
515
527
|
}
|
|
516
528
|
|
|
517
|
-
|
|
529
|
+
var __defProp$a = Object.defineProperty;
|
|
530
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
531
|
+
var __publicField$a = (obj, key, value) => {
|
|
532
|
+
__defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
533
|
+
return value;
|
|
534
|
+
};
|
|
535
|
+
const _BitbucketIntegration = class _BitbucketIntegration {
|
|
518
536
|
constructor(integrationConfig) {
|
|
519
537
|
this.integrationConfig = integrationConfig;
|
|
520
538
|
}
|
|
@@ -549,8 +567,7 @@ const _BitbucketIntegration = class {
|
|
|
549
567
|
return editUrl.toString();
|
|
550
568
|
}
|
|
551
569
|
};
|
|
552
|
-
|
|
553
|
-
BitbucketIntegration.factory = ({
|
|
570
|
+
__publicField$a(_BitbucketIntegration, "factory", ({
|
|
554
571
|
config
|
|
555
572
|
}) => {
|
|
556
573
|
var _a, _b, _c;
|
|
@@ -567,7 +584,8 @@ BitbucketIntegration.factory = ({
|
|
|
567
584
|
configs.map((c) => new _BitbucketIntegration(c)),
|
|
568
585
|
(i) => i.config.host
|
|
569
586
|
);
|
|
570
|
-
};
|
|
587
|
+
});
|
|
588
|
+
let BitbucketIntegration = _BitbucketIntegration;
|
|
571
589
|
|
|
572
590
|
async function getBitbucketDefaultBranch(url, config) {
|
|
573
591
|
const { name: repoName, owner: project, resource } = parseGitUrl(url);
|
|
@@ -674,7 +692,13 @@ function readBitbucketCloudIntegrationConfigs(configs) {
|
|
|
674
692
|
return result;
|
|
675
693
|
}
|
|
676
694
|
|
|
677
|
-
|
|
695
|
+
var __defProp$9 = Object.defineProperty;
|
|
696
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
697
|
+
var __publicField$9 = (obj, key, value) => {
|
|
698
|
+
__defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
699
|
+
return value;
|
|
700
|
+
};
|
|
701
|
+
const _BitbucketCloudIntegration = class _BitbucketCloudIntegration {
|
|
678
702
|
constructor(integrationConfig) {
|
|
679
703
|
this.integrationConfig = integrationConfig;
|
|
680
704
|
}
|
|
@@ -704,8 +728,7 @@ const _BitbucketCloudIntegration = class {
|
|
|
704
728
|
return editUrl.toString();
|
|
705
729
|
}
|
|
706
730
|
};
|
|
707
|
-
|
|
708
|
-
BitbucketCloudIntegration.factory = ({
|
|
731
|
+
__publicField$9(_BitbucketCloudIntegration, "factory", ({
|
|
709
732
|
config
|
|
710
733
|
}) => {
|
|
711
734
|
var _a;
|
|
@@ -716,7 +739,8 @@ BitbucketCloudIntegration.factory = ({
|
|
|
716
739
|
configs.map((c) => new _BitbucketCloudIntegration(c)),
|
|
717
740
|
(i) => i.config.host
|
|
718
741
|
);
|
|
719
|
-
};
|
|
742
|
+
});
|
|
743
|
+
let BitbucketCloudIntegration = _BitbucketCloudIntegration;
|
|
720
744
|
|
|
721
745
|
async function getBitbucketCloudDefaultBranch(url, config) {
|
|
722
746
|
const { name: repoName, owner: project } = parseGitUrl(url);
|
|
@@ -809,7 +833,13 @@ function readBitbucketServerIntegrationConfigs(configs) {
|
|
|
809
833
|
return configs.map(readBitbucketServerIntegrationConfig);
|
|
810
834
|
}
|
|
811
835
|
|
|
812
|
-
|
|
836
|
+
var __defProp$8 = Object.defineProperty;
|
|
837
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
838
|
+
var __publicField$8 = (obj, key, value) => {
|
|
839
|
+
__defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
840
|
+
return value;
|
|
841
|
+
};
|
|
842
|
+
const _BitbucketServerIntegration = class _BitbucketServerIntegration {
|
|
813
843
|
constructor(integrationConfig) {
|
|
814
844
|
this.integrationConfig = integrationConfig;
|
|
815
845
|
}
|
|
@@ -838,8 +868,7 @@ const _BitbucketServerIntegration = class {
|
|
|
838
868
|
return url;
|
|
839
869
|
}
|
|
840
870
|
};
|
|
841
|
-
|
|
842
|
-
BitbucketServerIntegration.factory = ({
|
|
871
|
+
__publicField$8(_BitbucketServerIntegration, "factory", ({
|
|
843
872
|
config
|
|
844
873
|
}) => {
|
|
845
874
|
var _a;
|
|
@@ -850,7 +879,8 @@ BitbucketServerIntegration.factory = ({
|
|
|
850
879
|
configs.map((c) => new _BitbucketServerIntegration(c)),
|
|
851
880
|
(i) => i.config.host
|
|
852
881
|
);
|
|
853
|
-
};
|
|
882
|
+
});
|
|
883
|
+
let BitbucketServerIntegration = _BitbucketServerIntegration;
|
|
854
884
|
|
|
855
885
|
async function getBitbucketServerDefaultBranch(url, config) {
|
|
856
886
|
const { name: repoName, owner: project } = parseGitUrl(url);
|
|
@@ -964,7 +994,9 @@ function readGerritIntegrationConfigs(configs) {
|
|
|
964
994
|
|
|
965
995
|
const GERRIT_BODY_PREFIX = ")]}'";
|
|
966
996
|
function parseGerritGitilesUrl(config, url) {
|
|
967
|
-
const
|
|
997
|
+
const baseUrlParse = new URL(config.gitilesBaseUrl);
|
|
998
|
+
const urlParse = new URL(url);
|
|
999
|
+
const urlPath = urlParse.pathname.substring(urlParse.pathname.startsWith("/a/") ? 2 : 0).replace(baseUrlParse.pathname, "");
|
|
968
1000
|
const parts = urlPath.split("/").filter((p) => !!p);
|
|
969
1001
|
const projectEndIndex = parts.indexOf("+");
|
|
970
1002
|
if (projectEndIndex <= 0) {
|
|
@@ -986,9 +1018,21 @@ function parseGerritGitilesUrl(config, url) {
|
|
|
986
1018
|
function buildGerritGitilesUrl(config, project, branch, filePath) {
|
|
987
1019
|
return `${config.gitilesBaseUrl}/${project}/+/refs/heads/${branch}/${trimStart(filePath, "/")}`;
|
|
988
1020
|
}
|
|
1021
|
+
function buildGerritGitilesArchiveUrl(config, project, branch, filePath) {
|
|
1022
|
+
const archiveName = filePath === "/" || filePath === "" ? ".tar.gz" : `/${filePath}.tar.gz`;
|
|
1023
|
+
return `${getGitilesAuthenticationUrl(
|
|
1024
|
+
config
|
|
1025
|
+
)}/${project}/+archive/refs/heads/${branch}${archiveName}`;
|
|
1026
|
+
}
|
|
989
1027
|
function getAuthenticationPrefix(config) {
|
|
990
1028
|
return config.password ? "/a/" : "/";
|
|
991
1029
|
}
|
|
1030
|
+
function getGitilesAuthenticationUrl(config) {
|
|
1031
|
+
const parsedUrl = new URL(config.gitilesBaseUrl);
|
|
1032
|
+
return `${parsedUrl.protocol}//${parsedUrl.host}${getAuthenticationPrefix(
|
|
1033
|
+
config
|
|
1034
|
+
)}${parsedUrl.pathname.substring(1)}`;
|
|
1035
|
+
}
|
|
992
1036
|
function getGerritBranchApiUrl(config, url) {
|
|
993
1037
|
const { branch, project } = parseGerritGitilesUrl(config, url);
|
|
994
1038
|
return `${config.baseUrl}${getAuthenticationPrefix(
|
|
@@ -1037,7 +1081,13 @@ async function parseGerritJsonResponse(response) {
|
|
|
1037
1081
|
);
|
|
1038
1082
|
}
|
|
1039
1083
|
|
|
1040
|
-
|
|
1084
|
+
var __defProp$7 = Object.defineProperty;
|
|
1085
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1086
|
+
var __publicField$7 = (obj, key, value) => {
|
|
1087
|
+
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1088
|
+
return value;
|
|
1089
|
+
};
|
|
1090
|
+
const _GerritIntegration = class _GerritIntegration {
|
|
1041
1091
|
constructor(integrationConfig) {
|
|
1042
1092
|
this.integrationConfig = integrationConfig;
|
|
1043
1093
|
}
|
|
@@ -1071,8 +1121,7 @@ const _GerritIntegration = class {
|
|
|
1071
1121
|
return url;
|
|
1072
1122
|
}
|
|
1073
1123
|
};
|
|
1074
|
-
|
|
1075
|
-
GerritIntegration.factory = ({ config }) => {
|
|
1124
|
+
__publicField$7(_GerritIntegration, "factory", ({ config }) => {
|
|
1076
1125
|
var _a;
|
|
1077
1126
|
const configs = readGerritIntegrationConfigs(
|
|
1078
1127
|
(_a = config.getOptionalConfigArray("integrations.gerrit")) != null ? _a : []
|
|
@@ -1081,7 +1130,8 @@ GerritIntegration.factory = ({ config }) => {
|
|
|
1081
1130
|
configs.map((c) => new _GerritIntegration(c)),
|
|
1082
1131
|
(i) => i.config.host
|
|
1083
1132
|
);
|
|
1084
|
-
};
|
|
1133
|
+
});
|
|
1134
|
+
let GerritIntegration = _GerritIntegration;
|
|
1085
1135
|
|
|
1086
1136
|
function readGiteaConfig(config) {
|
|
1087
1137
|
const host = config.getString("host");
|
|
@@ -1146,7 +1196,13 @@ function getGiteaRequestOptions(config) {
|
|
|
1146
1196
|
};
|
|
1147
1197
|
}
|
|
1148
1198
|
|
|
1149
|
-
|
|
1199
|
+
var __defProp$6 = Object.defineProperty;
|
|
1200
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1201
|
+
var __publicField$6 = (obj, key, value) => {
|
|
1202
|
+
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1203
|
+
return value;
|
|
1204
|
+
};
|
|
1205
|
+
const _GiteaIntegration = class _GiteaIntegration {
|
|
1150
1206
|
constructor(config) {
|
|
1151
1207
|
this.config = config;
|
|
1152
1208
|
}
|
|
@@ -1163,8 +1219,7 @@ const _GiteaIntegration = class {
|
|
|
1163
1219
|
return getGiteaEditContentsUrl(this.config, url);
|
|
1164
1220
|
}
|
|
1165
1221
|
};
|
|
1166
|
-
|
|
1167
|
-
GiteaIntegration.factory = ({ config }) => {
|
|
1222
|
+
__publicField$6(_GiteaIntegration, "factory", ({ config }) => {
|
|
1168
1223
|
var _a;
|
|
1169
1224
|
const configs = (_a = config.getOptionalConfigArray("integrations.gitea")) != null ? _a : [];
|
|
1170
1225
|
const giteaConfigs = configs.map((c) => readGiteaConfig(c));
|
|
@@ -1172,7 +1227,8 @@ GiteaIntegration.factory = ({ config }) => {
|
|
|
1172
1227
|
giteaConfigs.map((c) => new _GiteaIntegration(c)),
|
|
1173
1228
|
(gitea) => gitea.config.host
|
|
1174
1229
|
);
|
|
1175
|
-
};
|
|
1230
|
+
});
|
|
1231
|
+
let GiteaIntegration = _GiteaIntegration;
|
|
1176
1232
|
|
|
1177
1233
|
const GITHUB_HOST = "github.com";
|
|
1178
1234
|
const GITHUB_API_BASE_URL = "https://api.github.com";
|
|
@@ -1256,10 +1312,16 @@ function chooseEndpoint(config, credentials) {
|
|
|
1256
1312
|
return "raw";
|
|
1257
1313
|
}
|
|
1258
1314
|
|
|
1315
|
+
var __defProp$5 = Object.defineProperty;
|
|
1316
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1317
|
+
var __publicField$5 = (obj, key, value) => {
|
|
1318
|
+
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1319
|
+
return value;
|
|
1320
|
+
};
|
|
1259
1321
|
class Cache {
|
|
1260
1322
|
constructor() {
|
|
1261
|
-
this
|
|
1262
|
-
this
|
|
1323
|
+
__publicField$5(this, "tokenCache", /* @__PURE__ */ new Map());
|
|
1324
|
+
__publicField$5(this, "isExpired", (date) => DateTime.local() > date);
|
|
1263
1325
|
}
|
|
1264
1326
|
async getOrCreateToken(owner, repo, supplier) {
|
|
1265
1327
|
let existingInstallationData = this.tokenCache.get(owner);
|
|
@@ -1291,7 +1353,11 @@ const HEADERS = {
|
|
|
1291
1353
|
class GithubAppManager {
|
|
1292
1354
|
// undefined allows all installations
|
|
1293
1355
|
constructor(config, baseUrl) {
|
|
1294
|
-
this
|
|
1356
|
+
__publicField$5(this, "appClient");
|
|
1357
|
+
__publicField$5(this, "baseUrl");
|
|
1358
|
+
__publicField$5(this, "baseAuthConfig");
|
|
1359
|
+
__publicField$5(this, "cache", new Cache());
|
|
1360
|
+
__publicField$5(this, "allowedInstallationOwners");
|
|
1295
1361
|
this.allowedInstallationOwners = config.allowedInstallationOwners;
|
|
1296
1362
|
this.baseUrl = baseUrl;
|
|
1297
1363
|
this.baseAuthConfig = {
|
|
@@ -1369,6 +1435,7 @@ class GithubAppManager {
|
|
|
1369
1435
|
}
|
|
1370
1436
|
class GithubAppCredentialsMux {
|
|
1371
1437
|
constructor(config) {
|
|
1438
|
+
__publicField$5(this, "apps");
|
|
1372
1439
|
var _a, _b;
|
|
1373
1440
|
this.apps = (_b = (_a = config.apps) == null ? void 0 : _a.map((ac) => new GithubAppManager(ac, config.apiBaseUrl))) != null ? _b : [];
|
|
1374
1441
|
}
|
|
@@ -1410,7 +1477,7 @@ class GithubAppCredentialsMux {
|
|
|
1410
1477
|
return void 0;
|
|
1411
1478
|
}
|
|
1412
1479
|
}
|
|
1413
|
-
const _SingleInstanceGithubCredentialsProvider = class {
|
|
1480
|
+
const _SingleInstanceGithubCredentialsProvider = class _SingleInstanceGithubCredentialsProvider {
|
|
1414
1481
|
constructor(githubAppCredentialsMux, token) {
|
|
1415
1482
|
this.githubAppCredentialsMux = githubAppCredentialsMux;
|
|
1416
1483
|
this.token = token;
|
|
@@ -1452,13 +1519,13 @@ const _SingleInstanceGithubCredentialsProvider = class {
|
|
|
1452
1519
|
};
|
|
1453
1520
|
}
|
|
1454
1521
|
};
|
|
1455
|
-
|
|
1456
|
-
SingleInstanceGithubCredentialsProvider.create = (config) => {
|
|
1522
|
+
__publicField$5(_SingleInstanceGithubCredentialsProvider, "create", (config) => {
|
|
1457
1523
|
return new _SingleInstanceGithubCredentialsProvider(
|
|
1458
1524
|
new GithubAppCredentialsMux(config),
|
|
1459
1525
|
config.token
|
|
1460
1526
|
);
|
|
1461
|
-
};
|
|
1527
|
+
});
|
|
1528
|
+
let SingleInstanceGithubCredentialsProvider = _SingleInstanceGithubCredentialsProvider;
|
|
1462
1529
|
|
|
1463
1530
|
class DefaultGithubCredentialsProvider {
|
|
1464
1531
|
constructor(providers) {
|
|
@@ -1508,7 +1575,13 @@ class DefaultGithubCredentialsProvider {
|
|
|
1508
1575
|
}
|
|
1509
1576
|
}
|
|
1510
1577
|
|
|
1511
|
-
|
|
1578
|
+
var __defProp$4 = Object.defineProperty;
|
|
1579
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1580
|
+
var __publicField$4 = (obj, key, value) => {
|
|
1581
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1582
|
+
return value;
|
|
1583
|
+
};
|
|
1584
|
+
const _GithubIntegration = class _GithubIntegration {
|
|
1512
1585
|
constructor(integrationConfig) {
|
|
1513
1586
|
this.integrationConfig = integrationConfig;
|
|
1514
1587
|
}
|
|
@@ -1528,8 +1601,7 @@ const _GithubIntegration = class {
|
|
|
1528
1601
|
return replaceGithubUrlType(url, "edit");
|
|
1529
1602
|
}
|
|
1530
1603
|
};
|
|
1531
|
-
|
|
1532
|
-
GithubIntegration.factory = ({ config }) => {
|
|
1604
|
+
__publicField$4(_GithubIntegration, "factory", ({ config }) => {
|
|
1533
1605
|
var _a;
|
|
1534
1606
|
const configs = readGithubIntegrationConfigs(
|
|
1535
1607
|
(_a = config.getOptionalConfigArray("integrations.github")) != null ? _a : []
|
|
@@ -1538,7 +1610,8 @@ GithubIntegration.factory = ({ config }) => {
|
|
|
1538
1610
|
configs.map((c) => new _GithubIntegration(c)),
|
|
1539
1611
|
(i) => i.config.host
|
|
1540
1612
|
);
|
|
1541
|
-
};
|
|
1613
|
+
});
|
|
1614
|
+
let GithubIntegration = _GithubIntegration;
|
|
1542
1615
|
function replaceGithubUrlType(url, type) {
|
|
1543
1616
|
return url.replace(
|
|
1544
1617
|
/\/\/([^/]+)\/([^/]+)\/([^/]+)\/(blob|tree|edit)\//,
|
|
@@ -1548,6 +1621,12 @@ function replaceGithubUrlType(url, type) {
|
|
|
1548
1621
|
);
|
|
1549
1622
|
}
|
|
1550
1623
|
|
|
1624
|
+
var __defProp$3 = Object.defineProperty;
|
|
1625
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1626
|
+
var __publicField$3 = (obj, key, value) => {
|
|
1627
|
+
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1628
|
+
return value;
|
|
1629
|
+
};
|
|
1551
1630
|
const getGitHubFileFetchUrl = getGithubFileFetchUrl;
|
|
1552
1631
|
class GitHubIntegration extends GithubIntegration {
|
|
1553
1632
|
constructor(integrationConfig) {
|
|
@@ -1557,7 +1636,7 @@ class GitHubIntegration extends GithubIntegration {
|
|
|
1557
1636
|
return super.config;
|
|
1558
1637
|
}
|
|
1559
1638
|
}
|
|
1560
|
-
GitHubIntegration
|
|
1639
|
+
__publicField$3(GitHubIntegration, "factory", GithubIntegration.factory);
|
|
1561
1640
|
const readGitHubIntegrationConfig = readGithubIntegrationConfig;
|
|
1562
1641
|
const readGitHubIntegrationConfigs = readGithubIntegrationConfigs;
|
|
1563
1642
|
const replaceGitHubUrlType = replaceGithubUrlType;
|
|
@@ -1677,7 +1756,13 @@ async function getProjectId(target, config) {
|
|
|
1677
1756
|
}
|
|
1678
1757
|
}
|
|
1679
1758
|
|
|
1680
|
-
|
|
1759
|
+
var __defProp$2 = Object.defineProperty;
|
|
1760
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1761
|
+
var __publicField$2 = (obj, key, value) => {
|
|
1762
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1763
|
+
return value;
|
|
1764
|
+
};
|
|
1765
|
+
const _GitLabIntegration = class _GitLabIntegration {
|
|
1681
1766
|
constructor(integrationConfig) {
|
|
1682
1767
|
this.integrationConfig = integrationConfig;
|
|
1683
1768
|
}
|
|
@@ -1697,8 +1782,7 @@ const _GitLabIntegration = class {
|
|
|
1697
1782
|
return replaceGitLabUrlType(url, "edit");
|
|
1698
1783
|
}
|
|
1699
1784
|
};
|
|
1700
|
-
|
|
1701
|
-
GitLabIntegration.factory = ({ config }) => {
|
|
1785
|
+
__publicField$2(_GitLabIntegration, "factory", ({ config }) => {
|
|
1702
1786
|
var _a;
|
|
1703
1787
|
const configs = readGitLabIntegrationConfigs(
|
|
1704
1788
|
(_a = config.getOptionalConfigArray("integrations.gitlab")) != null ? _a : []
|
|
@@ -1707,12 +1791,19 @@ GitLabIntegration.factory = ({ config }) => {
|
|
|
1707
1791
|
configs.map((c) => new _GitLabIntegration(c)),
|
|
1708
1792
|
(i) => i.config.host
|
|
1709
1793
|
);
|
|
1710
|
-
};
|
|
1794
|
+
});
|
|
1795
|
+
let GitLabIntegration = _GitLabIntegration;
|
|
1711
1796
|
function replaceGitLabUrlType(url, type) {
|
|
1712
1797
|
return url.replace(/\/\-\/(blob|tree|edit)\//, `/-/${type}/`);
|
|
1713
1798
|
}
|
|
1714
1799
|
|
|
1715
|
-
|
|
1800
|
+
var __defProp$1 = Object.defineProperty;
|
|
1801
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1802
|
+
var __publicField$1 = (obj, key, value) => {
|
|
1803
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1804
|
+
return value;
|
|
1805
|
+
};
|
|
1806
|
+
const _SingleInstanceGitlabCredentialsProvider = class _SingleInstanceGitlabCredentialsProvider {
|
|
1716
1807
|
constructor(token) {
|
|
1717
1808
|
this.token = token;
|
|
1718
1809
|
}
|
|
@@ -1728,10 +1819,10 @@ const _SingleInstanceGitlabCredentialsProvider = class {
|
|
|
1728
1819
|
};
|
|
1729
1820
|
}
|
|
1730
1821
|
};
|
|
1731
|
-
|
|
1732
|
-
SingleInstanceGitlabCredentialsProvider.create = (config) => {
|
|
1822
|
+
__publicField$1(_SingleInstanceGitlabCredentialsProvider, "create", (config) => {
|
|
1733
1823
|
return new _SingleInstanceGitlabCredentialsProvider(config.token);
|
|
1734
|
-
};
|
|
1824
|
+
});
|
|
1825
|
+
let SingleInstanceGitlabCredentialsProvider = _SingleInstanceGitlabCredentialsProvider;
|
|
1735
1826
|
|
|
1736
1827
|
class DefaultGitlabCredentialsProvider {
|
|
1737
1828
|
constructor(providers) {
|
|
@@ -1769,7 +1860,17 @@ function readGoogleGcsIntegrationConfig(config) {
|
|
|
1769
1860
|
return { clientEmail, privateKey };
|
|
1770
1861
|
}
|
|
1771
1862
|
|
|
1863
|
+
var __defProp = Object.defineProperty;
|
|
1864
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1865
|
+
var __publicField = (obj, key, value) => {
|
|
1866
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1867
|
+
return value;
|
|
1868
|
+
};
|
|
1772
1869
|
class ScmIntegrations {
|
|
1870
|
+
constructor(integrationsByType) {
|
|
1871
|
+
__publicField(this, "byType");
|
|
1872
|
+
this.byType = integrationsByType;
|
|
1873
|
+
}
|
|
1773
1874
|
static fromConfig(config) {
|
|
1774
1875
|
return new ScmIntegrations({
|
|
1775
1876
|
awsS3: AwsS3Integration.factory({ config }),
|
|
@@ -1783,9 +1884,6 @@ class ScmIntegrations {
|
|
|
1783
1884
|
gitea: GiteaIntegration.factory({ config })
|
|
1784
1885
|
});
|
|
1785
1886
|
}
|
|
1786
|
-
constructor(integrationsByType) {
|
|
1787
|
-
this.byType = integrationsByType;
|
|
1788
|
-
}
|
|
1789
1887
|
get awsS3() {
|
|
1790
1888
|
return this.byType.awsS3;
|
|
1791
1889
|
}
|
|
@@ -1852,5 +1950,5 @@ class ScmIntegrations {
|
|
|
1852
1950
|
}
|
|
1853
1951
|
}
|
|
1854
1952
|
|
|
1855
|
-
export { AwsS3Integration, AzureIntegration, BitbucketCloudIntegration, BitbucketIntegration, BitbucketServerIntegration, DefaultGithubCredentialsProvider, DefaultGitlabCredentialsProvider, GerritIntegration, GitHubIntegration, GitLabIntegration, GiteaIntegration, GithubAppCredentialsMux, GithubIntegration, ScmIntegrations, SingleInstanceGithubCredentialsProvider, defaultScmResolveUrl, getAzureCommitsUrl, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketCloudDefaultBranch, getBitbucketCloudDownloadUrl, getBitbucketCloudFileFetchUrl, getBitbucketCloudRequestOptions, getBitbucketDefaultBranch, getBitbucketDownloadUrl, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getBitbucketServerDefaultBranch, getBitbucketServerDownloadUrl, getBitbucketServerFileFetchUrl, getBitbucketServerRequestOptions, getGerritBranchApiUrl, getGerritCloneRepoUrl, getGerritFileContentsApiUrl, getGerritProjectsApiUrl, getGerritRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabIntegrationRelativePath, getGitLabRequestOptions, getGiteaFileContentsUrl, getGiteaRequestOptions, getGithubFileFetchUrl, parseGerritGitilesUrl, parseGerritJsonResponse, readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketCloudIntegrationConfig, readBitbucketCloudIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readBitbucketServerIntegrationConfig, readBitbucketServerIntegrationConfigs, readGerritIntegrationConfig, readGerritIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs, readGiteaConfig, readGithubIntegrationConfig, readGithubIntegrationConfigs, readGoogleGcsIntegrationConfig, replaceGitHubUrlType, replaceGitLabUrlType, replaceGithubUrlType };
|
|
1953
|
+
export { AwsS3Integration, AzureIntegration, BitbucketCloudIntegration, BitbucketIntegration, BitbucketServerIntegration, DefaultGithubCredentialsProvider, DefaultGitlabCredentialsProvider, GerritIntegration, GitHubIntegration, GitLabIntegration, GiteaIntegration, GithubAppCredentialsMux, GithubIntegration, ScmIntegrations, SingleInstanceGithubCredentialsProvider, buildGerritGitilesArchiveUrl, defaultScmResolveUrl, getAzureCommitsUrl, getAzureDownloadUrl, getAzureFileFetchUrl, getAzureRequestOptions, getBitbucketCloudDefaultBranch, getBitbucketCloudDownloadUrl, getBitbucketCloudFileFetchUrl, getBitbucketCloudRequestOptions, getBitbucketDefaultBranch, getBitbucketDownloadUrl, getBitbucketFileFetchUrl, getBitbucketRequestOptions, getBitbucketServerDefaultBranch, getBitbucketServerDownloadUrl, getBitbucketServerFileFetchUrl, getBitbucketServerRequestOptions, getGerritBranchApiUrl, getGerritCloneRepoUrl, getGerritFileContentsApiUrl, getGerritProjectsApiUrl, getGerritRequestOptions, getGitHubFileFetchUrl, getGitHubRequestOptions, getGitLabFileFetchUrl, getGitLabIntegrationRelativePath, getGitLabRequestOptions, getGiteaFileContentsUrl, getGiteaRequestOptions, getGithubFileFetchUrl, parseGerritGitilesUrl, parseGerritJsonResponse, readAwsS3IntegrationConfig, readAwsS3IntegrationConfigs, readAzureIntegrationConfig, readAzureIntegrationConfigs, readBitbucketCloudIntegrationConfig, readBitbucketCloudIntegrationConfigs, readBitbucketIntegrationConfig, readBitbucketIntegrationConfigs, readBitbucketServerIntegrationConfig, readBitbucketServerIntegrationConfigs, readGerritIntegrationConfig, readGerritIntegrationConfigs, readGitHubIntegrationConfig, readGitHubIntegrationConfigs, readGitLabIntegrationConfig, readGitLabIntegrationConfigs, readGiteaConfig, readGithubIntegrationConfig, readGithubIntegrationConfigs, readGoogleGcsIntegrationConfig, replaceGitHubUrlType, replaceGitLabUrlType, replaceGithubUrlType };
|
|
1856
1954
|
//# sourceMappingURL=index.esm.js.map
|