@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,13 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.productPlanCatalogueSchema = exports.personalPlanCatalogueSchema = exports.personalPlanDisplayPriceSchema = void 0;
4
+ const numberChecks_1 = require("../numberChecks");
5
+ const stringChecks_1 = require("../stringChecks");
4
6
  const zod_1 = require("zod");
5
7
  const access_1 = require("./access");
6
8
  /** Approved display terms never identify or activate a billing-provider price. */
7
9
  exports.personalPlanDisplayPriceSchema = zod_1.z
8
10
  .object({
9
11
  currency: zod_1.z.string().regex(/^[A-Z]{3}$/),
10
- amountMinorUnits: zod_1.z.number().int().positive().safe(),
12
+ amountMinorUnits: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive().check((0, numberChecks_1.safeNumberCheck)()),
11
13
  interval: zod_1.z.literal('month'),
12
14
  trial: zod_1.z.literal('none'),
13
15
  taxTreatment: zod_1.z.literal('inclusive'),
@@ -22,14 +24,17 @@ exports.personalPlanCatalogueSchema = zod_1.z
22
24
  purchase: zod_1.z.enum(['unavailable', 'available']),
23
25
  plans: zod_1.z.array(zod_1.z
24
26
  .object({
25
- offerId: zod_1.z.string().min(1).max(160),
26
- offerVersion: zod_1.z.number().int().positive().safe(),
27
- displayName: zod_1.z.string().min(1).max(100),
27
+ offerId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(160)),
28
+ offerVersion: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive().check((0, numberChecks_1.safeNumberCheck)()),
29
+ displayName: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(100)),
28
30
  audience: zod_1.z.literal('personal'),
29
31
  kind: zod_1.z.literal('oxy_one'),
30
32
  price: exports.personalPlanDisplayPriceSchema.optional(),
31
33
  benefits: zod_1.z.array(zod_1.z
32
- .object({ displayName: zod_1.z.string().min(1).max(100), benefit: access_1.productBenefitSchema })
34
+ .object({
35
+ displayName: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(100)),
36
+ benefit: access_1.productBenefitSchema,
37
+ })
33
38
  .strict()),
34
39
  })
35
40
  .strict()),
@@ -39,14 +44,14 @@ exports.personalPlanCatalogueSchema = zod_1.z
39
44
  exports.productPlanCatalogueSchema = zod_1.z
40
45
  .object({
41
46
  schemaVersion: zod_1.z.literal(1),
42
- productId: zod_1.z.string().min(1).max(160),
47
+ productId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(160)),
43
48
  purchase: zod_1.z.enum(['unavailable', 'available']),
44
49
  plans: zod_1.z.array(zod_1.z
45
50
  .object({
46
- productId: zod_1.z.string().min(1).max(160),
47
- offerId: zod_1.z.string().min(1).max(160),
48
- offerVersion: zod_1.z.number().int().positive().safe(),
49
- displayName: zod_1.z.string().min(1).max(100),
51
+ productId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(160)),
52
+ offerId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(160)),
53
+ offerVersion: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).positive().check((0, numberChecks_1.safeNumberCheck)()),
54
+ displayName: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(100)),
50
55
  price: exports.personalPlanDisplayPriceSchema.extend({ interval: zod_1.z.enum(['month', 'year']) }),
51
56
  })
52
57
  .strict()),
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logPageResponseSchema = exports.chainHeadResponseSchema = void 0;
4
+ const numberChecks_1 = require("./numberChecks");
2
5
  /**
3
6
  * Generic "Oxy Protocol" record surface — the app-agnostic conventions every app
4
7
  * follows to decentralize its own content on the shared signed-record substrate.
@@ -38,16 +41,14 @@
38
41
  *
39
42
  * Platform-agnostic — zod only, no react/react-native/expo, ESM-safe.
40
43
  */
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.logPageResponseSchema = exports.chainHeadResponseSchema = void 0;
43
44
  const zod_1 = require("zod");
44
45
  const identity_1 = require("./identity");
45
46
  exports.chainHeadResponseSchema = zod_1.z.object({
46
47
  headRecordId: zod_1.z.string().nullable(),
47
- seq: zod_1.z.number().int(),
48
- recordCount: zod_1.z.number().int().nonnegative(),
48
+ seq: zod_1.z.number().check((0, numberChecks_1.integerCheck)()),
49
+ recordCount: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
49
50
  });
50
51
  exports.logPageResponseSchema = zod_1.z.object({
51
52
  records: zod_1.z.array(identity_1.signedRecordEnvelopeSchema),
52
- count: zod_1.z.number().int().nonnegative(),
53
+ count: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
53
54
  });
