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

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 (318) hide show
  1. package/README.md +102 -78
  2. package/assets/skill/skills/primitive-platform/SKILL.md +87 -23
  3. package/dist/bin/primitive.js +11 -82
  4. package/dist/bin/primitive.js.map +1 -1
  5. package/dist/src/commands/admins.js +79 -17
  6. package/dist/src/commands/admins.js.map +1 -1
  7. package/dist/src/commands/agent-sessions.js +2 -0
  8. package/dist/src/commands/agent-sessions.js.map +1 -1
  9. package/dist/src/commands/analytics.js +183 -12
  10. package/dist/src/commands/analytics.js.map +1 -1
  11. package/dist/src/commands/apps-children.js +2 -0
  12. package/dist/src/commands/apps-children.js.map +1 -1
  13. package/dist/src/commands/apps.js +19 -2
  14. package/dist/src/commands/apps.js.map +1 -1
  15. package/dist/src/commands/auth.js +11 -1
  16. package/dist/src/commands/auth.js.map +1 -1
  17. package/dist/src/commands/collections.js +13 -0
  18. package/dist/src/commands/collections.js.map +1 -1
  19. package/dist/src/commands/config.d.ts +1 -1
  20. package/dist/src/commands/config.js +40 -9
  21. package/dist/src/commands/config.js.map +1 -1
  22. package/dist/src/commands/connections.js +2 -0
  23. package/dist/src/commands/connections.js.map +1 -1
  24. package/dist/src/commands/database-type-configs.js +5 -3
  25. package/dist/src/commands/database-type-configs.js.map +1 -1
  26. package/dist/src/commands/databases.js +6 -4
  27. package/dist/src/commands/databases.js.map +1 -1
  28. package/dist/src/commands/db3-types.js +2 -0
  29. package/dist/src/commands/db3-types.js.map +1 -1
  30. package/dist/src/commands/db3.d.ts +12 -0
  31. package/dist/src/commands/db3.js +343 -24
  32. package/dist/src/commands/db3.js.map +1 -1
  33. package/dist/src/commands/documents.d.ts +52 -12
  34. package/dist/src/commands/documents.js +120 -29
  35. package/dist/src/commands/documents.js.map +1 -1
  36. package/dist/src/commands/email-templates.js +72 -0
  37. package/dist/src/commands/email-templates.js.map +1 -1
  38. package/dist/src/commands/functions.js +47 -10
  39. package/dist/src/commands/functions.js.map +1 -1
  40. package/dist/src/commands/groups.js +18 -3
  41. package/dist/src/commands/groups.js.map +1 -1
  42. package/dist/src/commands/init.js +7 -1
  43. package/dist/src/commands/init.js.map +1 -1
  44. package/dist/src/commands/integrations.js +80 -47
  45. package/dist/src/commands/integrations.js.map +1 -1
  46. package/dist/src/commands/metadata-category-configs.js +2 -0
  47. package/dist/src/commands/metadata-category-configs.js.map +1 -1
  48. package/dist/src/commands/metadata.js +41 -0
  49. package/dist/src/commands/metadata.js.map +1 -1
  50. package/dist/src/commands/prompts.js +73 -47
  51. package/dist/src/commands/prompts.js.map +1 -1
  52. package/dist/src/commands/rule-sets.js +2 -0
  53. package/dist/src/commands/rule-sets.js.map +1 -1
  54. package/dist/src/commands/schemas.d.ts +15 -0
  55. package/dist/src/commands/schemas.js +122 -0
  56. package/dist/src/commands/schemas.js.map +1 -0
  57. package/dist/src/commands/secrets.js +45 -3
  58. package/dist/src/commands/secrets.js.map +1 -1
  59. package/dist/src/commands/sessions.js +2 -0
  60. package/dist/src/commands/sessions.js.map +1 -1
  61. package/dist/src/commands/sync-schemas.d.ts +202 -0
  62. package/dist/src/commands/sync-schemas.js +629 -0
  63. package/dist/src/commands/sync-schemas.js.map +1 -0
  64. package/dist/src/commands/sync-user-properties.d.ts +118 -0
  65. package/dist/src/commands/sync-user-properties.js +276 -0
  66. package/dist/src/commands/sync-user-properties.js.map +1 -0
  67. package/dist/src/commands/sync.d.ts +243 -12
  68. package/dist/src/commands/sync.js +1474 -314
  69. package/dist/src/commands/sync.js.map +1 -1
  70. package/dist/src/commands/user-properties.d.ts +14 -0
  71. package/dist/src/commands/user-properties.js +79 -0
  72. package/dist/src/commands/user-properties.js.map +1 -0
  73. package/dist/src/commands/users.js +879 -16
  74. package/dist/src/commands/users.js.map +1 -1
  75. package/dist/src/commands/waitlist.js +39 -4
  76. package/dist/src/commands/waitlist.js.map +1 -1
  77. package/dist/src/lib/analytics-query.d.ts +58 -0
  78. package/dist/src/lib/analytics-query.js +134 -0
  79. package/dist/src/lib/analytics-query.js.map +1 -0
  80. package/dist/src/lib/api-client.d.ts +748 -95
  81. package/dist/src/lib/api-client.js +356 -158
  82. package/dist/src/lib/api-client.js.map +1 -1
  83. package/dist/src/lib/block-selector.d.ts +9 -15
  84. package/dist/src/lib/block-selector.js +9 -20
  85. package/dist/src/lib/block-selector.js.map +1 -1
  86. package/dist/src/lib/cli-manifest.d.ts +8 -0
  87. package/dist/src/lib/cli-manifest.js +10 -1
  88. package/dist/src/lib/cli-manifest.js.map +1 -1
  89. package/dist/src/lib/cli-version.d.ts +14 -0
  90. package/dist/src/lib/cli-version.js +38 -0
  91. package/dist/src/lib/cli-version.js.map +1 -0
  92. package/dist/src/lib/codegen-shared/prettierStable.d.ts +41 -0
  93. package/dist/src/lib/codegen-shared/prettierStable.js +146 -24
  94. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -1
  95. package/dist/src/lib/command-status.d.ts +110 -0
  96. package/dist/src/lib/command-status.js +184 -0
  97. package/dist/src/lib/command-status.js.map +1 -0
  98. package/dist/src/lib/config-object-descriptor.d.ts +6 -0
  99. package/dist/src/lib/config-object-descriptor.js +71 -0
  100. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  101. package/dist/src/lib/config-toml.d.ts +11 -2
  102. package/dist/src/lib/config-toml.js +25 -2
  103. package/dist/src/lib/config-toml.js.map +1 -1
  104. package/dist/src/lib/data-input.d.ts +1 -1
  105. package/dist/src/lib/data-input.js +1 -1
  106. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +1 -1
  107. package/dist/src/lib/db-codegen/dbTsTypes.js +3 -0
  108. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
  109. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +11 -1
  110. package/dist/src/lib/db-codegen/dbTypeIR.js +11 -5
  111. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
  112. package/dist/src/lib/db-type-records.d.ts +95 -0
  113. package/dist/src/lib/db-type-records.js +219 -0
  114. package/dist/src/lib/db-type-records.js.map +1 -0
  115. package/dist/src/lib/db3-export.d.ts +51 -14
  116. package/dist/src/lib/db3-export.js +135 -27
  117. package/dist/src/lib/db3-export.js.map +1 -1
  118. package/dist/src/lib/db3-index-output.d.ts +68 -3
  119. package/dist/src/lib/db3-index-output.js +139 -3
  120. package/dist/src/lib/db3-index-output.js.map +1 -1
  121. package/dist/src/lib/db3-type-models.d.ts +39 -7
  122. package/dist/src/lib/db3-type-models.js +138 -27
  123. package/dist/src/lib/db3-type-models.js.map +1 -1
  124. package/dist/src/lib/deprecation.d.ts +2 -2
  125. package/dist/src/lib/deprecation.js +2 -2
  126. package/dist/src/lib/experimental-apis.d.ts +36 -0
  127. package/dist/src/lib/experimental-apis.js +46 -0
  128. package/dist/src/lib/experimental-apis.js.map +1 -0
  129. package/dist/src/lib/file-attachment.d.ts +24 -0
  130. package/dist/src/lib/file-attachment.js +31 -0
  131. package/dist/src/lib/file-attachment.js.map +1 -0
  132. package/dist/src/lib/function-authorize-check.d.ts +1 -1
  133. package/dist/src/lib/function-authorize-check.js +2 -1
  134. package/dist/src/lib/function-authorize-check.js.map +1 -1
  135. package/dist/src/lib/function-authorize-view.js +4 -0
  136. package/dist/src/lib/function-authorize-view.js.map +1 -1
  137. package/dist/src/lib/function-bundle.d.ts +27 -5
  138. package/dist/src/lib/function-bundle.js +106 -7
  139. package/dist/src/lib/function-bundle.js.map +1 -1
  140. package/dist/src/lib/function-collect.d.ts +2 -0
  141. package/dist/src/lib/function-collect.js +36 -7
  142. package/dist/src/lib/function-collect.js.map +1 -1
  143. package/dist/src/lib/function-db-types.d.ts +57 -40
  144. package/dist/src/lib/function-db-types.js +246 -285
  145. package/dist/src/lib/function-db-types.js.map +1 -1
  146. package/dist/src/lib/function-document-types.d.ts +19 -7
  147. package/dist/src/lib/function-document-types.js +24 -12
  148. package/dist/src/lib/function-document-types.js.map +1 -1
  149. package/dist/src/lib/function-run.d.ts +1 -1
  150. package/dist/src/lib/function-run.js +1 -1
  151. package/dist/src/lib/function-run.js.map +1 -1
  152. package/dist/src/lib/function-schema-codegen.d.ts +58 -18
  153. package/dist/src/lib/function-schema-codegen.js +85 -74
  154. package/dist/src/lib/function-schema-codegen.js.map +1 -1
  155. package/dist/src/lib/function-schema-refs.d.ts +98 -0
  156. package/dist/src/lib/function-schema-refs.js +177 -0
  157. package/dist/src/lib/function-schema-refs.js.map +1 -0
  158. package/dist/src/lib/function-sync.d.ts +38 -4
  159. package/dist/src/lib/function-sync.js +83 -14
  160. package/dist/src/lib/function-sync.js.map +1 -1
  161. package/dist/src/lib/function-typecheck.d.ts +52 -0
  162. package/dist/src/lib/function-typecheck.js +171 -54
  163. package/dist/src/lib/function-typecheck.js.map +1 -1
  164. package/dist/src/lib/generated-build-flags.d.ts +13 -0
  165. package/dist/src/lib/generated-build-flags.js +14 -0
  166. package/dist/src/lib/generated-build-flags.js.map +1 -0
  167. package/dist/src/lib/generated-config-surfaces.d.ts +211 -11
  168. package/dist/src/lib/generated-config-surfaces.js +579 -69
  169. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  170. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  171. package/dist/src/lib/generated-sdk-types.js +1 -1
  172. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  173. package/dist/src/lib/integration-test-request.d.ts +54 -0
  174. package/dist/src/lib/integration-test-request.js +207 -0
  175. package/dist/src/lib/integration-test-request.js.map +1 -0
  176. package/dist/src/lib/metadata-report.d.ts +85 -0
  177. package/dist/src/lib/metadata-report.js +81 -0
  178. package/dist/src/lib/metadata-report.js.map +1 -0
  179. package/dist/src/lib/output.d.ts +1 -1
  180. package/dist/src/lib/output.js +1 -1
  181. package/dist/src/lib/platform-owned.js +5 -0
  182. package/dist/src/lib/platform-owned.js.map +1 -1
  183. package/dist/src/lib/primitive-declaration-names.d.ts +21 -0
  184. package/dist/src/lib/primitive-declaration-names.js +22 -0
  185. package/dist/src/lib/primitive-declaration-names.js.map +1 -0
  186. package/dist/src/lib/primitive-declaration.d.ts +143 -0
  187. package/dist/src/lib/primitive-declaration.js +658 -0
  188. package/dist/src/lib/primitive-declaration.js.map +1 -0
  189. package/dist/src/lib/prompt-schema-codegen.d.ts +36 -12
  190. package/dist/src/lib/prompt-schema-codegen.js +82 -98
  191. package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
  192. package/dist/src/lib/prompt-schema-document.d.ts +35 -0
  193. package/dist/src/lib/prompt-schema-document.js +92 -0
  194. package/dist/src/lib/prompt-schema-document.js.map +1 -0
  195. package/dist/src/lib/prompt-schema-refs.d.ts +164 -0
  196. package/dist/src/lib/prompt-schema-refs.js +452 -0
  197. package/dist/src/lib/prompt-schema-refs.js.map +1 -0
  198. package/dist/src/lib/records-verbs.d.ts +12 -2
  199. package/dist/src/lib/records-verbs.js +7 -2
  200. package/dist/src/lib/records-verbs.js.map +1 -1
  201. package/dist/src/lib/register-commands.d.ts +28 -0
  202. package/dist/src/lib/register-commands.js +101 -0
  203. package/dist/src/lib/register-commands.js.map +1 -0
  204. package/dist/src/lib/retired-imports.d.ts +53 -0
  205. package/dist/src/lib/retired-imports.js +120 -0
  206. package/dist/src/lib/retired-imports.js.map +1 -0
  207. package/dist/src/lib/schema-codegen/compiledSpace.d.ts +62 -0
  208. package/dist/src/lib/schema-codegen/compiledSpace.js +103 -0
  209. package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -0
  210. package/dist/src/lib/schema-codegen/generated-db3-bridge.d.ts +86 -0
  211. package/dist/src/lib/schema-codegen/generated-db3-bridge.js +221 -0
  212. package/dist/src/lib/schema-codegen/generated-db3-bridge.js.map +1 -0
  213. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.d.ts +85 -0
  214. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js +86 -0
  215. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js.map +1 -0
  216. package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +209 -0
  217. package/dist/src/lib/schema-codegen/generated-field-grammar.js +379 -0
  218. package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -0
  219. package/dist/src/lib/schema-codegen/generated-field-table.d.ts +80 -0
  220. package/dist/src/lib/schema-codegen/generated-field-table.js +542 -0
  221. package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -0
  222. package/dist/src/lib/schema-codegen/generated-prompt-schemas.d.ts +195 -0
  223. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js +503 -0
  224. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js.map +1 -0
  225. package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +129 -0
  226. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +154 -1
  227. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -1
  228. package/dist/src/lib/schema-codegen/generated-schema-file.d.ts +129 -0
  229. package/dist/src/lib/schema-codegen/generated-schema-file.js +475 -0
  230. package/dist/src/lib/schema-codegen/generated-schema-file.js.map +1 -0
  231. package/dist/src/lib/schema-codegen/generated-schema-provenance.d.ts +115 -0
  232. package/dist/src/lib/schema-codegen/generated-schema-provenance.js +274 -0
  233. package/dist/src/lib/schema-codegen/generated-schema-provenance.js.map +1 -0
  234. package/dist/src/lib/schema-codegen/generated-schema-refs.d.ts +366 -0
  235. package/dist/src/lib/schema-codegen/generated-schema-refs.js +1789 -0
  236. package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -0
  237. package/dist/src/lib/schema-codegen/namedRefs.d.ts +56 -0
  238. package/dist/src/lib/schema-codegen/namedRefs.js +143 -0
  239. package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -0
  240. package/dist/src/lib/schema-codegen/schemaChanges.d.ts +74 -0
  241. package/dist/src/lib/schema-codegen/schemaChanges.js +277 -0
  242. package/dist/src/lib/schema-codegen/schemaChanges.js.map +1 -0
  243. package/dist/src/lib/schema-codegen/schemaDocs.d.ts +69 -0
  244. package/dist/src/lib/schema-codegen/schemaDocs.js +219 -0
  245. package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -0
  246. package/dist/src/lib/schema-codegen/schemaIR.d.ts +158 -0
  247. package/dist/src/lib/schema-codegen/schemaIR.js +279 -0
  248. package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -0
  249. package/dist/src/lib/schema-codegen/schemaToTs.d.ts +40 -13
  250. package/dist/src/lib/schema-codegen/schemaToTs.js +124 -160
  251. package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -1
  252. package/dist/src/lib/schema-codegen/valuesLists.d.ts +35 -0
  253. package/dist/src/lib/schema-codegen/valuesLists.js +128 -0
  254. package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -0
  255. package/dist/src/lib/schema-family-index.d.ts +228 -0
  256. package/dist/src/lib/schema-family-index.js +813 -0
  257. package/dist/src/lib/schema-family-index.js.map +1 -0
  258. package/dist/src/lib/schema-pins.d.ts +82 -0
  259. package/dist/src/lib/schema-pins.js +198 -0
  260. package/dist/src/lib/schema-pins.js.map +1 -0
  261. package/dist/src/lib/schema-preview.d.ts +244 -0
  262. package/dist/src/lib/schema-preview.js +498 -0
  263. package/dist/src/lib/schema-preview.js.map +1 -0
  264. package/dist/src/lib/skill-installer.d.ts +2 -2
  265. package/dist/src/lib/skill-installer.js +2 -21
  266. package/dist/src/lib/skill-installer.js.map +1 -1
  267. package/dist/src/lib/step-run-table.d.ts +1 -2
  268. package/dist/src/lib/step-run-table.js +1 -2
  269. package/dist/src/lib/step-run-table.js.map +1 -1
  270. package/dist/src/lib/swift-codegen/agentGenerator.d.ts +2 -1
  271. package/dist/src/lib/swift-codegen/agentGenerator.js +24 -22
  272. package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
  273. package/dist/src/lib/swift-codegen/banners.d.ts +12 -0
  274. package/dist/src/lib/swift-codegen/banners.js +12 -0
  275. package/dist/src/lib/swift-codegen/banners.js.map +1 -1
  276. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +36 -1
  277. package/dist/src/lib/swift-codegen/functionGenerator.js +167 -50
  278. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  279. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +31 -7
  280. package/dist/src/lib/swift-codegen/schemaToSwift.js +213 -177
  281. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
  282. package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +45 -0
  283. package/dist/src/lib/swift-codegen/sharedGenerator.js +120 -0
  284. package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
  285. package/dist/src/lib/swift-codegen/userPropertiesGenerator.d.ts +30 -0
  286. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js +69 -0
  287. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js.map +1 -0
  288. package/dist/src/lib/sync-resource-types.d.ts +37 -5
  289. package/dist/src/lib/sync-resource-types.js +53 -5
  290. package/dist/src/lib/sync-resource-types.js.map +1 -1
  291. package/dist/src/lib/sync-selectors.d.ts +7 -0
  292. package/dist/src/lib/sync-selectors.js +22 -2
  293. package/dist/src/lib/sync-selectors.js.map +1 -1
  294. package/dist/src/lib/test-runs.d.ts +45 -0
  295. package/dist/src/lib/test-runs.js +150 -0
  296. package/dist/src/lib/test-runs.js.map +1 -0
  297. package/dist/src/lib/toml-database-config.d.ts +2 -1
  298. package/dist/src/lib/toml-database-config.js +4 -3
  299. package/dist/src/lib/toml-database-config.js.map +1 -1
  300. package/dist/src/lib/toml-scalar-edit.js +6 -4
  301. package/dist/src/lib/toml-scalar-edit.js.map +1 -1
  302. package/dist/src/lib/user-index.d.ts +80 -0
  303. package/dist/src/lib/user-index.js +166 -0
  304. package/dist/src/lib/user-index.js.map +1 -0
  305. package/dist/src/lib/user-properties/generated-properties-schema.d.ts +159 -0
  306. package/dist/src/lib/user-properties/generated-properties-schema.js +471 -0
  307. package/dist/src/lib/user-properties/generated-properties-schema.js.map +1 -0
  308. package/dist/src/lib/user-properties/user-properties-codegen.d.ts +55 -0
  309. package/dist/src/lib/user-properties/user-properties-codegen.js +129 -0
  310. package/dist/src/lib/user-properties/user-properties-codegen.js.map +1 -0
  311. package/dist/src/lib/user-walk.d.ts +31 -0
  312. package/dist/src/lib/user-walk.js +102 -0
  313. package/dist/src/lib/user-walk.js.map +1 -0
  314. package/dist/src/lib/worker-perf-format.d.ts +22 -0
  315. package/dist/src/lib/worker-perf-format.js +27 -0
  316. package/dist/src/lib/worker-perf-format.js.map +1 -0
  317. package/dist/src/types/index.d.ts +13 -34
  318. package/package.json +5 -3
