primitive-admin 1.2.0-alpha.9 → 1.3.0-alpha.1

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 (590) hide show
  1. package/README.md +303 -186
  2. package/assets/skill/skills/primitive-platform/SKILL.md +93 -27
  3. package/dist/bin/primitive.js +15 -89
  4. package/dist/bin/primitive.js.map +1 -1
  5. package/dist/src/commands/admins.js +80 -17
  6. package/dist/src/commands/admins.js.map +1 -1
  7. package/dist/src/commands/agent-sessions.d.ts +129 -0
  8. package/dist/src/commands/agent-sessions.js +532 -20
  9. package/dist/src/commands/agent-sessions.js.map +1 -1
  10. package/dist/src/commands/analytics.js +207 -155
  11. package/dist/src/commands/analytics.js.map +1 -1
  12. package/dist/src/commands/apps-children.js +3 -0
  13. package/dist/src/commands/apps-children.js.map +1 -1
  14. package/dist/src/commands/apps-transitions.d.ts +39 -0
  15. package/dist/src/commands/apps-transitions.js +198 -0
  16. package/dist/src/commands/apps-transitions.js.map +1 -0
  17. package/dist/src/commands/apps.d.ts +17 -0
  18. package/dist/src/commands/apps.js +108 -3
  19. package/dist/src/commands/apps.js.map +1 -1
  20. package/dist/src/commands/auth-sessions.js +2 -0
  21. package/dist/src/commands/auth-sessions.js.map +1 -1
  22. package/dist/src/commands/auth.js +170 -50
  23. package/dist/src/commands/auth.js.map +1 -1
  24. package/dist/src/commands/blob-buckets.js +2 -0
  25. package/dist/src/commands/blob-buckets.js.map +1 -1
  26. package/dist/src/commands/collections.js +318 -256
  27. package/dist/src/commands/collections.js.map +1 -1
  28. package/dist/src/commands/comparisons.js +2 -0
  29. package/dist/src/commands/comparisons.js.map +1 -1
  30. package/dist/src/commands/config.d.ts +2 -2
  31. package/dist/src/commands/config.js +59 -33
  32. package/dist/src/commands/config.js.map +1 -1
  33. package/dist/src/commands/connections.js +2 -0
  34. package/dist/src/commands/connections.js.map +1 -1
  35. package/dist/src/commands/database-type-configs.js +5 -3
  36. package/dist/src/commands/database-type-configs.js.map +1 -1
  37. package/dist/src/commands/databases.js +6 -4
  38. package/dist/src/commands/databases.js.map +1 -1
  39. package/dist/src/commands/db3-types.d.ts +42 -0
  40. package/dist/src/commands/db3-types.js +445 -0
  41. package/dist/src/commands/db3-types.js.map +1 -0
  42. package/dist/src/commands/db3.d.ts +38 -0
  43. package/dist/src/commands/db3.js +2053 -0
  44. package/dist/src/commands/db3.js.map +1 -0
  45. package/dist/src/commands/documents.d.ts +110 -10
  46. package/dist/src/commands/documents.js +1019 -748
  47. package/dist/src/commands/documents.js.map +1 -1
  48. package/dist/src/commands/email-templates.js +74 -0
  49. package/dist/src/commands/email-templates.js.map +1 -1
  50. package/dist/src/commands/env.js +8 -4
  51. package/dist/src/commands/env.js.map +1 -1
  52. package/dist/src/commands/function-trigger-commands.d.ts +28 -0
  53. package/dist/src/commands/function-trigger-commands.js +341 -0
  54. package/dist/src/commands/function-trigger-commands.js.map +1 -0
  55. package/dist/src/commands/functions.js +383 -32
  56. package/dist/src/commands/functions.js.map +1 -1
  57. package/dist/src/commands/groups.js +168 -50
  58. package/dist/src/commands/groups.js.map +1 -1
  59. package/dist/src/commands/guides.js +7 -5
  60. package/dist/src/commands/guides.js.map +1 -1
  61. package/dist/src/commands/hosting.d.ts +8 -0
  62. package/dist/src/commands/hosting.js +509 -0
  63. package/dist/src/commands/hosting.js.map +1 -0
  64. package/dist/src/commands/init.js +129 -38
  65. package/dist/src/commands/init.js.map +1 -1
  66. package/dist/src/commands/integrations.js +82 -53
  67. package/dist/src/commands/integrations.js.map +1 -1
  68. package/dist/src/commands/locks.d.ts +5 -3
  69. package/dist/src/commands/locks.js +19 -61
  70. package/dist/src/commands/locks.js.map +1 -1
  71. package/dist/src/commands/metadata-category-configs.d.ts +2 -2
  72. package/dist/src/commands/metadata-category-configs.js +4 -2
  73. package/dist/src/commands/metadata-category-configs.js.map +1 -1
  74. package/dist/src/commands/metadata.js +55 -6
  75. package/dist/src/commands/metadata.js.map +1 -1
  76. package/dist/src/commands/prompts.js +75 -52
  77. package/dist/src/commands/prompts.js.map +1 -1
  78. package/dist/src/commands/rate-counters.d.ts +19 -0
  79. package/dist/src/commands/rate-counters.js +104 -0
  80. package/dist/src/commands/rate-counters.js.map +1 -0
  81. package/dist/src/commands/rule-sets.d.ts +1 -1
  82. package/dist/src/commands/rule-sets.js +2 -1
  83. package/dist/src/commands/rule-sets.js.map +1 -1
  84. package/dist/src/commands/schemas.d.ts +15 -0
  85. package/dist/src/commands/schemas.js +122 -0
  86. package/dist/src/commands/schemas.js.map +1 -0
  87. package/dist/src/commands/scripts.d.ts +9 -17
  88. package/dist/src/commands/scripts.js +24 -479
  89. package/dist/src/commands/scripts.js.map +1 -1
  90. package/dist/src/commands/secrets.d.ts +38 -0
  91. package/dist/src/commands/secrets.js +148 -6
  92. package/dist/src/commands/secrets.js.map +1 -1
  93. package/dist/src/commands/sessions.js +2 -0
  94. package/dist/src/commands/sessions.js.map +1 -1
  95. package/dist/src/commands/skill.js +2 -0
  96. package/dist/src/commands/skill.js.map +1 -1
  97. package/dist/src/commands/spent-tokens.d.ts +19 -0
  98. package/dist/src/commands/spent-tokens.js +79 -0
  99. package/dist/src/commands/spent-tokens.js.map +1 -0
  100. package/dist/src/commands/sync-app-settings.d.ts +58 -0
  101. package/dist/src/commands/sync-app-settings.js +119 -2
  102. package/dist/src/commands/sync-app-settings.js.map +1 -1
  103. package/dist/src/commands/sync-schemas.d.ts +202 -0
  104. package/dist/src/commands/sync-schemas.js +629 -0
  105. package/dist/src/commands/sync-schemas.js.map +1 -0
  106. package/dist/src/commands/sync-user-properties.d.ts +118 -0
  107. package/dist/src/commands/sync-user-properties.js +276 -0
  108. package/dist/src/commands/sync-user-properties.js.map +1 -0
  109. package/dist/src/commands/sync.d.ts +578 -546
  110. package/dist/src/commands/sync.js +3516 -5134
  111. package/dist/src/commands/sync.js.map +1 -1
  112. package/dist/src/commands/tokens.js +5 -3
  113. package/dist/src/commands/tokens.js.map +1 -1
  114. package/dist/src/commands/transitions.d.ts +54 -0
  115. package/dist/src/commands/transitions.js +418 -0
  116. package/dist/src/commands/transitions.js.map +1 -0
  117. package/dist/src/commands/usage.d.ts +42 -0
  118. package/dist/src/commands/usage.js +397 -0
  119. package/dist/src/commands/usage.js.map +1 -0
  120. package/dist/src/commands/user-properties.d.ts +14 -0
  121. package/dist/src/commands/user-properties.js +79 -0
  122. package/dist/src/commands/user-properties.js.map +1 -0
  123. package/dist/src/commands/users.js +951 -18
  124. package/dist/src/commands/users.js.map +1 -1
  125. package/dist/src/commands/vars.js +2 -0
  126. package/dist/src/commands/vars.js.map +1 -1
  127. package/dist/src/commands/waitlist.js +39 -4
  128. package/dist/src/commands/waitlist.js.map +1 -1
  129. package/dist/src/commands/workflows.d.ts +5 -83
  130. package/dist/src/commands/workflows.js +57 -2282
  131. package/dist/src/commands/workflows.js.map +1 -1
  132. package/dist/src/lib/analytics-query.d.ts +58 -0
  133. package/dist/src/lib/analytics-query.js +134 -0
  134. package/dist/src/lib/analytics-query.js.map +1 -0
  135. package/dist/src/lib/api-client.d.ts +1976 -431
  136. package/dist/src/lib/api-client.js +1095 -550
  137. package/dist/src/lib/api-client.js.map +1 -1
  138. package/dist/src/lib/app-settings-descriptor.d.ts +14 -2
  139. package/dist/src/lib/app-settings-descriptor.js +55 -1
  140. package/dist/src/lib/app-settings-descriptor.js.map +1 -1
  141. package/dist/src/lib/auth-fixtures.d.ts +44 -0
  142. package/dist/src/lib/auth-fixtures.js +61 -0
  143. package/dist/src/lib/auth-fixtures.js.map +1 -0
  144. package/dist/src/lib/auth-flow.d.ts +47 -1
  145. package/dist/src/lib/auth-flow.js +451 -14
  146. package/dist/src/lib/auth-flow.js.map +1 -1
  147. package/dist/src/lib/block-layout.d.ts +12 -23
  148. package/dist/src/lib/block-layout.js +26 -92
  149. package/dist/src/lib/block-layout.js.map +1 -1
  150. package/dist/src/lib/block-selector.d.ts +8 -14
  151. package/dist/src/lib/block-selector.js +8 -19
  152. package/dist/src/lib/block-selector.js.map +1 -1
  153. package/dist/src/lib/child-apps-local.d.ts +3 -1
  154. package/dist/src/lib/child-apps-local.js +9 -1
  155. package/dist/src/lib/child-apps-local.js.map +1 -1
  156. package/dist/src/lib/cli-manifest.d.ts +9 -0
  157. package/dist/src/lib/cli-manifest.js +10 -1
  158. package/dist/src/lib/cli-manifest.js.map +1 -1
  159. package/dist/src/lib/cli-version.d.ts +14 -0
  160. package/dist/src/lib/cli-version.js +38 -0
  161. package/dist/src/lib/cli-version.js.map +1 -0
  162. package/dist/src/lib/codegen-shared/prettierStable.d.ts +41 -0
  163. package/dist/src/lib/codegen-shared/prettierStable.js +146 -24
  164. package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -1
  165. package/dist/src/lib/collection-export.d.ts +76 -15
  166. package/dist/src/lib/collection-export.js +116 -23
  167. package/dist/src/lib/collection-export.js.map +1 -1
  168. package/dist/src/lib/collection-principal.d.ts +22 -0
  169. package/dist/src/lib/collection-principal.js +35 -0
  170. package/dist/src/lib/collection-principal.js.map +1 -0
  171. package/dist/src/lib/command-groups.d.ts +30 -0
  172. package/dist/src/lib/command-groups.js +111 -0
  173. package/dist/src/lib/command-groups.js.map +1 -0
  174. package/dist/src/lib/command-status.d.ts +147 -0
  175. package/dist/src/lib/command-status.js +266 -0
  176. package/dist/src/lib/command-status.js.map +1 -0
  177. package/dist/src/lib/config-object-descriptor.d.ts +9 -22
  178. package/dist/src/lib/config-object-descriptor.js +113 -277
  179. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  180. package/dist/src/lib/config-surface.d.ts +3 -7
  181. package/dist/src/lib/config-surface.js +9 -13
  182. package/dist/src/lib/config-surface.js.map +1 -1
  183. package/dist/src/lib/config-toml.d.ts +11 -2
  184. package/dist/src/lib/config-toml.js +25 -2
  185. package/dist/src/lib/config-toml.js.map +1 -1
  186. package/dist/src/lib/credentials-home.d.ts +7 -0
  187. package/dist/src/lib/credentials-home.js +45 -10
  188. package/dist/src/lib/credentials-home.js.map +1 -1
  189. package/dist/src/lib/credentials-lock.d.ts +14 -6
  190. package/dist/src/lib/credentials-lock.js +90 -10
  191. package/dist/src/lib/credentials-lock.js.map +1 -1
  192. package/dist/src/lib/credentials-store.d.ts +142 -70
  193. package/dist/src/lib/credentials-store.js +420 -111
  194. package/dist/src/lib/credentials-store.js.map +1 -1
  195. package/dist/src/lib/custodian.d.ts +8 -0
  196. package/dist/src/lib/custodian.js +18 -0
  197. package/dist/src/lib/custodian.js.map +1 -0
  198. package/dist/src/lib/data-input.d.ts +1 -1
  199. package/dist/src/lib/data-input.js +1 -1
  200. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +1 -1
  201. package/dist/src/lib/db-codegen/dbTsTypes.js +3 -0
  202. package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
  203. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +40 -1
  204. package/dist/src/lib/db-codegen/dbTypeIR.js +32 -8
  205. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
  206. package/dist/src/lib/db-type-records.d.ts +125 -0
  207. package/dist/src/lib/db-type-records.js +237 -0
  208. package/dist/src/lib/db-type-records.js.map +1 -0
  209. package/dist/src/lib/db3-export.d.ts +322 -0
  210. package/dist/src/lib/db3-export.js +767 -0
  211. package/dist/src/lib/db3-export.js.map +1 -0
  212. package/dist/src/lib/db3-index-output.d.ts +116 -0
  213. package/dist/src/lib/db3-index-output.js +223 -0
  214. package/dist/src/lib/db3-index-output.js.map +1 -0
  215. package/dist/src/lib/db3-json-fields.d.ts +49 -0
  216. package/dist/src/lib/db3-json-fields.js +195 -0
  217. package/dist/src/lib/db3-json-fields.js.map +1 -0
  218. package/dist/src/lib/db3-type-archive.d.ts +59 -0
  219. package/dist/src/lib/db3-type-archive.js +95 -0
  220. package/dist/src/lib/db3-type-archive.js.map +1 -0
  221. package/dist/src/lib/db3-type-models.d.ts +148 -0
  222. package/dist/src/lib/db3-type-models.js +583 -0
  223. package/dist/src/lib/db3-type-models.js.map +1 -0
  224. package/dist/src/lib/deprecation.d.ts +2 -2
  225. package/dist/src/lib/deprecation.js +2 -2
  226. package/dist/src/lib/document-export-record-log.d.ts +7 -0
  227. package/dist/src/lib/document-export-record-log.js +9 -0
  228. package/dist/src/lib/document-export-record-log.js.map +1 -1
  229. package/dist/src/lib/document-ingest-artifact.d.ts +19 -0
  230. package/dist/src/lib/document-ingest-artifact.js +55 -6
  231. package/dist/src/lib/document-ingest-artifact.js.map +1 -1
  232. package/dist/src/lib/document-ingest-format2.d.ts +36 -0
  233. package/dist/src/lib/document-ingest-format2.js +78 -0
  234. package/dist/src/lib/document-ingest-format2.js.map +1 -0
  235. package/dist/src/lib/document-ingest-input.d.ts +9 -0
  236. package/dist/src/lib/document-ingest-input.js +28 -1
  237. package/dist/src/lib/document-ingest-input.js.map +1 -1
  238. package/dist/src/lib/document-ingest.d.ts +11 -1
  239. package/dist/src/lib/document-ingest.js +16 -0
  240. package/dist/src/lib/document-ingest.js.map +1 -1
  241. package/dist/src/lib/document-schema-rows.d.ts +42 -0
  242. package/dist/src/lib/document-schema-rows.js +53 -0
  243. package/dist/src/lib/document-schema-rows.js.map +1 -0
  244. package/dist/src/lib/experimental-apis.d.ts +36 -0
  245. package/dist/src/lib/experimental-apis.js +46 -0
  246. package/dist/src/lib/experimental-apis.js.map +1 -0
  247. package/dist/src/lib/file-attachment.d.ts +24 -0
  248. package/dist/src/lib/file-attachment.js +31 -0
  249. package/dist/src/lib/file-attachment.js.map +1 -0
  250. package/dist/src/lib/function-authorize-check.d.ts +142 -0
  251. package/dist/src/lib/function-authorize-check.js +311 -0
  252. package/dist/src/lib/function-authorize-check.js.map +1 -0
  253. package/dist/src/lib/function-authorize-view.d.ts +36 -0
  254. package/dist/src/lib/function-authorize-view.js +110 -0
  255. package/dist/src/lib/function-authorize-view.js.map +1 -0
  256. package/dist/src/lib/function-bundle.d.ts +27 -5
  257. package/dist/src/lib/function-bundle.js +142 -7
  258. package/dist/src/lib/function-bundle.js.map +1 -1
  259. package/dist/src/lib/function-collect.d.ts +112 -12
  260. package/dist/src/lib/function-collect.js +601 -12
  261. package/dist/src/lib/function-collect.js.map +1 -1
  262. package/dist/src/lib/function-db-types.d.ts +65 -11
  263. package/dist/src/lib/function-db-types.js +326 -157
  264. package/dist/src/lib/function-db-types.js.map +1 -1
  265. package/dist/src/lib/function-document-types.d.ts +19 -7
  266. package/dist/src/lib/function-document-types.js +24 -12
  267. package/dist/src/lib/function-document-types.js.map +1 -1
  268. package/dist/src/lib/function-grants-preflight.d.ts +99 -0
  269. package/dist/src/lib/function-grants-preflight.js +154 -2
  270. package/dist/src/lib/function-grants-preflight.js.map +1 -1
  271. package/dist/src/lib/function-lint.d.ts +85 -0
  272. package/dist/src/lib/function-lint.js +442 -0
  273. package/dist/src/lib/function-lint.js.map +1 -0
  274. package/dist/src/lib/function-log-row.js +21 -2
  275. package/dist/src/lib/function-log-row.js.map +1 -1
  276. package/dist/src/lib/function-run.d.ts +13 -21
  277. package/dist/src/lib/function-run.js +14 -27
  278. package/dist/src/lib/function-run.js.map +1 -1
  279. package/dist/src/lib/function-schema-codegen.d.ts +86 -22
  280. package/dist/src/lib/function-schema-codegen.js +194 -88
  281. package/dist/src/lib/function-schema-codegen.js.map +1 -1
  282. package/dist/src/lib/function-schema-refs.d.ts +98 -0
  283. package/dist/src/lib/function-schema-refs.js +177 -0
  284. package/dist/src/lib/function-schema-refs.js.map +1 -0
  285. package/dist/src/lib/function-sync.d.ts +120 -6
  286. package/dist/src/lib/function-sync.js +217 -26
  287. package/dist/src/lib/function-sync.js.map +1 -1
  288. package/dist/src/lib/function-trigger-listing.d.ts +11 -6
  289. package/dist/src/lib/function-trigger-listing.js +32 -11
  290. package/dist/src/lib/function-trigger-listing.js.map +1 -1
  291. package/dist/src/lib/function-typecheck.d.ts +52 -0
  292. package/dist/src/lib/function-typecheck.js +174 -54
  293. package/dist/src/lib/function-typecheck.js.map +1 -1
  294. package/dist/src/lib/function-versions.d.ts +2 -0
  295. package/dist/src/lib/function-versions.js +1 -0
  296. package/dist/src/lib/function-versions.js.map +1 -1
  297. package/dist/src/lib/generated-build-flags.d.ts +13 -0
  298. package/dist/src/lib/generated-build-flags.js +14 -0
  299. package/dist/src/lib/generated-build-flags.js.map +1 -0
  300. package/dist/src/lib/generated-command-status.d.ts +6 -0
  301. package/dist/src/lib/generated-command-status.js +502 -0
  302. package/dist/src/lib/generated-command-status.js.map +1 -0
  303. package/dist/src/lib/generated-config-surfaces.d.ts +804 -140
  304. package/dist/src/lib/generated-config-surfaces.js +2491 -1806
  305. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  306. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  307. package/dist/src/lib/generated-sdk-types.js +1 -1
  308. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  309. package/dist/src/lib/hosting-build.d.ts +97 -0
  310. package/dist/src/lib/hosting-build.js +204 -0
  311. package/dist/src/lib/hosting-build.js.map +1 -0
  312. package/dist/src/lib/hosting-client.d.ts +167 -0
  313. package/dist/src/lib/hosting-client.js +340 -0
  314. package/dist/src/lib/hosting-client.js.map +1 -0
  315. package/dist/src/lib/hosting-environments.d.ts +32 -0
  316. package/dist/src/lib/hosting-environments.js +74 -0
  317. package/dist/src/lib/hosting-environments.js.map +1 -0
  318. package/dist/src/lib/hosting-errors.d.ts +30 -0
  319. package/dist/src/lib/hosting-errors.js +43 -0
  320. package/dist/src/lib/hosting-errors.js.map +1 -0
  321. package/dist/src/lib/hosting-token.d.ts +46 -0
  322. package/dist/src/lib/hosting-token.js +60 -0
  323. package/dist/src/lib/hosting-token.js.map +1 -0
  324. package/dist/src/lib/hosting-trust-step.d.ts +67 -0
  325. package/dist/src/lib/hosting-trust-step.js +279 -0
  326. package/dist/src/lib/hosting-trust-step.js.map +1 -0
  327. package/dist/src/lib/hosting-trust.d.ts +77 -0
  328. package/dist/src/lib/hosting-trust.js +194 -0
  329. package/dist/src/lib/hosting-trust.js.map +1 -0
  330. package/dist/src/lib/hosting-wait.d.ts +42 -0
  331. package/dist/src/lib/hosting-wait.js +84 -0
  332. package/dist/src/lib/hosting-wait.js.map +1 -0
  333. package/dist/src/lib/hosting-wfp-upload.d.ts +86 -0
  334. package/dist/src/lib/hosting-wfp-upload.js +149 -0
  335. package/dist/src/lib/hosting-wfp-upload.js.map +1 -0
  336. package/dist/src/lib/init-assets.d.ts +2 -6
  337. package/dist/src/lib/init-assets.js +11 -27
  338. package/dist/src/lib/init-assets.js.map +1 -1
  339. package/dist/src/lib/init-ios-links.d.ts +11 -7
  340. package/dist/src/lib/init-ios-links.js +28 -22
  341. package/dist/src/lib/init-ios-links.js.map +1 -1
  342. package/dist/src/lib/init-login-note.d.ts +13 -0
  343. package/dist/src/lib/init-login-note.js +22 -0
  344. package/dist/src/lib/init-login-note.js.map +1 -0
  345. package/dist/src/lib/init-schema.d.ts +15 -0
  346. package/dist/src/lib/init-schema.js +54 -0
  347. package/dist/src/lib/init-schema.js.map +1 -1
  348. package/dist/src/lib/integration-test-request.d.ts +54 -0
  349. package/dist/src/lib/integration-test-request.js +207 -0
  350. package/dist/src/lib/integration-test-request.js.map +1 -0
  351. package/dist/src/lib/invoker-shared-enums.d.ts +35 -0
  352. package/dist/src/lib/invoker-shared-enums.js +98 -0
  353. package/dist/src/lib/invoker-shared-enums.js.map +1 -0
  354. package/dist/src/lib/json-value.d.ts +6 -0
  355. package/dist/src/lib/json-value.js +13 -0
  356. package/dist/src/lib/json-value.js.map +1 -0
  357. package/dist/src/lib/load-routes.d.ts +33 -0
  358. package/dist/src/lib/load-routes.js +35 -0
  359. package/dist/src/lib/load-routes.js.map +1 -0
  360. package/dist/src/lib/log-inspection.d.ts +23 -4
  361. package/dist/src/lib/log-inspection.js +14 -5
  362. package/dist/src/lib/log-inspection.js.map +1 -1
  363. package/dist/src/lib/login-exchange-check.d.ts +18 -0
  364. package/dist/src/lib/login-exchange-check.js +27 -0
  365. package/dist/src/lib/login-exchange-check.js.map +1 -0
  366. package/dist/src/lib/login-scope-lines.d.ts +17 -7
  367. package/dist/src/lib/login-scope-lines.js +33 -10
  368. package/dist/src/lib/login-scope-lines.js.map +1 -1
  369. package/dist/src/lib/metadata-report.d.ts +85 -0
  370. package/dist/src/lib/metadata-report.js +81 -0
  371. package/dist/src/lib/metadata-report.js.map +1 -0
  372. package/dist/src/lib/object-status-filter.d.ts +9 -1
  373. package/dist/src/lib/object-status-filter.js +9 -1
  374. package/dist/src/lib/object-status-filter.js.map +1 -1
  375. package/dist/src/lib/output.d.ts +1 -1
  376. package/dist/src/lib/output.js +3 -1
  377. package/dist/src/lib/output.js.map +1 -1
  378. package/dist/src/lib/pin-refusal-hint.d.ts +12 -0
  379. package/dist/src/lib/pin-refusal-hint.js +35 -0
  380. package/dist/src/lib/pin-refusal-hint.js.map +1 -0
  381. package/dist/src/lib/platform-owned.js +5 -0
  382. package/dist/src/lib/platform-owned.js.map +1 -1
  383. package/dist/src/lib/primitive-declaration-names.d.ts +21 -0
  384. package/dist/src/lib/primitive-declaration-names.js +22 -0
  385. package/dist/src/lib/primitive-declaration-names.js.map +1 -0
  386. package/dist/src/lib/primitive-declaration.d.ts +174 -0
  387. package/dist/src/lib/primitive-declaration.js +871 -0
  388. package/dist/src/lib/primitive-declaration.js.map +1 -0
  389. package/dist/src/lib/primitive-env-plugin.d.ts +99 -0
  390. package/dist/src/lib/primitive-env-plugin.js +408 -0
  391. package/dist/src/lib/primitive-env-plugin.js.map +1 -0
  392. package/dist/src/lib/project-login-apps.d.ts +8 -0
  393. package/dist/src/lib/project-login-apps.js +27 -0
  394. package/dist/src/lib/project-login-apps.js.map +1 -0
  395. package/dist/src/lib/prompt-schema-codegen.d.ts +36 -12
  396. package/dist/src/lib/prompt-schema-codegen.js +96 -100
  397. package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
  398. package/dist/src/lib/prompt-schema-document.d.ts +35 -0
  399. package/dist/src/lib/prompt-schema-document.js +92 -0
  400. package/dist/src/lib/prompt-schema-document.js.map +1 -0
  401. package/dist/src/lib/prompt-schema-refs.d.ts +173 -0
  402. package/dist/src/lib/prompt-schema-refs.js +478 -0
  403. package/dist/src/lib/prompt-schema-refs.js.map +1 -0
  404. package/dist/src/lib/records-verbs.d.ts +79 -0
  405. package/dist/src/lib/records-verbs.js +45 -0
  406. package/dist/src/lib/records-verbs.js.map +1 -0
  407. package/dist/src/lib/refresh-admin-credentials.d.ts +34 -4
  408. package/dist/src/lib/refresh-admin-credentials.js +85 -29
  409. package/dist/src/lib/refresh-admin-credentials.js.map +1 -1
  410. package/dist/src/lib/refresh-stored-login.d.ts +85 -0
  411. package/dist/src/lib/refresh-stored-login.js +233 -0
  412. package/dist/src/lib/refresh-stored-login.js.map +1 -0
  413. package/dist/src/lib/register-commands.d.ts +36 -0
  414. package/dist/src/lib/register-commands.js +37 -0
  415. package/dist/src/lib/register-commands.js.map +1 -0
  416. package/dist/src/lib/retired-imports.d.ts +53 -0
  417. package/dist/src/lib/retired-imports.js +120 -0
  418. package/dist/src/lib/retired-imports.js.map +1 -0
  419. package/dist/src/lib/row-field-rename.d.ts +18 -0
  420. package/dist/src/lib/row-field-rename.js +32 -0
  421. package/dist/src/lib/row-field-rename.js.map +1 -0
  422. package/dist/src/lib/run-status.d.ts +1 -1
  423. package/dist/src/lib/run-status.generated.d.ts +2 -2
  424. package/dist/src/lib/run-status.generated.js +3 -1
  425. package/dist/src/lib/run-status.generated.js.map +1 -1
  426. package/dist/src/lib/run-status.js +1 -1
  427. package/dist/src/lib/schema-codegen/compiledSpace.d.ts +62 -0
  428. package/dist/src/lib/schema-codegen/compiledSpace.js +103 -0
  429. package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -0
  430. package/dist/src/lib/schema-codegen/generated-db3-bridge.d.ts +86 -0
  431. package/dist/src/lib/schema-codegen/generated-db3-bridge.js +227 -0
  432. package/dist/src/lib/schema-codegen/generated-db3-bridge.js.map +1 -0
  433. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.d.ts +85 -0
  434. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js +86 -0
  435. package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js.map +1 -0
  436. package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +229 -0
  437. package/dist/src/lib/schema-codegen/generated-field-grammar.js +420 -0
  438. package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -0
  439. package/dist/src/lib/schema-codegen/generated-field-table.d.ts +80 -0
  440. package/dist/src/lib/schema-codegen/generated-field-table.js +542 -0
  441. package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -0
  442. package/dist/src/lib/schema-codegen/generated-prompt-schemas.d.ts +195 -0
  443. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js +503 -0
  444. package/dist/src/lib/schema-codegen/generated-prompt-schemas.js.map +1 -0
  445. package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +258 -0
  446. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +422 -0
  447. package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -0
  448. package/dist/src/lib/schema-codegen/generated-schema-file.d.ts +129 -0
  449. package/dist/src/lib/schema-codegen/generated-schema-file.js +475 -0
  450. package/dist/src/lib/schema-codegen/generated-schema-file.js.map +1 -0
  451. package/dist/src/lib/schema-codegen/generated-schema-provenance.d.ts +115 -0
  452. package/dist/src/lib/schema-codegen/generated-schema-provenance.js +274 -0
  453. package/dist/src/lib/schema-codegen/generated-schema-provenance.js.map +1 -0
  454. package/dist/src/lib/schema-codegen/generated-schema-refs.d.ts +366 -0
  455. package/dist/src/lib/schema-codegen/generated-schema-refs.js +1789 -0
  456. package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -0
  457. package/dist/src/lib/schema-codegen/generated-schema-shape.d.ts +27 -0
  458. package/dist/src/lib/schema-codegen/generated-schema-shape.js +126 -0
  459. package/dist/src/lib/schema-codegen/generated-schema-shape.js.map +1 -0
  460. package/dist/src/lib/schema-codegen/namedRefs.d.ts +56 -0
  461. package/dist/src/lib/schema-codegen/namedRefs.js +143 -0
  462. package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -0
  463. package/dist/src/lib/schema-codegen/naming.d.ts +35 -0
  464. package/dist/src/lib/schema-codegen/naming.js +83 -0
  465. package/dist/src/lib/schema-codegen/naming.js.map +1 -0
  466. package/dist/src/lib/schema-codegen/schemaChanges.d.ts +74 -0
  467. package/dist/src/lib/schema-codegen/schemaChanges.js +277 -0
  468. package/dist/src/lib/schema-codegen/schemaChanges.js.map +1 -0
  469. package/dist/src/lib/schema-codegen/schemaDocs.d.ts +69 -0
  470. package/dist/src/lib/schema-codegen/schemaDocs.js +219 -0
  471. package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -0
  472. package/dist/src/lib/schema-codegen/schemaIR.d.ts +158 -0
  473. package/dist/src/lib/schema-codegen/schemaIR.js +279 -0
  474. package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -0
  475. package/dist/src/lib/schema-codegen/schemaToTs.d.ts +109 -0
  476. package/dist/src/lib/schema-codegen/schemaToTs.js +269 -0
  477. package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -0
  478. package/dist/src/lib/schema-codegen/valuesLists.d.ts +48 -0
  479. package/dist/src/lib/schema-codegen/valuesLists.js +144 -0
  480. package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -0
  481. package/dist/src/lib/schema-defs-module.d.ts +29 -0
  482. package/dist/src/lib/schema-defs-module.js +103 -0
  483. package/dist/src/lib/schema-defs-module.js.map +1 -0
  484. package/dist/src/lib/schema-family-index.d.ts +228 -0
  485. package/dist/src/lib/schema-family-index.js +813 -0
  486. package/dist/src/lib/schema-family-index.js.map +1 -0
  487. package/dist/src/lib/schema-pins.d.ts +82 -0
  488. package/dist/src/lib/schema-pins.js +198 -0
  489. package/dist/src/lib/schema-pins.js.map +1 -0
  490. package/dist/src/lib/schema-preview.d.ts +244 -0
  491. package/dist/src/lib/schema-preview.js +498 -0
  492. package/dist/src/lib/schema-preview.js.map +1 -0
  493. package/dist/src/lib/scope-request.d.ts +23 -11
  494. package/dist/src/lib/scope-request.js +69 -31
  495. package/dist/src/lib/scope-request.js.map +1 -1
  496. package/dist/src/lib/session-scope.d.ts +26 -0
  497. package/dist/src/lib/session-scope.js +58 -0
  498. package/dist/src/lib/session-scope.js.map +1 -0
  499. package/dist/src/lib/skill-installer.d.ts +2 -2
  500. package/dist/src/lib/skill-installer.js +2 -21
  501. package/dist/src/lib/skill-installer.js.map +1 -1
  502. package/dist/src/lib/step-run-table.d.ts +1 -2
  503. package/dist/src/lib/step-run-table.js +1 -2
  504. package/dist/src/lib/step-run-table.js.map +1 -1
  505. package/dist/src/lib/swift-codegen/agentGenerator.d.ts +2 -1
  506. package/dist/src/lib/swift-codegen/agentGenerator.js +25 -23
  507. package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
  508. package/dist/src/lib/swift-codegen/banners.d.ts +12 -0
  509. package/dist/src/lib/swift-codegen/banners.js +12 -0
  510. package/dist/src/lib/swift-codegen/banners.js.map +1 -1
  511. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +36 -1
  512. package/dist/src/lib/swift-codegen/functionGenerator.js +169 -51
  513. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  514. package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +33 -9
  515. package/dist/src/lib/swift-codegen/schemaToSwift.js +215 -179
  516. package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
  517. package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +51 -0
  518. package/dist/src/lib/swift-codegen/sharedGenerator.js +239 -0
  519. package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
  520. package/dist/src/lib/swift-codegen/swiftKeys.d.ts +19 -0
  521. package/dist/src/lib/swift-codegen/swiftKeys.js +31 -0
  522. package/dist/src/lib/swift-codegen/swiftKeys.js.map +1 -0
  523. package/dist/src/lib/swift-codegen/userPropertiesGenerator.d.ts +30 -0
  524. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js +69 -0
  525. package/dist/src/lib/swift-codegen/userPropertiesGenerator.js.map +1 -0
  526. package/dist/src/lib/sync-resource-types.d.ts +117 -31
  527. package/dist/src/lib/sync-resource-types.js +197 -189
  528. package/dist/src/lib/sync-resource-types.js.map +1 -1
  529. package/dist/src/lib/sync-selectors.d.ts +7 -0
  530. package/dist/src/lib/sync-selectors.js +22 -2
  531. package/dist/src/lib/sync-selectors.js.map +1 -1
  532. package/dist/src/lib/template.d.ts +39 -3
  533. package/dist/src/lib/template.js +103 -14
  534. package/dist/src/lib/template.js.map +1 -1
  535. package/dist/src/lib/test-case-file-names.d.ts +3 -5
  536. package/dist/src/lib/test-case-file-names.js +3 -5
  537. package/dist/src/lib/test-case-file-names.js.map +1 -1
  538. package/dist/src/lib/test-runs.d.ts +45 -0
  539. package/dist/src/lib/test-runs.js +150 -0
  540. package/dist/src/lib/test-runs.js.map +1 -0
  541. package/dist/src/lib/test-users.d.ts +25 -0
  542. package/dist/src/lib/test-users.js +36 -0
  543. package/dist/src/lib/test-users.js.map +1 -0
  544. package/dist/src/lib/toml-database-config.d.ts +4 -2
  545. package/dist/src/lib/toml-database-config.js +11 -6
  546. package/dist/src/lib/toml-database-config.js.map +1 -1
  547. package/dist/src/lib/toml-list-edit.d.ts +33 -0
  548. package/dist/src/lib/toml-list-edit.js +481 -0
  549. package/dist/src/lib/toml-list-edit.js.map +1 -0
  550. package/dist/src/lib/toml-scalar-edit.d.ts +9 -0
  551. package/dist/src/lib/toml-scalar-edit.js +73 -5
  552. package/dist/src/lib/toml-scalar-edit.js.map +1 -1
  553. package/dist/src/lib/transition-warnings.d.ts +21 -0
  554. package/dist/src/lib/transition-warnings.js +49 -0
  555. package/dist/src/lib/transition-warnings.js.map +1 -0
  556. package/dist/src/lib/usage-meters.d.ts +16 -0
  557. package/dist/src/lib/usage-meters.js +52 -0
  558. package/dist/src/lib/usage-meters.js.map +1 -0
  559. package/dist/src/lib/user-index.d.ts +80 -0
  560. package/dist/src/lib/user-index.js +166 -0
  561. package/dist/src/lib/user-index.js.map +1 -0
  562. package/dist/src/lib/user-properties/generated-properties-schema.d.ts +159 -0
  563. package/dist/src/lib/user-properties/generated-properties-schema.js +471 -0
  564. package/dist/src/lib/user-properties/generated-properties-schema.js.map +1 -0
  565. package/dist/src/lib/user-properties/user-properties-codegen.d.ts +55 -0
  566. package/dist/src/lib/user-properties/user-properties-codegen.js +129 -0
  567. package/dist/src/lib/user-properties/user-properties-codegen.js.map +1 -0
  568. package/dist/src/lib/user-walk.d.ts +31 -0
  569. package/dist/src/lib/user-walk.js +102 -0
  570. package/dist/src/lib/user-walk.js.map +1 -0
  571. package/dist/src/lib/webhook-capture.d.ts +43 -0
  572. package/dist/src/lib/webhook-capture.js +91 -0
  573. package/dist/src/lib/webhook-capture.js.map +1 -0
  574. package/dist/src/lib/webhook-deliver.d.ts +18 -20
  575. package/dist/src/lib/webhook-deliver.js +34 -89
  576. package/dist/src/lib/webhook-deliver.js.map +1 -1
  577. package/dist/src/lib/webhook-test-run.d.ts +32 -0
  578. package/dist/src/lib/webhook-test-run.js +108 -0
  579. package/dist/src/lib/webhook-test-run.js.map +1 -0
  580. package/dist/src/lib/worker-perf-format.d.ts +22 -0
  581. package/dist/src/lib/worker-perf-format.js +27 -0
  582. package/dist/src/lib/worker-perf-format.js.map +1 -0
  583. package/dist/src/types/index.d.ts +20 -65
  584. package/dist/src/validators.d.ts +7 -55
  585. package/dist/src/validators.js +7 -53
  586. package/dist/src/validators.js.map +1 -1
  587. package/dist/src/vite.d.ts +17 -0
  588. package/dist/src/vite.js +18 -0
  589. package/dist/src/vite.js.map +1 -0
  590. package/package.json +20 -9
