@spacefast/common 0.0.13 → 0.0.18

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 (154) hide show
  1. package/dist/agents/client-registry.d.ts +22 -0
  2. package/dist/agents/client-registry.js +41 -0
  3. package/dist/agents/connect-targets.d.ts +51 -6
  4. package/dist/agents/connect-targets.js +93 -28
  5. package/dist/brand.d.ts +0 -11
  6. package/dist/brand.js +0 -20
  7. package/dist/config/domains.d.ts +15 -6
  8. package/dist/config/domains.js +24 -10
  9. package/dist/config/postgres-budget.d.ts +3 -0
  10. package/dist/config/postgres-budget.js +6 -1
  11. package/dist/config/postgres-budget.json +2 -1
  12. package/dist/contracts/abuse.js +1 -1
  13. package/dist/contracts/access.d.ts +149 -44
  14. package/dist/contracts/access.js +94 -8
  15. package/dist/contracts/activity.js +5 -1
  16. package/dist/contracts/api-keys.js +9 -9
  17. package/dist/contracts/archives.js +11 -11
  18. package/dist/contracts/beta.js +1 -1
  19. package/dist/contracts/builds.js +14 -14
  20. package/dist/contracts/channels.js +2 -2
  21. package/dist/contracts/comments.d.ts +86 -15
  22. package/dist/contracts/comments.js +116 -20
  23. package/dist/contracts/common.d.ts +12 -12
  24. package/dist/contracts/common.js +33 -30
  25. package/dist/contracts/continuation.js +5 -5
  26. package/dist/contracts/data-source-routes.js +1 -1
  27. package/dist/contracts/device-auth.d.ts +6 -6
  28. package/dist/contracts/device-auth.js +12 -12
  29. package/dist/contracts/docs.d.ts +10 -10
  30. package/dist/contracts/domains.js +39 -33
  31. package/dist/contracts/enums.d.ts +2 -10
  32. package/dist/contracts/enums.js +0 -2
  33. package/dist/contracts/error-code-meta.d.ts +116 -47
  34. package/dist/contracts/error-code-meta.js +37 -16
  35. package/dist/contracts/error-codes.d.ts +7 -4
  36. package/dist/contracts/error-codes.js +46 -21
  37. package/dist/contracts/events.d.ts +10 -3
  38. package/dist/contracts/events.js +33 -5
  39. package/dist/contracts/execution.d.ts +26 -0
  40. package/dist/contracts/execution.js +21 -0
  41. package/dist/contracts/feature-lifecycle.d.ts +21 -24
  42. package/dist/contracts/feature-lifecycle.js +28 -26
  43. package/dist/contracts/features.js +4 -4
  44. package/dist/contracts/functions.d.ts +8 -140
  45. package/dist/contracts/functions.js +9 -19
  46. package/dist/contracts/git.d.ts +1 -1
  47. package/dist/contracts/grants.d.ts +96 -79
  48. package/dist/contracts/grants.js +130 -43
  49. package/dist/contracts/ids.d.ts +2 -2
  50. package/dist/contracts/ids.js +2 -4
  51. package/dist/contracts/internal.js +2 -2
  52. package/dist/contracts/mcp.d.ts +17 -556
  53. package/dist/contracts/mcp.js +9 -103
  54. package/dist/contracts/me.js +3 -4
  55. package/dist/contracts/notifications.d.ts +108 -0
  56. package/dist/contracts/notifications.js +54 -0
  57. package/dist/contracts/oauth-resources.d.ts +18 -1
  58. package/dist/contracts/oauth-resources.js +22 -2
  59. package/dist/contracts/operations.d.ts +2 -50
  60. package/dist/contracts/operations.js +0 -19
  61. package/dist/contracts/pages.d.ts +8 -4
  62. package/dist/contracts/pages.js +16 -3
  63. package/dist/contracts/platform.js +10 -8
  64. package/dist/contracts/problem-document.d.ts +14 -0
  65. package/dist/contracts/problem-document.js +35 -0
  66. package/dist/contracts/push-new.d.ts +21 -6
  67. package/dist/contracts/push-new.js +3 -7
  68. package/dist/contracts/resources.d.ts +8 -7
  69. package/dist/contracts/resources.js +9 -6
  70. package/dist/contracts/runtime-api.d.ts +162 -92
  71. package/dist/contracts/runtime-api.js +99 -27
  72. package/dist/contracts/runtime-app.d.ts +41 -11
  73. package/dist/contracts/runtime-app.js +22 -1
  74. package/dist/contracts/runtime-db.d.ts +424 -0
  75. package/dist/contracts/runtime-db.js +108 -0
  76. package/dist/contracts/runtime-storage.d.ts +120 -0
  77. package/dist/contracts/runtime-storage.js +40 -0
  78. package/dist/contracts/sf-config-v1.d.ts +49 -1
  79. package/dist/contracts/sf-config-v1.js +2 -2
  80. package/dist/contracts/sites.d.ts +1 -0
  81. package/dist/contracts/sites.js +20 -12
  82. package/dist/contracts/space-config.d.ts +62 -22
  83. package/dist/contracts/space-config.js +173 -47
  84. package/dist/contracts/spaces.d.ts +79 -45
  85. package/dist/contracts/spaces.js +66 -50
  86. package/dist/contracts/superadmin-spaces.d.ts +13 -2
  87. package/dist/contracts/superadmin-spaces.js +15 -0
  88. package/dist/contracts/superadmin-tenants.js +4 -4
  89. package/dist/contracts/superadmin.d.ts +4 -0
  90. package/dist/contracts/superadmin.js +14 -1
  91. package/dist/contracts/tags.d.ts +17 -17
  92. package/dist/contracts/tags.js +1 -1
  93. package/dist/contracts/teams.js +25 -16
  94. package/dist/contracts/theme-json.js +1 -1
  95. package/dist/contracts/transfers.js +4 -4
  96. package/dist/contracts/variables.js +3 -3
  97. package/dist/contracts/zero.d.ts +204 -338
  98. package/dist/contracts/zero.js +94 -98
  99. package/dist/dashboard-paths/index.d.ts +16 -1
  100. package/dist/dashboard-paths/index.js +18 -0
  101. package/dist/docs/agent-handoff-document.d.ts +2 -2
  102. package/dist/docs/agent-handoff-document.js +8 -7
  103. package/dist/docs/agent-prose.d.ts +22 -3
  104. package/dist/docs/agent-prose.js +221 -51
  105. package/dist/docs/agent-setup.d.ts +13 -10
  106. package/dist/docs/agent-setup.js +279 -53
  107. package/dist/docs/agent-solutions.d.ts +6 -6
  108. package/dist/docs/agent-solutions.js +23 -21
  109. package/dist/docs/catalog.d.ts +29 -74
  110. package/dist/docs/catalog.js +65 -92
  111. package/dist/docs/error-docs.js +293 -221
  112. package/dist/docs/skill-distribution.d.ts +2 -0
  113. package/dist/docs/skill-distribution.js +7 -4
  114. package/dist/docs/skills.d.ts +546 -0
  115. package/dist/docs/skills.js +340 -0
  116. package/dist/utils/browser-credential.d.ts +19 -0
  117. package/dist/utils/browser-credential.js +62 -0
  118. package/dist/utils/comment-avatars.d.ts +7 -0
  119. package/dist/utils/comment-avatars.js +42 -0
  120. package/dist/utils/content-type.d.ts +3 -3
  121. package/dist/utils/content-type.js +38 -61
  122. package/dist/utils/domain-diagnostics.d.ts +5 -5
  123. package/dist/utils/domain-diagnostics.js +21 -10
  124. package/dist/utils/local-space-state.d.ts +78 -4
  125. package/dist/utils/local-space-state.js +383 -82
  126. package/dist/utils/one-shot-replay.d.ts +14 -0
  127. package/dist/utils/one-shot-replay.js +21 -0
  128. package/dist/utils/page-preview.d.ts +7 -0
  129. package/dist/utils/page-preview.js +9 -0
  130. package/dist/utils/pages.d.ts +2 -11
  131. package/dist/utils/pages.js +58 -14
  132. package/dist/utils/publish-form-data.d.ts +22 -0
  133. package/dist/utils/publish-form-data.js +26 -0
  134. package/dist/utils/publish-policy.js +20 -4
  135. package/dist/utils/query-keys.d.ts +7 -4
  136. package/dist/utils/query-keys.js +13 -4
  137. package/dist/utils/runtime-paths.d.ts +3 -0
  138. package/dist/utils/runtime-paths.js +7 -0
  139. package/dist/utils/secure-local-file.d.ts +73 -0
  140. package/dist/utils/secure-local-file.js +1373 -0
  141. package/dist/utils/space-config.d.ts +13 -4
  142. package/dist/utils/space-config.js +123 -15
  143. package/dist/utils/storage-policy.d.ts +20 -0
  144. package/dist/utils/storage-policy.fixtures.json +174 -0
  145. package/dist/utils/storage-policy.js +193 -0
  146. package/dist/utils/upload-session.d.ts +12 -1
  147. package/dist/utils/upload-session.js +37 -2
  148. package/dist/utils/version-file-browser.d.ts +13 -0
  149. package/dist/utils/version-file-browser.js +59 -0
  150. package/package.json +19 -1
  151. package/dist/contracts/mounts.d.ts +0 -142
  152. package/dist/contracts/mounts.js +0 -56
  153. package/dist/utils/asset-fingerprint.d.ts +0 -64
  154. package/dist/utils/asset-fingerprint.js +0 -620
