@spacefast/common 0.0.23 → 0.0.26

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 (224) hide show
  1. package/brand-assets/LICENSE-Haskoy.txt +93 -0
  2. package/brand-assets/haskoy-latin-variable.woff2 +0 -0
  3. package/brand-assets/spacefast-favicon.svg +4 -4
  4. package/brand-assets/spacefast-sf-full-bleed.svg +3 -3
  5. package/brand-assets/spacefast-wordmark.svg +2 -4
  6. package/dist/agents/connect-targets.js +1 -1
  7. package/dist/agents/private-key-oauth.d.ts +0 -1
  8. package/dist/agents/private-key-oauth.js +46 -63
  9. package/dist/brand-assets-build.js +4 -6
  10. package/dist/brand-assets.d.ts +5 -15
  11. package/dist/brand-assets.js +15 -14
  12. package/dist/config/domains.d.ts +47 -7
  13. package/dist/config/domains.js +66 -10
  14. package/dist/config/index.d.ts +0 -1
  15. package/dist/config/index.js +0 -1
  16. package/dist/contracts/abuse.d.ts +2 -0
  17. package/dist/contracts/abuse.js +12 -0
  18. package/dist/contracts/access.d.ts +124 -12
  19. package/dist/contracts/access.js +73 -9
  20. package/dist/contracts/activity.d.ts +1 -1
  21. package/dist/contracts/activity.js +5 -12
  22. package/dist/contracts/api-keys.d.ts +21 -21
  23. package/dist/contracts/api-keys.js +2 -2
  24. package/dist/contracts/beta.js +1 -1
  25. package/dist/contracts/billing.d.ts +3 -35
  26. package/dist/contracts/billing.js +33 -52
  27. package/dist/contracts/builds.d.ts +30 -18
  28. package/dist/contracts/builds.js +28 -9
  29. package/dist/contracts/channels.js +1 -1
  30. package/dist/contracts/cli.d.ts +10 -0
  31. package/dist/contracts/cli.js +10 -0
  32. package/dist/contracts/collab-public.d.ts +63 -0
  33. package/dist/contracts/collab-public.js +46 -0
  34. package/dist/contracts/comments.d.ts +282 -53
  35. package/dist/contracts/comments.js +173 -52
  36. package/dist/contracts/common.d.ts +3 -3
  37. package/dist/contracts/common.js +5 -5
  38. package/dist/contracts/crons.d.ts +35 -0
  39. package/dist/contracts/crons.js +42 -0
  40. package/dist/contracts/device-auth.d.ts +6 -6
  41. package/dist/contracts/device-auth.js +2 -2
  42. package/dist/contracts/docs.js +2 -2
  43. package/dist/contracts/domains.d.ts +38 -27
  44. package/dist/contracts/domains.js +29 -2
  45. package/dist/contracts/enums.d.ts +34 -30
  46. package/dist/contracts/enums.js +62 -48
  47. package/dist/contracts/error-code-meta.d.ts +50 -125
  48. package/dist/contracts/error-code-meta.js +29 -41
  49. package/dist/contracts/error-codes.d.ts +1 -1
  50. package/dist/contracts/error-codes.js +14 -33
  51. package/dist/contracts/execution.d.ts +47 -66
  52. package/dist/contracts/execution.js +53 -49
  53. package/dist/contracts/feature-lifecycle-core.d.ts +0 -6
  54. package/dist/contracts/feature-lifecycle-core.js +2 -31
  55. package/dist/contracts/feature-lifecycle.d.ts +12 -52
  56. package/dist/contracts/feature-lifecycle.js +16 -59
  57. package/dist/contracts/features.d.ts +48 -60
  58. package/dist/contracts/features.js +59 -51
  59. package/dist/contracts/functions.d.ts +266 -72
  60. package/dist/contracts/functions.js +260 -37
  61. package/dist/contracts/git.d.ts +28 -34
  62. package/dist/contracts/git.js +10 -11
  63. package/dist/contracts/grants.d.ts +9 -5
  64. package/dist/contracts/grants.js +18 -9
  65. package/dist/contracts/ids.js +2 -2
  66. package/dist/contracts/internal.d.ts +8 -6
  67. package/dist/contracts/internal.js +12 -12
  68. package/dist/contracts/mcp.d.ts +11 -0
  69. package/dist/contracts/mcp.js +5 -0
  70. package/dist/contracts/me.js +1 -1
  71. package/dist/contracts/oauth-resources.d.ts +4 -3
  72. package/dist/contracts/oauth-resources.js +12 -3
  73. package/dist/contracts/operations.d.ts +90 -5
  74. package/dist/contracts/operations.js +77 -3
  75. package/dist/contracts/pages.d.ts +12 -7
  76. package/dist/contracts/pages.js +24 -1
  77. package/dist/contracts/plan-policy.d.ts +0 -2
  78. package/dist/contracts/plan-policy.js +2 -3
  79. package/dist/contracts/platform.d.ts +61 -148
  80. package/dist/contracts/platform.js +70 -126
  81. package/dist/contracts/publish-archive.d.ts +508 -0
  82. package/dist/contracts/publish-archive.js +32 -0
  83. package/dist/contracts/push-new.d.ts +4 -4
  84. package/dist/contracts/quotas.js +2 -2
  85. package/dist/contracts/repository-connections.d.ts +43 -30
  86. package/dist/contracts/repository-connections.js +11 -3
  87. package/dist/contracts/resources.d.ts +12 -24
  88. package/dist/contracts/resources.js +36 -16
  89. package/dist/contracts/runtime-api.d.ts +433 -192
  90. package/dist/contracts/runtime-api.js +421 -356
  91. package/dist/contracts/runtime-app.d.ts +127 -120
  92. package/dist/contracts/runtime-app.js +19 -10
  93. package/dist/contracts/runtime-db.d.ts +5 -5
  94. package/dist/contracts/runtime-db.js +2 -2
  95. package/dist/contracts/runtime-purge.d.ts +8 -0
  96. package/dist/contracts/runtime-purge.js +7 -0
  97. package/dist/contracts/runtime-services.d.ts +219 -0
  98. package/dist/contracts/runtime-services.js +437 -0
  99. package/dist/contracts/runtime-storage.d.ts +46 -32
  100. package/dist/contracts/runtime-storage.js +31 -8
  101. package/dist/contracts/sf-config-v1.d.ts +48 -10
  102. package/dist/contracts/space-config.d.ts +69 -18
  103. package/dist/contracts/space-config.js +226 -27
  104. package/dist/contracts/spaces.d.ts +236 -450
  105. package/dist/contracts/spaces.js +131 -151
  106. package/dist/contracts/superadmin-activity.d.ts +57 -4
  107. package/dist/contracts/superadmin-activity.js +48 -2
  108. package/dist/contracts/superadmin-search.d.ts +126 -0
  109. package/dist/contracts/superadmin-search.js +61 -0
  110. package/dist/contracts/superadmin-spaces.d.ts +361 -92
  111. package/dist/contracts/superadmin-spaces.js +97 -24
  112. package/dist/contracts/superadmin-teams.d.ts +28 -10
  113. package/dist/contracts/superadmin-teams.js +5 -8
  114. package/dist/contracts/superadmin-tenants.d.ts +0 -6
  115. package/dist/contracts/superadmin-tenants.js +1 -7
  116. package/dist/contracts/superadmin.d.ts +135 -54
  117. package/dist/contracts/superadmin.js +46 -23
  118. package/dist/contracts/tags.d.ts +12 -12
  119. package/dist/contracts/tags.js +3 -3
  120. package/dist/contracts/teams.d.ts +49 -14
  121. package/dist/contracts/teams.js +40 -22
  122. package/dist/contracts/transfers.d.ts +0 -49
  123. package/dist/contracts/transfers.js +4 -8
  124. package/dist/contracts/usage.d.ts +61 -0
  125. package/dist/contracts/usage.js +64 -0
  126. package/dist/contracts/variables.d.ts +2 -7
  127. package/dist/contracts/variables.js +9 -8
  128. package/dist/contracts/webhooks.d.ts +2 -2
  129. package/dist/contracts/zero.d.ts +102 -73
  130. package/dist/contracts/zero.js +94 -32
  131. package/dist/dashboard-paths/index.d.ts +1 -1
  132. package/dist/dashboard-paths/index.js +1 -0
  133. package/dist/docs/agent-prose.d.ts +2 -2
  134. package/dist/docs/agent-prose.js +63 -70
  135. package/dist/docs/agent-setup.js +45 -15
  136. package/dist/docs/catalog.d.ts +24 -24
  137. package/dist/docs/catalog.js +35 -24
  138. package/dist/docs/error-docs.js +194 -270
  139. package/dist/docs/skills.d.ts +12 -12
  140. package/dist/docs/skills.js +4 -4
  141. package/dist/test-helpers/fetch-stub.d.ts +16 -0
  142. package/dist/test-helpers/fetch-stub.js +25 -0
  143. package/dist/utils/build-settings.d.ts +5 -1
  144. package/dist/utils/build-settings.js +91 -13
  145. package/dist/utils/canonical-json.d.ts +10 -0
  146. package/dist/utils/canonical-json.js +22 -0
  147. package/dist/utils/cast-transport.d.ts +28 -0
  148. package/dist/utils/cast-transport.js +52 -0
  149. package/dist/utils/claim-token.d.ts +0 -8
  150. package/dist/utils/claim-token.js +3 -15
  151. package/dist/utils/concurrency.js +1 -0
  152. package/dist/utils/credential-policy.d.ts +1 -1
  153. package/dist/utils/credential-policy.js +4 -3
  154. package/dist/utils/dns-instructions.js +9 -9
  155. package/dist/utils/env-file.d.ts +17 -0
  156. package/dist/utils/env-file.js +96 -0
  157. package/dist/utils/error-code.d.ts +2 -0
  158. package/dist/utils/error-code.js +8 -0
  159. package/dist/utils/generate-space-name.d.ts +8 -10
  160. package/dist/utils/generate-space-name.js +206 -21
  161. package/dist/utils/grant-decision.fixtures.json +2938 -0
  162. package/dist/utils/grants.d.ts +2 -0
  163. package/dist/utils/grants.js +26 -1
  164. package/dist/utils/gravatar.d.ts +9 -0
  165. package/dist/utils/gravatar.js +31 -0
  166. package/dist/utils/idempotency.d.ts +6 -0
  167. package/dist/utils/idempotency.js +28 -0
  168. package/dist/utils/local-space-state.d.ts +9 -16
  169. package/dist/utils/local-space-state.js +20 -50
  170. package/dist/utils/one-shot-replay.d.ts +4 -1
  171. package/dist/utils/page-colors.d.ts +14 -12
  172. package/dist/utils/page-colors.js +15 -13
  173. package/dist/utils/page-fonts.d.ts +2 -2
  174. package/dist/utils/page-fonts.js +15 -4
  175. package/dist/utils/pages.d.ts +21 -3
  176. package/dist/utils/pages.js +42 -13
  177. package/dist/utils/publish-form-data.d.ts +12 -0
  178. package/dist/utils/publish-form-data.js +10 -0
  179. package/dist/utils/publish-policy.d.ts +27 -0
  180. package/dist/utils/publish-policy.fixtures.json +403 -0
  181. package/dist/utils/publish-policy.js +45 -20
  182. package/dist/utils/push-new.d.ts +7 -0
  183. package/dist/utils/push-new.js +7 -0
  184. package/dist/utils/query-keys.d.ts +4 -5
  185. package/dist/utils/query-keys.js +2 -3
  186. package/dist/utils/runtime-paths.d.ts +5 -0
  187. package/dist/utils/runtime-paths.js +5 -0
  188. package/dist/utils/runtime-upload-batch.d.ts +0 -5
  189. package/dist/utils/runtime-upload-batch.js +1 -27
  190. package/dist/utils/runtime-upload.d.ts +6 -11
  191. package/dist/utils/runtime-upload.js +10 -13
  192. package/dist/utils/secure-local-file.js +5 -16
  193. package/dist/utils/space-config.d.ts +1 -34
  194. package/dist/utils/space-config.js +8 -326
  195. package/dist/utils/static-runtime-policy.d.ts +9 -3
  196. package/dist/utils/static-runtime-policy.fixtures.json +38 -41
  197. package/dist/utils/static-runtime-policy.js +22 -56
  198. package/dist/utils/storage-policy.d.ts +1 -1
  199. package/dist/utils/storage-policy.js +3 -1
  200. package/dist/utils/structured-error.d.ts +14 -0
  201. package/dist/utils/structured-error.js +22 -0
  202. package/dist/utils/upload-session.d.ts +4 -1
  203. package/dist/utils/upload-session.js +33 -5
  204. package/dist/utils/version-path.js +13 -4
  205. package/dist/vocabulary.d.ts +13 -11
  206. package/dist/vocabulary.js +42 -28
  207. package/package.json +7 -17
  208. package/dist/config/postgres-budget.d.ts +0 -129
  209. package/dist/config/postgres-budget.js +0 -140
  210. package/dist/config/postgres-budget.json +0 -51
  211. package/dist/contracts/archives.d.ts +0 -331
  212. package/dist/contracts/archives.js +0 -120
  213. package/dist/contracts/deployments.d.ts +0 -574
  214. package/dist/contracts/deployments.js +0 -97
  215. package/dist/contracts/sites.d.ts +0 -416
  216. package/dist/contracts/sites.js +0 -168
  217. package/dist/contracts/superadmin-queues.d.ts +0 -414
  218. package/dist/contracts/superadmin-queues.js +0 -202
  219. package/dist/contracts/superadmin-runtime.d.ts +0 -27
  220. package/dist/contracts/superadmin-runtime.js +0 -38
  221. package/dist/index.d.ts +0 -1
  222. package/dist/index.js +0 -1
  223. package/dist/utils/api.d.ts +0 -4
  224. package/dist/utils/api.js +0 -13
