@spacefast/common 0.0.5 → 0.0.7

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 (183) hide show
  1. package/brand-assets/spacefast-favicon.svg +16 -0
  2. package/brand-assets/spacefast-sf-full-bleed.svg +13 -0
  3. package/brand-assets/spacefast-wordmark.svg +5 -0
  4. package/dist/agents/connect-targets.d.ts +138 -0
  5. package/dist/agents/connect-targets.js +243 -0
  6. package/dist/brand-assets-build.d.ts +26 -0
  7. package/dist/brand-assets-build.js +81 -0
  8. package/dist/brand-assets.d.ts +42 -0
  9. package/dist/brand-assets.js +30 -0
  10. package/dist/brand.d.ts +1 -0
  11. package/dist/brand.js +5 -0
  12. package/dist/config/domains.d.ts +12 -6
  13. package/dist/config/domains.js +30 -38
  14. package/dist/contracts/access.d.ts +967 -124
  15. package/dist/contracts/access.js +804 -148
  16. package/dist/contracts/activity.d.ts +1 -1
  17. package/dist/contracts/activity.js +28 -2
  18. package/dist/contracts/annotations.d.ts +2 -4
  19. package/dist/contracts/api-keys.d.ts +126 -4
  20. package/dist/contracts/api-keys.js +74 -6
  21. package/dist/contracts/archives.d.ts +8 -2
  22. package/dist/contracts/archives.js +11 -4
  23. package/dist/contracts/billing.d.ts +0 -9
  24. package/dist/contracts/builds.d.ts +65 -21
  25. package/dist/contracts/builds.js +29 -0
  26. package/dist/contracts/common.d.ts +2 -0
  27. package/dist/contracts/common.js +4 -0
  28. package/dist/contracts/continuation.d.ts +0 -3
  29. package/dist/contracts/countries.d.ts +2 -0
  30. package/dist/contracts/countries.js +261 -0
  31. package/dist/contracts/deployments.d.ts +34 -34
  32. package/dist/contracts/device-auth.d.ts +4 -11
  33. package/dist/contracts/device-auth.js +4 -0
  34. package/dist/contracts/docs.d.ts +119 -0
  35. package/dist/contracts/docs.js +51 -0
  36. package/dist/contracts/domains.d.ts +96 -54
  37. package/dist/contracts/domains.js +26 -4
  38. package/dist/contracts/enums.d.ts +15 -16
  39. package/dist/contracts/enums.js +26 -14
  40. package/dist/contracts/error-code-meta.d.ts +184 -0
  41. package/dist/contracts/error-code-meta.js +124 -10
  42. package/dist/contracts/error-codes.d.ts +1 -1
  43. package/dist/contracts/error-codes.js +42 -0
  44. package/dist/contracts/events.d.ts +1 -1
  45. package/dist/contracts/feature-lifecycle-core.d.ts +36 -0
  46. package/dist/contracts/feature-lifecycle-core.js +220 -0
  47. package/dist/contracts/feature-lifecycle.d.ts +7 -0
  48. package/dist/contracts/feature-lifecycle.js +31 -0
  49. package/dist/contracts/features.d.ts +76 -6
  50. package/dist/contracts/features.js +178 -13
  51. package/dist/contracts/generated-feature-launch-entries.d.ts +2 -0
  52. package/dist/contracts/generated-feature-launch-entries.js +518 -0
  53. package/dist/contracts/git.d.ts +2 -8
  54. package/dist/contracts/ids.d.ts +9 -0
  55. package/dist/contracts/ids.js +13 -0
  56. package/dist/contracts/mcp.d.ts +8 -10
  57. package/dist/contracts/me.js +1 -1
  58. package/dist/contracts/oauth-resources.d.ts +19 -8
  59. package/dist/contracts/oauth-resources.js +44 -13
  60. package/dist/contracts/operations.d.ts +161 -1
  61. package/dist/contracts/operations.js +49 -1
  62. package/dist/contracts/platform.d.ts +6 -102
  63. package/dist/contracts/platform.js +6 -50
  64. package/dist/contracts/publishes.d.ts +130 -0
  65. package/dist/contracts/publishes.js +145 -0
  66. package/dist/contracts/push-new.d.ts +4 -4
  67. package/dist/contracts/quotas.d.ts +2 -0
  68. package/dist/contracts/quotas.js +8 -0
  69. package/dist/contracts/repository-connections.d.ts +9 -8
  70. package/dist/contracts/repository-connections.js +13 -0
  71. package/dist/contracts/resources.d.ts +99 -13
  72. package/dist/contracts/resources.js +36 -4
  73. package/dist/contracts/routes.d.ts +0 -2
  74. package/dist/contracts/runtime-api.d.ts +363 -39
  75. package/dist/contracts/runtime-api.js +276 -6
  76. package/dist/contracts/sf-config-v1.d.ts +75 -0
  77. package/dist/contracts/sf-config-v1.js +6 -0
  78. package/dist/contracts/sites.d.ts +19 -2
  79. package/dist/contracts/sites.js +21 -0
  80. package/dist/contracts/space-config.d.ts +201 -2
  81. package/dist/contracts/space-config.js +135 -5
  82. package/dist/contracts/spaces.d.ts +376 -196
  83. package/dist/contracts/spaces.js +62 -10
  84. package/dist/contracts/superadmin-emails.d.ts +4 -2
  85. package/dist/contracts/superadmin-emails.js +8 -0
  86. package/dist/contracts/superadmin-queues.d.ts +26 -26
  87. package/dist/contracts/superadmin-spaces.d.ts +172 -42
  88. package/dist/contracts/superadmin-tenants.d.ts +6 -6
  89. package/dist/contracts/superadmin-tenants.js +6 -11
  90. package/dist/contracts/superadmin.d.ts +6 -93
  91. package/dist/contracts/superadmin.js +6 -14
  92. package/dist/contracts/tags.d.ts +10 -9
  93. package/dist/contracts/tags.js +2 -1
  94. package/dist/contracts/teams.d.ts +26 -30
  95. package/dist/contracts/teams.js +11 -17
  96. package/dist/contracts/theme-json.d.ts +30 -0
  97. package/dist/contracts/theme-json.js +48 -0
  98. package/dist/contracts/variables.d.ts +0 -2
  99. package/dist/contracts/variables.js +0 -5
  100. package/dist/contracts/webhooks.d.ts +2 -0
  101. package/dist/contracts/webhooks.js +1 -1
  102. package/dist/contracts/zero.d.ts +5 -10
  103. package/dist/docs/agent-prose.d.ts +43 -3
  104. package/dist/docs/agent-prose.js +146 -7
  105. package/dist/docs/agent-setup.d.ts +51 -0
  106. package/dist/docs/agent-setup.js +211 -14
  107. package/dist/docs/agent-solutions.d.ts +5 -5
  108. package/dist/docs/agent-solutions.js +2 -2
  109. package/dist/docs/catalog.d.ts +650 -0
  110. package/dist/docs/catalog.js +758 -0
  111. package/dist/docs/error-docs.d.ts +0 -2
  112. package/dist/docs/error-docs.js +189 -35
  113. package/dist/docs/index-build.d.ts +17 -0
  114. package/dist/docs/index-build.js +24 -0
  115. package/dist/docs/search.d.ts +54 -0
  116. package/dist/docs/search.js +96 -0
  117. package/dist/docs/skill-distribution.d.ts +5 -3
  118. package/dist/docs/skill-distribution.js +8 -8
  119. package/dist/slug-policy/blocklist.d.ts +4 -0
  120. package/dist/slug-policy/blocklist.js +122 -0
  121. package/dist/slug-policy/index.d.ts +17 -0
  122. package/dist/slug-policy/index.js +86 -0
  123. package/dist/utils/access-match.d.ts +39 -0
  124. package/dist/utils/access-match.js +296 -0
  125. package/dist/utils/auth-redirect.d.ts +3 -1
  126. package/dist/utils/auth-redirect.js +21 -1
  127. package/dist/utils/build-settings.d.ts +6 -0
  128. package/dist/utils/build-settings.js +429 -46
  129. package/dist/utils/claim-token.d.ts +8 -0
  130. package/dist/utils/claim-token.js +23 -2
  131. package/dist/utils/concurrency.d.ts +1 -0
  132. package/dist/utils/concurrency.js +22 -0
  133. package/dist/utils/content-type.d.ts +1 -0
  134. package/dist/utils/content-type.js +1 -1
  135. package/dist/utils/credential-policy.d.ts +54 -0
  136. package/dist/utils/{access-policy.js → credential-policy.js} +28 -2
  137. package/dist/utils/email.d.ts +1 -0
  138. package/dist/utils/email.js +3 -0
  139. package/dist/utils/gate-theme.d.ts +61 -0
  140. package/dist/utils/gate-theme.js +217 -0
  141. package/dist/utils/git-repository.d.ts +0 -1
  142. package/dist/utils/git-repository.js +0 -3
  143. package/dist/utils/id-hints.d.ts +8 -0
  144. package/dist/utils/id-hints.js +61 -0
  145. package/dist/utils/local-space-state.d.ts +91 -0
  146. package/dist/utils/local-space-state.js +251 -0
  147. package/dist/utils/oauth-signed-query.d.ts +8 -0
  148. package/dist/utils/oauth-signed-query.js +26 -0
  149. package/dist/utils/publish-detection.d.ts +0 -8
  150. package/dist/utils/publish-detection.js +0 -93
  151. package/dist/utils/publish-policy.d.ts +6 -5
  152. package/dist/utils/publish-policy.js +71 -7
  153. package/dist/utils/query-keys.d.ts +16 -4
  154. package/dist/utils/query-keys.js +31 -4
  155. package/dist/utils/runtime-paths.d.ts +0 -1
  156. package/dist/utils/runtime-paths.js +0 -1
  157. package/dist/utils/runtime-upload-batch.d.ts +18 -0
  158. package/dist/utils/runtime-upload-batch.js +90 -0
  159. package/dist/utils/runtime-upload.d.ts +2 -0
  160. package/dist/utils/runtime-upload.js +5 -0
  161. package/dist/utils/sf-config-v1.d.ts +2 -0
  162. package/dist/utils/sf-config-v1.js +542 -0
  163. package/dist/utils/space-config.d.ts +4 -0
  164. package/dist/utils/space-config.js +10 -1
  165. package/dist/utils/space-theme.d.ts +2 -0
  166. package/dist/utils/space-theme.js +9 -0
  167. package/dist/utils/static-runtime-policy.d.ts +0 -21
  168. package/dist/utils/static-runtime-policy.js +19 -103
  169. package/dist/utils/upload-session.d.ts +1 -1
  170. package/dist/utils/wpcom-auth-redirects.d.ts +32 -2
  171. package/dist/utils/wpcom-auth-redirects.js +26 -10
  172. package/dist/vocabulary.d.ts +130 -30
  173. package/dist/vocabulary.js +77 -36
  174. package/package.json +35 -1
  175. package/dist/contracts/account.d.ts +0 -28
  176. package/dist/contracts/account.js +0 -54
  177. package/dist/contracts/intercom.d.ts +0 -6
  178. package/dist/contracts/intercom.js +0 -5
  179. package/dist/contracts/telemetry.d.ts +0 -2
  180. package/dist/contracts/telemetry.js +0 -1
  181. package/dist/utils/access-policy.d.ts +0 -39
  182. package/dist/utils/error-display.d.ts +0 -7
  183. package/dist/utils/error-display.js +0 -42
