@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,4 +1,9 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applicationRolesMeSchema = exports.listApplicationRoleGrantsQuerySchema = exports.revokeApplicationRoleGrantRequestSchema = exports.createApplicationRoleGrantRequestSchema = exports.applicationRoleGrantListSchema = exports.applicationRoleGrantSchema = exports.declareApplicationPermissionsResponseSchema = exports.applicationPermissionListSchema = exports.applicationPermissionSchema = exports.declareApplicationPermissionsRequestSchema = exports.applicationPermissionDeclarationSchema = exports.applicationPermissionKeySchema = exports.APPLICATION_ROLE_ERROR_CODES = exports.APPLICATION_ROLE_GRANTS_PAGE_MAX = exports.APPLICATION_ROLE_GRANTS_PAGE_DEFAULT = exports.APPLICATION_ROLE_REASON_MAX_LENGTH = exports.APPLICATION_PERMISSIONS_MAX_DECLARED = exports.APPLICATION_PERMISSION_DESCRIPTION_MAX_LENGTH = exports.APPLICATION_PERMISSION_KEY_MAX_LENGTH = exports.APPLICATION_PERMISSION_KEY_PATTERN = exports.APPLICATION_PERMISSION_KEY_PATTERN_SOURCE = void 0;
4
+ exports.isApplicationPermissionKey = isApplicationPermissionKey;
5
+ const numberChecks_1 = require("./numberChecks");
6
+ const stringChecks_1 = require("./stringChecks");
2
7
  /**
3
8
  * Application roles — the wire contract for permissions an APPLICATION declares
4
9
  * about its own users, and for the grants that give them to Oxy users.
@@ -26,9 +31,6 @@
26
31
  *
27
32
  * Platform-agnostic — zod only, no react/react-native/expo.
28
33
  */
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.applicationRolesMeSchema = exports.listApplicationRoleGrantsQuerySchema = exports.revokeApplicationRoleGrantRequestSchema = exports.createApplicationRoleGrantRequestSchema = exports.applicationRoleGrantListSchema = exports.applicationRoleGrantSchema = exports.declareApplicationPermissionsResponseSchema = exports.applicationPermissionListSchema = exports.applicationPermissionSchema = exports.declareApplicationPermissionsRequestSchema = exports.applicationPermissionDeclarationSchema = exports.applicationPermissionKeySchema = exports.APPLICATION_ROLE_ERROR_CODES = exports.APPLICATION_ROLE_GRANTS_PAGE_MAX = exports.APPLICATION_ROLE_GRANTS_PAGE_DEFAULT = exports.APPLICATION_ROLE_REASON_MAX_LENGTH = exports.APPLICATION_PERMISSIONS_MAX_DECLARED = exports.APPLICATION_PERMISSION_DESCRIPTION_MAX_LENGTH = exports.APPLICATION_PERMISSION_KEY_MAX_LENGTH = exports.APPLICATION_PERMISSION_KEY_PATTERN = exports.APPLICATION_PERMISSION_KEY_PATTERN_SOURCE = void 0;
31
- exports.isApplicationPermissionKey = isApplicationPermissionKey;
32
34
  const zod_1 = require("zod");
33
35
  /**
34
36
  * Two to four dot-separated segments, each a lowercase letter followed by
@@ -72,22 +74,22 @@ function isApplicationPermissionKey(value) {
72
74
  }
73
75
  exports.applicationPermissionKeySchema = zod_1.z
74
76
  .string()
75
- .max(exports.APPLICATION_PERMISSION_KEY_MAX_LENGTH)
77
+ .check((0, stringChecks_1.utf16MaxLength)(exports.APPLICATION_PERMISSION_KEY_MAX_LENGTH))
76
78
  .regex(exports.APPLICATION_PERMISSION_KEY_PATTERN, 'A permission key is 2-4 dot-separated lowercase segments, e.g. payments.operate');
77
79
  /** Plain text: no control characters other than a newline or a tab. */
78
80
  function plainText(max) {
79
81
  return zod_1.z
80
82
  .string()
81
83
  .trim()
82
- .min(1)
83
- .max(max)
84
+ .check((0, stringChecks_1.utf16MinLength)(1))
85
+ .check((0, stringChecks_1.utf16MaxLength)(max))
84
86
  .refine((value) => Array.from(value).every((character) => {
85
87
  const code = character.charCodeAt(0);
86
88
  return (code >= 32 && code !== 127) || character === '\n' || character === '\t';
87
89
  }), 'Must be plain text');
88
90
  }
89
- const id = zod_1.z.string().min(1).max(128);
90
- const isoTimestamp = zod_1.z.string().min(1);
91
+ const id = zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128));
92
+ const isoTimestamp = zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1));
91
93
  const reasonSchema = plainText(exports.APPLICATION_ROLE_REASON_MAX_LENGTH);
