@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
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.utf16MinLength = utf16MinLength;
|
|
4
|
+
exports.utf16MaxLength = utf16MaxLength;
|
|
5
|
+
exports.utf16Length = utf16Length;
|
|
6
|
+
exports.isoDateTime = isoDateTime;
|
|
7
|
+
exports.urlCheck = urlCheck;
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
/**
|
|
10
|
+
* Oxy text limits count UTF-16 units. Each factory owns its check and retains
|
|
11
|
+
* native metadata for standard JSON Schema and OpenAPI consumers.
|
|
12
|
+
*/
|
|
13
|
+
function stringLengthCheck(kind, value, message) {
|
|
14
|
+
const check = kind === 'min'
|
|
15
|
+
? zod_1.z.minLength(value, message)
|
|
16
|
+
: kind === 'max'
|
|
17
|
+
? zod_1.z.maxLength(value, message)
|
|
18
|
+
: zod_1.z.length(value, message);
|
|
19
|
+
check._zod.check = (context) => {
|
|
20
|
+
const length = context.value.length;
|
|
21
|
+
const tooSmall = kind !== 'max' && length < value;
|
|
22
|
+
const tooBig = kind !== 'min' && length > value;
|
|
23
|
+
if (!tooSmall && !tooBig)
|
|
24
|
+
return;
|
|
25
|
+
context.issues.push({
|
|
26
|
+
origin: 'string',
|
|
27
|
+
...(tooSmall
|
|
28
|
+
? { code: 'too_small', minimum: value }
|
|
29
|
+
: { code: 'too_big', maximum: value }),
|
|
30
|
+
inclusive: true,
|
|
31
|
+
...(kind === 'length' ? { exact: true } : {}),
|
|
32
|
+
input: context.value,
|
|
33
|
+
inst: check,
|
|
34
|
+
continue: true,
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
return check;
|
|
38
|
+
}
|
|
39
|
+
function utf16MinLength(minimum, message) {
|
|
40
|
+
return stringLengthCheck('min', minimum, message);
|
|
41
|
+
}
|
|
42
|
+
function utf16MaxLength(maximum, message) {
|
|
43
|
+
return stringLengthCheck('max', maximum, message);
|
|
44
|
+
}
|
|
45
|
+
function utf16Length(length, message) {
|
|
46
|
+
return stringLengthCheck('length', length, message);
|
|
47
|
+
}
|
|
48
|
+
/** Oxy timestamps retain optional seconds, fractional precision and existing offset syntax. */
|
|
49
|
+
function isoDateTime(options = {}) {
|
|
50
|
+
const params = typeof options === 'string' ? { message: options } : options;
|
|
51
|
+
const precision = params.precision;
|
|
52
|
+
const date = zod_1.z.regexes.date.source.slice(1, -1);
|
|
53
|
+
const fraction = precision ? `\\.\\d{${precision}}` : precision == null ? '(\\.\\d+)?' : '';
|
|
54
|
+
const seconds = `(:[0-5]\\d${fraction})${precision ? '+' : '?'}`;
|
|
55
|
+
const zone = `${params.local ? 'Z?' : 'Z'}${params.offset ? '|[+-]\\d{2}:?\\d{2}' : ''}`;
|
|
56
|
+
const expression = new RegExp(`^${date}T([01]\\d|2[0-3]):[0-5]\\d${seconds}(${zone})$`);
|
|
57
|
+
return zod_1.z.stringFormat('datetime', expression, params);
|
|
58
|
+
}
|
|
59
|
+
/** Validate a URL without normalizing the value returned by the API contract. */
|
|
60
|
+
function urlCheck(message) {
|
|
61
|
+
return zod_1.z.stringFormat('url', (value) => {
|
|
62
|
+
try {
|
|
63
|
+
new URL(value);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}, message);
|
|
70
|
+
}
|
package/dist/cjs/transparency.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transparencyCheckpointListSchema = exports.transparencyInclusionProofSchema = exports.transparencyCheckpointSchema = exports.transparencyAnchorSchema = exports.transparencyCheckpointSignatureSchema = void 0;
|
|
4
|
+
const numberChecks_1 = require("./numberChecks");
|
|
5
|
+
const stringChecks_1 = require("./stringChecks");
|
|
4
6
|
const zod_1 = require("zod");
|
|
5
7
|
/**
|
|
6
8
|
* Transparency log — the public wire contract of the checkpoint surface.
|
|
@@ -34,19 +36,19 @@ const hexDigestSchema = zod_1.z
|
|
|
34
36
|
*/
|
|
35
37
|
exports.transparencyCheckpointSignatureSchema = zod_1.z.object({
|
|
36
38
|
/** Uncompressed hex public key of the signer. */
|
|
37
|
-
publicKey: zod_1.z.string().
|
|
39
|
+
publicKey: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
38
40
|
alg: zod_1.z.literal('ES256K-DER-SHA256'),
|
|
39
41
|
/** DER-encoded hex secp256k1 signature over the checkpoint signing input. */
|
|
40
|
-
signature: zod_1.z.string().
|
|
42
|
+
signature: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
41
43
|
});
|
|
42
44
|
/** Where a checkpoint root was published on a public chain. */
|
|
43
45
|
exports.transparencyAnchorSchema = zod_1.z.object({
|
|
44
46
|
/** Chain/network identifier, e.g. `faircoin-main`. */
|
|
45
|
-
network: zod_1.z.string().
|
|
46
|
-
txid: zod_1.z.string().
|
|
47
|
-
confirmations: zod_1.z.number().
|
|
47
|
+
network: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
48
|
+
txid: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
49
|
+
confirmations: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
|
|
48
50
|
/** When the anchoring transaction was broadcast (ms epoch). */
|
|
49
|
-
anchoredAt: zod_1.z.number().
|
|
51
|
+
anchoredAt: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
|
|
50
52
|
});
|
|
51
53
|
/**
|
|
52
54
|
* A published checkpoint.
|
|
@@ -57,11 +59,11 @@ exports.transparencyAnchorSchema = zod_1.z.object({
|
|
|
57
59
|
* normal, temporary state rather than an error.
|
|
58
60
|
*/
|
|
59
61
|
exports.transparencyCheckpointSchema = zod_1.z.object({
|
|
60
|
-
index: zod_1.z.number().
|
|
62
|
+
index: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
|
|
61
63
|
/** End of the committed period (ms epoch). */
|
|
62
|
-
periodEnd: zod_1.z.number().
|
|
64
|
+
periodEnd: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
|
|
63
65
|
/** Number of subjects (leaves) committed. */
|
|
64
|
-
treeSize: zod_1.z.number().
|
|
66
|
+
treeSize: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
|
|
65
67
|
root: hexDigestSchema,
|
|
66
68
|
/** Hash of the previous checkpoint; `null` only at genesis. */
|
|
67
69
|
prevCheckpointHash: hexDigestSchema.nullable(),
|
|
@@ -77,11 +79,11 @@ exports.transparencyCheckpointSchema = zod_1.z.object({
|
|
|
77
79
|
*/
|
|
78
80
|
exports.transparencyInclusionProofSchema = zod_1.z.object({
|
|
79
81
|
checkpoint: exports.transparencyCheckpointSchema,
|
|
80
|
-
subjectDid: zod_1.z.string().
|
|
81
|
-
seq: zod_1.z.number().
|
|
82
|
+
subjectDid: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
83
|
+
seq: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
|
|
82
84
|
headRecordId: hexDigestSchema,
|
|
83
85
|
leaf: hexDigestSchema,
|
|
84
|
-
leafIndex: zod_1.z.number().
|
|
86
|
+
leafIndex: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
|
|
85
87
|
/** Audit path, leaf-adjacent sibling first; empty for a single-leaf tree. */
|
|
86
88
|
proof: zod_1.z.array(hexDigestSchema),
|
|
87
89
|
});
|
package/dist/cjs/updates.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateRolloutPatchSchema = exports.promoteRequestSchema = exports.rollbackToEmbeddedRequestSchema = exports.rollbackRequestSchema = exports.updateListResponseSchema = exports.channelListResponseSchema = exports.channelSchema = exports.rollbackToEmbeddedEntrySchema = exports.createUpdateResponseSchema = exports.updateSchema = exports.createUpdateRequestSchema = exports.updateAssetRefSchema = exports.assetCompleteResponseSchema = exports.assetCompleteResultItemSchema = exports.assetCompleteRequestSchema = exports.assetInitResponseSchema = exports.assetUploadTicketSchema = exports.assetInitRequestSchema = exports.assetInitItemSchema = exports.rolloutPercentSchema = exports.runtimeVersionSchema = exports.channelNameSchema = exports.sha256HexSchema = exports.updateAssetStatusSchema = exports.updateStatusSchema = exports.updatePlatformSchema = void 0;
|
|
4
|
+
const numberChecks_1 = require("./numberChecks");
|
|
5
|
+
const stringChecks_1 = require("./stringChecks");
|
|
2
6
|
/**
|
|
3
7
|
* Oxy Updates (self-hosted expo-updates protocol) — publish/admin API contracts.
|
|
4
8
|
*
|
|
@@ -24,8 +28,6 @@
|
|
|
24
28
|
* Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
|
|
25
29
|
* `require()`).
|
|
26
30
|
*/
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.updateRolloutPatchSchema = exports.promoteRequestSchema = exports.rollbackToEmbeddedRequestSchema = exports.rollbackRequestSchema = exports.updateListResponseSchema = exports.channelListResponseSchema = exports.channelSchema = exports.rollbackToEmbeddedEntrySchema = exports.createUpdateResponseSchema = exports.updateSchema = exports.createUpdateRequestSchema = exports.updateAssetRefSchema = exports.assetCompleteResponseSchema = exports.assetCompleteResultItemSchema = exports.assetCompleteRequestSchema = exports.assetInitResponseSchema = exports.assetUploadTicketSchema = exports.assetInitRequestSchema = exports.assetInitItemSchema = exports.rolloutPercentSchema = exports.runtimeVersionSchema = exports.channelNameSchema = exports.sha256HexSchema = exports.updateAssetStatusSchema = exports.updateStatusSchema = exports.updatePlatformSchema = void 0;
|
|
29
31
|
const zod_1 = require("zod");
|
|
30
32
|
/* -------------------------------------------------------------------------- */
|
|
31
33
|
/* Shared primitives */
|
|
@@ -47,13 +49,13 @@ exports.sha256HexSchema = zod_1.z
|
|
|
47
49
|
*/
|
|
48
50
|
exports.channelNameSchema = zod_1.z
|
|
49
51
|
.string()
|
|
50
|
-
.
|
|
51
|
-
.
|
|
52
|
+
.check((0, stringChecks_1.utf16MinLength)(1))
|
|
53
|
+
.check((0, stringChecks_1.utf16MaxLength)(100))
|
|
52
54
|
.regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/, 'channel name must be a URL-safe slug');
|
|
53
55
|
/** A runtime version string (expo-updates `runtimeVersion`, e.g. an appVersion). */
|
|
54
|
-
exports.runtimeVersionSchema = zod_1.z.string().
|
|
56
|
+
exports.runtimeVersionSchema = zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(255));
|
|
55
57
|
/** A rollout percentage: 0 rolls out to nobody, 100 to everybody. */
|
|
56
|
-
exports.rolloutPercentSchema = zod_1.z.number().
|
|
58
|
+
exports.rolloutPercentSchema = zod_1.z.number().check((0, numberChecks_1.integerCheck)()).min(0).max(100);
|
|
57
59
|
/* -------------------------------------------------------------------------- */
|
|
58
60
|
/* Assets: init + complete */
|
|
59
61
|
/* -------------------------------------------------------------------------- */
|
|
@@ -64,8 +66,8 @@ exports.rolloutPercentSchema = zod_1.z.number().int().min(0).max(100);
|
|
|
64
66
|
*/
|
|
65
67
|
exports.assetInitItemSchema = zod_1.z.object({
|
|
66
68
|
sha256: exports.sha256HexSchema,
|
|
67
|
-
contentType: zod_1.z.string().
|
|
68
|
-
size: zod_1.z.number().
|
|
69
|
+
contentType: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(255)),
|
|
70
|
+
size: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
|
|
69
71
|
});
|
|
70
72
|
/**
|
|
71
73
|
* `POST /updates/v1/assets/init` request. Declares the full asset set of an
|
|
@@ -73,7 +75,7 @@ exports.assetInitItemSchema = zod_1.z.object({
|
|
|
73
75
|
* already hold (content-addressed dedup — unchanged assets are never re-uploaded).
|
|
74
76
|
*/
|
|
75
77
|
exports.assetInitRequestSchema = zod_1.z.object({
|
|
76
|
-
applicationId: zod_1.z.string().
|
|
78
|
+
applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
77
79
|
assets: zod_1.z.array(exports.assetInitItemSchema).min(1).max(2000),
|
|
78
80
|
});
|
|
79
81
|
/** One presigned upload the client must PUT its bytes to before completing. */
|
|
@@ -109,14 +111,14 @@ exports.assetInitResponseSchema = zod_1.z.object({
|
|
|
109
111
|
* `uploaded`; an object that is absent or size-mismatched is rejected.
|
|
110
112
|
*/
|
|
111
113
|
exports.assetCompleteRequestSchema = zod_1.z.object({
|
|
112
|
-
applicationId: zod_1.z.string().
|
|
114
|
+
applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
113
115
|
sha256s: zod_1.z.array(exports.sha256HexSchema).min(1).max(2000),
|
|
114
116
|
});
|
|
115
117
|
/** Per-asset verification outcome from `assets/complete`. */
|
|
116
118
|
exports.assetCompleteResultItemSchema = zod_1.z.object({
|
|
117
119
|
sha256: exports.sha256HexSchema,
|
|
118
120
|
status: exports.updateAssetStatusSchema,
|
|
119
|
-
size: zod_1.z.number().
|
|
121
|
+
size: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
|
|
120
122
|
});
|
|
121
123
|
exports.assetCompleteResponseSchema = zod_1.z.object({
|
|
122
124
|
assets: zod_1.z.array(exports.assetCompleteResultItemSchema),
|
|
@@ -132,8 +134,8 @@ exports.assetCompleteResponseSchema = zod_1.z.object({
|
|
|
132
134
|
exports.updateAssetRefSchema = zod_1.z.object({
|
|
133
135
|
sha256: exports.sha256HexSchema,
|
|
134
136
|
/** expo-export asset key (md5 basename) — how app code references the asset. */
|
|
135
|
-
key: zod_1.z.string().
|
|
136
|
-
contentType: zod_1.z.string().
|
|
137
|
+
key: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
138
|
+
contentType: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
137
139
|
/** Suggested file extension including the leading dot (e.g. `.js`, `.png`). */
|
|
138
140
|
fileExtension: zod_1.z.string().optional(),
|
|
139
141
|
});
|
|
@@ -144,7 +146,7 @@ exports.updateAssetRefSchema = zod_1.z.object({
|
|
|
144
146
|
* MUST carry `expoClient` so `Constants.expoConfig` works after an OTA update.
|
|
145
147
|
*/
|
|
146
148
|
exports.createUpdateRequestSchema = zod_1.z.object({
|
|
147
|
-
applicationId: zod_1.z.string().
|
|
149
|
+
applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
148
150
|
channel: exports.channelNameSchema,
|
|
149
151
|
runtimeVersion: exports.runtimeVersionSchema,
|
|
150
152
|
platform: exports.updatePlatformSchema,
|
|
@@ -162,11 +164,11 @@ exports.createUpdateRequestSchema = zod_1.z.object({
|
|
|
162
164
|
/** Initial rollout percentage (default 100 — full rollout). */
|
|
163
165
|
rolloutPercent: exports.rolloutPercentSchema.optional(),
|
|
164
166
|
/** Git commit the bundle was built from (audit / console display). */
|
|
165
|
-
gitCommit: zod_1.z.string().
|
|
167
|
+
gitCommit: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(100)).optional(),
|
|
166
168
|
/** Git branch the bundle was built from (audit / console display). */
|
|
167
|
-
gitBranch: zod_1.z.string().
|
|
169
|
+
gitBranch: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(200)).optional(),
|
|
168
170
|
/** Human-readable publish message (console display). */
|
|
169
|
-
message: zod_1.z.string().
|
|
171
|
+
message: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(500)).optional(),
|
|
170
172
|
});
|
|
171
173
|
exports.updateSchema = zod_1.z.object({
|
|
172
174
|
id: zod_1.z.string(),
|
|
@@ -216,7 +218,7 @@ exports.updateListResponseSchema = zod_1.z.object({
|
|
|
216
218
|
* update (if any) becomes head again. Nothing is deleted.
|
|
217
219
|
*/
|
|
218
220
|
exports.rollbackRequestSchema = zod_1.z.object({
|
|
219
|
-
applicationId: zod_1.z.string().
|
|
221
|
+
applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
220
222
|
runtimeVersion: exports.runtimeVersionSchema,
|
|
221
223
|
platform: exports.updatePlatformSchema,
|
|
222
224
|
});
|
|
@@ -226,7 +228,7 @@ exports.rollbackRequestSchema = zod_1.z.object({
|
|
|
226
228
|
* fall back to the update embedded in their binary.
|
|
227
229
|
*/
|
|
228
230
|
exports.rollbackToEmbeddedRequestSchema = zod_1.z.object({
|
|
229
|
-
applicationId: zod_1.z.string().
|
|
231
|
+
applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
230
232
|
runtimeVersion: exports.runtimeVersionSchema,
|
|
231
233
|
platform: exports.updatePlatformSchema,
|
|
232
234
|
});
|
|
@@ -236,8 +238,8 @@ exports.rollbackToEmbeddedRequestSchema = zod_1.z.object({
|
|
|
236
238
|
* UUID) pointing at the SAME assets. `toChannel` defaults to the path channel.
|
|
237
239
|
*/
|
|
238
240
|
exports.promoteRequestSchema = zod_1.z.object({
|
|
239
|
-
applicationId: zod_1.z.string().
|
|
240
|
-
updateId: zod_1.z.string().
|
|
241
|
+
applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
242
|
+
updateId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
241
243
|
/** Target channel to promote into. Defaults to the path `:channel`. */
|
|
242
244
|
toChannel: exports.channelNameSchema.optional(),
|
|
243
245
|
/** Rollout percentage for the promoted update (default 100). */
|
|
@@ -245,6 +247,6 @@ exports.promoteRequestSchema = zod_1.z.object({
|
|
|
245
247
|
});
|
|
246
248
|
/** `PATCH /updates/v1/updates/:updateId` request — adjust a rollout in place. */
|
|
247
249
|
exports.updateRolloutPatchSchema = zod_1.z.object({
|
|
248
|
-
applicationId: zod_1.z.string().
|
|
250
|
+
applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
249
251
|
rolloutPercent: exports.rolloutPercentSchema,
|
|
250
252
|
});
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.oxyUserInvalidationEventSchema = exports.OXY_PUBLISHED_USER_CHANGE_REASONS = exports.OXY_USER_CHANGE_REASONS = exports.OXY_USER_INVALIDATION_CHANNEL = void 0;
|
|
4
|
+
exports.isPublishedOxyUserChangeReason = isPublishedOxyUserChangeReason;
|
|
5
|
+
const numberChecks_1 = require("./numberChecks");
|
|
6
|
+
const stringChecks_1 = require("./stringChecks");
|
|
2
7
|
/**
|
|
3
8
|
* Canonical contract for the Oxy user-invalidation broadcast.
|
|
4
9
|
*
|
|
@@ -31,9 +36,6 @@
|
|
|
31
36
|
*
|
|
32
37
|
* Platform-agnostic — zod only, no react/react-native/expo.
|
|
33
38
|
*/
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.oxyUserInvalidationEventSchema = exports.OXY_PUBLISHED_USER_CHANGE_REASONS = exports.OXY_USER_CHANGE_REASONS = exports.OXY_USER_INVALIDATION_CHANNEL = void 0;
|
|
36
|
-
exports.isPublishedOxyUserChangeReason = isPublishedOxyUserChangeReason;
|
|
37
39
|
const zod_1 = require("zod");
|
|
38
40
|
/** Redis pub/sub channel carrying user-invalidation events. */
|
|
39
41
|
exports.OXY_USER_INVALIDATION_CHANNEL = 'oxy:user:invalidate';
|
|
@@ -81,9 +83,9 @@ function isPublishedOxyUserChangeReason(reason) {
|
|
|
81
83
|
*/
|
|
82
84
|
exports.oxyUserInvalidationEventSchema = zod_1.z.object({
|
|
83
85
|
/** The Oxy user whose record changed. */
|
|
84
|
-
userId: zod_1.z.string().
|
|
86
|
+
userId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
|
|
85
87
|
/** Why it changed. Only broadcast reasons appear on the wire. */
|
|
86
88
|
reason: zod_1.z.enum(exports.OXY_PUBLISHED_USER_CHANGE_REASONS),
|
|
87
89
|
/** Publisher's epoch-ms timestamp. Diagnostic only. */
|
|
88
|
-
at: zod_1.z.number().
|
|
90
|
+
at: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
|
|
89
91
|
});
|
package/dist/cjs/userResponse.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deviceLinkedSessionsResponseSchema = exports.deviceLinkedSessionSchema = exports.currentUserResponseSchema = exports.userProfileUpdateSchema = exports.userResponseSchema = exports.dateOfBirthSchema = exports.themePreferenceSchema = exports.userRelationshipSchema = exports.userNameSchema = void 0;
|
|
4
|
+
exports.resolveUserId = resolveUserId;
|
|
5
|
+
exports.safeParseContract = safeParseContract;
|
|
6
|
+
const stringChecks_1 = require("./stringChecks");
|
|
2
7
|
/**
|
|
3
8
|
* Canonical API user-response contracts.
|
|
4
9
|
*
|
|
@@ -29,10 +34,6 @@
|
|
|
29
34
|
* Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
|
|
30
35
|
* `require()`).
|
|
31
36
|
*/
|
|
32
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.deviceLinkedSessionsResponseSchema = exports.deviceLinkedSessionSchema = exports.currentUserResponseSchema = exports.userProfileUpdateSchema = exports.userResponseSchema = exports.dateOfBirthSchema = exports.themePreferenceSchema = exports.userRelationshipSchema = exports.userNameSchema = void 0;
|
|
34
|
-
exports.resolveUserId = resolveUserId;
|
|
35
|
-
exports.safeParseContract = safeParseContract;
|
|
36
37
|
const zod_1 = require("zod");
|
|
37
38
|
const identity_1 = require("./identity");
|
|
38
39
|
const accountGraph_1 = require("./accountGraph");
|
|
@@ -239,7 +240,7 @@ exports.userResponseSchema = zod_1.z
|
|
|
239
240
|
personalization: zod_1.z
|
|
240
241
|
.object({
|
|
241
242
|
mentionMono: zod_1.z
|
|
242
|
-
.object({ allowed: zod_1.z.boolean(), expiresAt: zod_1.z.string().
|
|
243
|
+
.object({ allowed: zod_1.z.boolean(), expiresAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()).nullable() })
|
|
243
244
|
.strict(),
|
|
244
245
|
})
|
|
245
246
|
.strict()
|
|
@@ -294,12 +295,12 @@ exports.userProfileUpdateSchema = zod_1.z
|
|
|
294
295
|
*/
|
|
295
296
|
languages: zod_1.z.array(zod_1.z.string()).optional(),
|
|
296
297
|
accountExpiresAfterInactivityDays: zod_1.z.number().nullable().optional(),
|
|
297
|
-
notificationPreferences: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
298
|
+
notificationPreferences: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
298
299
|
userPreferences: zod_1.z
|
|
299
300
|
.object({ displayCurrency: zod_1.z.enum(['USD', 'EUR', 'FAIR']).optional() })
|
|
300
301
|
.catchall(zod_1.z.unknown())
|
|
301
302
|
.optional(),
|
|
302
|
-
privacySettings: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
303
|
+
privacySettings: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
303
304
|
/**
|
|
304
305
|
* Portable theme preference. Written through the same `PUT /users/me`
|
|
305
306
|
* settings-update path as `languages`/`userPreferences`.
|
package/dist/cjs/username.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.botUsernameSchema = exports.usernameSchema = exports.applyBotUsernameSuffix = exports.BOT_USERNAME_INVALID_MESSAGE = exports.BOT_USERNAME_SUFFIX = exports.stripDisallowedUsernameCharacters = exports.USERNAME_PATTERN_SOURCE = exports.NUMERIC_USERNAME_MESSAGE = exports.RESERVED_USERNAME_MESSAGE = exports.RESERVED_USERNAMES = exports.USERNAME_INVALID_MESSAGE = exports.USERNAME_MAX_LENGTH = exports.USERNAME_MIN_LENGTH = void 0;
|
|
4
|
+
exports.isValidUsername = isValidUsername;
|
|
5
|
+
exports.usernameSchemaForAccountKind = usernameSchemaForAccountKind;
|
|
6
|
+
const stringChecks_1 = require("./stringChecks");
|
|
2
7
|
/**
|
|
3
8
|
* Username policy — the ONE rule, for every kind of account.
|
|
4
9
|
*
|
|
@@ -99,10 +104,6 @@
|
|
|
99
104
|
* back as a 409 for the client to retry with a fresh suggestion. Nothing here
|
|
100
105
|
* knows what is taken, and it must not pretend to.
|
|
101
106
|
*/
|
|
102
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
103
|
-
exports.botUsernameSchema = exports.usernameSchema = exports.applyBotUsernameSuffix = exports.BOT_USERNAME_INVALID_MESSAGE = exports.BOT_USERNAME_SUFFIX = exports.stripDisallowedUsernameCharacters = exports.USERNAME_PATTERN_SOURCE = exports.NUMERIC_USERNAME_MESSAGE = exports.RESERVED_USERNAME_MESSAGE = exports.RESERVED_USERNAMES = exports.USERNAME_INVALID_MESSAGE = exports.USERNAME_MAX_LENGTH = exports.USERNAME_MIN_LENGTH = void 0;
|
|
104
|
-
exports.isValidUsername = isValidUsername;
|
|
105
|
-
exports.usernameSchemaForAccountKind = usernameSchemaForAccountKind;
|
|
106
107
|
const zod_1 = require("zod");
|
|
107
108
|
// The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
|
|
108
109
|
// it is re-exported here so the root entry is unchanged.
|
|
@@ -131,8 +132,8 @@ Object.defineProperty(exports, "applyBotUsernameSuffix", { enumerable: true, get
|
|
|
131
132
|
exports.usernameSchema = zod_1.z
|
|
132
133
|
.string()
|
|
133
134
|
.trim()
|
|
134
|
-
.
|
|
135
|
-
.
|
|
135
|
+
.check((0, stringChecks_1.utf16MinLength)(username_1.USERNAME_MIN_LENGTH, username_1.USERNAME_INVALID_MESSAGE))
|
|
136
|
+
.check((0, stringChecks_1.utf16MaxLength)(username_1.USERNAME_MAX_LENGTH, username_1.USERNAME_INVALID_MESSAGE))
|
|
136
137
|
.regex(username_1.USERNAME_PATTERN, username_1.USERNAME_INVALID_MESSAGE)
|
|
137
138
|
.refine((username) => !/^[0-9]+$/.test(username), username_1.NUMERIC_USERNAME_MESSAGE)
|
|
138
139
|
.refine((username) => !username_1.RESERVED_USERNAMES.has(username.toLowerCase()), username_1.RESERVED_USERNAME_MESSAGE)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { utf16MinLength } from './stringChecks.js';
|
|
1
2
|
/**
|
|
2
3
|
* Wire contract for `GET /internal/accounts/:accountId/access/:userId`: Oxy
|
|
3
4
|
* answers a trusted first-party service's question "may this person act FOR
|
|
@@ -49,15 +50,15 @@ export const accountAccessSourceSchema = z.enum(ACCOUNT_ACCESS_SOURCES);
|
|
|
49
50
|
* revokes), never on `role`.
|
|
50
51
|
*/
|
|
51
52
|
export const accountAccessGrantSchema = z.object({
|
|
52
|
-
role: z.string().
|
|
53
|
-
permissions: z.array(z.string().
|
|
53
|
+
role: z.string().check(utf16MinLength(1)),
|
|
54
|
+
permissions: z.array(z.string().check(utf16MinLength(1))),
|
|
54
55
|
/** Only an active membership grants access, so this is the one value. */
|
|
55
56
|
status: z.literal('active'),
|
|
56
57
|
source: accountAccessSourceSchema,
|
|
57
58
|
});
|
|
58
59
|
export const accountAccessVerdictSchema = z
|
|
59
60
|
.object({
|
|
60
|
-
accountId: z.string().
|
|
61
|
+
accountId: z.string().check(utf16MinLength(1)),
|
|
61
62
|
/** `null` when no such account exists. */
|
|
62
63
|
kind: accountKindSchema.nullable(),
|
|
63
64
|
/** `null` means: this person may not act for this account. */
|
package/dist/esm/accountEmail.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { integerCheck } from './numberChecks.js';
|
|
2
|
+
import { utf16MaxLength, utf16MinLength } from './stringChecks.js';
|
|
1
3
|
/**
|
|
2
4
|
* Email codes and tickets (ADR 0030).
|
|
3
5
|
*
|
|
@@ -18,7 +20,13 @@ import { z } from 'zod';
|
|
|
18
20
|
import { EMAIL_CODE_LENGTH } from './client/accountEmail.js';
|
|
19
21
|
export { EMAIL_VERIFICATION_PURPOSES, EMAIL_CODE_LENGTH, EMAIL_CODE_TTL_MS, EMAIL_CODE_MAX_ATTEMPTS, EMAIL_TICKET_TTL_MS, EMAIL_VERIFICATION_ERROR_CODES, } from './client/accountEmail.js';
|
|
20
22
|
/** An email address as the API stores it: trimmed and lowercase. */
|
|
21
|
-
export const emailAddressSchema = z
|
|
23
|
+
export const emailAddressSchema = z
|
|
24
|
+
.string()
|
|
25
|
+
.trim()
|
|
26
|
+
.toLowerCase()
|
|
27
|
+
.check(utf16MinLength(3))
|
|
28
|
+
.check(utf16MaxLength(254))
|
|
29
|
+
.email();
|
|
22
30
|
/** An opaque one-use ticket (32 random bytes, base64url). */
|
|
23
31
|
export const emailTicketSchema = z
|
|
24
32
|
.string()
|
|
@@ -29,13 +37,13 @@ export const emailVerificationStartRequestSchema = z
|
|
|
29
37
|
.object({ purpose: z.literal('signup'), email: emailAddressSchema })
|
|
30
38
|
.strict();
|
|
31
39
|
export const emailVerificationStartResponseSchema = z.object({
|
|
32
|
-
verificationId: z.string().
|
|
33
|
-
expiresAt: z.number().
|
|
40
|
+
verificationId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(64)),
|
|
41
|
+
expiresAt: z.number().check(integerCheck()).positive(),
|
|
34
42
|
});
|
|
35
43
|
/** `POST /auth/email/verify/confirm` */
|
|
36
44
|
export const emailVerificationConfirmRequestSchema = z
|
|
37
45
|
.object({
|
|
38
|
-
verificationId: z.string().trim().
|
|
46
|
+
verificationId: z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(64)),
|
|
39
47
|
code: z
|
|
40
48
|
.string()
|
|
41
49
|
.trim()
|
|
@@ -44,5 +52,5 @@ export const emailVerificationConfirmRequestSchema = z
|
|
|
44
52
|
.strict();
|
|
45
53
|
export const emailVerificationConfirmResponseSchema = z.object({
|
|
46
54
|
ticket: emailTicketSchema,
|
|
47
|
-
expiresAt: z.number().
|
|
55
|
+
expiresAt: z.number().check(integerCheck()).positive(),
|
|
48
56
|
});
|
package/dist/esm/accountGraph.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { utf16MaxLength, utf16MinLength } from './stringChecks.js';
|
|
1
2
|
/**
|
|
2
3
|
* Account graph wire contracts — the account-kind vocabulary, the account
|
|
3
4
|
* category taxonomy, and the create-account input.
|
|
@@ -69,9 +70,9 @@ export const accountCategoriesSchema = z
|
|
|
69
70
|
*/
|
|
70
71
|
export const accountNameSchema = z
|
|
71
72
|
.object({
|
|
72
|
-
first: z.string().trim().
|
|
73
|
-
last: z.string().trim().
|
|
74
|
-
displayName: z.string().trim().
|
|
73
|
+
first: z.string().trim().check(utf16MaxLength(100)).optional(),
|
|
74
|
+
last: z.string().trim().check(utf16MaxLength(100)).optional(),
|
|
75
|
+
displayName: z.string().trim().check(utf16MaxLength(ACCOUNT_TITLE_MAX_LENGTH)).optional(),
|
|
75
76
|
})
|
|
76
77
|
.optional();
|
|
77
78
|
/**
|
|
@@ -87,7 +88,7 @@ export const accountNameSchema = z
|
|
|
87
88
|
*/
|
|
88
89
|
export const createAccountRequestSchema = z
|
|
89
90
|
.object({
|
|
90
|
-
parentAccountId: z.string().trim().
|
|
91
|
+
parentAccountId: z.string().trim().check(utf16MinLength(1)).optional(),
|
|
91
92
|
kind: childAccountKindSchema,
|
|
92
93
|
/**
|
|
93
94
|
* The SAME policy a person's handle is held to. `users.username` is one unique
|
|
@@ -102,9 +103,9 @@ export const createAccountRequestSchema = z
|
|
|
102
103
|
*/
|
|
103
104
|
username: usernameSchema,
|
|
104
105
|
name: accountNameSchema,
|
|
105
|
-
bio: z.string().trim().
|
|
106
|
+
bio: z.string().trim().check(utf16MaxLength(500)).optional(),
|
|
106
107
|
avatar: z.string().optional(),
|
|
107
|
-
description: z.string().trim().
|
|
108
|
+
description: z.string().trim().check(utf16MaxLength(1000)).optional(),
|
|
108
109
|
/**
|
|
109
110
|
* A named color preset KEY (`"blue"`, `"mint"`, …), never a hex value.
|
|
110
111
|
*
|
|
@@ -121,7 +122,7 @@ export const createAccountRequestSchema = z
|
|
|
121
122
|
* would drift apart silently. What this shape does is keep an over-long or
|
|
122
123
|
* non-string value from reaching the service at all.
|
|
123
124
|
*/
|
|
124
|
-
color: z.string().trim().
|
|
125
|
+
color: z.string().trim().check(utf16MaxLength(32)).optional(),
|
|
125
126
|
/** Ordered, PRIMARY FIRST — see rule 2 above {@link ACCOUNT_CATEGORY_IDS}. */
|
|
126
127
|
accountCategories: accountCategoriesSchema.optional(),
|
|
127
128
|
organizationType: z.enum(ORGANIZATION_TYPES).optional(),
|
package/dist/esm/accountName.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { utf16MaxLength, utf16MinLength } from './stringChecks.js';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
// The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
|
|
3
4
|
// it is re-exported here so the root entry carries the whole policy.
|
|
@@ -7,6 +8,6 @@ export { ACCOUNT_NAME_POLICY_BY_KIND, ACCOUNT_TITLE_DISALLOWED_SOURCE, ACCOUNT_T
|
|
|
7
8
|
export const accountTitleSchema = z
|
|
8
9
|
.string()
|
|
9
10
|
.trim()
|
|
10
|
-
.
|
|
11
|
-
.
|
|
11
|
+
.check(utf16MinLength(1))
|
|
12
|
+
.check(utf16MaxLength(ACCOUNT_TITLE_MAX_LENGTH))
|
|
12
13
|
.refine(isPlainTextTitle, 'Name must be plain text');
|