@domino-sdk/relay 1.9.0 → 1.10.1

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 (44) hide show
  1. package/dist/{activity-CCe1e_7a.d.ts → activity-C0O3g7VJ.d.ts} +115 -115
  2. package/dist/authoring.d.ts +49 -49
  3. package/dist/authoring.js +3 -3
  4. package/dist/{automatic-outcomes-Dyk0VTUs.d.ts → automatic-outcomes-kPIDv6X_.d.ts} +1 -1
  5. package/dist/avatar.d.ts +2 -2
  6. package/dist/browser.d.ts +8 -8
  7. package/dist/browser.js +8 -7
  8. package/dist/{capability-error-Bv996M-h.d.ts → capability-error-ty3SqD_b.d.ts} +1 -1
  9. package/dist/chunk-2M3HLQFP.js +13 -0
  10. package/dist/{chunk-KGJSKGKI.js → chunk-5WK4EB5I.js} +1120 -910
  11. package/dist/{chunk-5ECM6AWV.js → chunk-A2KXEGGD.js} +3 -3
  12. package/dist/{chunk-L3QFIRGO.js → chunk-FH7ZFHDB.js} +2 -2
  13. package/dist/{chunk-FWSSMSIA.js → chunk-MDN5EJY2.js} +37 -8
  14. package/dist/{chunk-2V74CHDL.js → chunk-MJMFGTVV.js} +52 -37
  15. package/dist/{chunk-2N464DDE.js → chunk-NM2ZAWTF.js} +48 -37
  16. package/dist/{chunk-ETPL6AAJ.js → chunk-PFKV2M4B.js} +1 -1
  17. package/dist/{chunk-6ON4RMEN.js → chunk-PRLGLZM4.js} +1 -1
  18. package/dist/{chunk-JW4G3SY5.js → chunk-S4IHOJEP.js} +60 -47
  19. package/dist/{chunk-23QJ7WH4.js → chunk-WZJQ7XAT.js} +1 -1
  20. package/dist/{chunk-734LYHWP.js → chunk-XMZNIFXH.js} +232 -7
  21. package/dist/{client-CbASImpi.d.ts → client-Yq11HA_f.d.ts} +26 -11
  22. package/dist/{groups-Dvmd4CYk.d.ts → groups-BK8ts2yK.d.ts} +94 -6
  23. package/dist/{images-Dekv3DYF.d.ts → images-aw6W7vFZ.d.ts} +2 -2
  24. package/dist/index.d.ts +9 -9
  25. package/dist/index.js +7 -6
  26. package/dist/internal.d.ts +3 -3
  27. package/dist/internal.js +5 -5
  28. package/dist/{offers-BEGVSOTD.d.ts → offers-C2FANzrG.d.ts} +3 -3
  29. package/dist/{pages-HmS6eedC.d.ts → pages-D00JDZB-.d.ts} +33 -2
  30. package/dist/portal-proxy.js +8 -2
  31. package/dist/react/index.d.ts +14 -17
  32. package/dist/react/index.js +8 -7
  33. package/dist/{referral-reward-kinds-Flbb1D2q.d.ts → referral-reward-kinds-M3f0PdiR.d.ts} +2 -2
  34. package/dist/{schema-BCuiO7eD.d.ts → schema-DEM8y8Fm.d.ts} +1 -1
  35. package/dist/schema.d.ts +11239 -13
  36. package/dist/schema.js +38 -6
  37. package/dist/server/index.d.ts +43117 -22
  38. package/dist/server/index.js +303 -14
  39. package/dist/{sign-in-options-z3wsfizk.d.ts → sign-in-options-Coim0G1u.d.ts} +3 -3
  40. package/dist/{submission-input-Bs14jIsu.d.ts → submission-input-BbBJTVlT.d.ts} +3 -3
  41. package/dist/util.d-w9f9t3ua.d.ts +5 -0
  42. package/dist/{wallet-YssWxGg8.d.ts → wallet-CDyo-U4n.d.ts} +1 -1
  43. package/package.json +1 -1
  44. package/dist/{profiles-D2aFcOxu.d.ts → profiles-BHMVj0kM.d.ts} +5 -5
