@fluidgrids/cli 2026.1028.2 → 2026.1031.1

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.
Files changed (69) hide show
  1. package/README.md +102 -3
  2. package/dist/code-first/api.d.ts +244 -0
  3. package/dist/code-first/api.d.ts.map +1 -1
  4. package/dist/code-first/api.js +148 -4
  5. package/dist/code-first/api.js.map +1 -1
  6. package/dist/code-first/code-upload.d.ts +2 -1
  7. package/dist/code-first/code-upload.d.ts.map +1 -1
  8. package/dist/code-first/code-upload.js +5 -1
  9. package/dist/code-first/code-upload.js.map +1 -1
  10. package/dist/code-first/commands/runs.d.ts +80 -14
  11. package/dist/code-first/commands/runs.d.ts.map +1 -1
  12. package/dist/code-first/commands/runs.js +281 -20
  13. package/dist/code-first/commands/runs.js.map +1 -1
  14. package/dist/code-first/commands/suite.d.ts +57 -0
  15. package/dist/code-first/commands/suite.d.ts.map +1 -0
  16. package/dist/code-first/commands/suite.js +197 -0
  17. package/dist/code-first/commands/suite.js.map +1 -0
  18. package/dist/code-first/commands/versions.d.ts +52 -3
  19. package/dist/code-first/commands/versions.d.ts.map +1 -1
  20. package/dist/code-first/commands/versions.js +177 -3
  21. package/dist/code-first/commands/versions.js.map +1 -1
  22. package/dist/code-first/durable-operations.d.ts +1 -2
  23. package/dist/code-first/durable-operations.d.ts.map +1 -1
  24. package/dist/code-first/durable-operations.js +1 -2
  25. package/dist/code-first/durable-operations.js.map +1 -1
  26. package/dist/code-first/index.d.ts +2 -1
  27. package/dist/code-first/index.d.ts.map +1 -1
  28. package/dist/code-first/index.js +2 -1
  29. package/dist/code-first/index.js.map +1 -1
  30. package/dist/code-first/junit.d.ts +24 -0
  31. package/dist/code-first/junit.d.ts.map +1 -0
  32. package/dist/code-first/junit.js +163 -0
  33. package/dist/code-first/junit.js.map +1 -0
  34. package/dist/code-first/lowering.d.ts +13 -0
  35. package/dist/code-first/lowering.d.ts.map +1 -1
  36. package/dist/code-first/lowering.js +24 -1
  37. package/dist/code-first/lowering.js.map +1 -1
  38. package/dist/code-first/operations.d.ts +1 -3
  39. package/dist/code-first/operations.d.ts.map +1 -1
  40. package/dist/code-first/operations.js +1 -3
  41. package/dist/code-first/operations.js.map +1 -1
  42. package/dist/code-first/parity-operations.d.ts +44 -0
  43. package/dist/code-first/parity-operations.d.ts.map +1 -0
  44. package/dist/code-first/parity-operations.js +211 -0
  45. package/dist/code-first/parity-operations.js.map +1 -0
  46. package/dist/code-first/parity.d.ts +83 -0
  47. package/dist/code-first/parity.d.ts.map +1 -0
  48. package/dist/code-first/parity.js +301 -0
  49. package/dist/code-first/parity.js.map +1 -0
  50. package/dist/code-first/redact.d.ts +31 -0
  51. package/dist/code-first/redact.d.ts.map +1 -0
  52. package/dist/code-first/redact.js +150 -0
  53. package/dist/code-first/redact.js.map +1 -0
  54. package/dist/code-first/register.d.ts +9 -1
  55. package/dist/code-first/register.d.ts.map +1 -1
  56. package/dist/code-first/register.js +171 -26
  57. package/dist/code-first/register.js.map +1 -1
  58. package/dist/code-first/shared.d.ts +2 -0
  59. package/dist/code-first/shared.d.ts.map +1 -1
  60. package/dist/code-first/shared.js +1 -0
  61. package/dist/code-first/shared.js.map +1 -1
  62. package/dist/code-first/test-suite-operations.d.ts +16 -0
  63. package/dist/code-first/test-suite-operations.d.ts.map +1 -0
  64. package/dist/code-first/test-suite-operations.js +44 -0
  65. package/dist/code-first/test-suite-operations.js.map +1 -0
  66. package/dist/program.d.ts.map +1 -1
  67. package/dist/program.js +1 -0
  68. package/dist/program.js.map +1 -1
  69. package/package.json +2 -2
