@oxy.so/contracts 5.2.0 → 5.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/accountGraph.js +8 -5
- package/dist/cjs/accountName.js +20 -0
- package/dist/cjs/accountSubject.js +4 -2
- package/dist/cjs/client/accountGraph.js +2 -0
- package/dist/cjs/client/accountName.js +56 -0
- package/dist/cjs/client/index.js +12 -4
- package/dist/cjs/client/organizations.js +5 -4
- package/dist/cjs/index.js +22 -15
- package/dist/cjs/organizations.js +3 -7
- package/dist/esm/accountGraph.js +9 -6
- package/dist/esm/accountName.js +12 -0
- package/dist/esm/accountSubject.js +4 -2
- package/dist/esm/client/accountGraph.js +2 -0
- package/dist/esm/client/accountName.js +51 -0
- package/dist/esm/client/index.js +1 -0
- package/dist/esm/client/organizations.js +5 -4
- package/dist/esm/index.js +1 -0
- package/dist/esm/organizations.js +4 -8
- package/dist/types/accountAccess.d.ts +5 -5
- package/dist/types/accountGraph.d.ts +12 -12
- package/dist/types/accountName.d.ts +5 -0
- package/dist/types/accountSubject.d.ts +3 -2
- package/dist/types/agency.d.ts +28 -28
- package/dist/types/client/accountGraph.d.ts +12 -6
- package/dist/types/client/accountName.d.ts +48 -0
- package/dist/types/client/deviceDirectory.d.ts +3 -3
- package/dist/types/client/index.d.ts +1 -0
- package/dist/types/client/organizations.d.ts +8 -7
- package/dist/types/client/safety.d.ts +2 -2
- package/dist/types/deviceDirectory.d.ts +33 -33
- package/dist/types/externalIdentity.d.ts +14 -14
- package/dist/types/index.d.ts +2 -0
- package/dist/types/inference/economics.d.ts +2 -2
- package/dist/types/inference/providerConnection.d.ts +4 -4
- package/dist/types/notifications.d.ts +4 -4
- package/dist/types/organizations.d.ts +41 -40
- package/dist/types/safety.d.ts +22 -22
- package/dist/types/stickers.d.ts +9 -9
- package/dist/types/userResponse.d.ts +42 -42
- package/package.json +1 -1
package/dist/cjs/accountGraph.js
CHANGED
|
@@ -11,6 +11,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
11
11
|
exports.createAccountRequestSchema = exports.accountNameSchema = exports.accountCategoriesSchema = exports.accountCategoryIdSchema = exports.childAccountKindSchema = exports.accountKindSchema = exports.kindAcceptsAccountCategories = exports.ACCOUNT_CATEGORY_KINDS = exports.MAX_ACCOUNT_CATEGORIES = exports.newlyAddedRetiredCategories = exports.SELECTABLE_ACCOUNT_CATEGORY_IDS = exports.isSelectableAccountCategoryId = exports.RETIRED_ACCOUNT_CATEGORY_IDS = exports.ACCOUNT_CATEGORY_IDS = exports.isAccountKind = exports.isOperatorSwitchTargetKind = exports.isDelegatedActAsEligibleKind = exports.CHILD_ACCOUNT_KINDS = exports.ACCOUNT_KINDS = void 0;
|
|
12
12
|
const zod_1 = require("zod");
|
|
13
13
|
const avatarCharacter_1 = require("./avatarCharacter");
|
|
14
|
+
const accountName_1 = require("./accountName");
|
|
15
|
+
const accountName_2 = require("./client/accountName");
|
|
14
16
|
const organizations_1 = require("./organizations");
|
|
15
17
|
const username_1 = require("./username");
|
|
16
18
|
// The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
|
|
@@ -85,7 +87,7 @@ exports.accountNameSchema = zod_1.z
|
|
|
85
87
|
.object({
|
|
86
88
|
first: zod_1.z.string().trim().max(100).optional(),
|
|
87
89
|
last: zod_1.z.string().trim().max(100).optional(),
|
|
88
|
-
displayName: zod_1.z.string().trim().max(
|
|
90
|
+
displayName: zod_1.z.string().trim().max(accountName_2.ACCOUNT_TITLE_MAX_LENGTH).optional(),
|
|
89
91
|
})
|
|
90
92
|
.optional();
|
|
91
93
|
/**
|
|
@@ -97,7 +99,7 @@ exports.accountNameSchema = zod_1.z
|
|
|
97
99
|
* this route. The refinement the single-valued predecessor needed disappeared
|
|
98
100
|
* along with the restriction that made it necessary. A child kind that does NOT
|
|
99
101
|
* accept categories would break that reasoning silently, so
|
|
100
|
-
* `__tests__/accountGraph.test.ts` asserts
|
|
102
|
+
* `__tests__/accountGraph.test.ts` asserts every child kind is a category kind.
|
|
101
103
|
*/
|
|
102
104
|
exports.createAccountRequestSchema = zod_1.z
|
|
103
105
|
.object({
|
|
@@ -198,9 +200,10 @@ exports.createAccountRequestSchema = zod_1.z
|
|
|
198
200
|
}
|
|
199
201
|
const displayName = request.name?.displayName;
|
|
200
202
|
if (displayName) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
// A child kind is never `personal`, so every child is named by the
|
|
204
|
+
// title policy; the person policy's character classes live in
|
|
205
|
+
// `@oxy.so/core`, which this package cannot import.
|
|
206
|
+
const parsedName = accountName_1.accountTitleSchema.safeParse(displayName);
|
|
204
207
|
if (!parsedName.success) {
|
|
205
208
|
for (const issue of parsedName.error.issues) {
|
|
206
209
|
ctx.addIssue({ ...issue, path: ['name', 'displayName', ...issue.path] });
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.accountTitleSchema = exports.isPlainTextTitle = exports.accountNamePolicyForKind = exports.ACCOUNT_TITLE_MAX_LENGTH = exports.ACCOUNT_TITLE_DISALLOWED_SOURCE = exports.ACCOUNT_NAME_POLICY_BY_KIND = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
|
|
6
|
+
// it is re-exported here so the root entry carries the whole policy.
|
|
7
|
+
const accountName_1 = require("./client/accountName");
|
|
8
|
+
var accountName_2 = require("./client/accountName");
|
|
9
|
+
Object.defineProperty(exports, "ACCOUNT_NAME_POLICY_BY_KIND", { enumerable: true, get: function () { return accountName_2.ACCOUNT_NAME_POLICY_BY_KIND; } });
|
|
10
|
+
Object.defineProperty(exports, "ACCOUNT_TITLE_DISALLOWED_SOURCE", { enumerable: true, get: function () { return accountName_2.ACCOUNT_TITLE_DISALLOWED_SOURCE; } });
|
|
11
|
+
Object.defineProperty(exports, "ACCOUNT_TITLE_MAX_LENGTH", { enumerable: true, get: function () { return accountName_2.ACCOUNT_TITLE_MAX_LENGTH; } });
|
|
12
|
+
Object.defineProperty(exports, "accountNamePolicyForKind", { enumerable: true, get: function () { return accountName_2.accountNamePolicyForKind; } });
|
|
13
|
+
Object.defineProperty(exports, "isPlainTextTitle", { enumerable: true, get: function () { return accountName_2.isPlainTextTitle; } });
|
|
14
|
+
/** A non-personal account's title — see `./client/accountName.ts` for the policy. */
|
|
15
|
+
exports.accountTitleSchema = zod_1.z
|
|
16
|
+
.string()
|
|
17
|
+
.trim()
|
|
18
|
+
.min(1)
|
|
19
|
+
.max(accountName_1.ACCOUNT_TITLE_MAX_LENGTH)
|
|
20
|
+
.refine(accountName_1.isPlainTextTitle, 'Name must be plain text');
|
|
@@ -51,8 +51,9 @@ exports.ACCOUNT_SUBJECT_CONTRACT_VERSION = 1;
|
|
|
51
51
|
* - `person` — a human; a personal account is its own actor.
|
|
52
52
|
* - `agent` — an AI agent; a bot is its own actor (ADR 0018 `ActorRef`
|
|
53
53
|
* `{type:'agent'}`), and audit records the bot, never the human who owns it.
|
|
54
|
-
* - `operated` — never its own actor. An organization, project
|
|
55
|
-
* acts through a member, and that
|
|
54
|
+
* - `operated` — never its own actor. An organization, project, channel or
|
|
55
|
+
* community only acts through a member (a community's moderators), and that
|
|
56
|
+
* member is the actor.
|
|
56
57
|
*/
|
|
57
58
|
exports.ACCOUNT_ACTOR_NATURES = ['person', 'agent', 'operated'];
|
|
58
59
|
exports.accountActorNatureSchema = zod_1.z.enum(exports.ACCOUNT_ACTOR_NATURES);
|
|
@@ -66,6 +67,7 @@ const ACTOR_NATURE_BY_KIND = {
|
|
|
66
67
|
organization: 'operated',
|
|
67
68
|
project: 'operated',
|
|
68
69
|
channel: 'operated',
|
|
70
|
+
community: 'operated',
|
|
69
71
|
};
|
|
70
72
|
/** `null` for a value that is not an account kind. Never a guess. */
|
|
71
73
|
function accountKindActorNature(kind) {
|
|
@@ -30,6 +30,7 @@ exports.ACCOUNT_KINDS = [
|
|
|
30
30
|
'project',
|
|
31
31
|
'bot',
|
|
32
32
|
'channel',
|
|
33
|
+
'community',
|
|
33
34
|
];
|
|
34
35
|
exports.CHILD_ACCOUNT_KINDS = [
|
|
35
36
|
'organization',
|
|
@@ -310,6 +311,7 @@ exports.ACCOUNT_CATEGORY_KINDS = [
|
|
|
310
311
|
'project',
|
|
311
312
|
'bot',
|
|
312
313
|
'channel',
|
|
314
|
+
'community',
|
|
313
315
|
];
|
|
314
316
|
/**
|
|
315
317
|
* Whether an account of this kind may carry categories.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The account-name policy, without Zod. Schema: `../accountName.ts`.
|
|
4
|
+
*
|
|
5
|
+
* Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
|
|
6
|
+
*
|
|
7
|
+
* An account's name follows ONE of two policies, chosen by its `kind` and by
|
|
8
|
+
* nothing else — not by which route wrote it, nor by whether it is native or
|
|
9
|
+
* federated:
|
|
10
|
+
*
|
|
11
|
+
* - `person`: a human name. Letters of the allowlisted scripts, combining
|
|
12
|
+
* marks, spaces, the apostrophe and letter-flanked name separators; no
|
|
13
|
+
* digits. The character classes are generated data and live in
|
|
14
|
+
* `@oxy.so/core` (`isValidDisplayName`), which applies this table through
|
|
15
|
+
* `isValidAccountName`.
|
|
16
|
+
* - `title`: what an organization, project, bot, channel or community is called. Plain
|
|
17
|
+
* text — digits and punctuation are part of real titles ("Studio 54",
|
|
18
|
+
* "Blink-182") — without markup or control characters. Defined here, once.
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.accountTitleCheck = exports.ACCOUNT_TITLE_DISALLOWED_SOURCE = exports.ACCOUNT_TITLE_MAX_LENGTH = exports.ACCOUNT_NAME_POLICY_BY_KIND = void 0;
|
|
22
|
+
exports.accountNamePolicyForKind = accountNamePolicyForKind;
|
|
23
|
+
exports.isPlainTextTitle = isPlainTextTitle;
|
|
24
|
+
const check_1 = require("./check");
|
|
25
|
+
/**
|
|
26
|
+
* The policy for each kind. A `Record` over the whole union, so adding a kind
|
|
27
|
+
* fails this file's typecheck until someone decides how it is named.
|
|
28
|
+
*/
|
|
29
|
+
exports.ACCOUNT_NAME_POLICY_BY_KIND = {
|
|
30
|
+
personal: 'person',
|
|
31
|
+
organization: 'title',
|
|
32
|
+
project: 'title',
|
|
33
|
+
bot: 'title',
|
|
34
|
+
channel: 'title',
|
|
35
|
+
community: 'title',
|
|
36
|
+
};
|
|
37
|
+
/** A missing kind is `personal`, the `users.kind` column default. */
|
|
38
|
+
function accountNamePolicyForKind(kind) {
|
|
39
|
+
return exports.ACCOUNT_NAME_POLICY_BY_KIND[kind ?? 'personal'];
|
|
40
|
+
}
|
|
41
|
+
/** Longest title, in UTF-16 code units after trimming. */
|
|
42
|
+
exports.ACCOUNT_TITLE_MAX_LENGTH = 300;
|
|
43
|
+
/**
|
|
44
|
+
* Source of the characters a title may not contain: `<`, `>`, the C0 controls
|
|
45
|
+
* and DEL. A class of literal code points — no property escapes — so it
|
|
46
|
+
* compiles on Hermes. The probe below rejects with it; the API compiles it with
|
|
47
|
+
* `g` to strip untrusted titles, so the gate and the strip cannot disagree.
|
|
48
|
+
*/
|
|
49
|
+
exports.ACCOUNT_TITLE_DISALLOWED_SOURCE = '[<>\\u0000-\\u001F\\u007F]';
|
|
50
|
+
const TITLE_DISALLOWED_PROBE = new RegExp(exports.ACCOUNT_TITLE_DISALLOWED_SOURCE, 'u');
|
|
51
|
+
/** Whether `value` holds no character the title policy disallows. */
|
|
52
|
+
function isPlainTextTitle(value) {
|
|
53
|
+
return !TITLE_DISALLOWED_PROBE.test(value);
|
|
54
|
+
}
|
|
55
|
+
/** The twin of `accountTitleSchema`. */
|
|
56
|
+
exports.accountTitleCheck = (0, check_1.refine)((0, check_1.string)(check_1.trim, (0, check_1.minLength)(1), (0, check_1.maxLength)(exports.ACCOUNT_TITLE_MAX_LENGTH)), isPlainTextTitle, 'Name must be plain text');
|
package/dist/cjs/client/index.js
CHANGED
|
@@ -30,10 +30,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
30
30
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
33
|
+
exports.deviceActivateResponseCheck = exports.signedRecordEnvelopeCheck = exports.externalIdentityReferenceCheck = exports.loginResultCheck = exports.isLoopbackOrigin = exports.executeAgentKeyOperationCheck = exports.agentVerifyRequestCheck = exports.agentProofClaimsCheck = exports.agentKeyOperationResultCheck = exports.agentKeyOperationCheck = exports.agentKeyOperationChallengeCheck = exports.agentKeyListResponseCheck = exports.agentChallengeRequestCheck = exports.AGENT_PROOF_TTL_MS = exports.AGENT_PROOF_AUDIENCE = exports.AGENT_PROOF_ACTIONS = exports.ACCOUNT_AUTH_METHODS = exports.emailVerificationStartResponseCheck = exports.emailVerificationConfirmResponseCheck = exports.emailTicketCheck = exports.emailAddressCheck = exports.EMAIL_VERIFICATION_PURPOSES = exports.EMAIL_VERIFICATION_ERROR_CODES = exports.EMAIL_TICKET_TTL_MS = exports.EMAIL_CODE_TTL_MS = exports.EMAIL_CODE_MAX_ATTEMPTS = exports.EMAIL_CODE_LENGTH = exports.isPlainTextTitle = exports.accountTitleCheck = exports.accountNamePolicyForKind = exports.ACCOUNT_TITLE_MAX_LENGTH = exports.ACCOUNT_TITLE_DISALLOWED_SOURCE = exports.ACCOUNT_NAME_POLICY_BY_KIND = exports.newlyAddedRetiredCategories = exports.kindAcceptsAccountCategories = exports.isSelectableAccountCategoryId = exports.isOperatorSwitchTargetKind = exports.isDelegatedActAsEligibleKind = exports.isAccountKind = exports.SELECTABLE_ACCOUNT_CATEGORY_IDS = exports.RETIRED_ACCOUNT_CATEGORY_IDS = exports.MAX_ACCOUNT_CATEGORIES = exports.CHILD_ACCOUNT_KINDS = exports.ACCOUNT_KINDS = exports.ACCOUNT_CATEGORY_KINDS = exports.ACCOUNT_CATEGORY_IDS = exports.parseContract = exports.formatCheckPath = exports.checkContract = exports.ContractCheckError = void 0;
|
|
34
|
+
exports.cancelProductSubscriptionCheck = exports.updateOrganizationCheck = exports.organizationNameCheck = exports.organizationListCheck = exports.organizationImportBatchResultCheck = exports.organizationExternalResolutionCheck = exports.organizationExternalCheck = exports.organizationCurationResultCheck = exports.organizationClaimReviewCheck = exports.organizationClaimListCheck = exports.organizationClaimInputCheck = exports.organizationClaimDetailCheck = exports.organizationClaimCheck = exports.organizationCheck = exports.organizationBatchCheck = exports.createOrganizationCheck = exports.ORGANIZATION_TYPES = exports.ORGANIZATION_STATUSES = exports.ORGANIZATION_NAME_MAX_LENGTH = exports.ORGANIZATION_ERROR_CODES = exports.ORGANIZATION_CLAIM_STATUSES = exports.ORGANIZATION_CLAIM_DECISIONS = exports.ORGANIZATION_ALIAS_KINDS = exports.canonicalJson = exports.buildIdentityProofMessage = exports.IDENTITY_PROOF_VERSION = exports.IDENTITY_PROOF_DOMAIN = exports.IDENTITY_PROOF_CHALLENGE_TTL_MS = exports.IDENTITY_PROOF_AUDIENCE = exports.IDENTITY_PROOF_ACTION_VALUES = exports.IDENTITY_PROOF_ACTIONS = exports.IDENTITY_ERROR_CODES = exports.parseIdentityLinkQrPayload = exports.identityLinkStateCheck = exports.identityLinkCreateResponseCheck = exports.buildIdentityLinkQrPayload = exports.IDENTITY_LINK_STATUSES = exports.IDENTITY_LINK_QR_PREFIX = exports.sessionAccountsChangedEventCheck = exports.deviceTokenMintResponseCheck = exports.deviceSessionSyncCheck = exports.deviceSessionStateCheck = exports.deviceRegisterResponseCheck = exports.deviceJoinResponseCheck = exports.deviceJoinCodeResponseCheck = exports.deviceBackgroundCredentialResponseCheck = exports.activeTokenCheck = exports.SESSION_ACCOUNTS_CHANGED_EVENT = exports.deviceDirectorySyncCheck = exports.deviceDirectoryCheck = void 0;
|
|
35
|
+
exports.TOTP_PERIOD_SECONDS = exports.TOTP_DIGITS = exports.TOTP_BACKUP_CODE_COUNT = exports.SIGN_IN_ERROR_CODES = exports.SIGNIN_SECOND_FACTOR_TTL_MS = exports.SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS = exports.REAUTH_ACTIONS = exports.PASSWORD_MIN_LENGTH = exports.PASSWORD_MAX_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_ALPHABET = exports.EMAIL_SIGNIN_LINK_TTL_MS = exports.EMAIL_SIGNIN_CHOICE_TTL_MS = exports.EMAIL_ACCOUNTS_MAX = exports.publicApplicationCheck = exports.supervisionStateCheck = exports.supervisionReviewInputCheck = exports.supervisionInviteInputCheck = exports.supervisionInvitationCheck = exports.supervisionContactsResponseCheck = exports.supervisionContactInputCheck = exports.supervisionAcceptInputCheck = exports.safetyPeopleResponseCheck = exports.safetyPeopleInputCheck = exports.safetyOrganizationsResponseCheck = exports.safetyOrganizationsInputCheck = exports.purchaseReviewInputCheck = exports.purchaseApprovalListCheck = exports.purchaseApprovalCheck = exports.profileAccessInputCheck = exports.profileAccessDecisionCheck = exports.SUPERVISION_STATUSES = exports.SUPERVISION_INVITATION_STATUSES = exports.SUPERVISION_CONSENT_VERSION = exports.SUPERVISED_ACTIONS = exports.SAFETY_POLICY_VERSION = exports.PURCHASE_APPROVAL_STATUSES = exports.isFullReputationBalance = exports.recommendationRequestCheck = exports.subscriptionCreditGrantsResponseCheck = exports.subjectProductAccessQueryCheck = exports.subjectProductAccessCheck = exports.productSubscriptionsResponseCheck = exports.productSubscriptionRenewalRequestCheck = exports.productSubscriptionCancellationResultCheck = exports.productPlanCheckoutRequestCheck = exports.productPlanCatalogueCheck = exports.personalPlanCheckoutResultCheck = exports.personalPlanCheckoutRequestCheck = exports.personalPlanCatalogueCheck = void 0;
|
|
36
|
+
exports.appAssertionResponseCheck = exports.appAssertionChallengeResponseCheck = exports.OXY_APP_ASSERTION_TYPE = exports.OXY_APP_ASSERTION_TTL_SECONDS = exports.OXY_APP_ASSERTION_HEADER = exports.OXY_APP_ASSERTION_AUDIENCE = exports.APP_ASSERTION_PLATFORMS = exports.APP_ASSERTION_ERROR_CODES = exports.APP_ASSERTION_CHALLENGE_PURPOSES = exports.isRightsClaim = exports.isErasureRequest = exports.OPEN_CONTENT_CLAIM_STATES = exports.ERASURE_REQUEST_DEADLINE_DAYS = exports.COUNTER_NOTICE_STATEMENTS = exports.COUNTER_NOTICE_STATEMENT_VERSION = exports.CONTENT_CLAIM_STATES = exports.CONTENT_CLAIM_REFERENCE_PATTERN = exports.CONTENT_CLAIM_LIMITS = exports.CONTENT_CLAIM_KINDS = exports.CONTENT_CLAIM_ERROR_CODES = exports.CONTENT_CLAIM_COUNTER_NOTICE_LIMITS = exports.CLOSED_CONTENT_CLAIM_STATES = exports.CLAIMANT_RELATIONSHIPS = exports.userNameCheck = exports.usernameCheckForAccountKind = exports.usernameCheck = exports.stripDisallowedUsernameCharacters = exports.botUsernameCheck = exports.applyBotUsernameSuffix = exports.USERNAME_PATTERN_SOURCE = exports.USERNAME_MIN_LENGTH = exports.USERNAME_MAX_LENGTH = exports.USERNAME_INVALID_MESSAGE = exports.RESERVED_USERNAME_MESSAGE = exports.RESERVED_USERNAMES = exports.NUMERIC_USERNAME_MESSAGE = exports.BOT_USERNAME_SUFFIX = exports.BOT_USERNAME_INVALID_MESSAGE = exports.totpEnrollResponseCheck = exports.totpBackupCodesResponseCheck = exports.signInMethodsCheck = exports.secondFactorRequiredCheck = exports.reauthProofCheck = exports.normalizeEmailSignInCode = exports.isSecondFactorRequired = exports.isEmailSignInChooseAccount = exports.emailSignInStartResponseCheck = exports.emailSignInPendingCheck = exports.emailSignInLinkResponseCheck = exports.emailSignInChooseAccountCheck = void 0;
|
|
37
|
+
exports.appAttestKeyResponseCheck = void 0;
|
|
37
38
|
var check_1 = require("./check");
|
|
38
39
|
Object.defineProperty(exports, "ContractCheckError", { enumerable: true, get: function () { return check_1.ContractCheckError; } });
|
|
39
40
|
Object.defineProperty(exports, "checkContract", { enumerable: true, get: function () { return check_1.checkContract; } });
|
|
@@ -53,6 +54,13 @@ Object.defineProperty(exports, "isOperatorSwitchTargetKind", { enumerable: true,
|
|
|
53
54
|
Object.defineProperty(exports, "isSelectableAccountCategoryId", { enumerable: true, get: function () { return accountGraph_1.isSelectableAccountCategoryId; } });
|
|
54
55
|
Object.defineProperty(exports, "kindAcceptsAccountCategories", { enumerable: true, get: function () { return accountGraph_1.kindAcceptsAccountCategories; } });
|
|
55
56
|
Object.defineProperty(exports, "newlyAddedRetiredCategories", { enumerable: true, get: function () { return accountGraph_1.newlyAddedRetiredCategories; } });
|
|
57
|
+
var accountName_1 = require("./accountName");
|
|
58
|
+
Object.defineProperty(exports, "ACCOUNT_NAME_POLICY_BY_KIND", { enumerable: true, get: function () { return accountName_1.ACCOUNT_NAME_POLICY_BY_KIND; } });
|
|
59
|
+
Object.defineProperty(exports, "ACCOUNT_TITLE_DISALLOWED_SOURCE", { enumerable: true, get: function () { return accountName_1.ACCOUNT_TITLE_DISALLOWED_SOURCE; } });
|
|
60
|
+
Object.defineProperty(exports, "ACCOUNT_TITLE_MAX_LENGTH", { enumerable: true, get: function () { return accountName_1.ACCOUNT_TITLE_MAX_LENGTH; } });
|
|
61
|
+
Object.defineProperty(exports, "accountNamePolicyForKind", { enumerable: true, get: function () { return accountName_1.accountNamePolicyForKind; } });
|
|
62
|
+
Object.defineProperty(exports, "accountTitleCheck", { enumerable: true, get: function () { return accountName_1.accountTitleCheck; } });
|
|
63
|
+
Object.defineProperty(exports, "isPlainTextTitle", { enumerable: true, get: function () { return accountName_1.isPlainTextTitle; } });
|
|
56
64
|
var accountEmail_1 = require("./accountEmail");
|
|
57
65
|
Object.defineProperty(exports, "EMAIL_CODE_LENGTH", { enumerable: true, get: function () { return accountEmail_1.EMAIL_CODE_LENGTH; } });
|
|
58
66
|
Object.defineProperty(exports, "EMAIL_CODE_MAX_ATTEMPTS", { enumerable: true, get: function () { return accountEmail_1.EMAIL_CODE_MAX_ATTEMPTS; } });
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.organizationCurationResultCheck = exports.organizationExternalResolutionCheck = exports.organizationExternalCheck = exports.organizationImportBatchResultCheck = exports.organizationClaimReviewCheck = exports.organizationClaimListCheck = exports.organizationClaimDetailCheck = exports.organizationClaimCheck = exports.organizationClaimInputCheck = exports.organizationBatchCheck = exports.organizationListCheck = exports.organizationCheck = exports.updateOrganizationCheck = exports.createOrganizationCheck = exports.organizationNameCheck = exports.ORGANIZATION_ERROR_CODES = exports.ORGANIZATION_NAME_MAX_LENGTH = exports.ORGANIZATION_CLAIM_DECISIONS = exports.ORGANIZATION_ALIAS_KINDS = exports.ORGANIZATION_CLAIM_STATUSES = exports.ORGANIZATION_STATUSES = exports.ORGANIZATION_TYPES = void 0;
|
|
9
|
+
const accountName_1 = require("./accountName");
|
|
9
10
|
const check_1 = require("./check");
|
|
10
11
|
/** Real-world identity classification, independent of account topics and permissions. */
|
|
11
12
|
exports.ORGANIZATION_TYPES = [
|
|
@@ -25,7 +26,8 @@ exports.ORGANIZATION_ALIAS_KINDS = [
|
|
|
25
26
|
'misspelling',
|
|
26
27
|
];
|
|
27
28
|
exports.ORGANIZATION_CLAIM_DECISIONS = ['pending', 'approved', 'rejected'];
|
|
28
|
-
|
|
29
|
+
/** An organization's name is a title; the cap is the title policy's. */
|
|
30
|
+
exports.ORGANIZATION_NAME_MAX_LENGTH = accountName_1.ACCOUNT_TITLE_MAX_LENGTH;
|
|
29
31
|
exports.ORGANIZATION_ERROR_CODES = [
|
|
30
32
|
'bad_request',
|
|
31
33
|
'unauthorized',
|
|
@@ -50,9 +52,8 @@ const organizationAlias = (0, check_1.strictObject)({
|
|
|
50
52
|
kind: (0, check_1.oneOf)(exports.ORGANIZATION_ALIAS_KINDS),
|
|
51
53
|
language: (0, check_1.optional)((0, check_1.string)((0, check_1.minLength)(2), (0, check_1.maxLength)(35))),
|
|
52
54
|
});
|
|
53
|
-
/** The twin of `organizationNameSchema
|
|
54
|
-
exports.organizationNameCheck =
|
|
55
|
-
Array.from(value).every((character) => character.charCodeAt(0) >= 32 && character.charCodeAt(0) !== 127), 'Organization name must be plain text');
|
|
55
|
+
/** The twin of `organizationNameSchema`: the title policy (`./accountName.ts`). */
|
|
56
|
+
exports.organizationNameCheck = accountName_1.accountTitleCheck;
|
|
56
57
|
const organizationFields = {
|
|
57
58
|
name: exports.organizationNameCheck,
|
|
58
59
|
organizationType: (0, check_1.oneOf)(exports.ORGANIZATION_TYPES),
|
package/dist/cjs/index.js
CHANGED
|
@@ -25,21 +25,21 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
25
25
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.FREE_USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLORS = void 0;
|
|
28
|
+
exports.USERNAME_INVALID_MESSAGE = exports.USERNAME_MAX_LENGTH = exports.USERNAME_MIN_LENGTH = exports.applyBotUsernameSuffix = exports.stripDisallowedUsernameCharacters = exports.isValidUsername = exports.usernameSchemaForAccountKind = exports.usernameSchema = exports.financialEffectAttributionSchema = exports.attributeFinancialEffect = exports.accountKindActsAsItself = exports.accountKindActorNature = exports.accountActorNatureSchema = exports.accountActorChainSchema = exports.accountActorChainFromSession = exports.KIND_INDEPENDENT_ACCOUNT_DIMENSIONS = exports.FINANCIAL_EFFECT_DIRECTIONS = exports.ACCOUNT_SUBJECT_CONTRACT_VERSION = exports.ACCOUNT_ACTOR_NATURES = exports.parseAvatarCharacter = exports.avatarCharacterSchema = exports.avatarCharacterFor = exports.AVATAR_PICKABLE_SHAPES = exports.AVATAR_PICKABLE_COLORS = exports.AVATAR_EYE_SPACING = exports.isPlainTextTitle = exports.accountTitleSchema = exports.accountNamePolicyForKind = exports.ACCOUNT_TITLE_MAX_LENGTH = exports.ACCOUNT_TITLE_DISALLOWED_SOURCE = exports.ACCOUNT_NAME_POLICY_BY_KIND = exports.accountNameSchema = exports.createAccountRequestSchema = exports.SELECTABLE_ACCOUNT_CATEGORY_IDS = exports.RETIRED_ACCOUNT_CATEGORY_IDS = exports.newlyAddedRetiredCategories = exports.MAX_ACCOUNT_CATEGORIES = exports.kindAcceptsAccountCategories = exports.isSelectableAccountCategoryId = exports.accountCategoryIdSchema = exports.accountCategoriesSchema = exports.ACCOUNT_CATEGORY_KINDS = exports.ACCOUNT_CATEGORY_IDS = exports.isOperatorSwitchTargetKind = exports.isDelegatedActAsEligibleKind = exports.isAccountKind = exports.childAccountKindSchema = exports.CHILD_ACCOUNT_KINDS = exports.accountKindSchema = exports.ACCOUNT_KINDS = void 0;
|
|
29
|
+
exports.domainVerificationInstructionsSchema = exports.resourceDomainOwnershipResponseSchema = exports.resourceDomainOwnershipRequestSchema = exports.domainVerificationRequestSchema = exports.verifiedDomainSchema = exports.signedRecordEnvelopeSchema = exports.didDocumentSchema = exports.didServiceSchema = exports.verificationMethodSchema = exports.appAffinityEventsIngestSchema = exports.appAffinityEventSchema = exports.appAffinityEventTypeSchema = exports.appUserSignalIngestSchema = exports.appInterestInputSchema = exports.appEndorsementInputSchema = exports.recommendationResponseSchema = exports.recommendationItemSchema = exports.recommendationCountSchema = exports.recommendationRequestSchema = exports.recommendationSignalWeightsSchema = exports.recommendationBoostSchema = exports.recommendationExcludeTypeSchema = exports.oxyUserInvalidationEventSchema = exports.isPublishedOxyUserChangeReason = exports.OXY_PUBLISHED_USER_CHANGE_REASONS = exports.OXY_USER_CHANGE_REASONS = exports.OXY_USER_INVALIDATION_CHANNEL = exports.inboxEmailPushDataSchema = exports.INBOX_EMAIL_PUSH_TYPE = exports.INBOX_EMAIL_PUSH_CHANNEL = exports.IDENTITY_APPROVAL_PUSH_CHANNEL = exports.commonsDenyReasonSchema = exports.COMMONS_DENY_REASONS = exports.sessionStatusSchema = exports.publicApplicationSchema = exports.applicationTypeSchema = exports.safeParseContract = exports.resolveUserId = exports.deviceLinkedSessionsResponseSchema = exports.deviceLinkedSessionSchema = exports.currentUserResponseSchema = exports.userProfileUpdateSchema = exports.userResponseSchema = exports.dateOfBirthSchema = exports.themePreferenceSchema = exports.userRelationshipSchema = exports.userNameSchema = exports.NUMERIC_USERNAME_MESSAGE = exports.RESERVED_USERNAME_MESSAGE = exports.BOT_USERNAME_INVALID_MESSAGE = void 0;
|
|
30
|
+
exports.reputationInfluenceResultSchema = exports.reputationLeaderboardEntrySchema = exports.reputationLeaderboardUserSchema = exports.reputationRulesResponseSchema = exports.reputationRuleSchema = exports.reputationBalanceSchema = exports.reputationBalanceSummarySchema = exports.reputationReliabilitySchema = exports.reputationInfluenceSchema = exports.reputationBalanceBreakdownSchema = exports.reputationTransactionSchema = exports.reputationInfluenceContextSchema = exports.reputationTargetEntityTypeSchema = exports.trustTierSchema = exports.reputationTransactionStatusSchema = exports.reputationCategorySchema = exports.REPUTATION_INFLUENCE_CONTEXTS = exports.REPUTATION_TARGET_ENTITY_TYPES = exports.TRUST_TIERS = exports.REPUTATION_TRANSACTION_STATUSES = exports.REPUTATION_CATEGORIES = exports.credentialVerifyResultSchema = exports.credentialListResultSchema = exports.credentialIssueResultSchema = exports.verifiableCredentialResponseSchema = exports.credentialRecordSchema = exports.vouchResultSchema = exports.personhoodStatusResultSchema = exports.personhoodBreakdownSchema = exports.personhoodVouchRecordSchema = exports.validationVoteResultSchema = exports.validationRequestSummarySchema = exports.validationOpenResultSchema = exports.validationOpenRequestSchema = exports.validationVerdictRecordSchema = exports.realLifeAttestationResultSchema = exports.realLifeAttestationRecordSchema = exports.signedPublicCardSchema = exports.publicCardSchema = exports.logPageResponseSchema = exports.chainHeadResponseSchema = exports.oxySignedRecordTypeSchema = exports.exportBundleSchema = exports.exportFinancialSectionSchema = exports.exportUsageReservationSchema = exports.exportLedgerEntrySchema = exports.exportUsageReceiptSchema = exports.exportAttestationSchema = exports.authMethodsResponseSchema = exports.authMethodEntrySchema = void 0;
|
|
31
|
+
exports.deviceSessionStateSchema = exports.sessionAccountSchema = 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.applicationModerationStandingSchema = exports.identityBindingStatusSchema = exports.identityBindingTypeSchema = exports.personhoodStatusSchema = exports.contributionTierSchema = exports.conductStandingSchema = exports.conductStrikeStatusSchema = exports.moderationEffectSkipReasonSchema = exports.moderationEffectStatusSchema = exports.moderationEffectTypeSchema = exports.moderationDecisionStatusSchema = exports.moderationAttributionSchema = exports.moderationFindingScopeSchema = exports.moderationSeveritySchema = exports.APPLICATION_MODERATION_STANDINGS = exports.IDENTITY_BINDING_STATUSES = exports.IDENTITY_BINDING_TYPES = exports.PERSONHOOD_STATUSES = exports.CONTRIBUTION_TIERS = exports.CONDUCT_STANDINGS = exports.CONDUCT_STRIKE_STATUSES = exports.MODERATION_EFFECT_SKIP_REASONS = exports.MODERATION_EFFECT_STATUSES = exports.MODERATION_EFFECT_TYPES = exports.MODERATION_DECISION_STATUSES = exports.MODERATION_ATTRIBUTIONS = exports.MODERATION_FINDING_SCOPES = exports.MODERATION_SEVERITIES = exports.isFullReputationBalance = exports.awardReputationSchema = void 0;
|
|
32
|
+
exports.identityProofChallengeRequestSchema = exports.identityProofSchema = exports.buildIdentityProofMessage = exports.canonicalJson = exports.IDENTITY_ERROR_CODES = exports.IDENTITY_PROOF_ACTION_VALUES = exports.IDENTITY_PROOF_ACTIONS = exports.IDENTITY_PROOF_CHALLENGE_TTL_MS = exports.IDENTITY_PROOF_AUDIENCE = exports.IDENTITY_PROOF_DOMAIN = exports.IDENTITY_PROOF_VERSION = exports.backupStatusResponseSchema = exports.backupUploadRequestSchema = exports.encryptedBackupEnvelopeSchema = exports.backupLookupIdSchema = exports.rotateKeyCompleteResponseSchema = exports.rotateKeyCompleteRequestSchema = exports.rotateKeyChallengeResponseSchema = exports.loginResultSchema = exports.mcpOAuthConsentResponseSchema = exports.mcpOAuthClientInfoResponseSchema = exports.mcpOAuthConsentContextSchema = exports.mcpOAuthWriteActionSchema = exports.mcpOAuthClientApplicationSchema = exports.oauthAuthorizeCodeResponseSchema = exports.oauthConsentDecisionSchema = exports.deviceDirectorySyncSchema = exports.deviceActivateResponseSchema = exports.deviceActivateRequestSchema = exports.deviceDirectorySchema = exports.devicePrincipalSchema = exports.deviceAccountContextSchema = exports.deviceDirectoryProfileSchema = exports.deviceContextRelationshipSchema = exports.sessionAccountsChangedEventSchema = exports.sessionAccountsChangedReasonSchema = exports.SESSION_ACCOUNTS_CHANGED_EVENT = exports.deviceJoinResponseSchema = exports.deviceJoinRequestSchema = exports.deviceJoinCodeResponseSchema = exports.deviceJoinCodeRequestSchema = exports.deviceRegisterResponseSchema = exports.deviceProofSchema = exports.deviceBackgroundTokenResponseSchema = exports.deviceBackgroundTokenRequestSchema = exports.deviceBackgroundCredentialResponseSchema = exports.deviceTokenMintResponseSchema = exports.deviceTokenMintRequestSchema = exports.deviceSessionSyncSchema = exports.activeTokenSchema = void 0;
|
|
33
|
+
exports.signInIdentifierSchema = exports.SIGN_IN_ERROR_CODES = exports.TOTP_BACKUP_CODE_COUNT = exports.TOTP_PERIOD_SECONDS = exports.TOTP_DIGITS = exports.PASSWORD_MAX_LENGTH = exports.PASSWORD_MIN_LENGTH = exports.SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS = exports.SIGNIN_SECOND_FACTOR_TTL_MS = exports.EMAIL_SIGNIN_LINK_TTL_MS = exports.emailVerificationConfirmResponseSchema = exports.emailVerificationConfirmRequestSchema = exports.emailVerificationStartResponseSchema = exports.emailVerificationStartRequestSchema = exports.emailTicketSchema = exports.emailAddressSchema = exports.EMAIL_VERIFICATION_ERROR_CODES = exports.EMAIL_TICKET_TTL_MS = exports.EMAIL_CODE_MAX_ATTEMPTS = exports.EMAIL_CODE_TTL_MS = exports.EMAIL_CODE_LENGTH = exports.EMAIL_VERIFICATION_PURPOSES = 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 = exports.identityRootStatusSchema = exports.identityProofChallengeResponseSchema = void 0;
|
|
34
|
+
exports.transparencyInclusionProofSchema = exports.transparencyCheckpointSchema = exports.transparencyAnchorSchema = exports.transparencyCheckpointSignatureSchema = exports.identityLinkCompleteRequestSchema = exports.identityLinkProofRequestSchema = exports.identityLinkStateSchema = exports.identityLinkCreateResponseSchema = exports.parseIdentityLinkQrPayload = exports.buildIdentityLinkQrPayload = exports.identityLinkIdSchema = exports.IDENTITY_LINK_QR_PREFIX = exports.IDENTITY_LINK_STATUSES = exports.totpBackupCodesResponseSchema = exports.totpReauthRequestSchema = exports.totpConfirmRequestSchema = exports.totpEnrollResponseSchema = exports.signInMethodsSchema = exports.emailSetRequestSchema = exports.emailChangeStartRequestSchema = exports.signInMethodRemoveRequestSchema = exports.passwordSetRequestSchema = exports.reauthEmailStartRequestSchema = exports.REAUTH_ACTIONS = exports.reauthProofSchema = exports.isSecondFactorRequired = exports.signUpRequestSchema = exports.secondFactorRequiredSchema = exports.secondFactorSignInRequestSchema = exports.passwordSignInRequestSchema = exports.isEmailSignInChooseAccount = exports.emailSignInChooseRequestSchema = exports.emailSignInChooseAccountSchema = exports.emailSignInAccountOptionSchema = exports.EMAIL_ACCOUNTS_MAX = exports.EMAIL_SIGNIN_CHOICE_TTL_MS = exports.emailSignInPendingSchema = exports.emailSignInLinkResponseSchema = exports.emailSignInLinkRequestSchema = exports.emailSignInCollectRequestSchema = exports.EMAIL_SIGNIN_LONG_CODE_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_ALPHABET = exports.normalizeEmailSignInCode = exports.emailSignInCodeSchema = exports.emailSignInConfirmRequestSchema = exports.emailSignInStartResponseSchema = exports.emailSignInStartRequestSchema = exports.secondFactorCodeSchema = exports.newPasswordSchema = exports.passwordInputSchema = void 0;
|
|
35
|
+
exports.embeddingUsageSchema = exports.embeddingVectorSchema = exports.inferenceErrorSchema = exports.providerErrorPassthroughSchema = exports.safeErrorTextSchema = exports.upstreamErrorCategorySchema = exports.inferenceErrorCodeSchema = exports.NON_RETRYABLE_INFERENCE_ERROR_CODES = exports.INFERENCE_ERROR_CODES = exports.inferenceAttributionSchema = exports.authenticatedPrincipalSchema = exports.billingPrincipalSchema = exports.inferenceScopeSchema = exports.INFERENCE_SCOPES = exports.unitPriceSchema = exports.usageQuantitySchema = exports.usageSourceSchema = exports.USAGE_SOURCES = exports.usageUnitSchema = exports.USAGE_UNITS = exports.moneySchema = exports.exactDecimalSchema = exports.INFERENCE_MONEY_SCALE = exports.currencyCodeSchema = exports.RESERVED_ALIA_PUBLISHER = exports.inferenceFundingTierSchema = exports.inferenceRegionSchema = exports.deploymentIdSchema = exports.inferenceProviderSlugSchema = exports.routingProfileSlugSchema = exports.routingProfileIdSchema = exports.modelReferenceSchema = exports.modelRevisionLabelSchema = exports.modelIdSchema = exports.modelSlugSchema = exports.publisherSlugSchema = exports.sha256DigestSchema = exports.inferenceHttpsUrlSchema = exports.inferenceDateSchema = exports.inferenceTimestampSchema = exports.inferenceEnvironmentSchema = exports.idempotencyKeySchema = exports.generationIdSchema = exports.requestIdSchema = exports.oxyCredentialIdSchema = exports.oxyApplicationIdSchema = exports.delegatedUserIdSchema = exports.oxyAccountIdSchema = exports.INFERENCE_CONTRACT_VERSION = exports.transparencyCheckpointListSchema = void 0;
|
|
36
|
+
exports.modelGpaiDocumentationSchema = exports.modelDownstreamDocumentationSchema = exports.SYSTEMIC_RISK_COMPUTE_THRESHOLD_FLOPS = exports.trainingComputeFlopsSchema = exports.modelSystemicRiskTierSchema = exports.modelDistributionMethodSchema = exports.aliaModelReleaseManifestSchema = exports.aliaReleaseSignatureSchema = exports.aliaReleaseArtifactSchema = exports.authorizedRouteSchema = exports.effectiveSameModelDeployment = exports.routingPolicyReferenceSchema = exports.routingPolicySchema = exports.routingFallbackPolicySchema = exports.routingPolicyScopeSchema = exports.routingTargetSchema = exports.modelCatalogueEntrySchema = exports.catalogueServingProviderSummarySchema = exports.cataloguePublisherSummarySchema = exports.routingProfileSchema = exports.routingProfileCandidateSchema = exports.modelDeploymentSchema = exports.inferenceProviderSchema = exports.modelRevisionSchema = exports.catalogueModelSchema = exports.modelPublisherSchema = exports.modelSafetyMetadataSchema = exports.modelEvaluationResultSchema = exports.modelDeprecationSchema = exports.commercialPermissionSchema = exports.availabilityScopeSchema = exports.inferenceDataPolicySchema = exports.modelProvenanceSchema = exports.modelLicenseSchema = exports.modelCapabilitiesSchema = exports.modelRealtimeCapabilitiesSchema = exports.realtimeSessionTransportSchema = exports.realtimeSessionKindSchema = exports.inferenceApiFormatSchema = exports.modelPowerClassSchema = exports.powerLevelSchema = exports.reasoningEffortSchema = exports.inferenceOutputModalitySchema = exports.inferenceModalitySchema = exports.priceSnapshotSchema = exports.priceVersionSchema = exports.priceVersionStatusSchema = exports.embeddingResponseSchema = exports.embeddingFailureSchema = exports.embeddingSuccessSchema = void 0;
|
|
37
|
+
exports.realtimeSessionRequestSchema = exports.realtimeClientMetadataSchema = exports.realtimeSessionLimitsSchema = exports.realtimeSessionConfigUpdateSchema = exports.realtimeSessionConfigSchema = exports.realtimeTranslationSchema = exports.realtimeInputTranscriptionSchema = exports.realtimeTurnDetectionSchema = exports.realtimeOutputModalitySchema = exports.realtimeAudioFormatSchema = exports.realtimeResponseIdSchema = exports.realtimeItemIdSchema = exports.realtimeCommandIdSchema = exports.MAX_REALTIME_RESUME_WINDOW_MS = exports.MAX_REALTIME_SESSION_AUDIO_BYTES = exports.MAX_REALTIME_SESSION_DURATION_MS = exports.MAX_REALTIME_AUDIO_FRAME_BASE64_LENGTH = 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 = exports.inferenceAudioOutputParametersSchema = exports.inferenceSpeechParametersSchema = exports.inferenceRequestSchema = exports.clientRequestMetadataSchema = exports.responseFormatSchema = exports.toolChoiceSchema = exports.toolDefinitionSchema = exports.inferenceReasoningSchema = exports.samplingParametersSchema = exports.inferenceInputSchema = exports.inferenceMessageSchema = exports.inferenceMessageRoleSchema = exports.inferenceToolCallSchema = exports.inferenceContentPartSchema = exports.inferenceContentSourceSchema = exports.modelDocumentationSchema = exports.modelReleaseIngestionResultSchema = exports.modelReleaseIngestionRequestSchema = exports.modelLineDeclarationSchema = void 0;
|
|
38
|
+
exports.usageRefundSchema = exports.usageRefundReasonSchema = exports.usageRefundSubjectSchema = exports.usageReceiptSchema = exports.normalizedUsageReportSchema = exports.inferenceRequestOutcomeSchema = exports.usageReservationSchema = exports.usageReservationStatusSchema = exports.usageReservationRequestSchema = exports.realtimeServerEventSchema = exports.realtimeSessionClosedEventSchema = exports.realtimeSessionCloseReasonSchema = exports.realtimeErrorEventSchema = exports.realtimeResponseDoneEventSchema = exports.realtimeResponseStatusSchema = exports.realtimeToolCallEventSchema = exports.realtimeTextDeltaEventSchema = exports.realtimeTranscriptDoneEventSchema = exports.realtimeTranscriptDeltaEventSchema = exports.realtimeTranscriptSourceSchema = exports.realtimeOutputAudioDoneEventSchema = exports.realtimeOutputAudioDeltaEventSchema = exports.realtimeResponseCreatedEventSchema = exports.realtimeInputAudioClearedEventSchema = exports.realtimeInputAudioCommittedEventSchema = exports.realtimeSpeechStoppedEventSchema = exports.realtimeSpeechStartedEventSchema = exports.realtimeItemTruncatedEventSchema = exports.realtimeItemDeletedEventSchema = exports.realtimeItemDoneEventSchema = exports.realtimeItemAddedEventSchema = exports.realtimeCommandAcceptedEventSchema = exports.realtimeSessionResumedEventSchema = exports.realtimeSessionUpdatedEventSchema = exports.realtimeSessionCreatedEventSchema = exports.realtimeClientCommandSchema = exports.realtimeSessionCloseCommandSchema = exports.realtimeSessionResumeCommandSchema = exports.realtimeResponseCancelCommandSchema = exports.realtimeResponseCreateCommandSchema = exports.realtimeInputAudioClearCommandSchema = exports.realtimeInputAudioCommitCommandSchema = exports.realtimeInputAudioAppendCommandSchema = exports.realtimeItemTruncateCommandSchema = exports.realtimeItemDeleteCommandSchema = exports.realtimeItemCreateCommandSchema = exports.realtimeSessionUpdateCommandSchema = exports.realtimeResponseParametersSchema = exports.realtimeConversationItemSchema = exports.realtimeContentPartSchema = void 0;
|
|
39
|
+
exports.reconciliationRunSchema = exports.reconciliationDiscrepancySchema = exports.reconciliationRunStatusSchema = exports.RECONCILIATION_RUN_STATUSES = exports.reconciliationDiscrepancyKindSchema = exports.RECONCILIATION_DISCREPANCY_KINDS = exports.autoRechargeAttemptSchema = exports.autoRechargeStatusSchema = exports.AUTO_RECHARGE_STATUSES = exports.externalPaymentSchema = exports.externalPaymentKindSchema = exports.EXTERNAL_PAYMENT_KINDS = exports.externalPaymentProviderSchema = exports.EXTERNAL_PAYMENT_PROVIDERS = exports.billingInvoiceSchema = exports.billingInvoiceStatusSchema = exports.BILLING_INVOICE_STATUSES = exports.accountBillingStateSchema = exports.billingProfileSchema = exports.autoRechargeSchema = exports.billingProfileStatusSchema = exports.BILLING_PROFILE_STATUSES = exports.billingModeSchema = exports.BILLING_MODES = exports.providerConnectionSchema = exports.providerConnectionStatusSchema = exports.providerConnectionValidationSchema = exports.providerCredentialCustodyStateSchema = exports.providerCredentialValidationDeploymentSchema = exports.providerCredentialValidationOperationSchema = exports.kaanaCredentialValidationOutcomeSchema = exports.kaanaCredentialValidationFailureCodeSchema = exports.kaanaCredentialValidationOutcomeStateSchema = exports.kaanaCredentialValidationTaskSchema = exports.kaanaCredentialOutcomeSchema = exports.kaanaCredentialConflictOutcomeSchema = exports.kaanaCredentialAppliedOutcomeSchema = exports.kaanaCredentialOutcomeRequestSchema = exports.kaanaCredentialRevokeOutcomeRequestSchema = exports.kaanaCredentialRotateOutcomeRequestSchema = exports.kaanaCredentialCreateOutcomeRequestSchema = exports.kaanaCredentialMutationSchema = exports.kaanaCredentialRevokeMutationSchema = exports.kaanaCredentialRotateMutationSchema = exports.kaanaCredentialCreateMutationSchema = exports.kaanaCredentialIdentitySchema = exports.kaanaCredentialOperationActionSchema = exports.kaanaCredentialOperationIdSchema = exports.kaanaCredentialHandleSchema = exports.providerConnectionScopeSchema = void 0;
|
|
40
|
+
exports.CATALOG_TOOL_ACTOR_TYPES = exports.auditEventSchema = exports.auditResultSchema = exports.policyDecisionSchema = exports.invocationPrincipalSchema = exports.capabilityTicketClaimsSchema = exports.automationDefinitionSchema = exports.automationDataFlowSchema = exports.automationActorSelectionSchema = exports.automationTriggerSchema = exports.agentAvailabilitySchema = exports.applicationAgentSchema = exports.applicationAgentWriteSchema = exports.applicationAgentAvailabilitySchema = exports.APPLICATION_AGENT_AVAILABILITIES = exports.agentRequesterCeilingSchema = exports.agentRequesterCeilingWriteSchema = exports.AGENT_REQUESTER_CEILING_AUTONOMY = exports.delegationGrantSchema = exports.capabilityTicketRequestSchema = exports.capabilityCoordinatorSchema = exports.executionAuthorizationRefSchema = exports.capabilityCatalogBindingSchema = exports.grantLimitSchema = exports.toolGrantOverrideSchema = exports.resourceRefSchema = exports.foregroundExecutionAuthorizationInputSchema = exports.executionActorRefSchema = exports.actorRefSchema = exports.capabilityPackageSchema = exports.autonomyLevelSchema = exports.CAPABILITY_PACKAGES = exports.AUTONOMY_LEVELS = exports.costCenterUsageSchema = exports.providerCostSourceSchema = exports.PROVIDER_COST_SOURCES = exports.inferenceEconomicTreatmentSchema = exports.INFERENCE_ECONOMIC_TREATMENTS = exports.productEntitlementSchema = exports.costCenterSpendSchema = exports.costCenterSchema = exports.costCenterStatusSchema = exports.COST_CENTER_STATUSES = exports.payAsYouGoEntitlementSchema = exports.productPlanSchema = exports.planAllowanceSchema = exports.LIVE_PRODUCT_PLAN_STATUSES = exports.productPlanStatusSchema = exports.PRODUCT_PLAN_STATUSES = exports.reconciliationReportSchema = void 0;
|
|
41
|
+
exports.cancelProductSubscriptionSchema = exports.subscriptionCreditGrantsResponseSchema = exports.subscriptionCreditGrantSchema = exports.productSubscriptionsResponseSchema = exports.productSubscriptionSummarySchema = exports.isLoopbackOrigin = exports.inputSatisfiesCapabilityLimits = exports.canonicalCapabilityJson = exports.meteredGenerationSchema = exports.subjectProductAccessSchema = exports.productOfferSegmentSchema = exports.subjectProductGrantSnapshotSchema = exports.productAccessGrantSchema = exports.productSubscriptionSourceSchema = exports.productOfferSchema = exports.productBenefitSchema = exports.subjectProductAccessQuerySchema = exports.productDefinitionSchema = exports.inboxInferenceStreamEventSchema = exports.inboxThreadSummaryResponseSchema = exports.inboxSmartRepliesResponseSchema = exports.inboxNaturalSearchResponseSchema = exports.inboxInferenceTextResponseSchema = exports.inboxMessageInferenceParamsSchema = exports.inboxNaturalSearchRequestSchema = exports.INBOX_DAILY_BRIEF_SECTIONS = exports.inboxDailyBriefResponseSchema = exports.inboxDailyBriefRequestSchema = exports.inboxComposeRequestSchema = exports.emailAgentContextSchema = exports.emailContextMessageSchema = exports.emailContextMailboxSchema = exports.emailContextAddressSchema = exports.resolveCatalogInvocation = exports.matchCatalogInvocation = exports.findOverlappingCatalogInvocations = exports.catalogInvocationTemplatesEquivalent = exports.catalogInvocationsOverlap = exports.catalogInvocationPathParameters = exports.normalizedAppEventSchema = exports.catalogRegistrationSchema = exports.appCapabilityCatalogSchema = exports.CATALOG_INTERNAL_TRANSPORTS = exports.catalogFeatureSchema = exports.catalogEventSchema = exports.catalogToolSchema = exports.catalogToolAllowsActor = exports.catalogToolActors = exports.catalogToolActorTypeSchema = exports.CATALOG_TOOL_DEFAULT_ACTORS = void 0;
|
|
42
|
+
exports.FREE_USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLOR_PRESETS = exports.USER_PROFILE_COLORS = exports.serviceTokenOptionsSchema = exports.serviceTokenScopesSchema = exports.productPlanCatalogueSchema = exports.personalPlanCatalogueSchema = exports.personalPlanDisplayPriceSchema = exports.productSubscriptionCancellationResultSchema = void 0;
|
|
43
43
|
var accountGraph_1 = require("./accountGraph");
|
|
44
44
|
Object.defineProperty(exports, "ACCOUNT_KINDS", { enumerable: true, get: function () { return accountGraph_1.ACCOUNT_KINDS; } });
|
|
45
45
|
Object.defineProperty(exports, "accountKindSchema", { enumerable: true, get: function () { return accountGraph_1.accountKindSchema; } });
|
|
@@ -60,6 +60,13 @@ Object.defineProperty(exports, "RETIRED_ACCOUNT_CATEGORY_IDS", { enumerable: tru
|
|
|
60
60
|
Object.defineProperty(exports, "SELECTABLE_ACCOUNT_CATEGORY_IDS", { enumerable: true, get: function () { return accountGraph_1.SELECTABLE_ACCOUNT_CATEGORY_IDS; } });
|
|
61
61
|
Object.defineProperty(exports, "createAccountRequestSchema", { enumerable: true, get: function () { return accountGraph_1.createAccountRequestSchema; } });
|
|
62
62
|
Object.defineProperty(exports, "accountNameSchema", { enumerable: true, get: function () { return accountGraph_1.accountNameSchema; } });
|
|
63
|
+
var accountName_1 = require("./accountName");
|
|
64
|
+
Object.defineProperty(exports, "ACCOUNT_NAME_POLICY_BY_KIND", { enumerable: true, get: function () { return accountName_1.ACCOUNT_NAME_POLICY_BY_KIND; } });
|
|
65
|
+
Object.defineProperty(exports, "ACCOUNT_TITLE_DISALLOWED_SOURCE", { enumerable: true, get: function () { return accountName_1.ACCOUNT_TITLE_DISALLOWED_SOURCE; } });
|
|
66
|
+
Object.defineProperty(exports, "ACCOUNT_TITLE_MAX_LENGTH", { enumerable: true, get: function () { return accountName_1.ACCOUNT_TITLE_MAX_LENGTH; } });
|
|
67
|
+
Object.defineProperty(exports, "accountNamePolicyForKind", { enumerable: true, get: function () { return accountName_1.accountNamePolicyForKind; } });
|
|
68
|
+
Object.defineProperty(exports, "accountTitleSchema", { enumerable: true, get: function () { return accountName_1.accountTitleSchema; } });
|
|
69
|
+
Object.defineProperty(exports, "isPlainTextTitle", { enumerable: true, get: function () { return accountName_1.isPlainTextTitle; } });
|
|
63
70
|
var avatarCharacter_1 = require("./avatarCharacter");
|
|
64
71
|
Object.defineProperty(exports, "AVATAR_EYE_SPACING", { enumerable: true, get: function () { return avatarCharacter_1.AVATAR_EYE_SPACING; } });
|
|
65
72
|
Object.defineProperty(exports, "AVATAR_PICKABLE_COLORS", { enumerable: true, get: function () { return avatarCharacter_1.AVATAR_PICKABLE_COLORS; } });
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.organizationCurationResultSchema = exports.organizationCurationSchema = exports.organizationErrorSchema = exports.organizationMergeSchema = exports.organizationExternalResolutionSchema = exports.organizationExternalSchema = exports.organizationImportBatchResultSchema = exports.organizationImportBatchSchema = exports.organizationExternalInputSchema = exports.organizationClaimReviewSchema = exports.organizationClaimListSchema = exports.organizationClaimListQuerySchema = exports.organizationClaimDetailSchema = exports.organizationClaimSchema = exports.organizationClaimInputSchema = exports.organizationBatchSchema = exports.organizationBatchInputSchema = exports.organizationListSchema = exports.organizationSearchSchema = exports.organizationSchema = exports.updateOrganizationSchema = exports.createOrganizationSchema = exports.organizationNameSchema = exports.organizationAliasSchema = exports.ORGANIZATION_ERROR_CODES = exports.ORGANIZATION_NAME_MAX_LENGTH = exports.ORGANIZATION_CLAIM_DECISIONS = exports.ORGANIZATION_ALIAS_KINDS = exports.ORGANIZATION_CLAIM_STATUSES = exports.ORGANIZATION_STATUSES = exports.ORGANIZATION_TYPES = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const accountName_1 = require("./accountName");
|
|
5
6
|
// The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
|
|
6
7
|
// it is re-exported here so the root entry is unchanged.
|
|
7
8
|
const organizations_1 = require("./client/organizations");
|
|
@@ -22,13 +23,8 @@ exports.organizationAliasSchema = zod_1.z
|
|
|
22
23
|
language: zod_1.z.string().min(2).max(35).optional(),
|
|
23
24
|
})
|
|
24
25
|
.strict();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.trim()
|
|
28
|
-
.min(1)
|
|
29
|
-
.max(organizations_1.ORGANIZATION_NAME_MAX_LENGTH)
|
|
30
|
-
.refine((value) => !/[<>]/.test(value) &&
|
|
31
|
-
Array.from(value).every((character) => character.charCodeAt(0) >= 32 && character.charCodeAt(0) !== 127), 'Organization name must be plain text');
|
|
26
|
+
/** An organization is named by the title policy every non-personal account uses. */
|
|
27
|
+
exports.organizationNameSchema = accountName_1.accountTitleSchema;
|
|
32
28
|
exports.createOrganizationSchema = zod_1.z
|
|
33
29
|
.object({
|
|
34
30
|
name: exports.organizationNameSchema,
|
package/dist/esm/accountGraph.js
CHANGED
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
import { avatarCharacterSchema } from './avatarCharacter.js';
|
|
11
|
-
import {
|
|
11
|
+
import { accountTitleSchema } from './accountName.js';
|
|
12
|
+
import { ACCOUNT_TITLE_MAX_LENGTH } from './client/accountName.js';
|
|
13
|
+
import { ORGANIZATION_TYPES } from './organizations.js';
|
|
12
14
|
import { usernameSchema, usernameSchemaForAccountKind } from './username.js';
|
|
13
15
|
// The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
|
|
14
16
|
// it is re-exported here so the root entry is unchanged.
|
|
@@ -69,7 +71,7 @@ export const accountNameSchema = z
|
|
|
69
71
|
.object({
|
|
70
72
|
first: z.string().trim().max(100).optional(),
|
|
71
73
|
last: z.string().trim().max(100).optional(),
|
|
72
|
-
displayName: z.string().trim().max(
|
|
74
|
+
displayName: z.string().trim().max(ACCOUNT_TITLE_MAX_LENGTH).optional(),
|
|
73
75
|
})
|
|
74
76
|
.optional();
|
|
75
77
|
/**
|
|
@@ -81,7 +83,7 @@ export const accountNameSchema = z
|
|
|
81
83
|
* this route. The refinement the single-valued predecessor needed disappeared
|
|
82
84
|
* along with the restriction that made it necessary. A child kind that does NOT
|
|
83
85
|
* accept categories would break that reasoning silently, so
|
|
84
|
-
* `__tests__/accountGraph.test.ts` asserts
|
|
86
|
+
* `__tests__/accountGraph.test.ts` asserts every child kind is a category kind.
|
|
85
87
|
*/
|
|
86
88
|
export const createAccountRequestSchema = z
|
|
87
89
|
.object({
|
|
@@ -182,9 +184,10 @@ export const createAccountRequestSchema = z
|
|
|
182
184
|
}
|
|
183
185
|
const displayName = request.name?.displayName;
|
|
184
186
|
if (displayName) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
// A child kind is never `personal`, so every child is named by the
|
|
188
|
+
// title policy; the person policy's character classes live in
|
|
189
|
+
// `@oxy.so/core`, which this package cannot import.
|
|
190
|
+
const parsedName = accountTitleSchema.safeParse(displayName);
|
|
188
191
|
if (!parsedName.success) {
|
|
189
192
|
for (const issue of parsedName.error.issues) {
|
|
190
193
|
ctx.addIssue({ ...issue, path: ['name', 'displayName', ...issue.path] });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
|
|
3
|
+
// it is re-exported here so the root entry carries the whole policy.
|
|
4
|
+
import { ACCOUNT_TITLE_MAX_LENGTH, isPlainTextTitle } from './client/accountName.js';
|
|
5
|
+
export { ACCOUNT_NAME_POLICY_BY_KIND, ACCOUNT_TITLE_DISALLOWED_SOURCE, ACCOUNT_TITLE_MAX_LENGTH, accountNamePolicyForKind, isPlainTextTitle, } from './client/accountName.js';
|
|
6
|
+
/** A non-personal account's title — see `./client/accountName.ts` for the policy. */
|
|
7
|
+
export const accountTitleSchema = z
|
|
8
|
+
.string()
|
|
9
|
+
.trim()
|
|
10
|
+
.min(1)
|
|
11
|
+
.max(ACCOUNT_TITLE_MAX_LENGTH)
|
|
12
|
+
.refine(isPlainTextTitle, 'Name must be plain text');
|
|
@@ -44,8 +44,9 @@ export const ACCOUNT_SUBJECT_CONTRACT_VERSION = 1;
|
|
|
44
44
|
* - `person` — a human; a personal account is its own actor.
|
|
45
45
|
* - `agent` — an AI agent; a bot is its own actor (ADR 0018 `ActorRef`
|
|
46
46
|
* `{type:'agent'}`), and audit records the bot, never the human who owns it.
|
|
47
|
-
* - `operated` — never its own actor. An organization, project
|
|
48
|
-
* acts through a member, and that
|
|
47
|
+
* - `operated` — never its own actor. An organization, project, channel or
|
|
48
|
+
* community only acts through a member (a community's moderators), and that
|
|
49
|
+
* member is the actor.
|
|
49
50
|
*/
|
|
50
51
|
export const ACCOUNT_ACTOR_NATURES = ['person', 'agent', 'operated'];
|
|
51
52
|
export const accountActorNatureSchema = z.enum(ACCOUNT_ACTOR_NATURES);
|
|
@@ -59,6 +60,7 @@ const ACTOR_NATURE_BY_KIND = {
|
|
|
59
60
|
organization: 'operated',
|
|
60
61
|
project: 'operated',
|
|
61
62
|
channel: 'operated',
|
|
63
|
+
community: 'operated',
|
|
62
64
|
};
|
|
63
65
|
/** `null` for a value that is not an account kind. Never a guess. */
|
|
64
66
|
export function accountKindActorNature(kind) {
|
|
@@ -21,6 +21,7 @@ export const ACCOUNT_KINDS = [
|
|
|
21
21
|
'project',
|
|
22
22
|
'bot',
|
|
23
23
|
'channel',
|
|
24
|
+
'community',
|
|
24
25
|
];
|
|
25
26
|
export const CHILD_ACCOUNT_KINDS = [
|
|
26
27
|
'organization',
|
|
@@ -301,6 +302,7 @@ export const ACCOUNT_CATEGORY_KINDS = [
|
|
|
301
302
|
'project',
|
|
302
303
|
'bot',
|
|
303
304
|
'channel',
|
|
305
|
+
'community',
|
|
304
306
|
];
|
|
305
307
|
/**
|
|
306
308
|
* Whether an account of this kind may carry categories.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The account-name policy, without Zod. Schema: `../accountName.ts`.
|
|
3
|
+
*
|
|
4
|
+
* Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
|
|
5
|
+
*
|
|
6
|
+
* An account's name follows ONE of two policies, chosen by its `kind` and by
|
|
7
|
+
* nothing else — not by which route wrote it, nor by whether it is native or
|
|
8
|
+
* federated:
|
|
9
|
+
*
|
|
10
|
+
* - `person`: a human name. Letters of the allowlisted scripts, combining
|
|
11
|
+
* marks, spaces, the apostrophe and letter-flanked name separators; no
|
|
12
|
+
* digits. The character classes are generated data and live in
|
|
13
|
+
* `@oxy.so/core` (`isValidDisplayName`), which applies this table through
|
|
14
|
+
* `isValidAccountName`.
|
|
15
|
+
* - `title`: what an organization, project, bot, channel or community is called. Plain
|
|
16
|
+
* text — digits and punctuation are part of real titles ("Studio 54",
|
|
17
|
+
* "Blink-182") — without markup or control characters. Defined here, once.
|
|
18
|
+
*/
|
|
19
|
+
import { maxLength, minLength, refine, string, trim } from './check.js';
|
|
20
|
+
/**
|
|
21
|
+
* The policy for each kind. A `Record` over the whole union, so adding a kind
|
|
22
|
+
* fails this file's typecheck until someone decides how it is named.
|
|
23
|
+
*/
|
|
24
|
+
export const ACCOUNT_NAME_POLICY_BY_KIND = {
|
|
25
|
+
personal: 'person',
|
|
26
|
+
organization: 'title',
|
|
27
|
+
project: 'title',
|
|
28
|
+
bot: 'title',
|
|
29
|
+
channel: 'title',
|
|
30
|
+
community: 'title',
|
|
31
|
+
};
|
|
32
|
+
/** A missing kind is `personal`, the `users.kind` column default. */
|
|
33
|
+
export function accountNamePolicyForKind(kind) {
|
|
34
|
+
return ACCOUNT_NAME_POLICY_BY_KIND[kind ?? 'personal'];
|
|
35
|
+
}
|
|
36
|
+
/** Longest title, in UTF-16 code units after trimming. */
|
|
37
|
+
export const ACCOUNT_TITLE_MAX_LENGTH = 300;
|
|
38
|
+
/**
|
|
39
|
+
* Source of the characters a title may not contain: `<`, `>`, the C0 controls
|
|
40
|
+
* and DEL. A class of literal code points — no property escapes — so it
|
|
41
|
+
* compiles on Hermes. The probe below rejects with it; the API compiles it with
|
|
42
|
+
* `g` to strip untrusted titles, so the gate and the strip cannot disagree.
|
|
43
|
+
*/
|
|
44
|
+
export const ACCOUNT_TITLE_DISALLOWED_SOURCE = '[<>\\u0000-\\u001F\\u007F]';
|
|
45
|
+
const TITLE_DISALLOWED_PROBE = new RegExp(ACCOUNT_TITLE_DISALLOWED_SOURCE, 'u');
|
|
46
|
+
/** Whether `value` holds no character the title policy disallows. */
|
|
47
|
+
export function isPlainTextTitle(value) {
|
|
48
|
+
return !TITLE_DISALLOWED_PROBE.test(value);
|
|
49
|
+
}
|
|
50
|
+
/** The twin of `accountTitleSchema`. */
|
|
51
|
+
export const accountTitleCheck = refine(string(trim, minLength(1), maxLength(ACCOUNT_TITLE_MAX_LENGTH)), isPlainTextTitle, 'Name must be plain text');
|
package/dist/esm/client/index.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
export { ContractCheckError, checkContract, formatCheckPath, parseContract, } from './check.js';
|
|
18
18
|
export { ACCOUNT_CATEGORY_IDS, ACCOUNT_CATEGORY_KINDS, ACCOUNT_KINDS, CHILD_ACCOUNT_KINDS, MAX_ACCOUNT_CATEGORIES, RETIRED_ACCOUNT_CATEGORY_IDS, SELECTABLE_ACCOUNT_CATEGORY_IDS, isAccountKind, isDelegatedActAsEligibleKind, isOperatorSwitchTargetKind, isSelectableAccountCategoryId, kindAcceptsAccountCategories, newlyAddedRetiredCategories, } from './accountGraph.js';
|
|
19
|
+
export { ACCOUNT_NAME_POLICY_BY_KIND, ACCOUNT_TITLE_DISALLOWED_SOURCE, ACCOUNT_TITLE_MAX_LENGTH, accountNamePolicyForKind, accountTitleCheck, isPlainTextTitle, } from './accountName.js';
|
|
19
20
|
export { EMAIL_CODE_LENGTH, EMAIL_CODE_MAX_ATTEMPTS, EMAIL_CODE_TTL_MS, EMAIL_TICKET_TTL_MS, EMAIL_VERIFICATION_ERROR_CODES, EMAIL_VERIFICATION_PURPOSES, emailAddressCheck, emailTicketCheck, emailVerificationConfirmResponseCheck, emailVerificationStartResponseCheck, } from './accountEmail.js';
|
|
20
21
|
export { ACCOUNT_AUTH_METHODS, AGENT_PROOF_ACTIONS, AGENT_PROOF_AUDIENCE, AGENT_PROOF_TTL_MS, agentChallengeRequestCheck, agentKeyListResponseCheck, agentKeyOperationChallengeCheck, agentKeyOperationCheck, agentKeyOperationResultCheck, agentProofClaimsCheck, agentVerifyRequestCheck, executeAgentKeyOperationCheck, } from './agentKeys.js';
|
|
21
22
|
export { isLoopbackOrigin } from '../capabilityBindings.js';
|