@@ -4,15 +4,15 @@ import {
4
4
  imageFieldsSchema,
5
5
  imageInspectionSchema,
6
6
  imageSightingsSchema
7
- } from "./chunk-JW4G3SY5.js";
7
+ } from "./chunk-S4IHOJEP.js";
8
8
  import {
9
9
  authScopeSchema
10
- } from "./chunk-6ON4RMEN.js";
10
+ } from "./chunk-PRLGLZM4.js";
11
11
  import {
12
12
  appIdentityKindSchema,
13
13
  openIdentityKindSchema,
14
14
  photoResultSchema
15
- } from "./chunk-KGJSKGKI.js";
15
+ } from "./chunk-5WK4EB5I.js";
16
16
 
17
17
  // src/configuration.ts
18
18
  function questConfiguration(release) {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createRelayClient
3
- } from "./chunk-FWSSMSIA.js";
3
+ } from "./chunk-MDN5EJY2.js";
4
4
  import {
5
5
  RelayErrorCode,
6
6
  asRelayError,
7
7
  clientError,
8
8
  cosmosChain
9
- } from "./chunk-2V74CHDL.js";
9
+ } from "./chunk-MJMFGTVV.js";
10
10
 
11
11
  // src/base58.ts
12
12
  var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createRelayAction,
3
3
  withActionId