@@ -1,4 +1,8 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.appAffinityEventsIngestSchema = exports.appAffinityEventSchema = exports.appAffinityEventTypeSchema = exports.appUserSignalIngestSchema = exports.appInterestInputSchema = exports.appEndorsementInputSchema = exports.recommendationResponseSchema = exports.recommendationItemSchema = exports.recommendationCountSchema = exports.recommendationRequestSchema = exports.recommendationSignalWeightsSchema = exports.recommendationBoostSchema = exports.recommendationExcludeTypeSchema = void 0;
4
+ const numberChecks_1 = require("./numberChecks");
5
+ const stringChecks_1 = require("./stringChecks");
2
6
  /**
3
7
  * Recommendation-engine API contracts.
4
8
  *
@@ -11,8 +15,6 @@
11
15
  * Platform-agnostic — zod is the only runtime dependency (no react / react-native
12
16
  * / expo, ESM-safe).
13
17
  */
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.appAffinityEventsIngestSchema = exports.appAffinityEventSchema = exports.appAffinityEventTypeSchema = exports.appUserSignalIngestSchema = exports.appInterestInputSchema = exports.appEndorsementInputSchema = exports.recommendationResponseSchema = exports.recommendationItemSchema = exports.recommendationCountSchema = exports.recommendationRequestSchema = exports.recommendationSignalWeightsSchema = exports.recommendationBoostSchema = exports.recommendationExcludeTypeSchema = void 0;
16
18
  const zod_1 = require("zod");
17
19
  const avatarCharacter_1 = require("./avatarCharacter");
18
20
  const userResponse_1 = require("./userResponse");
@@ -25,9 +27,12 @@ exports.recommendationExcludeTypeSchema = zod_1.z.enum(['federated', 'agent', 'a
25
27
  * gate — a boost cannot resurrect a private/restricted/ineligible account.
26
28
  */
27
29
  exports.recommendationBoostSchema = zod_1.z.object({
28
- userIds: zod_1.z.array(zod_1.z.string().trim().min(1)).min(1).max(200),
30
+ userIds: zod_1.z
31
+ .array(zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)))
32
+ .min(1)
33
+ .max(200),
29
34
  weight: zod_1.z.number().min(-5).max(5),
30
- reason: zod_1.z.string().trim().max(120).optional(),
35
+ reason: zod_1.z.string().trim().check((0, stringChecks_1.utf16MaxLength)(120)).optional(),
31
36
  });
32
37
  /**
33
38
  * Per-request overrides for the scoring signal weights. Every key is optional
@@ -55,18 +60,21 @@ exports.recommendationSignalWeightsSchema = zod_1.z
55
60
  * ranking within server-enforced bounds.
56
61
  */
57
62
  exports.recommendationRequestSchema = zod_1.z.object({
58
- clientId: zod_1.z.string().trim().min(1).optional(),
59
- limit: zod_1.z.number().int().min(1).max(100).optional(),
60
- offset: zod_1.z.number().int().min(0).optional(),
63
+ clientId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
64
+ limit: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).min(1).max(100).optional(),
65
+ offset: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).min(0).optional(),
61
66
  excludeTypes: zod_1.z.array(exports.recommendationExcludeTypeSchema).optional(),
62
- excludeIds: zod_1.z.array(zod_1.z.string().trim().min(1)).max(500).optional(),
67
+ excludeIds: zod_1.z
68
+ .array(zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)))
69
+ .max(500)
70
+ .optional(),
63
71
  boosts: zod_1.z.array(exports.recommendationBoostSchema).max(50).optional(),
64
72
  signalWeights: exports.recommendationSignalWeightsSchema.optional(),
65
73
  });
66
74
  /** Follower/following counts attached to a recommendation item. */
67
75
  exports.recommendationCountSchema = zod_1.z.object({
68
- followers: zod_1.z.number().int().nonnegative(),
69
- following: zod_1.z.number().int().nonnegative(),
76
+ followers: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
77
+ following: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
70
78
  });
71
79
  /**
72
80
  * A single recommended profile.
@@ -88,7 +96,7 @@ exports.recommendationItemSchema = zod_1.z
88
96
  description: zod_1.z.string().nullable().optional(),
89
97
  verified: zod_1.z.boolean().optional(),
90
98
  trustTier: zod_1.z.string().optional(),
91
- mutualCount: zod_1.z.number().int().nonnegative(),
99
+ mutualCount: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
92
100
  score: zod_1.z.number().optional(),
93
101
  matchedSignals: zod_1.z.array(zod_1.z.string()).optional(),
94
102
  isFederated: zod_1.z.boolean().optional(),
@@ -102,14 +110,14 @@ exports.recommendationItemSchema = zod_1.z
102
110
  exports.recommendationResponseSchema = zod_1.z.array(exports.recommendationItemSchema);
103
111
  /** One endorsement edge an app reports: `ownerId` endorses `memberId`. */
