@codefresh-io/cf-git-providers 0.13.2 → 0.13.4
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/lib/bin/commands/create/status.cmd.js +14 -12
- package/lib/bin/commands/create/status.cmd.js.map +1 -1
- package/lib/bin/commands/create/webhook.cmd.js +14 -12
- package/lib/bin/commands/create/webhook.cmd.js.map +1 -1
- package/lib/bin/commands/delete/webhook.cmd.js +10 -8
- package/lib/bin/commands/delete/webhook.cmd.js.map +1 -1
- package/lib/bin/commands/get/branch.cmd.js +10 -8
- package/lib/bin/commands/get/branch.cmd.js.map +1 -1
- package/lib/bin/commands/get/file.cmd.js +11 -9
- package/lib/bin/commands/get/file.cmd.js.map +1 -1
- package/lib/bin/commands/get/repo.cmd.js +10 -8
- package/lib/bin/commands/get/repo.cmd.js.map +1 -1
- package/lib/bin/commands/list/branches.cmd.js +16 -14
- package/lib/bin/commands/list/branches.cmd.js.map +1 -1
- package/lib/bin/commands/list/organizations.cmd.js +8 -6
- package/lib/bin/commands/list/organizations.cmd.js.map +1 -1
- package/lib/bin/commands/list/repos.cmd.js +15 -13
- package/lib/bin/commands/list/repos.cmd.js.map +1 -1
- package/lib/bin/commands/list/webhooks.cmd.js +10 -8
- package/lib/bin/commands/list/webhooks.cmd.js.map +1 -1
- package/lib/bin/commands/root/create.cmd.js +3 -2
- package/lib/bin/commands/root/create.cmd.js.map +1 -1
- package/lib/bin/commands/root/delete.cmd.js +3 -2
- package/lib/bin/commands/root/delete.cmd.js.map +1 -1
- package/lib/bin/commands/root/get.cmd.js +3 -2
- package/lib/bin/commands/root/get.cmd.js.map +1 -1
- package/lib/bin/commands/root/list.cmd.js +3 -2
- package/lib/bin/commands/root/list.cmd.js.map +1 -1
- package/lib/bin/index.js +10 -6
- package/lib/bin/index.js.map +1 -1
- package/lib/helpers/__test_helpers__/retry-test-helper.js +1 -1
- package/lib/helpers/__test_helpers__/retry-test-helper.js.map +1 -1
- package/lib/helpers/index.d.ts +1 -1
- package/lib/helpers/index.d.ts.map +1 -1
- package/lib/helpers/index.js +36 -21
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/request-retry.d.ts +2 -2
- package/lib/helpers/request-retry.d.ts.map +1 -1
- package/lib/helpers/request-retry.js +1 -1
- package/lib/helpers/request-retry.js.map +1 -1
- package/lib/index.js +8 -4
- package/lib/index.js.map +1 -1
- package/lib/providers/bitbucket-server.js +40 -40
- package/lib/providers/bitbucket-server.js.map +1 -1
- package/lib/providers/bitbucket.js +25 -25
- package/lib/providers/bitbucket.js.map +1 -1
- package/lib/providers/gerrit.d.ts +1 -1
- package/lib/providers/gerrit.d.ts.map +1 -1
- package/lib/providers/gerrit.js +38 -38
- package/lib/providers/gerrit.js.map +1 -1
- package/lib/providers/github.d.ts.map +1 -1
- package/lib/providers/github.js +71 -74
- package/lib/providers/github.js.map +1 -1
- package/lib/providers/gitlab.js +21 -21
- package/lib/providers/gitlab.js.map +1 -1
- package/lib/providers/types.d.ts +9 -9
- package/lib/providers/types.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -3,29 +3,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.handler = exports.builder = exports.desc = exports.aliases = exports.command = void 0;
|
|
4
4
|
const helpers_1 = require("../../../helpers");
|
|
5
5
|
// tslint:disable-next-line: no-var-requires
|
|
6
|
-
const logger = helpers_1.createNewLogger('codefresh:list:organizations');
|
|
6
|
+
const logger = (0, helpers_1.createNewLogger)('codefresh:list:organizations');
|
|
7
7
|
exports.command = 'organizations';
|
|
8
8
|
exports.aliases = ['orgs'];
|
|
9
9
|
exports.desc = 'Get a list of organizations that the authenticated user is related to';
|
|
10
|
-
|
|
10
|
+
const builder = (yargs) => yargs
|
|
11
11
|
.usage('Usage: $0 list organizations [options]')
|
|
12
12
|
.example(`$0 list ${exports.command}`, 'Will list all organizations the authenticated user is affiliated with');
|
|
13
|
-
exports.
|
|
13
|
+
exports.builder = builder;
|
|
14
|
+
const handler = async (argv) => {
|
|
14
15
|
const provider = argv.provider;
|
|
15
16
|
const output = argv.output;
|
|
16
17
|
const limit = argv.limit;
|
|
17
18
|
const page = argv.page;
|
|
18
19
|
logger.debug(`output=${output}`);
|
|
19
20
|
logger.debug(`page=${page}`);
|
|
20
|
-
const [err, orgs] = await helpers_1.to(provider.listOrganizations({ limit, page }));
|
|
21
|
+
const [err, orgs] = await (0, helpers_1.to)(provider.listOrganizations({ limit, page }));
|
|
21
22
|
if (err) {
|
|
22
|
-
helpers_1.exitWithError(`failed to get the list of organizations, ${err}`);
|
|
23
|
+
(0, helpers_1.exitWithError)(`failed to get the list of organizations, ${err}`);
|
|
23
24
|
}
|
|
24
25
|
if (output) {
|
|
25
|
-
await helpers_1.writeResultsToFile(output, JSON.stringify(orgs));
|
|
26
|
+
await (0, helpers_1.writeResultsToFile)(output, JSON.stringify(orgs));
|
|
26
27
|
}
|
|
27
28
|
else {
|
|
28
29
|
console.log(JSON.stringify(orgs));
|
|
29
30
|
}
|
|
30
31
|
};
|
|
32
|
+
exports.handler = handler;
|
|
31
33
|
//# sourceMappingURL=organizations.cmd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organizations.cmd.js","sourceRoot":"","sources":["../../../../src/bin/commands/list/organizations.cmd.ts"],"names":[],"mappings":";;;AAEA,8CAAyF;AAGzF,4CAA4C;AAC5C,MAAM,MAAM,GAAG,yBAAe,
|
|
1
|
+
{"version":3,"file":"organizations.cmd.js","sourceRoot":"","sources":["../../../../src/bin/commands/list/organizations.cmd.ts"],"names":[],"mappings":";;;AAEA,8CAAyF;AAGzF,4CAA4C;AAC5C,MAAM,MAAM,GAAG,IAAA,yBAAe,EAAC,8BAA8B,CAAC,CAAA;AAEjD,QAAA,OAAO,GAAG,eAAe,CAAA;AACzB,QAAA,OAAO,GAAa,CAAE,MAAM,CAAE,CAAA;AAC9B,QAAA,IAAI,GAAG,uEAAuE,CAAA;AAEpF,MAAM,OAAO,GAAG,CAAC,KAAW,EAAE,EAAE,CAAC,KAAK;KACxC,KAAK,CAAC,wCAAwC,CAAC;KAC/C,OAAO,CACJ,WAAW,eAAO,EAAE,EACpB,uEAAuE,CAC1E,CAAA;AALQ,QAAA,OAAO,WAKf;AAEE,MAAM,OAAO,GAAG,KAAK,EAAE,IAAe,EAAE,EAAE;IAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAoB,CAAA;IAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAgB,CAAA;IACpC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAe,CAAA;IAClC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAc,CAAA;IAEhC,MAAM,CAAC,KAAK,CAAC,UAAU,MAAM,EAAE,CAAC,CAAA;IAChC,MAAM,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAA;IAE5B,MAAM,CAAE,GAAG,EAAE,IAAI,CAAE,GAAG,MAAM,IAAA,YAAE,EAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAoB,CAAA;IAC9F,IAAI,GAAG,EAAE;QACL,IAAA,uBAAa,EAAC,4CAA4C,GAAG,EAAE,CAAC,CAAA;KACnE;IAED,IAAI,MAAM,EAAE;QACR,MAAM,IAAA,4BAAkB,EAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;KACzD;SAAM;QACH,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;KACpC;AACL,CAAC,CAAA;AAnBY,QAAA,OAAO,WAmBnB"}
|
|
@@ -8,12 +8,12 @@ const lodash_1 = require("lodash");
|
|
|
8
8
|
const p_limit_1 = __importDefault(require("p-limit"));
|
|
9
9
|
const helpers_1 = require("../../../helpers");
|
|
10
10
|
// tslint:disable-next-line: no-var-requires
|
|
11
|
-
const logger = helpers_1.createNewLogger('codefresh:list:repos');
|
|
11
|
+
const logger = (0, helpers_1.createNewLogger)('codefresh:list:repos');
|
|
12
12
|
const MAX_REPOS_FETCHED_CONCURRENTLY = 4;
|
|
13
13
|
exports.command = 'repos';
|
|
14
14
|
exports.aliases = ['rp'];
|
|
15
15
|
exports.desc = 'Get a list of repos of a specified owner or with a specified affiliation to the authenticated user';
|
|
16
|
-
|
|
16
|
+
const builder = (yargs) => yargs
|
|
17
17
|
.usage('Usage: $0 list repos [options]')
|
|
18
18
|
.option('owner', {
|
|
19
19
|
alias: ['o'],
|
|
@@ -27,8 +27,8 @@ exports.builder = (yargs) => yargs
|
|
|
27
27
|
describe: 'The user affiliation to the repo',
|
|
28
28
|
defaultDescription: 'all',
|
|
29
29
|
coerce: (affiliations) => {
|
|
30
|
-
if (lodash_1.isArray(affiliations)) {
|
|
31
|
-
return lodash_1.flatMap(affiliations, (aff) => aff.split(','));
|
|
30
|
+
if ((0, lodash_1.isArray)(affiliations)) {
|
|
31
|
+
return (0, lodash_1.flatMap)(affiliations, (aff) => aff.split(','));
|
|
32
32
|
}
|
|
33
33
|
if (affiliations === 'all' || affiliations === true) {
|
|
34
34
|
return ['owner', 'collaborator', 'organization_member'];
|
|
@@ -67,7 +67,8 @@ exports.builder = (yargs) => yargs
|
|
|
67
67
|
.example(`$0 list ${exports.command} --affiliation owner`, 'Will list all repositories the authenticated user has "owner" affiliation with')
|
|
68
68
|
.example(`$0 list ${exports.command} -o some-owner`, 'Will list all the repositories of "some-owner"')
|
|
69
69
|
.example(`$0 list ${exports.command} -o some-owner -l 40`, 'Will list up to 40 repositories of "some-owner"');
|
|
70
|
-
exports.
|
|
70
|
+
exports.builder = builder;
|
|
71
|
+
const handler = async (argv) => {
|
|
71
72
|
const owner = argv.owner;
|
|
72
73
|
const provider = argv.provider;
|
|
73
74
|
const output = argv.output;
|
|
@@ -108,23 +109,24 @@ exports.handler = async (argv) => {
|
|
|
108
109
|
result = repos.map((r) => r.name);
|
|
109
110
|
}
|
|
110
111
|
if (output) {
|
|
111
|
-
await helpers_1.writeResultsToFile(output, JSON.stringify(result));
|
|
112
|
+
await (0, helpers_1.writeResultsToFile)(output, JSON.stringify(result));
|
|
112
113
|
}
|
|
113
114
|
else {
|
|
114
115
|
console.log(JSON.stringify(result));
|
|
115
116
|
}
|
|
116
117
|
};
|
|
118
|
+
exports.handler = handler;
|
|
117
119
|
const getReposForOwner = async (provider, args) => {
|
|
118
120
|
const { owner, sort, direction, limit, page } = args;
|
|
119
|
-
const [listReposErr, repos] = await helpers_1.to(provider.listRepositoriesForOwner({ owner, limit, page, sort, direction }));
|
|
121
|
+
const [listReposErr, repos] = await (0, helpers_1.to)(provider.listRepositoriesForOwner({ owner, limit, page, sort, direction }));
|
|
120
122
|
if (listReposErr) {
|
|
121
|
-
helpers_1.exitWithError(`failed to get the list of repositories of "${owner}", ${listReposErr}`);
|
|
123
|
+
(0, helpers_1.exitWithError)(`failed to get the list of repositories of "${owner}", ${listReposErr}`);
|
|
122
124
|
}
|
|
123
125
|
return repos;
|
|
124
126
|
};
|
|
125
127
|
const getAffiliatedRepos = async (provider, args) => {
|
|
126
128
|
const { affiliations, sort, direction, limit, page } = args;
|
|
127
|
-
const [listReposErr, repos] = await helpers_1.to(provider.listRepositoriesWithAffiliation({
|
|
129
|
+
const [listReposErr, repos] = await (0, helpers_1.to)(provider.listRepositoriesWithAffiliation({
|
|
128
130
|
affiliation: affiliations.join(','),
|
|
129
131
|
...(sort && { sort }),
|
|
130
132
|
...(direction && { direction }),
|
|
@@ -132,13 +134,13 @@ const getAffiliatedRepos = async (provider, args) => {
|
|
|
132
134
|
page,
|
|
133
135
|
}));
|
|
134
136
|
if (listReposErr) {
|
|
135
|
-
helpers_1.exitWithError(`failed to get the list of repositories with affiliation: "${affiliations}", ${listReposErr}`);
|
|
137
|
+
(0, helpers_1.exitWithError)(`failed to get the list of repositories with affiliation: "${affiliations}", ${listReposErr}`);
|
|
136
138
|
}
|
|
137
139
|
return repos;
|
|
138
140
|
};
|
|
139
141
|
const getReposByListOfNames = async (provider, args) => {
|
|
140
142
|
const { repoNames } = args;
|
|
141
|
-
const limitter = p_limit_1.default(MAX_REPOS_FETCHED_CONCURRENTLY);
|
|
143
|
+
const limitter = (0, p_limit_1.default)(MAX_REPOS_FETCHED_CONCURRENTLY);
|
|
142
144
|
const repoPromises = repoNames.map((repoName) => {
|
|
143
145
|
const [owner, repo] = repoName.split('/');
|
|
144
146
|
return limitter(provider.getRepository.bind(provider), { owner, repo });
|
|
@@ -147,9 +149,9 @@ const getReposByListOfNames = async (provider, args) => {
|
|
|
147
149
|
};
|
|
148
150
|
const getReposForOrg = async (provider, args) => {
|
|
149
151
|
const { organization, sort, direction, limit, page } = args;
|
|
150
|
-
const [listReposErr, repos] = await helpers_1.to(provider.listRepositoriesForOrganization({ organization, limit, page, sort, direction }));
|
|
152
|
+
const [listReposErr, repos] = await (0, helpers_1.to)(provider.listRepositoriesForOrganization({ organization, limit, page, sort, direction }));
|
|
151
153
|
if (listReposErr) {
|
|
152
|
-
helpers_1.exitWithError(`failed to get the list of repositories of organization: "${organization}", ${listReposErr}`);
|
|
154
|
+
(0, helpers_1.exitWithError)(`failed to get the list of repositories of organization: "${organization}", ${listReposErr}`);
|
|
153
155
|
}
|
|
154
156
|
return repos;
|
|
155
157
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repos.cmd.js","sourceRoot":"","sources":["../../../../src/bin/commands/list/repos.cmd.ts"],"names":[],"mappings":";;;;;;AACA,mCAAyC;AACzC,sDAA4B;AAE5B,8CAAyF;AAGzF,4CAA4C;AAC5C,MAAM,MAAM,GAAG,yBAAe,
|
|
1
|
+
{"version":3,"file":"repos.cmd.js","sourceRoot":"","sources":["../../../../src/bin/commands/list/repos.cmd.ts"],"names":[],"mappings":";;;;;;AACA,mCAAyC;AACzC,sDAA4B;AAE5B,8CAAyF;AAGzF,4CAA4C;AAC5C,MAAM,MAAM,GAAG,IAAA,yBAAe,EAAC,sBAAsB,CAAC,CA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IAAI,EAAE,CAAC,CAAA;IAC3E,CAAC,CAAC,CAAA;IACF,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;AACpC,CAAC,CAAA;AAED,MAAM,cAAc,GAAI,KAAK,EAAE,QAAkB,EAAE,IAMlD,EAAyB,EAAE;IACxB,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IAC3D,MAAM,CAAE,YAAY,EAAE,KAAK,CAAE,GAAG,MAAM,IAAA,YAAE,EAAC,QAAQ,CAAC,+BAA+B,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAwB,CAAA;IACzJ,IAAI,YAAY,EAAE;QACd,IAAA,uBAAa,EAAC,4DAA4D,YAAY,MAAM,YAAY,EAAE,CAAC,CAAA;KAC9G;IACD,OAAO,KAAK,CAAA;AAChB,CAAC,CAAA"}
|
|
@@ -3,27 +3,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.handler = exports.builder = exports.desc = exports.aliases = exports.command = void 0;
|
|
4
4
|
const helpers_1 = require("../../../helpers");
|
|
5
5
|
// tslint:disable-next-line: no-var-requires
|
|
6
|
-
const logger = helpers_1.createNewLogger('codefresh:list:webhooks');
|
|
6
|
+
const logger = (0, helpers_1.createNewLogger)('codefresh:list:webhooks');
|
|
7
7
|
exports.command = 'webhooks';
|
|
8
8
|
exports.aliases = ['wh'];
|
|
9
9
|
exports.desc = 'Get a list of the repository webhooks';
|
|
10
|
-
|
|
10
|
+
const builder = (yargs) => yargs
|
|
11
11
|
.usage('Usage: $0 list webhooks [options]')
|
|
12
12
|
.option('owner', {
|
|
13
13
|
alias: 'o',
|
|
14
|
-
demandOption: helpers_1.errormsg `must provide "owner" option`,
|
|
14
|
+
demandOption: (0, helpers_1.errormsg) `must provide "owner" option`,
|
|
15
15
|
describe: 'The name of the owner of the git repository',
|
|
16
16
|
type: 'string'
|
|
17
17
|
})
|
|
18
18
|
.option('repo', {
|
|
19
19
|
alias: 'r',
|
|
20
|
-
demandOption: helpers_1.errormsg `must provide "repo" option`,
|
|
20
|
+
demandOption: (0, helpers_1.errormsg) `must provide "repo" option`,
|
|
21
21
|
describe: 'The name of the git repository',
|
|
22
22
|
type: 'string'
|
|
23
23
|
})
|
|
24
24
|
.example(`$0 list ${exports.command} -o some-owner -r some-repo`, 'Will list all webhooks from repo: "some-owner/some-repo"')
|
|
25
25
|
.example(`$0 list ${exports.command} -o some-owner -r some-repo -l 40`, 'Will list up to 40 webhooks from repo: "some-owner/some-repo"');
|
|
26
|
-
exports.
|
|
26
|
+
exports.builder = builder;
|
|
27
|
+
const handler = async (argv) => {
|
|
27
28
|
const owner = argv.owner;
|
|
28
29
|
const repo = argv.repo;
|
|
29
30
|
const provider = argv.provider;
|
|
@@ -34,15 +35,16 @@ exports.handler = async (argv) => {
|
|
|
34
35
|
logger.debug(`output=${output}`);
|
|
35
36
|
logger.debug(`limit=${limit}`);
|
|
36
37
|
logger.debug(`page=${page}`);
|
|
37
|
-
const [err, webhooks] = await helpers_1.to(provider.listWebhooks({ owner, repo, limit, page }));
|
|
38
|
+
const [err, webhooks] = await (0, helpers_1.to)(provider.listWebhooks({ owner, repo, limit, page }));
|
|
38
39
|
if (err) {
|
|
39
|
-
helpers_1.exitWithError(`failed to get the list of webhooks of repository: "${owner}/${repo}", ${err}`);
|
|
40
|
+
(0, helpers_1.exitWithError)(`failed to get the list of webhooks of repository: "${owner}/${repo}", ${err}`);
|
|
40
41
|
}
|
|
41
42
|
if (output) {
|
|
42
|
-
await helpers_1.writeResultsToFile(output, JSON.stringify(webhooks));
|
|
43
|
+
await (0, helpers_1.writeResultsToFile)(output, JSON.stringify(webhooks));
|
|
43
44
|
}
|
|
44
45
|
else {
|
|
45
46
|
console.log(JSON.stringify(webhooks));
|
|
46
47
|
}
|
|
47
48
|
};
|
|
49
|
+
exports.handler = handler;
|
|
48
50
|
//# sourceMappingURL=webhooks.cmd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.cmd.js","sourceRoot":"","sources":["../../../../src/bin/commands/list/webhooks.cmd.ts"],"names":[],"mappings":";;;AAEA,8CAAmG;AAInG,4CAA4C;AAC5C,MAAM,MAAM,GAAG,yBAAe,
|
|
1
|
+
{"version":3,"file":"webhooks.cmd.js","sourceRoot":"","sources":["../../../../src/bin/commands/list/webhooks.cmd.ts"],"names":[],"mappings":";;;AAEA,8CAAmG;AAInG,4CAA4C;AAC5C,MAAM,MAAM,GAAG,IAAA,yBAAe,EAAC,yBAAyB,CAAC,CAAA;AAE5C,QAAA,OAAO,GAAG,UAAU,CAAA;AACpB,QAAA,OAAO,GAAa,CAAE,IAAI,CAAE,CAAA;AAC5B,QAAA,IAAI,GAAG,uCAAuC,CAAA;AAEpD,MAAM,OAAO,GAAG,CAAC,KAAW,EAAE,EAAE,CAAC,KAAK;KACxC,KAAK,CAAC,mCAAmC,CAAC;KAC1C,MAAM,CAAC,OAAO,EAAE;IACb,KAAK,EAAE,GAAG;IACV,YAAY,EAAE,IAAA,kBAAQ,EAAA,6BAA6B;IACnD,QAAQ,EAAE,6CAA6C;IACvD,IAAI,EAAE,QAAQ;CACjB,CAAC;KACD,MAAM,CAAC,MAAM,EAAE;IACZ,KAAK,EAAE,GAAG;IACV,YAAY,EAAE,IAAA,kBAAQ,EAAA,4BAA4B;IAClD,QAAQ,EAAE,gCAAgC;IAC1C,IAAI,EAAE,QAAQ;CACjB,CAAC;KACD,OAAO,CACJ,WAAW,eAAO,6BAA6B,EAC/C,0DAA0D,CAC7D;KACA,OAAO,CACJ,WAAW,eAAO,mCAAmC,EACrD,+DAA+D,CAClE,CAAA;AArBQ,QAAA,OAAO,WAqBf;AAEE,MAAM,OAAO,GAAG,KAAK,EAAE,IAAe,EAAE,EAAE;IAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAe,CAAA;IAClC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAc,CAAA;IAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAoB,CAAA;IAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAgB,CAAA;IACpC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAe,CAAA;IAClC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAc,CAAA;IAEhC,MAAM,CAAC,KAAK,CAAC,SAAS,KAAK,EAAE,CAAC,CAAA;IAC9B,MAAM,CAAC,KAAK,CAAC,UAAU,MAAM,EAAE,CAAC,CAAA;IAChC,MAAM,CAAC,KAAK,CAAC,SAAS,KAAK,EAAE,CAAC,CAAA;IAC9B,MAAM,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAA;IAE5B,MAAM,CAAE,GAAG,EAAE,QAAQ,CAAE,GAAG,MAAM,IAAA,YAAE,EAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAqB,CAAA;IAC3G,IAAI,GAAG,EAAE;QACL,IAAA,uBAAa,EAAC,sDAAsD,KAAK,IAAI,IAAI,MAAM,GAAG,EAAE,CAAC,CAAA;KAChG;IAED,IAAI,MAAM,EAAE;QACR,MAAM,IAAA,4BAAkB,EAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAA;KAC7D;SAAM;QACH,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAA;KACxC;AACL,CAAC,CAAA;AAvBY,QAAA,OAAO,WAuBnB"}
|
|
@@ -5,11 +5,11 @@ const helpers_1 = require("../../../helpers");
|
|
|
5
5
|
exports.command = 'create';
|
|
6
6
|
exports.desc = 'create a git resouce';
|
|
7
7
|
exports.usage = 'Usage: $0 create <resource> [options]';
|
|
8
|
-
|
|
8
|
+
const builder = (yargs) => yargs
|
|
9
9
|
.commandDir('../create', {
|
|
10
10
|
extensions: ['cmd.js', 'cmd.ts'],
|
|
11
11
|
})
|
|
12
|
-
.demandCommand(2, helpers_1.errormsg `must specify the resource type`)
|
|
12
|
+
.demandCommand(2, (0, helpers_1.errormsg) `must specify the resource type`)
|
|
13
13
|
.option('output', {
|
|
14
14
|
alias: 's',
|
|
15
15
|
describe: 'Where to save the command output to',
|
|
@@ -17,4 +17,5 @@ exports.builder = (yargs) => yargs
|
|
|
17
17
|
type: 'string'
|
|
18
18
|
})
|
|
19
19
|
.example(`$0 ${exports.command} webhook -o some-owner -r some-repo -e http://some-endpoint/webhooks -s secret`, 'Will create a webhook for repo: "some-owner/some-repo');
|
|
20
|
+
exports.builder = builder;
|
|
20
21
|
//# sourceMappingURL=create.cmd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.cmd.js","sourceRoot":"","sources":["../../../../src/bin/commands/root/create.cmd.ts"],"names":[],"mappings":";;;AAEA,8CAA2C;AAC9B,QAAA,OAAO,GAAG,QAAQ,CAAA;AAClB,QAAA,IAAI,GAAG,sBAAsB,CAAA;AAC7B,QAAA,KAAK,GAAG,uCAAuC,CAAA;
|
|
1
|
+
{"version":3,"file":"create.cmd.js","sourceRoot":"","sources":["../../../../src/bin/commands/root/create.cmd.ts"],"names":[],"mappings":";;;AAEA,8CAA2C;AAC9B,QAAA,OAAO,GAAG,QAAQ,CAAA;AAClB,QAAA,IAAI,GAAG,sBAAsB,CAAA;AAC7B,QAAA,KAAK,GAAG,uCAAuC,CAAA;AAErD,MAAM,OAAO,GAAG,CAAC,KAAW,EAAE,EAAE,CAAC,KAAK;KACxC,UAAU,CAAC,WAAW,EAAE;IACrB,UAAU,EAAE,CAAE,QAAQ,EAAE,QAAQ,CAAE;CACrC,CAAC;KACD,aAAa,CAAC,CAAC,EAAE,IAAA,kBAAQ,EAAA,gCAAgC,CAAC;KAC1D,MAAM,CAAC,QAAQ,EAAE;IACd,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,qCAAqC;IAC/C,kBAAkB,EAAE,eAAe;IACnC,IAAI,EAAE,QAAQ;CACjB,CAAC;KACD,OAAO,CACJ,MAAM,eAAO,gFAAgF,EAC7F,uDAAuD,CAC1D,CAAA;AAdQ,QAAA,OAAO,WAcf"}
|
|
@@ -5,11 +5,11 @@ const helpers_1 = require("../../../helpers");
|
|
|
5
5
|
exports.command = 'delete';
|
|
6
6
|
exports.desc = 'delete a git resouce';
|
|
7
7
|
exports.usage = 'Usage: $0 delete <resource> [options]';
|
|
8
|
-
|
|
8
|
+
const builder = (yargs) => yargs
|
|
9
9
|
.commandDir('../delete', {
|
|
10
10
|
extensions: ['cmd.js', 'cmd.ts'],
|
|
11
11
|
})
|
|
12
|
-
.demandCommand(2, helpers_1.errormsg `must specify the resource type`)
|
|
12
|
+
.demandCommand(2, (0, helpers_1.errormsg) `must specify the resource type`)
|
|
13
13
|
.option('output', {
|
|
14
14
|
alias: 's',
|
|
15
15
|
describe: 'Where to save the command output to',
|
|
@@ -17,4 +17,5 @@ exports.builder = (yargs) => yargs
|
|
|
17
17
|
type: 'string'
|
|
18
18
|
})
|
|
19
19
|
.example(`$0 ${exports.command} webhook -o some-owner -r some-repo --id someid`, 'Will delete a webhook for repo: "some-owner/some-repo with the id: "someid"');
|
|
20
|
+
exports.builder = builder;
|
|
20
21
|
//# sourceMappingURL=delete.cmd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.cmd.js","sourceRoot":"","sources":["../../../../src/bin/commands/root/delete.cmd.ts"],"names":[],"mappings":";;;AAEA,8CAA2C;AAC9B,QAAA,OAAO,GAAG,QAAQ,CAAA;AAClB,QAAA,IAAI,GAAG,sBAAsB,CAAA;AAC7B,QAAA,KAAK,GAAG,uCAAuC,CAAA;
|
|
1
|
+
{"version":3,"file":"delete.cmd.js","sourceRoot":"","sources":["../../../../src/bin/commands/root/delete.cmd.ts"],"names":[],"mappings":";;;AAEA,8CAA2C;AAC9B,QAAA,OAAO,GAAG,QAAQ,CAAA;AAClB,QAAA,IAAI,GAAG,sBAAsB,CAAA;AAC7B,QAAA,KAAK,GAAG,uCAAuC,CAAA;AAErD,MAAM,OAAO,GAAG,CAAC,KAAW,EAAE,EAAE,CAAC,KAAK;KACxC,UAAU,CAAC,WAAW,EAAE;IACrB,UAAU,EAAE,CAAE,QAAQ,EAAE,QAAQ,CAAE;CACrC,CAAC;KACD,aAAa,CAAC,CAAC,EAAE,IAAA,kBAAQ,EAAA,gCAAgC,CAAC;KAC1D,MAAM,CAAC,QAAQ,EAAE;IACd,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,qCAAqC;IAC/C,kBAAkB,EAAE,eAAe;IACnC,IAAI,EAAE,QAAQ;CACjB,CAAC;KACD,OAAO,CACJ,MAAM,eAAO,iDAAiD,EAC9D,6EAA6E,CAChF,CAAA;AAdQ,QAAA,OAAO,WAcf"}
|
|
@@ -5,11 +5,11 @@ const helpers_1 = require("../../../helpers");
|
|
|
5
5
|
exports.command = 'get';
|
|
6
6
|
exports.desc = 'get a resouce from a git provider';
|
|
7
7
|
exports.usage = 'Usage: $0 get <resource> [options]';
|
|
8
|
-
|
|
8
|
+
const builder = (yargs) => yargs
|
|
9
9
|
.commandDir('../get', {
|
|
10
10
|
extensions: ['cmd.js', 'cmd.ts'],
|
|
11
11
|
})
|
|
12
|
-
.demandCommand(2, helpers_1.errormsg `must specify the resource type`)
|
|
12
|
+
.demandCommand(2, (0, helpers_1.errormsg) `must specify the resource type`)
|
|
13
13
|
.option('output', {
|
|
14
14
|
alias: 's',
|
|
15
15
|
describe: 'Where to save the command output to',
|
|
@@ -18,4 +18,5 @@ exports.builder = (yargs) => yargs
|
|
|
18
18
|
})
|
|
19
19
|
.example(`$0 ${exports.command} file -o some-owner -r some-repo -p ./path/to/file`, 'Will fetch the file located at path/to/file from the root of repo: "some-owner/some-repo" (revision "master")')
|
|
20
20
|
.example(`$0 ${exports.command} branch -o some-owner -r some-repo -n some-branch`, 'Will return the details of the branch named "some-branch" of repo: "some-owner/some-repo"');
|
|
21
|
+
exports.builder = builder;
|
|
21
22
|
//# sourceMappingURL=get.cmd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.cmd.js","sourceRoot":"","sources":["../../../../src/bin/commands/root/get.cmd.ts"],"names":[],"mappings":";;;AAEA,8CAA2C;AAC9B,QAAA,OAAO,GAAG,KAAK,CAAA;AACf,QAAA,IAAI,GAAG,mCAAmC,CAAA;AAC1C,QAAA,KAAK,GAAG,oCAAoC,CAAA;
|
|
1
|
+
{"version":3,"file":"get.cmd.js","sourceRoot":"","sources":["../../../../src/bin/commands/root/get.cmd.ts"],"names":[],"mappings":";;;AAEA,8CAA2C;AAC9B,QAAA,OAAO,GAAG,KAAK,CAAA;AACf,QAAA,IAAI,GAAG,mCAAmC,CAAA;AAC1C,QAAA,KAAK,GAAG,oCAAoC,CAAA;AAElD,MAAM,OAAO,GAAG,CAAC,KAAW,EAAE,EAAE,CAAC,KAAK;KACxC,UAAU,CAAC,QAAQ,EAAE;IAClB,UAAU,EAAE,CAAE,QAAQ,EAAE,QAAQ,CAAE;CACrC,CAAC;KACD,aAAa,CAAC,CAAC,EAAE,IAAA,kBAAQ,EAAA,gCAAgC,CAAC;KAC1D,MAAM,CAAC,QAAQ,EAAE;IACd,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,qCAAqC;IAC/C,kBAAkB,EAAE,eAAe;IACnC,IAAI,EAAE,QAAQ;CACjB,CAAC;KACD,OAAO,CACJ,MAAM,eAAO,oDAAoD,EACjE,+GAA+G,CAClH;KACA,OAAO,CACJ,MAAM,eAAO,mDAAmD,EAChE,2FAA2F,CAC9F,CAAA;AAlBQ,QAAA,OAAO,WAkBf"}
|
|
@@ -5,11 +5,11 @@ const helpers_1 = require("../../../helpers");
|
|
|
5
5
|
exports.command = 'list';
|
|
6
6
|
exports.desc = 'list various git repository resources';
|
|
7
7
|
exports.usage = 'Usage: $0 list <resource> [options]';
|
|
8
|
-
|
|
8
|
+
const builder = (yargs) => yargs
|
|
9
9
|
.commandDir('../list', {
|
|
10
10
|
extensions: ['cmd.js', 'cmd.ts'],
|
|
11
11
|
})
|
|
12
|
-
.demandCommand(2, helpers_1.errormsg `must specify the resource type`)
|
|
12
|
+
.demandCommand(2, (0, helpers_1.errormsg) `must specify the resource type`)
|
|
13
13
|
.option('output', {
|
|
14
14
|
alias: 's',
|
|
15
15
|
describe: 'Where to save the command output to',
|
|
@@ -30,4 +30,5 @@ exports.builder = (yargs) => yargs
|
|
|
30
30
|
})
|
|
31
31
|
.example(`$0 ${exports.command} branches -o some-owner -r some-repo`, 'Will display a list of all branches in the specified git repository')
|
|
32
32
|
.example(`$0 ${exports.command} branches -o some-owner -r some-repo -l 120 -p 5`, 'Will display a list of 120 branches starting from page 5 (skip first 400 branches) in the specified git repository');
|
|
33
|
+
exports.builder = builder;
|
|
33
34
|
//# sourceMappingURL=list.cmd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.cmd.js","sourceRoot":"","sources":["../../../../src/bin/commands/root/list.cmd.ts"],"names":[],"mappings":";;;AAEA,8CAA2C;AAC9B,QAAA,OAAO,GAAG,MAAM,CAAA;AAChB,QAAA,IAAI,GAAG,uCAAuC,CAAA;AAC9C,QAAA,KAAK,GAAG,qCAAqC,CAAA;
|
|
1
|
+
{"version":3,"file":"list.cmd.js","sourceRoot":"","sources":["../../../../src/bin/commands/root/list.cmd.ts"],"names":[],"mappings":";;;AAEA,8CAA2C;AAC9B,QAAA,OAAO,GAAG,MAAM,CAAA;AAChB,QAAA,IAAI,GAAG,uCAAuC,CAAA;AAC9C,QAAA,KAAK,GAAG,qCAAqC,CAAA;AAEnD,MAAM,OAAO,GAAG,CAAC,KAAW,EAAE,EAAE,CAAC,KAAK;KACxC,UAAU,CAAC,SAAS,EAAE;IACnB,UAAU,EAAE,CAAE,QAAQ,EAAE,QAAQ,CAAE;CACrC,CAAC;KACD,aAAa,CAAC,CAAC,EAAE,IAAA,kBAAQ,EAAA,gCAAgC,CAAC;KAC1D,MAAM,CAAC,QAAQ,EAAE;IACd,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,qCAAqC;IAC/C,kBAAkB,EAAE,eAAe;IACnC,IAAI,EAAE,QAAQ;CACjB,CAAC;KACD,MAAM,CAAC,OAAO,EAAE;IACb,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,wCAAwC;IAClD,kBAAkB,EAAE,UAAU;IAC9B,IAAI,EAAE,QAAQ;CACjB,CAAC;KACD,MAAM,CAAC,MAAM,EAAE;IACZ,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,sFAAsF;IAChG,kBAAkB,EAAE,YAAY;IAChC,IAAI,EAAE,QAAQ;CACjB,CAAC;KACD,OAAO,CACJ,MAAM,eAAO,sCAAsC,EACnD,qEAAqE,CACxE;KACA,OAAO,CACJ,MAAM,eAAO,kDAAkD,EAC/D,oHAAoH,CACvH,CAAA;AA9BQ,QAAA,OAAO,WA8Bf"}
|
package/lib/bin/index.js
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
4
|
if (k2 === undefined) k2 = k;
|
|
5
|
-
Object.
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
6
10
|
}) : (function(o, m, k, k2) {
|
|
7
11
|
if (k2 === undefined) k2 = k;
|
|
8
12
|
o[k2] = m[k];
|
|
@@ -15,7 +19,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
19
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
16
20
|
if (mod && mod.__esModule) return mod;
|
|
17
21
|
var result = {};
|
|
18
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
19
23
|
__setModuleDefault(result, mod);
|
|
20
24
|
return result;
|
|
21
25
|
};
|
|
@@ -30,7 +34,7 @@ process.on('unhandledRejection', helpers_1.exitWithError);
|
|
|
30
34
|
.env('CF_')
|
|
31
35
|
.option('git-context', {
|
|
32
36
|
description: 'The git-context object in json format',
|
|
33
|
-
demand: helpers_1.errormsg `must provide "git-context" object as a json object (may be encoded in base64)`,
|
|
37
|
+
demand: (0, helpers_1.errormsg) `must provide "git-context" object as a json object (may be encoded in base64)`,
|
|
34
38
|
})
|
|
35
39
|
.option('insecure', {
|
|
36
40
|
alias: ['i'],
|
|
@@ -48,12 +52,12 @@ process.on('unhandledRejection', helpers_1.exitWithError);
|
|
|
48
52
|
})
|
|
49
53
|
.middleware([async (argv) => {
|
|
50
54
|
const gitContext = argv.gitContext;
|
|
51
|
-
const [getProviderErr, provider] = await helpers_1.to(__1.getProviderByContext(gitContext, {
|
|
55
|
+
const [getProviderErr, provider] = await (0, helpers_1.to)((0, __1.getProviderByContext)(gitContext, {
|
|
52
56
|
insecure: argv.insecure,
|
|
53
57
|
timeout: argv.timeout,
|
|
54
58
|
}));
|
|
55
59
|
if (getProviderErr) {
|
|
56
|
-
helpers_1.exitWithError(`invalid provider: ${getProviderErr}`);
|
|
60
|
+
(0, helpers_1.exitWithError)(`invalid provider: ${getProviderErr}`);
|
|
57
61
|
}
|
|
58
62
|
argv.provider = provider;
|
|
59
63
|
}])
|
|
@@ -62,7 +66,7 @@ process.on('unhandledRejection', helpers_1.exitWithError);
|
|
|
62
66
|
.commandDir('commands/root', {
|
|
63
67
|
extensions: ['cmd.js', 'cmd.ts'],
|
|
64
68
|
})
|
|
65
|
-
.demandCommand(1, helpers_1.errormsg `need to use at least one command`)
|
|
69
|
+
.demandCommand(1, (0, helpers_1.errormsg) `need to use at least one command`)
|
|
66
70
|
.scriptName('cgp')
|
|
67
71
|
.version()
|
|
68
72
|
.argv;
|
package/lib/bin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6CAA8B;AAE9B,wCAAyE;AACzE,2BAAoD;AAEpD,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,uBAAa,CAAC,CAAA;AAC9C,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,uBAAa,CAAC,CAAC;AAEhD,CAAC,KAAK,IAAI,EAAE;IACR,OAAO,KAAK;SACP,GAAG,CAAC,KAAK,CAAC;SACV,MAAM,CAAC,aAAa,EAAE;QACnB,WAAW,EAAE,uCAAuC;QACpD,MAAM,EAAE,IAAA,kBAAQ,EAAA,+EAA+E;KAClG,CAAC;SACD,MAAM,CAAC,UAAU,EAAE;QAChB,KAAK,EAAE,CAAE,GAAG,CAAE;QACd,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,yDAAyD;QACtE,OAAO,EAAE,KAAK;KACjB,CAAC;SACD,MAAM,CAAC,SAAS,EAAE;QACf,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,sBAAsB;QACnC,OAAO,EAAE,KAAK;KACjB,CAAC;SACD,MAAM,CAAC;QACJ,aAAa,EAAE,yBAAe;KACjC,CAAC;SACD,UAAU,CAAC,CAAE,KAAK,EAAC,IAAqB,EAAE,EAAE;YACzC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAiB,CAAA;YACzC,MAAM,CAAE,cAAc,EAAE,QAAQ,CAAE,GAAG,MAAM,IAAA,YAAE,EAAC,IAAA,wBAAoB,EAAC,UAAU,EAAE;gBAC3E,QAAQ,EAAE,IAAI,CAAC,QAAmB;gBAClC,OAAO,EAAE,IAAI,CAAC,OAAiB;aAClC,CAAC,CAAoB,CAAA;YACtB,IAAI,cAAc,EAAE;gBAChB,IAAA,uBAAa,EAAC,qBAAqB,cAAc,EAAE,CAAC,CAAA;aACvD;YACD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QAC5B,CAAC,CAAE,CAAC;SACH,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;SAC1C,KAAK,CAAC,+BAA+B,CAAC;SACtC,UAAU,CAAC,eAAe,EAAE;QACzB,UAAU,EAAE,CAAE,QAAQ,EAAE,QAAQ,CAAE;KACrC,CAAC;SACD,aAAa,CAAC,CAAC,EAAE,IAAA,kBAAQ,EAAA,kCAAkC,CAAC;SAC5D,UAAU,CAAC,KAAK,CAAC;SACjB,OAAO,EAAE;SACT,IAAI,CAAA;AACb,CAAC,CAAC,EAAE,CAAA"}
|
|
@@ -48,7 +48,7 @@ async function execRetryTestWithMock(client, retries, retryErrorCode, reqMock, s
|
|
|
48
48
|
numOfExpectedExecutions = retryConfig[0].retryCount + 1;
|
|
49
49
|
}
|
|
50
50
|
const opts = { owner: '~joe', repo: 'some-repo', ref: 'master', path: 'some-path', retryConfig: retryConfig };
|
|
51
|
-
const result = await index_1.to(client.fetchRawFile(opts));
|
|
51
|
+
const result = await (0, index_1.to)(client.fetchRawFile(opts));
|
|
52
52
|
return [result, opts, numOfExpectedExecutions];
|
|
53
53
|
}
|
|
54
54
|
exports.execRetryTestWithMock = execRetryTestWithMock;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry-test-helper.js","sourceRoot":"","sources":["../../../src/helpers/__test_helpers__/retry-test-helper.ts"],"names":[],"mappings":";;;AAAA,oCAA6B;AAG7B,8DAA8D;AAC9D,MAAM,OAAO,GAAG,O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interface Logger {
|
|
|
12
12
|
export declare const createNewLogger: (namespace: string) => Logger;
|
|
13
13
|
export declare const writeResultsToFile: (fileName: string, data: string) => Promise<void>;
|
|
14
14
|
export declare const createProgress: (resourceName: string, total: number, refreshMs?: number) => {
|
|
15
|
-
tick: (n?: number
|
|
15
|
+
tick: (n?: number) => void;
|
|
16
16
|
};
|
|
17
17
|
export declare const assertPatWritePermission: (url: string, auth: GitAuth) => Promise<void>;
|
|
18
18
|
export declare const cleanEncodedFilePath: (filepath: string, { preserveSlashes }?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAM5C,eAAO,MAAM,EAAE,OAAc,GAAG,mBAY/B,CAAA;AAED,eAAO,MAAM,QAAQ,QAAS,oBAAoB,GAAG,MAAM,KAAG,MAE7D,CAAA;AAED,eAAO,MAAM,aAAa,QAAS,oBAAoB,GAAG,MAAM,UAI/D,CAAA;AAED,eAAO,MAAM,eAAe,kBAAmB,MAAM,KAAG,GAYvD,CAAA;AAED,UAAU,MAAM;IACZ,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IACzB,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IACzB,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IAC1B,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,eAAe,cAAe,MAAM,KAAG,MAQnD,CAAA;AAED,eAAO,MAAM,kBAAkB,aAAoB,MAAM,QAAQ,MAAM,kBAKtE,CAAA;AAED,eAAO,MAAM,cAAc,iBAAkB,MAAM,SAAS,MAAM;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAM5C,eAAO,MAAM,EAAE,OAAc,GAAG,mBAY/B,CAAA;AAED,eAAO,MAAM,QAAQ,QAAS,oBAAoB,GAAG,MAAM,KAAG,MAE7D,CAAA;AAED,eAAO,MAAM,aAAa,QAAS,oBAAoB,GAAG,MAAM,UAI/D,CAAA;AAED,eAAO,MAAM,eAAe,kBAAmB,MAAM,KAAG,GAYvD,CAAA;AAED,UAAU,MAAM;IACZ,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IACzB,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IACzB,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IAC1B,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,eAAe,cAAe,MAAM,KAAG,MAQnD,CAAA;AAED,eAAO,MAAM,kBAAkB,aAAoB,MAAM,QAAQ,MAAM,kBAKtE,CAAA;AAED,eAAO,MAAM,cAAc,iBAAkB,MAAM,SAAS,MAAM;eAAiC,MAAM,KAAK,IAAI;CAoBjH,CAAA;AAED,eAAO,MAAM,wBAAwB,QAAe,MAAM,QAAQ,OAAO,kBA6BxE,CAAA;AAOD,eAAO,MAAM,oBAAoB,aACnB,MAAM;;MAEjB,MAKF,CAAA;AAED,eAAO,MAAM,cAAc,QAAS,MAAM,KAAG,MAE5C,CAAA;AAED,eAAO,MAAM,YAAY,QAAS,GAAG,YAOpC,CAAA"}
|
package/lib/helpers/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
14
18
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
19
|
if (mod && mod.__esModule) return mod;
|
|
16
20
|
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
22
|
__setModuleDefault(result, mod);
|
|
19
23
|
return result;
|
|
20
24
|
};
|
|
@@ -33,7 +37,7 @@ const nodefs = __importStar(require("fs"));
|
|
|
33
37
|
const fs_1 = require("fs");
|
|
34
38
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
35
39
|
const CFError = require('cf-errors');
|
|
36
|
-
|
|
40
|
+
const to = async (fn) => {
|
|
37
41
|
try {
|
|
38
42
|
let res;
|
|
39
43
|
if (typeof fn === 'function') {
|
|
@@ -48,15 +52,18 @@ exports.to = async (fn) => {
|
|
|
48
52
|
return [error, null];
|
|
49
53
|
}
|
|
50
54
|
};
|
|
51
|
-
exports.
|
|
52
|
-
|
|
55
|
+
exports.to = to;
|
|
56
|
+
const errormsg = (msg) => {
|
|
57
|
+
return (0, chalk_1.red) `error: ` + msg;
|
|
53
58
|
};
|
|
54
|
-
exports.
|
|
55
|
-
|
|
59
|
+
exports.errormsg = errormsg;
|
|
60
|
+
const exitWithError = (msg) => {
|
|
61
|
+
console.error((0, exports.errormsg)(msg));
|
|
56
62
|
// eslint-disable-next-line unicorn/no-process-exit
|
|
57
63
|
process.exit(1);
|
|
58
64
|
};
|
|
59
|
-
exports.
|
|
65
|
+
exports.exitWithError = exitWithError;
|
|
66
|
+
const parseGitContext = (gitContextStr) => {
|
|
60
67
|
const isBase64 = /^([\d+/A-Za-z]{4})*([\d+/A-Za-z]{3}=|[\d+/A-Za-z]{2}==)?$/;
|
|
61
68
|
if (isBase64.test(gitContextStr)) {
|
|
62
69
|
gitContextStr = Buffer.from(gitContextStr, 'base64').toString('utf-8');
|
|
@@ -66,11 +73,12 @@ exports.parseGitContext = (gitContextStr) => {
|
|
|
66
73
|
return gitContext;
|
|
67
74
|
}
|
|
68
75
|
catch (error) {
|
|
69
|
-
exports.exitWithError(`could not parse git context json, with error ${error}`);
|
|
76
|
+
(0, exports.exitWithError)(`could not parse git context json, with error ${error}`);
|
|
70
77
|
}
|
|
71
78
|
};
|
|
72
|
-
exports.
|
|
73
|
-
|
|
79
|
+
exports.parseGitContext = parseGitContext;
|
|
80
|
+
const createNewLogger = (namespace) => {
|
|
81
|
+
const logger = (0, debug_1.default)(namespace);
|
|
74
82
|
return {
|
|
75
83
|
info: (msg) => logger('[%s] level: %s, msg: %s', new Date().toISOString(), 'info', msg),
|
|
76
84
|
warn: (msg) => logger('[%s] level: %s, msg: %s', new Date().toISOString(), 'warn', msg),
|
|
@@ -78,13 +86,15 @@ exports.createNewLogger = (namespace) => {
|
|
|
78
86
|
error: (msg) => logger('[%s] level: %s, msg: %s', new Date().toISOString(), 'error', msg),
|
|
79
87
|
};
|
|
80
88
|
};
|
|
81
|
-
exports.
|
|
82
|
-
|
|
89
|
+
exports.createNewLogger = createNewLogger;
|
|
90
|
+
const writeResultsToFile = async (fileName, data) => {
|
|
91
|
+
const [writeErr] = await (0, exports.to)(async () => (0, fs_1.writeFileSync)(fileName, data));
|
|
83
92
|
if (writeErr) {
|
|
84
|
-
exports.exitWithError(`failed to write result to file ${fileName}", ${writeErr}`);
|
|
93
|
+
(0, exports.exitWithError)(`failed to write result to file ${fileName}", ${writeErr}`);
|
|
85
94
|
}
|
|
86
95
|
};
|
|
87
|
-
exports.
|
|
96
|
+
exports.writeResultsToFile = writeResultsToFile;
|
|
97
|
+
const createProgress = (resourceName, total, refreshMs = 200) => {
|
|
88
98
|
const progressBar = new progress_1.default(`fetching ${resourceName} (:current/:total) [:bar] :percent eta=:etas elapsed=:elapsed`, {
|
|
89
99
|
total,
|
|
90
100
|
complete: '=',
|
|
@@ -102,11 +112,12 @@ exports.createProgress = (resourceName, total, refreshMs = 200) => {
|
|
|
102
112
|
};
|
|
103
113
|
return { tick: makeTick }; // return a simple interface
|
|
104
114
|
};
|
|
105
|
-
exports.
|
|
106
|
-
|
|
115
|
+
exports.createProgress = createProgress;
|
|
116
|
+
const assertPatWritePermission = async (url, auth) => {
|
|
117
|
+
const tag = `write-check-${(0, uuid_1.v4)()}`;
|
|
107
118
|
const dir = `/tmp/${tag}`;
|
|
108
119
|
// create tmp dir if doesnt exist
|
|
109
|
-
const [accessErr] = await exports.to(nodefs.promises.access(dir, nodefs.constants.F_OK));
|
|
120
|
+
const [accessErr] = await (0, exports.to)(nodefs.promises.access(dir, nodefs.constants.F_OK));
|
|
110
121
|
if (accessErr) {
|
|
111
122
|
await nodefs.promises.mkdir(dir, { recursive: true });
|
|
112
123
|
}
|
|
@@ -128,20 +139,23 @@ exports.assertPatWritePermission = async (url, auth) => {
|
|
|
128
139
|
}
|
|
129
140
|
}
|
|
130
141
|
};
|
|
142
|
+
exports.assertPatWritePermission = assertPatWritePermission;
|
|
131
143
|
const removePrefixIfExists = (prefix, filepath) => {
|
|
132
144
|
const hasPrefix = filepath.indexOf(prefix) === 0;
|
|
133
145
|
return hasPrefix ? filepath.slice(prefix.length) : filepath;
|
|
134
146
|
};
|
|
135
|
-
|
|
147
|
+
const cleanEncodedFilePath = (filepath, { preserveSlashes } = {}) => {
|
|
136
148
|
const path = removePrefixIfExists('./', filepath);
|
|
137
149
|
return preserveSlashes
|
|
138
150
|
? path.split('/').map(substr => encodeURIComponent(substr)).join('/')
|
|
139
151
|
: encodeURIComponent(path);
|
|
140
152
|
};
|
|
141
|
-
exports.
|
|
153
|
+
exports.cleanEncodedFilePath = cleanEncodedFilePath;
|
|
154
|
+
const cleanUrlPrefix = (url) => {
|
|
142
155
|
return url.startsWith('/') ? url.slice(1) : url;
|
|
143
156
|
};
|
|
144
|
-
exports.
|
|
157
|
+
exports.cleanUrlPrefix = cleanUrlPrefix;
|
|
158
|
+
const isJsonString = (str) => {
|
|
145
159
|
try {
|
|
146
160
|
JSON.parse(str);
|
|
147
161
|
}
|
|
@@ -150,4 +164,5 @@ exports.isJsonString = (str) => {
|
|
|
150
164
|
}
|
|
151
165
|
return true;
|
|
152
166
|
};
|
|
167
|
+
exports.isJsonString = isJsonString;
|
|
153
168
|
//# sourceMappingURL=index.js.map
|
package/lib/helpers/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA2B;AAC3B,kDAA6B;AAC7B,wDAAkC;AAClC,oDAAqC;AACrC,+DAAgD;AAChD,+BAAmC;AAEnC,2CAA4B;AAC5B,2BAAkC;AAIlC,8DAA8D;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;AAE7B,MAAM,EAAE,GAAG,KAAK,EAAE,EAAO,EAAE,EAAE;IAChC,IAAI;QACA,IAAI,GAAG,CAAA;QACP,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE;YAC1B,GAAG,GAAG,MAAM,EAAE,EAAE,CAAA;SACnB;aAAM;YACH,GAAG,GAAG,MAAM,EAAE,CAAA;SACjB;QACD,OAAO,CAAE,IAAI,EAAE,GAAG,CAAE,CAAA;KACvB;IAAC,OAA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