primitive-admin 1.2.0-alpha.6 → 1.2.0-alpha.8

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 (110) hide show
  1. package/README.md +9 -3
  2. package/assets/skill/skills/primitive-platform/SKILL.md +12 -6
  3. package/dist/src/commands/apps-children.d.ts +1 -1
  4. package/dist/src/commands/apps-children.js +172 -28
  5. package/dist/src/commands/apps-children.js.map +1 -1
  6. package/dist/src/commands/auth.js +147 -38
  7. package/dist/src/commands/auth.js.map +1 -1
  8. package/dist/src/commands/config.js +43 -4
  9. package/dist/src/commands/config.js.map +1 -1
  10. package/dist/src/commands/database-types.js +313 -13
  11. package/dist/src/commands/database-types.js.map +1 -1
  12. package/dist/src/commands/databases.js +143 -54
  13. package/dist/src/commands/databases.js.map +1 -1
  14. package/dist/src/commands/documents.js +70 -11
  15. package/dist/src/commands/documents.js.map +1 -1
  16. package/dist/src/commands/init.d.ts +7 -0
  17. package/dist/src/commands/init.js +9 -1
  18. package/dist/src/commands/init.js.map +1 -1
  19. package/dist/src/commands/llm.js +6 -9
  20. package/dist/src/commands/llm.js.map +1 -1
  21. package/dist/src/commands/settings.d.ts +9 -12
  22. package/dist/src/commands/settings.js +79 -31
  23. package/dist/src/commands/settings.js.map +1 -1
  24. package/dist/src/commands/sync-app-settings.d.ts +12 -2
  25. package/dist/src/commands/sync-app-settings.js +35 -10
  26. package/dist/src/commands/sync-app-settings.js.map +1 -1
  27. package/dist/src/commands/sync.d.ts +118 -6
  28. package/dist/src/commands/sync.js +638 -65
  29. package/dist/src/commands/sync.js.map +1 -1
  30. package/dist/src/lib/api-client.d.ts +25 -6
  31. package/dist/src/lib/api-client.js +106 -72
  32. package/dist/src/lib/api-client.js.map +1 -1
  33. package/dist/src/lib/app-settings-descriptor.d.ts +38 -0
  34. package/dist/src/lib/app-settings-descriptor.js +96 -4
  35. package/dist/src/lib/app-settings-descriptor.js.map +1 -1
  36. package/dist/src/lib/child-apps-local.d.ts +45 -21
  37. package/dist/src/lib/child-apps-local.js +68 -30
  38. package/dist/src/lib/child-apps-local.js.map +1 -1
  39. package/dist/src/lib/credentials-home.d.ts +51 -0
  40. package/dist/src/lib/credentials-home.js +169 -0
  41. package/dist/src/lib/credentials-home.js.map +1 -0
  42. package/dist/src/lib/credentials-lock.d.ts +80 -0
  43. package/dist/src/lib/credentials-lock.js +222 -0
  44. package/dist/src/lib/credentials-lock.js.map +1 -0
  45. package/dist/src/lib/credentials-store.d.ts +92 -5
  46. package/dist/src/lib/credentials-store.js +377 -53
  47. package/dist/src/lib/credentials-store.js.map +1 -1
  48. package/dist/src/lib/env-resolver-core.d.ts +1 -1
  49. package/dist/src/lib/env-resolver-core.js.map +1 -1
  50. package/dist/src/lib/function-bundle.d.ts +38 -18
  51. package/dist/src/lib/function-bundle.js +60 -35
  52. package/dist/src/lib/function-bundle.js.map +1 -1
  53. package/dist/src/lib/function-collect.d.ts +1 -1
  54. package/dist/src/lib/function-collect.js +4 -0
  55. package/dist/src/lib/function-collect.js.map +1 -1
  56. package/dist/src/lib/function-document-types.d.ts +5 -3
  57. package/dist/src/lib/function-document-types.js +10 -14
  58. package/dist/src/lib/function-document-types.js.map +1 -1
  59. package/dist/src/lib/function-source-roots.d.ts +67 -0
  60. package/dist/src/lib/function-source-roots.js +148 -0
  61. package/dist/src/lib/function-source-roots.js.map +1 -0
  62. package/dist/src/lib/function-sync.d.ts +27 -0
  63. package/dist/src/lib/function-sync.js +16 -3
  64. package/dist/src/lib/function-sync.js.map +1 -1
  65. package/dist/src/lib/function-triggers.d.ts +3 -15
  66. package/dist/src/lib/function-triggers.js +10 -72
  67. package/dist/src/lib/function-triggers.js.map +1 -1
  68. package/dist/src/lib/function-typecheck.d.ts +37 -2
  69. package/dist/src/lib/function-typecheck.js +210 -28
  70. package/dist/src/lib/function-typecheck.js.map +1 -1
  71. package/dist/src/lib/generated-config-surfaces.d.ts +148 -0
  72. package/dist/src/lib/generated-config-surfaces.js +229 -35
  73. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  74. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  75. package/dist/src/lib/generated-sdk-types.js +1 -1
  76. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  77. package/dist/src/lib/local-state.d.ts +21 -6
  78. package/dist/src/lib/local-state.js +78 -34
  79. package/dist/src/lib/local-state.js.map +1 -1
  80. package/dist/src/lib/login-scope-lines.d.ts +1 -1
  81. package/dist/src/lib/login-scope-lines.js +1 -1
  82. package/dist/src/lib/login-scope-lines.js.map +1 -1
  83. package/dist/src/lib/project-config.d.ts +7 -0
  84. package/dist/src/lib/project-config.js +22 -1
  85. package/dist/src/lib/project-config.js.map +1 -1
  86. package/dist/src/lib/push-failure-report.d.ts +45 -0
  87. package/dist/src/lib/push-failure-report.js +57 -0
  88. package/dist/src/lib/push-failure-report.js.map +1 -0
  89. package/dist/src/lib/root-import-decision.d.ts +9 -4
  90. package/dist/src/lib/root-import-decision.js +24 -3
  91. package/dist/src/lib/root-import-decision.js.map +1 -1
  92. package/dist/src/lib/scope-request.d.ts +8 -5
  93. package/dist/src/lib/scope-request.js +17 -8
  94. package/dist/src/lib/scope-request.js.map +1 -1
  95. package/dist/src/lib/sync-selectors.d.ts +5 -1
  96. package/dist/src/lib/sync-selectors.js +23 -13
  97. package/dist/src/lib/sync-selectors.js.map +1 -1
  98. package/dist/src/lib/transient-retry.d.ts +9 -0
  99. package/dist/src/lib/transient-retry.js +37 -0
  100. package/dist/src/lib/transient-retry.js.map +1 -1
  101. package/dist/src/lib/vars-override.d.ts +105 -0
  102. package/dist/src/lib/vars-override.js +143 -0
  103. package/dist/src/lib/vars-override.js.map +1 -0
  104. package/package.json +2 -2
  105. package/dist/src/lib/generated-workflow-model-fields.d.ts +0 -20
  106. package/dist/src/lib/generated-workflow-model-fields.js +0 -53
  107. package/dist/src/lib/generated-workflow-model-fields.js.map +0 -1
  108. package/dist/src/lib/workflow-field-descriptor.d.ts +0 -91
  109. package/dist/src/lib/workflow-field-descriptor.js +0 -153
  110. package/dist/src/lib/workflow-field-descriptor.js.map +0 -1