104
112
  exports.appEndorsementInputSchema = zod_1.z.object({
105
- ownerId: zod_1.z.string().trim().min(1),
106
- memberId: zod_1.z.string().trim().min(1),
113
+ ownerId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
114
+ memberId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
107
115
  op: zod_1.z.enum(['add', 'remove']).default('add'),
108
- sourceId: zod_1.z.string().trim().min(1).optional(),
116
+ sourceId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
109
117
  });
110
118
  /** One interest signal an app reports: how interested `userId` is in a topic. */
111
119
  exports.appInterestInputSchema = zod_1.z.object({
112
- userId: zod_1.z.string().trim().min(1),
120
+ userId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
113
121
  interestScore: zod_1.z.number().min(0).max(1),
114
122
  });
115
123
  /**
@@ -153,12 +161,12 @@ exports.appAffinityEventTypeSchema = zod_1.z.enum([
153
161
  * same application is folded at most once (bounded dedup window).
154
162
  */
155
163
  exports.appAffinityEventSchema = zod_1.z.object({
156
- fromUserId: zod_1.z.string().trim().min(1),
157
- toUserId: zod_1.z.string().trim().min(1),
164
+ fromUserId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
165
+ toUserId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
158
166
  type: exports.appAffinityEventTypeSchema,
159
167
  weight: zod_1.z.number().min(0).max(100).optional(),
160
- occurredAt: zod_1.z.string().datetime().optional(),
161
- eventId: zod_1.z.string().trim().min(1).max(200).optional(),
168
+ occurredAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()).optional(),
169
+ eventId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(200)).optional(),
162
170
  });
163
171
  /**
164
172
  * Request body for `POST /app-signals/events` (service token, `signals:write`).
@@ -1,4 +1,8 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.awardReputationSchema = exports.reputationInfluenceResultSchema = exports.reputationLeaderboardEntrySchema = exports.reputationLeaderboardUserSchema = exports.reputationRulesResponseSchema = exports.reputationRuleSchema = exports.reputationBalanceSchema = exports.reputationBalanceSummarySchema = exports.reputationReliabilitySchema = exports.reputationInfluenceSchema = exports.reputationBalanceBreakdownSchema = exports.reputationTransactionSchema = exports.reputationInfluenceContextSchema = exports.REPUTATION_INFLUENCE_CONTEXTS = exports.reputationTargetEntityTypeSchema = exports.REPUTATION_TARGET_ENTITY_TYPES = exports.trustTierSchema = exports.TRUST_TIERS = exports.reputationTransactionStatusSchema = exports.REPUTATION_TRANSACTION_STATUSES = exports.reputationCategorySchema = exports.REPUTATION_CATEGORIES = exports.isFullReputationBalance = void 0;
4
+ const numberChecks_1 = require("./numberChecks");
5
+ const stringChecks_1 = require("./stringChecks");
2
6
  /**
3
7
  * Oxy Trust — reputation API contracts.
4
8
  *
@@ -39,8 +43,6 @@
39
43
  * Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
40
44
  * `require()`).
41
45
  */
42
- Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.awardReputationSchema = exports.reputationInfluenceResultSchema = exports.reputationLeaderboardEntrySchema = exports.reputationLeaderboardUserSchema = exports.reputationRulesResponseSchema = exports.reputationRuleSchema = exports.reputationBalanceSchema = exports.reputationBalanceSummarySchema = exports.reputationReliabilitySchema = exports.reputationInfluenceSchema = exports.reputationBalanceBreakdownSchema = exports.reputationTransactionSchema = exports.reputationInfluenceContextSchema = exports.REPUTATION_INFLUENCE_CONTEXTS = exports.reputationTargetEntityTypeSchema = exports.REPUTATION_TARGET_ENTITY_TYPES = exports.trustTierSchema = exports.TRUST_TIERS = exports.reputationTransactionStatusSchema = exports.REPUTATION_TRANSACTION_STATUSES = exports.reputationCategorySchema = exports.REPUTATION_CATEGORIES = exports.isFullReputationBalance = void 0;
44
46
  const zod_1 = require("zod");
45
47
  const userResponse_1 = require("./userResponse");
46
48
  const moderationReputation_1 = require("./moderationReputation");