@@ -1,5 +1,4 @@
1
1
  import { type ListEnvelope } from "./paginate.js";
2
- import { type GlobalAppRef, type WorkflowUsageReport } from "./workflow-usage.js";
3
2
  /**
4
3
  * #4262 — an agent prompt's test case: its `[test.agent]` block on the wire.
5
4
  * `agentHistory` is JSON text; context and the expected call are parsed.
@@ -29,6 +28,71 @@ export interface BlobInfo {
29
28
  uploaded?: string | null;
30
29
  etag?: string | null;
31
30
  }
31
+ /**
32
+ * The `authorize` and `input` fields of one function version as the admin API
33
+ * answers it (a configs-list item, a version get, a push answer). `input` is
34
+ * the list of top-level input keys the version's `authorize` callable declared,
35
+ * recorded by the server at push; `null` for a version without `authorize` and
36
+ * for one that declared no list. Annotate a version read with it to type the
37
+ * two fields.
38
+ */
39
+ export interface FunctionVersionInputFields {
40
+ authorize?: boolean;
41
+ input?: string[] | null;
42
+ /** #5840 — whether this version opens to signed-out callers. */
43
+ signedOut?: boolean;
44
+ /**
45
+ * #5844 — the version's `[function] public` options, as push stored them;
46
+ * `null` when it stores none.
47
+ */
48
+ publicOptions?: {
49
+ cacheSeconds?: number;
50
+ cors?: "*";
51
+ turnstile?: true;
52
+ rate?: "low" | "medium" | "high";
53
+ } | null;
54
+ }
55
+ /**
56
+ * The live version's `authorize` flag and `input` list as the function get
57
+ * and each functions-list item answer them. Both are `null` when no version is
58
+ * active; `activeConfigInput` is also `null` when the live version recorded no
59
+ * list.
60
+ */
61
+ export interface FunctionActiveInputFields {
62
+ activeConfigAuthorize?: boolean | null;
63
+ activeConfigInput?: string[] | null;
64
+ /**
65
+ * #5840 — whether the live version opens to signed-out callers while the
66
+ * app's `signedOutAccess` is on; `null` when no version is active.
67
+ */
68
+ activeConfigSignedOut?: boolean | null;
69
+ }
70
+ /**
71
+ * An app as `GET /admin/api/apps/{appId}` serializes it. Dates are ISO-8601
72
+ * strings. The lineage fields are null on an app with no parent, and
73
+ * `ownerAdminId`, `branch`, `idleDays` and `expiresAt` appear only on a child.
74
+ */
75
+ export interface AdminApp {
76
+ appId: string;
77
+ name: string;
78
+ mode: string;
79
+ baseUrl: string | null;
80
+ createdBy: string | null;
81
+ /** The format new root documents are minted in, or null when the app never chose. */
82
+ rootDocumentFormat: string | null;
83
+ protection: string;
84
+ parentAppId: string | null;
85
+ childSlug: string | null;
86
+ lastActivityAt: string | null;
87
+ ownerAdminId?: string | null;
88
+ branch?: string | null;
89
+ idleDays?: number | null;
90
+ expiresAt?: string | null;
91
+ createdAt: string;
92
+ modifiedAt: string;
93
+ /** The app's remaining settings (auth, CORS, passkeys, invitations, …). */
94
+ [setting: string]: unknown;
95
+ }
32
96
  /**
33
97
  * One child app as `GET /admin/api/apps/{appId}/children` lists it. Dates
34
98
  * are ISO-8601 strings.
@@ -61,6 +125,328 @@ export interface ChildPreviewOrigins {
61
125
  childSlug: string;
62
126
  previewOrigins: string[];
63
127
  }
128
+ /** One row of a db3's index registry, as `db3/:id/indexes` answers it. */
129
+ /** What a db3 index is (#5220). */
130
+ export type Db3IndexKind = "scalar" | "members" | "text" | "vector";
131
+ /** Where a db3 index lives (#5220). */
132
+ export type Db3IndexPlacement = "server" | "device" | "both";
133
+ /** A `vector` index's options on its registration (#5225): how devices search the field. */
134
+ export interface Db3VectorIndexOptions {
135
+ distance?: "cos" | "l2";
136
+ index?: "exact" | {
137
+ mode: "ann";
138
+ nbucket?: number;
139
+ codesize?: number;
140
+ quantizer?: "pq" | "opq" | "bq";
141
+ };
142
+ }
143
+ export interface Db3IndexRow {
144
+ name: string;
145
+ model: string;
146
+ fields: string[];
147
+ unique: boolean;
148
+ /** `true` for a string-set field's member index; absent on any other. */
149
+ members?: boolean;
150
+ origins: Array<{
151
+ kind: "declaration" | "named";
152
+ unique: boolean;
153
+ }>;
154
+ /** What the index is; a server from before #5220 lists none. */
155
+ kind?: Db3IndexKind;
156
+ /** Where the index lives; a server from before #5220 lists none. */
157
+ on?: Db3IndexPlacement;
158
+ /** A text index's options, every one filled in (#5222); absent on any other kind. */
159
+ text?: Db3TextIndexOptions;
160
+ /** A vector index's options filled in, with its field's `dims` and `element` (#5229); absent on any other kind. */
161
+ vector?: Db3VectorIndexOptions & {
162
+ dims?: number;
163
+ element?: "f32" | "f16" | "i8";
164
+ };
165
+ /** A vector index's generation: new at every registration (#5229). */
166
+ generation?: number;
167
+ /** A vector index's model revision: moved on when its model is deleted (#5229). */
168
+ revision?: number;
169
+ /** An `ann` vector index's shared model, once a device uploaded one (#5229). */
170
+ annModel?: Db3IndexAnnModel;
171
+ }
172
+ /** An `ann` vector index's shared model as `GET db3/:id/indexes` lists it (#5229). */
173
+ export interface Db3IndexAnnModel {
174
+ revision: number;
175
+ trainedAt: string;
176
+ rows: number;
177
+ bytes: number;
178
+ format: string;
179
+ }
180
+ /** What `db3/:id/records/:model/explain` takes (#5240): the read, as its records route takes it, and an optional force. */
181
+ export interface Db3ExplainRequest {
182
+ op: "query" | "count" | "aggregate";
183
+ filter?: Record<string, any>;
184
+ options?: {
185
+ sort?: unknown;
186
+ limit?: number | string;
187
+ cursor?: string;
188
+ include?: unknown;
189
+ };
190
+ aggregate?: Record<string, unknown>;
191
+ /** An index of the model to force the read onto, or `"none"`. */
192
+ index?: string;
193
+ }
194
+ /** One statement an explained read ran (#5240). */
195
+ export interface Db3ExplainedStatement {
196
+ model: string;
197
+ sql: string;
198
+ runs: number;
199
+ plan: string[] | null;
200
+ planError?: string;
201
+ indexes: string[];
202
+ scan: boolean;
203
+ }
204
+ /** What `db3/:id/records/:model/explain` answers (#5240). */
205
+ export interface Db3ExplainAnswer {
206
+ op: "query" | "count" | "aggregate";
207
+ model: string;
208
+ index: string | null;
209
+ indexes: string[];
210
+ scanned: string[];
211
+ statements: Db3ExplainedStatement[];
212
+ answered: number;
213
+ cost: {
214
+ rowsRead: number | null;
215
+ rowsWritten: number | null;
216
+ };
217
+ stats: boolean;
218
+ sqlite: string;
219
+ }
220
+ /** A text index's tokenizer (#5222). */
221
+ export type Db3TextTokenizer = "unicode61" | "porter";
222
+ /** A text index's options (#5222): as `list` answers them every one is filled in; a registration gives any. */
223
+ export interface Db3TextIndexOptions {
224
+ tokenizer: Db3TextTokenizer;
225
+ prefix: number[];
226
+ weights: Record<string, number>;
227
+ }
228
+ /** `GET`/`PATCH users/index/limits`: the shard limit overrides and effective limits, and the property caps. */
229
+ export interface UserIndexLimitsAnswer {
230
+ overrides: Record<string, number | null> | null;
231
+ effective: Record<string, unknown>;
232
+ caps?: {
233
+ effective: Record<string, number>;
234
+ overrides: Record<string, number | null> | null;
235
+ };
236
+ }
237
+ /** One revalidation slice of an app's user index: when it ran, what started it, and its counts. */
238
+ export type UserIndexSlice = {
239
+ at: string;
240
+ startedAt: string;
241
+ durationMs: number;
242
+ trigger: "alarm" | "demand";
243
+ intervalMs: number;
244
+ nextAt: string;
245
+ batches: number;
246
+ continuations: number;
247
+ behind: boolean;
248
+ hinted: number;
249
+ verified: number;
250
+ stamped: number;
251
+ reprojected: number;
252
+ deleted: number;
253
+ applied: number;
254
+ misplaced: number;
255
+ failed: number;
256
+ sourcePages: number;
257
+ swept: number;
258
+ invitationClaims: number;
259
+ };
260
+ /**
261
+ * `POST users/index/reconcile`: 202 once one slice ran, or 200 with no slice
262
+ * while the app is being deleted.
263
+ */
264
+ export type UserIndexReconcileAnswer = {
265
+ ok: boolean;
266
+ started: true;
267
+ mode: "slice";
268
+ slice: UserIndexSlice;
269
+ reason?: undefined;
270
+ } | {
271
+ ok: boolean;
272
+ started: false;
273
+ reason: "closed";
274
+ };
275
+ /** The body of `POST users/walks` (#5393): the batch function, the walk's key, which users in what batches. */
276
+ export interface UserWalkStartBody {
277
+ function: string;
278
+ key: string;
279
+ filter?: Record<string, unknown>;
280
+ sort?: Record<string, 1 | -1>;
281
+ input?: unknown;
282
+ batchSize?: number;
283
+ concurrency?: number;
284
+ snapshot?: boolean;
285
+ }
286
+ /** A started (or found) users walk. */
287
+ export interface UserWalkStartAnswer {
288
+ runId: string;
289
+ walkId: string;
290
+ key: string;
291
+ status: string;
292
+ existing: boolean;
293
+ }
294
+ /** A users walk read: the coordinator's view (null when it holds no state) and the walk's run row. */
295
+ export interface UserWalkAnswer {
296
+ status: {
297
+ status: string;
298
+ walk: Record<string, any> | null;
299
+ };
300
+ run: Record<string, any>;
301
+ /** On a terminate only: whether this call ended the walk. */
302
+ terminated?: boolean;
303
+ }
304
+ /** One window length of a rate counter, as `GET rate-counters/:key` answers it. */
305
+ export interface RateCounterWindow {
306
+ windowSeconds: number;
307
+ /** The limit of the latest lease request. */
308
+ limit: number;
309
+ windowStart: string;
310
+ windowEnd: string;
311
+ granted: number;
312
+ returned: number;
313
+ held: number;
314
+ remaining: number;
315
+ /** Lease requests answered with no slots in the window. */
316
+ emptyGrants: number;
317
+ /** Isolates holding leases in the window; `leases` lists at most 50. */
318
+ leaseCount: number;
319
+ leases: Array<{
320
+ isolateId: string;
321
+ granted: number;
322
+ returned: number;
323
+ lastLeaseAt: string;
324
+ }>;
325
+ previous: {
326
+ windowStart: string;
327
+ granted: number;
328
+ returned: number;
329
+ emptyGrants: number;
330
+ } | null;
331
+ }
332
+ /** `GET /admin/api/apps/:appId/rate-counters/:key`: `counters` is empty for a key nothing counted. */
333
+ export interface RateCounterState {
334
+ appId: string;
335
+ key: string;
336
+ counters: RateCounterWindow[];
337
+ }
338
+ /** A single-use token's one use, as `GET /admin/api/apps/:appId/spent-tokens/:tokenId` answers it. */
339
+ export interface SpentTokenState {
340
+ tokenId: string;
341
+ /** What kind of token it is, e.g. `"db3-blob-upload"`. */
342
+ purpose: string;
343
+ usedAt: string;
344
+ /** The token's expiry; the row may be removed after it. */
345
+ expiresAt: string | null;
346
+ }
347
+ /** The active user properties schema, as `GET users/properties` answers it. */
348
+ export interface UserPropertiesActive {
349
+ version: number;
350
+ hash: string;
351
+ fields: Record<string, any>;
352
+ uniqueConstraints: Array<{
353
+ name: string;
354
+ fields: string[];
355
+ }>;
356
+ modifiedAt: string | null;
357
+ }
358
+ /** `GET users/properties`. */
359
+ export interface UserPropertiesState {
360
+ appId: string;
361
+ active: UserPropertiesActive | null;
362
+ /** Always null: a push publishes or is refused at once. */
363
+ staged: null;
364
+ removedFields: Record<string, {
365
+ type: string;
366
+ removedAt: string;
367
+ }>;
368
+ caps: {
369
+ effective: Record<string, number>;
370
+ overrides: Record<string, number | null> | null;
371
+ };
372
+ }
373
+ /** One member with their properties, as `GET users/{userId}`, `POST users/get-by` and a property write answer it (#5386). */
374
+ export interface AppUserWithProperties {
375
+ userId: string;
376
+ email: string | null;
377
+ name: string | null;
378
+ avatarUrl: string | null;
379
+ role: string | null;
380
+ status: string;
381
+ disabledAt?: string;
382
+ addedAt: string | null;
383
+ testUser: boolean;
384
+ properties: Record<string, unknown>;
385
+ }
386
+ /** A property write's body (#5386): a merge-patch (null clears), set additions and removals, and a condition checked inside the write. */
387
+ export interface AppUserPropertiesWrite {
388
+ patch?: Record<string, unknown>;
389
+ addToSet?: Record<string, string[]>;
390
+ removeFromSet?: Record<string, string[]>;
391
+ condition?: Record<string, unknown>;
392
+ }
393
+ /** `PUT users/properties`. */
394
+ export interface UserPropertiesPushAnswer {
395
+ outcome: "published" | "unchanged" | "would-publish";
396
+ active?: UserPropertiesActive | null;
397
+ removedFields?: Record<string, {
398
+ type: string;
399
+ removedAt: string;
400
+ }>;
401
+ checks?: Array<Record<string, unknown>>;
402
+ }
403
+ /** One version of a `schemas/` file, as `GET …/schemas` lists it (#5532). */
404
+ export interface SchemaFileMeta {
405
+ file: string;
406
+ version: number;
407
+ tombstone: boolean;
408
+ /** sha256 hex of the source; null on a tombstone. */
409
+ sourceHash: string | null;
410
+ /** The file's def names, in file order; empty on a tombstone. */
411
+ defs: string[];
412
+ createdAt: string;
413
+ }
414
+ /** One version of a `schemas/` file with its source and compiled defs (`GET …/schemas/:file`). */
415
+ export interface SchemaFileVersion extends SchemaFileMeta {
416
+ /** Whether this is the file's current version. */
417
+ current: boolean;
418
+ createdBy: string;
419
+ source: string | null;
420
+ /**
421
+ * The compiled defs and, for a version stored since #5533, each def's
422
+ * provenance: where it inlined refs and the hash of each def it inlined.
423
+ */
424
+ compiled: {
425
+ defs: Record<string, unknown>;
426
+ provenance?: Record<string, SchemaFileProvenance>;
427
+ } | null;
428
+ }
429
+ /** One def's provenance: inlined pointer → the chain of refs inlined there, each with its def's hash (#5533). */
430
+ export type SchemaFileProvenance = Record<string, {
431
+ chain: Array<{
432
+ ref: string;
433
+ hash: string;
434
+ }>;
435
+ }>;
436
+ /** What a `schemas/` push answers (`PUT …/schemas/:file`). */
437
+ export interface SchemaPushAnswer extends SchemaFileMeta {
438
+ outcome: "created" | "unchanged" | "tombstoned";
439
+ warnings: string[];
440
+ }
441
+ /** One live file's source, as `POST …/schemas/pull` answers it. */
442
+ export interface SchemaPullItem {
443
+ file: string;
444
+ version: number;
445
+ sourceHash: string;
446
+ defs: string[];
447
+ createdAt: string;
448
+ source: string;
449
+ }
64
450
  export declare class ApiError extends Error {
65
451
  statusCode: number;
66
452
  code?: string;
@@ -172,6 +558,14 @@ interface EmailTemplateDetail {
172
558
  description: string;
173
559
  }[];
174
560
  }
