primitive-admin 1.2.0-alpha.15 → 1.2.0-alpha.16

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 (202) hide show
  1. package/README.md +84 -0
  2. package/dist/src/commands/admins.js +1 -0
  3. package/dist/src/commands/admins.js.map +1 -1
  4. package/dist/src/commands/analytics.js +2 -4
  5. package/dist/src/commands/analytics.js.map +1 -1
  6. package/dist/src/commands/apps-transitions.d.ts +39 -0
  7. package/dist/src/commands/apps-transitions.js +198 -0
  8. package/dist/src/commands/apps-transitions.js.map +1 -0
  9. package/dist/src/commands/apps.d.ts +11 -0
  10. package/dist/src/commands/apps.js +50 -5
  11. package/dist/src/commands/apps.js.map +1 -1
  12. package/dist/src/commands/auth-sessions.js +2 -0
  13. package/dist/src/commands/auth-sessions.js.map +1 -1
  14. package/dist/src/commands/auth.js +5 -0
  15. package/dist/src/commands/auth.js.map +1 -1
  16. package/dist/src/commands/blob-buckets.js +2 -0
  17. package/dist/src/commands/blob-buckets.js.map +1 -1
  18. package/dist/src/commands/collections.js +2 -13
  19. package/dist/src/commands/collections.js.map +1 -1
  20. package/dist/src/commands/comparisons.js +2 -0
  21. package/dist/src/commands/comparisons.js.map +1 -1
  22. package/dist/src/commands/config.js +2 -0
  23. package/dist/src/commands/config.js.map +1 -1
  24. package/dist/src/commands/connections.js +2 -2
  25. package/dist/src/commands/connections.js.map +1 -1
  26. package/dist/src/commands/db3.js +79 -21
  27. package/dist/src/commands/db3.js.map +1 -1
  28. package/dist/src/commands/email-templates.js +2 -0
  29. package/dist/src/commands/email-templates.js.map +1 -1
  30. package/dist/src/commands/env.js +2 -0
  31. package/dist/src/commands/env.js.map +1 -1
  32. package/dist/src/commands/functions.js +45 -3
  33. package/dist/src/commands/functions.js.map +1 -1
  34. package/dist/src/commands/groups.js +2 -0
  35. package/dist/src/commands/groups.js.map +1 -1
  36. package/dist/src/commands/guides.js +2 -0
  37. package/dist/src/commands/guides.js.map +1 -1
  38. package/dist/src/commands/hosting.d.ts +8 -0
  39. package/dist/src/commands/hosting.js +346 -0
  40. package/dist/src/commands/hosting.js.map +1 -0
  41. package/dist/src/commands/init.js +2 -0
  42. package/dist/src/commands/init.js.map +1 -1
  43. package/dist/src/commands/integrations.js +2 -0
  44. package/dist/src/commands/integrations.js.map +1 -1
  45. package/dist/src/commands/locks.js +2 -0
  46. package/dist/src/commands/locks.js.map +1 -1
  47. package/dist/src/commands/metadata-category-configs.js +1 -1
  48. package/dist/src/commands/metadata-category-configs.js.map +1 -1
  49. package/dist/src/commands/metadata.js +2 -2
  50. package/dist/src/commands/metadata.js.map +1 -1
  51. package/dist/src/commands/prompts.js +2 -0
  52. package/dist/src/commands/prompts.js.map +1 -1
  53. package/dist/src/commands/rate-counters.d.ts +19 -0
  54. package/dist/src/commands/rate-counters.js +104 -0
  55. package/dist/src/commands/rate-counters.js.map +1 -0
  56. package/dist/src/commands/rule-sets.js +2 -2
  57. package/dist/src/commands/rule-sets.js.map +1 -1
  58. package/dist/src/commands/schemas.js +4 -4
  59. package/dist/src/commands/schemas.js.map +1 -1
  60. package/dist/src/commands/secrets.js +2 -0
  61. package/dist/src/commands/secrets.js.map +1 -1
  62. package/dist/src/commands/skill.js +2 -0
  63. package/dist/src/commands/skill.js.map +1 -1
  64. package/dist/src/commands/sync.d.ts +101 -2
  65. package/dist/src/commands/sync.js +391 -62
  66. package/dist/src/commands/sync.js.map +1 -1
  67. package/dist/src/commands/tokens.js +2 -0
  68. package/dist/src/commands/tokens.js.map +1 -1
  69. package/dist/src/commands/transitions.d.ts +54 -0
  70. package/dist/src/commands/transitions.js +418 -0
  71. package/dist/src/commands/transitions.js.map +1 -0
  72. package/dist/src/commands/usage.d.ts +18 -0
  73. package/dist/src/commands/usage.js +343 -0
  74. package/dist/src/commands/usage.js.map +1 -0
  75. package/dist/src/commands/user-properties.js +2 -2
  76. package/dist/src/commands/user-properties.js.map +1 -1
  77. package/dist/src/commands/users.js +28 -29
  78. package/dist/src/commands/users.js.map +1 -1
  79. package/dist/src/commands/vars.js +2 -0
  80. package/dist/src/commands/vars.js.map +1 -1
  81. package/dist/src/commands/waitlist.js +2 -2
  82. package/dist/src/commands/waitlist.js.map +1 -1
  83. package/dist/src/lib/api-client.d.ts +606 -2
  84. package/dist/src/lib/api-client.js +157 -6
  85. package/dist/src/lib/api-client.js.map +1 -1
  86. package/dist/src/lib/app-settings-descriptor.d.ts +1 -1
  87. package/dist/src/lib/app-settings-descriptor.js +6 -0
  88. package/dist/src/lib/app-settings-descriptor.js.map +1 -1
  89. package/dist/src/lib/auth-flow.d.ts +33 -0
  90. package/dist/src/lib/auth-flow.js +404 -13
  91. package/dist/src/lib/auth-flow.js.map +1 -1
  92. package/dist/src/lib/cli-manifest.d.ts +5 -4
  93. package/dist/src/lib/cli-manifest.js.map +1 -1
  94. package/dist/src/lib/command-groups.d.ts +30 -0
  95. package/dist/src/lib/command-groups.js +109 -0
  96. package/dist/src/lib/command-groups.js.map +1 -0
  97. package/dist/src/lib/command-status.d.ts +56 -19
  98. package/dist/src/lib/command-status.js +101 -19
  99. package/dist/src/lib/command-status.js.map +1 -1
  100. package/dist/src/lib/config-object-descriptor.js +0 -1
  101. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  102. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +7 -0
  103. package/dist/src/lib/db-codegen/dbTypeIR.js +3 -0
  104. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
  105. package/dist/src/lib/db-type-records.d.ts +12 -1
  106. package/dist/src/lib/db-type-records.js +8 -3
  107. package/dist/src/lib/db-type-records.js.map +1 -1
  108. package/dist/src/lib/db3-export.js +2 -2
  109. package/dist/src/lib/db3-export.js.map +1 -1
  110. package/dist/src/lib/db3-index-output.d.ts +26 -3
  111. package/dist/src/lib/db3-index-output.js +48 -12
  112. package/dist/src/lib/db3-index-output.js.map +1 -1
  113. package/dist/src/lib/db3-type-models.d.ts +11 -1
  114. package/dist/src/lib/db3-type-models.js +22 -2
  115. package/dist/src/lib/db3-type-models.js.map +1 -1
  116. package/dist/src/lib/function-authorize-view.d.ts +12 -0
  117. package/dist/src/lib/function-authorize-view.js +34 -0
  118. package/dist/src/lib/function-authorize-view.js.map +1 -1
  119. package/dist/src/lib/function-collect.d.ts +13 -0
  120. package/dist/src/lib/function-collect.js +37 -7
  121. package/dist/src/lib/function-collect.js.map +1 -1
  122. package/dist/src/lib/function-db-types.d.ts +14 -8
  123. package/dist/src/lib/function-db-types.js +56 -21
  124. package/dist/src/lib/function-db-types.js.map +1 -1
  125. package/dist/src/lib/function-lint.d.ts +24 -1
  126. package/dist/src/lib/function-lint.js +123 -1
  127. package/dist/src/lib/function-lint.js.map +1 -1
  128. package/dist/src/lib/function-schema-codegen.d.ts +31 -7
  129. package/dist/src/lib/function-schema-codegen.js +131 -36
  130. package/dist/src/lib/function-schema-codegen.js.map +1 -1
  131. package/dist/src/lib/function-sync.js +9 -1
  132. package/dist/src/lib/function-sync.js.map +1 -1
  133. package/dist/src/lib/generated-command-status.d.ts +6 -0
  134. package/dist/src/lib/generated-command-status.js +469 -0
  135. package/dist/src/lib/generated-command-status.js.map +1 -0
  136. package/dist/src/lib/generated-config-surfaces.d.ts +28 -3
  137. package/dist/src/lib/generated-config-surfaces.js +91 -16
  138. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  139. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  140. package/dist/src/lib/generated-sdk-types.js +1 -1
  141. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  142. package/dist/src/lib/hosting-build.d.ts +97 -0
  143. package/dist/src/lib/hosting-build.js +204 -0
  144. package/dist/src/lib/hosting-build.js.map +1 -0
  145. package/dist/src/lib/hosting-client.d.ts +167 -0
  146. package/dist/src/lib/hosting-client.js +340 -0
  147. package/dist/src/lib/hosting-client.js.map +1 -0
  148. package/dist/src/lib/hosting-environments.d.ts +32 -0
  149. package/dist/src/lib/hosting-environments.js +74 -0
  150. package/dist/src/lib/hosting-environments.js.map +1 -0
  151. package/dist/src/lib/hosting-errors.d.ts +30 -0
  152. package/dist/src/lib/hosting-errors.js +43 -0
  153. package/dist/src/lib/hosting-errors.js.map +1 -0
  154. package/dist/src/lib/hosting-token.d.ts +46 -0
  155. package/dist/src/lib/hosting-token.js +60 -0
  156. package/dist/src/lib/hosting-token.js.map +1 -0
  157. package/dist/src/lib/hosting-wait.d.ts +42 -0
  158. package/dist/src/lib/hosting-wait.js +84 -0
  159. package/dist/src/lib/hosting-wait.js.map +1 -0
  160. package/dist/src/lib/hosting-wfp-upload.d.ts +86 -0
  161. package/dist/src/lib/hosting-wfp-upload.js +149 -0
  162. package/dist/src/lib/hosting-wfp-upload.js.map +1 -0
  163. package/dist/src/lib/invoker-shared-enums.d.ts +35 -0
  164. package/dist/src/lib/invoker-shared-enums.js +98 -0
  165. package/dist/src/lib/invoker-shared-enums.js.map +1 -0
  166. package/dist/src/lib/log-inspection.d.ts +4 -1
  167. package/dist/src/lib/log-inspection.js.map +1 -1
  168. package/dist/src/lib/primitive-declaration.d.ts +32 -1
  169. package/dist/src/lib/primitive-declaration.js +153 -19
  170. package/dist/src/lib/primitive-declaration.js.map +1 -1
  171. package/dist/src/lib/prompt-schema-codegen.d.ts +1 -1
  172. package/dist/src/lib/prompt-schema-codegen.js +31 -19
  173. package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
  174. package/dist/src/lib/prompt-schema-refs.d.ts +9 -0
  175. package/dist/src/lib/prompt-schema-refs.js +28 -2
  176. package/dist/src/lib/prompt-schema-refs.js.map +1 -1
  177. package/dist/src/lib/register-commands.d.ts +14 -6
  178. package/dist/src/lib/register-commands.js +19 -83
  179. package/dist/src/lib/register-commands.js.map +1 -1
  180. package/dist/src/lib/schema-codegen/generated-db3-bridge.js +10 -4
  181. package/dist/src/lib/schema-codegen/generated-db3-bridge.js.map +1 -1
  182. package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +11 -2
  183. package/dist/src/lib/schema-codegen/generated-field-grammar.js +22 -4
  184. package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -1
  185. package/dist/src/lib/schema-codegen/generated-schema-shape.d.ts +27 -0
  186. package/dist/src/lib/schema-codegen/generated-schema-shape.js +126 -0
  187. package/dist/src/lib/schema-codegen/generated-schema-shape.js.map +1 -0
  188. package/dist/src/lib/schema-codegen/valuesLists.d.ts +15 -2
  189. package/dist/src/lib/schema-codegen/valuesLists.js +19 -3
  190. package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -1
  191. package/dist/src/lib/swift-codegen/functionGenerator.js +4 -3
  192. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  193. package/dist/src/lib/swift-codegen/sharedGenerator.js +50 -5
  194. package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -1
  195. package/dist/src/lib/sync-resource-types.js +0 -3
  196. package/dist/src/lib/sync-resource-types.js.map +1 -1
  197. package/dist/src/lib/toml-database-config.js +3 -1
  198. package/dist/src/lib/toml-database-config.js.map +1 -1
  199. package/dist/src/lib/transition-warnings.d.ts +21 -0
  200. package/dist/src/lib/transition-warnings.js +49 -0
  201. package/dist/src/lib/transition-warnings.js.map +1 -0
  202. package/package.json +2 -2