4
- } from "./chunk-ETPL6AAJ.js";
4
+ } from "./chunk-PFKV2M4B.js";
5
5
  import {
6
6
  collectionPassSchema,
7
7
  participantActivityQuerySchema,
@@ -16,7 +16,7 @@ import {
16
16
  questOutcomeQuerySchema,
17
17
  questOutcomeSchema,
18
18
  rewardDeliveriesSchema
19
- } from "./chunk-2N464DDE.js";
19
+ } from "./chunk-NM2ZAWTF.js";
20
20
  import {
21
21
  AVATAR_UPLOAD_LIMIT,
22
22
  RelayError,
@@ -27,7 +27,7 @@ import {
27
27
  engagementPageQuerySchema,
28
28
  engagementPageSchema,
29
29
  isRelayError,
30
- leaderboardDefinitionSchema,
30
+ leaderboardDefinitionResponseSchema,
31
31
  leaderboardPageSchema,
32
32
  leaderboardPlacementSchema,
33
33
  leaderboardQuerySchema,
@@ -55,7 +55,7 @@ import {
55
55
  walletSignInNetworksSchema,
56
56
  walletSignatureSchema,
57
57
  walletUnlinkInputSchema
58
- } from "./chunk-2V74CHDL.js";
58
+ } from "./chunk-MJMFGTVV.js";
59
59
  import {
60
60
  PARTICIPANT_TIMEOUT,
61
61
  lifetime,
@@ -63,13 +63,16 @@ import {
63
63
  retrying,
64
64
  validTimeout
65
65
  } from "./chunk-6QJ3LADK.js";
66
+ import {
67
+ clientIdentity
68
+ } from "./chunk-2M3HLQFP.js";
66
69
  import {
67
70
  exchangeResultSchema,
68
71
  exchangeSchema,
69
72
  memberSummarySchema,
70
73
  participantSessionSchema,
71
74
  sessionMember
72
- } from "./chunk-6ON4RMEN.js";
75
+ } from "./chunk-PRLGLZM4.js";
73
76
  import {
74
77
  accountConnectionSchema,
75
78
  attemptSchema,
@@ -83,6 +86,7 @@ import {
83
86
  contentQualificationQuerySchema,
84
87
  evidenceSchema,
85
88
  identifier,
89
+ knownResponse,
86
90
  memberProgressSchema,
87
91
  missingPrerequisiteSchema,
88
92
  pageQuerySchema,
@@ -92,7 +96,7 @@ import {
92
96
  tieredRewardReferenceSchema,
93
97
  validateSubmissionValue,
94
98
  valueEvidenceSchema
95
- } from "./chunk-KGJSKGKI.js";
99
+ } from "./chunk-5WK4EB5I.js";
96
100
 
97
101
  // src/submissions.ts
98
102
  import { z } from "zod";
@@ -852,6 +856,7 @@ function relayClient(options) {
852
856
  async function send(path, call, life) {
853
857
  const method = methodOf(call);
854
858
  const headers = new Headers(call.headers);
859
+ headers.set("X-Domino-Client", clientIdentity());
855
860
  let body2 = call.body;
856
861
  if (options.token) {
857
862
  headers.set("Authorization", `Bearer ${options.token}`);
@@ -973,7 +978,7 @@ function relayClient(options) {
973
978
  } catch (error) {
974
979
  throw invalidResponse(response.status, call, error);
975
980
  }
976
- const parsed = schema.safeParse(value);
981
+ const parsed = knownResponse(schema).safeParse(value);
977
982
  if (!parsed.success) {
978
983
  throw invalidResponse(response.status, call, parsed.error);
979
984
  }
@@ -1076,6 +1081,30 @@ function relayClient(options) {
1076
1081
  return {
1077
1082
  /** Owns one action key across uncertain writes. Reuse the helper until a definite answer. */
1078
1083
  action: createRelayAction,
1084
+ /** A JSON call using an explicit tolerant response schema from `@domino-sdk/relay/schema`. */
1085
+ response: (path, schema, call = {}) => {
1086
+ const base = new URL(options.baseUrl, "http://response.invalid");
1087
+ const target = new URL(path, base);
1088
+ if (!path.startsWith("/v1/") || /[\\#]/.test(path) || /%2e|%2f|%5c/i.test(path.split("?")[0]) || target.origin !== base.origin || !target.pathname.startsWith("/v1/")) {
1089
+ throw clientError(
1090
+ "Response path must stay within /v1",
1091
+ RelayErrorCode.InvalidInput
1092
+ );
1093
+ }
1094
+ const requestCall = {
1095
+ method: call.method,
1096
+ json: call.input,
1097
+ operationId: call.operationId,
1098
+ replaySafe: call.replaySafe,
1099
+ headers: { "X-Domino-Response": "tolerant-v1" },
1100
+ options: call
1101
+ };
1102
+ return exchange(path, requestCall, async (response, life) => ({
1103
+ status: response.status,
1104
+ operationId: call.operationId,
1105
+ result: await read(response, schema, requestCall, life)
1106
+ }));
1107
+ },
1079
1108
  offers: {
1080
1109
  /** Offers available to this participant, including stock and per-member availability. */
1081
1110
  list: (requestOptions) => request("/v1/offers", z2.array(offerSchema), {
@@ -1144,7 +1173,7 @@ function relayClient(options) {
1144
1173
  })
1145
1174
  },
1146
1175
  leaderboards: {
1147
- list: (requestOptions) => request("/v1/leaderboards", z2.array(leaderboardDefinitionSchema), {
1176
+ list: (requestOptions) => request("/v1/leaderboards", z2.array(leaderboardDefinitionResponseSchema), {
1148
1177
  options: requestOptions
1149
1178
  }),
1150
1179
  standings: async (board, query = {}, requestOptions) => request(
@@ -12,9 +12,10 @@ import {
12
12
  pointsRewardSchema,
13
13
  refuseWindowTimeZone,
14
14
  resourceHandle,
15
+ responseShape,
15
16
  rewardKey,
16
17
  tierRewardSchema
17
- } from "./chunk-KGJSKGKI.js";
18
+ } from "./chunk-5WK4EB5I.js";
18
19
 
19
20
  // src/errors.ts
20
21
  import { z } from "zod";
@@ -577,6 +578,9 @@ var validateSettlementWindow = (definition, context) => {
577
578
  }
578
579
  };
579
580
  var leaderboardDefinitionSchema = leaderboardDefinitionObject.superRefine(validateSettlementWindow);
581
+ var leaderboardDefinitionResponseSchema = responseShape(
582
+ leaderboardDefinitionSchema
583
+ );
580
584
  var leaderboardAuthoringSchema = leaderboardDefinitionObject.omit({ id: true }).extend({
581
585
  ...authoringIdentityShape,
582
586
  score: z5.preprocess(refuseWindowTimeZone, scoreSchema),
@@ -589,7 +593,7 @@ var leaderboardArtifactSchema = z5.union([
589
593
  var publishedLeaderboardSchema = z5.object({
590
594
  archivedAt: z5.number().int().nonnegative().nullable().optional(),
591
595
  version: identifier,
592
- definition: leaderboardDefinitionSchema,
596
+ definition: leaderboardDefinitionResponseSchema,
593
597
  publishedAt: timestamp,
594
598
  actor: z5.string().nullable()
595
599
  });
@@ -943,18 +947,22 @@ var offerArtifactSchema = z7.union([
943
947
  offerAuthoringSchema,
944
948
  z7.object({ code: z7.string().min(1).max(2e6) }).strict()
945
949
  ]);
946
- var offerAvailabilitySchema = z7.discriminatedUnion("kind", [
947
- z7.object({ kind: z7.literal("available"), remaining: quantity }).strict(),
948
- z7.object({ kind: z7.literal("out-of-stock") }).strict(),
949
- z7.object({ kind: z7.literal("limit-reached") }).strict(),
950
- z7.object({ kind: z7.literal("paused") }).strict()
951
- ]);
952
- var offerSchema = offerDefinitionSchema.extend({
953
- revision: z7.number().int().positive(),
954
- available: quantity,
955
- redeemed: quantity,
956
- availability: offerAvailabilitySchema
957
- });
950
+ var offerAvailabilitySchema = responseShape(
951
+ z7.discriminatedUnion("kind", [
952
+ z7.object({ kind: z7.literal("available"), remaining: quantity }).strict(),
953
+ z7.object({ kind: z7.literal("out-of-stock") }).strict(),
954
+ z7.object({ kind: z7.literal("limit-reached") }).strict(),
955
+ z7.object({ kind: z7.literal("paused") }).strict()
956
+ ])
957
+ );
958
+ var offerSchema = responseShape(
959
+ offerDefinitionSchema.extend({
960
+ revision: z7.number().int().positive(),
961
+ available: quantity,
962
+ redeemed: quantity,
963
+ availability: offerAvailabilitySchema
964
+ })
965
+ );
958
966
  var redeemOfferSchema = z7.object({ actionId: identifier }).strict();
959
967
  var redemptionBase = {
960
968
  id: identifier,
@@ -972,15 +980,17 @@ var redemptionBase = {
972
980
  revision: z7.number().int().positive(),
973
981
  redeemedAt: z7.number().int().safe().nonnegative()
974
982
  };
975
- var redemptionSchema = z7.discriminatedUnion("status", [
976
- z7.object({ ...redemptionBase, status: z7.literal("fulfilled") }).strict(),
977
- z7.object({
978
- ...redemptionBase,
979
- status: z7.literal("canceled"),
980
- canceledAt: z7.number().int().safe().nonnegative(),
981
- reason: z7.string().min(1).max(500)
982
- }).strict()
983
- ]);
983
+ var redemptionSchema = responseShape(
984
+ z7.discriminatedUnion("status", [
985
+ z7.object({ ...redemptionBase, status: z7.literal("fulfilled") }).strict(),
986
+ z7.object({
987
+ ...redemptionBase,
988
+ status: z7.literal("canceled"),
989
+ canceledAt: z7.number().int().safe().nonnegative(),
990
+ reason: z7.string().min(1).max(500)
991
+ }).strict()
992
+ ])
993
+ );
984
994
  var offerControlSchema = z7.object({
985
995
  actionId: identifier,
986
996
  revision: z7.number().int().positive(),
@@ -1130,20 +1140,24 @@ var evmChainIdSchema = z8.custom(
1130
1140
  'Use an EVM chain ID such as "eip155:8453"'
1131
1141
  );
1132
1142
  var units = z8.string().regex(/^(0|[1-9][0-9]*)$/);
1133
- var walletBalanceSchema = z8.object({
1134
- /** Canonical CAIP-2 ID for Solana, EVM or a supported Cosmos SDK chain. */
1135
- chain: z8.string(),
1136
- /** The canonical mint, EIP-55 contract or Cosmos bank denom; null for a native coin. */
1137
- token: z8.string().nullable(),
1138
- /** Null when token metadata does not report decimals. */
1139
- decimals: z8.number().int().min(0).max(255).nullable(),
1140
- /** The sum over `wallets`. */
1141
- total: units,
1142
- wallets: z8.array(z8.object({ address: z8.string(), amount: units }).strict()),
1143
- /** Solana: lowest slot. EVM: approximate latest block. Cosmos: the fixed queried block. */
1144
- at: z8.object({ kind: z8.enum(["slot", "block"]), number: units }).strict(),
1145
- observedAt: z8.number().int().nonnegative()
1146
- }).strict();
1143
+ var walletBalanceSchema = responseShape(
1144
+ z8.object({
1145
+ /** Canonical CAIP-2 ID for Solana, EVM or a supported Cosmos SDK chain. */
1146
+ chain: z8.string(),
1147
+ /** The canonical mint, EIP-55 contract or Cosmos bank denom; null for a native coin. */
1148
+ token: z8.string().nullable(),
1149
+ /** Null when token metadata does not report decimals. */
1150
+ decimals: z8.number().int().min(0).max(255).nullable(),
1151
+ /** The sum over `wallets`. */
1152
+ total: units,
1153
+ wallets: z8.array(
1154
+ z8.object({ address: z8.string(), amount: units }).strict()
1155
+ ),
1156
+ /** Solana: lowest slot. EVM: approximate latest block. Cosmos: the fixed queried block. */
1157
+ at: z8.object({ kind: z8.enum(["slot", "block"]), number: units }).strict(),
1158
+ observedAt: z8.number().int().nonnegative()
1159
+ }).strict()
1160
+ );
1147
1161
 
1148
1162
  export {
1149
1163
  RelayErrorCode,
@@ -1208,6 +1222,7 @@ export {
1208
1222
  leaderboardPrizeSchema,
1209
1223
  leaderboardSettlementPolicySchema,
1210
1224
  leaderboardDefinitionSchema,
1225
+ leaderboardDefinitionResponseSchema,
1211
1226
  leaderboardAuthoringSchema,
1212
1227
  leaderboardArtifactSchema,
1213
1228
  publishedLeaderboardSchema,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pointLedgerReferenceSchema
3
- } from "./chunk-2V74CHDL.js";
3
+ } from "./chunk-MJMFGTVV.js";
4
4
  import {
5
5
  authoringIdentityShape,
6
6
  entitlementSchema,
@@ -11,12 +11,13 @@ import {
11
11
  pickupSelectionSchema,
12
12
  prerequisiteSchema,
13
13
  publishedReleaseSchema,
14
+ responseShape,
14
15
  reviewModeSchema,
15
16
  settingsValuesSchema,
16
17
  storedQuestDescriptionSchema,
17
18
  storedReviewModeSchema,
18
19
  tieredRewardReferenceSchema
19
- } from "./chunk-KGJSKGKI.js";
20
+ } from "./chunk-5WK4EB5I.js";
20
21
 
21
22
  // src/participant-activity.ts
22
23
  import { z } from "zod";
@@ -154,22 +155,26 @@ var draftBase = z2.object({
154
155
  baseRevision: z2.number().int().nonnegative(),
155
156
  changes: questDraftChangesSchema
156
157
  });
157
- var questDraftSchema = z2.discriminatedUnion("status", [
158
- draftBase.extend({ status: z2.literal("draft") }),
159
- draftBase.extend({
160
- status: z2.literal("published"),
161
- releaseIds: z2.array(identifier)
158
+ var questDraftSchema = responseShape(
159
+ z2.discriminatedUnion("status", [
160
+ draftBase.extend({ status: z2.literal("draft") }),
161
+ draftBase.extend({
162
+ status: z2.literal("published"),
163
+ releaseIds: z2.array(identifier)
164
+ })
165
+ ])
166
+ );
167
+ var questCatalogSchema = responseShape(
168
+ z2.object({
169
+ revision: z2.number().int().nonnegative(),
170
+ types: z2.array(questTypeVersionSchema),
171
+ collections: z2.array(questCollectionSchema),
172
+ quests: z2.array(questInstanceSchema),
173
+ drafts: z2.array(questDraftSchema),
174
+ releases: z2.array(publishedReleaseSchema).default([]),
175
+ supportedInteractions: z2.array(interactionSchema)
162
176
  })
163
- ]);
164
- var questCatalogSchema = z2.object({
165
- revision: z2.number().int().nonnegative(),
166
- types: z2.array(questTypeVersionSchema),
167
- collections: z2.array(questCollectionSchema),
168
- quests: z2.array(questInstanceSchema),
169
- drafts: z2.array(questDraftSchema),
170
- releases: z2.array(publishedReleaseSchema).default([]),
171
- supportedInteractions: z2.array(interactionSchema)
172
- });
177
+ );
173
178
  var catalogDeploymentSchema = z2.object({
174
179
  expectedRevision: z2.number().int().nonnegative(),
175
180
  types: z2.array(
@@ -181,12 +186,14 @@ var catalogDeploymentSchema = z2.object({
181
186
  collections: z2.array(collectionSlotDeclarationSchema).max(50).default([]),
182
187
  supportedInteractions: z2.array(interactionSchema).min(1).optional()
183
188
  }).strict();
184
- var catalogDeploymentPreviewSchema = z2.object({
185
- revision: z2.number().int().nonnegative(),
186
- types: z2.array(questTypeVersionSchema),
187
- collections: z2.array(collectionSlotSchema),
188
- supportedInteractions: z2.array(interactionSchema)
189
- });
189
+ var catalogDeploymentPreviewSchema = responseShape(
190
+ z2.object({
191
+ revision: z2.number().int().nonnegative(),
192
+ types: z2.array(questTypeVersionSchema),
193
+ collections: z2.array(collectionSlotSchema),
194
+ supportedInteractions: z2.array(interactionSchema)
195
+ })
196
+ );
190
197
  var saveQuestDraftSchema = z2.object({
191
198
  id: identifier.optional(),
192
199
  actionId: identifier,
@@ -210,13 +217,13 @@ var questRewardViewSchema = z2.discriminatedUnion("kind", [
210
217
  }),
211
218
  z2.object({ kind: z2.literal("integration"), label: z2.string() })
212
219
  ]);
213
- var questViewSchema = memberProgressSchema.shape.quests.element.extend(
214
- {
220
+ var questViewSchema = responseShape(
221
+ memberProgressSchema.shape.quests.element.extend({
215
222
  release: identifier,
216
223
  interaction: interactionSchema,
217
224
  lifecycle: z2.enum(["active", "paused", "archived"]),
218
225
  rewards: z2.array(questRewardViewSchema)
219
- }
226
+ })
220
227
  );
221
228
  var collectionViewSchema = z2.object({
222
229
  key: identifier.optional(),
@@ -224,17 +231,21 @@ var collectionViewSchema = z2.object({
224
231
  title: z2.string(),
225
232
  quests: z2.array(questViewSchema)
226
233
  });
227
- var questExperienceSchema = z2.object({
228
- entitlements: z2.array(entitlementSchema).default([]),
229
- member: identifier,
230
- quests: z2.array(questViewSchema),
231
- collections: z2.array(collectionViewSchema)
232
- });
233
- var questPublicationPreviewSchema = z2.object({
234
- draft: questDraftSchema,
235
- releases: z2.array(publishedReleaseSchema),
236
- affectedCollections: z2.array(questCollectionSchema)
237
- });
234
+ var questExperienceSchema = responseShape(
235
+ z2.object({
236
+ entitlements: z2.array(entitlementSchema).default([]),
237
+ member: identifier,
238
+ quests: z2.array(questViewSchema),
239
+ collections: z2.array(collectionViewSchema)
240
+ })
241
+ );
242
+ var questPublicationPreviewSchema = responseShape(
243
+ z2.object({
244
+ draft: questDraftSchema,
245
+ releases: z2.array(publishedReleaseSchema),
246
+ affectedCollections: z2.array(questCollectionSchema)
247
+ })
248
+ );
238
249
  var allocateQuestSchema = z2.object({ actionId: identifier }).strict();
239
250
  var allocatedQuestSchema = z2.object({ id: identifier });
240
251
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  RelayErrorCode,
3
3
  clientError
4
- } from "./chunk-2V74CHDL.js";
4
+ } from "./chunk-MJMFGTVV.js";
5
5
  import {
6
6
  isRequestError
7
7
  } from "./chunk-NPGENI7K.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  identifier
3
- } from "./chunk-KGJSKGKI.js";
3
+ } from "./chunk-5WK4EB5I.js";
4
4
 
5
5
  // src/auth.ts
6
6
  import { z } from "zod";
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  identifier,
3
+ responseShape,
3
4
  xTweetSchema
4
- } from "./chunk-KGJSKGKI.js";
5
+ } from "./chunk-5WK4EB5I.js";
5
6
 
6
7
  // src/x.ts
7
8
  import { z } from "zod";
@@ -85,33 +86,41 @@ var imageRequestSchema = z2.discriminatedUnion("operation", [
85
86
  })
86
87
  ]);
87
88
  var hash = z2.string().regex(/^[0-9a-f]{16}$/);
88
- var imageInspectionSchema = z2.strictObject({
89
- width: z2.number().int().positive(),
90
- height: z2.number().int().positive(),
91
- format: z2.enum(["jpeg", "png", "webp", "gif", "avif"]),
92
- bytes: z2.number().int().positive(),
93
- sha256: z2.string().regex(/^[0-9a-f]{64}$/),
94
- phash: hash,
95
- dhash: hash
96
- });
89
+ var imageInspectionSchema = responseShape(
90
+ z2.strictObject({
91
+ width: z2.number().int().positive(),
92
+ height: z2.number().int().positive(),
93
+ format: z2.enum(["jpeg", "png", "webp", "gif", "avif"]),
94
+ bytes: z2.number().int().positive(),
95
+ sha256: z2.string().regex(/^[0-9a-f]{64}$/),
96
+ phash: hash,
97
+ dhash: hash
98
+ })
99
+ );
97
100
  var distance = z2.number().int().min(0).max(64);
98
- var imageComparisonSchema = z2.strictObject({
99
- identical: z2.boolean(),
100
- phashDistance: distance,
101
- dhashDistance: distance
102
- });
103
- var imageExtractionSchema = z2.strictObject({
104
- values: z2.record(
105
- z2.string(),
106
- z2.union([z2.string().max(2e3), z2.number(), z2.boolean(), z2.null()])
107
- ),
108
- reason: z2.string().min(1).max(2e3)
109
- });
110
- var imageSightingsSchema = z2.strictObject({
111
- matches: z2.number().int().nonnegative(),
112
- closestDistance: distance.nullable(),
113
- firstSeenAt: z2.number().int().nonnegative().nullable()
114
- });
101
+ var imageComparisonSchema = responseShape(
102
+ z2.strictObject({
103
+ identical: z2.boolean(),
104
+ phashDistance: distance,
105
+ dhashDistance: distance
106
+ })
107
+ );
108
+ var imageExtractionSchema = responseShape(
109
+ z2.strictObject({
110
+ values: z2.record(
111
+ z2.string(),
112
+ z2.union([z2.string().max(2e3), z2.number(), z2.boolean(), z2.null()])
113
+ ),
114
+ reason: z2.string().min(1).max(2e3)
115
+ })
116
+ );
117
+ var imageSightingsSchema = responseShape(
118
+ z2.strictObject({
119
+ matches: z2.number().int().nonnegative(),
120
+ closestDistance: distance.nullable(),
121
+ firstSeenAt: z2.number().int().nonnegative().nullable()
122
+ })
123
+ );
115
124
  var sha256 = z2.string().regex(/^[0-9a-f]{64}$/);
116
125
  var imageSize = z2.number().int().positive().max(5 * 1024 * 1024);
117
126
  var imageAssetArtifactSchema = z2.strictObject({
@@ -129,26 +138,30 @@ var imageUploadRequestSchema = z2.strictObject({
129
138
  })
130
139
  ).min(1).max(10)
131
140
  });
132
- var imageUploadsSchema = z2.strictObject({
133
- images: z2.array(
134
- z2.strictObject({
135
- sha256,
136
- upload: z2.strictObject({
137
- url: z2.string().url(),
138
- headers: z2.record(z2.string(), z2.string()),
139
- expiresAt: z2.number().int().positive()
140
- }).nullable()
141
- })
142
- )
143
- });
144
- var publishedImageSchema = z2.strictObject({
145
- key: identifier,
146
- sha256,
147
- type: z2.enum(["image/jpeg", "image/png", "image/webp"]),
148
- size: imageSize,
149
- width: z2.number().int().positive(),
150
- height: z2.number().int().positive()
151
- });
141
+ var imageUploadsSchema = responseShape(
142
+ z2.strictObject({
143
+ images: z2.array(
144
+ z2.strictObject({
145
+ sha256,
146
+ upload: z2.strictObject({
147
+ url: z2.string().url(),
148
+ headers: z2.record(z2.string(), z2.string()),
149
+ expiresAt: z2.number().int().positive()
150
+ }).nullable()
151
+ })
152
+ )
153
+ })
154
+ );
155
+ var publishedImageSchema = responseShape(
156
+ z2.strictObject({
157
+ key: identifier,
158
+ sha256,
159
+ type: z2.enum(["image/jpeg", "image/png", "image/webp"]),
160
+ size: imageSize,
161
+ width: z2.number().int().positive(),
162
+ height: z2.number().int().positive()
163
+ })
164
+ );
152
165
 
153
166
  export {
154
167
  xIdSchema,
@@ -5,7 +5,7 @@ import {
5
5
  isKnownTrackerSource,
6
6
  trackerDataSchema,
7
7
  xAccountRoles
8
- } from "./chunk-KGJSKGKI.js";
8
+ } from "./chunk-5WK4EB5I.js";
9
9
 
10
10
  // src/quest-shape.ts
11
11
  function validateQuestShape(description, options = {}) {