@spacefast/common 0.0.2

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 (202) hide show
  1. package/README.md +42 -0
  2. package/dist/brand.d.ts +15 -0
  3. package/dist/brand.js +24 -0
  4. package/dist/config/domains.d.ts +30 -0
  5. package/dist/config/domains.js +75 -0
  6. package/dist/config/index.d.ts +1 -0
  7. package/dist/config/index.js +3 -0
  8. package/dist/contracts/abuse.d.ts +93 -0
  9. package/dist/contracts/abuse.js +50 -0
  10. package/dist/contracts/access.d.ts +409 -0
  11. package/dist/contracts/access.js +396 -0
  12. package/dist/contracts/account.d.ts +28 -0
  13. package/dist/contracts/account.js +54 -0
  14. package/dist/contracts/activity.d.ts +118 -0
  15. package/dist/contracts/activity.js +180 -0
  16. package/dist/contracts/analytics.d.ts +56 -0
  17. package/dist/contracts/analytics.js +91 -0
  18. package/dist/contracts/annotations.d.ts +327 -0
  19. package/dist/contracts/annotations.js +234 -0
  20. package/dist/contracts/api-keys.d.ts +517 -0
  21. package/dist/contracts/api-keys.js +235 -0
  22. package/dist/contracts/archives.d.ts +332 -0
  23. package/dist/contracts/archives.js +120 -0
  24. package/dist/contracts/auth.d.ts +86 -0
  25. package/dist/contracts/auth.js +82 -0
  26. package/dist/contracts/beta.d.ts +106 -0
  27. package/dist/contracts/beta.js +104 -0
  28. package/dist/contracts/billing.d.ts +328 -0
  29. package/dist/contracts/billing.js +203 -0
  30. package/dist/contracts/builds.d.ts +504 -0
  31. package/dist/contracts/builds.js +248 -0
  32. package/dist/contracts/channels.d.ts +49 -0
  33. package/dist/contracts/channels.js +51 -0
  34. package/dist/contracts/common.d.ts +238 -0
  35. package/dist/contracts/common.js +175 -0
  36. package/dist/contracts/deployments.d.ts +574 -0
  37. package/dist/contracts/deployments.js +97 -0
  38. package/dist/contracts/device-auth.d.ts +194 -0
  39. package/dist/contracts/device-auth.js +162 -0
  40. package/dist/contracts/domains.d.ts +6115 -0
  41. package/dist/contracts/domains.js +1435 -0
  42. package/dist/contracts/enums.d.ts +196 -0
  43. package/dist/contracts/enums.js +211 -0
  44. package/dist/contracts/error-code-meta.d.ts +1560 -0
  45. package/dist/contracts/error-code-meta.js +400 -0
  46. package/dist/contracts/error-codes.d.ts +13 -0
  47. package/dist/contracts/error-codes.js +416 -0
  48. package/dist/contracts/events.d.ts +398 -0
  49. package/dist/contracts/events.js +320 -0
  50. package/dist/contracts/fast-domain-search.d.ts +19 -0
  51. package/dist/contracts/fast-domain-search.js +22 -0
  52. package/dist/contracts/features.d.ts +240 -0
  53. package/dist/contracts/features.js +406 -0
  54. package/dist/contracts/git.d.ts +288 -0
  55. package/dist/contracts/git.js +116 -0
  56. package/dist/contracts/ids.d.ts +35 -0
  57. package/dist/contracts/ids.js +45 -0
  58. package/dist/contracts/intercom.d.ts +6 -0
  59. package/dist/contracts/intercom.js +5 -0
  60. package/dist/contracts/internal.d.ts +103 -0
  61. package/dist/contracts/internal.js +92 -0
  62. package/dist/contracts/mcp.d.ts +788 -0
  63. package/dist/contracts/mcp.js +161 -0
  64. package/dist/contracts/me.d.ts +81 -0
  65. package/dist/contracts/me.js +104 -0
  66. package/dist/contracts/oauth-resources.d.ts +30 -0
  67. package/dist/contracts/oauth-resources.js +61 -0
  68. package/dist/contracts/operations.d.ts +54 -0
  69. package/dist/contracts/operations.js +14 -0
  70. package/dist/contracts/plan-policy.d.ts +85 -0
  71. package/dist/contracts/plan-policy.js +75 -0
  72. package/dist/contracts/platform.d.ts +359 -0
  73. package/dist/contracts/platform.js +216 -0
  74. package/dist/contracts/push-new.d.ts +156 -0
  75. package/dist/contracts/push-new.js +52 -0
  76. package/dist/contracts/quotas.d.ts +16 -0
  77. package/dist/contracts/quotas.js +36 -0
  78. package/dist/contracts/repository-connections.d.ts +231 -0
  79. package/dist/contracts/repository-connections.js +106 -0
  80. package/dist/contracts/resources.d.ts +529 -0
  81. package/dist/contracts/resources.js +209 -0
  82. package/dist/contracts/routes.d.ts +45 -0
  83. package/dist/contracts/routes.js +31 -0
  84. package/dist/contracts/runtime-api.d.ts +449 -0
  85. package/dist/contracts/runtime-api.js +513 -0
  86. package/dist/contracts/sites.d.ts +393 -0
  87. package/dist/contracts/sites.js +121 -0
  88. package/dist/contracts/slugs.d.ts +31 -0
  89. package/dist/contracts/slugs.js +47 -0
  90. package/dist/contracts/space-config.d.ts +216 -0
  91. package/dist/contracts/space-config.js +237 -0
  92. package/dist/contracts/space-theme.d.ts +25 -0
  93. package/dist/contracts/space-theme.js +49 -0
  94. package/dist/contracts/spaces.d.ts +2760 -0
  95. package/dist/contracts/spaces.js +589 -0
  96. package/dist/contracts/superadmin-activity.d.ts +205 -0
  97. package/dist/contracts/superadmin-activity.js +107 -0
  98. package/dist/contracts/superadmin-emails.d.ts +212 -0
  99. package/dist/contracts/superadmin-emails.js +112 -0
  100. package/dist/contracts/superadmin-queues.d.ts +414 -0
  101. package/dist/contracts/superadmin-queues.js +202 -0
  102. package/dist/contracts/superadmin-runtime.d.ts +27 -0
  103. package/dist/contracts/superadmin-runtime.js +38 -0
  104. package/dist/contracts/superadmin-spaces.d.ts +429 -0
  105. package/dist/contracts/superadmin-spaces.js +82 -0
  106. package/dist/contracts/superadmin-tenants.d.ts +180 -0
  107. package/dist/contracts/superadmin-tenants.js +117 -0
  108. package/dist/contracts/superadmin.d.ts +654 -0
  109. package/dist/contracts/superadmin.js +309 -0
  110. package/dist/contracts/tags.d.ts +1140 -0
  111. package/dist/contracts/tags.js +1050 -0
  112. package/dist/contracts/teams.d.ts +233 -0
  113. package/dist/contracts/teams.js +174 -0
  114. package/dist/contracts/telemetry.d.ts +2 -0
  115. package/dist/contracts/telemetry.js +1 -0
  116. package/dist/contracts/transfers.d.ts +105 -0
  117. package/dist/contracts/transfers.js +48 -0
  118. package/dist/contracts/variables.d.ts +189 -0
  119. package/dist/contracts/variables.js +82 -0
  120. package/dist/contracts/webhooks.d.ts +159 -0
  121. package/dist/contracts/webhooks.js +59 -0
  122. package/dist/contracts/zero.d.ts +1538 -0
  123. package/dist/contracts/zero.js +755 -0
  124. package/dist/docs/agent-prose.d.ts +35 -0
  125. package/dist/docs/agent-prose.js +153 -0
  126. package/dist/docs/agent-setup.d.ts +6 -0
  127. package/dist/docs/agent-setup.js +164 -0
  128. package/dist/docs/agent-solutions.d.ts +110 -0
  129. package/dist/docs/agent-solutions.js +181 -0
  130. package/dist/docs/error-docs.d.ts +12 -0
  131. package/dist/docs/error-docs.js +1601 -0
  132. package/dist/docs/skill-distribution.d.ts +12 -0
  133. package/dist/docs/skill-distribution.js +18 -0
  134. package/dist/domain-exploration.d.ts +108 -0
  135. package/dist/domain-exploration.js +488 -0
  136. package/dist/domain-normalize.d.ts +1 -0
  137. package/dist/domain-normalize.js +14 -0
  138. package/dist/domain-zones.d.ts +1 -0
  139. package/dist/domain-zones.js +5272 -0
  140. package/dist/index.d.ts +1 -0
  141. package/dist/index.js +1 -0
  142. package/dist/utils/access-policy.d.ts +39 -0
  143. package/dist/utils/access-policy.js +232 -0
  144. package/dist/utils/api.d.ts +4 -0
  145. package/dist/utils/api.js +13 -0
  146. package/dist/utils/auth-redirect.d.ts +1 -0
  147. package/dist/utils/auth-redirect.js +48 -0
  148. package/dist/utils/auth.d.ts +5 -0
  149. package/dist/utils/auth.js +13 -0
  150. package/dist/utils/build-settings.d.ts +49 -0
  151. package/dist/utils/build-settings.js +366 -0
  152. package/dist/utils/claim-token.d.ts +1 -0
  153. package/dist/utils/claim-token.js +9 -0
  154. package/dist/utils/collections.d.ts +1 -0
  155. package/dist/utils/collections.js +5 -0
  156. package/dist/utils/concurrency.d.ts +1 -0
  157. package/dist/utils/concurrency.js +18 -0
  158. package/dist/utils/content-type.d.ts +10 -0
  159. package/dist/utils/content-type.js +145 -0
  160. package/dist/utils/error-display.d.ts +7 -0
  161. package/dist/utils/error-display.js +42 -0
  162. package/dist/utils/error.d.ts +1 -0
  163. package/dist/utils/error.js +3 -0
  164. package/dist/utils/generate-space-name.d.ts +14 -0
  165. package/dist/utils/generate-space-name.js +95 -0
  166. package/dist/utils/git-repository.d.ts +5 -0
  167. package/dist/utils/git-repository.js +99 -0
  168. package/dist/utils/guards.d.ts +1 -0
  169. package/dist/utils/guards.js +3 -0
  170. package/dist/utils/publish-detection.d.ts +10 -0
  171. package/dist/utils/publish-detection.js +118 -0
  172. package/dist/utils/publish-policy.d.ts +69 -0
  173. package/dist/utils/publish-policy.js +429 -0
  174. package/dist/utils/query-client.d.ts +7 -0
  175. package/dist/utils/query-client.js +21 -0
  176. package/dist/utils/query-keys.d.ts +75 -0
  177. package/dist/utils/query-keys.js +78 -0
  178. package/dist/utils/runtime-paths.d.ts +7 -0
  179. package/dist/utils/runtime-paths.js +28 -0
  180. package/dist/utils/runtime-upload.d.ts +19 -0
  181. package/dist/utils/runtime-upload.js +27 -0
  182. package/dist/utils/slug.d.ts +5 -0
  183. package/dist/utils/slug.js +13 -0
  184. package/dist/utils/space-config.d.ts +75 -0
  185. package/dist/utils/space-config.js +415 -0
  186. package/dist/utils/space-theme.d.ts +16 -0
  187. package/dist/utils/space-theme.js +89 -0
  188. package/dist/utils/static-runtime-policy.d.ts +17 -0
  189. package/dist/utils/static-runtime-policy.js +103 -0
  190. package/dist/utils/upload-session.d.ts +34 -0
  191. package/dist/utils/upload-session.js +69 -0
  192. package/dist/utils/urls.d.ts +2 -0
  193. package/dist/utils/urls.js +7 -0
  194. package/dist/utils/version-path.d.ts +6 -0
  195. package/dist/utils/version-path.js +51 -0
  196. package/dist/utils/wpcom-auth-redirects.d.ts +14 -0
  197. package/dist/utils/wpcom-auth-redirects.js +49 -0
  198. package/dist/utils/zero-realtime-signature.d.ts +12 -0
  199. package/dist/utils/zero-realtime-signature.js +45 -0
  200. package/dist/vocabulary.d.ts +230 -0
  201. package/dist/vocabulary.js +218 -0
  202. package/package.json +58 -0