@@ -0,0 +1,197 @@
1
+ /**
2
+ * `fluidgrids test <workflowKey>`: run a workflow's saved test cases on the
3
+ * service (BOFF-9960) and fail CI when one does not pass.
4
+ *
5
+ * The command starts a suite run (`runWorkflowTests`, source CLI), polls
6
+ * `workflowTestRun` until it is final, prints a row per case and, with
7
+ * `--junit <file>`, writes a JUnit XML report. Exit status:
8
+ *
9
+ * - 0: the suite PASSED;
10
+ * - 1: the suite FAILED (a case failed) or ended in ERROR (a case could not
11
+ * run), or the request itself failed;
12
+ * - 2: authentication (the CLI-wide status of an auth error);
13
+ * - 3: the suite was still running when `--timeout` ran out. It keeps running
14
+ * on the service; the JUnit report marks the unfinished cases NOT_FINISHED.
15
+ *
16
+ * Without a key, `fluidgrids test` keeps its code-first meaning (the project's
17
+ * test script plus history replays, `./replay.ts`). The two option sets do not
18
+ * mix; `testSuiteOptions` and `codeFirstTestOptions` reject the other's flags.
19
+ *
20
+ * This file must stay free of `@fluidgrids/workflows`: a suite run needs no
21
+ * project and no lowering.
22
+ */
23
+ import { writeFileSync } from 'fs';
24
+ import { resolve } from 'path';
25
+ import { CliAuthError, CliUserError } from '@burdenoff/cli-sdk/core';
26
+ import { suiteToJUnit } from '../junit.js';
27
+ import { emit, parsePositiveInt } from '../shared.js';
28
+ /** The suite is still being worked on. */
29
+ const OPEN = ['PENDING', 'RUNNING'];
30
+ /** 30 minutes: long enough for a suite of slow cases, short of a CI job's usual cap. */
31
+ export const DEFAULT_SUITE_TIMEOUT_MS = 30 * 60 * 1000;
32
+ export const DEFAULT_SUITE_POLL_INTERVAL_MS = 2000;
33
+ /** Consecutive failed polls tolerated (a gateway blip) before the command gives up. */
34
+ export const POLL_ATTEMPTS = 3;
35
+ /** Exit status when the suite outlives `--timeout`. 2 is the CLI-wide auth status. */
36
+ export const SUITE_TIMEOUT_EXIT_CODE = 3;
37
+ /** The suite-run options; code-first-only flags are refused. */
38
+ export function testSuiteOptions(options) {
39
+ const misplaced = [
40
+ options.replay !== undefined ? '--replay' : null,
41
+ options.isolate ? '--isolate' : null,
42
+ options.script === false ? '--no-script' : null,
43
+ options.project !== undefined ? '--project' : null,
44
+ ].filter((flag) => flag !== null);
45
+ if (misplaced.length > 0) {
46
+ throw new CliUserError(`${misplaced.join(', ')} ${misplaced.length === 1 ? 'applies' : 'apply'} to the code-first tests, not to a workflow's test suite.`, { hint: 'Run `fluidgrids test` without a workflow key in a code-first project for those.' });
47
+ }
48
+ return {
49
+ ...(options.format !== undefined ? { format: options.format } : {}),
50
+ ...(options.wfVersion !== undefined ? { wfVersion: options.wfVersion } : {}),
51
+ ...(options.case !== undefined ? { case: options.case } : {}),
52
+ ...(options.junit !== undefined ? { junit: options.junit } : {}),
53
+ ...(options.timeout !== undefined ? { timeout: options.timeout } : {}),
54
+ ...(options.pollInterval !== undefined ? { pollInterval: options.pollInterval } : {}),
55
+ };
56
+ }
57
+ /** The code-first test options; suite-only flags are refused. */
58
+ export function codeFirstTestOptions(options) {
59
+ const misplaced = [
60
+ options.wfVersion !== undefined ? '--wf-version' : null,
61
+ options.case !== undefined ? '--case' : null,
62
+ options.junit !== undefined ? '--junit' : null,
63
+ options.timeout !== undefined ? '--timeout' : null,
64
+ options.pollInterval !== undefined ? '--poll-interval' : null,
65
+ ].filter((flag) => flag !== null);
66
+ if (misplaced.length > 0) {
67
+ throw new CliUserError(`${misplaced.join(', ')} ${misplaced.length === 1 ? 'needs' : 'need'} a workflow key: \`fluidgrids test <workflowKey>\`.`);
68
+ }
69
+ return {
70
+ ...(options.format !== undefined ? { format: options.format } : {}),
71
+ ...(options.project !== undefined ? { project: options.project } : {}),
72
+ ...(options.replay !== undefined ? { replay: options.replay } : {}),
73
+ ...(options.isolate !== undefined ? { isolate: options.isolate } : {}),
74
+ ...(options.script !== undefined ? { script: options.script } : {}),
75
+ };
76
+ }
77
+ function caseIds(raw) {
78
+ if (raw === undefined)
79
+ return undefined;
80
+ const ids = [...new Set(raw.map((id) => id.trim()))];
81
+ if (ids.some((id) => id === ''))
82
+ throw new CliUserError('--case needs a test case id.');
83
+ return ids;
84
+ }
85
+ function finished(suite) {
86
+ return suite.summary.total - suite.summary.pending;
87
+ }
88
+ /** Poll until the suite is final or the deadline passes; transient poll failures are retried. */
89
+ async function waitForSuite(env, started, timeoutMs, intervalMs) {
90
+ const deadline = Date.now() + timeoutMs;
91
+ let suite = started;
92
+ let reported = finished(suite);
93
+ let failedPolls = 0;
94
+ while (OPEN.includes(suite.status)) {
95
+ if (Date.now() >= deadline)
96
+ return { suite, timedOut: true };
97
+ await env.sleep(Math.max(0, Math.min(intervalMs, deadline - Date.now())));
98
+ // The last sleep is clipped to the deadline: stop there instead of starting a poll that a
99
+ // slow gateway could stretch well past --timeout.
100
+ if (Date.now() >= deadline)
101
+ return { suite, timedOut: true };
102
+ let next;
103
+ try {
104
+ next = await env.api.workflowTestRun(suite.id);
105
+ failedPolls = 0;
106
+ }
107
+ catch (error) {
108
+ // An expired login will not heal by retrying; a gateway blip usually does.
109
+ if (error instanceof CliAuthError || ++failedPolls >= POLL_ATTEMPTS)
110
+ throw error;
111
+ env.ctx.logger.warn(`Polling suite ${suite.id} failed (${failedPolls}/${POLL_ATTEMPTS}); retrying.`);
112
+ continue;
113
+ }
114
+ if (!next) {
115
+ throw new CliUserError(`Suite run ${suite.id} is no longer visible (NOT_FOUND).`);
116
+ }
117
+ suite = next;
118
+ if (finished(suite) !== reported) {
119
+ reported = finished(suite);
120
+ env.ctx.logger.info(`${reported}/${suite.summary.total} test cases finished`);
121
+ }
122
+ }
123
+ return { suite, timedOut: false };
124
+ }
125
+ function failureSummary(result) {
126
+ const [first, ...rest] = result.failures;
127
+ if (!first)
128
+ return '';
129
+ const head = `${first.code}${first.nodeId ? ` (${first.nodeId})` : ''}`;
130
+ return rest.length > 0 ? `${head} +${rest.length}` : head;
131
+ }
132
+ function detailLines(suite, timedOut, junit) {
133
+ const { total, passed, failed, errored, pending } = suite.summary;
134
+ const counts = `${passed} passed, ${failed} failed, ${errored} errored${pending > 0 ? `, ${pending} not finished` : ''}`;
135
+ const lines = [
136
+ `Suite ${suite.id} (${suite.workflowKey} ${suite.version}): ${timedOut ? `still ${suite.status}` : suite.status}, ${counts} of ${total}`,
137
+ ];
138
+ for (const result of suite.results) {
139
+ for (const failure of result.failures) {
140
+ lines.push(` ${result.caseName}: ${failure.code}${failure.nodeId ? ` at ${failure.nodeId}` : ''}: ${failure.message}`);
141
+ }
142
+ }
143
+ if (junit)
144
+ lines.push(`JUnit report: ${junit}`);
145
+ return lines;
146
+ }
147
+ export async function runTestSuite(env, workflowKey, options) {
148
+ const key = workflowKey.trim();
149
+ if (key === '')
150
+ throw new CliUserError('The workflow key is empty.');
151
+ const timeoutMs = parsePositiveInt(options.timeout, '--timeout') ?? DEFAULT_SUITE_TIMEOUT_MS;
152
+ const intervalMs = parsePositiveInt(options.pollInterval, '--poll-interval') ?? DEFAULT_SUITE_POLL_INTERVAL_MS;
153
+ const ids = caseIds(options.case);
154
+ const input = {
155
+ workflowKey: key,
156
+ source: 'CLI',
157
+ ...(options.wfVersion !== undefined ? { version: options.wfVersion } : {}),
158
+ ...(ids !== undefined ? { caseIds: ids } : {}),
159
+ };
160
+ const started = await env.api.runWorkflowTests(input);
161
+ env.ctx.logger.info(`Started suite ${started.id}: ${started.summary.total} test case${started.summary.total === 1 ? '' : 's'} of ${started.workflowKey} ${started.version}`);
162
+ const { suite, timedOut } = await waitForSuite(env, started, timeoutMs, intervalMs);
163
+ const result = { suite, timedOut };
164
+ if (options.junit !== undefined) {
165
+ const path = resolve(env.cwd(), options.junit);
166
+ try {
167
+ writeFileSync(path, suiteToJUnit(suite), 'utf8');
168
+ }
169
+ catch (error) {
170
+ throw new CliUserError(`Could not write the JUnit report to ${options.junit}: ${error instanceof Error ? error.message : String(error)}`);
171
+ }
172
+ result.junit = options.junit;
173
+ }
174
+ emit(env, options, result, {
175
+ headers: ['Case', 'Status', 'Run', 'Failure'],
176
+ rows: suite.results.map((row) => [
177
+ row.caseName,
178
+ row.status,
179
+ row.runId ?? '-',
180
+ failureSummary(row) || '-',
181
+ ]),
182
+ }, detailLines(suite, timedOut, result.junit));
183
+ if (timedOut) {
184
+ throw new CliUserError(`Suite ${suite.id} was still ${suite.status} after ${timeoutMs} ms (${finished(suite)}/${suite.summary.total} cases finished).`, {
185
+ exitCode: SUITE_TIMEOUT_EXIT_CODE,
186
+ hint: 'It keeps running on the service. Raise --timeout to wait longer.',
187
+ });
188
+ }
189
+ if (suite.status === 'FAILED') {
190
+ throw new CliUserError(`${suite.summary.failed} of ${suite.summary.total} test cases of ${suite.workflowKey} failed.`);
191
+ }
192
+ if (suite.status === 'ERROR') {
193
+ throw new CliUserError(`${suite.summary.errored} of ${suite.summary.total} test cases of ${suite.workflowKey} could not run.`);
194
+ }
195
+ return result;
196
+ }
197
+ //# sourceMappingURL=suite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suite.js","sourceRoot":"","sources":["../../../src/code-first/commands/suite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAQrE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAuC,MAAM,cAAc,CAAC;AAmB3F,0CAA0C;AAC1C,MAAM,IAAI,GAAqC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAEtE,wFAAwF;AACxF,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACvD,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,CAAC;AACnD,uFAAuF;AACvF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAE/B,sFAAsF;AACtF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAEzC,gEAAgE;AAChE,MAAM,UAAU,gBAAgB,CAAC,OAA2B;IAC1D,MAAM,SAAS,GAAG;QAChB,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI;QAChD,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC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`fluidgrids versions list <key>`: every stored version of a workflow with
3
3
  * the code bundle it references (`workflowCodeBundle`), so the build each
