@nocobase/app-plugin-releases 0.1.0-beta.2 → 0.1.0-beta.20

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 (268) hide show
  1. package/CHANGELOG.md +341 -0
  2. package/LICENSE.txt +129 -0
  3. package/README.md +91 -16
  4. package/dist/client/components/environment-form.d.ts +1 -1
  5. package/dist/client/components/environment-form.d.ts.map +1 -1
  6. package/dist/client/components/environment-form.js +9 -2
  7. package/dist/client/components/environment-form.js.map +1 -1
  8. package/dist/client/components/page-header.d.ts.map +1 -1
  9. package/dist/client/components/page-header.js +1 -1
  10. package/dist/client/components/page-header.js.map +1 -1
  11. package/dist/client/components/release-badges.d.ts.map +1 -1
  12. package/dist/client/components/release-badges.js +13 -1
  13. package/dist/client/components/release-badges.js.map +1 -1
  14. package/dist/client/components/route-overlay.d.ts +4 -1
  15. package/dist/client/components/route-overlay.d.ts.map +1 -1
  16. package/dist/client/components/route-overlay.js +32 -3
  17. package/dist/client/components/route-overlay.js.map +1 -1
  18. package/dist/client/components/runtime-policy-fields.d.ts +7 -1
  19. package/dist/client/components/runtime-policy-fields.d.ts.map +1 -1
  20. package/dist/client/components/runtime-policy-fields.js +19 -5
  21. package/dist/client/components/runtime-policy-fields.js.map +1 -1
  22. package/dist/client/components/runtime-state.d.ts +6 -0
  23. package/dist/client/components/runtime-state.d.ts.map +1 -0
  24. package/dist/client/components/runtime-state.js +67 -0
  25. package/dist/client/components/runtime-state.js.map +1 -0
  26. package/dist/client/components/shared-host.d.ts +20 -0
  27. package/dist/client/components/shared-host.d.ts.map +1 -0
  28. package/dist/client/components/shared-host.js +88 -0
  29. package/dist/client/components/shared-host.js.map +1 -0
  30. package/dist/client/components/ui/progress.d.ts +9 -0
  31. package/dist/client/components/ui/progress.d.ts.map +1 -0
  32. package/dist/client/components/ui/progress.js +20 -0
  33. package/dist/client/components/ui/progress.js.map +1 -0
  34. package/dist/client/components/use-route-overlay.d.ts +2 -9
  35. package/dist/client/components/use-route-overlay.d.ts.map +1 -1
  36. package/dist/client/components/use-route-overlay.js +5 -3
  37. package/dist/client/components/use-route-overlay.js.map +1 -1
  38. package/dist/client/components/variable-alerts.d.ts.map +1 -1
  39. package/dist/client/components/variable-alerts.js +6 -18
  40. package/dist/client/components/variable-alerts.js.map +1 -1
  41. package/dist/client/hooks/use-app-summary.d.ts +1 -1
  42. package/dist/client/hooks/use-app-summary.d.ts.map +1 -1
  43. package/dist/client/hooks/use-app-summary.js +4 -1
  44. package/dist/client/hooks/use-app-summary.js.map +1 -1
  45. package/dist/client/hooks/use-releases.d.ts +4 -1
  46. package/dist/client/hooks/use-releases.d.ts.map +1 -1
  47. package/dist/client/hooks/use-releases.js +6 -2
  48. package/dist/client/hooks/use-releases.js.map +1 -1
  49. package/dist/client/lib/app-state.d.ts +2 -2
  50. package/dist/client/lib/app-state.d.ts.map +1 -1
  51. package/dist/client/lib/app-state.js +10 -3
  52. package/dist/client/lib/app-state.js.map +1 -1
  53. package/dist/client/lib/errors.d.ts.map +1 -1
  54. package/dist/client/lib/errors.js +7 -0
  55. package/dist/client/lib/errors.js.map +1 -1
  56. package/dist/client/lib/format.d.ts +2 -0
  57. package/dist/client/lib/format.d.ts.map +1 -1
  58. package/dist/client/lib/format.js +7 -0
  59. package/dist/client/lib/format.js.map +1 -1
  60. package/dist/client/lib/paths.d.ts +5 -0
  61. package/dist/client/lib/paths.d.ts.map +1 -1
  62. package/dist/client/lib/paths.js +10 -0
  63. package/dist/client/lib/paths.js.map +1 -1
  64. package/dist/client/lib/permissions.d.ts +5 -0
  65. package/dist/client/lib/permissions.d.ts.map +1 -1
  66. package/dist/client/lib/permissions.js +8 -0
  67. package/dist/client/lib/permissions.js.map +1 -1
  68. package/dist/client/lib/runtime-state.d.ts +25 -0
  69. package/dist/client/lib/runtime-state.d.ts.map +1 -0
  70. package/dist/client/lib/runtime-state.js +58 -0
  71. package/dist/client/lib/runtime-state.js.map +1 -0
  72. package/dist/client/locales/de-DE.d.ts +5 -0
  73. package/dist/client/locales/de-DE.d.ts.map +1 -0
  74. package/dist/client/locales/de-DE.js +876 -0
  75. package/dist/client/locales/de-DE.js.map +1 -0
  76. package/dist/client/locales/en-US.d.ts +83 -9
  77. package/dist/client/locales/en-US.d.ts.map +1 -1
  78. package/dist/client/locales/en-US.js +80 -9
  79. package/dist/client/locales/en-US.js.map +1 -1
  80. package/dist/client/locales/es-ES.d.ts +5 -0
  81. package/dist/client/locales/es-ES.d.ts.map +1 -0
  82. package/dist/client/locales/es-ES.js +882 -0
  83. package/dist/client/locales/es-ES.js.map +1 -0
  84. package/dist/client/locales/fr-FR.d.ts +5 -0
  85. package/dist/client/locales/fr-FR.d.ts.map +1 -0
  86. package/dist/client/locales/fr-FR.js +882 -0
  87. package/dist/client/locales/fr-FR.js.map +1 -0
  88. package/dist/client/locales/id-ID.d.ts +5 -0
  89. package/dist/client/locales/id-ID.d.ts.map +1 -0
  90. package/dist/client/locales/id-ID.js +876 -0
  91. package/dist/client/locales/id-ID.js.map +1 -0
  92. package/dist/client/locales/index.d.ts.map +1 -1
  93. package/dist/client/locales/index.js +10 -0
  94. package/dist/client/locales/index.js.map +1 -1
  95. package/dist/client/locales/ja-JP.d.ts +5 -0
  96. package/dist/client/locales/ja-JP.d.ts.map +1 -0
  97. package/dist/client/locales/ja-JP.js +876 -0
  98. package/dist/client/locales/ja-JP.js.map +1 -0
  99. package/dist/client/locales/ko-KR.d.ts +5 -0
  100. package/dist/client/locales/ko-KR.d.ts.map +1 -0
  101. package/dist/client/locales/ko-KR.js +879 -0
  102. package/dist/client/locales/ko-KR.js.map +1 -0
  103. package/dist/client/locales/pt-BR.d.ts +5 -0
  104. package/dist/client/locales/pt-BR.d.ts.map +1 -0
  105. package/dist/client/locales/pt-BR.js +882 -0
  106. package/dist/client/locales/pt-BR.js.map +1 -0
  107. package/dist/client/locales/ru-RU.d.ts +5 -0
  108. package/dist/client/locales/ru-RU.d.ts.map +1 -0
  109. package/dist/client/locales/ru-RU.js +891 -0
  110. package/dist/client/locales/ru-RU.js.map +1 -0
  111. package/dist/client/locales/vi-VN.d.ts +5 -0
  112. package/dist/client/locales/vi-VN.d.ts.map +1 -0
  113. package/dist/client/locales/vi-VN.js +876 -0
  114. package/dist/client/locales/vi-VN.js.map +1 -0
  115. package/dist/client/locales/zh-CN.d.ts.map +1 -1
  116. package/dist/client/locales/zh-CN.js +83 -9
  117. package/dist/client/locales/zh-CN.js.map +1 -1
  118. package/dist/client/locales/zh-TW.d.ts +5 -0
  119. package/dist/client/locales/zh-TW.d.ts.map +1 -0
  120. package/dist/client/locales/zh-TW.js +876 -0
  121. package/dist/client/locales/zh-TW.js.map +1 -0
  122. package/dist/client/pages/app-page.d.ts.map +1 -1
  123. package/dist/client/pages/app-page.js +14 -8
  124. package/dist/client/pages/app-page.js.map +1 -1
  125. package/dist/client/pages/apps-outlet.d.ts +8 -0
  126. package/dist/client/pages/apps-outlet.d.ts.map +1 -0
  127. package/dist/client/pages/apps-outlet.js +9 -0
  128. package/dist/client/pages/apps-outlet.js.map +1 -0
  129. package/dist/client/pages/environment-page.d.ts.map +1 -1
  130. package/dist/client/pages/environment-page.js +112 -24
  131. package/dist/client/pages/environment-page.js.map +1 -1
  132. package/dist/client/pages/environments-page.d.ts +8 -3
  133. package/dist/client/pages/environments-page.d.ts.map +1 -1
  134. package/dist/client/pages/environments-page.js +58 -10
  135. package/dist/client/pages/environments-page.js.map +1 -1
  136. package/dist/client/pages/new-app-page.d.ts +2 -4
  137. package/dist/client/pages/new-app-page.d.ts.map +1 -1
  138. package/dist/client/pages/new-app-page.js +29 -19
  139. package/dist/client/pages/new-app-page.js.map +1 -1
  140. package/dist/client/pages/new-app-redirect.d.ts +7 -0
  141. package/dist/client/pages/new-app-redirect.d.ts.map +1 -0
  142. package/dist/client/pages/new-app-redirect.js +8 -0
  143. package/dist/client/pages/new-app-redirect.js.map +1 -0
  144. package/dist/client/pages/request-page.js +1 -1
  145. package/dist/client/pages.d.ts +6 -2
  146. package/dist/client/pages.d.ts.map +1 -1
  147. package/dist/client/pages.js +8 -4
  148. package/dist/client/pages.js.map +1 -1
  149. package/dist/client/routes.d.ts.map +1 -1
  150. package/dist/client/routes.js +37 -10
  151. package/dist/client/routes.js.map +1 -1
  152. package/dist/database/migrations/.manifest.json +10 -2
  153. package/dist/database/migrations/202610020001_rel_create_tables.js +1 -1
  154. package/dist/database/migrations/202610020001_rel_create_tables.js.map +1 -1
  155. package/dist/database/migrations/202610260002_rel_bound_artifact_keys.d.ts +4 -0
  156. package/dist/database/migrations/202610260002_rel_bound_artifact_keys.d.ts.map +1 -0
  157. package/dist/database/migrations/202610260002_rel_bound_artifact_keys.js +51 -0
  158. package/dist/database/migrations/202610260002_rel_bound_artifact_keys.js.map +1 -0
  159. package/dist/database/migrations/202611020001_rel_environment_purpose.d.ts +8 -0
  160. package/dist/database/migrations/202611020001_rel_environment_purpose.d.ts.map +1 -0
  161. package/dist/database/migrations/202611020001_rel_environment_purpose.js +30 -0
  162. package/dist/database/migrations/202611020001_rel_environment_purpose.js.map +1 -0
  163. package/dist/server/access/caller.d.ts +6 -0
  164. package/dist/server/access/caller.d.ts.map +1 -1
  165. package/dist/server/access/caller.js +36 -0
  166. package/dist/server/access/caller.js.map +1 -1
  167. package/dist/server/artifact-config.d.ts +9 -0
  168. package/dist/server/artifact-config.d.ts.map +1 -0
  169. package/dist/server/artifact-config.js +49 -0
  170. package/dist/server/artifact-config.js.map +1 -0
  171. package/dist/server/composition.d.ts +6 -0
  172. package/dist/server/composition.d.ts.map +1 -1
  173. package/dist/server/composition.js +7 -1
  174. package/dist/server/composition.js.map +1 -1
  175. package/dist/server/config.d.ts +18 -2
  176. package/dist/server/config.d.ts.map +1 -1
  177. package/dist/server/drivers/host/driver.d.ts +13 -2
  178. package/dist/server/drivers/host/driver.d.ts.map +1 -1
  179. package/dist/server/drivers/host/driver.js +427 -81
  180. package/dist/server/drivers/host/driver.js.map +1 -1
  181. package/dist/server/drivers/types.d.ts +79 -1
  182. package/dist/server/drivers/types.d.ts.map +1 -1
  183. package/dist/server/drivers/types.js +6 -0
  184. package/dist/server/drivers/types.js.map +1 -1
  185. package/dist/server/index.d.ts +1 -1
  186. package/dist/server/index.d.ts.map +1 -1
  187. package/dist/server/index.js.map +1 -1
  188. package/dist/server/locales/de-DE.d.ts +5 -0
  189. package/dist/server/locales/de-DE.d.ts.map +1 -0
  190. package/dist/server/locales/de-DE.js +133 -0
  191. package/dist/server/locales/de-DE.js.map +1 -0
  192. package/dist/server/locales/es-ES.d.ts +5 -0
  193. package/dist/server/locales/es-ES.d.ts.map +1 -0
  194. package/dist/server/locales/es-ES.js +133 -0
  195. package/dist/server/locales/es-ES.js.map +1 -0
  196. package/dist/server/locales/fr-FR.d.ts +5 -0
  197. package/dist/server/locales/fr-FR.d.ts.map +1 -0
  198. package/dist/server/locales/fr-FR.js +133 -0
  199. package/dist/server/locales/fr-FR.js.map +1 -0
  200. package/dist/server/locales/id-ID.d.ts +5 -0
  201. package/dist/server/locales/id-ID.d.ts.map +1 -0
  202. package/dist/server/locales/id-ID.js +133 -0
  203. package/dist/server/locales/id-ID.js.map +1 -0
  204. package/dist/server/locales/index.d.ts.map +1 -1
  205. package/dist/server/locales/index.js +10 -0
  206. package/dist/server/locales/index.js.map +1 -1
  207. package/dist/server/locales/ja-JP.d.ts +5 -0
  208. package/dist/server/locales/ja-JP.d.ts.map +1 -0
  209. package/dist/server/locales/ja-JP.js +133 -0
  210. package/dist/server/locales/ja-JP.js.map +1 -0
  211. package/dist/server/locales/ko-KR.d.ts +5 -0
  212. package/dist/server/locales/ko-KR.d.ts.map +1 -0
  213. package/dist/server/locales/ko-KR.js +133 -0
  214. package/dist/server/locales/ko-KR.js.map +1 -0
  215. package/dist/server/locales/pt-BR.d.ts +5 -0
  216. package/dist/server/locales/pt-BR.d.ts.map +1 -0
  217. package/dist/server/locales/pt-BR.js +133 -0
  218. package/dist/server/locales/pt-BR.js.map +1 -0
  219. package/dist/server/locales/ru-RU.d.ts +5 -0
  220. package/dist/server/locales/ru-RU.d.ts.map +1 -0
  221. package/dist/server/locales/ru-RU.js +133 -0
  222. package/dist/server/locales/ru-RU.js.map +1 -0
  223. package/dist/server/locales/vi-VN.d.ts +5 -0
  224. package/dist/server/locales/vi-VN.d.ts.map +1 -0
  225. package/dist/server/locales/vi-VN.js +133 -0
  226. package/dist/server/locales/vi-VN.js.map +1 -0
  227. package/dist/server/locales/zh-TW.d.ts +5 -0
  228. package/dist/server/locales/zh-TW.d.ts.map +1 -0
  229. package/dist/server/locales/zh-TW.js +133 -0
  230. package/dist/server/locales/zh-TW.js.map +1 -0
  231. package/dist/server/providers/releases.d.ts.map +1 -1
  232. package/dist/server/providers/releases.js +12 -5
  233. package/dist/server/providers/releases.js.map +1 -1
  234. package/dist/server/routes/api.d.ts +1 -1
  235. package/dist/server/routes/api.d.ts.map +1 -1
  236. package/dist/server/routes/api.js +120 -20
  237. package/dist/server/routes/api.js.map +1 -1
  238. package/dist/server/routes/index.d.ts.map +1 -1
  239. package/dist/server/routes/index.js +10 -2
  240. package/dist/server/routes/index.js.map +1 -1
  241. package/dist/server/routes/schemas.d.ts +7 -2
  242. package/dist/server/routes/schemas.d.ts.map +1 -1
  243. package/dist/server/routes/schemas.js +320 -89
  244. package/dist/server/routes/schemas.js.map +1 -1
  245. package/dist/server/services/environments.d.ts +2 -2
  246. package/dist/server/services/environments.d.ts.map +1 -1
  247. package/dist/server/services/environments.js +21 -1
  248. package/dist/server/services/environments.js.map +1 -1
  249. package/dist/server/services/releases.d.ts +69 -8
  250. package/dist/server/services/releases.d.ts.map +1 -1
  251. package/dist/server/services/releases.js +574 -128
  252. package/dist/server/services/releases.js.map +1 -1
  253. package/dist/server/services/validation.d.ts +2 -0
  254. package/dist/server/services/validation.d.ts.map +1 -1
  255. package/dist/server/services/validation.js +8 -0
  256. package/dist/server/services/validation.js.map +1 -1
  257. package/dist/server/tokens.d.ts +15 -2
  258. package/dist/server/tokens.d.ts.map +1 -1
  259. package/dist/server/tokens.js.map +1 -1
  260. package/dist/shared/releases.d.ts +94 -3
  261. package/dist/shared/releases.d.ts.map +1 -1
  262. package/dist/shared/releases.js +37 -0
  263. package/dist/shared/releases.js.map +1 -1
  264. package/package.json +18 -18
  265. package/dist/client/pages/apps-page.d.ts +0 -4
  266. package/dist/client/pages/apps-page.d.ts.map +0 -1
  267. package/dist/client/pages/apps-page.js +0 -116
  268. package/dist/client/pages/apps-page.js.map +0 -1