@@ -0,0 +1,180 @@
1
+ import { z } from "zod";
2
+ import { AnyObjectSchema, CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
3
+ // The single event taxonomy (internal-docs/platform.md "Event taxonomy").
4
+ // Every emitted activity event and every webhook `events` filter selects on
5
+ // these codes. Growth is additive-only: codes are never renamed or removed.
6
+ // `appendActivityEvent` is typed against this list, so emitting a code that is
7
+ // not in the table is a typecheck (CI) failure.
8
+ export const ACTIVITY_EVENT_CODES = [
9
+ // space
10
+ "space.created",
11
+ "space.claimed",
12
+ "space.transferred",
13
+ "space.moved",
14
+ "space.expired",
15
+ "space.disabled",
16
+ "space.enabled",
17
+ "space.deleted",
18
+ "space.config_updated",
19
+ "space.password_updated",
20
+ // version
21
+ "version.created",
22
+ "version.ready",
23
+ "version.warning",
24
+ "version.failed",
25
+ "version.expired",
26
+ "version.canceled",
27
+ "version.deleted",
28
+ "version.retention_warning",
29
+ "version.retention_deleted",
30
+ // channel
31
+ "channel.promoted",
32
+ // build
33
+ "build.created",
34
+ "build.succeeded",
35
+ "build.failed",
36
+ "build.canceled",
37
+ "build.skipped",
38
+ // domain
39
+ "domain.created",
40
+ "domain.verified",
41
+ "domain.verification_failed",
42
+ "domain.control_lost",
43
+ "domain.dns_updated",
44
+ "domain.nameservers_updated",
45
+ "domain.registration_purchased",
46
+ "domain.registration_renewed",
47
+ "domain.registration_expiring",
48
+ "domain.registration_expired",
49
+ "domain.transfer_in_started",
50
+ "domain.transfer_out_started",
51
+ "domain.deleted",
52
+ // binding
53
+ "binding.created",
54
+ "binding.activated",
55
+ "binding.blocked",
56
+ "binding.deleted",
57
+ // transfer
58
+ "transfer.requested",
59
+ "transfer.confirmed",
60
+ "transfer.completed",
61
+ "transfer.canceled",
62
+ "transfer.expired",
63
+ "transfer.failed",
64
+ // variable (key-level only; never values)
65
+ "variable.updated",
66
+ "variable.deleted",
67
+ // api_key
68
+ "api_key.created",
69
+ "api_key.updated",
70
+ "api_key.revoked",
71
+ // webhook (DELETE is a soft-disable that emits webhook.disabled; there is no
72
+ // webhook.deleted event — internal-docs/platform.md "Webhook DELETE")
73
+ "webhook.created",
74
+ "webhook.updated",
75
+ "webhook.secret_rotated",
76
+ "webhook.disabled",
77
+ // team (builds_deploys_quota_exceeded is a shipped additive extension: the
78
+ // pooled monthly builds+deploys meter is SOFT — it tracks, never blocks)
79
+ "team.updated",
80
+ "team.member_added",
81
+ "team.member_removed",
82
+ "team.member_role_updated",
83
+ "team.builds_deploys_quota_exceeded",
84
+ // tenant (tenant.deleted is a shipped additive extension)
85
+ "tenant.past_due",
86
+ "tenant.suspended",
87
+ "tenant.reactivated",
88
+ "tenant.deleted",
89
+ // export / import
90
+ "export.ready",
91
+ "export.failed",
92
+ "import.ready",
93
+ "import.failed",
94
+ // annotations
95
+ "annotation.token_minted",
96
+ "annotation.created",
97
+ "annotation.comment_created",
98
+ "annotation.resolved",
99
+ "annotation.reopened",
100
+ "annotation.archived",
101
+ // abuse (additive extension: operator-tunable abuse-control telemetry)
102
+ "abuse_report.created",
103
+ "abuse_report.updated",
104
+ // claim (additive extension: a claim attempt against a taken-down space is
105
+ // flagged, never silently 404ed — internal-docs/platform.md "Abuse Posture")
106
+ "claim.blocked_takedown",
107
+ // user (additive extension: account lifecycle plus the 2FA and
108
+ // admin-impersonation effects that must surface through ActivityEvent —
109
+ // internal-docs/platform.md Better Auth usage). `user.created` fires once on
110
+ // signup; `user.signed_in` fires per non-impersonation session creation;
111
+ // `user.deleted` fires on account deletion and retains the analyticsId in
112
+ // its details so right-to-erasure can be completed in every provider.
113
+ "user.created",
114
+ "user.signed_in",
115
+ "user.deleted",
116
+ "user.impersonation_started",
117
+ "user.impersonation_stopped",
118
+ "user.two_factor_enabled",
119
+ "user.two_factor_disabled",
120
+ ];
121
+ const ACTIVITY_EVENT_CODE_SET = new Set(ACTIVITY_EVENT_CODES);
122
+ const ACTIVITY_EVENT_RESOURCES = new Set(ACTIVITY_EVENT_CODES.map((code) => code.split(".", 1)[0]));
123
+ export function isActivityEventCode(value) {
124
+ return ACTIVITY_EVENT_CODE_SET.has(value);
125
+ }
126
+ // Webhook `events` filters accept exact codes, prefix wildcards ("version.*"),
127
+ // and the catch-all ["*"].
128
+ export function isValidActivityEventFilter(filter) {
129
+ if (filter === "*") {
130
+ return true;
131
+ }
132
+ if (filter.endsWith(".*")) {
133
+ return ACTIVITY_EVENT_RESOURCES.has(filter.slice(0, -2));
134
+ }
135
+ return ACTIVITY_EVENT_CODE_SET.has(filter);
136
+ }
137
+ export function matchesActivityEventFilters(filters, code) {
138
+ return filters.some((filter) => filter === "*" ||
139
+ filter === code ||
140
+ (filter.endsWith(".*") && code.startsWith(filter.slice(0, -1))));
141
+ }
142
+ export const activityActorSchema = z.discriminatedUnion("type", [
143
+ z.object({ type: z.literal("user"), id: z.string().min(1) }),
144
+ z.object({ type: z.literal("api_key"), id: z.string().min(1) }),
145
+ z.object({ type: z.literal("oauth_client"), id: z.string().min(1) }),
146
+ z.object({ type: z.literal("anonymous_claim"), id: z.string().min(1) }),
147
+ z.object({ type: z.literal("system"), id: z.string().min(1) }),
148
+ ]);
149
+ export const activityPrincipalSchema = z.object({
150
+ tenantId: z.string().min(1),
151
+ principalType: z.enum(["team", "external"]),
152
+ principalId: z.string().min(1),
153
+ });
154
+ export const activityEventSchema = z.object({
155
+ id: z.string(),
156
+ sequence: z.number().int().nonnegative(),
157
+ tenantId: z.string(),
158
+ principal: activityPrincipalSchema.nullable(),
159
+ spaceId: z.string().nullable(),
160
+ actor: activityActorSchema,
161
+ code: z.string(),
162
+ message: z.string(),
163
+ details: AnyObjectSchema.nullable(),
164
+ createdAt: z.string().datetime(),
165
+ });
166
+ export const activityQuerySchema = cursorListQuerySchema.extend({
167
+ principalType: z
168
+ .enum(["team", "external"])
169
+ .optional()
170
+ .describe("Filter to events owned by a team or an external customer principal."),
171
+ principalId: z.string().min(1).optional().describe("Filter to a single principal id."),
172
+ spaceId: z.string().min(1).optional().describe("Filter to events for one space."),
173
+ code: z.string().min(1).optional().describe("Filter to one event code, e.g. `space.created`."),
174
+ since: z.string().datetime().optional().describe("Only events at or after this time."),
175
+ until: z.string().datetime().optional().describe("Only events at or before this time."),
176
+ });
177
+ export const activityListResponseSchema = z.object({
178
+ data: z.array(activityEventSchema),
179
+ pagination: CursorPaginationSchema,
180
+ });
@@ -0,0 +1,56 @@
1
+ import { z } from "zod";
2
+ export declare const DOMAIN_SSH_ANALYTICS_EVENTS: readonly ["domain_ssh_session_started", "domain_ssh_session_ended", "domain_ssh_lookup_requested"];
3
+ export declare const ANALYTICS_EVENTS: readonly ["version_intent_created", "version_finalize_queued", "version_promote_queued", "publish_receipt_created", "feature_blocked", "limit_tripped", "domain_ssh_session_started", "domain_ssh_session_ended", "domain_ssh_lookup_requested"];
4
+ export declare const analyticsEventSchema: z.ZodEnum<{
5
+ domain_ssh_session_started: "domain_ssh_session_started";
6
+ domain_ssh_session_ended: "domain_ssh_session_ended";
7
+ domain_ssh_lookup_requested: "domain_ssh_lookup_requested";
8
+ version_intent_created: "version_intent_created";
9
+ version_finalize_queued: "version_finalize_queued";
10
+ version_promote_queued: "version_promote_queued";
11
+ publish_receipt_created: "publish_receipt_created";
12
+ feature_blocked: "feature_blocked";
13
+ limit_tripped: "limit_tripped";
14
+ }>;
15
+ export type AnalyticsEvent = z.infer<typeof analyticsEventSchema>;
16
+ export declare const DOMAIN_SSH_ANALYTICS_MAX_UNITS = 160;
17
+ export declare const domainSshAnalyticsEventSchema: z.ZodObject<{
18
+ action: z.ZodOptional<z.ZodEnum<{
19
+ suggestions: "suggestions";
20
+ whois: "whois";
21
+ availability: "availability";
22
+ }>>;
23
+ cols: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
24
+ durationMs: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
25
+ event: z.ZodEnum<{
26
+ domain_ssh_session_started: "domain_ssh_session_started";
27
+ domain_ssh_session_ended: "domain_ssh_session_ended";
28
+ domain_ssh_lookup_requested: "domain_ssh_lookup_requested";
29
+ }>;
30
+ reason: z.ZodOptional<z.ZodEnum<{
31
+ closed: "closed";
32
+ ended: "ended";
33
+ exec_rejected: "exec_rejected";
34
+ lookup_rate_limited: "lookup_rate_limited";
35
+ renderer_failed: "renderer_failed";
36
+ session_limit: "session_limit";
37
+ shutdown: "shutdown";
38
+ started: "started";
39
+ }>>;
40
+ rows: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
41
+ sessionId: z.ZodString;
42
+ sourceFamily: z.ZodDefault<z.ZodEnum<{
43
+ unknown: "unknown";
44
+ ipv4: "ipv4";
45
+ ipv6: "ipv6";
46
+ }>>;
47
+ sourceHash: z.ZodOptional<z.ZodString>;
48
+ units: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
49
+ }, z.core.$strip>;
50
+ export type DomainSshAnalyticsPayload = z.infer<typeof domainSshAnalyticsEventSchema>;
51
+ export type DomainSshAnalyticsEvent = DomainSshAnalyticsPayload["event"];
52
+ export type DomainSshSourceFamily = DomainSshAnalyticsPayload["sourceFamily"];
53
+ export declare const TRACKS_EVENT_PREFIX = "stattic";
54
+ export declare function tracksEventName(name: string): string;
55
+ export declare function tracksPropertyName(name: string): string;
56
+ export declare function tracksProperties(properties: Record<string, unknown>): Record<string, string | number | boolean>;
@@ -0,0 +1,91 @@
1
+ import { z } from "zod";
2
+ export const DOMAIN_SSH_ANALYTICS_EVENTS = [
3
+ "domain_ssh_session_started",
4
+ "domain_ssh_session_ended",
5
+ "domain_ssh_lookup_requested",
6
+ ];
7
+ // Direct product analytics events. These cover request/funnel moments that the
8
+ // activity taxonomy (contracts/activity.ts) intentionally does NOT record —
9
+ // queue requests, anonymous publish receipts, gating decisions. Everything
10
+ // that IS an activity event reaches the analytics providers through the
11
+ // activity fan-out instead, so a business moment is never captured twice.
12
+ export const ANALYTICS_EVENTS = [
13
+ "version_intent_created",
14
+ "version_finalize_queued",
15
+ "version_promote_queued",
16
+ "publish_receipt_created",
17
+ "feature_blocked",
18
+ "limit_tripped",
19
+ ...DOMAIN_SSH_ANALYTICS_EVENTS,
20
+ ];
21
+ export const analyticsEventSchema = z.enum(ANALYTICS_EVENTS);
22
+ export const DOMAIN_SSH_ANALYTICS_MAX_UNITS = 160;
23
+ export const domainSshAnalyticsEventSchema = z.object({
24
+ action: z.enum(["suggestions", "availability", "whois"]).optional(),
25
+ cols: z.coerce.number().int().min(1).max(500).optional(),
26
+ durationMs: z.coerce
27
+ .number()
28
+ .int()
29
+ .min(0)
30
+ .max(24 * 60 * 60 * 1000)
31
+ .optional(),
32
+ event: z.enum(DOMAIN_SSH_ANALYTICS_EVENTS),
33
+ reason: z
34
+ .enum([
35
+ "closed",
36
+ "ended",
37
+ "exec_rejected",
38
+ "lookup_rate_limited",
39
+ "renderer_failed",
40
+ "session_limit",
41
+ "shutdown",
42
+ "started",
43
+ ])
44
+ .optional(),
45
+ rows: z.coerce.number().int().min(1).max(200).optional(),
46
+ sessionId: z
47
+ .string()
48
+ .trim()
49
+ .min(8)
50
+ .max(96)
51
+ .regex(/^[A-Za-z0-9:_-]+$/),
52
+ sourceFamily: z.enum(["ipv4", "ipv6", "unknown"]).default("unknown"),
53
+ sourceHash: z
54
+ .string()
55
+ .trim()
56
+ .regex(/^[a-f0-9]{64}$/)
57
+ .optional(),
58
+ units: z.coerce.number().int().min(1).max(DOMAIN_SSH_ANALYTICS_MAX_UNITS).optional(),
59
+ });
60
+ // Tracks (Automattic analytics) naming rules, shared by the browser pixel
61
+ // client and the control-plane REST client: event names are
62
+ // `stattic_<noun>_<verb>` snake_case tokens and property names are lowercase
63
+ // snake_case (calypso-analytics validation rules). Internal names use dots
64
+ // (`space.created`, `cli.command`) and camelCase details, so both normalize.
65
+ export const TRACKS_EVENT_PREFIX = "stattic";
66
+ export function tracksEventName(name) {
67
+ const normalized = name
68
+ .toLowerCase()
69
+ .replace(/[^a-z0-9]+/g, "_")
70
+ .replace(/^_+|_+$/g, "");
71
+ return `${TRACKS_EVENT_PREFIX}_${normalized}`;
72
+ }
73
+ export function tracksPropertyName(name) {
74
+ return name
75
+ .replace(/([a-z0-9])([A-Z])/g, "$1_$2")
76
+ .toLowerCase()
77
+ .replace(/[^a-z0-9_]+/g, "_")
78
+ .replace(/^([0-9])/, "_$1");
79
+ }
80
+ export function tracksProperties(properties) {
81
+ const result = {};
82
+ for (const [key, value] of Object.entries(properties)) {
83
+ if (value === null || value === undefined) {
84
+ continue;
85
+ }
86
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
87
+ result[tracksPropertyName(key)] = value;
88
+ }
89
+ }
90
+ return result;
91
+ }
@@ -0,0 +1,327 @@
1
+ import { z } from "zod";
2
+ export declare const collaborationModeSchema: z.ZodEnum<{
3
+ review: "review";
4
+ }>;
5
+ export declare const annotationThreadStatusSchema: z.ZodEnum<{
6
+ open: "open";
7
+ resolved: "resolved";
8
+ archived: "archived";
9
+ }>;
10
+ export declare const collaborationReviewerLevelSchema: z.ZodEnum<{
11
+ viewer: "viewer";
12
+ commenter: "commenter";
13
+ editor: "editor";
14
+ }>;
15
+ export declare const collaborationInvitedReviewerSchema: z.ZodObject<{
16
+ email: z.ZodString;
17
+ level: z.ZodEnum<{
18
+ viewer: "viewer";
19
+ commenter: "commenter";
20
+ editor: "editor";
21
+ }>;
22
+ }, z.core.$strip>;
23
+ export declare const collaborationSettingsSchema: z.ZodObject<{
24
+ anonymousReviewers: z.ZodOptional<z.ZodBoolean>;
25
+ invitedReviewers: z.ZodOptional<z.ZodArray<z.ZodObject<{
26
+ email: z.ZodString;
27
+ level: z.ZodEnum<{
28
+ viewer: "viewer";
29
+ commenter: "commenter";
30
+ editor: "editor";
31
+ }>;
32
+ }, z.core.$strip>>>;
33
+ publishedComments: z.ZodOptional<z.ZodBoolean>;
34
+ allowedOrigins: z.ZodOptional<z.ZodArray<z.ZodString>>;
35
+ notificationPreferences: z.ZodOptional<z.ZodObject<{
36
+ newThreads: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
37
+ newReplies: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
38
+ statusChanges: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
39
+ }, z.core.$strip>>;
40
+ }, z.core.$catchall<z.ZodUnknown>>;
41
+ export declare const collaborationSchema: z.ZodObject<{
42
+ spaceId: z.ZodString;
43
+ enabled: z.ZodBoolean;
44
+ mode: z.ZodEnum<{
45
+ review: "review";
46
+ }>;
47
+ castResourceId: z.ZodNullable<z.ZodString>;
48
+ castResourceKey: z.ZodNullable<z.ZodString>;
49
+ settings: z.ZodObject<{
50
+ anonymousReviewers: z.ZodOptional<z.ZodBoolean>;
51
+ invitedReviewers: z.ZodOptional<z.ZodArray<z.ZodObject<{
52
+ email: z.ZodString;
53
+ level: z.ZodEnum<{
54
+ viewer: "viewer";
55
+ commenter: "commenter";
56
+ editor: "editor";
57
+ }>;
58
+ }, z.core.$strip>>>;
59
+ publishedComments: z.ZodOptional<z.ZodBoolean>;
60
+ allowedOrigins: z.ZodOptional<z.ZodArray<z.ZodString>>;
61
+ notificationPreferences: z.ZodOptional<z.ZodObject<{
62
+ newThreads: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
63
+ newReplies: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
64
+ statusChanges: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
65
+ }, z.core.$strip>>;
66
+ }, z.core.$catchall<z.ZodUnknown>>;
67
+ createdAt: z.ZodNullable<z.ZodString>;
68
+ updatedAt: z.ZodNullable<z.ZodString>;
69
+ }, z.core.$strip>;
70
+ export declare const collaborationUpdateSchema: z.ZodObject<{
71
+ enabled: z.ZodBoolean;
72
+ mode: z.ZodOptional<z.ZodEnum<{
73
+ review: "review";
74
+ }>>;
75
+ settings: z.ZodOptional<z.ZodObject<{
76
+ anonymousReviewers: z.ZodOptional<z.ZodBoolean>;
77
+ invitedReviewers: z.ZodOptional<z.ZodArray<z.ZodObject<{
78
+ email: z.ZodString;
79
+ level: z.ZodEnum<{
80
+ viewer: "viewer";
81
+ commenter: "commenter";
82
+ editor: "editor";
83
+ }>;
84
+ }, z.core.$strip>>>;
85
+ publishedComments: z.ZodOptional<z.ZodBoolean>;
86
+ allowedOrigins: z.ZodOptional<z.ZodArray<z.ZodString>>;
87
+ notificationPreferences: z.ZodOptional<z.ZodObject<{
88
+ newThreads: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
89
+ newReplies: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
90
+ statusChanges: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
91
+ }, z.core.$strip>>;
92
+ }, z.core.$catchall<z.ZodUnknown>>>;
93
+ }, z.core.$strip>;
94
+ export declare const collaborationTokenRequestSchema: z.ZodObject<{
95
+ versionId: z.ZodOptional<z.ZodString>;
96
+ pagePath: z.ZodDefault<z.ZodString>;
97
+ displayName: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strip>;
99
+ export declare const collaborationTokenResponseSchema: z.ZodObject<{
100
+ token: z.ZodString;
101
+ expiresAt: z.ZodString;
102
+ cast: z.ZodObject<{
103
+ resource: z.ZodString;
104
+ room: z.ZodNullable<z.ZodString>;
105
+ loaderUrl: z.ZodString;
106
+ }, z.core.$strip>;
107
+ }, z.core.$strip>;
108
+ export declare const collaborationHandoffRequestSchema: z.ZodObject<{
109
+ versionId: z.ZodString;
110
+ pagePath: z.ZodDefault<z.ZodString>;
111
+ }, z.core.$strip>;
112
+ export declare const collaborationHandoffResponseSchema: z.ZodObject<{
113
+ handoffToken: z.ZodString;
114
+ expiresAt: z.ZodString;
115
+ url: z.ZodNullable<z.ZodString>;
116
+ }, z.core.$strip>;
117
+ export declare const collaborationHandoffExchangeSchema: z.ZodObject<{
118
+ handoffToken: z.ZodString;
119
+ }, z.core.$strip>;
120
+ export declare const realtimeTokenRequestSchema: z.ZodObject<{
121
+ versionId: z.ZodOptional<z.ZodString>;
122
+ scope: z.ZodDefault<z.ZodEnum<{
123
+ space: "space";
124
+ version: "version";
125
+ }>>;
126
+ }, z.core.$strip>;
127
+ export declare const realtimeTokenResponseSchema: z.ZodObject<{
128
+ token: z.ZodString;
129
+ expiresAt: z.ZodString;
130
+ cast: z.ZodObject<{
131
+ resource: z.ZodString;
132
+ room: z.ZodString;
133
+ loaderUrl: z.ZodString;
134
+ }, z.core.$strip>;
135
+ }, z.core.$strip>;
136
+ export declare const noticePublishSchema: z.ZodObject<{
137
+ versionId: z.ZodOptional<z.ZodString>;
138
+ kind: z.ZodDefault<z.ZodString>;
139
+ title: z.ZodString;
140
+ message: z.ZodString;
141
+ level: z.ZodDefault<z.ZodEnum<{
142
+ success: "success";
143
+ info: "info";
144
+ warning: "warning";
145
+ error: "error";
146
+ }>>;
147
+ payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
148
+ durable: z.ZodDefault<z.ZodBoolean>;
149
+ idempotencyKey: z.ZodOptional<z.ZodString>;
150
+ }, z.core.$strip>;
151
+ export declare const noticePublishResponseSchema: z.ZodObject<{
152
+ status: z.ZodString;
153
+ event: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
154
+ broadcast: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
155
+ }, z.core.$strip>;
156
+ export declare const overlayConfigQuerySchema: z.ZodObject<{
157
+ path: z.ZodOptional<z.ZodString>;
158
+ host: z.ZodOptional<z.ZodString>;
159
+ }, z.core.$strip>;
160
+ export declare const overlayConfigSchema: z.ZodObject<{
161
+ enabled: z.ZodBoolean;
162
+ features: z.ZodObject<{
163
+ annotations: z.ZodBoolean;
164
+ anonymousReviewers: z.ZodBoolean;
165
+ notices: z.ZodBoolean;
166
+ }, z.core.$strip>;
167
+ cast: z.ZodNullable<z.ZodObject<{
168
+ loaderUrl: z.ZodString;
169
+ resource: z.ZodString;
170
+ room: z.ZodString;
171
+ wsUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
172
+ inboxUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
173
+ threadUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
174
+ tokenEndpoint: z.ZodString;
175
+ handoffEndpoint: z.ZodString;
176
+ authBridgeUrl: z.ZodString;
177
+ }, z.core.$strip>>;
178
+ }, z.core.$strip>;
179
+ export declare const publicOverlayConfigQuerySchema: z.ZodObject<{
180
+ path: z.ZodOptional<z.ZodString>;
181
+ }, z.core.$strip>;
182
+ export declare const publicOverlayConfigSchema: z.ZodObject<{
183
+ enabled: z.ZodBoolean;
184
+ publishedComments: z.ZodBoolean;
185
+ anonymousReviewers: z.ZodBoolean;
186
+ room: z.ZodNullable<z.ZodString>;
187
+ resourceKey: z.ZodNullable<z.ZodString>;
188
+ version: z.ZodObject<{
189
+ id: z.ZodNullable<z.ZodString>;
190
+ current: z.ZodNullable<z.ZodString>;
191
+ }, z.core.$strip>;
192
+ sdkUrl: z.ZodString;
193
+ wsUrl: z.ZodNullable<z.ZodString>;
194
+ inboxUrl: z.ZodNullable<z.ZodString>;
195
+ threadUrl: z.ZodNullable<z.ZodString>;
196
+ tokenUrl: z.ZodString;
197
+ authBridgeUrl: z.ZodString;
198
+ level: z.ZodNullable<z.ZodString>;
199
+ }, z.core.$strip>;
200
+ export declare const annotationAuthorSchema: z.ZodObject<{
201
+ kind: z.ZodNullable<z.ZodString>;
202
+ id: z.ZodNullable<z.ZodString>;
203
+ name: z.ZodNullable<z.ZodString>;
204
+ }, z.core.$strip>;
205
+ export declare const annotationTargetSchema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
206
+ export declare const annotationThreadSchema: z.ZodObject<{
207
+ id: z.ZodString;
208
+ castThreadId: z.ZodString;
209
+ spaceId: z.ZodString;
210
+ versionId: z.ZodNullable<z.ZodString>;
211
+ channel: z.ZodNullable<z.ZodString>;
212
+ pagePath: z.ZodString;
213
+ url: z.ZodNullable<z.ZodString>;
214
+ status: z.ZodEnum<{
215
+ open: "open";
216
+ resolved: "resolved";
217
+ archived: "archived";
218
+ }>;
219
+ body: z.ZodNullable<z.ZodString>;
220
+ author: z.ZodNullable<z.ZodObject<{
221
+ kind: z.ZodNullable<z.ZodString>;
222
+ id: z.ZodNullable<z.ZodString>;
223
+ name: z.ZodNullable<z.ZodString>;
224
+ }, z.core.$strip>>;
225
+ target: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
226
+ comments: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
227
+ permalink: z.ZodNullable<z.ZodString>;
228
+ updatedAt: z.ZodNullable<z.ZodString>;
229
+ }, z.core.$strip>;
230
+ export declare const annotationListQuerySchema: z.ZodObject<{
231
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
232
+ cursor: z.ZodOptional<z.ZodString>;
233
+ versionId: z.ZodOptional<z.ZodString>;
234
+ status: z.ZodOptional<z.ZodEnum<{
235
+ open: "open";
236
+ resolved: "resolved";
237
+ archived: "archived";
238
+ }>>;
239
+ pagePath: z.ZodOptional<z.ZodString>;
240
+ }, z.core.$strip>;
241
+ export declare const annotationCreateSchema: z.ZodObject<{
242
+ pagePath: z.ZodDefault<z.ZodString>;
243
+ body: z.ZodString;
244
+ target: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
245
+ idempotencyKey: z.ZodOptional<z.ZodString>;
246
+ }, z.core.$strip>;
247
+ export declare const annotationScreenshotCreateSchema: z.ZodObject<{
248
+ versionId: z.ZodString;
249
+ pagePath: z.ZodDefault<z.ZodString>;
250
+ contentType: z.ZodEnum<{
251
+ "image/png": "image/png";
252
+ "image/jpeg": "image/jpeg";
253
+ "image/webp": "image/webp";
254
+ }>;
255
+ contentBase64: z.ZodString;
256
+ }, z.core.$strip>;
257
+ export declare const annotationScreenshotSchema: z.ZodObject<{
258
+ id: z.ZodString;
259
+ key: z.ZodString;
260
+ url: z.ZodString;
261
+ expiresAt: z.ZodString;
262
+ }, z.core.$strip>;
263
+ export declare const annotationReplySchema: z.ZodObject<{
264
+ body: z.ZodString;
265
+ idempotencyKey: z.ZodOptional<z.ZodString>;
266
+ }, z.core.$strip>;
267
+ export declare const annotationPatchSchema: z.ZodObject<{
268
+ status: z.ZodOptional<z.ZodEnum<{
269
+ open: "open";
270
+ resolved: "resolved";
271
+ archived: "archived";
272
+ }>>;
273
+ }, z.core.$strip>;
274
+ export declare const annotationExportQuerySchema: z.ZodObject<{
275
+ format: z.ZodDefault<z.ZodEnum<{
276
+ markdown: "markdown";
277
+ json: "json";
278
+ }>>;
279
+ status: z.ZodOptional<z.ZodEnum<{
280
+ open: "open";
281
+ resolved: "resolved";
282
+ archived: "archived";
283
+ }>>;
284
+ }, z.core.$strip>;
285
+ export declare const annotationListResponseSchema: z.ZodObject<{
286
+ data: z.ZodArray<z.ZodObject<{
287
+ id: z.ZodString;
288
+ castThreadId: z.ZodString;
289
+ spaceId: z.ZodString;
290
+ versionId: z.ZodNullable<z.ZodString>;
291
+ channel: z.ZodNullable<z.ZodString>;
292
+ pagePath: z.ZodString;
293
+ url: z.ZodNullable<z.ZodString>;
294
+ status: z.ZodEnum<{
295
+ open: "open";
296
+ resolved: "resolved";
297
+ archived: "archived";
298
+ }>;
299
+ body: z.ZodNullable<z.ZodString>;
300
+ author: z.ZodNullable<z.ZodObject<{
301
+ kind: z.ZodNullable<z.ZodString>;
302
+ id: z.ZodNullable<z.ZodString>;
303
+ name: z.ZodNullable<z.ZodString>;
304
+ }, z.core.$strip>>;
305
+ target: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
306
+ comments: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
307
+ permalink: z.ZodNullable<z.ZodString>;
308
+ updatedAt: z.ZodNullable<z.ZodString>;
309
+ }, z.core.$strip>>;
310
+ pagination: z.ZodObject<{
311
+ nextCursor: z.ZodNullable<z.ZodString>;
312
+ hasMore: z.ZodBoolean;
313
+ }, z.core.$strip>;
314
+ }, z.core.$strip>;
315
+ export declare const annotationExportResponseSchema: z.ZodObject<{
316
+ format: z.ZodEnum<{
317
+ markdown: "markdown";
318
+ json: "json";
319
+ }>;
320
+ content: z.ZodString;
321
+ }, z.core.$strip>;
322
+ export type CollaborationInvitedReviewer = z.infer<typeof collaborationInvitedReviewerSchema>;
323
+ export type Collaboration = z.infer<typeof collaborationSchema>;
324
+ export type OverlayConfig = z.infer<typeof overlayConfigSchema>;
325
+ export type PublicOverlayConfig = z.infer<typeof publicOverlayConfigSchema>;
326
+ export type AnnotationThread = z.infer<typeof annotationThreadSchema>;
327
+ export type RealtimeToken = z.infer<typeof realtimeTokenResponseSchema>;