@oxy.so/contracts 4.16.0 → 4.21.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.
Files changed (135) hide show
  1. package/dist/cjs/accountAccess.js +72 -0
  2. package/dist/cjs/accountEmail.js +12 -34
  3. package/dist/cjs/accountGraph.js +22 -320
  4. package/dist/cjs/agency.js +112 -1
  5. package/dist/cjs/agentKeys.js +11 -13
  6. package/dist/cjs/applicationRoles.js +211 -0
  7. package/dist/cjs/client/accountEmail.js +48 -0
  8. package/dist/cjs/client/accountGraph.js +323 -0
  9. package/dist/cjs/client/agentKeys.js +77 -0
  10. package/dist/cjs/client/check.js +475 -0
  11. package/dist/cjs/client/deviceBoot.js +22 -0
  12. package/dist/cjs/client/deviceDirectory.js +51 -0
  13. package/dist/cjs/client/deviceSession.js +63 -0
  14. package/dist/cjs/client/externalIdentity.js +19 -0
  15. package/dist/cjs/client/identity.js +45 -0
  16. package/dist/cjs/client/identityLink.js +55 -0
  17. package/dist/cjs/client/identityProof.js +109 -0
  18. package/dist/cjs/client/index.js +211 -0
  19. package/dist/cjs/client/organizations.js +114 -0
  20. package/dist/cjs/client/products.js +153 -0
  21. package/dist/cjs/client/recommendations.js +33 -0
  22. package/dist/cjs/client/reputation.js +41 -0
  23. package/dist/cjs/client/safety.js +196 -0
  24. package/dist/cjs/client/sessionStatus.js +23 -0
  25. package/dist/cjs/client/signIn.js +159 -0
  26. package/dist/cjs/client/userResponse.js +15 -0
  27. package/dist/cjs/client/username.js +173 -0
  28. package/dist/cjs/deviceSession.js +3 -16
  29. package/dist/cjs/identityLink.js +13 -34
  30. package/dist/cjs/identityProof.js +18 -106
  31. package/dist/cjs/index.js +13 -3
  32. package/dist/cjs/organizations.js +21 -41
  33. package/dist/cjs/reputation.js +3 -34
  34. package/dist/cjs/safety.js +430 -1
  35. package/dist/cjs/serviceToken.js +14 -0
  36. package/dist/cjs/signIn.js +33 -111
  37. package/dist/cjs/username.js +23 -158
  38. package/dist/esm/accountAccess.js +69 -0
  39. package/dist/esm/accountEmail.js +4 -32
  40. package/dist/esm/accountGraph.js +4 -309
  41. package/dist/esm/agency.js +111 -0
  42. package/dist/esm/agentKeys.js +4 -10
  43. package/dist/esm/applicationRoles.js +207 -0
  44. package/dist/esm/client/accountEmail.js +45 -0
  45. package/dist/esm/client/accountGraph.js +314 -0
  46. package/dist/esm/client/agentKeys.js +74 -0
  47. package/dist/esm/client/check.js +436 -0
  48. package/dist/esm/client/deviceBoot.js +19 -0
  49. package/dist/esm/client/deviceDirectory.js +48 -0
  50. package/dist/esm/client/deviceSession.js +60 -0
  51. package/dist/esm/client/externalIdentity.js +16 -0
  52. package/dist/esm/client/identity.js +42 -0
  53. package/dist/esm/client/identityLink.js +50 -0
  54. package/dist/esm/client/identityProof.js +104 -0
  55. package/dist/esm/client/index.js +37 -0
  56. package/dist/esm/client/organizations.js +111 -0
  57. package/dist/esm/client/products.js +150 -0
  58. package/dist/esm/client/recommendations.js +30 -0
  59. package/dist/esm/client/reputation.js +37 -0
  60. package/dist/esm/client/safety.js +193 -0
  61. package/dist/esm/client/sessionStatus.js +20 -0
  62. package/dist/esm/client/signIn.js +153 -0
  63. package/dist/esm/client/userResponse.js +12 -0
  64. package/dist/esm/client/username.js +167 -0
  65. package/dist/esm/deviceSession.js +1 -15
  66. package/dist/esm/identityLink.js +4 -27
  67. package/dist/esm/identityProof.js +4 -99
  68. package/dist/esm/index.js +4 -1
  69. package/dist/esm/organizations.js +4 -31
  70. package/dist/esm/reputation.js +1 -32
  71. package/dist/esm/safety.js +423 -0
  72. package/dist/esm/serviceToken.js +11 -0
  73. package/dist/esm/signIn.js +4 -96
  74. package/dist/esm/username.js +4 -148
  75. package/dist/types/accountAccess.d.ts +128 -0
  76. package/dist/types/accountEmail.d.ts +4 -36
  77. package/dist/types/accountGraph.d.ts +12 -208
  78. package/dist/types/agency.d.ts +351 -26
  79. package/dist/types/agentKeys.d.ts +14 -12
  80. package/dist/types/applicationRoles.d.ts +438 -0
  81. package/dist/types/client/accountEmail.d.ts +44 -0
  82. package/dist/types/client/accountGraph.d.ts +203 -0
  83. package/dist/types/client/agentKeys.d.ts +113 -0
  84. package/dist/types/client/check.d.ts +187 -0
  85. package/dist/types/client/deviceBoot.d.ts +6 -0
  86. package/dist/types/client/deviceDirectory.d.ts +134 -0
  87. package/dist/types/client/deviceSession.d.ts +91 -0
  88. package/dist/types/client/externalIdentity.d.ts +14 -0
  89. package/dist/types/client/identity.d.ts +8 -0
  90. package/dist/types/client/identityLink.d.ts +21 -0
  91. package/dist/types/client/identityProof.d.ts +73 -0
  92. package/dist/types/client/index.d.ts +37 -0
  93. package/dist/types/client/organizations.d.ts +167 -0
  94. package/dist/types/client/products.d.ts +145 -0
  95. package/dist/types/client/recommendations.d.ts +27 -0
  96. package/dist/types/client/reputation.d.ts +28 -0
  97. package/dist/types/client/safety.d.ts +213 -0
  98. package/dist/types/client/sessionStatus.d.ts +19 -0
  99. package/dist/types/client/signIn.d.ts +107 -0
  100. package/dist/types/client/userResponse.d.ts +7 -0
  101. package/dist/types/client/username.d.ts +126 -0
  102. package/dist/types/deviceDirectory.d.ts +28 -28
  103. package/dist/types/deviceSession.d.ts +5 -16
  104. package/dist/types/email/messages.d.ts +2 -2
  105. package/dist/types/externalIdentity.d.ts +15 -15
  106. package/dist/types/identityLink.d.ts +3 -11
  107. package/dist/types/identityProof.d.ts +2 -65
  108. package/dist/types/index.d.ts +5 -2
  109. package/dist/types/inference/accountBilling.d.ts +2 -2
  110. package/dist/types/inference/catalogue.d.ts +22 -22
  111. package/dist/types/inference/decisions.d.ts +10 -10
  112. package/dist/types/inference/embeddings.d.ts +16 -16
  113. package/dist/types/inference/errors.d.ts +8 -8
  114. package/dist/types/inference/inbox.d.ts +8 -8
  115. package/dist/types/inference/privateAutoExecution.d.ts +6 -6
  116. package/dist/types/inference/providerConnection.d.ts +4 -4
  117. package/dist/types/inference/realtime.d.ts +92 -92
  118. package/dist/types/inference/request.d.ts +48 -48
  119. package/dist/types/inference/streamEvents.d.ts +16 -16
  120. package/dist/types/inference/usage.d.ts +4 -4
  121. package/dist/types/oauth.d.ts +2 -2
  122. package/dist/types/organizations.d.ts +8 -10
  123. package/dist/types/products/access.d.ts +4 -4
  124. package/dist/types/products/billing.d.ts +3 -0
  125. package/dist/types/reputation.d.ts +1 -11
  126. package/dist/types/safety.d.ts +2374 -2
  127. package/dist/types/serviceToken.d.ts +11 -0
  128. package/dist/types/sessionStatus.d.ts +2 -2
  129. package/dist/types/signIn.d.ts +11 -94
  130. package/dist/types/userResponse.d.ts +22 -22
  131. package/dist/types/username.d.ts +1 -96
  132. package/package.json +24 -20
  133. package/dist/cjs/.tsbuildinfo +0 -1
  134. package/dist/esm/.tsbuildinfo +0 -1
  135. package/dist/types/.tsbuildinfo +0 -1
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ /**
3
+ * Product access, plans, checkout and subscription checks, without Zod.
4
+ * Schemas: `../products/*.ts`.
5
+ *
6
+ * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.productSubscriptionCancellationResultCheck = exports.cancelProductSubscriptionCheck = exports.subscriptionCreditGrantsResponseCheck = exports.productSubscriptionsResponseCheck = exports.personalPlanCheckoutResultCheck = exports.personalPlanCheckoutRequestCheck = exports.personalPlanCatalogueCheck = exports.subjectProductAccessCheck = exports.subjectProductAccessQueryCheck = void 0;
10
+ const check_1 = require("./check");
11
+ const identifier = (0, check_1.string)((0, check_1.minLength)(1), (0, check_1.maxLength)(160));
12
+ const displayName = (0, check_1.string)((0, check_1.minLength)(1), (0, check_1.maxLength)(100));
13
+ const count = (0, check_1.number)(check_1.int, check_1.nonnegative, check_1.safe);
14
+ const version = (0, check_1.number)(check_1.int, check_1.positive, check_1.safe);
15
+ const oxyAccountId = (0, check_1.branded)((0, check_1.string)((0, check_1.minLength)(1), (0, check_1.maxLength)(64)));
16
+ const actionKey = (0, check_1.string)((0, check_1.minLength)(8), (0, check_1.maxLength)(160), (0, check_1.pattern)(/^[a-zA-Z0-9_-]+$/));
17
+ const combination = (0, check_1.oneOf)(['maximum', 'sum', 'exclusive']);
18
+ const origin = (0, check_1.oneOf)(['individual', 'bundle']);
19
+ const period = (message) => (0, check_1.refine)((0, check_1.strictObject)({ start: (0, check_1.string)(check_1.datetime), end: (0, check_1.string)(check_1.datetime) }), (value) => Date.parse(value.end) > Date.parse(value.start), message);
20
+ const productBenefit = (0, check_1.discriminatedUnion)('kind', {
21
+ capability: (0, check_1.strictObject)({ kind: (0, check_1.literal)('capability'), productId: identifier, key: identifier }),
22
+ quota: (0, check_1.strictObject)({
23
+ kind: (0, check_1.literal)('quota'),
24
+ productId: identifier,
25
+ key: identifier,
26
+ unit: identifier,
27
+ included: count,
28
+ combination,
29
+ }),
30
+ });
31
+ exports.subjectProductAccessQueryCheck = (0, check_1.exact)()((0, check_1.strictObject)({
32
+ schemaVersion: (0, check_1.literal)(1),
33
+ subjectAccountId: oxyAccountId,
34
+ productId: identifier,
35
+ }));
36
+ exports.subjectProductAccessCheck = (0, check_1.exact)()((0, check_1.strictObject)({
37
+ schemaVersion: (0, check_1.literal)(1),
38
+ subjectAccountId: oxyAccountId,
39
+ productId: identifier,
40
+ evaluatedAt: (0, check_1.string)(check_1.datetime),
41
+ capabilities: (0, check_1.array)((0, check_1.strictObject)({ key: identifier, grantIds: (0, check_1.array)(identifier) })),
42
+ quotas: (0, check_1.array)((0, check_1.strictObject)({
43
+ key: identifier,
44
+ unit: identifier,
45
+ included: count,
46
+ combination,
47
+ grantIds: (0, check_1.array)(identifier),
48
+ })),
49
+ conflicts: (0, check_1.array)((0, check_1.strictObject)({
50
+ key: identifier,
51
+ reason: (0, check_1.oneOf)([
52
+ 'combination_mismatch',
53
+ 'unit_mismatch',
54
+ 'exclusive_overlap',
55
+ 'unsafe_total',
56
+ ]),
57
+ grantIds: (0, check_1.array)(identifier),
58
+ })),
59
+ }));
60
+ exports.personalPlanCatalogueCheck = (0, check_1.exact)()((0, check_1.refine)((0, check_1.strictObject)({
61
+ schemaVersion: (0, check_1.literal)(1),
62
+ state: (0, check_1.oneOf)(['unconfigured', 'configured']),
63
+ purchase: (0, check_1.literal)('unavailable'),
64
+ plans: (0, check_1.array)((0, check_1.strictObject)({
65
+ offerId: identifier,
66
+ offerVersion: version,
67
+ displayName,
68
+ audience: (0, check_1.literal)('personal'),
69
+ kind: (0, check_1.literal)('oxy_one'),
70
+ price: (0, check_1.optional)((0, check_1.strictObject)({
71
+ currency: (0, check_1.string)((0, check_1.pattern)(/^[A-Z]{3}$/)),
72
+ amountMinorUnits: version,
73
+ interval: (0, check_1.literal)('month'),
74
+ trial: (0, check_1.literal)('none'),
75
+ taxTreatment: (0, check_1.literal)('inclusive'),
76
+ merchantTotal: (0, check_1.literal)('final'),
77
+ })),
78
+ benefits: (0, check_1.array)((0, check_1.strictObject)({ displayName, benefit: productBenefit })),
79
+ })),
80
+ }), (value) => (value.state === 'unconfigured') === (value.plans.length === 0), 'Catalogue state must match published plans'));
81
+ exports.personalPlanCheckoutRequestCheck = (0, check_1.exact)()((0, check_1.strictObject)({
82
+ expectedSubjectAccountId: oxyAccountId,
83
+ offerId: identifier,
84
+ offerVersion: version,
85
+ idempotencyKey: actionKey,
86
+ }));
87
+ exports.personalPlanCheckoutResultCheck = (0, check_1.exact)()((0, check_1.discriminatedUnion)('state', {
88
+ unconfigured: (0, check_1.strictObject)({
89
+ state: (0, check_1.literal)('unconfigured'),
90
+ reason: (0, check_1.oneOf)(['provider_unconfigured', 'offer_unconfigured', 'price_unconfigured']),
91
+ }),
92
+ pending: (0, check_1.strictObject)({
93
+ state: (0, check_1.literal)('pending'),
94
+ intentId: identifier,
95
+ checkoutUrl: (0, check_1.optional)((0, check_1.string)(check_1.url, (0, check_1.startsWith)('https://'))),
96
+ }),
97
+ closed: (0, check_1.strictObject)({ state: (0, check_1.literal)('closed'), intentId: identifier }),
98
+ fulfilled: (0, check_1.strictObject)({ state: (0, check_1.literal)('fulfilled'), intentId: identifier }),
99
+ }));
100
+ const billingPeriod = period('Period end must follow start');
101
+ exports.productSubscriptionsResponseCheck = (0, check_1.exact)()((0, check_1.strictObject)({
102
+ subscriptions: (0, check_1.array)((0, check_1.strictObject)({
103
+ sourceId: identifier,
104
+ status: (0, check_1.oneOf)([
105
+ 'active',
106
+ 'trialing',
107
+ 'past_due',
108
+ 'unpaid',
109
+ 'canceled',
110
+ 'paused',
111
+ 'incomplete',
112
+ 'incomplete_expired',
113
+ ]),
114
+ period: billingPeriod,
115
+ cancelAtPeriodEnd: check_1.boolean,
116
+ canCancel: check_1.boolean,
117
+ offers: (0, check_1.array)((0, check_1.strictObject)({
118
+ segmentId: identifier,
119
+ offerId: identifier,
120
+ offerVersion: version,
121
+ displayName,
122
+ origin,
123
+ period: billingPeriod,
124
+ current: check_1.boolean,
125
+ products: (0, check_1.array)((0, check_1.strictObject)({ id: identifier, displayName })),
126
+ })),
127
+ })),
128
+ }));
129
+ exports.subscriptionCreditGrantsResponseCheck = (0, check_1.exact)()((0, check_1.strictObject)({
130
+ grants: (0, check_1.array)((0, check_1.refine)((0, check_1.strictObject)({
131
+ id: identifier,
132
+ invoiceId: identifier,
133
+ origin: (0, check_1.oneOf)([
134
+ 'subscription_payment',
135
+ 'subscription_proration',
136
+ 'subscription_promotional_grant',
137
+ ]),
138
+ period: billingPeriod,
139
+ granted: count,
140
+ consumed: count,
141
+ clawed: count,
142
+ remaining: count,
143
+ promotionId: (0, check_1.nullable)(identifier),
144
+ createdAt: (0, check_1.string)(check_1.datetime),
145
+ }), (value) => BigInt(value.consumed) + BigInt(value.clawed) + BigInt(value.remaining) ===
146
+ BigInt(value.granted), 'Grant conservation differs')),
147
+ }));
148
+ exports.cancelProductSubscriptionCheck = (0, check_1.exact)()((0, check_1.strictObject)({
149
+ sourceId: identifier,
150
+ actionId: (0, check_1.optional)(actionKey),
151
+ expectedSubjectAccountId: (0, check_1.optional)(oxyAccountId),
152
+ }));
153
+ exports.productSubscriptionCancellationResultCheck = (0, check_1.exact)()((0, check_1.union)((0, check_1.strictObject)({ sourceId: identifier, cancelAtPeriodEnd: (0, check_1.literal)(true) }), (0, check_1.strictObject)({ sourceId: identifier, reconciliationPending: (0, check_1.literal)(true) })));
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /**
3
+ * The recommendation-request check, without Zod. Schemas: `../recommendations.ts`.
4
+ *
5
+ * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.recommendationRequestCheck = void 0;
9
+ const check_1 = require("./check");
10
+ const id = (0, check_1.string)(check_1.trim, (0, check_1.minLength)(1));
11
+ const weight = (0, check_1.optional)((0, check_1.number)((0, check_1.atLeast)(0), (0, check_1.atMost)(10)));
12
+ exports.recommendationRequestCheck = (0, check_1.exact)()((0, check_1.object)({
13
+ clientId: (0, check_1.optional)((0, check_1.string)(check_1.trim, (0, check_1.minLength)(1))),
14
+ limit: (0, check_1.optional)((0, check_1.number)(check_1.int, (0, check_1.atLeast)(1), (0, check_1.atMost)(100))),
15
+ offset: (0, check_1.optional)((0, check_1.number)(check_1.int, (0, check_1.atLeast)(0))),
16
+ excludeTypes: (0, check_1.optional)((0, check_1.array)((0, check_1.oneOf)(['federated', 'agent', 'automated']))),
17
+ excludeIds: (0, check_1.optional)((0, check_1.array)(id, (0, check_1.maxItems)(500))),
18
+ boosts: (0, check_1.optional)((0, check_1.array)((0, check_1.object)({
19
+ userIds: (0, check_1.array)(id, (0, check_1.minItems)(1), (0, check_1.maxItems)(200)),
20
+ weight: (0, check_1.number)((0, check_1.atLeast)(-5), (0, check_1.atMost)(5)),
21
+ reason: (0, check_1.optional)((0, check_1.string)(check_1.trim, (0, check_1.maxLength)(120))),
22
+ }), (0, check_1.maxItems)(50))),
23
+ signalWeights: (0, check_1.optional)((0, check_1.object)({
24
+ graph: weight,
25
+ completeness: weight,
26
+ verified: weight,
27
+ curation: weight,
28
+ interest: weight,
29
+ appBoost: weight,
30
+ repCandidate: weight,
31
+ affinity: weight,
32
+ })),
33
+ }));
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * The reputation view guard, without Zod. Schemas: `../reputation.ts`.
4
+ *
5
+ * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.FULL_BALANCE_FIELDS = void 0;
9
+ exports.isFullReputationBalance = isFullReputationBalance;
10
+ /**
11
+ * The fields the full {@link ReputationBalance} carries beyond the public
12
+ * {@link ReputationBalanceSummary} that the API sends ALL-OR-NOTHING. The
13
+ * runtime discriminant between the two views.
14
+ *
15
+ * The V2 blocks (`conduct`, `contribution`, …) are deliberately NOT listed:
16
+ * they are optional on the wire, so requiring them here would make a balance
17
+ * from a server that predates them fail to narrow, hiding the whole private
18
+ * view. Read a V2 block by checking that block.
19
+ */
20
+ exports.FULL_BALANCE_FIELDS = [
21
+ 'positive',
22
+ 'negative',
23
+ 'breakdown',
24
+ 'influence',
25
+ 'reliability',
26
+ 'recalculatedAt',
27
+ 'updatedAt',
28
+ ];
29
+ /**
30
+ * Whether a balance came back as the SUBJECT view, and so carries the
31
+ * breakdown / influence / reliability blocks.
32
+ *
33
+ * Checks every extra field rather than one representative: the point of the
34
+ * guard is that the caller then dereferences those blocks, so a partial payload
35
+ * must not narrow.
36
+ *
37
+ * @param balance - A balance from `getReputationBalance`.
38
+ */
39
+ function isFullReputationBalance(balance) {
40
+ return exports.FULL_BALANCE_FIELDS.every((field) => field in balance);
41
+ }
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ /**
3
+ * Safety and supervision checks, without Zod. Schemas: `../safety.ts`.
4
+ *
5
+ * Only what a browser or device sends and reads is here: the profile-access
6
+ * read, supervision management and the guardian's purchase review. The service
7
+ * decision lanes are server-only (`@oxy.so/core/server`) and parse with the
8
+ * Zod schemas directly.
9
+ *
10
+ * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.purchaseReviewInputCheck = exports.purchaseApprovalListCheck = exports.purchaseApprovalCheck = exports.safetyOrganizationsResponseCheck = exports.safetyOrganizationsInputCheck = exports.safetyPeopleResponseCheck = exports.safetyPeopleInputCheck = exports.supervisionReviewInputCheck = exports.supervisionContactInputCheck = exports.supervisionAcceptInputCheck = exports.supervisionInviteInputCheck = exports.supervisionContactsResponseCheck = exports.supervisionStateCheck = exports.supervisionInvitationCheck = exports.profileAccessDecisionCheck = exports.profileAccessInputCheck = exports.PURCHASE_APPROVAL_STATUSES = exports.SUPERVISION_INVITATION_STATUSES = exports.SUPERVISION_STATUSES = exports.SUPERVISION_CONSENT_VERSION = exports.SAFETY_POLICY_VERSION = exports.SUPERVISED_ACTIONS = void 0;
14
+ const check_1 = require("./check");
15
+ const organizations_1 = require("./organizations");
16
+ const signIn_1 = require("./signIn");
17
+ /** Supervision is a personal-account safety policy, never a new login/account kind. */
18
+ exports.SUPERVISED_ACTIONS = ['profile', 'messaging', 'content', 'purchases'];
19
+ exports.SAFETY_POLICY_VERSION = '2';
20
+ exports.SUPERVISION_CONSENT_VERSION = '1';
21
+ exports.SUPERVISION_STATUSES = ['active', 'orphaned', 'ended'];
22
+ exports.SUPERVISION_INVITATION_STATUSES = ['pending', 'accepted', 'cancelled'];
23
+ exports.PURCHASE_APPROVAL_STATUSES = [
24
+ 'pending',
25
+ 'approved',
26
+ 'rejected',
27
+ 'reserved',
28
+ 'confirmed',
29
+ 'cancelled',
30
+ ];
31
+ exports.profileAccessInputCheck = (0, check_1.exact)()((0, check_1.strictObject)({ subjectAccountId: (0, check_1.string)((0, check_1.minLength)(1), (0, check_1.maxLength)(128)) }));
32
+ exports.profileAccessDecisionCheck = (0, check_1.exact)()((0, check_1.strictObject)({
33
+ allowed: check_1.boolean,
34
+ reason: (0, check_1.oneOf)(['public', 'owner', 'private', 'blocked', 'unavailable']),
35
+ policyVersion: (0, check_1.literal)('1'),
36
+ }));
37
+ const accountId = (0, check_1.string)((0, check_1.minLength)(1), (0, check_1.maxLength)(128));
38
+ const resourceId = (0, check_1.string)(check_1.trim, (0, check_1.minLength)(1), (0, check_1.maxLength)(256));
39
+ const uniqueIds = (max) => (0, check_1.refine)((0, check_1.array)(accountId, (0, check_1.minItems)(1), (0, check_1.maxItems)(max)), (ids) => new Set(ids).size === ids.length, 'Account IDs must be unique');
40
+ /* -------------------------------------------------------------------------- */
41
+ /* Supervision management */
42
+ /* -------------------------------------------------------------------------- */
43
+ const supervisionCheck = (0, check_1.exact)()((0, check_1.strictObject)({
44
+ childAccountId: accountId,
45
+ guardianAccountId: (0, check_1.nullable)(accountId),
46
+ status: (0, check_1.oneOf)(exports.SUPERVISION_STATUSES),
47
+ policyVersion: (0, check_1.literal)(exports.SAFETY_POLICY_VERSION),
48
+ consentVersion: (0, check_1.literal)(exports.SUPERVISION_CONSENT_VERSION),
49
+ createdAt: (0, check_1.string)(check_1.datetime),
50
+ }));
51
+ exports.supervisionInvitationCheck = (0, check_1.exact)()((0, check_1.strictObject)({
52
+ id: accountId,
53
+ childAccountId: accountId,
54
+ guardianAccountId: accountId,
55
+ status: (0, check_1.oneOf)(exports.SUPERVISION_INVITATION_STATUSES),
56
+ expiresAt: (0, check_1.string)(check_1.datetime),
57
+ consentVersion: (0, check_1.literal)(exports.SUPERVISION_CONSENT_VERSION),
58
+ createdAt: (0, check_1.string)(check_1.datetime),
59
+ }));
60
+ exports.supervisionStateCheck = (0, check_1.exact)()((0, check_1.strictObject)({
61
+ self: (0, check_1.nullable)(supervisionCheck),
62
+ children: (0, check_1.array)(supervisionCheck, (0, check_1.maxItems)(100)),
63
+ invitations: (0, check_1.array)(exports.supervisionInvitationCheck, (0, check_1.maxItems)(100)),
64
+ }));
65
+ exports.supervisionContactsResponseCheck = (0, check_1.exact)()((0, check_1.strictObject)({
66
+ items: (0, check_1.array)((0, check_1.strictObject)({
67
+ childAccountId: accountId,
68
+ contactAccountId: accountId,
69
+ approvedAt: (0, check_1.string)(check_1.datetime),
70
+ }), (0, check_1.maxItems)(1000)),
71
+ }));
72
+ exports.supervisionInviteInputCheck = (0, check_1.exact)()((0, check_1.strictObject)({
73
+ guardianAccountId: accountId,
74
+ consentVersion: (0, check_1.literal)(exports.SUPERVISION_CONSENT_VERSION),
75
+ reauth: signIn_1.reauthProofCheck,
76
+ }));
77
+ exports.supervisionAcceptInputCheck = (0, check_1.exact)()((0, check_1.strictObject)({ consentVersion: (0, check_1.literal)(exports.SUPERVISION_CONSENT_VERSION), reauth: signIn_1.reauthProofCheck }));
78
+ exports.supervisionContactInputCheck = (0, check_1.exact)()((0, check_1.strictObject)({
79
+ childAccountId: accountId,
80
+ contactAccountId: accountId,
81
+ reauth: signIn_1.reauthProofCheck,
82
+ }));
83
+ exports.supervisionReviewInputCheck = (0, check_1.exact)()((0, check_1.strictObject)({
84
+ childAccountId: accountId,
85
+ action: (0, check_1.oneOf)(['end', 'transfer']),
86
+ guardianAccountId: (0, check_1.optional)(accountId),
87
+ evidenceReference: (0, check_1.string)(check_1.trim, (0, check_1.minLength)(1), (0, check_1.maxLength)(2048)),
88
+ reauth: signIn_1.reauthProofCheck,
89
+ }));
90
+ /* -------------------------------------------------------------------------- */
91
+ /* Minimal identities for the management screens */
92
+ /* -------------------------------------------------------------------------- */
93
+ const safetyPersonCheck = (0, check_1.exact)()((0, check_1.strictObject)({ accountId, username: (0, check_1.nullable)((0, check_1.string)()), displayName: (0, check_1.nullable)((0, check_1.string)()) }));
94
+ exports.safetyPeopleInputCheck = (0, check_1.exact)()((0, check_1.union)((0, check_1.strictObject)({ query: (0, check_1.string)(check_1.trim, (0, check_1.minLength)(2), (0, check_1.maxLength)(100)) }), (0, check_1.strictObject)({ accountIds: uniqueIds(100) })));
95
+ exports.safetyPeopleResponseCheck = (0, check_1.exact)()((0, check_1.strictObject)({ items: (0, check_1.array)(safetyPersonCheck, (0, check_1.maxItems)(100)) }));
96
+ exports.safetyOrganizationsInputCheck = (0, check_1.exact)()((0, check_1.union)((0, check_1.strictObject)({
97
+ query: (0, check_1.string)(check_1.trim, (0, check_1.minLength)(1), (0, check_1.maxLength)(100)),
98
+ limit: (0, check_1.optional)((0, check_1.number)(check_1.int, (0, check_1.atLeast)(1), (0, check_1.atMost)(20))),
99
+ }), (0, check_1.strictObject)({ ids: uniqueIds(100) })));
100
+ exports.safetyOrganizationsResponseCheck = (0, check_1.exact)()((0, check_1.strictObject)({
101
+ items: (0, check_1.array)((0, check_1.strictObject)({
102
+ requestedAccountId: accountId,
103
+ organization: (0, check_1.strictObject)({
104
+ accountId,
105
+ username: (0, check_1.nullable)((0, check_1.string)()),
106
+ name: (0, check_1.string)(),
107
+ organizationType: (0, check_1.oneOf)(organizations_1.ORGANIZATION_TYPES),
108
+ }),
109
+ }), (0, check_1.maxItems)(100)),
110
+ missingIds: (0, check_1.array)(accountId, (0, check_1.maxItems)(100)),
111
+ }));
112
+ /* -------------------------------------------------------------------------- */
113
+ /* Purchase approvals */
114
+ /* -------------------------------------------------------------------------- */
115
+ const fingerprint = (0, check_1.string)((0, check_1.pattern)(/^[a-f0-9]{64}$/));
116
+ const minorUnits = (0, check_1.number)(check_1.int, check_1.nonnegative, (0, check_1.atMost)(Number.MAX_SAFE_INTEGER));
117
+ const purchaseApprovalLineCheck = (0, check_1.exact)()((0, check_1.strictObject)({
118
+ itemReference: resourceId,
119
+ title: (0, check_1.string)(check_1.trim, (0, check_1.minLength)(1), (0, check_1.maxLength)(300)),
120
+ optionsText: (0, check_1.string)(check_1.trim, (0, check_1.maxLength)(300)),
121
+ merchantAccountId: accountId,
122
+ quantity: (0, check_1.number)(check_1.int, (0, check_1.atLeast)(1), (0, check_1.atMost)(1000000)),
123
+ unitAmountMinor: minorUnits,
124
+ lineAmountMinor: minorUnits,
125
+ }));
126
+ /** The effect fields every approval shape shares, in the schema's key order. */
127
+ const purchaseEffectFields = {
128
+ operationId: resourceId,
129
+ resourceId,
130
+ cartFingerprint: fingerprint,
131
+ summary: (0, check_1.string)(check_1.trim, (0, check_1.minLength)(1), (0, check_1.maxLength)(300)),
132
+ merchantAccountIds: (0, check_1.transform)((0, check_1.refine)((0, check_1.array)(accountId, (0, check_1.minItems)(1), (0, check_1.maxItems)(100)), (ids) => new Set(ids).size === ids.length, 'Merchant accounts must be unique'), (ids) => [...ids].sort()),
133
+ };
134
+ const purchaseAmountFields = {
135
+ shippingMinor: minorUnits,
136
+ taxMinor: minorUnits,
137
+ discountMinor: minorUnits,
138
+ roundingAdjustmentMinor: (0, check_1.number)(check_1.int, (0, check_1.atLeast)(-Number.MAX_SAFE_INTEGER), (0, check_1.atMost)(Number.MAX_SAFE_INTEGER)),
139
+ paymentFingerprint: fingerprint,
140
+ amountMinor: minorUnits,
141
+ currency: (0, check_1.string)((0, check_1.pattern)(/^[A-Z]{3}$/)),
142
+ expiresAt: (0, check_1.string)(check_1.datetime),
143
+ };
144
+ const purchaseApprovalFields = {
145
+ id: accountId,
146
+ childAccountId: accountId,
147
+ applicationId: accountId,
148
+ status: (0, check_1.oneOf)(exports.PURCHASE_APPROVAL_STATUSES),
149
+ createdAt: (0, check_1.string)(check_1.datetime),
150
+ receiptReference: (0, check_1.nullable)((0, check_1.string)((0, check_1.maxLength)(512))),
151
+ };
152
+ /** The first problem `validatePurchaseEvidence` in `../safety.ts` reports, in its order. */
153
+ function purchaseEvidenceProblem(value) {
154
+ const merchants = new Set(value.merchantAccountIds);
155
+ const references = new Set();
156
+ for (const line of value.lineItems) {
157
+ const key = `${line.merchantAccountId}:${line.itemReference}`;
158
+ if (!merchants.has(line.merchantAccountId) || references.has(key)) {
159
+ return {
160
+ path: [],
161
+ message: 'Purchase lines must name an included merchant and unique item reference',
162
+ };
163
+ }
164
+ references.add(key);
165
+ }
166
+ if (merchants.size !== new Set(value.lineItems.map((line) => line.merchantAccountId)).size) {
167
+ return { path: [], message: 'Every merchant must have an approval line' };
168
+ }
169
+ const total = value.lineItems.reduce((sum, line) => sum + BigInt(line.lineAmountMinor), 0n) +
170
+ BigInt(value.shippingMinor) +
171
+ BigInt(value.taxMinor) -
172
+ BigInt(value.discountMinor) +
173
+ BigInt(value.roundingAdjustmentMinor);
174
+ if (total < 0n ||
175
+ total > BigInt(Number.MAX_SAFE_INTEGER) ||
176
+ total !== BigInt(value.amountMinor)) {
177
+ return { path: [], message: 'Approval evidence must equal the exact payment total' };
178
+ }
179
+ if (Math.abs(value.roundingAdjustmentMinor) >
180
+ value.lineItems.length + 3 * value.merchantAccountIds.length) {
181
+ return { path: [], message: 'Rounding adjustment exceeds the bounded conversion stages' };
182
+ }
183
+ return undefined;
184
+ }
185
+ exports.purchaseApprovalCheck = (0, check_1.exact)()((0, check_1.refineAt)((0, check_1.strictObject)({
186
+ ...purchaseEffectFields,
187
+ lineItems: (0, check_1.array)(purchaseApprovalLineCheck, (0, check_1.minItems)(1), (0, check_1.maxItems)(200)),
188
+ ...purchaseAmountFields,
189
+ ...purchaseApprovalFields,
190
+ }), purchaseEvidenceProblem));
191
+ const purchaseApprovalSummaryCheck = (0, check_1.exact)()((0, check_1.strictObject)({ ...purchaseEffectFields, ...purchaseAmountFields, ...purchaseApprovalFields }));
192
+ exports.purchaseApprovalListCheck = (0, check_1.exact)()((0, check_1.strictObject)({
193
+ items: (0, check_1.array)(purchaseApprovalSummaryCheck, (0, check_1.maxItems)(100)),
194
+ nextCursor: (0, check_1.nullable)((0, check_1.string)()),
195
+ }));
196
+ exports.purchaseReviewInputCheck = (0, check_1.exact)()((0, check_1.strictObject)({ decision: (0, check_1.oneOf)(['approved', 'rejected']), reauth: signIn_1.reauthProofCheck }));
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /**
3
+ * The public-application check, without Zod. Schemas: `../sessionStatus.ts`.
4
+ *
5
+ * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.publicApplicationCheck = void 0;
9
+ const check_1 = require("./check");
10
+ exports.publicApplicationCheck = (0, check_1.exact)()((0, check_1.object)({
11
+ id: (0, check_1.string)(),
12
+ name: (0, check_1.string)(),
13
+ description: (0, check_1.optional)((0, check_1.string)()),
14
+ icon: (0, check_1.optional)((0, check_1.string)()),
15
+ websiteUrl: (0, check_1.optional)((0, check_1.string)()),
16
+ privacyPolicyUrl: (0, check_1.optional)((0, check_1.string)()),
17
+ termsUrl: (0, check_1.optional)((0, check_1.string)()),
18
+ type: (0, check_1.oneOf)(['first_party', 'third_party', 'internal', 'system']),
19
+ isOfficial: check_1.boolean,
20
+ isInternal: check_1.boolean,
21
+ scopes: (0, check_1.array)((0, check_1.string)()),
22
+ developerName: (0, check_1.optional)((0, check_1.string)()),
23
+ }));
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ /**
3
+ * Sign-in constants, guards and response checks, without Zod. Schemas: `../signIn.ts`.
4
+ *
5
+ * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.reauthProofCheck = exports.totpBackupCodesResponseCheck = exports.totpEnrollResponseCheck = exports.signInMethodsCheck = exports.emailSignInChooseAccountCheck = exports.emailSignInPendingCheck = exports.secondFactorRequiredCheck = exports.emailSignInLinkResponseCheck = exports.emailSignInStartResponseCheck = exports.SIGN_IN_ERROR_CODES = exports.REAUTH_ACTIONS = exports.EMAIL_ACCOUNTS_MAX = exports.EMAIL_SIGNIN_CHOICE_TTL_MS = exports.EMAIL_SIGNIN_LONG_CODE_LENGTH = exports.EMAIL_SIGNIN_LONG_CODE_ALPHABET = 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 = void 0;
9
+ exports.normalizeEmailSignInCode = normalizeEmailSignInCode;
10
+ exports.isSecondFactorRequired = isSecondFactorRequired;
11
+ exports.isEmailSignInChooseAccount = isEmailSignInChooseAccount;
12
+ const accountEmail_1 = require("./accountEmail");
13
+ const check_1 = require("./check");
14
+ /** How long the link in a sign-in email can be opened. */
15
+ exports.EMAIL_SIGNIN_LINK_TTL_MS = 15 * 60 * 1000;
16
+ /** How long a second-factor challenge can be answered. */
17
+ exports.SIGNIN_SECOND_FACTOR_TTL_MS = 5 * 60 * 1000;
18
+ /** Wrong second-factor codes one challenge accepts. */
19
+ exports.SIGNIN_SECOND_FACTOR_MAX_ATTEMPTS = 5;
20
+ /** Shortest password Oxy accepts when one is set. */
21
+ exports.PASSWORD_MIN_LENGTH = 10;
22
+ /** Longest password Oxy accepts (characters). */
23
+ exports.PASSWORD_MAX_LENGTH = 256;
24
+ /** Digits in an authenticator code. */
25
+ exports.TOTP_DIGITS = 6;
26
+ /** Seconds each authenticator code lasts. */
27
+ exports.TOTP_PERIOD_SECONDS = 30;
28
+ /** Backup codes issued when an authenticator is enabled or they are regenerated. */
29
+ exports.TOTP_BACKUP_CODE_COUNT = 10;
30
+ /**
31
+ * The long sign-in code: ten characters of Crockford base32 without the
32
+ * look-alikes (no 0, O, 1, I, L, U), shown as `XXXXX-XXXXX`. An account whose
33
+ * sign-in codes were guessed at too often today (the per-account ceiling) is
34
+ * sent this instead of 6 digits for the rest of the day, so its owner can still
35
+ * type a code while guessing one is infeasible.
36
+ */
37
+ exports.EMAIL_SIGNIN_LONG_CODE_ALPHABET = '23456789ABCDEFGHJKMNPQRSTVWXYZ';
38
+ exports.EMAIL_SIGNIN_LONG_CODE_LENGTH = 10;
39
+ /**
40
+ * Normalise a typed sign-in code: 6 digits stay as they are; a long code is
41
+ * upper-cased with its dash and spaces removed. Anything else is returned
42
+ * trimmed (and will simply be wrong).
43
+ */
44
+ function normalizeEmailSignInCode(code) {
45
+ const compact = code.trim().replace(/[\s-]/g, '').toUpperCase();
46
+ return compact;
47
+ }
48
+ /**
49
+ * How long, once the email is proven, the person has to choose which of its
50
+ * accounts signs in.
51
+ */
52
+ exports.EMAIL_SIGNIN_CHOICE_TTL_MS = 5 * 60 * 1000;
53
+ /** Most accounts one email can hold; sign-up refuses another past it. */
54
+ exports.EMAIL_ACCOUNTS_MAX = 20;
55
+ /** Narrow a {@link SignInStepResult}. */
56
+ function isSecondFactorRequired(result) {
57
+ return result.secondFactorRequired === true;
58
+ }
59
+ /** Narrow an {@link EmailSignInStepResult}. */
60
+ function isEmailSignInChooseAccount(result) {
61
+ return result.chooseAccount === true;
62
+ }
63
+ /**
64
+ * What a re-verification email code confirms. The code is bound to it: a code
65
+ * asked for one change never authorises another, and the email names it.
66
+ */
67
+ exports.REAUTH_ACTIONS = [
68
+ 'change_password',
69
+ 'totp',
70
+ 'link_commons',
71
+ 'delete_account',
72
+ 'credentials_manage',
73
+ 'supervision',
74
+ 'supervision_purchase',
75
+ ];
76
+ /**
77
+ * Stable error codes (`error.code` in the API error body). Clients map these
78
+ * through their localization, never the English message.
79
+ */
80
+ exports.SIGN_IN_ERROR_CODES = {
81
+ /** Wrong identifier or password — never says which. */
82
+ invalidCredentials: 'SIGNIN_INVALID_CREDENTIALS',
83
+ /** The request is unknown, expired, spent, or its secret is wrong. */
84
+ requestInvalid: 'SIGNIN_REQUEST_INVALID',
85
+ /** The link is unknown, expired or already used. */
86
+ linkInvalid: 'SIGNIN_LINK_INVALID',
87
+ /** The link was opened in another browser: type the code in the app instead. */
88
+ linkOtherDevice: 'SIGNIN_LINK_OTHER_DEVICE',
89
+ /** The second-factor challenge or its code is wrong, expired or spent. */
90
+ secondFactorInvalid: 'SECOND_FACTOR_INVALID',
91
+ /** Too many failures for this account: wait and try again. */
92
+ locked: 'SIGNIN_LOCKED',
93
+ /** The step needs a fresh proof (`reauth`). */
94
+ reauthRequired: 'REAUTH_REQUIRED',
95
+ /** The fresh proof was wrong. */
96
+ reauthInvalid: 'REAUTH_INVALID',
97
+ /** The account has an authenticator: the proof must carry its code. */
98
+ totpRequired: 'TOTP_REQUIRED',
99
+ /** Enrolling or confirming an authenticator that is already on. */
100
+ totpAlreadyEnabled: 'TOTP_ALREADY_ENABLED',
101
+ /** Disabling, confirming or regenerating codes with no authenticator (or no pending one). */
102
+ totpNotEnabled: 'TOTP_NOT_ENABLED',
103
+ /** The code the authenticator showed at enrolment is wrong. */
104
+ totpCodeInvalid: 'TOTP_CODE_INVALID',
105
+ /** Only official Oxy apps and auth.oxy.so may sign people in here. */
106
+ originNotAllowed: 'SIGNIN_ORIGIN_NOT_ALLOWED',
107
+ /** The username is taken. */
108
+ usernameTaken: 'USERNAME_TAKEN',
109
+ /** The email already holds `EMAIL_ACCOUNTS_MAX` accounts: no sign-up adds another. */
110
+ emailAccountsFull: 'EMAIL_ACCOUNTS_FULL',
111
+ };
112
+ /* -------------------------------------------------------------------------- */
113
+ /* Checks */
114
+ /* -------------------------------------------------------------------------- */
115
+ const expiresAt = (0, check_1.number)(check_1.int, check_1.positive);
116
+ const sixDigits = (0, check_1.string)(check_1.trim, (0, check_1.pattern)(new RegExp(`^\\d{${accountEmail_1.EMAIL_CODE_LENGTH}}$`), `code must be ${accountEmail_1.EMAIL_CODE_LENGTH} digits`));
117
+ const passwordInput = (0, check_1.string)((0, check_1.minLength)(1), (0, check_1.maxLength)(exports.PASSWORD_MAX_LENGTH));
118
+ const secondFactorCode = (0, check_1.string)(check_1.trim, (0, check_1.minLength)(exports.TOTP_DIGITS), (0, check_1.maxLength)(16));
119
+ exports.emailSignInStartResponseCheck = (0, check_1.exact)()((0, check_1.object)({
120
+ requestId: (0, check_1.string)((0, check_1.minLength)(1), (0, check_1.maxLength)(64)),
121
+ requestSecret: accountEmail_1.emailTicketCheck,
122
+ expiresAt,
123
+ retryLater: (0, check_1.optional)((0, check_1.literal)(true)),
124
+ }));
125
+ exports.emailSignInLinkResponseCheck = (0, check_1.exact)()((0, check_1.object)({ approved: (0, check_1.literal)(true) }));
126
+ exports.secondFactorRequiredCheck = (0, check_1.exact)()((0, check_1.object)({ secondFactorRequired: (0, check_1.literal)(true), challengeId: accountEmail_1.emailTicketCheck, expiresAt }));
127
+ exports.emailSignInPendingCheck = (0, check_1.exact)()((0, check_1.object)({ status: (0, check_1.literal)('pending'), expiresAt }));
128
+ const emailSignInAccountOption = (0, check_1.exact)()((0, check_1.object)({
129
+ id: (0, check_1.string)((0, check_1.minLength)(1), (0, check_1.maxLength)(64)),
130
+ username: (0, check_1.optional)((0, check_1.string)((0, check_1.minLength)(1))),
131
+ displayName: (0, check_1.optional)((0, check_1.string)((0, check_1.minLength)(1))),
132
+ avatar: (0, check_1.optional)((0, check_1.string)((0, check_1.minLength)(1))),
133
+ }));
134
+ exports.emailSignInChooseAccountCheck = (0, check_1.exact)()((0, check_1.object)({
135
+ chooseAccount: (0, check_1.literal)(true),
136
+ accounts: (0, check_1.array)(emailSignInAccountOption, (0, check_1.minItems)(2), (0, check_1.maxItems)(exports.EMAIL_ACCOUNTS_MAX)),
137
+ expiresAt,
138
+ }));
139
+ exports.signInMethodsCheck = (0, check_1.exact)()((0, check_1.object)({
140
+ hasEmail: check_1.boolean,
141
+ hasPassword: check_1.boolean,
142
+ totpEnabled: check_1.boolean,
143
+ backupCodesRemaining: (0, check_1.number)(check_1.int, check_1.nonnegative),
144
+ }));
145
+ exports.totpEnrollResponseCheck = (0, check_1.exact)()((0, check_1.object)({
146
+ secret: (0, check_1.string)((0, check_1.pattern)(/^[A-Z2-7]+$/)),
147
+ otpauthUri: (0, check_1.string)((0, check_1.startsWith)('otpauth://totp/')),
148
+ }));
149
+ exports.totpBackupCodesResponseCheck = (0, check_1.exact)()((0, check_1.object)({
150
+ backupCodes: (0, check_1.array)((0, check_1.string)((0, check_1.pattern)(/^[a-z2-9]{5}-[a-z2-9]{5}$/)), (0, check_1.exactItems)(exports.TOTP_BACKUP_CODE_COUNT)),
151
+ }));
152
+ exports.reauthProofCheck = (0, check_1.exact)()((0, check_1.refine)((0, check_1.strictObject)({
153
+ password: (0, check_1.optional)(passwordInput),
154
+ emailCode: (0, check_1.optional)((0, check_1.strictObject)({
155
+ verificationId: (0, check_1.string)(check_1.trim, (0, check_1.minLength)(1), (0, check_1.maxLength)(64)),
156
+ code: sixDigits,
157
+ })),
158
+ totpCode: (0, check_1.optional)(secondFactorCode),
159
+ }), (proof) => proof.password !== undefined || proof.emailCode !== undefined, 'password or emailCode is required'));
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * User-response checks, without Zod. Schemas: `../userResponse.ts`.
4
+ *
5
+ * Part of `@oxy.so/contracts/client`: never import `zod` here (see `./check.ts`).
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.userNameCheck = void 0;
9
+ const check_1 = require("./check");
10
+ exports.userNameCheck = (0, check_1.exact)()((0, check_1.looseObject)({
11
+ first: (0, check_1.optional)((0, check_1.string)()),
12
+ last: (0, check_1.optional)((0, check_1.string)()),
13
+ full: (0, check_1.optional)((0, check_1.string)()),
14
+ displayName: (0, check_1.optional)((0, check_1.string)()),
15
+ }));