4
4
  * version runs, the builds a hotfix kept compatible and when it was replaced
5
- * are visible. Rollouts and drainage (`versions rollout | drainage`) arrive
6
- * with the Phase B parity release (spec 11 §2.27).
5
+ * are visible.
6
+ *
7
+ * Durable-function parity (BOFF-9905 B19, spec code-first 11 §2.27; each
8
+ * needs fluidgrids.durable-parity, which the service checks):
9
+ *
10
+ * | Command | Operation |
11
+ * |---|---|
12
+ * | `versions rollout <key>` | `workflowRollouts` |
13
+ * | `versions rollout <key> --to <version> --percent <n>` | `setWorkflowRollout` |
14
+ * | `versions rollout delete <key>` | `deleteWorkflowRollout` |
15
+ * | `versions drainage <key> <version>` | `workflowVersionDrainage` |
16
+ * | `versions override <runId> --pin <version> \| --auto-upgrade \| --clear` | `setWorkflowRunVersioningOverride` |
7
17
  */
8
- import type { CodeBundleInfo, RemoteVersion } from '../api.js';
18
+ import type { CodeBundleInfo, DurableRun, RemoteVersion, VersionDrainage, WorkflowRollout } from '../api.js';
19
+ import { type TargetOptions } from '../parity.js';
9
20
  import { type CommandEnv, type OutputOptions } from '../shared.js';