@@ -125,7 +127,7 @@ exports.reputationTransactionSchema = zod_1.z.object({
125
127
  status: exports.reputationTransactionStatusSchema,
126
128
  reversedTransactionId: zod_1.z.string().optional(),
127
129
  reason: zod_1.z.string().optional(),
128
- metadata: zod_1.z.record(zod_1.z.unknown()).optional(),
130
+ metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
129
131
  createdByUserId: zod_1.z.string().optional(),
130
132
  reviewedByUserId: zod_1.z.string().optional(),
131
133
  reviewedAt: zod_1.z.string().optional(),
@@ -183,7 +185,7 @@ exports.reputationRuleSchema = zod_1.z.object({
183
185
  cooldownInMinutes: zod_1.z.number(),
184
186
  });
185
187
  exports.reputationRulesResponseSchema = zod_1.z.object({
186
- version: zod_1.z.number().int(),
188
+ version: zod_1.z.number().check((0, numberChecks_1.integerCheck)()),
187
189
  rules: zod_1.z.array(exports.reputationRuleSchema),
188
190
  });
189
191
  exports.reputationLeaderboardUserSchema = zod_1.z.object({
@@ -205,14 +207,14 @@ exports.reputationInfluenceResultSchema = zod_1.z.object({
205
207
  influence: exports.reputationInfluenceSchema,
206
208
  });
207
209
  exports.awardReputationSchema = zod_1.z.object({
208
- userId: zod_1.z.string().trim().min(1),
209
- actionType: zod_1.z.string().trim().min(1),
210
- applicationId: zod_1.z.string().trim().min(1).optional(),
211
- credentialId: zod_1.z.string().trim().min(1).optional(),
212
- sourceActionId: zod_1.z.string().trim().min(1).optional(),
213
- sourceActionType: zod_1.z.string().trim().min(1).optional(),
214
- targetEntityId: zod_1.z.string().trim().min(1).optional(),
210
+ userId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
211
+ actionType: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)),
212
+ applicationId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
213
+ credentialId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
214
+ sourceActionId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
215
+ sourceActionType: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
216
+ targetEntityId: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).optional(),
215
217
  targetEntityType: exports.reputationTargetEntityTypeSchema.optional(),
216
- reason: zod_1.z.string().trim().max(500).optional(),
217
- metadata: zod_1.z.record(zod_1.z.unknown()).optional(),
218
+ reason: zod_1.z.string().trim().check((0, stringChecks_1.utf16MaxLength)(500)).optional(),
219
+ metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
218
220
  });
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.safetyErrorSchema = exports.SAFETY_ERROR_CODES = exports.cancelPurchaseSchema = exports.confirmPurchaseSchema = exports.reservePurchaseSchema = exports.purchaseApprovalListSchema = exports.purchaseApprovalSummarySchema = exports.purchaseApprovalSchema = exports.purchaseEffectsSchema = exports.purchaseApprovalLineSchema = exports.supervisionContactsResponseSchema = exports.supervisionStateSchema = exports.supervisionContactSchema = exports.supervisionInvitationSchema = exports.supervisionSchema = exports.safetyRequesterSchema = exports.messagingSessionsResponseSchema = exports.messagingSessionsInputSchema = exports.messageAccessBatchResponseSchema = exports.deliveryAccessBatchInputSchema = exports.messageAccessBatchInputSchema = exports.deliveryAccessInputSchema = exports.contentAccessBatchResponseSchema = exports.contentAccessBatchInputSchema = exports.publicationPoliciesResponseSchema = exports.publicationPoliciesInputSchema = exports.publicationPolicySchema = exports.contentAccessInputSchema = exports.CONTENT_CLASSIFICATIONS = exports.contactAccessResponseSchema = exports.contactAccessInputSchema = exports.messageAccessInputSchema = exports.MESSAGE_ACCESS_MAX_INPUT_BYTES = exports.MESSAGE_ACCESS_MAX_PARTICIPANT_SLOTS = exports.MESSAGE_ACCESS_MAX_SUPERVISED_PARTICIPANTS = exports.MESSAGE_ACCESS_MAX_PARTICIPANTS = exports.MESSAGE_ACCESS_MAX_RESOURCES = exports.profileAccessBatchResponseSchema = exports.profileAccessBatchInputSchema = exports.safetyDecisionSchema = exports.SAFETY_DECISION_REASONS = exports.profileAccessDecisionSchema = exports.profileAccessInputSchema = exports.SUPERVISION_STATUSES = exports.SUPERVISION_INVITATION_STATUSES = exports.SUPERVISION_CONSENT_VERSION = exports.SUPERVISION_CHANGED_EVENT = exports.SUPERVISED_ACTIONS = exports.SAFETY_POLICY_VERSION = exports.PURCHASE_APPROVAL_STATUSES = void 0;
4
4
  exports.safetyOrganizationsResponseSchema = exports.safetyOrganizationsInputSchema = exports.safetyOrganizationIdentitySchema = exports.safetyPeopleResponseSchema = exports.safetyPeopleInputSchema = exports.safetyPersonSchema = exports.safetySessionValidationSchema = exports.safetySessionInputSchema = exports.purchaseReviewInputSchema = exports.supervisionReviewInputSchema = exports.supervisionContactInputSchema = exports.supervisionAcceptInputSchema = exports.supervisionInviteInputSchema = void 0;
5
+ const numberChecks_1 = require("./numberChecks");
6
+ const stringChecks_1 = require("./stringChecks");
5
7
  const zod_1 = require("zod");
6
8
  const accountSubject_1 = require("./accountSubject");
7
9
  // The Zod-free half of this contract lives in `./client/` (`@oxy.so/contracts/client`);
@@ -19,7 +21,7 @@ const signIn_1 = require("./signIn");
19
21
  const userResponse_1 = require("./userResponse");
20
22
  /** The requester is authenticated by the bearer; applications cannot submit viewer IDs. */
21
23
  exports.profileAccessInputSchema = zod_1.z
22
- .object({ subjectAccountId: zod_1.z.string().min(1).max(128) })
24
+ .object({ subjectAccountId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)) })
23
25
  .strict();
