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,37 @@
1
+ /**
2
+ * The `primitive` CLI's command tree, as the bin runs it.
3
+ *
4
+ * `cli/bin/primitive.ts` builds its tree through `registerAllCommands`, and so
5
+ * does anything that needs the whole tree without running the bin. It
6
+ * registers every group (`registerCommandGroups`, command-groups.ts), gives
7
+ * every command its row of the generated status table
8
+ * (`generated-command-status.ts`, written by `pnpm api-status --write`), and
9
+ * on a production build prunes the experimental commands. Registering a
10
+ * group in command-groups.ts, rather than in the bin, is what keeps the two
11
+ * trees the same.
12
+ */
13
+ import { applyCommandStatusTable, pruneExperimentalCommands } from "./command-status.js";
14
+ import { registerCommandGroups } from "./command-groups.js";
15
+ import { COMMAND_STATUS } from "./generated-command-status.js";
16
+ import { EXPERIMENTAL_APIS } from "./generated-build-flags.js";
17
+ /**
18
+ * Register every command group on `program` and give each command its status
19
+ * from the generated table. A production build (`experimental` false) throws
20
+ * when a registered command has no row, then prunes the experimental
21
+ * commands; a full build leaves a command with no row on its declared status.
22
+ *
23
+ * @param program The root commander `Command`.
24
+ * @param options Whether to include experimental commands.
25
+ * @returns The same `program`, with every group registered.
26
+ * @throws On a production build, when the status table has no row for a
27
+ * registered command (run `pnpm api-status --write`).
28
+ */
29
+ export function registerAllCommands(program, options = {}) {
30
+ const experimental = options.experimental ?? EXPERIMENTAL_APIS;
31
+ registerCommandGroups(program, { experimental });
32
+ applyCommandStatusTable(program, COMMAND_STATUS, { strict: !experimental });
33
+ if (!experimental)
34
+ pruneExperimentalCommands(program);
35
+ return program;
36
+ }
37
+ //# sourceMappingURL=register-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-commands.js","sourceRoot":"","sources":["../../../src/lib/register-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAa/D;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAgB,EAAE,UAAsC,EAAE;IAC5F,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,iBAAiB,CAAC;IAC/D,qBAAqB,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;IACjD,uBAAuB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,MAAM,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC;IAC5E,IAAI,CAAC,YAAY;QAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC;IACtD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Imports of the declarations `functions/primitive.d.ts` replaced (#5544,
3
+ * project `unified-schemas` phase 10).
4
+ *
5
+ * Codegen no longer writes `primitive-function-types.d.ts`,
6
+ * `primitive-prompt-types.d.ts`, `primitive-db3-types.d.ts` or
7
+ * `primitive-user-properties.d.ts`, and removes the copies an earlier push
8
+ * left. A function source still importing one would fail at its first
9
+ * typecheck with a generic "Cannot find module", or not at all under
10
+ * `--no-typecheck` (a type-only import is erased). So `buildFunctionBundle`
11
+ * refuses it by name, the way it refuses the retired SDK specifier: this
12
+ * module says which specifiers are retired, finds them in an authored source,
13
+ * and words the refusal.
14
+ *
15
+ * A specifier is retired when it is relative and its base name, with any
16
+ * `.js`, `.ts` or `.d.ts` suffix removed, is a retired declaration's stem —
17
+ * `./primitive-function-types`, `../functions/primitive-prompt-types.js`.
18
+ * `./primitive`, `primitive-functions` and a tree file that merely shares a
19
+ * prefix (`./primitive-function-types-extra.ts`) are not.
20
+ *
21
+ * The scan is anchored at the start of a line, as the SDK one is, so prose
22
+ * naming a retired file — a comment, a doc line, a string — refuses nothing.
23
+ * `import("…")` is the one form read mid-line: a type position spells it
24
+ * there (`type T = import("./x").Y`).
25
+ */
26
+ import { type RetiredDeclaration } from "./primitive-declaration-names.js";
27
+ /** One retired import an authored source makes. */
28
+ export interface RetiredImport {
29
+ /** The specifier as written. */
30
+ specifier: string;
31
+ retired: RetiredDeclaration;
32
+ /** The names its import or export clause lists, in order; empty when it lists none. */
33
+ names: string[];
34
+ }
35
+ /** The retired declaration a specifier names, or null; see the module note. */
36
+ export declare function retiredDeclarationStem(specifier: string): RetiredDeclaration | null;
37
+ /** Every module specifier a source names, with the names its clause lists, in source order. */
38
+ export declare function scanImportSpecifiers(source: string): Array<{
39
+ specifier: string;
40
+ names: string[];
41
+ index: number;
42
+ typeOnly: boolean;
43
+ }>;
44
+ /** Every retired import a source makes, in source order. */
45
+ export declare function scanRetiredImports(source: string): RetiredImport[];
46
+ /**
47
+ * The refusal for one retired import of `file` (tree-relative), in the
48
+ * function `functionKey`'s build: the replacement specifier, the namespace and
49
+ * an example name — the name the import listed, or one the namespace holds. A
50
+ * top-level `Primitive*` name keeps its spelling in `primitive.d.ts`, so only
51
+ * the specifier changes.
52
+ */
53
+ export declare function retiredImportRefusal(functionKey: string, file: string, found: RetiredImport): string;
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Imports of the declarations `functions/primitive.d.ts` replaced (#5544,
3
+ * project `unified-schemas` phase 10).
4
+ *
5
+ * Codegen no longer writes `primitive-function-types.d.ts`,
6
+ * `primitive-prompt-types.d.ts`, `primitive-db3-types.d.ts` or
7
+ * `primitive-user-properties.d.ts`, and removes the copies an earlier push
8
+ * left. A function source still importing one would fail at its first
9
+ * typecheck with a generic "Cannot find module", or not at all under
10
+ * `--no-typecheck` (a type-only import is erased). So `buildFunctionBundle`
11
+ * refuses it by name, the way it refuses the retired SDK specifier: this
12
+ * module says which specifiers are retired, finds them in an authored source,
13
+ * and words the refusal.
14
+ *
15
+ * A specifier is retired when it is relative and its base name, with any
16
+ * `.js`, `.ts` or `.d.ts` suffix removed, is a retired declaration's stem —
17
+ * `./primitive-function-types`, `../functions/primitive-prompt-types.js`.
18
+ * `./primitive`, `primitive-functions` and a tree file that merely shares a
19
+ * prefix (`./primitive-function-types-extra.ts`) are not.
20
+ *
21
+ * The scan is anchored at the start of a line, as the SDK one is, so prose
22
+ * naming a retired file — a comment, a doc line, a string — refuses nothing.
23
+ * `import("…")` is the one form read mid-line: a type position spells it
24
+ * there (`type T = import("./x").Y`).
25
+ */
26
+ import { basename } from "path";
27
+ import { workflowTypeBaseName } from "./schema-codegen/naming.js";
28
+ import { PRIMITIVE_DECLARATION_SPECIFIER, RETIRED_DECLARATIONS, } from "./primitive-declaration-names.js";
29
+ /** The retired declaration a specifier names, or null; see the module note. */
30
+ export function retiredDeclarationStem(specifier) {
31
+ if (!specifier.startsWith("./") && !specifier.startsWith("../"))
32
+ return null;
33
+ const stem = basename(specifier).replace(/\.d\.ts$|\.ts$|\.js$/, "");
34
+ return RETIRED_DECLARATIONS.find((retired) => retired.file === `${stem}.d.ts`) ?? null;
35
+ }
36
+ /** The names of an import or export clause (`{ A, type B as C }` → `A`, `B`). */
37
+ function clauseNames(clause) {
38
+ const braces = /\{([^}]*)\}/.exec(clause);
39
+ if (!braces)
40
+ return [];
41
+ return braces[1]
42
+ .split(",")
43
+ .map((part) => part.trim().replace(/^type\s+/, "").split(/\s+as\s+/)[0].trim())
44
+ .filter((name) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name));
45
+ }
46
+ /**
47
+ * The import and export forms that name a module, each anchored at the start
48
+ * of a line: a clause and its `from` (on one line or ending a multi-line
49
+ * clause), a bare side-effect import, and a triple-slash reference.
50
+ */
51
+ const FROM_FORM = /^[ \t]*(?:import|export)\b([^;'"]*?)\bfrom[ \t]*(['"])([^'"\n]+)\2/gm;
52
+ const BARE_FORM = /^[ \t]*import[ \t]*(['"])([^'"\n]+)\1/gm;
53
+ const REFERENCE_FORM = /^[ \t]*\/\/\/[ \t]*<reference[ \t]+path[ \t]*=[ \t]*(['"])([^'"\n]+)\1/gm;
54
+ const DYNAMIC_FORM = /\bimport[ \t]*\([ \t]*(['"])([^'"\n]+)\1[ \t]*\)/g;
55
+ /** Whether the line holding `index` is a comment line (`//`, `*`, `/*`). */
56
+ function onCommentLine(source, index) {
57
+ const start = source.lastIndexOf("\n", index - 1) + 1;
58
+ return /^[ \t]*(\/\/|\*|\/\*)/.test(source.slice(start, index + 1));
59
+ }
60
+ /** Every module specifier a source names, with the names its clause lists, in source order. */
61
+ export function scanImportSpecifiers(source) {
62
+ const found = [];
63
+ // A clause holds no `;` and no quote, so a `from` past the end of a
64
+ // statement is never read as this one's.
65
+ for (const match of source.matchAll(FROM_FORM)) {
66
+ found.push({ specifier: match[3], names: clauseNames(match[1]), index: match.index, typeOnly: /^\s*type\b/.test(match[1]) });
67
+ }
68
+ for (const match of source.matchAll(BARE_FORM))
69
+ found.push({ specifier: match[2], names: [], index: match.index, typeOnly: false });
70
+ for (const match of source.matchAll(REFERENCE_FORM))
71
+ found.push({ specifier: match[2], names: [], index: match.index, typeOnly: true });
72
+ for (const match of source.matchAll(DYNAMIC_FORM)) {
73
+ if (onCommentLine(source, match.index))
74
+ continue;
75
+ found.push({ specifier: match[2], names: [], index: match.index, typeOnly: false });
76
+ }
77
+ return found.sort((a, b) => a.index - b.index);
78
+ }
79
+ /** Every retired import a source makes, in source order. */
80
+ export function scanRetiredImports(source) {
81
+ const found = [];
82
+ for (const { specifier, names } of scanImportSpecifiers(source)) {
83
+ const retired = retiredDeclarationStem(specifier);
84
+ if (retired)
85
+ found.push({ specifier, retired, names });
86
+ }
87
+ return found;
88
+ }
89
+ /** A name of the namespace to give as the example when the import names none. */
90
+ function fallbackExample(namespace, functionKey) {
91
+ switch (namespace) {
92
+ case "Functions":
93
+ return `${workflowTypeBaseName(functionKey)}Input`;
94
+ case "Prompts":
95
+ return "<Key>PromptOutput";
96
+ case "Db3":
97
+ return "<Model>";
98
+ case "UserProperties":
99
+ return "UserProperties";
100
+ }
101
+ }
102
+ /**
103
+ * The refusal for one retired import of `file` (tree-relative), in the
104
+ * function `functionKey`'s build: the replacement specifier, the namespace and
105
+ * an example name — the name the import listed, or one the namespace holds. A
106
+ * top-level `Primitive*` name keeps its spelling in `primitive.d.ts`, so only
107
+ * the specifier changes.
108
+ */
109
+ export function retiredImportRefusal(functionKey, file, found) {
110
+ const head = `function '${functionKey}': ${file} imports "${found.specifier}", which codegen no longer writes.`;
111
+ const first = found.names[0];
112
+ if (first && /^Primitive/.test(first)) {
113
+ return `${head} Import type { ${first} } from "${PRIMITIVE_DECLARATION_SPECIFIER}": the name is unchanged.`;
114
+ }
115
+ const namespace = found.retired.namespace;
116
+ const example = first ?? fallbackExample(namespace, functionKey);
117
+ return (`${head} Import type { ${namespace} } from "${PRIMITIVE_DECLARATION_SPECIFIER}" and write ` +
118
+ `${namespace}.<Name> (for example ${namespace}.${example}).`);
119
+ }
120
+ //# sourceMappingURL=retired-imports.js.map
@@ -0,0 +1 @@
1
+ {"version":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,OAAO,mBAAmB,CAAC;QAC7B,KAAK,KAAK;YACR,OAAO,SAAS,CAAC;QACnB,KAAK,gBAAgB;YACnB,OAAO,gBAAgB,CAAC;IAC5B,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,WAAmB,EAAE,IAAY,EAAE,KAAoB;IAC1F,MAAM,IAAI,GAAG,aAAa,WAAW,MAAM,IAAI,aAAa,KAAK,CAAC,SAAS,oCAAoC,CAAC;IAChH,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7B,IAAI,KAAK,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO,GAAG,IAAI,kBAAkB,KAAK,YAAY,+BAA+B,2BAA2B,CAAC;IAC9G,CAAC;IACD,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;IAC1C,MAAM,OAAO,GAAG,KAAK,IAAI,eAAe,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACjE,OAAO,CACL,GAAG,IAAI,kBAAkB,SAAS,YAAY,+BAA+B,cAAc;QAC3F,GAAG,SAAS,wBAAwB,SAAS,IAAI,OAAO,IAAI,CAC7D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * The compiled space (#5544, project `unified-schemas` phase 10): every type
3
+ * name the generated declarations emit, across the five namespaces of
4
+ * `functions/primitive.d.ts` (`Schemas`, `Functions`, `Prompts`, `Db3`,
5
+ * `UserProperties`) and the shared Swift file.
6
+ *
7
+ * A name one party produces is emitted short. Every party to a name two or
8
+ * more parties produce becomes `<Namespace>_<PascalKey>_<Name>`, in both
9
+ * languages: a collision in either language's normalization renames the
10
+ * parties in both, so a reader types the same name in TypeScript and Swift.
11
+ * TypeScript renames inside its namespace too, though the namespace alone
12
+ * would keep two `Money`s apart there, because Swift has no namespaces.
13
+ *
14
+ * A party is a source: a `schemas/` file, a function, a prompt, a db3 model
15
+ * (two db3 types declaring one model identically are one party, by the
16
+ * caller's `identity`), the user properties. A name still produced twice after
17
+ * the rename is reported in `collisions`, with both sources, for the caller
18
+ * to refuse in its own error class.
19
+ */
20
+ /** A namespace of `primitive.d.ts`. */
21
+ export type SpaceNamespace = "Schemas" | "Functions" | "Prompts" | "Db3" | "UserProperties";
22
+ /** One name a party produces. */
23
+ export interface SpaceName {
24
+ /** What a lookup names it by: the explicit ref of a ref target, or a declaration's own id. */
25
+ id: string;
26
+ namespace: SpaceNamespace;
27
+ /** The party's key: a `schemas/` file stem, a function or prompt key, a db3 type, `UserProperties`. */
28
+ key: string;
29
+ /** Where the name is declared, for a refusal: `schemas/common.toml`, `functions/charge.toml`. */
30
+ source: string;
31
+ /** The name each language emits when no other party produces it. */
32
+ short: {
33
+ ts: string;
34
+ swift: string;
35
+ };
36
+ /** `<Name>` in `<Namespace>_<PascalKey>_<Name>`. */
37
+ suffix: string;
38
+ /**
39
+ * Names of one namespace and one short name with the same identity are one
40
+ * party, whatever their keys: a db3 model two types declare identically.
41
+ */
42
+ identity?: string;
43
+ }
44
+ /** A name two parties still produce after the rename. */
45
+ export interface SpaceCollision {
46
+ name: string;
47
+ sources: [string, string];
48
+ }
49
+ export interface CompiledSpace {
50
+ /** Each name's emitted TypeScript name (unqualified), by id. */
51
+ ts: ReadonlyMap<string, string>;
52
+ /** Each name's emitted Swift name, by id. */
53
+ swift: ReadonlyMap<string, string>;
54
+ /** The ids of the names a collision renamed. */
55
+ renamed: ReadonlySet<string>;
56
+ collisions: {
57
+ ts: SpaceCollision[];
58
+ swift: SpaceCollision[];
59
+ };
60
+ }
61
+ /** Compute the compiled space; see the module note. Deterministic for any order of `names`. */
62
+ export declare function compiledSpace(names: readonly SpaceName[]): CompiledSpace;
@@ -0,0 +1,103 @@
1
+ /**
2
+ * The compiled space (#5544, project `unified-schemas` phase 10): every type
3
+ * name the generated declarations emit, across the five namespaces of
4
+ * `functions/primitive.d.ts` (`Schemas`, `Functions`, `Prompts`, `Db3`,
5
+ * `UserProperties`) and the shared Swift file.
6
+ *
7
+ * A name one party produces is emitted short. Every party to a name two or
8
+ * more parties produce becomes `<Namespace>_<PascalKey>_<Name>`, in both
9
+ * languages: a collision in either language's normalization renames the
10
+ * parties in both, so a reader types the same name in TypeScript and Swift.
11
+ * TypeScript renames inside its namespace too, though the namespace alone
12
+ * would keep two `Money`s apart there, because Swift has no namespaces.
13
+ *
14
+ * A party is a source: a `schemas/` file, a function, a prompt, a db3 model
15
+ * (two db3 types declaring one model identically are one party, by the
16
+ * caller's `identity`), the user properties. A name still produced twice after
17
+ * the rename is reported in `collisions`, with both sources, for the caller
18
+ * to refuse in its own error class.
19
+ */
20
+ import { pascalCase } from "../db-codegen/dbNaming.js";
21
+ /** The party a name belongs to: its namespace and key, or its identity when it has one. */
22
+ function partyOf(name) {
23
+ return name.identity !== undefined
24
+ ? `${name.namespace}\u0000identity\u0000${name.identity}`
25
+ : `${name.namespace}\u0000${name.key}`;
26
+ }
27
+ /**
28
+ * `<Namespace>_<PascalKey>_<Name>`: the key's alphanumerics PascalCased, the
29
+ * same in both languages. A party one identity joins is named by its first key.
30
+ */
31
+ function renamed(name, partyKey) {
32
+ return `${name.namespace}_${pascalCase(partyKey)}_${name.suffix}`;
33
+ }
34
+ /** Compute the compiled space; see the module note. Deterministic for any order of `names`. */
35
+ export function compiledSpace(names) {
36
+ const sorted = [...names].sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
37
+ // Names sharing a short name in either language are joined; a group with two
38
+ // or more parties is a collision, and every name in it is renamed.
39
+ const parent = sorted.map((_, i) => i);
40
+ const find = (i) => (parent[i] === i ? i : (parent[i] = find(parent[i])));
41
+ const join = (a, b) => {
42
+ const ra = find(a);
43
+ const rb = find(b);
44
+ if (ra !== rb)
45
+ parent[Math.max(ra, rb)] = Math.min(ra, rb);
46
+ };
47
+ for (const language of ["ts", "swift"]) {
48
+ const first = new Map();
49
+ sorted.forEach((name, i) => {
50
+ const at = first.get(name.short[language]);
51
+ if (at === undefined)
52
+ first.set(name.short[language], i);
53
+ else
54
+ join(at, i);
55
+ });
56
+ }
57
+ const parties = new Map();
58
+ sorted.forEach((name, i) => {
59
+ const root = find(i);
60
+ if (!parties.has(root))
61
+ parties.set(root, new Set());
62
+ parties.get(root).add(partyOf(name));
63
+ });
64
+ const partyKey = new Map();
65
+ for (const name of sorted) {
66
+ const party = partyOf(name);
67
+ const known = partyKey.get(party);
68
+ if (known === undefined || name.key < known)
69
+ partyKey.set(party, name.key);
70
+ }
71
+ const ts = new Map();
72
+ const swift = new Map();
73
+ const renamedIds = new Set();
74
+ sorted.forEach((name, i) => {
75
+ if (parties.get(find(i)).size > 1) {
76
+ const emitted = renamed(name, partyKey.get(partyOf(name)));
77
+ renamedIds.add(name.id);
78
+ ts.set(name.id, emitted);
79
+ swift.set(name.id, emitted);
80
+ }
81
+ else {
82
+ ts.set(name.id, name.short.ts);
83
+ swift.set(name.id, name.short.swift);
84
+ }
85
+ });
86
+ const survivors = (emitted) => {
87
+ const byName = new Map();
88
+ const out = [];
89
+ for (const name of sorted) {
90
+ const emittedName = emitted.get(name.id);
91
+ const prior = byName.get(emittedName);
92
+ if (prior && partyOf(prior) !== partyOf(name)) {
93
+ out.push({ name: emittedName, sources: [prior.source, name.source] });
94
+ continue;
95
+ }
96
+ if (!prior)
97
+ byName.set(emittedName, name);
98
+ }
99
+ return out;
100
+ };
101
+ return { ts, swift, renamed: renamedIds, collisions: { ts: survivors(ts), swift: survivors(swift) } };
102
+ }
103
+ //# sourceMappingURL=compiledSpace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiledSpace.js","sourceRoot":"","sources":["../../../../src/lib/schema-codegen/compiledSpace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAyCvD,2FAA2F;AAC3F,SAAS,OAAO,CAAC,IAAe;IA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QAC3E,MAAM,MAAM,GAAG,IAAI,GAAG,EAAqB,CAAC;QAC5C,MAAM,GAAG,GAAqB,EAAE,CAAC;QACjC,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;YAC1B,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAE,CAAC;YAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACtC,IAAI,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC9C,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBACtE,SAAS;YACX,CAAC;YACD,IAAI,CAAC,KAAK;gBAAE,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;IACF,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;AACxG,CAAC"}
@@ -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-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
+ /** The two projections of a db3 model, in the order messages list them. */
18
+ export declare const DB3_PROJECTIONS: readonly ["row", "declared"];
19
+ /** A projection of a db3 model. */
20
+ export type Db3Projection = (typeof DB3_PROJECTIONS)[number];
21
+ /** A db3 type as the bridge reads it. */
22
+ export interface Db3BridgeType {
23
+ /** The type's name, as a ref spells it. */
24
+ name: string;
25
+ /** The parsed `[models.*]` tables. */
26
+ models: unknown;
27
+ /** The type's `timestamps`: the create and update stamp names, and the models they are limited to. */
28
+ timestamps?: {
29
+ create?: unknown;
30
+ update?: unknown;
31
+ models?: unknown;
32
+ } | null;
33
+ /** The type's `autoPopulatedFields`, by field name. */
34
+ autoPopulatedFields?: Readonly<Record<string, unknown>> | null;
35
+ }
36
+ /** A projected model, or why the model cannot be bridged. */
37
+ export type Db3ProjectionResult = {
38
+ ok: true;
39
+ schema: Record<string, unknown>;
40
+ } | {
41
+ ok: false;
42
+ reason: string;
43
+ };
44
+ /** A db3 type as a family index holds it: both projections of every model it can bridge. */
45
+ export interface Db3TypeProjections {
46
+ /** The models the type declares, in declaration order. */
47
+ models: string[];
48
+ /** Each bridged model's projections, keyed `<model>/row` and `<model>/declared`. */
49
+ defs: Record<string, unknown>;
50
+ /** Why a model cannot be bridged, by model. */
51
+ modelErrors?: Record<string, string>;
52
+ /** Why the type cannot be bridged at all. */
53
+ error?: string;
54
+ }
55
+ /** A marker the bridge writes, read back. */
56
+ export interface Db3ProjectionMarker {
57
+ type: string;
58
+ model: string;
59
+ projection: Db3Projection;
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 declare function db3ProjectionMarker(type: string, model: string, projection: Db3Projection): string;
66
+ /** A `$comment` read as a projection marker, or null when it is not one. */
67
+ export declare function parseDb3ProjectionMarker(comment: unknown): Db3ProjectionMarker | null;
68
+ /** The models a type declares, in declaration order; empty when its `models` is not a table. */
69
+ export declare function db3ModelNames(type: Db3BridgeType): string[];
70
+ /**
71
+ * One projection of one model of `type`. Refuses a model the type does not
72
+ * declare (listing the ones it does), a model that is not a table, and a
73
+ * field the field grammar refuses (naming the field and the grammar's reason).
74
+ *
75
+ * @example
76
+ * db3ModelProjection({ name: "workspace", models: { tasks: { fields: { title: { type: "string", required: true } } } } }, "tasks", "declared");
77
+ * // → { ok: true, schema: { type: "object", properties: { title: { type: "string" } }, required: ["title"],
78
+ * // additionalProperties: false, $comment: "db3:workspace#/$defs/tasks/declared" } }
79
+ */
80
+ export declare function db3ModelProjection(type: Db3BridgeType, model: string, projection: Db3Projection): Db3ProjectionResult;
81
+ /**
82
+ * Both projections of every model of `type`, as a family index's db3 slot
83
+ * holds them. A model that cannot be bridged keeps its reason, so a ref to it
84
+ * is refused naming it; a type whose `models` is not a table has none.
85
+ */
86
+ export declare function db3TypeProjections(type: Db3BridgeType): Db3TypeProjections;