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,1936 @@
1
+ import { type ListEnvelope } from "./paginate.js";
2
+ /**
3
+ * Metadata for a single bucket blob, as returned by the metadata endpoint
4
+ * `GET blob-buckets/:bucketId/blobs/:blobId/metadata`. Mirrors the published
5
+ * JS client's `BlobInfo` shape.
6
+ */
7
+ export interface BlobInfo {
8
+ blobId: string;
9
+ bucketId: string;
10
+ filename: string | null;
11
+ contentType: string | null;
12
+ numBytes: number;
13
+ sha256: string | null;
14
+ tags: string[];
15
+ createdBy: string | null;
16
+ uploaded?: string | null;
17
+ etag?: string | null;
18
+ }
19
+ export declare class ApiError extends Error {
20
+ statusCode: number;
21
+ code?: string;
22
+ /**
23
+ * Structured `details` payload from `corsErrorResponse`.
24
+ *
25
+ * The server's error envelope can emit `details` as either:
26
+ * - an array of validation issues (e.g. `[{ path, message }, ...]`) —
27
+ * this is what most legacy endpoints produce, and what sync.ts walks
28
+ * via `Array.isArray(err.details)` / `for (const detail of ...)`.
29
+ * - a record of structured offender fields (e.g. `{ refs, operations,
30
+ * opCount, line, column, ... }`) — emitted by the issue #666 schema
31
+ * gate and consumed by the typed exception subclasses below.
32
+ *
33
+ * Callers must narrow before use: `Array.isArray(err.details)` for the
34
+ * legacy shape, otherwise treat as `Record<string, any>`.
35
+ */
36
+ details?: unknown[] | Record<string, any>;
37
+ constructor(message: string, statusCode: number, code?: string, details?: unknown[] | Record<string, any>);
38
+ }
39
+ export declare class ConflictError extends ApiError {
40
+ serverModifiedAt: string;
41
+ expectedModifiedAt: string;
42
+ constructor(message: string, serverModifiedAt: string, expectedModifiedAt: string, details?: Record<string, any>);
43
+ }
44
+ /**
45
+ * Parsed shape of a non-OK HTTP response body.
46
+ *
47
+ * The server's standard error envelope (corsErrorResponse, `src/utils.ts:348`)
48
+ * writes the message to `error`. A handful of bespoke endpoints (ConflictError,
49
+ * integrations proxy) use `message`. This helper reads both fields so all CLI
50
+ * call sites surface the real server message instead of `HTTP <status>`.
51
+ *
52
+ * `htmlNotFound` is set when the body looks like an HTML 404 page (typically
53
+ * served when an API path is wrong); callers can use it to throw a clearer
54
+ * "API endpoint not found" message regardless of the original status code.
55
+ *
56
+ * `details` can be either an array (legacy validation-issue list) or a
57
+ * structured record (issue #666 schema gate); the schema-feature errors
58
+ * below need the record shape, while the legacy `for (const detail of ...)`
59
+ * walkers in sync.ts assume the array shape.
60
+ */
61
+ export interface ParsedErrorResponse {
62
+ message: string;
63
+ code?: string;
64
+ details?: unknown[] | Record<string, any>;
65
+ /** True when the response body is an HTML error page (e.g. wrong API path). */
66
+ htmlNotFound?: boolean;
67
+ /** Raw parsed JSON envelope (or `undefined` for non-JSON bodies). */
68
+ raw?: any;
69
+ }
70
+ /**
71
+ * Extract a human-readable error message + structured fields from a non-OK
72
+ * HTTP response body. Single source of truth used by every error-handler call
73
+ * site in this file (see issue #684).
74
+ */
75
+ export declare function parseErrorResponse(response: {
76
+ status: number;
77
+ }, text: string, path?: string): ParsedErrorResponse;
78
+ /**
79
+ * Typed exception classes for the database-schema feature (issue #666).
80
+ * Each maps 1:1 to a server `code` value emitted from the op-edit or
81
+ * schema-edit gate. They all extend ApiError so existing catch-all paths
82
+ * continue to work; specialized catch blocks can branch on `instanceof`.
83
+ *
84
+ * Per round-2 addendum A1, `details` is always preserved so callers can
85
+ * extract structured offender lists (refs[], operations[], etc.).
86
+ */
87
+ export declare class SchemaRequiredError extends ApiError {
88
+ constructor(message: string, details?: Record<string, any>);
89
+ }
90
+ export declare class OperationRefError extends ApiError {
91
+ constructor(message: string, details?: Record<string, any>);
92
+ get refs(): Array<{
93
+ ref: string;
94
+ location: string;
95
+ }>;
96
+ }
97
+ export declare class SchemaBreaksOpsError extends ApiError {
98
+ constructor(message: string, details?: Record<string, any>);
99
+ get operations(): Array<{
100
+ operation: string;
101
+ refs: Array<{
102
+ ref: string;
103
+ location: string;
104
+ }>;
105
+ }>;
106
+ }
107
+ export declare class SchemaHasUncheckableOpsError extends ApiError {
108
+ constructor(message: string, details?: Record<string, any>);
109
+ get operations(): Array<{
110
+ operation: string;
111
+ locations: string[];
112
+ }>;
113
+ }
114
+ export declare class TomlParseError extends ApiError {
115
+ constructor(message: string, details?: Record<string, any>);
116
+ get line(): number | undefined;
117
+ get column(): number | undefined;
118
+ }
119
+ export declare class OpsExistError extends ApiError {
120
+ constructor(message: string, details?: Record<string, any>);
121
+ get opCount(): number;
122
+ }
123
+ interface EmailTemplateSummary {
124
+ emailType: string;
125
+ label: string;
126
+ description: string;
127
+ hasOverride: boolean;
128
+ modifiedAt: string | null;
129
+ }
130
+ interface EmailTemplateDetail {
131
+ emailType: string;
132
+ label: string;
133
+ description: string;
134
+ hasOverride: boolean;
135
+ override: {
136
+ templateId: string;
137
+ subject: string;
138
+ htmlBody: string;
139
+ textBody: string;
140
+ createdAt: string;
141
+ modifiedAt: string;
142
+ } | null;
143
+ default: {
144
+ subject: string;
145
+ htmlBody: string;
146
+ textBody: string;
147
+ };
148
+ variables: {
149
+ name: string;
150
+ required: boolean;
151
+ description: string;
152
+ }[];
153
+ }
154
+ interface EmailTemplateUpsertResult {
155
+ emailType: string;
156
+ templateId: string;
157
+ subject: string;
158
+ htmlBody: string;
159
+ textBody: string;
160
+ createdAt: string;
161
+ modifiedAt: string;
162
+ warnings: string[];
163
+ }
164
+ interface AnalyticsTiming {
165
+ total_ms: number;
166
+ wae_queries: number[];
167
+ }
168
+ interface AnalyticsMetricResponse {
169
+ value: number;
170
+ previous: number;
171
+ deltaPct: number;
172
+ _timing: AnalyticsTiming;
173
+ }
174
+ interface AnalyticsGrowthResponse {
175
+ window_days: number;
176
+ retained_users: number;
177
+ new_users: number;
178
+ reactivated_users: number;
179
+ churned_users: number;
180
+ current_active: number;
181
+ previous_active: number;
182
+ deltaPct: number;
183
+ _timing: AnalyticsTiming;
184
+ }
185
+ interface AnalyticsDailyActivePoint {
186
+ day_ts: number;
187
+ day_label: string;
188
+ active_users: number;
189
+ }
190
+ interface AnalyticsDailyActiveResponse {
191
+ window_days: number;
192
+ rows: AnalyticsDailyActivePoint[];
193
+ _timing: AnalyticsTiming;
194
+ }
195
+ interface AnalyticsCohortRow {
196
+ signup_week: number;
197
+ signup_week_label: string;
198
+ cohort_size: number;
199
+ retention: (number | null)[];
200
+ }
201
+ interface AnalyticsCohortResponse {
202
+ weeks: number[];
203
+ rows: AnalyticsCohortRow[];
204
+ averages: (number | null)[];
205
+ _timing: AnalyticsTiming;
206
+ }
207
+ interface AnalyticsUserSummary {
208
+ userUlid: string;
209
+ email: string | null;
210
+ name: string | null;
211
+ firstSeen: string;
212
+ lastSeen: string;
213
+ eventCount: number;
214
+ }
215
+ interface AnalyticsTopUsersResponse {
216
+ windowDays: number;
217
+ limit: number;
218
+ results: AnalyticsUserSummary[];
219
+ _timing: AnalyticsTiming;
220
+ }
221
+ interface AnalyticsUserSearchResponse {
222
+ query: string;
223
+ limit: number;
224
+ results: AnalyticsUserSummary[];
225
+ }
226
+ interface AnalyticsUserDetailResponse {
227
+ user: {
228
+ user_ulid: string;
229
+ email: string | null;
230
+ name: string | null;
231
+ };
232
+ stats: {
233
+ first_seen: string | null;
234
+ last_active: string | null;
235
+ total_events: number;
236
+ days_active: number;
237
+ };
238
+ events_by_action: Array<{
239
+ action: string;
240
+ event_count: number;
241
+ last_occurred: string;
242
+ }>;
243
+ events_by_feature: Array<{
244
+ feature: string;
245
+ event_count: number;
246
+ pct: number;
247
+ }>;
248
+ _timing: AnalyticsTiming;
249
+ }
250
+ interface AnalyticsUserSnapshotResponse {
251
+ snapshot: {
252
+ timestamp: string;
253
+ values: unknown;
254
+ } | null;
255
+ _timing: AnalyticsTiming;
256
+ }
257
+ interface AnalyticsEventRow {
258
+ timestamp: string;
259
+ user_ulid: string;
260
+ action: string;
261
+ feature: string;
262
+ route: string;
263
+ country: string;
264
+ }
265
+ interface AnalyticsEventsResponse {
266
+ page: number;
267
+ page_size: number;
268
+ total_rows: number;
269
+ rows: AnalyticsEventRow[];
270
+ _timing: AnalyticsTiming;
271
+ }
272
+ interface AnalyticsGroupedRow {
273
+ group_value: string;
274
+ raw_group_value: string;
275
+ events: number;
276
+ unique_users: number;
277
+ }
278
+ interface AnalyticsEventsGroupedResponse {
279
+ group_by: string;
280
+ rows: AnalyticsGroupedRow[];
281
+ _timing: AnalyticsTiming;
282
+ }
283
+ interface AnalyticsErrorGroupExemplar {
284
+ message: string;
285
+ action: string;
286
+ scope_key: string;
287
+ step_id: string | null;
288
+ run_id: string | null;
289
+ at: string;
290
+ }
291
+ interface AnalyticsErrorGroupRow {
292
+ fingerprint: string;
293
+ normalized_title: string;
294
+ source: string;
295
+ status_class: string;
296
+ total: number;
297
+ daily: Array<{
298
+ day: string;
299
+ count: number;
300
+ }>;
301
+ /** First/last occurrence in the window (ISO-8601). */
302
+ first_seen: string | null;
303
+ last_seen: string | null;
304
+ /** A raw sample of the failure, or null when no sampled row carried one
305
+ * (events written before the exemplar shipped, or a starved group). */
306
+ exemplar: AnalyticsErrorGroupExemplar | null;
307
+ }
308
+ interface AnalyticsErrorsGroupsResponse {
309
+ window_days: number;
310
+ rows: AnalyticsErrorGroupRow[];
311
+ _timing: AnalyticsTiming;
312
+ }
313
+ /**
314
+ * What a `DELETE` on a status-carrying object answers (#2887, #2907).
315
+ *
316
+ * The plain call archives and `?hard=true` destroys, and the envelope says
317
+ * which happened. Four of the five methods below were declared `Promise<void>`
318
+ * while returning this at runtime, so `primitive <noun> archive --json` printed
319
+ * a value TypeScript believed did not exist. The fields are optional because
320
+ * the cron route answers the shorter `{ archived: true }` — no `success`, and
321
+ * no key — which is why the archive commands identify the object by the id the
322
+ * operator passed rather than by anything the envelope carries.
323
+ */
324
+ export interface ArchiveEnvelope {
325
+ success?: boolean;
326
+ hardDeleted?: boolean;
327
+ archived?: boolean;
328
+ [key: string]: unknown;
329
+ }
330
+ /**
331
+ * Body accepted by integration create and update (#2631).
332
+ *
333
+ * `accessRule` is the CEL expression gating who may invoke the integration
334
+ * through the proxy. The server REQUIRES it on create; on update, `null` or
335
+ * `""` clears it, and a cleared rule denies every non-admin call.
336
+ */
337
+ export interface IntegrationWritePayload {
338
+ integrationKey?: string;
339
+ displayName?: string;
340
+ description?: string | null;
341
+ requestConfig?: any;
342
+ timeoutMs?: number;
343
+ status?: string;
344
+ accessRule?: string | null;
345
+ }
346
+ /**
347
+ * Integration detail response. `accessRule` is only on the detail — the list
348
+ * summary does not carry it (#2631).
349
+ */
350
+ export interface IntegrationDetail {
351
+ integrationId: string;
352
+ integrationKey: string;
353
+ displayName?: string;
354
+ description?: string | null;
355
+ status?: string;
356
+ timeoutMs?: number;
357
+ requestConfig?: any;
358
+ accessRule?: string | null;
359
+ modifiedAt?: string;
360
+ [key: string]: any;
361
+ }
362
+ interface AnalyticsIntegrationMetric {
363
+ integrationKey: string;
364
+ invocations: number;
365
+ errorRate: number;
366
+ medianDurationMs: number;
367
+ p95DurationMs: number;
368
+ }
369
+ interface AnalyticsIntegrationMetricsResponse {
370
+ windowDays: number;
371
+ integrations: AnalyticsIntegrationMetric[];
372
+ _timing: AnalyticsTiming;
373
+ }
374
+ interface WorkflowAnalyticsSummary {
375
+ workflowKey: string;
376
+ runs: number;
377
+ successRate: number;
378
+ medianDurationMs: number;
379
+ p95: number;
380
+ totalTokens: number;
381
+ }
382
+ interface TopWorkflowsResponse {
383
+ windowDays: number;
384
+ limit: number;
385
+ workflows: WorkflowAnalyticsSummary[];
386
+ _timing: AnalyticsTiming;
387
+ }
388
+ interface PromptAnalyticsSummary {
389
+ promptKey: string;
390
+ executions: number;
391
+ medianDurationMs: number;
392
+ p95DurationMs: number;
393
+ totalTokens: number;
394
+ }
395
+ interface TopPromptsResponse {
396
+ windowDays: number;
397
+ limit: number;
398
+ prompts: PromptAnalyticsSummary[];
399
+ _timing: AnalyticsTiming;
400
+ }
401
+ /**
402
+ * One operation in a `records/batch` request. Mirrors the wire shape the
403
+ * DatabaseDO expects (`databases-controller.ts`): `{ op, modelName, id, data }`.
404
+ * `data` is required for `save`/`patch` and omitted for `delete`.
405
+ */
406
+ export interface DatabaseBatchOperation {
407
+ op: "save" | "patch" | "delete";
408
+ modelName: string;
409
+ id: string;
410
+ data?: any;
411
+ /**
412
+ * Strict create: the DatabaseDO fails the op with a 409 `ALREADY_EXISTS` when
413
+ * the id is already present, instead of `save`'s upsert merge. Checked inside
414
+ * the batch transaction, so under `atomic` it rolls the whole batch back.
415
+ */
416
+ ifNotExists?: boolean;
417
+ /**
418
+ * Per-op guard evaluated inside the batch transaction — a mismatch is a 409
419
+ * `CONDITION_NOT_MET`, and under `atomic` it rolls the whole batch back. This
420
+ * is what the documents surface calls a `precondition`.
421
+ */
422
+ condition?: Record<string, any>;
423
+ }
424
+ /**
425
+ * Normalize a `databases operations execute` result to the CLI's one list
426
+ * envelope — but only when the result is a Durable Object query page
427
+ * (issue #2440).
428
+ *
429
+ * A registered operation is a list only sometimes. Of the shapes the server's
430
+ * operation dispatch can return, exactly two carry a top-level `data` array: a
431
+ * bare `query` and a `pipeline` whose `returnField` names a query step. A
432
+ * `count` (`{ count }`), an `aggregate` (`{ result }`), a mutation
433
+ * (`{ results }`), an `applyToQuery` (`{ matched, affected, failed, … }`) and a
434
+ * `returnField: "all"` pipeline (`{ steps: { … } }`) do not, so blanket
435
+ * normalization would corrupt them. This helper therefore tests the shape
436
+ * first and passes everything else through byte-for-byte — including the
437
+ * nested steps of a `returnField: "all"` pipeline, which are operation-defined
438
+ * objects the CLI must not reach into.
439
+ *
440
+ * Deliberately narrow, not a general-purpose predicate: the contract is
441
+ * specifically "an operations-execute result may be a DO query page".
442
+ * `executeDatabaseOperation()` is the only caller.
443
+ *
444
+ * The conversion itself is delegated to `normalizeCliListEnvelope()` so cursor
445
+ * handling, `prevCursor` dropping and `hasMore` derivation have exactly one
446
+ * implementation. That helper throws on an unrecognized shape — correct when
447
+ * the payload is supposed to be a list, wrong here, where the payload is the
448
+ * caller's own result — which is why the shape test has to run first. `_timing`
449
+ * (`--timing`) is re-attached afterwards, since it rides alongside the envelope
450
+ * rather than inside it.
451
+ */
452
+ export declare function normalizeDatabaseOperationResult(raw: unknown): unknown;
453
+ export declare class ApiClient {
454
+ private credentials;
455
+ constructor();
456
+ private ensureAuthenticated;
457
+ private refreshToken;
458
+ request<T = any>(path: string, options?: RequestInit): Promise<T>;
459
+ get<T = any>(path: string, params?: Record<string, any>): Promise<T>;
460
+ post<T = any>(path: string, body?: any): Promise<T>;
461
+ put<T = any>(path: string, body?: any): Promise<T>;
462
+ patch<T = any>(path: string, body?: any): Promise<T>;
463
+ delete<T = any>(path: string): Promise<T>;
464
+ listApps(): Promise<{
465
+ apps: Array<{
466
+ id: string;
467
+ name: string;
468
+ role?: string;
469
+ }>;
470
+ }>;
471
+ createApp(data: {
472
+ name: string;
473
+ initialAdminEmail?: string;
474
+ }): Promise<any>;
475
+ getApp(appId: string): Promise<{
476
+ id: string;
477
+ name: string;
478
+ }>;
479
+ deleteApp(appId: string): Promise<void>;
480
+ getAppSettings(appId: string): Promise<any>;
481
+ updateAppSettings(appId: string, settings: any): Promise<any>;
482
+ addUserByEmail(appId: string, data: {
483
+ email: string;
484
+ role?: string;
485
+ }): Promise<any>;
486
+ mintTestJwt(appId: string, userId: string, role?: string): Promise<any>;
487
+ rebuildUserSearchText(appId: string): Promise<{
488
+ count: number;
489
+ }>;
490
+ listUsers(appId: string, params?: {
491
+ name?: string;
492
+ email?: string;
493
+ userId?: string;
494
+ limit?: number;
495
+ cursor?: string;
496
+ }): Promise<{
497
+ items: any[];
498
+ nextCursor?: string | null;
499
+ }>;
500
+ removeUser(appId: string, userId: string): Promise<void>;
501
+ /**
502
+ * #2803 — take a user's access away, or give it back. Distinct from
503
+ * `removeUser`, which detaches the membership: this blocks the person's auth
504
+ * in the app, revokes their sessions and tokens, and is reversible. Both
505
+ * routes already existed; nothing on the CLI reached them.
506
+ */
507
+ setUserAvailability(appId: string, userId: string, action: "enable" | "disable"): Promise<void>;
508
+ /**
509
+ * #2803 — the platform's feature flags. A server-owned admin toggle with a
510
+ * console but, until now, no CLI: the same "one control, both surfaces" rule
511
+ * the carrying types get.
512
+ */
513
+ listFeatureFlags(): Promise<any>;
514
+ /**
515
+ * The flag itself, not the `{ flag }` envelope the route answers with —
516
+ * `feature-flags get` prints the key, the enabled state and the per-app
517
+ * overrides, and reading them off the envelope printed a blank row.
518
+ */
519
+ getFeatureFlag(flagKey: string): Promise<any>;
520
+ /** Same envelope, same unwrap: `enable`/`disable` print the updated flag. */
521
+ setFeatureFlagEnabled(flagKey: string, enabled: boolean): Promise<any>;
522
+ updateUserRole(appId: string, userId: string, role: "admin" | "member"): Promise<any>;
523
+ transferOwnership(appId: string, newOwnerEmail: string): Promise<void>;
524
+ transferAdminOwnership(appId: string, adminId: string): Promise<any>;
525
+ listAppAdmins(appId: string): Promise<any[]>;
526
+ addAppAdmin(appId: string, data: {
527
+ adminEmail: string;
528
+ role?: string;
529
+ sendEmail?: boolean;
530
+ loginUrl?: string;
531
+ }): Promise<any>;
532
+ removeAppAdmin(appId: string, adminId: string): Promise<any>;
533
+ listAppAdminInvitations(appId: string): Promise<any[]>;
534
+ deleteAppAdminInvitation(appId: string, invitationId: string): Promise<any>;
535
+ transferDocumentOwnership(appId: string, documentId: string, newOwnerId: string): Promise<void>;
536
+ listInvitations(appId: string, params?: {
537
+ limit?: number;
538
+ cursor?: string;
539
+ }): Promise<{
540
+ items: any[];
541
+ nextCursor?: string;
542
+ hasMore?: boolean;
543
+ /** @deprecated Alias of `nextCursor` (#1316). */
544
+ cursor?: string;
545
+ }>;
546
+ createInvitation(appId: string, data: {
547
+ email: string;
548
+ role: "admin" | "member";
549
+ expiresInDays?: number;
550
+ sendEmail?: boolean;
551
+ note?: string;
552
+ }): Promise<any>;
553
+ deleteInvitation(appId: string, invitationId: string): Promise<void>;
554
+ listWaitlist(appId: string): Promise<any[]>;
555
+ inviteWaitlistEntry(appId: string, waitlistId: string, options?: {
556
+ sendEmail?: boolean;
557
+ signupUrl?: string;
558
+ }): Promise<any>;
559
+ bulkInviteWaitlist(appId: string, payload: {
560
+ waitlistIds?: string[];
561
+ count?: number;
562
+ sendEmail?: boolean;
563
+ signupUrl?: string;
564
+ }): Promise<any>;
565
+ removeWaitlistEntry(appId: string, waitlistId: string): Promise<void>;
566
+ listDeferredGrants(appId: string, params?: {
567
+ type?: string;
568
+ email?: string;
569
+ limit?: number;
570
+ cursor?: string;
571
+ }): Promise<{
572
+ grants: any[];
573
+ nextCursor?: string | null;
574
+ hasMore?: boolean;
575
+ }>;
576
+ revokeDeferredGrant(appId: string, deferredId: string, type: string): Promise<any>;
577
+ listIntegrations(appId: string, params?: {
578
+ status?: string;
579
+ cursor?: string;
580
+ limit?: number;
581
+ }): Promise<{
582
+ items: any[];
583
+ nextCursor?: string | null;
584
+ }>;
585
+ /** Integration detail (#2631: `accessRule` is on the detail, not the list summary). */
586
+ getIntegration(appId: string, integrationId: string): Promise<IntegrationDetail>;
587
+ /**
588
+ * An integration's named configs. Test cases pin a config by NAME so the
589
+ * sidecar is portable across apps (#2769); this is the map pull and push
590
+ * resolve that name through, the same way prompts/workflows/scripts do.
591
+ */
592
+ listIntegrationConfigs(appId: string, integrationId: string): Promise<{
593
+ items: any[];
594
+ }>;
595
+ createIntegration(appId: string, payload: IntegrationWritePayload): Promise<any>;
596
+ updateIntegration(appId: string, integrationId: string, payload: IntegrationWritePayload, expectedModifiedAt?: string): Promise<any>;
597
+ /**
598
+ * Delete an integration. Archives it by default; `{ hard: true }` destroys
599
+ * the row instead, which is what `config push --prune` passes (#2803) so a
600
+ * pruned integration stops holding its key. The positional boolean is still
601
+ * accepted for the existing callers.
602
+ */
603
+ deleteIntegration(appId: string, integrationId: string, hard?: boolean | {
604
+ hard?: boolean;
605
+ }): Promise<ArchiveEnvelope>;
606
+ testIntegration(appId: string, integrationId: string, payload: any): Promise<any>;
607
+ listIntegrationLogs(appId: string, integrationId: string, params?: {
608
+ limit?: number;
609
+ status?: string;
610
+ from?: string;
611
+ to?: string;
612
+ source?: "user" | "admin" | "test" | "workflow";
613
+ }): Promise<any[]>;
614
+ listWorkflowRunIntegrationLogs(appId: string, runId: string, params?: {
615
+ limit?: number;
616
+ }): Promise<any[]>;
617
+ listAppSecrets(appId: string): Promise<any[]>;
618
+ createAppSecret(appId: string, payload: {
619
+ key: string;
620
+ value: string;
621
+ summary?: string;
622
+ }): Promise<any>;
623
+ updateAppSecret(appId: string, secretId: string, payload: {
624
+ value?: string;
625
+ summary?: string;
626
+ }): Promise<any>;
627
+ upsertAppSecret(appId: string, key: string, payload: {
628
+ value: string;
629
+ summary?: string;
630
+ }): Promise<any>;
631
+ deleteAppSecret(appId: string, secretId: string): Promise<any>;
632
+ listAppConfigVars(appId: string): Promise<any[]>;
633
+ upsertAppConfigVar(appId: string, key: string, payload: {
634
+ value: string;
635
+ summary?: string;
636
+ }, expectedModifiedAt?: string, options?: {
637
+ expectNotExists?: boolean;
638
+ }): Promise<any>;
639
+ deleteAppConfigVar(appId: string, key: string, expectedModifiedAt?: string): Promise<any>;
640
+ listWebhooks(appId: string, params?: {
641
+ status?: string;
642
+ cursor?: string;
643
+ limit?: number;
644
+ }): Promise<{
645
+ items: any[];
646
+ nextCursor?: string | null;
647
+ }>;
648
+ getWebhook(appId: string, webhookId: string): Promise<any>;
649
+ createWebhook(appId: string, payload: any): Promise<any>;
650
+ updateWebhook(appId: string, webhookId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
651
+ /**
652
+ * Delete a webhook. Archives it by default; `hard` hard-deletes the row
653
+ * instead (#2232), which is what frees a slot under the per-app webhook cap
654
+ * and releases the webhook key for reuse. Same `?hard=true` verb the admin
655
+ * integrations delete uses.
656
+ */
657
+ deleteWebhook(appId: string, webhookId: string, options?: {
658
+ hard?: boolean;
659
+ }): Promise<ArchiveEnvelope>;
660
+ /**
661
+ * #2803 — the operational verb pair for a webhook. It posts to the
662
+ * enable/disable route rather than PATCHing `status`, which is server-owned
663
+ * and refused on every configuration write path.
664
+ */
665
+ setWebhookAvailability(appId: string, webhookId: string, action: "enable" | "disable"): Promise<any>;
666
+ /** #2803 — the operational verb pair for a prompt (admin API). */
667
+ setPromptAvailability(appId: string, promptId: string, action: "enable" | "disable"): Promise<any>;
668
+ /** #2803 — the operational verb pair for an integration (admin API). */
669
+ setIntegrationAvailability(appId: string, integrationId: string, action: "enable" | "disable"): Promise<any>;
670
+ rotateWebhookSecret(appId: string, webhookId: string, payload: {
671
+ signingSecret: string;
672
+ }): Promise<any>;
673
+ listWebhookEvents(appId: string, webhookId: string, params?: {
674
+ limit?: number;
675
+ cursor?: string;
676
+ }): Promise<{
677
+ items: any[];
678
+ hasMore?: boolean;
679
+ nextCursor?: string | null;
680
+ /** @deprecated Alias of `nextCursor` (#1316). */
681
+ cursor?: string | null;
682
+ }>;
683
+ /**
684
+ * List the live connections the server believes exist for exactly one of a
685
+ * document, user, or database. Read-only inspection over admin-api. Rows are
686
+ * per-connection-×-subscription bindings, so `connectionId` is not unique
687
+ * across rows. `params` on a database-subscription row is caller-defined
688
+ * bound CEL input — typed `unknown`.
689
+ */
690
+ listConnections(appId: string, selector: {
691
+ documentId?: string;
692
+ userId?: string;
693
+ databaseId?: string;
694
+ }, params?: {
695
+ limit?: number;
696
+ cursor?: string;
697
+ }): Promise<{
698
+ items: unknown[];
699
+ nextCursor?: string | null;
700
+ }>;
701
+ listSessions(appId: string, userId: string, params?: {
702
+ limit?: number;
703
+ cursor?: string;
704
+ }): Promise<{
705
+ items: unknown[];
706
+ nextCursor?: string | null;
707
+ }>;
708
+ testWebhook(appId: string, webhookId: string, payload?: any): Promise<any>;
709
+ /**
710
+ * Run a webhook's configured verifier over headers and a body captured from
711
+ * a real delivery, and report whether that signature checks out (#2445).
712
+ *
713
+ * `headers` is sent as ordered `[name, value]` pairs so a capture carrying a
714
+ * field name on more than one line survives the round trip. Nothing is
715
+ * delivered: no delivery record, no workflow run.
716
+ */
717
+ verifyWebhook(appId: string, webhookId: string, payload: {
718
+ headers: Array<[string, string]>;
719
+ rawBody?: string;
720
+ bodyBase64?: string;
721
+ }): Promise<any>;
722
+ listLocks(appId: string): Promise<{
723
+ locks: any[];
724
+ }>;
725
+ getLockStatus(appId: string, key: string): Promise<any>;
726
+ acquireLock(appId: string, key: string, ttlMs: number): Promise<any>;
727
+ releaseLock(appId: string, key: string, handleId: string): Promise<any>;
728
+ listCronTriggers(appId: string): Promise<{
729
+ items: any[];
730
+ }>;
731
+ getCronTrigger(appId: string, triggerId: string): Promise<any>;
732
+ createCronTrigger(appId: string, payload: any): Promise<any>;
733
+ updateCronTrigger(appId: string, triggerId: string, payload: any): Promise<any>;
734
+ /**
735
+ * Retire a cron trigger. The default soft-deletes (writes the `archived`
736
+ * tombstone); `{ hard: true }` destroys the row, which is what
737
+ * `config push --prune` passes (#2803) so a pruned trigger stops consuming
738
+ * the per-app cap and holding its key.
739
+ */
740
+ deleteCronTrigger(appId: string, triggerId: string, options?: {
741
+ hard?: boolean;
742
+ }): Promise<ArchiveEnvelope>;
743
+ disableCronTrigger(appId: string, triggerId: string): Promise<any>;
744
+ enableCronTrigger(appId: string, triggerId: string): Promise<any>;
745
+ testCronTrigger(appId: string, triggerId: string): Promise<any>;
746
+ listIterations(appId: string): Promise<{
747
+ items: any[];
748
+ }>;
749
+ getIteration(appId: string, iterationName: string): Promise<any>;
750
+ resetIteration(appId: string, iterationName: string): Promise<any>;
751
+ readResourceMetadata(appId: string, resourceType: string, resourceId: string, category: string): Promise<any>;
752
+ writeResourceMetadata(appId: string, resourceType: string, resourceId: string, category: string, data: Record<string, any>): Promise<any>;
753
+ batchReadResourceMetadata(appId: string, requests: Array<{
754
+ resourceType: string;
755
+ resourceId: string;
756
+ categories: string[];
757
+ }>): Promise<{
758
+ results: any[];
759
+ }>;
760
+ /**
761
+ * List every stored metadata category on one resource (issue #1402 — debug
762
+ * tooling). The CLI authenticates as a console admin, so the app-level
763
+ * owner/admin bypass returns every category regardless of its readRule.
764
+ */
765
+ listResourceMetadata(appId: string, resourceType: string, resourceId: string): Promise<{
766
+ resourceType: string;
767
+ resourceId: string;
768
+ categories: Array<{
769
+ category: string;
770
+ data: Record<string, any>;
771
+ schemaVersion: number | null;
772
+ }>;
773
+ }>;
774
+ /**
775
+ * Delete one resource's metadata for one category (issue #1402 — debug
776
+ * tooling). Idempotent: deleting an absent item succeeds with
777
+ * `deleted: false` rather than a 404.
778
+ */
779
+ deleteResourceMetadata(appId: string, resourceType: string, resourceId: string, category: string): Promise<{
780
+ resourceType: string;
781
+ resourceId: string;
782
+ category: string;
783
+ deleted: boolean;
784
+ }>;
785
+ /**
786
+ * Reverse-resolve a resource by a category's unique metadata value (issue
787
+ * #2137). A miss is a success with `resourceId: null`, never an error. The
788
+ * CLI authenticates as a console admin, so the app-level owner/admin bypass
789
+ * skips readRule evaluation.
790
+ */
791
+ resolveResourceMetadata(appId: string, resourceType: string, category: string, key: string, value: string): Promise<{
792
+ resourceId: string | null;
793
+ resourceType?: string;
794
+ }>;
795
+ listPrompts(appId: string, params?: {
796
+ status?: string;
797
+ limit?: number;
798
+ cursor?: string;
799
+ }): Promise<{
800
+ items: any[];
801
+ nextCursor?: string | null;
802
+ }>;
803
+ getPrompt(appId: string, promptId: string): Promise<any>;
804
+ createPrompt(appId: string, payload: any): Promise<any>;
805
+ updatePrompt(appId: string, promptId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
806
+ /**
807
+ * Retire a prompt, or destroy it.
808
+ *
809
+ * `hard` was always sent by both first-party clients and always ignored by
810
+ * the server; #2887 made it mean something — the plain call now archives.
811
+ */
812
+ deletePrompt(appId: string, promptId: string, hard?: boolean): Promise<ArchiveEnvelope>;
813
+ executePrompt(appId: string, promptId: string, payload: {
814
+ variables: Record<string, any>;
815
+ modelOverride?: string;
816
+ configId?: string;
817
+ }): Promise<any>;
818
+ previewPrompt(appId: string, promptId: string, payload: {
819
+ variables: Record<string, any>;
820
+ configId?: string;
821
+ }): Promise<any>;
822
+ listPromptConfigs(appId: string, promptId: string): Promise<{
823
+ items: any[];
824
+ }>;
825
+ getPromptConfig(appId: string, promptId: string, configId: string): Promise<any>;
826
+ createPromptConfig(appId: string, promptId: string, payload: any): Promise<any>;
827
+ updatePromptConfig(appId: string, promptId: string, configId: string, payload: any): Promise<any>;
828
+ activatePromptConfig(appId: string, promptId: string, configId: string): Promise<any>;
829
+ duplicatePromptConfig(appId: string, promptId: string, configId: string, payload?: {
830
+ configName?: string;
831
+ description?: string;
832
+ }): Promise<any>;
833
+ listScripts(appId: string): Promise<{
834
+ items: any[];
835
+ }>;
836
+ getScript(appId: string, scriptId: string): Promise<any>;
837
+ /**
838
+ * List a script's versioned configs (the `ScriptConfig` rows). Each config
839
+ * is a distinct block version: `configId` is the stable version selector,
840
+ * `contentHash` is its content identity, and `status` reports whether it is
841
+ * `active`/`draft`/`archived`. The script header's `activeConfigId` names
842
+ * the live version. Used by `scripts configs list` and by the script test
843
+ * commands to run against a specific pinned version.
844
+ */
845
+ listScriptConfigs(appId: string, scriptId: string): Promise<{
846
+ items: any[];
847
+ }>;
848
+ createScript(appId: string, payload: {
849
+ name: string;
850
+ body: string;
851
+ description?: string;
852
+ }): Promise<any>;
853
+ /**
854
+ * Push a new body for an existing script by creating a new `ScriptConfig`
855
+ * and activating it (the prompt-model "edit → activate" flow). Referencing
856
+ * workflows pick up the new body on their next run with no fan-out. The
857
+ * config name is unique per script, so we mint a timestamped name.
858
+ */
859
+ pushScriptBody(appId: string, scriptId: string, body: string,
860
+ /**
861
+ * The active state the caller believes holds right now (#2731 B10).
862
+ * Creating an inactive config races nothing, so the guard sits on the
863
+ * ACTIVATION step: if the active config has moved since the caller read it,
864
+ * the server rejects with a 409 instead of overwriting a concurrent script
865
+ * change. It takes BOTH halves of "what is active", because a config's body
866
+ * can be edited in place without the active id changing — the id alone
867
+ * would let such an edit through. Omitted (e.g. `--force`) means activate
868
+ * unconditionally.
869
+ */
870
+ expectedActive?: {
871
+ configId?: string;
872
+ modifiedAt?: string;
873
+ }): Promise<any>;
874
+ /**
875
+ * Delete a script header (cascades its configs). `force` overrides the
876
+ * server's guard against deleting a script that an active workflow still
877
+ * references by name — without it the server answers 409.
878
+ */
879
+ deleteScript(appId: string, scriptId: string, force?: boolean): Promise<void>;
880
+ getPromptSchema(appId: string, promptId: string): Promise<{
881
+ promptId: string;
882
+ promptKey: string;
883
+ displayName: string;
884
+ inputSchema: any;
885
+ inputVariables: string[];
886
+ outputSchema: any;
887
+ activeConfigId: string | null;
888
+ activeConfigName: string | null;
889
+ }>;
890
+ /**
891
+ * One page of a block's test cases. The endpoint paginates (default 50, cap
892
+ * 100) and reports `nextCursor`; callers that reconcile the sync tree must
893
+ * drain every page before deleting or classifying anything (#2769).
894
+ */
895
+ listTestCases(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, params?: {
896
+ limit?: number;
897
+ cursor?: string;
898
+ }): Promise<{
899
+ items: any[];
900
+ nextCursor?: string;
901
+ }>;
902
+ getTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<any>;
903
+ createTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload: {
904
+ name: string;
905
+ description?: string | null;
906
+ inputVariables: Record<string, any>;
907
+ expectedOutputPattern?: string;
908
+ expectedOutputContains?: string[];
909
+ expectedJsonSubset?: Record<string, any>;
910
+ configId?: string;
911
+ evaluatorPromptId?: string;
912
+ evaluatorConfigId?: string;
913
+ /** The sidecar's file name — the case's identity (#2896). */
914
+ key?: string;
915
+ }): Promise<any>;
916
+ updateTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, payload: {
917
+ name?: string;
918
+ description?: string | null;
919
+ inputVariables?: Record<string, any>;
920
+ expectedOutputPattern?: string | null;
921
+ expectedOutputContains?: string[] | null;
922
+ expectedJsonSubset?: Record<string, any> | null;
923
+ configId?: string | null;
924
+ evaluatorPromptId?: string | null;
925
+ evaluatorConfigId?: string | null;
926
+ /** The sidecar's file name, on a create-or-rename backfill (#2896). */
927
+ key?: string;
928
+ }): Promise<any>;
929
+ deleteTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<void>;
930
+ listTestCaseAttachments(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<{
931
+ attachments: Array<{
932
+ filename: string;
933
+ contentType: string;
934
+ size: number;
935
+ r2Key: string;
936
+ }>;
937
+ }>;
938
+ uploadTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, filename: string, data: Buffer, contentType: string): Promise<{
939
+ success: boolean;
940
+ attachment: {
941
+ filename: string;
942
+ contentType: string;
943
+ size: number;
944
+ r2Key: string;
945
+ };
946
+ }>;
947
+ downloadTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, filename: string): Promise<{
948
+ data: Buffer;
949
+ contentType: string;
950
+ }>;
951
+ deleteTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, filename: string): Promise<{
952
+ success: boolean;
953
+ deleted: boolean;
954
+ }>;
955
+ executeBlockTest(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload: {
956
+ variables?: Record<string, any>;
957
+ testCaseId?: string;
958
+ configId?: string;
959
+ comparisonGroup?: string;
960
+ }): Promise<any>;
961
+ runAllTestCases(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload?: {
962
+ overrideConfigId?: string;
963
+ comparisonGroup?: string;
964
+ testCaseIds?: string[];
965
+ }): Promise<any>;
966
+ listTestRuns(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, params?: {
967
+ limit?: number;
968
+ comparisonGroup?: string;
969
+ }): Promise<{
970
+ items: any[];
971
+ }>;
972
+ listWorkflows(appId: string, params?: {
973
+ status?: string;
974
+ limit?: number;
975
+ cursor?: string;
976
+ }): Promise<{
977
+ items: any[];
978
+ nextCursor?: string | null;
979
+ }>;
980
+ getWorkflow(appId: string, workflowId: string): Promise<any>;
981
+ createWorkflow(appId: string, payload: any): Promise<any>;
982
+ updateWorkflow(appId: string, workflowId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
983
+ /**
984
+ * Retire a workflow, or destroy it (#2887).
985
+ *
986
+ * The plain call ARCHIVES: the definition row stays, so its runs, revisions
987
+ * and test cases keep resolving. `{ hard: true }` performs the full cascade
988
+ * and is what releases the `workflowKey` — the flag `config push --prune`
989
+ * sends, for the same reason it sends it for webhooks and integrations.
990
+ */
991
+ deleteWorkflow(appId: string, workflowId: string, options?: {
992
+ hard?: boolean;
993
+ }): Promise<ArchiveEnvelope>;
994
+ /**
995
+ * #2645 criterion 9 — the operational toggle. Deliberately NOT the config
996
+ * PATCH: `config push` owns every configuration field, and taking a workflow
997
+ * out of service must not touch one, or an operator's action would show up as
998
+ * drift against the repo. Same route shape as `cron-triggers pause|resume`.
999
+ */
1000
+ disableWorkflow(appId: string, workflowId: string): Promise<any>;
1001
+ enableWorkflow(appId: string, workflowId: string): Promise<any>;
1002
+ updateWorkflowDraft(appId: string, workflowId: string, payload: any): Promise<any>;
1003
+ previewWorkflow(appId: string, workflowId: string, payload: {
1004
+ rootInput?: object;
1005
+ meta?: object;
1006
+ configId?: string;
1007
+ useDraft?: boolean;
1008
+ preferActive?: boolean;
1009
+ }): Promise<{
1010
+ instanceId: string;
1011
+ usingDraft?: boolean;
1012
+ source?: "config" | "active" | "draft" | null;
1013
+ configName?: string | null;
1014
+ configId?: string | null;
1015
+ warning?: string;
1016
+ }>;
1017
+ getPreviewStatus(appId: string, workflowId: string, instanceId: string): Promise<any>;
1018
+ listWorkflowRuns(appId: string, workflowId: string, params?: {
1019
+ status?: string;
1020
+ limit?: number;
1021
+ cursor?: string;
1022
+ forward?: boolean;
1023
+ follow?: boolean;
1024
+ after?: string;
1025
+ }): Promise<{
1026
+ items: any[];
1027
+ hasMore?: boolean;
1028
+ nextCursor?: string | null;
1029
+ /** @deprecated Alias of `nextCursor` (#1316). */
1030
+ cursor?: string | null;
1031
+ /** #1969 — opaque follow checkpoint; present on `follow=true` responses. */
1032
+ resumeAfter?: string;
1033
+ /**
1034
+ * #2237 — index rows the server examined for this request. Filtered reads
1035
+ * only, and only on a server new enough to report it; `undefined`
1036
+ * otherwise, which callers must treat as "unknown", not zero.
1037
+ */
1038
+ scanned?: number;
1039
+ }>;
1040
+ /**
1041
+ * Workflow runs started by one app user, across every workflow (#1967).
1042
+ * Backed by `GET /admin/api/apps/{appId}/users/{userId}/workflow-runs`,
1043
+ * which resolves the app user before querying the `runsByUser` index.
1044
+ */
1045
+ listUserWorkflowRuns(appId: string, userId: string, params?: {
1046
+ status?: string;
1047
+ limit?: number;
1048
+ cursor?: string;
1049
+ forward?: boolean;
1050
+ workflowId?: string;
1051
+ }): Promise<{
1052
+ items: any[];
1053
+ hasMore?: boolean;
1054
+ nextCursor?: string | null;
1055
+ /** @deprecated Alias of `nextCursor` (#1316). */
1056
+ cursor?: string | null;
1057
+ /** #2237 — index rows examined; filtered reads only, `undefined` if unknown. */
1058
+ scanned?: number;
1059
+ }>;
1060
+ getWorkflowRunStatus(appId: string, workflowId: string, runId: string): Promise<any>;
1061
+ getWorkflowStepRuns(appId: string, workflowId: string, runId: string): Promise<{
1062
+ items: any[];
1063
+ }>;
1064
+ listWorkflowConfigs(appId: string, workflowId: string): Promise<{
1065
+ items: any[];
1066
+ }>;
1067
+ getWorkflowConfig(appId: string, workflowId: string, configId: string): Promise<any>;
1068
+ createWorkflowConfig(appId: string, workflowId: string, payload: {
1069
+ configName: string;
1070
+ description?: string;
1071
+ steps: any[];
1072
+ expressions?: {
1073
+ cel?: Record<string, string>;
1074
+ };
1075
+ }): Promise<any>;
1076
+ updateWorkflowConfig(appId: string, workflowId: string, configId: string, payload: {
1077
+ configName?: string;
1078
+ description?: string;
1079
+ steps?: any[];
1080
+ status?: string;
1081
+ expressions?: {
1082
+ cel?: Record<string, string>;
1083
+ };
1084
+ }): Promise<any>;
1085
+ archiveWorkflowConfig(appId: string, workflowId: string, configId: string): Promise<any>;
1086
+ activateWorkflowConfig(appId: string, workflowId: string, configId: string): Promise<any>;
1087
+ duplicateWorkflowConfig(appId: string, workflowId: string, configId: string, payload?: {
1088
+ configName?: string;
1089
+ }): Promise<any>;
1090
+ getAnalyticsTopUsers(appId: string, params?: {
1091
+ windowDays?: number;
1092
+ limit?: number;
1093
+ }): Promise<AnalyticsTopUsersResponse>;
1094
+ getAnalyticsIntegrationMetrics(appId: string, params?: {
1095
+ windowDays?: number;
1096
+ }): Promise<AnalyticsIntegrationMetricsResponse>;
1097
+ getAnalyticsOverviewDau(appId: string): Promise<AnalyticsMetricResponse>;
1098
+ getAnalyticsOverviewWau(appId: string): Promise<AnalyticsMetricResponse>;
1099
+ getAnalyticsOverviewMau(appId: string): Promise<AnalyticsMetricResponse>;
1100
+ getAnalyticsOverviewGrowth(appId: string, params?: {
1101
+ windowDays?: number;
1102
+ }): Promise<AnalyticsGrowthResponse>;
1103
+ getAnalyticsDailyActive(appId: string, params?: {
1104
+ windowDays?: number;
1105
+ }): Promise<AnalyticsDailyActiveResponse>;
1106
+ getAnalyticsRollingActive(appId: string, params?: {
1107
+ windowDays?: number;
1108
+ }): Promise<AnalyticsDailyActiveResponse>;
1109
+ getAnalyticsCohortRetention(appId: string): Promise<AnalyticsCohortResponse>;
1110
+ getAnalyticsUserSearch(appId: string, params: {
1111
+ q: string;
1112
+ limit?: number;
1113
+ }): Promise<AnalyticsUserSearchResponse>;
1114
+ getAnalyticsUserDetail(appId: string, userUlid: string): Promise<AnalyticsUserDetailResponse>;
1115
+ getAnalyticsUserSnapshot(appId: string, userUlid: string): Promise<AnalyticsUserSnapshotResponse>;
1116
+ getAnalyticsEvents(appId: string, params?: {
1117
+ windowDays?: number;
1118
+ page?: number;
1119
+ [key: string]: any;
1120
+ }): Promise<AnalyticsEventsResponse>;
1121
+ getAnalyticsEventsGrouped(appId: string, params?: {
1122
+ groupBy?: string;
1123
+ windowDays?: number;
1124
+ [key: string]: any;
1125
+ }): Promise<AnalyticsEventsGroupedResponse>;
1126
+ getAnalyticsErrorsGroups(appId: string, params?: {
1127
+ windowDays?: number;
1128
+ limit?: number;
1129
+ [key: string]: any;
1130
+ }): Promise<AnalyticsErrorsGroupsResponse>;
1131
+ getAnalyticsTopWorkflows(appId: string, params?: {
1132
+ windowDays?: number;
1133
+ limit?: number;
1134
+ }): Promise<TopWorkflowsResponse>;
1135
+ getAnalyticsTopPrompts(appId: string, params?: {
1136
+ windowDays?: number;
1137
+ limit?: number;
1138
+ }): Promise<TopPromptsResponse>;
1139
+ listAllAdmins(params?: {
1140
+ limit?: number;
1141
+ cursor?: string;
1142
+ }): Promise<any>;
1143
+ searchAdminByEmail(email: string): Promise<any>;
1144
+ getAdminApps(email: string): Promise<any>;
1145
+ updateAdminSettings(adminId: string, data: {
1146
+ appCreationLimit?: number;
1147
+ disabled?: boolean;
1148
+ role?: "admin" | "super-admin";
1149
+ }): Promise<any>;
1150
+ reindexAdmin(adminId: string): Promise<void>;
1151
+ listAllAdminInvitations(): Promise<any[]>;
1152
+ createGlobalAdminInvitation(data: {
1153
+ email: string;
1154
+ appCreationLimit?: number;
1155
+ expiresInDays?: number;
1156
+ }): Promise<any>;
1157
+ deleteGlobalAdminInvitation(invitationId: string): Promise<void>;
1158
+ listPromptCatalog(params?: {
1159
+ status?: string;
1160
+ limit?: number;
1161
+ cursor?: string;
1162
+ }): Promise<any>;
1163
+ getPromptCatalogItem(catalogId: string): Promise<any>;
1164
+ createPromptCatalogItem(payload: any): Promise<any>;
1165
+ updatePromptCatalogItem(catalogId: string, payload: any): Promise<any>;
1166
+ deletePromptCatalogItem(catalogId: string): Promise<void>;
1167
+ listIntegrationCatalog(params?: {
1168
+ status?: string;
1169
+ limit?: number;
1170
+ cursor?: string;
1171
+ }): Promise<any>;
1172
+ getIntegrationCatalogItem(catalogId: string): Promise<any>;
1173
+ createIntegrationCatalogItem(payload: any): Promise<any>;
1174
+ updateIntegrationCatalogItem(catalogId: string, payload: any): Promise<any>;
1175
+ deleteIntegrationCatalogItem(catalogId: string): Promise<void>;
1176
+ startBatchTests(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload?: {
1177
+ comparisonGroup?: string;
1178
+ overrideConfigId?: string;
1179
+ testCaseIds?: string[];
1180
+ }): Promise<{
1181
+ batchId: string;
1182
+ totalTests: number;
1183
+ instanceIds: string[];
1184
+ errors?: any[];
1185
+ }>;
1186
+ getBatchTestStatus(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, batchId: string): Promise<{
1187
+ status: string;
1188
+ batchId: string;
1189
+ completed: number;
1190
+ passed: number;
1191
+ failed: number;
1192
+ results: Array<{
1193
+ testCaseId: string;
1194
+ runId: string;
1195
+ status: string;
1196
+ verificationPassed: boolean;
1197
+ durationMs?: number;
1198
+ verificationDetails?: any;
1199
+ startedAt?: string;
1200
+ endedAt?: string;
1201
+ }>;
1202
+ }>;
1203
+ cancelBatchTests(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, batchId: string, instanceIds: string[]): Promise<{
1204
+ batchId: string;
1205
+ terminated: string[];
1206
+ errors?: any[];
1207
+ }>;
1208
+ getComparisonGroup(appId: string, group: string): Promise<{
1209
+ comparisonGroup: string;
1210
+ runs: any[];
1211
+ }>;
1212
+ listEmailTemplates(appId: string): Promise<{
1213
+ templates: EmailTemplateSummary[];
1214
+ }>;
1215
+ getEmailTemplate(appId: string, emailType: string): Promise<EmailTemplateDetail>;
1216
+ /**
1217
+ * Create or replace an email-template override.
1218
+ *
1219
+ * `expectedModifiedAt` is the optimistic-concurrency token every sibling
1220
+ * config endpoint already takes (#2731 B10). Optional and additive: when
1221
+ * omitted the write is unconditional, which is how `--force` and every
1222
+ * pre-existing caller keep working; when supplied and stale, the server
1223
+ * answers 409 rather than silently overwriting a concurrent edit.
1224
+ */
1225
+ upsertEmailTemplate(appId: string, emailType: string, payload: {
1226
+ subject: string;
1227
+ htmlBody: string;
1228
+ textBody: string;
1229
+ }, expectedModifiedAt?: string): Promise<EmailTemplateUpsertResult>;
1230
+ deleteEmailTemplate(appId: string, emailType: string): Promise<{
1231
+ success: boolean;
1232
+ }>;
1233
+ testEmailTemplate(appId: string, emailType: string, payload?: {
1234
+ subject: string;
1235
+ htmlBody: string;
1236
+ textBody: string;
1237
+ }): Promise<{
1238
+ success: boolean;
1239
+ sentTo: string;
1240
+ error?: string;
1241
+ }>;
1242
+ createToken(appId: string, data: {
1243
+ name: string;
1244
+ ttl?: string;
1245
+ userId?: string;
1246
+ }): Promise<{
1247
+ token: string;
1248
+ tokenId: string;
1249
+ name: string;
1250
+ expiresAt: string | null;
1251
+ createdAt: string;
1252
+ warning: string;
1253
+ }>;
1254
+ listTokens(appId: string, params?: {
1255
+ userId?: string;
1256
+ }): Promise<Array<{
1257
+ tokenId: string;
1258
+ name: string;
1259
+ userId: string;
1260
+ expiresAt: string | null;
1261
+ lastUsedAt: string | null;
1262
+ createdAt: string;
1263
+ createdBy: string;
1264
+ }>>;
1265
+ getToken(appId: string, tokenId: string): Promise<{
1266
+ tokenId: string;
1267
+ name: string;
1268
+ userId: string;
1269
+ expiresAt: string | null;
1270
+ lastUsedAt: string | null;
1271
+ createdAt: string;
1272
+ createdBy: string;
1273
+ revokedAt: string | null;
1274
+ }>;
1275
+ revokeToken(appId: string, tokenId: string): Promise<{
1276
+ success: boolean;
1277
+ message: string;
1278
+ }>;
1279
+ /**
1280
+ * List an app's databases, following the cursor to the end.
1281
+ *
1282
+ * The endpoint returns the `{ items, hasMore, nextCursor }` envelope and
1283
+ * caps a page at 100 (#1958), so `databases list` needs the follow-up pages
1284
+ * to show every database. `paginateAll` carries the repeat-cursor and
1285
+ * max-page guards, so a server that hands out a non-advancing cursor fails
1286
+ * loudly instead of looping forever.
1287
+ *
1288
+ * `options.owner` narrows the result to the databases that user created; the
1289
+ * server resolves it through the `databasesByCreator` index (#1965).
1290
+ */
1291
+ listDatabases(appId: string, options?: {
1292
+ owner?: string;
1293
+ }): Promise<any[]>;
1294
+ createDatabase(appId: string, data: {
1295
+ title: string;
1296
+ databaseType?: string;
1297
+ metadata?: Record<string, any> | string;
1298
+ initialMetadata?: Record<string, Record<string, unknown>>;
1299
+ }): Promise<any>;
1300
+ getDatabase(appId: string, databaseId: string): Promise<any>;
1301
+ updateDatabase(appId: string, databaseId: string, data: Record<string, any>): Promise<any>;
1302
+ deleteDatabase(appId: string, databaseId: string): Promise<void>;
1303
+ /**
1304
+ * Read a database's CEL context dict.
1305
+ *
1306
+ * The HTTP path stays `/metadata` because the wire field name is still
1307
+ * `metadata`; only the client/CLI-facing helper names were reframed.
1308
+ */
1309
+ getDatabaseCelContext(appId: string, databaseId: string): Promise<any>;
1310
+ /** Update a database's CEL context dict (merge with existing). */
1311
+ updateDatabaseCelContext(appId: string, databaseId: string, celContext: Record<string, any>): Promise<any>;
1312
+ /** @deprecated Use {@link getDatabaseCelContext} instead. */
1313
+ getDatabaseMetadata(appId: string, databaseId: string): Promise<any>;
1314
+ /** @deprecated Use {@link updateDatabaseCelContext} instead. */
1315
+ updateDatabaseMetadata(appId: string, databaseId: string, metadata: Record<string, any>): Promise<any>;
1316
+ listDatabasePermissions(appId: string, databaseId: string): Promise<any[]>;
1317
+ addDatabaseManager(appId: string, databaseId: string, userId: string): Promise<any>;
1318
+ removeDatabaseManager(appId: string, databaseId: string, userId: string): Promise<any>;
1319
+ /** @deprecated Use {@link addDatabaseManager} instead. */
1320
+ grantDatabasePermission(appId: string, databaseId: string, data: {
1321
+ userId: string;
1322
+ permission: "manager";
1323
+ }): Promise<any>;
1324
+ /** @deprecated Use {@link removeDatabaseManager} instead. */
1325
+ revokeDatabasePermission(appId: string, databaseId: string, userId: string): Promise<any>;
1326
+ listDatabaseModels(appId: string, databaseId: string): Promise<any>;
1327
+ describeDatabaseModel(appId: string, databaseId: string, modelName: string): Promise<any>;
1328
+ /**
1329
+ * Query records in a database model. The Durable Object answers with its own
1330
+ * `{ data, hasMore, nextCursor?, prevCursor? }` envelope; that wire shape is
1331
+ * shared with the JS client, the Swift client and web-admin, so the CLI
1332
+ * normalizes it at its own boundary instead (issue #2357) and hands callers
1333
+ * the same `{ items, hasMore, nextCursor? }` envelope as
1334
+ * {@link queryDocumentRecords}.
1335
+ */
1336
+ queryDatabaseRecords(appId: string, databaseId: string, modelName: string, queryOptions?: {
1337
+ filter?: Record<string, any>;
1338
+ limit?: number;
1339
+ cursor?: string;
1340
+ }): Promise<ListEnvelope>;
1341
+ countDatabaseRecords(appId: string, databaseId: string, modelName: string, filter?: Record<string, any>): Promise<{
1342
+ count: number;
1343
+ }>;
1344
+ aggregateDatabaseRecords(appId: string, databaseId: string, modelName: string, options: {
1345
+ operations: {
1346
+ type: string;
1347
+ field?: string;
1348
+ }[];
1349
+ groupBy: (string | {
1350
+ field: string;
1351
+ contains: string;
1352
+ })[];
1353
+ filter?: Record<string, any>;
1354
+ }): Promise<{
1355
+ result: unknown;
1356
+ }>;
1357
+ /**
1358
+ * Upsert one record via `records/save`: creates the record when the id is
1359
+ * new, and merges the supplied fields into it when it already exists (the DO
1360
+ * writes with `ON CONFLICT … json_patch`, so fields you leave out survive).
1361
+ * `patchDatabaseRecord` is the same merge but requires the record to exist.
1362
+ *
1363
+ * `id` is optional: when omitted the body carries no `id`, which the
1364
+ * DatabaseDO only accepts alongside an `upsertOn` field — callers that want a
1365
+ * plain create must supply an id themselves (`databases records save` mints a
1366
+ * ULID, matching the CSV import path).
1367
+ *
1368
+ * Returns the endpoint's flat `{ success, id, appliedFields }` — not the
1369
+ * saved record.
1370
+ */
1371
+ saveDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string | undefined, data: any): Promise<any>;
1372
+ /**
1373
+ * Merge the supplied fields into an existing record via `records/patch`.
1374
+ *
1375
+ * Fields absent from `data` are left as they are. Unlike `saveDatabaseRecord`
1376
+ * the record must already exist — the DatabaseDO answers 404 for an unknown
1377
+ * id rather than creating one. Returns the flat
1378
+ * `{ success, id, appliedFields }`.
1379
+ */
1380
+ patchDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string, data: any): Promise<any>;
1381
+ listDatabaseOperations(appId: string, databaseId: string): Promise<any[]>;
1382
+ /**
1383
+ * Execute a registered operation and, when the result is a query page,
1384
+ * normalize it to the CLI's one list envelope (issue #2440).
1385
+ *
1386
+ * The registered operation decides the response shape, so the normalization
1387
+ * is conditional — see {@link normalizeDatabaseOperationResult}. Everything
1388
+ * else (a `count`, an `aggregate`, a mutation, a `returnField: "all"`
1389
+ * pipeline) is returned exactly as the server sent it.
1390
+ */
1391
+ executeDatabaseOperation(appId: string, databaseId: string, operationName: string, data?: {
1392
+ params?: Record<string, any>;
1393
+ limit?: number;
1394
+ cursor?: string;
1395
+ direction?: number;
1396
+ }, token?: string, options?: {
1397
+ timing?: boolean;
1398
+ }): Promise<any>;
1399
+ /**
1400
+ * Execute a registered batch (bulk) database operation. Posts a chunk of
1401
+ * items to the canonical `operations/:name/batch` endpoint (the same one the
1402
+ * client library's `executeBatch` uses — NOT the deprecated `import-bulk`
1403
+ * alias). Used by `databases import-csv`.
1404
+ *
1405
+ * @returns `{ imported, failed }` — DO-level write outcome counts. Per-item
1406
+ * validation/access failures abort the whole chunk with a 4xx (thrown).
1407
+ */
1408
+ executeBatch(appId: string, databaseId: string, operationName: string, batch: Array<{
1409
+ params: Record<string, any>;
1410
+ }>): Promise<{
1411
+ imported: number;
1412
+ failed: number;
1413
+ }>;
1414
+ /**
1415
+ * Make a request using a specific JWT token instead of the CLI's credentials.
1416
+ * Used for executing operations as a different user.
1417
+ */
1418
+ requestWithToken<T = any>(path: string, token: string, options?: RequestInit): Promise<T>;
1419
+ listDatabaseIndexes(appId: string, databaseId: string, modelName?: string): Promise<any>;
1420
+ registerDatabaseIndex(appId: string, databaseId: string, data: {
1421
+ modelName: string;
1422
+ fieldName: string;
1423
+ fieldType: string;
1424
+ unique?: boolean;
1425
+ }): Promise<any>;
1426
+ dropDatabaseIndex(appId: string, databaseId: string, data: {
1427
+ modelName: string;
1428
+ fieldName: string;
1429
+ }): Promise<any>;
1430
+ /**
1431
+ * Issue #974: back-provision an existing database instance's schema-declared
1432
+ * unique indexes by reading its type schema and registering any declared-but-
1433
+ * missing unique index. Idempotent.
1434
+ */
1435
+ reindexDatabaseFromSchema(appId: string, databaseId: string): Promise<{
1436
+ ok: boolean;
1437
+ registered: number;
1438
+ skipped?: boolean;
1439
+ reason?: string;
1440
+ databaseType?: string;
1441
+ }>;
1442
+ listDatabaseTypeConfigs(appId: string): Promise<any[]>;
1443
+ getDatabaseTypeConfig(appId: string, databaseType: string): Promise<any>;
1444
+ createDatabaseTypeConfig(appId: string, data: {
1445
+ databaseType: string;
1446
+ ruleSetId?: string | null;
1447
+ triggers?: Record<string, any> | null;
1448
+ metadataAccess?: string | null;
1449
+ defaultAccess?: string | null;
1450
+ autoPopulatedFields?: Record<string, any> | null;
1451
+ timestamps?: Record<string, any> | null;
1452
+ schema?: string | null;
1453
+ metadataManifest?: any;
1454
+ }, options?: {
1455
+ dryRun?: boolean;
1456
+ }): Promise<any>;
1457
+ updateDatabaseTypeConfig(appId: string, databaseType: string, data: {
1458
+ ruleSetId?: string | null;
1459
+ triggers?: Record<string, any> | null;
1460
+ metadataAccess?: string | null;
1461
+ defaultAccess?: string | null;
1462
+ autoPopulatedFields?: Record<string, any> | null;
1463
+ timestamps?: Record<string, any> | null;
1464
+ schema?: string | null;
1465
+ pendingOpDeletes?: string[];
1466
+ finalOpNames?: string[];
1467
+ metadataManifest?: any;
1468
+ pendingOpUpdates?: Array<{
1469
+ name: string;
1470
+ access?: string | null;
1471
+ params?: Record<string, any> | null;
1472
+ }>;
1473
+ pendingOpUpserts?: Array<Record<string, any>>;
1474
+ }, expectedModifiedAt?: string, options?: {
1475
+ dryRun?: boolean;
1476
+ acceptWarnings?: boolean;
1477
+ }): Promise<any>;
1478
+ deleteDatabaseTypeConfig(appId: string, databaseType: string, options?: {
1479
+ force?: boolean;
1480
+ }): Promise<any>;
1481
+ /**
1482
+ * Issue #666 Phase 3: ask the server to scaffold a TOML schema from
1483
+ * existing ops + DO field introspection. Read-only — does NOT persist.
1484
+ */
1485
+ scaffoldDatabaseTypeSchema(appId: string, databaseType: string): Promise<{
1486
+ schema: string;
1487
+ }>;
1488
+ listDatabaseTypeOperations(appId: string, databaseType: string): Promise<any[]>;
1489
+ getDatabaseTypeOperation(appId: string, databaseType: string, name: string): Promise<any>;
1490
+ createDatabaseTypeOperation(appId: string, databaseType: string, data: {
1491
+ name: string;
1492
+ type: string;
1493
+ modelName: string;
1494
+ access?: string | null;
1495
+ definition: Record<string, any>;
1496
+ params?: Record<string, any> | null;
1497
+ }, options?: {
1498
+ dryRun?: boolean;
1499
+ schemaOverride?: string | null;
1500
+ defaultAccess?: string | null;
1501
+ metadataManifestOverride?: Record<string, any> | null;
1502
+ }): Promise<any>;
1503
+ updateDatabaseTypeOperation(appId: string, databaseType: string, name: string, data: Record<string, any>, expectedModifiedAt?: string, options?: {
1504
+ dryRun?: boolean;
1505
+ schemaOverride?: string | null;
1506
+ metadataManifestOverride?: Record<string, any> | null;
1507
+ }): Promise<any>;
1508
+ deleteDatabaseTypeOperation(appId: string, databaseType: string, name: string): Promise<any>;
1509
+ listDatabaseTypeSubscriptions(appId: string, databaseType: string): Promise<any[]>;
1510
+ getDatabaseTypeSubscription(appId: string, databaseType: string, subscriptionKey: string): Promise<any>;
1511
+ createDatabaseTypeSubscription(appId: string, databaseType: string, data: {
1512
+ subscriptionKey: string;
1513
+ displayName: string;
1514
+ modelName: string;
1515
+ filter: string;
1516
+ access: string;
1517
+ description?: string | null;
1518
+ select?: string[] | null;
1519
+ emit?: string[] | null;
1520
+ params?: Record<string, any> | null;
1521
+ status?: string;
1522
+ }): Promise<any>;
1523
+ updateDatabaseTypeSubscription(appId: string, databaseType: string, subscriptionKey: string, data: Record<string, any>, expectedModifiedAt?: string): Promise<any>;
1524
+ deleteDatabaseTypeSubscription(appId: string, databaseType: string, subscriptionKey: string): Promise<any>;
1525
+ listGroups(appId: string, params?: {
1526
+ type?: string;
1527
+ limit?: number;
1528
+ cursor?: string;
1529
+ }): Promise<{
1530
+ items: any[];
1531
+ nextCursor?: string;
1532
+ hasMore?: boolean;
1533
+ /** @deprecated Alias of `nextCursor` (#1316). */
1534
+ cursor?: string;
1535
+ }>;
1536
+ createGroup(appId: string, data: {
1537
+ groupType: string;
1538
+ groupId?: string;
1539
+ name: string;
1540
+ description?: string;
1541
+ }): Promise<any>;
1542
+ getGroup(appId: string, groupType: string, groupId: string): Promise<any>;
1543
+ updateGroup(appId: string, groupType: string, groupId: string, data: {
1544
+ name?: string;
1545
+ description?: string;
1546
+ }): Promise<any>;
1547
+ deleteGroup(appId: string, groupType: string, groupId: string): Promise<any>;
1548
+ listGroupMembers(appId: string, groupType: string, groupId: string, options?: {
1549
+ include?: "profiles";
1550
+ }): Promise<{
1551
+ items: any[];
1552
+ nextCursor?: string;
1553
+ hasMore?: boolean;
1554
+ /** @deprecated Alias of `nextCursor` (#1316). */
1555
+ cursor?: string;
1556
+ }>;
1557
+ addGroupMember(appId: string, groupType: string, groupId: string, data: {
1558
+ userId: string;
1559
+ }): Promise<any>;
1560
+ removeGroupMember(appId: string, groupType: string, groupId: string, userId: string): Promise<any>;
1561
+ listGroupDocuments(appId: string, groupType: string, groupId: string): Promise<any[]>;
1562
+ listUserMemberships(appId: string, userId: string): Promise<any[]>;
1563
+ listDocumentGroupPermissions(appId: string, documentId: string): Promise<any[]>;
1564
+ grantDocumentGroupPermission(appId: string, documentId: string, data: {
1565
+ groupType: string;
1566
+ groupId: string;
1567
+ permission: string;
1568
+ }): Promise<any>;
1569
+ revokeDocumentGroupPermission(appId: string, documentId: string, groupType: string, groupId: string): Promise<any>;
1570
+ listCollections(appId: string, params?: {
1571
+ limit?: number;
1572
+ cursor?: string;
1573
+ }): Promise<{
1574
+ items: any[];
1575
+ nextCursor?: string | null;
1576
+ }>;
1577
+ listAllCollections(appId: string, params?: {
1578
+ limit?: number;
1579
+ cursor?: string;
1580
+ }): Promise<{
1581
+ items: any[];
1582
+ nextCursor?: string | null;
1583
+ }>;
1584
+ createCollection(appId: string, data: {
1585
+ name: string;
1586
+ description?: string;
1587
+ initialMetadata?: Record<string, Record<string, unknown>>;
1588
+ }): Promise<any>;
1589
+ getCollection(appId: string, collectionId: string): Promise<any>;
1590
+ updateCollection(appId: string, collectionId: string, data: {
1591
+ name?: string;
1592
+ description?: string;
1593
+ }): Promise<any>;
1594
+ deleteCollection(appId: string, collectionId: string): Promise<any>;
1595
+ listCollectionDocuments(appId: string, collectionId: string, params?: {
1596
+ limit?: number;
1597
+ cursor?: string;
1598
+ }): Promise<{
1599
+ items: any[];
1600
+ nextCursor?: string | null;
1601
+ }>;
1602
+ addCollectionDocument(appId: string, collectionId: string, data: {
1603
+ documentId: string;
1604
+ }): Promise<any>;
1605
+ removeCollectionDocument(appId: string, collectionId: string, documentId: string): Promise<any>;
1606
+ listCollectionsForDocument(appId: string, documentId: string, params?: {
1607
+ limit?: number;
1608
+ cursor?: string;
1609
+ }): Promise<{
1610
+ items: any[];
1611
+ nextCursor?: string | null;
1612
+ }>;
1613
+ getCollectionAccess(appId: string, collectionId: string): Promise<any>;
1614
+ grantCollectionGroupPermission(appId: string, collectionId: string, data: {
1615
+ groupType: string;
1616
+ groupId: string;
1617
+ permission: string;
1618
+ }): Promise<any>;
1619
+ revokeCollectionGroupPermission(appId: string, collectionId: string, groupType: string, groupId: string): Promise<any>;
1620
+ addCollectionMember(appId: string, collectionId: string, data: {
1621
+ userId: string;
1622
+ permission: string;
1623
+ }): Promise<any>;
1624
+ removeCollectionMember(appId: string, collectionId: string, userId: string): Promise<any>;
1625
+ listCollectionTypeConfigs(appId: string): Promise<any[]>;
1626
+ getCollectionTypeConfig(appId: string, collectionType: string): Promise<any>;
1627
+ createCollectionTypeConfig(appId: string, data: {
1628
+ collectionType: string;
1629
+ ruleSetId?: string;
1630
+ metadataManifest?: any;
1631
+ }): Promise<any>;
1632
+ updateCollectionTypeConfig(appId: string, collectionType: string, data: {
1633
+ ruleSetId?: string | null;
1634
+ metadataManifest?: any;
1635
+ }, expectedModifiedAt?: string): Promise<any>;
1636
+ deleteCollectionTypeConfig(appId: string, collectionType: string): Promise<any>;
1637
+ /**
1638
+ * List all metadata category configs for an app. The route returns
1639
+ * `{ configs: [...] }`; unwrap to a bare array to match the other
1640
+ * `list*Configs` helpers.
1641
+ */
1642
+ listMetadataCategoryConfigs(appId: string): Promise<any[]>;
1643
+ getMetadataCategoryConfig(appId: string, resourceType: string, category: string): Promise<any>;
1644
+ /**
1645
+ * Create or replace a metadata category config (idempotent upsert via the
1646
+ * path-addressed PUT route). `resourceType` / `category` identify the config;
1647
+ * the body carries `schema` / `readRule` / `writeRule` / `description`.
1648
+ */
1649
+ upsertMetadataCategoryConfig(appId: string, resourceType: string, category: string, data: {
1650
+ schema: unknown;
1651
+ readRule?: string | null;
1652
+ writeRule?: string | null;
1653
+ description?: string | null;
1654
+ metadataManifest?: unknown;
1655
+ },
1656
+ /** Optimistic-concurrency token; see `upsertEmailTemplate` (#2731 B10). */
1657
+ expectedModifiedAt?: string): Promise<any>;
1658
+ /**
1659
+ * Delete a metadata category config (issue #1426, admin-gated route shipped
1660
+ * in #1364). Orphan semantics: the config row is hard-deleted; any stored
1661
+ * `ResourceMetadata` value rows for the category are left behind and become
1662
+ * unreachable (no query path from a category to its values). Delete the
1663
+ * values first if you need them gone — an orphaned value row can't be
1664
+ * removed through any surface once its config is gone. Returns
1665
+ * `{ resourceType, category, deleted }`; a missing config is a 404.
1666
+ */
1667
+ deleteMetadataCategoryConfig(appId: string, resourceType: string, category: string): Promise<{
1668
+ resourceType: string;
1669
+ category: string;
1670
+ deleted: boolean;
1671
+ }>;
1672
+ listRuleSets(appId: string, params?: {
1673
+ resourceType?: string;
1674
+ }): Promise<any[]>;
1675
+ createRuleSet(appId: string, data: {
1676
+ name: string;
1677
+ resourceType: string;
1678
+ rules: Record<string, any>;
1679
+ description?: string;
1680
+ }): Promise<any>;
1681
+ getRuleSet(appId: string, ruleSetId: string): Promise<any>;
1682
+ updateRuleSet(appId: string, ruleSetId: string, data: {
1683
+ name?: string;
1684
+ description?: string;
1685
+ rules?: Record<string, any>;
1686
+ }, expectedModifiedAt?: string): Promise<any>;
1687
+ deleteRuleSet(appId: string, ruleSetId: string): Promise<any>;
1688
+ getRuleSetSchema(appId: string): Promise<any>;
1689
+ getRuleSetResourceTypes(appId: string): Promise<{
1690
+ resourceTypes: string[];
1691
+ }>;
1692
+ testRuleSet(appId: string, ruleSetId: string, data: any): Promise<any>;
1693
+ debugRuleSet(appId: string, data: any): Promise<any>;
1694
+ listGroupTypeConfigs(appId: string): Promise<any[]>;
1695
+ getGroupTypeConfig(appId: string, groupType: string): Promise<any>;
1696
+ createGroupTypeConfig(appId: string, data: {
1697
+ groupType: string;
1698
+ ruleSetId?: string;
1699
+ autoAddCreator?: boolean;
1700
+ metadataManifest?: any;
1701
+ }): Promise<any>;
1702
+ updateGroupTypeConfig(appId: string, groupType: string, data: {
1703
+ ruleSetId?: string | null;
1704
+ autoAddCreator?: boolean;
1705
+ metadataManifest?: any;
1706
+ }, expectedModifiedAt?: string): Promise<any>;
1707
+ deleteGroupTypeConfig(appId: string, groupType: string): Promise<any>;
1708
+ exportDocumentState(appId: string, documentId: string): Promise<{
1709
+ state: string;
1710
+ byteLength: number;
1711
+ documentId: string;
1712
+ }>;
1713
+ importDocumentState(appId: string, documentId: string, stateBase64: string): Promise<any>;
1714
+ getDocument(appId: string, documentId: string): Promise<any>;
1715
+ /**
1716
+ * Delete a document and everything hanging off it (#2756). The server route
1717
+ * runs the same cascade the client SDK's `documents.delete()` triggers —
1718
+ * Yjs state and update history, blob rows and objects, aliases, user/group
1719
+ * permissions, invitations, collection memberships — and returns
1720
+ * `{ success, message }`, which callers pass through under `--json`.
1721
+ */
1722
+ deleteDocument(appId: string, documentId: string): Promise<any>;
1723
+ /**
1724
+ * Introspect a document's Yjs schema (model names, per-model fields and
1725
+ * indexes). Backs `documents records models` and `documents records
1726
+ * describe`. Reuses the existing `GET documents/:id/schema` endpoint.
1727
+ */
1728
+ getDocumentSchema(appId: string, documentId: string): Promise<any>;
1729
+ /**
1730
+ * Query records in a document model (issue #1964 Phase 3). Reuses the
1731
+ * server-side `GET documents/:id/records/:model` endpoint, which runs
1732
+ * through the caller's document permission (reader+) or the app-admin arm.
1733
+ * Returns the unified `{ items, hasMore, nextCursor? }` envelope. The cursor
1734
+ * is an opaque token — feed `nextCursor` back as `cursor` for the next page.
1735
+ * The server also dual-emits a deprecated `cursor` alias (#1316); the
1736
+ * normalizer drops it so CLI output is already on `nextCursor` when #1982
1737
+ * removes it.
1738
+ */
1739
+ queryDocumentRecords(appId: string, documentId: string, modelName: string, queryOptions?: {
1740
+ filter?: Record<string, any>;
1741
+ limit?: number;
1742
+ cursor?: string;
1743
+ }): Promise<ListEnvelope>;
1744
+ /**
1745
+ * Count records in a document model (issue #1964 Phase 3). Returns `{ count }`.
1746
+ */
1747
+ countDocumentRecords(appId: string, documentId: string, modelName: string, queryOptions?: {
1748
+ filter?: Record<string, any>;
1749
+ }): Promise<{
1750
+ count: number;
1751
+ }>;
1752
+ /**
1753
+ * Aggregate records in a document model (issue #2437) — the documents twin
1754
+ * of {@link aggregateDatabaseRecords}. `POST documents/:id/records/:model/aggregate`
1755
+ * with `{ options: { operations, groupBy?, filter? } }`, answering `{ result }`
1756
+ * in the same shape as the database endpoint.
1757
+ *
1758
+ * `groupBy` takes plain field names only: StringSet facet grouping and
1759
+ * `{ field, contains }` membership grouping are database-only, which is why
1760
+ * this signature is narrower than the databases one.
1761
+ */
1762
+ aggregateDocumentRecords(appId: string, documentId: string, modelName: string, options: {
1763
+ operations: {
1764
+ type: string;
1765
+ field?: string;
1766
+ }[];
1767
+ groupBy?: string[];
1768
+ filter?: Record<string, any>;
1769
+ }): Promise<{
1770
+ result: unknown;
1771
+ }>;
1772
+ /**
1773
+ * Fetch platform-vocabulary document statistics (issue #1964 Phase 3):
1774
+ * record/model/blob counts, approximate size, and last-modified timestamp.
1775
+ */
1776
+ getDocumentStats(appId: string, documentId: string): Promise<any>;
1777
+ /**
1778
+ * Create or replace a record in a document model (issue #1964 Phase 4).
1779
+ * `POST documents/:id/records/:model` with `{ id, data, options? }` —
1780
+ * server-side write through the document facade (Yjs-first, CRDT-safe,
1781
+ * broadcasts to connected clients). Requires read-write+ on the document
1782
+ * or the app-admin arm. Returns `{ record }`.
1783
+ */
1784
+ saveDocumentRecord(appId: string, documentId: string, modelName: string, body: {
1785
+ id: string;
1786
+ data: Record<string, unknown>;
1787
+ options?: Record<string, unknown>;
1788
+ }): Promise<{
1789
+ record: unknown;
1790
+ }>;
1791
+ /**
1792
+ * Merge fields into an existing record (issue #1964 Phase 4).
1793
+ * `PATCH documents/:id/records/:model/:recordId` with `{ data, options? }`.
1794
+ * Returns `{ record }`.
1795
+ */
1796
+ patchDocumentRecord(appId: string, documentId: string, modelName: string, recordId: string, body: {
1797
+ data: Record<string, unknown>;
1798
+ options?: Record<string, unknown>;
1799
+ }): Promise<{
1800
+ record: unknown;
1801
+ }>;
1802
+ /**
1803
+ * Delete a record from a document model (issue #1964 Phase 4).
1804
+ * `DELETE documents/:id/records/:model/:recordId`. A missing record id is
1805
+ * a silent no-op per the facade contract. Returns `{ deleted: true }`.
1806
+ */
1807
+ deleteDocumentRecord(appId: string, documentId: string, modelName: string, recordId: string): Promise<{
1808
+ deleted: boolean;
1809
+ }>;
1810
+ /**
1811
+ * Apply an ordered multi-model create/patch/delete blob atomically (issue
1812
+ * #1964 Phase 4, wrapping the #1517 `bulkUpdate` facade). All-or-nothing:
1813
+ * a validation failure commits nothing. Returns the facade's
1814
+ * `{ applied, added, updated, deleted }`.
1815
+ */
1816
+ bulkDocumentRecords(appId: string, documentId: string, operations: Array<Record<string, unknown>>): Promise<{
1817
+ applied: number;
1818
+ added: Array<{
1819
+ model: string;
1820
+ id: string;
1821
+ }>;
1822
+ updated: Array<{
1823
+ model: string;
1824
+ id: string;
1825
+ }>;
1826
+ deleted: number;
1827
+ }>;
1828
+ createDocument(appId: string, data: {
1829
+ title: string;
1830
+ documentId?: string;
1831
+ tags?: string[];
1832
+ createdBy?: string;
1833
+ }): Promise<any>;
1834
+ listDocumentPermissions(appId: string, documentId: string): Promise<any[]>;
1835
+ grantDocumentPermission(appId: string, documentId: string, permissions: Array<{
1836
+ userId?: string;
1837
+ email?: string;
1838
+ permission: string;
1839
+ }>): Promise<any>;
1840
+ /**
1841
+ * Revoke a user's permission on a document. Mirrors the published client's
1842
+ * `documents.removePermission` wire behavior (`src/client/api/documentsApi.ts`):
1843
+ * a userId targets the path route `DELETE .../permissions/:userId`, while an
1844
+ * email targets the query-param route `DELETE .../permissions?email=...`
1845
+ * (unified email removal, #452). This duplication of the client's wire shape
1846
+ * is deliberate and parity-tested (issue #1964 amendment 8).
1847
+ */
1848
+ revokeDocumentPermission(appId: string, documentId: string, target: {
1849
+ userId?: string;
1850
+ email?: string;
1851
+ }): Promise<any>;
1852
+ getDocumentLinkAccess(appId: string, documentId: string): Promise<any>;
1853
+ setDocumentLinkAccess(appId: string, documentId: string, level: "reader" | "read-write"): Promise<any>;
1854
+ clearDocumentLinkAccess(appId: string, documentId: string): Promise<any>;
1855
+ listDocumentInvitations(appId: string, documentId: string): Promise<any[]>;
1856
+ listDocumentBlobs(appId: string, documentId: string): Promise<any[]>;
1857
+ downloadBlob(appId: string, documentId: string, blobId: string): Promise<Buffer>;
1858
+ uploadBlob(appId: string, documentId: string, blobId: string, data: Buffer, meta: {
1859
+ filename: string;
1860
+ contentType: string;
1861
+ sha256: string;
1862
+ }): Promise<any>;
1863
+ listDocumentAliases(appId: string, documentId: string): Promise<any[]>;
1864
+ setDocumentAlias(appId: string, aliasScope: string, aliasKey: string, documentId: string, ownerUserId?: string, mustNotExist?: boolean): Promise<any>;
1865
+ /**
1866
+ * Resolve an app user by exact email — the single email → userId lookup in
1867
+ * the CLI (issue #2763). It reads the member-accessible `users/lookup`
1868
+ * endpoint rather than the admin-only `GET /users` list, and returns the
1869
+ * server's `{ exists, user? }` envelope as-is: a 403 or a transport failure
1870
+ * rejects instead of being flattened into "no such user", which is exactly
1871
+ * how the deleted admin-list helper misreported permission problems.
1872
+ */
1873
+ lookupUserByEmail(appId: string, email: string): Promise<{
1874
+ exists: boolean;
1875
+ user?: {
1876
+ userId: string;
1877
+ name?: string;
1878
+ email?: string;
1879
+ };
1880
+ }>;
1881
+ listAdminDocuments(appId: string, userId: string): Promise<any[]>;
1882
+ /**
1883
+ * Apply an ordered batch of record operations via `records/batch`.
1884
+ *
1885
+ * `atomic` (default off, matching the DatabaseDO) makes the whole batch
1886
+ * all-or-nothing: the DO rolls every write back at the first failed
1887
+ * operation and answers with that operation's status. `databases records
1888
+ * bulk` sends `atomic: true` so it matches the documents twin's
1889
+ * all-or-nothing contract (#2437); the CSV/import paths keep the default
1890
+ * partial-success behavior.
1891
+ */
1892
+ batchDatabaseRecords(appId: string, databaseId: string, operations: DatabaseBatchOperation[], options?: {
1893
+ atomic?: boolean;
1894
+ }): Promise<any>;
1895
+ deleteDatabaseRecord(appId: string, databaseId: string, modelName: string, id: string): Promise<any>;
1896
+ batchDeleteDatabaseRecords(appId: string, databaseId: string, operations: {
1897
+ op: "delete";
1898
+ modelName: string;
1899
+ id: string;
1900
+ }[]): Promise<any>;
1901
+ listDatabaseUniqueConstraints(appId: string, databaseId: string): Promise<any[]>;
1902
+ registerDatabaseUniqueConstraint(appId: string, databaseId: string, constraint: {
1903
+ modelName: string;
1904
+ constraintName: string;
1905
+ fields: string[];
1906
+ }): Promise<any>;
1907
+ listBlobBuckets(appId: string): Promise<{
1908
+ items: any[];
1909
+ }>;
1910
+ createBlobBucket(appId: string, payload: any): Promise<any>;
1911
+ getBlobBucket(appId: string, bucketIdOrKey: string): Promise<any>;
1912
+ updateBlobBucket(appId: string, bucketIdOrKey: string, payload: any): Promise<any>;
1913
+ deleteBlobBucket(appId: string, bucketIdOrKey: string): Promise<any>;
1914
+ listBucketBlobs(appId: string, bucketIdOrKey: string, params?: {
1915
+ cursor?: string;
1916
+ limit?: number;
1917
+ }): Promise<{
1918
+ items: any[];
1919
+ nextCursor?: string;
1920
+ hasMore?: boolean;
1921
+ /** @deprecated Alias of `nextCursor` (#1316). */
1922
+ cursor?: string;
1923
+ }>;
1924
+ uploadBucketBlob(appId: string, bucketIdOrKey: string, data: Buffer, meta: {
1925
+ filename: string;
1926
+ contentType: string;
1927
+ tags?: string[];
1928
+ }): Promise<any>;
1929
+ downloadBucketBlob(appId: string, bucketIdOrKey: string, blobId: string): Promise<Buffer>;
1930
+ deleteBucketBlob(appId: string, bucketIdOrKey: string, blobId: string): Promise<any>;
1931
+ deleteBucketBlobs(appId: string, bucketIdOrKey: string, blobIds: string[]): Promise<any>;
1932
+ getBucketBlobSignedUrl(appId: string, bucketIdOrKey: string, blobId: string, expiresInSeconds?: number): Promise<any>;
1933
+ getBucketBlobMetadata(appId: string, bucketIdOrKey: string, blobId: string): Promise<BlobInfo>;
1934
+ }
1935
+ export declare const apiClient: ApiClient;
1936
+ export {};