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

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 (98) hide show
  1. package/assets/skill/skills/primitive-platform/SKILL.md +17 -0
  2. package/dist/src/commands/auth.js +7 -4
  3. package/dist/src/commands/auth.js.map +1 -1
  4. package/dist/src/commands/connections.js +11 -12
  5. package/dist/src/commands/connections.js.map +1 -1
  6. package/dist/src/commands/database-type-configs.js +2 -76
  7. package/dist/src/commands/database-type-configs.js.map +1 -1
  8. package/dist/src/commands/databases.d.ts +9 -0
  9. package/dist/src/commands/databases.js +67 -367
  10. package/dist/src/commands/databases.js.map +1 -1
  11. package/dist/src/commands/documents.d.ts +32 -2
  12. package/dist/src/commands/documents.js +281 -685
  13. package/dist/src/commands/documents.js.map +1 -1
  14. package/dist/src/commands/functions.js +2 -2
  15. package/dist/src/commands/functions.js.map +1 -1
  16. package/dist/src/commands/sync.d.ts +31 -81
  17. package/dist/src/commands/sync.js +228 -1113
  18. package/dist/src/commands/sync.js.map +1 -1
  19. package/dist/src/lib/api-client.d.ts +30 -199
  20. package/dist/src/lib/api-client.js +31 -297
  21. package/dist/src/lib/api-client.js.map +1 -1
  22. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +6 -7
  23. package/dist/src/lib/codegen-shared/generatedFiles.js +2 -2
  24. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -1
  25. package/dist/src/lib/codegen-shared/prettierStable.d.ts +1 -1
  26. package/dist/src/lib/codegen-shared/prettierStable.js +1 -1
  27. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +2 -2
  28. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +2 -2
  29. package/dist/src/lib/config-object-descriptor.js +1 -5
  30. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  31. package/dist/src/lib/config-surface.d.ts +2 -1
  32. package/dist/src/lib/config-surface.js +4 -1
  33. package/dist/src/lib/config-surface.js.map +1 -1
  34. package/dist/src/lib/connections-list.d.ts +10 -0
  35. package/dist/src/lib/connections-list.js +18 -0
  36. package/dist/src/lib/connections-list.js.map +1 -0
  37. package/dist/src/lib/csv.d.ts +8 -9
  38. package/dist/src/lib/csv.js +3 -4
  39. package/dist/src/lib/csv.js.map +1 -1
  40. package/dist/src/lib/db-codegen/dbNaming.d.ts +2 -1
  41. package/dist/src/lib/db-codegen/dbNaming.js +2 -1
  42. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
  43. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +2 -2
  44. package/dist/src/lib/db-codegen/dbTsTypes.js +2 -2
  45. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +59 -1
  46. package/dist/src/lib/db-codegen/dbTypeIR.js +12 -1
  47. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
  48. package/dist/src/lib/document-export-record-log.d.ts +57 -0
  49. package/dist/src/lib/document-export-record-log.js +215 -0
  50. package/dist/src/lib/document-export-record-log.js.map +1 -0
  51. package/dist/src/lib/document-ingest-artifact.d.ts +13 -2
  52. package/dist/src/lib/document-ingest-artifact.js +7 -3
  53. package/dist/src/lib/document-ingest-artifact.js.map +1 -1
  54. package/dist/src/lib/document-ingest-rows.d.ts +16 -0
  55. package/dist/src/lib/document-ingest-rows.js +17 -0
  56. package/dist/src/lib/document-ingest-rows.js.map +1 -1
  57. package/dist/src/lib/document-ingest.d.ts +22 -0
  58. package/dist/src/lib/document-ingest.js +33 -0
  59. package/dist/src/lib/document-ingest.js.map +1 -1
  60. package/dist/src/lib/generated-allowlist.js +0 -20
  61. package/dist/src/lib/generated-allowlist.js.map +1 -1
  62. package/dist/src/lib/generated-config-surfaces.d.ts +40 -2
  63. package/dist/src/lib/generated-config-surfaces.js +160 -94
  64. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  65. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  66. package/dist/src/lib/generated-sdk-types.js +1 -1
  67. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  68. package/dist/src/lib/login-scope-lines.d.ts +15 -0
  69. package/dist/src/lib/login-scope-lines.js +22 -0
  70. package/dist/src/lib/login-scope-lines.js.map +1 -0
  71. package/dist/src/lib/paginate.d.ts +0 -5
  72. package/dist/src/lib/paginate.js +0 -5
  73. package/dist/src/lib/paginate.js.map +1 -1
  74. package/dist/src/lib/refresh-admin-credentials.d.ts +7 -0
  75. package/dist/src/lib/refresh-admin-credentials.js +16 -4
  76. package/dist/src/lib/refresh-admin-credentials.js.map +1 -1
  77. package/dist/src/lib/root-import-decision.d.ts +15 -14
  78. package/dist/src/lib/root-import-decision.js +44 -51
  79. package/dist/src/lib/root-import-decision.js.map +1 -1
  80. package/dist/src/lib/snapshot-build-rows.d.ts +21 -0
  81. package/dist/src/lib/snapshot-build-rows.js +22 -0
  82. package/dist/src/lib/snapshot-build-rows.js.map +1 -1
  83. package/dist/src/lib/snapshot-build.js +8 -3
  84. package/dist/src/lib/snapshot-build.js.map +1 -1
  85. package/dist/src/lib/swift-codegen/banners.d.ts +34 -7
  86. package/dist/src/lib/swift-codegen/banners.js +37 -7
  87. package/dist/src/lib/swift-codegen/banners.js.map +1 -1
  88. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +3 -3
  89. package/dist/src/lib/swift-codegen/functionGenerator.js +22 -17
  90. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  91. package/dist/src/lib/swift-codegen/generator.js +27 -27
  92. package/dist/src/lib/swift-codegen/generator.js.map +1 -1
  93. package/dist/src/lib/toml-database-config.d.ts +14 -75
  94. package/dist/src/lib/toml-database-config.js +14 -305
  95. package/dist/src/lib/toml-database-config.js.map +1 -1
  96. package/dist/src/lib/workflow-toml-validator.js +15 -1
  97. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  98. package/package.json +3 -5