10
21
  export interface VersionRow extends RemoteVersion {
11
22
  bundle: CodeBundleInfo | null;
12
23
  }
13
24
  export declare function runVersionsList(env: CommandEnv, workflowKey: string, options: OutputOptions): Promise<VersionRow[]>;
25
+ export interface RolloutOptions extends OutputOptions {
26
+ to?: string;
27
+ percent?: string;
28
+ from?: string;
29
+ environment?: string;
30
+ }
31
+ /**
32
+ * Without `--to`: the workflow's rollouts. With `--to` and `--percent`: create
33
+ * or change the PROD rollout (`percent: 100` promotes the version through the
34
+ * activation check and removes the rollout).
35
+ */
36
+ export declare function runRollout(env: CommandEnv, workflowKey: string, options: RolloutOptions): Promise<WorkflowRollout[] | WorkflowRollout>;
37
+ export interface RolloutDeleteOptions extends OutputOptions {
38
+ environment?: string;
39
+ force?: boolean;
40
+ }
41
+ /**
42
+ * Merge what the parent `versions rollout` command parsed into the `delete` options. Options typed
43
+ * before `delete` (`rollout --environment STAGING delete k`) land on the parent; the environment
44
+ * is honoured when it does not contradict the subcommand's own, and the setter-only options are
45
+ * refused so a delete never silently ignores them.
46
+ */
47
+ export declare function rolloutDeleteOptions(options: RolloutDeleteOptions, parent: Record<string, unknown>): RolloutDeleteOptions;
48
+ /** Remove a rollout: every automatic start runs the ACTIVE version again. */
49
+ export declare function runRolloutDelete(env: CommandEnv, workflowKey: string, options: RolloutDeleteOptions): Promise<boolean>;
50
+ /** Whether a version's bundle still serves open runs. */
51
+ export declare function runDrainage(env: CommandEnv, workflowKey: string, version: string, options: OutputOptions): Promise<VersionDrainage>;
52
+ export interface OverrideOptions extends OutputOptions, TargetOptions {
53
+ pin?: string;
54
+ autoUpgrade?: boolean;
55
+ clear?: boolean;
56
+ reason?: string;
57
+ }
58
+ /**
59
+ * Set or remove a run's versioning override. A change that moves the run to
60
+ * another bundle is replay-checked by the service first (`pendingOverride`).
61
+ */
62
+ export declare function runOverride(env: CommandEnv, runId: string | undefined, options: OverrideOptions): Promise<DurableRun>;
14
63
  //# sourceMappingURL=versions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../src/code-first/commands/versions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/D,OAAO,EAAQ,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAEzE,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;CAC/B;AAED,wBAAsB,eAAe,CACnC,GAAG,EAAE,UAAU,EACf,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,UAAU,EAAE,CAAC,CAmBvB"}
