bdy 1.19.2-dev-pipeline → 1.19.2-dev
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/distTs/package.json +1 -1
- package/distTs/src/api/client.js +2 -103
- package/distTs/src/command/pipeline/run.js +125 -22
- package/distTs/src/command/pipeline.js +0 -23
- package/distTs/src/command/project/get.js +18 -0
- package/distTs/src/command/project/link.js +11 -11
- package/distTs/src/command/project/set.js +31 -0
- package/distTs/src/command/sandbox/get/yaml.js +30 -0
- package/distTs/src/command/vt/scrape.js +193 -0
- package/distTs/src/input.js +31 -14
- package/distTs/src/output.js +31 -149
- package/distTs/src/texts.js +34 -84
- package/distTs/src/tunnel/output/interactive/tunnel.js +2 -2
- package/package.json +1 -1
- package/distTs/src/command/crawl/link.js +0 -61
- package/distTs/src/command/crawl/run.js +0 -147
- package/distTs/src/command/crawl/validation.js +0 -154
- package/distTs/src/command/crawl.js +0 -13
- package/distTs/src/command/pipeline/create.js +0 -45
- package/distTs/src/command/pipeline/get.js +0 -42
- package/distTs/src/command/pipeline/list.js +0 -43
- package/distTs/src/command/pipeline/run/apply.js +0 -62
- package/distTs/src/command/pipeline/run/approve.js +0 -62
- package/distTs/src/command/pipeline/run/cancel.js +0 -36
- package/distTs/src/command/pipeline/run/list.js +0 -52
- package/distTs/src/command/pipeline/run/logs.js +0 -37
- package/distTs/src/command/pipeline/run/retry.js +0 -36
- package/distTs/src/command/pipeline/run/start.js +0 -96
- package/distTs/src/command/pipeline/run/status.js +0 -35
- package/distTs/src/command/pipeline/update.js +0 -41
- package/distTs/src/command/pipeline/yaml.js +0 -38
- package/distTs/src/command/tests/capture/validation.js +0 -46
- package/distTs/src/command/tests/capture.js +0 -103
- package/distTs/src/command/tests/unit/link.js +0 -61
- package/distTs/src/command/tests/unit/upload.js +0 -91
- package/distTs/src/command/tests/unit.js +0 -13
- package/distTs/src/command/tests/visual/link.js +0 -61
- package/distTs/src/command/tests/visual/session/close.js +0 -32
- package/distTs/src/command/tests/visual/session/create.js +0 -86
- package/distTs/src/command/tests/visual/session.js +0 -13
- package/distTs/src/command/tests/visual/setup.js +0 -20
- package/distTs/src/command/tests/visual/shared/validation.js +0 -145
- package/distTs/src/command/tests/visual/upload.js +0 -141
- package/distTs/src/command/tests/visual.js +0 -17
- package/distTs/src/command/tests.js +0 -15
- package/distTs/src/crawl/requests.js +0 -141
- package/distTs/src/output/pipeline.js +0 -1527
- package/distTs/src/types/crawl.js +0 -2
- package/distTs/src/types/pipeline.js +0 -424
- package/distTs/src/unitTest/context.js +0 -26
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.validateInputAndOptions = validateInputAndOptions;
|
|
7
|
-
const zod_1 = require("zod");
|
|
8
|
-
const output_1 = __importDefault(require("../../output"));
|
|
9
|
-
const validation_1 = require("../tests/visual/shared/validation");
|
|
10
|
-
const urlSchema = zod_1.z.string().url().optional();
|
|
11
|
-
const browserSchema = zod_1.z.enum(['chrome', 'firefox', 'safari']);
|
|
12
|
-
const browsersListSchema = zod_1.z
|
|
13
|
-
.string()
|
|
14
|
-
.transform((value) => value
|
|
15
|
-
.split(',')
|
|
16
|
-
.map((browser) => browser.trim().toLowerCase())
|
|
17
|
-
.filter((browser) => browser.length > 0))
|
|
18
|
-
.refine((browsers) => browsers.length > 0, {
|
|
19
|
-
message: 'Invalid browsers list. Supported values: chrome,firefox,safari',
|
|
20
|
-
})
|
|
21
|
-
.pipe(zod_1.z.array(browserSchema))
|
|
22
|
-
.transform((browsers) => Array.from(new Set(browsers.map((browser) => browser === 'chrome'
|
|
23
|
-
? 'CHROMIUM'
|
|
24
|
-
: browser === 'firefox'
|
|
25
|
-
? 'FIREFOX'
|
|
26
|
-
: 'WEBKIT'))));
|
|
27
|
-
const optionsSchema = zod_1.z.object({
|
|
28
|
-
follow: zod_1.z.boolean(),
|
|
29
|
-
respectRobots: zod_1.z.boolean().optional(),
|
|
30
|
-
outputType: zod_1.z.enum(['jpeg', 'png', 'md', 'html']).optional(),
|
|
31
|
-
outputTypes: zod_1.z.string().optional(),
|
|
32
|
-
quality: zod_1.z.coerce.number().min(1).max(100).optional(),
|
|
33
|
-
outputDir: zod_1.z.string().default('.'),
|
|
34
|
-
fullPage: zod_1.z.boolean().optional(),
|
|
35
|
-
cssSelector: zod_1.z.string().optional(),
|
|
36
|
-
xpathSelector: zod_1.z.string().optional(),
|
|
37
|
-
colorScheme: zod_1.z.enum(['LIGHT', 'DARK', 'LIGHT_AND_DARK']).optional(),
|
|
38
|
-
browsers: browsersListSchema.optional(),
|
|
39
|
-
devices: zod_1.z.string().optional(),
|
|
40
|
-
delay: validation_1.delaySchema,
|
|
41
|
-
waitFor: validation_1.waitForSchema,
|
|
42
|
-
cookie: validation_1.cookieSchema,
|
|
43
|
-
header: validation_1.headerSchema,
|
|
44
|
-
localStorage: zod_1.z
|
|
45
|
-
.array(zod_1.z.string().regex(/^(?:([^:]+)::)?([^=]+)=(.*)$/, {
|
|
46
|
-
message: "LocalStorage option must follow pattern '[scope::]key=value' (scope is optional)",
|
|
47
|
-
}))
|
|
48
|
-
.optional()
|
|
49
|
-
.transform((value) => value?.map((v) => {
|
|
50
|
-
const { scope, key, value } = (0, validation_1.parseScopedKeyValue)(v);
|
|
51
|
-
return { scope, key, value };
|
|
52
|
-
})),
|
|
53
|
-
});
|
|
54
|
-
function validateInputAndOptions(input, options) {
|
|
55
|
-
try {
|
|
56
|
-
const url = urlSchema.parse(input);
|
|
57
|
-
const { follow, respectRobots, outputType, outputTypes: rawOutputTypes, quality, outputDir, fullPage, cssSelector, xpathSelector, colorScheme, browsers: parsedBrowsers, devices: rawDevices, delay, waitFor, cookie, header, localStorage, } = optionsSchema.parse(options);
|
|
58
|
-
let parsedOutputTypes;
|
|
59
|
-
if (rawOutputTypes) {
|
|
60
|
-
try {
|
|
61
|
-
const outputTypeEntrySchema = zod_1.z.array(zod_1.z
|
|
62
|
-
.object({
|
|
63
|
-
type: zod_1.z.string().transform((v) => v.toUpperCase()),
|
|
64
|
-
selector: zod_1.z
|
|
65
|
-
.object({
|
|
66
|
-
type: zod_1.z.enum(['CSS', 'XPATH']).optional(),
|
|
67
|
-
value: zod_1.z.string().optional(),
|
|
68
|
-
})
|
|
69
|
-
.optional(),
|
|
70
|
-
quality: zod_1.z.number().min(1).max(100).optional(),
|
|
71
|
-
fullPage: zod_1.z.boolean().optional(),
|
|
72
|
-
})
|
|
73
|
-
.transform((data) => ({
|
|
74
|
-
...data,
|
|
75
|
-
type: data.type,
|
|
76
|
-
})));
|
|
77
|
-
parsedOutputTypes = outputTypeEntrySchema.parse(JSON.parse(rawOutputTypes));
|
|
78
|
-
}
|
|
79
|
-
catch {
|
|
80
|
-
output_1.default.exitError("Invalid --outputTypes value. Use JSON array, e.g. --outputTypes '[{\"type\":\"png\"},{\"type\":\"jpeg\",\"quality\":80}]'");
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
else if (outputType) {
|
|
84
|
-
if (typeof quality === 'number' && outputType !== 'jpeg') {
|
|
85
|
-
output_1.default.exitError('Quality is only supported for jpeg output type, use --outputType jpeg');
|
|
86
|
-
}
|
|
87
|
-
if (cssSelector && xpathSelector) {
|
|
88
|
-
output_1.default.exitError('Only one of --cssSelector or --xpathSelector can be used');
|
|
89
|
-
}
|
|
90
|
-
const entry = {
|
|
91
|
-
type: outputType.toUpperCase(),
|
|
92
|
-
};
|
|
93
|
-
if (cssSelector) {
|
|
94
|
-
entry.selector = { type: 'CSS', value: cssSelector };
|
|
95
|
-
}
|
|
96
|
-
else if (xpathSelector) {
|
|
97
|
-
entry.selector = { type: 'XPATH', value: xpathSelector };
|
|
98
|
-
}
|
|
99
|
-
if (typeof quality === 'number') {
|
|
100
|
-
entry.quality = quality;
|
|
101
|
-
}
|
|
102
|
-
if (fullPage) {
|
|
103
|
-
entry.fullPage = fullPage;
|
|
104
|
-
}
|
|
105
|
-
parsedOutputTypes = [entry];
|
|
106
|
-
}
|
|
107
|
-
let parsedDevices;
|
|
108
|
-
if (rawDevices) {
|
|
109
|
-
try {
|
|
110
|
-
const dimensionSchema = zod_1.z
|
|
111
|
-
.string()
|
|
112
|
-
.regex(/^\d+x\d+$/, 'Must be in format "widthxheight"')
|
|
113
|
-
.transform((val) => {
|
|
114
|
-
const [width, height] = val.split('x').map(Number);
|
|
115
|
-
return { width, height };
|
|
116
|
-
});
|
|
117
|
-
const deviceSchema = zod_1.z.array(zod_1.z.object({
|
|
118
|
-
name: zod_1.z.string().optional(),
|
|
119
|
-
viewport: dimensionSchema,
|
|
120
|
-
screen: dimensionSchema,
|
|
121
|
-
devicePixelRatio: zod_1.z.number().positive(),
|
|
122
|
-
isMobile: zod_1.z.boolean(),
|
|
123
|
-
}));
|
|
124
|
-
parsedDevices = deviceSchema.parse(JSON.parse(rawDevices));
|
|
125
|
-
}
|
|
126
|
-
catch {
|
|
127
|
-
output_1.default.exitError('Invalid --devices value. Use JSON array, e.g. --devices \'[{"viewport":"1920x1080","screen":"1920x1080","devicePixelRatio":1,"isMobile":false}]\'');
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return {
|
|
131
|
-
url,
|
|
132
|
-
follow,
|
|
133
|
-
respectRobots,
|
|
134
|
-
outputTypes: parsedOutputTypes,
|
|
135
|
-
outputDir,
|
|
136
|
-
colorScheme,
|
|
137
|
-
browsers: parsedBrowsers,
|
|
138
|
-
devices: parsedDevices,
|
|
139
|
-
cookies: cookie,
|
|
140
|
-
requestHeaders: header,
|
|
141
|
-
delays: delay ?? [],
|
|
142
|
-
waitForSelectors: waitFor,
|
|
143
|
-
localStorage,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
catch (error) {
|
|
147
|
-
if (error instanceof zod_1.ZodError) {
|
|
148
|
-
output_1.default.exitError(error.errors.map((e) => `${e.path}: ${e.message}`).join(', '));
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
throw error;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const utils_1 = require("../utils");
|
|
7
|
-
const texts_1 = require("../texts");
|
|
8
|
-
const run_1 = __importDefault(require("./crawl/run"));
|
|
9
|
-
const link_1 = __importDefault(require("./crawl/link"));
|
|
10
|
-
const commandCrawl = (0, utils_1.newCommand)('crawl', texts_1.DESC_COMMAND_CRAWL);
|
|
11
|
-
commandCrawl.addCommand(run_1.default);
|
|
12
|
-
commandCrawl.addCommand(link_1.default);
|
|
13
|
-
exports.default = commandCrawl;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const utils_1 = require("../../utils");
|
|
7
|
-
const texts_1 = require("../../texts");
|
|
8
|
-
const input_1 = __importDefault(require("../../input"));
|
|
9
|
-
const output_1 = __importDefault(require("../../output"));
|
|
10
|
-
const commandPipelineCreate = (0, utils_1.newCommand)('create', texts_1.DESC_COMMAND_PIPELINE_CREATE);
|
|
11
|
-
commandPipelineCreate.alias('add');
|
|
12
|
-
commandPipelineCreate.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
|
-
commandPipelineCreate.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
-
commandPipelineCreate.option('-n, --name <name>', texts_1.OPTION_PIPELINE_NAME);
|
|
15
|
-
commandPipelineCreate.option('-i, --identifier <identifier>', texts_1.OPTION_PIPELINE_IDENTIFIER);
|
|
16
|
-
commandPipelineCreate.option('--yaml <content|@path>', texts_1.OPTION_PIPELINE_YAML);
|
|
17
|
-
commandPipelineCreate.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_PIPELINE_CREATE}`);
|
|
18
|
-
commandPipelineCreate.action(async (options) => {
|
|
19
|
-
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
20
|
-
const project = input_1.default.restApiProject(options.project);
|
|
21
|
-
const client = input_1.default.restApiTokenClient();
|
|
22
|
-
const humanId = require('human-id').default;
|
|
23
|
-
const timestamp = Date.now().toString(36);
|
|
24
|
-
const baseName = humanId({ separator: '-', capitalize: false });
|
|
25
|
-
const defaultIdentifier = `${baseName}-${timestamp}`;
|
|
26
|
-
let body = {
|
|
27
|
-
name: options.name || options.identifier || baseName,
|
|
28
|
-
identifier: options.identifier || defaultIdentifier,
|
|
29
|
-
};
|
|
30
|
-
let result = await client.createPipeline(workspace, project, body);
|
|
31
|
-
if (options.yaml) {
|
|
32
|
-
const yaml = input_1.default.restApiYaml(options.yaml);
|
|
33
|
-
body = {
|
|
34
|
-
yaml: Buffer.from(yaml, 'utf8').toString('base64'),
|
|
35
|
-
};
|
|
36
|
-
await client.updatePipelineYml(workspace, project, result.id, body);
|
|
37
|
-
}
|
|
38
|
-
result = await client.getPipeline(workspace, project, result.id);
|
|
39
|
-
output_1.default.dim('Identifier: ', false);
|
|
40
|
-
output_1.default.cyan(result.identifier);
|
|
41
|
-
output_1.default.cyan(result.html_url);
|
|
42
|
-
output_1.default.green(texts_1.TXT_PIPELINE_CREATED);
|
|
43
|
-
output_1.default.exitNormal();
|
|
44
|
-
});
|
|
45
|
-
exports.default = commandPipelineCreate;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const utils_1 = require("../../utils");
|
|
7
|
-
const texts_1 = require("../../texts");
|
|
8
|
-
const input_1 = __importDefault(require("../../input"));
|
|
9
|
-
const output_1 = __importDefault(require("../../output"));
|
|
10
|
-
const commandPipelineGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_PIPELINE_GET);
|
|
11
|
-
commandPipelineGet.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
|
-
commandPipelineGet.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
-
commandPipelineGet.argument('<identifier>', texts_1.OPTION_PIPELINE_IDENTIFIER);
|
|
14
|
-
commandPipelineGet.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_PIPELINE_GET}`);
|
|
15
|
-
commandPipelineGet.action(async (identifier, options) => {
|
|
16
|
-
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
|
-
const project = input_1.default.restApiProject(options.project);
|
|
18
|
-
const client = input_1.default.restApiTokenClient();
|
|
19
|
-
const data = await client.getPipelineByIdentifier(workspace, project, identifier);
|
|
20
|
-
if (!data || !data.domain) {
|
|
21
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
22
|
-
}
|
|
23
|
-
if (!data.project_identifier) {
|
|
24
|
-
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
25
|
-
}
|
|
26
|
-
if (!data.pipeline_id) {
|
|
27
|
-
output_1.default.exitError(texts_1.ERR_PIPELINE_NOT_FOUND);
|
|
28
|
-
}
|
|
29
|
-
const pipeline = await client.getPipeline(workspace, project, data.pipeline_id);
|
|
30
|
-
const OutputPipeline = require('../../output/pipeline').default;
|
|
31
|
-
const table = [
|
|
32
|
-
['Field', 'Value'],
|
|
33
|
-
['Name', pipeline.name || '-'],
|
|
34
|
-
['Status', OutputPipeline.runStatusText(pipeline.last_execution_status || '-')],
|
|
35
|
-
['ID', String(pipeline.id || '-')],
|
|
36
|
-
['Identifier', pipeline.identifier || '-'],
|
|
37
|
-
['URL', pipeline.html_url || '-'],
|
|
38
|
-
];
|
|
39
|
-
output_1.default.table(table);
|
|
40
|
-
output_1.default.exitNormal();
|
|
41
|
-
});
|
|
42
|
-
exports.default = commandPipelineGet;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const utils_1 = require("../../utils");
|
|
7
|
-
const texts_1 = require("../../texts");
|
|
8
|
-
const input_1 = __importDefault(require("../../input"));
|
|
9
|
-
const output_1 = __importDefault(require("../../output"));
|
|
10
|
-
const commandPipelineList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_PIPELINE_LIST);
|
|
11
|
-
commandPipelineList.alias('ls');
|
|
12
|
-
commandPipelineList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
|
-
commandPipelineList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
-
commandPipelineList.option('--page <number>', texts_1.OPTION_REST_API_PAGE, '1');
|
|
15
|
-
commandPipelineList.option('--per-page <number>', texts_1.OPTION_REST_API_PER_PAGE, '10');
|
|
16
|
-
commandPipelineList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_PIPELINE_LIST}`);
|
|
17
|
-
commandPipelineList.action(async (options) => {
|
|
18
|
-
const page = input_1.default.restApiPage(options.page);
|
|
19
|
-
const perPage = input_1.default.restApiPerPage(options.perPage);
|
|
20
|
-
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
21
|
-
const project = input_1.default.restApiProject(options.project);
|
|
22
|
-
const client = input_1.default.restApiTokenClient();
|
|
23
|
-
const r = await client.getPipelines(workspace, project, page, perPage);
|
|
24
|
-
if (!r.pipelines.length) {
|
|
25
|
-
output_1.default.exitError(texts_1.ERR_PIPELINES_NOT_FOUND);
|
|
26
|
-
}
|
|
27
|
-
const data = [
|
|
28
|
-
['NAME', 'STATUS', 'ID', 'IDENTIFIER', 'URL']
|
|
29
|
-
];
|
|
30
|
-
const OutputPipeline = require('../../output/pipeline').default;
|
|
31
|
-
for (const pipeline of r.pipelines) {
|
|
32
|
-
data.push([
|
|
33
|
-
pipeline.name || '-',
|
|
34
|
-
OutputPipeline.runStatusText(pipeline.last_execution_status || '-'),
|
|
35
|
-
String(pipeline.id || '-'),
|
|
36
|
-
pipeline.identifier || '-',
|
|
37
|
-
pipeline.html_url || '-',
|
|
38
|
-
]);
|
|
39
|
-
}
|
|
40
|
-
output_1.default.table(data);
|
|
41
|
-
output_1.default.exitNormal();
|
|
42
|
-
});
|
|
43
|
-
exports.default = commandPipelineList;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const utils_1 = require("../../../utils");
|
|
7
|
-
const texts_1 = require("../../../texts");
|
|
8
|
-
const input_1 = __importDefault(require("../../../input"));
|
|
9
|
-
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const pipeline_1 = require("../../../types/pipeline");
|
|
11
|
-
const commandPipelineRunApply = (0, utils_1.newCommand)('apply', texts_1.DESC_COMMAND_PIPELINE_RUN_APPLY);
|
|
12
|
-
commandPipelineRunApply.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
|
-
commandPipelineRunApply.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
-
commandPipelineRunApply.option('-n, --no-wait', texts_1.OPTION_PIPELINE_RUN_NO_WAIT);
|
|
15
|
-
commandPipelineRunApply.argument('<identifier>', texts_1.OPTION_PIPELINE_RUN_ARGUMENT);
|
|
16
|
-
commandPipelineRunApply.argument('<run-id>', texts_1.OPTION_PIPELINE_RUN_ID);
|
|
17
|
-
commandPipelineRunApply.argument('<run-action-id>', texts_1.OPTION_PIPELINE_RUN_ACTION_ID);
|
|
18
|
-
commandPipelineRunApply.option('-v,--variable <variables...>', texts_1.OPTION_PIPELINE_RUN_VAR);
|
|
19
|
-
commandPipelineRunApply.addHelpText('after', texts_1.EXAMPLE_PIPELINE_RUN_APPLY);
|
|
20
|
-
commandPipelineRunApply.action(async (identifier, runId, runActionId, options) => {
|
|
21
|
-
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
22
|
-
const project = input_1.default.restApiProject(options.project);
|
|
23
|
-
const rid = input_1.default.pipelineRunId(runId);
|
|
24
|
-
const variables = input_1.default.pipelineRunVariable(options.variable || [], false);
|
|
25
|
-
const client = input_1.default.restApiTokenClient();
|
|
26
|
-
const data = await client.getPipelineByIdentifier(workspace, project, identifier);
|
|
27
|
-
if (!data || !data.domain) {
|
|
28
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
29
|
-
}
|
|
30
|
-
if (!data.project_identifier) {
|
|
31
|
-
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
32
|
-
}
|
|
33
|
-
if (!data.pipeline_id) {
|
|
34
|
-
output_1.default.exitError(texts_1.ERR_PIPELINE_NOT_FOUND);
|
|
35
|
-
}
|
|
36
|
-
const a = await client.getPipelineRunActionExecution(workspace, project, data.pipeline_id, rid, runActionId);
|
|
37
|
-
let type;
|
|
38
|
-
if (a.status === pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_APPLY) {
|
|
39
|
-
type = 'APPLY';
|
|
40
|
-
}
|
|
41
|
-
else if (a.status === pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_VT_SESSION) {
|
|
42
|
-
type = 'APPROVE_VT';
|
|
43
|
-
}
|
|
44
|
-
else if (a.status === pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_VARIABLES) {
|
|
45
|
-
type = 'APPLY_VARIABLES';
|
|
46
|
-
}
|
|
47
|
-
else if (a.status === pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_SETTABLE_VARIABLES) {
|
|
48
|
-
type = 'SET_VARIABLES';
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
output_1.default.exitError(texts_1.ERR_CANT_APPLY_ACTION_EXECUTION);
|
|
52
|
-
}
|
|
53
|
-
const body = {
|
|
54
|
-
operation: type,
|
|
55
|
-
approve_action_id: runActionId,
|
|
56
|
-
variables,
|
|
57
|
-
};
|
|
58
|
-
await client.pipelineRunApply(workspace, project, data.pipeline_id, rid, body);
|
|
59
|
-
const OutputPipeline = require('../../../output/pipeline').default;
|
|
60
|
-
await OutputPipeline.runStatus(client, workspace, project, data.pipeline_id, rid, !options.wait);
|
|
61
|
-
});
|
|
62
|
-
exports.default = commandPipelineRunApply;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const utils_1 = require("../../../utils");
|
|
7
|
-
const texts_1 = require("../../../texts");
|
|
8
|
-
const input_1 = __importDefault(require("../../../input"));
|
|
9
|
-
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const pipeline_1 = require("../../../types/pipeline");
|
|
11
|
-
const commandPipelineRunApprove = (0, utils_1.newCommand)('approve', texts_1.DESC_COMMAND_PIPELINE_RUN_APPLY);
|
|
12
|
-
commandPipelineRunApprove.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
|
-
commandPipelineRunApprove.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
-
commandPipelineRunApprove.option('-n, --no-wait', texts_1.OPTION_PIPELINE_RUN_NO_WAIT);
|
|
15
|
-
commandPipelineRunApprove.argument('<identifier>', texts_1.OPTION_PIPELINE_IDENTIFIER);
|
|
16
|
-
commandPipelineRunApprove.argument('<run-id>', texts_1.OPTION_PIPELINE_RUN_ID);
|
|
17
|
-
commandPipelineRunApprove.argument('<run-action-id>', texts_1.OPTION_PIPELINE_RUN_ACTION_ID);
|
|
18
|
-
commandPipelineRunApprove.option('-v,--variable <variables...>', texts_1.OPTION_PIPELINE_RUN_VAR);
|
|
19
|
-
commandPipelineRunApprove.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_PIPELINE_RUN_APPLY}`);
|
|
20
|
-
commandPipelineRunApprove.action(async (identifier, runId, runActionId, options) => {
|
|
21
|
-
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
22
|
-
const project = input_1.default.restApiProject(options.project);
|
|
23
|
-
const rid = input_1.default.pipelineRunId(runId);
|
|
24
|
-
const variables = input_1.default.pipelineRunVariable(options.variable || [], false);
|
|
25
|
-
const client = input_1.default.restApiTokenClient();
|
|
26
|
-
const data = await client.getPipelineByIdentifier(workspace, project, identifier);
|
|
27
|
-
if (!data || !data.domain) {
|
|
28
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
29
|
-
}
|
|
30
|
-
if (!data.project_identifier) {
|
|
31
|
-
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
32
|
-
}
|
|
33
|
-
if (!data.pipeline_id) {
|
|
34
|
-
output_1.default.exitError(texts_1.ERR_PIPELINE_NOT_FOUND);
|
|
35
|
-
}
|
|
36
|
-
const a = await client.getPipelineRunActionExecution(workspace, project, data.pipeline_id, rid, runActionId);
|
|
37
|
-
let type;
|
|
38
|
-
if (a.status === pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_APPLY) {
|
|
39
|
-
type = 'APPLY';
|
|
40
|
-
}
|
|
41
|
-
else if (a.status === pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_VT_SESSION) {
|
|
42
|
-
type = 'APPROVE_VT';
|
|
43
|
-
}
|
|
44
|
-
else if (a.status === pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_VARIABLES) {
|
|
45
|
-
type = 'APPLY_VARIABLES';
|
|
46
|
-
}
|
|
47
|
-
else if (a.status === pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_SETTABLE_VARIABLES) {
|
|
48
|
-
type = 'SET_VARIABLES';
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
output_1.default.exitError(texts_1.ERR_CANT_APPLY_ACTION_EXECUTION);
|
|
52
|
-
}
|
|
53
|
-
const body = {
|
|
54
|
-
operation: type,
|
|
55
|
-
approve_action_id: runActionId,
|
|
56
|
-
variables,
|
|
57
|
-
};
|
|
58
|
-
await client.pipelineRunApply(workspace, project, data.pipeline_id, rid, body);
|
|
59
|
-
const OutputPipeline = require('../../../output/pipeline').default;
|
|
60
|
-
await OutputPipeline.runStatus(client, workspace, project, data.pipeline_id, rid, !options.wait);
|
|
61
|
-
});
|
|
62
|
-
exports.default = commandPipelineRunApprove;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const utils_1 = require("../../../utils");
|
|
7
|
-
const texts_1 = require("../../../texts");
|
|
8
|
-
const input_1 = __importDefault(require("../../../input"));
|
|
9
|
-
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandPipelineRunCancel = (0, utils_1.newCommand)('cancel', texts_1.DESC_COMMAND_PIPELINE_RUN_CANCEL);
|
|
11
|
-
commandPipelineRunCancel.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
|
-
commandPipelineRunCancel.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
-
commandPipelineRunCancel.option('-n, --no-wait', texts_1.OPTION_PIPELINE_RUN_NO_WAIT);
|
|
14
|
-
commandPipelineRunCancel.argument('<identifier>', texts_1.OPTION_PIPELINE_IDENTIFIER);
|
|
15
|
-
commandPipelineRunCancel.argument('<run-id>', texts_1.OPTION_PIPELINE_RUN_ID);
|
|
16
|
-
commandPipelineRunCancel.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_PIPELINE_RUN_CANCEL}`);
|
|
17
|
-
commandPipelineRunCancel.action(async (identifier, runId, options) => {
|
|
18
|
-
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
|
-
const project = input_1.default.restApiProject(options.project);
|
|
20
|
-
const client = input_1.default.restApiTokenClient();
|
|
21
|
-
const rid = input_1.default.pipelineRunId(runId);
|
|
22
|
-
const data = await client.getPipelineByIdentifier(workspace, project, identifier);
|
|
23
|
-
if (!data || !data.domain) {
|
|
24
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
25
|
-
}
|
|
26
|
-
if (!data.project_identifier) {
|
|
27
|
-
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
28
|
-
}
|
|
29
|
-
if (!data.pipeline_id) {
|
|
30
|
-
output_1.default.exitError(texts_1.ERR_PIPELINE_NOT_FOUND);
|
|
31
|
-
}
|
|
32
|
-
await client.pipelineRunCancel(workspace, project, data.pipeline_id, rid);
|
|
33
|
-
const OutputPipeline = require('../../../output/pipeline').default;
|
|
34
|
-
await OutputPipeline.runStatus(client, workspace, project, data.pipeline_id, rid, !options.wait);
|
|
35
|
-
});
|
|
36
|
-
exports.default = commandPipelineRunCancel;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const utils_1 = require("../../../utils");
|
|
7
|
-
const texts_1 = require("../../../texts");
|
|
8
|
-
const input_1 = __importDefault(require("../../../input"));
|
|
9
|
-
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandPipelineRunList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_PIPELINE_RUN_LIST);
|
|
11
|
-
commandPipelineRunList.alias('ls');
|
|
12
|
-
commandPipelineRunList.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
|
-
commandPipelineRunList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
-
commandPipelineRunList.option('--page <number>', texts_1.OPTION_REST_API_PAGE, '1');
|
|
15
|
-
commandPipelineRunList.option('--per-page <number>', texts_1.OPTION_REST_API_PER_PAGE, '10');
|
|
16
|
-
commandPipelineRunList.argument('<identifier>', texts_1.OPTION_PIPELINE_IDENTIFIER);
|
|
17
|
-
commandPipelineRunList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_PIPELINE_RUN_LIST}`);
|
|
18
|
-
commandPipelineRunList.action(async (identifier, options) => {
|
|
19
|
-
const page = input_1.default.restApiPage(options.page);
|
|
20
|
-
const perPage = input_1.default.restApiPerPage(options.perPage);
|
|
21
|
-
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
22
|
-
const project = input_1.default.restApiProject(options.project);
|
|
23
|
-
const client = input_1.default.restApiTokenClient();
|
|
24
|
-
const data = await client.getPipelineByIdentifier(workspace, project, identifier);
|
|
25
|
-
if (!data || !data.domain) {
|
|
26
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
27
|
-
}
|
|
28
|
-
if (!data.project_identifier) {
|
|
29
|
-
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
30
|
-
}
|
|
31
|
-
if (!data.pipeline_id) {
|
|
32
|
-
output_1.default.exitError(texts_1.ERR_PIPELINE_NOT_FOUND);
|
|
33
|
-
}
|
|
34
|
-
const result = await client.getPipelineRuns(workspace, project, data.pipeline_id, page, perPage);
|
|
35
|
-
if (!result.executions.length) {
|
|
36
|
-
output_1.default.exitError(texts_1.ERR_PIPELINE_RUNS_NOT_FOUND);
|
|
37
|
-
}
|
|
38
|
-
const OutputPipeline = require('../../../output/pipeline').default;
|
|
39
|
-
const table = [['ID', 'STATUS', 'STARTED', 'FINISHED', 'URL']];
|
|
40
|
-
for (const run of result.executions) {
|
|
41
|
-
table.push([
|
|
42
|
-
String(run.id),
|
|
43
|
-
OutputPipeline.runStatusText(run.status),
|
|
44
|
-
run.start_date || '-',
|
|
45
|
-
run.finish_date || '-',
|
|
46
|
-
run.html_url,
|
|
47
|
-
]);
|
|
48
|
-
}
|
|
49
|
-
output_1.default.table(table);
|
|
50
|
-
output_1.default.exitNormal('');
|
|
51
|
-
});
|
|
52
|
-
exports.default = commandPipelineRunList;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const utils_1 = require("../../../utils");
|
|
7
|
-
const texts_1 = require("../../../texts");
|
|
8
|
-
const input_1 = __importDefault(require("../../../input"));
|
|
9
|
-
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandPipelineRunLogs = (0, utils_1.newCommand)('logs', texts_1.DESC_COMMAND_PIPELINE_RUN_LOGS);
|
|
11
|
-
commandPipelineRunLogs.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
|
-
commandPipelineRunLogs.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
-
commandPipelineRunLogs.option('-n, --no-wait', texts_1.OPTION_PIPELINE_RUN_NO_WAIT);
|
|
14
|
-
commandPipelineRunLogs.argument('<identifier>', texts_1.OPTION_PIPELINE_IDENTIFIER);
|
|
15
|
-
commandPipelineRunLogs.argument('<run-id>', texts_1.OPTION_PIPELINE_RUN_ID);
|
|
16
|
-
commandPipelineRunLogs.argument('<run-action-id>', texts_1.OPTION_PIPELINE_RUN_ACTION_ID);
|
|
17
|
-
commandPipelineRunLogs.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_PIPELINE_RUN_LOGS}`);
|
|
18
|
-
commandPipelineRunLogs.action(async (identifier, runId, runActionId, options) => {
|
|
19
|
-
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
20
|
-
const project = input_1.default.restApiProject(options.project);
|
|
21
|
-
const client = input_1.default.restApiTokenClient();
|
|
22
|
-
const rid = input_1.default.pipelineRunId(runId);
|
|
23
|
-
const raid = input_1.default.pipelineRunActionId(runActionId);
|
|
24
|
-
const data = await client.getPipelineByIdentifier(workspace, project, identifier);
|
|
25
|
-
if (!data || !data.domain) {
|
|
26
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
27
|
-
}
|
|
28
|
-
if (!data.project_identifier) {
|
|
29
|
-
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
30
|
-
}
|
|
31
|
-
if (!data.pipeline_id) {
|
|
32
|
-
output_1.default.exitError(texts_1.ERR_PIPELINE_NOT_FOUND);
|
|
33
|
-
}
|
|
34
|
-
const OutputPipeline = require('../../../output/pipeline').default;
|
|
35
|
-
await OutputPipeline.runLogs(client, workspace, project, data.pipeline_id, rid, raid, !options.wait);
|
|
36
|
-
});
|
|
37
|
-
exports.default = commandPipelineRunLogs;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const utils_1 = require("../../../utils");
|
|
7
|
-
const texts_1 = require("../../../texts");
|
|
8
|
-
const input_1 = __importDefault(require("../../../input"));
|
|
9
|
-
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandPipelineRunRetry = (0, utils_1.newCommand)('retry', texts_1.DESC_COMMAND_PIPELINE_RUN_RETRY);
|
|
11
|
-
commandPipelineRunRetry.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
12
|
-
commandPipelineRunRetry.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
13
|
-
commandPipelineRunRetry.option('-n, --no-wait', texts_1.OPTION_PIPELINE_RUN_NO_WAIT);
|
|
14
|
-
commandPipelineRunRetry.argument('<identifier>', texts_1.OPTION_PIPELINE_IDENTIFIER);
|
|
15
|
-
commandPipelineRunRetry.argument('<run-id>', texts_1.OPTION_PIPELINE_RUN_ID);
|
|
16
|
-
commandPipelineRunRetry.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_PIPELINE_RUN_RETRY}`);
|
|
17
|
-
commandPipelineRunRetry.action(async (identifier, runId, options) => {
|
|
18
|
-
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
|
-
const project = input_1.default.restApiProject(options.project);
|
|
20
|
-
const client = input_1.default.restApiTokenClient();
|
|
21
|
-
const rid = input_1.default.pipelineRunId(runId);
|
|
22
|
-
const data = await client.getPipelineByIdentifier(workspace, project, identifier);
|
|
23
|
-
if (!data || !data.domain) {
|
|
24
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
25
|
-
}
|
|
26
|
-
if (!data.project_identifier) {
|
|
27
|
-
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
28
|
-
}
|
|
29
|
-
if (!data.pipeline_id) {
|
|
30
|
-
output_1.default.exitError(texts_1.ERR_PIPELINE_NOT_FOUND);
|
|
31
|
-
}
|
|
32
|
-
await client.pipelineRunRetry(workspace, project, data.pipeline_id, rid);
|
|
33
|
-
const OutputPipeline = require('../../../output/pipeline').default;
|
|
34
|
-
await OutputPipeline.runStatus(client, workspace, project, data.pipeline_id, rid, !options.wait);
|
|
35
|
-
});
|
|
36
|
-
exports.default = commandPipelineRunRetry;
|