@oxy.so/contracts 4.17.0 → 4.22.0
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/cjs/accountAccess.js +72 -0
- package/dist/cjs/agency.js +112 -1
- package/dist/cjs/applicationRoles.js +211 -0
- package/dist/cjs/client/check.js +9 -0
- package/dist/cjs/client/contentClaims.js +139 -0
- package/dist/cjs/client/index.js +37 -1
- package/dist/cjs/client/safety.js +183 -2
- package/dist/cjs/client/signIn.js +2 -0
- package/dist/cjs/contentClaims.js +246 -0
- package/dist/cjs/index.js +14 -3
- package/dist/cjs/safety.js +430 -1
- package/dist/cjs/serviceToken.js +14 -0
- package/dist/esm/accountAccess.js +69 -0
- package/dist/esm/agency.js +111 -0
- package/dist/esm/applicationRoles.js +207 -0
- package/dist/esm/client/check.js +8 -0
- package/dist/esm/client/contentClaims.js +134 -0
- package/dist/esm/client/index.js +2 -1
- package/dist/esm/client/safety.js +183 -2
- package/dist/esm/client/signIn.js +2 -0
- package/dist/esm/contentClaims.js +229 -0
- package/dist/esm/index.js +5 -1
- package/dist/esm/safety.js +423 -0
- package/dist/esm/serviceToken.js +11 -0
- package/dist/types/accountAccess.d.ts +128 -0
- package/dist/types/accountEmail.d.ts +2 -2
- package/dist/types/agency.d.ts +327 -2
- package/dist/types/agentKeys.d.ts +6 -6
- package/dist/types/applicationRoles.d.ts +438 -0
- package/dist/types/client/agentKeys.d.ts +2 -2
- package/dist/types/client/check.d.ts +3 -0
- package/dist/types/client/contentClaims.d.ts +106 -0
- package/dist/types/client/deviceSession.d.ts +1 -1
- package/dist/types/client/index.d.ts +2 -1
- package/dist/types/client/safety.d.ts +204 -4
- package/dist/types/client/signIn.d.ts +1 -1
- package/dist/types/contentClaims.d.ts +383 -0
- package/dist/types/deviceSession.d.ts +4 -4
- package/dist/types/email/messages.d.ts +4 -4
- package/dist/types/externalIdentity.d.ts +16 -16
- package/dist/types/index.d.ts +6 -2
- package/dist/types/inference/accountBilling.d.ts +2 -2
- package/dist/types/inference/aliaModelRelease.d.ts +8 -8
- package/dist/types/inference/catalogue.d.ts +26 -26
- package/dist/types/inference/inbox.d.ts +4 -4
- package/dist/types/inference/modelDocumentation.d.ts +16 -16
- package/dist/types/inference/providerConnection.d.ts +4 -4
- package/dist/types/inference/realtime.d.ts +74 -74
- package/dist/types/inference/request.d.ts +60 -60
- package/dist/types/inference/usage.d.ts +4 -4
- package/dist/types/products/access.d.ts +4 -4
- package/dist/types/safety.d.ts +2374 -2
- package/dist/types/serviceToken.d.ts +11 -0
- package/dist/types/sessionStatus.d.ts +4 -4
- package/dist/types/signIn.d.ts +5 -5
- package/dist/types/updates.d.ts +6 -6
- package/dist/types/userResponse.d.ts +8 -8
- package/package.json +5 -20
- package/dist/cjs/.tsbuildinfo +0 -1
- package/dist/esm/.tsbuildinfo +0 -1
- package/dist/types/.tsbuildinfo +0 -1
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application roles — the wire contract for permissions an APPLICATION declares
|
|
3
|
+
* about its own users, and for the grants that give them to Oxy users.
|
|
4
|
+
*
|
|
5
|
+
* Oxy decides who holds an app's operator powers (who may run Mercaria's
|
|
6
|
+
* payments desk, moderate GoWay, administer Homiio), so no app keeps an
|
|
7
|
+
* allow-list of Oxy user ids in its environment. The app declares a closed
|
|
8
|
+
* vocabulary of keys, its owners grant them to people, and the app's backend
|
|
9
|
+
* asks Oxy which of them the human behind a request holds
|
|
10
|
+
* (`GET /applications/:appId/roles/me`, read through `@oxy.so/core/server`).
|
|
11
|
+
*
|
|
12
|
+
* ## Why an application key can never collide with an Oxy permission
|
|
13
|
+
*
|
|
14
|
+
* Every permission Oxy itself checks (`app:update`, `apps:create`,
|
|
15
|
+
* `credentials:rotate`, every scope) is spelled with a COLON. An application key
|
|
16
|
+
* is dot-separated lowercase segments and cannot contain one, so the two
|
|
17
|
+
* vocabularies are disjoint by syntax, not by convention. They are also stored
|
|
18
|
+
* apart (scoped to one application id) and no Oxy gate ever reads an
|
|
19
|
+
* application key. A key means something only to the application that declared
|
|
20
|
+
* it.
|
|
21
|
+
*
|
|
22
|
+
* The pattern is exported as a SOURCE string because the API renders the same
|
|
23
|
+
* text into a Postgres CHECK; JavaScript's `RegExp` and Postgres' ARE agree on
|
|
24
|
+
* everything it uses (anchors, classes, a capturing group, a bounded repeat).
|
|
25
|
+
*
|
|
26
|
+
* Platform-agnostic — zod only, no react/react-native/expo.
|
|
27
|
+
*/
|
|
28
|
+
import { z } from 'zod';
|
|
29
|
+
/**
|
|
30
|
+
* Two to four dot-separated segments, each a lowercase letter followed by
|
|
31
|
+
* lowercase letters, digits or underscores: `payments.operate`,
|
|
32
|
+
* `catalog.review.publish`. At least two segments so a key always names an
|
|
33
|
+
* area and an action; never a colon (see the header).
|
|
34
|
+
*/
|
|
35
|
+
export declare const APPLICATION_PERMISSION_KEY_PATTERN_SOURCE = "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*){1,3}$";
|
|
36
|
+
export declare const APPLICATION_PERMISSION_KEY_PATTERN: RegExp;
|
|
37
|
+
export declare const APPLICATION_PERMISSION_KEY_MAX_LENGTH = 64;
|
|
38
|
+
export declare const APPLICATION_PERMISSION_DESCRIPTION_MAX_LENGTH = 280;
|
|
39
|
+
/** How many live keys one application may declare. Operator powers are few. */
|
|
40
|
+
export declare const APPLICATION_PERMISSIONS_MAX_DECLARED = 64;
|
|
41
|
+
export declare const APPLICATION_ROLE_REASON_MAX_LENGTH = 500;
|
|
42
|
+
export declare const APPLICATION_ROLE_GRANTS_PAGE_DEFAULT = 50;
|
|
43
|
+
export declare const APPLICATION_ROLE_GRANTS_PAGE_MAX = 200;
|
|
44
|
+
/**
|
|
45
|
+
* The `error` codes the application-roles routes answer beyond the generic
|
|
46
|
+
* ones (`BAD_REQUEST`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`). Renaming one
|
|
47
|
+
* is a breaking change.
|
|
48
|
+
*/
|
|
49
|
+
export declare const APPLICATION_ROLE_ERROR_CODES: {
|
|
50
|
+
/** 403: a grant naming yourself on an application you do not own outright. */
|
|
51
|
+
readonly selfGrantForbidden: "SELF_GRANT_FORBIDDEN";
|
|
52
|
+
/** 422: the key is not a live declared permission of this application. */
|
|
53
|
+
readonly unknownPermission: "UNKNOWN_PERMISSION";
|
|
54
|
+
/** 422: the grantee is not a person (an organization, project, bot or channel). */
|
|
55
|
+
readonly granteeNotAPerson: "GRANTEE_NOT_A_PERSON";
|
|
56
|
+
/** 409: the grantee already holds the key; `details.grantId` names the live grant. */
|
|
57
|
+
readonly alreadyGranted: "ALREADY_GRANTED";
|
|
58
|
+
/** 409: the grant was already revoked. */
|
|
59
|
+
readonly alreadyRevoked: "ALREADY_REVOKED";
|
|
60
|
+
/** 403: the bearer's session belongs to a DIFFERENT application. */
|
|
61
|
+
readonly sessionApplicationMismatch: "SESSION_APPLICATION_MISMATCH";
|
|
62
|
+
};
|
|
63
|
+
export type ApplicationRoleErrorCode = (typeof APPLICATION_ROLE_ERROR_CODES)[keyof typeof APPLICATION_ROLE_ERROR_CODES];
|
|
64
|
+
/** Whether `value` is a well-formed application permission key. */
|
|
65
|
+
export declare function isApplicationPermissionKey(value: unknown): value is string;
|
|
66
|
+
export declare const applicationPermissionKeySchema: z.ZodString;
|
|
67
|
+
/** One key as the application's owners declare it. */
|
|
68
|
+
export declare const applicationPermissionDeclarationSchema: z.ZodObject<{
|
|
69
|
+
key: z.ZodString;
|
|
70
|
+
description: z.ZodEffects<z.ZodString, string, string>;
|
|
71
|
+
}, "strict", z.ZodTypeAny, {
|
|
72
|
+
description: string;
|
|
73
|
+
key: string;
|
|
74
|
+
}, {
|
|
75
|
+
description: string;
|
|
76
|
+
key: string;
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* `PUT /applications/:appId/roles/permissions` — the WHOLE vocabulary.
|
|
80
|
+
*
|
|
81
|
+
* Declarative: a key present here and not live is added, a live key absent
|
|
82
|
+
* here is retired (and every grant of it revoked), a live key present here
|
|
83
|
+
* keeps its identity and takes the new description. Sending the same body twice
|
|
84
|
+
* changes nothing.
|
|
85
|
+
*/
|
|
86
|
+
export declare const declareApplicationPermissionsRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
87
|
+
permissions: z.ZodArray<z.ZodObject<{
|
|
88
|
+
key: z.ZodString;
|
|
89
|
+
description: z.ZodEffects<z.ZodString, string, string>;
|
|
90
|
+
}, "strict", z.ZodTypeAny, {
|
|
91
|
+
description: string;
|
|
92
|
+
key: string;
|
|
93
|
+
}, {
|
|
94
|
+
description: string;
|
|
95
|
+
key: string;
|
|
96
|
+
}>, "many">;
|
|
97
|
+
}, "strict", z.ZodTypeAny, {
|
|
98
|
+
permissions: {
|
|
99
|
+
description: string;
|
|
100
|
+
key: string;
|
|
101
|
+
}[];
|
|
102
|
+
}, {
|
|
103
|
+
permissions: {
|
|
104
|
+
description: string;
|
|
105
|
+
key: string;
|
|
106
|
+
}[];
|
|
107
|
+
}>, {
|
|
108
|
+
permissions: {
|
|
109
|
+
description: string;
|
|
110
|
+
key: string;
|
|
111
|
+
}[];
|
|
112
|
+
}, {
|
|
113
|
+
permissions: {
|
|
114
|
+
description: string;
|
|
115
|
+
key: string;
|
|
116
|
+
}[];
|
|
117
|
+
}>;
|
|
118
|
+
/** A declared key. Retired keys are history: they confer nothing. */
|
|
119
|
+
export declare const applicationPermissionSchema: z.ZodObject<{
|
|
120
|
+
key: z.ZodString;
|
|
121
|
+
description: z.ZodString;
|
|
122
|
+
declaredAt: z.ZodString;
|
|
123
|
+
declaredByUserId: z.ZodNullable<z.ZodString>;
|
|
124
|
+
retiredAt: z.ZodNullable<z.ZodString>;
|
|
125
|
+
retiredByUserId: z.ZodNullable<z.ZodString>;
|
|
126
|
+
}, "strip", z.ZodTypeAny, {
|
|
127
|
+
description: string;
|
|
128
|
+
key: string;
|
|
129
|
+
declaredAt: string;
|
|
130
|
+
declaredByUserId: string | null;
|
|
131
|
+
retiredAt: string | null;
|
|
132
|
+
retiredByUserId: string | null;
|
|
133
|
+
}, {
|
|
134
|
+
description: string;
|
|
135
|
+
key: string;
|
|
136
|
+
declaredAt: string;
|
|
137
|
+
declaredByUserId: string | null;
|
|
138
|
+
retiredAt: string | null;
|
|
139
|
+
retiredByUserId: string | null;
|
|
140
|
+
}>;
|
|
141
|
+
export declare const applicationPermissionListSchema: z.ZodObject<{
|
|
142
|
+
items: z.ZodArray<z.ZodObject<{
|
|
143
|
+
key: z.ZodString;
|
|
144
|
+
description: z.ZodString;
|
|
145
|
+
declaredAt: z.ZodString;
|
|
146
|
+
declaredByUserId: z.ZodNullable<z.ZodString>;
|
|
147
|
+
retiredAt: z.ZodNullable<z.ZodString>;
|
|
148
|
+
retiredByUserId: z.ZodNullable<z.ZodString>;
|
|
149
|
+
}, "strip", z.ZodTypeAny, {
|
|
150
|
+
description: string;
|
|
151
|
+
key: string;
|
|
152
|
+
declaredAt: string;
|
|
153
|
+
declaredByUserId: string | null;
|
|
154
|
+
retiredAt: string | null;
|
|
155
|
+
retiredByUserId: string | null;
|
|
156
|
+
}, {
|
|
157
|
+
description: string;
|
|
158
|
+
key: string;
|
|
159
|
+
declaredAt: string;
|
|
160
|
+
declaredByUserId: string | null;
|
|
161
|
+
retiredAt: string | null;
|
|
162
|
+
retiredByUserId: string | null;
|
|
163
|
+
}>, "many">;
|
|
164
|
+
}, "strip", z.ZodTypeAny, {
|
|
165
|
+
items: {
|
|
166
|
+
description: string;
|
|
167
|
+
key: string;
|
|
168
|
+
declaredAt: string;
|
|
169
|
+
declaredByUserId: string | null;
|
|
170
|
+
retiredAt: string | null;
|
|
171
|
+
retiredByUserId: string | null;
|
|
172
|
+
}[];
|
|
173
|
+
}, {
|
|
174
|
+
items: {
|
|
175
|
+
description: string;
|
|
176
|
+
key: string;
|
|
177
|
+
declaredAt: string;
|
|
178
|
+
declaredByUserId: string | null;
|
|
179
|
+
retiredAt: string | null;
|
|
180
|
+
retiredByUserId: string | null;
|
|
181
|
+
}[];
|
|
182
|
+
}>;
|
|
183
|
+
export declare const declareApplicationPermissionsResponseSchema: z.ZodObject<{
|
|
184
|
+
items: z.ZodArray<z.ZodObject<{
|
|
185
|
+
key: z.ZodString;
|
|
186
|
+
description: z.ZodString;
|
|
187
|
+
declaredAt: z.ZodString;
|
|
188
|
+
declaredByUserId: z.ZodNullable<z.ZodString>;
|
|
189
|
+
retiredAt: z.ZodNullable<z.ZodString>;
|
|
190
|
+
retiredByUserId: z.ZodNullable<z.ZodString>;
|
|
191
|
+
}, "strip", z.ZodTypeAny, {
|
|
192
|
+
description: string;
|
|
193
|
+
key: string;
|
|
194
|
+
declaredAt: string;
|
|
195
|
+
declaredByUserId: string | null;
|
|
196
|
+
retiredAt: string | null;
|
|
197
|
+
retiredByUserId: string | null;
|
|
198
|
+
}, {
|
|
199
|
+
description: string;
|
|
200
|
+
key: string;
|
|
201
|
+
declaredAt: string;
|
|
202
|
+
declaredByUserId: string | null;
|
|
203
|
+
retiredAt: string | null;
|
|
204
|
+
retiredByUserId: string | null;
|
|
205
|
+
}>, "many">;
|
|
206
|
+
} & {
|
|
207
|
+
/** Keys that became live with this declaration. */
|
|
208
|
+
added: z.ZodArray<z.ZodString, "many">;
|
|
209
|
+
/** Keys this declaration retired. */
|
|
210
|
+
retired: z.ZodArray<z.ZodString, "many">;
|
|
211
|
+
/** Live keys whose description changed. */
|
|
212
|
+
described: z.ZodArray<z.ZodString, "many">;
|
|
213
|
+
/** Live grants revoked because their key was retired. */
|
|
214
|
+
revokedGrants: z.ZodNumber;
|
|
215
|
+
}, "strip", z.ZodTypeAny, {
|
|
216
|
+
items: {
|
|
217
|
+
description: string;
|
|
218
|
+
key: string;
|
|
219
|
+
declaredAt: string;
|
|
220
|
+
declaredByUserId: string | null;
|
|
221
|
+
retiredAt: string | null;
|
|
222
|
+
retiredByUserId: string | null;
|
|
223
|
+
}[];
|
|
224
|
+
added: string[];
|
|
225
|
+
retired: string[];
|
|
226
|
+
described: string[];
|
|
227
|
+
revokedGrants: number;
|
|
228
|
+
}, {
|
|
229
|
+
items: {
|
|
230
|
+
description: string;
|
|
231
|
+
key: string;
|
|
232
|
+
declaredAt: string;
|
|
233
|
+
declaredByUserId: string | null;
|
|
234
|
+
retiredAt: string | null;
|
|
235
|
+
retiredByUserId: string | null;
|
|
236
|
+
}[];
|
|
237
|
+
added: string[];
|
|
238
|
+
retired: string[];
|
|
239
|
+
described: string[];
|
|
240
|
+
revokedGrants: number;
|
|
241
|
+
}>;
|
|
242
|
+
/** One grant of one key to one Oxy user. Revocation is a stamp, never a delete. */
|
|
243
|
+
export declare const applicationRoleGrantSchema: z.ZodObject<{
|
|
244
|
+
id: z.ZodString;
|
|
245
|
+
applicationId: z.ZodString;
|
|
246
|
+
permission: z.ZodString;
|
|
247
|
+
userId: z.ZodString;
|
|
248
|
+
/** The grantee's handle, for display. */
|
|
249
|
+
username: z.ZodNullable<z.ZodString>;
|
|
250
|
+
/** The HUMAN who granted it; null once that account was erased. */
|
|
251
|
+
grantedByUserId: z.ZodNullable<z.ZodString>;
|
|
252
|
+
grantedAt: z.ZodString;
|
|
253
|
+
grantReason: z.ZodNullable<z.ZodString>;
|
|
254
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
255
|
+
revokedByUserId: z.ZodNullable<z.ZodString>;
|
|
256
|
+
revokeReason: z.ZodNullable<z.ZodString>;
|
|
257
|
+
}, "strip", z.ZodTypeAny, {
|
|
258
|
+
username: string | null;
|
|
259
|
+
id: string;
|
|
260
|
+
applicationId: string;
|
|
261
|
+
revokedAt: string | null;
|
|
262
|
+
userId: string;
|
|
263
|
+
permission: string;
|
|
264
|
+
grantedByUserId: string | null;
|
|
265
|
+
grantedAt: string;
|
|
266
|
+
grantReason: string | null;
|
|
267
|
+
revokedByUserId: string | null;
|
|
268
|
+
revokeReason: string | null;
|
|
269
|
+
}, {
|
|
270
|
+
username: string | null;
|
|
271
|
+
id: string;
|
|
272
|
+
applicationId: string;
|
|
273
|
+
revokedAt: string | null;
|
|
274
|
+
userId: string;
|
|
275
|
+
permission: string;
|
|
276
|
+
grantedByUserId: string | null;
|
|
277
|
+
grantedAt: string;
|
|
278
|
+
grantReason: string | null;
|
|
279
|
+
revokedByUserId: string | null;
|
|
280
|
+
revokeReason: string | null;
|
|
281
|
+
}>;
|
|
282
|
+
export declare const applicationRoleGrantListSchema: z.ZodObject<{
|
|
283
|
+
items: z.ZodArray<z.ZodObject<{
|
|
284
|
+
id: z.ZodString;
|
|
285
|
+
applicationId: z.ZodString;
|
|
286
|
+
permission: z.ZodString;
|
|
287
|
+
userId: z.ZodString;
|
|
288
|
+
/** The grantee's handle, for display. */
|
|
289
|
+
username: z.ZodNullable<z.ZodString>;
|
|
290
|
+
/** The HUMAN who granted it; null once that account was erased. */
|
|
291
|
+
grantedByUserId: z.ZodNullable<z.ZodString>;
|
|
292
|
+
grantedAt: z.ZodString;
|
|
293
|
+
grantReason: z.ZodNullable<z.ZodString>;
|
|
294
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
295
|
+
revokedByUserId: z.ZodNullable<z.ZodString>;
|
|
296
|
+
revokeReason: z.ZodNullable<z.ZodString>;
|
|
297
|
+
}, "strip", z.ZodTypeAny, {
|
|
298
|
+
username: string | null;
|
|
299
|
+
id: string;
|
|
300
|
+
applicationId: string;
|
|
301
|
+
revokedAt: string | null;
|
|
302
|
+
userId: string;
|
|
303
|
+
permission: string;
|
|
304
|
+
grantedByUserId: string | null;
|
|
305
|
+
grantedAt: string;
|
|
306
|
+
grantReason: string | null;
|
|
307
|
+
revokedByUserId: string | null;
|
|
308
|
+
revokeReason: string | null;
|
|
309
|
+
}, {
|
|
310
|
+
username: string | null;
|
|
311
|
+
id: string;
|
|
312
|
+
applicationId: string;
|
|
313
|
+
revokedAt: string | null;
|
|
314
|
+
userId: string;
|
|
315
|
+
permission: string;
|
|
316
|
+
grantedByUserId: string | null;
|
|
317
|
+
grantedAt: string;
|
|
318
|
+
grantReason: string | null;
|
|
319
|
+
revokedByUserId: string | null;
|
|
320
|
+
revokeReason: string | null;
|
|
321
|
+
}>, "many">;
|
|
322
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
323
|
+
}, "strip", z.ZodTypeAny, {
|
|
324
|
+
items: {
|
|
325
|
+
username: string | null;
|
|
326
|
+
id: string;
|
|
327
|
+
applicationId: string;
|
|
328
|
+
revokedAt: string | null;
|
|
329
|
+
userId: string;
|
|
330
|
+
permission: string;
|
|
331
|
+
grantedByUserId: string | null;
|
|
332
|
+
grantedAt: string;
|
|
333
|
+
grantReason: string | null;
|
|
334
|
+
revokedByUserId: string | null;
|
|
335
|
+
revokeReason: string | null;
|
|
336
|
+
}[];
|
|
337
|
+
nextCursor: string | null;
|
|
338
|
+
}, {
|
|
339
|
+
items: {
|
|
340
|
+
username: string | null;
|
|
341
|
+
id: string;
|
|
342
|
+
applicationId: string;
|
|
343
|
+
revokedAt: string | null;
|
|
344
|
+
userId: string;
|
|
345
|
+
permission: string;
|
|
346
|
+
grantedByUserId: string | null;
|
|
347
|
+
grantedAt: string;
|
|
348
|
+
grantReason: string | null;
|
|
349
|
+
revokedByUserId: string | null;
|
|
350
|
+
revokeReason: string | null;
|
|
351
|
+
}[];
|
|
352
|
+
nextCursor: string | null;
|
|
353
|
+
}>;
|
|
354
|
+
/** `POST /applications/:appId/roles/grants` — name the grantee by id OR handle. */
|
|
355
|
+
export declare const createApplicationRoleGrantRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
356
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
357
|
+
username: z.ZodOptional<z.ZodString>;
|
|
358
|
+
permission: z.ZodString;
|
|
359
|
+
reason: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
360
|
+
}, "strict", z.ZodTypeAny, {
|
|
361
|
+
permission: string;
|
|
362
|
+
username?: string | undefined;
|
|
363
|
+
reason?: string | undefined;
|
|
364
|
+
userId?: string | undefined;
|
|
365
|
+
}, {
|
|
366
|
+
permission: string;
|
|
367
|
+
username?: string | undefined;
|
|
368
|
+
reason?: string | undefined;
|
|
369
|
+
userId?: string | undefined;
|
|
370
|
+
}>, {
|
|
371
|
+
permission: string;
|
|
372
|
+
username?: string | undefined;
|
|
373
|
+
reason?: string | undefined;
|
|
374
|
+
userId?: string | undefined;
|
|
375
|
+
}, {
|
|
376
|
+
permission: string;
|
|
377
|
+
username?: string | undefined;
|
|
378
|
+
reason?: string | undefined;
|
|
379
|
+
userId?: string | undefined;
|
|
380
|
+
}>;
|
|
381
|
+
/** `POST /applications/:appId/roles/grants/:grantId/revoke`. */
|
|
382
|
+
export declare const revokeApplicationRoleGrantRequestSchema: z.ZodObject<{
|
|
383
|
+
reason: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
384
|
+
}, "strict", z.ZodTypeAny, {
|
|
385
|
+
reason?: string | undefined;
|
|
386
|
+
}, {
|
|
387
|
+
reason?: string | undefined;
|
|
388
|
+
}>;
|
|
389
|
+
/** `GET /applications/:appId/roles/grants` query. */
|
|
390
|
+
export declare const listApplicationRoleGrantsQuerySchema: z.ZodObject<{
|
|
391
|
+
permission: z.ZodOptional<z.ZodString>;
|
|
392
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
393
|
+
includeRevoked: z.ZodOptional<z.ZodEffects<z.ZodEnum<["true", "false"]>, boolean, "true" | "false">>;
|
|
394
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
395
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
396
|
+
}, "strict", z.ZodTypeAny, {
|
|
397
|
+
limit?: number | undefined;
|
|
398
|
+
cursor?: string | undefined;
|
|
399
|
+
userId?: string | undefined;
|
|
400
|
+
permission?: string | undefined;
|
|
401
|
+
includeRevoked?: boolean | undefined;
|
|
402
|
+
}, {
|
|
403
|
+
limit?: number | undefined;
|
|
404
|
+
cursor?: string | undefined;
|
|
405
|
+
userId?: string | undefined;
|
|
406
|
+
permission?: string | undefined;
|
|
407
|
+
includeRevoked?: "true" | "false" | undefined;
|
|
408
|
+
}>;
|
|
409
|
+
/**
|
|
410
|
+
* `GET /applications/:appId/roles/me` — the keys the HUMAN behind the bearer
|
|
411
|
+
* holds for this application, in no particular order. `userId` is that human
|
|
412
|
+
* (the operator), which is NOT the account the session speaks as when a person
|
|
413
|
+
* is acting as an organization.
|
|
414
|
+
*/
|
|
415
|
+
export declare const applicationRolesMeSchema: z.ZodObject<{
|
|
416
|
+
applicationId: z.ZodString;
|
|
417
|
+
userId: z.ZodString;
|
|
418
|
+
permissions: z.ZodArray<z.ZodString, "many">;
|
|
419
|
+
}, "strip", z.ZodTypeAny, {
|
|
420
|
+
permissions: string[];
|
|
421
|
+
applicationId: string;
|
|
422
|
+
userId: string;
|
|
423
|
+
}, {
|
|
424
|
+
permissions: string[];
|
|
425
|
+
applicationId: string;
|
|
426
|
+
userId: string;
|
|
427
|
+
}>;
|
|
428
|
+
export type ApplicationPermissionDeclaration = z.infer<typeof applicationPermissionDeclarationSchema>;
|
|
429
|
+
export type DeclareApplicationPermissionsRequest = z.infer<typeof declareApplicationPermissionsRequestSchema>;
|
|
430
|
+
export type ApplicationPermissionDefinition = z.infer<typeof applicationPermissionSchema>;
|
|
431
|
+
export type ApplicationPermissionList = z.infer<typeof applicationPermissionListSchema>;
|
|
432
|
+
export type DeclareApplicationPermissionsResponse = z.infer<typeof declareApplicationPermissionsResponseSchema>;
|
|
433
|
+
export type ApplicationRoleGrant = z.infer<typeof applicationRoleGrantSchema>;
|
|
434
|
+
export type ApplicationRoleGrantList = z.infer<typeof applicationRoleGrantListSchema>;
|
|
435
|
+
export type CreateApplicationRoleGrantRequest = z.infer<typeof createApplicationRoleGrantRequestSchema>;
|
|
436
|
+
export type RevokeApplicationRoleGrantRequest = z.infer<typeof revokeApplicationRoleGrantRequestSchema>;
|
|
437
|
+
export type ListApplicationRoleGrantsQuery = z.infer<typeof listApplicationRoleGrantsQuerySchema>;
|
|
438
|
+
export type ApplicationRolesMe = z.infer<typeof applicationRolesMeSchema>;
|
|
@@ -10,8 +10,8 @@ export type AgentProofAction = (typeof AGENT_PROOF_ACTIONS)[number];
|
|
|
10
10
|
export declare const ACCOUNT_AUTH_METHODS: readonly ["identity", "agent_key"];
|
|
11
11
|
export type AccountAuthMethod = (typeof ACCOUNT_AUTH_METHODS)[number];
|
|
12
12
|
export declare const agentProofClaimsCheck: import("./check").Check<{
|
|
13
|
-
expiresAt: number;
|
|
14
13
|
accountId: string;
|
|
14
|
+
expiresAt: number;
|
|
15
15
|
version: 1;
|
|
16
16
|
audience: "oxy-api/agent";
|
|
17
17
|
action: "agent_signin" | "agent_enroll" | "agent_rotate" | "agent_recover" | "agent_governance";
|
|
@@ -82,8 +82,8 @@ export declare const executeAgentKeyOperationCheck: import("./check").Check<{
|
|
|
82
82
|
}>;
|
|
83
83
|
export declare const agentKeyOperationChallengeCheck: import("./check").Check<{
|
|
84
84
|
claims: {
|
|
85
|
-
expiresAt: number;
|
|
86
85
|
accountId: string;
|
|
86
|
+
expiresAt: number;
|
|
87
87
|
version: 1;
|
|
88
88
|
audience: "oxy-api/agent";
|
|
89
89
|
action: "agent_signin" | "agent_enroll" | "agent_rotate" | "agent_recover" | "agent_governance";
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* strictObject(shape) unknown keys FAIL (`.strict()`)
|
|
25
25
|
* looseObject(shape) unknown keys are KEPT (`.passthrough()`)
|
|
26
26
|
* refine(c, test) a further condition, run once `c` passes
|
|
27
|
+
* transform(c, f) `f` rewrites the value once `c` passes
|
|
27
28
|
* union / discriminatedUnion as Zod 3 reports them
|
|
28
29
|
*
|
|
29
30
|
* A failure carries the first issue Zod would report and whether Zod would have
|
|
@@ -113,6 +114,8 @@ export declare function refineAt<T>(inner: Check<T>, test: (value: T) => {
|
|
|
113
114
|
path: CheckPath;
|
|
114
115
|
message: string;
|
|
115
116
|
} | undefined): Check<T>;
|
|
117
|
+
/** Zod's `.transform()`: rewrites a value `inner` accepted. */
|
|
118
|
+
export declare function transform<T, U>(inner: Check<T>, rewrite: (value: T) => U): Check<U>;
|
|
116
119
|
/** Narrows a checked value to a branded contract type (Zod's `.brand()`). */
|
|
117
120
|
export declare function branded<T extends B, B>(inner: Check<B>): Check<T>;
|
|
118
121
|
export interface ArrayRule {
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content claims (ADR 0043 D10) — the constants of the public "Report content
|
|
3
|
+
* / rights claim" intake and of a claim's review, without Zod. Schemas:
|
|
4
|
+
* `../contentClaims.ts`.
|
|
5
|
+
*
|
|
6
|
+
* Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
|
|
7
|
+
*/
|
|
8
|
+
/** What a claim asserts. */
|
|
9
|
+
export declare const CONTENT_CLAIM_KINDS: readonly ["copyright", "trademark", "privacy", "illegal_content", "other"];
|
|
10
|
+
export type ContentClaimKind = (typeof CONTENT_CLAIM_KINDS)[number];
|
|
11
|
+
/** Who the claimant is to the content. */
|
|
12
|
+
export declare const CLAIMANT_RELATIONSHIPS: readonly ["rights_holder", "authorized_agent", "affected_person", "other"];
|
|
13
|
+
export type ClaimantRelationship = (typeof CLAIMANT_RELATIONSHIPS)[number];
|
|
14
|
+
/** The bounds of a submission. The website fills its validation messages from these. */
|
|
15
|
+
export declare const CONTENT_CLAIM_LIMITS: {
|
|
16
|
+
readonly minUrls: 1;
|
|
17
|
+
readonly maxUrls: 20;
|
|
18
|
+
readonly maxUrlLength: 2048;
|
|
19
|
+
readonly minDescription: 20;
|
|
20
|
+
readonly maxDescription: 5000;
|
|
21
|
+
readonly maxName: 200;
|
|
22
|
+
readonly maxOrganization: 200;
|
|
23
|
+
readonly maxEmail: 254;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Where a claim is in its review.
|
|
27
|
+
*
|
|
28
|
+
* `received → reviewing → actioned | rejected`; an actioned claim can be
|
|
29
|
+
* answered by the content's owner (`counter_noticed`), which ends either in
|
|
30
|
+
* `reinstated` (the content is served again) or `upheld` (it stays blocked).
|
|
31
|
+
* A claim can also be rejected straight from `received`.
|
|
32
|
+
*/
|
|
33
|
+
export declare const CONTENT_CLAIM_STATES: readonly ["received", "reviewing", "actioned", "rejected", "counter_noticed", "reinstated", "upheld"];
|
|
34
|
+
export type ContentClaimState = (typeof CONTENT_CLAIM_STATES)[number];
|
|
35
|
+
/** The states in which a claim is still open: its evidence is kept and its blocks can change. */
|
|
36
|
+
export declare const OPEN_CONTENT_CLAIM_STATES: readonly ["received", "reviewing", "actioned", "counter_noticed"];
|
|
37
|
+
/** The states a claim ends in. */
|
|
38
|
+
export declare const CLOSED_CONTENT_CLAIM_STATES: readonly ["rejected", "reinstated", "upheld"];
|
|
39
|
+
/**
|
|
40
|
+
* The kinds whose claimant asserts a right in a work or a mark. Only these
|
|
41
|
+
* carry the link to the original — a privacy or illegal-content report
|
|
42
|
+
* asserts no ownership.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isRightsClaim(kind: ContentClaimKind): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* A request to erase the claimant's OWN personal data (GDPR art. 17): a
|
|
47
|
+
* privacy claim made by the person it is about. Oxy must answer it within one
|
|
48
|
+
* month (art. 12(3)); the claim carries that deadline.
|
|
49
|
+
*/
|
|
50
|
+
export declare function isErasureRequest(kind: ContentClaimKind, relationship: ClaimantRelationship): boolean;
|
|
51
|
+
/** Days Oxy has to answer an erasure request ({@link isErasureRequest}). */
|
|
52
|
+
export declare const ERASURE_REQUEST_DEADLINE_DAYS = 30;
|
|
53
|
+
/**
|
|
54
|
+
* Stable error codes a takedown produces elsewhere in the API. A file whose
|
|
55
|
+
* bytes are on the blocklist cannot be uploaded, imported or copied by anyone
|
|
56
|
+
* (HTTP 451).
|
|
57
|
+
*/
|
|
58
|
+
export declare const CONTENT_CLAIM_ERROR_CODES: {
|
|
59
|
+
/** The submission failed validation; `fields` names each problem. */
|
|
60
|
+
readonly invalid: "CONTENT_CLAIM_INVALID";
|
|
61
|
+
/** These exact bytes were taken down after a claim and cannot be stored again. */
|
|
62
|
+
readonly contentBlocked: "CONTENT_BLOCKED";
|
|
63
|
+
/** A counter-notice failed validation; `fields` names each problem. */
|
|
64
|
+
readonly counterNoticeInvalid: "CONTENT_CLAIM_COUNTER_NOTICE_INVALID";
|
|
65
|
+
/** The files named are blocked by more than one claim: name the claim's reference. */
|
|
66
|
+
readonly counterNoticeAmbiguous: "CONTENT_CLAIM_COUNTER_NOTICE_AMBIGUOUS";
|
|
67
|
+
/** This account already sent a counter-notice for this claim. */
|
|
68
|
+
readonly counterNoticeExists: "CONTENT_CLAIM_COUNTER_NOTICE_EXISTS";
|
|
69
|
+
};
|
|
70
|
+
export type ContentClaimErrorCode = (typeof CONTENT_CLAIM_ERROR_CODES)[keyof typeof CONTENT_CLAIM_ERROR_CODES];
|
|
71
|
+
/**
|
|
72
|
+
* A claim's reference as the claimant and the owner are sent it:
|
|
73
|
+
* `OXY-XXXX-XXXX`, Crockford base32 (no I, L, O or U).
|
|
74
|
+
*/
|
|
75
|
+
export declare const CONTENT_CLAIM_REFERENCE_PATTERN: RegExp;
|
|
76
|
+
/** The bounds of an owner's counter-notice. The website fills its validation messages from these. */
|
|
77
|
+
export declare const CONTENT_CLAIM_COUNTER_NOTICE_LIMITS: {
|
|
78
|
+
readonly maxFileIds: 50;
|
|
79
|
+
readonly maxFileId: 64;
|
|
80
|
+
readonly maxName: 200;
|
|
81
|
+
readonly maxAddress: 500;
|
|
82
|
+
readonly minPhone: 5;
|
|
83
|
+
readonly maxPhone: 40;
|
|
84
|
+
readonly maxEmail: 254;
|
|
85
|
+
readonly minMaterial: 10;
|
|
86
|
+
readonly maxMaterial: 2000;
|
|
87
|
+
readonly maxLocation: 2048;
|
|
88
|
+
readonly minExplanation: 20;
|
|
89
|
+
readonly maxExplanation: 5000;
|
|
90
|
+
readonly maxSignature: 200;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* The statements an owner's counter-notice makes, word for word — what the
|
|
94
|
+
* form shows beside each box (17 U.S.C. § 512(g)(3)(C) and (D), and what Oxy
|
|
95
|
+
* does with the notice). The API records {@link COUNTER_NOTICE_STATEMENT_VERSION}
|
|
96
|
+
* with every notice, so the wording a person agreed to can always be told
|
|
97
|
+
* apart from a later one. Change the text only together with the version.
|
|
98
|
+
*/
|
|
99
|
+
export declare const COUNTER_NOTICE_STATEMENTS: {
|
|
100
|
+
readonly perjury: "I swear, under penalty of perjury, that I have a good faith belief that the material identified above was removed or disabled as a result of a mistake or misidentification of the material to be removed or disabled.";
|
|
101
|
+
readonly jurisdiction: "I consent to the jurisdiction of the Federal District Court for the judicial district in which my address is located or, if my address is outside of the United States, any judicial district in which Oxy may be found.";
|
|
102
|
+
readonly serviceOfProcess: "I will accept service of process from the person who provided the notification of the claimed infringement, or an agent of such person.";
|
|
103
|
+
readonly disclosure: "I understand that Oxy sends a copy of this counter-notice, including my name and contact details, to the person who made the claim, as the law requires.";
|
|
104
|
+
};
|
|
105
|
+
/** The version of {@link COUNTER_NOTICE_STATEMENTS} in force. */
|
|
106
|
+
export declare const COUNTER_NOTICE_STATEMENT_VERSION = "2026-10-16";
|
|
@@ -72,8 +72,8 @@ export declare const sessionAccountsChangedEventCheck: import("./check").Check<{
|
|
|
72
72
|
userId: string;
|
|
73
73
|
}>;
|
|
74
74
|
export declare const deviceBackgroundCredentialResponseCheck: import("./check").Check<{
|
|
75
|
-
expiresAt: string;
|
|
76
75
|
accountId: string;
|
|
76
|
+
expiresAt: string;
|
|
77
77
|
deviceId: string;
|
|
78
78
|
secret: string;
|
|
79
79
|
}>;
|
|
@@ -30,8 +30,9 @@ export { ORGANIZATION_ALIAS_KINDS, ORGANIZATION_CLAIM_DECISIONS, ORGANIZATION_CL
|
|
|
30
30
|
export { cancelProductSubscriptionCheck, personalPlanCatalogueCheck, personalPlanCheckoutRequestCheck, personalPlanCheckoutResultCheck, productSubscriptionCancellationResultCheck, productSubscriptionsResponseCheck, subjectProductAccessCheck, subjectProductAccessQueryCheck, subscriptionCreditGrantsResponseCheck, } from './products';
|
|
31
31
|
export { recommendationRequestCheck } from './recommendations';
|
|
32
32
|
export { isFullReputationBalance } from './reputation';
|
|
33
|
-
export { profileAccessDecisionCheck, profileAccessInputCheck } from './safety';
|
|
33
|
+
export { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, profileAccessDecisionCheck, profileAccessInputCheck, purchaseApprovalCheck, purchaseApprovalListCheck, purchaseReviewInputCheck, safetyOrganizationsInputCheck, safetyOrganizationsResponseCheck, safetyPeopleInputCheck, safetyPeopleResponseCheck, supervisionAcceptInputCheck, supervisionContactInputCheck, supervisionContactsResponseCheck, supervisionInvitationCheck, supervisionInviteInputCheck, supervisionReviewInputCheck, supervisionStateCheck, } from './safety';
|
|
34
34
|
export { publicApplicationCheck } from './sessionStatus';
|
|
35
35
|
export { EMAIL_ACCOUNTS_MAX, EMAIL_SIGNIN_CHOICE_TTL_MS, EMAIL_SIGNIN_LINK_TTL_MS, EMAIL_SIGNIN_LONG_CODE_ALPHABET, EMAIL_SIGNIN_LONG_CODE_LENGTH, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, REAUTH_ACTIONS, SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS, SIGNIN_SECOND_FACTOR_TTL_MS, SIGN_IN_ERROR_CODES, TOTP_BACKUP_CODE_COUNT, TOTP_DIGITS, TOTP_PERIOD_SECONDS, emailSignInChooseAccountCheck, emailSignInLinkResponseCheck, emailSignInPendingCheck, emailSignInStartResponseCheck, isEmailSignInChooseAccount, isSecondFactorRequired, normalizeEmailSignInCode, reauthProofCheck, secondFactorRequiredCheck, signInMethodsCheck, totpBackupCodesResponseCheck, totpEnrollResponseCheck, } from './signIn';
|
|
36
36
|
export { BOT_USERNAME_INVALID_MESSAGE, BOT_USERNAME_SUFFIX, NUMERIC_USERNAME_MESSAGE, RESERVED_USERNAMES, RESERVED_USERNAME_MESSAGE, USERNAME_INVALID_MESSAGE, USERNAME_MAX_LENGTH, USERNAME_MIN_LENGTH, USERNAME_PATTERN_SOURCE, applyBotUsernameSuffix, botUsernameCheck, stripDisallowedUsernameCharacters, usernameCheck, usernameCheckForAccountKind, } from './username';
|
|
37
37
|
export { userNameCheck } from './userResponse';
|
|
38
|
+
export { CLAIMANT_RELATIONSHIPS, CLOSED_CONTENT_CLAIM_STATES, CONTENT_CLAIM_COUNTER_NOTICE_LIMITS, CONTENT_CLAIM_ERROR_CODES, CONTENT_CLAIM_KINDS, CONTENT_CLAIM_LIMITS, CONTENT_CLAIM_REFERENCE_PATTERN, CONTENT_CLAIM_STATES, COUNTER_NOTICE_STATEMENT_VERSION, COUNTER_NOTICE_STATEMENTS, ERASURE_REQUEST_DEADLINE_DAYS, OPEN_CONTENT_CLAIM_STATES, isErasureRequest, isRightsClaim, } from './contentClaims';
|