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