@@ -33,7 +33,6 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
33
33
  "as",
34
34
  "asBase64",
35
35
  "attachments",
36
- "batch",
37
36
  "blobId",
38
37
  "blobIds",
39
38
  "blockKey",
@@ -66,10 +65,8 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
66
65
  "deepLink",
67
66
  "default",
68
67
  "description",
69
- "direction",
70
68
  "documentAlias",
71
69
  "documentId",
72
- "dryRun",
73
70
  "durationMs",
74
71
  "email",
75
72
  "events",
@@ -118,14 +115,12 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
118
115
  "offset",
119
116
  "onConflict",
120
117
  "onPartialFailure",
121
- "operationName",
122
118
  "operations",
123
119
  "options",
124
120
  "output",
125
121
  "ownerOnly",
126
122
  "page",
127
123
  "pageSize",
128
- "params",
129
124
  "payload",
130
125
  "perUser",
131
126
  "permission",
@@ -152,7 +147,6 @@ export const GENERATED_ALLOWLISTED_FIELDS = [
152
147
  "signupEndDay",
153
148
  "signupStartDay",
154
149
  "skipWhenSkipped",
155
- "sort",
156
150
  "source",
157
151
  "step",
158
152
  "strict",
@@ -206,22 +200,8 @@ export const GENERATED_KNOWN_KINDS = [
206
200
  "collection.grantGroupPermission",
207
201
  "collection.removeDocument",
208
202
  "create",
209
- "database.aggregate",
210
- "database.aggregateForUser",
211
- "database.applyToQuery",
212
- "database.applyToQueryForUser",
213
- "database.batch",
214
- "database.batchForUser",
215
- "database.count",
216
- "database.countForUser",
217
203
  "database.create",
218
204
  "database.delete",
219
- "database.mutate",
220
- "database.mutateForUser",
221
- "database.pipeline",
222
- "database.pipelineForUser",
223
- "database.query",
224
- "database.queryForUser",
225
205
  "database.syncIndexes",
226
206
  "delay",
227
207
  "document.bulkUpdate",
@@ -1 +1 @@
1
- {"version":3,"file":"generated-allowlist.js","sourceRoot":"","sources":["../../../src/lib/generated-allowlist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,4BAA4B,GAAsB;IAC7D,kBAAkB;IAClB,WAAW;IACX,YAAY;I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BAA4B;IAC5B,uBAAuB;IACvB,sBAAsB;IACtB,gBAAgB;IAChB,gBAAgB;IAChB,mBAAmB;IACnB,uBAAuB;IACvB,8BAA8B;IAC9B,eAAe;IACf,YAAY;IACZ,YAAY;IACZ,oBAAoB;IACpB,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;IACjB,uBAAuB;IACvB,cAAc;IACd,cAAc;IACd,mBAAmB;IACnB,2BAA2B;IAC3B,iBAAiB;IACjB,oBAAoB;IACpB,MAAM;IACN,kBAAkB;IAClB,eAAe;IACf,UAAU;IACV,cAAc;IACd,cAAc;IACd,YAAY;IACZ,aAAa;IACb,iBAAiB;IACjB,eAAe;IACf,kBAAkB;IAClB,gBAAgB;IAChB,MAAM;IACN,mBAAmB;IACnB,gBAAgB;IAChB,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,UAAU;IACV,cAAc;IACd,yBAAyB;IACzB,eAAe;CAChB,CAAC"}
1
+ {"version":3,"file":"generated-allowlist.js","sourceRoot":"","sources":["../../../src/lib/generated-allowlist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,4BAA4B,GAAsB;IAC7D,kBAAkB;IAClB,WAAW;IACX,YAAY;IACZ,QAAQ;IACR,UAAU;IACV,OAAO;IACP,IAAI;IACJ,UAAU;IACV,aAAa;IACb,QAAQ;IACR,SAAS;IACT,UAAU;IACV,WAAW;IACX,UAAU;IACV,MAAM;IACN,UAAU;IACV,UAAU;IACV,WAAW;IACX,iBAAiB;IACjB,OAAO;IACP,UAAU;IACV,UAAU;IACV,YAAY;IACZ,cAAc;IACd,gBAAgB;IAChB,aAAa;IACb,UAAU;IACV,SAAS;IACT,eAAe;IACf,aAAa;IACb,SAAS;IACT,iBAAiB;IACjB,QAAQ;IACR,QAAQ;IACR,aAAa;IACb,MAAM;IACN,YAAY;IACZ,cAAc;IACd,UAAU;IACV,SAAS;IAC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ACN,QAAQ;IACR,UAAU;IACV,UAAU;IACV,OAAO;IACP,WAAW;IACX,SAAS;IACT,YAAY;IACZ,MAAM;IACN,aAAa;IACb,cAAc;CACf,CAAC;AAEF,0GAA0G;AAC1G,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACtD,iBAAiB;IACjB,iBAAiB;IACjB,wBAAwB;IACxB,aAAa;IACb,eAAe;IACf,gBAAgB;IAChB,aAAa;IACb,YAAY;IACZ,SAAS;IACT,wBAAwB;IACxB,mBAAmB;IACnB,mBAAmB;IACnB,iCAAiC;IACjC,2BAA2B;IAC3B,QAAQ;IACR,iBAAiB;IACjB,iBAAiB;IACjB,sBAAsB;IACtB,OAAO;IACP,qBAAqB;IACrB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,qBAAqB;IACrB,sCAAsC;IACtC,yBAAyB;IACzB,4BAA4B;IAC5B,uBAAuB;IACvB,sBAAsB;IACtB,gBAAgB;IAChB,gBAAgB;IAChB,mBAAmB;IACnB,uBAAuB;IACvB,8BAA8B;IAC9B,eAAe;IACf,YAAY;IACZ,YAAY;IACZ,oBAAoB;IACpB,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;IACjB,uBAAuB;IACvB,cAAc;IACd,cAAc;IACd,mBAAmB;IACnB,2BAA2B;IAC3B,iBAAiB;IACjB,oBAAoB;IACpB,MAAM;IACN,kBAAkB;IAClB,eAAe;IACf,UAAU;IACV,cAAc;IACd,cAAc;IACd,YAAY;IACZ,aAAa;IACb,iBAAiB;IACjB,eAAe;IACf,kBAAkB;IAClB,gBAAgB;IAChB,MAAM;IACN,mBAAmB;IACnB,gBAAgB;IAChB,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,UAAU;IACV,cAAc;IACd,yBAAyB;IACzB,eAAe;CAChB,CAAC"}
@@ -31,7 +31,7 @@
31
31
  * server; the CLI vendors them at build time into
32
32
  * `cli/src/lib/generated-config-surfaces.ts`
33
33
  * (`cli/scripts/gen-config-surfaces.mjs`), the same server→CLI vendoring
34
- * `gen-operation-def-descriptor.mjs` (#1544) already uses, so the published CLI
34
+ * `gen-workflow-schema-descriptor.mjs` (#1442) already uses, so the published CLI
35
35
  * still imports no server code at runtime.
36
36
  *
37
37
  * ── Scope: declarative classification and coverage ONLY ──────────────────
@@ -1101,6 +1101,19 @@ export interface RetiredConfigKey {
1101
1101
  request: string;
1102
1102
  }
1103
1103
  export declare const RETIRED_CONFIG_KEYS: Record<string, Record<string, RetiredConfigKey>>;
1104
+ /**
1105
+ * Top-level TOML tables a configuration object's FILE retired — keyed by the
1106
+ * surface's label, then by the table key. Only the TOML half exists: these were
1107
+ * sub-trees applied through their own endpoints, never request keys of the
1108
+ * object itself, so no request body can carry one.
1109
+ *
1110
+ * Without an entry here a retired table would be answered as an unrecognized
1111
+ * one ("check the spelling, or upgrade the CLI"), which is backwards for a
1112
+ * table removed on purpose.
1113
+ */
1114
+ export declare const RETIRED_DOCUMENT_KEYS: Record<string, Record<string, RetiredTomlSpelling>>;
1115
+ /** The retired-table guidance for `key` on the surface labelled `label`, or null. */
1116
+ export declare function retiredDocumentKey(label: string, key: string): RetiredTomlSpelling | null;
1104
1117
  /** The retired-key entry for `key` under `prefix`, or null when it is simply unknown. */
1105
1118
  export declare function retiredConfigKey(prefix: string, key: string): RetiredConfigKey | null;
1106
1119
  /**
@@ -1968,7 +1981,7 @@ export declare function validateSigningSecretDeclaration(input: {
1968
1981
  * `preflight`.
1969
1982
  */
1970
1983
  /** The rule ids this module owns — the union type below anchors them (#3373). */
1971
- export declare const WORKFLOW_RULE_IDS: readonly ["system-access-rule"];
1984
+ export declare const WORKFLOW_RULE_IDS: readonly ["system-access-rule", "retired-database-step-kind"];
1972
1985
  type WorkflowRuleId = (typeof WORKFLOW_RULE_IDS)[number];
1973
1986
  /** A violation of one of this module's rules, for a site to render. */
1974
1987
  export interface WorkflowRuleViolation extends RuleRefusal<WorkflowRuleId> {
@@ -1986,6 +1999,31 @@ export declare function checkWorkflowSystemAccessRule(input: {
1986
1999
  runAs?: unknown;
1987
2000
  accessRule?: unknown;
1988
2001
  }): WorkflowRuleViolation | null;
2002
+ /**
2003
+ * The DSL step kinds that executed a registered database operation (#3189,
2004
+ * phase 6 of project `server-functions`, matrix row M8).
2005
+ *
2006
+ * Every `database.*` runner except `database.syncIndexes` called
2007
+ * `DatabaseOperationsController.execute`, so retiring database operations
2008
+ * retires these fourteen kinds with them: the seven base kinds and their seven
2009
+ * `*ForUser` twins. `database.syncIndexes` (which calls the records index
2010
+ * route), `database.create` and `database.delete` (resource lifecycle) are not
2011
+ * here and keep running until the engine retires.
2012
+ */
2013
+ export declare const RETIRED_DATABASE_STEP_KINDS: readonly ["database.query", "database.mutate", "database.count", "database.aggregate", "database.pipeline", "database.applyToQuery", "database.batch", "database.queryForUser", "database.mutateForUser", "database.countForUser", "database.aggregateForUser", "database.pipelineForUser", "database.applyToQueryForUser", "database.batchForUser"];
2014
+ /**
2015
+ * Every step in a definition — or the one step a run has reached — whose kind
2016
+ * is a retired database kind, with the sentence naming the replacement.
2017
+ *
2018
+ * Walks the top-level `steps` and a `collect` step's nested `step`, the one
2019
+ * place a step definition nests another. Push (the CLI preflight), save, the
2020
+ * activation lint and the engine all ask this one question, so a definition is
2021
+ * refused by the same words wherever it is caught, and a run that reaches such
2022
+ * a step fails with them.
2023
+ */
2024
+ export declare function checkWorkflowRetiredStepKinds(input: {
2025
+ steps?: unknown;
2026
+ }): WorkflowRuleViolation[];
1989
2027
  export declare const WORKFLOW_SURFACE: ConfigObjectSurface;
1990
2028
  /**
1991
2029
  * Cron-expression and timezone VALIDITY — the half of `src/cron-parser.ts`
@@ -2440,7 +2440,44 @@ export const RETIRED_CONFIG_KEYS = {
2440
2440
  // #3997 — keyed by each table's TOML prefix. Only `database-type-config`
2441
2441
  // uses `[type]`, so that entry cannot reach another surface. The blob
2442
2442
  // bucket's `[bucket] ruleSetId` has its own entry under `bucket` (#4283).
2443
- type: { ruleSetId: RULE_SET_ID_RETIRED },
2443
+ //
2444
+ // #3189 — server-functions phase 6 retires database operations, and with
2445
+ // them the two type-level CEL keys that existed for operations: the access
2446
+ // an operation inherited and the gate on the (already retired, #3991)
2447
+ // database CEL context. Data access goes through a function, whose `access`
2448
+ // gate is the authorization; per-database values are resource metadata
2449
+ // categories. Refused rather than ignored: a file that keeps the line would
2450
+ // otherwise read as though it still gated something.
2451
+ type: {
2452
+ ruleSetId: RULE_SET_ID_RETIRED,
2453
+ defaultAccess: {
2454
+ toml: "`defaultAccess` is no longer a database type key (#3189): it was the " +
2455
+ "access database operations inherited, and operations are retired. " +
2456
+ "Read and write the type's records from a function — its `access` " +
2457
+ "gate is the authorization. Delete the line and push again.",
2458
+ request: "`defaultAccess` is retired (#3189): it was the access database " +
2459
+ "operations inherited, and operations are retired. Gate data access " +
2460
+ "with a function's `access` rule; omit the field.",
2461
+ },
2462
+ celContextAccess: {
2463
+ toml: "`celContextAccess` is no longer a database type key (#3189): the " +
2464
+ "database CEL context it gated is gone (#3991). Per-database values " +
2465
+ "are resource metadata categories, each with its own readRule and " +
2466
+ "writeRule. Delete the line and push again.",
2467
+ request: "`celContextAccess` is retired (#3189): the database CEL context it " +
2468
+ "gated is gone (#3991). Use a resource metadata category; omit the " +
2469
+ "field.",
2470
+ },
2471
+ metadataAccess: {
2472
+ toml: "`metadataAccess` is no longer a database type key (#3189): it was " +
2473
+ "the legacy spelling of `celContextAccess`, which gated the retired " +
2474
+ "database CEL context (#3991). Per-database values are resource " +
2475
+ "metadata categories. Delete the line and push again.",
2476
+ request: "`metadataAccess` is retired (#3189): the database CEL context it " +
2477
+ "gated is gone (#3991). Use a resource metadata category, which has " +
2478
+ "its own readRule and writeRule; omit the field.",
2479
+ },
2480
+ },
2444
2481
  groupTypeConfig: { ruleSetId: RULE_SET_ID_RETIRED },
2445
2482
  collectionTypeConfig: { ruleSetId: RULE_SET_ID_RETIRED },
2446
2483
  // #2803 — the OBJECT-level availability leaves TOML. The per-version
@@ -2615,6 +2652,41 @@ export const RETIRED_CONFIG_KEYS = {
2615
2652
  },
2616
2653
  },
2617
2654
  };
2655
+ /**
2656
+ * Top-level TOML tables a configuration object's FILE retired — keyed by the
2657
+ * surface's label, then by the table key. Only the TOML half exists: these were
2658
+ * sub-trees applied through their own endpoints, never request keys of the
2659
+ * object itself, so no request body can carry one.
2660
+ *
2661
+ * Without an entry here a retired table would be answered as an unrecognized
2662
+ * one ("check the spelling, or upgrade the CLI"), which is backwards for a
2663
+ * table removed on purpose.
2664
+ */
2665
+ export const RETIRED_DOCUMENT_KEYS = {
2666
+ // #3189 — server-functions phase 6 retires database operations and
2667
+ // type-scoped subscriptions. Data access and change feeds are a function's
2668
+ // now; the rows the two tables created are swept at deploy.
2669
+ "database-type-config": {
2670
+ operations: {
2671
+ toml: "`[[operations]]` is no longer part of a database type file (#3189): " +
2672
+ "database operations are retired. Read and write the type's records " +
2673
+ "from a function (`ctx.db(<databaseId>).model(<Model>)`), and call the " +
2674
+ "function from the client. Delete every `[[operations]]` block and " +
2675
+ "push again.",
2676
+ },
2677
+ subscriptions: {
2678
+ toml: "`[[subscriptions]]` is no longer part of a database type file " +
2679
+ "(#3189): type-scoped subscriptions are retired. Publish changes on a " +
2680
+ "channel from the function that writes them " +
2681
+ "(`ctx.channels.authorize` / `ctx.channels.publish`). Delete every " +
2682
+ "`[[subscriptions]]` block and push again.",
2683
+ },
2684
+ },
2685
+ };
2686
+ /** The retired-table guidance for `key` on the surface labelled `label`, or null. */
2687
+ export function retiredDocumentKey(label, key) {
2688
+ return RETIRED_DOCUMENT_KEYS[label]?.[key] ?? null;
2689
+ }
2618
2690
  /** The retired-key entry for `key` under `prefix`, or null when it is simply unknown. */
2619
2691
  export function retiredConfigKey(prefix, key) {
2620
2692
  return RETIRED_CONFIG_KEYS[prefix]?.[key] ?? null;
@@ -4222,7 +4294,10 @@ export function validateSigningSecretDeclaration(input) {
4222
4294
  * `preflight`.
4223
4295
  */
4224
4296
  /** The rule ids this module owns — the union type below anchors them (#3373). */
4225
- export const WORKFLOW_RULE_IDS = ["system-access-rule"];
4297
+ export const WORKFLOW_RULE_IDS = [
4298
+ "system-access-rule",
4299
+ "retired-database-step-kind",
4300
+ ];
4226
4301
  /** The one refusal constructor: a new branch cannot compile without an id. */
4227
4302
  function refuseWorkflowRule(ruleId, message) {
4228
4303
  return { ruleId, message };
@@ -4245,6 +4320,64 @@ export function checkWorkflowSystemAccessRule(input) {
4245
4320
  }
4246
4321
  return null;
4247
4322
  }
4323
+ /**
4324
+ * The DSL step kinds that executed a registered database operation (#3189,
4325
+ * phase 6 of project `server-functions`, matrix row M8).
4326
+ *
4327
+ * Every `database.*` runner except `database.syncIndexes` called
4328
+ * `DatabaseOperationsController.execute`, so retiring database operations
4329
+ * retires these fourteen kinds with them: the seven base kinds and their seven
4330
+ * `*ForUser` twins. `database.syncIndexes` (which calls the records index
4331
+ * route), `database.create` and `database.delete` (resource lifecycle) are not
4332
+ * here and keep running until the engine retires.
4333
+ */
4334
+ export const RETIRED_DATABASE_STEP_KINDS = [
4335
+ "database.query",
4336
+ "database.mutate",
4337
+ "database.count",
4338
+ "database.aggregate",
4339
+ "database.pipeline",
4340
+ "database.applyToQuery",
4341
+ "database.batch",
4342
+ "database.queryForUser",
4343
+ "database.mutateForUser",
4344
+ "database.countForUser",
4345
+ "database.aggregateForUser",
4346
+ "database.pipelineForUser",
4347
+ "database.applyToQueryForUser",
4348
+ "database.batchForUser",
4349
+ ];
4350
+ /**
4351
+ * Every step in a definition — or the one step a run has reached — whose kind
4352
+ * is a retired database kind, with the sentence naming the replacement.
4353
+ *
4354
+ * Walks the top-level `steps` and a `collect` step's nested `step`, the one
4355
+ * place a step definition nests another. Push (the CLI preflight), save, the
4356
+ * activation lint and the engine all ask this one question, so a definition is
4357
+ * refused by the same words wherever it is caught, and a run that reaches such
4358
+ * a step fails with them.
4359
+ */
4360
+ export function checkWorkflowRetiredStepKinds(input) {
4361
+ const violations = [];
4362
+ const visit = (step) => {
4363
+ if (!step || typeof step !== "object" || Array.isArray(step))
4364
+ return;
4365
+ const kind = step.kind;
4366
+ const id = step.id;
4367
+ if (typeof kind === "string" &&
4368
+ RETIRED_DATABASE_STEP_KINDS.includes(kind)) {
4369
+ const name = typeof id === "string" && id ? `step "${id}"` : "a step";
4370
+ violations.push(refuseWorkflowRule("retired-database-step-kind", `${name} uses ${kind}, which was retired with database operations — ` +
4371
+ "move its work into a server function (ctx.db(databaseId).model(name)) " +
4372
+ "and call that function from the workflow with a workflow.call step"));
4373
+ }
4374
+ if (kind === "collect")
4375
+ visit(step.step);
4376
+ };
4377
+ if (Array.isArray(input.steps))
4378
+ input.steps.forEach(visit);
4379
+ return violations;
4380
+ }
4248
4381
  // ── src/config-surface/workflow.ts ───────────────────────────────────────
4249
4382
  /**
4250
4383
  * The `workflow` configuration object's definition (issue #2644, phase 1).
@@ -4595,8 +4728,9 @@ export const WORKFLOW_SURFACE = {
4595
4728
  },
4596
4729
  // ── Cross-field rules (#3374) ─────────────────────────────────────────────
4597
4730
  //
4598
- // One rule the CLI's push preflight runs — through the vendored copy of
4599
- // `workflow-rules.ts` — and seven the server runs at save time. What stays
4731
+ // Two rules the CLI's push preflight runs — through the vendored copy of
4732
+ // `workflow-rules.ts` (the server runs both too) — and six more the server
4733
+ // runs at save time. What stays
4600
4734
  // UNDECLARED, on purpose: the step-body validation (`validateWorkflowDefinition`
4601
4735
  // and the `steps` structural sub-tree, which is not a field-table rule), and
4602
4736
  // the enable-time activation lint (`workflow-activation-lint.ts`, a transition
@@ -4613,6 +4747,17 @@ export const WORKFLOW_SURFACE = {
4613
4747
  stage: "preflight",
4614
4748
  handler: enforcedBy("src/config-surface/workflow-rules.ts", "checkWorkflowSystemAccessRule"),
4615
4749
  },
4750
+ {
4751
+ id: "retired-database-step-kind",
4752
+ description: "A step may not use a retired `database.*` kind (`database.query`, " +
4753
+ "`mutate`, `count`, `aggregate`, `pipeline`, `applyToQuery`, `batch` " +
4754
+ "and their `*ForUser` twins): each executed a registered database " +
4755
+ "operation, and operations retired (#3189). `database.syncIndexes`, " +
4756
+ "`database.create` and `database.delete` stay. Push, save, the " +
4757
+ "activation lint and the engine ask the same predicate.",
4758
+ stage: "preflight",
4759
+ handler: enforcedBy("src/config-surface/workflow-rules.ts", "checkWorkflowRetiredStepKinds"),
4760
+ },
4616
4761
  workflowApplyRule("run-as-value", "validateWorkflowIdentityConfig", '`runAs` must be "caller" or "system" when present — the runner has no ' +
4617
4762
  "third identity."),
4618
4763
  workflowApplyRule("capabilities-shape", "validateWorkflowIdentityConfig", "`capabilities` must be an array or set of capability strings."),
@@ -8952,20 +9097,21 @@ export const EMAIL_TEMPLATE_SURFACE = {
8952
9097
  * The `database-type-config` configuration object's definition (issue #2644, phase 3).
8953
9098
  *
8954
9099
  * `database-type-configs/<databaseType>.toml` is the most structured file in the sync
8955
- * slot: a `[type]` scalar table, plus four authored sub-trees that keep the
9100
+ * slot: a `[type]` scalar table, plus three authored sub-trees that keep the
8956
9101
  * validators that already own them, per the spec's scope boundary —
8957
9102
  *
8958
9103
  * `[models.*]` → the stored `schema` TOML string (`parseSchemaToml`)
8959
- * `[[operations]]` → `DatabaseTypeOperation` rows (`toml-params-validator.ts`)
8960
- * `[[subscriptions]]` → `DatabaseTypeSubscription` rows (#803)
8961
9104
  * `[triggers]` → the trigger-rule tree (`validateTriggerRules`)
8962
9105
  * `[metadata]`/`secrets` → the declared-access manifest (#1304)
8963
9106
  *
8964
- * `operations` and `subscriptions` are separate models with their own
8965
- * endpoints, so they are not fields of `DatabaseTypeConfig` at all; `schema`,
8966
- * `triggers` and `metadataManifest` ARE model fields and are declared
8967
- * `structural` here, naming the channel and the validator, so their absence
8968
- * from the `[type]` table reads as a decision rather than an omission.
9107
+ * `schema`, `triggers` and `metadataManifest` are model fields and are
9108
+ * declared `structural` here, naming the channel and the validator, so their
9109
+ * absence from the `[type]` table reads as a decision rather than an omission.
9110
+ *
9111
+ * #3189 — `[[operations]]` and `[[subscriptions]]` retired with database
9112
+ * operations and type-scoped subscriptions; `config push` refuses a file that
9113
+ * still carries either, with the sentence `retired-keys.ts` states
9114
+ * (`RETIRED_DOCUMENT_KEYS`).
8969
9115
  *
8970
9116
  * The exposed `[type]` scalars are exactly the file-OWNED ones (#1567): `sync
8971
9117
  * push` sends each as value-or-`null` so removing a line from the TOML clears
@@ -9004,30 +9150,6 @@ export const DATABASE_TYPE_SURFACE = {
9004
9150
  // spelling is retired in TOML (#3997): `retired-keys.ts`, `type`.
9005
9151
  validation: handledBy(DB_TYPE_HANDLER, "DatabaseTypeConfigController", "apply"),
9006
9152
  },
9007
- {
9008
- field: "metadataAccess",
9009
- tomlKey: "celContextAccess",
9010
- type: "string",
9011
- emit: "whenSet",
9012
- writableOn: BOTH,
9013
- // CEL, parsed before storing (#1336). The legacy `metadataAccess`
9014
- // spelling stays readable on push — see tomlOnlyKeys.
9015
- deprecated: {
9016
- note: "one CEL expression gates both read and update of the database " +
9017
- "CEL context; use a resource metadata category, which has " +
9018
- "separate readRule and writeRule",
9019
- },
9020
- validation: handledBy(DB_TYPE_HANDLER, "DatabaseTypeConfigController", "apply"),
9021
- },
9022
- {
9023
- field: "defaultAccess",
9024
- tomlKey: "defaultAccess",
9025
- type: "string",
9026
- emit: "whenSet",
9027
- writableOn: BOTH,
9028
- // CEL, plus the shared `md`-shape allowlist (#1523).
9029
- validation: handledBy(DB_TYPE_HANDLER, "DatabaseTypeConfigController", "apply"),
9030
- },
9031
9153
  {
9032
9154
  field: "autoPopulatedFields",
9033
9155
  tomlKey: "autoPopulatedFields",
@@ -9087,44 +9209,8 @@ export const DATABASE_TYPE_SURFACE = {
9087
9209
  note: "User who created the config; assigned server-side.",
9088
9210
  },
9089
9211
  },
9090
- tomlOnlyKeys: {
9091
- metadataAccess: {
9092
- kind: "deprecated",
9093
- note: "The legacy spelling of `celContextAccess`. Read on push when the " +
9094
- "newer key is absent (#1567 keeps `celContextAccess = \"\"` an " +
9095
- "explicit clear); pull writes `celContextAccess`.",
9096
- },
9097
- },
9098
- requestOnlyKeys: {
9099
- pendingOpDeletes: {
9100
- note: "Operation names this push is deleting, sent with the type-config " +
9101
- "PATCH so the server validates the remaining schema against the " +
9102
- "operations that will survive rather than the current set.",
9103
- },
9104
- pendingOpUpdates: {
9105
- note: "#1336 — the post-push form of the operations this push rewrites " +
9106
- "({ name, access, params }), so the child-op re-lint evaluates " +
9107
- "each against what the push is about to store rather than the " +
9108
- "stale row. Read by `type-config-access-lint.ts`, the same " +
9109
- "look-ahead contract as `pendingOpDeletes` / `finalOpNames`.",
9110
- },
9111
- pendingOpUpserts: {
9112
- modes: ["update"],
9113
- note: "#2732 — the full post-push BODY of every operation this push " +
9114
- "lands ({ name, type, modelName, access, definition, params }), so " +
9115
- "the schema-edit gate lints a rewritten operation as rewritten " +
9116
- "rather than as stored. That is what makes removing a model and " +
9117
- "rewriting the operations that named it a single push. Read by " +
9118
- "`pending-op-set.ts`, which honors an entry only when it is a " +
9119
- "whole operation body whose name `finalOpNames` keeps — anything " +
9120
- "less is ignored and the stored operation is gated instead. A " +
9121
- "create has no stored operations to gate.",
9122
- },
9123
- finalOpNames: {
9124
- note: "The operation names the file will end with, for the same " +
9125
- "look-ahead validation as `pendingOpDeletes`.",
9126
- },
9127
- },
9212
+ tomlOnlyKeys: {},
9213
+ requestOnlyKeys: {},
9128
9214
  responseOnlyKeys: {},
9129
9215
  },
9130
9216
  ],
@@ -9134,15 +9220,6 @@ export const DATABASE_TYPE_SURFACE = {
9134
9220
  note: "#666 — the `[models.<Name>.fields.*]` blocks, re-serialized into the " +
9135
9221
  "stored `schema` TOML string on push and merged back on pull.",
9136
9222
  },
9137
- operations: {
9138
- kind: "structural",
9139
- note: "The `[[operations]]` array. Keeps the validator that already owns it " +
9140
- "(`cli/src/lib/toml-params-validator.ts`) and its own endpoints.",
9141
- },
9142
- subscriptions: {
9143
- kind: "structural",
9144
- note: "#803 — the `[[subscriptions]]` array, applied through its own endpoints.",
9145
- },
9146
9223
  triggers: {
9147
9224
  kind: "structural",
9148
9225
  note: "The type's authored trigger table, stored on the type config as " +
@@ -9889,14 +9966,6 @@ export const SERVER_FUNCTION_SURFACE = {
9889
9966
  note: "#3462 — WHICH admin put the active version live. Same two doors, " +
9890
9967
  "same reason: the actor is observed, never declared.",
9891
9968
  },
9892
- runAs: {
9893
- kind: "server-owned",
9894
- note: "RETIRED from the write surface by #3279: function code acts as " +
9895
- "the system whoever invoked it, so the mode the column chose " +
9896
- "between no longer exists. Declared-and-deprecated storage only " +
9897
- "until phase 6 drops the column; a stored value decides nothing " +
9898
- "and is never echoed.",
9899
- },
9900
9969
  deleteLockedAt: {
9901
9970
  kind: "server-owned",
9902
9971
  note: "#3186 — the lease a hard delete takes before it scans for live " +
@@ -11115,8 +11184,6 @@ export const GENERATED_CONFIG_MODEL_FIELDS = {
11115
11184
  "databaseType",
11116
11185
  "ruleSetId",
11117
11186
  "triggers",
11118
- "metadataAccess",
11119
- "defaultAccess",
11120
11187
  "metadataManifest",
11121
11188
  "autoPopulatedFields",
11122
11189
  "timestamps",
@@ -11172,7 +11239,6 @@ export const GENERATED_CONFIG_MODEL_FIELDS = {
11172
11239
  "activeConfigId",
11173
11240
  "activeConfigActivatedAt",
11174
11241
  "activeConfigActivatedBy",
11175
- "runAs",
11176
11242
  "access",
11177
11243
  "inputSchema",
11178
11244
  "outputSchema",