@@ -0,0 +1,424 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * The database surface, for whichever runtime a space is carrying.
4
+ *
5
+ * There is one database per space — the site's own MySQL — and at most one
6
+ * runtime with a claim on it, so these contracts are runtime-neutral by
7
+ * default. The two exceptions are stated explicitly: a migration plan is a
8
+ * capsule's declaration and no worker has one, and the console hand-off is a
9
+ * property of the wp.cloud site rather than of anything a version declared.
10
+ *
11
+ * The reads answer in the capsule's declaration shapes (`zeroTableSchema`,
12
+ * `zeroMigrationOperationSchema`) because a capsule's declared schema is the
13
+ * richest answer either runtime can give and a worker's is the same answer with
14
+ * the declaration-shaped fields empty. Those shapes stay Zero-named and stay in
15
+ * `./zero.js`: a declared table is the capsule's own statement about itself.
16
+ */
17
+ export declare const runtimeDbInspectResponseSchema: z.ZodObject<{
18
+ versionId: z.ZodNullable<z.ZodString>;
19
+ artifactId: z.ZodNullable<z.ZodString>;
20
+ backend: z.ZodNullable<z.ZodLiteral<"wpcloud-mysql">>;
21
+ migrationMode: z.ZodNullable<z.ZodEnum<{
22
+ safe: "safe";
23
+ drop: "drop";
24
+ rename: "rename";
25
+ }>>;
26
+ schemaHash: z.ZodNullable<z.ZodString>;
27
+ tables: z.ZodDefault<z.ZodArray<z.ZodObject<{
28
+ name: z.ZodString;
29
+ columns: z.ZodDefault<z.ZodArray<z.ZodObject<{
30
+ name: z.ZodString;
31
+ type: z.ZodEnum<{
32
+ string: "string";
33
+ number: "number";
34
+ boolean: "boolean";
35
+ json: "json";
36
+ }>;
37
+ nullable: z.ZodDefault<z.ZodBoolean>;
38
+ default: z.ZodOptional<z.ZodUnknown>;
39
+ }, z.core.$strict>>>;
40
+ indexes: z.ZodDefault<z.ZodArray<z.ZodObject<{
41
+ name: z.ZodString;
42
+ fields: z.ZodArray<z.ZodString>;
43
+ }, z.core.$strict>>>;
44
+ }, z.core.$strict>>>;
45
+ migrations: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
46
+ op: z.ZodLiteral<"create_table">;
47
+ table: z.ZodString;
48
+ }, z.core.$strict>, z.ZodObject<{
49
+ op: z.ZodLiteral<"add_column">;
50
+ table: z.ZodString;
51
+ column: z.ZodObject<{
52
+ name: z.ZodString;
53
+ type: z.ZodEnum<{
54
+ string: "string";
55
+ number: "number";
56
+ boolean: "boolean";
57
+ json: "json";
58
+ }>;
59
+ nullable: z.ZodDefault<z.ZodBoolean>;
60
+ default: z.ZodOptional<z.ZodUnknown>;
61
+ }, z.core.$strict>;
62
+ }, z.core.$strict>, z.ZodObject<{
63
+ op: z.ZodLiteral<"add_index">;
64
+ table: z.ZodString;
65
+ name: z.ZodString;
66
+ columns: z.ZodArray<z.ZodString>;
67
+ unique: z.ZodDefault<z.ZodBoolean>;
68
+ }, z.core.$strict>, z.ZodObject<{
69
+ op: z.ZodLiteral<"drop_index">;
70
+ table: z.ZodString;
71
+ name: z.ZodString;
72
+ explicit: z.ZodLiteral<"drop">;
73
+ }, z.core.$strict>, z.ZodObject<{
74
+ op: z.ZodLiteral<"drop_table">;
75
+ table: z.ZodString;
76
+ explicit: z.ZodLiteral<"drop">;
77
+ }, z.core.$strict>, z.ZodObject<{
78
+ op: z.ZodLiteral<"drop_column">;
79
+ table: z.ZodString;
80
+ column: z.ZodString;
81
+ explicit: z.ZodLiteral<"drop">;
82
+ }, z.core.$strict>, z.ZodObject<{
83
+ op: z.ZodLiteral<"rename_table">;
84
+ from: z.ZodString;
85
+ to: z.ZodString;
86
+ explicit: z.ZodLiteral<"rename">;
87
+ }, z.core.$strict>, z.ZodObject<{
88
+ op: z.ZodLiteral<"rename_column">;
89
+ table: z.ZodString;
90
+ from: z.ZodString;
91
+ to: z.ZodString;
92
+ explicit: z.ZodLiteral<"rename">;
93
+ }, z.core.$strict>], "op">>>;
94
+ }, z.core.$strict>;
95
+ export type RuntimeDbInspectResponse = z.infer<typeof runtimeDbInspectResponseSchema>;
96
+ export declare const runtimeDbInspectPublicResponseSchema: z.ZodObject<{
97
+ data: z.ZodObject<{
98
+ versionId: z.ZodNullable<z.ZodString>;
99
+ artifactId: z.ZodNullable<z.ZodString>;
100
+ backend: z.ZodNullable<z.ZodLiteral<"wpcloud-mysql">>;
101
+ migrationMode: z.ZodNullable<z.ZodEnum<{
102
+ safe: "safe";
103
+ drop: "drop";
104
+ rename: "rename";
105
+ }>>;
106
+ schemaHash: z.ZodNullable<z.ZodString>;
107
+ tables: z.ZodDefault<z.ZodArray<z.ZodObject<{
108
+ name: z.ZodString;
109
+ columns: z.ZodDefault<z.ZodArray<z.ZodObject<{
110
+ name: z.ZodString;
111
+ type: z.ZodEnum<{
112
+ string: "string";
113
+ number: "number";
114
+ boolean: "boolean";
115
+ json: "json";
116
+ }>;
117
+ nullable: z.ZodDefault<z.ZodBoolean>;
118
+ default: z.ZodOptional<z.ZodUnknown>;
119
+ }, z.core.$strict>>>;
120
+ indexes: z.ZodDefault<z.ZodArray<z.ZodObject<{
121
+ name: z.ZodString;
122
+ fields: z.ZodArray<z.ZodString>;
123
+ }, z.core.$strict>>>;
124
+ }, z.core.$strict>>>;
125
+ migrations: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
126
+ op: z.ZodLiteral<"create_table">;
127
+ table: z.ZodString;
128
+ }, z.core.$strict>, z.ZodObject<{
129
+ op: z.ZodLiteral<"add_column">;
130
+ table: z.ZodString;
131
+ column: z.ZodObject<{
132
+ name: z.ZodString;
133
+ type: z.ZodEnum<{
134
+ string: "string";
135
+ number: "number";
136
+ boolean: "boolean";
137
+ json: "json";
138
+ }>;
139
+ nullable: z.ZodDefault<z.ZodBoolean>;
140
+ default: z.ZodOptional<z.ZodUnknown>;
141
+ }, z.core.$strict>;
142
+ }, z.core.$strict>, z.ZodObject<{
143
+ op: z.ZodLiteral<"add_index">;
144
+ table: z.ZodString;
145
+ name: z.ZodString;
146
+ columns: z.ZodArray<z.ZodString>;
147
+ unique: z.ZodDefault<z.ZodBoolean>;
148
+ }, z.core.$strict>, z.ZodObject<{
149
+ op: z.ZodLiteral<"drop_index">;
150
+ table: z.ZodString;
151
+ name: z.ZodString;
152
+ explicit: z.ZodLiteral<"drop">;
153
+ }, z.core.$strict>, z.ZodObject<{
154
+ op: z.ZodLiteral<"drop_table">;
155
+ table: z.ZodString;
156
+ explicit: z.ZodLiteral<"drop">;
157
+ }, z.core.$strict>, z.ZodObject<{
158
+ op: z.ZodLiteral<"drop_column">;
159
+ table: z.ZodString;
160
+ column: z.ZodString;
161
+ explicit: z.ZodLiteral<"drop">;
162
+ }, z.core.$strict>, z.ZodObject<{
163
+ op: z.ZodLiteral<"rename_table">;
164
+ from: z.ZodString;
165
+ to: z.ZodString;
166
+ explicit: z.ZodLiteral<"rename">;
167
+ }, z.core.$strict>, z.ZodObject<{
168
+ op: z.ZodLiteral<"rename_column">;
169
+ table: z.ZodString;
170
+ from: z.ZodString;
171
+ to: z.ZodString;
172
+ explicit: z.ZodLiteral<"rename">;
173
+ }, z.core.$strict>], "op">>>;
174
+ }, z.core.$strict>;
175
+ }, z.core.$strip>;
176
+ export declare const runtimeDbDumpQuerySchema: z.ZodObject<{
177
+ table: z.ZodOptional<z.ZodString>;
178
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
179
+ }, z.core.$strict>;
180
+ export declare const runtimeDbDumpTableSchema: z.ZodObject<{
181
+ name: z.ZodString;
182
+ rows: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
183
+ }, z.core.$strict>;
184
+ export declare const runtimeDbDumpResponseSchema: z.ZodObject<{
185
+ versionId: z.ZodNullable<z.ZodString>;
186
+ artifactId: z.ZodNullable<z.ZodString>;
187
+ schemaHash: z.ZodNullable<z.ZodString>;
188
+ tables: z.ZodDefault<z.ZodArray<z.ZodObject<{
189
+ name: z.ZodString;
190
+ rows: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
191
+ }, z.core.$strict>>>;
192
+ }, z.core.$strict>;
193
+ export type RuntimeDbDumpResponse = z.infer<typeof runtimeDbDumpResponseSchema>;
194
+ export declare const runtimeDbDumpPublicResponseSchema: z.ZodObject<{
195
+ data: z.ZodObject<{
196
+ versionId: z.ZodNullable<z.ZodString>;
197
+ artifactId: z.ZodNullable<z.ZodString>;
198
+ schemaHash: z.ZodNullable<z.ZodString>;
199
+ tables: z.ZodDefault<z.ZodArray<z.ZodObject<{
200
+ name: z.ZodString;
201
+ rows: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
202
+ }, z.core.$strict>>>;
203
+ }, z.core.$strict>;
204
+ }, z.core.$strip>;
205
+ export declare const runtimeDbExportOrderingSchema: z.ZodObject<{
206
+ tables: z.ZodLiteral<"name_asc">;
207
+ rows: z.ZodLiteral<"created_at_id_asc">;
208
+ }, z.core.$strict>;
209
+ export declare const runtimeDbExportMetadataSchema: z.ZodObject<{
210
+ spaceId: z.ZodNullable<z.ZodString>;
211
+ versionId: z.ZodNullable<z.ZodString>;
212
+ schemaHash: z.ZodString;
213
+ consistency: z.ZodLiteral<"per_page">;
214
+ ordering: z.ZodObject<{
215
+ tables: z.ZodLiteral<"name_asc">;
216
+ rows: z.ZodLiteral<"created_at_id_asc">;
217
+ }, z.core.$strict>;
218
+ tables: z.ZodArray<z.ZodString>;
219
+ }, z.core.$strict>;
220
+ export type RuntimeDbExportMetadata = z.infer<typeof runtimeDbExportMetadataSchema>;
221
+ export declare const runtimeDbExportMetadataPublicResponseSchema: z.ZodObject<{
222
+ data: z.ZodObject<{
223
+ spaceId: z.ZodNullable<z.ZodString>;
224
+ versionId: z.ZodNullable<z.ZodString>;
225
+ schemaHash: z.ZodString;
226
+ consistency: z.ZodLiteral<"per_page">;
227
+ ordering: z.ZodObject<{
228
+ tables: z.ZodLiteral<"name_asc">;
229
+ rows: z.ZodLiteral<"created_at_id_asc">;
230
+ }, z.core.$strict>;
231
+ tables: z.ZodArray<z.ZodString>;
232
+ }, z.core.$strict>;
233
+ }, z.core.$strip>;
234
+ export declare const runtimeDbExportPageQuerySchema: z.ZodObject<{
235
+ schemaHash: z.ZodString;
236
+ cursor: z.ZodOptional<z.ZodString>;
237
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
238
+ }, z.core.$strict>;
239
+ export declare const runtimeDbExportPageSchema: z.ZodObject<{
240
+ rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
241
+ cursor: z.ZodNullable<z.ZodString>;
242
+ }, z.core.$strict>;
243
+ export type RuntimeDbExportPage = z.infer<typeof runtimeDbExportPageSchema>;
244
+ export declare const runtimeDbExportPagePublicResponseSchema: z.ZodObject<{
245
+ data: z.ZodObject<{
246
+ rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
247
+ cursor: z.ZodNullable<z.ZodString>;
248
+ }, z.core.$strict>;
249
+ }, z.core.$strip>;
250
+ export declare const runtimeDbMigrateResultSchema: z.ZodObject<{
251
+ versionId: z.ZodString;
252
+ runtimeKind: z.ZodLiteral<"zero">;
253
+ schemaHash: z.ZodNullable<z.ZodString>;
254
+ mode: z.ZodNullable<z.ZodEnum<{
255
+ safe: "safe";
256
+ drop: "drop";
257
+ rename: "rename";
258
+ }>>;
259
+ operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
260
+ op: z.ZodLiteral<"create_table">;
261
+ table: z.ZodString;
262
+ }, z.core.$strict>, z.ZodObject<{
263
+ op: z.ZodLiteral<"add_column">;
264
+ table: z.ZodString;
265
+ column: z.ZodObject<{
266
+ name: z.ZodString;
267
+ type: z.ZodEnum<{
268
+ string: "string";
269
+ number: "number";
270
+ boolean: "boolean";
271
+ json: "json";
272
+ }>;
273
+ nullable: z.ZodDefault<z.ZodBoolean>;
274
+ default: z.ZodOptional<z.ZodUnknown>;
275
+ }, z.core.$strict>;
276
+ }, z.core.$strict>, z.ZodObject<{
277
+ op: z.ZodLiteral<"add_index">;
278
+ table: z.ZodString;
279
+ name: z.ZodString;
280
+ columns: z.ZodArray<z.ZodString>;
281
+ unique: z.ZodDefault<z.ZodBoolean>;
282
+ }, z.core.$strict>, z.ZodObject<{
283
+ op: z.ZodLiteral<"drop_index">;
284
+ table: z.ZodString;
285
+ name: z.ZodString;
286
+ explicit: z.ZodLiteral<"drop">;
287
+ }, z.core.$strict>, z.ZodObject<{
288
+ op: z.ZodLiteral<"drop_table">;
289
+ table: z.ZodString;
290
+ explicit: z.ZodLiteral<"drop">;
291
+ }, z.core.$strict>, z.ZodObject<{
292
+ op: z.ZodLiteral<"drop_column">;
293
+ table: z.ZodString;
294
+ column: z.ZodString;
295
+ explicit: z.ZodLiteral<"drop">;
296
+ }, z.core.$strict>, z.ZodObject<{
297
+ op: z.ZodLiteral<"rename_table">;
298
+ from: z.ZodString;
299
+ to: z.ZodString;
300
+ explicit: z.ZodLiteral<"rename">;
301
+ }, z.core.$strict>, z.ZodObject<{
302
+ op: z.ZodLiteral<"rename_column">;
303
+ table: z.ZodString;
304
+ from: z.ZodString;
305
+ to: z.ZodString;
306
+ explicit: z.ZodLiteral<"rename">;
307
+ }, z.core.$strict>], "op">>;
308
+ queued: z.ZodBoolean;
309
+ }, z.core.$strict>;
310
+ export type RuntimeDbMigrateResult = z.infer<typeof runtimeDbMigrateResultSchema>;
311
+ export declare const runtimeDbMigrateResponseSchema: z.ZodObject<{
312
+ data: z.ZodObject<{
313
+ versionId: z.ZodString;
314
+ runtimeKind: z.ZodLiteral<"zero">;
315
+ schemaHash: z.ZodNullable<z.ZodString>;
316
+ mode: z.ZodNullable<z.ZodEnum<{
317
+ safe: "safe";
318
+ drop: "drop";
319
+ rename: "rename";
320
+ }>>;
321
+ operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
322
+ op: z.ZodLiteral<"create_table">;
323
+ table: z.ZodString;
324
+ }, z.core.$strict>, z.ZodObject<{
325
+ op: z.ZodLiteral<"add_column">;
326
+ table: z.ZodString;
327
+ column: z.ZodObject<{
328
+ name: z.ZodString;
329
+ type: z.ZodEnum<{
330
+ string: "string";
331
+ number: "number";
332
+ boolean: "boolean";
333
+ json: "json";
334
+ }>;
335
+ nullable: z.ZodDefault<z.ZodBoolean>;
336
+ default: z.ZodOptional<z.ZodUnknown>;
337
+ }, z.core.$strict>;
338
+ }, z.core.$strict>, z.ZodObject<{
339
+ op: z.ZodLiteral<"add_index">;
340
+ table: z.ZodString;
341
+ name: z.ZodString;
342
+ columns: z.ZodArray<z.ZodString>;
343
+ unique: z.ZodDefault<z.ZodBoolean>;
344
+ }, z.core.$strict>, z.ZodObject<{
345
+ op: z.ZodLiteral<"drop_index">;
346
+ table: z.ZodString;
347
+ name: z.ZodString;
348
+ explicit: z.ZodLiteral<"drop">;
349
+ }, z.core.$strict>, z.ZodObject<{
350
+ op: z.ZodLiteral<"drop_table">;
351
+ table: z.ZodString;
352
+ explicit: z.ZodLiteral<"drop">;
353
+ }, z.core.$strict>, z.ZodObject<{
354
+ op: z.ZodLiteral<"drop_column">;
355
+ table: z.ZodString;
356
+ column: z.ZodString;
357
+ explicit: z.ZodLiteral<"drop">;
358
+ }, z.core.$strict>, z.ZodObject<{
359
+ op: z.ZodLiteral<"rename_table">;
360
+ from: z.ZodString;
361
+ to: z.ZodString;
362
+ explicit: z.ZodLiteral<"rename">;
363
+ }, z.core.$strict>, z.ZodObject<{
364
+ op: z.ZodLiteral<"rename_column">;
365
+ table: z.ZodString;
366
+ from: z.ZodString;
367
+ to: z.ZodString;
368
+ explicit: z.ZodLiteral<"rename">;
369
+ }, z.core.$strict>], "op">>;
370
+ queued: z.ZodBoolean;
371
+ }, z.core.$strict>;
372
+ operation: z.ZodNullable<z.ZodObject<{
373
+ id: z.ZodString;
374
+ kind: z.ZodString;
375
+ status: z.ZodEnum<{
376
+ failed: "failed";
377
+ canceled: "canceled";
378
+ queued: "queued";
379
+ running: "running";
380
+ succeeded: "succeeded";
381
+ }>;
382
+ resources: z.ZodArray<z.ZodObject<{
383
+ type: z.ZodString;
384
+ id: z.ZodString;
385
+ }, z.core.$strip>>;
386
+ progress: z.ZodOptional<z.ZodObject<{
387
+ total: z.ZodNumber;
388
+ completed: z.ZodNumber;
389
+ failed: z.ZodNumber;
390
+ }, z.core.$strip>>;
391
+ diagnostics: z.ZodOptional<z.ZodArray<z.ZodObject<{
392
+ code: z.ZodString;
393
+ severity: z.ZodEnum<{
394
+ info: "info";
395
+ error: "error";
396
+ warning: "warning";
397
+ }>;
398
+ message: z.ZodString;
399
+ path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
400
+ provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
401
+ registrar: "registrar";
402
+ wpcloud: "wpcloud";
403
+ dns: "dns";
404
+ runtime: "runtime";
405
+ }>>>;
406
+ details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
407
+ fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
408
+ retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
409
+ }, z.core.$strip>>>;
410
+ createdAt: z.ZodString;
411
+ finishedAt: z.ZodOptional<z.ZodString>;
412
+ }, z.core.$strip>>;
413
+ }, z.core.$strip>;
414
+ export declare const runtimeDbConsoleSchema: z.ZodObject<{
415
+ provider: z.ZodLiteral<"wpcloud-phpmyadmin">;
416
+ url: z.ZodString;
417
+ }, z.core.$strict>;
418
+ export type RuntimeDbConsole = z.infer<typeof runtimeDbConsoleSchema>;
419
+ export declare const runtimeDbConsoleResponseSchema: z.ZodObject<{
420
+ data: z.ZodObject<{
421
+ provider: z.ZodLiteral<"wpcloud-phpmyadmin">;
422
+ url: z.ZodString;
423
+ }, z.core.$strict>;
424
+ }, z.core.$strip>;
@@ -0,0 +1,108 @@
1
+ import { z } from "zod";
2
+ import { dataEnvelope, mutationEnvelope } from "./common.js";
3
+ import { executionIdentifierSchema, executionSha256Schema } from "./execution.js";
4
+ import { ZERO_RUNTIME_KIND, zeroMigrationOperationSchema, zeroTableSchema } from "./zero.js";
5
+ /**
6
+ * The database surface, for whichever runtime a space is carrying.
7
+ *
8
+ * There is one database per space — the site's own MySQL — and at most one
9
+ * runtime with a claim on it, so these contracts are runtime-neutral by
10
+ * default. The two exceptions are stated explicitly: a migration plan is a
11
+ * capsule's declaration and no worker has one, and the console hand-off is a
12
+ * property of the wp.cloud site rather than of anything a version declared.
13
+ *
14
+ * The reads answer in the capsule's declaration shapes (`zeroTableSchema`,
15
+ * `zeroMigrationOperationSchema`) because a capsule's declared schema is the
16
+ * richest answer either runtime can give and a worker's is the same answer with
17
+ * the declaration-shaped fields empty. Those shapes stay Zero-named and stay in
18
+ * `./zero.js`: a declared table is the capsule's own statement about itself.
19
+ */
20
+ export const runtimeDbInspectResponseSchema = z
21
+ .object({
22
+ versionId: z.string().min(1).nullable(),
23
+ artifactId: z.string().min(1).nullable(),
24
+ backend: z.literal("wpcloud-mysql").nullable(),
25
+ migrationMode: z.enum(["safe", "drop", "rename"]).nullable(),
26
+ schemaHash: executionSha256Schema.nullable(),
27
+ tables: z.array(zeroTableSchema).default([]),
28
+ migrations: z.array(zeroMigrationOperationSchema).default([]),
29
+ })
30
+ .strict();
31
+ export const runtimeDbInspectPublicResponseSchema = dataEnvelope(runtimeDbInspectResponseSchema);
32
+ export const runtimeDbDumpQuerySchema = z
33
+ .object({
34
+ table: executionIdentifierSchema.optional(),
35
+ limit: z.coerce.number().int().min(1).max(100).default(25),
36
+ })
37
+ .strict();
38
+ export const runtimeDbDumpTableSchema = z
39
+ .object({
40
+ name: executionIdentifierSchema,
41
+ rows: z.array(z.record(z.string(), z.unknown())).default([]),
42
+ })
43
+ .strict();
44
+ export const runtimeDbDumpResponseSchema = z
45
+ .object({
46
+ versionId: z.string().min(1).nullable(),
47
+ artifactId: z.string().min(1).nullable(),
48
+ schemaHash: executionSha256Schema.nullable(),
49
+ tables: z.array(runtimeDbDumpTableSchema).default([]),
50
+ })
51
+ .strict();
52
+ export const runtimeDbDumpPublicResponseSchema = dataEnvelope(runtimeDbDumpResponseSchema);
53
+ export const runtimeDbExportOrderingSchema = z
54
+ .object({
55
+ tables: z.literal("name_asc"),
56
+ rows: z.literal("created_at_id_asc"),
57
+ })
58
+ .strict();
59
+ export const runtimeDbExportMetadataSchema = z
60
+ .object({
61
+ spaceId: z.string().min(1).nullable(),
62
+ versionId: z.string().min(1).nullable(),
63
+ schemaHash: executionSha256Schema,
64
+ consistency: z.literal("per_page"),
65
+ ordering: runtimeDbExportOrderingSchema,
66
+ tables: z.array(executionIdentifierSchema),
67
+ })
68
+ .strict();
69
+ export const runtimeDbExportMetadataPublicResponseSchema = dataEnvelope(runtimeDbExportMetadataSchema);
70
+ export const runtimeDbExportPageQuerySchema = z
71
+ .object({
72
+ schemaHash: executionSha256Schema,
73
+ cursor: z.string().min(1).max(4_096).optional(),
74
+ limit: z.coerce.number().int().min(1).max(1_000).default(500),
75
+ })
76
+ .strict();
77
+ export const runtimeDbExportPageSchema = z
78
+ .object({
79
+ rows: z.array(z.record(z.string(), z.unknown())),
80
+ cursor: z.string().nullable(),
81
+ })
82
+ .strict();
83
+ export const runtimeDbExportPagePublicResponseSchema = dataEnvelope(runtimeDbExportPageSchema);
84
+ export const runtimeDbMigrateResultSchema = z
85
+ .object({
86
+ versionId: z.string().min(1).describe("Live version whose migration plan this is."),
87
+ runtimeKind: z.literal(ZERO_RUNTIME_KIND),
88
+ schemaHash: executionSha256Schema.nullable(),
89
+ mode: z.enum(["safe", "drop", "rename"]).nullable(),
90
+ operations: z
91
+ .array(zeroMigrationOperationSchema)
92
+ .describe("The plan the live capsule declared, in the order it applies."),
93
+ queued: z
94
+ .boolean()
95
+ .describe("Whether runtime finalize was queued to apply the plan. `false` when the plan is empty because there is nothing to run."),
96
+ })
97
+ .strict();
98
+ export const runtimeDbMigrateResponseSchema = mutationEnvelope(runtimeDbMigrateResultSchema);
99
+ export const runtimeDbConsoleSchema = z
100
+ .object({
101
+ provider: z.literal("wpcloud-phpmyadmin"),
102
+ url: z
103
+ .string()
104
+ .url()
105
+ .describe("Short-lived, single-use phpMyAdmin sign-in URL for the space MySQL. Treat it as a credential."),
106
+ })
107
+ .strict();
108
+ export const runtimeDbConsoleResponseSchema = dataEnvelope(runtimeDbConsoleSchema);
@@ -0,0 +1,120 @@
1
+ import { z } from "zod";
2
+ export declare const runtimeStorageVisibilitySchema: z.ZodEnum<{
3
+ public: "public";
4
+ private: "private";
5
+ }>;
6
+ export type RuntimeStorageVisibility = z.infer<typeof runtimeStorageVisibilitySchema>;
7
+ export declare const runtimeStorageObjectIdSchema: z.ZodString;
8
+ export declare const runtimeStorageObjectKeySchema: z.ZodString;
9
+ export declare const runtimeStorageListQuerySchema: z.ZodObject<{
10
+ cursor: z.ZodOptional<z.ZodString>;
11
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
12
+ visibility: z.ZodOptional<z.ZodEnum<{
13
+ public: "public";
14
+ private: "private";
15
+ }>>;
16
+ }, z.core.$strict>;
17
+ export declare const runtimeStorageObjectSchema: z.ZodObject<{
18
+ key: z.ZodString;
19
+ visibility: z.ZodEnum<{
20
+ public: "public";
21
+ private: "private";
22
+ }>;
23
+ contentType: z.ZodString;
24
+ createdAt: z.ZodString;
25
+ size: z.ZodNumber;
26
+ uploaderId: z.ZodString;
27
+ sha256: z.ZodString;
28
+ }, z.core.$strict>;
29
+ export type RuntimeStorageObject = z.infer<typeof runtimeStorageObjectSchema>;
30
+ export declare const runtimeStorageListResponseSchema: z.ZodObject<{
31
+ objects: z.ZodArray<z.ZodObject<{
32
+ key: z.ZodString;
33
+ visibility: z.ZodEnum<{
34
+ public: "public";
35
+ private: "private";
36
+ }>;
37
+ contentType: z.ZodString;
38
+ createdAt: z.ZodString;
39
+ size: z.ZodNumber;
40
+ uploaderId: z.ZodString;
41
+ sha256: z.ZodString;
42
+ }, z.core.$strict>>;
43
+ cursor: z.ZodNullable<z.ZodString>;
44
+ hasMore: z.ZodBoolean;
45
+ usedBytes: z.ZodNumber;
46
+ quotaBytes: z.ZodNumber;
47
+ }, z.core.$strict>;
48
+ export type RuntimeStorageListResponse = z.infer<typeof runtimeStorageListResponseSchema>;
49
+ export declare const runtimeStorageListPublicResponseSchema: z.ZodObject<{
50
+ data: z.ZodObject<{
51
+ objects: z.ZodArray<z.ZodObject<{
52
+ key: z.ZodString;
53
+ visibility: z.ZodEnum<{
54
+ public: "public";
55
+ private: "private";
56
+ }>;
57
+ contentType: z.ZodString;
58
+ createdAt: z.ZodString;
59
+ size: z.ZodNumber;
60
+ uploaderId: z.ZodString;
61
+ sha256: z.ZodString;
62
+ }, z.core.$strict>>;
63
+ cursor: z.ZodNullable<z.ZodString>;
64
+ hasMore: z.ZodBoolean;
65
+ usedBytes: z.ZodNumber;
66
+ quotaBytes: z.ZodNumber;
67
+ }, z.core.$strict>;
68
+ }, z.core.$strip>;
69
+ export declare const runtimeStorageDeleteResponseSchema: z.ZodObject<{
70
+ key: z.ZodString;
71
+ deleted: z.ZodBoolean;
72
+ }, z.core.$strict>;
73
+ export type RuntimeStorageDeleteResponse = z.infer<typeof runtimeStorageDeleteResponseSchema>;
74
+ export declare const runtimeStorageDeletePublicResponseSchema: z.ZodObject<{
75
+ data: z.ZodObject<{
76
+ key: z.ZodString;
77
+ deleted: z.ZodBoolean;
78
+ }, z.core.$strict>;
79
+ operation: z.ZodNullable<z.ZodObject<{
80
+ id: z.ZodString;
81
+ kind: z.ZodString;
82
+ status: z.ZodEnum<{
83
+ failed: "failed";
84
+ canceled: "canceled";
85
+ queued: "queued";
86
+ running: "running";
87
+ succeeded: "succeeded";
88
+ }>;
89
+ resources: z.ZodArray<z.ZodObject<{
90
+ type: z.ZodString;
91
+ id: z.ZodString;
92
+ }, z.core.$strip>>;
93
+ progress: z.ZodOptional<z.ZodObject<{
94
+ total: z.ZodNumber;
95
+ completed: z.ZodNumber;
96
+ failed: z.ZodNumber;
97
+ }, z.core.$strip>>;
98
+ diagnostics: z.ZodOptional<z.ZodArray<z.ZodObject<{
99
+ code: z.ZodString;
100
+ severity: z.ZodEnum<{
101
+ info: "info";
102
+ error: "error";
103
+ warning: "warning";
104
+ }>;
105
+ message: z.ZodString;
106
+ path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
107
+ provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
108
+ registrar: "registrar";
109
+ wpcloud: "wpcloud";
110
+ dns: "dns";
111
+ runtime: "runtime";
112
+ }>>>;
113
+ details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
114
+ fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
115
+ retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
116
+ }, z.core.$strip>>>;
117
+ createdAt: z.ZodString;
118
+ finishedAt: z.ZodOptional<z.ZodString>;
119
+ }, z.core.$strip>>;
120
+ }, z.core.$strip>;
@@ -0,0 +1,40 @@
1
+ import { z } from "zod";
2
+ import { dataEnvelope, mutationEnvelope } from "./common.js";
3
+ export const runtimeStorageVisibilitySchema = z.enum(["public", "private"]);
4
+ export const runtimeStorageObjectIdSchema = z.string().regex(/^[a-f0-9]{32}$/);
5
+ export const runtimeStorageObjectKeySchema = z.string().regex(/^(public|private)\/[a-f0-9]{32}$/);
6
+ export const runtimeStorageListQuerySchema = z
7
+ .object({
8
+ cursor: z.string().min(1).max(2_048).optional(),
9
+ limit: z.coerce.number().int().min(1).max(100).default(50),
10
+ visibility: runtimeStorageVisibilitySchema.optional(),
11
+ })
12
+ .strict();
13
+ export const runtimeStorageObjectSchema = z
14
+ .object({
15
+ key: runtimeStorageObjectKeySchema,
16
+ visibility: runtimeStorageVisibilitySchema,
17
+ contentType: z.string().min(1).max(255),
18
+ createdAt: z.string().datetime(),
19
+ size: z.number().int().nonnegative(),
20
+ uploaderId: z.string().min(1).max(255),
21
+ sha256: z.string().regex(/^[a-f0-9]{64}$/),
22
+ })
23
+ .strict();
24
+ export const runtimeStorageListResponseSchema = z
25
+ .object({
26
+ objects: z.array(runtimeStorageObjectSchema),
27
+ cursor: z.string().nullable(),
28
+ hasMore: z.boolean(),
29
+ usedBytes: z.number().int().nonnegative(),
30
+ quotaBytes: z.number().int().positive(),
31
+ })
32
+ .strict();
33
+ export const runtimeStorageListPublicResponseSchema = dataEnvelope(runtimeStorageListResponseSchema);
34
+ export const runtimeStorageDeleteResponseSchema = z
35
+ .object({
36
+ key: runtimeStorageObjectKeySchema,
37
+ deleted: z.boolean(),
38
+ })
39
+ .strict();
40
+ export const runtimeStorageDeletePublicResponseSchema = mutationEnvelope(runtimeStorageDeleteResponseSchema);