@spacefast/common 0.0.12 → 0.0.13

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 (113) hide show
  1. package/dist/contracts/access.d.ts +386 -1201
  2. package/dist/contracts/access.js +240 -1057
  3. package/dist/contracts/activity.d.ts +1 -1
  4. package/dist/contracts/activity.js +6 -14
  5. package/dist/contracts/api-keys.d.ts +16 -0
  6. package/dist/contracts/api-keys.js +2 -0
  7. package/dist/contracts/archives.d.ts +1 -2
  8. package/dist/contracts/archives.js +4 -6
  9. package/dist/contracts/comments.d.ts +58 -85
  10. package/dist/contracts/comments.js +86 -67
  11. package/dist/contracts/countries.js +2 -7
  12. package/dist/contracts/data-source-routes.d.ts +20 -0
  13. package/dist/contracts/data-source-routes.js +15 -0
  14. package/dist/contracts/device-auth.d.ts +7 -3
  15. package/dist/contracts/enums.d.ts +2 -4
  16. package/dist/contracts/enums.js +3 -8
  17. package/dist/contracts/error-code-meta.d.ts +17 -20
  18. package/dist/contracts/error-code-meta.js +8 -5
  19. package/dist/contracts/error-codes.d.ts +1 -1
  20. package/dist/contracts/error-codes.js +4 -5
  21. package/dist/contracts/events.d.ts +13 -13
  22. package/dist/contracts/execution.d.ts +212 -0
  23. package/dist/contracts/execution.js +288 -0
  24. package/dist/contracts/feature-lifecycle.d.ts +21 -167
  25. package/dist/contracts/feature-lifecycle.js +27 -173
  26. package/dist/contracts/features.d.ts +13 -115
  27. package/dist/contracts/features.js +1 -31
  28. package/dist/contracts/functions.d.ts +729 -0
  29. package/dist/contracts/functions.js +485 -0
  30. package/dist/contracts/git.d.ts +1 -1
  31. package/dist/contracts/grants.d.ts +1158 -0
  32. package/dist/contracts/grants.js +696 -0
  33. package/dist/contracts/ids.d.ts +5 -3
  34. package/dist/contracts/ids.js +5 -3
  35. package/dist/contracts/mcp.d.ts +6 -6
  36. package/dist/contracts/oauth-resources.d.ts +5 -5
  37. package/dist/contracts/oauth-resources.js +1 -0
  38. package/dist/contracts/operations.d.ts +2 -2
  39. package/dist/contracts/pages.d.ts +6 -14
  40. package/dist/contracts/pages.js +6 -23
  41. package/dist/contracts/plan-policy.d.ts +1 -8
  42. package/dist/contracts/plan-policy.js +1 -4
  43. package/dist/contracts/platform.d.ts +78 -30
  44. package/dist/contracts/platform.js +59 -12
  45. package/dist/contracts/push-new.d.ts +26 -2
  46. package/dist/contracts/push-new.js +8 -0
  47. package/dist/contracts/quotas.d.ts +0 -1
  48. package/dist/contracts/quotas.js +0 -5
  49. package/dist/contracts/repository-connections.d.ts +1 -1
  50. package/dist/contracts/resources.d.ts +10 -66
  51. package/dist/contracts/resources.js +4 -10
  52. package/dist/contracts/runtime-api.d.ts +558 -265
  53. package/dist/contracts/runtime-api.js +178 -91
  54. package/dist/contracts/runtime-app.d.ts +138 -0
  55. package/dist/contracts/runtime-app.js +21 -0
  56. package/dist/contracts/sf-config-v1.d.ts +5 -0
  57. package/dist/contracts/sites.d.ts +5 -0
  58. package/dist/contracts/sites.js +12 -1
  59. package/dist/contracts/space-config.d.ts +46 -116
  60. package/dist/contracts/space-config.js +320 -24
  61. package/dist/contracts/spaces.d.ts +253 -158
  62. package/dist/contracts/spaces.js +68 -54
  63. package/dist/contracts/superadmin-emails.d.ts +2 -2
  64. package/dist/contracts/superadmin-spaces.d.ts +15 -130
  65. package/dist/contracts/superadmin-spaces.js +7 -0
  66. package/dist/contracts/tags.d.ts +23 -23
  67. package/dist/contracts/teams.d.ts +9 -9
  68. package/dist/contracts/transfers.d.ts +0 -1
  69. package/dist/contracts/zero.d.ts +195 -273
  70. package/dist/contracts/zero.js +78 -206
  71. package/dist/dashboard-paths/index.d.ts +2 -2
  72. package/dist/dashboard-paths/index.js +1 -0
  73. package/dist/docs/agent-prose.js +10 -8
  74. package/dist/docs/agent-setup.d.ts +2 -2
  75. package/dist/docs/agent-setup.js +11 -9
  76. package/dist/docs/agent-solutions.js +1 -1
  77. package/dist/docs/catalog.d.ts +28 -28
  78. package/dist/docs/catalog.js +29 -29
  79. package/dist/docs/error-docs.js +23 -27
  80. package/dist/utils/asset-fingerprint.d.ts +11 -0
  81. package/dist/utils/asset-fingerprint.js +46 -0
  82. package/dist/utils/auth-redirect.d.ts +1 -3
  83. package/dist/utils/auth-redirect.js +1 -21
  84. package/dist/utils/build-settings.d.ts +2 -0
  85. package/dist/utils/build-settings.js +61 -9
  86. package/dist/utils/credential-policy.d.ts +1 -1
  87. package/dist/utils/credential-policy.js +4 -0
  88. package/dist/utils/egress-policy.fixtures.json +1 -1
  89. package/dist/utils/grants.d.ts +53 -0
  90. package/dist/utils/grants.js +160 -0
  91. package/dist/utils/local-space-state.js +1 -0
  92. package/dist/utils/pages.d.ts +11 -5
  93. package/dist/utils/pages.js +19 -32
  94. package/dist/utils/publish-policy.d.ts +34 -4
  95. package/dist/utils/publish-policy.js +132 -61
  96. package/dist/utils/query-keys.d.ts +1 -6
  97. package/dist/utils/query-keys.js +1 -6
  98. package/dist/utils/space-config.d.ts +5 -1
  99. package/dist/utils/space-config.js +35 -0
  100. package/dist/utils/static-runtime-policy.d.ts +5 -0
  101. package/dist/utils/static-runtime-policy.js +54 -10
  102. package/dist/utils/upload-session.d.ts +3 -0
  103. package/dist/utils/upload-session.js +31 -0
  104. package/package.json +2 -1
  105. package/dist/utils/access-grant.d.ts +0 -14
  106. package/dist/utils/access-grant.js +0 -88
  107. package/dist/utils/access-match.d.ts +0 -46
  108. package/dist/utils/access-match.fixtures.json +0 -513
  109. package/dist/utils/access-match.js +0 -312
  110. package/dist/utils/access-verdict.fixtures.json +0 -421
  111. package/dist/utils/sf-config-v1.d.ts +0 -2
  112. package/dist/utils/sf-config-v1.fixtures.json +0 -9
  113. package/dist/utils/sf-config-v1.js +0 -551
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const ACTIVITY_EVENT_CODES: readonly ["space.created", "space.claimed", "feedback.lead_claim_pending", "space.transferred", "space.move_requested", "space.moved", "space.expired", "space.disabled", "space.enabled", "space.deleted", "space.config_updated", "space.slug_updated", "space.password_updated", "site.provision_requested", "site.placement_hold_set", "site.placement_hold_cleared", "site.burst_toggled", "space.access_logout_all", "space.access_transfer_scrub", "space.access_operator_token", "space.sharing_updated", "space.share_link_created", "space.share_link_revoked", "space.invite_created", "space.invite_revoked", "space.access_request_created", "space.access_request_resolved", "space.firewall_updated", "team.access_defaults_updated", "team.service_token_created", "team.service_token_revoked", "team.access_connection_created", "team.access_connection_updated", "team.access_connection_revoked", "version.created", "version.ready", "version.warning", "version.failed", "version.expired", "version.canceled", "version.deleted", "version.retention_warning", "version.retention_deleted", "channel.promoted", "build.created", "build.succeeded", "build.failed", "build.canceled", "build.skipped", "domain.created", "domain.verified", "domain.verification_failed", "domain.control_lost", "domain.dns_updated", "domain.nameservers_updated", "domain.registration_purchased", "domain.registration_renewed", "domain.registration_expiring", "domain.registration_expired", "domain.transfer_in_started", "domain.transfer_out_started", "domain.deleted", "domain.attached", "domain.activated", "domain.blocked", "domain.detached", "transfer.requested", "transfer.confirmed", "transfer.completed", "transfer.canceled", "transfer.expired", "transfer.failed", "variable.updated", "variable.deleted", "api_key.created", "api_key.updated", "api_key.revoked", "agent_handoff.created", "agent_handoff.redeemed", "agent_handoff.revoked", "webhook.created", "webhook.updated", "webhook.secret_rotated", "webhook.disabled", "webhook.deleted", "team.updated", "team.slug_updated", "team.member_added", "team.member_removed", "team.member_role_updated", "team.builds_deploys_quota_exceeded", "tenant.past_due", "tenant.suspended", "tenant.reactivated", "tenant.deleted", "export.ready", "export.failed", "import.ready", "import.failed", "comment.token_minted", "comment.created", "comment.reply_created", "comment.archived", "comment.unarchived", "abuse_report.created", "abuse_report.updated", "claim.blocked_takedown", "user.created", "user.signed_in", "user.deleted", "user.impersonation_started", "user.impersonation_stopped", "user.two_factor_enabled", "user.two_factor_disabled"];
2
+ export declare const ACTIVITY_EVENT_CODES: readonly ["space.created", "space.claimed", "feedback.lead_claim_pending", "space.transferred", "space.move_requested", "space.moved", "space.expired", "space.disabled", "space.enabled", "space.deleted", "space.config_updated", "space.slug_updated", "site.provision_requested", "site.placement_hold_set", "site.placement_hold_cleared", "site.burst_toggled", "space.access_logout_all", "space.access_transfer_scrub", "space.share_link_created", "space.share_link_revoked", "space.access_request_created", "space.access_request_resolved", "space.grant_created", "space.grant_updated", "space.grant_revoked", "team.access_defaults_updated", "version.created", "version.ready", "version.warning", "version.failed", "version.expired", "version.canceled", "version.deleted", "version.retention_warning", "version.retention_deleted", "channel.promoted", "build.created", "build.succeeded", "build.failed", "build.canceled", "build.skipped", "domain.created", "domain.verified", "domain.verification_failed", "domain.control_lost", "domain.dns_updated", "domain.nameservers_updated", "domain.registration_purchased", "domain.registration_renewed", "domain.registration_expiring", "domain.registration_expired", "domain.transfer_in_started", "domain.transfer_out_started", "domain.deleted", "domain.attached", "domain.activated", "domain.blocked", "domain.detached", "transfer.requested", "transfer.confirmed", "transfer.completed", "transfer.canceled", "transfer.expired", "transfer.failed", "variable.updated", "variable.deleted", "api_key.created", "api_key.updated", "api_key.revoked", "agent_handoff.created", "agent_handoff.redeemed", "agent_handoff.revoked", "webhook.created", "webhook.updated", "webhook.secret_rotated", "webhook.disabled", "webhook.deleted", "team.updated", "team.slug_updated", "team.member_added", "team.member_removed", "team.member_role_updated", "team.builds_deploys_quota_exceeded", "tenant.past_due", "tenant.suspended", "tenant.reactivated", "tenant.deleted", "export.ready", "export.failed", "import.ready", "import.failed", "comment.token_minted", "comment.created", "comment.reply_created", "comment.archived", "comment.unarchived", "abuse_report.created", "abuse_report.updated", "claim.blocked_takedown", "claim.authority_rotated", "user.created", "user.signed_in", "user.deleted", "user.impersonation_started", "user.impersonation_stopped", "user.two_factor_enabled", "user.two_factor_disabled"];
3
3
  export type ActivityEventCode = (typeof ACTIVITY_EVENT_CODES)[number];