24
26
  exports.profileAccessDecisionSchema = zod_1.z
25
27
  .object({
@@ -41,8 +43,8 @@ exports.SAFETY_DECISION_REASONS = [
41
43
  'unrated_content',
42
44
  'approval_required',
43
45
  ];
44
- const accountId = zod_1.z.string().min(1).max(128);
45
- const resourceId = zod_1.z.string().trim().min(1).max(256);
46
+ const accountId = zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128));
47
+ const resourceId = zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(256));
46
48
  const uniqueIds = (max, min = 1) => zod_1.z
47
49
  .array(accountId)
48
50
  .min(min)
@@ -177,7 +179,7 @@ exports.messagingSessionsInputSchema = zod_1.z
177
179
  .array(zod_1.z
178
180
  .object({
179
181
  requestId: resourceId,
180
- accessToken: zod_1.z.string().min(1).max(16384),
182
+ accessToken: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(16384)),
181
183
  })
182
184
  .strict())
183
185
  .min(1)
@@ -197,8 +199,20 @@ exports.messagingSessionsResponseSchema = zod_1.z
197
199
  })
198
200
  .strict();
199
201
  exports.safetyRequesterSchema = zod_1.z.union([
200
- zod_1.z.object({ accessToken: zod_1.z.string().min(1).max(16384).nullable() }).strict(),
201
- zod_1.z.object({ connectionToken: zod_1.z.string().min(1).max(16384) }).strict(),
202
+ zod_1.z
203
+ .object({
204
+ accessToken: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(16384)).nullable(),
205
+ })
206
+ .strict(),
207
+ zod_1.z
208
+ .object({ connectionToken: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(16384)) })
209
+ .strict(),
210
+ zod_1.z
211
+ .object({ capabilityTicket: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(16384)) })
212
+ .strict(),
213
+ zod_1.z
214
+ .object({ requesterContext: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(16384)) })
215
+ .strict(),
202
216
  ]);
203
217
  exports.supervisionSchema = zod_1.z
204
218
  .object({
@@ -207,7 +221,7 @@ exports.supervisionSchema = zod_1.z
207
221
  status: zod_1.z.enum(safety_1.SUPERVISION_STATUSES),
208
222
  policyVersion: zod_1.z.literal(safety_1.SAFETY_POLICY_VERSION),
209
223
  consentVersion: zod_1.z.literal(safety_1.SUPERVISION_CONSENT_VERSION),
210
- createdAt: zod_1.z.string().datetime(),
224
+ createdAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
211
225
  })
212
226
  .strict();
213
227
  exports.supervisionInvitationSchema = zod_1.z
@@ -216,16 +230,16 @@ exports.supervisionInvitationSchema = zod_1.z
216
230
  childAccountId: accountId,
217
231
  guardianAccountId: accountId,
218
232
  status: zod_1.z.enum(safety_1.SUPERVISION_INVITATION_STATUSES),
219
- expiresAt: zod_1.z.string().datetime(),
233
+ expiresAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
220
234
  consentVersion: zod_1.z.literal(safety_1.SUPERVISION_CONSENT_VERSION),
221
- createdAt: zod_1.z.string().datetime(),
235
+ createdAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
222
236
  })
223
237
  .strict();
224
238
  exports.supervisionContactSchema = zod_1.z
225
239
  .object({
226
240
  childAccountId: accountId,
227
241
  contactAccountId: accountId,
228
- approvedAt: zod_1.z.string().datetime(),
242
+ approvedAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
229
243
  })
230
244
  .strict();
231
245
  exports.supervisionStateSchema = zod_1.z
@@ -239,14 +253,14 @@ exports.supervisionContactsResponseSchema = zod_1.z
239
253
  .object({ items: zod_1.z.array(exports.supervisionContactSchema).max(1000) })
240
254
  .strict();
