@spacefast/common 0.0.13 → 0.0.17
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/agents/client-registry.d.ts +22 -0
- package/dist/agents/client-registry.js +41 -0
- package/dist/agents/connect-targets.d.ts +51 -6
- package/dist/agents/connect-targets.js +93 -28
- package/dist/brand.d.ts +0 -11
- package/dist/brand.js +0 -20
- package/dist/config/domains.d.ts +15 -6
- package/dist/config/domains.js +24 -10
- package/dist/config/postgres-budget.d.ts +3 -0
- package/dist/config/postgres-budget.js +6 -1
- package/dist/config/postgres-budget.json +2 -1
- package/dist/contracts/abuse.js +1 -1
- package/dist/contracts/access.d.ts +149 -44
- package/dist/contracts/access.js +94 -8
- package/dist/contracts/activity.js +5 -1
- package/dist/contracts/api-keys.js +9 -9
- package/dist/contracts/archives.js +11 -11
- package/dist/contracts/beta.js +1 -1
- package/dist/contracts/builds.js +14 -14
- package/dist/contracts/channels.js +2 -2
- package/dist/contracts/comments.d.ts +86 -15
- package/dist/contracts/comments.js +116 -20
- package/dist/contracts/common.d.ts +12 -12
- package/dist/contracts/common.js +33 -30
- package/dist/contracts/continuation.js +5 -5
- package/dist/contracts/data-source-routes.js +1 -1
- package/dist/contracts/device-auth.d.ts +6 -6
- package/dist/contracts/device-auth.js +12 -12
- package/dist/contracts/docs.d.ts +10 -10
- package/dist/contracts/domains.js +39 -33
- package/dist/contracts/enums.d.ts +2 -10
- package/dist/contracts/enums.js +0 -2
- package/dist/contracts/error-code-meta.d.ts +116 -47
- package/dist/contracts/error-code-meta.js +37 -16
- package/dist/contracts/error-codes.d.ts +7 -4
- package/dist/contracts/error-codes.js +46 -21
- package/dist/contracts/events.d.ts +10 -3
- package/dist/contracts/events.js +33 -5
- package/dist/contracts/execution.d.ts +26 -0
- package/dist/contracts/execution.js +21 -0
- package/dist/contracts/feature-lifecycle.d.ts +21 -24
- package/dist/contracts/feature-lifecycle.js +28 -26
- package/dist/contracts/features.js +4 -4
- package/dist/contracts/functions.d.ts +8 -140
- package/dist/contracts/functions.js +9 -19
- package/dist/contracts/git.d.ts +1 -1
- package/dist/contracts/grants.d.ts +96 -79
- package/dist/contracts/grants.js +130 -43
- package/dist/contracts/ids.d.ts +2 -2
- package/dist/contracts/ids.js +2 -4
- package/dist/contracts/internal.js +2 -2
- package/dist/contracts/mcp.d.ts +17 -556
- package/dist/contracts/mcp.js +9 -103
- package/dist/contracts/me.js +3 -4
- package/dist/contracts/notifications.d.ts +108 -0
- package/dist/contracts/notifications.js +54 -0
- package/dist/contracts/oauth-resources.d.ts +18 -1
- package/dist/contracts/oauth-resources.js +22 -2
- package/dist/contracts/operations.d.ts +2 -50
- package/dist/contracts/operations.js +0 -19
- package/dist/contracts/pages.d.ts +8 -4
- package/dist/contracts/pages.js +16 -3
- package/dist/contracts/platform.js +10 -8
- package/dist/contracts/problem-document.d.ts +14 -0
- package/dist/contracts/problem-document.js +35 -0
- package/dist/contracts/push-new.d.ts +21 -6
- package/dist/contracts/push-new.js +3 -7
- package/dist/contracts/resources.d.ts +8 -7
- package/dist/contracts/resources.js +9 -6
- package/dist/contracts/runtime-api.d.ts +162 -92
- package/dist/contracts/runtime-api.js +99 -27
- package/dist/contracts/runtime-app.d.ts +41 -11
- package/dist/contracts/runtime-app.js +22 -1
- package/dist/contracts/runtime-db.d.ts +424 -0
- package/dist/contracts/runtime-db.js +108 -0
- package/dist/contracts/runtime-storage.d.ts +120 -0
- package/dist/contracts/runtime-storage.js +40 -0
- package/dist/contracts/sf-config-v1.d.ts +49 -1
- package/dist/contracts/sf-config-v1.js +2 -2
- package/dist/contracts/sites.d.ts +1 -0
- package/dist/contracts/sites.js +20 -12
- package/dist/contracts/space-config.d.ts +62 -22
- package/dist/contracts/space-config.js +173 -47
- package/dist/contracts/spaces.d.ts +79 -45
- package/dist/contracts/spaces.js +66 -50
- package/dist/contracts/superadmin-spaces.d.ts +13 -2
- package/dist/contracts/superadmin-spaces.js +15 -0
- package/dist/contracts/superadmin-tenants.js +4 -4
- package/dist/contracts/superadmin.d.ts +4 -0
- package/dist/contracts/superadmin.js +14 -1
- package/dist/contracts/tags.d.ts +17 -17
- package/dist/contracts/tags.js +1 -1
- package/dist/contracts/teams.js +25 -16
- package/dist/contracts/theme-json.js +1 -1
- package/dist/contracts/transfers.js +4 -4
- package/dist/contracts/variables.js +3 -3
- package/dist/contracts/zero.d.ts +204 -338
- package/dist/contracts/zero.js +94 -98
- package/dist/dashboard-paths/index.d.ts +16 -1
- package/dist/dashboard-paths/index.js +18 -0
- package/dist/docs/agent-handoff-document.d.ts +2 -2
- package/dist/docs/agent-handoff-document.js +8 -7
- package/dist/docs/agent-prose.d.ts +22 -3
- package/dist/docs/agent-prose.js +221 -51
- package/dist/docs/agent-setup.d.ts +13 -10
- package/dist/docs/agent-setup.js +279 -53
- package/dist/docs/agent-solutions.d.ts +6 -6
- package/dist/docs/agent-solutions.js +23 -21
- package/dist/docs/catalog.d.ts +29 -74
- package/dist/docs/catalog.js +65 -92
- package/dist/docs/error-docs.js +293 -221
- package/dist/docs/skill-distribution.d.ts +2 -0
- package/dist/docs/skill-distribution.js +7 -4
- package/dist/docs/skills.d.ts +546 -0
- package/dist/docs/skills.js +340 -0
- package/dist/utils/browser-credential.d.ts +19 -0
- package/dist/utils/browser-credential.js +62 -0
- package/dist/utils/comment-avatars.d.ts +7 -0
- package/dist/utils/comment-avatars.js +42 -0
- package/dist/utils/content-type.d.ts +3 -3
- package/dist/utils/content-type.js +38 -61
- package/dist/utils/domain-diagnostics.d.ts +5 -5
- package/dist/utils/domain-diagnostics.js +21 -10
- package/dist/utils/local-space-state.d.ts +78 -4
- package/dist/utils/local-space-state.js +383 -82
- package/dist/utils/one-shot-replay.d.ts +14 -0
- package/dist/utils/one-shot-replay.js +21 -0
- package/dist/utils/page-preview.d.ts +7 -0
- package/dist/utils/page-preview.js +9 -0
- package/dist/utils/pages.d.ts +2 -11
- package/dist/utils/pages.js +58 -14
- package/dist/utils/publish-form-data.d.ts +22 -0
- package/dist/utils/publish-form-data.js +26 -0
- package/dist/utils/publish-policy.js +20 -4
- package/dist/utils/query-keys.d.ts +7 -4
- package/dist/utils/query-keys.js +13 -4
- package/dist/utils/runtime-paths.d.ts +3 -0
- package/dist/utils/runtime-paths.js +7 -0
- package/dist/utils/secure-local-file.d.ts +73 -0
- package/dist/utils/secure-local-file.js +1373 -0
- package/dist/utils/space-config.d.ts +13 -4
- package/dist/utils/space-config.js +123 -15
- package/dist/utils/storage-policy.d.ts +20 -0
- package/dist/utils/storage-policy.fixtures.json +174 -0
- package/dist/utils/storage-policy.js +193 -0
- package/dist/utils/upload-session.d.ts +12 -1
- package/dist/utils/upload-session.js +37 -2
- package/dist/utils/version-file-browser.d.ts +13 -0
- package/dist/utils/version-file-browser.js +59 -0
- package/package.json +19 -1
- package/dist/contracts/mounts.d.ts +0 -142
- package/dist/contracts/mounts.js +0 -56
- package/dist/utils/asset-fingerprint.d.ts +0 -64
- package/dist/utils/asset-fingerprint.js +0 -620
|
@@ -22,14 +22,29 @@ export declare function maxAccessRole(left: AccessRole | null, right: AccessRole
|
|
|
22
22
|
* comments, and runtime authorization.
|
|
23
23
|
*/
|
|
24
24
|
export declare function normalizeAccessScopePath(input: string): string;
|
|
25
|
-
export declare const accessScopePathSchema: z.
|
|
25
|
+
export declare const accessScopePathSchema: z.ZodString;
|
|
26
26
|
export type AccessScopePath = z.infer<typeof accessScopePathSchema>;
|
|
27
27
|
export declare function accessScopeContains(scope: string, path: string): boolean;
|
|
28
28
|
export declare const authorityReferenceSchema: z.ZodString;
|
|
29
29
|
export type AuthorityReference = z.infer<typeof authorityReferenceSchema>;
|
|
30
|
+
export declare const accountPrincipalSchema: z.ZodString;
|
|
31
|
+
export type AccountPrincipal = z.infer<typeof accountPrincipalSchema>;
|
|
32
|
+
export declare const identifiedPrincipalSchema: z.ZodString;
|
|
33
|
+
export type IdentifiedPrincipal = z.infer<typeof identifiedPrincipalSchema>;
|
|
34
|
+
export declare const accessPrincipalSchema: z.ZodUnion<readonly [z.ZodLiteral<"anonymous">, z.ZodString]>;
|
|
35
|
+
export type AccessPrincipal = z.infer<typeof accessPrincipalSchema>;
|
|
36
|
+
export declare function accountPrincipal(userId: string): AccountPrincipal;
|
|
37
|
+
/** The user id behind an account principal; null for anonymous or malformed. */
|
|
38
|
+
export declare function accountPrincipalUserId(principal: string | undefined | null): string | null;
|
|
39
|
+
/**
|
|
40
|
+
* The identity an authority reference names on its own, if any. Credential
|
|
41
|
+
* classes name nobody. This is the ONE place a class maps to an identity: at
|
|
42
|
+
* the exchange that just authenticated it, never downstream.
|
|
43
|
+
*/
|
|
44
|
+
export declare function principalForAuthority(reference: AuthorityReference): IdentifiedPrincipal | undefined;
|
|
30
45
|
export declare const personGrantSchema: z.ZodObject<{
|
|
31
46
|
id: z.ZodString;
|
|
32
|
-
scope: z.
|
|
47
|
+
scope: z.ZodString;
|
|
33
48
|
role: z.ZodEnum<{
|
|
34
49
|
viewer: "viewer";
|
|
35
50
|
commenter: "commenter";
|
|
@@ -59,7 +74,7 @@ export declare const spacePersonSchema: z.ZodObject<{
|
|
|
59
74
|
}>;
|
|
60
75
|
grants: z.ZodArray<z.ZodObject<{
|
|
61
76
|
id: z.ZodString;
|
|
62
|
-
scope: z.
|
|
77
|
+
scope: z.ZodString;
|
|
63
78
|
role: z.ZodEnum<{
|
|
64
79
|
viewer: "viewer";
|
|
65
80
|
commenter: "commenter";
|
|
@@ -79,7 +94,7 @@ export type SpacePerson = z.infer<typeof spacePersonSchema>;
|
|
|
79
94
|
export declare const inheritedTeamAccessSchema: z.ZodObject<{
|
|
80
95
|
teamId: z.ZodString;
|
|
81
96
|
teamName: z.ZodString;
|
|
82
|
-
ruleScopes: z.ZodArray<z.
|
|
97
|
+
ruleScopes: z.ZodArray<z.ZodString>;
|
|
83
98
|
members: z.ZodArray<z.ZodObject<{
|
|
84
99
|
membershipId: z.ZodString;
|
|
85
100
|
userId: z.ZodString;
|
|
@@ -103,7 +118,7 @@ export declare const spacePeopleListSchema: z.ZodObject<{
|
|
|
103
118
|
}>;
|
|
104
119
|
grants: z.ZodArray<z.ZodObject<{
|
|
105
120
|
id: z.ZodString;
|
|
106
|
-
scope: z.
|
|
121
|
+
scope: z.ZodString;
|
|
107
122
|
role: z.ZodEnum<{
|
|
108
123
|
viewer: "viewer";
|
|
109
124
|
commenter: "commenter";
|
|
@@ -122,7 +137,7 @@ export declare const spacePeopleListSchema: z.ZodObject<{
|
|
|
122
137
|
inheritedTeamAccess: z.ZodNullable<z.ZodObject<{
|
|
123
138
|
teamId: z.ZodString;
|
|
124
139
|
teamName: z.ZodString;
|
|
125
|
-
ruleScopes: z.ZodArray<z.
|
|
140
|
+
ruleScopes: z.ZodArray<z.ZodString>;
|
|
126
141
|
members: z.ZodArray<z.ZodObject<{
|
|
127
142
|
membershipId: z.ZodString;
|
|
128
143
|
userId: z.ZodString;
|
|
@@ -138,11 +153,12 @@ export declare const accessShareLinkSchema: z.ZodObject<{
|
|
|
138
153
|
id: z.ZodString;
|
|
139
154
|
spaceId: z.ZodString;
|
|
140
155
|
grantId: z.ZodString;
|
|
156
|
+
revision: z.ZodNumber;
|
|
141
157
|
name: z.ZodString;
|
|
142
|
-
landingPath: z.
|
|
158
|
+
landingPath: z.ZodString;
|
|
143
159
|
resources: z.ZodObject<{
|
|
144
|
-
include: z.ZodArray<z.
|
|
145
|
-
exclude: z.ZodDefault<z.ZodArray<z.
|
|
160
|
+
include: z.ZodArray<z.ZodString>;
|
|
161
|
+
exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
146
162
|
}, z.core.$strict>;
|
|
147
163
|
capabilities: z.ZodArray<z.ZodEnum<{
|
|
148
164
|
"page.view": "page.view";
|
|
@@ -155,9 +171,9 @@ export declare const accessShareLinkSchema: z.ZodObject<{
|
|
|
155
171
|
maxUses: z.ZodOptional<z.ZodNumber>;
|
|
156
172
|
requireVerifiedEmail: z.ZodOptional<z.ZodBoolean>;
|
|
157
173
|
network: z.ZodOptional<z.ZodObject<{
|
|
158
|
-
ipCidrs: z.ZodOptional<z.ZodArray<z.
|
|
159
|
-
countries: z.ZodOptional<z.ZodArray<z.
|
|
160
|
-
excludedCountries: z.ZodOptional<z.ZodArray<z.
|
|
174
|
+
ipCidrs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
175
|
+
countries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
176
|
+
excludedCountries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
161
177
|
excludedUserAgentSubstrings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
162
178
|
}, z.core.$strict>>;
|
|
163
179
|
}, z.core.$strict>;
|
|
@@ -184,11 +200,12 @@ export declare const accessShareLinkWithUrlSchema: z.ZodObject<{
|
|
|
184
200
|
id: z.ZodString;
|
|
185
201
|
spaceId: z.ZodString;
|
|
186
202
|
grantId: z.ZodString;
|
|
203
|
+
revision: z.ZodNumber;
|
|
187
204
|
name: z.ZodString;
|
|
188
|
-
landingPath: z.
|
|
205
|
+
landingPath: z.ZodString;
|
|
189
206
|
resources: z.ZodObject<{
|
|
190
|
-
include: z.ZodArray<z.
|
|
191
|
-
exclude: z.ZodDefault<z.ZodArray<z.
|
|
207
|
+
include: z.ZodArray<z.ZodString>;
|
|
208
|
+
exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
192
209
|
}, z.core.$strict>;
|
|
193
210
|
capabilities: z.ZodArray<z.ZodEnum<{
|
|
194
211
|
"page.view": "page.view";
|
|
@@ -201,9 +218,9 @@ export declare const accessShareLinkWithUrlSchema: z.ZodObject<{
|
|
|
201
218
|
maxUses: z.ZodOptional<z.ZodNumber>;
|
|
202
219
|
requireVerifiedEmail: z.ZodOptional<z.ZodBoolean>;
|
|
203
220
|
network: z.ZodOptional<z.ZodObject<{
|
|
204
|
-
ipCidrs: z.ZodOptional<z.ZodArray<z.
|
|
205
|
-
countries: z.ZodOptional<z.ZodArray<z.
|
|
206
|
-
excludedCountries: z.ZodOptional<z.ZodArray<z.
|
|
221
|
+
ipCidrs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
222
|
+
countries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
223
|
+
excludedCountries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
207
224
|
excludedUserAgentSubstrings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
208
225
|
}, z.core.$strict>>;
|
|
209
226
|
}, z.core.$strict>;
|
|
@@ -227,6 +244,60 @@ export declare const accessShareLinkWithUrlSchema: z.ZodObject<{
|
|
|
227
244
|
url: z.ZodString;
|
|
228
245
|
}, z.core.$strip>;
|
|
229
246
|
export type AccessShareLinkWithUrl = z.infer<typeof accessShareLinkWithUrlSchema>;
|
|
247
|
+
export declare const accessShareLinkReadSchema: z.ZodObject<{
|
|
248
|
+
id: z.ZodString;
|
|
249
|
+
spaceId: z.ZodString;
|
|
250
|
+
grantId: z.ZodString;
|
|
251
|
+
revision: z.ZodNumber;
|
|
252
|
+
name: z.ZodString;
|
|
253
|
+
landingPath: z.ZodString;
|
|
254
|
+
resources: z.ZodObject<{
|
|
255
|
+
include: z.ZodArray<z.ZodString>;
|
|
256
|
+
exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
257
|
+
}, z.core.$strict>;
|
|
258
|
+
capabilities: z.ZodArray<z.ZodEnum<{
|
|
259
|
+
"page.view": "page.view";
|
|
260
|
+
"comments.read": "comments.read";
|
|
261
|
+
"comments.write": "comments.write";
|
|
262
|
+
}>>;
|
|
263
|
+
constraints: z.ZodObject<{
|
|
264
|
+
notBefore: z.ZodOptional<z.ZodString>;
|
|
265
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
266
|
+
maxUses: z.ZodOptional<z.ZodNumber>;
|
|
267
|
+
requireVerifiedEmail: z.ZodOptional<z.ZodBoolean>;
|
|
268
|
+
network: z.ZodOptional<z.ZodObject<{
|
|
269
|
+
ipCidrs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
270
|
+
countries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
271
|
+
excludedCountries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
272
|
+
excludedUserAgentSubstrings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
273
|
+
}, z.core.$strict>>;
|
|
274
|
+
}, z.core.$strict>;
|
|
275
|
+
target: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
276
|
+
kind: z.ZodLiteral<"live">;
|
|
277
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
278
|
+
kind: z.ZodLiteral<"version">;
|
|
279
|
+
versionId: z.ZodString;
|
|
280
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
281
|
+
kind: z.ZodLiteral<"branch">;
|
|
282
|
+
branch: z.ZodString;
|
|
283
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
284
|
+
kind: z.ZodLiteral<"all_versions">;
|
|
285
|
+
}, z.core.$strict>], "kind">;
|
|
286
|
+
createdBy: z.ZodNullable<z.ZodString>;
|
|
287
|
+
openCount: z.ZodNumber;
|
|
288
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
289
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
290
|
+
createdAt: z.ZodString;
|
|
291
|
+
active: z.ZodBoolean;
|
|
292
|
+
url: z.ZodNullable<z.ZodString>;
|
|
293
|
+
}, z.core.$strip>;
|
|
294
|
+
export type AccessShareLinkRead = z.infer<typeof accessShareLinkReadSchema>;
|
|
295
|
+
export declare const publishedAccessSchema: z.ZodObject<{
|
|
296
|
+
url: z.ZodString;
|
|
297
|
+
token: z.ZodString;
|
|
298
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
299
|
+
}, z.core.$strip>;
|
|
300
|
+
export type PublishedAccess = z.infer<typeof publishedAccessSchema>;
|
|
230
301
|
export declare const canonicalAccessRequestStatusSchema: z.ZodEnum<{
|
|
231
302
|
canceled: "canceled";
|
|
232
303
|
expired: "expired";
|
|
@@ -247,7 +318,7 @@ export declare const canonicalAccessRequestSchema: z.ZodObject<{
|
|
|
247
318
|
spaceId: z.ZodString;
|
|
248
319
|
displayName: z.ZodNullable<z.ZodString>;
|
|
249
320
|
email: z.ZodString;
|
|
250
|
-
scope: z.
|
|
321
|
+
scope: z.ZodString;
|
|
251
322
|
requestedRole: z.ZodEnum<{
|
|
252
323
|
viewer: "viewer";
|
|
253
324
|
commenter: "commenter";
|
|
@@ -287,7 +358,7 @@ export type LinkCapabilities = z.infer<typeof linkCapabilitiesSchema>;
|
|
|
287
358
|
export declare const spacePersonInviteWriteSchema: z.ZodObject<{
|
|
288
359
|
email: z.ZodString;
|
|
289
360
|
grants: z.ZodArray<z.ZodObject<{
|
|
290
|
-
scope: z.
|
|
361
|
+
scope: z.ZodString;
|
|
291
362
|
role: z.ZodEnum<{
|
|
292
363
|
viewer: "viewer";
|
|
293
364
|
commenter: "commenter";
|
|
@@ -297,7 +368,7 @@ export declare const spacePersonInviteWriteSchema: z.ZodObject<{
|
|
|
297
368
|
}, z.core.$strip>>;
|
|
298
369
|
}, z.core.$strip>;
|
|
299
370
|
export declare const personGrantWriteSchema: z.ZodObject<{
|
|
300
|
-
scope: z.
|
|
371
|
+
scope: z.ZodString;
|
|
301
372
|
role: z.ZodEnum<{
|
|
302
373
|
viewer: "viewer";
|
|
303
374
|
commenter: "commenter";
|
|
@@ -307,7 +378,7 @@ export declare const personGrantWriteSchema: z.ZodObject<{
|
|
|
307
378
|
}, z.core.$strip>;
|
|
308
379
|
export declare const spacePersonGrantSetWriteSchema: z.ZodObject<{
|
|
309
380
|
grants: z.ZodArray<z.ZodObject<{
|
|
310
|
-
scope: z.
|
|
381
|
+
scope: z.ZodString;
|
|
311
382
|
role: z.ZodEnum<{
|
|
312
383
|
viewer: "viewer";
|
|
313
384
|
commenter: "commenter";
|
|
@@ -318,10 +389,10 @@ export declare const spacePersonGrantSetWriteSchema: z.ZodObject<{
|
|
|
318
389
|
}, z.core.$strip>;
|
|
319
390
|
export declare const accessShareLinkCreateSchema: z.ZodObject<{
|
|
320
391
|
name: z.ZodString;
|
|
321
|
-
landingPath: z.ZodDefault<z.
|
|
392
|
+
landingPath: z.ZodDefault<z.ZodString>;
|
|
322
393
|
resources: z.ZodObject<{
|
|
323
|
-
include: z.ZodArray<z.
|
|
324
|
-
exclude: z.ZodDefault<z.ZodArray<z.
|
|
394
|
+
include: z.ZodArray<z.ZodString>;
|
|
395
|
+
exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
325
396
|
}, z.core.$strict>;
|
|
326
397
|
capabilities: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
327
398
|
"page.view": "page.view";
|
|
@@ -334,9 +405,9 @@ export declare const accessShareLinkCreateSchema: z.ZodObject<{
|
|
|
334
405
|
maxUses: z.ZodOptional<z.ZodNumber>;
|
|
335
406
|
requireVerifiedEmail: z.ZodOptional<z.ZodBoolean>;
|
|
336
407
|
network: z.ZodOptional<z.ZodObject<{
|
|
337
|
-
ipCidrs: z.ZodOptional<z.ZodArray<z.
|
|
338
|
-
countries: z.ZodOptional<z.ZodArray<z.
|
|
339
|
-
excludedCountries: z.ZodOptional<z.ZodArray<z.
|
|
408
|
+
ipCidrs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
409
|
+
countries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
410
|
+
excludedCountries: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
340
411
|
excludedUserAgentSubstrings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
341
412
|
}, z.core.$strict>>;
|
|
342
413
|
}, z.core.$strict>>;
|
|
@@ -353,11 +424,12 @@ export declare const accessShareLinkCreateSchema: z.ZodObject<{
|
|
|
353
424
|
}, z.core.$strict>], "kind">>;
|
|
354
425
|
}, z.core.$strip>;
|
|
355
426
|
export declare const accessShareLinkUpdateSchema: z.ZodObject<{
|
|
427
|
+
expectedRevision: z.ZodNumber;
|
|
356
428
|
name: z.ZodOptional<z.ZodString>;
|
|
357
|
-
landingPath: z.ZodOptional<z.
|
|
429
|
+
landingPath: z.ZodOptional<z.ZodString>;
|
|
358
430
|
resources: z.ZodOptional<z.ZodObject<{
|
|
359
|
-
include: z.ZodArray<z.
|
|
360
|
-
exclude: z.ZodDefault<z.ZodArray<z.
|
|
431
|
+
include: z.ZodArray<z.ZodString>;
|
|
432
|
+
exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
361
433
|
}, z.core.$strict>>;
|
|
362
434
|
capabilities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
363
435
|
"page.view": "page.view";
|
|
@@ -365,16 +437,16 @@ export declare const accessShareLinkUpdateSchema: z.ZodObject<{
|
|
|
365
437
|
"comments.write": "comments.write";
|
|
366
438
|
}>>>;
|
|
367
439
|
constraints: z.ZodOptional<z.ZodObject<{
|
|
368
|
-
notBefore: z.ZodOptional<z.ZodString
|
|
369
|
-
expiresAt: z.ZodOptional<z.ZodString
|
|
370
|
-
maxUses: z.ZodOptional<z.ZodNumber
|
|
371
|
-
requireVerifiedEmail: z.ZodOptional<z.ZodBoolean
|
|
372
|
-
network: z.ZodOptional<z.ZodObject<{
|
|
373
|
-
ipCidrs: z.ZodOptional<z.
|
|
374
|
-
countries: z.ZodOptional<z.
|
|
375
|
-
excludedCountries: z.ZodOptional<z.
|
|
376
|
-
excludedUserAgentSubstrings: z.ZodOptional<z.ZodArray<z.ZodString
|
|
377
|
-
}, z.core.$strict
|
|
440
|
+
notBefore: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
441
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
442
|
+
maxUses: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
443
|
+
requireVerifiedEmail: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
444
|
+
network: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
445
|
+
ipCidrs: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
446
|
+
countries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
447
|
+
excludedCountries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
448
|
+
excludedUserAgentSubstrings: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
449
|
+
}, z.core.$strict>>>;
|
|
378
450
|
}, z.core.$strict>>;
|
|
379
451
|
target: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
380
452
|
kind: z.ZodLiteral<"live">;
|
|
@@ -390,7 +462,7 @@ export declare const accessShareLinkUpdateSchema: z.ZodObject<{
|
|
|
390
462
|
}, z.core.$strip>;
|
|
391
463
|
export declare const canonicalAccessRequestCreateSchema: z.ZodObject<{
|
|
392
464
|
email: z.ZodString;
|
|
393
|
-
scope: z.
|
|
465
|
+
scope: z.ZodString;
|
|
394
466
|
requestedRole: z.ZodDefault<z.ZodEnum<{
|
|
395
467
|
viewer: "viewer";
|
|
396
468
|
commenter: "commenter";
|
|
@@ -400,7 +472,7 @@ export declare const canonicalAccessRequestCreateSchema: z.ZodObject<{
|
|
|
400
472
|
message: z.ZodOptional<z.ZodString>;
|
|
401
473
|
}, z.core.$strip>;
|
|
402
474
|
export declare const canonicalAccessRequestApproveSchema: z.ZodObject<{
|
|
403
|
-
scope: z.ZodOptional<z.
|
|
475
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
404
476
|
role: z.ZodOptional<z.ZodEnum<{
|
|
405
477
|
viewer: "viewer";
|
|
406
478
|
commenter: "commenter";
|
|
@@ -417,11 +489,31 @@ export declare const openHandoffSchema: z.ZodObject<{
|
|
|
417
489
|
claim_preview: "claim_preview";
|
|
418
490
|
}>;
|
|
419
491
|
}, z.core.$strip>;
|
|
492
|
+
export declare const openLinkSchema: z.ZodObject<{
|
|
493
|
+
url: z.ZodString;
|
|
494
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
495
|
+
kind: z.ZodLiteral<"link">;
|
|
496
|
+
}, z.core.$strip>;
|
|
497
|
+
export declare const privateOpenSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
498
|
+
url: z.ZodString;
|
|
499
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
500
|
+
kind: z.ZodLiteral<"link">;
|
|
501
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
502
|
+
url: z.ZodString;
|
|
503
|
+
expiresAt: z.ZodString;
|
|
504
|
+
kind: z.ZodEnum<{
|
|
505
|
+
management: "management";
|
|
506
|
+
person: "person";
|
|
507
|
+
claim_preview: "claim_preview";
|
|
508
|
+
}>;
|
|
509
|
+
}, z.core.$strip>]>;
|
|
420
510
|
export declare const openHandoffCreateSchema: z.ZodObject<{
|
|
421
|
-
landingPath: z.ZodDefault<z.
|
|
511
|
+
landingPath: z.ZodDefault<z.ZodString>;
|
|
422
512
|
targetHost: z.ZodOptional<z.ZodString>;
|
|
423
513
|
}, z.core.$strip>;
|
|
424
514
|
export type OpenHandoff = z.infer<typeof openHandoffSchema>;
|
|
515
|
+
export type OpenLink = z.infer<typeof openLinkSchema>;
|
|
516
|
+
export type PrivateOpen = z.infer<typeof privateOpenSchema>;
|
|
425
517
|
export declare const teamSpaceAccessDefaultSchema: z.ZodObject<{
|
|
426
518
|
newSpaceGrantPreset: z.ZodEnum<{
|
|
427
519
|
team: "team";
|
|
@@ -439,8 +531,15 @@ export declare const teamSpaceAccessDefaultWriteSchema: z.ZodObject<{
|
|
|
439
531
|
export declare const ACCESS_TOKEN_KID = "spacefast-runtime-v1";
|
|
440
532
|
export declare const ACCESS_TOKEN_ALG = "EdDSA";
|
|
441
533
|
export declare const RUNTIME_JWKS_WELL_KNOWN_FILENAME = "spacefast-runtime-jwks.json";
|
|
534
|
+
export declare const accessTokenPublicProfileSchema: z.ZodObject<{
|
|
535
|
+
name: z.ZodOptional<z.ZodString>;
|
|
536
|
+
username: z.ZodOptional<z.ZodString>;
|
|
537
|
+
avatar_url: z.ZodOptional<z.ZodURL>;
|
|
538
|
+
}, z.core.$strict>;
|
|
539
|
+
export type AccessTokenPublicProfile = z.infer<typeof accessTokenPublicProfileSchema>;
|
|
442
540
|
export declare const accessTokenPayloadSchema: z.ZodObject<{
|
|
443
541
|
sub: z.ZodString;
|
|
542
|
+
principal: z.ZodOptional<z.ZodString>;
|
|
444
543
|
authorities: z.ZodArray<z.ZodString>;
|
|
445
544
|
exp: z.ZodNumber;
|
|
446
545
|
nbf: z.ZodNumber;
|
|
@@ -448,8 +547,14 @@ export declare const accessTokenPayloadSchema: z.ZodObject<{
|
|
|
448
547
|
iss: z.ZodString;
|
|
449
548
|
aud: z.ZodString;
|
|
450
549
|
spaceId: z.ZodString;
|
|
550
|
+
sid: z.ZodString;
|
|
451
551
|
generation: z.ZodNumber;
|
|
452
552
|
emailVerified: z.ZodDefault<z.ZodBoolean>;
|
|
553
|
+
profile: z.ZodOptional<z.ZodObject<{
|
|
554
|
+
name: z.ZodOptional<z.ZodString>;
|
|
555
|
+
username: z.ZodOptional<z.ZodString>;
|
|
556
|
+
avatar_url: z.ZodOptional<z.ZodURL>;
|
|
557
|
+
}, z.core.$strict>>;
|
|
453
558
|
jti: z.ZodString;
|
|
454
559
|
}, z.core.$strip>;
|
|
455
560
|
export type AccessTokenPayload = z.infer<typeof accessTokenPayloadSchema>;
|
package/dist/contracts/access.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { grantConstraintsSchema, grantResourceSetSchema, grantTargetSelectorSchema, } from "./grants.js";
|
|
2
|
+
import { grantConstraintsPatchSchema, grantConstraintsSchema, grantResourceSetSchema, grantTargetSelectorSchema, } from "./grants.js";
|
|
3
3
|
// ---------------------------------------------------------------------------
|
|
4
4
|
// Canonical sharing model
|
|
5
5
|
// ---------------------------------------------------------------------------
|
|
@@ -74,16 +74,16 @@ export const accessScopePathSchema = z
|
|
|
74
74
|
.string()
|
|
75
75
|
.min(1)
|
|
76
76
|
.max(1024)
|
|
77
|
-
.
|
|
77
|
+
.check((context) => {
|
|
78
78
|
try {
|
|
79
|
-
|
|
79
|
+
context.value = normalizeAccessScopePath(context.value);
|
|
80
80
|
}
|
|
81
81
|
catch (error) {
|
|
82
|
-
context.
|
|
82
|
+
context.issues.push({
|
|
83
83
|
code: "custom",
|
|
84
|
+
input: context.value,
|
|
84
85
|
message: error instanceof Error ? error.message : "invalid access scope",
|
|
85
86
|
});
|
|
86
|
-
return z.NEVER;
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
export function accessScopeContains(scope, path) {
|
|
@@ -96,6 +96,40 @@ export function accessScopeContains(scope, path) {
|
|
|
96
96
|
export const authorityReferenceSchema = z
|
|
97
97
|
.string()
|
|
98
98
|
.regex(/^(member|person|link|password|machine|claim-preview|external):[A-Za-z0-9_.-]+$/);
|
|
99
|
+
// WHO a session is, orthogonal to WHAT it may do. A session has exactly one
|
|
100
|
+
// principal and any number of authorities; neither implies the other. A member
|
|
101
|
+
// who arrives by share link is still that member, and a link authority alone
|
|
102
|
+
// never makes someone anonymous.
|
|
103
|
+
export const accountPrincipalSchema = z.string().regex(/^account:[A-Za-z0-9_-]+$/);
|
|
104
|
+
// The three kinds of somebody. `account:` is a Spacefast user. `person:` is
|
|
105
|
+
// someone this Space invited by email and who accepted — a real, named identity
|
|
106
|
+
// with no platform account behind it. `external:` is a subject an identity
|
|
107
|
+
// connection vouched for. Anything else — a share Link, a password, a machine
|
|
108
|
+
// key, a claim preview — authenticates no one: those sessions stay anonymous
|
|
109
|
+
// and carry the credential purely as an authority.
|
|
110
|
+
export const identifiedPrincipalSchema = z
|
|
111
|
+
.string()
|
|
112
|
+
.regex(/^(?:account|person|external):[A-Za-z0-9_.-]+$/);
|
|
113
|
+
export const accessPrincipalSchema = z.union([z.literal("anonymous"), identifiedPrincipalSchema]);
|
|
114
|
+
export function accountPrincipal(userId) {
|
|
115
|
+
return accountPrincipalSchema.parse(`account:${userId}`);
|
|
116
|
+
}
|
|
117
|
+
/** The user id behind an account principal; null for anonymous or malformed. */
|
|
118
|
+
export function accountPrincipalUserId(principal) {
|
|
119
|
+
if (!principal || !accountPrincipalSchema.safeParse(principal).success)
|
|
120
|
+
return null;
|
|
121
|
+
return principal.slice("account:".length);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The identity an authority reference names on its own, if any. Credential
|
|
125
|
+
* classes name nobody. This is the ONE place a class maps to an identity: at
|
|
126
|
+
* the exchange that just authenticated it, never downstream.
|
|
127
|
+
*/
|
|
128
|
+
export function principalForAuthority(reference) {
|
|
129
|
+
return reference.startsWith("person:") || reference.startsWith("external:")
|
|
130
|
+
? identifiedPrincipalSchema.parse(reference)
|
|
131
|
+
: undefined;
|
|
132
|
+
}
|
|
99
133
|
export const personGrantSchema = z.object({
|
|
100
134
|
id: z.string().min(1),
|
|
101
135
|
scope: accessScopePathSchema,
|
|
@@ -128,7 +162,7 @@ export const inheritedTeamAccessSchema = z.object({
|
|
|
128
162
|
ruleScopes: z
|
|
129
163
|
.array(accessScopePathSchema)
|
|
130
164
|
.min(1)
|
|
131
|
-
.describe("Explicit
|
|
165
|
+
.describe("Explicit team rule locations, not effective subtree coverage."),
|
|
132
166
|
members: z.array(z.object({
|
|
133
167
|
membershipId: z.string().min(1),
|
|
134
168
|
userId: z.string().min(1),
|
|
@@ -146,6 +180,7 @@ export const accessShareLinkSchema = z.object({
|
|
|
146
180
|
id: z.string().min(1),
|
|
147
181
|
spaceId: z.string().min(1),
|
|
148
182
|
grantId: z.string().min(1),
|
|
183
|
+
revision: z.number().int().positive(),
|
|
149
184
|
name: z.string().min(1),
|
|
150
185
|
landingPath: accessScopePathSchema,
|
|
151
186
|
resources: grantResourceSetSchema,
|
|
@@ -162,6 +197,21 @@ export const accessShareLinkSchema = z.object({
|
|
|
162
197
|
export const accessShareLinkWithUrlSchema = accessShareLinkSchema.extend({
|
|
163
198
|
url: z.string().url(),
|
|
164
199
|
});
|
|
200
|
+
// Reads re-derive the durable branded URL from the sealed token. Links minted
|
|
201
|
+
// before branded URLs existed report null until the backfill mints theirs,
|
|
202
|
+
// rather than pretending to hold a URL that would not open.
|
|
203
|
+
export const accessShareLinkReadSchema = accessShareLinkSchema.extend({
|
|
204
|
+
url: z.string().url().nullable(),
|
|
205
|
+
});
|
|
206
|
+
// The publish receipt exposes one durable access capability in both of its
|
|
207
|
+
// useful transports: a browser entry URL and the raw token integrations send
|
|
208
|
+
// in X-SF-Authorization. It is access to published bytes, never proof of
|
|
209
|
+
// ownership; claim credentials stay a separate receipt field.
|
|
210
|
+
export const publishedAccessSchema = z.object({
|
|
211
|
+
url: z.string().url(),
|
|
212
|
+
token: z.string().min(16).max(512),
|
|
213
|
+
expiresAt: z.string().datetime().nullable(),
|
|
214
|
+
});
|
|
165
215
|
export const canonicalAccessRequestStatusSchema = z.enum([
|
|
166
216
|
"verification_pending",
|
|
167
217
|
"pending",
|
|
@@ -216,16 +266,19 @@ export const accessShareLinkCreateSchema = z.object({
|
|
|
216
266
|
name: z.string().trim().min(1).max(200),
|
|
217
267
|
landingPath: accessScopePathSchema.default("/"),
|
|
218
268
|
resources: grantResourceSetSchema,
|
|
219
|
-
|
|
269
|
+
// Anonymous commenting is a product default: a Link that names no
|
|
270
|
+
// capabilities admits reading the page and leaving a comment.
|
|
271
|
+
capabilities: linkCapabilitiesSchema.default(["page.view", "comments.read", "comments.write"]),
|
|
220
272
|
constraints: grantConstraintsSchema.default({}),
|
|
221
273
|
target: grantTargetSelectorSchema.default({ kind: "live" }),
|
|
222
274
|
});
|
|
223
275
|
export const accessShareLinkUpdateSchema = z.object({
|
|
276
|
+
expectedRevision: z.number().int().positive(),
|
|
224
277
|
name: z.string().trim().min(1).max(200).optional(),
|
|
225
278
|
landingPath: accessScopePathSchema.optional(),
|
|
226
279
|
resources: grantResourceSetSchema.optional(),
|
|
227
280
|
capabilities: linkCapabilitiesSchema.optional(),
|
|
228
|
-
constraints:
|
|
281
|
+
constraints: grantConstraintsPatchSchema.optional(),
|
|
229
282
|
target: grantTargetSelectorSchema.optional(),
|
|
230
283
|
});
|
|
231
284
|
export const canonicalAccessRequestCreateSchema = z.object({
|
|
@@ -243,6 +296,12 @@ export const openHandoffSchema = z.object({
|
|
|
243
296
|
expiresAt: z.string().datetime(),
|
|
244
297
|
kind: z.enum(["management", "claim_preview", "person"]),
|
|
245
298
|
});
|
|
299
|
+
export const openLinkSchema = z.object({
|
|
300
|
+
url: z.string().url(),
|
|
301
|
+
expiresAt: z.string().datetime().nullable(),
|
|
302
|
+
kind: z.literal("link"),
|
|
303
|
+
});
|
|
304
|
+
export const privateOpenSchema = z.union([openLinkSchema, openHandoffSchema]);
|
|
246
305
|
export const openHandoffCreateSchema = z.object({
|
|
247
306
|
landingPath: accessScopePathSchema.default("/"),
|
|
248
307
|
targetHost: z.string().trim().min(1).max(255).optional(),
|
|
@@ -259,8 +318,31 @@ export const teamSpaceAccessDefaultWriteSchema = z.object({
|
|
|
259
318
|
export const ACCESS_TOKEN_KID = "spacefast-runtime-v1";
|
|
260
319
|
export const ACCESS_TOKEN_ALG = "EdDSA";
|
|
261
320
|
export const RUNTIME_JWKS_WELL_KNOWN_FILENAME = "spacefast-runtime-jwks.json";
|
|
321
|
+
// Public identity attached only when a token consumer needs to render the
|
|
322
|
+
// person behind an authority. Collaboration tickets carry this audience-bound
|
|
323
|
+
// claim so Cast can paint an avatar without ever seeing an address: the
|
|
324
|
+
// minting side normalizes a provider avatar or derives one from the email,
|
|
325
|
+
// then drops the email. Raw email and provider-private profile metadata never
|
|
326
|
+
// belong here.
|
|
327
|
+
export const accessTokenPublicProfileSchema = z
|
|
328
|
+
.object({
|
|
329
|
+
name: z.string().min(1).max(120).optional(),
|
|
330
|
+
username: z.string().min(1).max(160).optional(),
|
|
331
|
+
avatar_url: z
|
|
332
|
+
.url({ protocol: /^https?$/ })
|
|
333
|
+
.max(2_048)
|
|
334
|
+
.optional(),
|
|
335
|
+
})
|
|
336
|
+
.strict();
|
|
262
337
|
export const accessTokenPayloadSchema = z.object({
|
|
263
338
|
sub: authorityReferenceSchema,
|
|
339
|
+
// Who this handoff authenticated, when it authenticated anybody. The account
|
|
340
|
+
// lane names the signed-in user; the invite and identity-connection lanes
|
|
341
|
+
// name the Person or external subject they just proved. Link, password,
|
|
342
|
+
// machine, and claim-preview lanes never set it, and its absence means the
|
|
343
|
+
// runtime session is anonymous. Identity comes from here alone — never
|
|
344
|
+
// inferred from the authority classes below.
|
|
345
|
+
principal: identifiedPrincipalSchema.optional(),
|
|
264
346
|
authorities: z.array(authorityReferenceSchema).min(1).max(16),
|
|
265
347
|
exp: z.number().int().nonnegative(),
|
|
266
348
|
nbf: z.number().int().nonnegative(),
|
|
@@ -268,7 +350,11 @@ export const accessTokenPayloadSchema = z.object({
|
|
|
268
350
|
iss: z.string().min(1),
|
|
269
351
|
aud: z.string().min(1),
|
|
270
352
|
spaceId: z.string().min(1),
|
|
353
|
+
// Shared opaque identity for the runtime session and its access-origin
|
|
354
|
+
// collaboration session. It is random per handoff and never authorizes by itself.
|
|
355
|
+
sid: z.string().regex(/^[a-f0-9]{64}$/),
|
|
271
356
|
generation: z.number().int().nonnegative(),
|
|
272
357
|
emailVerified: z.boolean().default(false),
|
|
358
|
+
profile: accessTokenPublicProfileSchema.optional(),
|
|
273
359
|
jti: z.string().min(1),
|
|
274
360
|
});
|
|
@@ -193,7 +193,11 @@ export const activityQuerySchema = cursorListQuerySchema.extend({
|
|
|
193
193
|
.describe("Filter to events owned by a team or an external customer principal."),
|
|
194
194
|
principalId: z.string().min(1).optional().describe("Filter to a single principal id."),
|
|
195
195
|
spaceId: z.string().min(1).optional().describe("Filter to events for one space."),
|
|
196
|
-
code: z
|
|
196
|
+
code: z
|
|
197
|
+
.string()
|
|
198
|
+
.min(1)
|
|
199
|
+
.optional()
|
|
200
|
+
.describe("Filter to one event code, for example `space.created`."),
|
|
197
201
|
since: z.string().datetime().optional().describe("Only events at or after this time."),
|
|
198
202
|
until: z.string().datetime().optional().describe("Only events at or before this time."),
|
|
199
203
|
});
|
|
@@ -48,7 +48,7 @@ export const StatticActionSchema = z.enum([
|
|
|
48
48
|
"runtime:manage",
|
|
49
49
|
"*",
|
|
50
50
|
]);
|
|
51
|
-
const DescribedStatticActionSchema = StatticActionSchema.describe("
|
|
51
|
+
const DescribedStatticActionSchema = StatticActionSchema.describe("Namespaced IAM-lite action (`noun:verb`), or `*` for all actions.");
|
|
52
52
|
const RESOURCE_PREFIX = "stt://tenant/";
|
|
53
53
|
function isResourceSegment(value) {
|
|
54
54
|
return Boolean(value && value.length > 0 && !/[\s/\\]/.test(value));
|
|
@@ -100,7 +100,7 @@ const StatticResourceSchema = z
|
|
|
100
100
|
.refine((value) => parseStatticResource(value) !== null, {
|
|
101
101
|
message: "Resource must be a stt:// URI from the StatticResource union (tenant, principal, site, space, site space, domain, or domain-group).",
|
|
102
102
|
})
|
|
103
|
-
.describe("
|
|
103
|
+
.describe("Resource URI from the resource union: stt://tenant/{t}, …/principal/(team|external)/{id}[/*], …/site/{id}[/*], …/space/{id}[/*], …/site/{id}/space/{id}[/*], …/domain/{id}, or …/domain-group/{id}.");
|
|
104
104
|
export const ApiCredentialPolicySchema = z
|
|
105
105
|
.object({
|
|
106
106
|
version: z
|
|
@@ -129,11 +129,11 @@ export const ApiCredentialPolicySchema = z
|
|
|
129
129
|
})
|
|
130
130
|
.strict()
|
|
131
131
|
.optional()
|
|
132
|
-
.describe("
|
|
132
|
+
.describe("AND condition attributes. Unresolvable attributes fail closed: no match for allow, and match for deny."),
|
|
133
133
|
})
|
|
134
134
|
.strict())
|
|
135
135
|
.min(1)
|
|
136
|
-
.describe("Evaluation: explicit deny wins, explicit allow permits, otherwise implicit deny."),
|
|
136
|
+
.describe("Evaluation order: explicit deny wins, explicit allow permits, otherwise implicit deny."),
|
|
137
137
|
})
|
|
138
138
|
.strict()
|
|
139
139
|
.describe("IAM-lite access policy evaluated for every credentialed request.");
|
|
@@ -147,12 +147,12 @@ export const ApiKeyPresetSchema = z
|
|
|
147
147
|
"team_admin",
|
|
148
148
|
"billing_viewer",
|
|
149
149
|
])
|
|
150
|
-
.describe("Named policy preset compiled into a concrete access policy
|
|
150
|
+
.describe("Named policy preset compiled into a concrete access policy when the key is created.");
|
|
151
151
|
// `system` is never a principal type: runtime/internal credentials are
|
|
152
152
|
// platform-owned and omit ownerPrincipal entirely (internal-docs/platform.md).
|
|
153
153
|
const ApiKeyOwnerPrincipalSchema = z.object({
|
|
154
154
|
type: z.enum(["team", "external"]).describe("Principal type that owns this key."),
|
|
155
|
-
id: z.string().min(1).describe("Stable principal id (Better Auth team id or external id)."),
|
|
155
|
+
id: z.string().min(1).describe("Stable principal id (Better Auth team id, or external id)."),
|
|
156
156
|
});
|
|
157
157
|
const ApiKeySubjectSchema = z.object({
|
|
158
158
|
type: z
|
|
@@ -190,7 +190,7 @@ export const ApiKeyListQuerySchema = cursorListQuerySchema.extend({
|
|
|
190
190
|
.string()
|
|
191
191
|
.min(1)
|
|
192
192
|
.optional()
|
|
193
|
-
.describe("Owning team whose keys to list. Defaults to the caller's own team
|
|
193
|
+
.describe("Owning team whose keys to list. Defaults to the caller's own team. Any team that the credential policy reaches is allowed."),
|
|
194
194
|
});
|
|
195
195
|
export const ApiKeyListResponseSchema = z.object({
|
|
196
196
|
data: z.array(ApiKeySchema),
|
|
@@ -202,7 +202,7 @@ export const ApiKeyCreateRequestSchema = z.object({
|
|
|
202
202
|
.string()
|
|
203
203
|
.min(1)
|
|
204
204
|
.optional()
|
|
205
|
-
.describe("Owning team for the new key. Defaults to the caller's own team
|
|
205
|
+
.describe("Owning team for the new key. Defaults to the caller's own team. Authorization is by the credential policy, not key ownership."),
|
|
206
206
|
preset: ApiKeyPresetSchema.optional(),
|
|
207
207
|
policy: ApiCredentialPolicySchema.nullable()
|
|
208
208
|
.optional()
|
|
@@ -252,7 +252,7 @@ export const ApiKeyScopeSchema = z
|
|
|
252
252
|
z.object({ kind: z.literal("team"), teamId: z.string().min(1) }).strict(),
|
|
253
253
|
z.object({ kind: z.literal("space"), spaceId: z.string().min(1) }).strict(),
|
|
254
254
|
])
|
|
255
|
-
.describe("Explicit, finite policy target. A space scope narrows the derived policy to exactly that space
|
|
255
|
+
.describe("Explicit, finite policy target. A space scope narrows the derived policy to exactly that space, never the owning team's whole tree.");
|
|
256
256
|
export const ApiKeyScopedCreateRequestSchema = z
|
|
257
257
|
.object({
|
|
258
258
|
name: z.string().trim().min(1).max(255).optional().describe("Human-readable key name."),
|