@domino-sdk/relay 1.5.2 → 1.7.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 (44) hide show
  1. package/dist/{activity-DeKJsRry.d.ts → activity-Br6vyYze.d.ts} +147 -116
  2. package/dist/authoring.d.ts +59 -47
  3. package/dist/authoring.js +3 -3
  4. package/dist/{automatic-outcomes-B1xrETxm.d.ts → automatic-outcomes-C1Q9LrDb.d.ts} +224 -13
  5. package/dist/browser.d.ts +22 -10
  6. package/dist/browser.js +6 -6
  7. package/dist/{capability-error-DNMwKmlL.d.ts → capability-error-Bv996M-h.d.ts} +2 -0
  8. package/dist/{chunk-GQKYAQM6.js → chunk-23QJ7WH4.js} +1 -1
  9. package/dist/{chunk-WJSSJ7AF.js → chunk-5ECM6AWV.js} +24 -4
  10. package/dist/{chunk-XFMSUPNS.js → chunk-6ON4RMEN.js} +1 -1
  11. package/dist/{chunk-VFHHLN6A.js → chunk-6RBF3UDA.js} +49 -6
  12. package/dist/chunk-AXRMT33W.js +112 -0
  13. package/dist/{chunk-24AFCBZN.js → chunk-BFZHJA2B.js} +2 -2
  14. package/dist/{chunk-EYH5RDIE.js → chunk-C25TDFHN.js} +4 -2
  15. package/dist/{chunk-36HTX2BM.js → chunk-GMPPLZKH.js} +61 -4
  16. package/dist/{chunk-BGGKNIRP.js → chunk-JW4G3SY5.js} +1 -1
  17. package/dist/{chunk-JON5SESL.js → chunk-KGJSKGKI.js} +84 -6
  18. package/dist/{chunk-DGWMLN35.js → chunk-ZOUEEK5L.js} +16 -5
  19. package/dist/{client-gqnRUHpC.d.ts → client-pfml_XAa.d.ts} +88 -41
  20. package/dist/{groups-Ck-OxzjD.d.ts → groups-BpWEqaPn.d.ts} +175 -3
  21. package/dist/{images-Dv-P5VBw.d.ts → images-BaKYd0fl.d.ts} +1 -1
  22. package/dist/index.d.ts +9 -9
  23. package/dist/index.js +5 -5
  24. package/dist/internal.d.ts +6 -113
  25. package/dist/internal.js +18 -24
  26. package/dist/{offers-Cy-e4o5x.d.ts → offers-CYtal8jO.d.ts} +3 -2
  27. package/dist/{outcomes-kVB-Juzs.d.ts → pages-CixTNnF4.d.ts} +142 -99
  28. package/dist/{pages-BBYD21IE.d.ts → participant-activity-DkL3nY5a.d.ts} +1 -14
  29. package/dist/portal-proxy.js +48 -36
  30. package/dist/react/index.d.ts +25 -3949
  31. package/dist/react/index.js +8 -7
  32. package/dist/referral-reward-kinds-ClxAuCGx.d.ts +171 -0
  33. package/dist/{request-error-DWduJCGV.d.ts → request-error-D_dUPLwo.d.ts} +5 -0
  34. package/dist/{schema-DfJzH2ci.d.ts → schema-CQydLqw4.d.ts} +122 -37
  35. package/dist/schema.d.ts +10 -10
  36. package/dist/schema.js +48 -6
  37. package/dist/server/index.d.ts +9673 -66110
  38. package/dist/server/index.js +1048 -550
  39. package/dist/sign-in-options-CtXUFV7E.d.ts +202 -0
  40. package/dist/{submission-input-BZkm6ohU.d.ts → submission-input-CLefHTrj.d.ts} +2 -2
  41. package/package.json +1 -1
  42. package/dist/browser-D_3s8B5e.d.ts +0 -4154
  43. package/dist/chunk-GUP7YRR4.js +0 -42
  44. package/dist/identity-integration-GxAHdKR2.d.ts +0 -58