@@ -2762,12 +2762,36 @@ export const RETIRED_TOML_SPELLINGS = {
2762
2762
  reasoningBudget: flatChatKeySpelling("reasoningBudget", true),
2763
2763
  },
2764
2764
  };
2765
+ // #5993 — a db3 type takes no rule set. Nothing evaluates one: every
2766
+ // `db3-types` route is for app admins and owners, who bypass rule sets. The
2767
+ // database type file still takes `ruleSetName`, and its `ruleSetId` keeps the
2768
+ // #3997 sentence, so these are keyed by the db3 type's surface.
2769
+ const DB3_TYPE_RULE_SET_SENTENCE = "A db3 type takes no rule set: nothing evaluated the one this line names, " +
2770
+ "and managing a type is for app admins and owners. Delete the line and " +
2771
+ "push again (`config pull` rewrites the file without it).";
2772
+ /**
2773
+ * Guidance keyed by surface label, then TOML prefix, then key — consulted
2774
+ * before `RETIRED_CONFIG_KEYS` and `RETIRED_TOML_SPELLINGS` when the caller
2775
+ * knows the surface.
2776
+ */
2777
+ export const RETIRED_SURFACE_TOML_KEYS = {
2778
+ "db3-type": {
2779
+ type: {
2780
+ ruleSetName: { toml: DB3_TYPE_RULE_SET_SENTENCE, emptyAccepted: true },
2781
+ ruleSetId: { toml: DB3_TYPE_RULE_SET_SENTENCE },
2782
+ },
2783
+ },
2784
+ };
2765
2785
  /**
2766
- * The TOML guidance for `key` under `prefix`: a fully retired key's, else a
2767
- * retired spelling's, else null when the key is simply unknown.
2786
+ * The TOML guidance for `key` under `prefix`: the surface's own when
2787
+ * `surfaceLabel` names one, else a fully retired key's, else a retired
2788
+ * spelling's, else null when the key is simply unknown.
2768
2789
  */
