@oxy.so/contracts 5.8.0 → 6.0.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 (219) hide show
  1. package/dist/cjs/accountAccess.js +6 -5
  2. package/dist/cjs/accountEmail.js +13 -5
  3. package/dist/cjs/accountGraph.js +10 -9
  4. package/dist/cjs/accountName.js +3 -2
  5. package/dist/cjs/agency.js +91 -34
  6. package/dist/cjs/agentKeys.js +21 -17
  7. package/dist/cjs/appAssertions.js +14 -13
  8. package/dist/cjs/applicationRoles.js +19 -12
  9. package/dist/cjs/civic.js +10 -9
  10. package/dist/cjs/client/check.js +61 -53
  11. package/dist/cjs/consoleOnboarding.js +9 -4
  12. package/dist/cjs/contentClaims.js +23 -14
  13. package/dist/cjs/deviceDirectory.js +11 -9
  14. package/dist/cjs/deviceSession.js +27 -25
  15. package/dist/cjs/email/messages.js +20 -18
  16. package/dist/cjs/emailAgentContext.js +11 -9
  17. package/dist/cjs/externalIdentity.js +15 -11
  18. package/dist/cjs/federationInstanceFetch.js +12 -7
  19. package/dist/cjs/identity.js +19 -17
  20. package/dist/cjs/identityLink.js +6 -4
  21. package/dist/cjs/identityProof.js +6 -4
  22. package/dist/cjs/inboxPush.js +5 -4
  23. package/dist/cjs/index.js +15 -6
  24. package/dist/cjs/inference/accountBilling.js +35 -33
  25. package/dist/cjs/inference/aliaModelRelease.js +9 -7
  26. package/dist/cjs/inference/attribution.js +14 -12
  27. package/dist/cjs/inference/catalogue.js +35 -29
  28. package/dist/cjs/inference/economics.js +24 -19
  29. package/dist/cjs/inference/embeddings.js +9 -7
  30. package/dist/cjs/inference/entitlement.js +17 -15
  31. package/dist/cjs/inference/errors.js +15 -8
  32. package/dist/cjs/inference/identifiers.js +33 -21
  33. package/dist/cjs/inference/inbox.js +37 -35
  34. package/dist/cjs/inference/modelDocumentation.js +16 -14
  35. package/dist/cjs/inference/money.js +5 -4
  36. package/dist/cjs/inference/priceVersion.js +10 -5
  37. package/dist/cjs/inference/providerConnection.js +21 -14
  38. package/dist/cjs/inference/realtime.js +88 -47
  39. package/dist/cjs/inference/request.js +27 -25
  40. package/dist/cjs/inference/routingPolicy.js +12 -10
  41. package/dist/cjs/inference/streamEvents.js +22 -16
  42. package/dist/cjs/inference/usage.js +32 -15
  43. package/dist/cjs/keyRecovery.js +8 -6
  44. package/dist/cjs/keyRotation.js +5 -4
  45. package/dist/cjs/linkedAccounts.js +22 -18
  46. package/dist/cjs/moderationReputation.js +29 -27
  47. package/dist/cjs/notifications.js +25 -9
  48. package/dist/cjs/numberChecks.js +45 -0
  49. package/dist/cjs/oauth.js +14 -12
  50. package/dist/cjs/organizations.js +23 -21
  51. package/dist/cjs/products/access.js +10 -8
  52. package/dist/cjs/products/billing.js +10 -8
  53. package/dist/cjs/products/checkout.js +22 -10
  54. package/dist/cjs/products/plans.js +15 -10
  55. package/dist/cjs/protocol.js +6 -5
  56. package/dist/cjs/recommendations.js +27 -19
  57. package/dist/cjs/reputation.js +15 -13
  58. package/dist/cjs/safety.js +43 -27
  59. package/dist/cjs/serviceToken.js +81 -2
  60. package/dist/cjs/sessionRevocation.js +8 -6
  61. package/dist/cjs/signIn.js +42 -24
  62. package/dist/cjs/stickers.js +19 -15
  63. package/dist/cjs/stringChecks.js +70 -0
  64. package/dist/cjs/transparency.js +14 -12
  65. package/dist/cjs/updates.js +24 -22
  66. package/dist/cjs/userInvalidation.js +7 -5
  67. package/dist/cjs/userResponse.js +8 -7
  68. package/dist/cjs/username.js +7 -6
  69. package/dist/esm/accountAccess.js +4 -3
  70. package/dist/esm/accountEmail.js +13 -5
  71. package/dist/esm/accountGraph.js +8 -7
  72. package/dist/esm/accountName.js +3 -2
  73. package/dist/esm/agency.js +90 -33
  74. package/dist/esm/agentKeys.js +21 -17
  75. package/dist/esm/appAssertions.js +11 -10
  76. package/dist/esm/applicationRoles.js +16 -9
  77. package/dist/esm/civic.js +8 -7
  78. package/dist/esm/client/check.js +61 -53
  79. package/dist/esm/consoleOnboarding.js +7 -2
  80. package/dist/esm/contentClaims.js +23 -14
  81. package/dist/esm/deviceDirectory.js +11 -9
  82. package/dist/esm/deviceSession.js +27 -25
  83. package/dist/esm/email/messages.js +18 -16
  84. package/dist/esm/emailAgentContext.js +11 -9
  85. package/dist/esm/externalIdentity.js +15 -11
  86. package/dist/esm/federationInstanceFetch.js +10 -5
  87. package/dist/esm/identity.js +17 -15
  88. package/dist/esm/identityLink.js +6 -4
  89. package/dist/esm/identityProof.js +6 -4
  90. package/dist/esm/inboxPush.js +3 -2
  91. package/dist/esm/index.js +4 -2
  92. package/dist/esm/inference/accountBilling.js +33 -31
  93. package/dist/esm/inference/aliaModelRelease.js +7 -5
  94. package/dist/esm/inference/attribution.js +14 -12
  95. package/dist/esm/inference/catalogue.js +33 -27
  96. package/dist/esm/inference/economics.js +22 -17
  97. package/dist/esm/inference/embeddings.js +9 -7
  98. package/dist/esm/inference/entitlement.js +15 -13
  99. package/dist/esm/inference/errors.js +13 -6
  100. package/dist/esm/inference/identifiers.js +31 -19
  101. package/dist/esm/inference/inbox.js +37 -35
  102. package/dist/esm/inference/modelDocumentation.js +14 -12
  103. package/dist/esm/inference/money.js +3 -2
  104. package/dist/esm/inference/priceVersion.js +8 -3
  105. package/dist/esm/inference/providerConnection.js +19 -12
  106. package/dist/esm/inference/realtime.js +85 -44
  107. package/dist/esm/inference/request.js +25 -23
  108. package/dist/esm/inference/routingPolicy.js +9 -7
  109. package/dist/esm/inference/streamEvents.js +20 -14
  110. package/dist/esm/inference/usage.js +30 -13
  111. package/dist/esm/keyRecovery.js +8 -6
  112. package/dist/esm/keyRotation.js +5 -4
  113. package/dist/esm/linkedAccounts.js +20 -16
  114. package/dist/esm/moderationReputation.js +27 -25
  115. package/dist/esm/notifications.js +23 -7
  116. package/dist/esm/numberChecks.js +41 -0
  117. package/dist/esm/oauth.js +14 -12
  118. package/dist/esm/organizations.js +23 -21
  119. package/dist/esm/products/access.js +10 -8
  120. package/dist/esm/products/billing.js +10 -8
  121. package/dist/esm/products/checkout.js +22 -10
  122. package/dist/esm/products/plans.js +15 -10
  123. package/dist/esm/protocol.js +4 -3
  124. package/dist/esm/recommendations.js +25 -17
  125. package/dist/esm/reputation.js +13 -11
  126. package/dist/esm/safety.js +43 -27
  127. package/dist/esm/serviceToken.js +80 -1
  128. package/dist/esm/sessionRevocation.js +6 -4
  129. package/dist/esm/signIn.js +42 -24
  130. package/dist/esm/stickers.js +17 -13
  131. package/dist/esm/stringChecks.js +63 -0
  132. package/dist/esm/transparency.js +14 -12
  133. package/dist/esm/updates.js +22 -20
  134. package/dist/esm/userInvalidation.js +4 -2
  135. package/dist/esm/userResponse.js +4 -3
  136. package/dist/esm/username.js +3 -2
  137. package/dist/types/accountAccess.d.ts +29 -70
  138. package/dist/types/accountEmail.d.ts +2 -14
  139. package/dist/types/accountGraph.d.ts +179 -171
  140. package/dist/types/accountName.d.ts +1 -1
  141. package/dist/types/accountSubject.d.ts +20 -93
  142. package/dist/types/agency.d.ts +528 -2924
  143. package/dist/types/agentKeys.d.ts +48 -421
  144. package/dist/types/appAssertions.d.ts +56 -210
  145. package/dist/types/applicationRoles.d.ts +30 -276
  146. package/dist/types/avatarCharacter.d.ts +1 -1
  147. package/dist/types/civic.d.ts +1 -13
  148. package/dist/types/client/agentKeys.d.ts +18 -18
  149. package/dist/types/client/appAssertions.d.ts +3 -3
  150. package/dist/types/client/check.d.ts +13 -13
  151. package/dist/types/client/deviceDirectory.d.ts +51 -51
  152. package/dist/types/client/deviceSession.d.ts +14 -14
  153. package/dist/types/client/organizations.d.ts +25 -25
  154. package/dist/types/client/products.d.ts +33 -33
  155. package/dist/types/client/recommendations.d.ts +2 -2
  156. package/dist/types/client/safety.d.ts +45 -45
  157. package/dist/types/client/sessionStatus.d.ts +4 -4
  158. package/dist/types/client/signIn.d.ts +1 -1
  159. package/dist/types/commonsSignIn.d.ts +4 -1
  160. package/dist/types/consoleOnboarding.d.ts +24 -44
  161. package/dist/types/contentClaims.d.ts +24 -180
  162. package/dist/types/deviceDirectory.d.ts +109 -1040
  163. package/dist/types/deviceSession.d.ts +36 -298
  164. package/dist/types/email/messages.d.ts +212 -1793
  165. package/dist/types/emailAgentContext.d.ts +10 -194
  166. package/dist/types/externalIdentity.d.ts +121 -615
  167. package/dist/types/federationInstanceFetch.d.ts +3 -32
  168. package/dist/types/identity.d.ts +15 -92
  169. package/dist/types/identityLink.d.ts +6 -84
  170. package/dist/types/identityProof.d.ts +5 -17
  171. package/dist/types/inboxPush.d.ts +1 -9
  172. package/dist/types/index.d.ts +5 -3
  173. package/dist/types/inference/accountBilling.d.ts +151 -488
  174. package/dist/types/inference/aliaModelRelease.d.ts +42 -439
  175. package/dist/types/inference/attribution.d.ts +75 -104
  176. package/dist/types/inference/catalogue.d.ts +417 -1599
  177. package/dist/types/inference/economics.d.ts +69 -276
  178. package/dist/types/inference/embeddings.d.ts +110 -406
  179. package/dist/types/inference/entitlement.d.ts +80 -335
  180. package/dist/types/inference/errors.d.ts +90 -102
  181. package/dist/types/inference/identifiers.d.ts +12 -4
  182. package/dist/types/inference/inbox.d.ts +105 -420
  183. package/dist/types/inference/modelDocumentation.d.ts +201 -1390
  184. package/dist/types/inference/money.d.ts +65 -32
  185. package/dist/types/inference/priceVersion.d.ts +53 -120
  186. package/dist/types/inference/providerConnection.d.ts +253 -710
  187. package/dist/types/inference/realtime.d.ts +954 -6825
  188. package/dist/types/inference/request.d.ts +300 -2572
  189. package/dist/types/inference/routingPolicy.d.ts +95 -503
  190. package/dist/types/inference/streamEvents.d.ts +253 -721
  191. package/dist/types/inference/usage.d.ts +317 -950
  192. package/dist/types/keyRecovery.d.ts +3 -51
  193. package/dist/types/keyRotation.d.ts +3 -38
  194. package/dist/types/linkedAccounts.d.ts +50 -236
  195. package/dist/types/moderationReputation.d.ts +81 -14
  196. package/dist/types/notifications.d.ts +19 -51
  197. package/dist/types/numberChecks.d.ts +9 -0
  198. package/dist/types/oauth.d.ts +101 -809
  199. package/dist/types/organizations.d.ts +268 -921
  200. package/dist/types/oxyRecordTypes.d.ts +11 -1
  201. package/dist/types/products/access.d.ts +125 -775
  202. package/dist/types/products/billing.d.ts +67 -503
  203. package/dist/types/products/checkout.d.ts +16 -69
  204. package/dist/types/products/plans.d.ts +33 -366
  205. package/dist/types/recommendations.d.ts +76 -389
  206. package/dist/types/reputation.d.ts +37 -5
  207. package/dist/types/safety.d.ts +408 -2048
  208. package/dist/types/serviceToken.d.ts +247 -7
  209. package/dist/types/sessionRevocation.d.ts +2 -17
  210. package/dist/types/sessionStatus.d.ts +27 -115
  211. package/dist/types/signIn.d.ts +53 -553
  212. package/dist/types/stickers.d.ts +67 -819
  213. package/dist/types/stringChecks.d.ts +16 -0
  214. package/dist/types/transparency.d.ts +14 -302
  215. package/dist/types/updates.d.ts +60 -316
  216. package/dist/types/userInvalidation.d.ts +4 -13
  217. package/dist/types/userResponse.d.ts +302 -2400
  218. package/dist/types/username.d.ts +3 -3
  219. package/package.json +2 -2
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.totpBackupCodesResponseSchema = exports.totpReauthRequestSchema = exports.totpConfirmRequestSchema = exports.totpEnrollResponseSchema = exports.signInMethodsSchema = exports.emailSetRequestSchema = exports.emailChangeStartRequestSchema = exports.signInMethodRemoveRequestSchema = exports.passwordSetRequestSchema = exports.reauthProofSchema = exports.reauthEmailStartRequestSchema = exports.emailSignInChooseRequestSchema = exports.emailSignInChooseAccountSchema = exports.emailSignInAccountOptionSchema = exports.emailSignInPendingSchema = exports.secondFactorRequiredSchema = exports.signUpRequestSchema = exports.secondFactorSignInRequestSchema = exports.passwordSignInRequestSchema = exports.emailSignInLinkResponseSchema = exports.emailSignInLinkRequestSchema = exports.emailSignInCollectRequestSchema = exports.emailSignInConfirmRequestSchema = exports.emailSignInCodeSchema = exports.emailSignInStartResponseSchema = exports.emailSignInStartRequestSchema = exports.secondFactorCodeSchema = exports.newPasswordSchema = exports.passwordInputSchema = exports.signInIdentifierSchema = exports.SIGN_IN_ERROR_CODES = exports.REAUTH_ACTIONS = exports.isEmailSignInChooseAccount = exports.isSecondFactorRequired = exports.EMAIL_ACCOUNTS_MAX = exports.EMAIL_SIGNIN_CHOICE_TTL_MS = exports.normalizeEmailSignInCode = 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;
4
+ const numberChecks_1 = require("./numberChecks");
5
+ const stringChecks_1 = require("./stringChecks");
4
6
  /**
5
7
  * Signing in: an email code or link, an optional password,
6
8
  * and an optional authenticator app (TOTP) as a second factor.
@@ -66,23 +68,39 @@ const sixDigits = zod_1.z
66
68
  */
