@spacefast/common 0.0.23 → 0.0.24
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.
- package/dist/config/domains.d.ts +1 -1
- package/dist/config/domains.js +1 -0
- package/dist/config/index.d.ts +0 -1
- package/dist/config/index.js +0 -1
- package/dist/contracts/abuse.d.ts +2 -0
- package/dist/contracts/abuse.js +12 -0
- package/dist/contracts/access.d.ts +121 -9
- package/dist/contracts/access.js +73 -9
- package/dist/contracts/activity.d.ts +1 -1
- package/dist/contracts/activity.js +0 -9
- package/dist/contracts/api-keys.d.ts +21 -21
- package/dist/contracts/beta.js +1 -1
- package/dist/contracts/billing.d.ts +1 -34
- package/dist/contracts/billing.js +4 -53
- package/dist/contracts/builds.d.ts +8 -8
- package/dist/contracts/builds.js +10 -3
- package/dist/contracts/cli.d.ts +10 -0
- package/dist/contracts/cli.js +10 -0
- package/dist/contracts/collab-public.d.ts +63 -0
- package/dist/contracts/collab-public.js +46 -0
- package/dist/contracts/comments.d.ts +283 -54
- package/dist/contracts/comments.js +173 -52
- package/dist/contracts/common.d.ts +3 -3
- package/dist/contracts/device-auth.d.ts +6 -6
- package/dist/contracts/device-auth.js +1 -1
- package/dist/contracts/docs.d.ts +5 -5
- package/dist/contracts/domains.d.ts +36 -36
- package/dist/contracts/enums.d.ts +33 -30
- package/dist/contracts/enums.js +52 -38
- package/dist/contracts/error-code-meta.d.ts +37 -126
- package/dist/contracts/error-code-meta.js +12 -41
- package/dist/contracts/error-codes.d.ts +1 -1
- package/dist/contracts/error-codes.js +10 -32
- package/dist/contracts/execution.d.ts +35 -57
- package/dist/contracts/execution.js +41 -40
- package/dist/contracts/feature-lifecycle-core.d.ts +0 -6
- package/dist/contracts/feature-lifecycle-core.js +2 -31
- package/dist/contracts/feature-lifecycle.d.ts +8 -38
- package/dist/contracts/feature-lifecycle.js +16 -48
- package/dist/contracts/features.d.ts +15 -13
- package/dist/contracts/features.js +39 -38
- package/dist/contracts/functions.d.ts +97 -70
- package/dist/contracts/functions.js +101 -34
- package/dist/contracts/git.d.ts +1 -1
- package/dist/contracts/grants.d.ts +7 -3
- package/dist/contracts/grants.js +18 -9
- package/dist/contracts/internal.d.ts +14 -1
- package/dist/contracts/internal.js +17 -7
- package/dist/contracts/oauth-resources.d.ts +4 -3
- package/dist/contracts/oauth-resources.js +12 -3
- package/dist/contracts/operations.d.ts +90 -5
- package/dist/contracts/operations.js +75 -1
- package/dist/contracts/pages.d.ts +6 -1
- package/dist/contracts/pages.js +24 -1
- package/dist/contracts/plan-policy.d.ts +1 -3
- package/dist/contracts/plan-policy.js +1 -2
- package/dist/contracts/platform.d.ts +61 -148
- package/dist/contracts/platform.js +70 -126
- package/dist/contracts/publish-archive.d.ts +498 -0
- package/dist/contracts/publish-archive.js +25 -0
- package/dist/contracts/resources.d.ts +12 -24
- package/dist/contracts/resources.js +32 -12
- package/dist/contracts/runtime-api.d.ts +369 -175
- package/dist/contracts/runtime-api.js +372 -348
- package/dist/contracts/runtime-app.d.ts +127 -120
- package/dist/contracts/runtime-app.js +19 -10
- package/dist/contracts/runtime-db.d.ts +1 -1
- package/dist/contracts/runtime-services.d.ts +219 -0
- package/dist/contracts/runtime-services.js +437 -0
- package/dist/contracts/runtime-storage.d.ts +45 -32
- package/dist/contracts/runtime-storage.js +30 -8
- package/dist/contracts/space-config.d.ts +10 -16
- package/dist/contracts/space-config.js +14 -10
- package/dist/contracts/spaces.d.ts +241 -436
- package/dist/contracts/spaces.js +128 -145
- package/dist/contracts/superadmin-activity.d.ts +57 -4
- package/dist/contracts/superadmin-activity.js +48 -2
- package/dist/contracts/superadmin-search.d.ts +126 -0
- package/dist/contracts/superadmin-search.js +61 -0
- package/dist/contracts/superadmin-spaces.d.ts +358 -89
- package/dist/contracts/superadmin-spaces.js +97 -24
- package/dist/contracts/superadmin-teams.d.ts +28 -10
- package/dist/contracts/superadmin-teams.js +5 -8
- package/dist/contracts/superadmin.d.ts +0 -32
- package/dist/contracts/superadmin.js +3 -11
- package/dist/contracts/tags.d.ts +9 -9
- package/dist/contracts/teams.d.ts +38 -0
- package/dist/contracts/teams.js +34 -16
- package/dist/contracts/transfers.d.ts +0 -49
- package/dist/contracts/transfers.js +2 -6
- package/dist/contracts/usage.d.ts +61 -0
- package/dist/contracts/usage.js +64 -0
- package/dist/contracts/variables.d.ts +2 -7
- package/dist/contracts/variables.js +6 -5
- package/dist/contracts/webhooks.d.ts +2 -2
- package/dist/contracts/zero.d.ts +87 -56
- package/dist/contracts/zero.js +82 -20
- package/dist/dashboard-paths/index.d.ts +1 -1
- package/dist/dashboard-paths/index.js +1 -0
- package/dist/docs/agent-prose.d.ts +1 -1
- package/dist/docs/agent-prose.js +57 -61
- package/dist/docs/agent-setup.js +40 -13
- package/dist/docs/catalog.d.ts +19 -19
- package/dist/docs/catalog.js +30 -19
- package/dist/docs/error-docs.js +63 -151
- package/dist/test-helpers/fetch-stub.d.ts +16 -0
- package/dist/test-helpers/fetch-stub.js +24 -0
- package/dist/utils/build-settings.js +9 -3
- package/dist/utils/canonical-json.d.ts +10 -0
- package/dist/utils/canonical-json.js +21 -0
- package/dist/utils/cast-transport.d.ts +28 -0
- package/dist/utils/cast-transport.js +52 -0
- package/dist/utils/claim-token.d.ts +0 -8
- package/dist/utils/claim-token.js +3 -15
- package/dist/utils/credential-policy.d.ts +1 -1
- package/dist/utils/env-file.d.ts +17 -0
- package/dist/utils/env-file.js +96 -0
- package/dist/utils/error-code.d.ts +2 -0
- package/dist/utils/error-code.js +7 -0
- package/dist/utils/generate-space-name.d.ts +8 -10
- package/dist/utils/generate-space-name.js +206 -21
- package/dist/utils/grant-decision.fixtures.json +2938 -0
- package/dist/utils/grants.d.ts +2 -0
- package/dist/utils/grants.js +25 -2
- package/dist/utils/gravatar.d.ts +9 -0
- package/dist/utils/gravatar.js +31 -0
- package/dist/utils/idempotency.d.ts +6 -0
- package/dist/utils/idempotency.js +28 -0
- package/dist/utils/local-space-state.d.ts +1 -5
- package/dist/utils/local-space-state.js +7 -26
- package/dist/utils/page-fonts.d.ts +2 -2
- package/dist/utils/page-fonts.js +22 -4
- package/dist/utils/pages.d.ts +1 -2
- package/dist/utils/pages.js +21 -5
- package/dist/utils/publish-form-data.d.ts +12 -0
- package/dist/utils/publish-form-data.js +10 -0
- package/dist/utils/publish-policy.d.ts +20 -0
- package/dist/utils/publish-policy.fixtures.json +397 -0
- package/dist/utils/publish-policy.js +36 -19
- package/dist/utils/push-new.d.ts +7 -0
- package/dist/utils/push-new.js +7 -0
- package/dist/utils/query-keys.d.ts +0 -1
- package/dist/utils/query-keys.js +0 -1
- package/dist/utils/runtime-paths.d.ts +5 -0
- package/dist/utils/runtime-paths.js +5 -0
- package/dist/utils/runtime-upload-batch.d.ts +0 -5
- package/dist/utils/runtime-upload-batch.js +1 -27
- package/dist/utils/runtime-upload.d.ts +3 -13
- package/dist/utils/runtime-upload.js +4 -14
- package/dist/utils/space-config.d.ts +0 -33
- package/dist/utils/space-config.js +5 -326
- package/dist/utils/storage-policy.d.ts +1 -1
- package/dist/utils/storage-policy.js +3 -1
- package/dist/utils/structured-error.d.ts +14 -0
- package/dist/utils/structured-error.js +22 -0
- package/dist/utils/version-path.js +12 -3
- package/dist/vocabulary.d.ts +5 -3
- package/dist/vocabulary.js +13 -10
- package/package.json +10 -5
- package/dist/config/postgres-budget.d.ts +0 -129
- package/dist/config/postgres-budget.js +0 -140
- package/dist/config/postgres-budget.json +0 -51
- package/dist/contracts/archives.d.ts +0 -331
- package/dist/contracts/archives.js +0 -120
- package/dist/contracts/deployments.d.ts +0 -574
- package/dist/contracts/deployments.js +0 -97
- package/dist/contracts/sites.d.ts +0 -416
- package/dist/contracts/sites.js +0 -168
- package/dist/contracts/superadmin-queues.d.ts +0 -414
- package/dist/contracts/superadmin-queues.js +0 -202
- package/dist/contracts/superadmin-runtime.d.ts +0 -27
- package/dist/contracts/superadmin-runtime.js +0 -38
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/utils/api.d.ts +0 -4
- package/dist/utils/api.js +0 -13
package/dist/config/domains.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Deployment environment a URL is being built for. */
|
|
2
2
|
export type DeployEnv = "dev" | "test" | "prod";
|
|
3
3
|
/** Logical services that each get their own host. */
|
|
4
|
-
export type Service = "www" | "api" | "dashboard" | "superadmin" | "cast" | "mcp" | "fieldguide";
|
|
4
|
+
export type Service = "www" | "api" | "dashboard" | "superadmin" | "cast" | "mcp" | "push" | "fieldguide";
|
|
5
5
|
export type EnvDomains = {
|
|
6
6
|
/** Apex/base origin for the marketing site (the `www` service + bare apex). */
|
|
7
7
|
readonly apex: string;
|
package/dist/config/domains.js
CHANGED
package/dist/config/index.d.ts
CHANGED
package/dist/config/index.js
CHANGED
|
@@ -80,6 +80,8 @@ export declare const superadminAbuseReportListQuerySchema: z.ZodObject<{
|
|
|
80
80
|
actioned: "actioned";
|
|
81
81
|
closed: "closed";
|
|
82
82
|
}>>;
|
|
83
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
84
|
+
hostname: z.ZodOptional<z.ZodString>;
|
|
83
85
|
}, z.core.$strip>;
|
|
84
86
|
export declare const superadminAbuseReportPatchSchema: z.ZodObject<{
|
|
85
87
|
status: z.ZodEnum<{
|
package/dist/contracts/abuse.js
CHANGED
|
@@ -44,6 +44,18 @@ export const superadminAbuseReportSchema = abuseReportSchema.extend({
|
|
|
44
44
|
});
|
|
45
45
|
export const superadminAbuseReportListQuerySchema = cursorListQuerySchema.extend({
|
|
46
46
|
status: abuseReportStatusSchema.optional().describe("Filter the triage list by status."),
|
|
47
|
+
spaceId: z
|
|
48
|
+
.string()
|
|
49
|
+
.trim()
|
|
50
|
+
.min(1)
|
|
51
|
+
.optional()
|
|
52
|
+
.describe("Filter to reports that resolved to one Space."),
|
|
53
|
+
hostname: z
|
|
54
|
+
.string()
|
|
55
|
+
.trim()
|
|
56
|
+
.min(1)
|
|
57
|
+
.optional()
|
|
58
|
+
.describe("Filter by the normalized reported hostname; matching is case-insensitive."),
|
|
47
59
|
});
|
|
48
60
|
export const superadminAbuseReportPatchSchema = z.object({
|
|
49
61
|
status: abuseReportStatusSchema.describe("New triage status; must be a valid transition from the current status."),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { type GrantCapability } from "./grants.js";
|
|
2
3
|
export declare const SPACE_ACCESS_PRESETS: readonly ["private", "team", "public"];
|
|
3
4
|
export declare const ACCESS_HANDOFF_MEDIA_TYPE = "application/vnd.spacefast.access-handoff+json";
|
|
4
5
|
export declare const spaceAccessPresetSchema: z.ZodEnum<{
|
|
@@ -7,6 +8,13 @@ export declare const spaceAccessPresetSchema: z.ZodEnum<{
|
|
|
7
8
|
private: "private";
|
|
8
9
|
}>;
|
|
9
10
|
export type SpaceAccessPreset = z.infer<typeof spaceAccessPresetSchema>;
|
|
11
|
+
/**
|
|
12
|
+
* The sharing vocabulary. Capabilities are the ground truth; a role is a named
|
|
13
|
+
* set of them, ordered from least to most. This is the only role enum and the
|
|
14
|
+
* only role⇄capability mapping in the product — every surface (dashboard, CLI,
|
|
15
|
+
* API, comments) names access with these four words and derives capabilities
|
|
16
|
+
* here rather than keeping its own preset list.
|
|
17
|
+
*/
|
|
10
18
|
export declare const ACCESS_ROLES: readonly ["viewer", "commenter", "editor", "manager"];
|
|
11
19
|
export declare const accessRoleSchema: z.ZodEnum<{
|
|
12
20
|
viewer: "viewer";
|
|
@@ -15,6 +23,31 @@ export declare const accessRoleSchema: z.ZodEnum<{
|
|
|
15
23
|
manager: "manager";
|
|
16
24
|
}>;
|
|
17
25
|
export type AccessRole = z.infer<typeof accessRoleSchema>;
|
|
26
|
+
export declare const ACCESS_ROLE_CAPABILITIES: {
|
|
27
|
+
readonly viewer: readonly ["page.view"];
|
|
28
|
+
readonly commenter: readonly ["page.view", "comments.read", "comments.write"];
|
|
29
|
+
readonly editor: readonly ["page.view", "comments.read", "comments.write", "content.publish"];
|
|
30
|
+
readonly manager: readonly ["page.view", "comments.read", "comments.write", "content.publish", "access.manage"];
|
|
31
|
+
};
|
|
32
|
+
export declare function accessRoleCapabilities(role: AccessRole): GrantCapability[];
|
|
33
|
+
/**
|
|
34
|
+
* The role a capability set amounts to, named by the strongest capability it
|
|
35
|
+
* carries. A Grant assembled capability-by-capability need not match a role
|
|
36
|
+
* exactly; this reports the role it reaches, never more.
|
|
37
|
+
*/
|
|
38
|
+
export declare function accessRoleForCapabilities(capabilities: readonly GrantCapability[]): AccessRole;
|
|
39
|
+
/**
|
|
40
|
+
* Roles a credential-backed audience can carry. A Link or a password is a
|
|
41
|
+
* secret anyone can forward, so it never publishes and never manages access —
|
|
42
|
+
* the same boundary `grantSchema` enforces on the capabilities themselves.
|
|
43
|
+
*/
|
|
44
|
+
export declare const VISITOR_ACCESS_ROLES: readonly ["viewer", "commenter"];
|
|
45
|
+
export type VisitorAccessRole = (typeof VISITOR_ACCESS_ROLES)[number];
|
|
46
|
+
export declare const linkCapabilitySchema: z.ZodEnum<{
|
|
47
|
+
"page.view": "page.view";
|
|
48
|
+
"comments.read": "comments.read";
|
|
49
|
+
"comments.write": "comments.write";
|
|
50
|
+
}>;
|
|
18
51
|
export declare function accessRoleRank(role: AccessRole): number;
|
|
19
52
|
export declare function maxAccessRole(left: AccessRole | null, right: AccessRole | null): AccessRole | null;
|
|
20
53
|
/**
|
|
@@ -51,6 +84,17 @@ export declare const personGrantSchema: z.ZodObject<{
|
|
|
51
84
|
editor: "editor";
|
|
52
85
|
manager: "manager";
|
|
53
86
|
}>;
|
|
87
|
+
target: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
88
|
+
kind: z.ZodLiteral<"live">;
|
|
89
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
90
|
+
kind: z.ZodLiteral<"version">;
|
|
91
|
+
versionId: z.ZodString;
|
|
92
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
93
|
+
kind: z.ZodLiteral<"branch">;
|
|
94
|
+
branch: z.ZodString;
|
|
95
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
96
|
+
kind: z.ZodLiteral<"all_versions">;
|
|
97
|
+
}, z.core.$strict>], "kind">;
|
|
54
98
|
createdAt: z.ZodString;
|
|
55
99
|
revokedAt: z.ZodNullable<z.ZodString>;
|
|
56
100
|
}, z.core.$strip>;
|
|
@@ -81,6 +125,17 @@ export declare const spacePersonSchema: z.ZodObject<{
|
|
|
81
125
|
editor: "editor";
|
|
82
126
|
manager: "manager";
|
|
83
127
|
}>;
|
|
128
|
+
target: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
129
|
+
kind: z.ZodLiteral<"live">;
|
|
130
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
131
|
+
kind: z.ZodLiteral<"version">;
|
|
132
|
+
versionId: z.ZodString;
|
|
133
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
134
|
+
kind: z.ZodLiteral<"branch">;
|
|
135
|
+
branch: z.ZodString;
|
|
136
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
137
|
+
kind: z.ZodLiteral<"all_versions">;
|
|
138
|
+
}, z.core.$strict>], "kind">;
|
|
84
139
|
createdAt: z.ZodString;
|
|
85
140
|
revokedAt: z.ZodNullable<z.ZodString>;
|
|
86
141
|
}, z.core.$strip>>;
|
|
@@ -125,6 +180,17 @@ export declare const spacePeopleListSchema: z.ZodObject<{
|
|
|
125
180
|
editor: "editor";
|
|
126
181
|
manager: "manager";
|
|
127
182
|
}>;
|
|
183
|
+
target: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
184
|
+
kind: z.ZodLiteral<"live">;
|
|
185
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
186
|
+
kind: z.ZodLiteral<"version">;
|
|
187
|
+
versionId: z.ZodString;
|
|
188
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
189
|
+
kind: z.ZodLiteral<"branch">;
|
|
190
|
+
branch: z.ZodString;
|
|
191
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
192
|
+
kind: z.ZodLiteral<"all_versions">;
|
|
193
|
+
}, z.core.$strict>], "kind">;
|
|
128
194
|
createdAt: z.ZodString;
|
|
129
195
|
revokedAt: z.ZodNullable<z.ZodString>;
|
|
130
196
|
}, z.core.$strip>>;
|
|
@@ -355,6 +421,26 @@ export declare const linkCapabilitiesSchema: z.ZodArray<z.ZodEnum<{
|
|
|
355
421
|
"comments.write": "comments.write";
|
|
356
422
|
}>>;
|
|
357
423
|
export type LinkCapabilities = z.infer<typeof linkCapabilitiesSchema>;
|
|
424
|
+
export declare const personGrantWriteSchema: z.ZodObject<{
|
|
425
|
+
scope: z.ZodString;
|
|
426
|
+
role: z.ZodEnum<{
|
|
427
|
+
viewer: "viewer";
|
|
428
|
+
commenter: "commenter";
|
|
429
|
+
editor: "editor";
|
|
430
|
+
manager: "manager";
|
|
431
|
+
}>;
|
|
432
|
+
target: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
433
|
+
kind: z.ZodLiteral<"live">;
|
|
434
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
435
|
+
kind: z.ZodLiteral<"version">;
|
|
436
|
+
versionId: z.ZodString;
|
|
437
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
438
|
+
kind: z.ZodLiteral<"branch">;
|
|
439
|
+
branch: z.ZodString;
|
|
440
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
441
|
+
kind: z.ZodLiteral<"all_versions">;
|
|
442
|
+
}, z.core.$strict>], "kind">>;
|
|
443
|
+
}, z.core.$strip>;
|
|
358
444
|
export declare const spacePersonInviteWriteSchema: z.ZodObject<{
|
|
359
445
|
email: z.ZodString;
|
|
360
446
|
grants: z.ZodArray<z.ZodObject<{
|
|
@@ -365,17 +451,20 @@ export declare const spacePersonInviteWriteSchema: z.ZodObject<{
|
|
|
365
451
|
editor: "editor";
|
|
366
452
|
manager: "manager";
|
|
367
453
|
}>;
|
|
454
|
+
target: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
455
|
+
kind: z.ZodLiteral<"live">;
|
|
456
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
457
|
+
kind: z.ZodLiteral<"version">;
|
|
458
|
+
versionId: z.ZodString;
|
|
459
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
460
|
+
kind: z.ZodLiteral<"branch">;
|
|
461
|
+
branch: z.ZodString;
|
|
462
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
463
|
+
kind: z.ZodLiteral<"all_versions">;
|
|
464
|
+
}, z.core.$strict>], "kind">>;
|
|
368
465
|
}, z.core.$strip>>;
|
|
369
466
|
}, z.core.$strip>;
|
|
370
|
-
export
|
|
371
|
-
scope: z.ZodString;
|
|
372
|
-
role: z.ZodEnum<{
|
|
373
|
-
viewer: "viewer";
|
|
374
|
-
commenter: "commenter";
|
|
375
|
-
editor: "editor";
|
|
376
|
-
manager: "manager";
|
|
377
|
-
}>;
|
|
378
|
-
}, z.core.$strip>;
|
|
467
|
+
export type PersonGrantWrite = z.infer<typeof personGrantWriteSchema>;
|
|
379
468
|
export declare const spacePersonGrantSetWriteSchema: z.ZodObject<{
|
|
380
469
|
grants: z.ZodArray<z.ZodObject<{
|
|
381
470
|
scope: z.ZodString;
|
|
@@ -385,6 +474,17 @@ export declare const spacePersonGrantSetWriteSchema: z.ZodObject<{
|
|
|
385
474
|
editor: "editor";
|
|
386
475
|
manager: "manager";
|
|
387
476
|
}>;
|
|
477
|
+
target: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
478
|
+
kind: z.ZodLiteral<"live">;
|
|
479
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
480
|
+
kind: z.ZodLiteral<"version">;
|
|
481
|
+
versionId: z.ZodString;
|
|
482
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
483
|
+
kind: z.ZodLiteral<"branch">;
|
|
484
|
+
branch: z.ZodString;
|
|
485
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
486
|
+
kind: z.ZodLiteral<"all_versions">;
|
|
487
|
+
}, z.core.$strict>], "kind">>;
|
|
388
488
|
}, z.core.$strip>>;
|
|
389
489
|
}, z.core.$strip>;
|
|
390
490
|
export declare const accessShareLinkCreateSchema: z.ZodObject<{
|
|
@@ -530,6 +630,15 @@ export declare const teamSpaceAccessDefaultWriteSchema: z.ZodObject<{
|
|
|
530
630
|
}, z.core.$strip>;
|
|
531
631
|
export declare const ACCESS_TOKEN_KID = "spacefast-runtime-v1";
|
|
532
632
|
export declare const ACCESS_TOKEN_ALG = "EdDSA";
|
|
633
|
+
/**
|
|
634
|
+
* The claim-schema version every platform token carries in `v`. One signer,
|
|
635
|
+
* one claim contract: a verifier that understands v1 refuses a token minted
|
|
636
|
+
* under a later shape instead of reading unknown claims optimistically.
|
|
637
|
+
*/
|
|
638
|
+
export declare const PLATFORM_TOKEN_CLAIM_VERSION: 1;
|
|
639
|
+
export declare const BLOB_GATE_DOWNLOAD_TTL_SECONDS: number;
|
|
640
|
+
export declare const BLOB_GATE_SCAN_TTL_SECONDS: number;
|
|
641
|
+
export declare const BLOB_GATE_UPLOAD_TTL_SECONDS: number;
|
|
533
642
|
export declare const RUNTIME_JWKS_WELL_KNOWN_FILENAME = "spacefast-runtime-jwks.json";
|
|
534
643
|
export declare const accessTokenPublicProfileSchema: z.ZodObject<{
|
|
535
644
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -538,6 +647,8 @@ export declare const accessTokenPublicProfileSchema: z.ZodObject<{
|
|
|
538
647
|
}, z.core.$strict>;
|
|
539
648
|
export type AccessTokenPublicProfile = z.infer<typeof accessTokenPublicProfileSchema>;
|
|
540
649
|
export declare const accessTokenPayloadSchema: z.ZodObject<{
|
|
650
|
+
purpose: z.ZodLiteral<"handoff">;
|
|
651
|
+
v: z.ZodLiteral<1>;
|
|
541
652
|
sub: z.ZodString;
|
|
542
653
|
principal: z.ZodOptional<z.ZodString>;
|
|
543
654
|
authorities: z.ZodArray<z.ZodString>;
|
|
@@ -546,6 +657,7 @@ export declare const accessTokenPayloadSchema: z.ZodObject<{
|
|
|
546
657
|
iat: z.ZodNumber;
|
|
547
658
|
iss: z.ZodString;
|
|
548
659
|
aud: z.ZodString;
|
|
660
|
+
host: z.ZodString;
|
|
549
661
|
spaceId: z.ZodString;
|
|
550
662
|
sid: z.ZodString;
|
|
551
663
|
generation: z.ZodNumber;
|
package/dist/contracts/access.js
CHANGED
|
@@ -6,8 +6,48 @@ import { grantConstraintsPatchSchema, grantConstraintsSchema, grantResourceSetSc
|
|
|
6
6
|
export const SPACE_ACCESS_PRESETS = ["private", "team", "public"];
|
|
7
7
|
export const ACCESS_HANDOFF_MEDIA_TYPE = "application/vnd.spacefast.access-handoff+json";
|
|
8
8
|
export const spaceAccessPresetSchema = z.enum(SPACE_ACCESS_PRESETS);
|
|
9
|
+
/**
|
|
10
|
+
* The sharing vocabulary. Capabilities are the ground truth; a role is a named
|
|
11
|
+
* set of them, ordered from least to most. This is the only role enum and the
|
|
12
|
+
* only role⇄capability mapping in the product — every surface (dashboard, CLI,
|
|
13
|
+
* API, comments) names access with these four words and derives capabilities
|
|
14
|
+
* here rather than keeping its own preset list.
|
|
15
|
+
*/
|
|
9
16
|
export const ACCESS_ROLES = ["viewer", "commenter", "editor", "manager"];
|
|
10
17
|
export const accessRoleSchema = z.enum(ACCESS_ROLES);
|
|
18
|
+
export const ACCESS_ROLE_CAPABILITIES = {
|
|
19
|
+
viewer: ["page.view"],
|
|
20
|
+
commenter: ["page.view", "comments.read", "comments.write"],
|
|
21
|
+
editor: ["page.view", "comments.read", "comments.write", "content.publish"],
|
|
22
|
+
manager: ["page.view", "comments.read", "comments.write", "content.publish", "access.manage"],
|
|
23
|
+
};
|
|
24
|
+
export function accessRoleCapabilities(role) {
|
|
25
|
+
return [...ACCESS_ROLE_CAPABILITIES[role]];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The role a capability set amounts to, named by the strongest capability it
|
|
29
|
+
* carries. A Grant assembled capability-by-capability need not match a role
|
|
30
|
+
* exactly; this reports the role it reaches, never more.
|
|
31
|
+
*/
|
|
32
|
+
export function accessRoleForCapabilities(capabilities) {
|
|
33
|
+
if (capabilities.includes("access.manage"))
|
|
34
|
+
return "manager";
|
|
35
|
+
if (capabilities.includes("content.publish"))
|
|
36
|
+
return "editor";
|
|
37
|
+
if (capabilities.includes("comments.write"))
|
|
38
|
+
return "commenter";
|
|
39
|
+
return "viewer";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Roles a credential-backed audience can carry. A Link or a password is a
|
|
43
|
+
* secret anyone can forward, so it never publishes and never manages access —
|
|
44
|
+
* the same boundary `grantSchema` enforces on the capabilities themselves.
|
|
45
|
+
*/
|
|
46
|
+
export const VISITOR_ACCESS_ROLES = [
|
|
47
|
+
"viewer",
|
|
48
|
+
"commenter",
|
|
49
|
+
];
|
|
50
|
+
export const linkCapabilitySchema = z.enum(["page.view", "comments.read", "comments.write"]);
|
|
11
51
|
export function accessRoleRank(role) {
|
|
12
52
|
return ACCESS_ROLES.indexOf(role);
|
|
13
53
|
}
|
|
@@ -134,6 +174,7 @@ export const personGrantSchema = z.object({
|
|
|
134
174
|
id: z.string().min(1),
|
|
135
175
|
scope: accessScopePathSchema,
|
|
136
176
|
role: accessRoleSchema,
|
|
177
|
+
target: grantTargetSelectorSchema,
|
|
137
178
|
createdAt: z.string().datetime(),
|
|
138
179
|
revokedAt: z.string().datetime().nullable(),
|
|
139
180
|
});
|
|
@@ -184,7 +225,7 @@ export const accessShareLinkSchema = z.object({
|
|
|
184
225
|
name: z.string().min(1),
|
|
185
226
|
landingPath: accessScopePathSchema,
|
|
186
227
|
resources: grantResourceSetSchema,
|
|
187
|
-
capabilities: z.array(
|
|
228
|
+
capabilities: z.array(linkCapabilitySchema).min(1),
|
|
188
229
|
constraints: grantConstraintsSchema,
|
|
189
230
|
target: grantTargetSelectorSchema,
|
|
190
231
|
createdBy: z.string().nullable(),
|
|
@@ -240,7 +281,7 @@ export const accessFenceKindValues = ["none", "ownership", "exposure"];
|
|
|
240
281
|
export const accessFenceKindSchema = z.enum(accessFenceKindValues);
|
|
241
282
|
export const ACCESS_GRANT_SCOPE_LIMIT = 32;
|
|
242
283
|
export const linkCapabilitiesSchema = z
|
|
243
|
-
.array(
|
|
284
|
+
.array(linkCapabilitySchema)
|
|
244
285
|
.min(1)
|
|
245
286
|
.refine((capabilities) => capabilities.includes("page.view"), {
|
|
246
287
|
message: "Link capabilities must include page.view",
|
|
@@ -248,16 +289,16 @@ export const linkCapabilitiesSchema = z
|
|
|
248
289
|
.refine((capabilities) => new Set(capabilities).size === capabilities.length, {
|
|
249
290
|
message: "Link capabilities must be unique",
|
|
250
291
|
});
|
|
251
|
-
export const spacePersonInviteWriteSchema = z.object({
|
|
252
|
-
email: z.string().email(),
|
|
253
|
-
grants: z
|
|
254
|
-
.array(z.object({ scope: accessScopePathSchema, role: accessRoleSchema }))
|
|
255
|
-
.min(1)
|
|
256
|
-
.max(ACCESS_GRANT_SCOPE_LIMIT),
|
|
257
|
-
});
|
|
258
292
|
export const personGrantWriteSchema = z.object({
|
|
259
293
|
scope: accessScopePathSchema,
|
|
260
294
|
role: accessRoleSchema,
|
|
295
|
+
// A Person can be invited to the live site, to one immutable Version, to a
|
|
296
|
+
// branch, or to every Version — the same selector Links and Grants take.
|
|
297
|
+
target: grantTargetSelectorSchema.default({ kind: "live" }),
|
|
298
|
+
});
|
|
299
|
+
export const spacePersonInviteWriteSchema = z.object({
|
|
300
|
+
email: z.string().email(),
|
|
301
|
+
grants: z.array(personGrantWriteSchema).min(1).max(ACCESS_GRANT_SCOPE_LIMIT),
|
|
261
302
|
});
|
|
262
303
|
export const spacePersonGrantSetWriteSchema = z.object({
|
|
263
304
|
grants: z.array(personGrantWriteSchema).min(1).max(ACCESS_GRANT_SCOPE_LIMIT),
|
|
@@ -317,6 +358,15 @@ export const teamSpaceAccessDefaultWriteSchema = z.object({
|
|
|
317
358
|
// ---------------------------------------------------------------------------
|
|
318
359
|
export const ACCESS_TOKEN_KID = "spacefast-runtime-v1";
|
|
319
360
|
export const ACCESS_TOKEN_ALG = "EdDSA";
|
|
361
|
+
/**
|
|
362
|
+
* The claim-schema version every platform token carries in `v`. One signer,
|
|
363
|
+
* one claim contract: a verifier that understands v1 refuses a token minted
|
|
364
|
+
* under a later shape instead of reading unknown claims optimistically.
|
|
365
|
+
*/
|
|
366
|
+
export const PLATFORM_TOKEN_CLAIM_VERSION = 1;
|
|
367
|
+
export const BLOB_GATE_DOWNLOAD_TTL_SECONDS = 10 * 60;
|
|
368
|
+
export const BLOB_GATE_SCAN_TTL_SECONDS = 60 * 60;
|
|
369
|
+
export const BLOB_GATE_UPLOAD_TTL_SECONDS = 60 * 60;
|
|
320
370
|
export const RUNTIME_JWKS_WELL_KNOWN_FILENAME = "spacefast-runtime-jwks.json";
|
|
321
371
|
// Public identity attached only when a token consumer needs to render the
|
|
322
372
|
// person behind an authority. Collaboration tickets carry this audience-bound
|
|
@@ -335,6 +385,13 @@ export const accessTokenPublicProfileSchema = z
|
|
|
335
385
|
})
|
|
336
386
|
.strict();
|
|
337
387
|
export const accessTokenPayloadSchema = z.object({
|
|
388
|
+
// Typed purpose from the one platform signer. The runtime REQUIRES exactly
|
|
389
|
+
// this value before consuming the jti: a system-view token (or any other
|
|
390
|
+
// purpose signed by the same key) can never redeem into a visitor session,
|
|
391
|
+
// and a handoff can never pass a system-view check.
|
|
392
|
+
purpose: z.literal("handoff"),
|
|
393
|
+
// Claim-schema version stamped by the one signer.
|
|
394
|
+
v: z.literal(PLATFORM_TOKEN_CLAIM_VERSION),
|
|
338
395
|
sub: authorityReferenceSchema,
|
|
339
396
|
// Who this handoff authenticated, when it authenticated anybody. The account
|
|
340
397
|
// lane names the signed-in user; the invite and identity-connection lanes
|
|
@@ -348,7 +405,14 @@ export const accessTokenPayloadSchema = z.object({
|
|
|
348
405
|
nbf: z.number().int().nonnegative(),
|
|
349
406
|
iat: z.number().int().nonnegative(),
|
|
350
407
|
iss: z.string().min(1),
|
|
408
|
+
// The Space this handoff belongs to, and the token's identity: a Space keeps
|
|
409
|
+
// its id across claim, rename, and every custom domain it later answers on,
|
|
410
|
+
// so the audience is stable where a serving host is not.
|
|
351
411
|
aud: z.string().min(1),
|
|
412
|
+
// The lowercased serving host the handoff was minted for. Host binding did
|
|
413
|
+
// not go away when `aud` stopped carrying it — it lives here, and the runtime
|
|
414
|
+
// rejects a token presented on any other host.
|
|
415
|
+
host: z.string().min(1),
|
|
352
416
|
spaceId: z.string().min(1),
|
|
353
417
|
// Shared opaque identity for the runtime session and its access-origin
|
|
354
418
|
// collaboration session. It is random per handoff and never authorizes by itself.
|
|
@@ -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.
|
|
2
|
+
export declare const ACTIVITY_EVENT_CODES: readonly ["space.created", "space.claimed", "feedback.lead_claim_pending", "space.transferred", "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", "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", "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;
|
|
@@ -11,8 +11,6 @@ export const ACTIVITY_EVENT_CODES = [
|
|
|
11
11
|
"space.claimed",
|
|
12
12
|
"feedback.lead_claim_pending",
|
|
13
13
|
"space.transferred",
|
|
14
|
-
"space.move_requested",
|
|
15
|
-
"space.moved",
|
|
16
14
|
"space.expired",
|
|
17
15
|
"space.disabled",
|
|
18
16
|
"space.enabled",
|
|
@@ -43,8 +41,6 @@ export const ACTIVITY_EVENT_CODES = [
|
|
|
43
41
|
"version.expired",
|
|
44
42
|
"version.canceled",
|
|
45
43
|
"version.deleted",
|
|
46
|
-
"version.retention_warning",
|
|
47
|
-
"version.retention_deleted",
|
|
48
44
|
// channel
|
|
49
45
|
"channel.promoted",
|
|
50
46
|
// build
|
|
@@ -109,11 +105,6 @@ export const ACTIVITY_EVENT_CODES = [
|
|
|
109
105
|
"tenant.suspended",
|
|
110
106
|
"tenant.reactivated",
|
|
111
107
|
"tenant.deleted",
|
|
112
|
-
// export / import
|
|
113
|
-
"export.ready",
|
|
114
|
-
"export.failed",
|
|
115
|
-
"import.ready",
|
|
116
|
-
"import.failed",
|
|
117
108
|
// comments
|
|
118
109
|
"comment.token_minted",
|
|
119
110
|
"comment.created",
|