@@ -1,16 +1,25 @@
1
1
  import { z } from 'zod';
2
2
  import { BUSINESS_ACTIONS, BUSINESS_KEYS, PAGES, SETTINGS_KEYS, } from '../../shared/access.js';
3
3
  import { ACTOR_KINDS, APP_ACTIVATIONS, REGISTRY_SECRET_KEYS, } from '../../shared/releases.js';
4
+ import { ENVIRONMENT_PURPOSES, RUN_STATES, } from '../../shared/releases.js';
4
5
  const id = z.string().min(1);
5
- export const EnvironmentParams = z.object({ environmentId: id });
6
+ export const EnvironmentParams = z.object({ environmentId: id.describe('The environment identifier.') });
6
7
  export const RegistryParams = z.object({
7
- registryId: id,
8
+ registryId: id.describe('The registry identifier.'),
9
+ });
10
+ export const AppParams = z.object({
11
+ appId: id.describe('The application identifier.'),
12
+ });
13
+ export const ReleaseParams = z.object({
14
+ appId: id.describe('The application identifier.'),
15
+ releaseId: id.describe('The release identifier to deploy.'),
16
+ });
17
+ export const DeploymentParams = z.object({
18
+ appId: id.describe('The application identifier.'),
19
+ deploymentId: id.describe('The deployment identifier.'),
8
20
  });