67
69
  const opaqueTokenSchema = accountEmail_1.emailTicketSchema;
68
70
  /** A username or an email. */
69
- exports.signInIdentifierSchema = zod_1.z.string().trim().min(1).max(254);
71
+ exports.signInIdentifierSchema = zod_1.z
72
+ .string()
73
+ .trim()
74
+ .check((0, stringChecks_1.utf16MinLength)(1))
75
+ .check((0, stringChecks_1.utf16MaxLength)(254));
70
76
  /** A password as typed. Its policy applies only when one is set. */
71
- exports.passwordInputSchema = zod_1.z.string().min(1).max(signIn_1.PASSWORD_MAX_LENGTH);
77
+ exports.passwordInputSchema = zod_1.z
78
+ .string()
79
+ .check((0, stringChecks_1.utf16MinLength)(1))
80
+ .check((0, stringChecks_1.utf16MaxLength)(signIn_1.PASSWORD_MAX_LENGTH));
72
81
  /** A new password. */
73
82
  exports.newPasswordSchema = zod_1.z
74
83
  .string()
75
- .min(signIn_1.PASSWORD_MIN_LENGTH, `password must be at least ${signIn_1.PASSWORD_MIN_LENGTH} characters`)
76
- .max(signIn_1.PASSWORD_MAX_LENGTH, `password must be at most ${signIn_1.PASSWORD_MAX_LENGTH} characters`);
84
+ .check((0, stringChecks_1.utf16MinLength)(signIn_1.PASSWORD_MIN_LENGTH, `password must be at least ${signIn_1.PASSWORD_MIN_LENGTH} characters`))
85
+ .check((0, stringChecks_1.utf16MaxLength)(signIn_1.PASSWORD_MAX_LENGTH, `password must be at most ${signIn_1.PASSWORD_MAX_LENGTH} characters`));
77
86
  /**
78
87
  * An authenticator code (6 digits) or a backup code (10 characters, with or
79
88
  * without its dash). Normalised server-side.
80
89
  */