@@ -1,102 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { a as AttemptStatus, bk as questDescriptionSchema, h as TrackerSkipCode } from './schema-DfJzH2ci.js';
3
-
4
- declare const contentQualificationDecisionSchema: z.ZodObject<{
5
- kind: z.ZodEnum<{
6
- accept: "accept";
7
- reject: "reject";
8
- review: "review";
9
- defer: "defer";
10
- progress: "progress";
11
- superseded: "superseded";
12
- }>;
13
- reason: z.ZodNullable<z.ZodString>;
14
- }, z.core.$strict>;
15
- declare const contentQualificationQuerySchema: z.ZodObject<{
16
- quest: z.ZodString;
17
- member: z.ZodOptional<z.ZodString>;
18
- /** A content item's record ID in the quest's tracker. */
19
- content: z.ZodOptional<z.ZodString>;
20
- cursor: z.ZodOptional<z.ZodString>;
21
- }, z.core.$strict>;
22
- declare const contentQualificationSchema: z.ZodObject<{
23
- quest: z.ZodString;
24
- /** The content item's record ID in the quest's tracker. */
25
- content: z.ZodString;
26
- member: z.ZodString;
27
- release: z.ZodString;
28
- attempt: z.ZodString;
29
- revision: z.ZodString;
30
- observation: z.ZodString;
31
- current: z.ZodBoolean;
32
- state: z.ZodEnum<{
33
- pending: "pending";
34
- superseded: "superseded";
35
- qualified: "qualified";
36
- unqualified: "unqualified";
37
- "needs-review": "needs-review";
38
- failed: "failed";
39
- stale: "stale";
40
- blocked: "blocked";
41
- unavailable: "unavailable";
42
- }>;
43
- reason: z.ZodNullable<z.ZodString>;
44
- reward: z.ZodObject<{
45
- attempt: z.ZodNullable<z.ZodString>;
46
- completion: z.ZodNullable<z.ZodString>;
47
- state: z.ZodEnum<{
48
- excluded: "excluded";
49
- unresolved: "unresolved";
50
- awarded: "awarded";
51
- }>;
52
- }, z.core.$strict>;
53
- }, z.core.$strict>;
54
- declare const contentQualificationPageSchema: z.ZodObject<{
55
- items: z.ZodArray<z.ZodObject<{
56
- quest: z.ZodString;
57
- /** The content item's record ID in the quest's tracker. */
58
- content: z.ZodString;
59
- member: z.ZodString;
60
- release: z.ZodString;
61
- attempt: z.ZodString;
62
- revision: z.ZodString;
63
- observation: z.ZodString;
64
- current: z.ZodBoolean;
65
- state: z.ZodEnum<{
66
- pending: "pending";
67
- superseded: "superseded";
68
- qualified: "qualified";
69
- unqualified: "unqualified";
70
- "needs-review": "needs-review";
71
- failed: "failed";
72
- stale: "stale";
73
- blocked: "blocked";
74
- unavailable: "unavailable";
75
- }>;
76
- reason: z.ZodNullable<z.ZodString>;
77
- reward: z.ZodObject<{
78
- attempt: z.ZodNullable<z.ZodString>;
79
- completion: z.ZodNullable<z.ZodString>;
80
- state: z.ZodEnum<{
81
- excluded: "excluded";
82
- unresolved: "unresolved";
83
- awarded: "awarded";
84
- }>;
85
- }, z.core.$strict>;
86
- }, z.core.$strict>>;
87
- nextCursor: z.ZodNullable<z.ZodString>;
88
- }, z.core.$strict>;
89
- /** A content metric's name, as its source declares it, such as `likes`. */
90
- declare const contentMetricSchema: z.ZodString;
91
- type ContentMetric = z.infer<typeof contentMetricSchema>;
92
- /** Measured counters by metric name. A metric a sample leaves out is unknown, never zero. */
93
- declare const contentMetricsSchema: z.ZodRecord<z.ZodString, z.ZodNumber>;
94
- /** Which declared metrics a content quest's performance stage reads, and how fresh they must be. */
95
- declare const contentPerformancePolicySchema: z.ZodObject<{
96
- metrics: z.ZodArray<z.ZodString>;
97
- maxAgeMs: z.ZodDefault<z.ZodNumber>;
98
- }, z.core.$strict>;
99
- type ContentPerformancePolicy = z.infer<typeof contentPerformancePolicySchema>;
2
+ import { a as AttemptStatus, by as questDescriptionSchema, h as TrackerSkipCode } from './schema-CQydLqw4.js';
100
3
 