2769
- export function retiredTomlKey(prefix, key) {
2770
- return (retiredConfigKey(prefix, key) ?? RETIRED_TOML_SPELLINGS[prefix]?.[key] ?? null);
2790
+ export function retiredTomlKey(prefix, key, surfaceLabel) {
2791
+ return ((surfaceLabel ? RETIRED_SURFACE_TOML_KEYS[surfaceLabel]?.[prefix]?.[key] : undefined) ??
2792
+ retiredConfigKey(prefix, key) ??
2793
+ RETIRED_TOML_SPELLINGS[prefix]?.[key] ??
2794
+ null);
2771
2795
  }
2772
2796
  // ── src/config-surface/function-grants.ts ────────────────────────────────
2773
2797
  /**
@@ -9395,9 +9419,12 @@ export const DATABASE_TYPE_SURFACE = {
9395
9419
  *
9396
9420
  * `db3-types/<name>.toml` is a db3 type: the `DatabaseTypeConfig` row a
9397
9421
  * database type is, read by db3s. One namespace, so the file's surface is the
9398
- * database type file's with one difference: the type is named by `[type]
9422
+ * database type file's with two differences: the type is named by `[type]
9399
9423
  * name`, where a database type file says `databaseType` (a retired spelling
9400
- * here, `retired-keys.ts`). The `[models.*]`, `[triggers]` and `[metadata]` /
9424
+ * here, `retired-keys.ts`), and it takes no rule set (#5993): nothing
9425
+ * evaluates one for a db3 type, whose management is for app admins and
9426
+ * owners, so `ruleSetName` and `ruleSetId` are refused here with that
9427
+ * sentence. The `[models.*]`, `[triggers]` and `[metadata]` /
9401
9428
  * `secrets` sub-trees are the database type's, kept by the validators that
9402
9429
  * own them; a db3 ignores the manifest. `config push` applies the file with
9403
9430
  * `PUT db3-types/:name`, which pushes the new revision to every db3 of the
@@ -9423,15 +9450,6 @@ export const DB3_TYPE_SURFACE = {
9423
9450
  // a push, `#`-free.
9424
9451
  validation: handledBy(DB3_TYPES_HANDLER, "Db3TypesController", "apply"),
9425
9452
  },
9426
- {
9427
- field: "ruleSetId",
9428
- tomlKey: "ruleSetName",
9429
- type: "string",
9430
- emit: "always",
9431
- writableOn: BOTH,
9432
- // The type's databases' rule set, by name; a db3 does not read it.
9433
- validation: handledBy(DB3_TYPES_HANDLER, "Db3TypesController", "apply"),
9434
- },
9435
9453
  {
9436
9454
  field: "autoPopulatedFields",
9437
9455
  tomlKey: "autoPopulatedFields",
@@ -9449,7 +9467,18 @@ export const DB3_TYPE_SURFACE = {
9449
9467
  validation: handledBy(DB3_TYPES_HANDLER, "Db3TypesController", "apply"),
9450
9468
  },
9451
9469
  ],
9452
- notExposed: LEGACY_TYPE_TABLE.notExposed,
9470
+ // A copy: the database type table's own classification stays as it is.
9471
+ notExposed: {
9472
+ ...LEGACY_TYPE_TABLE.notExposed,
9473
+ ruleSetId: {
9474
+ kind: "structural",
9475
+ // Never in a `PUT db3-types/:name` body: the route refuses a bound one.
9476
+ requestModes: [],
9477
+ note: "The database type's rule set, authored as `ruleSetName` in " +
9478
+ "`database-type-configs/` only. A db3 type takes none: nothing " +
9479
+ "evaluates it, and managing a type is for app admins and owners.",
9480
+ },
9481
+ },
9453
9482
  tomlOnlyKeys: {
9454
9483
  models: {
9455
9484
  kind: "structural",
@@ -10235,6 +10264,18 @@ export function authorizeRequiredMessage(functionKey, file) {
10235
10264
  "maps each `access` expression to a helper.";
10236
10265
  return file ? `${file}: ${message}` : message;
10237
10266
  }
10267
+ /**
10268
+ * The refusal of a version that declares `public = true` and has no
10269
+ * `authorize` — #5840. `public = true` opens the function to signed-out
10270
+ * callers, and the version's own `authorize` is what decides about them.
10271
+ */
10272
+ export function publicRequiresAuthorizeMessage(functionKey, file) {
10273
+ const message = `Function '${functionKey}' declares \`public = true\` and has no \`authorize\`: ` +
10274
+ "a public function decides who may call it, signed-out callers included, in its own " +
10275
+ "`authorize`. Export the object form with one, such as `authorize: allowAnyone()`, " +
10276
+ `or remove \`public\` from functions/${functionKey}.toml.`;
10277
+ return file ? `${file}: ${message}` : message;
10278
+ }
10238
10279
  /**
10239
10280
  * The refusal of a new version that defines `authorize` while its TOML still
10240
10281
  * carries `access`.
@@ -10664,6 +10705,32 @@ export const APP_SETTINGS_SURFACE = {
10664
10705
  // (`parseRootDocumentFormatSetting`).
10665
10706
  validation: handledBy(SETTINGS_HANDLER, "SettingsController", "apply"),
10666
10707
  },
10708
+ {
10709
+ field: "signedOutAccess",
10710
+ tomlKey: "signedOutAccess",
10711
+ type: "boolean",
10712
+ // Always: a pulled file states whether signed-out callers may
10713
+ // invoke the app's `public` functions, rather than leaving it to the
10714
+ // absence of a key (#5840).
10715
+ emit: "always",
10716
+ writableOn: UPDATE_ONLY,
10717
+ // A boolean, refused otherwise; the route answers the functions
10718
+ // turning it on opens (`signedOutFunctions`).
10719
+ validation: handledBy(SETTINGS_HANDLER, "SettingsController", "apply"),
10720
+ },
10721
+ {
10722
+ field: "allowFieldRemoval",
10723
+ tomlKey: "allowFieldRemoval",
10724
+ type: "boolean",
10725
+ // Whenever the app set it. An app that never did may not remove
10726
+ // fields from an in-use db3 type, and a pulled file should not grow
10727
+ // a key for it (#6019).
10728
+ emit: "whenSet",
10729
+ writableOn: UPDATE_ONLY,
10730
+ // A boolean or cleared, refused otherwise; a type write reads the
10731
+ // stored value before it takes `allowFieldRemoval=true`.
10732
+ validation: handledBy(SETTINGS_HANDLER, "SettingsController", "apply"),
10733
+ },
10667
10734
  {
10668
10735
  field: "protection",
10669
10736
  tomlKey: "protection",
@@ -10752,6 +10819,11 @@ export const APP_SETTINGS_SURFACE = {
10752
10819
  kind: "server-owned",
10753
10820
  note: "When the app last saw counted activity; written by the server.",
10754
10821
  },
10822
+ transitions: {
10823
+ kind: "server-owned",
10824
+ note: "The app's platform transition overrides (#5821); set only by a " +
10825
+ "super-admin through the transitions routes, so sync never sees it.",
10826
+ },
10755
10827
  passkeyRpId: {
10756
10828
  kind: "server-owned",
10757
10829
  note: "RETIRED from the write surface by #2891, superseded by " +
@@ -11246,6 +11318,8 @@ export const GENERATED_CONFIG_MODEL_FIELDS = {
11246
11318
  "memberInvitationLimit",
11247
11319
  "largeDocumentWindowDays",
11248
11320
  "rootDocumentFormat",
11321
+ "signedOutAccess",
11322
+ "allowFieldRemoval",
11249
11323
  "protection",
11250
11324
  "protected",
11251
11325
  "parentAppId",
@@ -11260,6 +11334,7 @@ export const GENERATED_CONFIG_MODEL_FIELDS = {
11260
11334
  "previewOrigins",
11261
11335
  "childPartition",
11262
11336
  "lastActivityAt",
11337
+ "transitions",
11263
11338
  "createdAt",
11264
11339
  "modifiedAt",
11265
11340
  ],