1
+ {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../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B,GAC5B,OAAO,CAAC,OAAO,CAAC,CA2BlB;AAID,yDAAyD;AACzD,wBAAsB,WAAW,CAC/B,GAAG,EAAE,UAAU,EACf,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,eAAe,CAAC,CAe1B;AAID,MAAM,WAAW,eAAgB,SAAQ,aAAa,EAAE,aAAa;IACnE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,UAAU,CAAC,CAkCrB"}
@@ -2,11 +2,24 @@
2
2
  * `fluidgrids versions list <key>`: every stored version of a workflow with
3
3
  * the code bundle it references (`workflowCodeBundle`), so the build each
4
4
  * version runs, the builds a hotfix kept compatible and when it was replaced
5
- * are visible. Rollouts and drainage (`versions rollout | drainage`) arrive
6
- * with the Phase B parity release (spec 11 §2.27).
5
+ * are visible.
6
+ *
7
+ * Durable-function parity (BOFF-9905 B19, spec code-first 11 §2.27; each
8
+ * needs fluidgrids.durable-parity, which the service checks):
9
+ *
10
+ * | Command | Operation |
11
+ * |---|---|
12
+ * | `versions rollout <key>` | `workflowRollouts` |
13
+ * | `versions rollout <key> --to <version> --percent <n>` | `setWorkflowRollout` |
14
+ * | `versions rollout delete <key>` | `deleteWorkflowRollout` |
15
+ * | `versions drainage <key> <version>` | `workflowVersionDrainage` |
16
+ * | `versions override <runId> --pin <version> \| --auto-upgrade \| --clear` | `setWorkflowRunVersioningOverride` |
7
17
  */
18
+ import { createInterface } from 'readline/promises';
19
+ import { CliUserError } from '@burdenoff/cli-sdk/core';
20
+ import { runRefOf } from '../parity.js';
8
21
  import { sortVersions } from '../remote.js';
9
- import { emit } from '../shared.js';
22
+ import { emit, parseChoice } from '../shared.js';
10
23
  export async function runVersionsList(env, workflowKey, options) {
11
24
  const versions = sortVersions(await env.api.workflowVersions(workflowKey));
12
25
  const rows = [];
@@ -27,4 +40,165 @@ export async function runVersionsList(env, workflowKey, options) {
27
40
  });
28
41
  return rows;
29
42
  }