101
4
  /**
102
5
  * The delivery actions this SDK knows. `RewardDelivery.action` is an open string: Relay can add
@@ -293,6 +196,11 @@ declare const interactionSchema: z.ZodEnum<{
293
196
  photo: "photo";
294
197
  }>;
295
198
  type QuestInteraction = z.infer<typeof interactionSchema>;
199
+ /**
200
+ * The control a participant app must render for a quest's trigger, checked against the app's
201
+ * `supportedInteractions`. Staff-entered (`staff`) and automatic (`automatic`) quests need no member
202
+ * control, so a staff quest's input and an automatic quest's tracker do not change the result.
203
+ */
296
204
  declare function questInteraction(trigger: z.infer<typeof questDescriptionSchema>["trigger"]): QuestInteraction;
297
205
  declare const questTypeVersionSchema: z.ZodObject<{
298
206
  archivedAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -2406,6 +2314,10 @@ declare const questViewSchema: z.ZodObject<{
2406
2314
  "wallet-required": "wallet-required";
2407
2315
  "enrollment-required": "enrollment-required";
2408
2316
  }>;
2317
+ window: z.ZodOptional<z.ZodEnum<{
2318
+ quest: "quest";
2319
+ tracker: "tracker";
2320
+ }>>;
2409
2321
  resetsAt: z.ZodOptional<z.ZodNumber>;
2410
2322
  }, z.core.$strip> | z.ZodObject<{
2411
2323
  kind: z.ZodLiteral<"staff-required">;
@@ -2877,6 +2789,10 @@ declare const collectionViewSchema: z.ZodObject<{
2877
2789
  "wallet-required": "wallet-required";
2878
2790
  "enrollment-required": "enrollment-required";
2879
2791
  }>;
2792
+ window: z.ZodOptional<z.ZodEnum<{
2793
+ quest: "quest";
2794
+ tracker: "tracker";
2795
+ }>>;
2880
2796
  resetsAt: z.ZodOptional<z.ZodNumber>;
2881
2797
  }, z.core.$strip> | z.ZodObject<{
2882
2798
  kind: z.ZodLiteral<"staff-required">;
@@ -3525,6 +3441,10 @@ declare const questExperienceSchema: z.ZodObject<{
3525
3441
  "wallet-required": "wallet-required";
3526
3442
  "enrollment-required": "enrollment-required";
3527
3443
  }>;
3444
+ window: z.ZodOptional<z.ZodEnum<{
3445
+ quest: "quest";
3446
+ tracker: "tracker";
3447
+ }>>;
3528
3448
  resetsAt: z.ZodOptional<z.ZodNumber>;
3529
3449
  }, z.core.$strip> | z.ZodObject<{
3530
3450
  kind: z.ZodLiteral<"staff-required">;
@@ -3996,6 +3916,10 @@ declare const questExperienceSchema: z.ZodObject<{
3996
3916
  "wallet-required": "wallet-required";
3997
3917
  "enrollment-required": "enrollment-required";
3998
3918
  }>;
3919
+ window: z.ZodOptional<z.ZodEnum<{
3920
+ quest: "quest";
3921
+ tracker: "tracker";
3922
+ }>>;
3999
3923
  resetsAt: z.ZodOptional<z.ZodNumber>;
4000
3924
  }, z.core.$strip> | z.ZodObject<{
4001
3925
  kind: z.ZodLiteral<"staff-required">;
@@ -4288,6 +4212,7 @@ declare const questExperienceSchema: z.ZodObject<{
4288
4212
  }, z.core.$strip>>;
4289
4213
  }, z.core.$strip>>;
4290
4214
  }, z.core.$strip>;
4215
+ /** @compat output */
4291
4216
  type QuestView = z.infer<typeof questViewSchema>;
4292
4217
  type QuestRewardView = z.infer<typeof questRewardViewSchema>;
4293
4218
  type QuestCatalog = z.infer<typeof questCatalogSchema>;
