@oxy.so/contracts 7.1.0 → 7.3.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/agency.js +5 -0
- package/dist/cjs/client/age.js +126 -0
- package/dist/cjs/client/index.js +15 -3
- package/dist/cjs/client/safety.js +10 -1
- package/dist/cjs/index.js +26 -14
- package/dist/cjs/safety.js +23 -1
- package/dist/cjs/signIn.js +9 -0
- package/dist/cjs/userResponse.js +15 -31
- package/dist/esm/agency.js +5 -0
- package/dist/esm/client/age.js +117 -0
- package/dist/esm/client/index.js +2 -1
- package/dist/esm/client/safety.js +9 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/safety.js +23 -1
- package/dist/esm/signIn.js +9 -0
- package/dist/esm/userResponse.js +15 -31
- package/dist/types/client/age.d.ts +94 -0
- package/dist/types/client/index.d.ts +3 -1
- package/dist/types/client/safety.d.ts +13 -0
- package/dist/types/externalIdentity.d.ts +5 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/inference/embeddings.d.ts +2 -2
- package/dist/types/inference/errors.d.ts +2 -2
- package/dist/types/inference/inbox.d.ts +1 -1
- package/dist/types/inference/realtime.d.ts +2 -2
- package/dist/types/inference/streamEvents.d.ts +2 -2
- package/dist/types/oxyRecordTypes.d.ts +1 -1
- package/dist/types/safety.d.ts +26 -0
- package/dist/types/signIn.d.ts +1 -0
- package/dist/types/userResponse.d.ts +21 -1
- package/package.json +2 -2
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Age bands (ADR 0067): the one answer every Oxy app gets to "how old is this
|
|
3
|
+
* person, as far as protection goes".
|
|
4
|
+
*
|
|
5
|
+
* A band is DERIVED from the account's date of birth on every read and never
|
|
6
|
+
* stored: it changes on a birthday without any write touching the row. An
|
|
7
|
+
* application never receives the date itself, only the band.
|
|
8
|
+
*
|
|
9
|
+
* - `under13`: below {@link MINIMUM_UNSUPERVISED_AGE_YEARS}. Such an account
|
|
10
|
+
* exists only under supervision (ADR 0041); sign-up creates it awaiting a
|
|
11
|
+
* guardian.
|
|
12
|
+
* - `teen`: old enough for an account of their own, not yet an adult. Apps
|
|
13
|
+
* apply their protective defaults.
|
|
14
|
+
* - `adult`: at least {@link ADULT_AGE_YEARS}.
|
|
15
|
+
*
|
|
16
|
+
* An account with no date of birth has NO band (`undefined`), which is distinct
|
|
17
|
+
* from every value here: "unknown" is never read as "adult" or as "minor".
|
|
18
|
+
*/
|
|
19
|
+
export const AGE_BANDS = ['under13', 'teen', 'adult'];
|
|
20
|
+
/**
|
|
21
|
+
* The earliest calendar year a date of birth may name.
|
|
22
|
+
*
|
|
23
|
+
* Not a biological bound: it catches an obviously transposed year (`1027` for
|
|
24
|
+
* `2027`) with a clear message instead of a 150-year-old account. No living
|
|
25
|
+
* person's real date is refused by it. The server's schema and every picker
|
|
26
|
+
* read this one value, so a picker cannot offer a date the API refuses.
|
|
27
|
+
*/
|
|
28
|
+
export const MIN_BIRTH_YEAR = 1900;
|
|
29
|
+
/** The wire format of a date of birth: `YYYY-MM-DD`, nothing looser. */
|
|
30
|
+
export const DATE_OF_BIRTH_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
31
|
+
/**
|
|
32
|
+
* Whether a `YYYY-MM-DD` string names a day that exists on the Gregorian
|
|
33
|
+
* calendar. The pattern only constrains digit count and would pass `2024-02-30`.
|
|
34
|
+
*/
|
|
35
|
+
export function isRealCalendarDate(value) {
|
|
36
|
+
const [year, month, day] = value.split('-').map(Number);
|
|
37
|
+
const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
|
38
|
+
const daysInMonth = [31, isLeapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
39
|
+
return month >= 1 && month <= 12 && day >= 1 && day <= daysInMonth[month - 1];
|
|
40
|
+
}
|
|
41
|
+
/** Whether a `YYYY-MM-DD` string is not before {@link MIN_BIRTH_YEAR}. */
|
|
42
|
+
export function isBirthYearInRange(value) {
|
|
43
|
+
return Number(value.slice(0, 4)) >= MIN_BIRTH_YEAR;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Whether a `YYYY-MM-DD` string is today (UTC) or earlier. Two zero-padded ISO
|
|
47
|
+
* dates of equal length sort exactly as their dates do.
|
|
48
|
+
*/
|
|
49
|
+
export function isNotAfterToday(value, today = new Date()) {
|
|
50
|
+
return value <= today.toISOString().slice(0, 10);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* What each date-of-birth rule says when it fails. The server's schema and the
|
|
54
|
+
* client's check word a refusal identically because both read these.
|
|
55
|
+
*/
|
|
56
|
+
export const DATE_OF_BIRTH_MESSAGES = {
|
|
57
|
+
format: 'dateOfBirth must be an ISO 8601 calendar date (YYYY-MM-DD)',
|
|
58
|
+
calendar: 'dateOfBirth is not a real calendar date',
|
|
59
|
+
tooEarly: `dateOfBirth must not be before ${MIN_BIRTH_YEAR}`,
|
|
60
|
+
future: 'dateOfBirth must not be in the future',
|
|
61
|
+
};
|
|
62
|
+
/** Below this age an account exists only under supervision. */
|
|
63
|
+
export const MINIMUM_UNSUPERVISED_AGE_YEARS = 13;
|
|
64
|
+
/** From this age an account is an adult's. */
|
|
65
|
+
export const ADULT_AGE_YEARS = 18;
|
|
66
|
+
/**
|
|
67
|
+
* Whole years between an ISO calendar date (`YYYY-MM-DD`) and `today`, both
|
|
68
|
+
* read in UTC.
|
|
69
|
+
*
|
|
70
|
+
* UTC because a date of birth has no time of day and no zone of its own, so
|
|
71
|
+
* there is no authoritative zone to evaluate it in; UTC is the one every server
|
|
72
|
+
* and every client agrees on without configuration. The effect is a band that
|
|
73
|
+
* can change up to a day before or after the person's own local midnight.
|
|
74
|
+
*
|
|
75
|
+
* A birthday on 29 February counts on 1 March in a year that has none, which is
|
|
76
|
+
* what `Date.UTC` yields for the 29th of a 28-day February.
|
|
77
|
+
*/
|
|
78
|
+
export function ageInYears(dateOfBirth, today = new Date()) {
|
|
79
|
+
const [year, month, day] = dateOfBirth.split('-').map(Number);
|
|
80
|
+
const todayUtc = Date.UTC(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate());
|
|
81
|
+
let age = today.getUTCFullYear() - year;
|
|
82
|
+
if (Date.UTC(year + age, month - 1, day) > todayUtc)
|
|
83
|
+
age -= 1;
|
|
84
|
+
return age;
|
|
85
|
+
}
|
|
86
|
+
/** The band of a validated ISO calendar date of birth. */
|
|
87
|
+
export function ageBandOf(dateOfBirth, today = new Date()) {
|
|
88
|
+
const age = ageInYears(dateOfBirth, today);
|
|
89
|
+
if (age < MINIMUM_UNSUPERVISED_AGE_YEARS)
|
|
90
|
+
return 'under13';
|
|
91
|
+
return age < ADULT_AGE_YEARS ? 'teen' : 'adult';
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Whether a person may move their own date of birth from one band to another.
|
|
95
|
+
*
|
|
96
|
+
* A first date (no band yet) is always theirs to give. After that the band may
|
|
97
|
+
* stay or get YOUNGER, never older: growing older on paper is how a protection
|
|
98
|
+
* would be removed, and that takes a reviewed correction, not a profile edit.
|
|
99
|
+
*/
|
|
100
|
+
export function isSelfServiceBandChange(from, to) {
|
|
101
|
+
if (from === undefined)
|
|
102
|
+
return true;
|
|
103
|
+
return AGE_BANDS.indexOf(to) <= AGE_BANDS.indexOf(from);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Why a profile edit to the date of birth was refused: the error's `code`,
|
|
107
|
+
* which a client maps to its own copy.
|
|
108
|
+
*
|
|
109
|
+
* - `locked`: the date is set and this edit would remove it or move the
|
|
110
|
+
* account to an older band.
|
|
111
|
+
* - `supervisionRequired`: the date would put an existing account below the
|
|
112
|
+
* minimum unsupervised age; that account enrols through supervision.
|
|
113
|
+
*/
|
|
114
|
+
export const DATE_OF_BIRTH_REFUSALS = {
|
|
115
|
+
locked: 'DATE_OF_BIRTH_LOCKED',
|
|
116
|
+
supervisionRequired: 'DATE_OF_BIRTH_SUPERVISION_REQUIRED',
|
|
117
|
+
};
|
package/dist/esm/client/index.js
CHANGED
|
@@ -34,7 +34,7 @@ export { ORGANIZATION_ALIAS_KINDS, ORGANIZATION_CLAIM_DECISIONS, ORGANIZATION_CL
|
|
|
34
34
|
export { cancelProductSubscriptionCheck, oxyAccountIdCheck, personalPlanCatalogueCheck, personalPlanCheckoutRequestCheck, personalPlanCheckoutResultCheck, productPlanCatalogueCheck, productPlanCheckoutRequestCheck, productSubscriptionCancellationResultCheck, productSubscriptionPortalRequestCheck, productSubscriptionPortalResponseCheck, productSubscriptionsResponseCheck, subjectProductAccessCheck, subjectProductAccessQueryCheck, subscriptionCreditGrantsResponseCheck, } from './products.js';
|
|
35
35
|
export { recommendationRequestCheck } from './recommendations.js';
|
|
36
36
|
export { isFullReputationBalance } from './reputation.js';
|
|
37
|
-
export { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, profileAccessDecisionCheck, profileAccessInputCheck, purchaseApprovalCheck, purchaseApprovalListCheck, purchaseReviewInputCheck, safetyOrganizationsInputCheck, safetyOrganizationsResponseCheck, safetyPeopleInputCheck, safetyPeopleResponseCheck, supervisionAcceptInputCheck, supervisionContactInputCheck, supervisionContactsResponseCheck, supervisionInvitationCheck, supervisionInviteInputCheck, supervisionReviewInputCheck, supervisionStateCheck, } from './safety.js';
|
|
37
|
+
export { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, profileAccessDecisionCheck, profileAccessInputCheck, purchaseApprovalCheck, purchaseApprovalListCheck, purchaseReviewInputCheck, safetyOrganizationsInputCheck, safetyOrganizationsResponseCheck, safetyPeopleInputCheck, safetyPeopleResponseCheck, supervisionAcceptInputCheck, supervisionContactInputCheck, supervisionContactsResponseCheck, supervisionInvitationCheck, supervisionInviteInputCheck, dateOfBirthCorrectionInputCheck, supervisionReviewInputCheck, supervisionStateCheck, } from './safety.js';
|
|
38
38
|
export { publicApplicationCheck } from './sessionStatus.js';
|
|
39
39
|
export { CONSOLE_TERMS_VERSION, CONSOLE_USE_CASES, } from './consoleOnboarding.js';
|
|
40
40
|
export { EMAIL_ACCOUNTS_MAX, EMAIL_SIGNIN_CHOICE_TTL_MS, EMAIL_SIGNIN_LINK_TTL_MS, EMAIL_SIGNIN_LONG_CODE_ALPHABET, EMAIL_SIGNIN_LONG_CODE_LENGTH, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, REAUTH_ACTIONS, SECOND_FACTOR_CODE_MAX_LENGTH, SIGN_IN_IDENTIFIER_MAX_LENGTH, SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS, SIGNIN_SECOND_FACTOR_TTL_MS, SIGN_IN_ERROR_CODES, TOTP_BACKUP_CODE_COUNT, TOTP_DIGITS, TOTP_PERIOD_SECONDS, emailSignInChooseAccountCheck, emailSignInLinkResponseCheck, emailSignInPendingCheck, emailSignInStartResponseCheck, isEmailSignInChooseAccount, isSecondFactorRequired, normalizeEmailSignInCode, reauthProofCheck, secondFactorRequiredCheck, signInMethodsCheck, totpBackupCodesResponseCheck, totpEnrollResponseCheck, } from './signIn.js';
|
|
@@ -42,6 +42,7 @@ export { BOT_USERNAME_INVALID_MESSAGE, BOT_USERNAME_SUFFIX, NUMERIC_USERNAME_MES
|
|
|
42
42
|
export { userNameCheck, PROFILE_LINKS_MAX, PROFILE_LINK_TITLE_MAX } from './userResponse.js';
|
|
43
43
|
export { PRONOUNS } from './userResponse.js';
|
|
44
44
|
export { CLAIMANT_RELATIONSHIPS, CLOSED_CONTENT_CLAIM_STATES, CONTENT_CLAIM_COUNTER_NOTICE_LIMITS, CONTENT_CLAIM_ERROR_CODES, CONTENT_CLAIM_KINDS, CONTENT_CLAIM_LIMITS, CONTENT_CLAIM_REFERENCE_PATTERN, CONTENT_CLAIM_STATES, COUNTER_NOTICE_STATEMENT_VERSION, COUNTER_NOTICE_STATEMENTS, ERASURE_REQUEST_DEADLINE_DAYS, OPEN_CONTENT_CLAIM_STATES, isErasureRequest, isRightsClaim, } from './contentClaims.js';
|
|
45
|
+
export { ADULT_AGE_YEARS, AGE_BANDS, DATE_OF_BIRTH_MESSAGES, DATE_OF_BIRTH_PATTERN, DATE_OF_BIRTH_REFUSALS, MINIMUM_UNSUPERVISED_AGE_YEARS, MIN_BIRTH_YEAR, ageBandOf, ageInYears, isSelfServiceBandChange, } from './age.js';
|
|
45
46
|
export { APP_ASSERTION_CHALLENGE_PURPOSES, APP_ASSERTION_ERROR_CODES, APP_ASSERTION_PLATFORMS, OXY_APP_ASSERTION_AUDIENCE, OXY_APP_ASSERTION_HEADER, OXY_APP_ASSERTION_TTL_SECONDS, OXY_APP_ASSERTION_TYPE, appAssertionChallengeResponseCheck, appAssertionResponseCheck, appAttestKeyResponseCheck, } from './appAssertions.js';
|
|
46
47
|
export { APP_TOKEN_DEVICE_ACCESS_DENIED, DEVICE_APP_TOKEN_ERROR_CODES, DEVICE_APP_TOKEN_TTL_SECONDS, OXYOS_DESKTOP_ENTRY_ID_PATTERN, PLATFORM_HOSTS, deviceAppTokenResponseCheck, } from './platformSession.js';
|
|
47
48
|
export { USER_PROFILE_COLORS, USER_PROFILE_COLOR_PRESETS, FREE_USER_PROFILE_COLOR_PRESETS, } from '../profileColors.generated.js';
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { array, atLeast, atMost, boolean, datetime, exact, int, literal, maxItems, maxLength, minItems, minLength, nonnegative, nullable, number, oneOf, optional, pattern, refine, refineAt, strictObject, string, transform, trim, union, } from './check.js';
|
|
12
12
|
import { ORGANIZATION_TYPES } from './organizations.js';
|
|
13
|
+
import { DATE_OF_BIRTH_MESSAGES, DATE_OF_BIRTH_PATTERN, isBirthYearInRange, isNotAfterToday, isRealCalendarDate, } from './age.js';
|
|
13
14
|
import { reauthProofCheck } from './signIn.js';
|
|
14
15
|
/** Supervision is a personal-account safety policy, never a new login/account kind. */
|
|
15
16
|
export const SUPERVISED_ACTIONS = ['profile', 'messaging', 'content', 'purchases'];
|
|
@@ -92,6 +93,14 @@ export const supervisionReviewInputCheck = exact()(strictObject({
|
|
|
92
93
|
evidenceReference: string(trim, minLength(1), maxLength(2048)),
|
|
93
94
|
reauth: reauthProofCheck,
|
|
94
95
|
}));
|
|
96
|
+
/** `dateOfBirthSchema`, rule for rule and message for message. */
|
|
97
|
+
const dateOfBirthCheck = refine(refine(refine(string(pattern(DATE_OF_BIRTH_PATTERN, DATE_OF_BIRTH_MESSAGES.format)), isRealCalendarDate, DATE_OF_BIRTH_MESSAGES.calendar), isBirthYearInRange, DATE_OF_BIRTH_MESSAGES.tooEarly), (value) => isNotAfterToday(value), DATE_OF_BIRTH_MESSAGES.future);
|
|
98
|
+
export const dateOfBirthCorrectionInputCheck = exact()(strictObject({
|
|
99
|
+
accountId,
|
|
100
|
+
dateOfBirth: dateOfBirthCheck,
|
|
101
|
+
evidenceReference: string(trim, minLength(1), maxLength(2048)),
|
|
102
|
+
reauth: reauthProofCheck,
|
|
103
|
+
}));
|
|
95
104
|
/* -------------------------------------------------------------------------- */
|
|
96
105
|
/* Minimal identities for the management screens */
|
|
97
106
|
/* -------------------------------------------------------------------------- */
|
package/dist/esm/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export { AVATAR_EYE_SPACING, AVATAR_PICKABLE_SHAPES, avatarCharacterFor, avatarC
|
|
|
15
15
|
export { ACCOUNT_ACTOR_NATURES, ACCOUNT_SUBJECT_CONTRACT_VERSION, FINANCIAL_EFFECT_DIRECTIONS, KIND_INDEPENDENT_ACCOUNT_DIMENSIONS, accountActorChainFromSession, accountActorChainSchema, accountActorNatureSchema, accountKindActorNature, accountKindActsAsItself, attributeFinancialEffect, financialEffectAttributionSchema, } from './accountSubject.js';
|
|
16
16
|
export { usernameSchema, usernameSchemaForAccountKind, isValidUsername, stripDisallowedUsernameCharacters, applyBotUsernameSuffix, USERNAME_MIN_LENGTH, USERNAME_MAX_LENGTH, USERNAME_INVALID_MESSAGE, BOT_USERNAME_INVALID_MESSAGE, RESERVED_USERNAME_MESSAGE, NUMERIC_USERNAME_MESSAGE, } from './username.js';
|
|
17
17
|
export { PRONOUNS, PROFILE_LINKS_MAX, PROFILE_LINK_TITLE_MAX } from './client/userResponse.js';
|
|
18
|
+
export { ADULT_AGE_YEARS, AGE_BANDS, DATE_OF_BIRTH_MESSAGES, DATE_OF_BIRTH_PATTERN, DATE_OF_BIRTH_REFUSALS, MINIMUM_UNSUPERVISED_AGE_YEARS, MIN_BIRTH_YEAR, ageBandOf, ageInYears, isSelfServiceBandChange, } from './client/age.js';
|
|
18
19
|
export {
|
|
19
20
|
// Schemas
|
|
20
21
|
userNameSchema, userRelationshipSchema, themePreferenceSchema, dateOfBirthSchema, userResponseSchema, userProfileUpdateSchema, currentUserResponseSchema, deviceLinkedSessionSchema, deviceLinkedSessionsResponseSchema,
|
package/dist/esm/safety.js
CHANGED
|
@@ -7,7 +7,7 @@ import { accountActorChainSchema } from './accountSubject.js';
|
|
|
7
7
|
import { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, } from './client/safety.js';
|
|
8
8
|
import { ORGANIZATION_TYPES } from './organizations.js';
|
|
9
9
|
import { reauthProofSchema } from './signIn.js';
|
|
10
|
-
import { userResponseSchema } from './userResponse.js';
|
|
10
|
+
import { dateOfBirthSchema, userResponseSchema } from './userResponse.js';
|
|
11
11
|
export { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, };
|
|
12
12
|
/** The requester is authenticated by the bearer; applications cannot submit viewer IDs. */
|
|
13
13
|
export const profileAccessInputSchema = z
|
|
@@ -222,6 +222,15 @@ export const safetyRequesterSchema = z.union([
|
|
|
222
222
|
z
|
|
223
223
|
.object({ requesterContext: z.string().check(utf16MinLength(1)).check(utf16MaxLength(16384)) })
|
|
224
224
|
.strict(),
|
|
225
|
+
/**
|
|
226
|
+
* The account an Oxy service acts for, on what its first-party registry entry
|
|
227
|
+
* declares (`oxy:safety`, ADR 0066). Only an Oxy service may send it.
|
|
228
|
+
*/
|
|
229
|
+
z
|
|
230
|
+
.object({
|
|
231
|
+
actingForAccountId: z.string().check(utf16MinLength(1)).check(utf16MaxLength(128)),
|
|
232
|
+
})
|
|
233
|
+
.strict(),
|
|
225
234
|
]);
|
|
226
235
|
export const supervisionSchema = z
|
|
227
236
|
.object({
|
|
@@ -407,6 +416,19 @@ export const supervisionReviewInputSchema = z
|
|
|
407
416
|
reauth: reauthProofSchema,
|
|
408
417
|
})
|
|
409
418
|
.strict();
|
|
419
|
+
/**
|
|
420
|
+
* `POST /safety/supervision/date-of-birth`: a staff member corrects an
|
|
421
|
+
* account's date of birth on reviewed evidence (ADR 0067). It is the only way
|
|
422
|
+
* a date moves to an OLDER age band; the person's own edits cannot.
|
|
423
|
+
*/
|
|
424
|
+
export const dateOfBirthCorrectionInputSchema = z
|
|
425
|
+
.object({
|
|
426
|
+
accountId,
|
|
427
|
+
dateOfBirth: dateOfBirthSchema,
|
|
428
|
+
evidenceReference: z.string().trim().check(utf16MinLength(1)).check(utf16MaxLength(2048)),
|
|
429
|
+
reauth: reauthProofSchema,
|
|
430
|
+
})
|
|
431
|
+
.strict();
|
|
410
432
|
export const purchaseReviewInputSchema = z
|
|
411
433
|
.object({ decision: z.enum(['approved', 'rejected']), reauth: reauthProofSchema })
|
|
412
434
|
.strict();
|
package/dist/esm/signIn.js
CHANGED
|
@@ -2,6 +2,7 @@ import { isLanguageTag } from './client/language.js';
|
|
|
2
2
|
import { campaignAttributionSchema } from './campaignAttribution.js';
|
|
3
3
|
import { integerCheck } from './numberChecks.js';
|
|
4
4
|
import { utf16MaxLength, utf16MinLength } from './stringChecks.js';
|
|
5
|
+
import { dateOfBirthSchema } from './userResponse.js';
|
|
5
6
|
/**
|
|
6
7
|
* Signing in: an email code or link, an optional password,
|
|
7
8
|
* and an optional authenticator app (TOTP) as a second factor.
|
|
@@ -187,6 +188,14 @@ export const signUpRequestSchema = z
|
|
|
187
188
|
.max(10)
|
|
188
189
|
.optional(),
|
|
189
190
|
campaignAttribution: campaignAttributionSchema.optional(),
|
|
191
|
+
/**
|
|
192
|
+
* The person's date of birth (ADR 0067). The sign-up panel always asks for
|
|
193
|
+
* it; it is optional on the wire only while clients published before it
|
|
194
|
+
* are still in use, and an account created without one has no age band.
|
|
195
|
+
* A date below the minimum unsupervised age creates the account under
|
|
196
|
+
* supervision, awaiting a guardian.
|
|
197
|
+
*/
|
|
198
|
+
dateOfBirth: dateOfBirthSchema.optional(),
|
|
190
199
|
...sessionEnvelope,
|
|
191
200
|
})
|
|
192
201
|
.strict();
|
package/dist/esm/userResponse.js
CHANGED
|
@@ -30,6 +30,7 @@ import { isoDateTime } from './stringChecks.js';
|
|
|
30
30
|
* `require()`).
|
|
31
31
|
*/
|
|
32
32
|
import { z } from 'zod';
|
|
33
|
+
import { AGE_BANDS, DATE_OF_BIRTH_MESSAGES, DATE_OF_BIRTH_PATTERN, isBirthYearInRange, isNotAfterToday, isRealCalendarDate, } from './client/age.js';
|
|
33
34
|
import { PRONOUNS, PROFILE_LINKS_MAX } from './client/userResponse.js';
|
|
34
35
|
import { verifiedDomainSchema } from './identity.js';
|
|
35
36
|
import { accountCategoriesSchema, accountKindSchema } from './accountGraph.js';
|
|
@@ -50,25 +51,6 @@ export const themePreferenceSchema = z.object({
|
|
|
50
51
|
mode: z.enum(['light', 'dark', 'system']),
|
|
51
52
|
colorPreset: z.string(),
|
|
52
53
|
});
|
|
53
|
-
/**
|
|
54
|
-
* The earliest calendar year `dateOfBirthSchema` accepts.
|
|
55
|
-
*
|
|
56
|
-
* Not a real biological bound — it exists to catch an obviously-transposed
|
|
57
|
-
* year (`1027` for `2027`, a stray OCR/typo digit) with a clear message
|
|
58
|
-
* instead of the value quietly becoming a 150-year-old account. 1900 is
|
|
59
|
-
* generous enough that no living person's real birthdate is rejected by it.
|
|
60
|
-
*/
|
|
61
|
-
const MIN_BIRTH_YEAR = 1900;
|
|
62
|
-
/**
|
|
63
|
-
* `true` when `year`/`month`/`day` name a date that actually exists on the
|
|
64
|
-
* Gregorian calendar — the check `z.string().regex(...)` alone cannot make,
|
|
65
|
-
* since the regex only constrains digit COUNT and would pass `2024-02-30`.
|
|
66
|
-
*/
|
|
67
|
-
function isRealCalendarDate(year, month, day) {
|
|
68
|
-
const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
|
69
|
-
const daysInMonth = [31, isLeapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
70
|
-
return month >= 1 && month <= 12 && day >= 1 && day <= daysInMonth[month - 1];
|
|
71
|
-
}
|
|
72
54
|
/**
|
|
73
55
|
* A date of birth, `YYYY-MM-DD`, the sole structured representation this
|
|
74
56
|
* platform stores going forward (`users.date_of_birth` — see
|
|
@@ -87,23 +69,16 @@ function isRealCalendarDate(year, month, day) {
|
|
|
87
69
|
* and not after today (comparing the zero-padded ISO strings directly is
|
|
88
70
|
* a valid, simpler stand-in for a numeric comparison here, since two
|
|
89
71
|
* `YYYY-MM-DD` strings of equal length sort exactly the way their dates
|
|
90
|
-
* do). "Today" is UTC — see `
|
|
72
|
+
* do). "Today" is UTC — see `ageInYears` in `client/age.ts` for why
|
|
91
73
|
* a date with no timezone of its own is evaluated in UTC rather than any
|
|
92
74
|
* particular caller's local zone.
|
|
93
75
|
*/
|
|
94
76
|
export const dateOfBirthSchema = z
|
|
95
77
|
.string()
|
|
96
|
-
.regex(
|
|
97
|
-
.refine(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}, { message: 'dateOfBirth is not a real calendar date' })
|
|
101
|
-
.refine((value) => Number(value.slice(0, 4)) >= MIN_BIRTH_YEAR, {
|
|
102
|
-
message: `dateOfBirth must not be before ${MIN_BIRTH_YEAR}`,
|
|
103
|
-
})
|
|
104
|
-
.refine((value) => value <= new Date().toISOString().slice(0, 10), {
|
|
105
|
-
message: 'dateOfBirth must not be in the future',
|
|
106
|
-
});
|
|
78
|
+
.regex(DATE_OF_BIRTH_PATTERN, DATE_OF_BIRTH_MESSAGES.format)
|
|
79
|
+
.refine(isRealCalendarDate, { message: DATE_OF_BIRTH_MESSAGES.calendar })
|
|
80
|
+
.refine(isBirthYearInRange, { message: DATE_OF_BIRTH_MESSAGES.tooEarly })
|
|
81
|
+
.refine((value) => isNotAfterToday(value), { message: DATE_OF_BIRTH_MESSAGES.future });
|
|
107
82
|
/**
|
|
108
83
|
* The canonical user object emitted by `formatUserResponse`.
|
|
109
84
|
*
|
|
@@ -153,6 +128,15 @@ export const userResponseSchema = z
|
|
|
153
128
|
* not decided here.
|
|
154
129
|
*/
|
|
155
130
|
isAdult: z.boolean().optional(),
|
|
131
|
+
/**
|
|
132
|
+
* The account's age band (ADR 0067), derived from `dateOfBirth` on every
|
|
133
|
+
* read and never stored. Absent when there is no date of birth: "unknown"
|
|
134
|
+
* is neither an adult nor a minor. The owner reads it on their own
|
|
135
|
+
* profile, and an Oxy service reads it on the session it validates
|
|
136
|
+
* (`POST /safety/service/session`); it never rides a public profile, and
|
|
137
|
+
* the date itself never leaves the owner's view.
|
|
138
|
+
*/
|
|
139
|
+
ageBand: z.enum(AGE_BANDS).optional(),
|
|
156
140
|
/** Avatar file id (string) or null. */
|
|
157
141
|
avatar: z.string().nullable().optional(),
|
|
158
142
|
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Age bands (ADR 0067): the one answer every Oxy app gets to "how old is this
|
|
3
|
+
* person, as far as protection goes".
|
|
4
|
+
*
|
|
5
|
+
* A band is DERIVED from the account's date of birth on every read and never
|
|
6
|
+
* stored: it changes on a birthday without any write touching the row. An
|
|
7
|
+
* application never receives the date itself, only the band.
|
|
8
|
+
*
|
|
9
|
+
* - `under13`: below {@link MINIMUM_UNSUPERVISED_AGE_YEARS}. Such an account
|
|
10
|
+
* exists only under supervision (ADR 0041); sign-up creates it awaiting a
|
|
11
|
+
* guardian.
|
|
12
|
+
* - `teen`: old enough for an account of their own, not yet an adult. Apps
|
|
13
|
+
* apply their protective defaults.
|
|
14
|
+
* - `adult`: at least {@link ADULT_AGE_YEARS}.
|
|
15
|
+
*
|
|
16
|
+
* An account with no date of birth has NO band (`undefined`), which is distinct
|
|
17
|
+
* from every value here: "unknown" is never read as "adult" or as "minor".
|
|
18
|
+
*/
|
|
19
|
+
export declare const AGE_BANDS: readonly ["under13", "teen", "adult"];
|
|
20
|
+
export type AgeBand = (typeof AGE_BANDS)[number];
|
|
21
|
+
/**
|
|
22
|
+
* The earliest calendar year a date of birth may name.
|
|
23
|
+
*
|
|
24
|
+
* Not a biological bound: it catches an obviously transposed year (`1027` for
|
|
25
|
+
* `2027`) with a clear message instead of a 150-year-old account. No living
|
|
26
|
+
* person's real date is refused by it. The server's schema and every picker
|
|
27
|
+
* read this one value, so a picker cannot offer a date the API refuses.
|
|
28
|
+
*/
|
|
29
|
+
export declare const MIN_BIRTH_YEAR = 1900;
|
|
30
|
+
/** The wire format of a date of birth: `YYYY-MM-DD`, nothing looser. */
|
|
31
|
+
export declare const DATE_OF_BIRTH_PATTERN: RegExp;
|
|
32
|
+
/**
|
|
33
|
+
* Whether a `YYYY-MM-DD` string names a day that exists on the Gregorian
|
|
34
|
+
* calendar. The pattern only constrains digit count and would pass `2024-02-30`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isRealCalendarDate(value: string): boolean;
|
|
37
|
+
/** Whether a `YYYY-MM-DD` string is not before {@link MIN_BIRTH_YEAR}. */
|
|
38
|
+
export declare function isBirthYearInRange(value: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether a `YYYY-MM-DD` string is today (UTC) or earlier. Two zero-padded ISO
|
|
41
|
+
* dates of equal length sort exactly as their dates do.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isNotAfterToday(value: string, today?: Date): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* What each date-of-birth rule says when it fails. The server's schema and the
|
|
46
|
+
* client's check word a refusal identically because both read these.
|
|
47
|
+
*/
|
|
48
|
+
export declare const DATE_OF_BIRTH_MESSAGES: {
|
|
49
|
+
readonly format: "dateOfBirth must be an ISO 8601 calendar date (YYYY-MM-DD)";
|
|
50
|
+
readonly calendar: "dateOfBirth is not a real calendar date";
|
|
51
|
+
readonly tooEarly: "dateOfBirth must not be before 1900";
|
|
52
|
+
readonly future: "dateOfBirth must not be in the future";
|
|
53
|
+
};
|
|
54
|
+
/** Below this age an account exists only under supervision. */
|
|
55
|
+
export declare const MINIMUM_UNSUPERVISED_AGE_YEARS = 13;
|
|
56
|
+
/** From this age an account is an adult's. */
|
|
57
|
+
export declare const ADULT_AGE_YEARS = 18;
|
|
58
|
+
/**
|
|
59
|
+
* Whole years between an ISO calendar date (`YYYY-MM-DD`) and `today`, both
|
|
60
|
+
* read in UTC.
|
|
61
|
+
*
|
|
62
|
+
* UTC because a date of birth has no time of day and no zone of its own, so
|
|
63
|
+
* there is no authoritative zone to evaluate it in; UTC is the one every server
|
|
64
|
+
* and every client agrees on without configuration. The effect is a band that
|
|
65
|
+
* can change up to a day before or after the person's own local midnight.
|
|
66
|
+
*
|
|
67
|
+
* A birthday on 29 February counts on 1 March in a year that has none, which is
|
|
68
|
+
* what `Date.UTC` yields for the 29th of a 28-day February.
|
|
69
|
+
*/
|
|
70
|
+
export declare function ageInYears(dateOfBirth: string, today?: Date): number;
|
|
71
|
+
/** The band of a validated ISO calendar date of birth. */
|
|
72
|
+
export declare function ageBandOf(dateOfBirth: string, today?: Date): AgeBand;
|
|
73
|
+
/**
|
|
74
|
+
* Whether a person may move their own date of birth from one band to another.
|
|
75
|
+
*
|
|
76
|
+
* A first date (no band yet) is always theirs to give. After that the band may
|
|
77
|
+
* stay or get YOUNGER, never older: growing older on paper is how a protection
|
|
78
|
+
* would be removed, and that takes a reviewed correction, not a profile edit.
|
|
79
|
+
*/
|
|
80
|
+
export declare function isSelfServiceBandChange(from: AgeBand | undefined, to: AgeBand): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Why a profile edit to the date of birth was refused: the error's `code`,
|
|
83
|
+
* which a client maps to its own copy.
|
|
84
|
+
*
|
|
85
|
+
* - `locked`: the date is set and this edit would remove it or move the
|
|
86
|
+
* account to an older band.
|
|
87
|
+
* - `supervisionRequired`: the date would put an existing account below the
|
|
88
|
+
* minimum unsupervised age; that account enrols through supervision.
|
|
89
|
+
*/
|
|
90
|
+
export declare const DATE_OF_BIRTH_REFUSALS: {
|
|
91
|
+
readonly locked: "DATE_OF_BIRTH_LOCKED";
|
|
92
|
+
readonly supervisionRequired: "DATE_OF_BIRTH_SUPERVISION_REQUIRED";
|
|
93
|
+
};
|
|
94
|
+
export type DateOfBirthRefusal = (typeof DATE_OF_BIRTH_REFUSALS)[keyof typeof DATE_OF_BIRTH_REFUSALS];
|
|
@@ -36,7 +36,7 @@ export { ORGANIZATION_ALIAS_KINDS, ORGANIZATION_CLAIM_DECISIONS, ORGANIZATION_CL
|
|
|
36
36
|
export { cancelProductSubscriptionCheck, oxyAccountIdCheck, personalPlanCatalogueCheck, personalPlanCheckoutRequestCheck, personalPlanCheckoutResultCheck, productPlanCatalogueCheck, productPlanCheckoutRequestCheck, productSubscriptionCancellationResultCheck, productSubscriptionPortalRequestCheck, productSubscriptionPortalResponseCheck, productSubscriptionsResponseCheck, subjectProductAccessCheck, subjectProductAccessQueryCheck, subscriptionCreditGrantsResponseCheck, } from './products';
|
|
37
37
|
export { recommendationRequestCheck } from './recommendations';
|
|
38
38
|
export { isFullReputationBalance } from './reputation';
|
|
39
|
-
export { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, profileAccessDecisionCheck, profileAccessInputCheck, purchaseApprovalCheck, purchaseApprovalListCheck, purchaseReviewInputCheck, safetyOrganizationsInputCheck, safetyOrganizationsResponseCheck, safetyPeopleInputCheck, safetyPeopleResponseCheck, supervisionAcceptInputCheck, supervisionContactInputCheck, supervisionContactsResponseCheck, supervisionInvitationCheck, supervisionInviteInputCheck, supervisionReviewInputCheck, supervisionStateCheck, } from './safety';
|
|
39
|
+
export { PURCHASE_APPROVAL_STATUSES, SAFETY_POLICY_VERSION, SUPERVISED_ACTIONS, SUPERVISION_CHANGED_EVENT, SUPERVISION_CONSENT_VERSION, SUPERVISION_INVITATION_STATUSES, SUPERVISION_STATUSES, profileAccessDecisionCheck, profileAccessInputCheck, purchaseApprovalCheck, purchaseApprovalListCheck, purchaseReviewInputCheck, safetyOrganizationsInputCheck, safetyOrganizationsResponseCheck, safetyPeopleInputCheck, safetyPeopleResponseCheck, supervisionAcceptInputCheck, supervisionContactInputCheck, supervisionContactsResponseCheck, supervisionInvitationCheck, supervisionInviteInputCheck, dateOfBirthCorrectionInputCheck, supervisionReviewInputCheck, supervisionStateCheck, } from './safety';
|
|
40
40
|
export { publicApplicationCheck } from './sessionStatus';
|
|
41
41
|
export { CONSOLE_TERMS_VERSION, CONSOLE_USE_CASES, type ConsoleUseCaseId, } from './consoleOnboarding';
|
|
42
42
|
export { EMAIL_ACCOUNTS_MAX, EMAIL_SIGNIN_CHOICE_TTL_MS, EMAIL_SIGNIN_LINK_TTL_MS, EMAIL_SIGNIN_LONG_CODE_ALPHABET, EMAIL_SIGNIN_LONG_CODE_LENGTH, PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH, REAUTH_ACTIONS, SECOND_FACTOR_CODE_MAX_LENGTH, SIGN_IN_IDENTIFIER_MAX_LENGTH, SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS, SIGNIN_SECOND_FACTOR_TTL_MS, SIGN_IN_ERROR_CODES, TOTP_BACKUP_CODE_COUNT, TOTP_DIGITS, TOTP_PERIOD_SECONDS, emailSignInChooseAccountCheck, emailSignInLinkResponseCheck, emailSignInPendingCheck, emailSignInStartResponseCheck, isEmailSignInChooseAccount, isSecondFactorRequired, normalizeEmailSignInCode, reauthProofCheck, secondFactorRequiredCheck, signInMethodsCheck, totpBackupCodesResponseCheck, totpEnrollResponseCheck, } from './signIn';
|
|
@@ -45,6 +45,8 @@ export { userNameCheck, PROFILE_LINKS_MAX, PROFILE_LINK_TITLE_MAX } from './user
|
|
|
45
45
|
export { PRONOUNS } from './userResponse';
|
|
46
46
|
export type { Pronouns } from './userResponse';
|
|
47
47
|
export { CLAIMANT_RELATIONSHIPS, CLOSED_CONTENT_CLAIM_STATES, CONTENT_CLAIM_COUNTER_NOTICE_LIMITS, CONTENT_CLAIM_ERROR_CODES, CONTENT_CLAIM_KINDS, CONTENT_CLAIM_LIMITS, CONTENT_CLAIM_REFERENCE_PATTERN, CONTENT_CLAIM_STATES, COUNTER_NOTICE_STATEMENT_VERSION, COUNTER_NOTICE_STATEMENTS, ERASURE_REQUEST_DEADLINE_DAYS, OPEN_CONTENT_CLAIM_STATES, isErasureRequest, isRightsClaim, } from './contentClaims';
|
|
48
|
+
export { ADULT_AGE_YEARS, AGE_BANDS, DATE_OF_BIRTH_MESSAGES, DATE_OF_BIRTH_PATTERN, DATE_OF_BIRTH_REFUSALS, MINIMUM_UNSUPERVISED_AGE_YEARS, MIN_BIRTH_YEAR, ageBandOf, ageInYears, isSelfServiceBandChange, } from './age';
|
|
49
|
+
export type { AgeBand, DateOfBirthRefusal } from './age';
|
|
48
50
|
export { APP_ASSERTION_CHALLENGE_PURPOSES, APP_ASSERTION_ERROR_CODES, APP_ASSERTION_PLATFORMS, OXY_APP_ASSERTION_AUDIENCE, OXY_APP_ASSERTION_HEADER, OXY_APP_ASSERTION_TTL_SECONDS, OXY_APP_ASSERTION_TYPE, appAssertionChallengeResponseCheck, appAssertionResponseCheck, appAttestKeyResponseCheck, } from './appAssertions';
|
|
49
51
|
export { APP_TOKEN_DEVICE_ACCESS_DENIED, DEVICE_APP_TOKEN_ERROR_CODES, DEVICE_APP_TOKEN_TTL_SECONDS, OXYOS_DESKTOP_ENTRY_ID_PATTERN, PLATFORM_HOSTS, deviceAppTokenResponseCheck, } from './platformSession';
|
|
50
52
|
export type { DeviceAppTokenErrorCode, DeviceAppTokenResponse, PlatformClient, PlatformHost, } from '../platformSession';
|
|
@@ -124,6 +124,19 @@ export declare const supervisionReviewInputCheck: Check<{
|
|
|
124
124
|
};
|
|
125
125
|
guardianAccountId?: string | undefined;
|
|
126
126
|
}>;
|
|
127
|
+
export declare const dateOfBirthCorrectionInputCheck: Check<{
|
|
128
|
+
accountId: string;
|
|
129
|
+
dateOfBirth: string;
|
|
130
|
+
evidenceReference: string;
|
|
131
|
+
reauth: {
|
|
132
|
+
password?: string | undefined;
|
|
133
|
+
emailCode?: {
|
|
134
|
+
verificationId: string;
|
|
135
|
+
code: string;
|
|
136
|
+
} | undefined;
|
|
137
|
+
totpCode?: string | undefined;
|
|
138
|
+
};
|
|
139
|
+
}>;
|
|
127
140
|
export declare const safetyPeopleInputCheck: Check<{
|
|
128
141
|
query: string;
|
|
129
142
|
} | {
|
|
@@ -41,6 +41,11 @@ export declare const resolveExternalIdentityResponseSchema: z.ZodObject<{
|
|
|
41
41
|
birthday: z.ZodOptional<z.ZodString>;
|
|
42
42
|
dateOfBirth: z.ZodOptional<z.ZodString>;
|
|
43
43
|
isAdult: z.ZodOptional<z.ZodBoolean>;
|
|
44
|
+
ageBand: z.ZodOptional<z.ZodEnum<{
|
|
45
|
+
under13: "under13";
|
|
46
|
+
teen: "teen";
|
|
47
|
+
adult: "adult";
|
|
48
|
+
}>>;
|
|
44
49
|
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
45
50
|
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
51
|
name: z.ZodType<import("./userResponse").UserNameResponse, unknown, z.core.$ZodTypeInternals<import("./userResponse").UserNameResponse, unknown>>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export type { AccountActorChain, AccountActorNature, FinancialEffectAttribution,
|
|
|
20
20
|
export { usernameSchema, usernameSchemaForAccountKind, isValidUsername, stripDisallowedUsernameCharacters, applyBotUsernameSuffix, USERNAME_MIN_LENGTH, USERNAME_MAX_LENGTH, USERNAME_INVALID_MESSAGE, BOT_USERNAME_INVALID_MESSAGE, RESERVED_USERNAME_MESSAGE, NUMERIC_USERNAME_MESSAGE, } from './username';
|
|
21
21
|
export { PRONOUNS, PROFILE_LINKS_MAX, PROFILE_LINK_TITLE_MAX } from './client/userResponse';
|
|
22
22
|
export type { Pronouns } from './client/userResponse';
|
|
23
|
+
export { ADULT_AGE_YEARS, AGE_BANDS, DATE_OF_BIRTH_MESSAGES, DATE_OF_BIRTH_PATTERN, DATE_OF_BIRTH_REFUSALS, MINIMUM_UNSUPERVISED_AGE_YEARS, MIN_BIRTH_YEAR, ageBandOf, ageInYears, isSelfServiceBandChange, } from './client/age';
|
|
24
|
+
export type { AgeBand, DateOfBirthRefusal } from './client/age';
|
|
23
25
|
export { userNameSchema, userRelationshipSchema, themePreferenceSchema, dateOfBirthSchema, userResponseSchema, userProfileUpdateSchema, currentUserResponseSchema, deviceLinkedSessionSchema, deviceLinkedSessionsResponseSchema, resolveUserId, safeParseContract, } from './userResponse';
|
|
24
26
|
export type { UserNameResponse, UserRelationship, ThemePreference, UserResponse, UserProfileUpdate, CurrentUserResponseContract, DeviceLinkedSessionResponse, DeviceLinkedSessionsResponseContract, } from './userResponse';
|
|
25
27
|
export { applicationTypeSchema, publicApplicationSchema, sessionStatusSchema, } from './sessionStatus';
|
|
@@ -63,8 +63,8 @@ export declare const embeddingFailureSchema: z.ZodObject<{
|
|
|
63
63
|
param: z.ZodOptional<z.ZodString>;
|
|
64
64
|
upstreamCategory: z.ZodOptional<z.ZodEnum<{
|
|
65
65
|
unknown: "unknown";
|
|
66
|
-
invalid_request: "invalid_request";
|
|
67
66
|
authentication: "authentication";
|
|
67
|
+
invalid_request: "invalid_request";
|
|
68
68
|
rate_limit: "rate_limit";
|
|
69
69
|
quota: "quota";
|
|
70
70
|
timeout: "timeout";
|
|
@@ -135,8 +135,8 @@ export declare const embeddingResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
135
135
|
param: z.ZodOptional<z.ZodString>;
|
|
136
136
|
upstreamCategory: z.ZodOptional<z.ZodEnum<{
|
|
137
137
|
unknown: "unknown";
|
|
138
|
-
invalid_request: "invalid_request";
|
|
139
138
|
authentication: "authentication";
|
|
139
|
+
invalid_request: "invalid_request";
|
|
140
140
|
rate_limit: "rate_limit";
|
|
141
141
|
quota: "quota";
|
|
142
142
|
timeout: "timeout";
|
|
@@ -138,8 +138,8 @@ export declare const safeErrorTextSchema: z.ZodString;
|
|
|
138
138
|
*/
|
|
139
139
|
export declare const upstreamErrorCategorySchema: z.ZodEnum<{
|
|
140
140
|
unknown: "unknown";
|
|
141
|
-
invalid_request: "invalid_request";
|
|
142
141
|
authentication: "authentication";
|
|
142
|
+
invalid_request: "invalid_request";
|
|
143
143
|
rate_limit: "rate_limit";
|
|
144
144
|
quota: "quota";
|
|
145
145
|
timeout: "timeout";
|
|
@@ -208,8 +208,8 @@ export declare const inferenceErrorSchema: z.ZodObject<{
|
|
|
208
208
|
param: z.ZodOptional<z.ZodString>;
|
|
209
209
|
upstreamCategory: z.ZodOptional<z.ZodEnum<{
|
|
210
210
|
unknown: "unknown";
|
|
211
|
-
invalid_request: "invalid_request";
|
|
212
211
|
authentication: "authentication";
|
|
212
|
+
invalid_request: "invalid_request";
|
|
213
213
|
rate_limit: "rate_limit";
|
|
214
214
|
quota: "quota";
|
|
215
215
|
timeout: "timeout";
|
|
@@ -179,8 +179,8 @@ export declare const inboxInferenceStreamEventSchema: z.ZodDiscriminatedUnion<[z
|
|
|
179
179
|
param: z.ZodOptional<z.ZodString>;
|
|
180
180
|
upstreamCategory: z.ZodOptional<z.ZodEnum<{
|
|
181
181
|
unknown: "unknown";
|
|
182
|
-
invalid_request: "invalid_request";
|
|
183
182
|
authentication: "authentication";
|
|
183
|
+
invalid_request: "invalid_request";
|
|
184
184
|
rate_limit: "rate_limit";
|
|
185
185
|
quota: "quota";
|
|
186
186
|
timeout: "timeout";
|
|
@@ -1502,8 +1502,8 @@ export declare const realtimeErrorEventSchema: z.ZodObject<{
|
|
|
1502
1502
|
param: z.ZodOptional<z.ZodString>;
|
|
1503
1503
|
upstreamCategory: z.ZodOptional<z.ZodEnum<{
|
|
1504
1504
|
unknown: "unknown";
|
|
1505
|
-
invalid_request: "invalid_request";
|
|
1506
1505
|
authentication: "authentication";
|
|
1506
|
+
invalid_request: "invalid_request";
|
|
1507
1507
|
rate_limit: "rate_limit";
|
|
1508
1508
|
quota: "quota";
|
|
1509
1509
|
timeout: "timeout";
|
|
@@ -2076,8 +2076,8 @@ export declare const realtimeServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
2076
2076
|
param: z.ZodOptional<z.ZodString>;
|
|
2077
2077
|
upstreamCategory: z.ZodOptional<z.ZodEnum<{
|
|
2078
2078
|
unknown: "unknown";
|
|
2079
|
-
invalid_request: "invalid_request";
|
|
2080
2079
|
authentication: "authentication";
|
|
2080
|
+
invalid_request: "invalid_request";
|
|
2081
2081
|
rate_limit: "rate_limit";
|
|
2082
2082
|
quota: "quota";
|
|
2083
2083
|
timeout: "timeout";
|
|
@@ -290,8 +290,8 @@ export declare const inferenceStreamErrorEventSchema: z.ZodObject<{
|
|
|
290
290
|
param: z.ZodOptional<z.ZodString>;
|
|
291
291
|
upstreamCategory: z.ZodOptional<z.ZodEnum<{
|
|
292
292
|
unknown: "unknown";
|
|
293
|
-
invalid_request: "invalid_request";
|
|
294
293
|
authentication: "authentication";
|
|
294
|
+
invalid_request: "invalid_request";
|
|
295
295
|
rate_limit: "rate_limit";
|
|
296
296
|
quota: "quota";
|
|
297
297
|
timeout: "timeout";
|
|
@@ -505,8 +505,8 @@ export declare const inferenceStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
505
505
|
param: z.ZodOptional<z.ZodString>;
|
|
506
506
|
upstreamCategory: z.ZodOptional<z.ZodEnum<{
|
|
507
507
|
unknown: "unknown";
|
|
508
|
-
invalid_request: "invalid_request";
|
|
509
508
|
authentication: "authentication";
|
|
509
|
+
invalid_request: "invalid_request";
|
|
510
510
|
rate_limit: "rate_limit";
|
|
511
511
|
quota: "quota";
|
|
512
512
|
timeout: "timeout";
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
*/
|
|
55
55
|
import { z } from 'zod';
|
|
56
56
|
export declare const oxySignedRecordTypeSchema: z.ZodEnum<{
|
|
57
|
-
credential: "credential";
|
|
58
57
|
identity: "identity";
|
|
59
58
|
profile: "profile";
|
|
59
|
+
credential: "credential";
|
|
60
60
|
reputation_attestation: "reputation_attestation";
|
|
61
61
|
real_life_attestation: "real_life_attestation";
|
|
62
62
|
validation_verdict: "validation_verdict";
|
package/dist/types/safety.d.ts
CHANGED
|
@@ -299,6 +299,8 @@ export declare const safetyRequesterSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
299
299
|
capabilityTicket: z.ZodString;
|
|
300
300
|
}, z.core.$strict>, z.ZodObject<{
|
|
301
301
|
requesterContext: z.ZodString;
|
|
302
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
303
|
+
actingForAccountId: z.ZodString;
|
|
302
304
|
}, z.core.$strict>]>;
|
|
303
305
|
export type SafetyRequester = z.infer<typeof safetyRequesterSchema>;
|
|
304
306
|
export type ProfileAccessBatchInput = z.infer<typeof profileAccessBatchInputSchema>;
|
|
@@ -630,6 +632,24 @@ export declare const supervisionReviewInputSchema: z.ZodObject<{
|
|
|
630
632
|
totpCode: z.ZodOptional<z.ZodString>;
|
|
631
633
|
}, z.core.$strict>;
|
|
632
634
|
}, z.core.$strict>;
|
|
635
|
+
/**
|
|
636
|
+
* `POST /safety/supervision/date-of-birth`: a staff member corrects an
|
|
637
|
+
* account's date of birth on reviewed evidence (ADR 0067). It is the only way
|
|
638
|
+
* a date moves to an OLDER age band; the person's own edits cannot.
|
|
639
|
+
*/
|
|
640
|
+
export declare const dateOfBirthCorrectionInputSchema: z.ZodObject<{
|
|
641
|
+
accountId: z.ZodString;
|
|
642
|
+
dateOfBirth: z.ZodString;
|
|
643
|
+
evidenceReference: z.ZodString;
|
|
644
|
+
reauth: z.ZodObject<{
|
|
645
|
+
password: z.ZodOptional<z.ZodString>;
|
|
646
|
+
emailCode: z.ZodOptional<z.ZodObject<{
|
|
647
|
+
verificationId: z.ZodString;
|
|
648
|
+
code: z.ZodString;
|
|
649
|
+
}, z.core.$strict>>;
|
|
650
|
+
totpCode: z.ZodOptional<z.ZodString>;
|
|
651
|
+
}, z.core.$strict>;
|
|
652
|
+
}, z.core.$strict>;
|
|
633
653
|
export declare const purchaseReviewInputSchema: z.ZodObject<{
|
|
634
654
|
decision: z.ZodEnum<{
|
|
635
655
|
approved: "approved";
|
|
@@ -649,6 +669,7 @@ export type SupervisionAcceptInput = z.infer<typeof supervisionAcceptInputSchema
|
|
|
649
669
|
export type SupervisionContactInput = z.infer<typeof supervisionContactInputSchema>;
|
|
650
670
|
export type SupervisionReviewInput = z.infer<typeof supervisionReviewInputSchema>;
|
|
651
671
|
export type PurchaseReviewInput = z.infer<typeof purchaseReviewInputSchema>;
|
|
672
|
+
export type DateOfBirthCorrectionInput = z.infer<typeof dateOfBirthCorrectionInputSchema>;
|
|
652
673
|
export declare const safetySessionInputSchema: z.ZodObject<{
|
|
653
674
|
sessionId: z.ZodString;
|
|
654
675
|
accessToken: z.ZodString;
|
|
@@ -675,6 +696,11 @@ export declare const safetySessionValidationSchema: z.ZodObject<{
|
|
|
675
696
|
birthday: z.ZodOptional<z.ZodString>;
|
|
676
697
|
dateOfBirth: z.ZodOptional<z.ZodString>;
|
|
677
698
|
isAdult: z.ZodOptional<z.ZodBoolean>;
|
|
699
|
+
ageBand: z.ZodOptional<z.ZodEnum<{
|
|
700
|
+
under13: "under13";
|
|
701
|
+
teen: "teen";
|
|
702
|
+
adult: "adult";
|
|
703
|
+
}>>;
|
|
678
704
|
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
679
705
|
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
680
706
|
name: z.ZodType<import("./userResponse").UserNameResponse, unknown, z.core.$ZodTypeInternals<import("./userResponse").UserNameResponse, unknown>>;
|