@@ -8,7 +8,7 @@ import { success, error, info, formatTable, formatId, formatDate, json, keyValue
8
8
  import { renderAggregateResult } from "../lib/aggregate-output.js";
9
9
  import { confirmPrompt } from "../lib/confirm-prompt.js";
10
10
  import { resolveOwnerUserId } from "../lib/resolve-owner.js";
11
- import { pageCursorOption, pageLimitOption, parsePageLimit, printEmptyPage, printPageHint, } from "../lib/list-options.js";
11
+ import { pageCursorOption, pageLimitOption, parsePageLimit, printEmptyPage, printPageHint, quoteCursorArg, } from "../lib/list-options.js";
12
12
  import { normalizeCliListEnvelope, wholeListEnvelope, } from "../lib/paginate.js";
13
13
  import { parseDataOption } from "../lib/data-input.js";
14
14
  import { parseFilterOptions } from "../lib/record-filter.js";
@@ -263,6 +263,7 @@ Examples:
263
263
  $ primitive documents records models <document-id>
264
264
  $ primitive documents records describe <document-id> <model-name>
265
265
  $ primitive documents records query <document-id> <model-name> --filter '{"status":"open"}'
266
+ $ primitive documents records query <document-id> <model-name> --sort '{"createdAt":-1}' --limit 50
266
267
  $ primitive documents records count <document-id> <model-name>
267
268
  $ primitive documents records save <document-id> <model-name> --data '{"qty":10}'
268
269
  $ primitive documents records patch <document-id> <model-name> <record-id> --data '{"qty":11}'
@@ -725,8 +726,11 @@ Permissions (enforced by the server, not the CLI):
725
726
  .option("--app <app-id>", "App ID")
726
727
  .option("--filter <json>", "Filter as JSON (e.g. '{\"status\":\"open\"}')")
727
728
  .option("--filter-file <path>", "Read filter from a JSON or TOML file")
728
- .option("--limit <n>", "Maximum number of records to return (max 100)", parseInt)
729
- .option("--cursor <cursor>", "Pagination cursor from a previous query")
729
+ .option("--sort <json>", "Sort as JSON, e.g. '{\"createdAt\":-1}'; 1 ascending, -1 descending, key order is precedence; repeat it with --cursor")
730
+ // Forwarded as typed: the server refuses a value outside 1–10000 with a
731
+ // sentence naming the maximum, which a CLI-side parse would hide.
732
+ .option("--limit <n>", "Records per page (default 100, max 10000)")
733
+ .option("--cursor <cursor>", "Pagination cursor from a previous query (valid only with the same --sort)")
730
734
  .option(DOCUMENT_FORMAT_FLAG, DOCUMENT_FORMAT_HELP)
731
735
  .option("--json", "Output as JSON")
732
736
  .action(async (documentId, modelName, options) => {
@@ -742,9 +746,21 @@ Permissions (enforced by the server, not the CLI):
742
746
  process.exit(1);
743
747
  }
744
748
  const filter = parseFilterOptions(options);
749
+ // The JSON is checked here; its shape (`{ field: 1 | -1 }`) is the
750
+ // route's to refuse, with its own `Invalid sort` message.
751
+ let sort;
752
+ if (options.sort !== undefined) {
753
+ try {
754
+ sort = JSON.parse(options.sort);
755
+ }
756
+ catch {
757
+ error("Invalid --sort JSON.");
758
+ process.exit(1);
759
+ }
760
+ }
745
761
  const client = new ApiClient();
746
762
  try {
747
- const result = await client.queryDocumentRecords(resolvedAppId, documentId, modelName, { filter, limit: options.limit, cursor: options.cursor, documentFormat });
763
+ const result = await client.queryDocumentRecords(resolvedAppId, documentId, modelName, { filter, sort, limit: options.limit, cursor: options.cursor, documentFormat });
748
764
  if (options.json) {
749
765
  json(result);
750
766
  return;
@@ -778,7 +794,9 @@ Permissions (enforced by the server, not the CLI):
778
794
  }));
779
795
  console.log(formatTable(items, columns));
780
796
  if (result.nextCursor) {
781
- info(`More results available. Use --cursor ${result.nextCursor}`);
797
+ // A cursor continues only the sort that minted it.
798
+ const sortArg = sort !== undefined ? ` --sort ${quoteCursorArg(JSON.stringify(sort))}` : "";
799
+ info(`More results available. Use --cursor ${result.nextCursor}${sortArg}`);
782
800
  }
783
801
  }