43
+ const ENVIRONMENTS = ['PROD', 'STAGING', 'DEV'];
44
+ function rolloutRows(rollouts) {
45
+ return rollouts.map((rollout) => [
46
+ rollout.environment,
47
+ rollout.fromVersion,
48
+ rollout.toVersion,
49
+ `${rollout.percent}%`,
50
+ `${rollout.verifiedPercent}%`,
51
+ rollout.activationCheck
52
+ ? `${rollout.activationCheck.kind ?? 'CHECK'} ${rollout.activationCheck.status}`
53
+ : '-',
54
+ ]);
55
+ }
56
+ function checkLine(check, what) {
57
+ if (!check || check.status === 'REPLACED' || check.status === 'REJECTED')
58
+ return [];
59
+ return [
60
+ `${what} waits for replay check ${check.id} (${check.kind ?? 'CHECK'} ${check.status}): the affected runs move only once they replay against the new bundle.`,
61
+ ];
62
+ }
63
+ /** `0` to `100`. */
64
+ function parsePercent(raw) {
65
+ if (raw === undefined || !/^\d{1,3}$/.test(raw.trim()) || Number(raw) > 100) {
66
+ throw new CliUserError(`Invalid value '${raw ?? ''}' for --percent: expected 0 to 100.`);
67
+ }
68
+ return Number(raw.trim());
69
+ }
70
+ /**
71
+ * Without `--to`: the workflow's rollouts. With `--to` and `--percent`: create
72
+ * or change the PROD rollout (`percent: 100` promotes the version through the
73
+ * activation check and removes the rollout).
74
+ */
75
+ export async function runRollout(env, workflowKey, options) {
76
+ const headers = ['Environment', 'From', 'To', 'Percent', 'Verified', 'Check'];
77
+ if (options.to === undefined && options.percent === undefined) {
78
+ const rollouts = await env.api.workflowRollouts(workflowKey);
79
+ emit(env, options, rollouts, { headers, rows: rolloutRows(rollouts) }, rollouts.length === 0 ? [`${workflowKey} has no rollout.`] : []);
80
+ return rollouts;
81
+ }
82
+ if (options.to === undefined || options.to.trim() === '') {
83
+ throw new CliUserError('--percent needs --to <version>.');
84
+ }
85
+ const input = {
86
+ toVersion: options.to,
87
+ percent: parsePercent(options.percent),
88
+ };
89
+ if (options.from !== undefined)
90
+ input.fromVersion = options.from;
91
+ const environment = parseChoice(options.environment?.toUpperCase(), '--environment', ENVIRONMENTS);
92
+ if (environment)
93
+ input.environment = environment;
94
+ const rollout = await env.api.setWorkflowRollout(workflowKey, input);
95
+ const details = [
96
+ rollout.promoted
97
+ ? `${rollout.toVersion} is promoted: it becomes the ACTIVE version${rollout.activationCheck ? ' once its activation check passes' : ''}.`
98
+ : `${rollout.percent}% of new automatic starts of ${workflowKey} run ${rollout.toVersion}.`,
99
+ ...checkLine(rollout.activationCheck, 'The rollout'),
100
+ ];
101
+ emit(env, options, rollout, { headers, rows: rolloutRows([rollout]) }, details);
102
+ return rollout;
103
+ }
104
+ /**
105
+ * Merge what the parent `versions rollout` command parsed into the `delete` options. Options typed
106
+ * before `delete` (`rollout --environment STAGING delete k`) land on the parent; the environment
107
+ * is honoured when it does not contradict the subcommand's own, and the setter-only options are
108
+ * refused so a delete never silently ignores them.
109
+ */
110
+ export function rolloutDeleteOptions(options, parent) {
111
+ for (const flag of ['to', 'percent', 'from']) {
112
+ if (parent[flag] !== undefined) {
113
+ throw new CliUserError(`--${flag} does not apply to \`versions rollout delete\`.`);
114
+ }
115
+ }
116
+ const inherited = parent['environment'];
117
+ if (typeof inherited !== 'string')
118
+ return options;
119
+ if (options.environment !== undefined && options.environment !== inherited) {
120
+ throw new CliUserError(`Conflicting --environment values '${inherited}' and '${options.environment}'.`);
121
+ }
122
+ return { ...options, environment: inherited };
123
+ }
124
+ async function confirm(question) {
125
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
126
+ try {
127
+ const answer = await rl.question(`${question} [y/N] `);
128
+ return /^y(es)?$/i.test(answer.trim());
129
+ }
130
+ finally {
131
+ rl.close();
132
+ }
133
+ }
134
+ /** Remove a rollout: every automatic start runs the ACTIVE version again. */
135
+ export async function runRolloutDelete(env, workflowKey, options) {
136
+ const environment = parseChoice(options.environment?.toUpperCase(), '--environment', ENVIRONMENTS);
137
+ if (!options.force) {
138
+ if (!env.interactive()) {
139
+ throw new CliUserError(`Removing the rollout of ${workflowKey} needs confirmation.`, {
140
+ hint: 'Pass --force to remove it without a prompt.',
141
+ });
142
+ }
143
+ if (!(await confirm(`Remove the rollout of ${workflowKey}? New starts run the ACTIVE version.`))) {
144
+ throw new CliUserError('Aborted: nothing was changed.');
145
+ }
146
+ }
147
+ const removed = await env.api.deleteWorkflowRollout(workflowKey, environment);
148
+ emit(env, options, { workflowKey, removed }, { headers: ['Workflow', 'Removed'], rows: [[workflowKey, removed ? 'yes' : 'no']] }, [removed ? `The rollout of ${workflowKey} is removed.` : `${workflowKey} had no rollout.`]);
149
+ return removed;
150
+ }
151
+ // ----------------------------------------------------------- versions drainage
152
+ /** Whether a version's bundle still serves open runs. */
153
+ export async function runDrainage(env, workflowKey, version, options) {
154
+ const drainage = await env.api.versionDrainage(workflowKey, version);
155
+ emit(env, options, drainage, {
156
+ headers: ['Version', 'Status', 'Open runs', 'Last run', 'Rollout target'],
157
+ rows: [
158
+ [
159
+ drainage.version,
160
+ drainage.status,
161
+ String(drainage.openRuns),
162
+ drainage.lastRunStartedAt ?? '-',
163
+ drainage.rolloutTarget ? 'yes' : 'no',
164
+ ],
165
+ ],
166
+ });
167
+ return drainage;
168
+ }
169
+ /**
170
+ * Set or remove a run's versioning override. A change that moves the run to
171
+ * another bundle is replay-checked by the service first (`pendingOverride`).
172
+ */
173
+ export async function runOverride(env, runId, options) {
174
+ const chosen = [options.pin !== undefined, options.autoUpgrade === true, options.clear === true];
175
+ if (chosen.filter(Boolean).length !== 1) {
176
+ throw new CliUserError('Give exactly one of --pin <version>, --auto-upgrade or --clear.');
177
+ }
178
+ let override = null;
179
+ if (options.pin !== undefined) {
180
+ if (options.pin.trim() === '')
181
+ throw new CliUserError('--pin needs a version.');
182
+ override = { behavior: 'PINNED', version: options.pin };
183
+ }
184
+ else if (options.autoUpgrade) {
185
+ override = { behavior: 'AUTO_UPGRADE' };
186
+ }
187
+ const ref = runRefOf(runId, options);
188
+ const run = await env.api.setRunVersioningOverride(ref, override, options.reason);
189
+ const versioning = run.versioning;
190
+ const rows = [
191
+ ['Run', run.id],
192
+ ['Behavior', versioning?.behavior ?? '-'],
193
+ [
194
+ 'Override',
195
+ versioning?.override
196
+ ? `${versioning.override.behavior}${versioning.override.version ? ` ${versioning.override.version}` : ''}`
197
+ : '-',
198
+ ],
199
+ ['Serving version', versioning?.servingVersion ?? run.version],
200
+ ];
201
+ emit(env, options, run, { headers: ['Field', 'Value'], rows }, checkLine(versioning?.pendingOverride, 'The override'));
202
+ return run;
203
+ }
30
204
  //# sourceMappingURL=versions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../src/code-first/commands/versions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAuC,MAAM,cAAc,CAAC;AAMzE,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAe,EACf,WAAmB,EACnB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;IAC3E,MAAM,IAAI,GAAiB,EAAE,CAAC;IAC9B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC5F,CAAC;IACD,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;Q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G,EAAE,CAAC;IAC1D,CAAC;SAAM,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;QAC/B,QAAQ,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC1C,CAAC;IACD,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACrC,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,wBAAwB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAClF,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;IAClC,MAAM,IAAI,GAAe;QACvB,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;QACf,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,IAAI,GAAG,CAAC;QACzC;YACE,UAAU;YACV,UAAU,EAAE,QAAQ;gBAClB,CAAC,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC1G,CAAC,CAAC,GAAG;SACR;QACD,CAAC,iBAAiB,EAAE,UAAU,EAAE,cAAc,IAAI,GAAG,CAAC,OAAO,CAAC;KAC/D,CAAC;IACF,IAAI,CACF,GAAG,EACH,OAAO,EACP,GAAG,EACH,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,EACrC,SAAS,CAAC,UAAU,EAAE,eAAe,EAAE,cAAc,CAAC,CACvD,CAAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -6,8 +6,7 @@