@@ -29,12 +29,19 @@ export declare const accessLogEntrySchema: z.ZodObject<{
29
29
  bytes: z.ZodNumber;
30
30
  }, z.core.$strip>;
31
31
  /**
32
- * One line a space's own code wrote, from whichever execution tier serves it.
32
+ * One line a space's own code wrote, whichever tier wrote it.
33
33
  *
34
- * This is `executionLogEntrySchema` verbatim rather than a platform-shaped
35
- * restatement of it: both tiers already emit that shape, and re-declaring it
36
- * here would be a second definition to keep in sync with the runtimes that
37
- * produce the records.
34
+ * There is exactly one place these come from: the hosting provider's PHP error
35
+ * log for the space's site. A Zero mutation, a PHP function, and a Functions
36
+ * worker on Cloudflare all end up writing to that file on the origin — the
37
+ * worker by tailing its output back to the origin that dispatched it — because
38
+ * it is the only stream the provider ships off the box and serves back. The
39
+ * runtime writes each record as one JSON line behind a marker; this is what the
40
+ * reader gets after pulling that line back out of the provider's message.
41
+ *
42
+ * `id` is minted by the runtime at write time rather than derived on read: the
43
+ * provider's log has no identity of its own, and a caller paging a window needs
44
+ * a stable key for a line it may see again at a page boundary.
38
45
  *
39
46
  * Unlike its access-log sibling there is no `ts` alongside `timestamp`. That
40
47
  * duplication is a compatibility alias the access log carries for callers that
@@ -58,17 +65,18 @@ export declare const runtimeLogEntrySchema: z.ZodObject<{
58
65
  }, z.core.$strict>;
59
66
  export type RuntimeLogEntry = z.infer<typeof runtimeLogEntrySchema>;
60
67
  /**
61
- * Handler logs are filtered, not windowed.
62
- *
63
- * The access log takes `since`/`until` because the provider indexes by time.
64
- * Neither execution tier does: Zero pages a local append-only store by cursor,
65
- * and the origin walks day files backwards from newest. Accepting a `since`
66
- * here would mean ignoring it, so it is absent — the filters below are the ones
67
- * both tiers actually honour.
68
+ * Windowed like its access-log sibling, because it reads the same provider
69
+ * index — `atomic_site_id` plus a `@timestamp` range — and that index has no
70
+ * other way in. The two log kinds sit side by side under one command, so they
71
+ * take one query shape; `requestId` and `handlerName` are the extra narrowings
72
+ * only handler output can answer, and they are applied over the pages the
73
+ * server fetched rather than by the provider, which indexes neither.
68
74
  */