@@ -0,0 +1,80 @@
1
+ /**
2
+ * The parts of `primitive users index` that need no server: flag parsing,
3
+ * the wait loop, the revalidation's completion (#5524) and the status's human
4
+ * form.
5
+ */
6
+ /** The limit flags, their override field, and the label the human form prints. */
7
+ export declare const USER_INDEX_LIMIT_FLAGS: readonly [{
8
+ readonly flag: "shard-threshold";
9
+ readonly field: "shardThreshold";
10
+ readonly label: "Threshold";
11
+ readonly effective: "placed";
12
+ }, {
13
+ readonly flag: "shard-bytes";
14
+ readonly field: "shardBytes";
15
+ readonly label: "Byte backstop";
16
+ readonly effective: "bytes";
17
+ }, {
18
+ readonly flag: "shard-ceiling";
19
+ readonly field: "shardCeiling";
20
+ readonly label: "Ceiling";
21
+ readonly effective: "ceiling";
22
+ }];
23
+ /** The property cap flags (#5385), their override field, and the label the human form prints. */
24
+ export declare const USER_PROPERTIES_CAP_FLAGS: readonly [{
25
+ readonly flag: "max-fields";
26
+ readonly field: "maxFields";
27
+ readonly label: "Max fields";
28
+ }, {
29
+ readonly flag: "max-unique";
30
+ readonly field: "maxUnique";
31
+ readonly label: "Max unique";
32
+ }, {
33
+ readonly flag: "max-indexed";
34
+ readonly field: "maxIndexed";
35
+ readonly label: "Max indexed";
36
+ }, {
37
+ readonly flag: "max-bytes";
38
+ readonly field: "maxBytes";
39
+ readonly label: "Max bytes per user";
40
+ }];
41
+ /** How long `--wait` waits by default, in seconds. */
42
+ export declare const USER_INDEX_WAIT_DEFAULT_SECONDS = 600;
43
+ /** A flag value the command refuses before any request. */
44
+ export declare class UserIndexFlagError extends Error {
45
+ }
46
+ /** A positive integer flag value, or a refusal naming the flag. */
47
+ export declare function parsePositiveIntegerFlag(flag: string, value: string): number;
48
+ /** `--timeout` in milliseconds: a positive number of seconds, else a refusal; the default when absent. */
49
+ export declare function parseWaitTimeout(value: string | undefined): number;
50
+ /**
51
+ * The PATCH body of `users index limits`: each setter flag's value and each
52
+ * `--clear` field as null; null when no flag asks for a change.
53
+ */
54
+ export declare function limitsPatchOf(options: Record<string, unknown>): Record<string, number | null> | null;
55
+ /** Collect a repeatable option's values. */
56
+ export declare function collectOption(value: string, previous?: string[]): string[];
57
+ /**
58
+ * Poll `read` every `intervalMs` until `done` holds; answers the last value,
59
+ * or null when `timeoutMs` passed first.
60
+ */
61
+ export declare function waitForUserIndex<T>(read: () => Promise<T>, done: (value: T) => boolean, timeoutMs: number, intervalMs?: number): Promise<T | null>;
62
+ /** A reconciliation's counts as one line (`lastReconcile.counts`). */
63
+ export declare function formatReconcileCounts(counts: Record<string, number> | null | undefined): string;
64
+ /** A slice's counts as one line: `verified n, re-projected n, deleted n, applied n, misplaced n, failed n`. */
65
+ export declare function formatSliceCounts(slice: Record<string, unknown> | null | undefined): string;
66
+ /** The counts of every slice a `--wait` ran, summed. */
67
+ export declare function sumSliceCounts(slices: ReadonlyArray<Record<string, unknown> | null | undefined>): Record<string, number>;
68
+ /**
69
+ * Whether the revalidation has gone over everything since `since` (ms): the
70
+ * member walk completed at or after it, and every current shard is empty or
71
+ * holds no record verified before it. An app with no index needs the walk
72
+ * only. What `users index reconcile --wait` waits for.
73
+ */
74
+ export declare function revalidationComplete(status: any, since: number): boolean;
75
+ /** The status's revalidation line: the oldest verified record, when the next slice runs, and the recently read users waiting for it. */
76
+ export declare function formatRevalidationLine(revalidation: any): string;
77
+ /** The status's last-slice line: when, what started it, and its counts; `never` before the first. */
78
+ export declare function formatLastSliceLine(slice: any): string;
79
+ /** The status's shard table: number, lower bound, status, records, bytes and when the counts were read. */
80
+ export declare function formatUserIndexShards(shards: any[]): string;
@@ -0,0 +1,166 @@
1
+ /**
2
+ * The parts of `primitive users index` that need no server: flag parsing,
3
+ * the wait loop, the revalidation's completion (#5524) and the status's human
4
+ * form.
5
+ */
6
+ import { formatDate, formatTable } from "./output.js";
7
+ /** The limit flags, their override field, and the label the human form prints. */
8
+ export const USER_INDEX_LIMIT_FLAGS = [
9
+ { flag: "shard-threshold", field: "shardThreshold", label: "Threshold", effective: "placed" },
10
+ { flag: "shard-bytes", field: "shardBytes", label: "Byte backstop", effective: "bytes" },
11
+ { flag: "shard-ceiling", field: "shardCeiling", label: "Ceiling", effective: "ceiling" },
12
+ ];
13
+ /** The property cap flags (#5385), their override field, and the label the human form prints. */
14
+ export const USER_PROPERTIES_CAP_FLAGS = [
15
+ { flag: "max-fields", field: "maxFields", label: "Max fields" },
16
+ { flag: "max-unique", field: "maxUnique", label: "Max unique" },
17
+ { flag: "max-indexed", field: "maxIndexed", label: "Max indexed" },
18
+ { flag: "max-bytes", field: "maxBytes", label: "Max bytes per user" },
19
+ ];
20
+ /** How long `--wait` waits by default, in seconds. */
21
+ export const USER_INDEX_WAIT_DEFAULT_SECONDS = 600;
22
+ /** A flag value the command refuses before any request. */
23
+ export class UserIndexFlagError extends Error {
24
+ }
25
+ /** A positive integer flag value, or a refusal naming the flag. */
26
+ export function parsePositiveIntegerFlag(flag, value) {
27
+ const trimmed = String(value).trim();
28
+ const number = /^\d+$/.test(trimmed) ? Number(trimmed) : NaN;
29
+ if (!Number.isSafeInteger(number) || number <= 0)
30
+ throw new UserIndexFlagError(`--${flag} must be a positive integer (got "${value}").`);
31
+ return number;
32
+ }
33
+ /** `--timeout` in milliseconds: a positive number of seconds, else a refusal; the default when absent. */
34
+ export function parseWaitTimeout(value) {
35
+ if (value === undefined)
36
+ return USER_INDEX_WAIT_DEFAULT_SECONDS * 1000;
37
+ const seconds = /^\d+(\.\d+)?$/.test(String(value).trim()) ? Number(value) : NaN;
38
+ if (!Number.isFinite(seconds) || seconds <= 0)
39
+ throw new UserIndexFlagError(`--timeout must be a positive number of seconds (got "${value}").`);
40
+ return Math.round(seconds * 1000);
41
+ }
42
+ /**
43
+ * The PATCH body of `users index limits`: each setter flag's value and each
44
+ * `--clear` field as null; null when no flag asks for a change.
45
+ */
46
+ export function limitsPatchOf(options) {
47
+ const patch = {};
48
+ const camel = (flag) => flag.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
49
+ const flags = [...USER_INDEX_LIMIT_FLAGS, ...USER_PROPERTIES_CAP_FLAGS];
50
+ for (const { flag, field } of flags) {
51
+ const value = options[camel(flag)];
52
+ if (value !== undefined)
53
+ patch[field] = parsePositiveIntegerFlag(flag, String(value));
54
+ }
55
+ const cleared = options.clear ?? [];
56
+ for (const name of cleared) {
57
+ const known = flags.find((entry) => entry.flag === name || entry.field === name);
58
+ if (!known) {
59
+ throw new UserIndexFlagError(`--clear takes shard-threshold, shard-bytes or shard-ceiling, or a property cap: max-fields, max-unique, max-indexed or max-bytes (got "${name}").`);
60
+ }
61
+ if (typeof patch[known.field] === "number")
62
+ throw new UserIndexFlagError(`--${known.flag} is both set and cleared.`);
63
+ patch[known.field] = null;
64
+ }
65
+ return Object.keys(patch).length > 0 ? patch : null;
66
+ }
67
+ /** Collect a repeatable option's values. */
68
+ export function collectOption(value, previous = []) {
69
+ return [...previous, value];
70
+ }
71
+ /**
72
+ * Poll `read` every `intervalMs` until `done` holds; answers the last value,
73
+ * or null when `timeoutMs` passed first.
74
+ */
75
+ export async function waitForUserIndex(read, done, timeoutMs, intervalMs = 1000) {
76
+ const deadline = Date.now() + timeoutMs;
77
+ for (;;) {
78
+ const value = await read();
79
+ if (done(value))
80
+ return value;
81
+ if (Date.now() + intervalMs > deadline)
82
+ return null;
83
+ await new Promise((resolve) => setTimeout(resolve, intervalMs));
84
+ }
85
+ }
86
+ /** A reconciliation's counts as one line (`lastReconcile.counts`). */
87
+ export function formatReconcileCounts(counts) {
88
+ const k = counts ?? {};
89
+ const parts = ["scanned", "missing", "drifted", "orphaned", "misplaced", "swept"].map((name) => `${name} ${k[name] ?? 0}`);
90
+ // `swept` counts the lookup rows the slice released; `invitationClaims` the live invitation rows its claim check left alone.
91
+ parts.push(`invitation claims ${k.invitationClaims ?? 0}`);
92
+ return parts.join(", ");
93
+ }
94
+ /** The counts of a revalidation slice (#5524) a reconcile prints. */
95
+ const SLICE_COUNTS = [
96
+ ["verified", "verified"],
97
+ ["reprojected", "re-projected"],
98
+ ["deleted", "deleted"],
99
+ ["applied", "applied"],
100
+ ["misplaced", "misplaced"],
101
+ ["failed", "failed"],
102
+ ];
103
+ /** A slice's counts as one line: `verified n, re-projected n, deleted n, applied n, misplaced n, failed n`. */
104
+ export function formatSliceCounts(slice) {
105
+ return SLICE_COUNTS.map(([key, label]) => `${label} ${Number(slice?.[key] ?? 0)}`).join(", ");
106
+ }
107
+ /** The counts of every slice a `--wait` ran, summed. */
108
+ export function sumSliceCounts(slices) {
109
+ const totals = { verified: 0, stamped: 0, reprojected: 0, deleted: 0, applied: 0, misplaced: 0, failed: 0, hinted: 0 };
110
+ for (const slice of slices)
111
+ for (const key of Object.keys(totals))
112
+ totals[key] += Number(slice?.[key] ?? 0);
113
+ return totals;
114
+ }
115
+ /**
116
+ * Whether the revalidation has gone over everything since `since` (ms): the
117
+ * member walk completed at or after it, and every current shard is empty or
118
+ * holds no record verified before it. An app with no index needs the walk
119
+ * only. What `users index reconcile --wait` waits for.
120
+ */
121
+ export function revalidationComplete(status, since) {
122
+ const revalidation = status?.revalidation;
123
+ if (!revalidation)
124
+ return false;
125
+ const completedAt = Date.parse(revalidation.sourceCursor?.completedAt ?? "");
126
+ if (!(completedAt >= since))
127
+ return false;
128
+ if (revalidation.replicaCursor === null)
129
+ return true;
130
+ const shards = revalidation.replicaCursor?.shards ?? [];
131
+ return shards.every((shard) => shard.empty === true || Date.parse(shard.oldestVerifiedAt ?? "") >= since);
132
+ }
133
+ /** The status's revalidation line: the oldest verified record, when the next slice runs, and the recently read users waiting for it. */
134
+ export function formatRevalidationLine(revalidation) {
135
+ const shards = revalidation?.replicaCursor?.shards ?? [];
136
+ const oldest = revalidation?.oldestVerifiedAt
137
+ ? formatDate(revalidation.oldestVerifiedAt)
138
+ : revalidation?.replicaCursor == null
139
+ ? "none"
140
+ : shards.length > 0 && shards.every((shard) => shard.empty === true)
141
+ ? "empty"
142
+ : "unstamped";
143
+ const next = revalidation?.lastSlice?.nextAt ? formatDate(revalidation.lastSlice.nextAt) : "not yet scheduled";
144
+ return `oldest verified ${oldest}, next slice ${next}, ${Number(revalidation?.recentlyRead ?? 0)} recently read`;
145
+ }
146
+ /** The status's last-slice line: when, what started it, and its counts; `never` before the first. */
147
+ export function formatLastSliceLine(slice) {
148
+ if (!slice)
149
+ return "never";
150
+ const counts = SLICE_COUNTS.filter(([key]) => key !== "misplaced")
151
+ .map(([key, label]) => `${label} ${Number(slice[key] ?? 0)}`)
152
+ .join(", ");
153
+ return `${formatDate(slice.at)} (${slice.trigger}; ${counts})`;
154
+ }
155
+ /** The status's shard table: number, lower bound, status, records, bytes and when the counts were read. */
156
+ export function formatUserIndexShards(shards) {
157
+ return formatTable(shards, [
158
+ { header: "NO", key: "no" },
159
+ { header: "LOWER BOUND", key: "lowerBound" },
160
+ { header: "STATUS", key: "status" },
161
+ { header: "RECORDS", key: "placed", format: (value) => (value === null || value === undefined ? "-" : String(value)) },
162
+ { header: "BYTES", key: "bytes", format: (value) => (value === null || value === undefined ? "-" : String(value)) },
163
+ { header: "CHECKED", key: "lastCheckedAt", format: (value) => (value ? formatDate(value) : "-") },
164
+ ]);
165
+ }
166
+ //# sourceMappingURL=user-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-index.js","sourceRoot":"","sources":["../../../src/lib/user-index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,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AC,CAAC;IACd,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,OAAO,KAAK,MAAM,GAAG,CAAC;AACjE,CAAC;AAED,2GAA2G;AAC3G,MAAM,UAAU,qBAAqB,CAAC,MAAa;IACjD,OAAO,WAAW,CAAC,MAAM,EAAE;QACzB,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE;QAC3B,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,YAAY,EAAE;QAC5C,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE;QACnC,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;QAC3H,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;QACxH,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;KACvG,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,159 @@
1
+ /**
2
+ * GENERATED FILE — DO NOT EDIT BY HAND.
3
+ *
4
+ * Vendored from the canonical server module
5
+ * `src/user-index/properties-schema.ts` — the SAME parser, rules, hash and
6
+ * diff the server's user properties push route applies. The CLI cannot import
7
+ * server `src/` at runtime, so the preflight, the pull, the diff and the
8
+ * codegens import this committed copy instead. Its field grammar import reads
9
+ * the CLI's vendored copy of the grammar.
10
+ *
11
+ * Regenerate with:
12
+ * node cli/scripts/gen-user-properties-schema.mjs (runs at CLI prebuild)
13
+ *
14
+ * `cli/scripts/gen-user-properties-schema.mjs --check` (asserted by
15
+ * `cli/tests/unit/user-properties-schema-drift-5385.test.ts`) fails when this
16
+ * copy does not match the source.
17
+ */
18
+ /** The normalized form's version. */
19
+ export declare const USER_PROPERTIES_SCHEMA_VERSION = 1;
20
+ /** A property's type: the property context's six field types. */
21
+ export type UserPropertyType = "string" | "number" | "boolean" | "date" | "id" | "stringset";
22
+ /** The field types a property may declare. */
23
+ export declare const USER_PROPERTY_TYPES: readonly UserPropertyType[];
24
+ /** Who reaches a property from a client session: `none` (the default), `self`, `self-write`, `members`, `self-write-members`. */
25
+ export declare const USER_PROPERTY_CLIENT_VALUES: readonly ["none", "self", "self-write", "members", "self-write-members"];
26
+ /** A property's `client` option. */
27
+ export type UserPropertyClient = (typeof USER_PROPERTY_CLIENT_VALUES)[number];
28
+ /** One declared property in the normalized form. */
29
+ export interface UserPropertyField {
30
+ type: UserPropertyType;
31
+ indexed: boolean;
32
+ unique: boolean;
33
+ client: UserPropertyClient;
34
+ default?: string | number | boolean | string[];
35
+ enum?: string[];
36
+ maxLength?: number;
37
+ maxCount?: number;
38
+ }
39
+ /** One `[[unique_constraints]]` entry: two or more declared fields whose values together are unique. */
40
+ export interface UserPropertyConstraint {
41
+ name: string;
42
+ fields: string[];
43
+ }
44
+ /** The normalized schema the server stores and every codegen reads. Field order is the file's. */
45
+ export interface UserPropertiesSchema {
46
+ v: typeof USER_PROPERTIES_SCHEMA_VERSION;
47
+ fields: Record<string, UserPropertyField>;
48
+ uniqueConstraints: UserPropertyConstraint[];
49
+ }
50
+ /** What was wrong and where: `fields.<name>`, `unique_constraints.<name>`, or a top-level key. */
51
+ export interface UserPropertiesReason {
52
+ path: string;
53
+ reason: string;
54
+ }
55
+ /** A parse's answer. A TOML syntax error also carries its line and column. */
56
+ export type UserPropertiesParse = {
57
+ ok: true;
58
+ schema: UserPropertiesSchema;
59
+ } | {
60
+ ok: false;
61
+ reasons: UserPropertiesReason[];
62
+ syntax?: {
63
+ line: number;
64
+ column: number;
65
+ message: string;
66
+ };
67
+ };
68
+ /** The caps a push is judged against. */
69
+ export interface UserPropertiesCaps {
70
+ /** The most declared fields. */
71
+ maxFields: number;
72
+ /** The most unique fields plus constraints. */
73
+ maxUnique: number;
74
+ /** The most indexed fields. */
75
+ maxIndexed: number;
76
+ /** The most bytes one user's stored properties take. */
77
+ maxBytes: number;
78
+ }
79
+ /** The platform's caps (intent Decision "Property storage?"); an app overrides any of them. */
80
+ export declare const USER_PROPERTIES_PLATFORM_CAPS: Readonly<UserPropertiesCaps>;
81
+ /** A name a removal dropped: the type it had and when. */
82
+ export interface RemovedUserProperty {
83
+ type: UserPropertyType;
84
+ removedAt: string;
85
+ }
86
+ /** Every name a publish ever dropped and has not redeclared with the same type. */
87
+ export type RemovedUserProperties = Record<string, RemovedUserProperty>;
88
+ /** The removal history's budget: a push whose record would pass it is refused. */
89
+ export declare const USER_PROPERTIES_REMOVED_FIELDS_MAX_BYTES: number;
90
+ /** Every field an app ever declared with the type it was created with, and every constraint name, in the order first declared. */
91
+ export interface DeclaredUserPropertyNames {
92
+ fields: Record<string, UserPropertyType>;
93
+ uniqueConstraints: string[];
94
+ }
95
+ /** The declared-name history's budget: a push whose record would pass it is refused. */
96
+ export declare const USER_PROPERTIES_DECLARED_NAMES_MAX_BYTES: number;
97
+ /** The longest property or constraint name. */
98
+ export declare const USER_PROPERTY_NAME_MAX_LENGTH = 64;
99
+ /** The empty schema: what an app with no pushed file has. */
100
+ export declare function emptyUserPropertiesSchema(): UserPropertiesSchema;
101
+ /** Whether a client may write a property under `client`. */
102
+ export declare function clientWritable(client: UserPropertyClient): boolean;
103
+ /** `record[name]` when `record` holds it itself; never a name inherited from `Object.prototype` (`toString` is a valid property name). */
104
+ export declare function ownEntry<T>(record: Readonly<Record<string, T>> | null | undefined, name: string): T | undefined;
105
+ /**
106
+ * Parse `user-properties.toml` into the normalized schema, or every reason
107
+ * it is refused (the grammar and the rules; the caps are
108
+ * {@link judgeUserPropertiesCaps}'s). An empty file is the empty schema.
109
+ */
110
+ export declare function parseUserPropertiesToml(text: string): UserPropertiesParse;
111
+ /** Read a stored normalized schema (`UserPropertiesConfig.schema`); a missing or unreadable one is the empty schema. */
112
+ export declare function storedUserPropertiesSchema(json: string | null | undefined): UserPropertiesSchema;
113
+ /** The caps a schema breaks, against `caps` (the app's effective caps). */
114
+ export declare function judgeUserPropertiesCaps(schema: UserPropertiesSchema, caps: Pick<UserPropertiesCaps, "maxFields" | "maxUnique" | "maxIndexed">): UserPropertiesReason[];
115
+ /** JSON with object keys in code-point order, so equal values print equally. */
116
+ export declare function stableUserPropertiesJson(value: unknown): string;
117
+ /**
118
+ * The schema's hash: hex SHA-256 of the sorted-key JSON of `{ fields,
119
+ * uniqueConstraints }`, the constraints sorted by name, so the same schema
120
+ * declared in another order hashes the same.
121
+ */
122
+ export declare function userPropertiesHash(schema: UserPropertiesSchema): Promise<string>;
123
+ /** The schema as `user-properties.toml` text (what a pull writes), in declaration order. */
124
+ export declare function serializeUserPropertiesToml(schema: UserPropertiesSchema): string;
125
+ /** What a push changes against the active schema and the app's history. */
126
+ export interface UserPropertiesDiff {
127
+ /** Names declared now and not in the active schema. */
128
+ addedFields: string[];
129
+ /** Names the active schema declares and this push drops. */
130
+ droppedFields: string[];
131
+ /** The removal history a publish of this push writes. */
132
+ removedFields: RemovedUserProperties;
133
+ /** The declared-name history a publish of this push writes. */
134
+ declaredNames: DeclaredUserPropertyNames;
135
+ /** Names newly unique. */
136
+ newUnique: string[];
137
+ /** Constraints new or with another field list. */
138
+ newConstraints: string[];
139
+ /** Changes refused outright. */
140
+ refusals: UserPropertiesReason[];
141
+ }
142
+ /**
143
+ * Judge `next` against the `active` schema and the app's history: the
144
+ * removal record and every name it ever declared with its type (`declared`;
145
+ * the active and removed names count too, for a row written before the
146
+ * record existed). A field's name, type and uniqueness are fixed when it is
147
+ * created: a type change on a declared name (a scalar/stringset crossing
148
+ * included), `unique` newly on a name declared before, a new or changed
149
+ * constraint naming any field declared before, and a constraint under a name
150
+ * declared before are refused. No push therefore needs stored values
151
+ * checked: whatever this does not refuse publishes at once.
152
+ */
153
+ export declare function diffUserPropertiesSchemas(active: UserPropertiesSchema, next: UserPropertiesSchema, removed: RemovedUserProperties, now?: number, declared?: DeclaredUserPropertyNames): UserPropertiesDiff;
154
+ /**
155
+ * A user's properties as the platform answers them: the declared names
156
+ * only, a stored non-null value as stored, else the field's default when it
157
+ * has one; an absent field with no default is left out.
158
+ */
159
+ export declare function applyUserPropertyDefaults(schema: UserPropertiesSchema, stored: Record<string, unknown> | null | undefined): Record<string, unknown>;