@@ -4794,6 +4719,103 @@ declare const allocatedQuestSchema: z.ZodObject<{
4794
4719
  id: z.ZodString;
4795
4720
  }, z.core.$strip>;
4796
4721
 
4722
+ declare const contentQualificationDecisionSchema: z.ZodObject<{
4723
+ kind: z.ZodEnum<{
4724
+ accept: "accept";
4725
+ reject: "reject";
4726
+ review: "review";
4727
+ defer: "defer";
4728
+ progress: "progress";
4729
+ superseded: "superseded";
4730
+ }>;
4731
+ reason: z.ZodNullable<z.ZodString>;
4732
+ }, z.core.$strict>;
4733
+ declare const contentQualificationQuerySchema: z.ZodObject<{
4734
+ quest: z.ZodString;
4735
+ member: z.ZodOptional<z.ZodString>;
4736
+ /** A content item's record ID in the quest's tracker. */
4737
+ content: z.ZodOptional<z.ZodString>;
4738
+ cursor: z.ZodOptional<z.ZodString>;
4739
+ }, z.core.$strict>;
4740
+ declare const contentQualificationSchema: z.ZodObject<{
4741
+ quest: z.ZodString;
4742
+ /** The content item's record ID in the quest's tracker. */
4743
+ content: z.ZodString;
4744
+ member: z.ZodString;
4745
+ release: z.ZodString;
4746
+ attempt: z.ZodString;
4747
+ revision: z.ZodString;
4748
+ observation: z.ZodString;
4749
+ current: z.ZodBoolean;
4750
+ state: z.ZodEnum<{
4751
+ pending: "pending";
4752
+ superseded: "superseded";
4753
+ qualified: "qualified";
4754
+ unqualified: "unqualified";
4755
+ "needs-review": "needs-review";
4756
+ failed: "failed";
4757
+ stale: "stale";
4758
+ blocked: "blocked";
4759
+ unavailable: "unavailable";
4760
+ }>;
4761
+ reason: z.ZodNullable<z.ZodString>;
4762
+ reward: z.ZodObject<{
4763
+ attempt: z.ZodNullable<z.ZodString>;
4764
+ completion: z.ZodNullable<z.ZodString>;
4765
+ state: z.ZodEnum<{
4766
+ excluded: "excluded";
4767
+ unresolved: "unresolved";
4768
+ awarded: "awarded";
4769
+ }>;
4770
+ }, z.core.$strict>;
4771
+ }, z.core.$strict>;
4772
+ declare const contentQualificationPageSchema: z.ZodObject<{
4773
+ items: z.ZodArray<z.ZodObject<{
4774
+ quest: z.ZodString;
4775
+ /** The content item's record ID in the quest's tracker. */
4776
+ content: z.ZodString;
4777
+ member: z.ZodString;
4778
+ release: z.ZodString;
4779
+ attempt: z.ZodString;
4780
+ revision: z.ZodString;
4781
+ observation: z.ZodString;
4782
+ current: z.ZodBoolean;
4783
+ state: z.ZodEnum<{
4784
+ pending: "pending";
4785
+ superseded: "superseded";
4786
+ qualified: "qualified";
4787
+ unqualified: "unqualified";
4788
+ "needs-review": "needs-review";
4789
+ failed: "failed";
4790
+ stale: "stale";
4791
+ blocked: "blocked";
4792
+ unavailable: "unavailable";
4793
+ }>;
4794
+ reason: z.ZodNullable<z.ZodString>;
4795
+ reward: z.ZodObject<{
4796
+ attempt: z.ZodNullable<z.ZodString>;
4797
+ completion: z.ZodNullable<z.ZodString>;
4798
+ state: z.ZodEnum<{
4799
+ excluded: "excluded";
4800
+ unresolved: "unresolved";
4801
+ awarded: "awarded";
4802
+ }>;
4803
+ }, z.core.$strict>;
4804
+ }, z.core.$strict>>;
4805
+ nextCursor: z.ZodNullable<z.ZodString>;
4806
+ }, z.core.$strict>;
4807
+ /** A content metric's name, as its source declares it, such as `likes`. */
4808
+ declare const contentMetricSchema: z.ZodString;
4809
+ type ContentMetric = z.infer<typeof contentMetricSchema>;
4810
+ /** Measured counters by metric name. A metric a sample leaves out is unknown, never zero. */
4811
+ declare const contentMetricsSchema: z.ZodRecord<z.ZodString, z.ZodNumber>;
4812
+ /** Which declared metrics a content quest's performance stage reads, and how fresh they must be. */
4813
+ declare const contentPerformancePolicySchema: z.ZodObject<{
4814
+ metrics: z.ZodArray<z.ZodString>;
4815
+ maxAgeMs: z.ZodDefault<z.ZodNumber>;
4816
+ }, z.core.$strict>;
4817
+ type ContentPerformancePolicy = z.infer<typeof contentPerformancePolicySchema>;
4818
+
4797
4819
  /** `relay.quests.enroll()`: the signed-in member enrolls in a quest that requires enrollment. */