9
- export const AppParams = z.object({ appId: id });
10
- export const ReleaseParams = z.object({ appId: id, releaseId: id });
11
- export const DeploymentParams = z.object({ appId: id, deploymentId: id });
12
21
  export const RequestParams = z.object({
13
- requestId: id,
22
+ requestId: id.describe('The request identifier.'),
14
23
  });
15
24
  const page = z.coerce.number().int().min(1).default(1);
16
25
  const pageSize = z.coerce.number().int().min(1).max(100).default(20);
@@ -19,15 +28,28 @@ const labelFilter = z
19
28
  .union([z.string(), z.array(z.string())])
20
29
  .optional()
21
30
  .transform((value) => value === undefined ? [] : Array.isArray(value) ? value : [value]);
31
+ /** A repeatable query value: one arrives as a string, several as an array. */
32
+ const repeated = (item) => z
33
+ .union([item, z.array(item)])
34
+ .optional()
35
+ .transform((value) => value === undefined ? [] : Array.isArray(value) ? value : [value]);
22
36
  export const ListAppsQuery = z.object({
23
- page,
24
- pageSize,
25
- q: z.string().trim().max(100).optional(),
26
- environmentId: z.string().optional(),
27
- label: labelFilter,
28
- });
29
- export const ListReleasesQuery = z.object({ page, pageSize, label: labelFilter });
30
- export const PageQuery = z.object({ page, pageSize });
37
+ page: page.describe('The page number, starting at 1.'),
38
+ pageSize: pageSize.describe('The maximum number of records to return.'),
39
+ q: z.string().trim().max(100).optional().describe('Text to search for.'),
40
+ environmentId: repeated(z.string().min(1)).describe('An environment identifier; repeat for Apps of any of them.'),
41
+ runtimeState: repeated(z.enum(RUN_STATES)).describe('A runtime state (`running`, `starting`, `pending`, `waiting`, `stopped`, `failed`, `unknown`); repeat for Apps in any of them. Applied before the page is cut.'),
42
+ label: labelFilter.describe('A label for this resource.'),
43
+ });
44
+ export const ListReleasesQuery = z.object({
45
+ page: page.describe('The page number, starting at 1.'),
46
+ pageSize: pageSize.describe('The maximum number of records to return.'),
47
+ label: labelFilter.describe('A label for this resource.'),
48
+ });
49
+ export const PageQuery = z.object({
50
+ page: page.describe('The page number, starting at 1.'),
51
+ pageSize: pageSize.describe('The maximum number of records to return.'),
52
+ });
31
53
  const REQUEST_STATUSES = [
32
54
  'pending',
33
55
  'approved',
@@ -37,11 +59,17 @@ const REQUEST_STATUSES = [
37
59
  'failed',
38
60
  ];
39
61
  export const ListRequestsQuery = z.object({
40
- page,
41
- pageSize,
42
- appId: z.string().optional(),
43
- status: z.enum(REQUEST_STATUSES).optional(),
44
- awaitingMe: z.enum(['true', 'false']).optional(),
62
+ page: page.describe('The page number, starting at 1.'),
63
+ pageSize: pageSize.describe('The maximum number of records to return.'),
64
+ appId: z.string().optional().describe('The application identifier.'),
65
+ status: z
66
+ .enum(REQUEST_STATUSES)
67
+ .optional()
68
+ .describe('The status to set or filter by.'),
69
+ awaitingMe: z
70
+ .enum(['true', 'false'])
71
+ .optional()
72
+ .describe('Only requests waiting for the caller’s approval.'),
45
73
  });
46
74
  export const DeleteAppQuery = z.object({
47
75
  confirm: z.string().optional(),
@@ -59,82 +87,161 @@ const LOG_LEVELS = [
59
87
  * the same token later returns what was appended since. A read returns one bounded chunk, so there is no `pageSize`.
60
88
  */
61
89
  export const LogQuery = z.object({
62
- pageToken: z.string().optional(),
63
- level: z.enum(LOG_LEVELS).optional(),
64
- source: z.string().optional(),
65
- q: z.string().optional(),
66
- since: z.iso.datetime({ offset: true }).optional(),
67
- until: z.iso.datetime({ offset: true }).optional(),
68
- fromStart: z.enum(['true', 'false']).optional(),
90
+ pageToken: z
91
+ .string()
92
+ .optional()
93
+ .describe('The continuation token returned by the previous page.'),
94
+ level: z
95
+ .enum(LOG_LEVELS)
96
+ .optional()
97
+ .describe('The log severity to filter by.'),
98
+ source: z
99
+ .string()
100
+ .optional()
101
+ .describe('The source context associated with this record.'),
102
+ q: z.string().optional().describe('Text to search for.'),
103
+ since: z.iso
104
+ .datetime({ offset: true })
105
+ .optional()
106
+ .describe('Return logs at or after this timestamp.'),
107
+ until: z.iso
108
+ .datetime({ offset: true })
109
+ .optional()
110
+ .describe('Return logs before this timestamp.'),
111
+ fromStart: z
112
+ .enum(['true', 'false'])
113
+ .optional()
114
+ .describe('Read from the beginning rather than the latest logs.'),
69
115
  });
70
116
  const labels = z.record(z.string(), z.string());
71
117
  // A driver's settings and credentials follow the schema the driver itself declares, which the service checks.
72
118
  const driverObject = z.record(z.string(), z.unknown());
73
119
  const nullableCount = z.number().nullable();
74
120
  const environmentFields = {
75
- name: z.string(),
76
- config: driverObject.optional(),
77
- secret: driverObject.nullable().optional(),
78
- secretChanges: driverObject.optional(),
79
- publicUrl: z.string().nullable().optional(),
121
+ name: z.string().describe('The name to display.'),
122
+ config: driverObject
123
+ .optional()
124
+ .describe('Configuration values for the selected environment or application.'),
125
+ secret: driverObject
126
+ .nullable()
127
+ .optional()
128
+ .describe('Secret configuration values.'),
129
+ secretChanges: driverObject
130
+ .optional()
131
+ .describe('Secret values to set or remove.'),
132
+ publicUrl: z
133
+ .string()
134
+ .nullable()
135
+ .optional()
136
+ .describe('The public URL applications in this environment use.'),
80
137
  protected: z.boolean().optional().meta({
81
138
  description: 'Every deployment goes through a deployment request an approver approves; nothing deploys directly.',
82
139
  }),
83
- approvers: z.array(z.string()).optional(),
84
- maxApps: nullableCount.optional(),
85
- defaultIdleStopMinutes: nullableCount.optional(),
86
- defaultDormantAfterHours: nullableCount.optional(),
87
- registryId: z.string().nullable().optional(),
140
+ approvers: z
141
+ .array(z.string())
142
+ .optional()
143
+ .describe('Users who may approve deployments to this environment.'),
144
+ maxApps: nullableCount
145
+ .optional()
146
+ .describe('The maximum number of applications in this environment; null means unlimited.'),
147
+ defaultIdleStopMinutes: nullableCount
148
+ .optional()
149
+ .describe('Default idle stop timeout in minutes for applications.'),
150
+ defaultDormantAfterHours: nullableCount
151
+ .optional()
152
+ .describe('Default dormant timeout in hours for applications.'),
153
+ registryId: z
154
+ .string()
155
+ .nullable()
156
+ .optional()
157
+ .describe('The registry identifier.'),
88
158
  sampleDataOnFirstDeploy: z.boolean().optional().meta({
89
159
  description: 'An App’s first deployment here loads its sample data (`APP_SAMPLE_DATA=true`).',
90
160
  }),
161
+ purpose: z.enum(ENVIRONMENT_PURPOSES).optional().meta({
162
+ description: 'What the environment is for: `preview` (pull request previews) or `test`; `test` when created without one.',
163
+ }),
91
164
  };
92
- export const CreateEnvironmentBody = z.strictObject({ ...environmentFields, id, driver: z.string() });
165
+ export const CreateEnvironmentBody = z.strictObject({
166
+ ...environmentFields,
167
+ id: id.describe('The record identifier.'),
168
+ driver: z.string().describe('The environment driver configuration.'),
169
+ });
93
170
  export const UpdateEnvironmentBody = z.strictObject({
94
171
  ...environmentFields,
95
- name: environmentFields.name.optional(),
96
- driver: z.string().optional(),
172
+ name: environmentFields.name.optional().describe('The name to display.'),
173
+ driver: z
174
+ .string()
175
+ .optional()
176
+ .describe('The environment driver configuration.'),
97
177
  });
98
178
  export const CheckEnvironmentBody = z.strictObject({
99
- id: z.string().optional(),
100
- name: z.string().optional(),
101
- driver: z.string(),
102
- config: driverObject.optional(),
103
- secret: driverObject.nullable().optional(),
104
- secretChanges: driverObject.optional(),
105
- publicUrl: z.string().nullable().optional(),
179
+ id: z.string().optional().describe('The record identifier.'),
180
+ name: z.string().optional().describe('The name to display.'),
181
+ driver: z.string().describe('The environment driver configuration.'),
182
+ config: driverObject
183
+ .optional()
184
+ .describe('Configuration values for the selected environment or application.'),
185
+ secret: driverObject
186
+ .nullable()
187
+ .optional()
188
+ .describe('Secret configuration values.'),
189
+ secretChanges: driverObject
190
+ .optional()
191
+ .describe('Secret values to set or remove.'),
192
+ publicUrl: z
193
+ .string()
194
+ .nullable()
195
+ .optional()
196
+ .describe('The public URL applications in this environment use.'),
106
197
  });
107
198
  const registryFields = {
108
- name: z.string().optional(),
109
- url: z.string().optional(),
110
- namespace: z.string().nullable().optional(),
111
- pullUsername: z.string().nullable().optional(),
199
+ name: z.string().optional().describe('The name to display.'),
200
+ url: z.string().optional().describe('The resource URL.'),
201
+ namespace: z
202
+ .string()
203
+ .nullable()
204
+ .optional()
205
+ .describe('The container registry namespace.'),
206
+ pullUsername: z
207
+ .string()
208
+ .nullable()
209
+ .optional()
210
+ .describe('The username used to pull container images.'),
112
211
  secretChanges: z
113
212
  .partialRecord(z.enum(REGISTRY_SECRET_KEYS), z.string().nullable())
114
- .optional(),
213
+ .optional()
214
+ .describe('Secret values to set or remove.'),
115
215
  };
116
216
  export const CreateRegistryBody = z.strictObject({
117
217
  ...registryFields,
118
- id,
119
- name: z.string(),
120
- url: z.string(),
218
+ id: id.describe('The record identifier.'),
219
+ name: z.string().describe('The name to display.'),
220
+ url: z.string().describe('The resource URL.'),
121
221
  });
122
222
  export const UpdateRegistryBody = z.strictObject(registryFields);
123
223
  /** Unsaved settings to try; `id` names the stored registry whose passwords fill the gaps. */
124
224
  export const CheckRegistryBody = z.strictObject({
125
225
  ...registryFields,
126
- id: z.string().optional(),
226
+ id: z.string().optional().describe('The record identifier.'),
127
227
  });
128
228
  const runtimePolicy = {
129
- activation: z.enum(APP_ACTIVATIONS).optional(),
130
- idleStopMinutes: nullableCount.optional(),
131
- dormantAfterHours: nullableCount.optional(),
229
+ activation: z
230
+ .enum(APP_ACTIVATIONS)
231
+ .optional()
232
+ .describe('The policy for starting the application.'),
233
+ idleStopMinutes: nullableCount
234
+ .optional()
235
+ .describe('Minutes without activity before stopping; null disables idle stopping.'),
236
+ dormantAfterHours: nullableCount
237
+ .optional()
238
+ .describe('Hours without activity before marking the app dormant; null disables it.'),
132
239
  };
133
240
  export const CreateAppBody = z.strictObject({
134
- id,
135
- name: z.string(),
136
- environmentId: z.string(),
137
- description: z.string().optional(),
241
+ id: id.describe('The record identifier.'),
242
+ name: z.string().describe('The name to display.'),
243
+ environmentId: z.string().describe('The environment identifier.'),
244
+ description: z.string().optional().describe('A description of the record.'),
138
245
  labels: labels.optional(),
139
246
  previewOf: z.string().optional().meta({
140
247
  description: 'Makes it a preview App of that App, removed with it.',
@@ -142,19 +249,24 @@ export const CreateAppBody = z.strictObject({
142
249
  ...runtimePolicy,
143
250
  });
144
251
  export const UpdateAppBody = z.strictObject({
145
- name: z.string().optional(),
146
- description: z.string().nullable().optional(),
252
+ name: z.string().optional().describe('The name to display.'),
253
+ description: z
254
+ .string()
255
+ .nullable()
256
+ .optional()
257
+ .describe('A description of the record.'),
147
258
  labels: labels.optional(),
148
259
  ...runtimePolicy,
149
260
  });
150
261
  export const UpdateConfigBody = z.strictObject({
151
- content: z.string(),
262
+ content: z.string().describe('The Markdown content.'),
152
263
  secretChanges: z
153
264
  .array(z.strictObject({
154
265
  path: z.array(z.union([z.string(), z.number().int().min(0)])),
155
266
  value: z.string().nullable(),
156
267
  }))
157
- .optional(),
268
+ .optional()
269
+ .describe('Secret values to set or remove.'),
158
270
  });
159
271
  export const LabelReleaseBody = z.strictObject({ labels });
160
272
  const generator = z.enum(['secret', 'secretKeys', 'password']);
@@ -188,18 +300,21 @@ export const RegisterImageReleaseBody = z.strictObject({
188
300
  deploy: z.boolean().optional().meta({
189
301
  description: 'Deploy it once registered; the answer then names the deployment (`deploymentId`).',
190
302
  }),
191
- version: z.string(),
192
- ref: z.string(),
193
- digest: z.string(),
194
- platform: z.string().optional(),
195
- sourceCommit: z.string().optional(),
196
- build: z.string().optional(),
303
+ version: z.string().describe('The release version label.'),
304
+ ref: z.string().describe('The image reference or Git revision.'),
305
+ digest: z.string().describe('The immutable container image digest.'),
306
+ platform: z.string().optional().describe('The container image platform.'),
307
+ sourceCommit: z.string().optional().describe('The source Git commit.'),
308
+ build: z.string().optional().describe('Build metadata for the image.'),
197
309
  labels: labels.optional(),
198
310
  variables: variablesManifest.optional().meta({
199
311
  description: 'The build’s variables manifest (`dist/variables.json`), which an image carries no other way; `--variables-file dist/variables.json` on the command line.',
200
312
  }),
201
313
  });
202
- export const PromoteBody = z.strictObject({ toAppId: id, labels: labels.optional() });
314
+ export const PromoteBody = z.strictObject({
315
+ toAppId: id.describe('The destination application identifier.'),
316
+ labels: labels.optional(),
317
+ });
203
318
  export const CreateUploadTicketBody = z.strictObject({
204
319
  deploy: z.boolean().optional(),
205
320
  ttlSeconds: z.number().int().optional(),
@@ -210,31 +325,38 @@ export const DeployQuery = z.object({
210
325
  }),
211
326
  });
212
327
  export const DeployBody = z.strictObject({
213
- releaseId: id,
328
+ releaseId: id.describe('The release identifier to deploy.'),
214
329
  config: z
215
330
  .strictObject({
216
331
  mode: z.enum(['file', 'external']),
217
332
  content: z.string().optional(),
218
333
  })
219
- .optional(),
334
+ .optional()
335
+ .describe('Configuration values for the selected environment or application.'),
220
336
  idempotencyKey: z.string().optional(),
221
337
  });
222
338
  export const RollbackBody = z.strictObject({
223
- deploymentId: id,
339
+ deploymentId: id.describe('The deployment identifier.'),
224
340
  });
225
341
  export const IdempotencyHeaders = z.object({ 'idempotency-key': z.string().optional() });
226
342
  export const CreateRequestBody = z.strictObject({
227
- releaseId: z.string().optional(),
228
- rollbackToDeploymentId: z.string().optional(),
229
- note: z.string().optional(),
343
+ releaseId: z
344
+ .string()
345
+ .optional()
346
+ .describe('The release identifier to deploy.'),
347
+ rollbackToDeploymentId: z
348
+ .string()
349
+ .optional()
350
+ .describe('The deployment to restore.'),
351
+ note: z.string().optional().describe('A note explaining this change.'),
230
352
  labels: labels.optional(),
231
353
  });
232
354
  export const ApproveRequestBody = z.strictObject({
233
- note: z.string().optional(),
355
+ note: z.string().optional().describe('A note explaining this change.'),
234
356
  confirm: z.string().optional(),
235
357
  });
236
358
  export const RejectRequestBody = z.strictObject({
237
- note: z.string().optional(),
359
+ note: z.string().optional().describe('A note explaining this change.'),
238
360
  });
239
361
  export const EmptyBody = z.strictObject({});
240
362
  /**
@@ -254,6 +376,16 @@ export const UploadHeaders = z.object({
254
376
  // --- Response schemas, typed against the views the services return. ---
255
377
  const dateTime = z.string().meta({ format: 'date-time' });
256
378
  const nullableDateTime = dateTime.nullable();
379
+ const hostHoldReason = z.enum([
380
+ 'requests',
381
+ 'connections',
382
+ 'starting',
383
+ 'operation',
384
+ 'resident',
385
+ 'busy',
386
+ 'recent',
387
+ ]);
388
+ const hostWaitReason = z.enum(['capacity', 'memory', 'recycle']);
257
389
  const outputLabels = z
258
390
  .record(z.string(), z.string())
259
391
  .meta({ ref: 'ReleasesLabels', description: 'Opaque key/value labels.' });
@@ -313,8 +445,7 @@ export const ReleasesDriverSchema = z.object({
313
445
  .nullable()
314
446
  .meta({ description: 'How the application configured the driver itself.' }),
315
447
  });
316
- export const ReleasesEnvironmentSchema = z
317
- .object({
448
+ const environmentRecordFields = {
318
449
  id: z.string(),
319
450
  name: z.string(),
320
451
  driver: z.string(),
@@ -330,6 +461,9 @@ export const ReleasesEnvironmentSchema = z
330
461
  defaultIdleStopMinutes: z.number().nullable(),
331
462
  defaultDormantAfterHours: z.number().nullable(),
332
463
  registryId: z.string().nullable(),
464
+ purpose: z.enum(ENVIRONMENT_PURPOSES).meta({
465
+ description: 'What the environment is for: `preview` (pull request previews) or `test`.',
466
+ }),
333
467
  sampleDataOnFirstDeploy: z.boolean().meta({
334
468
  description: 'An App’s first deployment here loads its sample data (`APP_SAMPLE_DATA=true`).',
335
469
  }),
@@ -350,8 +484,20 @@ export const ReleasesEnvironmentSchema = z
350
484
  }),
351
485
  createdAt: dateTime,
352
486
  updatedAt: dateTime,
353
- })
487
+ };
488
+ export const ReleasesEnvironmentSchema = z
489
+ .object(environmentRecordFields)
354
490
  .meta({ ref: 'ReleasesEnvironment' });
491
+ /** An environment in the list, with how many Apps it holds. */
492
+ export const ReleasesEnvironmentListItemSchema = z
493
+ .object({
494
+ ...environmentRecordFields,
495
+ appCount: z
496
+ .number()
497
+ .int()
498
+ .meta({ description: 'How many Apps the environment holds.' }),
499
+ })
500
+ .meta({ ref: 'ReleasesEnvironmentListItem' });
355
501
  export const ReleasesEnvironmentCheckSchema = z.object({
356
502
  ok: z.boolean(),
357
503
  message: z.string().optional(),
@@ -405,6 +551,35 @@ const appView = z
405
551
  updatedAt: dateTime,
406
552
  })
407
553
  .meta({ ref: 'ReleasesAppView' });
554
+ const appHostFields = {
555
+ id: z.string().meta({
556
+ description: 'The runtime, the same for every environment and App on it.',
557
+ }),
558
+ memory: z
559
+ .object({
560
+ heapUsed: z.number(),
561
+ heapLimit: z.number(),
562
+ rss: z.number(),
563
+ available: z.number(),
564
+ })
565
+ .nullable()
566
+ .meta({
567
+ description: 'The shared process’s memory in bytes, never divided among its Apps.',
568
+ }),
569
+ recycling: z.enum(['pending', 'restarting']).nullable(),
570
+ deployed: z.number().int().nonnegative(),
571
+ running: z.number().int().nonnegative().meta({
572
+ description: 'Apps running or starting on it; a failed App holds nothing and is not counted.',
573
+ }),
574
+ maxActive: z.number().int().positive().nullable().meta({
575
+ description: 'How many Apps may run or start on it at once; null when nothing limits it.',
576
+ }),
577
+ failedEnvironments: z.array(z.object({
578
+ id: z.string(),
579
+ name: z.string().nullable(),
580
+ error: z.string().nullable(),
581
+ })),
582
+ };
408
583
  export const ReleasesAppSchema = z
409
584
  .object({
410
585
  app: appView,
@@ -429,11 +604,27 @@ export const ReleasesAppSchema = z
429
604
  startedAt: nullableDateTime,
430
605
  error: z.string().nullable(),
431
606
  lastAccessedAt: nullableDateTime,
607
+ holds: z.array(hostHoldReason).optional().meta({
608
+ description: 'Why a running or starting App holds a slot on its shared runtime.',
609
+ }),
610
+ waiting: hostWaitReason.optional().meta({
611
+ description: 'Why its last start was refused, for a minute or until it starts.',
612
+ }),
613
+ unrestored: z.boolean().optional().meta({
614
+ description: 'Its shared runtime restarted and could not put this App back; retried in the background.',
615
+ }),
432
616
  }),
433
617
  url: z.string().nullable(),
434
618
  currentVersion: z.string().nullable(),
435
619
  hasReleases: z.boolean(),
436
620
  hasPendingDeployment: z.boolean(),
621
+ pendingDeployment: z
622
+ .object({
623
+ status: z.enum(['queued', 'deploying', 'cancelling']),
624
+ queueAhead: z.number().int().nonnegative().nullable(),
625
+ })
626
+ .nullable()
627
+ .optional(),
437
628
  allowed: z.array(z.enum(BUSINESS_ACTIONS['rel.apps'])).optional().meta({
438
629
  description: 'What the caller may do on this App; only the single-App read answers it.',
439
630
  }),
@@ -446,6 +637,9 @@ export const ReleasesAppSchema = z
446
637
  .meta({
447
638
  description: 'The current release’s required variables nothing supplies, and whether a value changed since the running deployment; only the single-App read answers it.',
448
639
  }),
640
+ host: z.object(appHostFields).nullable().optional().meta({
641
+ description: 'The runtime the App shares with other Apps, every environment on it included; only the single-App read answers it.',
642
+ }),
449
643
  })
450
644
  .meta({ ref: 'ReleasesApp' });
451
645
  export const ReleasesConfigSchema = z
@@ -463,6 +657,22 @@ export const ReleasesConfigTemplateSchema = z.object({
463
657
  .nullable()
464
658
  .meta({ description: 'The release’s configuration template, if any.' }),
465
659
  });
660
+ export const ReleasesSharedHostSchema = z
661
+ .object({
662
+ ...appHostFields,
663
+ environments: z
664
+ .array(z.object({
665
+ id: z.string(),
666
+ name: z.string(),
667
+ running: z.number().int().meta({
668
+ description: 'How many of the environment’s Apps run or start on this runtime (part of `running`).',
669
+ }),
670
+ }))
671
+ .meta({
672
+ description: 'The environments with Apps on this runtime.',
673
+ }),
674
+ })
675
+ .meta({ ref: 'ReleasesSharedHost' });
466
676
  const releaseArtifact = z.discriminatedUnion('kind', [
467
677
  z.object({
468
678
  kind: z.literal('tarball'),
@@ -527,6 +737,8 @@ export const ReleasesUploadTicketSchema = z.object({
527
737
  });
528
738
  const deploymentPhase = z.enum([
529
739
  'queued',
740
+ 'cancelling',
741
+ 'cancelled',
530
742
  'resolving',
531
743
  'verifying',
532
744
  'extracting',
@@ -545,7 +757,16 @@ export const ReleasesDeploymentSchema = z
545
757
  kind: z.enum(['deploy', 'rollback']),
546
758
  rollbackTargetDeploymentId: z.string().nullable(),
547
759
  previousDeploymentId: z.string().nullable(),
548
- status: z.enum(['queued', 'deploying', 'succeeded', 'failed']),
760
+ status: z.enum([
761
+ 'queued',
762
+ 'deploying',
763
+ 'cancelling',
764
+ 'cancelled',
765
+ 'succeeded',
766
+ 'failed',
767
+ ]),
768
+ queueAhead: z.number().int().nonnegative().nullable().optional(),
769
+ cancellable: z.boolean().optional(),
549
770
  phase: deploymentPhase,
550
771
  configMode: z.enum(['file', 'external']),
551
772
  error: z.string().nullable(),
@@ -650,16 +871,26 @@ export const ReleasesLogMeta = z
650
871
  .meta({ ref: 'ReleasesLogMeta' });
651
872
  // --- Variables --------------------------------------------------------------------------------------------------
652
873
  export const VariableParams = z.object({
653
- name: z.string().min(1).max(128),
874
+ name: z.string().min(1).max(128).describe('The name to display.'),
875
+ });
876
+ export const EnvironmentVariableParams = z.object({
877
+ environmentId: id.describe('The environment identifier.'),
878
+ name: z.string().min(1).max(128).describe('The name to display.'),
879
+ });
880
+ export const AppVariableParams = z.object({
881
+ appId: id.describe('The application identifier.'),
882
+ name: z.string().min(1).max(128).describe('The name to display.'),
654
883
  });
655
- export const EnvironmentVariableParams = z.object({ environmentId: id, name: z.string().min(1).max(128) });
656
- export const AppVariableParams = z.object({ appId: id, name: z.string().min(1).max(128) });
657
884
  export const SetEnvironmentVariableBody = z.strictObject({
658
885
  value: z.string().meta({ description: 'The value; at most 64 KiB.' }),
659
886
  secret: z.boolean().optional().meta({
660
887
  description: 'Never shown again once set. Inferred from the name when left out (`…_PASSWORD`, `…_SECRET`, `…_TOKEN`, `…_KEY`).',
661
888
  }),
662
- description: z.string().nullable().optional(),
889
+ description: z
890
+ .string()
891
+ .nullable()
892
+ .optional()
893
+ .describe('A description of the record.'),
663
894
  });
664
895
  export const SetAppVariableBody = z.strictObject({
665
896
  value: z.string().meta({ description: 'The value; at most 64 KiB.' }),