@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,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inferenceStreamEventSchema = exports.inferenceStreamDoneEventSchema = exports.inferenceFinishReasonSchema = exports.inferenceStreamErrorEventSchema = exports.inferenceStreamRouteSwitchEventSchema = exports.inferenceRouteSwitchReasonSchema = exports.inferenceRouteSwitchDetailSchema = exports.inferenceStreamUsageEventSchema = exports.inferenceStreamToolCallEventSchema = exports.inferenceStreamAudioEventSchema = exports.MAX_INFERENCE_AUDIO_BYTES = exports.inferenceAudioMediaTypeSchema = exports.inferenceStreamDeltaEventSchema = exports.inferenceStreamStartEventSchema = void 0;
|
|
4
|
+
const numberChecks_1 = require("../numberChecks");
|
|
5
|
+
const stringChecks_1 = require("../stringChecks");
|
|
2
6
|
/**
|
|
3
7
|
* Normalized stream events — what the data plane emits and the Oxy edge
|
|
4
8
|
* forwards as SSE.
|
|
@@ -21,8 +25,6 @@
|
|
|
21
25
|
*
|
|
22
26
|
* Decided in: docs/adr/0010-public-api-compatibility.md, docs/adr/0008-catalogue-concept-separation.md.
|
|
23
27
|
*/
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.inferenceStreamEventSchema = exports.inferenceStreamDoneEventSchema = exports.inferenceFinishReasonSchema = exports.inferenceStreamErrorEventSchema = exports.inferenceStreamRouteSwitchEventSchema = exports.inferenceRouteSwitchReasonSchema = exports.inferenceRouteSwitchDetailSchema = exports.inferenceStreamUsageEventSchema = exports.inferenceStreamToolCallEventSchema = exports.inferenceStreamAudioEventSchema = exports.MAX_INFERENCE_AUDIO_BYTES = exports.inferenceAudioMediaTypeSchema = exports.inferenceStreamDeltaEventSchema = exports.inferenceStreamStartEventSchema = void 0;
|
|
26
28
|
const zod_1 = require("zod");
|
|
27
29
|
const identifiers_1 = require("./identifiers");
|
|
28
30
|
const errors_1 = require("./errors");
|
|
@@ -40,7 +42,7 @@ exports.inferenceStreamStartEventSchema = zod_1.z.object({
|
|
|
40
42
|
schemaVersion: zod_1.z.literal(1),
|
|
41
43
|
type: zod_1.z.literal('start'),
|
|
42
44
|
requestId: identifiers_1.requestIdSchema,
|
|
43
|
-
sequence: zod_1.z.number().
|
|
45
|
+
sequence: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().check((0, numberChecks_1.safeNumberCheck)()),
|
|
44
46
|
generationId: identifiers_1.generationIdSchema.optional(),
|
|
45
47
|
/** Always revision-pinned, even when the request named only the model. */
|
|
46
48
|
resolvedModelReference: identifiers_1.modelReferenceSchema,
|
|
@@ -59,9 +61,9 @@ exports.inferenceStreamDeltaEventSchema = zod_1.z.object({
|
|
|
59
61
|
schemaVersion: zod_1.z.literal(1),
|
|
60
62
|
type: zod_1.z.literal('delta'),
|
|
61
63
|
requestId: identifiers_1.requestIdSchema,
|
|
62
|
-
sequence: zod_1.z.number().
|
|
64
|
+
sequence: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().check((0, numberChecks_1.safeNumberCheck)()),
|
|
63
65
|
/** Which output of a multi-output response this chunk belongs to. */
|
|
64
|
-
outputIndex: zod_1.z.number().
|
|
66
|
+
outputIndex: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().check((0, numberChecks_1.safeNumberCheck)()),
|
|
65
67
|
/**
|
|
66
68
|
* `output_audio_transcript` (contract set 3.2.0) carries the words of spoken
|
|
67
69
|
* output requested with `audioOutput`. It is its own channel for the same
|
|
@@ -87,10 +89,14 @@ exports.inferenceStreamAudioEventSchema = zod_1.z.object({
|
|
|
87
89
|
schemaVersion: zod_1.z.literal(1),
|
|
88
90
|
type: zod_1.z.literal('audio'),
|
|
89
91
|
requestId: identifiers_1.requestIdSchema,
|
|
90
|
-
sequence: zod_1.z.number().
|
|
91
|
-
outputIndex: zod_1.z.number().
|
|
92
|
+
sequence: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().check((0, numberChecks_1.safeNumberCheck)()),
|
|
93
|
+
outputIndex: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().check((0, numberChecks_1.safeNumberCheck)()),
|
|
92
94
|
mediaType: exports.inferenceAudioMediaTypeSchema,
|
|
93
|
-
data: zod_1.z
|
|
95
|
+
data: zod_1.z
|
|
96
|
+
.string()
|
|
97
|
+
.check((0, stringChecks_1.utf16MinLength)(4))
|
|
98
|
+
.check((0, stringChecks_1.utf16MaxLength)(65536))
|
|
99
|
+
.regex(identifiers_1.PADDED_BASE64_PATTERN),
|
|
94
100
|
});
|
|
95
101
|
/**
|
|
96
102
|
* A tool call being streamed.
|
|
@@ -103,10 +109,10 @@ exports.inferenceStreamToolCallEventSchema = zod_1.z.object({
|
|
|
103
109
|
schemaVersion: zod_1.z.literal(1),
|
|
104
110
|
type: zod_1.z.literal('tool_call'),
|
|
105
111
|
requestId: identifiers_1.requestIdSchema,
|
|
106
|
-
sequence: zod_1.z.number().
|
|
107
|
-
toolCallId: zod_1.z.string().
|
|
112
|
+
sequence: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().check((0, numberChecks_1.safeNumberCheck)()),
|
|
113
|
+
toolCallId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)),
|
|
108
114
|
/** Present on the first event of a call. */
|
|
109
|
-
name: zod_1.z.string().
|
|
115
|
+
name: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)).optional(),
|
|
110
116
|
argumentsDelta: zod_1.z.string().optional(),
|
|
111
117
|
complete: zod_1.z.boolean(),
|
|
112
118
|
});
|
|
@@ -150,7 +156,7 @@ exports.inferenceStreamUsageEventSchema = zod_1.z.object({
|
|
|
150
156
|
schemaVersion: zod_1.z.literal(2),
|
|
151
157
|
type: zod_1.z.literal('usage'),
|
|
152
158
|
requestId: identifiers_1.requestIdSchema,
|
|
153
|
-
sequence: zod_1.z.number().
|
|
159
|
+
sequence: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().check((0, numberChecks_1.safeNumberCheck)()),
|
|
154
160
|
/** Exact deployment whose metering produced these partial units. */
|
|
155
161
|
deploymentId: identifiers_1.deploymentIdSchema,
|
|
156
162
|
units: zod_1.z.array(money_1.usageQuantitySchema).min(1),
|
|
@@ -215,7 +221,7 @@ exports.inferenceStreamRouteSwitchEventSchema = zod_1.z.object({
|
|
|
215
221
|
schemaVersion: zod_1.z.literal(1),
|
|
216
222
|
type: zod_1.z.literal('route_switch'),
|
|
217
223
|
requestId: identifiers_1.requestIdSchema,
|
|
218
|
-
sequence: zod_1.z.number().
|
|
224
|
+
sequence: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().check((0, numberChecks_1.safeNumberCheck)()),
|
|
219
225
|
reason: exports.inferenceRouteSwitchReasonSchema,
|
|
220
226
|
detail: exports.inferenceRouteSwitchDetailSchema,
|
|
221
227
|
occurredAt: identifiers_1.inferenceTimestampSchema,
|
|
@@ -229,7 +235,7 @@ exports.inferenceStreamErrorEventSchema = zod_1.z.object({
|
|
|
229
235
|
schemaVersion: zod_1.z.literal(1),
|
|
230
236
|
type: zod_1.z.literal('error'),
|
|
231
237
|
requestId: identifiers_1.requestIdSchema,
|
|
232
|
-
sequence: zod_1.z.number().
|
|
238
|
+
sequence: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().check((0, numberChecks_1.safeNumberCheck)()),
|
|
233
239
|
/** Carries its own `schemaVersion`: the same body is returned non-streaming. */
|
|
234
240
|
error: errors_1.inferenceErrorSchema,
|
|
235
241
|
});
|
|
@@ -262,10 +268,10 @@ exports.inferenceStreamDoneEventSchema = zod_1.z.object({
|
|
|
262
268
|
schemaVersion: zod_1.z.literal(1),
|
|
263
269
|
type: zod_1.z.literal('done'),
|
|
264
270
|
requestId: identifiers_1.requestIdSchema,
|
|
265
|
-
sequence: zod_1.z.number().
|
|
271
|
+
sequence: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().check((0, numberChecks_1.safeNumberCheck)()),
|
|
266
272
|
generationId: identifiers_1.generationIdSchema.optional(),
|
|
267
273
|
finishReason: exports.inferenceFinishReasonSchema,
|
|
268
|
-
receiptId: zod_1.z.string().
|
|
274
|
+
receiptId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)).optional(),
|
|
269
275
|
completedAt: identifiers_1.inferenceTimestampSchema,
|
|
270
276
|
});
|
|
271
277
|
/**
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usageRefundSchema = exports.usageRefundReasonSchema = exports.usageRefundSubjectSchema = exports.usageReceiptSchema = exports.normalizedUsageReportSchema = exports.inferenceRequestOutcomeSchema = exports.usageReservationSchema = exports.usageReservationStatusSchema = exports.usageReservationRequestSchema = void 0;
|
|
4
|
+
const numberChecks_1 = require("../numberChecks");
|
|
5
|
+
const stringChecks_1 = require("../stringChecks");
|
|
2
6
|
/**
|
|
3
7
|
* The reserve → settle → refund protocol.
|
|
4
8
|
*
|
|
@@ -29,8 +33,6 @@
|
|
|
29
33
|
*
|
|
30
34
|
* Decided in: docs/adr/0009-usage-reservation-and-settlement.md.
|
|
31
35
|
*/
|
|
32
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.usageRefundSchema = exports.usageRefundReasonSchema = exports.usageRefundSubjectSchema = exports.usageReceiptSchema = exports.normalizedUsageReportSchema = exports.inferenceRequestOutcomeSchema = exports.usageReservationSchema = exports.usageReservationStatusSchema = exports.usageReservationRequestSchema = void 0;
|
|
34
36
|
const zod_1 = require("zod");
|
|
35
37
|
const attribution_1 = require("./attribution");
|
|
36
38
|
const identifiers_1 = require("./identifiers");
|
|
@@ -57,12 +59,12 @@ exports.usageReservationRequestSchema = zod_1.z.object({
|
|
|
57
59
|
/** Units already determined by the request itself, e.g. input tokens. */
|
|
58
60
|
knownUnits: zod_1.z.array(money_1.usageQuantitySchema).default([]),
|
|
59
61
|
/** The ceiling on generated output, when the request set one. */
|
|
60
|
-
maxOutputTokens: zod_1.z.number().
|
|
62
|
+
maxOutputTokens: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive().check((0, numberChecks_1.safeNumberCheck)()).optional(),
|
|
61
63
|
/** The price version of the most expensive route the policy permits. */
|
|
62
|
-
ceilingPriceVersionId: zod_1.z.string().
|
|
64
|
+
ceilingPriceVersionId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)),
|
|
63
65
|
maxAmount: money_1.exactDecimalSchema,
|
|
64
66
|
currency: money_1.currencyCodeSchema,
|
|
65
|
-
expiresInSeconds: zod_1.z.number().
|
|
67
|
+
expiresInSeconds: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive().max(86400),
|
|
66
68
|
});
|
|
67
69
|
/** Lifecycle of a hold. Terminal states are `settled`, `released`, `expired`. */
|
|
68
70
|
exports.usageReservationStatusSchema = zod_1.z.enum(['held', 'settled', 'released', 'expired']);
|
|
@@ -77,17 +79,17 @@ exports.usageReservationSchema = zod_1.z
|
|
|
77
79
|
.object({
|
|
78
80
|
/** See `version.ts`: read back by the edge and the Console on its own. */
|
|
79
81
|
schemaVersion: zod_1.z.literal(1),
|
|
80
|
-
reservationId: zod_1.z.string().
|
|
82
|
+
reservationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)),
|
|
81
83
|
idempotencyKey: identifiers_1.idempotencyKeySchema,
|
|
82
84
|
attribution: attribution_1.inferenceAttributionSchema,
|
|
83
85
|
status: exports.usageReservationStatusSchema,
|
|
84
86
|
reservedAmount: money_1.exactDecimalSchema,
|
|
85
87
|
currency: money_1.currencyCodeSchema,
|
|
86
|
-
ceilingPriceVersionId: zod_1.z.string().
|
|
88
|
+
ceilingPriceVersionId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)),
|
|
87
89
|
createdAt: identifiers_1.inferenceTimestampSchema,
|
|
88
90
|
expiresAt: identifiers_1.inferenceTimestampSchema,
|
|
89
91
|
/** The receipt that consumed this hold. Present exactly when `settled`. */
|
|
90
|
-
settledReceiptId: zod_1.z.string().
|
|
92
|
+
settledReceiptId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)).optional(),
|
|
91
93
|
})
|
|
92
94
|
.superRefine((reservation, ctx) => {
|
|
93
95
|
if (reservation.status === 'settled' && reservation.settledReceiptId === undefined) {
|
|
@@ -172,7 +174,7 @@ exports.normalizedUsageReportSchema = zod_1.z
|
|
|
172
174
|
/** Exact Kaana deployment that attempted the request; never inferred from names. */
|
|
173
175
|
deploymentId: identifiers_1.deploymentIdSchema,
|
|
174
176
|
/** How many allowed route switches occurred while serving this request. */
|
|
175
|
-
routeSwitches: zod_1.z.number().
|
|
177
|
+
routeSwitches: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().max(100),
|
|
176
178
|
/**
|
|
177
179
|
* The funding tier of the platform key that served the final attempt, as
|
|
178
180
|
* the data plane states it (ADR 0038). Absent when the key's economics
|
|
@@ -183,7 +185,12 @@ exports.normalizedUsageReportSchema = zod_1.z
|
|
|
183
185
|
fundingTier: identifiers_1.inferenceFundingTierSchema.optional(),
|
|
184
186
|
startedAt: identifiers_1.inferenceTimestampSchema,
|
|
185
187
|
completedAt: identifiers_1.inferenceTimestampSchema,
|
|
186
|
-
timeToFirstTokenMs: zod_1.z
|
|
188
|
+
timeToFirstTokenMs: zod_1.z
|
|
189
|
+
.number()
|
|
190
|
+
.check((0, numberChecks_1.integerCheck)())
|
|
191
|
+
.nonnegative()
|
|
192
|
+
.check((0, numberChecks_1.safeNumberCheck)())
|
|
193
|
+
.optional(),
|
|
187
194
|
})
|
|
188
195
|
.superRefine((report, ctx) => {
|
|
189
196
|
// Compared as instants: two spellings of one moment sort differently as text.
|
|
@@ -229,9 +236,9 @@ exports.usageReceiptSchema = zod_1.z
|
|
|
229
236
|
.object({
|
|
230
237
|
/** See `version.ts`: returned to customers by `GET /v1/generations/:id`. */
|
|
231
238
|
schemaVersion: zod_1.z.literal(1),
|
|
232
|
-
receiptId: zod_1.z.string().
|
|
239
|
+
receiptId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)),
|
|
233
240
|
/** The hold this settled against. Absent for a charge with no reservation. */
|
|
234
|
-
reservationId: zod_1.z.string().
|
|
241
|
+
reservationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)).optional(),
|
|
235
242
|
idempotencyKey: identifiers_1.idempotencyKeySchema,
|
|
236
243
|
attribution: attribution_1.inferenceAttributionSchema,
|
|
237
244
|
outcome: exports.inferenceRequestOutcomeSchema,
|
|
@@ -273,8 +280,18 @@ exports.usageReceiptSchema = zod_1.z
|
|
|
273
280
|
* ledger accounts and only the second one is visible on an invoice.
|
|
274
281
|
*/
|
|
275
282
|
exports.usageRefundSubjectSchema = zod_1.z.discriminatedUnion('kind', [
|
|
276
|
-
zod_1.z
|
|
277
|
-
|
|
283
|
+
zod_1.z
|
|
284
|
+
.object({
|
|
285
|
+
kind: zod_1.z.literal('reservation'),
|
|
286
|
+
reservationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)),
|
|
287
|
+
})
|
|
288
|
+
.strict(),
|
|
289
|
+
zod_1.z
|
|
290
|
+
.object({
|
|
291
|
+
kind: zod_1.z.literal('receipt'),
|
|
292
|
+
receiptId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)),
|
|
293
|
+
})
|
|
294
|
+
.strict(),
|
|
278
295
|
]);
|
|
279
296
|
/** Why money was given back or a hold was released. */
|
|
280
297
|
exports.usageRefundReasonSchema = zod_1.z.enum([
|
|
@@ -303,7 +320,7 @@ exports.usageRefundSchema = zod_1.z
|
|
|
303
320
|
.object({
|
|
304
321
|
/** See `version.ts`: a ledger record read back on its own. */
|
|
305
322
|
schemaVersion: zod_1.z.literal(1),
|
|
306
|
-
refundId: zod_1.z.string().
|
|
323
|
+
refundId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)),
|
|
307
324
|
idempotencyKey: identifiers_1.idempotencyKeySchema,
|
|
308
325
|
attribution: attribution_1.inferenceAttributionSchema,
|
|
309
326
|
subject: exports.usageRefundSubjectSchema,
|
package/dist/cjs/keyRecovery.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.backupStatusResponseSchema = exports.backupUploadRequestSchema = exports.encryptedBackupEnvelopeSchema = exports.backupLookupIdSchema = void 0;
|
|
4
|
+
const numberChecks_1 = require("./numberChecks");
|
|
5
|
+
const stringChecks_1 = require("./stringChecks");
|
|
4
6
|
/**
|
|
5
7
|
* Encrypted off-device identity backup contract (b3 Feature 1).
|
|
6
8
|
*
|
|
@@ -57,13 +59,13 @@ exports.backupLookupIdSchema = zod_1.z
|
|
|
57
59
|
* - `createdAt` — ISO-8601 creation timestamp.
|
|
58
60
|
*/
|
|
59
61
|
exports.encryptedBackupEnvelopeSchema = zod_1.z.object({
|
|
60
|
-
version: zod_1.z.number().
|
|
62
|
+
version: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
|
|
61
63
|
algorithm: zod_1.z.literal('xchacha20poly1305'),
|
|
62
|
-
kdfInfo: zod_1.z.string().
|
|
63
|
-
nonce: zod_1.z.string().trim().
|
|
64
|
-
ciphertext: zod_1.z.string().trim().
|
|
65
|
-
publicKeyHint: zod_1.z.string().trim().
|
|
66
|
-
createdAt: zod_1.z.string().trim().
|
|
64
|
+
kdfInfo: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
65
|
+
nonce: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
66
|
+
ciphertext: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
67
|
+
publicKeyHint: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
68
|
+
createdAt: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
67
69
|
});
|
|
68
70
|
/**
|
|
69
71
|
* Request body of `POST /identity/backup` — the envelope PLUS the raw
|
package/dist/cjs/keyRotation.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rotateKeyCompleteResponseSchema = exports.rotateKeyCompleteRequestSchema = exports.rotateKeyChallengeResponseSchema = void 0;
|
|
4
|
+
const stringChecks_1 = require("./stringChecks");
|
|
4
5
|
/**
|
|
5
6
|
* Key-rotation contract (b3 Feature 3 — key rotation + last-credential replacement).
|
|
6
7
|
*
|
|
@@ -54,11 +55,11 @@ exports.rotateKeyChallengeResponseSchema = zod_1.z.object({
|
|
|
54
55
|
* key Y.
|
|
55
56
|
*/
|
|
56
57
|
exports.rotateKeyCompleteRequestSchema = zod_1.z.object({
|
|
57
|
-
newPublicKey: zod_1.z.string().trim().
|
|
58
|
-
challenge: zod_1.z.string().trim().
|
|
59
|
-
signature: zod_1.z.string().trim().
|
|
58
|
+
newPublicKey: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
59
|
+
challenge: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
60
|
+
signature: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
60
61
|
/** Proof-of-possession: the NEW key signs the rotate_key_new payload. */
|
|
61
|
-
newKeyProof: zod_1.z.string().trim().
|
|
62
|
+
newKeyProof: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
62
63
|
timestamp: zod_1.z.number(),
|
|
63
64
|
/**
|
|
64
65
|
* When true, all OTHER active sessions for the account are revoked after a
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.linkedAccountStartErrorDetailsSchema = exports.linkedAccountStartErrorReasonSchema = exports.LINKED_ACCOUNT_START_ERROR_REASONS = exports.LINKED_ACCOUNT_CALLBACK_ERRORS = exports.serviceLinkedAccountListResponseSchema = exports.serviceLinkedAccountSchema = exports.linkedAccountListResponseSchema = exports.completeLinkedAccountResponseSchema = exports.linkedAccountSchema = exports.completeLinkedAccountRequestSchema = exports.startLinkedAccountResponseSchema = exports.startLinkedAccountRequestSchema = exports.linkedAccountNetworkSchema = exports.LINKED_ACCOUNT_NETWORKS = void 0;
|
|
4
|
+
const stringChecks_1 = require("./stringChecks");
|
|
2
5
|
/**
|
|
3
6
|
* Wire contract for Oxy linked accounts — external accounts (any Mastodon-API
|
|
4
7
|
* server, Bluesky) a LOCAL Oxy user has proven they own by completing an OAuth
|
|
@@ -10,8 +13,6 @@
|
|
|
10
13
|
*
|
|
11
14
|
* Platform-agnostic — zod only, no react/react-native/expo.
|
|
12
15
|
*/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.linkedAccountStartErrorDetailsSchema = exports.linkedAccountStartErrorReasonSchema = exports.LINKED_ACCOUNT_START_ERROR_REASONS = exports.LINKED_ACCOUNT_CALLBACK_ERRORS = exports.serviceLinkedAccountListResponseSchema = exports.serviceLinkedAccountSchema = exports.linkedAccountListResponseSchema = exports.completeLinkedAccountResponseSchema = exports.linkedAccountSchema = exports.completeLinkedAccountRequestSchema = exports.startLinkedAccountResponseSchema = exports.startLinkedAccountRequestSchema = exports.linkedAccountNetworkSchema = exports.LINKED_ACCOUNT_NETWORKS = void 0;
|
|
15
16
|
const zod_1 = require("zod");
|
|
16
17
|
exports.LINKED_ACCOUNT_NETWORKS = ['activitypub', 'atproto'];
|
|
17
18
|
exports.linkedAccountNetworkSchema = zod_1.z.enum(exports.LINKED_ACCOUNT_NETWORKS);
|
|
@@ -27,16 +28,16 @@ exports.linkedAccountNetworkSchema = zod_1.z.enum(exports.LINKED_ACCOUNT_NETWORK
|
|
|
27
28
|
*/
|
|
28
29
|
exports.startLinkedAccountRequestSchema = zod_1.z
|
|
29
30
|
.object({
|
|
30
|
-
instance: zod_1.z.string().trim().
|
|
31
|
-
handle: zod_1.z.string().trim().
|
|
32
|
-
clientId: zod_1.z.string().trim().
|
|
33
|
-
returnTo: zod_1.z.string().trim().
|
|
31
|
+
instance: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(320)).optional(),
|
|
32
|
+
handle: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(320)).optional(),
|
|
33
|
+
clientId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(256)),
|
|
34
|
+
returnTo: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(2048)),
|
|
34
35
|
})
|
|
35
36
|
.strict();
|
|
36
37
|
exports.startLinkedAccountResponseSchema = zod_1.z
|
|
37
38
|
.object({
|
|
38
|
-
authorizeUrl: zod_1.z.string().
|
|
39
|
-
expiresAt: zod_1.z.string().
|
|
39
|
+
authorizeUrl: zod_1.z.string().check((0, stringChecks_1.urlCheck)()),
|
|
40
|
+
expiresAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
40
41
|
})
|
|
41
42
|
.strict();
|
|
42
43
|
/**
|
|
@@ -46,22 +47,22 @@ exports.startLinkedAccountResponseSchema = zod_1.z
|
|
|
46
47
|
* other user it is refused (403) and burned.
|
|
47
48
|
*/
|
|
48
49
|
exports.completeLinkedAccountRequestSchema = zod_1.z
|
|
49
|
-
.object({ code: zod_1.z.string().trim().
|
|
50
|
+
.object({ code: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(256)) })
|
|
50
51
|
.strict();
|
|
51
52
|
/** One live linked account, as its owner sees it. */
|
|
52
53
|
exports.linkedAccountSchema = zod_1.z
|
|
53
54
|
.object({
|
|
54
|
-
id: zod_1.z.string().
|
|
55
|
+
id: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
55
56
|
network: exports.linkedAccountNetworkSchema,
|
|
56
57
|
/** `username@domain` for ActivityPub; the DID for atproto. */
|
|
57
|
-
accountKey: zod_1.z.string().
|
|
58
|
+
accountKey: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
58
59
|
/** ActivityPub actor id, or the DID for atproto. */
|
|
59
|
-
actorUri: zod_1.z.string().
|
|
60
|
-
handle: zod_1.z.string().
|
|
61
|
-
host: zod_1.z.string().
|
|
60
|
+
actorUri: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
61
|
+
handle: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
62
|
+
host: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
62
63
|
proofMethod: zod_1.z.literal('oauth'),
|
|
63
|
-
verifiedAt: zod_1.z.string().
|
|
64
|
-
createdAt: zod_1.z.string().
|
|
64
|
+
verifiedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
65
|
+
createdAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
|
|
65
66
|
})
|
|
66
67
|
.strict();
|
|
67
68
|
exports.completeLinkedAccountResponseSchema = zod_1.z
|
|
@@ -77,10 +78,13 @@ exports.linkedAccountListResponseSchema = zod_1.z
|
|
|
77
78
|
* content Oxy federated in before the account was linked.
|
|
78
79
|
*/
|
|
79
80
|
exports.serviceLinkedAccountSchema = exports.linkedAccountSchema
|
|
80
|
-
.extend({ federatedUserId: zod_1.z.string().
|
|
81
|
+
.extend({ federatedUserId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).nullable() })
|
|
81
82
|
.strict();
|
|
82
83
|
exports.serviceLinkedAccountListResponseSchema = zod_1.z
|
|
83
|
-
.object({
|
|
84
|
+
.object({
|
|
85
|
+
userId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
86
|
+
linkedAccounts: zod_1.z.array(exports.serviceLinkedAccountSchema),
|
|
87
|
+
})
|
|
84
88
|
.strict();
|
|
85
89
|
/**
|
|
86
90
|
* Error codes the callback appends as `?link_error=<code>` to `returnTo`. An
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applicationModerationTrustSchema = exports.reputationContextualInfluenceSchema = exports.reputationReviewingSchema = exports.reputationReportingSchema = exports.reputationConductSchema = exports.reputationContributionSchema = exports.reputationPersonhoodSchema = exports.identityBindingSchema = exports.registerIdentityBindingSchema = exports.reverseModerationEffectResultSchema = exports.applyModerationDecisionResultSchema = exports.moderationEffectSchema = exports.reverseModerationEffectSchema = exports.finalizeModerationDecisionSchema = exports.moderationDecisionEventSchema = exports.moderationPolicyVersionsSchema = exports.moderationDecisionEventSubjectSchema = exports.moderationFindingSchema = exports.moderationEffectSkipReasonSchema = exports.MODERATION_EFFECT_SKIP_REASONS = exports.applicationModerationStandingSchema = exports.APPLICATION_MODERATION_STANDINGS = exports.identityBindingStatusSchema = exports.IDENTITY_BINDING_STATUSES = exports.identityBindingTypeSchema = exports.IDENTITY_BINDING_TYPES = exports.personhoodStatusSchema = exports.PERSONHOOD_STATUSES = exports.contributionTierSchema = exports.CONTRIBUTION_TIERS = exports.conductStandingSchema = exports.CONDUCT_STANDINGS = exports.conductStrikeStatusSchema = exports.CONDUCT_STRIKE_STATUSES = exports.moderationEffectStatusSchema = exports.MODERATION_EFFECT_STATUSES = exports.moderationEffectTypeSchema = exports.MODERATION_EFFECT_TYPES = exports.moderationDecisionStatusSchema = exports.MODERATION_DECISION_STATUSES = exports.moderationAttributionSchema = exports.MODERATION_ATTRIBUTIONS = exports.moderationFindingScopeSchema = exports.MODERATION_FINDING_SCOPES = exports.moderationSeveritySchema = exports.MODERATION_SEVERITIES = void 0;
|
|
4
|
+
const numberChecks_1 = require("./numberChecks");
|
|
5
|
+
const stringChecks_1 = require("./stringChecks");
|
|
2
6
|
/**
|
|
3
7
|
* Oxy Trust — the moderation reputation bridge (CrowdSource → Oxy Trust).
|
|
4
8
|
*
|
|
@@ -35,8 +39,6 @@
|
|
|
35
39
|
*
|
|
36
40
|
* Platform-agnostic — zod only. ESM-safe (no `require()`).
|
|
37
41
|
*/
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.applicationModerationTrustSchema = exports.reputationContextualInfluenceSchema = exports.reputationReviewingSchema = exports.reputationReportingSchema = exports.reputationConductSchema = exports.reputationContributionSchema = exports.reputationPersonhoodSchema = exports.identityBindingSchema = exports.registerIdentityBindingSchema = exports.reverseModerationEffectResultSchema = exports.applyModerationDecisionResultSchema = exports.moderationEffectSchema = exports.reverseModerationEffectSchema = exports.finalizeModerationDecisionSchema = exports.moderationDecisionEventSchema = exports.moderationPolicyVersionsSchema = exports.moderationDecisionEventSubjectSchema = exports.moderationFindingSchema = exports.moderationEffectSkipReasonSchema = exports.MODERATION_EFFECT_SKIP_REASONS = exports.applicationModerationStandingSchema = exports.APPLICATION_MODERATION_STANDINGS = exports.identityBindingStatusSchema = exports.IDENTITY_BINDING_STATUSES = exports.identityBindingTypeSchema = exports.IDENTITY_BINDING_TYPES = exports.personhoodStatusSchema = exports.PERSONHOOD_STATUSES = exports.contributionTierSchema = exports.CONTRIBUTION_TIERS = exports.conductStandingSchema = exports.CONDUCT_STANDINGS = exports.conductStrikeStatusSchema = exports.CONDUCT_STRIKE_STATUSES = exports.moderationEffectStatusSchema = exports.MODERATION_EFFECT_STATUSES = exports.moderationEffectTypeSchema = exports.MODERATION_EFFECT_TYPES = exports.moderationDecisionStatusSchema = exports.MODERATION_DECISION_STATUSES = exports.moderationAttributionSchema = exports.MODERATION_ATTRIBUTIONS = exports.moderationFindingScopeSchema = exports.MODERATION_FINDING_SCOPES = exports.moderationSeveritySchema = exports.MODERATION_SEVERITIES = void 0;
|
|
40
42
|
const zod_1 = require("zod");
|
|
41
43
|
/* -------------------------------------------------------------------------- */
|
|
42
44
|
/* Closed value sets */
|
|
@@ -170,45 +172,45 @@ exports.MODERATION_EFFECT_SKIP_REASONS = [
|
|
|
170
172
|
];
|
|
171
173
|
exports.moderationEffectSkipReasonSchema = zod_1.z.enum(exports.MODERATION_EFFECT_SKIP_REASONS);
|
|
172
174
|
exports.moderationFindingSchema = zod_1.z.object({
|
|
173
|
-
code: zod_1.z.string().trim().
|
|
175
|
+
code: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(200)),
|
|
174
176
|
severity: exports.moderationSeveritySchema,
|
|
175
177
|
scope: exports.moderationFindingScopeSchema,
|
|
176
178
|
attribution: exports.moderationAttributionSchema,
|
|
177
|
-
family: zod_1.z.string().trim().
|
|
179
|
+
family: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(100)),
|
|
178
180
|
});
|
|
179
181
|
exports.moderationDecisionEventSubjectSchema = zod_1.z.object({
|
|
180
182
|
principalType: zod_1.z.literal('oxy_user'),
|
|
181
|
-
principalId: zod_1.z.string().trim().
|
|
182
|
-
bindingProofId: zod_1.z.string().trim().
|
|
183
|
+
principalId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
184
|
+
bindingProofId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
183
185
|
});
|
|
184
186
|
exports.moderationPolicyVersionsSchema = zod_1.z.object({
|
|
185
|
-
universal: zod_1.z.string().trim().
|
|
186
|
-
application: zod_1.z.string().trim().
|
|
187
|
-
oxyConduct: zod_1.z.string().trim().
|
|
187
|
+
universal: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(100)),
|
|
188
|
+
application: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(100)),
|
|
189
|
+
oxyConduct: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(100)),
|
|
188
190
|
});
|
|
189
191
|
exports.moderationDecisionEventSchema = zod_1.z.object({
|
|
190
|
-
eventId: zod_1.z.string().trim().
|
|
191
|
-
reportedApplicationId: zod_1.z.string().trim().
|
|
192
|
-
type: zod_1.z.string().trim().
|
|
193
|
-
caseId: zod_1.z.string().trim().
|
|
194
|
-
incidentId: zod_1.z.string().trim().
|
|
195
|
-
decisionId: zod_1.z.string().trim().
|
|
196
|
-
decisionRevision: zod_1.z.number().
|
|
192
|
+
eventId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(200)),
|
|
193
|
+
reportedApplicationId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(200)),
|
|
194
|
+
type: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(200)),
|
|
195
|
+
caseId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(200)),
|
|
196
|
+
incidentId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(200)),
|
|
197
|
+
decisionId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(200)),
|
|
198
|
+
decisionRevision: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).min(1),
|
|
197
199
|
subject: exports.moderationDecisionEventSubjectSchema,
|
|
198
200
|
findings: zod_1.z.array(exports.moderationFindingSchema).min(1).max(20),
|
|
199
201
|
decisionStatus: exports.moderationDecisionStatusSchema,
|
|
200
202
|
policyVersions: exports.moderationPolicyVersionsSchema,
|
|
201
|
-
occurredAt: zod_1.z.string().trim().
|
|
202
|
-
proofHash: zod_1.z.string().trim().
|
|
203
|
+
occurredAt: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
204
|
+
proofHash: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(200)),
|
|
203
205
|
});
|
|
204
206
|
exports.finalizeModerationDecisionSchema = zod_1.z.object({
|
|
205
|
-
decisionId: zod_1.z.string().trim().
|
|
206
|
-
decisionRevision: zod_1.z.number().
|
|
207
|
+
decisionId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(200)),
|
|
208
|
+
decisionRevision: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).min(1),
|
|
207
209
|
});
|
|
208
210
|
exports.reverseModerationEffectSchema = zod_1.z.object({
|
|
209
|
-
decisionId: zod_1.z.string().trim().
|
|
210
|
-
decisionRevision: zod_1.z.number().
|
|
211
|
-
reason: zod_1.z.string().trim().
|
|
211
|
+
decisionId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(200)),
|
|
212
|
+
decisionRevision: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).min(1),
|
|
213
|
+
reason: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(500)),
|
|
212
214
|
});
|
|
213
215
|
exports.moderationEffectSchema = zod_1.z.object({
|
|
214
216
|
id: zod_1.z.string(),
|
|
@@ -243,8 +245,8 @@ exports.reverseModerationEffectResultSchema = zod_1.z.object({
|
|
|
243
245
|
idempotent: zod_1.z.boolean(),
|
|
244
246
|
});
|
|
245
247
|
exports.registerIdentityBindingSchema = zod_1.z.object({
|
|
246
|
-
localPrincipalId: zod_1.z.string().trim().
|
|
247
|
-
userProofToken: zod_1.z.string().trim().
|
|
248
|
+
localPrincipalId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(200)),
|
|
249
|
+
userProofToken: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
248
250
|
});
|
|
249
251
|
exports.identityBindingSchema = zod_1.z.object({
|
|
250
252
|
id: zod_1.z.string(),
|
|
@@ -279,8 +281,8 @@ exports.reputationReportingSchema = zod_1.z.object({
|
|
|
279
281
|
});
|
|
280
282
|
exports.reputationReviewingSchema = zod_1.z.object({
|
|
281
283
|
globalReliability: zod_1.z.number(),
|
|
282
|
-
categoryReliability: zod_1.z.record(zod_1.z.number()),
|
|
283
|
-
languageReliability: zod_1.z.record(zod_1.z.number()),
|
|
284
|
+
categoryReliability: zod_1.z.record(zod_1.z.string(), zod_1.z.number()),
|
|
285
|
+
languageReliability: zod_1.z.record(zod_1.z.string(), zod_1.z.number()),
|
|
284
286
|
});
|
|
285
287
|
exports.reputationContextualInfluenceSchema = zod_1.z.object({
|
|
286
288
|
reportPriorityWeight: zod_1.z.number(),
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.oxySystemNotificationPushDataSchema = exports.OXY_SYSTEM_NOTIFICATION_PUSH_TYPE = exports.OXY_ACCOUNT_PUSH_CHANNEL = exports.createOxyNotificationRequestSchema = exports.OXY_NOTIFICATION_URL_MAX = exports.OXY_SYSTEM_NOTIFICATION_MESSAGE_MAX = exports.OXY_SYSTEM_NOTIFICATION_TITLE_MAX = exports.OXY_NOTIFICATION_ENTITY_TYPES = exports.OXY_NOTIFICATION_TYPES = void 0;
|
|
4
|
+
const stringChecks_1 = require("./stringChecks");
|
|
2
5
|
/**
|
|
3
6
|
* The closed set of Oxy in-app notification types — owned here so the API's
|
|
4
7
|
* CHECK constraint (`notifications.type`), its request validation and the SDK
|
|
@@ -11,8 +14,6 @@
|
|
|
11
14
|
*
|
|
12
15
|
* Platform-agnostic — zod only, no react/react-native/expo.
|
|
13
16
|
*/
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.oxySystemNotificationPushDataSchema = exports.OXY_SYSTEM_NOTIFICATION_PUSH_TYPE = exports.OXY_ACCOUNT_PUSH_CHANNEL = exports.createOxyNotificationRequestSchema = exports.OXY_NOTIFICATION_URL_MAX = exports.OXY_SYSTEM_NOTIFICATION_MESSAGE_MAX = exports.OXY_SYSTEM_NOTIFICATION_TITLE_MAX = exports.OXY_NOTIFICATION_ENTITY_TYPES = exports.OXY_NOTIFICATION_TYPES = void 0;
|
|
16
17
|
const zod_1 = require("zod");
|
|
17
18
|
exports.OXY_NOTIFICATION_TYPES = [
|
|
18
19
|
'like',
|
|
@@ -51,14 +52,29 @@ exports.OXY_NOTIFICATION_URL_MAX = 2048;
|
|
|
51
52
|
*/
|
|
52
53
|
exports.createOxyNotificationRequestSchema = zod_1.z
|
|
53
54
|
.object({
|
|
54
|
-
recipientId: zod_1.z.string().
|
|
55
|
-
actorId: zod_1.z.string().
|
|
55
|
+
recipientId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
56
|
+
actorId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
56
57
|
type: zod_1.z.enum(exports.OXY_NOTIFICATION_TYPES),
|
|
57
|
-
entityId: zod_1.z.string().
|
|
58
|
+
entityId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
58
59
|
entityType: zod_1.z.enum(exports.OXY_NOTIFICATION_ENTITY_TYPES),
|
|
59
|
-
title: zod_1.z
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
title: zod_1.z
|
|
61
|
+
.string()
|
|
62
|
+
.trim()
|
|
63
|
+
.check((0, stringChecks_1.utf16MinLength)(1))
|
|
64
|
+
.check((0, stringChecks_1.utf16MaxLength)(exports.OXY_SYSTEM_NOTIFICATION_TITLE_MAX))
|
|
65
|
+
.optional(),
|
|
66
|
+
message: zod_1.z
|
|
67
|
+
.string()
|
|
68
|
+
.trim()
|
|
69
|
+
.check((0, stringChecks_1.utf16MinLength)(1))
|
|
70
|
+
.check((0, stringChecks_1.utf16MaxLength)(exports.OXY_SYSTEM_NOTIFICATION_MESSAGE_MAX))
|
|
71
|
+
.optional(),
|
|
72
|
+
url: zod_1.z
|
|
73
|
+
.string()
|
|
74
|
+
.trim()
|
|
75
|
+
.check((0, stringChecks_1.utf16MinLength)(1))
|
|
76
|
+
.check((0, stringChecks_1.utf16MaxLength)(exports.OXY_NOTIFICATION_URL_MAX))
|
|
77
|
+
.optional(),
|
|
62
78
|
data: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
63
79
|
})
|
|
64
80
|
.superRefine((value, context) => {
|
|
@@ -116,5 +132,5 @@ exports.OXY_SYSTEM_NOTIFICATION_PUSH_TYPE = 'oxy_system_notification';
|
|
|
116
132
|
*/
|
|
117
133
|
exports.oxySystemNotificationPushDataSchema = zod_1.z.object({
|
|
118
134
|
type: zod_1.z.literal(exports.OXY_SYSTEM_NOTIFICATION_PUSH_TYPE),
|
|
119
|
-
notificationId: zod_1.z.string().
|
|
135
|
+
notificationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
|
|
120
136
|
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.integerCheck = integerCheck;
|
|
4
|
+
exports.safeNumberCheck = safeNumberCheck;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
/** Integer validation does not add a safe-number ceiling unless the contract requests one. */
|
|
7
|
+
function integerCheck(message) {
|
|
8
|
+
const check = zod_1.z.check((context) => {
|
|
9
|
+
if (Number.isInteger(context.value))
|
|
10
|
+
return;
|
|
11
|
+
context.issues.push({
|
|
12
|
+
code: 'invalid_type',
|
|
13
|
+
expected: 'int',
|
|
14
|
+
input: context.value,
|
|
15
|
+
continue: true,
|
|
16
|
+
...(message ? { message: typeof message === 'string' ? message : message.message } : {}),
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
check._zod.onattach.push((schema) => {
|
|
20
|
+
schema._zod.bag.format = 'integer';
|
|
21
|
+
});
|
|
22
|
+
return check;
|
|
23
|
+
}
|
|
24
|
+
/** Existing `.safe()` contracts bound a number independently of integer validation. */
|
|
25
|
+
function safeNumberCheck(message) {
|
|
26
|
+
const check = zod_1.z.check((context) => {
|
|
27
|
+
const common = {
|
|
28
|
+
origin: 'number',
|
|
29
|
+
input: context.value,
|
|
30
|
+
inclusive: true,
|
|
31
|
+
continue: true,
|
|
32
|
+
...(message ? { message: typeof message === 'string' ? message : message.message } : {}),
|
|
33
|
+
};
|
|
34
|
+
if (context.value < Number.MIN_SAFE_INTEGER)
|
|
35
|
+
context.issues.push({ ...common, code: 'too_small', minimum: Number.MIN_SAFE_INTEGER });
|
|
36
|
+
if (context.value > Number.MAX_SAFE_INTEGER)
|
|
37
|
+
context.issues.push({ ...common, code: 'too_big', maximum: Number.MAX_SAFE_INTEGER });
|
|
38
|
+
});
|
|
39
|
+
check._zod.onattach.push((schema) => {
|
|
40
|
+
const bag = schema._zod.bag;
|
|
41
|
+
bag.minimum = Math.max(typeof bag.minimum === 'number' ? bag.minimum : -Infinity, Number.MIN_SAFE_INTEGER);
|
|
42
|
+
bag.maximum = Math.min(typeof bag.maximum === 'number' ? bag.maximum : Infinity, Number.MAX_SAFE_INTEGER);
|
|
43
|
+
});
|
|
44
|
+
return check;
|
|
45
|
+
}
|