4798
4820
  declare const questEnrollmentInputSchema: z.ZodObject<{
4799
4821
  actionId: z.ZodString;
@@ -4858,6 +4880,10 @@ declare const questOutcomeSchema: z.ZodObject<{
4858
4880
  }>;
4859
4881
  code: z.ZodType<TrackerSkipCode | null>;
4860
4882
  reason: z.ZodNullable<z.ZodString>;
4883
+ window: z.ZodOptional<z.ZodEnum<{
4884
+ quest: "quest";
4885
+ tracker: "tracker";
4886
+ }>>;
4861
4887
  attempt: z.ZodNullable<z.ZodString>;
4862
4888
  claimable: z.ZodBoolean;
4863
4889
  createdAt: z.ZodNumber;
@@ -4890,6 +4916,10 @@ declare const questOutcomePageSchema: z.ZodObject<{
4890
4916
  }>;
4891
4917
  code: z.ZodType<TrackerSkipCode | null>;
4892
4918
  reason: z.ZodNullable<z.ZodString>;
4919
+ window: z.ZodOptional<z.ZodEnum<{
4920
+ quest: "quest";
4921
+ tracker: "tracker";
4922
+ }>>;
4893
4923
  attempt: z.ZodNullable<z.ZodString>;
4894
4924
  claimable: z.ZodBoolean;
4895
4925
  createdAt: z.ZodNumber;
@@ -4899,4 +4929,17 @@ declare const questOutcomePageSchema: z.ZodObject<{
4899
4929
  }, z.core.$strip>;
4900
4930
  type QuestOutcomePage = z.infer<typeof questOutcomePageSchema>;
4901
4931
 
4902
- export { rewardDeliveriesSchema as $, contentQualificationQuerySchema as A, contentQualificationSchema as B, type ContentMetric as C, interactionSchema as D, knownRewardDeliverySchema as E, memberEnrollmentInputSchema as F, publishQuestDraftSchema as G, questCatalogSchema as H, questClaimInputSchema as I, questCollectionSchema as J, questDraftChangesSchema as K, questDraftSchema as L, type MemberEnrollmentInput as M, questEnrollmentInputSchema as N, questEnrollmentSchema as O, questExperienceSchema as P, type QuestClaimInput as Q, type RewardDelivery as R, questInstanceSchema as S, questInteraction as T, questOutcomePageSchema as U, questOutcomeQuerySchema as V, questOutcomeSchema as W, questPublicationPreviewSchema as X, questRewardViewSchema as Y, questTypeVersionSchema as Z, questViewSchema as _, type QuestEnrollment as a, rewardDeliverySchema as a0, roleReconciliationSchema as a1, saveQuestDraftSchema as a2, type QuestEnrollmentInput as b, type QuestInteraction as c, type QuestOutcome as d, type QuestOutcomePage as e, type QuestOutcomeQuery as f, QuestOutcomeState as g, type QuestRewardView as h, type QuestView as i, type ContentPerformancePolicy as j, type QuestCatalog as k, type QuestDraft as l, type QuestInstance as m, RewardDeliveryAction as n, allocateQuestSchema as o, allocatedQuestSchema as p, catalogDeploymentPreviewSchema as q, catalogDeploymentSchema as r, collectionSlotDeclarationSchema as s, collectionSlotSchema as t, collectionViewSchema as u, contentMetricSchema as v, contentMetricsSchema as w, contentPerformancePolicySchema as x, contentQualificationDecisionSchema as y, contentQualificationPageSchema as z };
4932
+ /** A cursor as a client passes it back. */
4933
+ declare const pageCursorSchema: z.ZodString;
4934
+ /** A query that pages by cursor only. */
4935
+ declare const pageQuerySchema: z.ZodObject<{
4936
+ cursor: z.ZodOptional<z.ZodString>;
4937
+ }, z.core.$strict>;
4938
+ type PageQuery = z.input<typeof pageQuerySchema>;
4939
+ /** One page of a paged read. */
4940
+ type Page<T> = {
4941
+ items: T[];
4942
+ nextCursor: string | null;
4943
+ };
4944
+
4945
+ export { questPublicationPreviewSchema as $, contentQualificationPageSchema as A, contentQualificationQuerySchema as B, type ContentMetric as C, contentQualificationSchema as D, interactionSchema as E, knownRewardDeliverySchema as F, memberEnrollmentInputSchema as G, pageCursorSchema as H, pageQuerySchema as I, publishQuestDraftSchema as J, questCatalogSchema as K, questClaimInputSchema as L, type MemberEnrollmentInput as M, questCollectionSchema as N, questDraftChangesSchema as O, type Page as P, type QuestClaimInput as Q, type RewardDelivery as R, questDraftSchema as S, questEnrollmentInputSchema as T, questEnrollmentSchema as U, questExperienceSchema as V, questInstanceSchema as W, questInteraction as X, questOutcomePageSchema as Y, questOutcomeQuerySchema as Z, questOutcomeSchema as _, type PageQuery as a, questRewardViewSchema as a0, questTypeVersionSchema as a1, questViewSchema as a2, rewardDeliveriesSchema as a3, rewardDeliverySchema as a4, roleReconciliationSchema as a5, saveQuestDraftSchema as a6, type QuestEnrollment as b, type QuestEnrollmentInput as c, type QuestInteraction as d, type QuestOutcome as e, type QuestOutcomePage as f, type QuestOutcomeQuery as g, QuestOutcomeState as h, type QuestRewardView as i, type QuestView as j, type ContentPerformancePolicy as k, type QuestCatalog as l, type QuestDraft as m, type QuestInstance as n, RewardDeliveryAction as o, allocateQuestSchema as p, allocatedQuestSchema as q, catalogDeploymentPreviewSchema as r, catalogDeploymentSchema as s, collectionSlotDeclarationSchema as t, collectionSlotSchema as u, collectionViewSchema as v, contentMetricSchema as w, contentMetricsSchema as x, contentPerformancePolicySchema as y, contentQualificationDecisionSchema as z };
@@ -343,17 +343,4 @@ declare const participantActivitySchema: z.ZodObject<{
343
343
  type RelayEvent = z.infer<typeof relayEventSchema>;
344
344
  type ParticipantActivity = z.infer<typeof participantActivitySchema>;
345
345
 
346
- /** A cursor as a client passes it back. */
347
- declare const pageCursorSchema: z.ZodString;
348
- /** A query that pages by cursor only. */
349
- declare const pageQuerySchema: z.ZodObject<{
350
- cursor: z.ZodOptional<z.ZodString>;
351
- }, z.core.$strict>;
352
- type PageQuery = z.input<typeof pageQuerySchema>;
353
- /** One page of a paged read. */
354
- type Page<T> = {
355
- items: T[];
356
- nextCursor: string | null;
357
- };
358
-
359
- export { type ExchangeInput as E, type MemberSummary as M, type Page as P, type RelayEvent as R, type Session as S, type PageQuery as a, type ParticipantActivity as b, type ParticipantPrincipal as c, type ParticipantSession as d, authScopeSchema as e, exchangeResultSchema as f, exchangeSchema as g, pageQuerySchema as h, participantActivityQuerySchema as i, participantActivitySchema as j, knownRelayEventSchema as k, participantPrincipalSchema as l, memberSummarySchema as m, participantSessionSchema as n, principalSchema as o, pageCursorSchema as p, sessionSchema as q, relayEventSchema as r, sessionMember as s };
346
+ export { type ExchangeInput as E, type MemberSummary as M, type ParticipantActivity as P, type RelayEvent as R, type Session as S, type ParticipantPrincipal as a, type ParticipantSession as b, authScopeSchema as c, exchangeSchema as d, exchangeResultSchema as e, participantActivitySchema as f, participantPrincipalSchema as g, participantSessionSchema as h, principalSchema as i, sessionSchema as j, knownRelayEventSchema as k, memberSummarySchema as m, participantActivityQuerySchema as p, relayEventSchema as r, sessionMember as s };
@@ -1,36 +1,45 @@
1
1
  import {
2
- isActivityParticipantRoute,
3
- isContentParticipantRoute,
4
- isOfferParticipantRoute,
5
- isPointsParticipantRoute,
6
- isProfileParticipantRoute,
7
- isQuestOutcomeParticipantRoute,
8
- isRewardsParticipantRoute,
9
- isWalletParticipantRoute,
10
- isWalletSignInRoute
11
- } from "./chunk-GUP7YRR4.js";
2
+ isParticipantRoute
3
+ } from "./chunk-AXRMT33W.js";
12
4
  import {
13
5
  exchangeResultSchema
14
- } from "./chunk-XFMSUPNS.js";
15
- import "./chunk-JON5SESL.js";
6
+ } from "./chunk-6ON4RMEN.js";
7
+ import "./chunk-KGJSKGKI.js";
16
8
 