69
75
  export declare const runtimeLogListQuerySchema: z.ZodObject<{
70
76
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
71
77
  cursor: z.ZodOptional<z.ZodString>;
78
+ since: z.ZodOptional<z.ZodString>;
79
+ until: z.ZodOptional<z.ZodString>;
72
80
  requestId: z.ZodOptional<z.ZodString>;
73
81
  handlerName: z.ZodOptional<z.ZodString>;
74
82
  }, z.core.$strip>;
@@ -99,7 +107,7 @@ export declare const accessLogListResponseSchema: z.ZodObject<{
99
107
  path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
100
108
  provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
101
109
  registrar: "registrar";
102
- wpcloud: "wpcloud";
110
+ infra: "infra";
103
111
  dns: "dns";
104
112
  runtime: "runtime";
105
113
  }>>>;
@@ -111,26 +119,26 @@ export declare const accessLogListResponseSchema: z.ZodObject<{
111
119
  /**
112
120
  * Paged handler logs.
113
121
  *
114
- * The pagination block is deliberately the same `CursorPaginationSchema` the
115
- * access log uses — the two kinds sit side by side under one command, and a
116
- * caller should not have to learn a second paging idiom to read the other half
117
- * of its own space.
118
- *
119
122
  * One thing about that cursor is worth stating rather than discovering: **an
120
- * empty page does not mean the end.** `hasMore` is true whenever the server
121
- * stopped before reaching the oldest retained line, and the origin reader stops
122
- * on its own per-page bounds day count, line count, bytes scanned — which it
123
- * can hit while a `requestId` or `handlerName` filter matched nothing in the
124
- * stretch it read. Both tiers satisfy the same rule: **`hasMore: false` means
125
- * you have seen everything; `hasMore: true` means keep paging, whatever `data`
126
- * held.** A client that stops on the first empty page will silently truncate a
127
- * filtered search.
123
+ * empty page does not mean the end.** The cursor walks the provider's scroll
124
+ * over every PHP-error-log line in the window, and only some of those lines are
125
+ * handler output a page can come back empty because the stretch it scanned
126
+ * held none, or held none matching `requestId`/`handlerName`. The rule is
127
+ * **`hasMore: false` means you have seen everything; `hasMore: true` means keep
128
+ * paging, whatever `data` held.** A client that stops on the first empty page
129
+ * will silently truncate its own search.
128
130
  *
129
- * No `warnings` array, unlike the access log. Its one diagnostic is
130
- * `log_retention_clamped`, which reports a requested window being cut back to
131
- * the plan's retention — and there is no window to clamp here. An empty
132
- * diagnostics channel would be a field every caller must handle and no server
133
- * ever fills.
131
+ * `warnings` carries the same `log_retention_clamped` diagnostic the access log
132
+ * does, for the same reason: one window, one retention, one way of saying it
133
+ * was cut back.
134
+ *
135
+ * **These lines lag.** A record is written to a file on the origin, shipped off
136
+ * the box, and indexed before it can be read back, so a line a request just
137
+ * wrote will not be in the next page. Nothing here is live, and the delay is
138
+ * the provider's ingest lag rather than anything this surface schedules — it
139
+ * has not been measured against a real client yet, so no surface should quote
140
+ * a figure for it until the gate probe in
141
+ * `e2e-tests/direct/wpcloud-behavior.test.ts` has actually run.
134
142
  */
135
143
  export declare const runtimeLogListResponseSchema: z.ZodObject<{
136
144
  data: z.ZodArray<z.ZodObject<{
@@ -152,22 +160,37 @@ export declare const runtimeLogListResponseSchema: z.ZodObject<{
152
160
  nextCursor: z.ZodNullable<z.ZodString>;
153
161
  hasMore: z.ZodBoolean;
154
162
  }, z.core.$strip>;
163
+ warnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
164
+ code: z.ZodString;
165
+ severity: z.ZodEnum<{
166
+ info: "info";
167
+ error: "error";
168
+ warning: "warning";
169
+ }>;
170
+ message: z.ZodString;
171
+ path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
172
+ provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
173
+ registrar: "registrar";
174
+ infra: "infra";
175
+ dns: "dns";
176
+ runtime: "runtime";
177
+ }>>>;
178
+ details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
179
+ fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
180
+ retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
181
+ }, z.core.$strip>>>;
155
182
  }, z.core.$strip>;