784
802
  catch (err) {
@@ -1467,10 +1485,11 @@ Permissions (enforced by the server, not the CLI):
1467
1485
  // Bulk-load sessions of a large document (#3434, criterion 9): a data noun
1468
1486
  // with `list` and `get` readers, per docs/cli-design.md, beside `snapshots`
1469
1487
  // below. The ACTION verb `documents ingest` is #3435's; these two are how an
1470
- // operator sees what a session did and why one stopped.
1488
+ // operator sees what a session did and why one stopped, and `abort` (#4475)
1489
+ // is how they give one up.
1471
1490
  const ingests = documents
1472
1491
  .command("ingests")
1473
- .description("Inspect a large document's bulk-load sessions");
1492
+ .description("Inspect or abort a large document's bulk-load sessions");
1474
1493
  ingests
1475
1494
  .command("list")
1476
1495
  .description("List a large document's bulk-load sessions, newest first")
@@ -1540,12 +1559,52 @@ Permissions (enforced by the server, not the CLI):
1540
1559
  process.exit(1);
1541
1560
  }
1542
1561
  });
1562
+ // Destructive — what the session uploaded is discarded — so it confirms
1563
+ // unless `-y`, and a non-TTY stdin without `-y` is refused before any
1564
+ // request, as `documents ingest` refuses it (#4475).
1565
+ ingests
1566
+ .command("abort")
1567
+ .description("Abort a bulk-load session and discard what it uploaded")
1568
+ .argument("<document-id>", "Document ID")
1569
+ .argument("<session-id>", "Session ID")
1570
+ .option("--app <app-id>", "App ID")
1571
+ .option("-y, --yes", "Skip the confirmation prompt")
1572
+ .option("--json", "Output as JSON")
1573
+ .action(async (documentId, sessionId, options) => {
1574
+ const resolvedAppId = resolveAppId(undefined, options);
1575
+ if (!options.yes) {
1576
+ if (!process.stdin.isTTY) {
1577
+ error("Aborting a bulk load discards what it uploaded. " +
1578
+ "Re-run with -y to confirm it without a prompt.");
1579
+ process.exit(1);
1580
+ }
1581
+ const confirmed = await confirmPrompt(`Abort bulk load ${sessionId} on ${documentId}? What it uploaded is ` +
1582
+ "discarded; rows a committed load already applied stay.");
1583
+ if (!confirmed) {
1584
+ info("Cancelled.");
1585
+ return;
1586
+ }
1587
+ }
1588
+ const client = new ApiClient();
1589
+ try {
1590
+ const session = await client.abortDocumentIngest(resolvedAppId, documentId, sessionId);
1591
+ if (options.json) {
1592
+ json(session);
1593
+ return;
1594
+ }
1595
+ printIngestSession(session);
1596
+ }
1597
+ catch (err) {
1598
+ error(describeDocumentFailure(err));
1599
+ process.exit(1);
1600
+ }
1601
+ });
1543
1602
  // Snapshot builds of a large document (#3432, criterion 9): a data noun