81
- exports.secondFactorCodeSchema = zod_1.z.string().trim().min(signIn_1.TOTP_DIGITS).max(16);
90
+ exports.secondFactorCodeSchema = zod_1.z
91
+ .string()
92
+ .trim()
93
+ .check((0, stringChecks_1.utf16MinLength)(signIn_1.TOTP_DIGITS))
94
+ .check((0, stringChecks_1.utf16MaxLength)(16));
82
95
  /** The device-session fields every body that ends in a session may carry. */
83
96
  const sessionEnvelope = {
84
- deviceName: zod_1.z.string().trim().min(1).max(120).optional(),
85
- deviceFingerprint: zod_1.z.string().trim().min(1).max(256).optional(),
97
+ deviceName: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(120)).optional(),
98
+ deviceFingerprint: zod_1.z
99
+ .string()
100
+ .trim()
101
+ .check((0, stringChecks_1.utf16MinLength)(1))
102
+ .check((0, stringChecks_1.utf16MaxLength)(256))
103
+ .optional(),
86
104
  /** Proof of the browser's shared device; invalid → the session gets its own. */
87
105
  device: deviceSession_1.deviceProofSchema.optional(),
88
106
  };
@@ -95,9 +113,9 @@ exports.emailSignInStartRequestSchema = zod_1.z
95
113
  })
96
114
  .strict();
97
115
  exports.emailSignInStartResponseSchema = zod_1.z.object({
98
- requestId: zod_1.z.string().min(1).max(64),
116
+ requestId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
99
117
  requestSecret: opaqueTokenSchema,
100
- expiresAt: zod_1.z.number().int().positive(),
118
+ expiresAt: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
101
119
  retryLater: zod_1.z.literal(true).optional(),
102
120
  });
103
121
  /**
@@ -120,7 +138,7 @@ exports.emailSignInCodeSchema = zod_1.z
120
138
  /** `POST /auth/signin/email/confirm` — the code from the email. */
121
139
  exports.emailSignInConfirmRequestSchema = zod_1.z
