@oxy.so/contracts 5.7.0 → 6.0.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/civic.js +10 -9
- package/dist/cjs/client/check.js +61 -53
- package/dist/cjs/client/consoleOnboarding.js +24 -0
- package/dist/cjs/client/index.js +7 -3
- package/dist/cjs/client/safety.js +9 -1
- package/dist/cjs/consoleOnboarding.js +56 -0
- 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 +16 -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 +46 -29
- package/dist/cjs/serviceToken.js +81 -2
- package/dist/cjs/sessionRevocation.js +8 -6
- package/dist/cjs/signIn.js +42 -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/civic.js +8 -7
- package/dist/esm/client/check.js +61 -53
- package/dist/esm/client/consoleOnboarding.js +21 -0
- package/dist/esm/client/index.js +2 -1
- package/dist/esm/client/safety.js +8 -0
- package/dist/esm/consoleOnboarding.js +51 -0
- 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 +45 -29
- package/dist/esm/serviceToken.js +80 -1
- package/dist/esm/sessionRevocation.js +6 -4
- package/dist/esm/signIn.js +42 -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/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/check.d.ts +13 -13
- package/dist/types/client/consoleOnboarding.d.ts +16 -0
- 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 +2 -1
- 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 +53 -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 +57 -0
- 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 +6 -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 +410 -2050
- 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 +53 -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 +3 -4
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { integerCheck, safeNumberCheck } from '../numberChecks.js';
|
|
2
|
+
import { isoDateTime, utf16MaxLength, utf16MinLength } from '../stringChecks.js';
|
|
1
3
|
import { z } from 'zod';
|
|
2
4
|
import { oxyAccountIdSchema, oxyApplicationIdSchema } from '../inference/identifiers.js';
|
|
3
|
-
const identifier = z.string().
|
|
4
|
-
const count = z.number().
|
|
5
|
+
const identifier = z.string().check(utf16MinLength(1)).check(utf16MaxLength(160));
|
|
6
|
+
const count = z.number().check(integerCheck()).nonnegative().check(safeNumberCheck());
|
|
5
7
|
const period = z
|
|
6
|
-
.object({ start: z.string().
|
|
8
|
+
.object({ start: z.string().check(isoDateTime()), end: z.string().check(isoDateTime()) })
|
|
7
9
|
.strict()
|
|
8
10
|
.refine((value) => Date.parse(value.end) > Date.parse(value.start), 'period end must follow start');
|
|
9
11
|
/** Product ownership and audience are registered together; branding grants no trust. */
|
|
@@ -41,7 +43,7 @@ export const productOfferSchema = z
|
|
|
41
43
|
.object({
|
|
42
44
|
schemaVersion: z.literal(1),
|
|
43
45
|
id: identifier,
|
|
44
|
-
version: z.number().
|
|
46
|
+
version: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
|
|
45
47
|
kind: z.enum(['individual', 'bundle']),
|
|
46
48
|
benefits: z.array(productBenefitSchema),
|
|
47
49
|
})
|
|
@@ -78,7 +80,7 @@ export const productOfferSegmentSchema = z
|
|
|
78
80
|
subscriptionId: identifier,
|
|
79
81
|
beneficiaryAccountId: oxyAccountIdSchema,
|
|
80
82
|
offerId: identifier,
|
|
81
|
-
offerVersion: z.number().
|
|
83
|
+
offerVersion: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
|
|
82
84
|
origin: z.enum(['individual', 'bundle']),
|
|
83
85
|
period,
|
|
84
86
|
})
|
|
@@ -91,11 +93,11 @@ export const productAccessGrantSchema = z
|
|
|
91
93
|
sourceSegmentId: identifier,
|
|
92
94
|
beneficiaryAccountId: oxyAccountIdSchema,
|
|
93
95
|
offerId: identifier,
|
|
94
|
-
offerVersion: z.number().
|
|
96
|
+
offerVersion: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
|
|
95
97
|
origin: z.enum(['individual', 'bundle']),
|
|
96
98
|
benefit: productBenefitSchema,
|
|
97
99
|
period,
|
|
98
|
-
revokedAt: z.string().
|
|
100
|
+
revokedAt: z.string().check(isoDateTime()).nullable(),
|
|
99
101
|
})
|
|
100
102
|
.strict();
|
|
101
103
|
/** Access answers contain no payer, provider reference, price or account balance. */
|
|
@@ -104,7 +106,7 @@ export const subjectProductAccessSchema = z
|
|
|
104
106
|
schemaVersion: z.literal(1),
|
|
105
107
|
subjectAccountId: oxyAccountIdSchema,
|
|
106
108
|
productId: identifier,
|
|
107
|
-
evaluatedAt: z.string().
|
|
109
|
+
evaluatedAt: z.string().check(isoDateTime()),
|
|
108
110
|
capabilities: z.array(z.object({ key: identifier, grantIds: z.array(identifier) }).strict()),
|
|
109
111
|
quotas: z.array(z
|
|
110
112
|
.object({
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { integerCheck, safeNumberCheck } from '../numberChecks.js';
|
|
2
|
+
import { isoDateTime, utf16MaxLength, utf16MinLength } from '../stringChecks.js';
|
|
1
3
|
import { z } from 'zod';
|
|
2
4
|
import { oxyAccountIdSchema } from '../inference/identifiers.js';
|
|
3
|
-
const id = z.string().
|
|
4
|
-
const name = z.string().
|
|
5
|
-
const count = z.number().
|
|
5
|
+
const id = z.string().check(utf16MinLength(1)).check(utf16MaxLength(160));
|
|
6
|
+
const name = z.string().check(utf16MinLength(1)).check(utf16MaxLength(100));
|
|
7
|
+
const count = z.number().check(integerCheck()).nonnegative().check(safeNumberCheck());
|
|
6
8
|
const period = z
|
|
7
|
-
.object({ start: z.string().
|
|
9
|
+
.object({ start: z.string().check(isoDateTime()), end: z.string().check(isoDateTime()) })
|
|
8
10
|
.strict()
|
|
9
11
|
.refine((value) => Date.parse(value.end) > Date.parse(value.start), 'Period end must follow start');
|
|
10
12
|
/** Self-service provenance; no payer/provider identifiers or balances in access metadata. */
|
|
@@ -29,7 +31,7 @@ export const productSubscriptionSummarySchema = z
|
|
|
29
31
|
.object({
|
|
30
32
|
segmentId: id,
|
|
31
33
|
offerId: id,
|
|
32
|
-
offerVersion: z.number().
|
|
34
|
+
offerVersion: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
|
|
33
35
|
displayName: name,
|
|
34
36
|
origin: z.enum(['individual', 'bundle']),
|
|
35
37
|
period,
|
|
@@ -57,7 +59,7 @@ export const subscriptionCreditGrantSchema = z
|
|
|
57
59
|
clawed: count,
|
|
58
60
|
remaining: count,
|
|
59
61
|
promotionId: id.nullable(),
|
|
60
|
-
createdAt: z.string().
|
|
62
|
+
createdAt: z.string().check(isoDateTime()),
|
|
61
63
|
})
|
|
62
64
|
.strict()
|
|
63
65
|
.refine((value) => BigInt(value.consumed) + BigInt(value.clawed) + BigInt(value.remaining) ===
|
|
@@ -70,8 +72,8 @@ export const cancelProductSubscriptionSchema = z
|
|
|
70
72
|
sourceId: id,
|
|
71
73
|
actionId: z
|
|
72
74
|
.string()
|
|
73
|
-
.
|
|
74
|
-
.
|
|
75
|
+
.check(utf16MinLength(8))
|
|
76
|
+
.check(utf16MaxLength(160))
|
|
75
77
|
.regex(/^[a-zA-Z0-9_-]+$/)
|
|
76
78
|
.optional(),
|
|
77
79
|
expectedSubjectAccountId: oxyAccountIdSchema.optional(),
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import { integerCheck, safeNumberCheck } from '../numberChecks.js';
|
|
2
|
+
import { urlCheck, utf16MaxLength, utf16MinLength } from '../stringChecks.js';
|
|
1
3
|
import { z } from 'zod';
|
|
2
4
|
import { oxyAccountIdSchema } from '../inference/identifiers.js';
|
|
3
5
|
export const personalPlanCheckoutRequestSchema = z
|
|
4
6
|
.object({
|
|
5
7
|
expectedSubjectAccountId: oxyAccountIdSchema,
|
|
6
|
-
offerId: z.string().
|
|
7
|
-
offerVersion: z.number().
|
|
8
|
+
offerId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(160)),
|
|
9
|
+
offerVersion: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
|
|
8
10
|
idempotencyKey: z
|
|
9
11
|
.string()
|
|
10
|
-
.
|
|
11
|
-
.
|
|
12
|
+
.check(utf16MinLength(8))
|
|
13
|
+
.check(utf16MaxLength(160))
|
|
12
14
|
.regex(/^[a-zA-Z0-9_-]+$/),
|
|
13
15
|
})
|
|
14
16
|
.strict();
|
|
@@ -23,23 +25,33 @@ export const personalPlanCheckoutResultSchema = z.discriminatedUnion('state', [
|
|
|
23
25
|
z
|
|
24
26
|
.object({
|
|
25
27
|
state: z.literal('pending'),
|
|
26
|
-
intentId: z.string().
|
|
27
|
-
checkoutUrl: z.string().
|
|
28
|
+
intentId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(160)),
|
|
29
|
+
checkoutUrl: z.string().check(urlCheck()).startsWith('https://').optional(),
|
|
30
|
+
})
|
|
31
|
+
.strict(),
|
|
32
|
+
z
|
|
33
|
+
.object({
|
|
34
|
+
state: z.literal('closed'),
|
|
35
|
+
intentId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(160)),
|
|
36
|
+
})
|
|
37
|
+
.strict(),
|
|
38
|
+
z
|
|
39
|
+
.object({
|
|
40
|
+
state: z.literal('fulfilled'),
|
|
41
|
+
intentId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(160)),
|
|
28
42
|
})
|
|
29
43
|
.strict(),
|
|
30
|
-
z.object({ state: z.literal('closed'), intentId: z.string().min(1).max(160) }).strict(),
|
|
31
|
-
z.object({ state: z.literal('fulfilled'), intentId: z.string().min(1).max(160) }).strict(),
|
|
32
44
|
]);
|
|
33
45
|
/** Explicit individual product offer; still owned and paid through Oxy. */
|
|
34
46
|
export const productPlanCheckoutRequestSchema = personalPlanCheckoutRequestSchema
|
|
35
47
|
.extend({
|
|
36
|
-
productId: z.string().
|
|
48
|
+
productId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(160)),
|
|
37
49
|
})
|
|
38
50
|
.strict();
|
|
39
51
|
export const productSubscriptionRenewalRequestSchema = z
|
|
40
52
|
.object({
|
|
41
53
|
expectedSubjectAccountId: oxyAccountIdSchema,
|
|
42
|
-
sourceId: z.string().
|
|
54
|
+
sourceId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(160)),
|
|
43
55
|
idempotencyKey: personalPlanCheckoutRequestSchema.shape.idempotencyKey,
|
|
44
56
|
})
|
|
45
57
|
.strict();
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { integerCheck, safeNumberCheck } from '../numberChecks.js';
|
|
2
|
+
import { utf16MaxLength, utf16MinLength } from '../stringChecks.js';
|
|
1
3
|
import { z } from 'zod';
|
|
2
4
|
import { productBenefitSchema } from './access.js';
|
|
3
5
|
/** Approved display terms never identify or activate a billing-provider price. */
|
|
4
6
|
export const personalPlanDisplayPriceSchema = z
|
|
5
7
|
.object({
|
|
6
8
|
currency: z.string().regex(/^[A-Z]{3}$/),
|
|
7
|
-
amountMinorUnits: z.number().
|
|
9
|
+
amountMinorUnits: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
|
|
8
10
|
interval: z.literal('month'),
|
|
9
11
|
trial: z.literal('none'),
|
|
10
12
|
taxTreatment: z.literal('inclusive'),
|
|
@@ -19,14 +21,17 @@ export const personalPlanCatalogueSchema = z
|
|
|
19
21
|
purchase: z.enum(['unavailable', 'available']),
|
|
20
22
|
plans: z.array(z
|
|
21
23
|
.object({
|
|
22
|
-
offerId: z.string().
|
|
23
|
-
offerVersion: z.number().
|
|
24
|
-
displayName: z.string().
|
|
24
|
+
offerId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(160)),
|
|
25
|
+
offerVersion: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
|
|
26
|
+
displayName: z.string().check(utf16MinLength(1)).check(utf16MaxLength(100)),
|
|
25
27
|
audience: z.literal('personal'),
|
|
26
28
|
kind: z.literal('oxy_one'),
|
|
27
29
|
price: personalPlanDisplayPriceSchema.optional(),
|
|
28
30
|
benefits: z.array(z
|
|
29
|
-
.object({
|
|
31
|
+
.object({
|
|
32
|
+
displayName: z.string().check(utf16MinLength(1)).check(utf16MaxLength(100)),
|
|
33
|
+
benefit: productBenefitSchema,
|
|
34
|
+
})
|
|
30
35
|
.strict()),
|
|
31
36
|
})
|
|
32
37
|
.strict()),
|
|
@@ -36,14 +41,14 @@ export const personalPlanCatalogueSchema = z
|
|
|
36
41
|
export const productPlanCatalogueSchema = z
|
|
37
42
|
.object({
|
|
38
43
|
schemaVersion: z.literal(1),
|
|
39
|
-
productId: z.string().
|
|
44
|
+
productId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(160)),
|
|
40
45
|
purchase: z.enum(['unavailable', 'available']),
|
|
41
46
|
plans: z.array(z
|
|
42
47
|
.object({
|
|
43
|
-
productId: z.string().
|
|
44
|
-
offerId: z.string().
|
|
45
|
-
offerVersion: z.number().
|
|
46
|
-
displayName: z.string().
|
|
48
|
+
productId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(160)),
|
|
49
|
+
offerId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(160)),
|
|
50
|
+
offerVersion: z.number().check(integerCheck()).positive().check(safeNumberCheck()),
|
|
51
|
+
displayName: z.string().check(utf16MinLength(1)).check(utf16MaxLength(100)),
|
|
47
52
|
price: personalPlanDisplayPriceSchema.extend({ interval: z.enum(['month', 'year']) }),
|
|
48
53
|
})
|
|
49
54
|
.strict()),
|
package/dist/esm/protocol.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { integerCheck } from './numberChecks.js';
|
|
1
2
|
/**
|
|
2
3
|
* Generic "Oxy Protocol" record surface — the app-agnostic conventions every app
|
|
3
4
|
* follows to decentralize its own content on the shared signed-record substrate.
|
|
@@ -41,10 +42,10 @@ import { z } from 'zod';
|
|
|
41
42
|
import { signedRecordEnvelopeSchema } from './identity.js';
|
|
42
43
|
export const chainHeadResponseSchema = z.object({
|
|
43
44
|
headRecordId: z.string().nullable(),
|
|
44
|
-
seq: z.number().
|
|
45
|
-
recordCount: z.number().
|
|
45
|
+
seq: z.number().check(integerCheck()),
|
|
46
|
+
recordCount: z.number().check(integerCheck()).nonnegative(),
|
|
46
47
|
});
|
|
47
48
|
export const logPageResponseSchema = z.object({
|
|
48
49
|
records: z.array(signedRecordEnvelopeSchema),
|
|
49
|
-
count: z.number().
|
|
50
|
+
count: z.number().check(integerCheck()).nonnegative(),
|
|
50
51
|
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { integerCheck } from './numberChecks.js';
|
|
2
|
+
import { isoDateTime, utf16MaxLength, utf16MinLength } from './stringChecks.js';
|
|
1
3
|
/**
|
|
2
4
|
* Recommendation-engine API contracts.
|
|
3
5
|
*
|
|
@@ -22,9 +24,12 @@ export const recommendationExcludeTypeSchema = z.enum(['federated', 'agent', 'au
|
|
|
22
24
|
* gate — a boost cannot resurrect a private/restricted/ineligible account.
|
|
23
25
|
*/
|
|
24
26
|
export const recommendationBoostSchema = z.object({
|
|
25
|
-
userIds: z
|
|
27
|
+
userIds: z
|
|
28
|
+
.array(z.string().trim().check(utf16MinLength(1)))
|
|
29
|
+
.min(1)
|
|
30
|
+
.max(200),
|
|
26
31
|
weight: z.number().min(-5).max(5),
|
|
27
|
-
reason: z.string().trim().
|
|
32
|
+
reason: z.string().trim().check(utf16MaxLength(120)).optional(),
|
|
28
33
|
});
|
|
29
34
|
/**
|
|
30
35
|
* Per-request overrides for the scoring signal weights. Every key is optional
|
|
@@ -52,18 +57,21 @@ export const recommendationSignalWeightsSchema = z
|
|
|
52
57
|
* ranking within server-enforced bounds.
|
|
53
58
|
*/
|
|
54
59
|
export const recommendationRequestSchema = z.object({
|
|
55
|
-
clientId: z.string().trim().
|
|
56
|
-
limit: z.number().
|
|
57
|
-
offset: z.number().
|
|
60
|
+
clientId: z.string().trim().check(utf16MinLength(1)).optional(),
|
|
61
|
+
limit: z.number().check(integerCheck()).min(1).max(100).optional(),
|
|
62
|
+
offset: z.number().check(integerCheck()).min(0).optional(),
|
|
58
63
|
excludeTypes: z.array(recommendationExcludeTypeSchema).optional(),
|
|
59
|
-
excludeIds: z
|
|
64
|
+
excludeIds: z
|
|
65
|
+
.array(z.string().trim().check(utf16MinLength(1)))
|
|
66
|
+
.max(500)
|
|
67
|
+
.optional(),
|
|
60
68
|
boosts: z.array(recommendationBoostSchema).max(50).optional(),
|
|
61
69
|
signalWeights: recommendationSignalWeightsSchema.optional(),
|
|
62
70
|
});
|
|
63
71
|
/** Follower/following counts attached to a recommendation item. */
|
|
64
72
|
export const recommendationCountSchema = z.object({
|
|
65
|
-
followers: z.number().
|
|
66
|
-
following: z.number().
|
|
73
|
+
followers: z.number().check(integerCheck()).nonnegative(),
|
|
74
|
+
following: z.number().check(integerCheck()).nonnegative(),
|
|
67
75
|
});
|
|
68
76
|
/**
|
|
69
77
|
* A single recommended profile.
|
|
@@ -85,7 +93,7 @@ export const recommendationItemSchema = z
|
|
|
85
93
|
description: z.string().nullable().optional(),
|
|
86
94
|
verified: z.boolean().optional(),
|
|
87
95
|
trustTier: z.string().optional(),
|
|
88
|
-
mutualCount: z.number().
|
|
96
|
+
mutualCount: z.number().check(integerCheck()).nonnegative(),
|
|
89
97
|
score: z.number().optional(),
|
|
90
98
|
matchedSignals: z.array(z.string()).optional(),
|
|
91
99
|
isFederated: z.boolean().optional(),
|
|
@@ -99,14 +107,14 @@ export const recommendationItemSchema = z
|
|
|
99
107
|
export const recommendationResponseSchema = z.array(recommendationItemSchema);
|
|
100
108
|
/** One endorsement edge an app reports: `ownerId` endorses `memberId`. */
|
|
101
109
|
export const appEndorsementInputSchema = z.object({
|
|
102
|
-
ownerId: z.string().trim().
|
|
103
|
-
memberId: z.string().trim().
|
|
110
|
+
ownerId: z.string().trim().check(utf16MinLength(1)),
|
|
111
|
+
memberId: z.string().trim().check(utf16MinLength(1)),
|
|
104
112
|
op: z.enum(['add', 'remove']).default('add'),
|
|
105
|
-
sourceId: z.string().trim().
|
|
113
|
+
sourceId: z.string().trim().check(utf16MinLength(1)).optional(),
|
|
106
114
|
});
|
|
107
115
|
/** One interest signal an app reports: how interested `userId` is in a topic. */
|
|
108
116
|
export const appInterestInputSchema = z.object({
|
|
109
|
-
userId: z.string().trim().
|
|
117
|
+
userId: z.string().trim().check(utf16MinLength(1)),
|
|
110
118
|
interestScore: z.number().min(0).max(1),
|
|
111
119
|
});
|
|
112
120
|
/**
|
|
@@ -150,12 +158,12 @@ export const appAffinityEventTypeSchema = z.enum([
|
|
|
150
158
|
* same application is folded at most once (bounded dedup window).
|
|
151
159
|
*/
|
|
152
160
|
export const appAffinityEventSchema = z.object({
|
|
153
|
-
fromUserId: z.string().trim().
|
|
154
|
-
toUserId: z.string().trim().
|
|
161
|
+
fromUserId: z.string().trim().check(utf16MinLength(1)),
|
|
162
|
+
toUserId: z.string().trim().check(utf16MinLength(1)),
|
|
155
163
|
type: appAffinityEventTypeSchema,
|
|
156
164
|
weight: z.number().min(0).max(100).optional(),
|
|
157
|
-
occurredAt: z.string().
|
|
158
|
-
eventId: z.string().trim().
|
|
165
|
+
occurredAt: z.string().check(isoDateTime()).optional(),
|
|
166
|
+
eventId: z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(200)).optional(),
|
|
159
167
|
});
|
|
160
168
|
/**
|
|
161
169
|
* Request body for `POST /app-signals/events` (service token, `signals:write`).
|
package/dist/esm/reputation.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { integerCheck } from './numberChecks.js';
|
|
2
|
+
import { utf16MaxLength, utf16MinLength } from './stringChecks.js';
|
|
1
3
|
/**
|
|
2
4
|
* Oxy Trust — reputation API contracts.
|
|
3
5
|
*
|
|
@@ -121,7 +123,7 @@ export const reputationTransactionSchema = z.object({
|
|
|
121
123
|
status: reputationTransactionStatusSchema,
|
|
122
124
|
reversedTransactionId: z.string().optional(),
|
|
123
125
|
reason: z.string().optional(),
|
|
124
|
-
metadata: z.record(z.unknown()).optional(),
|
|
126
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
125
127
|
createdByUserId: z.string().optional(),
|
|
126
128
|
reviewedByUserId: z.string().optional(),
|
|
127
129
|
reviewedAt: z.string().optional(),
|
|
@@ -179,7 +181,7 @@ export const reputationRuleSchema = z.object({
|
|
|
179
181
|
cooldownInMinutes: z.number(),
|
|
180
182
|
});
|
|
181
183
|
export const reputationRulesResponseSchema = z.object({
|
|
182
|
-
version: z.number().
|
|
184
|
+
version: z.number().check(integerCheck()),
|
|
183
185
|
rules: z.array(reputationRuleSchema),
|
|
184
186
|
});
|
|
185
187
|
export const reputationLeaderboardUserSchema = z.object({
|
|
@@ -201,14 +203,14 @@ export const reputationInfluenceResultSchema = z.object({
|
|
|
201
203
|
influence: reputationInfluenceSchema,
|
|
202
204
|
});
|
|
203
205
|
export const awardReputationSchema = z.object({
|
|
204
|
-
userId: z.string().trim().
|
|
205
|
-
actionType: z.string().trim().
|
|
206
|
-
applicationId: z.string().trim().
|
|
207
|
-
credentialId: z.string().trim().
|
|
208
|
-
sourceActionId: z.string().trim().
|
|
209
|
-
sourceActionType: z.string().trim().
|
|
210
|
-
targetEntityId: z.string().trim().
|
|
206
|
+
userId: z.string().trim().check(utf16MinLength(1)),
|
|
207
|
+
actionType: z.string().trim().check(utf16MinLength(1)),
|
|
208
|
+
applicationId: z.string().trim().check(utf16MinLength(1)).optional(),
|
|
209
|
+
credentialId: z.string().trim().check(utf16MinLength(1)).optional(),
|
|
210
|
+
sourceActionId: z.string().trim().check(utf16MinLength(1)).optional(),
|
|
211
|
+
sourceActionType: z.string().trim().check(utf16MinLength(1)).optional(),
|
|
212
|
+
targetEntityId: z.string().trim().check(utf16MinLength(1)).optional(),
|
|
211
213
|
targetEntityType: reputationTargetEntityTypeSchema.optional(),
|
|
212
|
-
reason: z.string().trim().
|
|
213
|
-
metadata: z.record(z.unknown()).optional(),
|
|
214
|
+
reason: z.string().trim().check(utf16MaxLength(500)).optional(),
|
|
215
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
214
216
|
});
|
package/dist/esm/safety.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import { integerCheck } from './numberChecks.js';
|
|
2
|
+
import { isoDateTime, utf16MaxLength, utf16MinLength } from './stringChecks.js';
|
|
1
3
|
import { z } from 'zod';
|
|
2
4
|
import { accountActorChainSchema } from './accountSubject.js';
|
|
3
5
|
// The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
|
|
4
6
|
// its vocabularies are re-exported here so the root entry is unchanged.
|
|
5
|
-
import { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, } from './client/safety.js';
|
|
7
|
+
import { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, } from './client/safety.js';
|
|
6
8
|
import { ORGANIZATION_TYPES } from './organizations.js';
|
|
7
9
|
import { reauthProofSchema } from './signIn.js';
|
|
8
10
|
import { userResponseSchema } from './userResponse.js';
|
|
9
|
-
export { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, };
|
|
11
|
+
export { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, };
|
|
10
12
|
/** The requester is authenticated by the bearer; applications cannot submit viewer IDs. */
|
|
11
13
|
export const profileAccessInputSchema = z
|
|
12
|
-
.object({ subjectAccountId: z.string().
|
|
14
|
+
.object({ subjectAccountId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)) })
|
|
13
15
|
.strict();
|
|
14
16
|
export const profileAccessDecisionSchema = z
|
|
15
17
|
.object({
|
|
@@ -31,8 +33,8 @@ export const SAFETY_DECISION_REASONS = [
|
|
|
31
33
|
'unrated_content',
|
|
32
34
|
'approval_required',
|
|
33
35
|
];
|
|
34
|
-
const accountId = z.string().
|
|
35
|
-
const resourceId = z.string().trim().
|
|
36
|
+
const accountId = z.string().check(utf16MinLength(1)).check(utf16MaxLength(128));
|
|
37
|
+
const resourceId = z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(256));
|
|
36
38
|
const uniqueIds = (max, min = 1) => z
|
|
37
39
|
.array(accountId)
|
|
38
40
|
.min(min)
|
|
@@ -167,7 +169,7 @@ export const messagingSessionsInputSchema = z
|
|
|
167
169
|
.array(z
|
|
168
170
|
.object({
|
|
169
171
|
requestId: resourceId,
|
|
170
|
-
accessToken: z.string().
|
|
172
|
+
accessToken: z.string().check(utf16MinLength(1)).check(utf16MaxLength(16384)),
|
|
171
173
|
})
|
|
172
174
|
.strict())
|
|
173
175
|
.min(1)
|
|
@@ -187,8 +189,20 @@ export const messagingSessionsResponseSchema = z
|
|
|
187
189
|
})
|
|
188
190
|
.strict();
|
|
189
191
|
export const safetyRequesterSchema = z.union([
|
|
190
|
-
z
|
|
191
|
-
|
|
192
|
+
z
|
|
193
|
+
.object({
|
|
194
|
+
accessToken: z.string().check(utf16MinLength(1)).check(utf16MaxLength(16384)).nullable(),
|
|
195
|
+
})
|
|
196
|
+
.strict(),
|
|
197
|
+
z
|
|
198
|
+
.object({ connectionToken: z.string().check(utf16MinLength(1)).check(utf16MaxLength(16384)) })
|
|
199
|
+
.strict(),
|
|
200
|
+
z
|
|
201
|
+
.object({ capabilityTicket: z.string().check(utf16MinLength(1)).check(utf16MaxLength(16384)) })
|
|
202
|
+
.strict(),
|
|
203
|
+
z
|
|
204
|
+
.object({ requesterContext: z.string().check(utf16MinLength(1)).check(utf16MaxLength(16384)) })
|
|
205
|
+
.strict(),
|
|
192
206
|
]);
|
|
193
207
|
export const supervisionSchema = z
|
|
194
208
|
.object({
|
|
@@ -197,7 +211,7 @@ export const supervisionSchema = z
|
|
|
197
211
|
status: z.enum(SUPERVISION_STATUSES),
|
|
198
212
|
policyVersion: z.literal(SAFETY_POLICY_VERSION),
|
|
199
213
|
consentVersion: z.literal(SUPERVISION_CONSENT_VERSION),
|
|
200
|
-
createdAt: z.string().
|
|
214
|
+
createdAt: z.string().check(isoDateTime()),
|
|
201
215
|
})
|
|
202
216
|
.strict();
|
|
203
217
|
export const supervisionInvitationSchema = z
|
|
@@ -206,16 +220,16 @@ export const supervisionInvitationSchema = z
|
|
|
206
220
|
childAccountId: accountId,
|
|
207
221
|
guardianAccountId: accountId,
|
|
208
222
|
status: z.enum(SUPERVISION_INVITATION_STATUSES),
|
|
209
|
-
expiresAt: z.string().
|
|
223
|
+
expiresAt: z.string().check(isoDateTime()),
|
|
210
224
|
consentVersion: z.literal(SUPERVISION_CONSENT_VERSION),
|
|
211
|
-
createdAt: z.string().
|
|
225
|
+
createdAt: z.string().check(isoDateTime()),
|
|
212
226
|
})
|
|
213
227
|
.strict();
|
|
214
228
|
export const supervisionContactSchema = z
|
|
215
229
|
.object({
|
|
216
230
|
childAccountId: accountId,
|
|
217
231
|
contactAccountId: accountId,
|
|
218
|
-
approvedAt: z.string().
|
|
232
|
+
approvedAt: z.string().check(isoDateTime()),
|
|
219
233
|
})
|
|
220
234
|
.strict();
|
|
221
235
|
export const supervisionStateSchema = z
|
|
@@ -229,14 +243,14 @@ export const supervisionContactsResponseSchema = z
|
|
|
229
243
|
.object({ items: z.array(supervisionContactSchema).max(1000) })
|
|
230
244
|
.strict();
|
|
231
245
|
const fingerprint = z.string().regex(/^[a-f0-9]{64}$/);
|
|
232
|
-
const minorUnits = z.number().
|
|
246
|
+
const minorUnits = z.number().check(integerCheck()).nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
233
247
|
export const purchaseApprovalLineSchema = z
|
|
234
248
|
.object({
|
|
235
249
|
itemReference: resourceId,
|
|
236
|
-
title: z.string().trim().
|
|
237
|
-
optionsText: z.string().trim().
|
|
250
|
+
title: z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(300)),
|
|
251
|
+
optionsText: z.string().trim().check(utf16MaxLength(300)),
|
|
238
252
|
merchantAccountId: accountId,
|
|
239
|
-
quantity: z.number().
|
|
253
|
+
quantity: z.number().check(integerCheck()).min(1).max(1000000),
|
|
240
254
|
unitAmountMinor: minorUnits,
|
|
241
255
|
lineAmountMinor: minorUnits,
|
|
242
256
|
})
|
|
@@ -246,7 +260,7 @@ const purchaseEffectsObject = z
|
|
|
246
260
|
operationId: resourceId,
|
|
247
261
|
resourceId,
|
|
248
262
|
cartFingerprint: fingerprint,
|
|
249
|
-
summary: z.string().trim().
|
|
263
|
+
summary: z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(300)),
|
|
250
264
|
merchantAccountIds: z
|
|
251
265
|
.array(accountId)
|
|
252
266
|
.min(1)
|
|
@@ -259,13 +273,13 @@ const purchaseEffectsObject = z
|
|
|
259
273
|
discountMinor: minorUnits,
|
|
260
274
|
roundingAdjustmentMinor: z
|
|
261
275
|
.number()
|
|
262
|
-
.
|
|
276
|
+
.check(integerCheck())
|
|
263
277
|
.min(-Number.MAX_SAFE_INTEGER)
|
|
264
278
|
.max(Number.MAX_SAFE_INTEGER),
|
|
265
279
|
paymentFingerprint: fingerprint,
|
|
266
280
|
amountMinor: minorUnits,
|
|
267
281
|
currency: z.string().regex(/^[A-Z]{3}$/),
|
|
268
|
-
expiresAt: z.string().
|
|
282
|
+
expiresAt: z.string().check(isoDateTime()),
|
|
269
283
|
})
|
|
270
284
|
.strict();
|
|
271
285
|
function validatePurchaseEvidence(value, ctx) {
|
|
@@ -308,8 +322,8 @@ const purchaseApprovalFields = {
|
|
|
308
322
|
childAccountId: accountId,
|
|
309
323
|
applicationId: accountId,
|
|
310
324
|
status: z.enum(PURCHASE_APPROVAL_STATUSES),
|
|
311
|
-
createdAt: z.string().
|
|
312
|
-
receiptReference: z.string().
|
|
325
|
+
createdAt: z.string().check(isoDateTime()),
|
|
326
|
+
receiptReference: z.string().check(utf16MaxLength(512)).nullable(),
|
|
313
327
|
};
|
|
314
328
|
export const purchaseApprovalSchema = purchaseEffectsObject
|
|
315
329
|
.extend(purchaseApprovalFields)
|
|
@@ -333,7 +347,7 @@ export const confirmPurchaseSchema = z
|
|
|
333
347
|
.object({
|
|
334
348
|
approvalId: accountId,
|
|
335
349
|
operationId: resourceId,
|
|
336
|
-
receiptReference: z.string().trim().
|
|
350
|
+
receiptReference: z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(512)),
|
|
337
351
|
})
|
|
338
352
|
.strict();
|
|
339
353
|
export const cancelPurchaseSchema = confirmPurchaseSchema.omit({ receiptReference: true });
|
|
@@ -370,7 +384,7 @@ export const supervisionReviewInputSchema = z
|
|
|
370
384
|
childAccountId: accountId,
|
|
371
385
|
action: z.enum(['end', 'transfer']),
|
|
372
386
|
guardianAccountId: accountId.optional(),
|
|
373
|
-
evidenceReference: z.string().trim().
|
|
387
|
+
evidenceReference: z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(2048)),
|
|
374
388
|
reauth: reauthProofSchema,
|
|
375
389
|
})
|
|
376
390
|
.strict();
|
|
@@ -380,7 +394,7 @@ export const purchaseReviewInputSchema = z
|
|
|
380
394
|
export const safetySessionInputSchema = z
|
|
381
395
|
.object({
|
|
382
396
|
sessionId: accountId,
|
|
383
|
-
accessToken: z.string().
|
|
397
|
+
accessToken: z.string().check(utf16MinLength(1)).check(utf16MaxLength(16384)),
|
|
384
398
|
action: z.enum(SUPERVISED_ACTIONS),
|
|
385
399
|
})
|
|
386
400
|
.strict();
|
|
@@ -388,8 +402,8 @@ export const safetySessionValidationSchema = z
|
|
|
388
402
|
.object({
|
|
389
403
|
valid: z.literal(true),
|
|
390
404
|
sessionId: accountId,
|
|
391
|
-
expiresAt: z.string().
|
|
392
|
-
lastActivity: z.string().
|
|
405
|
+
expiresAt: z.string().check(isoDateTime()),
|
|
406
|
+
lastActivity: z.string().check(isoDateTime()),
|
|
393
407
|
user: userResponseSchema,
|
|
394
408
|
actor: accountActorChainSchema,
|
|
395
409
|
})
|
|
@@ -399,7 +413,9 @@ export const safetyPersonSchema = z
|
|
|
399
413
|
.object({ accountId, username: z.string().nullable(), displayName: z.string().nullable() })
|
|
400
414
|
.strict();
|
|
401
415
|
export const safetyPeopleInputSchema = z.union([
|
|
402
|
-
z
|
|
416
|
+
z
|
|
417
|
+
.object({ query: z.string().trim().check(utf16MinLength(2)).check(utf16MaxLength(100)) })
|
|
418
|
+
.strict(),
|
|
403
419
|
z.object({ accountIds: uniqueIds(100) }).strict(),
|
|
404
420
|
]);
|
|
405
421
|
export const safetyPeopleResponseSchema = z
|
|
@@ -417,8 +433,8 @@ export const safetyOrganizationIdentitySchema = z
|
|
|
417
433
|
export const safetyOrganizationsInputSchema = z.union([
|
|
418
434
|
z
|
|
419
435
|
.object({
|
|
420
|
-
query: z.string().trim().
|
|
421
|
-
limit: z.number().
|
|
436
|
+
query: z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(100)),
|
|
437
|
+
limit: z.number().check(integerCheck()).min(1).max(20).optional(),
|
|
422
438
|
})
|
|
423
439
|
.strict(),
|
|
424
440
|
z.object({ ids: uniqueIds(100) }).strict(),
|