4
4
  export declare function isActivityEventCode(value: string): value is ActivityEventCode;
5
5
  export declare function isValidActivityEventFilter(filter: string): boolean;
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { AnyObjectSchema, CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
3
3
  // The single event taxonomy (internal-docs/platform.md "Event taxonomy").
4
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.
5
+ // these codes.
6
6
  // `appendActivityEvent` is typed against this list, so emitting a code that is
7
7
  // not in the table is a typecheck (CI) failure.
8
8
  export const ACTIVITY_EVENT_CODES = [
@@ -19,31 +19,22 @@ export const ACTIVITY_EVENT_CODES = [
19
19
  "space.deleted",
20
20
  "space.config_updated",
21
21
  "space.slug_updated",
22
- "space.password_updated",
23
22
  // site
24
23
  "site.provision_requested",
25
24
  "site.placement_hold_set",
26
25
  "site.placement_hold_cleared",
27
26
  "site.burst_toggled",
28
- // access (internal-docs/access-plan.html): every access mutation emits an
29
- // activity event; operator mints are audited and owner-visible (X-27).
27
+ // access
30
28
  "space.access_logout_all",
31
29
  "space.access_transfer_scrub",
32
- "space.access_operator_token",
33
- "space.sharing_updated",
34
30
  "space.share_link_created",
35
31
  "space.share_link_revoked",
36
- "space.invite_created",
37
- "space.invite_revoked",
38
32
  "space.access_request_created",
39
33
  "space.access_request_resolved",
40
- "space.firewall_updated",
34
+ "space.grant_created",
35
+ "space.grant_updated",
36
+ "space.grant_revoked",
41
37
  "team.access_defaults_updated",
42
- "team.service_token_created",
43
- "team.service_token_revoked",
44
- "team.access_connection_created",
45
- "team.access_connection_updated",
46
- "team.access_connection_revoked",
47
38
  // version
48
39
  "version.created",
49
40
  "version.ready",
@@ -135,6 +126,7 @@ export const ACTIVITY_EVENT_CODES = [
135
126
  // claim (additive extension: a claim attempt against a taken-down space is
136
127
  // flagged, never silently 404ed — internal-docs/platform.md "Abuse Posture")
137
128
  "claim.blocked_takedown",
129
+ "claim.authority_rotated",
138
130
  // user (additive extension: account lifecycle plus the 2FA and
139
131
  // admin-impersonation effects that must surface through ActivityEvent —
140
132
  // internal-docs/platform.md Better Auth usage). `user.created` fires once on
@@ -5,6 +5,7 @@ export declare const StatticActionSchema: z.ZodEnum<{
5
5
  "teams:create": "teams:create";
6
6
  "spaces:read": "spaces:read";
7
7
  "spaces:write": "spaces:write";
8
+ "spaces:rename": "spaces:rename";
8
9
  "domains:read": "domains:read";
9
10
  "mcp:tools": "mcp:tools";
10
11
  "*": "*";
@@ -34,6 +35,7 @@ export declare const StatticActionSchema: z.ZodEnum<{
34
35
  "webhooks:read": "webhooks:read";
35
36
  "webhooks:write": "webhooks:write";
36
37
  "builds:read": "builds:read";
38
+ "builds:trigger": "builds:trigger";
37
39
  "builds:create": "builds:create";
38
40
  "teams:write": "teams:write";
39
41
  "teams:members.write": "teams:members.write";
@@ -87,6 +89,7 @@ export declare const ApiCredentialPolicySchema: z.ZodObject<{
87
89
  "teams:create": "teams:create";
88
90
  "spaces:read": "spaces:read";
89
91
  "spaces:write": "spaces:write";
92
+ "spaces:rename": "spaces:rename";
90
93
  "domains:read": "domains:read";
91
94
  "mcp:tools": "mcp:tools";
92
95
  "*": "*";
@@ -116,6 +119,7 @@ export declare const ApiCredentialPolicySchema: z.ZodObject<{
116
119
  "webhooks:read": "webhooks:read";
117
120
  "webhooks:write": "webhooks:write";
118
121
  "builds:read": "builds:read";
122
+ "builds:trigger": "builds:trigger";
119
123
  "builds:create": "builds:create";
120
124
  "teams:write": "teams:write";
121
125
  "teams:members.write": "teams:members.write";
@@ -191,6 +195,7 @@ export declare const ApiKeySchema: z.ZodObject<{
191
195
  "teams:create": "teams:create";
192
196
  "spaces:read": "spaces:read";
193
197
  "spaces:write": "spaces:write";
198
+ "spaces:rename": "spaces:rename";
194
199
  "domains:read": "domains:read";
195
200
  "mcp:tools": "mcp:tools";
196
201
  "*": "*";
@@ -220,6 +225,7 @@ export declare const ApiKeySchema: z.ZodObject<{
220
225
  "webhooks:read": "webhooks:read";
221
226
  "webhooks:write": "webhooks:write";
222
227
  "builds:read": "builds:read";
228
+ "builds:trigger": "builds:trigger";
223
229
  "builds:create": "builds:create";
224
230
  "teams:write": "teams:write";
225
231
  "teams:members.write": "teams:members.write";
@@ -303,6 +309,7 @@ export declare const ApiKeyListResponseSchema: z.ZodObject<{
303
309
  "teams:create": "teams:create";
304
310
  "spaces:read": "spaces:read";
305
311
  "spaces:write": "spaces:write";
312
+ "spaces:rename": "spaces:rename";
306
313
  "domains:read": "domains:read";
307
314
  "mcp:tools": "mcp:tools";
308
315
  "*": "*";
@@ -332,6 +339,7 @@ export declare const ApiKeyListResponseSchema: z.ZodObject<{
332
339
  "webhooks:read": "webhooks:read";
333
340
  "webhooks:write": "webhooks:write";
334
341
  "builds:read": "builds:read";
342
+ "builds:trigger": "builds:trigger";
335
343
  "builds:create": "builds:create";
336
344
  "teams:write": "teams:write";
337
345
  "teams:members.write": "teams:members.write";
@@ -395,6 +403,7 @@ export declare const ApiKeyCreateRequestSchema: z.ZodObject<{
395
403
  "teams:create": "teams:create";
396
404
  "spaces:read": "spaces:read";
397
405
  "spaces:write": "spaces:write";
406
+ "spaces:rename": "spaces:rename";
398
407
  "domains:read": "domains:read";
399
408
  "mcp:tools": "mcp:tools";
400
409
  "*": "*";
@@ -424,6 +433,7 @@ export declare const ApiKeyCreateRequestSchema: z.ZodObject<{
424
433
  "webhooks:read": "webhooks:read";
425
434
  "webhooks:write": "webhooks:write";
426
435
  "builds:read": "builds:read";
436
+ "builds:trigger": "builds:trigger";
427
437
  "builds:create": "builds:create";
428
438
  "teams:write": "teams:write";
429
439
  "teams:members.write": "teams:members.write";
@@ -469,6 +479,7 @@ export declare const ApiKeyPatchRequestSchema: z.ZodObject<{
469
479
  "teams:create": "teams:create";
470
480
  "spaces:read": "spaces:read";
471
481
  "spaces:write": "spaces:write";
482
+ "spaces:rename": "spaces:rename";
472
483
  "domains:read": "domains:read";
473
484
  "mcp:tools": "mcp:tools";
474
485
  "*": "*";
@@ -498,6 +509,7 @@ export declare const ApiKeyPatchRequestSchema: z.ZodObject<{
498
509
  "webhooks:read": "webhooks:read";
499
510
  "webhooks:write": "webhooks:write";
500
511
  "builds:read": "builds:read";
512
+ "builds:trigger": "builds:trigger";
501
513
  "builds:create": "builds:create";
502
514
  "teams:write": "teams:write";
503
515
  "teams:members.write": "teams:members.write";
@@ -542,6 +554,7 @@ export declare const ApiKeyScopedCreateRequestSchema: z.ZodObject<{
542
554
  "teams:create": "teams:create";
543
555
  "spaces:read": "spaces:read";
544
556
  "spaces:write": "spaces:write";
557
+ "spaces:rename": "spaces:rename";
545
558
  "domains:read": "domains:read";
546
559
  "mcp:tools": "mcp:tools";
547
560
  "*": "*";
@@ -571,6 +584,7 @@ export declare const ApiKeyScopedCreateRequestSchema: z.ZodObject<{
571
584
  "webhooks:read": "webhooks:read";
572
585
  "webhooks:write": "webhooks:write";
573
586
  "builds:read": "builds:read";
587
+ "builds:trigger": "builds:trigger";
574
588
  "builds:create": "builds:create";
575
589
  "teams:write": "teams:write";
576
590
  "teams:members.write": "teams:members.write";
@@ -601,6 +615,7 @@ export declare const ApiKeyScopedPatchRequestSchema: z.ZodObject<{
601
615
  "teams:create": "teams:create";
602
616
  "spaces:read": "spaces:read";
603
617
  "spaces:write": "spaces:write";
618
+ "spaces:rename": "spaces:rename";
604
619
  "domains:read": "domains:read";
605
620
  "mcp:tools": "mcp:tools";
606
621
  "*": "*";
@@ -630,6 +645,7 @@ export declare const ApiKeyScopedPatchRequestSchema: z.ZodObject<{
630
645
  "webhooks:read": "webhooks:read";
631
646
  "webhooks:write": "webhooks:write";
632
647
  "builds:read": "builds:read";
648
+ "builds:trigger": "builds:trigger";
633
649
  "builds:create": "builds:create";
634
650
  "teams:write": "teams:write";
635
651
  "teams:members.write": "teams:members.write";
@@ -11,6 +11,7 @@ export const StatticActionSchema = z.enum([
11
11
  "spaces:read",
12
12
  "spaces:create",
13
13
  "spaces:write",
14
+ "spaces:rename",
14
15
  "spaces:delete",
15
16
  "spaces:publish",
16
17
  "spaces:transfer",
@@ -32,6 +33,7 @@ export const StatticActionSchema = z.enum([
32
33
  "webhooks:read",
33
34
  "webhooks:write",
34
35
  "builds:read",
36
+ "builds:trigger",
35
37
  "builds:create",
36
38
  "teams:read",
37
39
  "teams:create",
@@ -6,8 +6,7 @@ export declare const archiveListQuerySchema: z.ZodObject<{
6
6
  export declare const spaceExportRequestSchema: z.ZodObject<{
7
7
  versionIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
8
8
  includeFiles: z.ZodDefault<z.ZodBoolean>;
9
- includeExplicitConfig: z.ZodDefault<z.ZodBoolean>;
10
- }, z.core.$strip>;
9
+ }, z.core.$strict>;
11
10
  export declare const spaceExportArchiveSchema: z.ZodObject<{
12
11
  contentType: z.ZodLiteral<"application/zip">;
13
12
  downloadUrl: z.ZodString;
@@ -2,7 +2,8 @@ import { z } from "zod";
2
2
  import { baseDiagnosticSchema, CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
3
3
  import { uploadInstructionsSchema } from "./internal.js";
4
4
  export const archiveListQuerySchema = cursorListQuerySchema;
5
- export const spaceExportRequestSchema = z.object({
5
+ export const spaceExportRequestSchema = z
6
+ .object({
6
7
  versionIds: z
7
8
  .array(z.string().min(1))
8
9
  .min(1)
@@ -12,11 +13,8 @@ export const spaceExportRequestSchema = z.object({
12
13
  .boolean()
13
14
  .default(true)
14
15
  .describe("Include version file trees and compiled serving artifacts. `false` produces a config-only archive that is not self-servable and cannot be re-imported."),
15
- includeExplicitConfig: z
16
- .boolean()
17
- .default(true)
18
- .describe("Include explicit space config (the space access policy) in the archive. Version manifests are always included."),
19
- });
16
+ })
17
+ .strict();
20
18
  export const spaceExportArchiveSchema = z.object({
21
19
  // Zip-only contract: spacefast_export_v1 archives are always zip (the spec
22
20
  // allows "zip or tar"; one format keeps the enum honest).
@@ -1,36 +1,70 @@
1
1
  import { z } from "zod";
2
+ import type { GrantCapability } from "./grants.js";
2
3
  export declare const commentThreadStatusSchema: z.ZodEnum<{
3
4
  open: "open";
4
5
  archived: "archived";
5
6
  }>;
6
7
  export declare const COMMENT_SEARCH_QUERY_MAX_LENGTH = 160;
7
8
  export declare function normalizeCommentSearchQuery(value: string | undefined): string | undefined;
8
- export declare const collaborationReviewerLevelSchema: z.ZodEnum<{
9
- viewer: "viewer";
10
- commenter: "commenter";
11
- editor: "editor";
12
- }>;
13
9
  export declare const COMMENT_PAGE_PATH_MAX_LENGTH = 2048;
14
- export declare const collaborationInvitedReviewerSchema: z.ZodObject<{
15
- email: z.ZodString;
16
- level: z.ZodEnum<{
10
+ export declare const commentCapabilitiesSchema: z.ZodArray<z.ZodEnum<{
11
+ "page.view": "page.view";
12
+ "comments.read": "comments.read";
13
+ "comments.write": "comments.write";
14
+ }>>;
15
+ export type CommentCapability = Extract<GrantCapability, "page.view" | "comments.read" | "comments.write">;
16
+ export type CommentCapabilities = CommentCapability[];
17
+ export declare const collaborationGuestProjectionSchema: z.ZodObject<{
18
+ anonymousId: z.ZodString;
19
+ name: z.ZodString;
20
+ namedByUser: z.ZodBoolean;
21
+ grantId: z.ZodString;
22
+ admittedBy: z.ZodUnion<readonly [z.ZodLiteral<"anyone">, z.ZodTemplateLiteral<`link:${string}`>, z.ZodTemplateLiteral<`password:${string}`>]>;
23
+ emailVerified: z.ZodDefault<z.ZodBoolean>;
24
+ capabilities: z.ZodArray<z.ZodEnum<{
25
+ "page.view": "page.view";
26
+ "comments.read": "comments.read";
27
+ "comments.write": "comments.write";
28
+ }>>;
29
+ }, z.core.$strip>;
30
+ export type CollaborationGuestProjection = z.infer<typeof collaborationGuestProjectionSchema>;
31
+ export declare const collaborationTicketClaimsSchema: z.ZodObject<{
32
+ sub: z.ZodString;
33
+ email: z.ZodOptional<z.ZodString>;
34
+ role: z.ZodEnum<{
17
35
  viewer: "viewer";
18
36
  commenter: "commenter";
19
37
  editor: "editor";
38
+ manager: "manager";
39
+ }>;
40
+ actorKind: z.ZodEnum<{
41
+ user: "user";
42
+ guest: "guest";
20
43
  }>;
44
+ capabilities: z.ZodArray<z.ZodEnum<{
45
+ "page.view": "page.view";
46
+ "comments.read": "comments.read";
47
+ "comments.write": "comments.write";
48
+ }>>;
49
+ anonymousId: z.ZodOptional<z.ZodString>;
50
+ namedByUser: z.ZodOptional<z.ZodBoolean>;
51
+ admittedBy: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"anyone">, z.ZodTemplateLiteral<`link:${string}`>, z.ZodTemplateLiteral<`password:${string}`>]>>;
52
+ emailVerified: z.ZodOptional<z.ZodBoolean>;
53
+ room: z.ZodString;
54
+ scope: z.ZodString;
55
+ surface: z.ZodEnum<{
56
+ preview: "preview";
57
+ published: "published";
58
+ }>;
59
+ nonce: z.ZodString;
60
+ iat: z.ZodNumber;
61
+ nbf: z.ZodNumber;
62
+ exp: z.ZodNumber;
63
+ iss: z.ZodLiteral<"spacefast-api">;
64
+ aud: z.ZodString;
21
65
  }, z.core.$strip>;
22
66
  export declare const collaborationSettingsSchema: z.ZodObject<{
23
- anonymousReviewers: z.ZodOptional<z.ZodBoolean>;
24
- publishedAnonymousCommenters: z.ZodOptional<z.ZodBoolean>;
25
67
  spamFilterEnabled: z.ZodOptional<z.ZodBoolean>;
26
- invitedReviewers: z.ZodOptional<z.ZodArray<z.ZodObject<{
27
- email: z.ZodString;
28
- level: z.ZodEnum<{
29
- viewer: "viewer";
30
- commenter: "commenter";
31
- editor: "editor";
32
- }>;
33
- }, z.core.$strip>>>;
34
68
  publishedComments: z.ZodOptional<z.ZodBoolean>;
35
69
  notificationPreferences: z.ZodOptional<z.ZodObject<{
36
70
  newThreads: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -44,17 +78,7 @@ export declare const collaborationSchema: z.ZodObject<{
44
78
  castResourceId: z.ZodNullable<z.ZodString>;
45
79
  castResourceKey: z.ZodNullable<z.ZodString>;
46
80
  settings: z.ZodObject<{
47
- anonymousReviewers: z.ZodOptional<z.ZodBoolean>;
48
- publishedAnonymousCommenters: z.ZodOptional<z.ZodBoolean>;
49
81
  spamFilterEnabled: z.ZodOptional<z.ZodBoolean>;
50
- invitedReviewers: z.ZodOptional<z.ZodArray<z.ZodObject<{
51
- email: z.ZodString;
52
- level: z.ZodEnum<{
53
- viewer: "viewer";
54
- commenter: "commenter";
55
- editor: "editor";
56
- }>;
57
- }, z.core.$strip>>>;
58
82
  publishedComments: z.ZodOptional<z.ZodBoolean>;
59
83
  notificationPreferences: z.ZodOptional<z.ZodObject<{
60
84
  newThreads: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -68,17 +92,7 @@ export declare const collaborationSchema: z.ZodObject<{
68
92
  export declare const collaborationUpdateSchema: z.ZodObject<{
69
93
  enabled: z.ZodBoolean;
70
94
  settings: z.ZodOptional<z.ZodObject<{
71
- anonymousReviewers: z.ZodOptional<z.ZodBoolean>;
72
- publishedAnonymousCommenters: z.ZodOptional<z.ZodBoolean>;
73
95
  spamFilterEnabled: z.ZodOptional<z.ZodBoolean>;
74
- invitedReviewers: z.ZodOptional<z.ZodArray<z.ZodObject<{
75
- email: z.ZodString;
76
- level: z.ZodEnum<{
77
- viewer: "viewer";
78
- commenter: "commenter";
79
- editor: "editor";
80
- }>;
81
- }, z.core.$strip>>>;
82
96
  publishedComments: z.ZodOptional<z.ZodBoolean>;
83
97
  notificationPreferences: z.ZodOptional<z.ZodObject<{
84
98
  newThreads: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -87,13 +101,13 @@ export declare const collaborationUpdateSchema: z.ZodObject<{
87
101
  }, z.core.$strip>>;
88
102
  }, z.core.$strict>>;
89
103
  }, z.core.$strip>;
90
- export declare const collaborationTokenRequestSchema: z.ZodObject<{
91
- versionId: z.ZodOptional<z.ZodString>;
104
+ export declare const commentsTicketRequestSchema: z.ZodObject<{
105
+ spaceId: z.ZodString;
92
106
  pagePath: z.ZodDefault<z.ZodString>;
93
- anonymousId: z.ZodOptional<z.ZodString>;
94
- displayName: z.ZodOptional<z.ZodString>;
107
+ origin: z.ZodString;
108
+ versionId: z.ZodOptional<z.ZodString>;
95
109
  }, z.core.$strip>;
96
- export declare const collaborationTokenResponseSchema: z.ZodObject<{
110
+ export declare const commentsTicketResponseSchema: z.ZodObject<{
97
111
  token: z.ZodString;
98
112
  expiresAt: z.ZodString;
99
113
  cast: z.ZodObject<{
@@ -101,18 +115,6 @@ export declare const collaborationTokenResponseSchema: z.ZodObject<{
101
115
  room: z.ZodString;
102
116
  }, z.core.$strip>;
103
117
  }, z.core.$strip>;
104
- export declare const collaborationHandoffRequestSchema: z.ZodObject<{
105
- versionId: z.ZodString;
106
- pagePath: z.ZodDefault<z.ZodString>;
107
- }, z.core.$strip>;
108
- export declare const collaborationHandoffResponseSchema: z.ZodObject<{
109
- handoffToken: z.ZodString;
110
- expiresAt: z.ZodString;
111
- url: z.ZodNullable<z.ZodString>;
112
- }, z.core.$strip>;
113
- export declare const collaborationHandoffExchangeSchema: z.ZodObject<{
114
- handoffToken: z.ZodString;
115
- }, z.core.$strip>;
116
118
  export declare const realtimeTokenRequestSchema: z.ZodObject<{
117
119
  versionId: z.ZodOptional<z.ZodString>;
118
120
  scope: z.ZodDefault<z.ZodEnum<{
@@ -155,37 +157,9 @@ export declare const collabOverlayConfigQuerySchema: z.ZodObject<{
155
157
  }, z.core.$strip>;
156
158
  export declare const collabOverlayConfigSchema: z.ZodObject<{
157
159
  enabled: z.ZodBoolean;
158
- anonymous_commenters: z.ZodBoolean;
159
- resource_key: z.ZodNullable<z.ZodString>;
160
- room_key: z.ZodNullable<z.ZodString>;
161
- version: z.ZodObject<{
162
- id: z.ZodNullable<z.ZodString>;
163
- current: z.ZodNullable<z.ZodString>;
164
- url: z.ZodNullable<z.ZodString>;
165
- }, z.core.$strip>;
166
- space: z.ZodObject<{
167
- live_url: z.ZodNullable<z.ZodString>;
168
- }, z.core.$strip>;
169
- ws_url: z.ZodNullable<z.ZodString>;
170
- endpoints: z.ZodObject<{
171
- token: z.ZodString;
172
- handoff_exchange: z.ZodString;
173
- auth_bridge: z.ZodString;
174
- screenshots: z.ZodString;
175
- }, z.core.$strip>;
176
- features: z.ZodObject<{
177
- drawing: z.ZodBoolean;
178
- capture: z.ZodBoolean;
179
- notices: z.ZodBoolean;
180
- }, z.core.$strip>;
160
+ surface_url: z.ZodNullable<z.ZodString>;
181
161
  }, z.core.$strip>;
182
162
  export declare const COLLAB_VERSION_URLS_MAX_IDS = 50;
183
- export declare const collabVersionUrlsQuerySchema: z.ZodObject<{
184
- path: z.ZodOptional<z.ZodString>;
185
- versionId: z.ZodOptional<z.ZodString>;
186
- host: z.ZodOptional<z.ZodString>;
187
- ids: z.ZodString;
188
- }, z.core.$strip>;
189
163
  export declare const collabVersionUrlSchema: z.ZodObject<{
190
164
  id: z.ZodString;
191
165
  url: z.ZodString;
@@ -337,7 +311,6 @@ export declare const commentExportResponseSchema: z.ZodObject<{
337
311
  }>;
338
312
  content: z.ZodString;
339
313
  }, z.core.$strip>;
340
- export type CollaborationInvitedReviewer = z.infer<typeof collaborationInvitedReviewerSchema>;
341
314
  export type Collaboration = z.infer<typeof collaborationSchema>;
342
315
  export type CollaborationUpdate = z.infer<typeof collaborationUpdateSchema>;
343
316
  export type CollabOverlayConfig = z.infer<typeof collabOverlayConfigSchema>;
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { accessRoleSchema } from "./access.js";
2
3
  import { CursorPaginationSchema, cursorListQuerySchema } from "./common.js";
3
4
  export const commentThreadStatusSchema = z.enum(["open", "archived"]);
4
5
  export const COMMENT_SEARCH_QUERY_MAX_LENGTH = 160;
@@ -6,24 +7,85 @@ export function normalizeCommentSearchQuery(value) {
6
7
  const trimmed = value?.trim();
7
8
  return trimmed ? trimmed.slice(0, COMMENT_SEARCH_QUERY_MAX_LENGTH) : undefined;
8
9
  }
9
- // The space access levels capability follows (SPACEFAST-CAST-PLAN D-2). Invited
10
- // reviewers are space invitees with one of these levels; the on-page overlay and
11
- // inbox re-evaluate the effective level server-side at join — this is only the
12
- // stored grant the dashboard manages.
13
- export const collaborationReviewerLevelSchema = z.enum(["viewer", "commenter", "editor"]);
14
10
  export const COMMENT_PAGE_PATH_MAX_LENGTH = 2_048;
15
- // An invited reviewer: request input projected into the access lane's canonical
16
- // `cast_reviewer` managed block. It is never mirrored into collaboration settings.
17
- export const collaborationInvitedReviewerSchema = z.object({
18
- email: z.string().email(),
19
- level: collaborationReviewerLevelSchema,
11
+ const COMMENT_CAPABILITIES = ["page.view", "comments.read", "comments.write"];
12
+ export const commentCapabilitiesSchema = z
13
+ .array(z.enum(COMMENT_CAPABILITIES))
14
+ .min(2)
15
+ .max(3)
16
+ .refine((capabilities) => new Set(capabilities).size === capabilities.length, {
17
+ message: "comment capabilities must be unique",
18
+ })
19
+ .superRefine((capabilities, context) => {
20
+ if (capabilities.includes("comments.write") && !capabilities.includes("comments.read")) {
21
+ context.addIssue({
22
+ code: "custom",
23
+ message: "comments.write requires comments.read",
24
+ });
25
+ }
26
+ if (capabilities.includes("comments.read") && !capabilities.includes("page.view")) {
27
+ context.addIssue({
28
+ code: "custom",
29
+ message: "comments.read requires page.view",
30
+ });
31
+ }
32
+ });
33
+ export const collaborationGuestProjectionSchema = z.object({
34
+ anonymousId: z.string().min(8).max(160),
35
+ name: z.string().trim().min(1).max(160),
36
+ namedByUser: z.boolean(),
37
+ grantId: z.string().min(1).max(128),
38
+ admittedBy: z.union([
39
+ z.literal("anyone"),
40
+ z.templateLiteral(["link:", z.string().regex(/^[A-Za-z0-9_.-]+$/)]),
41
+ z.templateLiteral(["password:", z.string().regex(/^[A-Za-z0-9_.-]+$/)]),
42
+ ]),
43
+ emailVerified: z.boolean().default(false),
44
+ capabilities: commentCapabilitiesSchema,
45
+ });
46
+ export const collaborationTicketClaimsSchema = z
47
+ .object({
48
+ sub: z.string().min(1),
49
+ email: z.string().email().optional(),
50
+ role: accessRoleSchema,
51
+ actorKind: z.enum(["user", "guest"]),
52
+ capabilities: commentCapabilitiesSchema,
53
+ anonymousId: z.string().min(8).max(160).optional(),
54
+ namedByUser: z.boolean().optional(),
55
+ admittedBy: z
56
+ .union([
57
+ z.literal("anyone"),
58
+ z.templateLiteral(["link:", z.string().regex(/^[A-Za-z0-9_.-]+$/)]),
59
+ z.templateLiteral(["password:", z.string().regex(/^[A-Za-z0-9_.-]+$/)]),
60
+ ])
61
+ .optional(),
62
+ emailVerified: z.boolean().optional(),
63
+ room: z.string().min(1).max(4_096),
64
+ scope: z.string().min(1).max(COMMENT_PAGE_PATH_MAX_LENGTH),
65
+ surface: z.enum(["published", "preview"]),
66
+ nonce: z.string().min(1).max(160),
67
+ iat: z.number().int(),
68
+ nbf: z.number().int(),
69
+ exp: z.number().int(),
70
+ iss: z.literal("spacefast-api"),
71
+ aud: z.string().min(1),
72
+ })
73
+ .superRefine((claims, context) => {
74
+ if (claims.actorKind !== "guest")
75
+ return;
76
+ for (const field of ["anonymousId", "namedByUser", "admittedBy", "emailVerified"]) {
77
+ if (claims[field] === undefined) {
78
+ context.addIssue({
79
+ code: "custom",
80
+ path: [field],
81
+ message: `${field} is required for a guest ticket`,
82
+ });
83
+ }
84
+ }
20
85
  });
21
86
  export const collaborationSettingsSchema = z
22
87
  .object({
23
- anonymousReviewers: z.boolean().optional(),
24
- publishedAnonymousCommenters: z.boolean().optional(),
25
88
  spamFilterEnabled: z.boolean().optional(),
26
- invitedReviewers: z.array(collaborationInvitedReviewerSchema).optional(),
27
89
  // Whether comments are surfaced on the live/published host (vs preview-only).
28
90
  // The published loader (SPACEFAST-CAST-PLAN §4.2) mounts the orb on a live
29
91
  // host only when this is true; toggling it never requires a republish — the
@@ -52,13 +114,13 @@ export const collaborationUpdateSchema = z.object({
52
114
  enabled: z.boolean(),
53
115
  settings: collaborationSettingsSchema.optional(),
54
116
  });
55
- export const collaborationTokenRequestSchema = z.object({
56
- versionId: z.string().min(1).optional(),
117
+ export const commentsTicketRequestSchema = z.object({
118
+ spaceId: z.string().min(1),
57
119
  pagePath: z.string().min(1).max(COMMENT_PAGE_PATH_MAX_LENGTH).default("/"),
58
- anonymousId: z.string().min(1).max(160).optional(),
59
- displayName: z.string().min(1).max(120).optional(),
120
+ origin: z.string().url(),
121
+ versionId: z.string().min(1).optional(),
60
122
  });
61
- export const collaborationTokenResponseSchema = z.object({
123
+ export const commentsTicketResponseSchema = z.object({
62
124
  token: z.string(),
63
125
  expiresAt: z.string().datetime(),
64
126
  cast: z.object({
@@ -66,18 +128,6 @@ export const collaborationTokenResponseSchema = z.object({
66
128
  room: z.string(),
67
129
  }),
68
130
  });
69
- export const collaborationHandoffRequestSchema = z.object({
70
- versionId: z.string().min(1),
71
- pagePath: z.string().min(1).max(COMMENT_PAGE_PATH_MAX_LENGTH).default("/"),
72
- });
73
- export const collaborationHandoffResponseSchema = z.object({
74
- handoffToken: z.string(),
75
- expiresAt: z.string().datetime(),
76
- url: z.string().url().nullable(),
77
- });
78
- export const collaborationHandoffExchangeSchema = z.object({
79
- handoffToken: z.string().min(16),
80
- });
81
131
  export const realtimeTokenRequestSchema = z.object({
82
132
  versionId: z.string().optional(),
83
133
  scope: z.enum(["space", "version"]).default("space"),
@@ -110,47 +160,16 @@ export const collabOverlayConfigQuerySchema = z.object({
110
160
  versionId: z.string().min(1).optional(),
111
161
  host: z.string().min(1).optional(),
112
162
  });
113
- // Snake case is intentional: the injected Collab SDK consumes this alongside
114
- // Cast's snake-case join payload without a remapping layer.
163
+ // Customer pages receive launcher state only. Room ids, Cast endpoints, resource
164
+ // keys, tickets, and platform session state never cross the customer-origin
165
+ // boundary.
115
166
  export const collabOverlayConfigSchema = z.object({
116
167
  enabled: z.boolean(),
117
- anonymous_commenters: z.boolean(),
118
- resource_key: z.string().nullable(),
119
- room_key: z.string().nullable(),
120
- version: z.object({
121
- id: z.string().nullable(),
122
- current: z.string().nullable(),
123
- // The viewed version's immutable URL; null when unknown (live context).
124
- url: z.string().nullable(),
125
- }),
126
- // The space's canonical live/published URL; null when comments-on-live is the
127
- // current context (you're already there) or no live URL exists.
128
- space: z.object({
129
- live_url: z.string().nullable(),
130
- }),
131
- ws_url: z.string().nullable(),
132
- endpoints: z.object({
133
- token: z.string().url(),
134
- handoff_exchange: z.string().url(),
135
- auth_bridge: z.string().url(),
136
- screenshots: z.string().url(),
137
- }),
138
- features: z.object({
139
- drawing: z.boolean(),
140
- capture: z.boolean(),
141
- notices: z.boolean(),
142
- }),
168
+ surface_url: z.string().url().nullable(),
143
169
  });
144
- // Cross-version navigation directory (§5 "versions are native"): the SDK asks
145
- // for the immutable URLs of the version ids present in a room's threads so
146
- // "Open this comment on v12" is a real link. Gated exactly like the overlay
147
- // config — disabled comments never leak version URLs.
170
+ // Cross-version navigation directory: the platform Comments page asks for the
171
+ // immutable URLs of version ids present in a room's threads.
148
172
  export const COLLAB_VERSION_URLS_MAX_IDS = 50;
149
- export const collabVersionUrlsQuerySchema = collabOverlayConfigQuerySchema.extend({
150
- // Comma-separated version ids; the route caps the lookup at
151
- // COLLAB_VERSION_URLS_MAX_IDS ids.
152
- ids: z.string().min(1).max(4_096),
153
- });
154
173
  export const collabVersionUrlSchema = z.object({
155
174
  id: z.string(),
156
175
  url: z.string(),