primitive-admin 1.1.0-alpha.7 → 1.1.0-alpha.71

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 (438) hide show
  1. package/README.md +404 -80
  2. package/assets/skill/skills/primitive-platform/SKILL.md +808 -0
  3. package/dist/bin/primitive.d.ts +2 -0
  4. package/dist/bin/primitive.js +294 -21
  5. package/dist/bin/primitive.js.map +1 -1
  6. package/dist/src/commands/admins.d.ts +2 -0
  7. package/dist/src/commands/admins.js +138 -19
  8. package/dist/src/commands/admins.js.map +1 -1
  9. package/dist/src/commands/analytics.d.ts +2 -0
  10. package/dist/src/commands/analytics.js +544 -55
  11. package/dist/src/commands/analytics.js.map +1 -1
  12. package/dist/src/commands/apps.d.ts +2 -0
  13. package/dist/src/commands/apps.js +51 -96
  14. package/dist/src/commands/apps.js.map +1 -1
  15. package/dist/src/commands/auth.d.ts +2 -0
  16. package/dist/src/commands/auth.js +177 -7
  17. package/dist/src/commands/auth.js.map +1 -1
  18. package/dist/src/commands/blob-buckets.d.ts +2 -0
  19. package/dist/src/commands/blob-buckets.js +330 -0
  20. package/dist/src/commands/blob-buckets.js.map +1 -0
  21. package/dist/src/commands/catalog.d.ts +2 -0
  22. package/dist/src/commands/catalog.js +37 -38
  23. package/dist/src/commands/catalog.js.map +1 -1
  24. package/dist/src/commands/collection-type-configs.d.ts +2 -0
  25. package/dist/src/commands/collection-type-configs.js +92 -0
  26. package/dist/src/commands/collection-type-configs.js.map +1 -0
  27. package/dist/src/commands/collections.d.ts +2 -0
  28. package/dist/src/commands/collections.js +565 -0
  29. package/dist/src/commands/collections.js.map +1 -0
  30. package/dist/src/commands/comparisons.d.ts +2 -0
  31. package/dist/src/commands/comparisons.js +6 -6
  32. package/dist/src/commands/comparisons.js.map +1 -1
  33. package/dist/src/commands/config.d.ts +46 -0
  34. package/dist/src/commands/config.js +479 -0
  35. package/dist/src/commands/config.js.map +1 -0
  36. package/dist/src/commands/connections.d.ts +2 -0
  37. package/dist/src/commands/connections.js +100 -0
  38. package/dist/src/commands/connections.js.map +1 -0
  39. package/dist/src/commands/cron-triggers.d.ts +2 -0
  40. package/dist/src/commands/cron-triggers.js +265 -0
  41. package/dist/src/commands/cron-triggers.js.map +1 -0
  42. package/dist/src/commands/database-type-configs.d.ts +2 -0
  43. package/dist/src/commands/database-type-configs.js +171 -0
  44. package/dist/src/commands/database-type-configs.js.map +1 -0
  45. package/dist/src/commands/database-types.d.ts +2 -0
  46. package/dist/src/commands/database-types.js +471 -0
  47. package/dist/src/commands/database-types.js.map +1 -0
  48. package/dist/src/commands/databases.d.ts +65 -0
  49. package/dist/src/commands/databases.js +2140 -112
  50. package/dist/src/commands/databases.js.map +1 -1
  51. package/dist/src/commands/documents.d.ts +2 -0
  52. package/dist/src/commands/documents.js +1357 -19
  53. package/dist/src/commands/documents.js.map +1 -1
  54. package/dist/src/commands/email-templates.d.ts +2 -0
  55. package/dist/src/commands/email-templates.js +174 -0
  56. package/dist/src/commands/email-templates.js.map +1 -0
  57. package/dist/src/commands/env.d.ts +23 -0
  58. package/dist/src/commands/env.js +333 -0
  59. package/dist/src/commands/env.js.map +1 -0
  60. package/dist/src/commands/feature-flags.d.ts +14 -0
  61. package/dist/src/commands/feature-flags.js +116 -0
  62. package/dist/src/commands/feature-flags.js.map +1 -0
  63. package/dist/src/commands/group-type-configs.d.ts +2 -0
  64. package/dist/src/commands/group-type-configs.js +86 -0
  65. package/dist/src/commands/group-type-configs.js.map +1 -0
  66. package/dist/src/commands/groups.d.ts +2 -0
  67. package/dist/src/commands/groups.js +38 -99
  68. package/dist/src/commands/groups.js.map +1 -1
  69. package/dist/src/commands/guides.d.ts +223 -0
  70. package/dist/src/commands/guides.js +617 -65
  71. package/dist/src/commands/guides.js.map +1 -1
  72. package/dist/src/commands/init.d.ts +25 -0
  73. package/dist/src/commands/init.js +1605 -208
  74. package/dist/src/commands/init.js.map +1 -1
  75. package/dist/src/commands/integrations.d.ts +2 -0
  76. package/dist/src/commands/integrations.js +380 -178
  77. package/dist/src/commands/integrations.js.map +1 -1
  78. package/dist/src/commands/llm.d.ts +2 -0
  79. package/dist/src/commands/llm.js +4 -2
  80. package/dist/src/commands/llm.js.map +1 -1
  81. package/dist/src/commands/locks.d.ts +8 -0
  82. package/dist/src/commands/locks.js +160 -0
  83. package/dist/src/commands/locks.js.map +1 -0
  84. package/dist/src/commands/metadata-category-configs.d.ts +12 -0
  85. package/dist/src/commands/metadata-category-configs.js +112 -0
  86. package/dist/src/commands/metadata-category-configs.js.map +1 -0
  87. package/dist/src/commands/metadata.d.ts +2 -0
  88. package/dist/src/commands/metadata.js +281 -0
  89. package/dist/src/commands/metadata.js.map +1 -0
  90. package/dist/src/commands/prompts.d.ts +2 -0
  91. package/dist/src/commands/prompts.js +225 -584
  92. package/dist/src/commands/prompts.js.map +1 -1
  93. package/dist/src/commands/rule-sets.d.ts +3 -0
  94. package/dist/src/commands/rule-sets.js +272 -0
  95. package/dist/src/commands/rule-sets.js.map +1 -0
  96. package/dist/src/commands/scripts.d.ts +20 -0
  97. package/dist/src/commands/scripts.js +554 -0
  98. package/dist/src/commands/scripts.js.map +1 -0
  99. package/dist/src/commands/secrets.d.ts +2 -0
  100. package/dist/src/commands/secrets.js +108 -0
  101. package/dist/src/commands/secrets.js.map +1 -0
  102. package/dist/src/commands/sessions.d.ts +2 -0
  103. package/dist/src/commands/sessions.js +75 -0
  104. package/dist/src/commands/sessions.js.map +1 -0
  105. package/dist/src/commands/skill.d.ts +2 -0
  106. package/dist/src/commands/skill.js +29 -0
  107. package/dist/src/commands/skill.js.map +1 -0
  108. package/dist/src/commands/sync-app-settings.d.ts +158 -0
  109. package/dist/src/commands/sync-app-settings.js +330 -0
  110. package/dist/src/commands/sync-app-settings.js.map +1 -0
  111. package/dist/src/commands/sync.d.ts +2323 -0
  112. package/dist/src/commands/sync.js +15065 -843
  113. package/dist/src/commands/sync.js.map +1 -1
  114. package/dist/src/commands/tokens.d.ts +2 -0
  115. package/dist/src/commands/tokens.js +130 -21
  116. package/dist/src/commands/tokens.js.map +1 -1
  117. package/dist/src/commands/users.d.ts +2 -0
  118. package/dist/src/commands/users.js +532 -23
  119. package/dist/src/commands/users.js.map +1 -1
  120. package/dist/src/commands/vars.d.ts +8 -0
  121. package/dist/src/commands/vars.js +96 -0
  122. package/dist/src/commands/vars.js.map +1 -0
  123. package/dist/src/commands/waitlist.d.ts +2 -0
  124. package/dist/src/commands/waitlist.js +10 -10
  125. package/dist/src/commands/waitlist.js.map +1 -1
  126. package/dist/src/commands/webhooks.d.ts +2 -0
  127. package/dist/src/commands/webhooks.js +562 -0
  128. package/dist/src/commands/webhooks.js.map +1 -0
  129. package/dist/src/commands/workflows.d.ts +116 -0
  130. package/dist/src/commands/workflows.js +1583 -681
  131. package/dist/src/commands/workflows.js.map +1 -1
  132. package/dist/src/lib/access-rule-display.d.ts +21 -0
  133. package/dist/src/lib/access-rule-display.js +34 -0
  134. package/dist/src/lib/access-rule-display.js.map +1 -0
  135. package/dist/src/lib/api-client.d.ts +1936 -0
  136. package/dist/src/lib/api-client.js +1826 -138
  137. package/dist/src/lib/api-client.js.map +1 -1
  138. package/dist/src/lib/app-settings-descriptor.d.ts +263 -0
  139. package/dist/src/lib/app-settings-descriptor.js +575 -0
  140. package/dist/src/lib/app-settings-descriptor.js.map +1 -0
  141. package/dist/src/lib/auth-flow.d.ts +8 -0
  142. package/dist/src/lib/batch.d.ts +26 -0
  143. package/dist/src/lib/batch.js +32 -0
  144. package/dist/src/lib/batch.js.map +1 -0
  145. package/dist/src/lib/block-layout.d.ts +160 -0
  146. package/dist/src/lib/block-layout.js +451 -0
  147. package/dist/src/lib/block-layout.js.map +1 -0
  148. package/dist/src/lib/canonical-json.d.ts +12 -0
  149. package/dist/src/lib/canonical-json.js +35 -0
  150. package/dist/src/lib/canonical-json.js.map +1 -0
  151. package/dist/src/lib/channel.d.ts +30 -0
  152. package/dist/src/lib/channel.js +68 -0
  153. package/dist/src/lib/channel.js.map +1 -0
  154. package/dist/src/lib/cli-manifest.d.ts +68 -0
  155. package/dist/src/lib/cli-manifest.js +71 -0
  156. package/dist/src/lib/cli-manifest.js.map +1 -0
  157. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +101 -0
  158. package/dist/src/lib/codegen-shared/generatedFiles.js +191 -0
  159. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
  160. package/dist/src/lib/codegen-shared/prettierStable.d.ts +262 -0
  161. package/dist/src/lib/codegen-shared/prettierStable.js +610 -0
  162. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -0
  163. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +68 -0
  164. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +168 -0
  165. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
  166. package/dist/src/lib/config-object-descriptor.d.ts +127 -0
  167. package/dist/src/lib/config-object-descriptor.js +658 -0
  168. package/dist/src/lib/config-object-descriptor.js.map +1 -0
  169. package/dist/src/lib/config-payload.d.ts +85 -0
  170. package/dist/src/lib/config-payload.js +116 -0
  171. package/dist/src/lib/config-payload.js.map +1 -0
  172. package/dist/src/lib/config-surface.d.ts +130 -0
  173. package/dist/src/lib/config-surface.js +300 -0
  174. package/dist/src/lib/config-surface.js.map +1 -0
  175. package/dist/src/lib/config-toml.d.ts +10 -0
  176. package/dist/src/lib/config-toml.js +42 -0
  177. package/dist/src/lib/config-toml.js.map +1 -0
  178. package/dist/src/lib/config.d.ts +53 -0
  179. package/dist/src/lib/config.js +92 -53
  180. package/dist/src/lib/config.js.map +1 -1
  181. package/dist/src/lib/confirm-prompt.d.ts +83 -0
  182. package/dist/src/lib/confirm-prompt.js +110 -0
  183. package/dist/src/lib/confirm-prompt.js.map +1 -0
  184. package/dist/src/lib/constants.d.ts +11 -0
  185. package/dist/src/lib/constants.js +12 -0
  186. package/dist/src/lib/constants.js.map +1 -0
  187. package/dist/src/lib/crash-handlers.d.ts +20 -0
  188. package/dist/src/lib/crash-handlers.js +49 -0
  189. package/dist/src/lib/crash-handlers.js.map +1 -0
  190. package/dist/src/lib/credentials-store.d.ts +89 -0
  191. package/dist/src/lib/credentials-store.js +330 -0
  192. package/dist/src/lib/credentials-store.js.map +1 -0
  193. package/dist/src/lib/csv.d.ts +47 -0
  194. package/dist/src/lib/csv.js +172 -0
  195. package/dist/src/lib/csv.js.map +1 -0
  196. package/dist/src/lib/data-input.d.ts +23 -0
  197. package/dist/src/lib/data-input.js +50 -0
  198. package/dist/src/lib/data-input.js.map +1 -0
  199. package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
  200. package/dist/src/lib/db-codegen/dbFingerprint.js +17 -0
  201. package/dist/src/lib/db-codegen/dbFingerprint.js.map +1 -0
  202. package/dist/src/lib/db-codegen/dbGenerator.d.ts +67 -0
  203. package/dist/src/lib/db-codegen/dbGenerator.js +170 -0
  204. package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -0
  205. package/dist/src/lib/db-codegen/dbNaming.d.ts +87 -0
  206. package/dist/src/lib/db-codegen/dbNaming.js +180 -0
  207. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -0
  208. package/dist/src/lib/db-codegen/dbTemplates.d.ts +272 -0
  209. package/dist/src/lib/db-codegen/dbTemplates.js +480 -0
  210. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -0
  211. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +73 -0
  212. package/dist/src/lib/db-codegen/dbTsTypes.js +139 -0
  213. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -0
  214. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +146 -0
  215. package/dist/src/lib/db-codegen/dbTypeIR.js +517 -0
  216. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
  217. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +112 -0
  218. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +211 -0
  219. package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
  220. package/dist/src/lib/env-resolver-core.d.ts +147 -0
  221. package/dist/src/lib/env-resolver-core.js +265 -0
  222. package/dist/src/lib/env-resolver-core.js.map +1 -0
  223. package/dist/src/lib/env-resolver.d.ts +84 -0
  224. package/dist/src/lib/env-resolver.js +133 -0
  225. package/dist/src/lib/env-resolver.js.map +1 -0
  226. package/dist/src/lib/fetch.d.ts +5 -0
  227. package/dist/src/lib/generated-allowlist.d.ts +28 -0
  228. package/dist/src/lib/generated-allowlist.js +277 -0
  229. package/dist/src/lib/generated-allowlist.js.map +1 -0
  230. package/dist/src/lib/generated-config-surfaces.d.ts +682 -0
  231. package/dist/src/lib/generated-config-surfaces.js +4058 -0
  232. package/dist/src/lib/generated-config-surfaces.js.map +1 -0
  233. package/dist/src/lib/generated-template-lint.d.ts +212 -0
  234. package/dist/src/lib/generated-template-lint.js +624 -0
  235. package/dist/src/lib/generated-template-lint.js.map +1 -0
  236. package/dist/src/lib/init-adopt.d.ts +16 -0
  237. package/dist/src/lib/init-adopt.js +34 -0
  238. package/dist/src/lib/init-adopt.js.map +1 -0
  239. package/dist/src/lib/init-assets.d.ts +39 -0
  240. package/dist/src/lib/init-assets.js +97 -0
  241. package/dist/src/lib/init-assets.js.map +1 -0
  242. package/dist/src/lib/init-config.d.ts +98 -0
  243. package/dist/src/lib/init-config.js +186 -0
  244. package/dist/src/lib/init-config.js.map +1 -0
  245. package/dist/src/lib/init-ios-links.d.ts +50 -0
  246. package/dist/src/lib/init-ios-links.js +153 -0
  247. package/dist/src/lib/init-ios-links.js.map +1 -0
  248. package/dist/src/lib/init-plan.d.ts +80 -0
  249. package/dist/src/lib/init-plan.js +95 -0
  250. package/dist/src/lib/init-plan.js.map +1 -0
  251. package/dist/src/lib/init-production-env.d.ts +48 -0
  252. package/dist/src/lib/init-production-env.js +59 -0
  253. package/dist/src/lib/init-production-env.js.map +1 -0
  254. package/dist/src/lib/init-schema.d.ts +74 -0
  255. package/dist/src/lib/init-schema.js +358 -0
  256. package/dist/src/lib/init-schema.js.map +1 -0
  257. package/dist/src/lib/init-xcode.d.ts +33 -0
  258. package/dist/src/lib/init-xcode.js +114 -0
  259. package/dist/src/lib/init-xcode.js.map +1 -0
  260. package/dist/src/lib/integration-request-config.d.ts +30 -0
  261. package/dist/src/lib/integration-request-config.js +145 -0
  262. package/dist/src/lib/integration-request-config.js.map +1 -0
  263. package/dist/src/lib/local-state.d.ts +55 -0
  264. package/dist/src/lib/local-state.js +167 -0
  265. package/dist/src/lib/local-state.js.map +1 -0
  266. package/dist/src/lib/log-inspection.d.ts +568 -0
  267. package/dist/src/lib/log-inspection.js +639 -0
  268. package/dist/src/lib/log-inspection.js.map +1 -0
  269. package/dist/src/lib/migration-nag.d.ts +49 -0
  270. package/dist/src/lib/migration-nag.js +163 -0
  271. package/dist/src/lib/migration-nag.js.map +1 -0
  272. package/dist/src/lib/object-status-filter.d.ts +22 -0
  273. package/dist/src/lib/object-status-filter.js +45 -0
  274. package/dist/src/lib/object-status-filter.js.map +1 -0
  275. package/dist/src/lib/output.d.ts +109 -0
  276. package/dist/src/lib/output.js +191 -8
  277. package/dist/src/lib/output.js.map +1 -1
  278. package/dist/src/lib/package-manager.d.ts +140 -0
  279. package/dist/src/lib/package-manager.js +305 -0
  280. package/dist/src/lib/package-manager.js.map +1 -0
  281. package/dist/src/lib/paginate.d.ts +83 -0
  282. package/dist/src/lib/paginate.js +95 -0
  283. package/dist/src/lib/paginate.js.map +1 -0
  284. package/dist/src/lib/platform-owned.d.ts +63 -0
  285. package/dist/src/lib/platform-owned.js +85 -0
  286. package/dist/src/lib/platform-owned.js.map +1 -0
  287. package/dist/src/lib/project-config.d.ts +97 -0
  288. package/dist/src/lib/project-config.js +217 -0
  289. package/dist/src/lib/project-config.js.map +1 -0
  290. package/dist/src/lib/query-operators.d.ts +43 -0
  291. package/dist/src/lib/query-operators.js +80 -0
  292. package/dist/src/lib/query-operators.js.map +1 -0
  293. package/dist/src/lib/record-filter.d.ts +18 -0
  294. package/dist/src/lib/record-filter.js +55 -0
  295. package/dist/src/lib/record-filter.js.map +1 -0
  296. package/dist/src/lib/refresh-admin-credentials.d.ts +65 -0
  297. package/dist/src/lib/refresh-admin-credentials.js +103 -0
  298. package/dist/src/lib/refresh-admin-credentials.js.map +1 -0
  299. package/dist/src/lib/resolve-init-dev-port.d.ts +56 -0
  300. package/dist/src/lib/resolve-init-dev-port.js +55 -0
  301. package/dist/src/lib/resolve-init-dev-port.js.map +1 -0
  302. package/dist/src/lib/resolve-init-server.d.ts +64 -0
  303. package/dist/src/lib/resolve-init-server.js +77 -0
  304. package/dist/src/lib/resolve-init-server.js.map +1 -0
  305. package/dist/src/lib/resolve-platform.d.ts +74 -0
  306. package/dist/src/lib/resolve-platform.js +105 -0
  307. package/dist/src/lib/resolve-platform.js.map +1 -0
  308. package/dist/src/lib/run-status.d.ts +19 -0
  309. package/dist/src/lib/run-status.generated.d.ts +39 -0
  310. package/dist/src/lib/run-status.generated.js +66 -0
  311. package/dist/src/lib/run-status.generated.js.map +1 -0
  312. package/dist/src/lib/run-status.js +19 -0
  313. package/dist/src/lib/run-status.js.map +1 -0
  314. package/dist/src/lib/server-text-normalization.d.ts +51 -0
  315. package/dist/src/lib/server-text-normalization.js +90 -0
  316. package/dist/src/lib/server-text-normalization.js.map +1 -0
  317. package/dist/src/lib/server-url.d.ts +22 -0
  318. package/dist/src/lib/server-url.js +33 -0
  319. package/dist/src/lib/server-url.js.map +1 -0
  320. package/dist/src/lib/signing-secret-status.d.ts +81 -0
  321. package/dist/src/lib/signing-secret-status.js +116 -0
  322. package/dist/src/lib/signing-secret-status.js.map +1 -0
  323. package/dist/src/lib/skill-installer.d.ts +25 -0
  324. package/dist/src/lib/skill-installer.js +266 -0
  325. package/dist/src/lib/skill-installer.js.map +1 -0
  326. package/dist/src/lib/snapshots.d.ts +99 -0
  327. package/dist/src/lib/snapshots.js +357 -0
  328. package/dist/src/lib/snapshots.js.map +1 -0
  329. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +113 -0
  330. package/dist/src/lib/swift-codegen/dbGenerator.js +914 -0
  331. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
  332. package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
  333. package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
  334. package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
  335. package/dist/src/lib/swift-codegen/generator.d.ts +94 -0
  336. package/dist/src/lib/swift-codegen/generator.js +440 -0
  337. package/dist/src/lib/swift-codegen/generator.js.map +1 -0
  338. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +72 -0
  339. package/dist/src/lib/swift-codegen/schemaToSwift.js +644 -0
  340. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
  341. package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +94 -0
  342. package/dist/src/lib/swift-codegen/siblingSymbols.js +155 -0
  343. package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -0
  344. package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
  345. package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
  346. package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
  347. package/dist/src/lib/sync-dir-selector.d.ts +21 -0
  348. package/dist/src/lib/sync-dir-selector.js +30 -0
  349. package/dist/src/lib/sync-dir-selector.js.map +1 -0
  350. package/dist/src/lib/sync-paths.d.ts +111 -0
  351. package/dist/src/lib/sync-paths.js +198 -0
  352. package/dist/src/lib/sync-paths.js.map +1 -0
  353. package/dist/src/lib/sync-resource-types.d.ts +544 -0
  354. package/dist/src/lib/sync-resource-types.js +975 -0
  355. package/dist/src/lib/sync-resource-types.js.map +1 -0
  356. package/dist/src/lib/sync-selectors.d.ts +95 -0
  357. package/dist/src/lib/sync-selectors.js +228 -0
  358. package/dist/src/lib/sync-selectors.js.map +1 -0
  359. package/dist/src/lib/template.d.ts +170 -0
  360. package/dist/src/lib/template.js +484 -68
  361. package/dist/src/lib/template.js.map +1 -1
  362. package/dist/src/lib/test-case-keys.d.ts +29 -0
  363. package/dist/src/lib/test-case-keys.js +55 -0
  364. package/dist/src/lib/test-case-keys.js.map +1 -0
  365. package/dist/src/lib/test-case-variables.d.ts +15 -0
  366. package/dist/src/lib/test-case-variables.js +29 -0
  367. package/dist/src/lib/test-case-variables.js.map +1 -0
  368. package/dist/src/lib/token-inject.d.ts +56 -0
  369. package/dist/src/lib/token-inject.js +204 -0
  370. package/dist/src/lib/token-inject.js.map +1 -0
  371. package/dist/src/lib/toml-database-config.d.ts +123 -0
  372. package/dist/src/lib/toml-database-config.js +527 -0
  373. package/dist/src/lib/toml-database-config.js.map +1 -0
  374. package/dist/src/lib/toml-metadata-config.d.ts +151 -0
  375. package/dist/src/lib/toml-metadata-config.js +476 -0
  376. package/dist/src/lib/toml-metadata-config.js.map +1 -0
  377. package/dist/src/lib/toml-native-form.d.ts +46 -0
  378. package/dist/src/lib/toml-native-form.js +78 -0
  379. package/dist/src/lib/toml-native-form.js.map +1 -0
  380. package/dist/src/lib/toml-params-validator.d.ts +129 -0
  381. package/dist/src/lib/toml-params-validator.js +298 -0
  382. package/dist/src/lib/toml-params-validator.js.map +1 -0
  383. package/dist/src/lib/toml-scalar-edit.d.ts +43 -0
  384. package/dist/src/lib/toml-scalar-edit.js +283 -0
  385. package/dist/src/lib/toml-scalar-edit.js.map +1 -0
  386. package/dist/src/lib/user-selector.d.ts +24 -0
  387. package/dist/src/lib/user-selector.js +33 -0
  388. package/dist/src/lib/user-selector.js.map +1 -0
  389. package/dist/src/lib/version-check.d.ts +35 -0
  390. package/dist/src/lib/version-check.js +241 -0
  391. package/dist/src/lib/version-check.js.map +1 -0
  392. package/dist/src/lib/watch.d.ts +121 -0
  393. package/dist/src/lib/watch.js +169 -0
  394. package/dist/src/lib/watch.js.map +1 -0
  395. package/dist/src/lib/workflow-apply.d.ts +110 -0
  396. package/dist/src/lib/workflow-apply.js +164 -0
  397. package/dist/src/lib/workflow-apply.js.map +1 -0
  398. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
  399. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
  400. package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
  401. package/dist/src/lib/workflow-codegen/generator.d.ts +96 -0
  402. package/dist/src/lib/workflow-codegen/generator.js +361 -0
  403. package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
  404. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +94 -0
  405. package/dist/src/lib/workflow-codegen/invokerIR.js +76 -0
  406. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
  407. package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
  408. package/dist/src/lib/workflow-codegen/naming.js +81 -0
  409. package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
  410. package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +80 -0
  411. package/dist/src/lib/workflow-codegen/schemaToTs.js +303 -0
  412. package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
  413. package/dist/src/lib/workflow-config-apply.d.ts +70 -0
  414. package/dist/src/lib/workflow-config-apply.js +137 -0
  415. package/dist/src/lib/workflow-config-apply.js.map +1 -0
  416. package/dist/src/lib/workflow-config-sidecar.d.ts +63 -0
  417. package/dist/src/lib/workflow-config-sidecar.js +96 -0
  418. package/dist/src/lib/workflow-config-sidecar.js.map +1 -0
  419. package/dist/src/lib/workflow-defaults.d.ts +29 -0
  420. package/dist/src/lib/workflow-defaults.js +41 -0
  421. package/dist/src/lib/workflow-defaults.js.map +1 -0
  422. package/dist/src/lib/workflow-fragments.d.ts +64 -0
  423. package/dist/src/lib/workflow-fragments.js +342 -0
  424. package/dist/src/lib/workflow-fragments.js.map +1 -0
  425. package/dist/src/lib/workflow-include-preserve.d.ts +76 -0
  426. package/dist/src/lib/workflow-include-preserve.js +286 -0
  427. package/dist/src/lib/workflow-include-preserve.js.map +1 -0
  428. package/dist/src/lib/workflow-payload.d.ts +98 -0
  429. package/dist/src/lib/workflow-payload.js +178 -0
  430. package/dist/src/lib/workflow-payload.js.map +1 -0
  431. package/dist/src/lib/workflow-toml-validator.d.ts +202 -0
  432. package/dist/src/lib/workflow-toml-validator.js +757 -0
  433. package/dist/src/lib/workflow-toml-validator.js.map +1 -0
  434. package/dist/src/types/index.d.ts +581 -0
  435. package/dist/src/validators.d.ts +65 -0
  436. package/dist/src/validators.js +64 -0
  437. package/dist/src/validators.js.map +1 -0
  438. package/package.json +32 -8
