@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
@@ -1,140 +0,0 @@
1
- import { z } from "zod";
2
- import budgetJson from "./postgres-budget.json" with { type: "json" };
3
- const serviceBudgetSchema = z.object({
4
- enabledInProduction: z.boolean(),
5
- replicas: z.number().int().nonnegative(),
6
- poolConnectionsPerReplica: z.number().int().positive(),
7
- fixedConnectionsPerReplica: z.number().int().nonnegative(),
8
- maxPinnedTransactionsPerReplica: z.number().int().nonnegative(),
9
- rolloutOverlapReplicas: z.number().int().nonnegative(),
10
- connectionBudget: z.string().min(1),
11
- });
12
- const postgresConnectionBudgetSchema = z
13
- .object({
14
- server: z.object({
15
- maxConnections: z.number().int().positive(),
16
- superuserReservedConnections: z.number().int().nonnegative(),
17
- }),
18
- migrationConnections: z.number().int().positive(),
19
- operationalReserveConnections: z.number().int().nonnegative(),
20
- transactionPools: z.record(z.string().min(1), z.object({
21
- serverConnections: z.number().int().positive(),
22
- })),
23
- services: z.object({
24
- api: serviceBudgetSchema,
25
- worker: serviceBudgetSchema,
26
- cast: serviceBudgetSchema,
27
- scanWorker: serviceBudgetSchema,
28
- }),
29
- })
30
- .superRefine((plan, context) => {
31
- for (const [serviceName, service] of Object.entries(plan.services)) {
32
- if (service.connectionBudget !== "direct" &&
33
- !Object.hasOwn(plan.transactionPools, service.connectionBudget)) {
34
- context.addIssue({
35
- code: "custom",
36
- message: `service ${serviceName} references unknown transaction pool ${service.connectionBudget}`,
37
- path: ["services", serviceName, "connectionBudget"],
38
- });
39
- }
40
- }
41
- for (const [poolName, pool] of Object.entries(plan.transactionPools)) {
42
- const maxPinnedTransactions = Object.values(plan.services)
43
- .filter((service) => service.enabledInProduction && service.connectionBudget === poolName)
44
- .reduce((total, service) => total +
45
- (service.replicas + service.rolloutOverlapReplicas) *
46
- service.maxPinnedTransactionsPerReplica, 0);
47
- if (maxPinnedTransactions >= pool.serverConnections) {
48
- context.addIssue({
49
- code: "custom",
50
- message: `transaction pool ${poolName} can pin ${maxPinnedTransactions}/${pool.serverConnections} server connections, leaving no callback query capacity`,
51
- path: ["transactionPools", poolName, "serverConnections"],
52
- });
53
- }
54
- }
55
- });
56
- export const POSTGRES_CONNECTION_BUDGET = postgresConnectionBudgetSchema.parse(budgetJson);
57
- function serviceFootprint(service) {
58
- return service.poolConnectionsPerReplica + service.fixedConnectionsPerReplica;
59
- }
60
- export function calculatePostgresConnectionBudget(plan, server = plan.server) {
61
- const usableServerConnections = server.maxConnections - server.superuserReservedConnections;
62
- if (usableServerConnections <= 0) {
63
- throw new Error(`postgres_connection_budget_invalid: maxConnections=${server.maxConnections} must exceed superuserReservedConnections=${server.superuserReservedConnections}`);
64
- }
65
- const directServices = Object.values(plan.services).filter((service) => service.enabledInProduction && service.connectionBudget === "direct");
66
- const directSteadyConnections = directServices.reduce((total, service) => total + service.replicas * serviceFootprint(service), 0);
67
- const transactionPoolConnections = Object.values(plan.transactionPools).reduce((total, pool) => total + pool.serverConnections, 0);
68
- const transactionPoolPinnedConnections = Object.values(plan.services)
69
- .filter((service) => service.enabledInProduction && service.connectionBudget !== "direct")
70
- .reduce((total, service) => total +
71
- (service.replicas + service.rolloutOverlapReplicas) *
72
- service.maxPinnedTransactionsPerReplica, 0);
73
- const transactionPoolQueryHeadroom = transactionPoolConnections - transactionPoolPinnedConnections;
74
- const steadyConnections = directSteadyConnections + transactionPoolConnections;
75
- const rollingDeploySurgeConnections = directServices.reduce((total, service) => total + service.rolloutOverlapReplicas * serviceFootprint(service), 0);
76
- const plannedConnections = steadyConnections +
77
- rollingDeploySurgeConnections +
78
- plan.migrationConnections +
79
- plan.operationalReserveConnections;
80
- return {
81
- usableServerConnections,
82
- directSteadyConnections,
83
- transactionPoolConnections,
84
- transactionPoolPinnedConnections,
85
- transactionPoolQueryHeadroom,
86
- steadyConnections,
87
- rollingDeploySurgeConnections,
88
- migrationConnections: plan.migrationConnections,
89
- operationalReserveConnections: plan.operationalReserveConnections,
90
- plannedConnections,
91
- unallocatedConnections: usableServerConnections - plannedConnections,
92
- };
93
- }
94
- export function assertPostgresServiceConnectionUrl(service, rawUrl, options = {}) {
95
- const parsed = new URL(rawUrl);
96
- const hostname = parsed.hostname.toLowerCase();
97
- const isLocalDevelopmentHost = hostname === "localhost" ||
98
- hostname === "127.0.0.1" ||
99
- hostname === "::1" ||
100
- hostname === "[::1]" ||
101
- (!hostname.includes(".") && !hostname.includes(":"));
102
- if (options.allowDirectDevelopmentConnection && isLocalDevelopmentHost) {
103
- return;
104
- }
105
- const serviceBudget = POSTGRES_CONNECTION_BUDGET.services[service];
106
- if (!serviceBudget.enabledInProduction) {
107
- throw new Error(`postgres_connection_budget_service_disabled: service=${service}; add its replicas and rollout overlap to the shared budget before production startup`);
108
- }
109
- const connectionBudget = serviceBudget.connectionBudget;
110
- const port = parsed.port || "5432";
111
- if (connectionBudget === "direct") {
112
- if (port !== "5432") {
113
- throw new Error(`postgres_connection_budget_url_mismatch: service=${service} planned=direct port=${port}`);
114
- }
115
- return;
116
- }
117
- if (port !== "6432") {
118
- throw new Error(`postgres_connection_budget_url_mismatch: service=${service} planned=transaction_pool pool=${connectionBudget} port=${port}`);
119
- }
120
- }
121
- export function assertPostgresServicePoolBudget(service, configuredPoolConnections) {
122
- const expected = POSTGRES_CONNECTION_BUDGET.services[service].poolConnectionsPerReplica;
123
- if (configuredPoolConnections !== expected) {
124
- throw new Error(`postgres_connection_budget_pool_mismatch: service=${service} configured=${configuredPoolConnections} planned=${expected}; update the shared budget and every affected service in one change`);
125
- }
126
- }
127
- export function assertPostgresServiceNamedLockBudget(service, configuredNamedLockTransactions) {
128
- const expected = POSTGRES_CONNECTION_BUDGET.services[service].maxPinnedTransactionsPerReplica;
129
- if (configuredNamedLockTransactions !== expected) {
130
- throw new Error(`postgres_connection_budget_named_lock_mismatch: service=${service} configured=${configuredNamedLockTransactions} planned=${expected}`);
131
- }
132
- }
133
- export function assertPostgresServerBudget(server) {
134
- const summary = calculatePostgresConnectionBudget(POSTGRES_CONNECTION_BUDGET, server);
135
- if (summary.unallocatedConnections < 0) {
136
- throw new Error(`postgres_connection_budget_exceeded: planned=${summary.plannedConnections} usable=${summary.usableServerConnections} max=${server.maxConnections} superuserReserved=${server.superuserReservedConnections}`);
137
- }
138
- return summary;
139
- }
140
- export const POSTGRES_CONNECTION_BUDGET_SUMMARY = assertPostgresServerBudget(POSTGRES_CONNECTION_BUDGET.server);
@@ -1,51 +0,0 @@
1
- {
2
- "server": {
3
- "maxConnections": 25,
4
- "superuserReservedConnections": 3
5
- },
6
- "migrationConnections": 1,
7
- "operationalReserveConnections": 4,
8
- "transactionPools": {
9
- "controlPlaneRuntime": {
10
- "serverConnections": 7
11
- }
12
- },
13
- "services": {
14
- "api": {
15
- "enabledInProduction": true,
16
- "replicas": 2,
17
- "poolConnectionsPerReplica": 4,
18
- "fixedConnectionsPerReplica": 0,
19
- "maxPinnedTransactionsPerReplica": 1,
20
- "rolloutOverlapReplicas": 1,
21
- "connectionBudget": "controlPlaneRuntime"
22
- },
23
- "worker": {
24
- "enabledInProduction": true,
25
- "replicas": 1,
26
- "poolConnectionsPerReplica": 4,
27
- "fixedConnectionsPerReplica": 0,
28
- "maxPinnedTransactionsPerReplica": 1,
29
- "rolloutOverlapReplicas": 1,
30
- "connectionBudget": "controlPlaneRuntime"
31
- },
32
- "cast": {
33
- "enabledInProduction": true,
34
- "replicas": 1,
35
- "poolConnectionsPerReplica": 4,
36
- "fixedConnectionsPerReplica": 1,
37
- "maxPinnedTransactionsPerReplica": 0,
38
- "rolloutOverlapReplicas": 1,
39
- "connectionBudget": "direct"
40
- },
41
- "scanWorker": {
42
- "enabledInProduction": false,
43
- "replicas": 0,
44
- "poolConnectionsPerReplica": 2,
45
- "fixedConnectionsPerReplica": 0,
46
- "maxPinnedTransactionsPerReplica": 1,
47
- "rolloutOverlapReplicas": 0,
48
- "connectionBudget": "controlPlaneRuntime"
49
- }
50
- }
51
- }
@@ -1,331 +0,0 @@
1
- import { z } from "zod";
2
- export declare const archiveListQuerySchema: z.ZodObject<{
3
- limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
4
- cursor: z.ZodOptional<z.ZodString>;
5
- }, z.core.$strip>;
6
- export declare const spaceExportRequestSchema: z.ZodObject<{
7
- versionIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
8
- includeFiles: z.ZodDefault<z.ZodBoolean>;
9
- }, z.core.$strict>;
10
- export declare const spaceExportArchiveSchema: z.ZodObject<{
11
- contentType: z.ZodLiteral<"application/zip">;
12
- downloadUrl: z.ZodString;
13
- expiresAt: z.ZodString;
14
- sizeBytes: z.ZodOptional<z.ZodNumber>;
15
- sha256: z.ZodOptional<z.ZodString>;
16
- }, z.core.$strip>;
17
- export declare const spaceExportSchema: z.ZodObject<{
18
- id: z.ZodString;
19
- spaceId: z.ZodString;
20
- status: z.ZodEnum<{
21
- failed: "failed";
22
- expired: "expired";
23
- ready: "ready";
24
- queued: "queued";
25
- running: "running";
26
- }>;
27
- format: z.ZodLiteral<"spacefast_export_v1">;
28
- diagnostics: z.ZodDefault<z.ZodArray<z.ZodObject<{
29
- code: z.ZodString;
30
- severity: z.ZodEnum<{
31
- info: "info";
32
- error: "error";
33
- warning: "warning";
34
- }>;
35
- message: z.ZodString;
36
- path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
- provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
38
- registrar: "registrar";
39
- wpcloud: "wpcloud";
40
- dns: "dns";
41
- runtime: "runtime";
42
- }>>>;
43
- details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
44
- fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
45
- retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
46
- }, z.core.$strip>>>;
47
- archive: z.ZodOptional<z.ZodObject<{
48
- contentType: z.ZodLiteral<"application/zip">;
49
- downloadUrl: z.ZodString;
50
- expiresAt: z.ZodString;
51
- sizeBytes: z.ZodOptional<z.ZodNumber>;
52
- sha256: z.ZodOptional<z.ZodString>;
53
- }, z.core.$strip>>;
54
- operationId: z.ZodNullable<z.ZodString>;
55
- createdAt: z.ZodString;
56
- updatedAt: z.ZodString;
57
- }, z.core.$strip>;
58
- export declare const spaceExportListResponseSchema: z.ZodObject<{
59
- data: z.ZodArray<z.ZodObject<{
60
- id: z.ZodString;
61
- spaceId: z.ZodString;
62
- status: z.ZodEnum<{
63
- failed: "failed";
64
- expired: "expired";
65
- ready: "ready";
66
- queued: "queued";
67
- running: "running";
68
- }>;
69
- format: z.ZodLiteral<"spacefast_export_v1">;
70
- diagnostics: z.ZodDefault<z.ZodArray<z.ZodObject<{
71
- code: z.ZodString;
72
- severity: z.ZodEnum<{
73
- info: "info";
74
- error: "error";
75
- warning: "warning";
76
- }>;
77
- message: z.ZodString;
78
- path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
79
- provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
80
- registrar: "registrar";
81
- wpcloud: "wpcloud";
82
- dns: "dns";
83
- runtime: "runtime";
84
- }>>>;
85
- details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
86
- fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
- retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
88
- }, z.core.$strip>>>;
89
- archive: z.ZodOptional<z.ZodObject<{
90
- contentType: z.ZodLiteral<"application/zip">;
91
- downloadUrl: z.ZodString;
92
- expiresAt: z.ZodString;
93
- sizeBytes: z.ZodOptional<z.ZodNumber>;
94
- sha256: z.ZodOptional<z.ZodString>;
95
- }, z.core.$strip>>;
96
- operationId: z.ZodNullable<z.ZodString>;
97
- createdAt: z.ZodString;
98
- updatedAt: z.ZodString;
99
- }, z.core.$strip>>;
100
- pagination: z.ZodObject<{
101
- nextCursor: z.ZodNullable<z.ZodString>;
102
- hasMore: z.ZodBoolean;
103
- }, z.core.$strip>;
104
- }, z.core.$strip>;
105
- export declare const spaceImportSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
106
- kind: z.ZodLiteral<"upload">;
107
- }, z.core.$strip>, z.ZodObject<{
108
- kind: z.ZodLiteral<"url">;
109
- url: z.ZodString;
110
- }, z.core.$strip>, z.ZodObject<{
111
- kind: z.ZodLiteral<"export">;
112
- exportId: z.ZodString;
113
- }, z.core.$strip>], "kind">;
114
- export declare const spaceImportRequestSchema: z.ZodObject<{
115
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
116
- kind: z.ZodLiteral<"upload">;
117
- }, z.core.$strip>, z.ZodObject<{
118
- kind: z.ZodLiteral<"url">;
119
- url: z.ZodString;
120
- }, z.core.$strip>, z.ZodObject<{
121
- kind: z.ZodLiteral<"export">;
122
- exportId: z.ZodString;
123
- }, z.core.$strip>], "kind">;
124
- publish: z.ZodDefault<z.ZodBoolean>;
125
- }, z.core.$strip>;
126
- export declare const spaceImportSchema: z.ZodObject<{
127
- id: z.ZodString;
128
- targetSpaceId: z.ZodString;
129
- status: z.ZodEnum<{
130
- failed: "failed";
131
- canceled: "canceled";
132
- created: "created";
133
- ready: "ready";
134
- waiting_for_archive: "waiting_for_archive";
135
- validating: "validating";
136
- materializing: "materializing";
137
- }>;
138
- archiveUpload: z.ZodOptional<z.ZodObject<{
139
- id: z.ZodString;
140
- mode: z.ZodEnum<{
141
- source: "source";
142
- dist: "dist";
143
- }>;
144
- expiresAt: z.ZodString;
145
- summary: z.ZodObject<{
146
- upload: z.ZodNumber;
147
- reused: z.ZodNumber;
148
- ignored: z.ZodNumber;
149
- }, z.core.$strip>;
150
- targets: z.ZodDefault<z.ZodArray<z.ZodObject<{
151
- path: z.ZodString;
152
- method: z.ZodEnum<{
153
- POST: "POST";
154
- PUT: "PUT";
155
- }>;
156
- url: z.ZodUnion<[z.ZodString, z.ZodString]>;
157
- headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
158
- body: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
159
- kind: z.ZodLiteral<"url">;
160
- url: z.ZodString;
161
- }, z.core.$strip>], "kind">>;
162
- size: z.ZodOptional<z.ZodNumber>;
163
- maxBytes: z.ZodOptional<z.ZodNumber>;
164
- sha256: z.ZodOptional<z.ZodString>;
165
- contentType: z.ZodOptional<z.ZodString>;
166
- }, z.core.$strip>>>;
167
- links: z.ZodObject<{
168
- resume: z.ZodString;
169
- finalize: z.ZodString;
170
- }, z.core.$strip>;
171
- details: z.ZodOptional<z.ZodObject<{
172
- reused: z.ZodOptional<z.ZodArray<z.ZodObject<{
173
- path: z.ZodString;
174
- reason: z.ZodString;
175
- }, z.core.$strip>>>;
176
- ignored: z.ZodOptional<z.ZodArray<z.ZodObject<{
177
- path: z.ZodString;
178
- reason: z.ZodString;
179
- }, z.core.$strip>>>;
180
- diagnostics: z.ZodOptional<z.ZodArray<z.ZodObject<{
181
- code: z.ZodString;
182
- severity: z.ZodEnum<{
183
- info: "info";
184
- error: "error";
185
- warning: "warning";
186
- }>;
187
- message: z.ZodString;
188
- path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
189
- provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
190
- registrar: "registrar";
191
- wpcloud: "wpcloud";
192
- dns: "dns";
193
- runtime: "runtime";
194
- }>>>;
195
- details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
196
- fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
197
- retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
198
- }, z.core.$strip>>>;
199
- }, z.core.$strip>>;
200
- }, z.core.$strip>>;
201
- draftVersionIds: z.ZodArray<z.ZodString>;
202
- diagnostics: z.ZodDefault<z.ZodArray<z.ZodObject<{
203
- code: z.ZodString;
204
- severity: z.ZodEnum<{
205
- info: "info";
206
- error: "error";
207
- warning: "warning";
208
- }>;
209
- message: z.ZodString;
210
- path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
211
- provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
212
- registrar: "registrar";
213
- wpcloud: "wpcloud";
214
- dns: "dns";
215
- runtime: "runtime";
216
- }>>>;
217
- details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
218
- fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
219
- retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
220
- }, z.core.$strip>>>;
221
- operationId: z.ZodNullable<z.ZodString>;
222
- createdAt: z.ZodString;
223
- updatedAt: z.ZodString;
224
- }, z.core.$strip>;
225
- export declare const spaceImportListResponseSchema: z.ZodObject<{
226
- data: z.ZodArray<z.ZodObject<{
227
- id: z.ZodString;
228
- targetSpaceId: z.ZodString;
229
- status: z.ZodEnum<{
230
- failed: "failed";
231
- canceled: "canceled";
232
- created: "created";
233
- ready: "ready";
234
- waiting_for_archive: "waiting_for_archive";
235
- validating: "validating";
236
- materializing: "materializing";
237
- }>;
238
- archiveUpload: z.ZodOptional<z.ZodObject<{
239
- id: z.ZodString;
240
- mode: z.ZodEnum<{
241
- source: "source";
242
- dist: "dist";
243
- }>;
244
- expiresAt: z.ZodString;
245
- summary: z.ZodObject<{
246
- upload: z.ZodNumber;
247
- reused: z.ZodNumber;
248
- ignored: z.ZodNumber;
249
- }, z.core.$strip>;
250
- targets: z.ZodDefault<z.ZodArray<z.ZodObject<{
251
- path: z.ZodString;
252
- method: z.ZodEnum<{
253
- POST: "POST";
254
- PUT: "PUT";
255
- }>;
256
- url: z.ZodUnion<[z.ZodString, z.ZodString]>;
257
- headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
258
- body: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
259
- kind: z.ZodLiteral<"url">;
260
- url: z.ZodString;
261
- }, z.core.$strip>], "kind">>;
262
- size: z.ZodOptional<z.ZodNumber>;
263
- maxBytes: z.ZodOptional<z.ZodNumber>;
264
- sha256: z.ZodOptional<z.ZodString>;
265
- contentType: z.ZodOptional<z.ZodString>;
266
- }, z.core.$strip>>>;
267
- links: z.ZodObject<{
268
- resume: z.ZodString;
269
- finalize: z.ZodString;
270
- }, z.core.$strip>;
271
- details: z.ZodOptional<z.ZodObject<{
272
- reused: z.ZodOptional<z.ZodArray<z.ZodObject<{
273
- path: z.ZodString;
274
- reason: z.ZodString;
275
- }, z.core.$strip>>>;
276
- ignored: z.ZodOptional<z.ZodArray<z.ZodObject<{
277
- path: z.ZodString;
278
- reason: z.ZodString;
279
- }, z.core.$strip>>>;
280
- diagnostics: z.ZodOptional<z.ZodArray<z.ZodObject<{
281
- code: z.ZodString;
282
- severity: z.ZodEnum<{
283
- info: "info";
284
- error: "error";
285
- warning: "warning";
286
- }>;
287
- message: z.ZodString;
288
- path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
289
- provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
290
- registrar: "registrar";
291
- wpcloud: "wpcloud";
292
- dns: "dns";
293
- runtime: "runtime";
294
- }>>>;
295
- details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
296
- fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
297
- retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
298
- }, z.core.$strip>>>;
299
- }, z.core.$strip>>;
300
- }, z.core.$strip>>;
301
- draftVersionIds: z.ZodArray<z.ZodString>;
302
- diagnostics: z.ZodDefault<z.ZodArray<z.ZodObject<{
303
- code: z.ZodString;
304
- severity: z.ZodEnum<{
305
- info: "info";
306
- error: "error";
307
- warning: "warning";
308
- }>;
309
- message: z.ZodString;
310
- path: z.ZodOptional<z.ZodNullable<z.ZodString>>;
311
- provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
312
- registrar: "registrar";
313
- wpcloud: "wpcloud";
314
- dns: "dns";
315
- runtime: "runtime";
316
- }>>>;
317
- details: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
318
- fix: z.ZodOptional<z.ZodNullable<z.ZodString>>;
319
- retryable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
320
- }, z.core.$strip>>>;
321
- operationId: z.ZodNullable<z.ZodString>;
322
- createdAt: z.ZodString;
323
- updatedAt: z.ZodString;
324
- }, z.core.$strip>>;
325
- pagination: z.ZodObject<{
326
- nextCursor: z.ZodNullable<z.ZodString>;
327
- hasMore: z.ZodBoolean;
328
- }, z.core.$strip>;
329
- }, z.core.$strip>;
330
- export type SpaceExport = z.infer<typeof spaceExportSchema>;
331
- export type SpaceImport = z.infer<typeof spaceImportSchema>;
@@ -1,120 +0,0 @@
1
- import { z } from "zod";
2
- import { baseDiagnosticSchema, CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
3
- import { uploadInstructionsSchema } from "./internal.js";
4
- export const archiveListQuerySchema = cursorListQuerySchema;
5
- export const spaceExportRequestSchema = z
6
- .object({
7
- versionIds: z
8
- .array(z.string().min(1))
9
- .min(1)
10
- .optional()
11
- .describe("Version ids (ver_…) to export. Every id must belong to the space; omit to export all versions."),
12
- includeFiles: z
13
- .boolean()
14
- .default(true)
15
- .describe("Pass `true` to include version file trees and compiled serving artifacts. Pass `false` for a config-only archive that is not self-servable and cannot be re-imported."),
16
- })
17
- .strict();
18
- export const spaceExportArchiveSchema = z.object({
19
- // Zip-only contract: spacefast_export_v1 archives are always zip (the spec
20
- // allows "zip or tar"; one format keeps the enum honest).
21
- contentType: z.literal("application/zip").describe("Archive media type. Always zip."),
22
- downloadUrl: z
23
- .string()
24
- .describe("API-relative URL streaming the archive while it has not expired."),
25
- expiresAt: z
26
- .string()
27
- .datetime()
28
- .describe("When the archive download expires; the export flips to `expired` afterwards."),
29
- sizeBytes: z.number().int().nonnegative().optional().describe("Archive size in bytes."),
30
- sha256: z
31
- .string()
32
- .optional()
33
- .describe("SHA-256 of the archive bytes (64 lowercase hex characters), for verification."),
34
- });
35
- export const spaceExportSchema = z.object({
36
- id: z.string().describe("The export handle id (`exp_…`)."),
37
- spaceId: z.string().describe("The source space id (`spc_…`)."),
38
- status: z
39
- .enum(["queued", "running", "ready", "failed", "expired"])
40
- .describe("Export lifecycle. `expired` means the archive download window has passed."),
41
- format: z
42
- .literal("spacefast_export_v1")
43
- .describe("Archive format identifier. Always `spacefast_export_v1`."),
44
- diagnostics: z
45
- .array(baseDiagnosticSchema)
46
- .default([])
47
- .describe("Diagnostics collected while producing the export."),
48
- archive: spaceExportArchiveSchema
49
- .optional()
50
- .describe("Archive download details; present only while status is `ready`."),
51
- operationId: z
52
- .string()
53
- .nullable()
54
- .describe("Operation (op_…) tracking the asynchronous export work."),
55
- createdAt: z.string().datetime().describe("Instant when the export handle was created."),
56
- updatedAt: z.string().datetime().describe("Instant when the export handle last changed."),
57
- });
58
- export const spaceExportListResponseSchema = z.object({
59
- data: z.array(spaceExportSchema),
60
- pagination: CursorPaginationSchema,
61
- });
62
- export const spaceImportSourceSchema = z
63
- .discriminatedUnion("kind", [
64
- z.object({
65
- kind: z
66
- .literal("upload")
67
- .describe("Upload an archive; the response carries `archiveUpload` instructions."),
68
- }),
69
- z.object({
70
- kind: z.literal("url").describe("Fetch the archive from a public HTTPS URL."),
71
- url: z.string().url().describe("Public HTTPS URL of a spacefast_export_v1 archive."),
72
- }),
73
- z.object({
74
- kind: z.literal("export").describe("Import directly from an export on this control plane."),
75
- exportId: z.string().min(1).describe("Source export id (exp_…) accessible to the caller."),
76
- }),
77
- ])
78
- .describe("Where the spacefast_export_v1 archive comes from.");
79
- export const spaceImportRequestSchema = z.object({
80
- source: spaceImportSourceSchema,
81
- publish: z
82
- .boolean()
83
- .default(false)
84
- .describe("Pass `true` to promote the newest imported version to the live channel after it materializes. Imported versions never go public implicitly."),
85
- });
86
- export const spaceImportSchema = z.object({
87
- id: z.string().describe("The import handle id (`imp_…`)."),
88
- targetSpaceId: z.string().describe("The target space id (`spc_…`) the import materializes into."),
89
- status: z
90
- .enum([
91
- "created",
92
- "waiting_for_archive",
93
- "validating",
94
- "materializing",
95
- "ready",
96
- "failed",
97
- "canceled",
98
- ])
99
- .describe("Import lifecycle. Upload-kind imports wait in `waiting_for_archive` until the archive is uploaded and the import is finalized."),
100
- archiveUpload: uploadInstructionsSchema
101
- .optional()
102
- .describe("Archive upload instructions. This is the same upload contract as publish. Present while status is `waiting_for_archive`: PUT the archive to `{baseUrl}/{files[0]}` with the session token, then POST `links.finalize`. Each fetch of the import mints a fresh token."),
103
- draftVersionIds: z
104
- .array(z.string())
105
- .describe("Version ids (ver_…) minted and owned by this import."),
106
- diagnostics: z
107
- .array(baseDiagnosticSchema)
108
- .default([])
109
- .describe("Diagnostics collected during validation and materialization, including warnings for imported config overridden by the target space/parent policy."),
110
- operationId: z
111
- .string()
112
- .nullable()
113
- .describe("Operation (op_…) tracking the asynchronous import work."),
114
- createdAt: z.string().datetime().describe("Instant when the import handle was created."),
115
- updatedAt: z.string().datetime().describe("Instant when the import handle last changed."),
116
- });
117
- export const spaceImportListResponseSchema = z.object({
118
- data: z.array(spaceImportSchema),
119
- pagination: CursorPaginationSchema,
120
- });