241
255
  const fingerprint = zod_1.z.string().regex(/^[a-f0-9]{64}$/);
242
- const minorUnits = zod_1.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
256
+ const minorUnits = zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative().max(Number.MAX_SAFE_INTEGER);
243
257
  exports.purchaseApprovalLineSchema = zod_1.z
244
258
  .object({
245
259
  itemReference: resourceId,
246
- title: zod_1.z.string().trim().min(1).max(300),
247
- optionsText: zod_1.z.string().trim().max(300),
260
+ title: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(300)),
261
+ optionsText: zod_1.z.string().trim().check((0, stringChecks_1.utf16MaxLength)(300)),
248
262
  merchantAccountId: accountId,
249
- quantity: zod_1.z.number().int().min(1).max(1000000),
263
+ quantity: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).min(1).max(1000000),
250
264
  unitAmountMinor: minorUnits,
251
265
  lineAmountMinor: minorUnits,
252
266
  })
@@ -256,7 +270,7 @@ const purchaseEffectsObject = zod_1.z
256
270
  operationId: resourceId,
257
271
  resourceId,
258
272
  cartFingerprint: fingerprint,
259
- summary: zod_1.z.string().trim().min(1).max(300),
273
+ summary: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(300)),
260
274
  merchantAccountIds: zod_1.z
261
275
  .array(accountId)
262
276
  .min(1)
@@ -269,13 +283,13 @@ const purchaseEffectsObject = zod_1.z
269
283
  discountMinor: minorUnits,
270
284
  roundingAdjustmentMinor: zod_1.z
271
285
  .number()
272
- .int()
286
+ .check((0, numberChecks_1.integerCheck)())
273
287
  .min(-Number.MAX_SAFE_INTEGER)
274
288
  .max(Number.MAX_SAFE_INTEGER),
275
289
  paymentFingerprint: fingerprint,
276
290
  amountMinor: minorUnits,
277
291
  currency: zod_1.z.string().regex(/^[A-Z]{3}$/),
278
- expiresAt: zod_1.z.string().datetime(),
292
+ expiresAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
279
293
  })
280
294
  .strict();
281
295
  function validatePurchaseEvidence(value, ctx) {
@@ -318,8 +332,8 @@ const purchaseApprovalFields = {
318
332
  childAccountId: accountId,
319
333
  applicationId: accountId,
320
334
  status: zod_1.z.enum(safety_1.PURCHASE_APPROVAL_STATUSES),
321
- createdAt: zod_1.z.string().datetime(),
322
- receiptReference: zod_1.z.string().max(512).nullable(),
335
+ createdAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
336
+ receiptReference: zod_1.z.string().check((0, stringChecks_1.utf16MaxLength)(512)).nullable(),
323
337
  };
324
338
  exports.purchaseApprovalSchema = purchaseEffectsObject
325
339
  .extend(purchaseApprovalFields)
@@ -343,7 +357,7 @@ exports.confirmPurchaseSchema = zod_1.z
343
357
  .object({
344
358
  approvalId: accountId,
345
359
  operationId: resourceId,
346
- receiptReference: zod_1.z.string().trim().min(1).max(512),
360
+ receiptReference: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(512)),
347
361
  })
348
362
  .strict();
349
363
  exports.cancelPurchaseSchema = exports.confirmPurchaseSchema.omit({ receiptReference: true });
@@ -380,7 +394,7 @@ exports.supervisionReviewInputSchema = zod_1.z
380
394
  childAccountId: accountId,
381
395
  action: zod_1.z.enum(['end', 'transfer']),
382
396
  guardianAccountId: accountId.optional(),
383
- evidenceReference: zod_1.z.string().trim().min(1).max(2048),
397
+ evidenceReference: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(2048)),
384
398
  reauth: signIn_1.reauthProofSchema,
385
399
  })
386
400
  .strict();
@@ -390,7 +404,7 @@ exports.purchaseReviewInputSchema = zod_1.z
390
404
  exports.safetySessionInputSchema = zod_1.z
391
405
  .object({
392
406
  sessionId: accountId,
393
- accessToken: zod_1.z.string().min(1).max(16384),
407
+ accessToken: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(16384)),
394
408
  action: zod_1.z.enum(safety_1.SUPERVISED_ACTIONS),
395
409
  })
396
410
  .strict();
@@ -398,8 +412,8 @@ exports.safetySessionValidationSchema = zod_1.z
398
412
  .object({
399
413
  valid: zod_1.z.literal(true),
400
414
  sessionId: accountId,
401
- expiresAt: zod_1.z.string().datetime(),
402
- lastActivity: zod_1.z.string().datetime(),
415
+ expiresAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
416
+ lastActivity: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
403
417
  user: userResponse_1.userResponseSchema,
404
418
  actor: accountSubject_1.accountActorChainSchema,
405
419
  })