6
6
  * Every document targets the WORKSPACE gateway (wspace-workflow-svc). The names
7
7
  * and shapes are the Phase B contract (PLAN-B §5 B8 and B9, spec 08 §4). They
8
8
  * are validated by `tests/code-first/durable-operations.test.ts` against the
9
- * vendored supergraph once `bun run schema:pull` brings the service release
10
- * in, and against `schema/durable.pending.graphql` until then.
9
+ * vendored supergraph.
11
10
  *
12
11
  * The service gates every operation that starts new durable work
13
12
  * (`prepareWorkflowCodeUpload`, `replaceWorkflowVersionCode`, `startWorkflow`,
@@ -1 +1 @@
1
- {"version":3,"file":"durable-operations.d.ts","sourceRoot":"","sources":["../../src/code-first/durable-operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,wFAAwF;AACxF,eAAO,MAAM,+BAA+B,4SAQ3C,CAAC;AAOF,+FAA+F;AAC/F,eAAO,MAAM,gCAAgC,2bAc5C,CAAC;AAEF,yBAAyB;AACzB,eAAO,MAAM,wBAAwB,kMAIpC,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,uBAAuB,wTAOnC,CAAC;AAWF,gDAAgD;AAChD,eAAO,MAAM,iBAAiB,ydAO7B,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,eAAe,qZAI3B,CAAC;AAEF,yCAAyC;AACzC,eAAO,MAAM,uBAAuB,sSAOnC,CAAC;AAEF,eAAO,MAAM,sBAAsB,wUAWlC,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,yBAAyB,4LAIrC,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,2BAA2B,8KAIvC,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,YAAY,oMAOxB,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,mBAAmB,8KAI/B,CAAC"}
1
+ {"version":3,"file":"durable-operations.d.ts","sourceRoot":"","sources":["../../src/code-first/durable-operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,wFAAwF;AACxF,eAAO,MAAM,+BAA+B,4SAQ3C,CAAC;AAOF,+FAA+F;AAC/F,eAAO,MAAM,gCAAgC,2bAc5C,CAAC;AAEF,yBAAyB;AACzB,eAAO,MAAM,wBAAwB,kMAIpC,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,uBAAuB,wTAOnC,CAAC;AAWF,gDAAgD;AAChD,eAAO,MAAM,iBAAiB,ydAO7B,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,eAAe,qZAI3B,CAAC;AAEF,yCAAyC;AACzC,eAAO,MAAM,uBAAuB,sSAOnC,CAAC;AAEF,eAAO,MAAM,sBAAsB,wUAWlC,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,yBAAyB,4LAIrC,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,2BAA2B,8KAIvC,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,YAAY,oMAOxB,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,mBAAmB,8KAI/B,CAAC"}
@@ -6,8 +6,7 @@
6
6
  * Every document targets the WORKSPACE gateway (wspace-workflow-svc). The names
7
7
  * and shapes are the Phase B contract (PLAN-B §5 B8 and B9, spec 08 §4). They
8
8
  * are validated by `tests/code-first/durable-operations.test.ts` against the
9
- * vendored supergraph once `bun run schema:pull` brings the service release
10
- * in, and against `schema/durable.pending.graphql` until then.
9
+ * vendored supergraph.
11
10
  *
12
11
  * The service gates every operation that starts new durable work
13
12
  * (`prepareWorkflowCodeUpload`, `replaceWorkflowVersionCode`, `startWorkflow`,
@@ -1 +1 @@
1
- {"version":3,"file":"durable-operations.js","sourceRoot":"","sources":["../../src/code-first/durable-operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,oBAAoB,GAAG,4CAA4C,CAAC;AAE1E,wFAAwF;AACxF,MAAM,CAAC,MAAM,+BAA+B,GAAG;;;;iBAI9B,oBAAoB;iBACpB,oBAAoB;;;CAGpC,CAAC;AAEF,MAAM,mBAAmB,GAAG;;;CAG3B,CAAC;AAEF,+FAA+F;AAC/F,MAAM,CAAC,MAAM,gCAAgC,GAAG;;;;;;;;;;;;UAYtC,mBAAmB;;CAE5B,CAAC;AAEF,yBA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wBAAwB,GAAG;;qCAEH,mBAAmB;;CAEvD,CAAC;AAEF,gFAAgF;AAChF,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;CAOtC,CAAC;AAEF,6CAA6C;AAC7C,MAAM,kBAAkB,GAAG;;;;;;CAM1B,CAAC;AAEF,gDAAgD;AAChD,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;cAInB,kBAAkB;;;CAG/B,CAAC;AAEF,uCAAuC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG;;6BAEF,kBAAkB;;CAE9C,CAAC;AAEF,yCAAyC;AACzC,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;CAOtC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;CAWrC,CAAC;AAEF,uFAAuF;AACvF,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;CAIxC,CAAC;AAEF,8FAA8F;AAC9F,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;CAI1C,CAAC;AAEF,oFAAoF;AACpF,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;CAO3B,CAAC;AAEF,iFAAiF;AACjF,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;CAIlC,CAAC"}
@@ -4,7 +4,8 @@
4
4
  * through the service's import path) and `interface`; and the durable-function
5
5
  * commands of Phase B (`push --hotfix`, `runs start|describe|history|signal|
6
6
  * terminate|stack`, `history`, `signal`, `replay`, `test`, `run`,
7
- * `versions list`).
7
+ * `versions list`). `test <workflowKey>` runs a workflow's saved test cases on
8
+ * the service (BOFF-9960) and needs neither a project nor `@fluidgrids/workflows`.
8
9
  *
9
10
  * Product-local rather than in `@burdenoff/cli-sdk`: they depend on
10
11
  * `@fluidgrids/workflows` (esbuild, Prettier, QuickJS), which the other product
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/code-first/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAezD,QAAA,MAAM,eAAe,EAAE,SAiBtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/code-first/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAezD,QAAA,MAAM,eAAe,EAAE,SAiBtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -4,7 +4,8 @@
4
4
  * through the service's import path) and `interface`; and the durable-function
5
5
  * commands of Phase B (`push --hotfix`, `runs start|describe|history|signal|
6
6
  * terminate|stack`, `history`, `signal`, `replay`, `test`, `run`,
7
- * `versions list`).
7
+ * `versions list`). `test <workflowKey>` runs a workflow's saved test cases on
8
+ * the service (BOFF-9960) and needs neither a project nor `@fluidgrids/workflows`.
8
9
  *
9
10
  * Product-local rather than in `@burdenoff/cli-sdk`: they depend on
10
11
  * `@fluidgrids/workflows` (esbuild, Prettier, QuickJS), which the other product
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/code-first/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EACL,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,eAAe,GAAc;IACjC,EAAE,EAAE,uBAAuB;IAC3B,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,iCAAiC;IAC9C,SAAS,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,GAAG;QACnB,MAAM,GAAG,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC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3B,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC3B,gBAAgB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC/B,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC7B,iBAAiB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAChC,eAAe,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC;CACF,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * JUnit XML for a workflow test suite run (`fluidgrids test <key> --junit`),
3
+ * the report format CI systems (GitHub Actions reporters, GitLab, Jenkins,
4
+ * Azure DevOps) read.
5
+ *
6
+ * One `<testsuite>` per suite run and one `<testcase>` per test case:
7
+ * - PASSED: an empty `<testcase>`;
8
+ * - FAILED: a `<failure>` (an assertion did not hold, or the run did not end
9
+ * as the case expects);
10
+ * - ERROR: an `<error>` (the case could not run);
11
+ * - PENDING or RUNNING, when the CLI stopped waiting first: an `<error>` of type
12
+ * NOT_FINISHED, so an unfinished case never reads as a pass.
13
+ *
14
+ * `time` is the seconds from the suite's start to the case's completion: the
15
+ * service records when a case finished, not when its run started.
16
+ */
17
+ import type { WorkflowTestSuite } from './api.js';
18
+ /** Text safe for an XML attribute value or element content. */
19
+ export declare function escapeXml(value: string): string;
20
+ /** Seconds between two ISO instants, 3 decimals; 0 when either is missing or unparsable. */
21
+ export declare function elapsedSeconds(from: string | null, to: string | null): string;
22
+ /** The JUnit XML document for a suite run (final or not). */
23
+ export declare function suiteToJUnit(suite: WorkflowTestSuite): string;
24
+ //# sourceMappingURL=junit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"junit.d.ts","sourceRoot":"","sources":["../../src/code-first/junit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAA0B,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAqB1E,+DAA+D;AAC/D,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA8B/C;AAQD,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAK7E;AAoCD,6DAA6D;AAC7D,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CA4D7D"}