92
94
  /** One key as the application's owners declare it. */
93
95
  exports.applicationPermissionDeclarationSchema = zod_1.z
@@ -144,7 +146,7 @@ exports.declareApplicationPermissionsResponseSchema = exports.applicationPermiss
144
146
  /** Live keys whose description changed. */
145
147
  described: zod_1.z.array(exports.applicationPermissionKeySchema),
146
148
  /** Live grants revoked because their key was retired. */
147
- revokedGrants: zod_1.z.number().int().nonnegative(),
149
+ revokedGrants: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
148
150
  });
149
151
  /** One grant of one key to one Oxy user. Revocation is a stamp, never a delete. */
150
152
  exports.applicationRoleGrantSchema = zod_1.z.object({
@@ -170,7 +172,7 @@ exports.applicationRoleGrantListSchema = zod_1.z.object({
170
172
  exports.createApplicationRoleGrantRequestSchema = zod_1.z
171
173
  .object({
172
174
  userId: id.optional(),
173
- username: zod_1.z.string().trim().min(1).max(64).optional(),
175
+ username: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)).optional(),
174
176
  permission: exports.applicationPermissionKeySchema,
175
177
  reason: reasonSchema.optional(),
176
178
  })
@@ -194,8 +196,13 @@ exports.listApplicationRoleGrantsQuerySchema = zod_1.z
194
196
  .enum(['true', 'false'])
195
197
  .transform((value) => value === 'true')
196
198
  .optional(),
197
- limit: zod_1.z.coerce.number().int().min(1).max(exports.APPLICATION_ROLE_GRANTS_PAGE_MAX).optional(),
198
- cursor: zod_1.z.string().min(1).max(512).optional(),
199
+ limit: zod_1.z.coerce
200
+ .number()
201
+ .check((0, numberChecks_1.integerCheck)())
202
+ .min(1)
203
+ .max(exports.APPLICATION_ROLE_GRANTS_PAGE_MAX)
204
+ .optional(),
205
+ cursor: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(512)).optional(),
199
206
  })
200
207
  .strict();
201
208
  /**
package/dist/cjs/civic.js CHANGED
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.credentialVerifyResultSchema = exports.credentialListResultSchema = exports.credentialIssueResultSchema = exports.verifiableCredentialResponseSchema = exports.credentialRecordSchema = exports.vouchResultSchema = exports.personhoodStatusResultSchema = exports.personhoodBreakdownSchema = exports.personhoodVouchRecordSchema = exports.validationVoteResultSchema = exports.validationRequestSummarySchema = exports.validationOpenResultSchema = exports.validationOpenRequestSchema = exports.validationVerdictRecordSchema = exports.realLifeAttestationResultSchema = exports.realLifeAttestationRecordSchema = exports.signedPublicCardSchema = exports.publicCardSchema = void 0;
4
+ const stringChecks_1 = require("./stringChecks");
2
5
  /**
3
6
  * Civic / Commons API contracts (Fase 1 — DNI + crypto-owned reputation).
4
7
  *
@@ -28,8 +31,6 @@
28
31
  *
29
32
  * Platform-agnostic — zod only, no react/react-native/expo, ESM-safe.
30
33
  */
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.credentialVerifyResultSchema = exports.credentialListResultSchema = exports.credentialIssueResultSchema = exports.verifiableCredentialResponseSchema = exports.credentialRecordSchema = exports.vouchResultSchema = exports.personhoodStatusResultSchema = exports.personhoodBreakdownSchema = exports.personhoodVouchRecordSchema = exports.validationVoteResultSchema = exports.validationRequestSummarySchema = exports.validationOpenResultSchema = exports.validationOpenRequestSchema = exports.validationVerdictRecordSchema = exports.realLifeAttestationResultSchema = exports.realLifeAttestationRecordSchema = exports.signedPublicCardSchema = exports.publicCardSchema = void 0;
33
34
  const zod_1 = require("zod");
34
35
  const identity_1 = require("./identity");