561
+ /** The server's rendering of an email template, from the preview route. */
562
+ export interface EmailTemplatePreview {
563
+ renderedSubject: string;
564
+ renderedHtml: string;
565
+ renderedText: string;
566
+ /** The variable values that were rendered: the type's samples, overridden by the caller's. */
567
+ sampleVariables: Record<string, string>;
568
+ }
175
569
  interface EmailTemplateUpsertResult {
176
570
  emailType: string;
177
571
  templateId: string;
@@ -182,6 +576,32 @@ interface EmailTemplateUpsertResult {
182
576
  modifiedAt: string;
183
577
  warnings: string[];
184
578
  }
579
+ /**
580
+ * #5105 — which `+primitivetest` test users an analytics read counted:
581
+ * `exclude` real users only, `include` everyone, `only` test users alone.
582
+ */
583
+ type AnalyticsTestUsersMode = "include" | "exclude" | "only";
584
+ /** The `testUsers` query parameter an analytics read accepts (#5105). */
585
+ interface AnalyticsTestUsersParam {
586
+ testUsers?: AnalyticsTestUsersMode;
587
+ }
588
+ /**
589
+ * #5251 — `_bust=1`: the analytics read recomputes instead of answering from
590
+ * the server's cache.
591
+ */
592
+ interface AnalyticsFreshParam {
593
+ _bust?: "1";
594
+ }
595
+ /**
596
+ * #5251 — one `filter[<field>][<operator>]` entry of an events or errors
597
+ * query, with the server's operator name (`is`, `is not`, `contains`,
598
+ * `starts with`).
599
+ */
600
+ export interface AnalyticsFilterParam {
601
+ field: string;
602
+ operator: string;
603
+ value: string;
604
+ }
185
605
  interface AnalyticsTiming {
186
606
  total_ms: number;
187
607
  wae_queries: number[];
@@ -190,6 +610,8 @@ interface AnalyticsMetricResponse {
190
610
  value: number;
191
611
  previous: number;
192
612
  deltaPct: number;
613
+ /** #5105 — the mode the server applied. */
614
+ testUsers: AnalyticsTestUsersMode;
193
615
  _timing: AnalyticsTiming;
194
616
  }
195
617
  interface AnalyticsGrowthResponse {
@@ -201,6 +623,8 @@ interface AnalyticsGrowthResponse {
201
623
  current_active: number;
202
624
  previous_active: number;
203
625
  deltaPct: number;
626
+ /** #5105 — the mode the server applied. */
627
+ testUsers: AnalyticsTestUsersMode;
204
628
  _timing: AnalyticsTiming;
205
629
  }
206
630
  interface AnalyticsDailyActivePoint {
@@ -211,6 +635,8 @@ interface AnalyticsDailyActivePoint {
211
635
  interface AnalyticsDailyActiveResponse {
212
636
  window_days: number;
213
637
  rows: AnalyticsDailyActivePoint[];
638
+ /** #5105 — the mode the server applied. */
639
+ testUsers: AnalyticsTestUsersMode;
214
640
  _timing: AnalyticsTiming;
215
641
  }
216
642
  interface AnalyticsCohortRow {
@@ -223,6 +649,8 @@ interface AnalyticsCohortResponse {
223
649
  weeks: number[];
224
650
  rows: AnalyticsCohortRow[];
225
651
  averages: (number | null)[];
652
+ /** #5105 — the mode the server applied. */
653
+ testUsers: AnalyticsTestUsersMode;
226
654
  _timing: AnalyticsTiming;
227
655
  }
228
656
  interface AnalyticsUserSummary {
@@ -249,10 +677,445 @@ interface AnalyticsUserSummary {
249
677
  interface AnalyticsTopUserRow extends AnalyticsUserSummary {
250
678
  firstSeenInWindow: string;
251
679
  }
680
+ /** One meter of a usage month (`GET apps/{appId}/usage`). */
681
+ export interface UsageMonthMeter {
682
+ meter: string;
683
+ kind: "usage" | "storage";
684
+ unit: string;
685
+ quantity: number;
686
+ /** Estimated cost in millionths of a dollar, unrounded. */
687
+ estCostMicros: number;
688
+ bytes: number;
689
+ points: number;
690
+ }
691
+ /** One meter of one day of a usage month. */
692
+ export interface UsageDayMeter {
693
+ meter: string;
694
+ kind: "usage" | "storage";
695
+ quantity: number;
696
+ estCostMicros: number;
697
+ bytes: number;
698
+ points: number;
699
+ source: "live" | "closed";
700
+ frozen: boolean;
701
+ }
702
+ /** A stored transition override: the value, when it was set (epoch ms) and by whom (#5821). */
703
+ export interface AppTransitionOverride {
704
+ v: string;
705
+ at: number;
706
+ by: string;
707
+ }
708
+ /** One platform transition's state for an app, with its registry entry (#5821). */
709
+ export interface AppTransitionState {
710
+ transition: string;
711
+ value: string;
712
+ source: "override" | "parent" | "newAppsFrom" | "default";
713
+ override: AppTransitionOverride | null;
714
+ values: string[];
715
+ v1: string;
716
+ v2: string;
717
+ existingAppsDefault: string;
718
+ newAppsFrom: string;
719
+ owner: string;
720
+ removeBy: string;
721
+ autoMove: "off" | "non-production" | "all";
722
+ migration: TransitionMigrationRecord | null;
723
+ }
724
+ /**
725
+ * An app's record of a transition's data migration (#5823): every field but
726
+ * `name` is null when the app has no record yet.
727
+ */
728
+ export interface TransitionMigrationRecord {
729
+ name: string;
730
+ status: "queued" | "running" | "blocked" | "complete" | null;
731
+ /** The handler's position. */
732
+ cursor: string | null;
733
+ counts: {
734
+ scanned: number;
735
+ migrated: number;
736
+ skipped: number;
737
+ } | null;
738
+ /** The app-side step a blocked migration waits for. */
739
+ waitingOn: string | null;
740
+ finishedAt: string | null;
741
+ /** While a rerun is in progress, the earlier completion's finish time. */
742
+ previousFinishedAt: string | null;
743
+ startedAt: string | null;
744
+ lastRunAt: string | null;
745
+ lastError: {
746
+ at: string;
747
+ message: string;
748
+ } | null;
749
+ }
750
+ /** `GET apps/{appId}/transitions`: every registered transition's state for the app (#5821). */
751
+ export interface AppTransitionsResponse {
752
+ appId: string;
753
+ parentAppId: string | null;
754
+ transitions: AppTransitionState[];
755
+ }
756
+ /** A committed transition set, or `unchanged: true` for one equal to the app's override (#5821). */
757
+ export type AppTransitionSetResponse = {
758
+ appId: string;
759
+ transition: string;
760
+ from: string;
761
+ to: string;
762
+ changeId: string;
763
+ at: number;
764
+ by: string;
765
+ } | {
766
+ appId: string;
767
+ transition: string;
768
+ value: string;
769
+ unchanged: true;
770
+ };
771
+ /** One row of an app's transition history (#5821). */
772
+ export interface AppTransitionChange {
773
+ changeId: string;
774
+ transition: string;
775
+ from: string | null;
776
+ to: string | null;
777
+ /** Epoch ms. */
778
+ at: number | null;
779
+ by: string | null;
780
+ reason: string | null;
781
+ children: string[] | null;
782
+ reading: Record<string, unknown> | null;
783
+ }
784
+ /** One registered transition's facts, as `GET transitions` lists them (#5822). */
785
+ export interface TransitionListEntry {
786
+ transition: string;
787
+ values: string[];
788
+ v1: string;
789
+ v2: string;
790
+ existingAppsDefault: string;
791
+ newAppsFrom: string;
792
+ counter: string;
793
+ window: {
794
+ moveDays: number;
795
+ contractDays: number;
796
+ };
797
+ owner: string;
798
+ removeBy: string;
799
+ autoMove: "off" | "non-production" | "all";
800
+ migration: string | null;
801
+ firstReadAt: string | null;
802
+ /** This environment's contract-ready record, or null (#5824). */
803
+ contractReady: TransitionContractReady | null;
804
+ }
805
+ /** A transition's contract-ready record in one environment (#5824). */
806
+ export interface TransitionContractReady {
807
+ ready: boolean;
808
+ /** ISO instant of the sweep that wrote it. */
809
+ at: string;
810
+ /** Apps the sweep counted. */
811
+ apps: number;
812
+ /** The environment-wide count over `contractDays`. */
813
+ count: number;
814
+ }
815
+ /** `GET transitions`: the registry, and apps per value from one budgeted walk (#5822). */
816
+ export interface TransitionListResponse {
817
+ environment: string;
818
+ transitions: TransitionListEntry[];
819
+ apps: {
820
+ counted: number;
821
+ complete: boolean;
822
+ coveredThrough: string | null;
823
+ byValue: Record<string, Record<string, number>>;
824
+ } | null;
825
+ }
826
+ /** One app's line of a transition report (#5822). */
827
+ export interface TransitionReportItem {
828
+ appId: string;
829
+ name: string | null;
830
+ parentAppId: string | null;
831
+ deleted: boolean;
832
+ value: string | null;
833
+ source: "override" | "parent" | "newAppsFrom" | "default" | null;
834
+ override: AppTransitionOverride | null;
835
+ counts: Array<{
836
+ callSite: string;
837
+ count: number;
838
+ }>;
839
+ countsTruncated: boolean;
840
+ total: number;
841
+ lastUseAt: string | null;
842
+ droppedPoints: number;
843
+ movesWith: string | null;
844
+ migration: TransitionMigrationRecord | null;
845
+ eligibleAt: string | null;
846
+ eligibleOn: string | null;
847
+ eligibility: "moved" | "eligible" | "waiting" | "no-first-read" | "with-parent" | "incomplete" | null;
848
+ }
849
+ /** `GET transitions/{transition}/report`: one page of apps (#5822). */
850
+ export interface TransitionReportResponse {
851
+ transition: string;
852
+ environment: string;
853
+ source: "wae" | "sink";
854
+ window: {
855
+ since: string;
856
+ until: string;
857
+ days: number;
858
+ };
859
+ firstReadAt: string | null;
860
+ /** The transition's migration and where its nightly walk stands, or null when it declares none (#5823). */
861
+ migration: {
862
+ name: string;
863
+ walk: {
864
+ pass: number;
865
+ after: string | null;
866
+ appsCovered: number;
867
+ finished: boolean;
868
+ lastRunAt: string | null;
869
+ } | null;
870
+ } | null;
871
+ items: TransitionReportItem[];
872
+ truncated: boolean;
873
+ hasMore: boolean;
874
+ nextCursor: string | null;
875
+ }
876
+ /** One row of the deprecated-calls report: one app, operation, source and client kind (#5916). */
877
+ export interface DeprecatedCall {
878
+ appId: string;
879
+ /** Recorded on an admin surface for no app of its own: `appId` is the admin partition. */
880
+ platform: boolean;
881
+ /** `<surface>:<METHOD> /<pattern>` for HTTP, `ws:<type>` for a WebSocket message. */
882
+ operation: string;
883
+ /** `api`, `fn` or `ws`. */
884
+ source: string;
885
+ /** `js`, `swift`, `cli`, `fn` or `unknown`. */
886
+ client: string;
887
+ /** Calls in the window; sampling-weighted on Analytics Engine, so an estimate there. */
888
+ count: number;
889
+ lastUseAt: string | null;
890
+ }
891
+ /** `GET transitions/deprecated-calls`: recent calls to deprecated operations (#5916). */
892
+ export interface DeprecatedCallsResponse {
893
+ environment: string;
894
+ source: "wae" | "sink";
895
+ window: {
896
+ since: string;
897
+ until: string;
898
+ days: number;
899
+ };
900
+ /** Most calls first. */
901
+ calls: DeprecatedCall[];
902
+ /** The rows reached the limit: narrow with an app or an operation. */
903
+ truncated: boolean;
904
+ }
905
+ /** The reading the move step decides a unit on (#5824). */
906
+ export interface TransitionReading {
907
+ count: number;
908
+ droppedPoints: number;
909
+ environment: string;
910
+ source: string;
911
+ windowStart: string;
912
+ windowEnd: string;
913
+ observedAt: string;
914
+ firstReadAt: string | null;
915
+ }
916
+ /** One unit not on V2 in a transition's move plan (#5824). */
917
+ export interface TransitionMovePlanItem {
918
+ appId: string;
919
+ name: string | null;
920
+ parentAppId: string | null;
921
+ /** What the next run does when it reaches the unit. */
922
+ action: "move" | "move-if-migrated" | "hold";
923
+ reason: string | null;
924
+ /** The member a `migration` hold names. */
925
+ member: string | null;
926
+ /** `behind`: the nightly walk has passed the unit in this pass, so it waits for the next. */
927
+ walk: "ahead" | "behind";
928
+ children: string[];
929
+ reading: TransitionReading;
930
+ total: number;
931
+ droppedPoints: number;
932
+ lastUseAt: string | null;
933
+ eligibleAt: string | null;
934
+ migration: Array<{
935
+ appId: string;
936
+ status: string | null;
937
+ }> | null;
938
+ }
939
+ /** `GET transitions/{transition}/move-plan`: one page of what the next move run would do (#5824). */
940
+ export interface TransitionMovePlanResponse {
941
+ transition: string;
942
+ environment: string;
943
+ source: "wae" | "sink";
944
+ autoMove: "off" | "non-production" | "all";
945
+ allowed: boolean;
946
+ firstReadAt: string | null;
947
+ window: {
948
+ since: string;
949
+ until: string;
950
+ days: number;
951
+ };
952
+ walk: {
953
+ after: string | null;
954
+ pass: number;
955
+ finished: boolean;
956
+ retry: {
957
+ appId: string;
958
+ } | null;
959
+ skip: string[];
960
+ sweepDue: boolean;
961
+ } | null;
962
+ contractReady: TransitionContractReady | null;
963
+ items: TransitionMovePlanItem[];
964
+ hasMore: boolean;
965
+ nextCursor: string | null;
966
+ }
967
+ /** An app's usage and estimated cost for a month, by meter and by day. */
968
+ export interface AppUsageMonthResponse {
969
+ appId: string;
970
+ month: string;
971
+ current: boolean;
972
+ source: "wae" | "sink" | null;
973
+ app: {
974
+ name: string | null;
975
+ parentAppId: string | null;
976
+ createdByAdminId: string | null;
977
+ deleted: boolean;
978
+ };
979
+ meters: UsageMonthMeter[];
980
+ days: Array<{
981
+ day: string;
982
+ estCostMicros: number;
983
+ meters: UsageDayMeter[];
984
+ }>;
985
+ storage: {
986
+ current: Array<{
987
+ meter: string;
988
+ bytes: number;
989
+ }>;
990
+ };
991
+ /** A parent app's children, one line each. */
992
+ children?: Array<{
993
+ appId: string;
994
+ name: string | null;
995
+ deleted: boolean;
996
+ estCostMicros: number;
997
+ meters: Array<{
998
+ meter: string;
999
+ kind: "usage" | "storage";
1000
+ quantity: number;
1001
+ estCostMicros: number;
1002
+ }>;
1003
+ }>;
1004
+ total: {
1005
+ estCostMicros: number;
1006
+ app: number;
1007
+ children: number;
1008
+ };
1009
+ truncated: boolean;
1010
+ }
1011
+ /** A live usage window: ISO 8601 bounds, UTC, half-open. */
1012
+ export interface UsageWindowParams {
1013
+ since?: string;
1014
+ until?: string;
1015
+ }
1016
+ /** An app's top users over a window. */
1017
+ export interface AppUsageTopUsersResponse {
1018
+ appId: string;
1019
+ since: string;
1020
+ until: string;
1021
+ by: "quantity" | "cost";
1022
+ meter: string | null;
1023
+ rows: Array<{
1024
+ billedTo: string;
1025
+ quantity: number | null;
1026
+ estCostMicros: number;
1027
+ points: number;
1028
+ }>;
1029
+ }
1030
+ /** One user's usage over a window and the bytes they own. */
1031
+ export interface AppUsageUserResponse {
1032
+ appId: string;
1033
+ billedTo: string;
1034
+ since: string;
1035
+ until: string;
1036
+ meters: Array<{
1037
+ meter: string;
1038
+ unit: string;
1039
+ quantity: number;
1040
+ estCostMicros: number;
1041
+ bytes: number;
1042
+ points: number;
1043
+ }>;
1044
+ storage: Array<{
1045
+ meter: string;
1046
+ bytes: number;
1047
+ }>;
1048
+ }
1049
+ /** An app's system usage by origin, source, resource and meter. */
1050
+ export interface AppUsageSystemResponse {
1051
+ appId: string;
1052
+ since: string;
1053
+ until: string;
1054
+ meter: string | null;
1055
+ rows: Array<{
1056
+ origin: string;
1057
+ source: string;
1058
+ resourceId: string;
1059
+ meter: string;
1060
+ quantity: number;
1061
+ estCostMicros: number;
1062
+ points: number;
1063
+ }>;
1064
+ truncated: boolean;
1065
+ }
1066
+ /** What the super-admin month-to-date rankings share. */
1067
+ export interface UsageMonthToDate {
1068
+ month: string;
1069
+ basis: "usage+storage";
1070
+ source: "wae" | "sink" | null;
1071
+ /** False when a walk stopped at its page budget. */
1072
+ complete: boolean;
1073
+ /** When incomplete, the last app id the walk reached. */
1074
+ coveredThrough: string | null;
1075
+ }
1076
+ /** The cost fields of a ranking row, in millionths of a dollar. */
1077
+ export interface UsageCostFields {
1078
+ usageEstCostMicros: number;
1079
+ storageEstCostMicros: number;
1080
+ estCostMicros: number;
1081
+ points: number;
1082
+ }
1083
+ /** The top apps by estimated cost, month to date. */
1084
+ export interface UsageTopAppsResponse extends UsageMonthToDate {
1085
+ rows: Array<UsageCostFields & {
1086
+ appId: string;
1087
+ name: string | null;
1088
+ deleted: boolean;
1089
+ parentAppId: string | null;
1090
+ createdByAdminId: string | null;
1091
+ }>;
1092
+ }
1093
+ /** The top developers by estimated cost, month to date. */
1094
+ export interface UsageTopDevelopersResponse extends UsageMonthToDate {
1095
+ rows: Array<UsageCostFields & {
1096
+ adminId: string | null;
1097
+ email: string | null;
1098
+ name: string | null;
1099
+ }>;
1100
+ }
1101
+ /** One usage job's state. */
1102
+ export interface UsageJobView {
1103
+ startedAt: string | null;
1104
+ lastRunAt: string | null;
1105
+ cursor: unknown;
1106
+ appsCovered: number | null;
1107
+ finished: boolean | null;
1108
+ }
1109
+ /** Every usage job's state, null for a job that never ran. */
1110
+ export interface UsageJobsResponse {
1111
+ jobs: Record<string, UsageJobView | null>;
1112
+ }
252
1113
  interface AnalyticsTopUsersResponse {
253
1114
  windowDays: number;
254
1115
  limit: number;
255
1116
  results: AnalyticsTopUserRow[];
1117
+ /** #5105 — the mode the server applied. */
1118
+ testUsers: AnalyticsTestUsersMode;
256
1119
  _timing: AnalyticsTiming;
257
1120
  }
258
1121
  interface AnalyticsUserSearchResponse {
@@ -266,6 +1129,8 @@ interface AnalyticsUserSearchResponse {
266
1129
  offset?: number;
267
1130
  /** True when more rows match than this page returned; page with `offset`. */
268
1131
  truncated?: boolean;
1132
+ /** #5105 — the mode the server applied. */
1133
+ testUsers: AnalyticsTestUsersMode;
269
1134
  }
270
1135
  interface AnalyticsUserDetailResponse {
271
1136
  user: {
@@ -314,6 +1179,8 @@ interface AnalyticsEventsResponse {
314
1179
  page_size: number;
315
1180
  total_rows: number;
316
1181
  rows: AnalyticsEventRow[];
1182
+ /** #5105 — the mode the server applied. */
1183
+ testUsers: AnalyticsTestUsersMode;
317
1184
  _timing: AnalyticsTiming;
318
1185
  }
319
1186
  interface AnalyticsGroupedRow {
@@ -325,6 +1192,8 @@ interface AnalyticsGroupedRow {
325
1192
  interface AnalyticsEventsGroupedResponse {
326
1193
  group_by: string;
327
1194
  rows: AnalyticsGroupedRow[];
1195
+ /** #5105 — the mode the server applied. */
1196
+ testUsers: AnalyticsTestUsersMode;
328
1197
  _timing: AnalyticsTiming;
329
1198
  }
330
1199
  interface AnalyticsErrorGroupExemplar {
@@ -357,6 +1226,54 @@ interface AnalyticsErrorsGroupsResponse {
357
1226
  rows: AnalyticsErrorGroupRow[];
358
1227
  _timing: AnalyticsTiming;
359
1228
  }
1229
+ /** One db3 query shape's cost over the window, per endpoint and function (#5244). */
1230
+ interface AnalyticsDb3QueryRow {
1231
+ shape_id: string;
1232
+ type: string;
1233
+ model: string;
1234
+ op: string;
1235
+ filter: string;
1236
+ sort: string;
1237
+ include: string;
1238
+ endpoint: string;
1239
+ function_id: string | null;
1240
+ function_key: string | null;
1241
+ calls: number;
1242
+ rows_read: number;
1243
+ rows_returned: number;
1244
+ rows_read_per_call: number;
1245
+ /** `null` when the calls returned nothing. */
1246
+ rows_read_per_returned: number | null;
1247
+ scanned_calls: number;
1248
+ counters_known_calls: number;
1249
+ }
1250
+ /** What `GET analytics/db3/queries` answers (#5244). */
1251
+ interface AnalyticsDb3QueriesResponse {
1252
+ window_days: number;
1253
+ order_by: "rowsRead" | "rowsPerReturned";
1254
+ rows: AnalyticsDb3QueryRow[];
1255
+ _timing: AnalyticsTiming;
1256
+ }
1257
+ /** One endpoint's (and function's) requests over the window (#5244). */
1258
+ interface AnalyticsRequestRow {
1259
+ method: string;
1260
+ path: string;
1261
+ function_id: string | null;
1262
+ function_key: string | null;
1263
+ requests: number;
1264
+ wall_ms_avg: number;
1265
+ wall_ms_p50: number;
1266
+ wall_ms_p95: number;
1267
+ dynamo_calls_per_request: number;
1268
+ dynamo_ms_per_request: number;
1269
+ cold_starts: number;
1270
+ }
1271
+ /** What `GET analytics/requests` answers (#5244). */
1272
+ interface AnalyticsRequestsResponse {
1273
+ window_days: number;
1274
+ rows: AnalyticsRequestRow[];
1275
+ _timing: AnalyticsTiming;
1276
+ }
360
1277
  /**
361
1278
  * What a `DELETE` on a status-carrying object answers (#2887, #2907).
362
1279
  *
@@ -374,13 +1291,7 @@ export interface ArchiveEnvelope {
374
1291
  archived?: boolean;
375
1292
  [key: string]: unknown;
376
1293
  }
377
- /**
378
- * Body accepted by integration create and update (#2631).
379
- *
380
- * `accessRule` is the CEL expression gating who may invoke the integration
381
- * through the proxy. The server REQUIRES it on create; on update, `null` or
382
- * `""` clears it, and a cleared rule denies every non-admin call.
383
- */
1294
+ /** Body accepted by integration create and update (#2631). */
384
1295
  export interface IntegrationWritePayload {
385
1296
  integrationKey?: string;
386
1297
  displayName?: string;
@@ -388,11 +1299,38 @@ export interface IntegrationWritePayload {
388
1299
  requestConfig?: any;
389
1300
  timeoutMs?: number;
390
1301
  status?: string;
391
- accessRule?: string | null;
1302
+ }
1303
+ /** A multipart part sent with an integration test request. */
1304
+ export interface IntegrationTestMultipartField {
1305
+ fieldName: string;
1306
+ /** `value` sends `value` as a text part; `attachment` sends the attachment at `attachmentIndex`. */
1307
+ type: "value" | "attachment";
1308
+ value?: string;
1309
+ attachmentIndex?: number;
1310
+ }
1311
+ /** Body accepted by `POST …/integrations/{id}/test`: the request under test. */
1312
+ export interface IntegrationTestPayload {
1313
+ method?: string;
1314
+ path?: string;
1315
+ query?: unknown;
1316
+ /** A JSON body. */
1317
+ body?: unknown;
1318
+ headers?: Record<string, string>;
1319
+ /** A url-encoded body; a name with an array value is sent as a repeated key. */
1320
+ form?: Record<string, string | string[]>;
1321
+ /** How the body is built; absent means JSON (or `form` when given). */
1322
+ bodyMode?: "raw" | "multipart";
1323
+ /** Files, each `{ name, type, data }` with `data` in base64. */
1324
+ attachments?: Array<{
1325
+ name: string;
1326
+ type: string;
1327
+ data: string;
1328
+ }>;
1329
+ multipartFields?: IntegrationTestMultipartField[];
392
1330
  }
393
1331
  /**
394
- * Integration detail response. `accessRule` is only on the detail — the list
395
- * summary does not carry it (#2631).
1332
+ * Integration detail response. `requestConfig` is only on the detail — the
1333
+ * list summary does not carry it.
396
1334
  */
397
1335
  export interface IntegrationDetail {
398
1336
  integrationId: string;
@@ -402,7 +1340,6 @@ export interface IntegrationDetail {
402
1340
  status?: string;
403
1341
  timeoutMs?: number;
404
1342
  requestConfig?: any;
405
- accessRule?: string | null;
406
1343
  modifiedAt?: string;
407
1344
  [key: string]: any;
408
1345
  }
@@ -418,20 +1355,6 @@ interface AnalyticsIntegrationMetricsResponse {
418
1355
  integrations: AnalyticsIntegrationMetric[];
419
1356
  _timing: AnalyticsTiming;
420
1357
  }
421
- interface WorkflowAnalyticsSummary {
422
- workflowKey: string;
423
- runs: number;
424
- successRate: number;
425
- medianDurationMs: number;
426
- p95: number;
427
- totalTokens: number;
428
- }
429
- interface TopWorkflowsResponse {
430
- windowDays: number;
431
- limit: number;
432
- workflows: WorkflowAnalyticsSummary[];
433
- _timing: AnalyticsTiming;
434
- }
435
1358
  interface PromptAnalyticsSummary {
436
1359
  promptKey: string;
437
1360
  executions: number;
@@ -477,6 +1400,21 @@ export interface DatabaseBatchOperation {
477
1400
  */
478
1401
  condition?: Record<string, any>;
479
1402
  }
1403
+ /** One place in an app's configuration that names a secret key (#5845). */
1404
+ export interface AppSecretReference {
1405
+ kind: "function-capability" | "cel-rule" | "integration" | "webhook-trigger" | "google-client";
1406
+ id: string;
1407
+ name: string;
1408
+ field: string;
1409
+ }
1410
+ /** What `GET …/secrets/by-key/{key}/references` answers (#5845). */
1411
+ export interface AppSecretReferences {
1412
+ key: string;
1413
+ reserved: boolean;
1414
+ stored: boolean;
1415
+ references: AppSecretReference[];
1416
+ truncated: boolean;
1417
+ }
480
1418
  export declare class ApiClient {
481
1419
  /**
482
1420
  * Loaded on first use (`ensureAuthenticated`), never in a constructor.
@@ -499,6 +1437,8 @@ export declare class ApiClient {
499
1437
  private ensureAuthenticated;
500
1438
  private refreshToken;
501
1439
  request<T = any>(path: string, options?: RequestInit): Promise<T>;
1440
+ /** The HTTP status of the last request `request` answered without throwing. */
1441
+ private lastStatus;
502
1442
  /**
503
1443
  * Whether a 403 should be retried with the stored step-up: it names
504
1444
  * `admin` among the missing scopes, or it is a protected app's refusal of
@@ -533,6 +1473,29 @@ export declare class ApiClient {
533
1473
  scope: string[];
534
1474
  apps: string[];
535
1475
  }>;
1476
+ /**
1477
+ * #5787 — what `primitive hosting` may send for the current credentials:
1478
+ * a CI token as it is (it cannot derive), or else nothing until a token is
1479
+ * derived; and whether an unexpired step-up that may reach `appId` is
1480
+ * stored. Throws the usual not-logged-in refusal.
1481
+ */
1482
+ hostingCredentials(appId: string): Promise<{
1483
+ ciToken: string | null;
1484
+ stepUp: boolean;
1485
+ }>;
1486
+ /**
1487
+ * #5787 — `POST /admin/api/auth/token` for hosting: a `write`-only token of
1488
+ * 15 minutes derived from the login, or from the stored step-up on a
1489
+ * protected app, pinned to `appId` when that bearer is pinned and unpinned
1490
+ * otherwise. Sent with exactly that bearer and never retried with another.
1491
+ */
1492
+ deriveHostingToken(input: {
1493
+ appId: string;
1494
+ from: "login" | "step-up";
1495
+ }): Promise<{
1496
+ accessToken: string;
1497
+ expiresAt: string;
1498
+ }>;
536
1499
  get<T = any>(path: string, params?: Record<string, any>): Promise<T>;
537
1500
  post<T = any>(path: string, body?: any): Promise<T>;
538
1501
  put<T = any>(path: string, body?: any): Promise<T>;
@@ -576,22 +1539,6 @@ export declare class ApiClient {
576
1539
  role?: string;
577
1540
  }>;
578
1541
  }>;
579
- /**
580
- * Every app on the server, not just the caller's own.
581
- *
582
- * Deliberately separate from `listApps()`, whose contract is "apps assigned
583
- * to me" (`GET /admin/api/admins/me/apps`, backed by `admin.queryApps()`) —
584
- * the contract every other command depends on. `analytics workflow-usage
585
- * --all-apps` has to reach apps nobody is assigned to, which is the global
586
- * route `GET /admin/api/apps` (`App.iterateAll()`), and that route
587
- * identifies an app as `appId` rather than `id` (D3130-001).
588
- *
589
- * One drain of that route is lossy — its cursor re-scans `App.iterateAll()`
590
- * from the start of each page, so a list that changes under it both repeats
591
- * and drops rows — so the walk is the union of repeated drains
592
- * (`drainAppsUntilConverged`, which carries the measurement).
593
- */
594
- listAllAppsGlobal(): Promise<GlobalAppRef[]>;
595
1542
  /**
596
1543
  * Create an app. An ordinary app takes `name` (and, for a super-admin,
597
1544
  * `initialAdminEmail`). A child app takes `parentAppId` and `childSlug`
@@ -631,10 +1578,7 @@ export declare class ApiClient {
631
1578
  */
632
1579
  removeChildPreviewOrigin(parentAppId: string, slug: string, origin: string): Promise<ChildPreviewOrigins>;
633
1580
  private childPreviewOriginsPath;
634
- getApp(appId: string): Promise<{
635
- id: string;
636
- name: string;
637
- }>;
1581
+ getApp(appId: string): Promise<AdminApp>;
638
1582
  deleteApp(appId: string): Promise<void>;
639
1583
  getAppSettings(appId: string): Promise<any>;
640
1584
  updateAppSettings(appId: string, settings: any): Promise<any>;
@@ -643,6 +1587,22 @@ export declare class ApiClient {
643
1587
  role?: string;
644
1588
  name?: string;
645
1589
  avatarUrl?: string | null;
1590
+ initialProperties?: Record<string, unknown>;
1591
+ }): Promise<any>;
1592
+ /**
1593
+ * Invite an email to the app as a console admin
1594
+ * (`POST /admin/api/apps/:appId/users/invite`): the invitation, with its
1595
+ * `inviteToken` and the `initialProperties` it gives the invitee at
1596
+ * acceptance (filling only what they have not set).
1597
+ */
1598
+ inviteUser(appId: string, data: {
1599
+ email: string;
1600
+ role?: "admin" | "member";
1601
+ expiresAt?: string;
1602
+ sendEmail?: boolean;
1603
+ note?: string;
1604
+ source?: string;
1605
+ initialProperties?: Record<string, unknown>;
646
1606
  }): Promise<any>;
647
1607
  /**
648
1608
  * Set a member's display name and/or avatar URL
@@ -662,16 +1622,209 @@ export declare class ApiClient {
662
1622
  rebuildUserSearchText(appId: string): Promise<{
663
1623
  count: number;
664
1624
  }>;
1625
+ /**
1626
+ * One page of an app's users from the user index
1627
+ * (`POST /admin/api/apps/:appId/users/query`): the records-query filter and
1628
+ * sort over base fields and `properties.<name>`, at most 1,000 per page.
1629
+ */
1630
+ queryUsers(appId: string, body: {
1631
+ filter?: Record<string, unknown>;
1632
+ sort?: unknown;
1633
+ limit?: number;
1634
+ cursor?: string;
1635
+ }): Promise<{
1636
+ items: any[];
1637
+ hasMore: boolean;
1638
+ nextCursor?: string;
1639
+ prevCursor?: string;
1640
+ meta: any;
1641
+ }>;
1642
+ /** How many of an app's users match (`POST /admin/api/apps/:appId/users/count`). */
1643
+ countUsers(appId: string, body: {
1644
+ filter?: Record<string, unknown>;
1645
+ }): Promise<{
1646
+ count: number;
1647
+ meta: any;
1648
+ }>;
1649
+ /**
1650
+ * The state of an app's user index (`GET /admin/api/apps/:appId/users/index`):
1651
+ * the generation, each shard with its bound and counts, superseded
1652
+ * generations, a rebuild in progress, queued applies, the last apply and
1653
+ * reconciliation, the limits and whether the shard ceiling is reached.
1654
+ */
1655
+ getUserIndexStatus(appId: string): Promise<any>;
1656
+ /**
1657
+ * Start a report of which user metadata categories still hold rows on the
1658
+ * app's current members (`POST /admin/api/apps/:appId/users/metadata-report`).
1659
+ */
1660
+ startUserMetadataReport(appId: string): Promise<{
1661
+ ok: boolean;
1662
+ runId: string;
1663
+ resourceType: string;
1664
+ status: string;
1665
+ statusUrl: string;
1666
+ }>;
1667
+ /**
1668
+ * Read a user metadata report run, or the app's newest when `runId` is
1669
+ * absent (`GET /admin/api/apps/:appId/users/metadata-report`).
1670
+ */
1671
+ getUserMetadataReport(appId: string, runId?: string): Promise<any>;
1672
+ /** Start building the next generation of an app's user index (`POST /admin/api/apps/:appId/users/index/rebuild`). */
1673
+ rebuildUserIndex(appId: string): Promise<{
1674
+ ok: boolean;
1675
+ generation: number;
1676
+ build: any;
1677
+ }>;
1678
+ /**
1679
+ * Run one revalidation slice of an app's user index now
1680
+ * (`POST /admin/api/apps/:appId/users/index/reconcile`), answered when it is
1681
+ * done; `started: false` while the app is being deleted.
1682
+ */
1683
+ reconcileUserIndex(appId: string): Promise<UserIndexReconcileAnswer>;
1684
+ /**
1685
+ * Start (or find) a walk over an app's users with the admin as its starter
1686
+ * (`POST /admin/api/apps/:appId/users/walks`); `existing` says the key named
1687
+ * a walk that already existed.
1688
+ */
1689
+ startUserWalk(appId: string, body: UserWalkStartBody): Promise<UserWalkStartAnswer>;
1690
+ /** A users walk by its run id (`GET /admin/api/apps/:appId/users/walks/:runId`). */
1691
+ getUserWalk(appId: string, runId: string): Promise<UserWalkAnswer>;
1692
+ /** A rate counter's state by key (`GET /admin/api/apps/:appId/rate-counters/:key`). */
1693
+ getRateCounter(appId: string, key: string): Promise<RateCounterState>;
1694
+ /** A spent token of the app by id (`GET /admin/api/apps/:appId/spent-tokens/:tokenId`); 404 when it has not been used. */
1695
+ getSpentToken(appId: string, tokenId: string): Promise<SpentTokenState>;
1696
+ /** Stop a users walk (`POST /admin/api/apps/:appId/users/walks/:runId/terminate`); batches in flight finish. */
1697
+ terminateUserWalk(appId: string, runId: string): Promise<UserWalkAnswer & {
1698
+ terminated: boolean;
1699
+ }>;
1700
+ /**
1701
+ * An app's user index limit overrides and the limits in effect, with the
1702
+ * property caps beside them (`GET /admin/api/apps/:appId/users/index/limits`).
1703
+ */
1704
+ getUserIndexLimits(appId: string): Promise<UserIndexLimitsAnswer>;
1705
+ /**
1706
+ * Set (a positive integer) or clear (`null`) an app's user index limit
1707
+ * overrides (`PATCH /admin/api/apps/:appId/users/index/limits`).
1708
+ */
1709
+ patchUserIndexLimits(appId: string, body: {
1710
+ shardThreshold?: number | null;
1711
+ shardBytes?: number | null;
1712
+ shardCeiling?: number | null;
1713
+ maxFields?: number | null;
1714
+ maxUnique?: number | null;
1715
+ maxIndexed?: number | null;
1716
+ maxBytes?: number | null;
1717
+ }): Promise<UserIndexLimitsAnswer>;
1718
+ /**
1719
+ * An app's user properties schema (`GET /admin/api/apps/:appId/users/properties`):
1720
+ * the active version, a push being validated, the removed fields and the caps.
1721
+ * While a push validates, this read also resumes its walk.
1722
+ */
1723
+ getUserProperties(appId: string): Promise<UserPropertiesState>;
1724
+ /**
1725
+ * Push the text of `user-properties.toml` (`PUT /admin/api/apps/:appId/users/properties`):
1726
+ * 200 `published` or `unchanged`, 400 when refused; `dryRun` judges it and
1727
+ * writes nothing.
1728
+ */
1729
+ pushUserProperties(appId: string, body: {
1730
+ schema: string;
1731
+ expectedModifiedAt?: string | null;
1732
+ }, options?: {
1733
+ dryRun?: boolean;
1734
+ }): Promise<UserPropertiesPushAnswer>;
1735
+ /**
1736
+ * The current version of each of an app's `schemas/` files
1737
+ * (`GET /admin/api/apps/:appId/schemas`); a tombstoned file only with
1738
+ * `includeTombstoned`.
1739
+ */
1740
+ listSchemaFiles(appId: string, options?: {
1741
+ includeTombstoned?: boolean;
1742
+ }): Promise<{
1743
+ items: SchemaFileMeta[];
1744
+ hasMore: boolean;
1745
+ }>;
1746
+ /**
1747
+ * One version of a `schemas/` file, the current one unless `version` names
1748
+ * another (`GET /admin/api/apps/:appId/schemas/:file`); 404
1749
+ * `SCHEMA_FILE_NOT_FOUND` or `SCHEMA_VERSION_NOT_FOUND`.
1750
+ */
1751
+ getSchemaFile(appId: string, file: string, options?: {
1752
+ version?: number;
1753
+ }): Promise<SchemaFileVersion>;
1754
+ /**
1755
+ * Push the text of `schemas/<file>.toml` with its compiled defs
1756
+ * (`PUT /admin/api/apps/:appId/schemas/:file`): `created` or `unchanged`;
1757
+ * 409 `CONFLICT` when the current version is not `expectedVersion`.
1758
+ */
1759
+ pushSchemaFile(appId: string, file: string, body: {
1760
+ source: string;
1761
+ compiled?: {
1762
+ defs: Record<string, unknown>;
1763
+ provenance?: Record<string, SchemaFileProvenance>;
1764
+ };
1765
+ expectedVersion?: number;
1766
+ }): Promise<SchemaPushAnswer>;
1767
+ /**
1768
+ * Write a tombstone version of a `schemas/` file (`PUT
1769
+ * /admin/api/apps/:appId/schemas/:file` with `{ tombstone: true }`), pinned
1770
+ * to `expectedVersion` when given.
1771
+ */
1772
+ tombstoneSchemaFile(appId: string, file: string, expectedVersion?: number): Promise<SchemaPushAnswer>;
1773
+ /**
1774
+ * The source of every live `schemas/` file, or of `files` only
1775
+ * (`POST /admin/api/apps/:appId/schemas/pull`); a named file with no live
1776
+ * version is listed under `missing`.
1777
+ */
1778
+ pullSchemaFiles(appId: string, files?: string[]): Promise<{
1779
+ items: SchemaPullItem[];
1780
+ missing: string[];
1781
+ }>;
1782
+ /** One member with their properties (`GET /admin/api/apps/:appId/users/:userId`); 404 `USER_NOT_FOUND` for a user who is no member. */
1783
+ getAppUser(appId: string, userId: string): Promise<AppUserWithProperties>;
1784
+ /**
1785
+ * The member who holds a unique property value or a unique constraint's
1786
+ * values (`POST /admin/api/apps/:appId/users/get-by`): `{ user }`, null when
1787
+ * no member holds it.
1788
+ */
1789
+ getAppUserBy(appId: string, selector: {
1790
+ field: string;
1791
+ value: unknown;
1792
+ } | {
1793
+ constraint: string;
1794
+ values: unknown[];
1795
+ }): Promise<{
1796
+ user: AppUserWithProperties | null;
1797
+ }>;
1798
+ /** Apply a property write to one member (`PATCH /admin/api/apps/:appId/users/:userId/properties`); answers the member after it. */
1799
+ setAppUserProperties(appId: string, userId: string, body: AppUserPropertiesWrite): Promise<AppUserWithProperties>;
1800
+ /** An aggregate over an app's users (`POST /admin/api/apps/:appId/users/aggregate`). */
1801
+ aggregateUsers(appId: string, body: {
1802
+ options: {
1803
+ operations: Array<{
1804
+ type: string;
1805
+ field?: string;
1806
+ }>;
1807
+ groupBy?: unknown[];
1808
+ filter?: Record<string, unknown>;
1809
+ sort?: unknown;
1810
+ limit?: number;
1811
+ };
1812
+ }): Promise<{
1813
+ result: any[];
1814
+ meta: any;
1815
+ }>;
665
1816
  listUsers(appId: string, params?: {
666
1817
  name?: string;
667
1818
  email?: string;
668
1819
  userId?: string;
669
1820
  limit?: number;
670
1821
  cursor?: string;
1822
+ testUsers?: "include" | "exclude" | "only";
671
1823
  }): Promise<{
672
1824
  items: any[];
673
1825
  hasMore?: boolean;
674
1826
  nextCursor?: string | null;
1827
+ scanned?: number;
675
1828
  }>;
676
1829
  /**
677
1830
  * @deprecated Use {@link setUserAvailability} with `"disable"`
@@ -685,21 +1838,13 @@ export declare class ApiClient {
685
1838
  * routes already existed; nothing on the CLI reached them.
686
1839
  */
687
1840
  setUserAvailability(appId: string, userId: string, action: "enable" | "disable"): Promise<void>;
1841
+ updateUserRole(appId: string, userId: string, role: "admin" | "member"): Promise<any>;
688
1842
  /**
689
- * #2803 — the platform's feature flags. A server-owned admin toggle with a
690
- * console but, until now, no CLI: the same "one control, both surfaces" rule
691
- * the carrying types get.
692
- */
693
- listFeatureFlags(): Promise<any>;
694
- /**
695
- * The flag itself, not the `{ flag }` envelope the route answers with —
696
- * `feature-flags get` prints the key, the enabled state and the per-app
697
- * overrides, and reading them off the envelope printed a blank row.
1843
+ * Make the app user with `newOwnerEmail` the app's owner; the previous
1844
+ * owner becomes an admin. The email resolves to a userId through
1845
+ * {@link lookupUserByEmail}, and an email no user of the app has rejects
1846
+ * with a message naming it.
698
1847
  */
699
- getFeatureFlag(flagKey: string): Promise<any>;
700
- /** Same envelope, same unwrap: `enable`/`disable` print the updated flag. */
701
- setFeatureFlagEnabled(flagKey: string, enabled: boolean): Promise<any>;
702
- updateUserRole(appId: string, userId: string, role: "admin" | "member"): Promise<any>;
703
1848
  transferOwnership(appId: string, newOwnerEmail: string): Promise<void>;
704
1849
  transferAdminOwnership(appId: string, adminId: string): Promise<any>;
705
1850
  listAppAdmins(appId: string): Promise<any[]>;
@@ -721,6 +1866,38 @@ export declare class ApiClient {
721
1866
  nextCursor?: string;
722
1867
  hasMore?: boolean;
723
1868
  }>;
1869
+ /**
1870
+ * `GET /app/{appId}/api/invitations/{invitationId}` — one invitation with
1871
+ * its `inviteToken` (the bearer credential an accept link carries) and its
1872
+ * `status`. Readable by an app admin/owner or the inviter.
1873
+ */
1874
+ /**
1875
+ * What an invitation shows before anyone signs in (#5848), by its token.
1876
+ * The route reads no credential.
1877
+ */
1878
+ previewInvitation(appId: string, inviteToken: string): Promise<{
1879
+ appName: string;
1880
+ appIconUrl: string | null;
1881
+ inviterName: string | null;
1882
+ role: string;
1883
+ shared: Array<{
1884
+ kind: "db3" | "group" | "collection";
1885
+ title: string;
1886
+ level: string;
1887
+ }>;
1888
+ sharedTruncated: boolean;
1889
+ maskedEmail: string;
1890
+ status: "pending" | "expired" | "accepted";
1891
+ expiresAt: string | null;
1892
+ }>;
1893
+ getInvitation(appId: string, invitationId: string): Promise<{
1894
+ invitationId: string;
1895
+ email: string;
1896
+ role: string;
1897
+ inviteToken: string | null;
1898
+ status: "pending" | "expired" | "accepted";
1899
+ [key: string]: any;
1900
+ }>;
724
1901
  createInvitation(appId: string, data: {
725
1902
  email: string;
726
1903
  role: "admin" | "member";
@@ -761,12 +1938,12 @@ export declare class ApiClient {
761
1938
  hasMore?: boolean;
762
1939
  nextCursor?: string | null;
763
1940
  }>;
764
- /** Integration detail (#2631: `accessRule` is on the detail, not the list summary). */
1941
+ /** Integration detail (`requestConfig` is on the detail, not the list summary). */
765
1942
  getIntegration(appId: string, integrationId: string): Promise<IntegrationDetail>;
766
1943
  /**
767
1944
  * An integration's named configs. Test cases pin a config by NAME so the
768
1945
  * sidecar is portable across apps (#2769); this is the map pull and push
769
- * resolve that name through, the same way prompts/workflows/scripts do.
1946
+ * resolve that name through, the same way prompts do.
770
1947
  */
771
1948
  listIntegrationConfigs(appId: string, integrationId: string): Promise<{
772
1949
  items: any[];
@@ -782,7 +1959,7 @@ export declare class ApiClient {
782
1959
  deleteIntegration(appId: string, integrationId: string, hard?: boolean | {
783
1960
  hard?: boolean;
784
1961
  }): Promise<ArchiveEnvelope>;
785
- testIntegration(appId: string, integrationId: string, payload: any): Promise<any>;
1962
+ testIntegration(appId: string, integrationId: string, payload: IntegrationTestPayload): Promise<any>;
786
1963
  listIntegrationLogs(appId: string, integrationId: string, params?: {
787
1964
  limit?: number;
788
1965
  status?: string;
@@ -794,9 +1971,6 @@ export declare class ApiClient {
794
1971
  /** #3781 — only the calls this step made: a workflow step id or a function step name. */
795
1972
  stepId?: string;
796
1973
  }): Promise<any[]>;
797
- listWorkflowRunIntegrationLogs(appId: string, runId: string, params?: {
798
- limit?: number;
799
- }): Promise<any[]>;
800
1974
  listAppSecrets(appId: string): Promise<any[]>;
801
1975
  createAppSecret(appId: string, payload: {
802
1976
  key: string;
@@ -805,13 +1979,19 @@ export declare class ApiClient {
805
1979
  }): Promise<any>;
806
1980
  updateAppSecret(appId: string, secretId: string, payload: {
807
1981
  value?: string;
808
- summary?: string;
1982
+ summary?: string | null;
809
1983
  }): Promise<any>;
810
1984
  upsertAppSecret(appId: string, key: string, payload: {
811
1985
  value: string;
812
1986
  summary?: string;
813
1987
  }): Promise<any>;
814
1988
  deleteAppSecret(appId: string, secretId: string): Promise<any>;
1989
+ /**
1990
+ * What in the app's configuration names a secret key (#5845, beta): `{ key,
1991
+ * reserved, stored, references: [{ kind, id, name, field }], truncated }`.
1992
+ * Answers for any key, stored or not; never a value.
1993
+ */
1994
+ getAppSecretReferences(appId: string, key: string): Promise<AppSecretReferences>;
815
1995
  listAppConfigVars(appId: string): Promise<any[]>;
816
1996
  upsertAppConfigVar(appId: string, key: string, payload: {
817
1997
  value: string;
@@ -820,36 +2000,11 @@ export declare class ApiClient {
820
2000
  expectNotExists?: boolean;
821
2001
  }): Promise<any>;
822
2002
  deleteAppConfigVar(appId: string, key: string, expectedModifiedAt?: string): Promise<any>;
823
- listWebhooks(appId: string, params?: {
824
- status?: string;
825
- cursor?: string;
826
- limit?: number;
827
- }): Promise<{
828
- items: any[];
829
- hasMore?: boolean;
830
- nextCursor?: string | null;
831
- }>;
832
- getWebhook(appId: string, webhookId: string): Promise<any>;
833
- createWebhook(appId: string, payload: any): Promise<any>;
834
- updateWebhook(appId: string, webhookId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
835
- /**
836
- * Delete a webhook. Archives it by default; `hard` hard-deletes the row
837
- * instead (#2232), which is what frees a slot under the per-app webhook cap
838
- * and releases the webhook key for reuse. Same `?hard=true` verb the admin
839
- * integrations delete uses.
840
- */
841
- deleteWebhook(appId: string, webhookId: string, options?: {
842
- hard?: boolean;
843
- }): Promise<ArchiveEnvelope>;
844
- /**
845
- * #2803 — the operational verb pair for a webhook. It posts to the
846
- * enable/disable route rather than PATCHing `status`, which is server-owned
847
- * and refused on every configuration write path.
848
- */
849
- setWebhookAvailability(appId: string, webhookId: string, action: "enable" | "disable"): Promise<any>;
2003
+ /** Every function of the app; each item carries {@link FunctionActiveInputFields}. */
850
2004
  listFunctions(appId: string): Promise<{
851
2005
  items: any[];
852
2006
  }>;
2007
+ /** One function; the answer carries {@link FunctionActiveInputFields}. */
853
2008
  getFunction(appId: string, functionId: string): Promise<any>;
854
2009
  createFunction(appId: string, payload: any): Promise<any>;
855
2010
  updateFunction(appId: string, functionId: string, payload: any): Promise<any>;
@@ -878,6 +2033,30 @@ export declare class ApiClient {
878
2033
  items: any[];
879
2034
  nextCursor?: string | null;
880
2035
  }>;
2036
+ private functionTriggersPath;
2037
+ /** The function's webhook delivery log, newest first. */
2038
+ listFunctionWebhookEvents(appId: string, functionId: string, params?: {
2039
+ limit?: number;
2040
+ cursor?: string;
2041
+ }): Promise<{
2042
+ items: any[];
2043
+ hasMore?: boolean;
2044
+ nextCursor?: string | null;
2045
+ }>;
2046
+ /** Sign a preview delivery for the function's webhook trigger. */
2047
+ testFunctionWebhook(appId: string, functionId: string, payload?: any): Promise<any>;
2048
+ /** Check captured headers and a captured body against the trigger's verifier. */
2049
+ verifyFunctionWebhook(appId: string, functionId: string, payload: {
2050
+ headers: Array<[string, string]>;
2051
+ rawBody?: string;
2052
+ bodyBase64?: string;
2053
+ }): Promise<any>;
2054
+ /** Point the trigger's `signingSecret` at a new `{{secrets.KEY}}` reference. */
2055
+ rotateFunctionWebhookSecret(appId: string, functionId: string, payload: {
2056
+ signingSecret: string;
2057
+ }): Promise<any>;
2058
+ /** One cron entry verb: `fire`, `fire-scheduled`, `enable` or `disable`. */
2059
+ functionCronEntryAction(appId: string, functionId: string, name: string, action: "fire" | "fire-scheduled" | "enable" | "disable"): Promise<any>;
881
2060
  /**
882
2061
  * A function run's step trace — #3348.
883
2062
  *
@@ -890,6 +2069,17 @@ export declare class ApiClient {
890
2069
  getFunctionStepRuns(appId: string, functionId: string, runId: string): Promise<{
891
2070
  items: any[];
892
2071
  }>;
2072
+ /**
2073
+ * The integration calls one function run made — #3190.
2074
+ *
2075
+ * The run → integration-logs pivot, addressed by the function that owns the
2076
+ * run (it was `workflows/runs/{runId}/integration-logs`).
2077
+ */
2078
+ listFunctionRunIntegrationLogs(appId: string, functionId: string, runId: string, options?: {
2079
+ limit?: number;
2080
+ }): Promise<{
2081
+ items: any[];
2082
+ }>;
893
2083
  /**
894
2084
  * End a function run that will not settle — #3348.
895
2085
  *
@@ -977,9 +2167,8 @@ export declare class ApiClient {
977
2167
  /**
978
2168
  * Which runtime this call means — #3482. The ROUTE is the selector:
979
2169
  * `POST functions/{key}` runs the function inside the request and
980
- * `POST functions/{key}/start` runs it as a task. The admin-only system
981
- * door is ONE route for both, so `--as system` keeps naming its runtime
982
- * in the body (F-3482-007); phase 7's rename may fold it.
2170
+ * `POST functions/{key}/start` runs it as a task; the admin-only system
2171
+ * door has `invoke-as-system` and `start-as-system` (#3190).
983
2172
  */
984
2173
  runtime?: "request" | "task";
985
2174
  }): Promise<{
@@ -987,13 +2176,26 @@ export declare class ApiClient {
987
2176
  retryAfterSeconds: number | null;
988
2177
  body: any;
989
2178
  }>;
2179
+ /**
2180
+ * Run only a function's `authorize` and hand back the ANSWER, whatever its
2181
+ * HTTP status — #4732. Like `invokeFunction`, it returns a refusal rather
2182
+ * than throwing it, so `functions authorize` renders the server's own
2183
+ * answer (and a case run records it as a failed row); it throws only when
2184
+ * the request did not complete. The CLI's own credentials, with the
2185
+ * step-up retry a protected app's refusal asks for.
2186
+ */
2187
+ authorizeFunction(appId: string, functionId: string, body: Record<string, unknown>): Promise<{
2188
+ httpStatus: number;
2189
+ body: any;
2190
+ }>;
990
2191
  /**
991
2192
  * A function's versions, newest first (#3462).
992
2193
  *
993
2194
  * Paging is opt-in on the server: with no `limit` and no `cursor` every
994
2195
  * version comes back, which is what this method did before paging existed and
995
2196
  * what an already-installed CLI still asks for. A caller that passes either
996
- * gets the shared `{ items, hasMore, nextCursor }` page.
2197
+ * gets the shared `{ items, hasMore, nextCursor }` page. Each item carries
2198
+ * {@link FunctionVersionInputFields}.
997
2199
  */
998
2200
  listFunctionConfigs(appId: string, functionId: string, options?: {
999
2201
  limit?: number;
@@ -1009,6 +2211,7 @@ export declare class ApiClient {
1009
2211
  * from the next call.
1010
2212
  */
1011
2213
  activateFunctionConfig(appId: string, functionId: string, configId: string): Promise<any>;
2214
+ /** One version; the answer carries {@link FunctionVersionInputFields}. */
1012
2215
  getFunctionConfig(appId: string, functionId: string, configId: string): Promise<any>;
1013
2216
  /**
1014
2217
  * The stored envelope: the authored TOML bytes, every source file and the
@@ -1021,17 +2224,6 @@ export declare class ApiClient {
1021
2224
  setPromptAvailability(appId: string, promptId: string, action: "enable" | "disable"): Promise<any>;
1022
2225
  /** #2803 — the operational verb pair for an integration (admin API). */
1023
2226
  setIntegrationAvailability(appId: string, integrationId: string, action: "enable" | "disable"): Promise<any>;
1024
- rotateWebhookSecret(appId: string, webhookId: string, payload: {
1025
- signingSecret: string;
1026
- }): Promise<any>;
1027
- listWebhookEvents(appId: string, webhookId: string, params?: {
1028
- limit?: number;
1029
- cursor?: string;
1030
- }): Promise<{
1031
- items: any[];
1032
- hasMore?: boolean;
1033
- nextCursor?: string | null;
1034
- }>;
1035
2227
  /**
1036
2228
  * List the live connections the server believes exist for exactly one of a
1037
2229
  * document or user. Read-only inspection over admin-api. Rows are
@@ -1097,53 +2289,18 @@ export declare class ApiClient {
1097
2289
  sessionId: string;
1098
2290
  revokedAt: string;
1099
2291
  }>;
1100
- testWebhook(appId: string, webhookId: string, payload?: any): Promise<any>;
1101
- /**
1102
- * Run a webhook's configured verifier over headers and a body captured from
1103
- * a real delivery, and report whether that signature checks out (#2445).
1104
- *
1105
- * `headers` is sent as ordered `[name, value]` pairs so a capture carrying a
1106
- * field name on more than one line survives the round trip. Nothing is
1107
- * delivered: no delivery record, no workflow run.
1108
- */
1109
- verifyWebhook(appId: string, webhookId: string, payload: {
1110
- headers: Array<[string, string]>;
1111
- rawBody?: string;
1112
- bodyBase64?: string;
1113
- }): Promise<any>;
1114
2292
  listLocks(appId: string): Promise<{
1115
2293
  locks: any[];
1116
2294
  }>;
1117
2295
  getLockStatus(appId: string, key: string): Promise<any>;
1118
2296
  /**
1119
- * #3562 — `owner` is sent only when one was given, so a call that names none
1120
- * composes byte for byte the body it always did.
1121
- */
1122
- acquireLock(appId: string, key: string, ttlMs: number, owner?: string): Promise<any>;
1123
- releaseLock(appId: string, key: string, handleId: string): Promise<any>;
1124
- listCronTriggers(appId: string): Promise<{
1125
- items: any[];
1126
- }>;
1127
- getCronTrigger(appId: string, triggerId: string): Promise<any>;
1128
- createCronTrigger(appId: string, payload: any): Promise<any>;
1129
- updateCronTrigger(appId: string, triggerId: string, payload: any): Promise<any>;
1130
- /**
1131
- * Retire a cron trigger. The default soft-deletes (writes the `archived`
1132
- * tombstone); `{ hard: true }` destroys the row, which is what
1133
- * `config push --prune` passes (#2803) so a pruned trigger stops consuming
1134
- * the per-app cap and holding its key.
2297
+ * #4959 — free a key whose lease is live, with no handle (admin). Acquire,
2298
+ * renew and release are server-function-only, so the CLI has no door to them.
1135
2299
  */
1136
- deleteCronTrigger(appId: string, triggerId: string, options?: {
1137
- hard?: boolean;
1138
- }): Promise<ArchiveEnvelope>;
1139
- disableCronTrigger(appId: string, triggerId: string): Promise<any>;
1140
- enableCronTrigger(appId: string, triggerId: string): Promise<any>;
1141
- testCronTrigger(appId: string, triggerId: string): Promise<any>;
1142
- listIterations(appId: string): Promise<{
1143
- items: any[];
2300
+ forceReleaseLock(appId: string, key: string): Promise<{
2301
+ released: boolean;
2302
+ reason?: string;
1144
2303
  }>;
1145
- getIteration(appId: string, iterationName: string): Promise<any>;
1146
- resetIteration(appId: string, iterationName: string): Promise<any>;
1147
2304
  readResourceMetadata(appId: string, resourceType: string, resourceId: string, category: string): Promise<any>;
1148
2305
  writeResourceMetadata(appId: string, resourceType: string, resourceId: string, category: string, data: Record<string, any>): Promise<any>;
1149
2306
  batchReadResourceMetadata(appId: string, requests: Array<{
@@ -1227,53 +2384,6 @@ export declare class ApiClient {
1227
2384
  configName?: string;
1228
2385
  description?: string;
1229
2386
  }): Promise<any>;
1230
- listScripts(appId: string): Promise<{
1231
- items: any[];
1232
- }>;
1233
- getScript(appId: string, scriptId: string): Promise<any>;
1234
- /**
1235
- * List a script's versioned configs (the `ScriptConfig` rows). Each config
1236
- * is a distinct block version: `configId` is the stable version selector,
1237
- * `contentHash` is its content identity, and `status` reports whether it is
1238
- * `active`/`draft`/`archived`. The script header's `activeConfigId` names
1239
- * the live version. Used by `scripts configs list` and by the script test
1240
- * commands to run against a specific pinned version.
1241
- */
1242
- listScriptConfigs(appId: string, scriptId: string): Promise<{
1243
- items: any[];
1244
- }>;
1245
- createScript(appId: string, payload: {
1246
- name: string;
1247
- body: string;
1248
- description?: string;
1249
- }): Promise<any>;
1250
- /**
1251
- * Push a new body for an existing script by creating a new `ScriptConfig`
1252
- * and activating it (the prompt-model "edit → activate" flow). Referencing
1253
- * workflows pick up the new body on their next run with no fan-out. The
1254
- * config name is unique per script, so we mint a timestamped name.
1255
- */
1256
- pushScriptBody(appId: string, scriptId: string, body: string,
1257
- /**
1258
- * The active state the caller believes holds right now (#2731 B10).
1259
- * Creating an inactive config races nothing, so the guard sits on the
1260
- * ACTIVATION step: if the active config has moved since the caller read it,
1261
- * the server rejects with a 409 instead of overwriting a concurrent script
1262
- * change. It takes BOTH halves of "what is active", because a config's body
1263
- * can be edited in place without the active id changing — the id alone
1264
- * would let such an edit through. Omitted (e.g. `--force`) means activate
1265
- * unconditionally.
1266
- */
1267
- expectedActive?: {
1268
- configId?: string;
1269
- modifiedAt?: string;
1270
- }): Promise<any>;
1271
- /**
1272
- * Delete a script header (cascades its configs). `force` overrides the
1273
- * server's guard against deleting a script that an active workflow still
1274
- * references by name — without it the server answers 409.
1275
- */
1276
- deleteScript(appId: string, scriptId: string, force?: boolean): Promise<void>;
1277
2387
  getPromptSchema(appId: string, promptId: string): Promise<{
1278
2388
  promptId: string;
1279
2389
  promptKey: string;
@@ -1289,7 +2399,7 @@ export declare class ApiClient {
1289
2399
  * 100) and reports `nextCursor`; callers that reconcile the sync tree must
1290
2400
  * drain every page before deleting or classifying anything (#2769).
1291
2401
  */
1292
- listTestCases(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, params?: {
2402
+ listTestCases(appId: string, blockType: "prompt" | "integration", blockId: string, params?: {
1293
2403
  limit?: number;
1294
2404
  cursor?: string;
1295
2405
  }): Promise<{
@@ -1297,8 +2407,8 @@ export declare class ApiClient {
1297
2407
  hasMore?: boolean;
1298
2408
  nextCursor?: string;
1299
2409
  }>;
1300
- getTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<any>;
1301
- createTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload: {
2410
+ getTestCase(appId: string, blockType: "prompt" | "integration", blockId: string, testCaseId: string): Promise<any>;
2411
+ createTestCase(appId: string, blockType: "prompt" | "integration", blockId: string, payload: {
1302
2412
  name: string;
1303
2413
  description?: string | null;
1304
2414
  inputVariables: Record<string, any>;
@@ -1311,7 +2421,7 @@ export declare class ApiClient {
1311
2421
  /** The sidecar's file name — the case's identity (#2896). */
1312
2422
  key?: string;
1313
2423
  } & AgentTestCaseWireFields): Promise<any>;
1314
- updateTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, payload: {
2424
+ updateTestCase(appId: string, blockType: "prompt" | "integration", blockId: string, testCaseId: string, payload: {
1315
2425
  name?: string;
1316
2426
  description?: string | null;
1317
2427
  inputVariables?: Record<string, any>;
@@ -1324,8 +2434,8 @@ export declare class ApiClient {
1324
2434
  /** The sidecar's file name, on a create-or-rename backfill (#2896). */
1325
2435
  key?: string;
1326
2436
  } & AgentTestCaseWireFields): Promise<any>;
1327
- deleteTestCase(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<void>;
1328
- listTestCaseAttachments(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string): Promise<{
2437
+ deleteTestCase(appId: string, blockType: "prompt" | "integration", blockId: string, testCaseId: string): Promise<void>;
2438
+ listTestCaseAttachments(appId: string, blockType: "prompt" | "integration", blockId: string, testCaseId: string): Promise<{
1329
2439
  attachments: Array<{
1330
2440
  filename: string;
1331
2441
  contentType: string;
@@ -1333,7 +2443,7 @@ export declare class ApiClient {
1333
2443
  r2Key: string;
1334
2444
  }>;
1335
2445
  }>;
1336
- uploadTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, filename: string, data: Buffer, contentType: string): Promise<{
2446
+ uploadTestCaseAttachment(appId: string, blockType: "prompt" | "integration", blockId: string, testCaseId: string, filename: string, data: Buffer, contentType: string): Promise<{
1337
2447
  success: boolean;
1338
2448
  attachment: {
1339
2449
  filename: string;
@@ -1342,176 +2452,63 @@ export declare class ApiClient {
1342
2452
  r2Key: string;
1343
2453
  };
1344
2454
  }>;
1345
- downloadTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, filename: string): Promise<{
2455
+ downloadTestCaseAttachment(appId: string, blockType: "prompt" | "integration", blockId: string, testCaseId: string, filename: string): Promise<{
1346
2456
  data: Buffer;
1347
2457
  contentType: string;
1348
2458
  }>;
1349
- deleteTestCaseAttachment(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, testCaseId: string, filename: string): Promise<{
2459
+ deleteTestCaseAttachment(appId: string, blockType: "prompt" | "integration", blockId: string, testCaseId: string, filename: string): Promise<{
1350
2460
  success: boolean;
1351
2461
  deleted: boolean;
1352
2462
  }>;
1353
- executeBlockTest(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload: {
2463
+ executeBlockTest(appId: string, blockType: "prompt" | "integration", blockId: string, payload: {
1354
2464
  variables?: Record<string, any>;
1355
2465
  testCaseId?: string;
1356
2466
  configId?: string;
1357
2467
  comparisonGroup?: string;
1358
2468
  }): Promise<any>;
1359
- runAllTestCases(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload?: {
2469
+ runAllTestCases(appId: string, blockType: "prompt" | "integration", blockId: string, payload?: {
1360
2470
  overrideConfigId?: string;
1361
2471
  comparisonGroup?: string;
1362
2472
  testCaseIds?: string[];
1363
2473
  }): Promise<any>;
1364
- listTestRuns(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, params?: {
1365
- limit?: number;
1366
- comparisonGroup?: string;
1367
- }): Promise<{
1368
- items: any[];
1369
- }>;
1370
- listWorkflows(appId: string, params?: {
1371
- status?: string;
1372
- limit?: number;
1373
- cursor?: string;
1374
- }): Promise<{
1375
- items: any[];
1376
- hasMore?: boolean;
1377
- nextCursor?: string | null;
1378
- }>;
1379
- getWorkflow(appId: string, workflowId: string): Promise<any>;
1380
2474
  /**
1381
- * One app's workflow step usage report (#3132).
1382
- *
1383
- * `windowDays` is omitted from the query when the caller did not ask for a
1384
- * window, so the server applies its own default rather than the CLI
1385
- * restating it on the wire.
1386
- */
1387
- getWorkflowUsage(appId: string, params?: {
1388
- windowDays?: number;
1389
- }): Promise<WorkflowUsageReport>;
1390
- createWorkflow(appId: string, payload: any): Promise<any>;
1391
- updateWorkflow(appId: string, workflowId: string, payload: any, expectedModifiedAt?: string): Promise<any>;
1392
- /**
1393
- * Retire a workflow, or destroy it (#2887).
1394
- *
1395
- * The plain call ARCHIVES: the definition row stays, so its runs, revisions
1396
- * and test cases keep resolving. `{ hard: true }` performs the full cascade
1397
- * and is what releases the `workflowKey` — the flag `config push --prune`
1398
- * sends, for the same reason it sends it for webhooks and integrations.
2475
+ * One page of a block's test runs, newest first. The endpoint paginates
2476
+ * (default 50, cap 100) and reports `nextCursor`.
1399
2477
  */
1400
- deleteWorkflow(appId: string, workflowId: string, options?: {
1401
- hard?: boolean;
1402
- }): Promise<ArchiveEnvelope>;
1403
- /**
1404
- * #2645 criterion 9 — the operational toggle. Deliberately NOT the config
1405
- * PATCH: `config push` owns every configuration field, and taking a workflow
1406
- * out of service must not touch one, or an operator's action would show up as
1407
- * drift against the repo. Same route shape as `cron-triggers pause|resume`.
1408
- */
1409
- disableWorkflow(appId: string, workflowId: string): Promise<any>;
1410
- enableWorkflow(appId: string, workflowId: string): Promise<any>;
1411
- updateWorkflowDraft(appId: string, workflowId: string, payload: any): Promise<any>;
1412
- previewWorkflow(appId: string, workflowId: string, payload: {
1413
- rootInput?: object;
1414
- meta?: object;
1415
- configId?: string;
1416
- useDraft?: boolean;
1417
- preferActive?: boolean;
1418
- }): Promise<{
1419
- instanceId: string;
1420
- usingDraft?: boolean;
1421
- source?: "config" | "active" | "draft" | null;
1422
- configName?: string | null;
1423
- configId?: string | null;
1424
- warning?: string;
1425
- }>;
1426
- getPreviewStatus(appId: string, workflowId: string, instanceId: string): Promise<any>;
1427
- listWorkflowRuns(appId: string, workflowId: string, params?: {
1428
- status?: string;
2478
+ listTestRuns(appId: string, blockType: "prompt" | "integration", blockId: string, params?: {
1429
2479
  limit?: number;
1430
2480
  cursor?: string;
1431
- forward?: boolean;
1432
- follow?: boolean;
1433
- after?: string;
1434
2481
  }): Promise<{
1435
2482
  items: any[];
1436
2483
  hasMore?: boolean;
1437
- nextCursor?: string | null;
1438
- /** #1969 — opaque follow checkpoint; present on `follow=true` responses. */
1439
- resumeAfter?: string;
1440
- /**
1441
- * #2237 — index rows the server examined for this request. Filtered reads
1442
- * only, and only on a server new enough to report it; `undefined`
1443
- * otherwise, which callers must treat as "unknown", not zero.
1444
- */
1445
- scanned?: number;
2484
+ nextCursor?: string;
1446
2485
  }>;
1447
2486
  /**
1448
- * Workflow runs started by one app user, across every workflow (#1967).
1449
- * Backed by `GET /admin/api/apps/{appId}/users/{userId}/workflow-runs`,
1450
- * which resolves the app user before querying the `runsByUser` index.
2487
+ * One of a block's test runs: the object `listTestRuns` lists for it. The
2488
+ * run id travels as one path segment, so a `/`, `?` or `#` in it can never
2489
+ * reach the listing or the query.
1451
2490
  */
1452
- listUserWorkflowRuns(appId: string, userId: string, params?: {
1453
- status?: string;
1454
- limit?: number;
1455
- cursor?: string;
1456
- forward?: boolean;
1457
- workflowId?: string;
1458
- }): Promise<{
1459
- items: any[];
1460
- hasMore?: boolean;
1461
- nextCursor?: string | null;
1462
- /** #2237 — index rows examined; filtered reads only, `undefined` if unknown. */
1463
- scanned?: number;
1464
- }>;
1465
- getWorkflowRunStatus(appId: string, workflowId: string, runId: string): Promise<any>;
1466
- getWorkflowStepRuns(appId: string, workflowId: string, runId: string): Promise<{
1467
- items: any[];
1468
- }>;
1469
- listWorkflowConfigs(appId: string, workflowId: string): Promise<{
1470
- items: any[];
1471
- }>;
1472
- getWorkflowConfig(appId: string, workflowId: string, configId: string): Promise<any>;
1473
- createWorkflowConfig(appId: string, workflowId: string, payload: {
1474
- configName: string;
1475
- description?: string;
1476
- steps: any[];
1477
- expressions?: {
1478
- cel?: Record<string, string>;
1479
- };
1480
- }): Promise<any>;
1481
- updateWorkflowConfig(appId: string, workflowId: string, configId: string, payload: {
1482
- configName?: string;
1483
- description?: string;
1484
- steps?: any[];
1485
- status?: string;
1486
- expressions?: {
1487
- cel?: Record<string, string>;
1488
- };
1489
- }): Promise<any>;
1490
- archiveWorkflowConfig(appId: string, workflowId: string, configId: string): Promise<any>;
1491
- activateWorkflowConfig(appId: string, workflowId: string, configId: string): Promise<any>;
1492
- duplicateWorkflowConfig(appId: string, workflowId: string, configId: string, payload?: {
1493
- configName?: string;
1494
- }): Promise<any>;
2491
+ getTestRun(appId: string, blockType: "prompt" | "integration", blockId: string, runId: string): Promise<any>;
1495
2492
  getAnalyticsTopUsers(appId: string, params?: {
1496
2493
  windowDays?: number;
1497
2494
  limit?: number;
1498
- }): Promise<AnalyticsTopUsersResponse>;
2495
+ } & AnalyticsTestUsersParam & AnalyticsFreshParam): Promise<AnalyticsTopUsersResponse>;
1499
2496
  getAnalyticsIntegrationMetrics(appId: string, params?: {
1500
2497
  windowDays?: number;
1501
- }): Promise<AnalyticsIntegrationMetricsResponse>;
1502
- getAnalyticsOverviewDau(appId: string): Promise<AnalyticsMetricResponse>;
1503
- getAnalyticsOverviewWau(appId: string): Promise<AnalyticsMetricResponse>;
1504
- getAnalyticsOverviewMau(appId: string): Promise<AnalyticsMetricResponse>;
2498
+ } & AnalyticsFreshParam): Promise<AnalyticsIntegrationMetricsResponse>;
2499
+ getAnalyticsOverviewDau(appId: string, params?: AnalyticsTestUsersParam & AnalyticsFreshParam): Promise<AnalyticsMetricResponse>;
2500
+ getAnalyticsOverviewWau(appId: string, params?: AnalyticsTestUsersParam & AnalyticsFreshParam): Promise<AnalyticsMetricResponse>;
2501
+ getAnalyticsOverviewMau(appId: string, params?: AnalyticsTestUsersParam & AnalyticsFreshParam): Promise<AnalyticsMetricResponse>;
1505
2502
  getAnalyticsOverviewGrowth(appId: string, params?: {
1506
2503
  windowDays?: number;
1507
- }): Promise<AnalyticsGrowthResponse>;
2504
+ } & AnalyticsTestUsersParam & AnalyticsFreshParam): Promise<AnalyticsGrowthResponse>;
1508
2505
  getAnalyticsDailyActive(appId: string, params?: {
1509
2506
  windowDays?: number;
1510
- }): Promise<AnalyticsDailyActiveResponse>;
2507
+ } & AnalyticsTestUsersParam & AnalyticsFreshParam): Promise<AnalyticsDailyActiveResponse>;
1511
2508
  getAnalyticsRollingActive(appId: string, params?: {
1512
2509
  windowDays?: number;
1513
- }): Promise<AnalyticsDailyActiveResponse>;
1514
- getAnalyticsCohortRetention(appId: string): Promise<AnalyticsCohortResponse>;
2510
+ } & AnalyticsTestUsersParam & AnalyticsFreshParam): Promise<AnalyticsDailyActiveResponse>;
2511
+ getAnalyticsCohortRetention(appId: string, params?: AnalyticsTestUsersParam & AnalyticsFreshParam): Promise<AnalyticsCohortResponse>;
1515
2512
  getAnalyticsUserSearch(appId: string, params: {
1516
2513
  q?: string;
1517
2514
  limit?: number;
@@ -1522,32 +2519,113 @@ export declare class ApiClient {
1522
2519
  signupEndDay?: string;
1523
2520
  /** #3127 — row offset, accepted only with a signup filter. */
1524
2521
  offset?: number;
1525
- }): Promise<AnalyticsUserSearchResponse>;
1526
- getAnalyticsUserDetail(appId: string, userUlid: string): Promise<AnalyticsUserDetailResponse>;
1527
- getAnalyticsUserSnapshot(appId: string, userUlid: string): Promise<AnalyticsUserSnapshotResponse>;
2522
+ } & AnalyticsTestUsersParam & AnalyticsFreshParam): Promise<AnalyticsUserSearchResponse>;
2523
+ getAnalyticsUserDetail(appId: string, userUlid: string, params?: AnalyticsFreshParam): Promise<AnalyticsUserDetailResponse>;
2524
+ getAnalyticsUserSnapshot(appId: string, userUlid: string, params?: AnalyticsFreshParam): Promise<AnalyticsUserSnapshotResponse>;
2525
+ /**
2526
+ * #5251 — `path` with `params` set as `get` sets them, then one appended
2527
+ * `filter[<field>][<operator>]` entry per filter, in order. `get`'s record
2528
+ * cannot hold two entries under one key; the server ANDs them all.
2529
+ */
2530
+ private analyticsFilteredGet;
1528
2531
  getAnalyticsEvents(appId: string, params?: {
1529
2532
  windowDays?: number;
1530
2533
  page?: number;
1531
2534
  [key: string]: any;
1532
- }): Promise<AnalyticsEventsResponse>;
2535
+ } & AnalyticsTestUsersParam & AnalyticsFreshParam, filters?: AnalyticsFilterParam[]): Promise<AnalyticsEventsResponse>;
1533
2536
  getAnalyticsEventsGrouped(appId: string, params?: {
1534
2537
  groupBy?: string;
1535
2538
  windowDays?: number;
1536
2539
  [key: string]: any;
1537
- }): Promise<AnalyticsEventsGroupedResponse>;
2540
+ } & AnalyticsTestUsersParam & AnalyticsFreshParam, filters?: AnalyticsFilterParam[]): Promise<AnalyticsEventsGroupedResponse>;
1538
2541
  getAnalyticsErrorsGroups(appId: string, params?: {
1539
2542
  windowDays?: number;
1540
2543
  limit?: number;
1541
- [key: string]: any;
1542
- }): Promise<AnalyticsErrorsGroupsResponse>;
1543
- getAnalyticsTopWorkflows(appId: string, params?: {
1544
- windowDays?: number;
2544
+ [key: string]: any;
2545
+ } & AnalyticsFreshParam, filters?: AnalyticsFilterParam[]): Promise<AnalyticsErrorsGroupsResponse>;
2546
+ /** The app's db3 query shapes that read the most rows (#5244). */
2547
+ getAnalyticsDb3Queries(appId: string, params?: {
2548
+ windowDays?: number;
2549
+ limit?: number;
2550
+ orderBy?: "rowsRead" | "rowsPerReturned";
2551
+ } & AnalyticsFreshParam): Promise<AnalyticsDb3QueriesResponse>;
2552
+ /** The app's request wall time and DynamoDB round trips per endpoint and function (#5244). */
2553
+ getAnalyticsRequests(appId: string, params?: {
2554
+ windowDays?: number;
2555
+ limit?: number;
2556
+ } & AnalyticsFreshParam): Promise<AnalyticsRequestsResponse>;
2557
+ getAnalyticsTopPrompts(appId: string, params?: {
2558
+ windowDays?: number;
2559
+ limit?: number;
2560
+ } & AnalyticsFreshParam): Promise<TopPromptsResponse>;
2561
+ /** An app's platform transitions: each one's value and where it came from. */
2562
+ getAppTransitions(appId: string): Promise<AppTransitionsResponse>;
2563
+ /** Set one platform transition on one app, with a reason (super-admin). */
2564
+ setAppTransition(appId: string, transition: string, body: {
2565
+ value: string;
2566
+ reason: string;
2567
+ }): Promise<AppTransitionSetResponse>;
2568
+ /** One page of an app's transition changes, newest first (super-admin). */
2569
+ listAppTransitionChanges(appId: string, params?: {
2570
+ transition?: string;
2571
+ limit?: number;
2572
+ cursor?: string;
2573
+ }): Promise<{
2574
+ items: AppTransitionChange[];
2575
+ hasMore: boolean;
2576
+ nextCursor?: string;
2577
+ }>;
2578
+ /** The registered transitions, with apps per value from one budgeted walk (super-admin). */
2579
+ listTransitions(params?: {
2580
+ after?: string;
2581
+ counts?: boolean;
2582
+ }): Promise<TransitionListResponse>;
2583
+ /** One page of a transition's report: each app's state, use by call site and eligible date (super-admin). */
2584
+ getTransitionReport(transition: string, params?: {
2585
+ only?: "all" | "in-use";
2586
+ limit?: number;
2587
+ cursor?: string;
2588
+ }): Promise<TransitionReportResponse>;
2589
+ /** One page of a transition's move plan: what the daily move step would do with each unit (super-admin, #5824). */
2590
+ getTransitionMovePlan(transition: string, params?: {
1545
2591
  limit?: number;
1546
- }): Promise<TopWorkflowsResponse>;
1547
- getAnalyticsTopPrompts(appId: string, params?: {
1548
- windowDays?: number;
2592
+ cursor?: string;
2593
+ }): Promise<TransitionMovePlanResponse>;
2594
+ /** Recent calls to deprecated operations, by app, operation, source and client (super-admin). */
2595
+ getDeprecatedCalls(params?: {
2596
+ days?: number;
2597
+ appId?: string;
2598
+ operation?: string;
2599
+ limit?: number;
2600
+ }): Promise<DeprecatedCallsResponse>;
2601
+ /** An app's usage and estimated cost for `month` (`YYYY-MM`, default the current month). */
2602
+ getAppUsage(appId: string, params?: {
2603
+ month?: string;
2604
+ }): Promise<AppUsageMonthResponse>;
2605
+ /** An app's top users over a window, by a meter's quantity or by cost. */
2606
+ getAppUsageTopUsers(appId: string, params?: {
2607
+ meter?: string;
2608
+ by?: "cost";
2609
+ } & UsageWindowParams & {
2610
+ limit?: number;
2611
+ }): Promise<AppUsageTopUsersResponse>;
2612
+ /** One user's usage over a window and the bytes they own. */
2613
+ getAppUsageUser(appId: string, userId: string, params?: UsageWindowParams): Promise<AppUsageUserResponse>;
2614
+ /** An app's system usage over a window, by origin, source, resource and meter. */
2615
+ getAppUsageSystem(appId: string, params?: UsageWindowParams & {
2616
+ meter?: string;
1549
2617
  limit?: number;
1550
- }): Promise<TopPromptsResponse>;
2618
+ }): Promise<AppUsageSystemResponse>;
2619
+ /** The top apps by estimated cost, month to date (super-admin). */
2620
+ listUsageTopApps(params?: {
2621
+ limit?: number;
2622
+ }): Promise<UsageTopAppsResponse>;
2623
+ /** The top developers by estimated cost, month to date (super-admin). */
2624
+ listUsageTopDevelopers(params?: {
2625
+ limit?: number;
2626
+ }): Promise<UsageTopDevelopersResponse>;
2627
+ /** The usage jobs' state (super-admin). */
2628
+ getUsageJobs(): Promise<UsageJobsResponse>;
1551
2629
  /**
1552
2630
  * The signed-in admin's own profile, `role` included.
1553
2631
  *
@@ -1578,32 +2656,21 @@ export declare class ApiClient {
1578
2656
  role?: "admin" | "super-admin";
1579
2657
  }): Promise<any>;
1580
2658
  reindexAdmin(adminId: string): Promise<void>;
1581
- listAllAdminInvitations(): Promise<any[]>;
2659
+ /** `reindexAdmin` with the route's answer, for callers that print it. */
2660
+ reindexAdminWithResult(adminId: string): Promise<{
2661
+ success: boolean;
2662
+ adminId: string;
2663
+ reindexedAt: string;
2664
+ }>;
2665
+ /** One address's pending admin invitations; the route requires the address. */
2666
+ listAllAdminInvitations(email: string): Promise<any[]>;
1582
2667
  createGlobalAdminInvitation(data: {
1583
2668
  email: string;
1584
2669
  appCreationLimit?: number;
1585
2670
  expiresInDays?: number;
1586
2671
  }): Promise<any>;
1587
2672
  deleteGlobalAdminInvitation(invitationId: string): Promise<void>;
1588
- listPromptCatalog(params?: {
1589
- status?: string;
1590
- limit?: number;
1591
- cursor?: string;
1592
- }): Promise<any>;
1593
- getPromptCatalogItem(catalogId: string): Promise<any>;
1594
- createPromptCatalogItem(payload: any): Promise<any>;
1595
- updatePromptCatalogItem(catalogId: string, payload: any): Promise<any>;
1596
- deletePromptCatalogItem(catalogId: string): Promise<void>;
1597
- listIntegrationCatalog(params?: {
1598
- status?: string;
1599
- limit?: number;
1600
- cursor?: string;
1601
- }): Promise<any>;
1602
- getIntegrationCatalogItem(catalogId: string): Promise<any>;
1603
- createIntegrationCatalogItem(payload: any): Promise<any>;
1604
- updateIntegrationCatalogItem(catalogId: string, payload: any): Promise<any>;
1605
- deleteIntegrationCatalogItem(catalogId: string): Promise<void>;
1606
- startBatchTests(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, payload?: {
2673
+ startBatchTests(appId: string, blockType: "prompt" | "integration", blockId: string, payload?: {
1607
2674
  comparisonGroup?: string;
1608
2675
  overrideConfigId?: string;
1609
2676
  testCaseIds?: string[];
@@ -1613,7 +2680,7 @@ export declare class ApiClient {
1613
2680
  instanceIds: string[];
1614
2681
  errors?: any[];
1615
2682
  }>;
1616
- getBatchTestStatus(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, batchId: string): Promise<{
2683
+ getBatchTestStatus(appId: string, blockType: "prompt" | "integration", blockId: string, batchId: string): Promise<{
1617
2684
  status: string;
1618
2685
  batchId: string;
1619
2686
  completed: number;
@@ -1630,7 +2697,7 @@ export declare class ApiClient {
1630
2697
  endedAt?: string;
1631
2698
  }>;
1632
2699
  }>;
1633
- cancelBatchTests(appId: string, blockType: "prompt" | "integration" | "workflow" | "script", blockId: string, batchId: string, instanceIds: string[]): Promise<{
2700
+ cancelBatchTests(appId: string, blockType: "prompt" | "integration", blockId: string, batchId: string, instanceIds: string[]): Promise<{
1634
2701
  batchId: string;
1635
2702
  terminated: string[];
1636
2703
  errors?: any[];
@@ -1669,6 +2736,15 @@ export declare class ApiClient {
1669
2736
  sentTo: string;
1670
2737
  error?: string;
1671
2738
  }>;
2739
+ /**
2740
+ * Render the saved template (or the built-in default) for an email type
2741
+ * without sending it. `variables` override the type's sample values. The
2742
+ * app id and the type are each encoded as one path segment, so no value of
2743
+ * either can select another route.
2744
+ */
2745
+ previewEmailTemplate(appId: string, emailType: string, payload?: {
2746
+ variables?: Record<string, string | number | boolean | null>;
2747
+ }): Promise<EmailTemplatePreview>;
1672
2748
  createToken(appId: string, data: {
1673
2749
  name: string;
1674
2750
  ttl?: string;
@@ -1846,6 +2922,7 @@ export declare class ApiClient {
1846
2922
  }, expectedModifiedAt?: string, options?: {
1847
2923
  dryRun?: boolean;
1848
2924
  acceptWarnings?: boolean;
2925
+ allowFieldRemoval?: boolean;
1849
2926
  }): Promise<any>;
1850
2927
  deleteDatabaseTypeConfig(appId: string, databaseType: string, options?: {
1851
2928
  force?: boolean;
@@ -1859,7 +2936,6 @@ export declare class ApiClient {
1859
2936
  schema: string;
1860
2937
  }>;
1861
2938
  listGroups(appId: string, params?: {
1862
- type?: string;
1863
2939
  limit?: number;
1864
2940
  cursor?: string;
1865
2941
  }): Promise<{
@@ -1867,28 +2943,56 @@ export declare class ApiClient {
1867
2943
  nextCursor?: string;
1868
2944
  hasMore?: boolean;
1869
2945
  }>;
2946
+ /** One page of one custodian's groups (`app` or `user:<userId>`), through the admin API. */
2947
+ listGroupsByCustodian(appId: string, custodian: string, params?: {
2948
+ limit?: number;
2949
+ cursor?: string;
2950
+ }): Promise<{
2951
+ items: any[];
2952
+ nextCursor?: string;
2953
+ hasMore?: boolean;
2954
+ }>;
2955
+ /** Transfer a group to `to` (`app` or `user:<userId>`) through the admin API. */
2956
+ transferGroup(appId: string, groupId: string, to: string): Promise<any>;
2957
+ /**
2958
+ * Create a group through the admin API; `custodian` is `app` or
2959
+ * `user:<userId>`. The server mints the group's id and answers it as
2960
+ * `groupId`.
2961
+ */
1870
2962
  createGroup(appId: string, data: {
1871
- groupType: string;
1872
- groupId?: string;
1873
2963
  name: string;
1874
2964
  description?: string;
2965
+ custodian: string;
2966
+ settings?: {
2967
+ memberList?: "members" | "managers";
2968
+ };
1875
2969
  initialMetadata?: Record<string, Record<string, unknown>>;
1876
2970
  }): Promise<any>;
1877
- getGroup(appId: string, groupType: string, groupId: string): Promise<any>;
1878
- updateGroup(appId: string, groupType: string, groupId: string, data: {
2971
+ /**
2972
+ * A group by id. `groupType` looks a group written before groups were
2973
+ * addressed by id up by its type first (the routes' deprecated
2974
+ * `?groupType=`), as an exported collection's grants still name them.
2975
+ */
2976
+ getGroup(appId: string, groupId: string, options?: {
2977
+ groupType?: string;
2978
+ }): Promise<any>;
2979
+ updateGroup(appId: string, groupId: string, data: {
1879
2980
  name?: string;
1880
2981
  description?: string;
2982
+ settings?: {
2983
+ memberList?: "members" | "managers";
2984
+ };
1881
2985
  }): Promise<any>;
1882
- deleteGroup(appId: string, groupType: string, groupId: string): Promise<any>;
2986
+ deleteGroup(appId: string, groupId: string): Promise<any>;
1883
2987
  /**
1884
- * One page of a group's members.
2988
+ * One page of a group's members, with their roles.
1885
2989
  *
1886
2990
  * The route paginates cursor-style (no default limit, cap 200) and reports
1887
2991
  * the boundary, so `groups members list` carries `--limit`/`--cursor` and
1888
2992
  * forwards them (#3646) rather than printing a first page that claims to be
1889
2993
  * the whole membership.
1890
2994
  */
1891
- listGroupMembers(appId: string, groupType: string, groupId: string, options?: {
2995
+ listGroupMembers(appId: string, groupId: string, options?: {
1892
2996
  include?: "profiles";
1893
2997
  limit?: number;
1894
2998
  cursor?: string;
@@ -1897,11 +3001,16 @@ export declare class ApiClient {
1897
3001
  nextCursor?: string;
1898
3002
  hasMore?: boolean;
1899
3003
  }>;
1900
- addGroupMember(appId: string, groupType: string, groupId: string, data: {
3004
+ /** Add a member through the admin API; `role: "owner"` restores the custodian's owner row. */
3005
+ addGroupMember(appId: string, groupId: string, data: {
1901
3006
  userId: string;
3007
+ role?: string;
1902
3008
  }): Promise<any>;
1903
- removeGroupMember(appId: string, groupType: string, groupId: string, userId: string): Promise<any>;
1904
- listGroupDocuments(appId: string, groupType: string, groupId: string): Promise<any[]>;
3009
+ /** Change a member's role through the admin API, the owner row's included. */
3010
+ setGroupMemberRole(appId: string, groupId: string, userId: string, role: string): Promise<any>;
3011
+ /** Remove a member through the admin API, the owner row included. */
3012
+ removeGroupMember(appId: string, groupId: string, userId: string): Promise<any>;
3013
+ listGroupDocuments(appId: string, groupId: string): Promise<any[]>;
1905
3014
  listUserMemberships(appId: string, userId: string): Promise<any[]>;
1906
3015
  listDocumentGroupPermissions(appId: string, documentId: string): Promise<any[]>;
1907
3016
  grantDocumentGroupPermission(appId: string, documentId: string, data: {
@@ -1935,12 +3044,40 @@ export declare class ApiClient {
1935
3044
  */
1936
3045
  collectionType?: string;
1937
3046
  initialMetadata?: Record<string, Record<string, unknown>>;
3047
+ }): Promise<any>;
3048
+ /** One page of one custodian's collections (`app` or `user:<userId>`), through the admin API. */
3049
+ listCollectionsByCustodian(appId: string, custodian: string, params?: {
3050
+ limit?: number;
3051
+ cursor?: string;
3052
+ }): Promise<{
3053
+ items: any[];
3054
+ nextCursor?: string;
3055
+ hasMore?: boolean;
3056
+ }>;
3057
+ /** Transfer a collection to `to` (`app` or `user:<userId>`) through the admin API. */
3058
+ transferCollection(appId: string, collectionId: string, to: string): Promise<any>;
3059
+ /**
3060
+ * Create a collection through the admin API, for `custodian` (`app` or
3061
+ * `user:<userId>`; a user custodian holds the owner row). Spends no
3062
+ * create budget.
3063
+ */
3064
+ createCollectionAsAdmin(appId: string, data: {
3065
+ name: string;
3066
+ description?: string;
1938
3067
  /**
1939
- * The app user to create the collection FOR (#3641). Honored only for
1940
- * admin-token callers; an app-user token has it ignored and creates as
1941
- * itself, exactly as `createDocument`'s does.
3068
+ * Deprecated: the server still records it while enforcement reads rule
3069
+ * sets, so a migration carries it across.
1942
3070
  */
1943
- createdBy?: string;
3071
+ collectionType?: string;
3072
+ custodian: string;
3073
+ settings?: {
3074
+ memberList?: "members" | "managers";
3075
+ } | Record<string, unknown>;
3076
+ initialMembers?: Array<{
3077
+ userId: string;
3078
+ role: string;
3079
+ }>;
3080
+ initialMetadata?: Record<string, Record<string, unknown>>;
1944
3081
  }): Promise<any>;
1945
3082
  getCollection(appId: string, collectionId: string): Promise<any>;
1946
3083
  updateCollection(appId: string, collectionId: string, data: {
@@ -1967,30 +3104,30 @@ export declare class ApiClient {
1967
3104
  items: any[];
1968
3105
  nextCursor?: string | null;
1969
3106
  }>;
1970
- getCollectionAccess(appId: string, collectionId: string): Promise<any>;
1971
- grantCollectionGroupPermission(appId: string, collectionId: string, data: {
1972
- groupType: string;
1973
- groupId: string;
1974
- permission: string;
1975
- }): Promise<any>;
1976
- revokeCollectionGroupPermission(appId: string, collectionId: string, groupType: string, groupId: string): Promise<any>;
1977
- addCollectionMember(appId: string, collectionId: string, data: {
3107
+ /**
3108
+ * Every member of a collection, users and groups as principals with their
3109
+ * roles, in one answer.
3110
+ */
3111
+ listCollectionMembers(appId: string, collectionId: string): Promise<{
3112
+ items: any[];
3113
+ hasMore: boolean;
3114
+ }>;
3115
+ /**
3116
+ * Add a user or a group to a collection through the admin API, with a role;
3117
+ * `role: "owner"` restores the custodian's owner row.
3118
+ */
3119
+ addCollectionMember(appId: string, collectionId: string, data: ({
1978
3120
  userId: string;
1979
- permission: string;
1980
- }): Promise<any>;
1981
- removeCollectionMember(appId: string, collectionId: string, userId: string): Promise<any>;
1982
- listCollectionTypeConfigs(appId: string): Promise<any[]>;
1983
- getCollectionTypeConfig(appId: string, collectionType: string): Promise<any>;
1984
- createCollectionTypeConfig(appId: string, data: {
1985
- collectionType: string;
1986
- ruleSetId?: string;
1987
- metadataManifest?: any;
3121
+ } | {
3122
+ groupId: string;
3123
+ groupType?: string;
3124
+ }) & {
3125
+ role: string;
1988
3126
  }): Promise<any>;
1989
- updateCollectionTypeConfig(appId: string, collectionType: string, data: {
1990
- ruleSetId?: string | null;
1991
- metadataManifest?: any;
1992
- }, expectedModifiedAt?: string): Promise<any>;
1993
- deleteCollectionTypeConfig(appId: string, collectionType: string): Promise<any>;
3127
+ /** Change a member's role through the admin API, the owner row's included. */
3128
+ setCollectionMemberRole(appId: string, collectionId: string, principal: string, role: string): Promise<any>;
3129
+ /** Remove a user or `group:<groupId>` through the admin API, the owner row included. */
3130
+ removeCollectionMember(appId: string, collectionId: string, principal: string): Promise<any>;
1994
3131
  /**
1995
3132
  * List all metadata category configs for an app. The route returns
1996
3133
  * `{ configs: [...] }`; unwrap to a bare array to match the other
@@ -2048,20 +3185,6 @@ export declare class ApiClient {
2048
3185
  }>;
2049
3186
  testRuleSet(appId: string, ruleSetId: string, data: any): Promise<any>;
2050
3187
  debugRuleSet(appId: string, data: any): Promise<any>;
2051
- listGroupTypeConfigs(appId: string): Promise<any[]>;
2052
- getGroupTypeConfig(appId: string, groupType: string): Promise<any>;
2053
- createGroupTypeConfig(appId: string, data: {
2054
- groupType: string;
2055
- ruleSetId?: string;
2056
- autoAddCreator?: boolean;
2057
- metadataManifest?: any;
2058
- }): Promise<any>;
2059
- updateGroupTypeConfig(appId: string, groupType: string, data: {
2060
- ruleSetId?: string | null;
2061
- autoAddCreator?: boolean;
2062
- metadataManifest?: any;
2063
- }, expectedModifiedAt?: string): Promise<any>;
2064
- deleteGroupTypeConfig(appId: string, groupType: string): Promise<any>;
2065
3188
  exportDocumentState(appId: string, documentId: string): Promise<{
2066
3189
  state: string;
2067
3190
  byteLength: number;
@@ -2126,6 +3249,8 @@ export declare class ApiClient {
2126
3249
  cursor?: string;
2127
3250
  /** #3764 — the format the caller believes this document has. */
2128
3251
  documentFormat?: 1 | 3;
3252
+ /** #4692 — include specs, answered on a db3 as `_related`; the route validates them. */
3253
+ include?: unknown;
2129
3254
  }): Promise<ListEnvelope>;
2130
3255
  /**
2131
3256
  * Count records in a document model (issue #1964 Phase 3). Returns `{ count }`.
@@ -2139,24 +3264,36 @@ export declare class ApiClient {
2139
3264
  /**
2140
3265
  * Aggregate records in a document model (issue #2437) — the documents twin
2141
3266
  * of {@link aggregateDatabaseRecords}. `POST documents/:id/records/:model/aggregate`
2142
- * with `{ options: { operations, groupBy?, filter? } }`, answering `{ result }`
2143
- * in the same shape as the database endpoint.
3267
+ * with `{ options: { operations, groupBy?, filter?, sort?, limit? } }`,
3268
+ * answering `{ result }` in the same shape as the database endpoint.
2144
3269
  *
2145
3270
  * `groupBy` takes plain field names and period levels `{ field, period }`
2146
- * (keyed `<field>_<period>` in a row's `group`): StringSet facet grouping
2147
- * and `{ field, contains }` membership grouping are database-only, which is
2148
- * why this signature is narrower than the databases one.
3271
+ * (keyed `<field>_<period>` in a row's `group`). On a db3 (a format-3
3272
+ * document) a StringSet field name is a facet, `{ field, contains }` a
3273
+ * membership, and `sort` and `limit` order and bound the groups; a format-1
3274
+ * document refuses those four with a 400.
2149
3275
  */
2150
3276
  aggregateDocumentRecords(appId: string, documentId: string, modelName: string, options: {
2151
3277
  operations: {
2152
3278
  type: string;
2153
3279
  field?: string;
2154
3280
  }[];
3281
+ /** On a db3, a StringSet field name is a facet and `{ field, contains }` a membership. */
2155
3282
  groupBy?: Array<string | {
2156
3283
  field: string;
2157
3284
  period: "month" | "quarter" | "year";
3285
+ } | {
3286
+ field: string;
3287
+ contains: string;
2158
3288
  }>;
2159
3289
  filter?: Record<string, any>;
3290
+ /** The groups' order; a db3 only. */
3291
+ sort?: {
3292
+ field: string;
3293
+ direction: 1 | -1;
3294
+ };
3295
+ /** The most groups answered, 1 to 10,000; a db3 only. */
3296
+ limit?: number;
2160
3297
  }, extra?: {
2161
3298
  documentFormat?: 1 | 3;
2162
3299
  }): Promise<{
@@ -2236,6 +3373,8 @@ export declare class ApiClient {
2236
3373
  lastId: string;
2237
3374
  body: Buffer;
2238
3375
  }): Promise<any>;
3376
+ /** A chunk upload to `<base>/ingest/<session>/chunks`: the documents route or its db3 mount. */
3377
+ private uploadIngestChunkAt;
2239
3378
  /** Freeze a session's manifest and hand it to the pipeline (#3435). */
2240
3379
  commitDocumentIngest(appId: string, documentId: string, sessionId: string): Promise<any>;
2241
3380
  /** Give a session up; allowed until the swap (#3435). */
@@ -2291,11 +3430,12 @@ export declare class ApiClient {
2291
3430
  }>;
2292
3431
  /**
2293
3432
  * Apply an ordered multi-model create/patch/delete blob atomically (issue
2294
- * #1964 Phase 4, wrapping the #1517 `bulkUpdate` facade). All-or-nothing:
2295
- * a validation failure commits nothing. Returns the facade's
2296
- * `{ applied, added, updated, deleted }`.
3433
+ * #1964 Phase 4, wrapping the #1517 `bulkUpdate` facade): `POST
3434
+ * records/batch`, at most 100 operations. All-or-nothing: a validation
3435
+ * failure commits nothing. Returns the facade's `{ applied, added,
3436
+ * updated, deleted }`, and on a db3 `reads` when the batch carried reads.
2297
3437
  */
2298
- bulkDocumentRecords(appId: string, documentId: string, operations: Array<Record<string, unknown>>, extra?: {
3438
+ batchDocumentRecords(appId: string, documentId: string, operations: Array<Record<string, unknown>>, extra?: {
2299
3439
  documentFormat?: 1 | 3;
2300
3440
  }): Promise<{
2301
3441
  applied: number;
@@ -2314,7 +3454,408 @@ export declare class ApiClient {
2314
3454
  id: string;
2315
3455
  created: boolean;
2316
3456
  }>;
3457
+ reads?: Array<Record<string, any>>;
3458
+ }>;
3459
+ /** `/app/<app>/api/db3/<id>`, the id encoded: every `db3.*` route's prefix. */
3460
+ private db3Path;
3461
+ /** `GET db3/:id/indexes` → `{ indexes }`, sorted by name. */
3462
+ listDb3Indexes(appId: string, db3Id: string): Promise<{
3463
+ indexes: Db3IndexRow[];
3464
+ }>;
3465
+ /**
3466
+ * `POST db3/:id/indexes` with `{ model, field | fields, unique?, name? }`,
3467
+ * `{ model, field, members: true }` for a member index, or `{ model, field
3468
+ * | fields, kind: "text", on, text? }` for a text index → `{ index }`. The
3469
+ * route applies the registration rules.
3470
+ */
3471
+ registerDb3Index(appId: string, db3Id: string, body: {
3472
+ model: string;
3473
+ field?: string;
3474
+ fields?: string[];
3475
+ unique?: boolean;
3476
+ name?: string;
3477
+ members?: boolean;
3478
+ kind?: Db3IndexKind;
3479
+ on?: Db3IndexPlacement;
3480
+ text?: Partial<Db3TextIndexOptions>;
3481
+ /** A `vector` index's options (#5225). */
3482
+ vector?: Db3VectorIndexOptions;
3483
+ }): Promise<{
3484
+ index: Db3IndexRow;
3485
+ }>;
3486
+ /** `DELETE db3/:id/indexes/:name` → `{ ok, name }`. */
3487
+ dropDb3Index(appId: string, db3Id: string, name: string): Promise<{
3488
+ ok: boolean;
3489
+ name: string;
3490
+ }>;
3491
+ /**
3492
+ * `GET db3/:id/indexes/:name/model` (#5229): a vector index's shared model,
3493
+ * its bytes as uploaded and the `X-Index-Model-*` headers it was uploaded
3494
+ * with.
3495
+ */
3496
+ fetchDb3IndexModel(appId: string, db3Id: string, name: string): Promise<{
3497
+ data: Buffer;
3498
+ generation: number;
3499
+ revision: number;
3500
+ rows: number;
3501
+ trainedAt: string;
3502
+ format: string;
3503
+ }>;
3504
+ /**
3505
+ * `DELETE db3/:id/indexes/:name/model` (#5229) → `{ ok, name, revision }`:
3506
+ * the model (or an upload under way) gone, `revision` the index's new one.
3507
+ */
3508
+ deleteDb3IndexModel(appId: string, db3Id: string, name: string): Promise<{
3509
+ ok: boolean;
3510
+ name: string;
3511
+ revision: number;
3512
+ }>;
3513
+ /** The db3 mount of {@link queryDocumentRecords}: `GET db3/:id/records/:model`. */
3514
+ queryDb3Records(appId: string, db3Id: string, modelName: string, queryOptions?: {
3515
+ filter?: Record<string, any>;
3516
+ sort?: unknown;
3517
+ limit?: number | string;
3518
+ cursor?: string;
3519
+ include?: unknown;
3520
+ }): Promise<ListEnvelope>;
3521
+ /** The db3 mount of {@link countDocumentRecords}: `GET db3/:id/records/:model/count`. */
3522
+ countDb3Records(appId: string, db3Id: string, modelName: string, queryOptions?: {
3523
+ filter?: Record<string, any>;
3524
+ }): Promise<{
3525
+ count: number;
3526
+ }>;
3527
+ /** The db3 mount of {@link aggregateDocumentRecords}: `POST db3/:id/records/:model/aggregate`. */
3528
+ aggregateDb3Records(appId: string, db3Id: string, modelName: string, options: Parameters<ApiClient["aggregateDocumentRecords"]>[3]): Promise<{
3529
+ result: unknown;
3530
+ }>;
3531
+ /**
3532
+ * `POST db3/:id/records/:model/explain` (#5240): run a query, count or
3533
+ * aggregate on the server, forced onto `index` (or off indexes, `"none"`)
3534
+ * when given, and answer how it read.
3535
+ */
3536
+ explainDb3Read(appId: string, db3Id: string, modelName: string, body: Db3ExplainRequest): Promise<Db3ExplainAnswer>;
3537
+ /** The db3 mount of {@link saveDocumentRecord}: `POST db3/:id/records/:model`. */
3538
+ saveDb3Record(appId: string, db3Id: string, modelName: string, body: {
3539
+ id: string;
3540
+ data: Record<string, unknown>;
3541
+ options?: Record<string, unknown>;
3542
+ }): Promise<{
3543
+ record: unknown;
3544
+ }>;
3545
+ /** The db3 mount of {@link patchDocumentRecord}: `PATCH db3/:id/records/:model/:recordId`. */
3546
+ patchDb3Record(appId: string, db3Id: string, modelName: string, recordId: string, body: {
3547
+ data: Record<string, unknown>;
3548
+ options?: Record<string, unknown>;
3549
+ }): Promise<{
3550
+ record: unknown;
3551
+ }>;
3552
+ /** The db3 mount of {@link deleteDocumentRecord}: `DELETE db3/:id/records/:model/:recordId`. */
3553
+ deleteDb3Record(appId: string, db3Id: string, modelName: string, recordId: string): Promise<{
3554
+ deleted: boolean;
3555
+ }>;
3556
+ /** The db3 mount of {@link batchDocumentRecords}: `POST db3/:id/records/batch`. */
3557
+ batchDb3Records(appId: string, db3Id: string, operations: Array<Record<string, unknown>>): ReturnType<ApiClient["batchDocumentRecords"]>;
3558
+ /**
3559
+ * Several reads of a db3 in one request (#5243): `POST db3/:id/records/batch-read`,
3560
+ * each answered at its index from one state of the db3. `atomic: false`
3561
+ * answers a refused read in its place rather than refusing the request.
3562
+ */
3563
+ batchReadDb3Records(appId: string, db3Id: string, operations: Array<Record<string, unknown>>, options?: {
3564
+ atomic?: boolean;
3565
+ }): Promise<{
3566
+ results: Array<Record<string, any>>;
3567
+ cost?: Record<string, unknown>;
3568
+ }>;
3569
+ /** The db3 mount of {@link getDocumentSchema}: `GET db3/:id/schema`. */
3570
+ getDb3Schema(appId: string, db3Id: string): Promise<any>;
3571
+ /** `?limit=&cursor=` for a listing. */
3572
+ private pageQuery;
3573
+ /** `GET db3/:id/ingest` (#4889): a db3's bulk-load sessions, newest first. */
3574
+ listDb3Ingests(appId: string, db3Id: string, options?: {
3575
+ limit?: number;
3576
+ cursor?: string;
3577
+ }): Promise<{
3578
+ items: any[];
3579
+ hasMore: boolean;
3580
+ nextCursor?: string;
3581
+ }>;
3582
+ /** `GET db3/:id/ingest/:sessionId` (#4889). */
3583
+ getDb3Ingest(appId: string, db3Id: string, sessionId: string): Promise<any>;
3584
+ /** `POST db3/:id/ingest` (#4889): open a bulk-load session; `{}` keeps the defaults. */
3585
+ createDb3Ingest(appId: string, db3Id: string, options?: {
3586
+ reserveEpoch?: "open" | "commit";
3587
+ mode?: "merge" | "refresh";
3588
+ models?: string[];
3589
+ }): Promise<any>;
3590
+ /** `POST db3/:id/ingest/:sessionId/chunks` (#4889): one chunk, multipart, as the documents upload sends it. */
3591
+ uploadDb3IngestChunk(appId: string, db3Id: string, sessionId: string, chunk: Parameters<ApiClient["uploadDocumentIngestChunk"]>[3]): Promise<any>;
3592
+ /** `POST db3/:id/ingest/:sessionId/commit` (#4889). */
3593
+ commitDb3Ingest(appId: string, db3Id: string, sessionId: string): Promise<any>;
3594
+ /** `POST db3/:id/ingest/:sessionId/abort` (#4889). */
3595
+ abortDb3Ingest(appId: string, db3Id: string, sessionId: string): Promise<any>;
3596
+ /** `GET db3/:id/snapshots` (#4889): a db3's segment exports, newest first. */
3597
+ listDb3Snapshots(appId: string, db3Id: string, options?: {
3598
+ limit?: number;
3599
+ cursor?: string;
3600
+ }): Promise<{
3601
+ items: any[];
3602
+ hasMore: boolean;
3603
+ nextCursor?: string;
3604
+ }>;
3605
+ /** `GET db3/:id/snapshots/:segmentId` (#4889). */
3606
+ getDb3Snapshot(appId: string, db3Id: string, segmentId: string): Promise<any>;
3607
+ /** `POST db3/:id/snapshots` (#4889): start a segment export. */
3608
+ requestDb3Snapshot(appId: string, db3Id: string): Promise<any>;
3609
+ /** `GET db3/:id/export/chain` (#4889): the current segment, signed for download. */
3610
+ exportDb3Chain(appId: string, db3Id: string): Promise<any>;
3611
+ /** `GET db3/:id/blobs` (#4889): one page of a db3's blobs. */
3612
+ listDb3Blobs(appId: string, db3Id: string, params?: {
3613
+ cursor?: string;
3614
+ limit?: number;
3615
+ }): Promise<any>;
3616
+ /** `GET db3/:id/blobs/:blobId/download` (#4889): a blob's bytes. */
3617
+ downloadDb3Blob(appId: string, db3Id: string, blobId: string): Promise<Buffer>;
3618
+ /** `PUT db3/:id/blobs/:blobId` (#4889): a blob under its own id, as the documents upload sends it. */
3619
+ uploadDb3Blob(appId: string, db3Id: string, blobId: string, data: Buffer, meta: {
3620
+ filename: string;
3621
+ contentType: string;
3622
+ sha256: string;
3623
+ }): Promise<any>;
3624
+ /** The db3 mount of {@link getDocumentRoom}: `GET db3/:id/room`. App admins only. */
3625
+ getDb3Room(appId: string, db3Id: string, query?: {
3626
+ refused?: string;
3627
+ limit?: number;
3628
+ cursor?: string;
3629
+ }): Promise<any>;
3630
+ /**
3631
+ * `POST db3` (#4804): create a db3 and answer it, `{ id, title, createdBy,
3632
+ * createdAt, modifiedAt, custodian, sync, type, tags }`. Without `custodian`
3633
+ * an admin token's create is held by the app. `id` keeps a caller-chosen id
3634
+ * (#4921), refused `DB3_ID_EXISTS` when the app holds it.
3635
+ */
3636
+ createDb3(appId: string, body: {
3637
+ title: string;
3638
+ type?: string;
3639
+ sync?: boolean;
3640
+ custodian?: string;
3641
+ tags?: string[];
3642
+ id?: string;
3643
+ }): Promise<any>;
3644
+ /** `GET db3/:id` (#4804): the db3, with the caller's grant when it reads it through one. */
3645
+ getDb3(appId: string, db3Id: string): Promise<any>;
3646
+ /**
3647
+ * `PUT db3/:id` (#5890): rename a db3, answered as `getDb3` answers it with
3648
+ * the new title.
3649
+ */
3650
+ updateDb3(appId: string, db3Id: string, body: {
3651
+ title: string;
3652
+ }): Promise<any>;
3653
+ /** `DELETE db3/:id` (#4804): the documents delete for a db3. */
3654
+ deleteDb3(appId: string, db3Id: string): Promise<any>;
3655
+ /** The db3 mount of {@link getDocumentStats}: `GET db3/:id/stats`. */
3656
+ getDb3Stats(appId: string, db3Id: string): Promise<any>;
3657
+ /**
3658
+ * `POST db3/:id/records/:model/:recordId/increment` (#4797): add each of
3659
+ * `fields` to the record's field, answering `{ record, values }`.
3660
+ */
3661
+ incrementDb3Record(appId: string, db3Id: string, modelName: string, recordId: string, body: {
3662
+ fields: Record<string, number>;
3663
+ }): Promise<{
3664
+ record: unknown;
3665
+ values: Record<string, number>;
3666
+ }>;
3667
+ /**
3668
+ * `POST db3/:id/records/:model/clear` (#5994): empty one model in one
3669
+ * operation; `{ ok, model, rows, lsn, epoch, dropped, cost }`.
3670
+ */
3671
+ clearDb3Model(appId: string, db3Id: string, modelName: string, body?: {
3672
+ drop?: boolean;
3673
+ }): Promise<{
3674
+ ok: boolean;
3675
+ model: string;
3676
+ rows: number;
3677
+ lsn: number | null;
3678
+ epoch: number | null;
3679
+ dropped: boolean;
3680
+ cost?: unknown;
3681
+ }>;
3682
+ /** `GET db3/:id/sync` (#4799): `{ id, sync }`. */
3683
+ getDb3Sync(appId: string, db3Id: string): Promise<{
3684
+ id: string;
3685
+ sync: boolean;
3686
+ }>;
3687
+ /** `PUT db3/:id/sync` (#4799): `{ id, sync, changed }`. */
3688
+ setDb3Sync(appId: string, db3Id: string, sync: boolean): Promise<{
3689
+ id: string;
3690
+ sync: boolean;
3691
+ changed: boolean;
3692
+ }>;
3693
+ /** `GET db3/:id/app-access` (#4801): `{ id, level }`, the level every user of the app holds, or null. */
3694
+ getDb3AppAccess(appId: string, db3Id: string): Promise<{
3695
+ id: string;
3696
+ level: string | null;
3697
+ }>;
3698
+ /** `PUT db3/:id/app-access` (#4801): grant the db3 to every user of the app, or remove the grant with null. */
3699
+ setDb3AppAccess(appId: string, db3Id: string, level: "reader" | "read-write" | null): Promise<{
3700
+ id: string;
3701
+ level: string | null;
3702
+ changed: boolean;
3703
+ }>;
3704
+ /**
3705
+ * `PUT db3/:id/public-access` (#5842): mark the db3 public at `reader`, or
3706
+ * clear it with null; `signedOutAccess` is the app's setting, which decides
3707
+ * whether the value is honoured yet.
3708
+ */
3709
+ setDb3PublicAccess(appId: string, db3Id: string, level: "reader" | null): Promise<{
3710
+ id: string;
3711
+ level: "reader" | null;
3712
+ changed: boolean;
3713
+ signedOutAccess: boolean;
3714
+ }>;
3715
+ /** `GET db3/:id/link-access`: `{ documentId, linkAccess, … }`, `linkAccess` null when off. */
3716
+ getDb3LinkAccess(appId: string, db3Id: string): Promise<{
3717
+ documentId: string;
3718
+ linkAccess: string | null;
3719
+ [key: string]: unknown;
3720
+ }>;
3721
+ /** `PUT db3/:id/link-access`: let anyone in the app with the id open the db3 at `level`. */
3722
+ setDb3LinkAccess(appId: string, db3Id: string, level: "reader" | "read-write"): Promise<any>;
3723
+ /** `DELETE db3/:id/link-access`: turn the db3's link access off. */
3724
+ clearDb3LinkAccess(appId: string, db3Id: string): Promise<any>;
3725
+ /** `GET db3/:id/permissions`: the db3's user grants, a bare array of `{ userId, email, name, permission, grantedAt }`. */
3726
+ listDb3Permissions(appId: string, db3Id: string): Promise<any[]>;
3727
+ /**
3728
+ * `PUT db3/:id/permissions`: grant one user, named by `userId` or `email`,
3729
+ * a level; `sendEmail` tells them, with `documentUrl` and `note` in the email.
3730
+ */
3731
+ grantDb3Permission(appId: string, db3Id: string, entry: {
3732
+ userId?: string;
3733
+ email?: string;
3734
+ permission: string;
3735
+ }, email?: {
3736
+ sendEmail?: boolean;
3737
+ documentUrl?: string;
3738
+ note?: string;
3739
+ }): Promise<any>;
3740
+ /** `DELETE db3/:id/permissions/:userId`, or `DELETE db3/:id/permissions?email=` for an email: revoke one user's grant. */
3741
+ revokeDb3Permission(appId: string, db3Id: string, target: {
3742
+ userId?: string;
3743
+ email?: string;
3744
+ }): Promise<any>;
3745
+ /** `GET db3/:id/group-permissions`: the db3's group grants, a bare array; `includeSystem` adds system groups'. */
3746
+ listDb3GroupPermissions(appId: string, db3Id: string, options?: {
3747
+ includeSystem?: boolean;
3748
+ }): Promise<any[]>;
3749
+ /** `POST db3/:id/group-permissions`: grant a group, named by its id, a level. */
3750
+ grantDb3GroupPermission(appId: string, db3Id: string, groupId: string, permission: string): Promise<any>;
3751
+ /** `DELETE db3/:id/group-permissions/:groupId`: revoke a group's grant. */
3752
+ revokeDb3GroupPermission(appId: string, db3Id: string, groupId: string): Promise<any>;
3753
+ /** `GET db3/:id/pending-invitations`: `{ items }`, the grants waiting for an address to join the app. */
3754
+ listDb3PendingInvitations(appId: string, db3Id: string): Promise<{
3755
+ items: any[];
3756
+ }>;
3757
+ /** `DELETE db3/:id/pending-invitations/:invitationId`: cancel a pending invitation's grants on this db3. */
3758
+ revokeDb3PendingInvitation(appId: string, db3Id: string, invitationId: string): Promise<any>;
3759
+ /** `GET db3/:id/access-requests`: the pending access requests, a bare array. */
3760
+ listDb3AccessRequests(appId: string, db3Id: string): Promise<any[]>;
3761
+ /**
3762
+ * `POST db3/:id/access-requests`: the signed-in caller asks for access.
3763
+ * `created` is true when the request is new (201) and false when the
3764
+ * caller's pending request was updated (200).
3765
+ */
3766
+ createDb3AccessRequest(appId: string, db3Id: string, body: {
3767
+ permission: string;
3768
+ message?: string;
3769
+ documentUrl?: string;
3770
+ reviewUrl?: string;
3771
+ sendEmail?: boolean;
3772
+ }): Promise<{
3773
+ answer: any;
3774
+ created: boolean;
3775
+ }>;
3776
+ /** `POST db3/:id/access-requests/:requestId/approve`: grant the requested level, or `permission`. */
3777
+ approveDb3AccessRequest(appId: string, db3Id: string, requestId: string, body?: {
3778
+ permission?: string;
3779
+ documentUrl?: string;
3780
+ }): Promise<any>;
3781
+ /** `POST db3/:id/access-requests/:requestId/deny`: deny the request. */
3782
+ denyDb3AccessRequest(appId: string, db3Id: string, requestId: string, body?: {
3783
+ documentUrl?: string;
3784
+ }): Promise<any>;
3785
+ /** `POST db3/:id/validate-access` with `{ userId }`: a named user's effective access to the db3. */
3786
+ validateDb3AccessForUser(appId: string, db3Id: string, userId: string): Promise<any>;
3787
+ /** One custodian's db3s through the admin API (#4800): `custodian` is `app` or `user:<userId>`. */
3788
+ listDb3ByCustodian(appId: string, custodian: string, params?: {
3789
+ limit?: number;
3790
+ cursor?: string;
3791
+ }): Promise<{
3792
+ items: any[];
3793
+ nextCursor?: string;
3794
+ hasMore?: boolean;
3795
+ }>;
3796
+ /**
3797
+ * Every db3 a member reaches through the admin API (#5253): held, shared
3798
+ * with them, then app access, each row with its `via`; `via` narrows to
3799
+ * some of the three ways.
3800
+ */
3801
+ listDb3ForUser(appId: string, userId: string, params?: {
3802
+ via?: string[];
3803
+ limit?: number;
3804
+ cursor?: string;
3805
+ }): Promise<{
3806
+ items: any[];
3807
+ nextCursor?: string;
3808
+ hasMore?: boolean;
2317
3809
  }>;
3810
+ /** Transfer a db3 to `to` (`app` or `user:<userId>`) through the admin API (#4804). */
3811
+ transferDb3(appId: string, db3Id: string, to: string): Promise<any>;
3812
+ /** Remove or restore a db3's owner row through the admin API (#4804): `{ id, custodian, ownerRow, changed }`. */
3813
+ setDb3OwnerRow(appId: string, db3Id: string, present: boolean): Promise<{
3814
+ id: string;
3815
+ custodian: string;
3816
+ ownerRow: boolean;
3817
+ changed: boolean;
3818
+ }>;
3819
+ /** `GET db3/:id/type` (#4802): the type the db3's row names, its revision, and what its room holds. */
3820
+ getDb3Type(appId: string, db3Id: string): Promise<any>;
3821
+ /** `PUT db3/:id/type` (#4802): attach a type, installing its current revision whole or refusing it whole. */
3822
+ attachDb3Type(appId: string, db3Id: string, type: string): Promise<any>;
3823
+ /** `/app/<app>/api/db3-types/<name>`, the name encoded (#4802). */
3824
+ private db3TypePath;
3825
+ /** `GET db3-types` (#4802): the app's db3 types, each with its revision. */
3826
+ listDb3Types(appId: string): Promise<{
3827
+ types: any[];
3828
+ }>;
3829
+ /** `GET db3-types/:name` (#4802). */
3830
+ getDb3TypeConfig(appId: string, name: string): Promise<any>;
3831
+ /**
3832
+ * `PUT db3-types/:name` (#4802): create or update the type, and push its new
3833
+ * revision to every db3 of it. `dryRun` judges the body and persists nothing;
3834
+ * `allowFieldRemoval` asks for the append-only override (#6019), which the
3835
+ * server takes only on an app whose stored settings enable it.
3836
+ */
3837
+ pushDb3Type(appId: string, name: string, data: {
3838
+ ruleSetId?: string | null;
3839
+ triggers?: Record<string, any> | null;
3840
+ autoPopulatedFields?: Record<string, any> | null;
3841
+ timestamps?: Record<string, any> | null;
3842
+ schema?: string | null;
3843
+ metadataManifest?: any;
3844
+ expectedModifiedAt?: string;
3845
+ /** #6020 — `true` archives the type, `false` or `null` unarchives it; omitted keeps it. */
3846
+ archived?: boolean | null;
3847
+ /** #5998 — who creates db3s of the type: `"admins"`, or `"members"`/`null` for every member; omitted keeps it. */
3848
+ create?: "admins" | "members" | null;
3849
+ }, options?: {
3850
+ dryRun?: boolean;
3851
+ allowFieldRemoval?: boolean;
3852
+ }): Promise<any>;
3853
+ /** `DELETE db3-types/:name` (#4802): refused while a db3 is of the type. */
3854
+ deleteDb3Type(appId: string, name: string): Promise<any>;
3855
+ /** `GET db3-types/:name/push-status` (#4802): a push's outcome per db3; the latest without `runId`. */
3856
+ getDb3TypePushStatus(appId: string, name: string, runId?: string): Promise<any>;
3857
+ /** `POST db3-types/:name/push?runId=` (#4802): push the current revision again to a run's refused and failed db3s. */
3858
+ retryDb3TypePush(appId: string, name: string, runId: string): Promise<any>;
2318
3859
  createDocument(appId: string, data: {
2319
3860
  title: string;
2320
3861
  documentId?: string;
@@ -2368,11 +3909,15 @@ export declare class ApiClient {
2368
3909
  limit?: number;
2369
3910
  }): Promise<any>;
2370
3911
  downloadBlob(appId: string, documentId: string, blobId: string): Promise<Buffer>;
3912
+ /** A blob's bytes from `<base>/blobs/<id>/download`: the documents route or its db3 mount. */
3913
+ private downloadBlobAt;
2371
3914
  uploadBlob(appId: string, documentId: string, blobId: string, data: Buffer, meta: {
2372
3915
  filename: string;
2373
3916
  contentType: string;
2374
3917
  sha256: string;
2375
3918
  }): Promise<any>;
3919
+ /** A blob PUT to `<base>/blobs/<id>`: the documents route or its db3 mount. */
3920
+ private uploadBlobAt;
2376
3921
  /**
2377
3922
  * Upload a file to an agent session by `sessionId` (#4585): the document
2378
3923
  * blob upload's headers and body, on the session's attachment route.