@@ -409,7 +423,9 @@ exports.safetyPersonSchema = zod_1.z
409
423
  .object({ accountId, username: zod_1.z.string().nullable(), displayName: zod_1.z.string().nullable() })
410
424
  .strict();
411
425
  exports.safetyPeopleInputSchema = zod_1.z.union([
412
- zod_1.z.object({ query: zod_1.z.string().trim().min(2).max(100) }).strict(),
426
+ zod_1.z
427
+ .object({ query: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(2)).check((0, stringChecks_1.utf16MaxLength)(100)) })
428
+ .strict(),
413
429
  zod_1.z.object({ accountIds: uniqueIds(100) }).strict(),
414
430
  ]);
415
431
  exports.safetyPeopleResponseSchema = zod_1.z
@@ -427,8 +443,8 @@ exports.safetyOrganizationIdentitySchema = zod_1.z
427
443
  exports.safetyOrganizationsInputSchema = zod_1.z.union([
428
444
  zod_1.z
429
445
  .object({
430
- query: zod_1.z.string().trim().min(1).max(100),
431
- limit: zod_1.z.number().int().min(1).max(20).optional(),
446
+ query: zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(100)),
447
+ limit: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).min(1).max(20).optional(),
432
448
  })
433
449
  .strict(),
434
450
  zod_1.z.object({ ids: uniqueIds(100) }).strict(),
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serviceTokenOptionsSchema = exports.serviceTokenScopesSchema = void 0;
3
+ exports.resourceIntrospectionSchema = exports.resourcePrincipalSchema = exports.serviceIntrospectionSchema = exports.servicePrincipalSchema = exports.externalServicePrincipalSchema = exports.firstPartyServicePrincipalSchema = exports.serviceAuthoritySchema = exports.serviceTokenOptionsSchema = exports.serviceTokenScopesSchema = void 0;
4
+ const stringChecks_1 = require("./stringChecks");
4
5
  const zod_1 = require("zod");
5
6
  /** Omitted means the existing grant; an explicit set only narrows that authority. */
6
7
  exports.serviceTokenScopesSchema = zod_1.z
7
- .array(zod_1.z.string().trim().min(1).max(128))
8
+ .array(zod_1.z.string().trim().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(128)))
8
9
  .min(1)
9
10
  .max(100)
10
11
  .refine((scopes) => new Set(scopes).size === scopes.length, 'Requested scopes must be unique')
@@ -12,3 +13,81 @@ exports.serviceTokenScopesSchema = zod_1.z
12
13
  exports.serviceTokenOptionsSchema = zod_1.z
13
14
  .object({ scopes: exports.serviceTokenScopesSchema.optional() })
14
15
  .strict();