@@ -0,0 +1,130 @@
1
+ import { z } from "zod";
2
+ export declare const publishStates: readonly ["awaiting_upload", "uploaded", "parked", "materializing", "succeeded", "failed", "cancelled", "expired"];
3
+ export declare const publishStateSchema: z.ZodEnum<{
4
+ failed: "failed";
5
+ expired: "expired";
6
+ uploaded: "uploaded";
7
+ succeeded: "succeeded";
8
+ materializing: "materializing";
9
+ awaiting_upload: "awaiting_upload";
10
+ parked: "parked";
11
+ cancelled: "cancelled";
12
+ }>;
13
+ export type PublishState = z.infer<typeof publishStateSchema>;
14
+ export declare const publishIdSchema: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
15
+ export declare const publishAdmissionSchema: z.ZodObject<{
16
+ id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
17
+ idempotencyKey: z.ZodString;
18
+ requestFingerprint: z.ZodString;
19
+ }, z.core.$strip>;
20
+ export declare const publishSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
21
+ id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
22
+ state: z.ZodLiteral<"awaiting_upload">;
23
+ target: z.ZodOptional<z.ZodObject<{
24
+ spaceId: z.ZodCustom<`spc_${string}`, `spc_${string}`>;
25
+ baseVersionId: z.ZodNullable<z.ZodCustom<`ver_${string}`, `ver_${string}`>>;
26
+ }, z.core.$strip>>;
27
+ counts: z.ZodOptional<z.ZodObject<{
28
+ received: z.ZodNumber;
29
+ missing: z.ZodNumber;
30
+ }, z.core.$strip>>;
31
+ expiresAt: z.ZodOptional<z.ZodString>;
32
+ upload: z.ZodOptional<z.ZodObject<{
33
+ missing: z.ZodArray<z.ZodObject<{
34
+ path: z.ZodString;
35
+ sha256: z.ZodNullable<z.ZodString>;
36
+ size: z.ZodNumber;
37
+ url: z.ZodString;
38
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
39
+ expiresAt: z.ZodString;
40
+ }, z.core.$strip>>;
41
+ }, z.core.$strip>>;
42
+ }, z.core.$strip>, z.ZodObject<{
43
+ id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
44
+ state: z.ZodLiteral<"uploaded">;
45
+ }, z.core.$strip>, z.ZodObject<{
46
+ id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
47
+ state: z.ZodLiteral<"parked">;
48
+ reason: z.ZodLiteral<"capacity">;
49
+ queuePosition: z.ZodOptional<z.ZodNumber>;
50
+ nextCheckAfterSeconds: z.ZodNumber;
51
+ actions: z.ZodTuple<[z.ZodObject<{
52
+ kind: z.ZodLiteral<"cancel_publish">;
53
+ publishId: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
54
+ }, z.core.$strip>], null>;
55
+ }, z.core.$strip>, z.ZodObject<{
56
+ id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
57
+ state: z.ZodLiteral<"materializing">;
58
+ operation: z.ZodObject<{
59
+ id: z.ZodCustom<`op_${string}`, `op_${string}`>;
60
+ kind: z.ZodLiteral<"publish.finalize">;
61
+ status: z.ZodEnum<{
62
+ queued: "queued";
63
+ running: "running";
64
+ }>;
65
+ }, z.core.$strip>;
66
+ }, z.core.$strip>, z.ZodObject<{
67
+ id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
68
+ state: z.ZodLiteral<"succeeded">;
69
+ outcome: z.ZodEnum<{
70
+ created: "created";
71
+ unchanged: "unchanged";
72
+ updated: "updated";
73
+ }>;
74
+ capturedBaseVersionId: z.ZodOptional<z.ZodNullable<z.ZodCustom<`ver_${string}`, `ver_${string}`>>>;
75
+ result: z.ZodObject<{
76
+ space: z.ZodObject<{
77
+ id: z.ZodCustom<`spc_${string}`, `spc_${string}`>;
78
+ liveUrl: z.ZodString;
79
+ }, z.core.$strip>;
80
+ version: z.ZodObject<{
81
+ id: z.ZodCustom<`ver_${string}`, `ver_${string}`>;
82
+ immutableUrl: z.ZodString;
83
+ }, z.core.$strip>;
84
+ live: z.ZodObject<{
85
+ previousVersionId: z.ZodNullable<z.ZodCustom<`ver_${string}`, `ver_${string}`>>;
86
+ versionId: z.ZodCustom<`ver_${string}`, `ver_${string}`>;
87
+ }, z.core.$strip>;
88
+ }, z.core.$strip>;
89
+ }, z.core.$strip>, z.ZodObject<{
90
+ id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
91
+ state: z.ZodLiteral<"failed">;
92
+ errorCode: z.ZodString;
93
+ }, z.core.$strip>, z.ZodObject<{
94
+ id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
95
+ state: z.ZodLiteral<"cancelled">;
96
+ }, z.core.$strip>, z.ZodObject<{
97
+ id: z.ZodCustom<`pub_${string}`, `pub_${string}`>;
98
+ state: z.ZodLiteral<"expired">;
99
+ }, z.core.$strip>], "state">;
100
+ export type Publish = z.infer<typeof publishSchema>;
101
+ export type PublishAdmission = z.infer<typeof publishAdmissionSchema>;
102
+ export type DurablePublish = Publish & PublishAdmission;
103
+ export type PublishByState<State extends PublishState> = Extract<DurablePublish, {
104
+ state: State;
105
+ }>;
106
+ declare const allowedTransitions: {
107
+ readonly awaiting_upload: readonly ["uploaded", "cancelled", "expired"];
108
+ readonly uploaded: readonly ["parked", "materializing", "cancelled", "expired"];
109
+ readonly parked: readonly ["materializing", "cancelled", "expired"];
110
+ readonly materializing: readonly ["succeeded", "failed", "cancelled", "expired"];
111
+ readonly succeeded: readonly [];
112
+ readonly failed: readonly [];
113
+ readonly cancelled: readonly [];
114
+ readonly expired: readonly [];
115
+ };
116
+ export type NextPublishState<State extends PublishState> = (typeof allowedTransitions)[State][number];
117
+ export declare function canTransitionPublish<From extends PublishState>(from: From, to: PublishState): to is NextPublishState<From>;
118
+ export declare function transitionPublish<From extends PublishState, Next extends DurablePublish>(publish: PublishByState<From>, next: Next & (Next["state"] extends NextPublishState<From> ? unknown : never)): Next;
119
+ export type PublishAdmissionResult<Existing extends PublishAdmission = PublishAdmission> = {
120
+ outcome: "created";
121
+ publish: PublishAdmission;
122
+ } | {
123
+ outcome: "replayed";
124
+ publish: Existing;
125
+ } | {
126
+ outcome: "conflict";
127
+ publish: Existing;
128
+ };
129
+ export declare function convergePublishAdmission<Existing extends PublishAdmission>(existing: Existing | undefined, attempted: PublishAdmission): PublishAdmissionResult<Existing>;
130
+ export {};
@@ -0,0 +1,145 @@
1
+ import { z } from "zod";
2
+ import { registeredIdSchema } from "./ids.js";
3
+ export const publishStates = [
4
+ "awaiting_upload",
5
+ "uploaded",
6
+ "parked",
7
+ "materializing",
8
+ "succeeded",
9
+ "failed",
10
+ "cancelled",
11
+ "expired",
12
+ ];
13
+ export const publishStateSchema = z.enum(publishStates);
14
+ export const publishIdSchema = registeredIdSchema("pub");
15
+ const spaceIdSchema = registeredIdSchema("spc");
16
+ const versionIdSchema = registeredIdSchema("ver");
17
+ export const publishAdmissionSchema = z.object({
18
+ id: publishIdSchema,
19
+ idempotencyKey: z.string().min(1),
20
+ requestFingerprint: z.string().min(1),
21
+ });
22
+ const cancellableActionSchema = z.object({
23
+ kind: z.literal("cancel_publish"),
24
+ publishId: publishIdSchema,
25
+ });
26
+ export const publishSchema = z.discriminatedUnion("state", [
27
+ z.object({
28
+ id: publishIdSchema,
29
+ state: z.literal("awaiting_upload"),
30
+ target: z
31
+ .object({
32
+ spaceId: spaceIdSchema,
33
+ baseVersionId: versionIdSchema.nullable(),
34
+ })
35
+ .optional(),
36
+ counts: z
37
+ .object({
38
+ received: z.number().int().nonnegative(),
39
+ missing: z.number().int().positive(),
40
+ })
41
+ .optional(),
42
+ expiresAt: z.string().datetime().optional(),
43
+ upload: z.object({
44
+ missing: z.array(z.object({
45
+ path: z.string(),
46
+ sha256: z.string().regex(/^[0-9a-f]{64}$/).nullable(),
47
+ size: z.number().int().nonnegative(),
48
+ url: z.string().url(),
49
+ headers: z.record(z.string(), z.string()),
50
+ expiresAt: z.string().datetime(),
51
+ })).min(1),
52
+ }).optional(),
53
+ }).refine((publish) => publish.counts === undefined ||
54
+ publish.upload === undefined ||
55
+ publish.counts.missing === publish.upload.missing.length, {
56
+ message: "Upload instructions must match the missing upload count.",
57
+ path: ["upload", "missing"],
58
+ }).refine((publish) => publish.counts !== undefined || publish.upload !== undefined, {
59
+ message: "An awaiting_upload publish must carry counts or upload instructions.",
60
+ path: ["counts"],
61
+ }),
62
+ z.object({ id: publishIdSchema, state: z.literal("uploaded") }),
63
+ z
64
+ .object({
65
+ id: publishIdSchema,
66
+ state: z.literal("parked"),
67
+ reason: z.literal("capacity"),
68
+ queuePosition: z.number().int().positive().optional(),
69
+ nextCheckAfterSeconds: z.number().int().positive(),
70
+ actions: z.tuple([cancellableActionSchema]),
71
+ })
72
+ .refine((publish) => publish.actions.every((action) => action.publishId === publish.id), {
73
+ message: "Cancel actions must reference the enclosing publish.",
74
+ path: ["actions"],
75
+ }),
76
+ z.object({
77
+ id: publishIdSchema,
78
+ state: z.literal("materializing"),
79
+ operation: z.object({
80
+ id: registeredIdSchema("op"),
81
+ kind: z.literal("publish.finalize"),
82
+ status: z.enum(["queued", "running"]),
83
+ }),
84
+ }),
85
+ z.object({
86
+ id: publishIdSchema,
87
+ state: z.literal("succeeded"),
88
+ outcome: z.enum(["created", "updated", "unchanged"]),
89
+ capturedBaseVersionId: versionIdSchema.nullable().optional(),
90
+ result: z.object({
91
+ space: z.object({ id: spaceIdSchema, liveUrl: z.string().url() }),
92
+ version: z.object({ id: versionIdSchema, immutableUrl: z.string().url() }),
93
+ live: z.object({
94
+ previousVersionId: versionIdSchema.nullable(),
95
+ versionId: versionIdSchema,
96
+ }),
97
+ }),
98
+ }),
99
+ z.object({ id: publishIdSchema, state: z.literal("failed"), errorCode: z.string().min(1) }),
100
+ z.object({ id: publishIdSchema, state: z.literal("cancelled") }),
101
+ z.object({ id: publishIdSchema, state: z.literal("expired") }),
102
+ ]);
103
+ // Cancellation may win during materialization only before the Version exists;
104
+ // afterwards it is not cancelable and the outcome is unchanged.
105
+ const allowedTransitions = {
106
+ awaiting_upload: ["uploaded", "cancelled", "expired"],
107
+ uploaded: ["parked", "materializing", "cancelled", "expired"],
108
+ parked: ["materializing", "cancelled", "expired"],
109
+ materializing: ["succeeded", "failed", "cancelled", "expired"],
110
+ succeeded: [],
111
+ failed: [],
112
+ cancelled: [],
113
+ expired: [],
114
+ };
115
+ export function canTransitionPublish(from, to) {
116
+ return allowedTransitions[from].some((candidate) => candidate === to);
117
+ }
118
+ export function transitionPublish(publish, next) {
119
+ if (publish.id !== next.id ||
120
+ publish.idempotencyKey !== next.idempotencyKey ||
121
+ publish.requestFingerprint !== next.requestFingerprint) {
122
+ throw new Error("A publish transition cannot change the durable publish identity.");
123
+ }
124
+ if (!canTransitionPublish(publish.state, next.state)) {
125
+ throw new Error(`Invalid publish transition: ${publish.state} -> ${next.state}`);
126
+ }
127
+ // Project through the wire schema so fields from the previous variant (e.g. a
128
+ // parked `reason` spread into a materializing publish) never leak downstream.
129
+ return {
130
+ ...publishSchema.parse(next),
131
+ idempotencyKey: next.idempotencyKey,
132
+ requestFingerprint: next.requestFingerprint,
133
+ };
134
+ }
135
+ export function convergePublishAdmission(existing, attempted) {
136
+ if (existing === undefined)
137
+ return { outcome: "created", publish: attempted };
138
+ if (existing.idempotencyKey !== attempted.idempotencyKey) {
139
+ throw new Error("Admission convergence requires one idempotency key.");
140
+ }
141
+ if (existing.requestFingerprint !== attempted.requestFingerprint) {
142
+ return { outcome: "conflict", publish: existing };
143
+ }
144
+ return { outcome: "replayed", publish: existing };
145
+ }
@@ -4,9 +4,9 @@ export declare const pushNewSessionStatusSchema: z.ZodEnum<{
4
4
  failed: "failed";
5
5
  expired: "expired";
6
6
  building: "building";
7
+ publishing: "publishing";
7
8
  waiting_for_push: "waiting_for_push";
8
9
  waiting_for_upload: "waiting_for_upload";
9
- publishing: "publishing";
10
10
  }>;
