primitive-admin 1.2.0-alpha.14 → 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 (400) hide show
  1. package/README.md +181 -73
  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 +80 -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 +181 -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-transitions.d.ts +39 -0
  14. package/dist/src/commands/apps-transitions.js +198 -0
  15. package/dist/src/commands/apps-transitions.js.map +1 -0
  16. package/dist/src/commands/apps.d.ts +11 -0
  17. package/dist/src/commands/apps.js +65 -3
  18. package/dist/src/commands/apps.js.map +1 -1
  19. package/dist/src/commands/auth-sessions.js +2 -0
  20. package/dist/src/commands/auth-sessions.js.map +1 -1
  21. package/dist/src/commands/auth.js +16 -1
  22. package/dist/src/commands/auth.js.map +1 -1
  23. package/dist/src/commands/blob-buckets.js +2 -0
  24. package/dist/src/commands/blob-buckets.js.map +1 -1
  25. package/dist/src/commands/collections.js +2 -0
  26. package/dist/src/commands/collections.js.map +1 -1
  27. package/dist/src/commands/comparisons.js +2 -0
  28. package/dist/src/commands/comparisons.js.map +1 -1
  29. package/dist/src/commands/config.d.ts +1 -1
  30. package/dist/src/commands/config.js +42 -9
  31. package/dist/src/commands/config.js.map +1 -1
  32. package/dist/src/commands/connections.js +2 -0
  33. package/dist/src/commands/connections.js.map +1 -1
  34. package/dist/src/commands/database-type-configs.js +5 -3
  35. package/dist/src/commands/database-type-configs.js.map +1 -1
  36. package/dist/src/commands/databases.js +6 -4
  37. package/dist/src/commands/databases.js.map +1 -1
  38. package/dist/src/commands/db3-types.js +2 -0
  39. package/dist/src/commands/db3-types.js.map +1 -1
  40. package/dist/src/commands/db3.d.ts +12 -0
  41. package/dist/src/commands/db3.js +408 -31
  42. package/dist/src/commands/db3.js.map +1 -1
  43. package/dist/src/commands/documents.d.ts +52 -12
  44. package/dist/src/commands/documents.js +120 -29
  45. package/dist/src/commands/documents.js.map +1 -1
  46. package/dist/src/commands/email-templates.js +74 -0
  47. package/dist/src/commands/email-templates.js.map +1 -1
  48. package/dist/src/commands/env.js +2 -0
  49. package/dist/src/commands/env.js.map +1 -1
  50. package/dist/src/commands/functions.js +90 -11
  51. package/dist/src/commands/functions.js.map +1 -1
  52. package/dist/src/commands/groups.js +20 -3
  53. package/dist/src/commands/groups.js.map +1 -1
  54. package/dist/src/commands/guides.js +2 -0
  55. package/dist/src/commands/guides.js.map +1 -1
  56. package/dist/src/commands/hosting.d.ts +8 -0
  57. package/dist/src/commands/hosting.js +346 -0
  58. package/dist/src/commands/hosting.js.map +1 -0
  59. package/dist/src/commands/init.js +9 -1
  60. package/dist/src/commands/init.js.map +1 -1
  61. package/dist/src/commands/integrations.js +82 -47
  62. package/dist/src/commands/integrations.js.map +1 -1
  63. package/dist/src/commands/locks.js +2 -0
  64. package/dist/src/commands/locks.js.map +1 -1
  65. package/dist/src/commands/metadata-category-configs.js +2 -0
  66. package/dist/src/commands/metadata-category-configs.js.map +1 -1
  67. package/dist/src/commands/metadata.js +41 -0
  68. package/dist/src/commands/metadata.js.map +1 -1
  69. package/dist/src/commands/prompts.js +75 -47
  70. package/dist/src/commands/prompts.js.map +1 -1
  71. package/dist/src/commands/rate-counters.d.ts +19 -0
  72. package/dist/src/commands/rate-counters.js +104 -0
  73. package/dist/src/commands/rate-counters.js.map +1 -0
  74. package/dist/src/commands/rule-sets.js +2 -0
  75. package/dist/src/commands/rule-sets.js.map +1 -1
  76. package/dist/src/commands/schemas.d.ts +15 -0
  77. package/dist/src/commands/schemas.js +122 -0
  78. package/dist/src/commands/schemas.js.map +1 -0
  79. package/dist/src/commands/secrets.js +47 -3
  80. package/dist/src/commands/secrets.js.map +1 -1
  81. package/dist/src/commands/sessions.js +2 -0
  82. package/dist/src/commands/sessions.js.map +1 -1
  83. package/dist/src/commands/skill.js +2 -0
  84. package/dist/src/commands/skill.js.map +1 -1
  85. package/dist/src/commands/sync-schemas.d.ts +202 -0
  86. package/dist/src/commands/sync-schemas.js +629 -0
  87. package/dist/src/commands/sync-schemas.js.map +1 -0
  88. package/dist/src/commands/sync-user-properties.d.ts +118 -0
  89. package/dist/src/commands/sync-user-properties.js +276 -0
  90. package/dist/src/commands/sync-user-properties.js.map +1 -0
  91. package/dist/src/commands/sync.d.ts +344 -14
  92. package/dist/src/commands/sync.js +1834 -345
  93. package/dist/src/commands/sync.js.map +1 -1
  94. package/dist/src/commands/tokens.js +2 -0
  95. package/dist/src/commands/tokens.js.map +1 -1
  96. package/dist/src/commands/transitions.d.ts +54 -0
  97. package/dist/src/commands/transitions.js +418 -0
  98. package/dist/src/commands/transitions.js.map +1 -0
  99. package/dist/src/commands/usage.d.ts +18 -0
  100. package/dist/src/commands/usage.js +343 -0
  101. package/dist/src/commands/usage.js.map +1 -0
  102. package/dist/src/commands/user-properties.d.ts +14 -0
  103. package/dist/src/commands/user-properties.js +79 -0
  104. package/dist/src/commands/user-properties.js.map +1 -0
  105. package/dist/src/commands/users.js +878 -16
  106. package/dist/src/commands/users.js.map +1 -1
  107. package/dist/src/commands/vars.js +2 -0
  108. package/dist/src/commands/vars.js.map +1 -1
  109. package/dist/src/commands/waitlist.js +39 -4
  110. package/dist/src/commands/waitlist.js.map +1 -1
  111. package/dist/src/lib/analytics-query.d.ts +58 -0
  112. package/dist/src/lib/analytics-query.js +134 -0
  113. package/dist/src/lib/analytics-query.js.map +1 -0
  114. package/dist/src/lib/api-client.d.ts +1354 -97
  115. package/dist/src/lib/api-client.js +513 -164
  116. package/dist/src/lib/api-client.js.map +1 -1
  117. package/dist/src/lib/app-settings-descriptor.d.ts +1 -1
  118. package/dist/src/lib/app-settings-descriptor.js +6 -0
  119. package/dist/src/lib/app-settings-descriptor.js.map +1 -1
  120. package/dist/src/lib/auth-flow.d.ts +33 -0
  121. package/dist/src/lib/auth-flow.js +404 -13
  122. package/dist/src/lib/auth-flow.js.map +1 -1
  123. package/dist/src/lib/block-selector.d.ts +9 -15
  124. package/dist/src/lib/block-selector.js +9 -20
  125. package/dist/src/lib/block-selector.js.map +1 -1
  126. package/dist/src/lib/cli-manifest.d.ts +9 -0
  127. package/dist/src/lib/cli-manifest.js +10 -1
  128. package/dist/src/lib/cli-manifest.js.map +1 -1
  129. package/dist/src/lib/cli-version.d.ts +14 -0
  130. package/dist/src/lib/cli-version.js +38 -0
  131. package/dist/src/lib/cli-version.js.map +1 -0
  132. package/dist/src/lib/codegen-shared/prettierStable.d.ts +41 -0
  133. package/dist/src/lib/codegen-shared/prettierStable.js +146 -24
  134. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -1
  135. package/dist/src/lib/command-groups.d.ts +30 -0
  136. package/dist/src/lib/command-groups.js +109 -0
  137. package/dist/src/lib/command-groups.js.map +1 -0
  138. package/dist/src/lib/command-status.d.ts +147 -0
  139. package/dist/src/lib/command-status.js +266 -0
  140. package/dist/src/lib/command-status.js.map +1 -0
  141. package/dist/src/lib/config-object-descriptor.d.ts +6 -0
  142. package/dist/src/lib/config-object-descriptor.js +71 -1
  143. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  144. package/dist/src/lib/config-toml.d.ts +11 -2
  145. package/dist/src/lib/config-toml.js +25 -2
  146. package/dist/src/lib/config-toml.js.map +1 -1
  147. package/dist/src/lib/data-input.d.ts +1 -1
  148. package/dist/src/lib/data-input.js +1 -1
  149. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +1 -1
  150. package/dist/src/lib/db-codegen/dbTsTypes.js +3 -0
  151. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
  152. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +18 -1
  153. package/dist/src/lib/db-codegen/dbTypeIR.js +14 -5
  154. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
  155. package/dist/src/lib/db-type-records.d.ts +106 -0
  156. package/dist/src/lib/db-type-records.js +224 -0
  157. package/dist/src/lib/db-type-records.js.map +1 -0
  158. package/dist/src/lib/db3-export.d.ts +51 -14
  159. package/dist/src/lib/db3-export.js +136 -28
  160. package/dist/src/lib/db3-export.js.map +1 -1
  161. package/dist/src/lib/db3-index-output.d.ts +92 -4
  162. package/dist/src/lib/db3-index-output.js +183 -11
  163. package/dist/src/lib/db3-index-output.js.map +1 -1
  164. package/dist/src/lib/db3-type-models.d.ts +49 -7
  165. package/dist/src/lib/db3-type-models.js +159 -28
  166. package/dist/src/lib/db3-type-models.js.map +1 -1
  167. package/dist/src/lib/deprecation.d.ts +2 -2
  168. package/dist/src/lib/deprecation.js +2 -2
  169. package/dist/src/lib/experimental-apis.d.ts +36 -0
  170. package/dist/src/lib/experimental-apis.js +46 -0
  171. package/dist/src/lib/experimental-apis.js.map +1 -0
  172. package/dist/src/lib/file-attachment.d.ts +24 -0
  173. package/dist/src/lib/file-attachment.js +31 -0
  174. package/dist/src/lib/file-attachment.js.map +1 -0
  175. package/dist/src/lib/function-authorize-check.d.ts +1 -1
  176. package/dist/src/lib/function-authorize-check.js +2 -1
  177. package/dist/src/lib/function-authorize-check.js.map +1 -1
  178. package/dist/src/lib/function-authorize-view.d.ts +12 -0
  179. package/dist/src/lib/function-authorize-view.js +38 -0
  180. package/dist/src/lib/function-authorize-view.js.map +1 -1
  181. package/dist/src/lib/function-bundle.d.ts +27 -5
  182. package/dist/src/lib/function-bundle.js +106 -7
  183. package/dist/src/lib/function-bundle.js.map +1 -1
  184. package/dist/src/lib/function-collect.d.ts +15 -0
  185. package/dist/src/lib/function-collect.js +73 -14
  186. package/dist/src/lib/function-collect.js.map +1 -1
  187. package/dist/src/lib/function-db-types.d.ts +63 -40
  188. package/dist/src/lib/function-db-types.js +289 -293
  189. package/dist/src/lib/function-db-types.js.map +1 -1
  190. package/dist/src/lib/function-document-types.d.ts +19 -7
  191. package/dist/src/lib/function-document-types.js +24 -12
  192. package/dist/src/lib/function-document-types.js.map +1 -1
  193. package/dist/src/lib/function-lint.d.ts +24 -1
  194. package/dist/src/lib/function-lint.js +123 -1
  195. package/dist/src/lib/function-lint.js.map +1 -1
  196. package/dist/src/lib/function-run.d.ts +1 -1
  197. package/dist/src/lib/function-run.js +1 -1
  198. package/dist/src/lib/function-run.js.map +1 -1
  199. package/dist/src/lib/function-schema-codegen.d.ts +85 -21
  200. package/dist/src/lib/function-schema-codegen.js +191 -85
  201. package/dist/src/lib/function-schema-codegen.js.map +1 -1
  202. package/dist/src/lib/function-schema-refs.d.ts +98 -0
  203. package/dist/src/lib/function-schema-refs.js +177 -0
  204. package/dist/src/lib/function-schema-refs.js.map +1 -0
  205. package/dist/src/lib/function-sync.d.ts +38 -4
  206. package/dist/src/lib/function-sync.js +91 -14
  207. package/dist/src/lib/function-sync.js.map +1 -1
  208. package/dist/src/lib/function-typecheck.d.ts +52 -0
  209. package/dist/src/lib/function-typecheck.js +171 -54
  210. package/dist/src/lib/function-typecheck.js.map +1 -1
  211. package/dist/src/lib/generated-build-flags.d.ts +13 -0
  212. package/dist/src/lib/generated-build-flags.js +14 -0
  213. package/dist/src/lib/generated-build-flags.js.map +1 -0
  214. package/dist/src/lib/generated-command-status.d.ts +6 -0
  215. package/dist/src/lib/generated-command-status.js +469 -0
  216. package/dist/src/lib/generated-command-status.js.map +1 -0
  217. package/dist/src/lib/generated-config-surfaces.d.ts +239 -14
  218. package/dist/src/lib/generated-config-surfaces.js +670 -85
  219. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  220. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  221. package/dist/src/lib/generated-sdk-types.js +1 -1
  222. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  223. package/dist/src/lib/hosting-build.d.ts +97 -0
  224. package/dist/src/lib/hosting-build.js +204 -0
  225. package/dist/src/lib/hosting-build.js.map +1 -0
  226. package/dist/src/lib/hosting-client.d.ts +167 -0
  227. package/dist/src/lib/hosting-client.js +340 -0
  228. package/dist/src/lib/hosting-client.js.map +1 -0
  229. package/dist/src/lib/hosting-environments.d.ts +32 -0
  230. package/dist/src/lib/hosting-environments.js +74 -0
  231. package/dist/src/lib/hosting-environments.js.map +1 -0
  232. package/dist/src/lib/hosting-errors.d.ts +30 -0
  233. package/dist/src/lib/hosting-errors.js +43 -0
  234. package/dist/src/lib/hosting-errors.js.map +1 -0
  235. package/dist/src/lib/hosting-token.d.ts +46 -0
  236. package/dist/src/lib/hosting-token.js +60 -0
  237. package/dist/src/lib/hosting-token.js.map +1 -0
  238. package/dist/src/lib/hosting-wait.d.ts +42 -0
  239. package/dist/src/lib/hosting-wait.js +84 -0
  240. package/dist/src/lib/hosting-wait.js.map +1 -0
  241. package/dist/src/lib/hosting-wfp-upload.d.ts +86 -0
  242. package/dist/src/lib/hosting-wfp-upload.js +149 -0
  243. package/dist/src/lib/hosting-wfp-upload.js.map +1 -0
  244. package/dist/src/lib/integration-test-request.d.ts +54 -0
  245. package/dist/src/lib/integration-test-request.js +207 -0
  246. package/dist/src/lib/integration-test-request.js.map +1 -0
  247. package/dist/src/lib/invoker-shared-enums.d.ts +35 -0
  248. package/dist/src/lib/invoker-shared-enums.js +98 -0
  249. package/dist/src/lib/invoker-shared-enums.js.map +1 -0
  250. package/dist/src/lib/log-inspection.d.ts +4 -1
  251. package/dist/src/lib/log-inspection.js.map +1 -1
  252. package/dist/src/lib/metadata-report.d.ts +85 -0
  253. package/dist/src/lib/metadata-report.js +81 -0
  254. package/dist/src/lib/metadata-report.js.map +1 -0
  255. package/dist/src/lib/output.d.ts +1 -1
  256. package/dist/src/lib/output.js +1 -1
  257. package/dist/src/lib/platform-owned.js +5 -0
  258. package/dist/src/lib/platform-owned.js.map +1 -1
  259. package/dist/src/lib/primitive-declaration-names.d.ts +21 -0
  260. package/dist/src/lib/primitive-declaration-names.js +22 -0
  261. package/dist/src/lib/primitive-declaration-names.js.map +1 -0
  262. package/dist/src/lib/primitive-declaration.d.ts +174 -0
  263. package/dist/src/lib/primitive-declaration.js +792 -0
  264. package/dist/src/lib/primitive-declaration.js.map +1 -0
  265. package/dist/src/lib/prompt-schema-codegen.d.ts +36 -12
  266. package/dist/src/lib/prompt-schema-codegen.js +94 -98
  267. package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
  268. package/dist/src/lib/prompt-schema-document.d.ts +35 -0
  269. package/dist/src/lib/prompt-schema-document.js +92 -0
  270. package/dist/src/lib/prompt-schema-document.js.map +1 -0
  271. package/dist/src/lib/prompt-schema-refs.d.ts +173 -0
  272. package/dist/src/lib/prompt-schema-refs.js +478 -0
  273. package/dist/src/lib/prompt-schema-refs.js.map +1 -0
  274. package/dist/src/lib/records-verbs.d.ts +12 -2
  275. package/dist/src/lib/records-verbs.js +7 -2
  276. package/dist/src/lib/records-verbs.js.map +1 -1
  277. package/dist/src/lib/register-commands.d.ts +36 -0
  278. package/dist/src/lib/register-commands.js +37 -0
  279. package/dist/src/lib/register-commands.js.map +1 -0
  280. package/dist/src/lib/retired-imports.d.ts +53 -0
  281. package/dist/src/lib/retired-imports.js +120 -0
  282. package/dist/src/lib/retired-imports.js.map +1 -0
  283. package/dist/src/lib/schema-codegen/compiledSpace.d.ts +62 -0
  284. package/dist/src/lib/schema-codegen/compiledSpace.js +103 -0
  285. package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -0
  286. package/dist/src/lib/schema-codegen/generated-db3-bridge.d.ts +86 -0
  287. package/dist/src/lib/schema-codegen/generated-db3-bridge.js +227 -0
  288. package/dist/src/lib/schema-codegen/generated-db3-bridge.js.map +1 -0
  289. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.d.ts +85 -0
  290. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js +86 -0
  291. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js.map +1 -0
  292. package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +218 -0
  293. package/dist/src/lib/schema-codegen/generated-field-grammar.js +397 -0
  294. package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -0
  295. package/dist/src/lib/schema-codegen/generated-field-table.d.ts +80 -0
  296. package/dist/src/lib/schema-codegen/generated-field-table.js +542 -0
  297. package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -0
  298. package/dist/src/lib/schema-codegen/generated-prompt-schemas.d.ts +195 -0
  299. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js +503 -0
  300. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js.map +1 -0
  301. package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +129 -0
  302. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +154 -1
  303. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -1
  304. package/dist/src/lib/schema-codegen/generated-schema-file.d.ts +129 -0
  305. package/dist/src/lib/schema-codegen/generated-schema-file.js +475 -0
  306. package/dist/src/lib/schema-codegen/generated-schema-file.js.map +1 -0
  307. package/dist/src/lib/schema-codegen/generated-schema-provenance.d.ts +115 -0
  308. package/dist/src/lib/schema-codegen/generated-schema-provenance.js +274 -0
  309. package/dist/src/lib/schema-codegen/generated-schema-provenance.js.map +1 -0
  310. package/dist/src/lib/schema-codegen/generated-schema-refs.d.ts +366 -0
  311. package/dist/src/lib/schema-codegen/generated-schema-refs.js +1789 -0
  312. package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -0
  313. package/dist/src/lib/schema-codegen/generated-schema-shape.d.ts +27 -0
  314. package/dist/src/lib/schema-codegen/generated-schema-shape.js +126 -0
  315. package/dist/src/lib/schema-codegen/generated-schema-shape.js.map +1 -0
  316. package/dist/src/lib/schema-codegen/namedRefs.d.ts +56 -0
  317. package/dist/src/lib/schema-codegen/namedRefs.js +143 -0
  318. package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -0
  319. package/dist/src/lib/schema-codegen/schemaChanges.d.ts +74 -0
  320. package/dist/src/lib/schema-codegen/schemaChanges.js +277 -0
  321. package/dist/src/lib/schema-codegen/schemaChanges.js.map +1 -0
  322. package/dist/src/lib/schema-codegen/schemaDocs.d.ts +69 -0
  323. package/dist/src/lib/schema-codegen/schemaDocs.js +219 -0
  324. package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -0
  325. package/dist/src/lib/schema-codegen/schemaIR.d.ts +158 -0
  326. package/dist/src/lib/schema-codegen/schemaIR.js +279 -0
  327. package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -0
  328. package/dist/src/lib/schema-codegen/schemaToTs.d.ts +40 -13
  329. package/dist/src/lib/schema-codegen/schemaToTs.js +124 -160
  330. package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -1
  331. package/dist/src/lib/schema-codegen/valuesLists.d.ts +48 -0
  332. package/dist/src/lib/schema-codegen/valuesLists.js +144 -0
  333. package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -0
  334. package/dist/src/lib/schema-family-index.d.ts +228 -0
  335. package/dist/src/lib/schema-family-index.js +813 -0
  336. package/dist/src/lib/schema-family-index.js.map +1 -0
  337. package/dist/src/lib/schema-pins.d.ts +82 -0
  338. package/dist/src/lib/schema-pins.js +198 -0
  339. package/dist/src/lib/schema-pins.js.map +1 -0
  340. package/dist/src/lib/schema-preview.d.ts +244 -0
  341. package/dist/src/lib/schema-preview.js +498 -0
  342. package/dist/src/lib/schema-preview.js.map +1 -0
  343. package/dist/src/lib/skill-installer.d.ts +2 -2
  344. package/dist/src/lib/skill-installer.js +2 -21
  345. package/dist/src/lib/skill-installer.js.map +1 -1
  346. package/dist/src/lib/step-run-table.d.ts +1 -2
  347. package/dist/src/lib/step-run-table.js +1 -2
  348. package/dist/src/lib/step-run-table.js.map +1 -1
  349. package/dist/src/lib/swift-codegen/agentGenerator.d.ts +2 -1
  350. package/dist/src/lib/swift-codegen/agentGenerator.js +24 -22
  351. package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
  352. package/dist/src/lib/swift-codegen/banners.d.ts +12 -0
  353. package/dist/src/lib/swift-codegen/banners.js +12 -0
  354. package/dist/src/lib/swift-codegen/banners.js.map +1 -1
  355. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +36 -1
  356. package/dist/src/lib/swift-codegen/functionGenerator.js +168 -50
  357. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  358. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +31 -7
  359. package/dist/src/lib/swift-codegen/schemaToSwift.js +213 -177
  360. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
  361. package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +45 -0
  362. package/dist/src/lib/swift-codegen/sharedGenerator.js +165 -0
  363. package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
  364. package/dist/src/lib/swift-codegen/userPropertiesGenerator.d.ts +30 -0
  365. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js +69 -0
  366. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js.map +1 -0
  367. package/dist/src/lib/sync-resource-types.d.ts +37 -5
  368. package/dist/src/lib/sync-resource-types.js +50 -5
  369. package/dist/src/lib/sync-resource-types.js.map +1 -1
  370. package/dist/src/lib/sync-selectors.d.ts +7 -0
  371. package/dist/src/lib/sync-selectors.js +22 -2
  372. package/dist/src/lib/sync-selectors.js.map +1 -1
  373. package/dist/src/lib/test-runs.d.ts +45 -0
  374. package/dist/src/lib/test-runs.js +150 -0
  375. package/dist/src/lib/test-runs.js.map +1 -0
  376. package/dist/src/lib/toml-database-config.d.ts +2 -1
  377. package/dist/src/lib/toml-database-config.js +7 -4
  378. package/dist/src/lib/toml-database-config.js.map +1 -1
  379. package/dist/src/lib/toml-scalar-edit.js +6 -4
  380. package/dist/src/lib/toml-scalar-edit.js.map +1 -1
  381. package/dist/src/lib/transition-warnings.d.ts +21 -0
  382. package/dist/src/lib/transition-warnings.js +49 -0
  383. package/dist/src/lib/transition-warnings.js.map +1 -0
  384. package/dist/src/lib/user-index.d.ts +80 -0
  385. package/dist/src/lib/user-index.js +166 -0
  386. package/dist/src/lib/user-index.js.map +1 -0
  387. package/dist/src/lib/user-properties/generated-properties-schema.d.ts +159 -0
  388. package/dist/src/lib/user-properties/generated-properties-schema.js +471 -0
  389. package/dist/src/lib/user-properties/generated-properties-schema.js.map +1 -0
  390. package/dist/src/lib/user-properties/user-properties-codegen.d.ts +55 -0
  391. package/dist/src/lib/user-properties/user-properties-codegen.js +129 -0
  392. package/dist/src/lib/user-properties/user-properties-codegen.js.map +1 -0
  393. package/dist/src/lib/user-walk.d.ts +31 -0
  394. package/dist/src/lib/user-walk.js +102 -0
  395. package/dist/src/lib/user-walk.js.map +1 -0
  396. package/dist/src/lib/worker-perf-format.d.ts +22 -0
  397. package/dist/src/lib/worker-perf-format.js +27 -0
  398. package/dist/src/lib/worker-perf-format.js.map +1 -0
  399. package/dist/src/types/index.d.ts +13 -34
  400. package/package.json +5 -3