1544
1603
  // with `list` and `get` readers, per docs/cli-design.md, over the app API's
1545
1604
  // read-only inspection routes.
1546
1605
  const snapshots = documents
1547
1606
  .command("snapshots")
1548
- .description("Inspect a large document's snapshot builds and their verification");
1607
+ .description("Inspect a large document's snapshots (its segments)");
1549
1608
  snapshots
1550
1609
  .command("list")
1551
1610
  .description("List a large document's snapshot builds, newest first")
@@ -1615,7 +1674,7 @@ Permissions (enforced by the server, not the CLI):
1615
1674
  });
1616
1675
  snapshots
1617
1676
  .command("get")
1618
- .description("Show one snapshot build, its verification result and where its time went")
1677
+ .description("Show one snapshot (a segment): its state, rows and chunks")
1619
1678
  .argument("<document-id>", "Document ID")
1620
1679
  .argument("<build-id>", "Build ID")
1621
1680
  .option("--app <app-id>", "App ID")
@@ -1653,10 +1712,10 @@ Permissions (enforced by the server, not the CLI):
1653
1712
  // on its own several times a day.
1654
1713
  snapshots
1655
1714
  .command("build")
1656
- .description("Snapshot a large document now: seal the open epoch and build a base")
1715
+ .description("Snapshot a large document now: start a segment export of its records")
1657
1716
  .argument("<document-id>", "Document ID")
1658
1717
  .option("--app <app-id>", "App ID")
1659
- .option("--wait", "Poll until the build has verified or failed")
1718
+ .option("--wait", "Poll until the segment is complete or failed")
1660
1719
  .option("--timeout <seconds>", "Give up waiting after this many seconds")
1661
1720
  .option("--json", "Output as JSON")
1662
1721
  .action(async (documentId, options) => {