11
11
  export declare const pushNewSourceKindSchema: z.ZodEnum<{
12
12
  direct_upload: "direct_upload";
@@ -23,9 +23,9 @@ export declare const PushNewSessionSchema: z.ZodObject<{
23
23
  failed: "failed";
24
24
  expired: "expired";
25
25
  building: "building";
26
+ publishing: "publishing";
26
27
  waiting_for_push: "waiting_for_push";
27
28
  waiting_for_upload: "waiting_for_upload";
28
- publishing: "publishing";
29
29
  }>;
30
30
  sourceKind: z.ZodEnum<{
31
31
  direct_upload: "direct_upload";
@@ -68,9 +68,9 @@ export declare const PushNewCreateSessionResponseSchema: z.ZodObject<{
68
68
  failed: "failed";
69
69
  expired: "expired";
70
70
  building: "building";
71
+ publishing: "publishing";
71
72
  waiting_for_push: "waiting_for_push";
72
73
  waiting_for_upload: "waiting_for_upload";
73
- publishing: "publishing";
74
74
  }>;
75
75
  sourceKind: z.ZodEnum<{
76
76
  direct_upload: "direct_upload";
@@ -113,9 +113,9 @@ export declare const PushNewStatusResponseSchema: z.ZodObject<{
113
113
  failed: "failed";
114
114
  expired: "expired";
115
115
  building: "building";
116
+ publishing: "publishing";
116
117
  waiting_for_push: "waiting_for_push";
117
118
  waiting_for_upload: "waiting_for_upload";
118
- publishing: "publishing";
119
119
  }>;
120
120
  expiresAt: z.ZodString;
121
121
  createdAt: z.ZodString;
@@ -10,7 +10,9 @@ export declare const WORST_CASE_QUOTAS: {
10
10
  export type WorstCaseQuotaName = keyof typeof WORST_CASE_QUOTAS;
11
11
  export declare const ANONYMOUS_PUBLISH_CAPS: {
12
12
  readonly maxFileBytes: number;
13
+ readonly maxTotalBytes: number;
13
14
  readonly maxInlineBodyBytes: number;
14
15
  readonly maxFilesPerVersion: 1000;
15
16
  readonly maxPublishesPerIpPerHour: 20;
17
+ readonly maxLifetimeViews: 100;
16
18
  };
@@ -26,6 +26,9 @@ export const WORST_CASE_QUOTAS = {
26
26
  export const ANONYMOUS_PUBLISH_CAPS = {
27
27
  // Per-file ceiling (= Free plan maxFileBytes).
28
28
  maxFileBytes: 50 * 1024 * 1024,
29
+ // Per-version total ceiling (sum of file bytes). Matches the inline body
30
+ // cap so the two publish encodings agree on how big an anonymous site can be.
31
+ maxTotalBytes: 100 * 1024 * 1024,
29
32
  // Inline one-shot publish body cap; tighter than the absolute
30
33
  // maxInlinePublishBodyBytes ceiling above.
31
34
  maxInlineBodyBytes: 100 * 1024 * 1024,
@@ -33,4 +36,9 @@ export const ANONYMOUS_PUBLISH_CAPS = {
33
36
  maxFilesPerVersion: 1000,
34
37
  // Anonymous publish/space-create attempts per IP per hour.
35
38
  maxPublishesPerIpPerHour: WORST_CASE_QUOTAS.maxPublishesPerIpPerHour,
39
+ // Views (non-crawler, status<400 requests) an unclaimed space may serve over
40
+ // its whole claim window before it goes dark behind the claim-nudge
41
+ // tombstone. Enforced by the periodic visit-quota sweep, so it is
42
+ // deliberately approximate — claiming the space lifts it entirely.
43
+ maxLifetimeViews: 100,
36
44
  };
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  export declare const repositoryConnectionTypeSchema: z.ZodEnum<{
3
- connected: "connected";
4
3
  hosted: "hosted";
4
+ connected: "connected";
5
5
  }>;
6
6
  export declare const repositoryConnectionSyncStatusSchema: z.ZodEnum<{
7
7
  failed: "failed";
@@ -19,10 +19,13 @@ export declare const RepositoryConnectionSchema: z.ZodObject<{
19
19
  generic: "generic";
20
20
  }>;
21
21
  connectionType: z.ZodEnum<{
22
- connected: "connected";
23
22
  hosted: "hosted";
23
+ connected: "connected";
24
24
  }>;
25
25
  repositoryId: z.ZodNullable<z.ZodString>;
26
+ installationId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
27
+ cloneUrlConfigured: z.ZodDefault<z.ZodBoolean>;
28
+ upstreamUrlConfigured: z.ZodDefault<z.ZodBoolean>;
26
29
  repositoryName: z.ZodString;
27
30
  repositoryFullName: z.ZodString;
28
31
  defaultBranch: z.ZodString;
@@ -63,8 +66,8 @@ export declare const repositoryConnectionCreateSchema: z.ZodObject<{
63
66
  generic: "generic";
64
67
  }>>;
65
68
  connectionType: z.ZodDefault<z.ZodEnum<{
66
- connected: "connected";
67
69
  hosted: "hosted";
70
+ connected: "connected";
68
71
  }>>;
69
72
  repositoryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
70
73
  repositoryName: z.ZodOptional<z.ZodString>;
@@ -92,8 +95,8 @@ export declare const repositoryConnectionCreateSchema: z.ZodObject<{
92
95
  }, z.core.$strip>;
93
96
  export declare const repositoryConnectionPatchSchema: z.ZodObject<{
94
97
  connectionType: z.ZodOptional<z.ZodEnum<{
95
- connected: "connected";
96
98
  hosted: "hosted";
99
+ connected: "connected";
97
100
  }>>;
98
101
  productionBranch: z.ZodOptional<z.ZodString>;
99
102
  cloneUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -122,6 +125,7 @@ export declare const repositoryImportRemoteSchema: z.ZodObject<{
122
125
  generic: "generic";
123
126
  }>>;
124
127
  repositoryFullName: z.ZodString;
128
+ credential: z.ZodOptional<z.ZodNullable<z.ZodString>>;
125
129
  repositoryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
126
130
  repositoryName: z.ZodOptional<z.ZodString>;
127
131
  defaultBranch: z.ZodDefault<z.ZodString>;
@@ -141,7 +145,6 @@ export declare const repositoryImportRemoteSchema: z.ZodObject<{
141
145
  }, z.core.$strip>>;
142
146
  autoDeployProduction: z.ZodDefault<z.ZodBoolean>;
143
147
  autoDeployPreviews: z.ZodDefault<z.ZodBoolean>;
144
- credential: z.ZodOptional<z.ZodNullable<z.ZodString>>;
145
148
  installationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
146
149
  upstreamUrl: z.ZodString;
147
150
  }, z.core.$strip>;
@@ -181,8 +184,8 @@ export declare const repositoryWebhookDeliveryListQuerySchema: z.ZodObject<{
181
184
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
182
185
  cursor: z.ZodOptional<z.ZodString>;
183
186
  connectionType: z.ZodOptional<z.ZodEnum<{
184
- connected: "connected";
185
187
  hosted: "hosted";
188
+ connected: "connected";
186
189
  }>>;
187
190
  status: z.ZodOptional<z.ZodEnum<{
188
191
  failed: "failed";
@@ -224,8 +227,6 @@ export declare const repositoryWebhookDeliveryListResponseSchema: z.ZodObject<{
224
227
  }, z.core.$strip>;
225
228
  }, z.core.$strip>;
226
229
  export type RepositoryConnection = z.infer<typeof RepositoryConnectionSchema>;
227
- export type RepositoryConnectionCreate = z.infer<typeof repositoryConnectionCreateSchema>;
228
- export type RepositoryConnectionPatch = z.infer<typeof repositoryConnectionPatchSchema>;
229
230
  export type RepositoryImportRemote = z.infer<typeof repositoryImportRemoteSchema>;
230
231
  export type RepositoryConnectionType = z.infer<typeof repositoryConnectionTypeSchema>;
231
232
  export type RepositoryWebhookDelivery = z.infer<typeof RepositoryWebhookDeliverySchema>;
@@ -15,6 +15,19 @@ export const RepositoryConnectionSchema = z.object({
15
15
  provider: gitProvider.describe("Git host family for the repository connection."),
16
16
  connectionType: repositoryConnectionTypeSchema,
17
17
  repositoryId: z.string().nullable(),
18
+ installationId: z
19
+ .string()
20
+ .nullable()
21
+ .default(null)
22
+ .describe("Repository app installation id, when configured."),
23
+ cloneUrlConfigured: z
24
+ .boolean()
25
+ .default(false)
26
+ .describe("Whether a repository clone URL is configured."),
27
+ upstreamUrlConfigured: z
28
+ .boolean()
29
+ .default(false)
30
+ .describe("Whether an upstream repository URL is configured."),
18
31
  repositoryName: z.string(),
19
32
  repositoryFullName: z.string(),
20
33
  defaultBranch: z.string(),
@@ -38,6 +38,7 @@ export declare const ChannelPointerSchema: z.ZodObject<{
38
38
  updatedAt: z.ZodString;
39
39
  }, z.core.$strip>;
40
40
  export type ChannelPointer = z.infer<typeof ChannelPointerSchema>;
41
+ export declare const spaceSettingsDigestSchema: z.ZodString;
41
42
  export declare const SpaceSchema: z.ZodObject<{
42
43
  id: z.ZodString;
43
44
  tenantId: z.ZodString;
@@ -70,6 +71,7 @@ export declare const SpaceSchema: z.ZodObject<{
70
71
  abuse_takedown: "abuse_takedown";
71
72
  tenant_suspended: "tenant_suspended";
72
73
  site_suspended: "site_suspended";
74
+ visit_cap_exceeded: "visit_cap_exceeded";
73
75
  }>;
74
76
  }, z.core.$strip>>;
75
77
  claimState: z.ZodNullable<z.ZodObject<{
@@ -83,7 +85,31 @@ export declare const SpaceSchema: z.ZodObject<{
83
85
  defaultHostname: z.ZodString;
84
86
  publicName: z.ZodString;
85
87
  liveUrl: z.ZodString;
88
+ thumbnail: z.ZodNullable<z.ZodObject<{
89
+ kind: z.ZodEnum<{
90
+ image: "image";
91
+ screenshot: "screenshot";
92
+ }>;
93
+ provider: z.ZodEnum<{
94
+ "wpcom-mshots": "wpcom-mshots";
95
+ "wpcom-site-accelerator": "wpcom-site-accelerator";
96
+ }>;
97
+ url: z.ZodString;
98
+ sourceUrl: z.ZodString;
99
+ }, z.core.$strip>>;
86
100
  dataLocation: z.ZodString;
101
+ region: z.ZodString;
102
+ placementMode: z.ZodEnum<{
103
+ shared: "shared";
104
+ dedicated: "dedicated";
105
+ }>;
106
+ burstable: z.ZodNullable<z.ZodBoolean>;
107
+ archivedBytes: z.ZodNumber;
108
+ tierPolicy: z.ZodEnum<{
109
+ auto: "auto";
110
+ always_hot: "always_hot";
111
+ }>;
112
+ moving: z.ZodBoolean;
87
113
  channels: z.ZodRecord<z.ZodString, z.ZodObject<{
88
114
  versionId: z.ZodOptional<z.ZodString>;
89
115
  weighted: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -98,6 +124,7 @@ export declare const SpaceSchema: z.ZodObject<{
98
124
  path: z.ZodString;
99
125
  status: z.ZodNumber;
100
126
  }, z.core.$strip>]>>;
127
+ cleanUrls: z.ZodOptional<z.ZodBoolean>;
101
128
  listing: z.ZodOptional<z.ZodBoolean>;
102
129
  meta: z.ZodOptional<z.ZodObject<{
103
130
  title: z.ZodOptional<z.ZodString>;
@@ -130,6 +157,7 @@ export declare const SpaceSchema: z.ZodObject<{
130
157
  reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
131
158
  }, z.core.$strip>>>;
132
159
  }, z.core.$strip>>;
160
+ requireReview: z.ZodOptional<z.ZodBoolean>;
133
161
  }, z.core.$strip>>;
134
162
  }, z.core.$strip>>;
135
163
  templates: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -156,6 +184,15 @@ export declare const SpaceSchema: z.ZodObject<{
156
184
  }, z.core.$strip>>>;
157
185
  }, z.core.$strip>>;
158
186
  }, z.core.$strip>>;
187
+ pages: z.ZodOptional<z.ZodObject<{
188
+ theme: z.ZodOptional<z.ZodObject<{
189
+ accent: z.ZodOptional<z.ZodString>;
190
+ background: z.ZodOptional<z.ZodString>;
191
+ logo: z.ZodOptional<z.ZodString>;
192
+ name: z.ZodOptional<z.ZodString>;
193
+ fontFamily: z.ZodOptional<z.ZodString>;
194
+ }, z.core.$strip>>;
195
+ }, z.core.$strip>>;
159
196
  build: z.ZodOptional<z.ZodObject<{
160
197
  rootDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
161
198
  installDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -168,6 +205,15 @@ export declare const SpaceSchema: z.ZodObject<{
168
205
  allowUnsupportedPlatformFeatures: z.ZodOptional<z.ZodBoolean>;
169
206
  timeoutSeconds: z.ZodOptional<z.ZodNumber>;
170
207
  }, z.core.$strict>>;
208
+ placement: z.ZodOptional<z.ZodObject<{
209
+ region: z.ZodOptional<z.ZodString>;
210
+ mode: z.ZodOptional<z.ZodEnum<{
211
+ shared: "shared";
212
+ dedicated: "dedicated";
213
+ }>>;
214
+ burstable: z.ZodOptional<z.ZodBoolean>;
215
+ }, z.core.$strict>>;
216
+ markdownNegotiation: z.ZodOptional<z.ZodBoolean>;
171
217
  experimental_gutenberg: z.ZodOptional<z.ZodBoolean>;
172
218
  inject: z.ZodOptional<z.ZodObject<{
173
219
  head: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -176,11 +222,15 @@ export declare const SpaceSchema: z.ZodObject<{
176
222
  noscript: z.ZodOptional<z.ZodArray<z.ZodString>>;
177
223
  }, z.core.$strip>>;
178
224
  }, z.core.$strip>>;
225
+ settingsDigest: z.ZodString;
179
226
  noindex: z.ZodBoolean;
180
227
  policy: z.ZodNullable<z.ZodObject<{
181
228
  rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
229
+ id: z.ZodOptional<z.ZodString>;
182
230
  match: z.ZodDefault<z.ZodObject<{
183
231
  host: z.ZodOptional<z.ZodString>;
232
+ hostPattern: z.ZodOptional<z.ZodString>;
233
+ hostTemplate: z.ZodOptional<z.ZodString>;
184
234
  pathPattern: z.ZodOptional<z.ZodString>;
185
235
  channel: z.ZodOptional<z.ZodString>;
186
236
  ipCidrs: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -197,29 +247,45 @@ export declare const SpaceSchema: z.ZodObject<{
197
247
  challenge: "challenge";
198
248
  }>;
199
249
  auth: z.ZodOptional<z.ZodObject<{
200
- password: z.ZodOptional<z.ZodObject<{
250
+ requiredGrants: z.ZodArray<z.ZodString>;
251
+ issuers: z.ZodOptional<z.ZodArray<z.ZodObject<{
252
+ kid: z.ZodString;
253
+ alg: z.ZodLiteral<"EdDSA">;
254
+ publicKey: z.ZodString;
255
+ grantNamespaces: z.ZodArray<z.ZodString>;
256
+ }, z.core.$strip>>>;
257
+ acquire: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
258
+ type: z.ZodLiteral<"password">;
201
259
  ref: z.ZodString;
202
260
  transport: z.ZodEnum<{
203
261
  basic: "basic";
204
262
  form: "form";
205
263
  }>;
206
264
  username: z.ZodOptional<z.ZodString>;
207
- }, z.core.$strip>>;
208
- token: z.ZodOptional<z.ZodObject<{
209
- requiredGrants: z.ZodArray<z.ZodString>;
210
- issuers: z.ZodOptional<z.ZodArray<z.ZodObject<{
211
- kid: z.ZodString;
212
- alg: z.ZodLiteral<"EdDSA">;
213
- publicKey: z.ZodString;
214
- grantNamespaces: z.ZodArray<z.ZodString>;
215
- }, z.core.$strip>>>;
216
- loginUrl: z.ZodOptional<z.ZodString>;
217
- cookieName: z.ZodOptional<z.ZodString>;
218
- }, z.core.$strip>>;
265
+ }, z.core.$strip>, z.ZodObject<{
266
+ type: z.ZodLiteral<"login">;
267
+ url: z.ZodString;
268
+ label: z.ZodOptional<z.ZodString>;
269
+ }, z.core.$strip>], "type">>>;
219
270
  }, z.core.$strip>>;
271
+ managedBy: z.ZodOptional<z.ZodEnum<{
272
+ sharing: "sharing";
273
+ firewall: "firewall";
274
+ file_share: "file_share";
275
+ cast_reviewer: "cast_reviewer";
276
+ team_default: "team_default";
277
+ }>>;
278
+ expiresAt: z.ZodOptional<z.ZodNumber>;
220
279
  reasonCode: z.ZodOptional<z.ZodString>;
221
280
  message: z.ZodOptional<z.ZodString>;
222
281
  }, z.core.$strip>>>;
282
+ issuers: z.ZodOptional<z.ZodArray<z.ZodObject<{
283
+ kid: z.ZodString;
284
+ alg: z.ZodLiteral<"EdDSA">;
285
+ publicKey: z.ZodString;
286
+ grantNamespaces: z.ZodArray<z.ZodString>;
287
+ }, z.core.$strip>>>;
288
+ sessionVersion: z.ZodOptional<z.ZodNumber>;
223
289
  }, z.core.$strip>>;
224
290
  operation: z.ZodNullable<z.ZodObject<{
225
291
  id: z.ZodString;
@@ -373,6 +439,7 @@ export declare const VersionSchema: z.ZodObject<{
373
439
  path: z.ZodString;
374
440
  status: z.ZodNumber;
375
441
  }, z.core.$strip>]>>;
442
+ cleanUrls: z.ZodOptional<z.ZodBoolean>;
376
443
  listing: z.ZodOptional<z.ZodBoolean>;
377
444
  meta: z.ZodOptional<z.ZodObject<{
378
445
  title: z.ZodOptional<z.ZodString>;
@@ -405,6 +472,7 @@ export declare const VersionSchema: z.ZodObject<{
405
472
  reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
406
473
  }, z.core.$strip>>>;
407
474
  }, z.core.$strip>>;
475
+ requireReview: z.ZodOptional<z.ZodBoolean>;
408
476
  }, z.core.$strip>>;
409
477
  }, z.core.$strip>>;
410
478
  templates: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -431,6 +499,15 @@ export declare const VersionSchema: z.ZodObject<{
431
499
  }, z.core.$strip>>>;
432
500
  }, z.core.$strip>>;
433
501
  }, z.core.$strip>>;
502
+ pages: z.ZodOptional<z.ZodObject<{
503
+ theme: z.ZodOptional<z.ZodObject<{
504
+ accent: z.ZodOptional<z.ZodString>;
505
+ background: z.ZodOptional<z.ZodString>;
506
+ logo: z.ZodOptional<z.ZodString>;
507
+ name: z.ZodOptional<z.ZodString>;
508
+ fontFamily: z.ZodOptional<z.ZodString>;
509
+ }, z.core.$strip>>;
510
+ }, z.core.$strip>>;
434
511
  build: z.ZodOptional<z.ZodObject<{
435
512
  rootDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
436
513
  installDirectory: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -443,6 +520,15 @@ export declare const VersionSchema: z.ZodObject<{
443
520
  allowUnsupportedPlatformFeatures: z.ZodOptional<z.ZodBoolean>;
444
521
  timeoutSeconds: z.ZodOptional<z.ZodNumber>;
445
522
  }, z.core.$strict>>;
523
+ placement: z.ZodOptional<z.ZodObject<{
524
+ region: z.ZodOptional<z.ZodString>;
525
+ mode: z.ZodOptional<z.ZodEnum<{
526
+ shared: "shared";
527
+ dedicated: "dedicated";
528
+ }>>;
529
+ burstable: z.ZodOptional<z.ZodBoolean>;
530
+ }, z.core.$strict>>;
531
+ markdownNegotiation: z.ZodOptional<z.ZodBoolean>;
446
532
  experimental_gutenberg: z.ZodOptional<z.ZodBoolean>;
447
533
  inject: z.ZodOptional<z.ZodObject<{
448
534
  head: z.ZodOptional<z.ZodArray<z.ZodString>>;