@@ -0,0 +1,575 @@
1
+ /**
2
+ * Shared field descriptor for app-settings TOML sync (issue #1033).
3
+ *
4
+ * A single source of truth describing every app setting that round-trips
5
+ * through `app.toml`. It drives BOTH directions:
6
+ * - pull (`serializeAppSettingsToToml`): server settings -> `app.toml` object
7
+ * - push (`parseTomlToAppSettings`): `app.toml` object -> settings payload
8
+ *
9
+ * Driving serializer and parser from one table means the two can never drift
10
+ * apart, and a single drift test can assert the descriptor stays in step with
11
+ * the server's `GET /settings` response and `PUT /settings` allow-list. This
12
+ * generalizes the earlier hand-maintained `AUTH_BOOLEAN_KEYS` /
13
+ * `RECOGNIZED_AUTH_KEYS` pattern to every section, and fully replaces it.
14
+ *
15
+ * Design decisions of record (issue #1033):
16
+ * - Google is a typed client MAP (#2891): `googleClients` renders as
17
+ * `[auth.google.clients.<type>]`, and each entry's `clientSecret` holds a
18
+ * whole `{{secrets.KEY}}` reference rather than the secret itself, so the
19
+ * map round-trips through `app.toml` like any other setting.
20
+ * - `[cors]` is always emitted (the `mode` key is `emit: "always"`), even in
21
+ * universal mode. A one-time diff on the next pull for existing apps is
22
+ * acceptable.
23
+ * - `[invitations]` is an additive table for the member-invitation fields.
24
+ * - Nothing is writable-but-excluded any more (#2891). The legacy passkey
25
+ * pair and the three Google/redirect scalars are RETIRED: not writable, not
26
+ * synced, and refused by name with their own guidance when an old
27
+ * `app.toml` still carries them.
28
+ * - Push type mismatches are field-named validation errors — no silent
29
+ * coercion of a mistyped TOML value.
30
+ * - THE FILE IS THE WHOLE TRUTH (#2880, sponsor 2026-08-21). `app.toml` used
31
+ * to be the one surface where an omitted key preserved the server's value,
32
+ * while every other type follows "the local file is the source of truth"
33
+ * (#1567). That exception is gone: push emits a value for EVERY writable
34
+ * field, and a key the file does not carry clears the field or resets it to
35
+ * its declared default (`APP_SETTINGS_ABSENT_VALUES`). `[app].name` and
36
+ * `[app].mode` are the two exceptions — no default, identity-critical, and
37
+ * `mode: null` is a 400 — so their absence is a validation error instead.
38
+ */
39
+ import { findUnknownDocumentKeys, requireConfigSurface, } from "./config-surface.js";
40
+ import { retiredConfigKey } from "./generated-config-surfaces.js";
41
+ import { canonicalizeSecretReference } from "./server-text-normalization.js";
42
+ /**
43
+ * The vendored `app-settings` definition (#2644) this module projects. Read
44
+ * once at load; a missing definition fails loudly rather than yielding an
45
+ * empty descriptor that would silently sync nothing.
46
+ */
47
+ const APP_SETTINGS_SURFACE = requireConfigSurface("app-settings");
48
+ /**
49
+ * Every field that round-trips through `app.toml` — DERIVED from the
50
+ * `app-settings` configuration-object definition (#2644), not listed.
51
+ *
52
+ * The definition already states each field's section (its table's TOML path),
53
+ * its `app.toml` key, its type and its `emit` rule, and the coverage guard
54
+ * holds it against the `App` model. Restating those 26 entries here made
55
+ * adding a setting two edits that a parity test then compared — the "two lists
56
+ * and a test they agree" shape the design gate rejected (2026-08-12). One edit
57
+ * in the definition now reaches the server allow-list
58
+ * (`settings-fields.ts`), this descriptor, and both directions of the sync.
59
+ *
60
+ * `json` in the definition is this module's `object` — the same shape under the
61
+ * name each side has always used for it.
62
+ */
63
+ export const APP_SETTINGS_DESCRIPTOR = APP_SETTINGS_SURFACE.tables.flatMap((table) => table.fields.map((field) => ({
64
+ field: field.field,
65
+ section: table.tomlPath[0],
66
+ key: field.tomlKey,
67
+ type: (field.type === "json" ? "object" : field.type),
68
+ emit: field.emit,
69
+ })));
70
+ /**
71
+ * Section render order for a stable, diff-friendly `app.toml` — the
72
+ * definition's table order (#2644), so a new section is rendered by being
73
+ * declared there.
74
+ */
75
+ export const APP_SETTINGS_SECTIONS = APP_SETTINGS_SURFACE.tables.map((table) => table.tomlPath[0]);
76
+ /**
77
+ * `GET /settings` keys that are computed/read-only and never sync (no server
78
+ * setter). The external coverage drift test classifies these here.
79
+ */
80
+ export const IGNORED_GET_KEYS = new Set([
81
+ "appId",
82
+ // `hasGoogleAuth`, `googleClientSecretSet` and `googleClientSecretStatus` are
83
+ // GONE (#2891), not ignored: the first could not describe a per-platform
84
+ // configuration, and the other two existed only to report a value the server
85
+ // refused to send back. The map states availability per entry and the stored
86
+ // reference is echoed, so a response still carrying any of them is a server
87
+ // this CLI does not understand — worth failing the drift guard over.
88
+ //
89
+ // `hasAppleAuth` / `hasPasskey` stay: the asymmetry is deliberate, since
90
+ // Apple and passkeys have no map to derive per-platform truth from.
91
+ "hasAppleAuth",
92
+ "hasPasskey",
93
+ // #2884 — compatibility fields DERIVED from the one email sign-in flow; the
94
+ // tenant PUT and app.toml retired them, GET still emits both for older
95
+ // clients. Computed, never synced.
96
+ "magicLinkEnabled",
97
+ "otpEnabled",
98
+ "createdAt",
99
+ "modifiedAt",
100
+ ]);
101
+ /**
102
+ * Fields that ARE still writable server-side (present in the `PUT /settings`
103
+ * allow-list) but are deliberately excluded from TOML because a newer field
104
+ * supersedes them. Kept distinct from `IGNORED_GET_KEYS` so the coverage test's
105
+ * "every allow-listed field is covered" claim stays true — these are excluded,
106
+ * not read-only. (Codex design-review concern #1.)
107
+ */
108
+ export const DEPRECATED_WRITABLE_EXCLUDED = new Set(
109
+ // Derived (#2644): `deprecated` is exactly "still writable, superseded by
110
+ // another field", which is what this set has always meant.
111
+ APP_SETTINGS_SURFACE.tables.flatMap((table) => Object.entries(table.notExposed)
112
+ .filter(([, classification]) => classification.kind === "deprecated")
113
+ .map(([field]) => field)));
114
+ export const APP_SETTINGS_ABSENT_VALUES = {
115
+ // [app]
116
+ name: { required: true },
117
+ mode: { required: true },
118
+ baseUrl: { value: null },
119
+ waitlistEnabled: { value: false },
120
+ waitlistNotifyAdmins: { value: true },
121
+ directLlmEnabled: { value: false },
122
+ allowedDomains: { value: null },
123
+ testAccountBaseEmails: { value: null },
124
+ // [auth]
125
+ googleOAuthEnabled: { value: null },
126
+ googleClients: { value: null },
127
+ passkeyEnabled: { value: false },
128
+ // #2884: the one email sign-in setting, absent ⇒ `true` because that is what
129
+ // `GET /settings` reports for a row storing none of the three fields
130
+ // (`isEmailSignInEnabled`) — the equality the table above exists to hold.
131
+ // Stated consequence: a hand-authored file that never carried the key pushes
132
+ // email sign-in ON, exactly as omitting `magicLinkEnabled` / `otpEnabled`
133
+ // did before the collapse. A pulled file always states the setting
134
+ // (`emit: "always"`), so this only bites a file authored without it.
135
+ emailSignInEnabled: { value: true },
136
+ appleSignInEnabled: { value: null },
137
+ appleAudiences: { value: null },
138
+ emailRedirectUris: { value: null },
139
+ passkeyRpConfig: { value: null },
140
+ // [cors]
141
+ corsMode: { value: "universal" },
142
+ corsAllowedOrigins: { value: null },
143
+ corsAllowCredentials: { value: false },
144
+ corsAllowedMethods: { value: null },
145
+ corsAllowedHeaders: { value: null },
146
+ corsExposedHeaders: { value: null },
147
+ corsMaxAge: { value: null },
148
+ // [invitations]
149
+ memberInvitationsEnabled: { value: false },
150
+ memberInvitationLimit: { value: 5 },
151
+ };
152
+ /**
153
+ * The absent-key rule for one field, or a loud failure.
154
+ *
155
+ * Deliberately a throw rather than a `?? null` fallback: under whole-truth push
156
+ * an unlisted field would be CLEARED on every push by a table nobody updated.
157
+ */
158
+ export function appSettingAbsentValue(field) {
159
+ const entry = APP_SETTINGS_ABSENT_VALUES[field];
160
+ if (!entry) {
161
+ throw new Error(`app.toml: no absent-key rule declared for the setting \`${field}\`. ` +
162
+ `Add it to APP_SETTINGS_ABSENT_VALUES (cli/src/lib/app-settings-descriptor.ts) ` +
163
+ `— push sends a value for every writable field (#2880).`);
164
+ }
165
+ return entry;
166
+ }
167
+ /** Fields whose absence is a validation error rather than a clear (#2880). */
168
+ export const REQUIRED_APP_SETTING_FIELDS = APP_SETTINGS_DESCRIPTOR.filter((d) => APP_SETTINGS_ABSENT_VALUES[d.field]?.required === true).map((d) => d.field);
169
+ /**
170
+ * The value the SERVER would hold after accepting this one (#2880 DSO-003).
171
+ *
172
+ * The comparison runs on the local side only: push forwards what the file says
173
+ * and the server normalizes it, so without this an authored-but-noncanonical
174
+ * value (`baseUrl` with a trailing slash, a mixed-case test-account email)
175
+ * differs from the record the server returns FOREVER — and baseline restamping
176
+ * cannot save it, because after an apply the remote hash matches the new
177
+ * baseline while the local hash still does not, re-classifying `local-edited`
178
+ * on every run.
179
+ *
180
+ * Mirrors the rules in `settings-controller.ts` (`baseUrl` trim + trailing
181
+ * slash), `validateTestAccountBaseEmails` (trim, lower-case, dedupe) and
182
+ * `validateRedirectUris` (trim, dedupe). Only the NORMALIZATION is mirrored,
183
+ * never the rejection: an entry the server would refuse stays as authored so
184
+ * the server's own 400 is what the operator sees.
185
+ */
186
+ export function canonicalizeAppSettingValue(field, value) {
187
+ if (value === null || value === undefined)
188
+ return value;
189
+ if (field === "baseUrl") {
190
+ if (typeof value !== "string")
191
+ return value;
192
+ const trimmed = value.trim().replace(/\/+$/, "");
193
+ return trimmed === "" ? null : trimmed;
194
+ }
195
+ if (field === "testAccountBaseEmails" || field === "emailRedirectUris") {
196
+ if (!Array.isArray(value))
197
+ return value;
198
+ const lower = field === "testAccountBaseEmails";
199
+ const seen = new Set();
200
+ const out = [];
201
+ for (const entry of value) {
202
+ if (typeof entry !== "string") {
203
+ out.push(entry);
204
+ continue;
205
+ }
206
+ const normalized = lower ? entry.trim().toLowerCase() : entry.trim();
207
+ if (seen.has(normalized))
208
+ continue;
209
+ seen.add(normalized);
210
+ out.push(normalized);
211
+ }
212
+ return out;
213
+ }
214
+ if (field === "appleAudiences") {
215
+ if (!Array.isArray(value))
216
+ return value;
217
+ // The controller filters non-empty strings and stores `null` for an empty
218
+ // result, so a list of blanks is the same state as no list at all.
219
+ return value.filter((v) => typeof v === "string" && v.length > 0);
220
+ }
221
+ if (field === "googleClients")
222
+ return canonicalizeGoogleClients(value);
223
+ return value;
224
+ }
225
+ /**
226
+ * The typed Google client map as the server STORES it (#2880 DSO-003).
227
+ *
228
+ * `validateGoogleClientsWrite` (`src/services/google-clients.ts`) rewrites each
229
+ * accepted entry: the `clientId` is trimmed, the `clientSecret` is stored as
230
+ * the canonical `{{secrets.KEY}}` reference, the redirect URIs are trimmed and
231
+ * de-duplicated (`validateRedirectUris`), and an entry that states none at all
232
+ * stores the empty list. Without mirroring that, an authored
233
+ * `clientId = " 123.apps... "` — or a `{{ secrets.KEY }}` written with the
234
+ * spacing TOML makes easy — is a `Modified` row on every run against a value
235
+ * push already applied.
236
+ *
237
+ * Normalization only, never rejection: an entry the server would refuse (a
238
+ * `clientSecret` that is not a reference, a URI it will not take) is left as
239
+ * authored so the `PUT`'s own 400 is what the operator sees.
240
+ */
241
+ function canonicalizeGoogleClients(value) {
242
+ if (!value || typeof value !== "object" || Array.isArray(value))
243
+ return value;
244
+ const clients = value.clients;
245
+ if (!clients || typeof clients !== "object" || Array.isArray(clients)) {
246
+ return value;
247
+ }
248
+ const out = {};
249
+ for (const [type, entry] of Object.entries(clients)) {
250
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
251
+ out[type] = entry;
252
+ continue;
253
+ }
254
+ const source = entry;
255
+ const canonical = { ...source };
256
+ if (typeof source.clientId === "string") {
257
+ canonical.clientId = source.clientId.trim();
258
+ }
259
+ if (source.clientSecret !== undefined) {
260
+ canonical.clientSecret = canonicalizeSecretReference(source.clientSecret);
261
+ }
262
+ // Trimmed and de-duplicated, and materialized when the entry states none —
263
+ // the server stores `[]` either way, so "no key" and "empty list" are one
264
+ // state rather than a difference no push can close.
265
+ canonical.redirectUris = Array.isArray(source.redirectUris)
266
+ ? [
267
+ ...new Set(source.redirectUris.map((uri) => typeof uri === "string" ? uri.trim() : uri)),
268
+ ]
269
+ : [];
270
+ out[type] = canonical;
271
+ }
272
+ return { clients: out };
273
+ }
274
+ /**
275
+ * One field's comparable value — what `config diff` and the push gate both read.
276
+ *
277
+ * Canonicalized as above, then flattened to `null` when the value is "empty"
278
+ * under an `emit: "whenSet"` field's own rule. That second step is the
279
+ * app-settings copy of what `projectConfigForComparison` does for every other
280
+ * type (#2731): pull OMITS an empty `whenSet` value, so the file it round-trips
281
+ * to has no key, and comparing `[]` against "no key" would be a difference no
282
+ * push could ever converge.
283
+ */
284
+ export function comparableAppSettingValue(descriptor, value) {
285
+ const canonical = canonicalizeAppSettingValue(descriptor.field, value);
286
+ if (canonical === undefined)
287
+ return null;
288
+ if (descriptor.emit === "whenSet" && isEmptyForEmit(canonical, descriptor.type)) {
289
+ return null;
290
+ }
291
+ return canonical ?? null;
292
+ }
293
+ /**
294
+ * Project a settings record (either side) onto the full writable field set.
295
+ *
296
+ * `excludeName` is the cross-app rule (#2880 DSO-001): while a cross-app push's
297
+ * name exclusion is active, BOTH sides and the stamped baseline are hashed
298
+ * without `name`, so `classifyPushChange`'s `remoteHash === baselineHash ⇒
299
+ * local-edited` arithmetic stays valid.
300
+ */
301
+ export function projectAppSettingsForComparison(settings, options = {}) {
302
+ const projected = {};
303
+ for (const d of APP_SETTINGS_DESCRIPTOR) {
304
+ if (options.excludeName && d.field === "name")
305
+ continue;
306
+ const raw = settings?.[d.field];
307
+ const absent = APP_SETTINGS_ABSENT_VALUES[d.field];
308
+ projected[d.field] = comparableAppSettingValue(d, raw === undefined && absent && absent.required !== true
309
+ ? absent.value
310
+ : raw);
311
+ }
312
+ return projected;
313
+ }
314
+ const DESCRIPTOR_BY_SECTION = (() => {
315
+ const m = new Map();
316
+ for (const d of APP_SETTINGS_DESCRIPTOR) {
317
+ const list = m.get(d.section) ?? [];
318
+ list.push(d);
319
+ m.set(d.section, list);
320
+ }
321
+ return m;
322
+ })();
323
+ /** Descriptor `field` names, for parity/coverage tests. */
324
+ export const DESCRIPTOR_FIELDS = new Set(APP_SETTINGS_DESCRIPTOR.map((d) => d.field));
325
+ function typeOfValue(value) {
326
+ if (value === null || value === undefined)
327
+ return "null";
328
+ if (typeof value === "boolean")
329
+ return "boolean";
330
+ if (typeof value === "number")
331
+ return "number";
332
+ if (typeof value === "string")
333
+ return "string";
334
+ if (Array.isArray(value))
335
+ return "string[]";
336
+ if (typeof value === "object")
337
+ return "object";
338
+ return "unknown";
339
+ }
340
+ /** True if a value should be omitted under `emit: "whenSet"`. */
341
+ function isEmptyForEmit(value, type) {
342
+ if (value === null || value === undefined)
343
+ return true;
344
+ if (type === "string")
345
+ return value === "";
346
+ if (type === "string[]")
347
+ return !Array.isArray(value) || value.length === 0;
348
+ if (type === "object")
349
+ return (typeof value !== "object" ||
350
+ value === null ||
351
+ Object.keys(value).length === 0);
352
+ return false; // booleans (false) and numbers (0) are meaningful, never empty
353
+ }
354
+ /**
355
+ * Validate a push value against its descriptor type. Returns an error string
356
+ * (field-named) on mismatch, or `null` when the value is acceptable. Arrays are
357
+ * checked element-by-element so a `["a", 1]` mistype is caught.
358
+ */
359
+ function typeError(descriptor, value) {
360
+ const actual = typeOfValue(value);
361
+ if (actual === "null")
362
+ return null; // null clears; server owns clear semantics
363
+ if (descriptor.type === "string[]") {
364
+ if (!Array.isArray(value) || !value.every((v) => typeof v === "string")) {
365
+ return `[${descriptor.section}].${descriptor.key} must be an array of strings (got ${actual})`;
366
+ }
367
+ return null;
368
+ }
369
+ if (descriptor.type === "object") {
370
+ if (actual !== "object") {
371
+ return `[${descriptor.section}].${descriptor.key} must be a table (got ${actual})`;
372
+ }
373
+ return null;
374
+ }
375
+ if (actual !== descriptor.type) {
376
+ return `[${descriptor.section}].${descriptor.key} must be a ${descriptor.type} (got ${actual})`;
377
+ }
378
+ return null;
379
+ }
380
+ /**
381
+ * Build one `app.toml` section object from server settings (pull direction).
382
+ * Applies each field's `emit` rule; a `null` value is always omitted (TOML
383
+ * cannot encode null).
384
+ */
385
+ export function serializeSection(settings, section) {
386
+ const out = {};
387
+ for (const d of DESCRIPTOR_BY_SECTION.get(section) ?? []) {
388
+ const value = settings[d.field];
389
+ if (value === null || value === undefined)
390
+ continue;
391
+ if (d.emit === "whenSet" && isEmptyForEmit(value, d.type))
392
+ continue;
393
+ out[d.key] = value;
394
+ }
395
+ return out;
396
+ }
397
+ /**
398
+ * Build the full `app.toml` data object (all sections) from server settings.
399
+ * Empty sections are omitted, though in practice every section has at least one
400
+ * `emit: "always"` key so all four are present.
401
+ */
402
+ export function serializeAppSettingsToToml(settings) {
403
+ const data = {};
404
+ for (const section of APP_SETTINGS_SECTIONS) {
405
+ const obj = serializeSection(settings, section);
406
+ if (Object.keys(obj).length > 0)
407
+ data[section] = obj;
408
+ }
409
+ return data;
410
+ }
411
+ /**
412
+ * Is `[app].name` out of this call entirely? ONE reading of the two spellings
413
+ * the callers use (#2936), so the parse and the payload can never disagree
414
+ * about whether the field is in play: `isCrossAppPush` is the raw cross-app
415
+ * determination, `excludeName` the already-computed answer from
416
+ * `appSettingsNameExcluded` (which also covers the recorded-exclusion case).
417
+ */
418
+ function appSettingsNameStripped(options) {
419
+ return !!(options.isCrossAppPush || options.excludeName);
420
+ }
421
+ /**
422
+ * Translate a parsed `app.toml` object into the settings the FILE STATES —
423
+ * only the keys it carries. This is the parse half; `buildAppSettingsPayload`
424
+ * below turns it into the whole-truth `PUT /settings` body by filling in what
425
+ * the file omits. An unrecognized key or table and a type
426
+ * mismatch are both hard errors the caller must treat as abort-before-PUT
427
+ * (#2644 criterion 6: push rejects what it does not recognize, for every
428
+ * configuration surface, so a typo fails locally instead of being ignored).
429
+ *
430
+ * A per-entry `clientSecret` that is not a whole `{{secrets.KEY}}` reference is
431
+ * the server's rejection to make (#2256): the push forwards the map and the
432
+ * `PUT` answers 400 with `GOOGLE_CLIENT_SECRET_MUST_BE_SECRET_REF`. Duplicating
433
+ * the shape rule here would put two definitions of "valid reference" in play.
434
+ *
435
+ * A RETIRED key (#2891) is different: it is not a value the server can judge,
436
+ * it is a line that has to be deleted, so the parser refuses it locally with
437
+ * the guidance that names its replacement.
438
+ *
439
+ * `isCrossAppPush` — or `excludeName`, the same rule as the caller computed it
440
+ * (#2880 DSO-001, `appSettingsNameExcluded`) — strips `name` so a cross-app
441
+ * push never overwrites the target app's name. The strip has to happen HERE and
442
+ * not only in the payload builder below (#2936): a field the body will not
443
+ * carry is not a field this file gets to refuse, or a slot bound to another app
444
+ * aborts diff and push over a `[app].name` neither of them was going to send.
445
+ */
446
+ export function parseTomlToAppSettings(tomlData, options = {}) {
447
+ const excludeName = appSettingsNameStripped(options);
448
+ const settings = {};
449
+ const warnings = [];
450
+ const errors = [];
451
+ // #2644 criterion 6 — a top-level table the definition does not declare is a
452
+ // hard error, the same posture every per-entity file has. Silently ignoring
453
+ // it made a typo'd header (`[curs]`) push as though the section it meant were
454
+ // absent, so the settings it carried were never applied.
455
+ for (const key of findUnknownDocumentKeys(tomlData, APP_SETTINGS_SURFACE)) {
456
+ errors.push(`app.toml: unrecognized top-level table [${key}]. Check the spelling ` +
457
+ `against the tables app.toml accepts (${APP_SETTINGS_SECTIONS.map((s) => `[${s}]`).join(", ")}), or upgrade the CLI if the server is newer than this one.`);
458
+ }
459
+ for (const section of APP_SETTINGS_SECTIONS) {
460
+ const sectionData = tomlData?.[section];
461
+ if (sectionData === undefined || sectionData === null)
462
+ continue;
463
+ if (typeof sectionData !== "object" || Array.isArray(sectionData)) {
464
+ errors.push(`[${section}] must be a table`);
465
+ continue;
466
+ }
467
+ const descriptors = DESCRIPTOR_BY_SECTION.get(section) ?? [];
468
+ const byKey = new Map(descriptors.map((d) => [d.key, d]));
469
+ for (const key of Object.keys(sectionData)) {
470
+ const d = byKey.get(key);
471
+ if (!d) {
472
+ // A RETIRED key is not an unknown key (#2803's rule, extended to
473
+ // app-settings by #2891/DSO-2891-005). "Check the spelling, or upgrade
474
+ // the CLI" is exactly backwards for a key the platform removed on
475
+ // purpose, and every pre-reshape `app.toml` still carries these lines —
476
+ // so the parser consults the shared retired set directly and says where
477
+ // the value moved to. Keyed under `app`, the app-settings surface's
478
+ // identifier, whichever section the key was authored in.
479
+ const retired = retiredConfigKey("app", key);
480
+ if (retired) {
481
+ errors.push(`app.toml: [${section}].${key} — ${retired.toml}`);
482
+ continue;
483
+ }
484
+ // #2644 criterion 6 — REJECTED, not warned-and-ignored. `app.toml` is a
485
+ // registered configuration surface like every other file, and an
486
+ // ignored key is a setting the author believes they changed.
487
+ errors.push(`app.toml: unrecognized key [${section}].${key}. Remove it or ` +
488
+ `upgrade the CLI if the server is newer than this one. ` +
489
+ `Recognized keys: ${descriptors.map((x) => x.key).join(", ")}.`);
490
+ continue;
491
+ }
492
+ if (excludeName && d.field === "name")
493
+ continue;
494
+ const value = sectionData[key];
495
+ const err = typeError(d, value);
496
+ if (err) {
497
+ errors.push(err);
498
+ continue;
499
+ }
500
+ settings[d.field] = value;
501
+ }
502
+ }
503
+ return { settings, warnings, errors };
504
+ }
505
+ /**
506
+ * `[app].name` / `[app].mode` absent — the two keys whole-truth push refuses to
507
+ * fill in for the author (#2880).
508
+ *
509
+ * Read from the DOCUMENT rather than the parse result, so a cross-app push
510
+ * (which strips `name` before validating) still requires the file to state one.
511
+ * `mode` has no default and `mode: null` is a 400; more to the point, a deleted
512
+ * `mode` line silently resetting an invite-only app to public is the wrong
513
+ * failure to choose.
514
+ */
515
+ export function missingRequiredKeyErrors(tomlData) {
516
+ const errors = [];
517
+ for (const field of REQUIRED_APP_SETTING_FIELDS) {
518
+ const d = APP_SETTINGS_DESCRIPTOR.find((x) => x.field === field);
519
+ if (!d)
520
+ continue;
521
+ const section = tomlData?.[d.section];
522
+ const present = section !== null &&
523
+ typeof section === "object" &&
524
+ !Array.isArray(section) &&
525
+ section[d.key] !== undefined;
526
+ if (present)
527
+ continue;
528
+ errors.push(`app.toml: [${d.section}].${d.key} is required — \`config push\` applies ` +
529
+ `app.toml as the whole truth, and this field has no default to fall ` +
530
+ `back to. Add the line (\`config pull --only app\` writes it).`);
531
+ }
532
+ return errors;
533
+ }
534
+ /**
535
+ * The whole-truth `PUT /settings` body (#2880 criterion 4).
536
+ *
537
+ * Every writable field gets a value: the authored one where the file carries
538
+ * the key, its `APP_SETTINGS_ABSENT_VALUES` entry where it does not. That is
539
+ * what makes `app.toml` mean what every other configuration file means — the
540
+ * local file is the state, not a patch over whatever the server happens to
541
+ * hold (#1567). The controller applies only the keys in the body (`if (field in
542
+ * updates)`), so the completeness has to come from here.
543
+ *
544
+ * Values are forwarded AS AUTHORED, never canonicalized: the server owns its
545
+ * own normalization, and a CLI that rewrote the value before sending it would
546
+ * be pushing something the operator did not write. The canonicalization in
547
+ * `canonicalizeAppSettingValue` is for the local COMPARISON only.
548
+ *
549
+ * `excludeName` (and `isCrossAppPush`, which implies it) leaves `name` out of
550
+ * the body entirely, so a cross-app push never renames the target app.
551
+ */
552
+ export function buildAppSettingsPayload(tomlData, options = {}) {
553
+ const parsed = parseTomlToAppSettings(tomlData, options);
554
+ const errors = [...parsed.errors, ...missingRequiredKeyErrors(tomlData)];
555
+ if (errors.length > 0) {
556
+ return { settings: {}, warnings: parsed.warnings, errors };
557
+ }
558
+ const excludeName = appSettingsNameStripped(options);
559
+ const settings = {};
560
+ for (const d of APP_SETTINGS_DESCRIPTOR) {
561
+ if (excludeName && d.field === "name")
562
+ continue;
563
+ if (d.field in parsed.settings) {
564
+ settings[d.field] = parsed.settings[d.field];
565
+ continue;
566
+ }
567
+ const absent = appSettingAbsentValue(d.field);
568
+ // Required fields never reach here — their absence already errored above.
569
+ if (absent.required === true)
570
+ continue;
571
+ settings[d.field] = absent.value;
572
+ }
573
+ return { settings, warnings: parsed.warnings, errors: [] };
574
+ }
575
+ //# sourceMappingURL=app-settings-descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-settings-descriptor.js","sourceRoot":"","sources":["../../../src/lib/app-settings-descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAA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AAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Credentials } from "../types/index.js";
2
+ interface AuthResult {
3
+ success: boolean;
4
+ credentials?: Credentials;
5
+ error?: string;
6
+ }
7
+ export declare function browserLogin(serverUrl: string): Promise<AuthResult>;
8
+ export {};
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Shared helpers for the CLI's batch-import commands
3
+ * (`databases import` and `databases import-csv`).
4
+ */
5
+ /** Split an array into fixed-size chunks. */
6
+ export declare function chunk<T>(items: T[], size: number): T[][];
7
+ export interface ParseBatchSizeOptions {
8
+ /** Largest batch size the caller will accept. */
9
+ max: number;
10
+ /** Message shown when the value exceeds `max`. */
11
+ overMaxMessage: string;
12
+ }
13
+ /**
14
+ * Parse and validate a `--batch-size` flag value.
15
+ *
16
+ * Returns the parsed integer on success, or a human-readable error message
17
+ * on failure (non-integer, `< 1`, or over the caller's ceiling). Callers
18
+ * decide how to surface the error — typically `error(msg); process.exit(1)`.
19
+ * Validating up front means a bad `--batch-size` fails before any write, so
20
+ * there are no partial imports.
21
+ */
22
+ export declare function parseBatchSize(raw: string, opts: ParseBatchSizeOptions): {
23
+ value: number;
24
+ } | {
25
+ error: string;
26
+ };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Shared helpers for the CLI's batch-import commands
3
+ * (`databases import` and `databases import-csv`).
4
+ */
5
+ /** Split an array into fixed-size chunks. */
6
+ export function chunk(items, size) {
7
+ const out = [];
8
+ for (let i = 0; i < items.length; i += size) {
9
+ out.push(items.slice(i, i + size));
10
+ }
11
+ return out;
12
+ }
13
+ /**
14
+ * Parse and validate a `--batch-size` flag value.
15
+ *
16
+ * Returns the parsed integer on success, or a human-readable error message
17
+ * on failure (non-integer, `< 1`, or over the caller's ceiling). Callers
18
+ * decide how to surface the error — typically `error(msg); process.exit(1)`.
19
+ * Validating up front means a bad `--batch-size` fails before any write, so
20
+ * there are no partial imports.
21
+ */
22
+ export function parseBatchSize(raw, opts) {
23
+ const n = Number(raw);
24
+ if (!Number.isInteger(n) || n < 1) {
25
+ return { error: "--batch-size must be a positive integer." };
26
+ }
27
+ if (n > opts.max) {
28
+ return { error: opts.overMaxMessage };
29
+ }
30
+ return { value: n };
31
+ }
32
+ //# sourceMappingURL=batch.js.map