@firstdraft.com/cli 0.1.0 → 0.2.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.
package/src/cli.js CHANGED
@@ -14,11 +14,18 @@ import {
14
14
  CompilationArtifactInvalidError,
15
15
  CompilationArtifactResponseInvalidError,
16
16
  CompilationArtifactUnavailableError,
17
+ CompilationCancelledError,
17
18
  CompilationChangedError,
19
+ CompilationFailedError,
20
+ CompilationLocalPlanChangedError,
21
+ CompilationLocalStateError,
18
22
  CompilationMaterializationError,
19
23
  CompilationNotSucceededError,
20
24
  CompilationNotPushedError,
21
25
  CompilationOutputPathError,
26
+ CompilationRetainedError,
27
+ CompilationRequestOutcomeUnknownError,
28
+ CompilationStartRejectedError,
22
29
  CompilationStatusInvalidError,
23
30
  CompilationStatusUnavailableError,
24
31
  CompilationTimeoutError,
@@ -32,6 +39,7 @@ import {
32
39
  PlanCompileAnalysisUnavailableError,
33
40
  PlanCompilePushRejectedError,
34
41
  compilePlan,
42
+ compilePlanToDirectory,
35
43
  } from "./commands/plan-compile.js";
36
44
  import { initializePlan } from "./commands/plan-init.js";
37
45
  import {
@@ -92,7 +100,7 @@ Commands:
92
100
  init Create a local empty Foundation Plan
93
101
  push Send the local Foundation Plan to First Draft
94
102
  status Read the current whole-graph analysis status
95
- compile Compile and publish the current Foundation Plan
103
+ compile Compile the current Foundation Plan
96
104
 
97
105
  Options:
98
106
  -h, --help Show help
@@ -173,18 +181,22 @@ const PLAN_COMPILE_HELP = `First Draft CLI
173
181
 
174
182
  Usage:
175
183
  firstdraft plan compile
184
+ firstdraft plan compile --output <absent-directory>
176
185
 
177
186
  Options:
178
- -h, --help Show help
187
+ --output <absent-directory> Materialize the generated application here
188
+ -h, --help Show help
179
189
 
180
190
  Environment:
181
191
  FIRSTDRAFT_API_TOKEN Authenticate API requests
182
192
  FIRSTDRAFT_API_URL Override the initial API origin
183
193
 
184
194
  The command submits the exact current whole-file Plan, waits for its analysis,
185
- and proceeds only when that analysis is valid. It then conditionally creates or
186
- replays the internal GitHub Publication lifecycle. Progress is written to
187
- stderr. Success prints only the validated private GitHub repository URL.
195
+ and proceeds only when that analysis is valid. Without --output, it conditionally
196
+ creates or replays the internal GitHub Publication lifecycle and prints the
197
+ private repository URL. With --output, it starts one direct Compilation and
198
+ atomically materializes the verified artifact into an absent directory without
199
+ starting GitHub Publication. Progress is written to stderr.
188
200
  `;
189
201
 
190
202
  const COMPILATION_HELP = `First Draft CLI
@@ -312,6 +324,24 @@ const PLAN_COMPILE_ANALYSIS_REJECTED_DETAIL =
312
324
  "First Draft rejected the current analysis status request.";
313
325
  const PLAN_COMPILE_ANALYSIS_NOT_VALID_DETAIL =
314
326
  "The current Foundation Plan analysis is not valid. Inspect its status and diagnostics before compiling again.";
327
+ const PLAN_COMPILE_LOCAL_PLAN_CHANGED_DETAIL =
328
+ "The local Foundation Plan changed after validation. Run 'firstdraft plan compile' again to submit the current bytes.";
329
+ const PLAN_COMPILE_DIRECT_REQUEST_OUTCOME_UNKNOWN_DETAIL =
330
+ "A Compilation may have started, but its response could not be verified. Do not rerun 'firstdraft plan compile --output' or start another Compilation until the current Project is reconciled.";
331
+ const PLAN_COMPILE_DIRECT_START_REJECTED_DETAIL =
332
+ "First Draft rejected the direct Compilation request.";
333
+ const PLAN_COMPILE_DIRECT_STATUS_UNAVAILABLE_DETAIL =
334
+ "Could not read the retained Compilation status. Use current.compilation.id with 'firstdraft compilation status'; do not start another Compilation.";
335
+ const PLAN_COMPILE_DIRECT_STATUS_INVALID_DETAIL =
336
+ "First Draft returned an invalid status for the retained Compilation. Preserve current.compilation.id for contract reconciliation; do not start another Compilation.";
337
+ const PLAN_COMPILE_DIRECT_CHANGED_DETAIL =
338
+ "The pinned Compilation changed while being polled. The command stopped without downloading an artifact.";
339
+ const PLAN_COMPILE_DIRECT_TIMEOUT_DETAIL =
340
+ "The retained Compilation is still processing after the bounded ten-minute wait. Use current.compilation.id with 'firstdraft compilation status'; do not rerun 'firstdraft plan compile --output' or start another Compilation.";
341
+ const PLAN_COMPILE_DIRECT_FAILED_DETAIL =
342
+ "The pinned Compilation failed. No artifact was downloaded or materialized.";
343
+ const PLAN_COMPILE_DIRECT_CANCELLED_DETAIL =
344
+ "The pinned Compilation was cancelled. No artifact was downloaded or materialized.";
315
345
  const PLAN_PUBLISH_INCOMPATIBLE_STATE_DETAIL =
316
346
  "The saved Foundation Plan ETag is incompatible with publication. No network request was made; reconcile the CLI and server contract.";
317
347
  const PLAN_PUBLISH_NOT_PUSHED_DETAIL =
@@ -357,6 +387,12 @@ const COMPILATION_ARTIFACT_INVALID_DETAIL =
357
387
  "The downloaded Compilation artifact did not satisfy the integrity contract. No files were materialized.";
358
388
  const COMPILATION_MATERIALIZATION_FAILED_DETAIL =
359
389
  "The validated Compilation artifact could not be materialized at the requested absent output path.";
390
+ const PLAN_COMPILE_DIRECT_ARTIFACT_UNAVAILABLE_DETAIL =
391
+ "Could not download the retained Compilation artifact. Use current.compilation.id with 'firstdraft compilation download'; do not start another Compilation.";
392
+ const PLAN_COMPILE_DIRECT_ARTIFACT_INVALID_DETAIL =
393
+ "The retained Compilation artifact did not satisfy the integrity contract. Preserve current.compilation.id for reconciliation; do not start another Compilation.";
394
+ const PLAN_COMPILE_DIRECT_MATERIALIZATION_FAILED_DETAIL =
395
+ "The retained Compilation artifact was validated but could not be materialized. Use current.compilation.id with 'firstdraft compilation download' after repairing the output path; do not start another Compilation.";
360
396
  const COMPILATION_INVALID_OUTPUT_PATH_DETAIL =
361
397
  "The compilation output path must be absent beneath an existing real directory. No network request was made.";
362
398
  const GENERATE_UUID_INVALID_ARGUMENTS_DETAIL =
@@ -394,6 +430,7 @@ const GENERATE_APPLICATION_KEY_INVALID_ARGUMENTS_DETAIL =
394
430
  * @property {typeof pushPlan} [planCompilePush]
395
431
  * @property {typeof readPlanStatus} [planCompileReadStatus]
396
432
  * @property {typeof import("./commands/plan-publish.js").publishPlan} [planCompilePublish]
433
+ * @property {typeof import("./commands/compilation.js").compileAndDownload} [planCompileDownload]
397
434
  * @property {string} [apiUrl]
398
435
  * @property {string} [apiToken]
399
436
  */
@@ -422,6 +459,7 @@ const GENERATE_APPLICATION_KEY_INVALID_ARGUMENTS_DETAIL =
422
459
  * @property {typeof pushPlan} [planCompilePush]
423
460
  * @property {typeof readPlanStatus} [planCompileReadStatus]
424
461
  * @property {typeof import("./commands/plan-publish.js").publishPlan} [planCompilePublish]
462
+ * @property {typeof import("./commands/compilation.js").compileAndDownload} [planCompileDownload]
425
463
  * @property {string} [apiUrl]
426
464
  * @property {string} [apiToken]
427
465
  */
@@ -435,7 +473,7 @@ const GENERATE_APPLICATION_KEY_INVALID_ARGUMENTS_DETAIL =
435
473
  */
436
474
 
437
475
  /**
438
- * @typedef {Omit<CommandOptions, "cwd" | "createProjectId" | "createUuid" | "fileSystem" | "createTemporaryId" | "planStatusSleep" | "planStatusNow" | "planCompileSleep" | "planCompileNow" | "planPublishSleep" | "planPublishNow" | "apiUrl" | "planCompilePush" | "planCompileReadStatus" | "planCompilePublish"> & {cwd?: string, getCwd: () => string}} CompilationCommandOptions
476
+ * @typedef {Omit<CommandOptions, "cwd" | "createProjectId" | "createUuid" | "fileSystem" | "createTemporaryId" | "planStatusSleep" | "planStatusNow" | "planCompileSleep" | "planCompileNow" | "planPublishSleep" | "planPublishNow" | "apiUrl" | "planCompilePush" | "planCompileReadStatus" | "planCompilePublish" | "planCompileDownload"> & {cwd?: string, getCwd: () => string}} CompilationCommandOptions
439
477
  */
440
478
 
441
479
  /** @param {RunOptions} options */
@@ -463,6 +501,7 @@ export async function run({
463
501
  planCompilePush,
464
502
  planCompileReadStatus,
465
503
  planCompilePublish,
504
+ planCompileDownload,
466
505
  apiUrl = process.env.FIRSTDRAFT_API_URL,
467
506
  apiToken = process.env.FIRSTDRAFT_API_TOKEN,
468
507
  }) {
@@ -494,9 +533,12 @@ export async function run({
494
533
  planCompileNow,
495
534
  planPublishSleep,
496
535
  planPublishNow,
536
+ compilationSleep,
537
+ compilationNow,
497
538
  planCompilePush,
498
539
  planCompileReadStatus,
499
540
  planCompilePublish,
541
+ planCompileDownload,
500
542
  apiUrl,
501
543
  apiToken,
502
544
  });
@@ -583,9 +625,12 @@ async function runPlan({
583
625
  planCompileNow,
584
626
  planPublishSleep,
585
627
  planPublishNow,
628
+ compilationSleep,
629
+ compilationNow,
586
630
  planCompilePush,
587
631
  planCompileReadStatus,
588
632
  planCompilePublish,
633
+ planCompileDownload,
589
634
  apiUrl,
590
635
  apiToken,
591
636
  }) {
@@ -644,9 +689,12 @@ async function runPlan({
644
689
  planCompileNow,
645
690
  planPublishSleep,
646
691
  planPublishNow,
692
+ compilationSleep,
693
+ compilationNow,
647
694
  planCompilePush,
648
695
  planCompileReadStatus,
649
696
  planCompilePublish,
697
+ planCompileDownload,
650
698
  apiUrl,
651
699
  apiToken,
652
700
  });
@@ -1445,7 +1493,7 @@ async function runPlanStatus({
1445
1493
  }
1446
1494
 
1447
1495
  /**
1448
- * @param {Pick<CommandOptions, "argv" | "stdout" | "stderr" | "cwd" | "fetchFunction" | "planPushFileSystem" | "createTemporaryId" | "createRequestSignal" | "planCompileSleep" | "planCompileNow" | "planPublishSleep" | "planPublishNow" | "planCompilePush" | "planCompileReadStatus" | "planCompilePublish" | "apiUrl" | "apiToken">} options
1496
+ * @param {Pick<CommandOptions, "argv" | "stdout" | "stderr" | "cwd" | "fetchFunction" | "planPushFileSystem" | "createTemporaryId" | "createRequestSignal" | "planCompileSleep" | "planCompileNow" | "planPublishSleep" | "planPublishNow" | "compilationSleep" | "compilationNow" | "planCompilePush" | "planCompileReadStatus" | "planCompilePublish" | "planCompileDownload" | "apiUrl" | "apiToken">} options
1449
1497
  */
1450
1498
  async function runPlanCompile({
1451
1499
  argv,
@@ -1460,16 +1508,22 @@ async function runPlanCompile({
1460
1508
  planCompileNow,
1461
1509
  planPublishSleep,
1462
1510
  planPublishNow,
1511
+ compilationSleep,
1512
+ compilationNow,
1463
1513
  planCompilePush,
1464
1514
  planCompileReadStatus,
1465
1515
  planCompilePublish,
1516
+ planCompileDownload,
1466
1517
  apiUrl,
1467
1518
  apiToken,
1468
1519
  }) {
1469
1520
  const parsed = parseArguments(() =>
1470
1521
  parseArgs({
1471
1522
  args: [...argv],
1472
- options: { help: { type: "boolean", short: "h" } },
1523
+ options: {
1524
+ output: { type: "string" },
1525
+ help: { type: "boolean", short: "h" },
1526
+ },
1473
1527
  allowPositionals: false,
1474
1528
  strict: true,
1475
1529
  tokens: true,
@@ -1489,41 +1543,67 @@ async function runPlanCompile({
1489
1543
  return 0;
1490
1544
  }
1491
1545
 
1546
+ const output = parsed.values.output;
1547
+ if (output !== undefined && output.length === 0) {
1548
+ writeJson(stderr, {
1549
+ error: "invalid_arguments",
1550
+ detail: PLAN_COMPILE_INVALID_ARGUMENTS_DETAIL,
1551
+ });
1552
+ return 2;
1553
+ }
1554
+
1492
1555
  const authorizedFetch = authenticatedFetch(fetchFunction, apiToken);
1493
1556
  if (authorizedFetch === null) {
1494
1557
  writeAuthenticationRequired(stderr);
1495
1558
  return 1;
1496
1559
  }
1497
1560
 
1498
- let result;
1499
1561
  const reportProgress = createPlanCompileProgressReporter(stderr);
1562
+ const shared = {
1563
+ cwd,
1564
+ apiUrl,
1565
+ fetchFunction: authorizedFetch,
1566
+ fileSystem: planPushFileSystem,
1567
+ createTemporaryId,
1568
+ createRequestSignal,
1569
+ analysisSleep: planCompileSleep,
1570
+ analysisNow: planCompileNow,
1571
+ push: planCompilePush,
1572
+ readStatus: planCompileReadStatus,
1573
+ onProgress: reportProgress,
1574
+ };
1575
+ if (output !== undefined) {
1576
+ try {
1577
+ const result = await compilePlanToDirectory({
1578
+ ...shared,
1579
+ output,
1580
+ compilationSleep,
1581
+ compilationNow,
1582
+ compile: planCompileDownload,
1583
+ });
1584
+ writeJson(stdout, result);
1585
+ return 0;
1586
+ } catch (error) {
1587
+ return writePlanCompileError(stderr, error);
1588
+ }
1589
+ }
1590
+
1500
1591
  try {
1501
- result = await compilePlan({
1502
- cwd,
1503
- apiUrl,
1504
- fetchFunction: authorizedFetch,
1505
- fileSystem: planPushFileSystem,
1506
- createTemporaryId,
1507
- createRequestSignal,
1508
- analysisSleep: planCompileSleep,
1509
- analysisNow: planCompileNow,
1592
+ const result = await compilePlan({
1593
+ ...shared,
1510
1594
  publicationSleep: planPublishSleep,
1511
1595
  publicationNow: planPublishNow,
1512
- push: planCompilePush,
1513
- readStatus: planCompileReadStatus,
1514
1596
  publish: planCompilePublish,
1515
- onProgress: reportProgress,
1516
1597
  });
1598
+ const repository =
1599
+ /** @type {NonNullable<typeof result.publication.repository>} */ (
1600
+ result.publication.repository
1601
+ );
1602
+ stdout.write(`${repository.html_url}\n`);
1603
+ return 0;
1517
1604
  } catch (error) {
1518
1605
  return writePlanCompileError(stderr, error);
1519
1606
  }
1520
-
1521
- const repository =
1522
- /** @type {NonNullable<typeof result.publication.repository>} */ (
1523
- result.publication.repository
1524
- );
1525
- stdout.write(`${repository.html_url}\n`);
1526
- return 0;
1527
1607
  }
1528
1608
 
1529
1609
  /** @param {Writer} writer @param {unknown} error */
@@ -1671,6 +1751,196 @@ function writePlanCompileError(writer, error) {
1671
1751
  return 1;
1672
1752
  }
1673
1753
 
1754
+ const retainedError =
1755
+ error instanceof CompilationRetainedError ? error : null;
1756
+ const compilationError = retainedError?.error ?? error;
1757
+ const retainedCompilation = retainedError?.current;
1758
+
1759
+ if (compilationError instanceof CompilationLocalStateError) {
1760
+ writeJson(writer, {
1761
+ error: "invalid_configuration",
1762
+ detail: PLAN_COMPILE_INCOMPATIBLE_STATE_DETAIL,
1763
+ });
1764
+ return 2;
1765
+ }
1766
+
1767
+ if (compilationError instanceof CompilationNotPushedError) {
1768
+ writeJson(writer, {
1769
+ error: "project_not_pushed",
1770
+ detail: PLAN_COMPILE_NOT_PUSHED_DETAIL,
1771
+ });
1772
+ return 1;
1773
+ }
1774
+
1775
+ if (compilationError instanceof CompilationLocalPlanChangedError) {
1776
+ writeJson(writer, {
1777
+ error: "local_plan_changed",
1778
+ detail: PLAN_COMPILE_LOCAL_PLAN_CHANGED_DETAIL,
1779
+ });
1780
+ return 1;
1781
+ }
1782
+
1783
+ if (compilationError instanceof CompilationRequestOutcomeUnknownError) {
1784
+ writeJson(writer, {
1785
+ error: "request_outcome_unknown",
1786
+ phase: "compilation",
1787
+ detail: PLAN_COMPILE_DIRECT_REQUEST_OUTCOME_UNKNOWN_DETAIL,
1788
+ ...(typeof compilationError.status === "number"
1789
+ ? { status: compilationError.status }
1790
+ : {}),
1791
+ ...(compilationError.response
1792
+ ? { response: compilationError.response }
1793
+ : {}),
1794
+ });
1795
+ return 1;
1796
+ }
1797
+
1798
+ if (
1799
+ (compilationError instanceof CompilationStartRejectedError ||
1800
+ compilationError instanceof CompilationStatusUnavailableError) &&
1801
+ isAuthenticationProblem(compilationError.status, compilationError.response)
1802
+ ) {
1803
+ writeAuthenticationRequired(
1804
+ writer,
1805
+ compilationError.status,
1806
+ /** @type {Record<string, unknown>} */ (compilationError.response),
1807
+ retainedCompilation,
1808
+ );
1809
+ return 1;
1810
+ }
1811
+
1812
+ if (compilationError instanceof CompilationStartRejectedError) {
1813
+ writeJson(writer, {
1814
+ error: "compilation_start_rejected",
1815
+ detail: PLAN_COMPILE_DIRECT_START_REJECTED_DETAIL,
1816
+ status: compilationError.status,
1817
+ response: compilationError.response,
1818
+ });
1819
+ return 1;
1820
+ }
1821
+
1822
+ if (compilationError instanceof CompilationStatusUnavailableError) {
1823
+ writeJson(writer, {
1824
+ error: "compilation_status_unavailable",
1825
+ detail: PLAN_COMPILE_DIRECT_STATUS_UNAVAILABLE_DETAIL,
1826
+ ...(typeof compilationError.status === "number"
1827
+ ? { status: compilationError.status }
1828
+ : {}),
1829
+ ...(compilationError.response
1830
+ ? { response: compilationError.response }
1831
+ : {}),
1832
+ ...(retainedCompilation ? { current: retainedCompilation } : {}),
1833
+ });
1834
+ return 1;
1835
+ }
1836
+
1837
+ if (compilationError instanceof CompilationStatusInvalidError) {
1838
+ writeJson(writer, {
1839
+ error: "invalid_compilation_status",
1840
+ detail: PLAN_COMPILE_DIRECT_STATUS_INVALID_DETAIL,
1841
+ status: compilationError.status,
1842
+ ...(retainedCompilation ? { current: retainedCompilation } : {}),
1843
+ });
1844
+ return 1;
1845
+ }
1846
+
1847
+ if (compilationError instanceof CompilationChangedError) {
1848
+ writeJson(writer, {
1849
+ error: "compilation_changed",
1850
+ detail: PLAN_COMPILE_DIRECT_CHANGED_DETAIL,
1851
+ current: compilationError.current,
1852
+ });
1853
+ return 1;
1854
+ }
1855
+
1856
+ if (compilationError instanceof CompilationTimeoutError) {
1857
+ writeJson(writer, {
1858
+ error: "compilation_wait_timed_out",
1859
+ detail: PLAN_COMPILE_DIRECT_TIMEOUT_DETAIL,
1860
+ current: compilationError.current,
1861
+ });
1862
+ return 1;
1863
+ }
1864
+
1865
+ if (compilationError instanceof CompilationFailedError) {
1866
+ writeJson(writer, {
1867
+ error: "compilation_failed",
1868
+ detail: PLAN_COMPILE_DIRECT_FAILED_DETAIL,
1869
+ current: compilationError.current,
1870
+ });
1871
+ return 1;
1872
+ }
1873
+
1874
+ if (compilationError instanceof CompilationCancelledError) {
1875
+ writeJson(writer, {
1876
+ error: "compilation_cancelled",
1877
+ detail: PLAN_COMPILE_DIRECT_CANCELLED_DETAIL,
1878
+ current: compilationError.current,
1879
+ });
1880
+ return 1;
1881
+ }
1882
+
1883
+ if (compilationError instanceof CompilationArtifactUnavailableError) {
1884
+ if (
1885
+ isAuthenticationProblem(
1886
+ compilationError.status,
1887
+ compilationError.response,
1888
+ )
1889
+ ) {
1890
+ writeAuthenticationRequired(
1891
+ writer,
1892
+ compilationError.status,
1893
+ /** @type {Record<string, unknown>} */ (compilationError.response),
1894
+ retainedCompilation,
1895
+ );
1896
+ return 1;
1897
+ }
1898
+ writeJson(writer, {
1899
+ error: "artifact_unavailable",
1900
+ detail: PLAN_COMPILE_DIRECT_ARTIFACT_UNAVAILABLE_DETAIL,
1901
+ ...(typeof compilationError.status === "number"
1902
+ ? { status: compilationError.status }
1903
+ : {}),
1904
+ ...(compilationError.response
1905
+ ? { response: compilationError.response }
1906
+ : {}),
1907
+ ...(retainedCompilation ? { current: retainedCompilation } : {}),
1908
+ });
1909
+ return 1;
1910
+ }
1911
+
1912
+ if (
1913
+ compilationError instanceof CompilationArtifactResponseInvalidError ||
1914
+ compilationError instanceof CompilationArtifactInvalidError
1915
+ ) {
1916
+ writeJson(writer, {
1917
+ error: "invalid_artifact",
1918
+ detail: PLAN_COMPILE_DIRECT_ARTIFACT_INVALID_DETAIL,
1919
+ ...(compilationError instanceof CompilationArtifactResponseInvalidError
1920
+ ? { status: compilationError.status }
1921
+ : {}),
1922
+ ...(retainedCompilation ? { current: retainedCompilation } : {}),
1923
+ });
1924
+ return 1;
1925
+ }
1926
+
1927
+ if (compilationError instanceof CompilationOutputPathError) {
1928
+ writeJson(writer, {
1929
+ error: "invalid_output_path",
1930
+ detail: COMPILATION_INVALID_OUTPUT_PATH_DETAIL,
1931
+ });
1932
+ return 2;
1933
+ }
1934
+
1935
+ if (compilationError instanceof CompilationMaterializationError) {
1936
+ writeJson(writer, {
1937
+ error: "materialization_failed",
1938
+ detail: PLAN_COMPILE_DIRECT_MATERIALIZATION_FAILED_DETAIL,
1939
+ ...(retainedCompilation ? { current: retainedCompilation } : {}),
1940
+ });
1941
+ return 1;
1942
+ }
1943
+
1674
1944
  if (error instanceof PublicationLocalStateError) {
1675
1945
  writeJson(writer, {
1676
1946
  error: "invalid_configuration",
@@ -1935,13 +2205,15 @@ function writeJson(writer, value) {
1935
2205
  * @param {Writer} writer
1936
2206
  * @param {number} [status]
1937
2207
  * @param {Record<string, unknown>} [response]
2208
+ * @param {import("./commands/compilation.js").CompilationResponse} [current]
1938
2209
  */
1939
- function writeAuthenticationRequired(writer, status, response) {
2210
+ function writeAuthenticationRequired(writer, status, response, current) {
1940
2211
  writeJson(writer, {
1941
2212
  error: "authentication_required",
1942
2213
  detail: AUTHENTICATION_REQUIRED_DETAIL,
1943
2214
  ...(status === undefined ? {} : { status }),
1944
2215
  ...(response === undefined ? {} : { response }),
2216
+ ...(current === undefined ? {} : { current }),
1945
2217
  });
1946
2218
  }
1947
2219