16
+ /** First-party authority is issued only to an attested, live Oxy workload. */
17
+ exports.serviceAuthoritySchema = zod_1.z.enum(['first_party', 'external']);
18
+ const resourceIdentity = {
19
+ active: zod_1.z.literal(true),
20
+ accountId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
21
+ applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
22
+ credentialId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
23
+ environment: zod_1.z.enum(['production', 'staging', 'development']),
24
+ audience: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
25
+ expiresAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
26
+ };
27
+ /** No scope list exists in the internal authority variant. */
28
+ exports.firstPartyServicePrincipalSchema = zod_1.z.object({
29
+ ...resourceIdentity,
30
+ authority: zod_1.z.literal('first_party'),
31
+ scopes: zod_1.z.never().optional(),
32
+ });
33
+ exports.externalServicePrincipalSchema = zod_1.z.object({
34
+ ...resourceIdentity,
35
+ authority: zod_1.z.literal('external'),
36
+ scopes: zod_1.z.array(zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1))),
37
+ });
38
+ exports.servicePrincipalSchema = zod_1.z.discriminatedUnion('authority', [
39
+ exports.firstPartyServicePrincipalSchema,
40
+ exports.externalServicePrincipalSchema,
41
+ ]);
42
+ exports.serviceIntrospectionSchema = zod_1.z.union([
43
+ zod_1.z.object({ active: zod_1.z.literal(false) }),
44
+ exports.servicePrincipalSchema,
45
+ ]);
46
+ /** A resource receiver introspects services, external keys and human sessions distinctly. */
47
+ const sessionIdentity = {
48
+ active: zod_1.z.literal(true),
49
+ kind: zod_1.z.literal('session'),
50
+ permissions: zod_1.z.array(zod_1.z.string()),
51
+ accountId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
52
+ requesterAccountId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
53
+ effectiveAccountId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
54
+ expiresAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()),
55
+ };
56
+ exports.resourcePrincipalSchema = zod_1.z.union([
57
+ exports.firstPartyServicePrincipalSchema.extend({
58
+ kind: zod_1.z.literal('service'),
59
+ permissions: zod_1.z.array(zod_1.z.string()),
60
+ }),
61
+ exports.externalServicePrincipalSchema.extend({
62
+ kind: zod_1.z.literal('service'),
63
+ permissions: zod_1.z.array(zod_1.z.string()),
64
+ }),
65
+ zod_1.z.object({
66
+ active: zod_1.z.literal(true),
67
+ kind: zod_1.z.literal('key'),
68
+ expiresAt: zod_1.z.string().check((0, stringChecks_1.isoDateTime)()).optional(),
69
+ permissions: zod_1.z.array(zod_1.z.string()),
70
+ authority: zod_1.z.literal('external'),
71
+ accountId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
72
+ applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
73
+ credentialId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
74
+ environment: zod_1.z.enum(['production', 'staging', 'development']),
75
+ scopes: zod_1.z.array(zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1))),
76
+ }),
77
+ zod_1.z.object({
78
+ ...sessionIdentity,
79
+ authority: zod_1.z.literal('first_party'),
80
+ applicationId: zod_1.z.null(),
81
+ scopes: zod_1.z.never().optional(),
82
+ }),
83
+ zod_1.z.object({
84
+ ...sessionIdentity,
85
+ authority: zod_1.z.literal('external'),
86
+ applicationId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)),
87
+ scopes: zod_1.z.array(zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1))),
88
+ }),
89
+ ]);
90
+ exports.resourceIntrospectionSchema = zod_1.z.union([
91
+ zod_1.z.object({ active: zod_1.z.literal(false) }),
92
+ exports.resourcePrincipalSchema,
93
+ ]);
@@ -1,4 +1,8 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.oxyServiceEventsHeartbeatSchema = exports.oxySessionRevocationEventSchema = exports.OXY_SERVICE_EVENTS_FORBIDDEN = exports.OXY_SERVICE_EVENTS_STALE_AFTER_MS = exports.OXY_SERVICE_EVENTS_HEARTBEAT_MS = exports.OXY_SERVICE_EVENTS_HEARTBEAT_EVENT = exports.OXY_SESSION_REVOKED_EVENT = exports.OXY_SERVICE_EVENTS_NAMESPACE = void 0;
4
+ const numberChecks_1 = require("./numberChecks");
5
+ const stringChecks_1 = require("./stringChecks");
2
6
  /**
3
7
  * Canonical contract for the session-revocation feed: oxy-api telling every
4
8
  * connected Oxy backend that a session stopped being valid.
@@ -35,8 +39,6 @@
35
39
  *
36
40
  * Platform-agnostic — zod only, no react/react-native/expo.
37
41
  */
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.oxyServiceEventsHeartbeatSchema = exports.oxySessionRevocationEventSchema = exports.OXY_SERVICE_EVENTS_FORBIDDEN = exports.OXY_SERVICE_EVENTS_STALE_AFTER_MS = exports.OXY_SERVICE_EVENTS_HEARTBEAT_MS = exports.OXY_SERVICE_EVENTS_HEARTBEAT_EVENT = exports.OXY_SESSION_REVOKED_EVENT = exports.OXY_SERVICE_EVENTS_NAMESPACE = void 0;
40
42
  const zod_1 = require("zod");
41
43
  /** The Socket.IO namespace on oxy-api that carries service events. */
42
44
  exports.OXY_SERVICE_EVENTS_NAMESPACE = '/service-events';
@@ -77,13 +79,13 @@ exports.OXY_SERVICE_EVENTS_FORBIDDEN = 'service_events_forbidden';
77
79
  */
78
80
  exports.oxySessionRevocationEventSchema = zod_1.z.object({
79
81
  /** The session that ended; absent for a revocation of every session of `userId`. */
80
- sessionId: zod_1.z.string().min(1).max(256).optional(),
82
+ sessionId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(256)).optional(),
81
83
  /** The account the session (or sessions) spoke as. */
82
- userId: zod_1.z.string().min(1).max(256),
84
+ userId: zod_1.z.string().check((0, stringChecks_1.utf16MinLength)(1)).check((0, stringChecks_1.utf16MaxLength)(256)),
83
85
  /** Publisher's epoch-ms timestamp. Diagnostic only. */
84
- at: zod_1.z.number().int().nonnegative(),
86
+ at: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
85
87
  });
86
88
  /** The heartbeat payload. */
87
89
  exports.oxyServiceEventsHeartbeatSchema = zod_1.z.object({
88
- at: zod_1.z.number().int().nonnegative(),
90
+ at: zod_1.z.number().check((0, numberChecks_1.integerCheck)()).nonnegative(),
89
91
  });