@copado/agentia-cli 0.112.0-alpha.0 → 0.113.0-alpha.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/README.md +1965 -410
- package/dist/commands/testing/build/abort.d.ts +7 -1
- package/dist/commands/testing/build/abort.js +13 -3
- package/dist/commands/testing/build/abort.js.map +1 -1
- package/dist/commands/testing/build/get.d.ts +18 -0
- package/dist/commands/testing/build/get.js +38 -0
- package/dist/commands/testing/build/get.js.map +1 -0
- package/dist/commands/testing/build/latest.d.ts +12 -0
- package/dist/commands/testing/build/latest.js +40 -0
- package/dist/commands/testing/build/latest.js.map +1 -0
- package/dist/commands/testing/build/list.d.ts +6 -1
- package/dist/commands/testing/build/list.js +23 -1
- package/dist/commands/testing/build/list.js.map +1 -1
- package/dist/commands/testing/build/logs.d.ts +6 -0
- package/dist/commands/testing/build/logs.js +8 -1
- package/dist/commands/testing/build/logs.js.map +1 -1
- package/dist/commands/testing/build/run.d.ts +27 -4
- package/dist/commands/testing/build/run.js +4 -18
- package/dist/commands/testing/build/run.js.map +1 -1
- package/dist/commands/testing/build/search.d.ts +21 -0
- package/dist/commands/testing/build/search.js +57 -0
- package/dist/commands/testing/build/search.js.map +1 -0
- package/dist/commands/testing/create.d.ts +1 -15
- package/dist/commands/testing/create.js +1 -43
- package/dist/commands/testing/create.js.map +1 -1
- package/dist/commands/testing/data-table/create.d.ts +30 -0
- package/dist/commands/testing/data-table/create.js +52 -0
- package/dist/commands/testing/data-table/create.js.map +1 -0
- package/dist/commands/testing/data-table/delete.d.ts +25 -0
- package/dist/commands/testing/data-table/delete.js +40 -0
- package/dist/commands/testing/data-table/delete.js.map +1 -0
- package/dist/commands/testing/data-table/export.d.ts +33 -0
- package/dist/commands/testing/data-table/export.js +59 -0
- package/dist/commands/testing/data-table/export.js.map +1 -0
- package/dist/commands/testing/data-table/get.d.ts +21 -0
- package/dist/commands/testing/data-table/get.js +35 -0
- package/dist/commands/testing/data-table/get.js.map +1 -0
- package/dist/commands/testing/data-table/list.d.ts +16 -0
- package/dist/commands/testing/data-table/list.js +33 -0
- package/dist/commands/testing/data-table/list.js.map +1 -0
- package/dist/commands/testing/data-table/update.d.ts +34 -0
- package/dist/commands/testing/data-table/update.js +64 -0
- package/dist/commands/testing/data-table/update.js.map +1 -0
- package/dist/commands/testing/job/create.d.ts +18 -0
- package/dist/commands/testing/job/create.js +60 -4
- package/dist/commands/testing/job/create.js.map +1 -1
- package/dist/commands/testing/job/delete.d.ts +6 -1
- package/dist/commands/testing/job/delete.js +13 -3
- package/dist/commands/testing/job/delete.js.map +1 -1
- package/dist/commands/testing/job/refs.d.ts +17 -0
- package/dist/commands/testing/job/refs.js +30 -0
- package/dist/commands/testing/job/refs.js.map +1 -0
- package/dist/commands/testing/job/schedule/get.d.ts +23 -0
- package/dist/commands/testing/job/schedule/get.js +31 -0
- package/dist/commands/testing/job/schedule/get.js.map +1 -0
- package/dist/commands/testing/job/schedule/remove.d.ts +24 -0
- package/dist/commands/testing/job/schedule/remove.js +34 -0
- package/dist/commands/testing/job/schedule/remove.js.map +1 -0
- package/dist/commands/testing/job/schedule/set.d.ts +23 -0
- package/dist/commands/testing/job/schedule/set.js +39 -0
- package/dist/commands/testing/job/schedule/set.js.map +1 -0
- package/dist/commands/testing/job/update.d.ts +2 -0
- package/dist/commands/testing/job/update.js +7 -1
- package/dist/commands/testing/job/update.js.map +1 -1
- package/dist/commands/testing/job/upload.d.ts +6 -0
- package/dist/commands/testing/job/upload.js +22 -0
- package/dist/commands/testing/job/upload.js.map +1 -1
- package/dist/commands/testing/live/continue.d.ts +20 -0
- package/dist/commands/testing/live/continue.js +21 -0
- package/dist/commands/testing/live/continue.js.map +1 -0
- package/dist/commands/testing/live/execute.d.ts +30 -0
- package/dist/commands/testing/live/execute.js +43 -0
- package/dist/commands/testing/live/execute.js.map +1 -0
- package/dist/commands/testing/live/history.d.ts +23 -0
- package/dist/commands/testing/live/history.js +35 -0
- package/dist/commands/testing/live/history.js.map +1 -0
- package/dist/commands/testing/live/inspect.d.ts +18 -0
- package/dist/commands/testing/live/inspect.js +30 -0
- package/dist/commands/testing/live/inspect.js.map +1 -0
- package/dist/commands/testing/live/interrupt.d.ts +20 -0
- package/dist/commands/testing/live/interrupt.js +21 -0
- package/dist/commands/testing/live/interrupt.js.map +1 -0
- package/dist/commands/testing/live/recorder.d.ts +23 -0
- package/dist/commands/testing/live/recorder.js +134 -0
- package/dist/commands/testing/live/recorder.js.map +1 -0
- package/dist/commands/testing/live/reports.d.ts +20 -0
- package/dist/commands/testing/live/reports.js +31 -0
- package/dist/commands/testing/live/reports.js.map +1 -0
- package/dist/commands/testing/live/screenshot.d.ts +23 -0
- package/dist/commands/testing/live/screenshot.js +25 -0
- package/dist/commands/testing/live/screenshot.js.map +1 -0
- package/dist/commands/testing/live/set-options.d.ts +27 -0
- package/dist/commands/testing/live/set-options.js +28 -0
- package/dist/commands/testing/live/set-options.js.map +1 -0
- package/dist/commands/testing/live/start.d.ts +29 -0
- package/dist/commands/testing/live/start.js +53 -0
- package/dist/commands/testing/live/start.js.map +1 -0
- package/dist/commands/testing/live/status.d.ts +19 -0
- package/dist/commands/testing/live/status.js +27 -0
- package/dist/commands/testing/live/status.js.map +1 -0
- package/dist/commands/testing/live/stop.d.ts +24 -0
- package/dist/commands/testing/live/stop.js +38 -0
- package/dist/commands/testing/live/stop.js.map +1 -0
- package/dist/commands/testing/live/view.d.ts +16 -0
- package/dist/commands/testing/live/view.js +36 -0
- package/dist/commands/testing/live/view.js.map +1 -0
- package/dist/commands/testing/logs.d.ts +6 -0
- package/dist/commands/testing/logs.js +8 -1
- package/dist/commands/testing/logs.js.map +1 -1
- package/dist/commands/testing/project/create.d.ts +3 -0
- package/dist/commands/testing/project/create.js +17 -1
- package/dist/commands/testing/project/create.js.map +1 -1
- package/dist/commands/testing/project/delete.d.ts +7 -2
- package/dist/commands/testing/project/delete.js +15 -3
- package/dist/commands/testing/project/delete.js.map +1 -1
- package/dist/commands/testing/project/get.js +1 -1
- package/dist/commands/testing/project/get.js.map +1 -1
- package/dist/commands/testing/project/permission/get.d.ts +13 -0
- package/dist/commands/testing/project/permission/get.js +21 -0
- package/dist/commands/testing/project/permission/get.js.map +1 -0
- package/dist/commands/testing/project/permission/list.d.ts +13 -0
- package/dist/commands/testing/project/permission/list.js +21 -0
- package/dist/commands/testing/project/permission/list.js.map +1 -0
- package/dist/commands/testing/project/permission/set.d.ts +19 -0
- package/dist/commands/testing/project/permission/set.js +33 -0
- package/dist/commands/testing/project/permission/set.js.map +1 -0
- package/dist/commands/testing/project/permission/update.d.ts +19 -0
- package/dist/commands/testing/project/permission/update.js +33 -0
- package/dist/commands/testing/project/permission/update.js.map +1 -0
- package/dist/commands/testing/project/update.d.ts +14 -0
- package/dist/commands/testing/project/update.js +28 -0
- package/dist/commands/testing/project/update.js.map +1 -0
- package/dist/commands/testing/robot/create.d.ts +4 -1
- package/dist/commands/testing/robot/create.js +20 -5
- package/dist/commands/testing/robot/create.js.map +1 -1
- package/dist/commands/testing/robot/delete.d.ts +6 -1
- package/dist/commands/testing/robot/delete.js +13 -3
- package/dist/commands/testing/robot/delete.js.map +1 -1
- package/dist/commands/testing/robot/update.d.ts +19 -0
- package/dist/commands/testing/robot/update.js +49 -0
- package/dist/commands/testing/robot/update.js.map +1 -0
- package/dist/commands/testing/run.d.ts +27 -4
- package/dist/commands/testing/run.js +4 -11
- package/dist/commands/testing/run.js.map +1 -1
- package/dist/commands/testing/test/run.d.ts +27 -11
- package/dist/commands/testing/test/run.js +5 -37
- package/dist/commands/testing/test/run.js.map +1 -1
- package/dist/commands/testing/update.d.ts +6 -0
- package/dist/commands/testing/update.js +10 -0
- package/dist/commands/testing/update.js.map +1 -1
- package/dist/commands/testing/user-parameter/create.d.ts +19 -0
- package/dist/commands/testing/user-parameter/create.js +45 -0
- package/dist/commands/testing/user-parameter/create.js.map +1 -0
- package/dist/commands/testing/user-parameter/delete.d.ts +21 -0
- package/dist/commands/testing/user-parameter/delete.js +33 -0
- package/dist/commands/testing/user-parameter/delete.js.map +1 -0
- package/dist/commands/testing/user-parameter/get.d.ts +13 -0
- package/dist/commands/testing/user-parameter/get.js +21 -0
- package/dist/commands/testing/user-parameter/get.js.map +1 -0
- package/dist/commands/testing/user-parameter/list.d.ts +12 -0
- package/dist/commands/testing/user-parameter/list.js +23 -0
- package/dist/commands/testing/user-parameter/list.js.map +1 -0
- package/dist/commands/testing/user-parameter/update.d.ts +23 -0
- package/dist/commands/testing/user-parameter/update.js +45 -0
- package/dist/commands/testing/user-parameter/update.js.map +1 -0
- package/dist/commands/testing/variable/create.d.ts +6 -2
- package/dist/commands/testing/variable/create.js +14 -5
- package/dist/commands/testing/variable/create.js.map +1 -1
- package/dist/commands/testing/variable/delete.d.ts +6 -1
- package/dist/commands/testing/variable/delete.js +13 -3
- package/dist/commands/testing/variable/delete.js.map +1 -1
- package/dist/commands/testing/variable/get.d.ts +13 -0
- package/dist/commands/testing/variable/get.js +25 -0
- package/dist/commands/testing/variable/get.js.map +1 -0
- package/dist/commands/testing/variable/list.d.ts +4 -0
- package/dist/commands/testing/variable/list.js +15 -3
- package/dist/commands/testing/variable/list.js.map +1 -1
- package/dist/commands/testing/variable/update.d.ts +6 -2
- package/dist/commands/testing/variable/update.js +11 -5
- package/dist/commands/testing/variable/update.js.map +1 -1
- package/dist/lib/credential-store.d.ts +3 -0
- package/dist/lib/credential-store.js +16 -0
- package/dist/lib/credential-store.js.map +1 -1
- package/dist/lib/mcp/command-id.js +3 -0
- package/dist/lib/mcp/command-id.js.map +1 -1
- package/dist/lib/mcp/testing-live-tools.d.ts +126 -0
- package/dist/lib/mcp/testing-live-tools.js +215 -0
- package/dist/lib/mcp/testing-live-tools.js.map +1 -0
- package/dist/lib/mcp/testing-tools.d.ts +455 -9
- package/dist/lib/mcp/testing-tools.js +677 -37
- package/dist/lib/mcp/testing-tools.js.map +1 -1
- package/dist/lib/mcp/tools.d.ts +551 -14
- package/dist/lib/testing-config.d.ts +3 -0
- package/dist/lib/testing-config.js +9 -0
- package/dist/lib/testing-config.js.map +1 -1
- package/dist/lib/testing-confirmation.d.ts +14 -0
- package/dist/lib/testing-confirmation.js +17 -0
- package/dist/lib/testing-confirmation.js.map +1 -0
- package/dist/lib/testing-data-command.d.ts +21 -0
- package/dist/lib/testing-data-command.js +49 -0
- package/dist/lib/testing-data-command.js.map +1 -0
- package/dist/lib/testing-data-core.d.ts +22 -0
- package/dist/lib/testing-data-core.js +208 -0
- package/dist/lib/testing-data-core.js.map +1 -0
- package/dist/lib/testing-data-export.d.ts +1 -0
- package/dist/lib/testing-data-export.js +2 -0
- package/dist/lib/testing-data-export.js.map +1 -0
- package/dist/lib/testing-data-import.d.ts +1 -0
- package/dist/lib/testing-data-import.js +2 -0
- package/dist/lib/testing-data-import.js.map +1 -0
- package/dist/lib/testing-data-io.d.ts +21 -0
- package/dist/lib/testing-data-io.js +236 -0
- package/dist/lib/testing-data-io.js.map +1 -0
- package/dist/lib/testing-data-operations.d.ts +36 -0
- package/dist/lib/testing-data-operations.js +91 -0
- package/dist/lib/testing-data-operations.js.map +1 -0
- package/dist/lib/testing-data-types.d.ts +41 -0
- package/dist/lib/testing-data-types.js +3 -0
- package/dist/lib/testing-data-types.js.map +1 -0
- package/dist/lib/testing-flags.d.ts +62 -1
- package/dist/lib/testing-flags.js +177 -1
- package/dist/lib/testing-flags.js.map +1 -1
- package/dist/lib/testing-gateway.d.ts +17 -3
- package/dist/lib/testing-gateway.js +175 -45
- package/dist/lib/testing-gateway.js.map +1 -1
- package/dist/lib/testing-live-command.d.ts +24 -0
- package/dist/lib/testing-live-command.js +56 -0
- package/dist/lib/testing-live-command.js.map +1 -0
- package/dist/lib/testing-live-endpoints.d.ts +14 -0
- package/dist/lib/testing-live-endpoints.js +34 -0
- package/dist/lib/testing-live-endpoints.js.map +1 -0
- package/dist/lib/testing-live-history.d.ts +11 -0
- package/dist/lib/testing-live-history.js +96 -0
- package/dist/lib/testing-live-history.js.map +1 -0
- package/dist/lib/testing-live-operations.d.ts +118 -0
- package/dist/lib/testing-live-operations.js +676 -0
- package/dist/lib/testing-live-operations.js.map +1 -0
- package/dist/lib/testing-live-recorder.d.ts +14 -0
- package/dist/lib/testing-live-recorder.js +122 -0
- package/dist/lib/testing-live-recorder.js.map +1 -0
- package/dist/lib/testing-live-robot.d.ts +16 -0
- package/dist/lib/testing-live-robot.js +158 -0
- package/dist/lib/testing-live-robot.js.map +1 -0
- package/dist/lib/testing-live-state.d.ts +4 -0
- package/dist/lib/testing-live-state.js +90 -0
- package/dist/lib/testing-live-state.js.map +1 -0
- package/dist/lib/testing-live-types.d.ts +92 -0
- package/dist/lib/testing-live-types.js +2 -0
- package/dist/lib/testing-live-types.js.map +1 -0
- package/dist/lib/testing-operations.d.ts +157 -5
- package/dist/lib/testing-operations.js +829 -66
- package/dist/lib/testing-operations.js.map +1 -1
- package/dist/lib/testing-run-command.d.ts +25 -0
- package/dist/lib/testing-run-command.js +94 -0
- package/dist/lib/testing-run-command.js.map +1 -0
- package/dist/lib/testing-sanitization.d.ts +11 -0
- package/dist/lib/testing-sanitization.js +135 -0
- package/dist/lib/testing-sanitization.js.map +1 -0
- package/dist/lib/testing-schedule.d.ts +23 -0
- package/dist/lib/testing-schedule.js +48 -0
- package/dist/lib/testing-schedule.js.map +1 -0
- package/dist/lib/testing-secret-input.d.ts +12 -0
- package/dist/lib/testing-secret-input.js +56 -0
- package/dist/lib/testing-secret-input.js.map +1 -0
- package/dist/lib/testing-session.d.ts +8 -0
- package/dist/lib/testing-session.js +82 -0
- package/dist/lib/testing-session.js.map +1 -0
- package/dist/lib/testing-types.d.ts +143 -13
- package/dist/lib/testing-types.js +110 -5
- package/dist/lib/testing-types.js.map +1 -1
- package/dist/lib/testing-watch.d.ts +4 -0
- package/dist/lib/testing-watch.js +45 -0
- package/dist/lib/testing-watch.js.map +1 -0
- package/oclif.manifest.json +8354 -3760
- package/package.json +12 -1
- package/templates/skills/agentia-testing/SKILL.md +9 -6
- package/templates/skills/agentia-testing/references/tests.md +70 -36
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createReadStream, lstatSync, realpathSync, statSync } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
export const TESTING_SECRET_INPUT_MAX_BYTES = 1024 * 1024;
|
|
4
|
+
export async function resolveTestingSecretInput(input, options) {
|
|
5
|
+
if (input.trim === true && input.noTrim === true) {
|
|
6
|
+
throw new Error('Use either --trim or --no-trim, not both.');
|
|
7
|
+
}
|
|
8
|
+
const sourceCount = [input.value !== undefined, input.valueFile !== undefined, input.valueStdin === true].filter(Boolean).length;
|
|
9
|
+
if (sourceCount > 1) {
|
|
10
|
+
throw new Error('Use exactly one of --value, --value-file, or --value-stdin.');
|
|
11
|
+
}
|
|
12
|
+
if (sourceCount === 0) {
|
|
13
|
+
if (options.required)
|
|
14
|
+
throw new Error(`Provide --value, --value-file, or --value-stdin for ${options.label}.`);
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const raw = input.value ??
|
|
18
|
+
(input.valueFile === undefined
|
|
19
|
+
? await readBoundedStream(process.stdin, options.label)
|
|
20
|
+
: await readBoundedSecretFile(input.valueFile, options.label));
|
|
21
|
+
const value = input.noTrim === true ? raw : raw.trim();
|
|
22
|
+
if (Buffer.byteLength(value) > TESTING_SECRET_INPUT_MAX_BYTES) {
|
|
23
|
+
throw new Error(`${options.label} exceeds the ${TESTING_SECRET_INPUT_MAX_BYTES} byte safety limit.`);
|
|
24
|
+
}
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
async function readBoundedSecretFile(path, label) {
|
|
28
|
+
if (path.trim().length === 0 || path.includes('\0'))
|
|
29
|
+
throw new Error(`${label} file path is invalid.`);
|
|
30
|
+
const target = resolve(path);
|
|
31
|
+
const linkStat = lstatSync(target);
|
|
32
|
+
if (linkStat.isSymbolicLink())
|
|
33
|
+
throw new Error(`${label} file must not be a symbolic link.`);
|
|
34
|
+
const canonical = realpathSync(target);
|
|
35
|
+
const stat = statSync(canonical);
|
|
36
|
+
if (!stat.isFile())
|
|
37
|
+
throw new Error(`${label} file must be a regular file.`);
|
|
38
|
+
if (stat.size > TESTING_SECRET_INPUT_MAX_BYTES) {
|
|
39
|
+
throw new Error(`${label} exceeds the ${TESTING_SECRET_INPUT_MAX_BYTES} byte safety limit.`);
|
|
40
|
+
}
|
|
41
|
+
return readBoundedStream(createReadStream(canonical), label);
|
|
42
|
+
}
|
|
43
|
+
async function readBoundedStream(stream, label) {
|
|
44
|
+
const chunks = [];
|
|
45
|
+
let size = 0;
|
|
46
|
+
for await (const chunk of stream) {
|
|
47
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
48
|
+
size += bytes.length;
|
|
49
|
+
if (size > TESTING_SECRET_INPUT_MAX_BYTES) {
|
|
50
|
+
throw new Error(`${label} exceeds the ${TESTING_SECRET_INPUT_MAX_BYTES} byte safety limit.`);
|
|
51
|
+
}
|
|
52
|
+
chunks.push(bytes);
|
|
53
|
+
}
|
|
54
|
+
return Buffer.concat(chunks).toString('utf8');
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=testing-secret-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing-secret-input.js","sourceRoot":"","sources":["../../src/lib/testing-secret-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAA;AAC3E,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAEjC,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,GAAG,IAAI,CAAA;AAUzD,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,KAAyB,EACzB,OAA2C;IAE3C,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;QACjD,MAAM,IAAI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AG,KAAK,gBAAgB,8BAA8B,qBAAqB,CAAC,CAAA;QAC9F,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AAC/C,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type TestingGatewayCallOptions, type TestingRequest } from './testing-gateway.js';
|
|
2
|
+
export type TestingSession = {
|
|
3
|
+
readonly cookie: string;
|
|
4
|
+
readonly xsrfToken?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function exchangeTestingSession(options?: TestingGatewayCallOptions): Promise<TestingSession>;
|
|
7
|
+
export declare function parseTestingSession(response: unknown): TestingSession;
|
|
8
|
+
export declare function testingSessionAuth(session: TestingSession): NonNullable<TestingRequest['auth']>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { TestingGateway } from './testing-gateway.js';
|
|
2
|
+
export async function exchangeTestingSession(options = {}) {
|
|
3
|
+
const response = await TestingGateway.call({
|
|
4
|
+
endpoint: '/user/access-keys/tokens?toSign=all',
|
|
5
|
+
method: 'GET',
|
|
6
|
+
service: 'pace',
|
|
7
|
+
}, options);
|
|
8
|
+
return parseTestingSession(response);
|
|
9
|
+
}
|
|
10
|
+
export function parseTestingSession(response) {
|
|
11
|
+
const record = asRecord(response);
|
|
12
|
+
const fl = stringValue(record.FL, record.fl);
|
|
13
|
+
const sessionsToken = stringValue(record.sessionsToken, record.sessionToken);
|
|
14
|
+
const xsrf = parseXsrf(record.XSRF ?? record.xsrf);
|
|
15
|
+
if (fl === undefined || sessionsToken === undefined || xsrf.jwt === undefined) {
|
|
16
|
+
throw new Error('CRT session exchange returned incomplete credentials. Sign in to CRT again.');
|
|
17
|
+
}
|
|
18
|
+
assertHeaderPart(fl, 'FL');
|
|
19
|
+
assertHeaderPart(xsrf.jwt, 'XSRF');
|
|
20
|
+
assertHeaderPart(sessionsToken, 'sessions token');
|
|
21
|
+
if (xsrf.token !== undefined)
|
|
22
|
+
assertHeaderValue(xsrf.token, 'XSRF token');
|
|
23
|
+
return {
|
|
24
|
+
cookie: `FL=${fl}; XSRF-TOKEN=${xsrf.jwt}; sessionsToken=${sessionsToken}`,
|
|
25
|
+
xsrfToken: xsrf.token,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function testingSessionAuth(session) {
|
|
29
|
+
return {
|
|
30
|
+
cookie: session.cookie,
|
|
31
|
+
mode: 'session',
|
|
32
|
+
xsrfToken: session.xsrfToken,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function parseXsrf(value) {
|
|
36
|
+
if (typeof value === 'string') {
|
|
37
|
+
return { jwt: nonBlank(value), token: extractXsrfTokenClaim(value) };
|
|
38
|
+
}
|
|
39
|
+
const record = asRecord(value);
|
|
40
|
+
const jwt = stringValue(record.jwt, record.JWT, record.value, record.cookie);
|
|
41
|
+
const token = stringValue(record.token, record.xsrfToken, record['X-XSRF-TOKEN']) ?? extractXsrfTokenClaim(jwt);
|
|
42
|
+
return { jwt, token };
|
|
43
|
+
}
|
|
44
|
+
function extractXsrfTokenClaim(jwt) {
|
|
45
|
+
if (jwt === undefined)
|
|
46
|
+
return undefined;
|
|
47
|
+
const encoded = jwt.split('.')[1];
|
|
48
|
+
if (encoded === undefined)
|
|
49
|
+
return undefined;
|
|
50
|
+
try {
|
|
51
|
+
const payload = JSON.parse(Buffer.from(encoded, 'base64url').toString('utf8'));
|
|
52
|
+
return nonBlank(asRecord(payload).token);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function stringValue(...values) {
|
|
59
|
+
for (const value of values) {
|
|
60
|
+
const normalized = nonBlank(value);
|
|
61
|
+
if (normalized !== undefined)
|
|
62
|
+
return normalized;
|
|
63
|
+
}
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
function nonBlank(value) {
|
|
67
|
+
return typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;
|
|
68
|
+
}
|
|
69
|
+
function asRecord(value) {
|
|
70
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
71
|
+
}
|
|
72
|
+
function assertHeaderPart(value, label) {
|
|
73
|
+
assertHeaderValue(value, label);
|
|
74
|
+
if (value.includes(';'))
|
|
75
|
+
throw new Error(`CRT ${label} contains an invalid cookie delimiter.`);
|
|
76
|
+
}
|
|
77
|
+
function assertHeaderValue(value, label) {
|
|
78
|
+
if ([...value].some((character) => character.codePointAt(0) <= 31 || character.codePointAt(0) === 127)) {
|
|
79
|
+
throw new Error(`CRT ${label} contains invalid header characters.`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=testing-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing-session.js","sourceRoot":"","sources":["../../src/lib/testing-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAsD,MAAM,sBAAsB,CAAA;AASxG,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,UAAqC,EAAE;IAEvC,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,IAAI,CACxC;QACE,QAAQ,EAAE,qCAAqC;QAC/C,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,MAAM;KAChB,EACD,OAAO,CACR,CAAA;IACD,OAAO,mBAAmB,CAAC,QAAQ,CAAC,CAAA;AACtC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,QAAiB;IACnD,MAAM,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACjC,MAAM,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IAC5C,MAAM,aAAa,GAAG,WAAW,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,YAAY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S,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,KAAuB,CAAC,CAAC,CAAC,EAAE,CAAA;AAC7G,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa,EAAE,KAAa;IACpD,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IAC/B,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,OAAO,KAAK,wCAAwC,CAAC,CAAA;AAChG,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAa,EAAE,KAAa;IACrD,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAE,IAAI,EAAE,IAAI,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;QACxG,MAAM,IAAI,KAAK,CAAC,OAAO,KAAK,sCAAsC,CAAC,CAAA;IACrE,CAAC;AACH,CAAC"}
|
|
@@ -2,14 +2,28 @@ export declare const TESTING_BUILD_STATUSES: readonly ["aborted", "executing", "
|
|
|
2
2
|
export declare const TESTING_JOB_PARALLEL_MODES: readonly ["disabled", "enabled"];
|
|
3
3
|
export declare const TESTING_JOB_SUITE_TYPES: readonly ["bitbar", "browserstack", "browserstackdesktop", "default", "lambdatest", "lambdatestdesktop", "mobile", "paceconnectmobile", "privatemobile", "rpa", "selenese", "zap"];
|
|
4
4
|
export declare const TESTING_RECORD_BUILD_OPTIONS: readonly ["all", "failed", "none"];
|
|
5
|
+
export declare const TESTING_RUN_TYPES: readonly ["regression", "development"];
|
|
6
|
+
export declare const TESTING_CONSOLE_COLORS: readonly ["auto", "on", "ansi", "off"];
|
|
5
7
|
export declare const TESTING_VARIABLE_TYPES: readonly ["clp", "config", "dataset", "secret"];
|
|
6
8
|
export declare const TESTING_FILE_OPERATIONS: readonly ["add", "replace", "remove"];
|
|
9
|
+
export declare const TESTING_PROJECT_TYPES: readonly ["ta", "rpa"];
|
|
10
|
+
export declare const TESTING_PROJECT_EXECUTORS: readonly ["jenkins", "kubernetes"];
|
|
11
|
+
export declare const TESTING_ROBOT_RUN_ENVIRONMENTS: readonly ["cloud", "paceconnect", "QConnect"];
|
|
12
|
+
export declare const TESTING_ROBOT_TYPES: readonly ["bitbar", "browserstack", "browserstackdesktop", "default", "lambdatest", "lambdatestdesktop", "mobile", "pabot", "paceconnectmobile", "privatemobile"];
|
|
13
|
+
export declare const TESTING_ROBOT_REPORTING: readonly ["all", "nothing"];
|
|
7
14
|
export type TestingBuildStatus = (typeof TESTING_BUILD_STATUSES)[number];
|
|
8
15
|
export type TestingJobParallelMode = (typeof TESTING_JOB_PARALLEL_MODES)[number];
|
|
9
16
|
export type TestingJobSuiteType = (typeof TESTING_JOB_SUITE_TYPES)[number];
|
|
10
17
|
export type TestingRecordBuildOption = (typeof TESTING_RECORD_BUILD_OPTIONS)[number];
|
|
18
|
+
export type TestingRunType = (typeof TESTING_RUN_TYPES)[number];
|
|
19
|
+
export type TestingConsoleColors = (typeof TESTING_CONSOLE_COLORS)[number];
|
|
11
20
|
export type TestingVariableType = (typeof TESTING_VARIABLE_TYPES)[number];
|
|
12
21
|
export type TestingFileOperationName = (typeof TESTING_FILE_OPERATIONS)[number];
|
|
22
|
+
export type TestingProjectType = (typeof TESTING_PROJECT_TYPES)[number];
|
|
23
|
+
export type TestingProjectExecutor = (typeof TESTING_PROJECT_EXECUTORS)[number];
|
|
24
|
+
export type TestingRobotRunEnvironment = (typeof TESTING_ROBOT_RUN_ENVIRONMENTS)[number];
|
|
25
|
+
export type TestingRobotType = (typeof TESTING_ROBOT_TYPES)[number];
|
|
26
|
+
export type TestingRobotReporting = (typeof TESTING_ROBOT_REPORTING)[number];
|
|
13
27
|
export type TestingRecord = Record<string, unknown>;
|
|
14
28
|
export type TestingProject = TestingRecord & {
|
|
15
29
|
id?: number | string;
|
|
@@ -41,6 +55,21 @@ export type TestingVariable = TestingRecord & {
|
|
|
41
55
|
sensitive?: boolean;
|
|
42
56
|
value?: string;
|
|
43
57
|
};
|
|
58
|
+
export type TestingUserParameter = TestingRecord & {
|
|
59
|
+
id?: number | string;
|
|
60
|
+
key?: string;
|
|
61
|
+
sensitive?: boolean;
|
|
62
|
+
type?: string;
|
|
63
|
+
userId?: number;
|
|
64
|
+
value?: string;
|
|
65
|
+
};
|
|
66
|
+
export type TestingPermission = TestingRecord & {
|
|
67
|
+
edit?: boolean;
|
|
68
|
+
groupId?: number;
|
|
69
|
+
id?: number;
|
|
70
|
+
userId?: number;
|
|
71
|
+
view?: boolean;
|
|
72
|
+
};
|
|
44
73
|
export type TestingFileEntry = TestingRecord & {
|
|
45
74
|
encoding?: 'base64' | 'utf-8' | string;
|
|
46
75
|
path?: string;
|
|
@@ -62,26 +91,63 @@ export type TestingBranchOrTag = {
|
|
|
62
91
|
};
|
|
63
92
|
export type TestingFileUploadRequest = {
|
|
64
93
|
author: TestingAuthor;
|
|
94
|
+
commitMessage?: string;
|
|
65
95
|
operations: TestingFileOperation[];
|
|
96
|
+
parentCommitHash?: string;
|
|
66
97
|
};
|
|
67
98
|
export type TestingCreateProjectRequest = {
|
|
99
|
+
dashboardId?: number;
|
|
68
100
|
description?: string;
|
|
69
101
|
name: string;
|
|
70
|
-
|
|
102
|
+
projectExecutor?: TestingProjectExecutor;
|
|
103
|
+
projectType: TestingProjectType;
|
|
104
|
+
};
|
|
105
|
+
export type TestingProjectUpdateRequest = {
|
|
106
|
+
description?: string;
|
|
107
|
+
name?: string;
|
|
108
|
+
};
|
|
109
|
+
export type TestingPermissionRequest = {
|
|
110
|
+
edit?: boolean;
|
|
111
|
+
groupId?: number;
|
|
112
|
+
userId?: number;
|
|
113
|
+
view?: boolean;
|
|
71
114
|
};
|
|
72
115
|
export type TestingCreateRobotRequest = {
|
|
73
116
|
description: string;
|
|
74
|
-
fwVersion
|
|
117
|
+
fwVersion?: string;
|
|
118
|
+
label?: string;
|
|
75
119
|
name: string;
|
|
76
|
-
os
|
|
77
|
-
|
|
120
|
+
os?: string;
|
|
121
|
+
reporting?: TestingRobotReporting;
|
|
122
|
+
robotType?: TestingRobotType;
|
|
78
123
|
runEnvironment: 'cloud' | 'paceconnect';
|
|
79
124
|
};
|
|
125
|
+
export type TestingRobotUpdateRequest = {
|
|
126
|
+
description?: string;
|
|
127
|
+
fwVersion?: string;
|
|
128
|
+
label?: string;
|
|
129
|
+
name?: string;
|
|
130
|
+
reporting?: TestingRobotReporting;
|
|
131
|
+
robotType?: TestingRobotType;
|
|
132
|
+
};
|
|
80
133
|
export type TestingCreateJobRequest = {
|
|
134
|
+
analytics?: {
|
|
135
|
+
caseDurationChangeDetection?: boolean;
|
|
136
|
+
};
|
|
81
137
|
description?: string;
|
|
82
138
|
domainCredentialId?: string;
|
|
83
139
|
name: string;
|
|
140
|
+
parallelExecution?: TestingJobParallelMode;
|
|
141
|
+
screen?: {
|
|
142
|
+
depth: number;
|
|
143
|
+
height: number;
|
|
144
|
+
width: number;
|
|
145
|
+
};
|
|
146
|
+
showVideoParams?: boolean;
|
|
84
147
|
storage: TestingStorageRequest;
|
|
148
|
+
suiteType?: TestingJobSuiteType;
|
|
149
|
+
timeout?: string;
|
|
150
|
+
validation?: boolean;
|
|
85
151
|
};
|
|
86
152
|
export type TestingGitStorageRequest = {
|
|
87
153
|
branchOrTag: TestingBranchOrTag;
|
|
@@ -109,6 +175,19 @@ export type TestingCreateVariableRequest = {
|
|
|
109
175
|
userSpecific?: boolean;
|
|
110
176
|
value?: string;
|
|
111
177
|
};
|
|
178
|
+
export type TestingCreateUserParameterRequest = {
|
|
179
|
+
description?: string;
|
|
180
|
+
key: string;
|
|
181
|
+
keyIsUnique?: boolean;
|
|
182
|
+
sensitive?: boolean;
|
|
183
|
+
type?: 'parameter';
|
|
184
|
+
value: string;
|
|
185
|
+
};
|
|
186
|
+
export type TestingUserParameterUpdateRequest = {
|
|
187
|
+
description?: string;
|
|
188
|
+
key?: string;
|
|
189
|
+
value?: string;
|
|
190
|
+
};
|
|
112
191
|
export type TestingInputParameter = {
|
|
113
192
|
key: string;
|
|
114
193
|
sensitive?: boolean;
|
|
@@ -121,8 +200,46 @@ export type TestingBuildRunRequest = {
|
|
|
121
200
|
record?: TestingRecordBuildOption;
|
|
122
201
|
rerunFailedFromLatest?: boolean;
|
|
123
202
|
rerunFailedId?: number;
|
|
203
|
+
runType?: 'development' | 'normal';
|
|
124
204
|
tag?: string;
|
|
125
205
|
};
|
|
206
|
+
export type TestingSchedule = TestingRecord & {
|
|
207
|
+
record?: TestingRecordBuildOption;
|
|
208
|
+
schedule: string;
|
|
209
|
+
timezone?: string;
|
|
210
|
+
};
|
|
211
|
+
export type TestingBuildListOptions = {
|
|
212
|
+
page?: number;
|
|
213
|
+
pageSize?: number;
|
|
214
|
+
resultSize?: 'compact';
|
|
215
|
+
status?: TestingBuildStatus;
|
|
216
|
+
};
|
|
217
|
+
export type TestingBuildLogOptions = {
|
|
218
|
+
container?: string;
|
|
219
|
+
limitBytes?: number;
|
|
220
|
+
pretty?: boolean;
|
|
221
|
+
sinceSeconds?: number;
|
|
222
|
+
tailLines?: number;
|
|
223
|
+
timestamps?: boolean;
|
|
224
|
+
};
|
|
225
|
+
export type TestingBuildSearchOptions = {
|
|
226
|
+
count?: boolean;
|
|
227
|
+
from?: string;
|
|
228
|
+
jobId: number;
|
|
229
|
+
order?: 'asc' | 'desc';
|
|
230
|
+
page?: number;
|
|
231
|
+
pageSize?: number;
|
|
232
|
+
projectId: number;
|
|
233
|
+
robots?: string[];
|
|
234
|
+
runTypes?: TestingRunType[];
|
|
235
|
+
sort?: 'date' | 'duration' | 'id' | 'status';
|
|
236
|
+
statuses?: string[];
|
|
237
|
+
to?: string;
|
|
238
|
+
};
|
|
239
|
+
export type TestingBuildSearchResult = {
|
|
240
|
+
count: number;
|
|
241
|
+
runs: TestingBuild[];
|
|
242
|
+
};
|
|
126
243
|
export type TestingJobUpdateRequest = {
|
|
127
244
|
analytics?: {
|
|
128
245
|
caseDurationChangeDetection?: boolean;
|
|
@@ -150,14 +267,18 @@ export type TestingVariableUpdateRequest = {
|
|
|
150
267
|
value?: string;
|
|
151
268
|
};
|
|
152
269
|
export type TestingJobCreateResult = {
|
|
270
|
+
dryRun?: true;
|
|
153
271
|
filesUploaded: number;
|
|
154
272
|
job: TestingRecord;
|
|
155
273
|
jobId?: number | string;
|
|
156
274
|
projectId: number;
|
|
157
275
|
};
|
|
158
276
|
export type TestingBuildRunResult = {
|
|
159
|
-
body: TestingBuildRunRequest
|
|
277
|
+
body: Array<TestingBuildRunRequest & {
|
|
278
|
+
jobId: number;
|
|
279
|
+
}> | TestingBuildRunRequest;
|
|
160
280
|
build: unknown;
|
|
281
|
+
dataDriven?: boolean;
|
|
161
282
|
jobId: number;
|
|
162
283
|
projectId: number;
|
|
163
284
|
};
|
|
@@ -167,6 +288,7 @@ export type TestingLogResult = {
|
|
|
167
288
|
log: string;
|
|
168
289
|
output?: string;
|
|
169
290
|
projectId: number;
|
|
291
|
+
status?: string;
|
|
170
292
|
};
|
|
171
293
|
export type TestingDownloadResult = {
|
|
172
294
|
files: TestingFileEntry[];
|
|
@@ -176,29 +298,37 @@ export type TestingDownloadResult = {
|
|
|
176
298
|
response: unknown;
|
|
177
299
|
};
|
|
178
300
|
export declare function testingProjectsEndpoint(orgId: number): string;
|
|
301
|
+
export declare function testingProjectEndpoint(projectId: number | string): string;
|
|
302
|
+
export declare function testingProjectPermissionsEndpoint(projectId: number | string): string;
|
|
303
|
+
export declare function testingPermissionsEndpoint(projectId: number | string): string;
|
|
304
|
+
export declare function testingPermissionEndpoint(permissionId: number): string;
|
|
179
305
|
export declare function testingRobotsEndpoint(projectId: number): string;
|
|
180
306
|
export declare function testingRobotEndpoint(projectId: number, robotId: number | string): string;
|
|
181
307
|
export declare function testingJobsEndpoint(projectId: number): string;
|
|
182
308
|
export declare function testingJobEndpoint(projectId: number, jobId: number): string;
|
|
309
|
+
export declare function testingJobScheduleEndpoint(projectId: number, jobId: number): string;
|
|
183
310
|
export declare function testingRobotJobsEndpoint(projectId: number, robotId: number | string): string;
|
|
184
311
|
export declare function testingJobFilesEndpoint(projectId: number, jobId: number): string;
|
|
312
|
+
export declare function testingJobRefsEndpoint(projectId: number, jobId: number, sharedCredentials?: boolean): string;
|
|
185
313
|
export declare function testingJobFilesUploadEndpoint(projectId: number, jobId: number, branch?: string): string;
|
|
186
314
|
export declare function testingJobFilesDownloadEndpoint(projectId: number, jobId: number, branch?: string): string;
|
|
187
|
-
export declare function testingJobBuildsEndpoint(projectId: number, jobId: number, options?:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
export declare function testingProjectBuildsEndpoint(projectId: number, options?: {
|
|
192
|
-
resultSize?: 'compact';
|
|
193
|
-
status?: TestingBuildStatus;
|
|
315
|
+
export declare function testingJobBuildsEndpoint(projectId: number, jobId: number, options?: TestingBuildListOptions): string;
|
|
316
|
+
export declare function testingProjectBuildsEndpoint(projectId: number, options?: TestingBuildListOptions): string;
|
|
317
|
+
export declare function testingBuildEndpoint(projectId: number, jobId: number, buildId: number | string, options?: {
|
|
318
|
+
full?: boolean;
|
|
194
319
|
}): string;
|
|
195
|
-
export declare function testingBuildLogsEndpoint(projectId: number, jobId: number, buildId: number): string;
|
|
320
|
+
export declare function testingBuildLogsEndpoint(projectId: number, jobId: number, buildId: number, options?: TestingBuildLogOptions): string;
|
|
196
321
|
export declare function testingBuildAbortEndpoint(projectId: number, jobId: number, buildId: number): string;
|
|
197
322
|
export declare function testingProjectDeleteEndpoint(projectId: number): string;
|
|
198
323
|
export declare function testingVariablesEndpoint(projectId: number): string;
|
|
324
|
+
export declare function testingMetricsSearchEndpoint(orgId: number): string;
|
|
199
325
|
export declare function testingVariableEndpoint(projectId: number, variableId: string): string;
|
|
326
|
+
export declare function testingUserParametersEndpoint(): string;
|
|
327
|
+
export declare function testingUserParameterEndpoint(parameterId: number | string): string;
|
|
328
|
+
export declare function appendTestingQuery(endpoint: string, values: Record<string, boolean | number | string | undefined>): string;
|
|
200
329
|
export declare function normalizeTestingArray<T extends TestingRecord = TestingRecord>(response: unknown): T[];
|
|
201
330
|
export declare function normalizeTestingRecord<T extends TestingRecord = TestingRecord>(response: unknown): T;
|
|
331
|
+
export declare function normalizeTestingEnvelopeRecord<T extends TestingRecord = TestingRecord>(response: unknown): T;
|
|
202
332
|
export declare function normalizeTestingId(response: unknown): number | string | undefined;
|
|
203
333
|
export declare function normalizeDownloadedFiles(response: unknown): TestingFileEntry[];
|
|
204
334
|
export declare function listSnapshotZipEntries(snapshot: Buffer): TestingFileEntry[];
|
|
@@ -17,11 +17,41 @@ export const TESTING_JOB_SUITE_TYPES = [
|
|
|
17
17
|
'zap',
|
|
18
18
|
];
|
|
19
19
|
export const TESTING_RECORD_BUILD_OPTIONS = ['all', 'failed', 'none'];
|
|
20
|
+
export const TESTING_RUN_TYPES = ['regression', 'development'];
|
|
21
|
+
export const TESTING_CONSOLE_COLORS = ['auto', 'on', 'ansi', 'off'];
|
|
20
22
|
export const TESTING_VARIABLE_TYPES = ['clp', 'config', 'dataset', 'secret'];
|
|
21
23
|
export const TESTING_FILE_OPERATIONS = ['add', 'replace', 'remove'];
|
|
24
|
+
export const TESTING_PROJECT_TYPES = ['ta', 'rpa'];
|
|
25
|
+
export const TESTING_PROJECT_EXECUTORS = ['jenkins', 'kubernetes'];
|
|
26
|
+
export const TESTING_ROBOT_RUN_ENVIRONMENTS = ['cloud', 'paceconnect', 'QConnect'];
|
|
27
|
+
export const TESTING_ROBOT_TYPES = [
|
|
28
|
+
'bitbar',
|
|
29
|
+
'browserstack',
|
|
30
|
+
'browserstackdesktop',
|
|
31
|
+
'default',
|
|
32
|
+
'lambdatest',
|
|
33
|
+
'lambdatestdesktop',
|
|
34
|
+
'mobile',
|
|
35
|
+
'pabot',
|
|
36
|
+
'paceconnectmobile',
|
|
37
|
+
'privatemobile',
|
|
38
|
+
];
|
|
39
|
+
export const TESTING_ROBOT_REPORTING = ['all', 'nothing'];
|
|
22
40
|
export function testingProjectsEndpoint(orgId) {
|
|
23
41
|
return `/organizations/${orgId}/projects`;
|
|
24
42
|
}
|
|
43
|
+
export function testingProjectEndpoint(projectId) {
|
|
44
|
+
return `/projects/${projectId}`;
|
|
45
|
+
}
|
|
46
|
+
export function testingProjectPermissionsEndpoint(projectId) {
|
|
47
|
+
return `/projects/${projectId}/permissions`;
|
|
48
|
+
}
|
|
49
|
+
export function testingPermissionsEndpoint(projectId) {
|
|
50
|
+
return `/permissions/projects/${projectId}`;
|
|
51
|
+
}
|
|
52
|
+
export function testingPermissionEndpoint(permissionId) {
|
|
53
|
+
return `/permissions/${permissionId}`;
|
|
54
|
+
}
|
|
25
55
|
export function testingRobotsEndpoint(projectId) {
|
|
26
56
|
return `/pace/v4/projects/${projectId}/robots`;
|
|
27
57
|
}
|
|
@@ -34,12 +64,19 @@ export function testingJobsEndpoint(projectId) {
|
|
|
34
64
|
export function testingJobEndpoint(projectId, jobId) {
|
|
35
65
|
return `/pace/v4/projects/${projectId}/jobs/${jobId}`;
|
|
36
66
|
}
|
|
67
|
+
export function testingJobScheduleEndpoint(projectId, jobId) {
|
|
68
|
+
return `/pace/v4/projects/${projectId}/jobs/${jobId}/schedule`;
|
|
69
|
+
}
|
|
37
70
|
export function testingRobotJobsEndpoint(projectId, robotId) {
|
|
38
71
|
return `/pace/v4/projects/${projectId}/robots/${robotId}/jobs`;
|
|
39
72
|
}
|
|
40
73
|
export function testingJobFilesEndpoint(projectId, jobId) {
|
|
41
74
|
return `/pace/v4/projects/${projectId}/jobs/${jobId}/files`;
|
|
42
75
|
}
|
|
76
|
+
export function testingJobRefsEndpoint(projectId, jobId, sharedCredentials) {
|
|
77
|
+
const endpoint = `/pace/v4/projects/${projectId}/jobs/${jobId}/refs`;
|
|
78
|
+
return appendBooleanQuery(endpoint, 'sharedCredentials', sharedCredentials);
|
|
79
|
+
}
|
|
43
80
|
export function testingJobFilesUploadEndpoint(projectId, jobId, branch) {
|
|
44
81
|
const endpoint = `/pace/v4/projects/${projectId}/jobs/${jobId}/files/upload`;
|
|
45
82
|
return appendOptionalBranch(endpoint, branch);
|
|
@@ -54,29 +91,73 @@ export function testingJobBuildsEndpoint(projectId, jobId, options = {}) {
|
|
|
54
91
|
export function testingProjectBuildsEndpoint(projectId, options = {}) {
|
|
55
92
|
return appendBuildQuery(`/pace/v4/projects/${projectId}/builds`, options);
|
|
56
93
|
}
|
|
57
|
-
export function
|
|
58
|
-
|
|
94
|
+
export function testingBuildEndpoint(projectId, jobId, buildId, options = {}) {
|
|
95
|
+
const endpoint = `/pace/v4/projects/${projectId}/jobs/${jobId}/builds/${buildId}`;
|
|
96
|
+
return options.full === true ? endpoint : `${endpoint}?resultSize=compact`;
|
|
97
|
+
}
|
|
98
|
+
export function testingBuildLogsEndpoint(projectId, jobId, buildId, options = {}) {
|
|
99
|
+
const endpoint = `/pace/v4/projects/${projectId}/jobs/${jobId}/builds/${buildId}/logs`;
|
|
100
|
+
const params = new URLSearchParams();
|
|
101
|
+
if (options.container !== undefined)
|
|
102
|
+
params.set('container', options.container);
|
|
103
|
+
if (options.tailLines !== undefined)
|
|
104
|
+
params.set('tailLines', options.tailLines.toString());
|
|
105
|
+
if (options.sinceSeconds !== undefined)
|
|
106
|
+
params.set('sinceSeconds', options.sinceSeconds.toString());
|
|
107
|
+
if (options.limitBytes !== undefined)
|
|
108
|
+
params.set('limitBytes', options.limitBytes.toString());
|
|
109
|
+
if (options.timestamps !== undefined)
|
|
110
|
+
params.set('timestamps', options.timestamps.toString());
|
|
111
|
+
if (options.pretty !== undefined)
|
|
112
|
+
params.set('pretty', options.pretty.toString());
|
|
113
|
+
const query = params.toString();
|
|
114
|
+
return query.length > 0 ? `${endpoint}?${query}` : endpoint;
|
|
59
115
|
}
|
|
60
116
|
export function testingBuildAbortEndpoint(projectId, jobId, buildId) {
|
|
61
117
|
return `/pace/v4/projects/${projectId}/jobs/${jobId}/builds/${buildId}/abort`;
|
|
62
118
|
}
|
|
63
119
|
export function testingProjectDeleteEndpoint(projectId) {
|
|
64
|
-
return
|
|
120
|
+
return testingProjectEndpoint(projectId);
|
|
65
121
|
}
|
|
66
122
|
export function testingVariablesEndpoint(projectId) {
|
|
67
123
|
return `/pace/v3/projects/${projectId}/secrets`;
|
|
68
124
|
}
|
|
125
|
+
export function testingMetricsSearchEndpoint(orgId) {
|
|
126
|
+
return `/organizations/${orgId}/search/_msearch`;
|
|
127
|
+
}
|
|
69
128
|
export function testingVariableEndpoint(projectId, variableId) {
|
|
70
129
|
return `/pace/v3/projects/${projectId}/secrets/${variableId}`;
|
|
71
130
|
}
|
|
131
|
+
export function testingUserParametersEndpoint() {
|
|
132
|
+
return '/pace/v4/user-parameters';
|
|
133
|
+
}
|
|
134
|
+
export function testingUserParameterEndpoint(parameterId) {
|
|
135
|
+
return `/pace/v4/user-parameters/${parameterId}`;
|
|
136
|
+
}
|
|
137
|
+
export function appendTestingQuery(endpoint, values) {
|
|
138
|
+
const params = new URLSearchParams();
|
|
139
|
+
for (const [key, value] of Object.entries(values)) {
|
|
140
|
+
if (value !== undefined)
|
|
141
|
+
params.set(key, value.toString());
|
|
142
|
+
}
|
|
143
|
+
const query = params.toString();
|
|
144
|
+
return query.length > 0 ? `${endpoint}?${query}` : endpoint;
|
|
145
|
+
}
|
|
72
146
|
function appendOptionalBranch(endpoint, branch) {
|
|
73
147
|
if (branch === undefined || branch.trim().length === 0)
|
|
74
148
|
return endpoint;
|
|
75
149
|
const params = new URLSearchParams({ branches: branch });
|
|
76
150
|
return `${endpoint}?${params.toString()}`;
|
|
77
151
|
}
|
|
152
|
+
function appendBooleanQuery(endpoint, key, value) {
|
|
153
|
+
return value === undefined ? endpoint : `${endpoint}?${new URLSearchParams({ [key]: value.toString() }).toString()}`;
|
|
154
|
+
}
|
|
78
155
|
function appendBuildQuery(endpoint, options = {}) {
|
|
79
156
|
const params = new URLSearchParams();
|
|
157
|
+
if (options.page !== undefined)
|
|
158
|
+
params.set('page', options.page.toString());
|
|
159
|
+
if (options.pageSize !== undefined)
|
|
160
|
+
params.set('pageSize', options.pageSize.toString());
|
|
80
161
|
if (options.resultSize !== undefined)
|
|
81
162
|
params.set('resultSize', options.resultSize);
|
|
82
163
|
if (options.status !== undefined)
|
|
@@ -101,7 +182,19 @@ export function normalizeTestingArray(response) {
|
|
|
101
182
|
if (Array.isArray(normalized))
|
|
102
183
|
return normalized;
|
|
103
184
|
if (isRecord(normalized)) {
|
|
104
|
-
for (const key of [
|
|
185
|
+
for (const key of [
|
|
186
|
+
'items',
|
|
187
|
+
'records',
|
|
188
|
+
'results',
|
|
189
|
+
'files',
|
|
190
|
+
'builds',
|
|
191
|
+
'jobs',
|
|
192
|
+
'robots',
|
|
193
|
+
'projects',
|
|
194
|
+
'secrets',
|
|
195
|
+
'permissions',
|
|
196
|
+
'userParameters',
|
|
197
|
+
]) {
|
|
105
198
|
const candidate = normalized[key];
|
|
106
199
|
if (Array.isArray(candidate))
|
|
107
200
|
return candidate;
|
|
@@ -113,6 +206,18 @@ export function normalizeTestingRecord(response) {
|
|
|
113
206
|
const normalized = nestedData(response);
|
|
114
207
|
return isRecord(normalized) ? normalized : {};
|
|
115
208
|
}
|
|
209
|
+
export function normalizeTestingEnvelopeRecord(response) {
|
|
210
|
+
if (!isRecord(response))
|
|
211
|
+
return {};
|
|
212
|
+
const domainKeys = ['id', 'buildId', 'jobId', 'outputArchive', 'status'];
|
|
213
|
+
if (domainKeys.some((key) => key in response))
|
|
214
|
+
return response;
|
|
215
|
+
if (isRecord(response.data))
|
|
216
|
+
return response.data;
|
|
217
|
+
if (isRecord(response.result))
|
|
218
|
+
return response.result;
|
|
219
|
+
return response;
|
|
220
|
+
}
|
|
116
221
|
export function normalizeTestingId(response) {
|
|
117
222
|
const record = normalizeTestingRecord(response);
|
|
118
223
|
const { id } = record;
|
|
@@ -142,7 +247,7 @@ export function redactTestingVariables(value) {
|
|
|
142
247
|
return value;
|
|
143
248
|
const redacted = {};
|
|
144
249
|
for (const [key, entry] of Object.entries(value)) {
|
|
145
|
-
redacted[key] = key === 'value' ? '
|
|
250
|
+
redacted[key] = key === 'value' ? '[REDACTED]' : redactTestingVariables(entry);
|
|
146
251
|
}
|
|
147
252
|
return redacted;
|
|
148
253
|
}
|