35
36
  exports.publicCardSchema = zod_1.z.object({
@@ -71,9 +72,9 @@ exports.validationVerdictRecordSchema = zod_1.z.object({
71
72
  /** Request body for opening a validation request (`POST /civic/validations`). */
72
73
  exports.validationOpenRequestSchema = zod_1.z.object({
73
74
  subjectUserId: zod_1.z.string(),
74
- actionType: zod_1.z.string().min(1),
75
- sourceActionId: zod_1.z.string().min(1),
76
- payload: zod_1.z.record(zod_1.z.unknown()),
75
+ actionType: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
76
+ sourceActionId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
77
+ payload: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
77
78
  highValue: zod_1.z.boolean().optional(),
78
79
  });
79
80
  exports.validationOpenResultSchema = zod_1.z.object({
@@ -85,7 +86,7 @@ exports.validationRequestSummarySchema = zod_1.z.object({
85
86
  id: zod_1.z.string(),
86
87
  subjectUserId: zod_1.z.string(),
87
88
  actionType: zod_1.z.string(),
88
- payload: zod_1.z.record(zod_1.z.unknown()),
89
+ payload: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
89
90
  payloadHash: zod_1.z.string(),
90
91
  status: zod_1.z.enum(['pending', 'quorum_met', 'validated', 'rejected', 'expired']),
91
92
  highValue: zod_1.z.boolean(),
@@ -131,8 +132,8 @@ exports.vouchResultSchema = zod_1.z.object({
131
132
  });
132
133
  exports.credentialRecordSchema = zod_1.z.object({
133
134
  about: zod_1.z.string(),
134
- types: zod_1.z.array(zod_1.z.string().min(1)).min(1),
135
- claims: zod_1.z.record(zod_1.z.unknown()),
135
+ types: zod_1.z.array(zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1))).min(1),
136
+ claims: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
136
137
  expiresAt: zod_1.z.number().optional(),
137
138
  });
138
139
  exports.verifiableCredentialResponseSchema = zod_1.z.object({
@@ -143,7 +144,7 @@ exports.verifiableCredentialResponseSchema = zod_1.z.object({
143
144
  issuerUserId: zod_1.z.string().optional(),
144
145
  issuerDid: zod_1.z.string(),
145
146
  types: zod_1.z.array(zod_1.z.string()),
146
- claims: zod_1.z.record(zod_1.z.unknown()),
147
+ claims: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
147
148
  status: zod_1.z.enum(['active', 'revoked', 'expired']),
148
149
  issuedAt: zod_1.z.number(),
149
150
  expiresAt: zod_1.z.number().optional(),
@@ -8,25 +8,25 @@
8
8
  * that bundles the SDK (~120 KB before compression, evaluated at startup). The
9
9
  * checks here give the client the same answers in plain TypeScript.
10
10
  *
11
- * Every check mirrors one Zod 3 schema in this package, and
11
+ * Every check mirrors one Zod 4 schema in this package, and
12
12
  * `__tests__/clientChecks.parity.test.ts` runs both over the same inputs and
13
13
  * requires the same verdict, the same output and the same failing path. The
14
- * rules follow Zod 3 exactly:
14
+ * rules follow Zod 4 exactly:
15
15
  *
16
16
  * string(...rules) a string; `trim`/`toLowerCase` rewrite it, the other
17
17
  * rules test it, in the order given
18
- * number(...rules) a number that is not NaN (Infinity passes, as in Zod)
18
+ * number(...rules) a finite number
19
19
  * literal(v) / oneOf `===` one value / one of a fixed set of strings
20
20
  * optional(c) `undefined` (or an absent key) passes; `null` does not
21
21
  * nullable(c) `null` passes and is kept
22
22
  * withDefault(c, v) `undefined` becomes `v`, which is then checked
23
- * array(c, ...rules) the size rules first, then every element in order
23
+ * array(c, ...rules) upper bounds before elements, lower bounds afterwards
24
24
  * object(shape) unknown keys are DROPPED (Zod's default "strip")
25
25
  * strictObject(shape) unknown keys FAIL (`.strict()`)
26
26
  * looseObject(shape) unknown keys are KEPT (`.passthrough()`)
27
27
  * refine(c, test) a further condition, run once `c` passes
28
28
  * transform(c, f) `f` rewrites the value once `c` passes
29
- * union / discriminatedUnion as Zod 3 reports them
29
+ * union / discriminatedUnion as Zod 4 reports them
30
30
  *
31
31
  * A failure carries the first issue Zod would report and whether Zod would have
32
32
  * stopped there (`fatal`: the type was wrong) or kept checking (`fatal: false`:
@@ -80,13 +80,15 @@ function describe(input) {
80
80
  if (Array.isArray(input))
81
81
  return 'array';
82
82
  if (typeof input === 'number' && Number.isNaN(input))
83
- return 'nan';
83
+ return 'NaN';
84
+ if (typeof input === 'number' && !Number.isFinite(input))
85
+ return String(input);
84
86
  return typeof input;
85
87
  }
86
88
  /** Zod's wording for a value of the wrong type. */
87
89
  function wrongType(path, expected, input) {
88
90
  const received = describe(input);
89
- const message = input === undefined ? 'Required' : `Expected ${expected}, received ${received}`;
91
+ const message = `Invalid input: expected ${expected}, received ${received === 'object' ? 'Object' : received}`;
90
92
  return fail(path, { code: 'invalid_type', message, expected, received }, true);
91
93
  }
92
94
  /** `'a' | 'b'` — how Zod lists allowed values. */
@@ -104,14 +106,14 @@ function minLength(min, message) {
104
106
  return {
105
107
  test: (value) => value.length >= min,
106
108
  code: 'too_small',
107
- message: message ?? `String must contain at least ${min} character(s)`,
109
+ message: message ?? `Too small: expected string to have >=${min} characters`,
108
110
  };
109
111
  }
110
112
  function maxLength(max, message) {
111
113
  return {
112
114
  test: (value) => value.length <= max,
113
115
  code: 'too_big',
114
- message: message ?? `String must contain at most ${max} character(s)`,
116
+ message: message ?? `Too big: expected string to have <=${max} characters`,
115
117
  };
116
118
  }
117
119
  function pattern(regex, message) {
@@ -120,21 +122,21 @@ function pattern(regex, message) {
120
122
  regex.lastIndex = 0;
121
123
  return regex.test(value);
122
124
  },
123
- code: 'invalid_string',
124
- message: message ?? 'Invalid',
125
+ code: 'invalid_format',
126
+ message: message ?? `Invalid string: must match pattern ${regex}`,
125
127
  };
126
128
  }
127
129
  function startsWith(prefix) {
128
130
  return {
129
131
  test: (value) => value.startsWith(prefix),
130
- code: 'invalid_string',
131
- message: `Invalid input: must start with "${prefix}"`,
132
+ code: 'invalid_format',
133
+ message: `Invalid string: must start with "${prefix}"`,
132
134
  };
133
135
  }
134
- /** Zod 3's `.email()`. */
136
+ /** Zod 4's `.email()`. */
135
137
  const EMAIL = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-]*\.)+[A-Z]{2,}$/i;
136
- exports.email = pattern(EMAIL, 'Invalid email');
137
- /** Zod 3's `.url()`: anything `new URL()` accepts. */
138
+ exports.email = pattern(EMAIL, 'Invalid email address');
139
+ /** The contract's URL check validates with `new URL()` and preserves the original value. */
138
140
  exports.url = {
139
141
  test: (value) => {
140
142
  try {
@@ -145,13 +147,13 @@ exports.url = {
145
147
  return false;
146
148
  }
147
149
  },
148
- code: 'invalid_string',
149
- message: 'Invalid url',
150
+ code: 'invalid_format',
151
+ message: 'Invalid URL',
150
152
  };
151
- /** Zod 3's `.datetime()`: ISO 8601 in UTC (`Z`), any sub-second precision, leap days checked. */
153
+ /** Zod 4's `.datetime()`: ISO 8601 in UTC (`Z`), any sub-second precision, leap days checked. */
152
154
  const DATETIME = new RegExp('^((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))' +
153
155
  'T([01]\\d|2[0-3]):[0-5]\\d(:[0-5]\\d(\\.\\d+)?)?(Z)$');
154
- exports.datetime = pattern(DATETIME, 'Invalid datetime');
156
+ exports.datetime = pattern(DATETIME, 'Invalid ISO datetime');
155
157
  function string(...rules) {
156
158
  return (input, path) => {
157
159
  if (typeof input !== 'string')
@@ -161,44 +163,44 @@ function string(...rules) {
161
163
  for (const rule of rules) {
162
164
  if ('rewrite' in rule)
163
165
  value = rule.rewrite(value);
164
- else if (firstFailure === null && !rule.test(value)) {
166
+ if ('test' in rule && firstFailure === null && !rule.test(value)) {
165
167
  firstFailure = { code: rule.code, message: rule.message };
166
168
  }
167
169
  }
168
170
  return firstFailure === null ? ok(value) : fail(path, firstFailure, false);
169
171
  };
170
172
  }
171
- /** Zod's `.int()` — reported, as Zod does, as an `invalid_type` that does not stop the parse. */
173
+ /** Integer validation, separate from the contract's optional safe bounds. */
172
174
  const int = (value) => Number.isInteger(value)
173
175
  ? undefined
174
176
  : {
175
177
  code: 'invalid_type',
176
- message: 'Expected integer, received float',
177
- expected: 'integer',
178
- received: 'float',
178
+ message: 'Invalid input: expected int, received number',
179
+ expected: 'int',
180
+ received: 'number',
179
181
  };
180
182
  exports.int = int;
181
183
  function atLeast(min) {
182
184
  return (value) => value >= min
183
185
  ? undefined
184
- : { code: 'too_small', message: `Number must be greater than or equal to ${min}` };
186
+ : { code: 'too_small', message: `Too small: expected number to be >=${min}` };
185
187
  }
186
188
  function atMost(max) {
187
189
  return (value) => value <= max
188
190
  ? undefined
189
- : { code: 'too_big', message: `Number must be less than or equal to ${max}` };
191
+ : { code: 'too_big', message: `Too big: expected number to be <=${max}` };
190
192
  }
191
193
  /** Zod's `.positive()`. */
192
- const positive = (value) => value > 0 ? undefined : { code: 'too_small', message: 'Number must be greater than 0' };
194
+ const positive = (value) => value > 0 ? undefined : { code: 'too_small', message: 'Too small: expected number to be >0' };
193
195
  exports.positive = positive;
194
196
  /** Zod's `.nonnegative()` (and `.min(0)`). */
195
197
  exports.nonnegative = atLeast(0);
196
- /** Zod's `.safe()`: both bounds, low first. */
198
+ /** The contract's explicit safe-number bounds. */
197
199
  const safe = (value) => atLeast(Number.MIN_SAFE_INTEGER)(value) ?? atMost(Number.MAX_SAFE_INTEGER)(value);
198
200
  exports.safe = safe;
199
201
  function number(...rules) {
200
202
  return (input, path) => {
201
- if (typeof input !== 'number' || Number.isNaN(input))
203
+ if (typeof input !== 'number' || !Number.isFinite(input))
202
204
  return wrongType(path, 'number', input);
203
205
  for (const rule of rules) {
204
206
  const problem = rule(input);
@@ -214,20 +216,20 @@ function literal(expected) {
214
216
  return (input, path) => input === expected
215
217
  ? ok(expected)
216
218
  : fail(path, {
217
- code: 'invalid_literal',
218
- message: `Invalid literal value, expected ${JSON.stringify(expected)}`,
219
+ code: 'invalid_value',
220
+ message: `Invalid input: expected ${JSON.stringify(expected)}`,
219
221
  }, true);
220
222
  }
221
223
  /** One of a fixed set of strings — Zod's `z.enum`. */
222
224
  function oneOf(values) {
223
225
  return (input, path) => {
224
- if (typeof input !== 'string')
225
- return wrongType(path, listValues(values), input);
226
- return values.includes(input)
226
+ return typeof input === 'string' && values.includes(input)
227
227
  ? ok(input)
228
228
  : fail(path, {
229
- code: 'invalid_enum_value',
230
- message: `Invalid enum value. Expected ${listValues(values)}, received '${input}'`,
229
+ code: 'invalid_value',
230
+ message: values.length === 1
231
+ ? `Invalid input: expected ${JSON.stringify(values[0])}`
232
+ : `Invalid option: expected one of ${values.map((value) => JSON.stringify(value)).join('|')}`,
231
233
  }, true);
232
234
  };
233
235
  }
@@ -279,7 +281,7 @@ function branded(inner) {
279
281
  return inner;
280
282
  }
281
283
  /**
282
- * The issues of a container, as Zod 3 orders them: the first one is reported,
284
+ * The issues of a container, as Zod 4 orders them: the first one is reported,
283
285
  * and the container is fatal when any part of it was.
284
286
  */
285
287
  class Failures {
@@ -299,22 +301,21 @@ function minItems(min) {
299
301
  return {
300
302
  test: (length) => length >= min,
301
303
  code: 'too_small',
302
- message: `Array must contain at least ${min} element(s)`,
304
+ message: `Too small: expected array to have >=${min} items`,
303
305
  };
304
306
  }
305
307
  function maxItems(max) {
306
308
  return {
307
309
  test: (length) => length <= max,
308
310
  code: 'too_big',
309
- message: `Array must contain at most ${max} element(s)`,
311
+ message: `Too big: expected array to have <=${max} items`,
310
312
  };
311
313
  }
312
314
  /** Zod's `.length(n)`: `too_big` or `too_small`, by which side it missed. */
313
315
  function exactItems(count) {
314
- const message = `Array must contain exactly ${count} element(s)`;
315
316
  return [
316
- { test: (length) => length <= count, code: 'too_big', message },
317
- { test: (length) => length >= count, code: 'too_small', message },
317
+ { ...maxItems(count), message: `Too big: expected array to have exactly ${count} items` },
318
+ { ...minItems(count), message: `Too small: expected array to have exactly ${count} items` },
318
319
  ];
319
320
  }
320
321
  function array(inner, ...rules) {
@@ -322,9 +323,12 @@ function array(inner, ...rules) {
322
323
  return (input, path) => {
323
324
  if (!Array.isArray(input))
324
325
  return wrongType(path, 'array', input);
325
- // Zod reports the size before any element, then every element in order.
326
+ // Oversized collections abort before walking any element. Lower bounds
327
+ // are checked after elements, matching the patched Zod parser.
326
328
  const size = sizeRules.find((rule) => !rule.test(input.length));
327
- const failures = new Failures(size ? { path, code: size.code, message: size.message } : null);
329
+ if (size?.code === 'too_big')
330
+ return fail(path, { code: size.code, message: size.message }, true);
331
+ const failures = new Failures(null);
328
332
  const out = [];
329
333
  for (let index = 0; index < input.length; index++) {
330
334
  const checked = inner(input[index], [...path, index]);
@@ -333,6 +337,8 @@ function array(inner, ...rules) {
333
337
  else
334
338
  failures.add(checked);
335
339
  }
340
+ if (size)
341
+ failures.add({ issue: { path, code: size.code, message: size.message }, fatal: false });
336
342
  return failures.result() ?? ok(out);
337
343
  };
338
344
  }
@@ -364,7 +370,7 @@ function objectWith(shape, unknownKeys) {
364
370
  }
365
371
  }
366
372
  if (unknownKeys === 'strict' && unknown.length > 0) {
367
- const message = `Unrecognized key(s) in object: ${listValues(unknown, ', ')}`;
373
+ const message = `Unrecognized key${unknown.length === 1 ? '' : 's'}: ${unknown.map((key) => JSON.stringify(key)).join(', ')}`;
368
374
  failures.add({ issue: { path, code: 'unrecognized_keys', message }, fatal: false });
369
375
  }
370
376
  }
@@ -386,7 +392,7 @@ function looseObject(shape) {
386
392
  /** Any object, every value kept — Zod's `z.record(z.unknown())`. */
387
393
  const unknownRecord = (input, path) => {
388
394
  if (!isRecord(input))
389
- return wrongType(path, 'object', input);
395
+ return wrongType(path, 'record', input);
390
396
  const out = {};
391
397
  for (const key in input)
392
398
  if (key !== '__proto__')
@@ -397,21 +403,23 @@ exports.unknownRecord = unknownRecord;
397
403
  /* -------------------------------------------------------------------------- */
398
404
  /* Unions */
399
405
  /* -------------------------------------------------------------------------- */
400
- /** The first option that passes; else Zod 3's report (the first option that only failed a rule). */
406
+ /** The first passing option, or the sole non-aborted option's issue; otherwise a union issue. */
401
407
  function union(...options) {
402
408
  return (input, path) => {
403
- let ruleFailure = null;
409
+ const ruleFailures = [];
404
410
  for (const option of options) {
405
411
  const checked = option(input, path);
406
412
  if (checked.ok)
407
413
  return checked;
408
414
  if (!checked.fatal)
409
- ruleFailure ?? (ruleFailure = checked);
415
+ ruleFailures.push(checked);
410
416
  }
411
- return ruleFailure ?? fail(path, { code: 'invalid_union', message: 'Invalid input' }, true);
417
+ return ruleFailures.length === 1
418
+ ? ruleFailures[0]
419
+ : fail(path, { code: 'invalid_union', message: 'Invalid input' }, true);
412
420
  };
413
421
  }
414
- /** Zod 3's `z.discriminatedUnion(key, options)`, with the options keyed by their tag. */
422
+ /** Zod 4's `z.discriminatedUnion(key, options)`, with the options keyed by their tag. */
415
423
  function discriminatedUnion(key, options) {
416
424
  return (input, path) => {
417
425
  if (!isRecord(input))
@@ -422,7 +430,7 @@ function discriminatedUnion(key, options) {
422
430
  : undefined;
423
431
  if (!option) {
424
432
  const message = `Invalid discriminator value. Expected ${listValues(Object.keys(options))}`;
425
- return fail([...path, key], { code: 'invalid_union_discriminator', message }, true);
433
+ return fail([...path, key], { code: 'invalid_union', message }, true);
426
434
  }
427
435
  return option(input, path);
428
436
  };
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.saveConsoleUseCasesInputSchema = exports.CONSOLE_USE_CASE_DESCRIPTION_MAX_LENGTH = exports.acceptConsoleTermsInputSchema = exports.consoleOnboardingStateSchema = exports.consoleUseCaseIdSchema = exports.CONSOLE_USE_CASES = exports.CONSOLE_TERMS_VERSION = void 0;
4
+ const stringChecks_1 = require("./stringChecks");
2
5
  /**
3
6
  * Oxy Console first-run onboarding — the wire contract.
4
7
  *
@@ -9,8 +12,6 @@
9
12
  *
10
13
  * Platform-agnostic — zod only. ESM-safe (no `require()`).
11
14
  */
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.saveConsoleUseCasesInputSchema = exports.CONSOLE_USE_CASE_DESCRIPTION_MAX_LENGTH = exports.acceptConsoleTermsInputSchema = exports.consoleOnboardingStateSchema = exports.consoleUseCaseIdSchema = exports.CONSOLE_USE_CASES = exports.CONSOLE_TERMS_VERSION = void 0;
14
15
  const zod_1 = require("zod");
15
16
  const consoleOnboarding_1 = require("./client/consoleOnboarding");
16
17
  var consoleOnboarding_2 = require("./client/consoleOnboarding");
@@ -33,7 +34,7 @@ exports.consoleOnboardingStateSchema = zod_1.z.object({
33
34
  });
34
35
  /** `POST /console/onboarding/terms`. */
35
36
  exports.acceptConsoleTermsInputSchema = zod_1.z.object({
36
- version: zod_1.z.string().min(1).max(64),
37
+ version: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(64)),
37
38
  adultAcknowledged: zod_1.z.literal(true),
38
39
  /** Understands the account may be suspended or terminated for violating the AUP/Terms. */
39
40
  aupAcknowledged: zod_1.z.literal(true),
@@ -43,7 +44,11 @@ exports.acceptConsoleTermsInputSchema = zod_1.z.object({
43
44
  exports.CONSOLE_USE_CASE_DESCRIPTION_MAX_LENGTH = 2000;
44
45
  exports.saveConsoleUseCasesInputSchema = zod_1.z.object({
45
46
  /** Optional free text; trimmed, and blank counts as absent. */
46
- description: zod_1.z.string().trim().max(exports.CONSOLE_USE_CASE_DESCRIPTION_MAX_LENGTH).optional(),
47
+ description: zod_1.z
48
+ .string()
49
+ .trim()
50
+ .check((0, stringChecks_1.utf16MaxLength)(exports.CONSOLE_USE_CASE_DESCRIPTION_MAX_LENGTH))
51
+ .optional(),
47
52
  useCases: zod_1.z
48
53
  .array(exports.consoleUseCaseIdSchema)
49
54
  .max(consoleOnboarding_1.CONSOLE_USE_CASES.length)
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.contentClaimCounterNoticeSchema = exports.CONTENT_CLAIM_COUNTER_NOTICE_VALIDATION_KEYS = exports.CONTENT_CLAIM_EVENT_ACTIONS = exports.CONTENT_CLAIM_TARGET_SOURCES = exports.CONTENT_CLAIM_TARGET_RESOLUTIONS = exports.contentClaimSubmissionSchema = exports.CONTENT_CLAIM_VALIDATION_KEYS = exports.isRightsClaim = exports.isErasureRequest = exports.OPEN_CONTENT_CLAIM_STATES = exports.ERASURE_REQUEST_DEADLINE_DAYS = exports.COUNTER_NOTICE_STATEMENTS = exports.COUNTER_NOTICE_STATEMENT_VERSION = exports.CONTENT_CLAIM_STATES = exports.CONTENT_CLAIM_REFERENCE_PATTERN = exports.CONTENT_CLAIM_LIMITS = exports.CONTENT_CLAIM_KINDS = exports.CONTENT_CLAIM_ERROR_CODES = exports.CONTENT_CLAIM_COUNTER_NOTICE_LIMITS = exports.CLOSED_CONTENT_CLAIM_STATES = exports.CLAIMANT_RELATIONSHIPS = void 0;
4
+ const stringChecks_1 = require("./stringChecks");
4
5
  /**
5
6
  * Content claims (ADR 0043 D10): the public "Report content / rights claim"
6
7
  * intake, `POST /content-claims`, and the staff review of a claim.
@@ -58,7 +59,11 @@ function isHttpsUrl(value) {
58
59
  return false;
59
60
  }
60
61
  }
61
- const httpsUrl = (message) => zod_1.z.string().trim().max(contentClaims_1.CONTENT_CLAIM_LIMITS.maxUrlLength, message).refine(isHttpsUrl, message);
62
+ const httpsUrl = (message) => zod_1.z
63
+ .string()
64
+ .trim()
65
+ .check((0, stringChecks_1.utf16MaxLength)(contentClaims_1.CONTENT_CLAIM_LIMITS.maxUrlLength, message))
66
+ .refine(isHttpsUrl, message);
62
67
  /**
63
68
  * `POST /content-claims` — a claim, as the claimant sends it. Strict: an
64
69
  * unknown key is refused rather than dropped.
@@ -75,25 +80,25 @@ exports.contentClaimSubmissionSchema = zod_1.z
75
80
  description: zod_1.z
76
81
  .string({ message: 'contentClaim.errors.descriptionShort' })
77
82
  .trim()
78
- .min(contentClaims_1.CONTENT_CLAIM_LIMITS.minDescription, 'contentClaim.errors.descriptionShort')
79
- .max(contentClaims_1.CONTENT_CLAIM_LIMITS.maxDescription, 'contentClaim.errors.descriptionLong'),
83
+ .check((0, stringChecks_1.utf16MinLength)(contentClaims_1.CONTENT_CLAIM_LIMITS.minDescription, 'contentClaim.errors.descriptionShort'))
84
+ .check((0, stringChecks_1.utf16MaxLength)(contentClaims_1.CONTENT_CLAIM_LIMITS.maxDescription, 'contentClaim.errors.descriptionLong')),
80
85
  originalWorkUrl: httpsUrl('contentClaim.errors.originalWorkUrl').optional(),
81
86
  claimant: zod_1.z
82
87
  .object({
83
88
  name: zod_1.z
84
89
  .string({ message: 'contentClaim.errors.name' })
85
90
  .trim()
86
- .min(1, 'contentClaim.errors.name')
87
- .max(contentClaims_1.CONTENT_CLAIM_LIMITS.maxName, 'contentClaim.errors.name'),
91
+ .check((0, stringChecks_1.utf16MinLength)(1, 'contentClaim.errors.name'))
92
+ .check((0, stringChecks_1.utf16MaxLength)(contentClaims_1.CONTENT_CLAIM_LIMITS.maxName, 'contentClaim.errors.name')),
88
93
  email: zod_1.z
89
94
  .string({ message: 'contentClaim.errors.email' })
90
95
  .trim()
91
96
  .email('contentClaim.errors.email')
92
- .max(contentClaims_1.CONTENT_CLAIM_LIMITS.maxEmail, 'contentClaim.errors.email'),
97
+ .check((0, stringChecks_1.utf16MaxLength)(contentClaims_1.CONTENT_CLAIM_LIMITS.maxEmail, 'contentClaim.errors.email')),
93
98
  organization: zod_1.z
94
99
  .string({ message: 'contentClaim.errors.organization' })
95
100
  .trim()
96
- .max(contentClaims_1.CONTENT_CLAIM_LIMITS.maxOrganization, 'contentClaim.errors.organization')
101
+ .check((0, stringChecks_1.utf16MaxLength)(contentClaims_1.CONTENT_CLAIM_LIMITS.maxOrganization, 'contentClaim.errors.organization'))
97
102
  .optional(),
98
103
  relationship: zod_1.z.enum(contentClaims_1.CLAIMANT_RELATIONSHIPS, {
99
104
  message: 'contentClaim.errors.relationship',
@@ -103,18 +108,18 @@ exports.contentClaimSubmissionSchema = zod_1.z
103
108
  statements: zod_1.z
104
109
  .object({
105
110
  goodFaith: zod_1.z.literal(true, {
106
- errorMap: () => ({ message: 'contentClaim.errors.goodFaith' }),
111
+ error: () => ({ message: 'contentClaim.errors.goodFaith' }),
107
112
  }),
108
113
  accurate: zod_1.z.literal(true, {
109
- errorMap: () => ({ message: 'contentClaim.errors.accurate' }),
114
+ error: () => ({ message: 'contentClaim.errors.accurate' }),
110
115
  }),
111
116
  }, { message: 'contentClaim.errors.goodFaith' })
112
117
  .strict(),
113
118
  signature: zod_1.z
114
119
  .string({ message: 'contentClaim.errors.signature' })
115
120
  .trim()
116
- .min(1, 'contentClaim.errors.signature')
117
- .max(contentClaims_1.CONTENT_CLAIM_LIMITS.maxName, 'contentClaim.errors.signature'),
121
+ .check((0, stringChecks_1.utf16MinLength)(1, 'contentClaim.errors.signature'))
122
+ .check((0, stringChecks_1.utf16MaxLength)(contentClaims_1.CONTENT_CLAIM_LIMITS.maxName, 'contentClaim.errors.signature')),
118
123
  })
119
124
  .strict();
120
125
  // ---------------------------------------------------------------------------
@@ -166,8 +171,12 @@ exports.CONTENT_CLAIM_COUNTER_NOTICE_VALIDATION_KEYS = [
166
171
  'contentClaim.counterNotice.errors.signature',
167
172
  ];
168
173
  const N = contentClaims_1.CONTENT_CLAIM_COUNTER_NOTICE_LIMITS;
169
- const boundedText = (min, max, message) => zod_1.z.string({ message }).trim().min(min, message).max(max, message);
170
- const affirmed = (message) => zod_1.z.literal(true, { errorMap: () => ({ message }) });
174
+ const boundedText = (min, max, message) => zod_1.z
175
+ .string({ message })
176
+ .trim()
177
+ .check((0, stringChecks_1.utf16MinLength)(min, message))
178
+ .check((0, stringChecks_1.utf16MaxLength)(max, message));
179
+ const affirmed = (message) => zod_1.z.literal(true, { error: () => ({ message }) });
171
180
  /**
172
181
  * `POST /content-claims/counter-notices` — the owner of content a claim took
173
182
  * down disputes it (17 U.S.C. § 512(g)(3)). Signed in: the API answers only
@@ -207,7 +216,7 @@ exports.contentClaimCounterNoticeSchema = zod_1.z
207
216
  .string({ message: 'contentClaim.counterNotice.errors.email' })
208
217
  .trim()
209
218
  .email('contentClaim.counterNotice.errors.email')
210
- .max(N.maxEmail, 'contentClaim.counterNotice.errors.email'),
219
+ .check((0, stringChecks_1.utf16MaxLength)(N.maxEmail, 'contentClaim.counterNotice.errors.email')),
211
220
  }, { message: 'contentClaim.counterNotice.errors.name' })
212
221
  .strict(),
213
222
  material: zod_1.z