122
140
  .object({
123
- requestId: zod_1.z.string().trim().min(1).max(64),
141
+ requestId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
124
142
  requestSecret: opaqueTokenSchema,
125
143
  code: exports.emailSignInCodeSchema,
126
144
  ...sessionEnvelope,
@@ -129,7 +147,7 @@ exports.emailSignInConfirmRequestSchema = zod_1.z
129
147
  /** `POST /auth/signin/email/collect` — the dialog asks whether its link was opened. */
130
148
  exports.emailSignInCollectRequestSchema = zod_1.z
131
149
  .object({
132
- requestId: zod_1.z.string().trim().min(1).max(64),
150
+ requestId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
133
151
  requestSecret: opaqueTokenSchema,
134
152
  ...sessionEnvelope,
135
153
  })
@@ -167,7 +185,7 @@ exports.secondFactorSignInRequestSchema = zod_1.z
167
185
  /** `POST /auth/signup` — the account, from a username and a confirmed email. */
168
186
  exports.signUpRequestSchema = zod_1.z
169
187
  .object({
170
- username: zod_1.z.string().trim().min(1).max(60),
188
+ username: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(60)),
171
189
  email: accountEmail_1.emailAddressSchema,
172
190
  /** The ticket `POST /auth/email/verify/confirm` (purpose `signup`) returned. */
173
191
  emailTicket: accountEmail_1.emailTicketSchema,
@@ -177,29 +195,29 @@ exports.signUpRequestSchema = zod_1.z
177
195
  exports.secondFactorRequiredSchema = zod_1.z.object({
178
196
  secondFactorRequired: zod_1.z.literal(true),
179
197
  challengeId: opaqueTokenSchema,
180
- expiresAt: zod_1.z.number().int().positive(),
198
+ expiresAt: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
181
199
  });
182
200
  exports.emailSignInPendingSchema = zod_1.z.object({
183
201
  status: zod_1.z.literal('pending'),
184
- expiresAt: zod_1.z.number().int().positive(),
202
+ expiresAt: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
185
203
  });
186
204
  exports.emailSignInAccountOptionSchema = zod_1.z.object({
187
- id: zod_1.z.string().min(1).max(64),
188
- username: zod_1.z.string().min(1).optional(),
189
- displayName: zod_1.z.string().min(1).optional(),
190
- avatar: zod_1.z.string().min(1).optional(),
205
+ id: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
206
+ username: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
207
+ displayName: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
208
+ avatar: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
191
209
  });
192
210
  exports.emailSignInChooseAccountSchema = zod_1.z.object({
193
211
  chooseAccount: zod_1.z.literal(true),
194
212
  accounts: zod_1.z.array(exports.emailSignInAccountOptionSchema).min(2).max(signIn_1.EMAIL_ACCOUNTS_MAX),
195
- expiresAt: zod_1.z.number().int().positive(),
213
+ expiresAt: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
196
214
  });
197
215
  /** `POST /auth/signin/email/choose` — the account, from those {@link EmailSignInChooseAccount} listed. */
198
216
  exports.emailSignInChooseRequestSchema = zod_1.z
199
217
  .object({
200
- requestId: zod_1.z.string().trim().min(1).max(64),
218
+ requestId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
201
219
  requestSecret: opaqueTokenSchema,
202
- userId: zod_1.z.string().trim().min(1).max(64),
220
+ userId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
203
221
  ...sessionEnvelope,
204
222
  })
205
223
  .strict();
@@ -216,7 +234,7 @@ exports.reauthProofSchema = zod_1.z
216
234
  password: exports.passwordInputSchema.optional(),
217
235
  emailCode: zod_1.z
218
236
  .object({
219
- verificationId: zod_1.z.string().trim().min(1).max(64),
237
+ verificationId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
220
238
  code: sixDigits,
221
239
  })
222
240
  .strict()
@@ -253,7 +271,7 @@ exports.emailChangeStartRequestSchema = zod_1.z.object({ email: accountEmail_1.e
253
271
  exports.emailSetRequestSchema = zod_1.z
254
272
  .object({
255
273
  email: accountEmail_1.emailAddressSchema,
256
- verificationId: zod_1.z.string().trim().min(1).max(64),
274
+ verificationId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
257
275
  code: sixDigits,
258
276
  reauth: exports.reauthProofSchema,
259
277
  })
@@ -262,7 +280,7 @@ exports.signInMethodsSchema = zod_1.z.object({
262
280
  hasEmail: zod_1.z.boolean(),
263
281
  hasPassword: zod_1.z.boolean(),
264
282
  totpEnabled: zod_1.z.boolean(),
265
- backupCodesRemaining: zod_1.z.number().int().min(0),
283
+ backupCodesRemaining: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).min(0),
266
284
  });
267
285
  exports.totpEnrollResponseSchema = zod_1.z.object({
268
286
  secret: zod_1.z.string().regex(/^[A-Z2-7]+$/),
@@ -1,4 +1,8 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateStickerPackRequestSchema = exports.createStickerPackRequestSchema = exports.reorderStickerPacksRequestSchema = exports.resolveStickersResponseSchema = exports.resolveStickersRequestSchema = exports.stickerRefSchema = exports.installedStickerPackSchema = exports.stickerPackSchema = exports.stickerPackSummarySchema = exports.stickerSchema = exports.stickerFileSchema = exports.stickerPackStatusSchema = exports.stickerIdSchema = exports.stickerPackSlugSchema = exports.stickerSha256Schema = exports.STICKER_RESOLVE_MAX_IDS = exports.STICKER_MAX_INSTALLED_PACKS = exports.STICKER_PACK_MAX_STICKERS = exports.STICKER_MAX_FALLBACK_BYTES = exports.STICKER_MAX_ANIMATION_BYTES = exports.STICKER_MAX_UPLOAD_BYTES = exports.STICKER_MAX_FRAME_RATE = exports.STICKER_MAX_DURATION_MS = exports.STICKER_FALLBACK_SIZE = exports.STICKER_CANVAS_SIZES = void 0;
4
+ const numberChecks_1 = require("./numberChecks");
5
+ const stringChecks_1 = require("./stringChecks");
2
6
  /**
3
7
  * Stickers — the wire shape of Oxy's shared sticker catalogue.
4
8
  *
@@ -14,8 +18,6 @@
14
18
  *
15
19
  * Platform-agnostic — zod only. ESM-safe (no `require()`).
16
20
  */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.updateStickerPackRequestSchema = exports.createStickerPackRequestSchema = exports.reorderStickerPacksRequestSchema = exports.resolveStickersResponseSchema = exports.resolveStickersRequestSchema = exports.stickerRefSchema = exports.installedStickerPackSchema = exports.stickerPackSchema = exports.stickerPackSummarySchema = exports.stickerSchema = exports.stickerFileSchema = exports.stickerPackStatusSchema = exports.stickerIdSchema = exports.stickerPackSlugSchema = exports.stickerSha256Schema = exports.STICKER_RESOLVE_MAX_IDS = exports.STICKER_MAX_INSTALLED_PACKS = exports.STICKER_PACK_MAX_STICKERS = exports.STICKER_MAX_FALLBACK_BYTES = exports.STICKER_MAX_ANIMATION_BYTES = exports.STICKER_MAX_UPLOAD_BYTES = exports.STICKER_MAX_FRAME_RATE = exports.STICKER_MAX_DURATION_MS = exports.STICKER_FALLBACK_SIZE = exports.STICKER_CANVAS_SIZES = void 0;
19
21
  const zod_1 = require("zod");
20
22
  /* -------------------------------------------------------------------------- */
21
23
  /* Limits */
@@ -62,17 +64,17 @@ exports.stickerSha256Schema = zod_1.z
62
64
  /** A pack's public URL segment. */
63
65
  exports.stickerPackSlugSchema = zod_1.z
64
66
  .string()
65
- .min(2)
66
- .max(64)
67
+ .check((0, stringChecks_1.utf16MinLength)(2))
68
+ .check((0, stringChecks_1.utf16MaxLength)(64))
67
69
  .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, 'slug must be lowercase words joined by hyphens');
68
- exports.stickerIdSchema = zod_1.z.string().min(1).max(64);
70
+ exports.stickerIdSchema = zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64));
69
71
  exports.stickerPackStatusSchema = zod_1.z.enum(['draft', 'published', 'archived']);
70
72
  /** One stored file: where to fetch it and the hash its bytes must have. */
71
73
  exports.stickerFileSchema = zod_1.z.object({
72
- url: zod_1.z.string().url(),
74
+ url: zod_1.z.string().check((0, stringChecks_1.urlCheck)()),
73
75
  sha256: exports.stickerSha256Schema,
74
76
  mime: zod_1.z.string(),
75
- bytes: zod_1.z.number().int().nonnegative(),
77
+ bytes: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
76
78
  });
77
79
  /* -------------------------------------------------------------------------- */
78
80
  /* Catalogue */
@@ -82,8 +84,8 @@ exports.stickerSchema = zod_1.z.object({
82
84
  packId: zod_1.z.string(),
83
85
  emoji: zod_1.z.array(zod_1.z.string()).min(1),
84
86
  keywords: zod_1.z.array(zod_1.z.string()),
85
- size: zod_1.z.number().int().positive(),
86
- durationMs: zod_1.z.number().int().positive(),
87
+ size: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
88
+ durationMs: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
87
89
  /** The Lottie JSON. */
88
90
  animation: exports.stickerFileSchema,
89
91
  /** A static image of the same sticker. */
@@ -98,7 +100,7 @@ exports.stickerPackSummarySchema = zod_1.z.object({
98
100
  author: zod_1.z.string().nullable(),
99
101
  status: exports.stickerPackStatusSchema,
100
102
  publishedAt: zod_1.z.string().nullable(),
101
- stickerCount: zod_1.z.number().int().nonnegative(),
103
+ stickerCount: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
102
104
  /** The first sticker, drawn as the pack's cover. Null for an empty draft. */
103
105
  cover: exports.stickerSchema.nullable(),
104
106
  });
@@ -120,7 +122,7 @@ exports.installedStickerPackSchema = exports.stickerPackSchema.extend({
120
122
  */
121
123
  exports.stickerRefSchema = zod_1.z.object({
122
124
  stickerId: exports.stickerIdSchema,
123
- packId: zod_1.z.string().min(1).max(64),
125
+ packId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
124
126
  sha256: exports.stickerSha256Schema,
125
127
  });
126
128
  /* -------------------------------------------------------------------------- */
@@ -136,14 +138,16 @@ exports.resolveStickersResponseSchema = zod_1.z.object({
136
138
  });
137
139
  /** PATCH /stickers/me/packs/order — the installed pack ids, first to last. */
138
140
  exports.reorderStickerPacksRequestSchema = zod_1.z.object({
139
- packIds: zod_1.z.array(zod_1.z.string().min(1).max(64)).max(exports.STICKER_MAX_INSTALLED_PACKS),
141
+ packIds: zod_1.z
142
+ .array(zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)))
143
+ .max(exports.STICKER_MAX_INSTALLED_PACKS),
140
144
  });
141
145
  /** POST /stickers/admin/packs */
142
146
  exports.createStickerPackRequestSchema = zod_1.z.object({
143
147
  slug: exports.stickerPackSlugSchema,
144
- title: zod_1.z.string().trim().min(1).max(64),
145
- description: zod_1.z.string().trim().max(500).nullish(),
146
- author: zod_1.z.string().trim().max(64).nullish(),
148
+ title: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
149
+ description: zod_1.z.string().trim().check((0, stringChecks_1.utf16MaxLength)(500)).nullish(),
150
+ author: zod_1.z.string().trim().check((0, stringChecks_1.utf16MaxLength)(64)).nullish(),
147
151
  });
148
152
  /** PATCH /stickers/admin/packs/:packId */
149
153
  exports.updateStickerPackRequestSchema = exports.createStickerPackRequestSchema
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.utf16MinLength = utf16MinLength;
4
+ exports.utf16MaxLength = utf16MaxLength;
5
+ exports.utf16Length = utf16Length;
6
+ exports.isoDateTime = isoDateTime;
7
+ exports.urlCheck = urlCheck;
8
+ const zod_1 = require("zod");
9
+ /**
10
+ * Oxy text limits count UTF-16 units. Each factory owns its check and retains
11
+ * native metadata for standard JSON Schema and OpenAPI consumers.
12
+ */
13
+ function stringLengthCheck(kind, value, message) {
14
+ const check = kind === 'min'
15
+ ? zod_1.z.minLength(value, message)
16
+ : kind === 'max'
17
+ ? zod_1.z.maxLength(value, message)
18
+ : zod_1.z.length(value, message);
19
+ check._zod.check = (context) => {
20
+ const length = context.value.length;
21
+ const tooSmall = kind !== 'max' && length < value;
22
+ const tooBig = kind !== 'min' && length > value;
23
+ if (!tooSmall && !tooBig)
24
+ return;
25
+ context.issues.push({
26
+ origin: 'string',
27
+ ...(tooSmall
28
+ ? { code: 'too_small', minimum: value }
29
+ : { code: 'too_big', maximum: value }),
30
+ inclusive: true,
31
+ ...(kind === 'length' ? { exact: true } : {}),
32
+ input: context.value,
33
+ inst: check,
34
+ continue: true,
35
+ });
36
+ };
37
+ return check;
38
+ }
39
+ function utf16MinLength(minimum, message) {
40
+ return stringLengthCheck('min', minimum, message);
41
+ }
42
+ function utf16MaxLength(maximum, message) {
43
+ return stringLengthCheck('max', maximum, message);
44
+ }
45
+ function utf16Length(length, message) {
46
+ return stringLengthCheck('length', length, message);
47
+ }
48
+ /** Oxy timestamps retain optional seconds, fractional precision and existing offset syntax. */
49
+ function isoDateTime(options = {}) {
50
+ const params = typeof options === 'string' ? { message: options } : options;
51
+ const precision = params.precision;
52
+ const date = zod_1.z.regexes.date.source.slice(1, -1);
53
+ const fraction = precision ? `\\.\\d{${precision}}` : precision == null ? '(\\.\\d+)?' : '';
54
+ const seconds = `(:[0-5]\\d${fraction})${precision ? '+' : '?'}`;
55
+ const zone = `${params.local ? 'Z?' : 'Z'}${params.offset ? '|[+-]\\d{2}:?\\d{2}' : ''}`;
56
+ const expression = new RegExp(`^${date}T([01]\\d|2[0-3]):[0-5]\\d${seconds}(${zone})$`);
57
+ return zod_1.z.stringFormat('datetime', expression, params);
58
+ }
59
+ /** Validate a URL without normalizing the value returned by the API contract. */
60
+ function urlCheck(message) {
61
+ return zod_1.z.stringFormat('url', (value) => {
62
+ try {
63
+ new URL(value);
64
+ return true;
65
+ }
66
+ catch {
67
+ return false;
68
+ }
69
+ }, message);
70
+ }
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transparencyCheckpointListSchema = exports.transparencyInclusionProofSchema = exports.transparencyCheckpointSchema = exports.transparencyAnchorSchema = exports.transparencyCheckpointSignatureSchema = void 0;
4
+ const numberChecks_1 = require("./numberChecks");
5
+ const stringChecks_1 = require("./stringChecks");
4
6
  const zod_1 = require("zod");
5
7
  /**
6
8
  * Transparency log — the public wire contract of the checkpoint surface.
@@ -34,19 +36,19 @@ const hexDigestSchema = zod_1.z
34
36
  */
35
37
  exports.transparencyCheckpointSignatureSchema = zod_1.z.object({
36
38
  /** Uncompressed hex public key of the signer. */
37
- publicKey: zod_1.z.string().min(1),
39
+ publicKey: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
38
40
  alg: zod_1.z.literal('ES256K-DER-SHA256'),
39
41
  /** DER-encoded hex secp256k1 signature over the checkpoint signing input. */
40
- signature: zod_1.z.string().min(1),
42
+ signature: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
41
43
  });
42
44
  /** Where a checkpoint root was published on a public chain. */
43
45
  exports.transparencyAnchorSchema = zod_1.z.object({
44
46
  /** Chain/network identifier, e.g. `faircoin-main`. */
45
- network: zod_1.z.string().min(1),
46
- txid: zod_1.z.string().min(1),
47
- confirmations: zod_1.z.number().int().nonnegative(),
47
+ network: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
48
+ txid: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
49
+ confirmations: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
48
50
  /** When the anchoring transaction was broadcast (ms epoch). */
49
- anchoredAt: zod_1.z.number().int().positive(),
51
+ anchoredAt: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
50
52
  });
51
53
  /**
52
54
  * A published checkpoint.
@@ -57,11 +59,11 @@ exports.transparencyAnchorSchema = zod_1.z.object({
57
59
  * normal, temporary state rather than an error.
58
60
  */
59
61
  exports.transparencyCheckpointSchema = zod_1.z.object({
60
- index: zod_1.z.number().int().nonnegative(),
62
+ index: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
61
63
  /** End of the committed period (ms epoch). */
62
- periodEnd: zod_1.z.number().int().positive(),
64
+ periodEnd: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
63
65
  /** Number of subjects (leaves) committed. */
64
- treeSize: zod_1.z.number().int().nonnegative(),
66
+ treeSize: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
65
67
  root: hexDigestSchema,
66
68
  /** Hash of the previous checkpoint; `null` only at genesis. */
67
69
  prevCheckpointHash: hexDigestSchema.nullable(),
@@ -77,11 +79,11 @@ exports.transparencyCheckpointSchema = zod_1.z.object({
77
79
  */
78
80
  exports.transparencyInclusionProofSchema = zod_1.z.object({
79
81
  checkpoint: exports.transparencyCheckpointSchema,
80
- subjectDid: zod_1.z.string().min(1),
81
- seq: zod_1.z.number().int().nonnegative(),
82
+ subjectDid: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
83
+ seq: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
82
84
  headRecordId: hexDigestSchema,
83
85
  leaf: hexDigestSchema,
84
- leafIndex: zod_1.z.number().int().nonnegative(),
86
+ leafIndex: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
85
87
  /** Audit path, leaf-adjacent sibling first; empty for a single-leaf tree. */
86
88
  proof: zod_1.z.array(hexDigestSchema),
87
89
  });
@@ -1,4 +1,8 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateRolloutPatchSchema = exports.promoteRequestSchema = exports.rollbackToEmbeddedRequestSchema = exports.rollbackRequestSchema = exports.updateListResponseSchema = exports.channelListResponseSchema = exports.channelSchema = exports.rollbackToEmbeddedEntrySchema = exports.createUpdateResponseSchema = exports.updateSchema = exports.createUpdateRequestSchema = exports.updateAssetRefSchema = exports.assetCompleteResponseSchema = exports.assetCompleteResultItemSchema = exports.assetCompleteRequestSchema = exports.assetInitResponseSchema = exports.assetUploadTicketSchema = exports.assetInitRequestSchema = exports.assetInitItemSchema = exports.rolloutPercentSchema = exports.runtimeVersionSchema = exports.channelNameSchema = exports.sha256HexSchema = exports.updateAssetStatusSchema = exports.updateStatusSchema = exports.updatePlatformSchema = void 0;
4
+ const numberChecks_1 = require("./numberChecks");
5
+ const stringChecks_1 = require("./stringChecks");
2
6
  /**
3
7
  * Oxy Updates (self-hosted expo-updates protocol) — publish/admin API contracts.
4
8
  *
@@ -24,8 +28,6 @@
24
28
  * Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
25
29
  * `require()`).
26
30
  */
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.updateRolloutPatchSchema = exports.promoteRequestSchema = exports.rollbackToEmbeddedRequestSchema = exports.rollbackRequestSchema = exports.updateListResponseSchema = exports.channelListResponseSchema = exports.channelSchema = exports.rollbackToEmbeddedEntrySchema = exports.createUpdateResponseSchema = exports.updateSchema = exports.createUpdateRequestSchema = exports.updateAssetRefSchema = exports.assetCompleteResponseSchema = exports.assetCompleteResultItemSchema = exports.assetCompleteRequestSchema = exports.assetInitResponseSchema = exports.assetUploadTicketSchema = exports.assetInitRequestSchema = exports.assetInitItemSchema = exports.rolloutPercentSchema = exports.runtimeVersionSchema = exports.channelNameSchema = exports.sha256HexSchema = exports.updateAssetStatusSchema = exports.updateStatusSchema = exports.updatePlatformSchema = void 0;
29
31
  const zod_1 = require("zod");
30
32
  /* -------------------------------------------------------------------------- */
31
33
  /* Shared primitives */
@@ -47,13 +49,13 @@ exports.sha256HexSchema = zod_1.z
47
49
  */
48
50
  exports.channelNameSchema = zod_1.z
49
51
  .string()
50
- .min(1)
51
- .max(100)
52
+ .check((0, stringChecks_1.utf16MinLength)(1))
53
+ .check((0, stringChecks_1.utf16MaxLength)(100))
52
54
  .regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/, 'channel name must be a URL-safe slug');
53
55
  /** A runtime version string (expo-updates `runtimeVersion`, e.g. an appVersion). */
54
- exports.runtimeVersionSchema = zod_1.z.string().min(1).max(255);
56
+ exports.runtimeVersionSchema = zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(255));
55
57
  /** A rollout percentage: 0 rolls out to nobody, 100 to everybody. */
56
- exports.rolloutPercentSchema = zod_1.z.number().int().min(0).max(100);
58
+ exports.rolloutPercentSchema = zod_1.z.number().check((0, numberChecks_1.integerCheck)()).min(0).max(100);
57
59
  /* -------------------------------------------------------------------------- */
58
60
  /* Assets: init + complete */
59
61
  /* -------------------------------------------------------------------------- */
@@ -64,8 +66,8 @@ exports.rolloutPercentSchema = zod_1.z.number().int().min(0).max(100);
64
66
  */
65
67
  exports.assetInitItemSchema = zod_1.z.object({
66
68
  sha256: exports.sha256HexSchema,
67
- contentType: zod_1.z.string().min(1).max(255),
68
- size: zod_1.z.number().int().positive(),
69
+ contentType: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(255)),
70
+ size: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive(),
69
71
  });
70
72
  /**
71
73
  * `POST /updates/v1/assets/init` request. Declares the full asset set of an
@@ -73,7 +75,7 @@ exports.assetInitItemSchema = zod_1.z.object({
73
75
  * already hold (content-addressed dedup — unchanged assets are never re-uploaded).
74
76
  */
75
77
  exports.assetInitRequestSchema = zod_1.z.object({
76
- applicationId: zod_1.z.string().min(1),
78
+ applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
77
79
  assets: zod_1.z.array(exports.assetInitItemSchema).min(1).max(2000),
78
80
  });
79
81
  /** One presigned upload the client must PUT its bytes to before completing. */
@@ -109,14 +111,14 @@ exports.assetInitResponseSchema = zod_1.z.object({
109
111
  * `uploaded`; an object that is absent or size-mismatched is rejected.
110
112
  */
111
113
  exports.assetCompleteRequestSchema = zod_1.z.object({
112
- applicationId: zod_1.z.string().min(1),
114
+ applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
113
115
  sha256s: zod_1.z.array(exports.sha256HexSchema).min(1).max(2000),
114
116
  });
115
117
  /** Per-asset verification outcome from `assets/complete`. */
116
118
  exports.assetCompleteResultItemSchema = zod_1.z.object({
117
119
  sha256: exports.sha256HexSchema,
118
120
  status: exports.updateAssetStatusSchema,
119
- size: zod_1.z.number().int().nonnegative(),
121
+ size: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
120
122
  });
121
123
  exports.assetCompleteResponseSchema = zod_1.z.object({
122
124
  assets: zod_1.z.array(exports.assetCompleteResultItemSchema),
@@ -132,8 +134,8 @@ exports.assetCompleteResponseSchema = zod_1.z.object({
132
134
  exports.updateAssetRefSchema = zod_1.z.object({
133
135
  sha256: exports.sha256HexSchema,
134
136
  /** expo-export asset key (md5 basename) — how app code references the asset. */
135
- key: zod_1.z.string().min(1),
136
- contentType: zod_1.z.string().min(1),
137
+ key: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
138
+ contentType: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
137
139
  /** Suggested file extension including the leading dot (e.g. `.js`, `.png`). */
138
140
  fileExtension: zod_1.z.string().optional(),
139
141
  });
@@ -144,7 +146,7 @@ exports.updateAssetRefSchema = zod_1.z.object({
144
146
  * MUST carry `expoClient` so `Constants.expoConfig` works after an OTA update.
145
147
  */
146
148
  exports.createUpdateRequestSchema = zod_1.z.object({
147
- applicationId: zod_1.z.string().min(1),
149
+ applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
148
150
  channel: exports.channelNameSchema,
149
151
  runtimeVersion: exports.runtimeVersionSchema,
150
152
  platform: exports.updatePlatformSchema,
@@ -162,11 +164,11 @@ exports.createUpdateRequestSchema = zod_1.z.object({
162
164
  /** Initial rollout percentage (default 100 — full rollout). */
163
165
  rolloutPercent: exports.rolloutPercentSchema.optional(),
164
166
  /** Git commit the bundle was built from (audit / console display). */
165
- gitCommit: zod_1.z.string().max(100).optional(),
167
+ gitCommit: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(100)).optional(),
166
168
  /** Git branch the bundle was built from (audit / console display). */
167
- gitBranch: zod_1.z.string().max(200).optional(),
169
+ gitBranch: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(200)).optional(),
168
170
  /** Human-readable publish message (console display). */
169
- message: zod_1.z.string().max(500).optional(),
171
+ message: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(500)).optional(),
170
172
  });
171
173
  exports.updateSchema = zod_1.z.object({
172
174
  id: zod_1.z.string(),
@@ -216,7 +218,7 @@ exports.updateListResponseSchema = zod_1.z.object({
216
218
  * update (if any) becomes head again. Nothing is deleted.
217
219
  */
218
220
  exports.rollbackRequestSchema = zod_1.z.object({
219
- applicationId: zod_1.z.string().min(1),
221
+ applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
220
222
  runtimeVersion: exports.runtimeVersionSchema,
221
223
  platform: exports.updatePlatformSchema,
222
224
  });
@@ -226,7 +228,7 @@ exports.rollbackRequestSchema = zod_1.z.object({
226
228
  * fall back to the update embedded in their binary.
227
229
  */
228
230
  exports.rollbackToEmbeddedRequestSchema = zod_1.z.object({
229
- applicationId: zod_1.z.string().min(1),
231
+ applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
230
232
  runtimeVersion: exports.runtimeVersionSchema,
231
233
  platform: exports.updatePlatformSchema,
232
234
  });
@@ -236,8 +238,8 @@ exports.rollbackToEmbeddedRequestSchema = zod_1.z.object({
236
238
  * UUID) pointing at the SAME assets. `toChannel` defaults to the path channel.
237
239
  */
238
240
  exports.promoteRequestSchema = zod_1.z.object({
239
- applicationId: zod_1.z.string().min(1),
240
- updateId: zod_1.z.string().min(1),
241
+ applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
242
+ updateId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
241
243
  /** Target channel to promote into. Defaults to the path `:channel`. */
242
244
  toChannel: exports.channelNameSchema.optional(),
243
245
  /** Rollout percentage for the promoted update (default 100). */
@@ -245,6 +247,6 @@ exports.promoteRequestSchema = zod_1.z.object({
245
247
  });
246
248
  /** `PATCH /updates/v1/updates/:updateId` request — adjust a rollout in place. */
247
249
  exports.updateRolloutPatchSchema = zod_1.z.object({
248
- applicationId: zod_1.z.string().min(1),
250
+ applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
249
251
  rolloutPercent: exports.rolloutPercentSchema,
250
252
  });
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.oxyUserInvalidationEventSchema = exports.OXY_PUBLISHED_USER_CHANGE_REASONS = exports.OXY_USER_CHANGE_REASONS = exports.OXY_USER_INVALIDATION_CHANNEL = void 0;
4
+ exports.isPublishedOxyUserChangeReason = isPublishedOxyUserChangeReason;
5
+ const numberChecks_1 = require("./numberChecks");
6
+ const stringChecks_1 = require("./stringChecks");
2
7
  /**
3
8
  * Canonical contract for the Oxy user-invalidation broadcast.
4
9
  *
@@ -31,9 +36,6 @@
31
36
  *
32
37
  * Platform-agnostic — zod only, no react/react-native/expo.
33
38
  */
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.oxyUserInvalidationEventSchema = exports.OXY_PUBLISHED_USER_CHANGE_REASONS = exports.OXY_USER_CHANGE_REASONS = exports.OXY_USER_INVALIDATION_CHANNEL = void 0;
36
- exports.isPublishedOxyUserChangeReason = isPublishedOxyUserChangeReason;
37
39
  const zod_1 = require("zod");
38
40
  /** Redis pub/sub channel carrying user-invalidation events. */
39
41
  exports.OXY_USER_INVALIDATION_CHANNEL = 'oxy:user:invalidate';
@@ -81,9 +83,9 @@ function isPublishedOxyUserChangeReason(reason) {
81
83
  */
82
84
  exports.oxyUserInvalidationEventSchema = zod_1.z.object({
83
85
  /** The Oxy user whose record changed. */
84
- userId: zod_1.z.string().min(1),
86
+ userId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
85
87
  /** Why it changed. Only broadcast reasons appear on the wire. */
86
88
  reason: zod_1.z.enum(exports.OXY_PUBLISHED_USER_CHANGE_REASONS),
87
89
  /** Publisher's epoch-ms timestamp. Diagnostic only. */
88
- at: zod_1.z.number().int().nonnegative(),
90
+ at: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
89
91
  });
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deviceLinkedSessionsResponseSchema = exports.deviceLinkedSessionSchema = exports.currentUserResponseSchema = exports.userProfileUpdateSchema = exports.userResponseSchema = exports.dateOfBirthSchema = exports.themePreferenceSchema = exports.userRelationshipSchema = exports.userNameSchema = void 0;
4
+ exports.resolveUserId = resolveUserId;
5
+ exports.safeParseContract = safeParseContract;
6
+ const stringChecks_1 = require("./stringChecks");
2
7
  /**
3
8
  * Canonical API user-response contracts.
4
9
  *
@@ -29,10 +34,6 @@
29
34
  * Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
30
35
  * `require()`).
31
36
  */
32
- Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.deviceLinkedSessionsResponseSchema = exports.deviceLinkedSessionSchema = exports.currentUserResponseSchema = exports.userProfileUpdateSchema = exports.userResponseSchema = exports.dateOfBirthSchema = exports.themePreferenceSchema = exports.userRelationshipSchema = exports.userNameSchema = void 0;
34
- exports.resolveUserId = resolveUserId;
35
- exports.safeParseContract = safeParseContract;
36
37
  const zod_1 = require("zod");
37
38
  const identity_1 = require("./identity");
38
39
  const accountGraph_1 = require("./accountGraph");
@@ -239,7 +240,7 @@ exports.userResponseSchema = zod_1.z
239
240
  personalization: zod_1.z
240
241
  .object({
241
242
  mentionMono: zod_1.z
242
- .object({ allowed: zod_1.z.boolean(), expiresAt: zod_1.z.string().datetime().nullable() })
243
+ .object({ allowed: zod_1.z.boolean(), expiresAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()).nullable() })
243
244
  .strict(),
244
245
  })
245
246
  .strict()
@@ -294,12 +295,12 @@ exports.userProfileUpdateSchema = zod_1.z
294
295
  */
295
296
  languages: zod_1.z.array(zod_1.z.string()).optional(),
296
297
  accountExpiresAfterInactivityDays: zod_1.z.number().nullable().optional(),
297
- notificationPreferences: zod_1.z.record(zod_1.z.unknown()).optional(),
298
+ notificationPreferences: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
298
299
  userPreferences: zod_1.z
299
300
  .object({ displayCurrency: zod_1.z.enum(['USD', 'EUR', 'FAIR']).optional() })
300
301
  .catchall(zod_1.z.unknown())
301
302
  .optional(),
302
- privacySettings: zod_1.z.record(zod_1.z.unknown()).optional(),
303
+ privacySettings: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
303
304
  /**
304
305
  * Portable theme preference. Written through the same `PUT /users/me`
305
306
  * settings-update path as `languages`/`userPreferences`.
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.botUsernameSchema = exports.usernameSchema = exports.applyBotUsernameSuffix = exports.BOT_USERNAME_INVALID_MESSAGE = exports.BOT_USERNAME_SUFFIX = exports.stripDisallowedUsernameCharacters = exports.USERNAME_PATTERN_SOURCE = exports.NUMERIC_USERNAME_MESSAGE = exports.RESERVED_USERNAME_MESSAGE = exports.RESERVED_USERNAMES = exports.USERNAME_INVALID_MESSAGE = exports.USERNAME_MAX_LENGTH = exports.USERNAME_MIN_LENGTH = void 0;
4
+ exports.isValidUsername = isValidUsername;
5
+ exports.usernameSchemaForAccountKind = usernameSchemaForAccountKind;
6
+ const stringChecks_1 = require("./stringChecks");
2
7
  /**
3
8
  * Username policy — the ONE rule, for every kind of account.
4
9
  *
@@ -99,10 +104,6 @@
99
104
  * back as a 409 for the client to retry with a fresh suggestion. Nothing here
100
105
  * knows what is taken, and it must not pretend to.
101
106
  */
102
- Object.defineProperty(exports, "__esModule", { value: true });
103
- exports.botUsernameSchema = exports.usernameSchema = exports.applyBotUsernameSuffix = exports.BOT_USERNAME_INVALID_MESSAGE = exports.BOT_USERNAME_SUFFIX = exports.stripDisallowedUsernameCharacters = exports.USERNAME_PATTERN_SOURCE = exports.NUMERIC_USERNAME_MESSAGE = exports.RESERVED_USERNAME_MESSAGE = exports.RESERVED_USERNAMES = exports.USERNAME_INVALID_MESSAGE = exports.USERNAME_MAX_LENGTH = exports.USERNAME_MIN_LENGTH = void 0;
104
- exports.isValidUsername = isValidUsername;
105
- exports.usernameSchemaForAccountKind = usernameSchemaForAccountKind;
106
107
  const zod_1 = require("zod");
107
108
  // The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
108
109
  // it is re-exported here so the root entry is unchanged.
@@ -131,8 +132,8 @@ Object.defineProperty(exports, "applyBotUsernameSuffix", { enumerable: true, get
131
132
  exports.usernameSchema = zod_1.z
132
133
  .string()
133
134
  .trim()
134
- .min(username_1.USERNAME_MIN_LENGTH, username_1.USERNAME_INVALID_MESSAGE)
135
- .max(username_1.USERNAME_MAX_LENGTH, username_1.USERNAME_INVALID_MESSAGE)
135
+ .check((0, stringChecks_1.utf16MinLength)(username_1.USERNAME_MIN_LENGTH, username_1.USERNAME_INVALID_MESSAGE))
136
+ .check((0, stringChecks_1.utf16MaxLength)(username_1.USERNAME_MAX_LENGTH, username_1.USERNAME_INVALID_MESSAGE))
136
137
  .regex(username_1.USERNAME_PATTERN, username_1.USERNAME_INVALID_MESSAGE)
137
138
  .refine((username) => !/^[0-9]+$/.test(username), username_1.NUMERIC_USERNAME_MESSAGE)
138
139
  .refine((username) => !username_1.RESERVED_USERNAMES.has(username.toLowerCase()), username_1.RESERVED_USERNAME_MESSAGE)