17
9
  // src/portal-proxy.ts
10
+ var statusCode = (status) => ({
11
+ 400: "invalid-request",
12
+ 401: "unauthenticated",
13
+ 403: "forbidden",
14
+ 404: "not-found",
15
+ 405: "method-not-allowed",
16
+ 409: "conflict",
17
+ 410: "gone",
18
+ 413: "payload-too-large",
19
+ 415: "unsupported-media-type",
20
+ 422: "validation-failed",
21
+ 429: "rate-limited",
22
+ 500: "internal-error",
23
+ 502: "upstream-failed",
24
+ 503: "unavailable",
25
+ 504: "upstream-timeout"
26
+ })[status] ?? (status >= 500 ? "internal-error" : "invalid-request");
18
27
  async function proxyParticipant(request, upstream) {
19
28
  const incoming = new URL(request.url);
20
29
  const path = incoming.pathname.slice("/relay".length);
21
- const allowed = incoming.pathname.startsWith("/relay/") && (/^\/v1\/auth\/(providers|accounts(?:\/disconnect)?|start|authorize|complete|session|logout|email\/start|email\/verify|callback\/[a-z][a-z0-9-]*)$/.test(
22
- path
23
- ) || /^\/v1\/me\/(progress|experience|attempts|evidence|collection-pass)$/.test(
24
- path
25
- ) || isWalletParticipantRoute(path) || isWalletSignInRoute(path) || path === "/v1/me" && request.method === "GET" || /^\/v1\/attempts\/[\w-]+\/retry$/.test(path) || /^\/v1\/referrals(?:\/(me|history))?$/.test(path) && request.method === "GET" || isContentParticipantRoute(path, request.method) || isQuestOutcomeParticipantRoute(path, request.method) || isProfileParticipantRoute(path, request.method) || isPointsParticipantRoute(path, request.method) || isRewardsParticipantRoute(path, request.method) || isActivityParticipantRoute(path, request.method) || isOfferParticipantRoute(path, request.method) || path === "/v1/reward-deliveries" && request.method === "GET" || path === "/v1/referrals/accept" && request.method === "POST" || request.method === "GET" && /^\/v1\/leaderboards(?:\/[\w-]+)?$/.test(path) || request.method === "GET" && (path === "/v1/point-ledgers" || path === "/v1/tiered-rewards"));
26
- if (!allowed || !["GET", "POST"].includes(request.method)) {
27
- return Response.json({ error: "Route not found" }, { status: 404 });
30
+ const allowed = incoming.pathname.startsWith("/relay/") && isParticipantRoute(path, request.method);
31
+ if (!allowed) {
32
+ return Response.json(
33
+ { error: "Route not found", code: "route-not-found" },
34
+ { status: 404 }
35
+ );
28
36
  }
29
37
  const target = new URL(upstream.baseUrl);
30
38
  if (target.protocol !== "https:" || target.username || target.password || target.pathname !== "/" || target.search || target.hash) {
31
39
  return Response.json(
32
40
  {
33
- error: "Participant API is not configured. Use the API origin, such as https://relay.domino.run, not a management URL."
41
+ error: "Participant API is not configured. Use the API origin, such as https://relay.domino.run, not a management URL.",
42
+ code: "not-configured"
34
43
  },
35
44
  { status: 503 }
36
45
  );
@@ -86,20 +95,23 @@ function createParticipantBackend(options) {
86
95
  const cookie = (token) => `domino_app_session=${token}; Path=/relay; HttpOnly; Secure; SameSite=Lax; Max-Age=${token ? 28800 : 0}`;
87
96
  return async (request) => {
88
97
  const url = new URL(request.url);
89
- const reject = (error, status) => Response.json(
90
- { error },
98
+ const reject = (error, status, code) => Response.json(
99
+ { error, code },
91
100
  { status, headers: { "Cache-Control": "no-store" } }
92
101
  );
93
102
  if (url.origin !== options.origin) {
94
- return reject("Unexpected application origin", 403);
103
+ return reject("Unexpected application origin", 403, "forbidden");
95
104
  }
96
105
  if (request.method !== "GET" && (request.headers.get("Origin") !== options.origin || request.headers.get("X-Relay-CSRF") !== "1")) {
97
- return reject("Untrusted browser request", 403);
106
+ return reject("Untrusted browser request", 403, "forbidden");
98
107
  }
99
108
  const identity = await options.authenticate(request);
100
109
  if (!identity) {
101
110
  return Response.json(
102
- url.pathname === "/relay/v1/auth/session" ? null : { error: "Sign in to the application" },
111
+ url.pathname === "/relay/v1/auth/session" ? null : {
112
+ error: "Sign in to the application",
113
+ code: "unauthenticated"
114
+ },
103
115
  {
104
116
  status: url.pathname === "/relay/v1/auth/session" ? 200 : 401,
105
117
  headers: { "Set-Cookie": cookie(""), "Cache-Control": "no-store" }
@@ -116,25 +128,25 @@ function createParticipantBackend(options) {
116
128
  },
117
129
  body: JSON.stringify({ subject: identity.subject, previousToken })
118
130
  });
119
- if (exchanged.status === 409) {
131
+ if (!exchanged.ok) {
120
132
  const body = await exchanged.json().catch(() => null);
133
+ const code = typeof body?.code === "string" ? body.code : statusCode(exchanged.status);
134
+ const retryAfter = exchanged.headers.get("Retry-After");
121
135
  return Response.json(
122
136
  {
123
- error: typeof body?.error === "string" ? body.error : "Domino refused this account. Ask an organizer.",
124
- ...typeof body?.code === "string" ? { code: body.code } : {}
137
+ error: exchanged.status === 409 && typeof body?.error === "string" ? body.error : exchanged.status === 409 ? "Domino refused this account. Ask an organizer." : "Domino identity exchange failed. Check the server integration key and its expiry in Console Settings.",
138
+ code
125
139
  },
126
140
  {
127
- status: 409,
128
- headers: { "Set-Cookie": cookie(""), "Cache-Control": "no-store" }
141
+ status: exchanged.status,
142
+ headers: {
143
+ "Set-Cookie": cookie(""),
144
+ "Cache-Control": "no-store",
145
+ ...retryAfter ? { "Retry-After": retryAfter } : {}
146
+ }
129
147
  }
130
148
  );
131
149
  }
132
- if (!exchanged.ok) {
133
- return reject(
134
- "Domino identity exchange failed. Check the server integration key and its expiry in Console Settings.",
135
- exchanged.status
136
- );
137
- }
138
150
  const { token } = exchangeResultSchema.parse(await exchanged.json());
139
151
  const response = await proxyParticipant(request, {
140
152
  baseUrl: options.baseUrl,