@@ -0,0 +1,227 @@
1
+ /**
2
+ * GENERATED FILE — DO NOT EDIT BY HAND.
3
+ *
4
+ * Vendored from the canonical server module
5
+ * `src/function-runs/db3-bridge.ts` — the SAME interpretation the server
6
+ * applies to a function's schemas. The CLI cannot import server `src/`
7
+ * at runtime, so the CLI imports this committed copy instead.
8
+ *
9
+ * Regenerate with:
10
+ * node cli/scripts/gen-schema-descriptor.mjs (runs at CLI prebuild)
11
+ *
12
+ * A CI freshness guard
13
+ * (`cli/scripts/gen-schema-descriptor.mjs --check`, also asserted by
14
+ * `cli/tests/unit/schema-codegen-descriptor-drift-guard.test.ts`) fails if
15
+ * this committed copy does not match the source — see issue #1442 / #998.
16
+ */
17
+ /**
18
+ * The db3 bridge: a db3 type's model as a JSON Schema a function, prompt or
19
+ * agent schema can `ref`.
20
+ *
21
+ * A model has two projections:
22
+ *
23
+ * - **declared**: the fields the model declares, in declaration order, with
24
+ * the storage keys stripped (`FIELD_KEYS` rows with `storage: true`), and
25
+ * `additionalProperties: false`. A field is required when it says
26
+ * `required = true` and is neither auto-assigned, stamped nor defaulted,
27
+ * because the room fills those itself.
28
+ * - **row**: the declared fields plus `id` and the type's stamps (each
29
+ * timestamp in the model's scope, a required `number` unless the model
30
+ * declares it; each auto-populated field, an optional `string`), open.
31
+ * Auto-assigned and stamped fields are required: the room writes them on
32
+ * every row. A defaulted field is optional, as in declared: the room
33
+ * applies a default only when a row is created and no read fills one, so
34
+ * a stored row may lack it.
35
+ *
36
+ * Every field maps as `primitive.d.ts`'s `Db3` namespace renders it: `string`,
37
+ * `id` and `date` to strings, `stringset` to an array of strings, `vector` to
38
+ * its stored base64 string, `enum` to `enum`. Each projection's root carries its
39
+ * marker in `$comment` (`db3:<type>#/$defs/<model>/<projection>`), which the
40
+ * validator names in its messages and the generated hovers render.
41
+ *
42
+ * Field tables are read through the shared field grammar's model context, so
43
+ * a model the db3 loader reads is one the bridge reads identically. A key the
44
+ * model context does not know is ignored, as the room's reader ignores it.
45
+ *
46
+ * Pure, importing only the field grammar, so the CLI vendors it
47
+ * (`cli/scripts/gen-schema-descriptor.mjs`) and the server and the CLI bridge
48
+ * a type to the same bytes.
49
+ */
50
+ import { fieldProblemMessage, readFieldTable } from "./generated-field-grammar.js";
51
+ /** The two projections of a db3 model, in the order messages list them. */
52
+ export const DB3_PROJECTIONS = Object.freeze(["row", "declared"]);
53
+ const isTable = (value) => value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date);
54
+ /** Set `key` as an own data property, so a field named `__proto__` stays a field. */
55
+ function setOwn(target, key, value) {
56
+ Object.defineProperty(target, key, { value, enumerable: true, writable: true, configurable: true });
57
+ }
58
+ function pointerSegment(segment) {
59
+ return segment.replace(/~/g, "~0").replace(/\//g, "~1");
60
+ }
61
+ /**
62
+ * The marker a projection carries: the projection's explicit ref,
63
+ * `db3:<type>#/$defs/<model>/<projection>`, the model pointer-escaped.
64
+ */
65
+ export function db3ProjectionMarker(type, model, projection) {
66
+ return `db3:${type}#/$defs/${pointerSegment(model)}/${projection}`;
67
+ }
68
+ /** A `$comment` read as a projection marker, or null when it is not one. */
69
+ export function parseDb3ProjectionMarker(comment) {
70
+ if (typeof comment !== "string" || !comment.startsWith("db3:"))
71
+ return null;
72
+ const hash = comment.indexOf("#/$defs/");
73
+ if (hash <= "db3:".length)
74
+ return null;
75
+ const rest = comment.slice(hash + "#/$defs/".length);
76
+ const slash = rest.lastIndexOf("/");
77
+ if (slash <= 0)
78
+ return null;
79
+ const projection = rest.slice(slash + 1);
80
+ if (projection !== "row" && projection !== "declared")
81
+ return null;
82
+ const model = rest
83
+ .slice(0, slash)
84
+ .split("/")
85
+ .map((segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~"))
86
+ .join("/");
87
+ return { type: comment.slice("db3:".length, hash), model, projection };
88
+ }
89
+ /** The models a type declares, in declaration order; empty when its `models` is not a table. */
90
+ export function db3ModelNames(type) {
91
+ return isTable(type.models) ? Object.keys(type.models) : [];
92
+ }
93
+ /** The type's timestamp names, and whether `model` is in their scope. */
94
+ function timestampsFor(type, model) {
95
+ const stamps = isTable(type.timestamps) ? type.timestamps : {};
96
+ const names = [stamps.create, stamps.update].filter((name) => typeof name === "string" && name !== "");
97
+ const scope = Array.isArray(stamps.models) ? stamps.models.filter((name) => typeof name === "string") : null;
98
+ return { names: [...new Set(names)], inScope: scope === null || scope.includes(model) };
99
+ }
100
+ const positiveInteger = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0;
101
+ /** One declared field as JSON Schema. */
102
+ function fieldSchema(decl) {
103
+ const schema = {};
104
+ switch (decl.type) {
105
+ case "number":
106
+ schema.type = "number";
107
+ break;
108
+ case "boolean":
109
+ schema.type = "boolean";
110
+ break;
111
+ case "stringset": {
112
+ const items = { type: "string" };
113
+ if (positiveInteger(decl.maxLength))
114
+ items.maxLength = decl.maxLength;
115
+ schema.type = "array";
116
+ schema.items = items;
117
+ if (positiveInteger(decl.maxCount))
118
+ schema.maxItems = decl.maxCount;
119
+ break;
120
+ }
121
+ case "vector":
122
+ schema.type = "string";
123
+ schema.description = `A vector of ${decl.dims} × ${decl.element}, as its stored base64`;
124
+ break;
125
+ default:
126
+ schema.type = "string";
127
+ if (decl.enum)
128
+ schema.enum = [...decl.enum];
129
+ if (positiveInteger(decl.maxLength))
130
+ schema.maxLength = decl.maxLength;
131
+ }
132
+ if (decl.default !== undefined)
133
+ schema.default = decl.default;
134
+ return schema;
135
+ }
136
+ /**
137
+ * One projection of one model of `type`. Refuses a model the type does not
138
+ * declare (listing the ones it does), a model that is not a table, and a
139
+ * field the field grammar refuses (naming the field and the grammar's reason).
140
+ *
141
+ * @example
142
+ * db3ModelProjection({ name: "workspace", models: { tasks: { fields: { title: { type: "string", required: true } } } } }, "tasks", "declared");
143
+ * // → { ok: true, schema: { type: "object", properties: { title: { type: "string" } }, required: ["title"],
144
+ * // additionalProperties: false, $comment: "db3:workspace#/$defs/tasks/declared" } }
145
+ */
146
+ export function db3ModelProjection(type, model, projection) {
147
+ const models = db3ModelNames(type);
148
+ if (!models.includes(model)) {
149
+ const declared = models.length > 0 ? `it declares ${models.join(", ")}` : "it declares no models";
150
+ return { ok: false, reason: `db3 type ${type.name} declares no model ${model} (${declared})` };
151
+ }
152
+ const table = type.models[model];
153
+ if (!isTable(table))
154
+ return { ok: false, reason: `model ${model} is not a table` };
155
+ const fields = table.fields === undefined ? {} : table.fields;
156
+ if (!isTable(fields))
157
+ return { ok: false, reason: `the fields of model ${model} are not a table` };
158
+ const stamps = timestampsFor(type, model);
159
+ const stampedInScope = new Set(stamps.inScope ? stamps.names : []);
160
+ const properties = {};
161
+ const required = [];
162
+ const row = projection === "row";
163
+ if (row && !Object.prototype.hasOwnProperty.call(fields, "id")) {
164
+ setOwn(properties, "id", { type: "string" });
165
+ required.push("id");
166
+ }
167
+ for (const [name, raw] of Object.entries(fields)) {
168
+ const { decl, problems } = readFieldTable(raw, "model");
169
+ const problem = problems.find((found) => found.code !== "unknown-key");
170
+ if (!decl || problem)
171
+ return { ok: false, reason: `field ${name}: ${problem ? fieldProblemMessage(problem) : "it declares no type"}` };
172
+ setOwn(properties, name, fieldSchema(decl));
173
+ // The room writes an auto-assigned or stamped field on every row. A
174
+ // default it applies only on create, and no read fills one, so a stored
175
+ // row may lack a defaulted field: optional in both projections (#5894).
176
+ const written = decl.autoAssign === true || decl.autoStamp !== undefined || stampedInScope.has(name);
177
+ const defaulted = decl.default !== undefined;
178
+ if (row ? written || name === "id" || (decl.required === true && !defaulted) : decl.required === true && !written && !defaulted)
179
+ required.push(name);
180
+ }
181
+ if (row) {
182
+ const autoPopulated = isTable(type.autoPopulatedFields) ? Object.keys(type.autoPopulatedFields) : [];
183
+ for (const name of [...new Set([...stamps.names, ...autoPopulated])].sort()) {
184
+ if (Object.prototype.hasOwnProperty.call(properties, name))
185
+ continue;
186
+ if (stampedInScope.has(name)) {
187
+ setOwn(properties, name, { type: "number" });
188
+ required.push(name);
189
+ }
190
+ else if (autoPopulated.includes(name)) {
191
+ setOwn(properties, name, { type: "string" });
192
+ }
193
+ }
194
+ }
195
+ const schema = { type: "object", properties };
196
+ if (required.length > 0)
197
+ schema.required = required;
198
+ if (!row)
199
+ schema.additionalProperties = false;
200
+ schema.$comment = db3ProjectionMarker(type.name, model, projection);
201
+ // Plain JSON, as a stored schema is: a TOML date default becomes its ISO string.
202
+ return { ok: true, schema: JSON.parse(JSON.stringify(schema)) };
203
+ }
204
+ /**
205
+ * Both projections of every model of `type`, as a family index's db3 slot
206
+ * holds them. A model that cannot be bridged keeps its reason, so a ref to it
207
+ * is refused naming it; a type whose `models` is not a table has none.
208
+ */
209
+ export function db3TypeProjections(type) {
210
+ if (!isTable(type.models))
211
+ return { models: [], defs: {}, error: "it declares no models" };
212
+ const models = db3ModelNames(type);
213
+ const defs = {};
214
+ const modelErrors = {};
215
+ for (const model of models) {
216
+ const row = db3ModelProjection(type, model, "row");
217
+ const declared = db3ModelProjection(type, model, "declared");
218
+ if ("reason" in row || "reason" in declared) {
219
+ setOwn(modelErrors, model, "reason" in row ? row.reason : declared.reason);
220
+ continue;
221
+ }
222
+ setOwn(defs, `${model}/row`, row.schema);
223
+ setOwn(defs, `${model}/declared`, declared.schema);
224
+ }
225
+ return { models, defs, ...(Object.keys(modelErrors).length > 0 ? { modelErrors } : {}) };
226
+ }
227
+ //# sourceMappingURL=generated-db3-bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-db3-bridge.js","sourceRoot":"","sources":["../../../../src/lib/schema-codegen/generated-db3-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAkB,MAAM,8BAA8B,CAAC;AAEnG,2EAA2E;AAC3E,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,UAAU,CAAU,CAAC,CAAC;AAuC3E,MAAM,OAAO,GAAG,CAAC,KAAc,EAAoC,EAAE,CACnE,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC,CAAC;AAEnG,qFAAqF;AACrF,SAAS,MAAM,CAAC,MAA+B,EAAE,GAAW,EAAE,KAAc;IAC1E,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;AACtG,CAAC;AAED,SAAS,cAAc,CAAC,OAAe;IACrC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAC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AM,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC3F,CAAC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * GENERATED FILE — DO NOT EDIT BY HAND.
3
+ *
4
+ * Vendored from the canonical server module
5
+ * `src/function-runs/db3-query-capabilities.ts` — the SAME interpretation the server
6
+ * applies to a function's schemas. The CLI cannot import server `src/`
7
+ * at runtime, so the CLI imports this committed copy instead.
8
+ *
9
+ * Regenerate with:
10
+ * node cli/scripts/gen-schema-descriptor.mjs (runs at CLI prebuild)
11
+ *
12
+ * A CI freshness guard
13
+ * (`cli/scripts/gen-schema-descriptor.mjs --check`, also asserted by
14
+ * `cli/tests/unit/schema-codegen-descriptor-drift-guard.test.ts`) fails if
15
+ * this committed copy does not match the source — see issue #1442 / #998.
16
+ */
17
+ /**
18
+ * The db3 query capability manifest: which filter operators, and which
19
+ * values, each declared db3 field kind takes.
20
+ *
21
+ * It states what `JsonQueryTranslator`'s schema-aware mode accepts under the
22
+ * room's options (`ROOM_TRANSLATOR_OPTIONS`: set arrays read from `_data`, so
23
+ * `$all` and `$size` are answered on every kind). The room itself builds its
24
+ * translator with no schema and never refuses a filter by kind; the generated
25
+ * `Db3.<Model>Filter` types read this table, so they are narrower than the
26
+ * room on purpose and constrain declared fields only.
27
+ *
28
+ * Two places the types differ from the translator, both recorded here:
29
+ *
30
+ * - a `date` field's string is not parsed at the type level (wider: any
31
+ * string typechecks, the translator refuses one `Date.parse` cannot read);
32
+ * - a `stringset` or `vector` field's `"scalar"` value is a string, number,
33
+ * boolean or `Date` (narrower: the translator passes an object under
34
+ * `$eq`, which SQLite cannot bind).
35
+ *
36
+ * `tests/unit/workflows/db3-query-capabilities-5546.test.ts` derives the
37
+ * table from the real translator and fails when either side moves.
38
+ *
39
+ * Pure, importing nothing, so the CLI vendors it
40
+ * (`cli/scripts/gen-schema-descriptor.mjs`).
41
+ */
42
+ /** The db3 field kinds, in the field grammar's order (`FIELD_TYPES`). */
43
+ export declare const DB3_FIELD_KINDS: readonly ["string", "number", "boolean", "date", "id", "stringset", "vector"];
44
+ /** A db3 field kind: a field's TOML `type`. */
45
+ export type Db3FieldKind = (typeof DB3_FIELD_KINDS)[number];
46
+ /**
47
+ * The value an operator takes:
48
+ *
49
+ * - `field`: one value of the field's kind (`DB3_QUERY_VALUE_KINDS`), or `null`;
50
+ * - `field-list`: an array of those, `null` members included;
51
+ * - `boolean`, `string`: a value of that type;
52
+ * - `string-list`: an array of strings;
53
+ * - `size`: a number, or `{ $eq, $ne, $gt, $gte, $lt, $lte }` with numbers.
54
+ */
55
+ export type Db3QueryOperatorValue = "field" | "field-list" | "boolean" | "string" | "string-list" | "size";
56
+ /** One field operator the translator knows. */
57
+ export interface Db3QueryOperator {
58
+ operator: string;
59
+ /** The kinds the operator applies to: every kind, or the listed ones. */
60
+ kinds: "all" | readonly Db3FieldKind[];
61
+ value: Db3QueryOperatorValue;
62
+ /** `substring`: at most one operator of the group per field. */
63
+ exclusive?: "substring";
64
+ }
65
+ /** Every field operator, in the order the docs table lists them. */
66
+ export declare const DB3_QUERY_OPERATORS: readonly Db3QueryOperator[];
67
+ /**
68
+ * The value of a field's kind under equality, as a member of `$in`/`$nin` and
69
+ * under a range operator: a string, a number, a boolean, a date (a `Date` or a
70
+ * string), or any scalar. `null` is accepted for every kind.
71
+ */
72
+ export type Db3QueryValueKind = "string" | "number" | "boolean" | "date" | "scalar";
73
+ /** Each kind's value. */
74
+ export declare const DB3_QUERY_VALUE_KINDS: Readonly<Record<Db3FieldKind, Db3QueryValueKind>>;
75
+ /** What one kind takes: its value and its operators, in `DB3_QUERY_OPERATORS` order. */
76
+ export interface Db3KindCapabilities {
77
+ value: Db3QueryValueKind;
78
+ operators: readonly string[];
79
+ }
80
+ /** The per-kind view of the two tables above. */
81
+ export declare const DB3_QUERY_CAPABILITIES: Readonly<Record<Db3FieldKind, Db3KindCapabilities>>;
82
+ /** The logical operators: arrays of filters, at any depth. */
83
+ export declare const DB3_QUERY_LOGICAL_OPERATORS: readonly ["$and", "$or"];
84
+ /** The operators a filter takes at its top level only: text search and nearest neighbours. */
85
+ export declare const DB3_QUERY_TOP_LEVEL_OPERATORS: readonly ["$search", "$near"];
@@ -0,0 +1,86 @@
1
+ /**
2
+ * GENERATED FILE — DO NOT EDIT BY HAND.
3
+ *
4
+ * Vendored from the canonical server module
5
+ * `src/function-runs/db3-query-capabilities.ts` — the SAME interpretation the server
6
+ * applies to a function's schemas. The CLI cannot import server `src/`
7
+ * at runtime, so the CLI imports this committed copy instead.
8
+ *
9
+ * Regenerate with:
10
+ * node cli/scripts/gen-schema-descriptor.mjs (runs at CLI prebuild)
11
+ *
12
+ * A CI freshness guard
13
+ * (`cli/scripts/gen-schema-descriptor.mjs --check`, also asserted by
14
+ * `cli/tests/unit/schema-codegen-descriptor-drift-guard.test.ts`) fails if
15
+ * this committed copy does not match the source — see issue #1442 / #998.
16
+ */
17
+ /**
18
+ * The db3 query capability manifest: which filter operators, and which
19
+ * values, each declared db3 field kind takes.
20
+ *
21
+ * It states what `JsonQueryTranslator`'s schema-aware mode accepts under the
22
+ * room's options (`ROOM_TRANSLATOR_OPTIONS`: set arrays read from `_data`, so
23
+ * `$all` and `$size` are answered on every kind). The room itself builds its
24
+ * translator with no schema and never refuses a filter by kind; the generated
25
+ * `Db3.<Model>Filter` types read this table, so they are narrower than the
26
+ * room on purpose and constrain declared fields only.
27
+ *
28
+ * Two places the types differ from the translator, both recorded here:
29
+ *
30
+ * - a `date` field's string is not parsed at the type level (wider: any
31
+ * string typechecks, the translator refuses one `Date.parse` cannot read);
32
+ * - a `stringset` or `vector` field's `"scalar"` value is a string, number,
33
+ * boolean or `Date` (narrower: the translator passes an object under
34
+ * `$eq`, which SQLite cannot bind).
35
+ *
36
+ * `tests/unit/workflows/db3-query-capabilities-5546.test.ts` derives the
37
+ * table from the real translator and fails when either side moves.
38
+ *
39
+ * Pure, importing nothing, so the CLI vendors it
40
+ * (`cli/scripts/gen-schema-descriptor.mjs`).
41
+ */
42
+ /** The db3 field kinds, in the field grammar's order (`FIELD_TYPES`). */
43
+ export const DB3_FIELD_KINDS = Object.freeze(["string", "number", "boolean", "date", "id", "stringset", "vector"]);
44
+ const RANGE_KINDS = Object.freeze(["id", "string", "number", "date"]);
45
+ const SUBSTRING_KINDS = Object.freeze(["string", "stringset"]);
46
+ /** Every field operator, in the order the docs table lists them. */
47
+ export const DB3_QUERY_OPERATORS = Object.freeze([
48
+ { operator: "$eq", kinds: "all", value: "field" },
49
+ { operator: "$ne", kinds: "all", value: "field" },
50
+ { operator: "$in", kinds: "all", value: "field-list" },
51
+ { operator: "$nin", kinds: "all", value: "field-list" },
52
+ { operator: "$exists", kinds: "all", value: "boolean" },
53
+ { operator: "$gt", kinds: RANGE_KINDS, value: "field" },
54
+ { operator: "$gte", kinds: RANGE_KINDS, value: "field" },
55
+ { operator: "$lt", kinds: RANGE_KINDS, value: "field" },
56
+ { operator: "$lte", kinds: RANGE_KINDS, value: "field" },
57
+ { operator: "$startsWith", kinds: SUBSTRING_KINDS, value: "string", exclusive: "substring" },
58
+ { operator: "$endsWith", kinds: SUBSTRING_KINDS, value: "string", exclusive: "substring" },
59
+ { operator: "$containsText", kinds: SUBSTRING_KINDS, value: "string", exclusive: "substring" },
60
+ { operator: "$contains", kinds: ["stringset"], value: "string" },
61
+ { operator: "$all", kinds: "all", value: "string-list" },
62
+ { operator: "$size", kinds: "all", value: "size" },
63
+ ]);
64
+ /** Each kind's value. */
65
+ export const DB3_QUERY_VALUE_KINDS = Object.freeze({
66
+ string: "string",
67
+ number: "number",
68
+ boolean: "boolean",
69
+ date: "date",
70
+ id: "string",
71
+ stringset: "scalar",
72
+ vector: "scalar",
73
+ });
74
+ /** The per-kind view of the two tables above. */
75
+ export const DB3_QUERY_CAPABILITIES = Object.freeze(Object.fromEntries(DB3_FIELD_KINDS.map((kind) => [
76
+ kind,
77
+ Object.freeze({
78
+ value: DB3_QUERY_VALUE_KINDS[kind],
79
+ operators: Object.freeze(DB3_QUERY_OPERATORS.filter((row) => row.kinds === "all" || row.kinds.includes(kind)).map((row) => row.operator)),
80
+ }),
81
+ ])));
82
+ /** The logical operators: arrays of filters, at any depth. */
83
+ export const DB3_QUERY_LOGICAL_OPERATORS = Object.freeze(["$and", "$or"]);
84
+ /** The operators a filter takes at its top level only: text search and nearest neighbours. */
85
+ export const DB3_QUERY_TOP_LEVEL_OPERATORS = Object.freeze(["$search", "$near"]);
86
+ //# sourceMappingURL=generated-db3-query-capabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-db3-query-capabilities.js","sourceRoot":"","sources":["../../../../src/lib/schema-codegen/generated-db3-query-capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,yEAAyE;AACzE,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,CAAU,CAAC,CAAC;AA0B5H,MAAM,WAAW,GAA4B,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC,CAAC;AACxG,MAAM,eAAe,GAA4B,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,WAAW,CAAU,CAAC,CAAC;AAEjG,oEAAoE;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAAgC,MAAM,CAAC,MAAM,CAAC;IAC5E,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE;IACjD,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,KAA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AE;CAC1C,CAAC,CAAC;AASZ,yBAAyB;AACzB,MAAM,CAAC,MAAM,qBAAqB,GAAsD,MAAM,CAAC,MAAM,CAAC;IACpG,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,QAAQ;IACZ,SAAS,EAAE,QAAQ;IACnB,MAAM,EAAE,QAAQ;CACjB,CAAC,CAAC;AAQH,iDAAiD;AACjD,MAAM,CAAC,MAAM,sBAAsB,GAAwD,MAAM,CAAC,MAAM,CACtG,MAAM,CAAC,WAAW,CAChB,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;IAC5B,IAAI;IACJ,MAAM,CAAC,MAAM,CAAC;QACZ,KAAK,EAAE,qBAAqB,CAAC,IAAI,CAAC;QAClC,SAAS,EAAE,MAAM,CAAC,MAAM,CACtB,mBAAmB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,KAAK,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAChH;KACF,CAAC;CACH,CAAC,CAC0C,CAC/C,CAAC;AAEF,8DAA8D;AAC9D,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,KAAK,CAAU,CAAC,CAAC;AAEnF,8FAA8F;AAC9F,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,OAAO,CAAU,CAAC,CAAC"}
@@ -0,0 +1,218 @@
1
+ /**
2
+ * GENERATED FILE — DO NOT EDIT BY HAND.
3
+ *
4
+ * Vendored from the canonical server module
5
+ * `src/function-runs/field-grammar.ts` — the SAME interpretation the server
6
+ * applies to a function's schemas. The CLI cannot import server `src/`
7
+ * at runtime, so the CLI imports this committed copy instead.
8
+ *
9
+ * Regenerate with:
10
+ * node cli/scripts/gen-schema-descriptor.mjs (runs at CLI prebuild)
11
+ *
12
+ * A CI freshness guard
13
+ * (`cli/scripts/gen-schema-descriptor.mjs --check`, also asserted by
14
+ * `cli/tests/unit/schema-codegen-descriptor-drift-guard.test.ts`) fails if
15
+ * this committed copy does not match the source — see issue #1442 / #998.
16
+ */
17
+ /**
18
+ * The db3 field grammar: the snake_case keys of a `[…fields.<name>]` table,
19
+ * and how one table is read in each context that declares fields.
20
+ *
21
+ * A db3 model (`models.toml`, a db3 type, a stored schema),
22
+ * `user-properties.toml` and a function, prompt or agent schema written as a
23
+ * field table (the `io` context) spell a field the same way, so one table
24
+ * holds the type list, each context's types and keys, and one row per key: the contexts
25
+ * it is allowed or refused in, its kind, the types it applies to, and whether
26
+ * it describes storage rather than the value. {@link readFieldTable} reads one
27
+ * table against it and answers the declaration plus structured problems;
28
+ * {@link fieldProblemMessage} words a problem. Each caller keeps its own
29
+ * voice and precedence on top.
30
+ *
31
+ * A rule runs in every context ("always") or only where the context checks
32
+ * values ("checked"). The model context takes values as written, as the db3
33
+ * loader always has: a flag counts only when it is `true`, and a length, a
34
+ * count or a default is copied as declared. `enforce_enum` is the exception:
35
+ * it takes `true` or `false` in every context, so a malformed value never
36
+ * reads as "off". The property and io contexts check every value.
37
+ *
38
+ * Pure and dependency-free, so the CLI and js-bao vendor it byte for byte
39
+ * (`cli/scripts/gen-schema-descriptor.mjs`). It avoids library calls newer
40
+ * than ES2020 (js-bao's `lib`).
41
+ */
42
+ /** A field's value type: the db3 seven, and the JSON value types only the io context takes. */
43
+ export type FieldType = "string" | "number" | "boolean" | "date" | "id" | "stringset" | "vector" | "integer" | "object" | "array";
44
+ /** Every field type, in the order the db3 loader has always listed them. */
45
+ export declare const FIELD_TYPES: readonly FieldType[];
46
+ /** Where a field table is read: a db3 model, a user property, or a function, prompt or agent schema. */
47
+ export type FieldContext = "model" | "property" | "io";
48
+ /** How one context reads a field table. */
49
+ export interface FieldContextSpec {
50
+ /** Which rule tier runs: `as-written` runs the always tier only, `checked` both. */
51
+ values: "as-written" | "checked";
52
+ /** The types a field may declare. */
53
+ types: readonly FieldType[];
54
+ /** The keys a field may carry, in the order this context has always listed them. */
55
+ keys: readonly string[];
56
+ /** Types this context refuses outright, with the reason. */
57
+ refusedTypes?: Readonly<Record<string, string>>;
58
+ }
59
+ /** The three contexts. */
60
+ export declare const FIELD_CONTEXTS: Readonly<Record<FieldContext, FieldContextSpec>>;
61
+ /** The values `auto_stamp` takes: when a date field is stamped. */
62
+ export declare const FIELD_AUTO_STAMP_VALUES: readonly ["create", "update", "both"];
63
+ /** The values `client` takes: who reaches a field from a client session. */
64
+ export declare const FIELD_CLIENT_VALUES: readonly ["none", "self", "self-write", "members", "self-write-members"];
65
+ /** What a key's value is. */
66
+ export type FieldKeyKind = "type" | "flag" | "literal" | "positive-integer" | "typed-default" | "string-list" | "as-declared" | "number" | "string" | "table" | "items";
67
+ /** A key in one context: allowed, unknown (named as an unknown key), or refused with a reason. */
68
+ export type FieldKeyContext = "allowed" | "unknown" | {
69
+ refused: string;
70
+ };
71
+ /** One key of the field grammar. */
72
+ export interface FieldKeyRow {
73
+ /** The key as written in TOML. */
74
+ key: string;
75
+ /** The name the key is recorded under in a {@link FieldDecl}. */
76
+ prop: keyof FieldDecl;
77
+ /** What the key's value is. */
78
+ kind: FieldKeyKind;
79
+ /** Whether the key describes how a value is stored (indexed, keyed, minted, stamped, encoded) rather than what it holds. */
80
+ storage: boolean;
81
+ /** The key in each context. */
82
+ contexts: Readonly<Record<FieldContext, FieldKeyContext>>;
83
+ /** The types the key applies to; absent for every type. */
84
+ types?: readonly FieldType[];
85
+ /** The tier at which a key on another type is refused; absent when it never is here. */
86
+ typesTier?: "always" | "checked";
87
+ /** A literal key's values, and a note its message adds. */
88
+ literals?: readonly string[];
89
+ note?: string;
90
+ /** A flag that takes `true` or `false` and nothing else in every context, not only where values are checked. */
91
+ flagTier?: "always";
92
+ /** A key this one needs beside it when it is `true`. */
93
+ needs?: "enum";
94
+ }
95
+ /**
96
+ * Every key, in the db3 loader's order with `client` next, then the keys only
97
+ * an I/O table carries. The order fixes the order of {@link readFieldTable}'s
98
+ * problems.
99
+ */
100
+ export declare const FIELD_KEYS: readonly FieldKeyRow[];
101
+ /** The keys a context allows, in the order it lists them. */
102
+ export declare function fieldKeysFor(context: FieldContext): readonly string[];
103
+ /** The types a context allows, in the order it lists them. */
104
+ export declare function fieldTypesFor(context: FieldContext): readonly FieldType[];
105
+ /**
106
+ * One field as declared, camelCase. In the `as-written` context a value other
107
+ * than a flag is copied as declared, whatever its type.
108
+ */
109
+ export interface FieldDecl {
110
+ type: FieldType;
111
+ indexed?: boolean;
112
+ unique?: boolean;
113
+ required?: boolean;
114
+ autoAssign?: boolean;
115
+ autoStamp?: (typeof FIELD_AUTO_STAMP_VALUES)[number];
116
+ maxLength?: number;
117
+ maxCount?: number;
118
+ default?: unknown;
119
+ enum?: string[];
120
+ enforceEnum?: boolean;
121
+ dims?: number;
122
+ element?: string;
123
+ client?: string;
124
+ fields?: Record<string, unknown>;
125
+ open?: boolean;
126
+ items?: string;
127
+ item?: Record<string, unknown>;
128
+ nullable?: boolean;
129
+ min?: number;
130
+ max?: number;
131
+ minLength?: number;
132
+ pattern?: string;
133
+ minItems?: number;
134
+ maxItems?: number;
135
+ coerce?: boolean;
136
+ ref?: string;
137
+ description?: string;
138
+ schema?: Record<string, unknown>;
139
+ }
140
+ /** What is wrong with one field table. */
141
+ export type FieldProblem = {
142
+ code: "unknown-key";
143
+ key: string;
144
+ allowed: string[];
145
+ } | {
146
+ code: "refused-key";
147
+ key: string;
148
+ reason: string;
149
+ } | {
150
+ code: "unknown-type";
151
+ type: unknown;
152
+ allowed: FieldType[];
153
+ } | {
154
+ code: "refused-type";
155
+ type: string;
156
+ reason: string;
157
+ } | {
158
+ code: "not-for-type";
159
+ key: string;
160
+ type: FieldType;
161
+ types: FieldType[];
162
+ } | {
163
+ code: "bad-literal";
164
+ key: string;
165
+ value: unknown;
166
+ literals: string[];
167
+ note?: string;
168
+ } | {
169
+ code: "bad-boolean";
170
+ key: string;
171
+ } | {
172
+ code: "bad-positive-integer";
173
+ key: string;
174
+ } | {
175
+ code: "bad-number";
176
+ key: string;
177
+ } | {
178
+ code: "bad-string";
179
+ key: string;
180
+ } | {
181
+ code: "bad-table";
182
+ key: string;
183
+ } | {
184
+ code: "bad-items";
185
+ key: "items";
186
+ } | {
187
+ code: "enum-not-list";
188
+ key: "enum";
189
+ } | {
190
+ code: "enum-member-not-string";
191
+ key: "enum";
192
+ } | {
193
+ code: "enum-repeats";
194
+ key: "enum";
195
+ } | {
196
+ code: "enforce-without-enum";
197
+ key: "enforce_enum";
198
+ } | {
199
+ code: "bad-default";
200
+ key: "default";
201
+ reason: string;
202
+ };
203
+ /** A field table's reading: the declaration (`null` when the type is missing or refused) and every problem, in order. */
204
+ export interface FieldTableReading {
205
+ decl: FieldDecl | null;
206
+ problems: FieldProblem[];
207
+ }
208
+ /**
209
+ * Read one field table in `context`. Problems come in a fixed order: every
210
+ * key in the author's order (refused, then unknown), then the type (reading
211
+ * stops at a missing, unknown or refused type, with `decl: null`), then each
212
+ * allowed key in {@link FIELD_KEYS} order with the typed default last. A key
213
+ * whose rule fails is left out of `decl`, so it does not bound the default.
214
+ * A value that is not a table reads as an empty table.
215
+ */
216
+ export declare function readFieldTable(raw: unknown, context: FieldContext): FieldTableReading;
217
+ /** A problem in the grammar's own words. */
218
+ export declare function fieldProblemMessage(problem: FieldProblem): string;