@oxy.so/contracts 5.8.0 → 6.1.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 +6 -5
- package/dist/cjs/accountEmail.js +13 -5
- package/dist/cjs/accountGraph.js +10 -9
- package/dist/cjs/accountName.js +3 -2
- package/dist/cjs/agency.js +91 -34
- package/dist/cjs/agentKeys.js +21 -17
- package/dist/cjs/appAssertions.js +14 -13
- package/dist/cjs/applicationRoles.js +19 -12
- package/dist/cjs/campaignAttribution.js +28 -0
- package/dist/cjs/civic.js +10 -9
- package/dist/cjs/client/campaignAttribution.js +14 -0
- package/dist/cjs/client/check.js +61 -53
- package/dist/cjs/client/index.js +7 -1
- package/dist/cjs/client/language.js +7 -0
- package/dist/cjs/consoleOnboarding.js +9 -4
- package/dist/cjs/contentClaims.js +23 -14
- package/dist/cjs/deviceDirectory.js +11 -9
- package/dist/cjs/deviceSession.js +27 -25
- package/dist/cjs/email/messages.js +20 -18
- package/dist/cjs/emailAgentContext.js +11 -9
- package/dist/cjs/externalIdentity.js +15 -11
- package/dist/cjs/federationInstanceFetch.js +12 -7
- package/dist/cjs/identity.js +19 -17
- package/dist/cjs/identityLink.js +6 -4
- package/dist/cjs/identityProof.js +6 -4
- package/dist/cjs/inboxPush.js +5 -4
- package/dist/cjs/index.js +17 -6
- package/dist/cjs/inference/accountBilling.js +35 -33
- package/dist/cjs/inference/aliaModelRelease.js +9 -7
- package/dist/cjs/inference/attribution.js +14 -12
- package/dist/cjs/inference/catalogue.js +35 -29
- package/dist/cjs/inference/economics.js +24 -19
- package/dist/cjs/inference/embeddings.js +9 -7
- package/dist/cjs/inference/entitlement.js +17 -15
- package/dist/cjs/inference/errors.js +15 -8
- package/dist/cjs/inference/identifiers.js +33 -21
- package/dist/cjs/inference/inbox.js +37 -35
- package/dist/cjs/inference/modelDocumentation.js +16 -14
- package/dist/cjs/inference/money.js +5 -4
- package/dist/cjs/inference/priceVersion.js +10 -5
- package/dist/cjs/inference/providerConnection.js +21 -14
- package/dist/cjs/inference/realtime.js +88 -47
- package/dist/cjs/inference/request.js +27 -25
- package/dist/cjs/inference/routingPolicy.js +12 -10
- package/dist/cjs/inference/streamEvents.js +22 -16
- package/dist/cjs/inference/usage.js +32 -15
- package/dist/cjs/keyRecovery.js +8 -6
- package/dist/cjs/keyRotation.js +5 -4
- package/dist/cjs/linkedAccounts.js +22 -18
- package/dist/cjs/moderationReputation.js +29 -27
- package/dist/cjs/notifications.js +25 -9
- package/dist/cjs/numberChecks.js +45 -0
- package/dist/cjs/oauth.js +14 -12
- package/dist/cjs/organizations.js +23 -21
- package/dist/cjs/products/access.js +10 -8
- package/dist/cjs/products/billing.js +10 -8
- package/dist/cjs/products/checkout.js +22 -10
- package/dist/cjs/products/plans.js +15 -10
- package/dist/cjs/protocol.js +6 -5
- package/dist/cjs/recommendations.js +27 -19
- package/dist/cjs/reputation.js +15 -13
- package/dist/cjs/safety.js +43 -27
- package/dist/cjs/serviceToken.js +81 -2
- package/dist/cjs/sessionRevocation.js +8 -6
- package/dist/cjs/signIn.js +50 -24
- package/dist/cjs/stickers.js +19 -15
- package/dist/cjs/stringChecks.js +70 -0
- package/dist/cjs/transparency.js +14 -12
- package/dist/cjs/updates.js +24 -22
- package/dist/cjs/userInvalidation.js +7 -5
- package/dist/cjs/userResponse.js +8 -7
- package/dist/cjs/username.js +7 -6
- package/dist/esm/accountAccess.js +4 -3
- package/dist/esm/accountEmail.js +13 -5
- package/dist/esm/accountGraph.js +8 -7
- package/dist/esm/accountName.js +3 -2
- package/dist/esm/agency.js +90 -33
- package/dist/esm/agentKeys.js +21 -17
- package/dist/esm/appAssertions.js +11 -10
- package/dist/esm/applicationRoles.js +16 -9
- package/dist/esm/campaignAttribution.js +25 -0
- package/dist/esm/civic.js +8 -7
- package/dist/esm/client/campaignAttribution.js +10 -0
- package/dist/esm/client/check.js +61 -53
- package/dist/esm/client/index.js +2 -0
- package/dist/esm/client/language.js +4 -0
- package/dist/esm/consoleOnboarding.js +7 -2
- package/dist/esm/contentClaims.js +23 -14
- package/dist/esm/deviceDirectory.js +11 -9
- package/dist/esm/deviceSession.js +27 -25
- package/dist/esm/email/messages.js +18 -16
- package/dist/esm/emailAgentContext.js +11 -9
- package/dist/esm/externalIdentity.js +15 -11
- package/dist/esm/federationInstanceFetch.js +10 -5
- package/dist/esm/identity.js +17 -15
- package/dist/esm/identityLink.js +6 -4
- package/dist/esm/identityProof.js +6 -4
- package/dist/esm/inboxPush.js +3 -2
- package/dist/esm/index.js +5 -2
- package/dist/esm/inference/accountBilling.js +33 -31
- package/dist/esm/inference/aliaModelRelease.js +7 -5
- package/dist/esm/inference/attribution.js +14 -12
- package/dist/esm/inference/catalogue.js +33 -27
- package/dist/esm/inference/economics.js +22 -17
- package/dist/esm/inference/embeddings.js +9 -7
- package/dist/esm/inference/entitlement.js +15 -13
- package/dist/esm/inference/errors.js +13 -6
- package/dist/esm/inference/identifiers.js +31 -19
- package/dist/esm/inference/inbox.js +37 -35
- package/dist/esm/inference/modelDocumentation.js +14 -12
- package/dist/esm/inference/money.js +3 -2
- package/dist/esm/inference/priceVersion.js +8 -3
- package/dist/esm/inference/providerConnection.js +19 -12
- package/dist/esm/inference/realtime.js +85 -44
- package/dist/esm/inference/request.js +25 -23
- package/dist/esm/inference/routingPolicy.js +9 -7
- package/dist/esm/inference/streamEvents.js +20 -14
- package/dist/esm/inference/usage.js +30 -13
- package/dist/esm/keyRecovery.js +8 -6
- package/dist/esm/keyRotation.js +5 -4
- package/dist/esm/linkedAccounts.js +20 -16
- package/dist/esm/moderationReputation.js +27 -25
- package/dist/esm/notifications.js +23 -7
- package/dist/esm/numberChecks.js +41 -0
- package/dist/esm/oauth.js +14 -12
- package/dist/esm/organizations.js +23 -21
- package/dist/esm/products/access.js +10 -8
- package/dist/esm/products/billing.js +10 -8
- package/dist/esm/products/checkout.js +22 -10
- package/dist/esm/products/plans.js +15 -10
- package/dist/esm/protocol.js +4 -3
- package/dist/esm/recommendations.js +25 -17
- package/dist/esm/reputation.js +13 -11
- package/dist/esm/safety.js +43 -27
- package/dist/esm/serviceToken.js +80 -1
- package/dist/esm/sessionRevocation.js +6 -4
- package/dist/esm/signIn.js +50 -24
- package/dist/esm/stickers.js +17 -13
- package/dist/esm/stringChecks.js +63 -0
- package/dist/esm/transparency.js +14 -12
- package/dist/esm/updates.js +22 -20
- package/dist/esm/userInvalidation.js +4 -2
- package/dist/esm/userResponse.js +4 -3
- package/dist/esm/username.js +3 -2
- package/dist/types/accountAccess.d.ts +29 -70
- package/dist/types/accountEmail.d.ts +2 -14
- package/dist/types/accountGraph.d.ts +179 -171
- package/dist/types/accountName.d.ts +1 -1
- package/dist/types/accountSubject.d.ts +20 -93
- package/dist/types/agency.d.ts +528 -2924
- package/dist/types/agentKeys.d.ts +48 -421
- package/dist/types/appAssertions.d.ts +56 -210
- package/dist/types/applicationRoles.d.ts +30 -276
- package/dist/types/avatarCharacter.d.ts +1 -1
- package/dist/types/campaignAttribution.d.ts +10 -0
- package/dist/types/civic.d.ts +1 -13
- package/dist/types/client/agentKeys.d.ts +18 -18
- package/dist/types/client/appAssertions.d.ts +3 -3
- package/dist/types/client/campaignAttribution.d.ts +12 -0
- package/dist/types/client/check.d.ts +13 -13
- package/dist/types/client/deviceDirectory.d.ts +51 -51
- package/dist/types/client/deviceSession.d.ts +14 -14
- package/dist/types/client/index.d.ts +3 -0
- package/dist/types/client/language.d.ts +2 -0
- package/dist/types/client/organizations.d.ts +25 -25
- package/dist/types/client/products.d.ts +33 -33
- package/dist/types/client/recommendations.d.ts +2 -2
- package/dist/types/client/safety.d.ts +45 -45
- package/dist/types/client/sessionStatus.d.ts +4 -4
- package/dist/types/client/signIn.d.ts +1 -1
- package/dist/types/commonsSignIn.d.ts +4 -1
- package/dist/types/consoleOnboarding.d.ts +24 -44
- package/dist/types/contentClaims.d.ts +24 -180
- package/dist/types/deviceDirectory.d.ts +109 -1040
- package/dist/types/deviceSession.d.ts +36 -298
- package/dist/types/email/messages.d.ts +212 -1793
- package/dist/types/emailAgentContext.d.ts +10 -194
- package/dist/types/externalIdentity.d.ts +121 -615
- package/dist/types/federationInstanceFetch.d.ts +3 -32
- package/dist/types/identity.d.ts +15 -92
- package/dist/types/identityLink.d.ts +6 -84
- package/dist/types/identityProof.d.ts +5 -17
- package/dist/types/inboxPush.d.ts +1 -9
- package/dist/types/index.d.ts +7 -3
- package/dist/types/inference/accountBilling.d.ts +151 -488
- package/dist/types/inference/aliaModelRelease.d.ts +42 -439
- package/dist/types/inference/attribution.d.ts +75 -104
- package/dist/types/inference/catalogue.d.ts +417 -1599
- package/dist/types/inference/economics.d.ts +69 -276
- package/dist/types/inference/embeddings.d.ts +110 -406
- package/dist/types/inference/entitlement.d.ts +80 -335
- package/dist/types/inference/errors.d.ts +90 -102
- package/dist/types/inference/identifiers.d.ts +12 -4
- package/dist/types/inference/inbox.d.ts +105 -420
- package/dist/types/inference/modelDocumentation.d.ts +201 -1390
- package/dist/types/inference/money.d.ts +65 -32
- package/dist/types/inference/priceVersion.d.ts +53 -120
- package/dist/types/inference/providerConnection.d.ts +253 -710
- package/dist/types/inference/realtime.d.ts +954 -6825
- package/dist/types/inference/request.d.ts +300 -2572
- package/dist/types/inference/routingPolicy.d.ts +95 -503
- package/dist/types/inference/streamEvents.d.ts +253 -721
- package/dist/types/inference/usage.d.ts +317 -950
- package/dist/types/keyRecovery.d.ts +3 -51
- package/dist/types/keyRotation.d.ts +3 -38
- package/dist/types/linkedAccounts.d.ts +50 -236
- package/dist/types/moderationReputation.d.ts +81 -14
- package/dist/types/notifications.d.ts +19 -51
- package/dist/types/numberChecks.d.ts +9 -0
- package/dist/types/oauth.d.ts +101 -809
- package/dist/types/organizations.d.ts +268 -921
- package/dist/types/oxyRecordTypes.d.ts +11 -1
- package/dist/types/products/access.d.ts +125 -775
- package/dist/types/products/billing.d.ts +67 -503
- package/dist/types/products/checkout.d.ts +16 -69
- package/dist/types/products/plans.d.ts +33 -366
- package/dist/types/recommendations.d.ts +76 -389
- package/dist/types/reputation.d.ts +37 -5
- package/dist/types/safety.d.ts +408 -2048
- package/dist/types/serviceToken.d.ts +247 -7
- package/dist/types/sessionRevocation.d.ts +2 -17
- package/dist/types/sessionStatus.d.ts +27 -115
- package/dist/types/signIn.d.ts +62 -553
- package/dist/types/stickers.d.ts +67 -819
- package/dist/types/stringChecks.d.ts +16 -0
- package/dist/types/transparency.d.ts +14 -302
- package/dist/types/updates.d.ts +60 -316
- package/dist/types/userInvalidation.d.ts +4 -13
- package/dist/types/userResponse.d.ts +302 -2400
- package/dist/types/username.d.ts +3 -3
- package/package.json +6 -4
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { integerCheck } from '../numberChecks.js';
|
|
2
|
+
import { isoDateTime } from '../stringChecks.js';
|
|
1
3
|
/**
|
|
2
4
|
* Wire contract for the Inbox read API (`/email/*` on oxy-api).
|
|
3
5
|
*
|
|
@@ -21,7 +23,7 @@
|
|
|
21
23
|
*/
|
|
22
24
|
import { z } from 'zod';
|
|
23
25
|
/** An ISO-8601 instant as `Date.prototype.toJSON` writes it. */
|
|
24
|
-
const isoInstant = z.string().
|
|
26
|
+
const isoInstant = z.string().check(isoDateTime());
|
|
25
27
|
// ─── Vocabularies ───────────────────────────────────────────────────
|
|
26
28
|
/** Structured data cards the AI extractor can emit. */
|
|
27
29
|
export const MESSAGE_CARD_TYPES = ['trip', 'purchase', 'event', 'bill', 'package'];
|
|
@@ -138,8 +140,8 @@ export const emailMessageHighlightSchema = z.object({
|
|
|
138
140
|
*/
|
|
139
141
|
export const emailMessageDeliverySchema = z.object({
|
|
140
142
|
state: z.enum(EMAIL_DELIVERY_STATES),
|
|
141
|
-
attempts: z.number().
|
|
142
|
-
maxAttempts: z.number().
|
|
143
|
+
attempts: z.number().check(integerCheck()),
|
|
144
|
+
maxAttempts: z.number().check(integerCheck()),
|
|
143
145
|
nextAttemptAt: isoInstant.nullable(),
|
|
144
146
|
error: z.string().nullable(),
|
|
145
147
|
errorCode: z.enum(EMAIL_DELIVERY_ERROR_CODES).nullable().catch(null),
|
|
@@ -186,14 +188,14 @@ export const emailMessageSchema = z.object({
|
|
|
186
188
|
receivedAt: isoInstant,
|
|
187
189
|
createdAt: isoInstant,
|
|
188
190
|
updatedAt: isoInstant,
|
|
189
|
-
draftRevision: z.number().
|
|
191
|
+
draftRevision: z.number().check(integerCheck()).min(1),
|
|
190
192
|
/** Present only on the reads that return bodies (single message, thread). */
|
|
191
193
|
text: z.string().nullable().optional(),
|
|
192
194
|
html: z.string().nullable().optional(),
|
|
193
195
|
headers: z.record(z.string(), z.string()).optional(),
|
|
194
196
|
senderAvatarPath: z.string().nullable().optional(),
|
|
195
197
|
/** Present only on list reads that walked the thread. */
|
|
196
|
-
threadCount: z.number().
|
|
198
|
+
threadCount: z.number().check(integerCheck()).optional(),
|
|
197
199
|
threadParticipants: z.array(z.string()).optional(),
|
|
198
200
|
/**
|
|
199
201
|
* Present only on a message the user sent through Oxy since delivery was
|
|
@@ -210,9 +212,9 @@ export const emailMailboxSchema = z.object({
|
|
|
210
212
|
name: z.string(),
|
|
211
213
|
path: z.string(),
|
|
212
214
|
specialUse: z.string().nullable(),
|
|
213
|
-
retentionDays: z.number().
|
|
214
|
-
totalMessages: z.number().
|
|
215
|
-
unseenMessages: z.number().
|
|
215
|
+
retentionDays: z.number().check(integerCheck()).nullable(),
|
|
216
|
+
totalMessages: z.number().check(integerCheck()),
|
|
217
|
+
unseenMessages: z.number().check(integerCheck()),
|
|
216
218
|
size: z.number(),
|
|
217
219
|
createdAt: isoInstant,
|
|
218
220
|
updatedAt: isoInstant,
|
|
@@ -224,7 +226,7 @@ export const emailUserLabelSchema = z.object({
|
|
|
224
226
|
userId: z.string(),
|
|
225
227
|
name: z.string(),
|
|
226
228
|
color: z.string(),
|
|
227
|
-
order: z.number().
|
|
229
|
+
order: z.number().check(integerCheck()),
|
|
228
230
|
system: z.literal(false),
|
|
229
231
|
createdAt: isoInstant,
|
|
230
232
|
updatedAt: isoInstant,
|
|
@@ -234,7 +236,7 @@ export const emailSystemLabelSchema = z.object({
|
|
|
234
236
|
_id: z.string(),
|
|
235
237
|
name: z.string(),
|
|
236
238
|
color: z.string(),
|
|
237
|
-
order: z.number().
|
|
239
|
+
order: z.number().check(integerCheck()),
|
|
238
240
|
system: z.literal(true),
|
|
239
241
|
});
|
|
240
242
|
export const emailLabelSchema = z.discriminatedUnion('system', [
|
|
@@ -259,7 +261,7 @@ export const emailFilterSchema = z.object({
|
|
|
259
261
|
name: z.string(),
|
|
260
262
|
enabled: z.boolean(),
|
|
261
263
|
matchAll: z.boolean(),
|
|
262
|
-
order: z.number().
|
|
264
|
+
order: z.number().check(integerCheck()),
|
|
263
265
|
conditions: z.array(emailFilterConditionSchema),
|
|
264
266
|
actions: z.array(emailFilterActionSchema),
|
|
265
267
|
createdAt: isoInstant,
|
|
@@ -275,7 +277,7 @@ export const emailBundleSchema = z.object({
|
|
|
275
277
|
matchLabels: z.array(z.string()),
|
|
276
278
|
enabled: z.boolean(),
|
|
277
279
|
collapsed: z.boolean(),
|
|
278
|
-
order: z.number().
|
|
280
|
+
order: z.number().check(integerCheck()),
|
|
279
281
|
createdAt: isoInstant,
|
|
280
282
|
updatedAt: isoInstant,
|
|
281
283
|
});
|
|
@@ -285,9 +287,9 @@ export const emailBundledInboxSchema = z.object({
|
|
|
285
287
|
bundles: z.array(z.object({
|
|
286
288
|
bundle: emailBundleSchema,
|
|
287
289
|
messages: z.array(emailMessageSchema),
|
|
288
|
-
unreadCount: z.number().
|
|
290
|
+
unreadCount: z.number().check(integerCheck()),
|
|
289
291
|
})),
|
|
290
|
-
total: z.number().
|
|
292
|
+
total: z.number().check(integerCheck()),
|
|
291
293
|
});
|
|
292
294
|
/** An address-book entry. `company` and `notes` are `null` when unset. */
|
|
293
295
|
export const emailContactSchema = z.object({
|
|
@@ -312,8 +314,8 @@ export const emailOutboxSchema = z.object({
|
|
|
312
314
|
id: z.string(),
|
|
313
315
|
messageId: z.string(),
|
|
314
316
|
status: z.enum(EMAIL_OUTBOX_STATUSES),
|
|
315
|
-
attempts: z.number().
|
|
316
|
-
maxAttempts: z.number().
|
|
317
|
+
attempts: z.number().check(integerCheck()),
|
|
318
|
+
maxAttempts: z.number().check(integerCheck()),
|
|
317
319
|
terminal: z.boolean(),
|
|
318
320
|
nextAttemptAt: isoInstant,
|
|
319
321
|
lastError: z.string().nullable(),
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { integerCheck } from './numberChecks.js';
|
|
2
|
+
import { isoDateTime, utf16MinLength } from './stringChecks.js';
|
|
1
3
|
import { z } from 'zod';
|
|
2
4
|
export const emailContextAddressSchema = z
|
|
3
5
|
.object({
|
|
@@ -7,29 +9,29 @@ export const emailContextAddressSchema = z
|
|
|
7
9
|
.strict();
|
|
8
10
|
export const emailContextMailboxSchema = z
|
|
9
11
|
.object({
|
|
10
|
-
mailboxId: z.string().
|
|
12
|
+
mailboxId: z.string().check(utf16MinLength(1)),
|
|
11
13
|
name: z.string(),
|
|
12
14
|
path: z.string(),
|
|
13
|
-
totalMessages: z.number().
|
|
14
|
-
unseenMessages: z.number().
|
|
15
|
+
totalMessages: z.number().check(integerCheck()).nonnegative(),
|
|
16
|
+
unseenMessages: z.number().check(integerCheck()).nonnegative(),
|
|
15
17
|
})
|
|
16
18
|
.strict();
|
|
17
19
|
export const emailContextMessageSchema = z
|
|
18
20
|
.object({
|
|
19
|
-
messageId: z.string().
|
|
20
|
-
mailboxId: z.string().
|
|
21
|
+
messageId: z.string().check(utf16MinLength(1)),
|
|
22
|
+
mailboxId: z.string().check(utf16MinLength(1)),
|
|
21
23
|
from: emailContextAddressSchema,
|
|
22
24
|
subject: z.string(),
|
|
23
|
-
receivedAt: z.string().
|
|
25
|
+
receivedAt: z.string().check(isoDateTime()),
|
|
24
26
|
seen: z.boolean(),
|
|
25
27
|
answered: z.boolean(),
|
|
26
28
|
})
|
|
27
29
|
.strict();
|
|
28
30
|
export const emailAgentContextSchema = z
|
|
29
31
|
.object({
|
|
30
|
-
accountId: z.string().
|
|
31
|
-
resourceMailboxId: z.string().
|
|
32
|
-
generatedAt: z.string().
|
|
32
|
+
accountId: z.string().check(utf16MinLength(1)),
|
|
33
|
+
resourceMailboxId: z.string().check(utf16MinLength(1)).nullable(),
|
|
34
|
+
generatedAt: z.string().check(isoDateTime()),
|
|
33
35
|
mailboxes: z.array(emailContextMailboxSchema),
|
|
34
36
|
recentUnread: z.array(emailContextMessageSchema),
|
|
35
37
|
needsResponse: z.array(emailContextMessageSchema),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { utf16MaxLength, utf16MinLength } from './stringChecks.js';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
import { userResponseSchema } from './userResponse.js';
|
|
3
4
|
/**
|
|
@@ -7,26 +8,26 @@ import { userResponseSchema } from './userResponse.js';
|
|
|
7
8
|
*/
|
|
8
9
|
export const externalIdentityProtocolSchema = z.enum(['activitypub', 'atproto', 'instagram-graph']);
|
|
9
10
|
export const externalIdentityReferenceSchema = z.object({
|
|
10
|
-
canonicalAcct: z.string().
|
|
11
|
-
network: z.string().
|
|
11
|
+
canonicalAcct: z.string().check(utf16MinLength(1)),
|
|
12
|
+
network: z.string().check(utf16MinLength(1)),
|
|
12
13
|
protocol: externalIdentityProtocolSchema,
|
|
13
|
-
actorUri: z.string().
|
|
14
|
-
transportAcct: z.string().
|
|
15
|
-
sourceUserId: z.string().
|
|
14
|
+
actorUri: z.string().check(utf16MinLength(1)),
|
|
15
|
+
transportAcct: z.string().check(utf16MinLength(1)),
|
|
16
|
+
sourceUserId: z.string().check(utf16MinLength(1)),
|
|
16
17
|
});
|
|
17
18
|
export const resolveExternalIdentityRequestSchema = z
|
|
18
19
|
.object({
|
|
19
|
-
actorUri: z.string().
|
|
20
|
-
handle: z.string().
|
|
21
|
-
transportAcct: z.string().
|
|
20
|
+
actorUri: z.string().check(utf16MinLength(1)).check(utf16MaxLength(2048)).optional(),
|
|
21
|
+
handle: z.string().check(utf16MinLength(1)).check(utf16MaxLength(2048)).optional(),
|
|
22
|
+
transportAcct: z.string().check(utf16MaxLength(320)).optional(),
|
|
22
23
|
protocol: externalIdentityProtocolSchema.optional(),
|
|
23
24
|
})
|
|
24
25
|
.refine((value) => Boolean(value.actorUri) !== Boolean(value.handle), 'Exactly one actorUri or handle is required');
|
|
25
26
|
export const resolveExternalIdentityResponseSchema = z
|
|
26
27
|
.object({
|
|
27
28
|
user: userResponseSchema.extend({
|
|
28
|
-
id: z.string().
|
|
29
|
-
username: z.string().
|
|
29
|
+
id: z.string().check(utf16MinLength(1)),
|
|
30
|
+
username: z.string().check(utf16MinLength(1)),
|
|
30
31
|
bio: z.string().optional(),
|
|
31
32
|
externalIdentities: z.array(externalIdentityReferenceSchema),
|
|
32
33
|
redirectedUserIds: z.array(z.string()),
|
|
@@ -61,7 +62,10 @@ export const resolveExternalIdentityResponseSchema = z
|
|
|
61
62
|
}
|
|
62
63
|
});
|
|
63
64
|
export const lookupExternalIdentitiesRequestSchema = z.object({
|
|
64
|
-
identifiers: z
|
|
65
|
+
identifiers: z
|
|
66
|
+
.array(z.string().check(utf16MinLength(1)).check(utf16MaxLength(2048)))
|
|
67
|
+
.min(1)
|
|
68
|
+
.max(100),
|
|
65
69
|
});
|
|
66
70
|
export const lookupExternalIdentitiesResponseSchema = z.object({
|
|
67
71
|
identities: z.array(z.object({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { urlCheck, utf16MaxLength, utf16MinLength } from './stringChecks.js';
|
|
1
2
|
/**
|
|
2
3
|
* Wire contract for `POST /federation/instance-fetch/sign`: Oxy's INSTANCE
|
|
3
4
|
* actor signs one ActivityPub GET for a first-party service, so the service can
|
|
@@ -22,19 +23,23 @@ export const INSTANCE_FETCH_MAX_URL_LENGTH = 2048;
|
|
|
22
23
|
export const instanceFetchSignRequestSchema = z
|
|
23
24
|
.object({
|
|
24
25
|
/** The absolute public `https://` URL the caller is about to GET. */
|
|
25
|
-
url: z
|
|
26
|
+
url: z
|
|
27
|
+
.string()
|
|
28
|
+
.trim()
|
|
29
|
+
.check(utf16MinLength(1))
|
|
30
|
+
.check(utf16MaxLength(INSTANCE_FETCH_MAX_URL_LENGTH)),
|
|
26
31
|
})
|
|
27
32
|
.strict();
|
|
28
33
|
export const instanceFetchSignResponseSchema = z
|
|
29
34
|
.object({
|
|
30
35
|
/** The instance actor's key, e.g. `https://oxy.so/ap/users/instance#main-key`. */
|
|
31
|
-
keyId: z.string().
|
|
36
|
+
keyId: z.string().check(urlCheck()),
|
|
32
37
|
/** Send all three on the GET, as they are. */
|
|
33
38
|
headers: z
|
|
34
39
|
.object({
|
|
35
|
-
Host: z.string().
|
|
36
|
-
Date: z.string().
|
|
37
|
-
Signature: z.string().
|
|
40
|
+
Host: z.string().check(utf16MinLength(1)),
|
|
41
|
+
Date: z.string().check(utf16MinLength(1)),
|
|
42
|
+
Signature: z.string().check(utf16MinLength(1)),
|
|
38
43
|
})
|
|
39
44
|
.strict(),
|
|
40
45
|
})
|
package/dist/esm/identity.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { integerCheck } from './numberChecks.js';
|
|
2
|
+
import { isoDateTime, utf16MaxLength, utf16MinLength } from './stringChecks.js';
|
|
1
3
|
/**
|
|
2
4
|
* Self-sovereign identity API contracts.
|
|
3
5
|
*
|
|
@@ -80,15 +82,15 @@ export const signedRecordEnvelopeSchema = z
|
|
|
80
82
|
version: z.union([z.literal(1), z.literal(2)]),
|
|
81
83
|
// Open, app-defined category (see the `type` doc above). The Oxy STORE
|
|
82
84
|
// re-narrows to `oxySignedRecordTypeSchema`; an app to its own constant.
|
|
83
|
-
type: z.string().
|
|
85
|
+
type: z.string().check(utf16MinLength(1)),
|
|
84
86
|
subject: z.string(),
|
|
85
87
|
issuer: z.string(),
|
|
86
|
-
record: z.record(z.unknown()),
|
|
88
|
+
record: z.record(z.string(), z.unknown()),
|
|
87
89
|
issuedAt: z.number(),
|
|
88
|
-
seq: z.number().
|
|
90
|
+
seq: z.number().check(integerCheck()).nonnegative().optional(),
|
|
89
91
|
prev: z.string().nullable().optional(),
|
|
90
|
-
collection: z.string().
|
|
91
|
-
rkey: z.string().
|
|
92
|
+
collection: z.string().check(utf16MinLength(1)).optional(),
|
|
93
|
+
rkey: z.string().check(utf16MinLength(1)).optional(),
|
|
92
94
|
publicKey: z.string(),
|
|
93
95
|
alg: z.literal('ES256K-DER-SHA256'),
|
|
94
96
|
signature: z.string(),
|
|
@@ -167,7 +169,7 @@ export const verifiedDomainSchema = z.object({
|
|
|
167
169
|
});
|
|
168
170
|
/** Request body for `POST /identity/domains` — the domain to start verifying. */
|
|
169
171
|
export const domainVerificationRequestSchema = z.object({
|
|
170
|
-
domain: z.string().trim().
|
|
172
|
+
domain: z.string().trim().check(utf16MinLength(1)),
|
|
171
173
|
});
|
|
172
174
|
const resourceOriginHostSchema = z
|
|
173
175
|
.string()
|
|
@@ -175,24 +177,24 @@ const resourceOriginHostSchema = z
|
|
|
175
177
|
.toLowerCase()
|
|
176
178
|
.pipe(z
|
|
177
179
|
.string()
|
|
178
|
-
.
|
|
179
|
-
.
|
|
180
|
+
.check(utf16MinLength(1))
|
|
181
|
+
.check(utf16MaxLength(253))
|
|
180
182
|
.regex(/^(?!-)[a-z0-9-]{1,63}(?<!-)(?:\.(?!-)[a-z0-9-]{1,63}(?<!-))+$/, 'originHost must be a public DNS hostname without scheme, port or path'));
|
|
181
183
|
/** Clarity resource-server request to bind a site to Oxy domain authority. */
|
|
182
184
|
export const resourceDomainOwnershipRequestSchema = z
|
|
183
185
|
.object({
|
|
184
|
-
accountId: z.string().
|
|
185
|
-
verifiedDomainId: z.string().
|
|
186
|
+
accountId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
187
|
+
verifiedDomainId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
186
188
|
originHost: resourceOriginHostSchema,
|
|
187
189
|
})
|
|
188
190
|
.strict();
|
|
189
191
|
export const resourceDomainOwnershipResponseSchema = z
|
|
190
192
|
.object({
|
|
191
193
|
verified: z.boolean(),
|
|
192
|
-
accountId: z.string().
|
|
193
|
-
verifiedDomainId: z.string().
|
|
194
|
+
accountId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
195
|
+
verifiedDomainId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
194
196
|
originHost: resourceOriginHostSchema,
|
|
195
|
-
verifiedAt: z.string().
|
|
197
|
+
verifiedAt: z.string().check(isoDateTime()).optional(),
|
|
196
198
|
method: z.enum(['dns-txt', 'well-known']).optional(),
|
|
197
199
|
})
|
|
198
200
|
.strict();
|
|
@@ -266,11 +268,11 @@ export const exportBundleSchema = z.object({
|
|
|
266
268
|
exportedAt: z.string(),
|
|
267
269
|
did: z.string(),
|
|
268
270
|
didDocument: didDocumentSchema,
|
|
269
|
-
profile: z.record(z.unknown()),
|
|
271
|
+
profile: z.record(z.string(), z.unknown()),
|
|
270
272
|
verifiedDomains: z.array(verifiedDomainSchema),
|
|
271
273
|
authMethods: z.array(authMethodEntrySchema),
|
|
272
274
|
signedRecords: z.array(signedRecordEnvelopeSchema),
|
|
273
|
-
appData: z.array(z.record(z.unknown())),
|
|
275
|
+
appData: z.array(z.record(z.string(), z.unknown())),
|
|
274
276
|
social: z.object({
|
|
275
277
|
following: z.array(z.string()),
|
|
276
278
|
followers: z.array(z.string()),
|
package/dist/esm/identityLink.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { integerCheck } from './numberChecks.js';
|
|
2
|
+
import { utf16MinLength } from './stringChecks.js';
|
|
1
3
|
/**
|
|
2
4
|
* Linking Commons to an account without a key (ADR 0029 D3) — the two-device
|
|
3
5
|
* relay.
|
|
@@ -37,16 +39,16 @@ export const identityLinkIdSchema = z
|
|
|
37
39
|
export const identityLinkCreateResponseSchema = z.object({
|
|
38
40
|
linkId: identityLinkIdSchema,
|
|
39
41
|
challenge: z.string().regex(CHALLENGE),
|
|
40
|
-
expiresAt: z.number().
|
|
42
|
+
expiresAt: z.number().check(integerCheck()).positive(),
|
|
41
43
|
qrPayload: z.string().startsWith(IDENTITY_LINK_QR_PREFIX),
|
|
42
44
|
});
|
|
43
45
|
export const identityLinkStateSchema = z.object({
|
|
44
46
|
status: z.enum(IDENTITY_LINK_STATUSES),
|
|
45
|
-
userId: z.string().
|
|
47
|
+
userId: z.string().check(utf16MinLength(1)),
|
|
46
48
|
username: z.string().nullable(),
|
|
47
49
|
publicKey: z.string().nullable(),
|
|
48
|
-
audience: z.string().
|
|
49
|
-
expiresAt: z.number().
|
|
50
|
+
audience: z.string().check(utf16MinLength(1)),
|
|
51
|
+
expiresAt: z.number().check(integerCheck()).positive(),
|
|
50
52
|
});
|
|
51
53
|
/** `POST /identity/link/:linkId/proof` — from Commons, no bearer. */
|
|
52
54
|
export const identityLinkProofRequestSchema = z
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { integerCheck } from './numberChecks.js';
|
|
2
|
+
import { utf16MaxLength, utf16MinLength } from './stringChecks.js';
|
|
1
3
|
/**
|
|
2
4
|
* Identity proof contract — the ONE signed format for operations on a personal root.
|
|
3
5
|
*
|
|
@@ -24,8 +26,8 @@ export { IDENTITY_PROOF_VERSION, IDENTITY_PROOF_DOMAIN, IDENTITY_PROOF_AUDIENCE,
|
|
|
24
26
|
export const identityProofSchema = z.object({
|
|
25
27
|
v: z.literal(IDENTITY_PROOF_VERSION),
|
|
26
28
|
challenge: z.string().trim().regex(CHALLENGE, 'challenge must be 64 lowercase hex characters'),
|
|
27
|
-
expiresAt: z.number().
|
|
28
|
-
signature: z.string().trim().
|
|
29
|
+
expiresAt: z.number().check(integerCheck()).positive(),
|
|
30
|
+
signature: z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(512)),
|
|
29
31
|
});
|
|
30
32
|
/** `POST /identity/proof-challenge` */
|
|
31
33
|
export const identityProofChallengeRequestSchema = z.object({
|
|
@@ -33,8 +35,8 @@ export const identityProofChallengeRequestSchema = z.object({
|
|
|
33
35
|
});
|
|
34
36
|
export const identityProofChallengeResponseSchema = z.object({
|
|
35
37
|
challenge: z.string().regex(CHALLENGE),
|
|
36
|
-
expiresAt: z.number().
|
|
37
|
-
audience: z.string().
|
|
38
|
+
expiresAt: z.number().check(integerCheck()).positive(),
|
|
39
|
+
audience: z.string().check(utf16MinLength(1)),
|
|
38
40
|
});
|
|
39
41
|
export const identityRootStatusSchema = z.object({
|
|
40
42
|
rootLinked: z.boolean(),
|
package/dist/esm/inboxPush.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { utf16MinLength } from './stringChecks.js';
|
|
1
2
|
/**
|
|
2
3
|
* Canonical contract for Inbox new-mail push notifications.
|
|
3
4
|
*
|
|
@@ -16,6 +17,6 @@ export const INBOX_EMAIL_PUSH_CHANNEL = 'email';
|
|
|
16
17
|
export const INBOX_EMAIL_PUSH_TYPE = 'oxy_inbox_new_message';
|
|
17
18
|
export const inboxEmailPushDataSchema = z.object({
|
|
18
19
|
type: z.literal(INBOX_EMAIL_PUSH_TYPE),
|
|
19
|
-
messageId: z.string().
|
|
20
|
-
mailboxId: z.string().
|
|
20
|
+
messageId: z.string().check(utf16MinLength(1)),
|
|
21
|
+
mailboxId: z.string().check(utf16MinLength(1)),
|
|
21
22
|
});
|
package/dist/esm/index.js
CHANGED
|
@@ -182,7 +182,7 @@ PRODUCT_PLAN_STATUSES, productPlanStatusSchema, LIVE_PRODUCT_PLAN_STATUSES, plan
|
|
|
182
182
|
export {
|
|
183
183
|
// Economic treatment (I09): derived by the server, never sent by a caller.
|
|
184
184
|
INFERENCE_ECONOMIC_TREATMENTS, inferenceEconomicTreatmentSchema, PROVIDER_COST_SOURCES, providerCostSourceSchema, costCenterUsageSchema, } from './inference/economics.js';
|
|
185
|
-
export { AUTONOMY_LEVELS, CAPABILITY_PACKAGES, autonomyLevelSchema, capabilityPackageSchema, actorRefSchema, executionActorRefSchema, foregroundExecutionAuthorizationInputSchema, resourceRefSchema, toolGrantOverrideSchema, grantLimitSchema, capabilityCatalogBindingSchema, executionAuthorizationRefSchema, capabilityCoordinatorSchema, capabilityTicketRequestSchema, delegationGrantSchema, AGENT_REQUESTER_CEILING_AUTONOMY, agentRequesterCeilingWriteSchema, agentRequesterCeilingSchema, APPLICATION_AGENT_AVAILABILITIES, applicationAgentAvailabilitySchema, applicationAgentWriteSchema, applicationAgentSchema, agentAvailabilitySchema, automationTriggerSchema, automationActorSelectionSchema, automationDataFlowSchema, automationDefinitionSchema, capabilityTicketClaimsSchema, invocationPrincipalSchema, policyDecisionSchema, auditResultSchema, auditEventSchema, CATALOG_TOOL_ACTOR_TYPES, CATALOG_TOOL_DEFAULT_ACTORS, catalogToolActorTypeSchema, catalogToolActors, catalogToolAllowsActor, catalogToolSchema, catalogEventSchema, catalogFeatureSchema, CATALOG_INTERNAL_TRANSPORTS, appCapabilityCatalogSchema, catalogRegistrationSchema, normalizedAppEventSchema, } from './agency.js';
|
|
185
|
+
export { AUTONOMY_LEVELS, CAPABILITY_PACKAGES, autonomyLevelSchema, capabilityPackageSchema, actorRefSchema, executionActorRefSchema, foregroundExecutionAuthorizationInputSchema, firstPartyExecutionAuthorizationInputSchema, firstPartyTaskInputSchema, resourceRefSchema, toolGrantOverrideSchema, grantLimitSchema, capabilityCatalogBindingSchema, executionAuthorizationRefSchema, capabilityCoordinatorSchema, capabilityTicketRequestSchema, delegationGrantSchema, AGENT_REQUESTER_CEILING_AUTONOMY, agentRequesterCeilingWriteSchema, agentRequesterCeilingSchema, APPLICATION_AGENT_AVAILABILITIES, applicationAgentAvailabilitySchema, applicationAgentWriteSchema, applicationAgentSchema, agentAvailabilitySchema, automationTriggerSchema, automationActorSelectionSchema, automationDataFlowSchema, automationDefinitionSchema, capabilityTicketClaimsSchema, invocationPrincipalSchema, policyDecisionSchema, auditResultSchema, auditEventSchema, CATALOG_TOOL_ACTOR_TYPES, CATALOG_TOOL_DEFAULT_ACTORS, catalogToolActorTypeSchema, catalogToolActors, catalogToolAllowsActor, catalogToolSchema, catalogEventSchema, catalogFeatureSchema, CATALOG_INTERNAL_TRANSPORTS, appCapabilityCatalogSchema, catalogRegistrationSchema, normalizedAppEventSchema, } from './agency.js';
|
|
186
186
|
export { catalogInvocationPathParameters, catalogInvocationsOverlap, catalogInvocationTemplatesEquivalent, findOverlappingCatalogInvocations, matchCatalogInvocation, resolveCatalogInvocation, } from './capabilityInvocation.js';
|
|
187
187
|
export { emailContextAddressSchema, emailContextMailboxSchema, emailContextMessageSchema, emailAgentContextSchema, } from './emailAgentContext.js';
|
|
188
188
|
export { inboxComposeRequestSchema, inboxDailyBriefRequestSchema, inboxDailyBriefResponseSchema, INBOX_DAILY_BRIEF_SECTIONS, inboxNaturalSearchRequestSchema, inboxMessageInferenceParamsSchema, inboxInferenceTextResponseSchema, inboxNaturalSearchResponseSchema, inboxSmartRepliesResponseSchema, inboxThreadSummaryResponseSchema, inboxInferenceStreamEventSchema, } from './inference/inbox.js';
|
|
@@ -203,9 +203,12 @@ export { personalPlanDisplayPriceSchema, personalPlanCatalogueSchema, productPla
|
|
|
203
203
|
export * from './products/checkout.js';
|
|
204
204
|
export * from './organizations.js';
|
|
205
205
|
export * from './safety.js';
|
|
206
|
-
export
|
|
206
|
+
export * from './serviceToken.js';
|
|
207
207
|
export * from './applicationRoles.js';
|
|
208
208
|
export * from './contentClaims.js';
|
|
209
209
|
export * from './appAssertions.js';
|
|
210
210
|
export * from './products/one.js';
|
|
211
211
|
export { USER_PROFILE_COLORS, USER_PROFILE_COLOR_PRESETS, FREE_USER_PROFILE_COLOR_PRESETS, } from './profileColors.generated.js';
|
|
212
|
+
export { utf16MinLength, utf16MaxLength, utf16Length, isoDateTime, urlCheck, } from './stringChecks.js';
|
|
213
|
+
export { integerCheck, safeNumberCheck } from './numberChecks.js';
|
|
214
|
+
export { campaignAttributionSchema } from './campaignAttribution.js';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { integerCheck, safeNumberCheck } from '../numberChecks.js';
|
|
2
|
+
import { isoDateTime, utf16MaxLength, utf16MinLength } from '../stringChecks.js';
|
|
1
3
|
/**
|
|
2
4
|
* The account-scoped billing surface: who pays, what they hold, what bounds
|
|
3
5
|
* them, and how it reconciles against the payment processor.
|
|
@@ -100,8 +102,8 @@ export const billingProfileSchema = z
|
|
|
100
102
|
*/
|
|
101
103
|
creditLimit: exactDecimalSchema,
|
|
102
104
|
autoRecharge: autoRechargeSchema,
|
|
103
|
-
createdAt: z.string().
|
|
104
|
-
updatedAt: z.string().
|
|
105
|
+
createdAt: z.string().check(isoDateTime()),
|
|
106
|
+
updatedAt: z.string().check(isoDateTime()),
|
|
105
107
|
})
|
|
106
108
|
.strict();
|
|
107
109
|
/* -------------------------------------------------------------------------- */
|
|
@@ -166,20 +168,20 @@ export const billingInvoiceSchema = z
|
|
|
166
168
|
.object({
|
|
167
169
|
/** See `version.ts`: this shape is served to Console and to Alia. */
|
|
168
170
|
schemaVersion: z.literal(1),
|
|
169
|
-
id: z.string().
|
|
171
|
+
id: z.string().check(utf16MinLength(1)).check(utf16MaxLength(64)),
|
|
170
172
|
accountId: oxyAccountIdSchema,
|
|
171
173
|
currency: currencyCodeSchema,
|
|
172
|
-
periodStart: z.string().
|
|
173
|
-
periodEnd: z.string().
|
|
174
|
+
periodStart: z.string().check(isoDateTime()),
|
|
175
|
+
periodEnd: z.string().check(isoDateTime()),
|
|
174
176
|
status: billingInvoiceStatusSchema,
|
|
175
177
|
subtotalAmount: exactDecimalSchema,
|
|
176
178
|
totalAmount: exactDecimalSchema,
|
|
177
|
-
minorUnitExponent: z.number().
|
|
179
|
+
minorUnitExponent: z.number().check(integerCheck()).min(0).max(4),
|
|
178
180
|
/** The processor's own invoice id, for reconciliation. Never an authority. */
|
|
179
|
-
externalInvoiceRef: z.string().
|
|
180
|
-
issuedAt: z.string().
|
|
181
|
-
paidAt: z.string().
|
|
182
|
-
receiptCount: z.number().
|
|
181
|
+
externalInvoiceRef: z.string().check(utf16MinLength(1)).check(utf16MaxLength(255)).optional(),
|
|
182
|
+
issuedAt: z.string().check(isoDateTime()).optional(),
|
|
183
|
+
paidAt: z.string().check(isoDateTime()).optional(),
|
|
184
|
+
receiptCount: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
183
185
|
})
|
|
184
186
|
.strict();
|
|
185
187
|
/* -------------------------------------------------------------------------- */
|
|
@@ -207,16 +209,16 @@ export const externalPaymentKindSchema = z.enum(EXTERNAL_PAYMENT_KINDS);
|
|
|
207
209
|
*/
|
|
208
210
|
export const externalPaymentSchema = z
|
|
209
211
|
.object({
|
|
210
|
-
id: z.string().
|
|
212
|
+
id: z.string().check(utf16MinLength(1)).check(utf16MaxLength(64)),
|
|
211
213
|
accountId: oxyAccountIdSchema,
|
|
212
214
|
provider: externalPaymentProviderSchema,
|
|
213
215
|
externalKind: externalPaymentKindSchema,
|
|
214
|
-
externalRef: z.string().
|
|
216
|
+
externalRef: z.string().check(utf16MinLength(1)).check(utf16MaxLength(255)),
|
|
215
217
|
amount: exactDecimalSchema,
|
|
216
218
|
currency: currencyCodeSchema,
|
|
217
|
-
ledgerEntryId: z.string().
|
|
218
|
-
occurredAt: z.string().
|
|
219
|
-
createdAt: z.string().
|
|
219
|
+
ledgerEntryId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(64)),
|
|
220
|
+
occurredAt: z.string().check(isoDateTime()),
|
|
221
|
+
createdAt: z.string().check(isoDateTime()),
|
|
220
222
|
})
|
|
221
223
|
.strict();
|
|
222
224
|
/** Lifecycle of one automatic top-up. */
|
|
@@ -234,18 +236,18 @@ export const autoRechargeAttemptSchema = z
|
|
|
234
236
|
.object({
|
|
235
237
|
/** See `version.ts`: this shape is served to Console and to Alia. */
|
|
236
238
|
schemaVersion: z.literal(1),
|
|
237
|
-
id: z.string().
|
|
239
|
+
id: z.string().check(utf16MinLength(1)).check(utf16MaxLength(64)),
|
|
238
240
|
accountId: oxyAccountIdSchema,
|
|
239
241
|
currency: currencyCodeSchema,
|
|
240
242
|
requestedAmount: exactDecimalSchema,
|
|
241
243
|
/** The spendable balance that triggered it — why this attempt exists. */
|
|
242
244
|
balanceAtTrigger: exactDecimalSchema,
|
|
243
245
|
status: autoRechargeStatusSchema,
|
|
244
|
-
externalRef: z.string().
|
|
246
|
+
externalRef: z.string().check(utf16MinLength(1)).check(utf16MaxLength(255)).optional(),
|
|
245
247
|
/** The processor's own decline code. Never a free-form message. */
|
|
246
|
-
failureCode: z.string().
|
|
247
|
-
createdAt: z.string().
|
|
248
|
-
updatedAt: z.string().
|
|
248
|
+
failureCode: z.string().check(utf16MinLength(1)).check(utf16MaxLength(64)).optional(),
|
|
249
|
+
createdAt: z.string().check(isoDateTime()),
|
|
250
|
+
updatedAt: z.string().check(isoDateTime()),
|
|
249
251
|
})
|
|
250
252
|
.strict();
|
|
251
253
|
/* -------------------------------------------------------------------------- */
|
|
@@ -280,18 +282,18 @@ export const reconciliationDiscrepancySchema = z
|
|
|
280
282
|
.object({
|
|
281
283
|
/** See `version.ts`: this shape is served to Console and to Alia. */
|
|
282
284
|
schemaVersion: z.literal(1),
|
|
283
|
-
id: z.string().
|
|
284
|
-
runId: z.string().
|
|
285
|
+
id: z.string().check(utf16MinLength(1)).check(utf16MaxLength(64)),
|
|
286
|
+
runId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(64)),
|
|
285
287
|
kind: reconciliationDiscrepancyKindSchema,
|
|
286
288
|
accountId: oxyAccountIdSchema.optional(),
|
|
287
|
-
externalRef: z.string().
|
|
288
|
-
ledgerEntryId: z.string().
|
|
289
|
+
externalRef: z.string().check(utf16MinLength(1)).check(utf16MaxLength(255)).optional(),
|
|
290
|
+
ledgerEntryId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(64)).optional(),
|
|
289
291
|
/** What Oxy recorded. Absent for `missing_in_ledger`. */
|
|
290
292
|
ledgerAmount: exactDecimalSchema.optional(),
|
|
291
293
|
/** What the processor recorded. Absent for `missing_in_external`. */
|
|
292
294
|
externalAmount: exactDecimalSchema.optional(),
|
|
293
295
|
currency: currencyCodeSchema,
|
|
294
|
-
createdAt: z.string().
|
|
296
|
+
createdAt: z.string().check(isoDateTime()),
|
|
295
297
|
})
|
|
296
298
|
.strict();
|
|
297
299
|
/**
|
|
@@ -306,19 +308,19 @@ export const reconciliationRunSchema = z
|
|
|
306
308
|
.object({
|
|
307
309
|
/** See `version.ts`: this shape is served to Console and to Alia. */
|
|
308
310
|
schemaVersion: z.literal(1),
|
|
309
|
-
id: z.string().
|
|
311
|
+
id: z.string().check(utf16MinLength(1)).check(utf16MaxLength(64)),
|
|
310
312
|
provider: externalPaymentProviderSchema,
|
|
311
313
|
/** Absent for a platform-wide pass. */
|
|
312
314
|
accountId: oxyAccountIdSchema.optional(),
|
|
313
315
|
currency: currencyCodeSchema,
|
|
314
|
-
periodStart: z.string().
|
|
315
|
-
periodEnd: z.string().
|
|
316
|
+
periodStart: z.string().check(isoDateTime()),
|
|
317
|
+
periodEnd: z.string().check(isoDateTime()),
|
|
316
318
|
status: reconciliationRunStatusSchema,
|
|
317
319
|
ledgerTotal: exactDecimalSchema,
|
|
318
320
|
externalTotal: exactDecimalSchema,
|
|
319
|
-
discrepancyCount: z.number().
|
|
320
|
-
startedAt: z.string().
|
|
321
|
-
completedAt: z.string().
|
|
321
|
+
discrepancyCount: z.number().check(integerCheck()).nonnegative().check(safeNumberCheck()),
|
|
322
|
+
startedAt: z.string().check(isoDateTime()),
|
|
323
|
+
completedAt: z.string().check(isoDateTime()).optional(),
|
|
322
324
|
})
|
|
323
325
|
.strict();
|
|
324
326
|
export const reconciliationReportSchema = z
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { integerCheck, safeNumberCheck } from '../numberChecks.js';
|
|
2
|
+
import { utf16MaxLength, utf16MinLength } from '../stringChecks.js';
|
|
1
3
|
/**
|
|
2
4
|
* The signed Alia model release manifest — the ingestion contract for a
|
|
3
5
|
* first-party model release.
|
|
@@ -93,10 +95,10 @@ import { inferenceTimestampSchema, RESERVED_ALIA_PUBLISHER, sha256DigestSchema,
|
|
|
93
95
|
export const aliaReleaseArtifactSchema = z
|
|
94
96
|
.object({
|
|
95
97
|
/** Path within the release, e.g. `model-00001-of-00004.safetensors`. */
|
|
96
|
-
path: z.string().
|
|
98
|
+
path: z.string().check(utf16MinLength(1)).check(utf16MaxLength(512)),
|
|
97
99
|
digest: sha256DigestSchema,
|
|
98
|
-
sizeBytes: z.number().
|
|
99
|
-
mediaType: z.string().
|
|
100
|
+
sizeBytes: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
|
|
101
|
+
mediaType: z.string().check(utf16MinLength(1)).check(utf16MaxLength(255)).optional(),
|
|
100
102
|
})
|
|
101
103
|
.strict();
|
|
102
104
|
/**
|
|
@@ -125,7 +127,7 @@ export const aliaReleaseSignatureSchema = z
|
|
|
125
127
|
algorithm: z.enum(['ed25519']),
|
|
126
128
|
canonicalization: z.enum(['jcs']),
|
|
127
129
|
/** Opaque identifier of the public key. Resolving it is undecided. */
|
|
128
|
-
keyId: z.string().
|
|
130
|
+
keyId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(256)),
|
|
129
131
|
/**
|
|
130
132
|
* Unpadded base64url. Exactly 86 characters, which is a 64-byte Ed25519
|
|
131
133
|
* signature — the one algorithm above. A second algorithm moves this length
|
|
@@ -150,7 +152,7 @@ export const aliaModelReleaseManifestSchema = z
|
|
|
150
152
|
/** See `version.ts`: an ingestion payload is a whole message on the wire. */
|
|
151
153
|
schemaVersion: z.literal(1),
|
|
152
154
|
/** The release's own identity, so ingestion is idempotent on it. */
|
|
153
|
-
releaseId: z.string().
|
|
155
|
+
releaseId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
154
156
|
issuedAt: inferenceTimestampSchema,
|
|
155
157
|
/**
|
|
156
158
|
* The revision being released. Carries its OWN `schemaVersion`, like
|
|
@@ -27,15 +27,7 @@
|
|
|
27
27
|
*/
|
|
28
28
|
import { z } from 'zod';
|
|
29
29
|
import { delegatedUserIdSchema, generationIdSchema, inferenceEnvironmentSchema, oxyAccountIdSchema, oxyApplicationIdSchema, oxyCredentialIdSchema, requestIdSchema, } from './identifiers.js';
|
|
30
|
-
/**
|
|
31
|
-
* The inference capability scopes the data plane needs to know about.
|
|
32
|
-
*
|
|
33
|
-
* A credential may carry many other Oxy scopes; only these cross the boundary,
|
|
34
|
-
* because the data plane's authorization questions are exactly "may this caller
|
|
35
|
-
* invoke", "may it read the catalogue", "may it read usage", "may it read or
|
|
36
|
-
* write routing", "may it read or write provider connections". Everything else
|
|
37
|
-
* is the control plane's business and is not the data plane's to hold.
|
|
38
|
-
*/
|
|
30
|
+
/** External caller limits recorded by Oxy. First-party instructions carry no scopes. */
|
|
39
31
|
export const INFERENCE_SCOPES = [
|
|
40
32
|
'inference:invoke',
|
|
41
33
|
'inference:models:read',
|
|
@@ -70,13 +62,23 @@ export const billingPrincipalSchema = z
|
|
|
70
62
|
* envelope; it does not re-derive access from its own database, because it has
|
|
71
63
|
* no account graph to re-derive it from.
|
|
72
64
|
*/
|
|
73
|
-
|
|
65
|
+
const principalIdentity = {
|
|
74
66
|
billing: billingPrincipalSchema,
|
|
75
67
|
applicationId: oxyApplicationIdSchema,
|
|
76
68
|
credentialId: oxyCredentialIdSchema,
|
|
77
69
|
environment: inferenceEnvironmentSchema,
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
};
|
|
71
|
+
/** Oxy has authorized this instruction; the discriminator never grants customer access in Kaana. */
|
|
72
|
+
export const authenticatedPrincipalSchema = z.discriminatedUnion('authority', [
|
|
73
|
+
z.object({ ...principalIdentity, authority: z.literal('first_party') }).strict(),
|
|
74
|
+
z
|
|
75
|
+
.object({
|
|
76
|
+
...principalIdentity,
|
|
77
|
+
authority: z.literal('external').optional(),
|
|
78
|
+
inferenceScopes: z.array(inferenceScopeSchema),
|
|
79
|
+
})
|
|
80
|
+
.strict(),
|
|
81
|
+
]);
|
|
80
82
|
/**
|
|
81
83
|
* The attribution block carried by every request, receipt and ledger record.
|
|
82
84
|
*
|