156
183
  export type RuntimeLogListResponse = z.infer<typeof runtimeLogListResponseSchema>;
157
184
  export declare const analyticsQuerySchema: z.ZodObject<{
158
185
  window: z.ZodOptional<z.ZodEnum<{
159
- custom: "custom";
160
186
  "48h": "48h";
161
187
  "7d": "7d";
162
188
  "30d": "30d";
163
189
  }>>;
164
- since: z.ZodOptional<z.ZodString>;
165
- until: z.ZodOptional<z.ZodString>;
166
190
  }, z.core.$strip>;
167
191
  export declare const analyticsResponseSchema: z.ZodObject<{
168
192
  spaceId: z.ZodString;
169
193
  window: z.ZodEnum<{
170
- custom: "custom";
171
194
  "48h": "48h";
172
195
  "7d": "7d";
173
196
  "30d": "30d";
@@ -178,18 +201,11 @@ export declare const analyticsResponseSchema: z.ZodObject<{
178
201
  hourly: "hourly";
179
202
  daily: "daily";
180
203
  }>;
181
- dataAsOf: z.ZodNullable<z.ZodString>;
182
- refreshing: z.ZodBoolean;
183
204
  views: z.ZodNumber;
184
- visitors: z.ZodNullable<z.ZodNumber>;
185
205
  bandwidthBytes: z.ZodNumber;
186
- visitorsByHost: z.ZodArray<z.ZodObject<{
187
- host: z.ZodString;
188
- series: z.ZodArray<z.ZodObject<{
189
- date: z.ZodString;
190
- visitors: z.ZodNumber;
191
- views: z.ZodNumber;
192
- }, z.core.$strip>>;
206
+ visitorsByDay: z.ZodArray<z.ZodObject<{
207
+ date: z.ZodString;
208
+ visitors: z.ZodNumber;
193
209
  }, z.core.$strip>>;
194
210
  topPaths: z.ZodArray<z.ZodObject<{
195
211
  path: z.ZodString;
@@ -205,107 +221,4 @@ export declare const analyticsResponseSchema: z.ZodObject<{
205
221
  views: z.ZodNumber;
206
222
  bandwidthBytes: z.ZodNumber;
207
223
  }, z.core.$strip>>;
208
- warnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
209
- code: z.ZodString;
210
- severity: z.ZodEnum<{
211
- info: "info";
212
- error: "error";
213
- warning: "warning";
214
- }>;
215
- message: z.ZodString;
216
- path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
217
- provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
218
- registrar: "registrar";
219
- wpcloud: "wpcloud";
220
- dns: "dns";
221
- runtime: "runtime";
222
- }>>>;
223
- details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
224
- fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
225
- retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
226
- }, z.core.$strip>>>;
227
- }, z.core.$strip>;
228
- export declare const runtimeCertificateSchema: z.ZodObject<{
229
- id: z.ZodNullable<z.ZodNumber>;
230
- status: z.ZodNullable<z.ZodString>;
231
- domains: z.ZodArray<z.ZodString>;
232
- expiration: z.ZodNullable<z.ZodString>;
233
- raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
234
- }, z.core.$strip>;
235
- export declare const runtimeCertificatesSchema: z.ZodObject<{
236
- data: z.ZodArray<z.ZodObject<{
237
- id: z.ZodNullable<z.ZodNumber>;
238
- status: z.ZodNullable<z.ZodString>;
239
- domains: z.ZodArray<z.ZodString>;
240
- expiration: z.ZodNullable<z.ZodString>;
241
- raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
242
- }, z.core.$strip>>;
243
- pagination: z.ZodObject<{
244
- nextCursor: z.ZodNullable<z.ZodString>;
245
- hasMore: z.ZodBoolean;
246
- }, z.core.$strip>;
247
- }, z.core.$strip>;
248
- export declare const runtimeCertificateStageSchema: z.ZodObject<{
249
- domains: z.ZodOptional<z.ZodArray<z.ZodString>>;
250
- certificate: z.ZodString;
251
- privateKey: z.ZodString;
252
- csr: z.ZodOptional<z.ZodString>;
253
- trustedCertificates: z.ZodOptional<z.ZodString>;
254
- clientCertificate: z.ZodOptional<z.ZodString>;
255
- }, z.core.$strip>;
256
- export declare const runtimeCertificateUpdateSchema: z.ZodObject<{
257
- certificate: z.ZodString;
258
- privateKey: z.ZodString;
259
- csr: z.ZodOptional<z.ZodString>;
260
- trustedCertificates: z.ZodOptional<z.ZodString>;
261
- clientCertificate: z.ZodOptional<z.ZodString>;
262
- domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
263
- }, z.core.$strip>;
264
- export declare const runtimeCertificateValidateSchema: z.ZodObject<{
265
- domains: z.ZodOptional<z.ZodArray<z.ZodString>>;
266
- certificate: z.ZodString;
267
- privateKey: z.ZodString;
268
- csr: z.ZodOptional<z.ZodString>;
269
- trustedCertificates: z.ZodOptional<z.ZodString>;
270
- clientCertificate: z.ZodOptional<z.ZodString>;
271
- }, z.core.$strip>;
272
- export declare const runtimeCertificateMutationResponseSchema: z.ZodObject<{
273
- certificate: z.ZodNullable<z.ZodObject<{
274
- id: z.ZodNullable<z.ZodNumber>;
275
- status: z.ZodNullable<z.ZodString>;
276
- domains: z.ZodArray<z.ZodString>;
277
- expiration: z.ZodNullable<z.ZodString>;
278
- raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
279
- }, z.core.$strip>>;
280
- raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
281
- }, z.core.$strip>;
282
- export declare const runtimeCertificateValidationResponseSchema: z.ZodObject<{
283
- valid: z.ZodBoolean;
284
- errors: z.ZodArray<z.ZodString>;
285
- warnings: z.ZodArray<z.ZodString>;
286
- validations: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
287
- }, z.core.$strip>;
288
- export declare const runtimeCertificateActivateSchema: z.ZodObject<{
289
- domains: z.ZodOptional<z.ZodArray<z.ZodString>>;
290
- }, z.core.$strip>;
291
- export declare const runtimeCertificateActionResponseSchema: z.ZodObject<{
292
- ok: z.ZodLiteral<true>;
293
- certificateId: z.ZodNumber;
294
- raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
295
- }, z.core.$strip>;
296
- export declare const runtimeSslInfoSchema: z.ZodObject<{
297
- domain: z.ZodString;
298
- raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
299
- }, z.core.$strip>;
300
- export declare const runtimeSslDomainSchema: z.ZodObject<{
301
- domain: z.ZodString;
302
- }, z.core.$strip>;
303
- export declare const runtimeSslToggleSchema: z.ZodObject<{
304
- domain: z.ZodString;
305
- enabled: z.ZodBoolean;
306
- }, z.core.$strip>;
307
- export declare const runtimeSslActionResponseSchema: z.ZodObject<{
308
- ok: z.ZodLiteral<true>;
309
- domain: z.ZodString;
310
- raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
311
224
  }, z.core.$strip>;
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import { CursorPaginationSchema, baseDiagnosticSchema, cursorListQuerySchema } from "./common.js";
3
- import { executionLogEntrySchema } from "./execution.js";
4
3
  export const domainPurchaseContactSchema = z.object({
5
4
  firstName: z.string().trim().min(1).max(80),
6
5
  lastName: z.string().trim().min(1).max(80),
@@ -29,29 +28,47 @@ export const accessLogEntrySchema = z.object({
29
28
  bytes: z.number().int().nonnegative(),
30
29
  });
31
30
  /**
32
- * One line a space's own code wrote, from whichever execution tier serves it.
31
+ * One line a space's own code wrote, whichever tier wrote it.
33
32
  *
34
- * This is `executionLogEntrySchema` verbatim rather than a platform-shaped
35
- * restatement of it: both tiers already emit that shape, and re-declaring it
36
- * here would be a second definition to keep in sync with the runtimes that
37
- * produce the records.
33
+ * There is exactly one place these come from: the hosting provider's PHP error
34
+ * log for the space's site. A Zero mutation, a PHP function, and a Functions
35
+ * worker on Cloudflare all end up writing to that file on the origin — the
36
+ * worker by tailing its output back to the origin that dispatched it — because
37
+ * it is the only stream the provider ships off the box and serves back. The
38
+ * runtime writes each record as one JSON line behind a marker; this is what the
39
+ * reader gets after pulling that line back out of the provider's message.
40
+ *
41
+ * `id` is minted by the runtime at write time rather than derived on read: the
42
+ * provider's log has no identity of its own, and a caller paging a window needs
43
+ * a stable key for a line it may see again at a page boundary.
38
44
  *
39
45
  * Unlike its access-log sibling there is no `ts` alongside `timestamp`. That
40
46
  * duplication is a compatibility alias the access log carries for callers that
41
47
  * predate the rename; runtime logs have never been served to anyone, so there
42
48
  * is no caller to keep and no reason to inherit the wart.
43
49
  */
44
- export const runtimeLogEntrySchema = executionLogEntrySchema;
50
+ export const runtimeLogEntrySchema = z
51
+ .object({
52
+ id: z.string().min(1),
53
+ timestamp: z.string().datetime(),
54
+ level: z.enum(["debug", "info", "warn", "error"]),
55
+ requestId: z.string().min(1).nullable(),
56
+ versionId: z.string().min(1).nullable(),
57
+ /** Zero names the mutation; Functions names the handler. */
58
+ handlerName: z.string().min(1).nullable(),
59
+ message: z.string(),
60
+ metadata: z.record(z.string(), z.unknown()).default({}),
61
+ })
62
+ .strict();
45
63
  /**
46
- * Handler logs are filtered, not windowed.
47
- *
48
- * The access log takes `since`/`until` because the provider indexes by time.
49
- * Neither execution tier does: Zero pages a local append-only store by cursor,
50
- * and the origin walks day files backwards from newest. Accepting a `since`
51
- * here would mean ignoring it, so it is absent — the filters below are the ones
52
- * both tiers actually honour.
64
+ * Windowed like its access-log sibling, because it reads the same provider
65
+ * index — `atomic_site_id` plus a `@timestamp` range — and that index has no
66
+ * other way in. The two log kinds sit side by side under one command, so they
67
+ * take one query shape; `requestId` and `handlerName` are the extra narrowings
68
+ * only handler output can answer, and they are applied over the pages the
69
+ * server fetched rather than by the provider, which indexes neither.
53
70
  */
54
- export const runtimeLogListQuerySchema = cursorListQuerySchema.extend({
71
+ export const runtimeLogListQuerySchema = logWindowQuerySchema.extend({
55
72
  requestId: z
56
73
  .string()
57
74
  .min(1)
@@ -74,75 +91,63 @@ export const accessLogListResponseSchema = z.object({
74
91
  /**
75
92
  * Paged handler logs.
76
93
  *
77
- * The pagination block is deliberately the same `CursorPaginationSchema` the
78
- * access log uses — the two kinds sit side by side under one command, and a
79
- * caller should not have to learn a second paging idiom to read the other half
80
- * of its own space.
81
- *
82
94
  * One thing about that cursor is worth stating rather than discovering: **an
83
- * empty page does not mean the end.** `hasMore` is true whenever the server
84
- * stopped before reaching the oldest retained line, and the origin reader stops
85
- * on its own per-page bounds day count, line count, bytes scanned — which it
86
- * can hit while a `requestId` or `handlerName` filter matched nothing in the
87
- * stretch it read. Both tiers satisfy the same rule: **`hasMore: false` means
88
- * you have seen everything; `hasMore: true` means keep paging, whatever `data`
89
- * held.** A client that stops on the first empty page will silently truncate a
90
- * filtered search.
95
+ * empty page does not mean the end.** The cursor walks the provider's scroll
96
+ * over every PHP-error-log line in the window, and only some of those lines are
97
+ * handler output a page can come back empty because the stretch it scanned
98
+ * held none, or held none matching `requestId`/`handlerName`. The rule is
99
+ * **`hasMore: false` means you have seen everything; `hasMore: true` means keep
100
+ * paging, whatever `data` held.** A client that stops on the first empty page
101
+ * will silently truncate its own search.
91
102
  *
92
- * No `warnings` array, unlike the access log. Its one diagnostic is
93
- * `log_retention_clamped`, which reports a requested window being cut back to
94
- * the plan's retention — and there is no window to clamp here. An empty
95
- * diagnostics channel would be a field every caller must handle and no server
96
- * ever fills.
103
+ * `warnings` carries the same `log_retention_clamped` diagnostic the access log
104
+ * does, for the same reason: one window, one retention, one way of saying it
105
+ * was cut back.
106
+ *
107
+ * **These lines lag.** A record is written to a file on the origin, shipped off
108
+ * the box, and indexed before it can be read back, so a line a request just
109
+ * wrote will not be in the next page. Nothing here is live, and the delay is
110
+ * the provider's ingest lag rather than anything this surface schedules — it
111
+ * has not been measured against a real client yet, so no surface should quote
112
+ * a figure for it until the gate probe in
113
+ * `e2e-tests/direct/wpcloud-behavior.test.ts` has actually run.
97
114
  */
98
115
  export const runtimeLogListResponseSchema = z.object({
99
116
  data: z.array(runtimeLogEntrySchema),
100
117
  pagination: CursorPaginationSchema,
118
+ warnings: z
119
+ .array(baseDiagnosticSchema)
120
+ .optional()
121
+ .describe("List-level diagnostics; log_retention_clamped names the effective `since` when the requested window exceeds the plan's log retention."),
101
122
  });
102
123
  export const analyticsQuerySchema = z.object({
103
124
  window: z
104
- .enum(["48h", "7d", "30d", "custom"])
125
+ .enum(["48h", "7d", "30d"])
105
126
  .optional()
106
- .describe('Analytics summary window. Defaults to "7d". "custom" requires since/until.'),
107
- since: z.string().datetime().optional().describe("Start of the custom analytics window."),
108
- until: z.string().datetime().optional().describe("End of the custom analytics window."),
127
+ .describe('Analytics summary window. Defaults to "7d".'),
109
128
  });
110
129
  // Served by `GET /v1/spaces/{spaceId}/analytics`: traffic summary over the
111
- // requested window, read from Spacefast's own per-space rollups (ingested on
112
- // demand from provider edge metrics; staleness bounded by the freshness TTL).
113
- // Counts cover main hostnames only: default, custom-domain, and channel.
114
- // Immutable version-URL traffic is ingested but never surfaced here.
130
+ // requested window, read live from the hosting provider's edge metrics no
131
+ // local store exists. Counts cover every hostname mapped to the space's site;
132
+ // a provider outage means this endpoint errors rather than answers stale.
115
133
  export const analyticsResponseSchema = z.object({
116
134
  spaceId: z.string().describe("The space id the traffic was aggregated for."),
117
- window: z.enum(["48h", "7d", "30d", "custom"]).describe("Resolved summary window."),
118
- since: z.string().describe("Resolved window start (ISO 8601), after retention clamping."),
119
- until: z.string().describe("Resolved window end (ISO 8601)."),
120
- granularity: z.enum(["hourly", "daily"]).describe("Series bucket size, resolved from the plan."),
121
- dataAsOf: z
122
- .string()
123
- .nullable()
124
- .describe("End of the last fully-ingested hour; null until the first ingest starts."),
125
- refreshing: z
126
- .boolean()
127
- .describe("Whether an ingest run is active or the server just triggered one."),
135
+ window: z.enum(["48h", "7d", "30d"]).describe("Resolved summary window."),
136
+ since: z.string().describe("Window start (ISO 8601)."),
137
+ until: z.string().describe("Window end (ISO 8601)."),
138
+ granularity: z
139
+ .enum(["hourly", "daily"])
140
+ .describe("Series bucket size: hourly for the 48h window, daily otherwise."),
128
141
  views: z
129
142
  .number()
130
- .describe("Successful non-crawler requests (status < 400, assets included) summed across main hostnames over the window."),
131
- visitors: z
132
- .number()
133
- .nullable()
134
- .describe("Unique-visitor estimate. Always null because per-hostname unique-visitor data is not yet available from the hosting provider."),
143
+ .describe("Successful non-crawler requests (status < 400, assets included) over the window."),
135
144
  bandwidthBytes: z.number().describe("Total response bytes in the window."),
136
- visitorsByHost: z
145
+ visitorsByDay: z
137
146
  .array(z.object({
138
- host: z.string(),
139
- series: z.array(z.object({
140
- date: z.string().describe("UTC day (ISO 8601)."),
141
- visitors: z.number(),
142
- views: z.number(),
143
- })),
147
+ date: z.string().describe("UTC day (ISO 8601)."),
148
+ visitors: z.number(),
144
149
  }))
145
- .describe("Per-hostname daily visitor estimates. Always empty because per-hostname unique-visitor data is not yet available from the hosting provider."),
150
+ .describe("Daily unique-visitor estimates. Daily is the provider's finest uniques resolution, and uniques are never summed across days."),
146
151
  topPaths: z
147
152
  .array(z.object({ path: z.string(), views: z.number() }))
148
153
  .describe("Most-viewed paths, capped at 10."),
@@ -157,65 +162,4 @@ export const analyticsResponseSchema = z.object({
157
162
  bandwidthBytes: z.number(),
158
163
  }))
159
164
  .describe("Time series across the window."),
160
- warnings: z
161
- .array(baseDiagnosticSchema)
162
- .optional()
163
- .describe("Diagnostics; analytics_retention_clamped names the effective `since` when the requested window exceeds the plan's analytics retention."),
164
- });
165
- export const runtimeCertificateSchema = z.object({
166
- id: z.number().int().positive().nullable(),
167
- status: z.string().nullable(),
168
- domains: z.array(z.string()),
169
- expiration: z.string().nullable(),
170
- raw: z.record(z.string(), z.unknown()),
171
- });
172
- export const runtimeCertificatesSchema = z.object({
173
- data: z.array(runtimeCertificateSchema),
174
- pagination: CursorPaginationSchema,
175
- });
176
- const certificatePayload = z.object({
177
- domains: z.array(z.string()).optional(),
178
- certificate: z.string().min(1),
179
- privateKey: z.string().min(1),
180
- csr: z.string().optional(),
181
- trustedCertificates: z.string().optional(),
182
- clientCertificate: z.string().optional(),
183
- });
184
- export const runtimeCertificateStageSchema = certificatePayload;
185
- export const runtimeCertificateUpdateSchema = certificatePayload.extend({
186
- domains: z.array(z.string()).default([]),
187
- });
188
- export const runtimeCertificateValidateSchema = certificatePayload;
189
- export const runtimeCertificateMutationResponseSchema = z.object({
190
- certificate: runtimeCertificateSchema.nullable(),
191
- raw: z.record(z.string(), z.unknown()),
192
- });
193
- export const runtimeCertificateValidationResponseSchema = z.object({
194
- valid: z.boolean(),
195
- errors: z.array(z.string()),
196
- warnings: z.array(z.string()),
197
- validations: z.record(z.string(), z.record(z.string(), z.unknown())),
198
- });
199
- export const runtimeCertificateActivateSchema = z.object({
200
- domains: z.array(z.string()).optional(),
201
- });
202
- export const runtimeCertificateActionResponseSchema = z.object({
203
- ok: z.literal(true),
204
- certificateId: z.number().int().positive(),
205
- raw: z.record(z.string(), z.unknown()),
206
- });
207
- export const runtimeSslInfoSchema = z.object({
208
- domain: z.string().min(1),
209
- raw: z.record(z.string(), z.unknown()),
210
- });
211
- export const runtimeSslDomainSchema = z.object({
212
- domain: z.string().min(1),
213
- });
214
- export const runtimeSslToggleSchema = runtimeSslDomainSchema.extend({
215
- enabled: z.boolean(),
216
- });
217
- export const runtimeSslActionResponseSchema = z.object({
218
- ok: z.literal(true),
219
- domain: z.string().min(1),
220
- raw: z.record(z.string(), z.unknown()),
221
165
  });