@domino-sdk/relay 0.3.0 → 0.4.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.
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ import {
18
18
  identityIntegrationSecretSchema,
19
19
  interactionSchema,
20
20
  participantExchangeSchema,
21
+ projectCatalogArtifactSchema,
21
22
  projectDeploymentSchema,
22
23
  publishDeploymentSchema,
23
24
  publishQuestDraftSchema,
@@ -41,28 +42,62 @@ import {
41
42
  walletChallengeSchema,
42
43
  walletConnectionSchema,
43
44
  walletProofSchema
44
- } from "./chunk-L757OYXZ.js";
45
+ } from "./chunk-KQVL6MOH.js";
46
+ import {
47
+ defineLeaderboard,
48
+ defineReferral,
49
+ leaderboardArtifactSchema,
50
+ leaderboardDefinitionSchema,
51
+ leaderboardExclusionSchema,
52
+ leaderboardGroupSchema,
53
+ leaderboardPageSchema,
54
+ leaderboardPreviewSchema,
55
+ leaderboardQuerySchema,
56
+ leaderboardRowSchema,
57
+ leaderboardWindowSchema,
58
+ pointsAccountSchema,
59
+ pointsEntrySchema,
60
+ pointsMutationSchema,
61
+ pointsResultSchema,
62
+ publishedLeaderboardSchema,
63
+ publishedReferralSchema,
64
+ referralAcceptSchema,
65
+ referralAccountSchema,
66
+ referralArtifactSchema,
67
+ referralControlSchema,
68
+ referralDefinitionSchema,
69
+ referralHistorySchema,
70
+ referralManagementSchema,
71
+ referralRelationshipSchema,
72
+ referralSummarySchema
73
+ } from "./chunk-TXL43HL3.js";
45
74
  import {
46
75
  authScopeSchema,
47
76
  exchangeResultSchema,
48
77
  exchangeSchema,
49
78
  principalSchema,
50
79
  sessionSchema
51
- } from "./chunk-6IXQRMGW.js";
80
+ } from "./chunk-QWRSUSNB.js";
52
81
  import {
82
+ accountConnectionSchema,
53
83
  artifactSchema,
54
84
  attemptSchema,
85
+ authProviderSchema,
55
86
  batchReleaseSchema,
56
87
  beginHandoverSchema,
57
88
  completionRecordSchema,
58
89
  configurePickupSchema,
59
90
  confirmHandoverSchema,
60
91
  decisionSchema,
92
+ discordMemberInputSchema,
93
+ discordMemberSchema,
94
+ discordServerSchema,
61
95
  entitlementSchema,
62
96
  errorSchema,
63
97
  eventSchema,
64
98
  evidenceSchema,
65
99
  identifier,
100
+ integrationProviderSchema,
66
101
  mediaUrlSchema,
67
102
  memberListSchema,
68
103
  memberPageSchema,
@@ -76,6 +111,7 @@ import {
76
111
  pickupSelectionSchema,
77
112
  pointsRewardSchema,
78
113
  prerequisiteSchema,
114
+ projectIntegrationSchema,
79
115
  publishedReleaseSchema,
80
116
  questAvailabilitySchema,
81
117
  questDescriptionSchema,
@@ -108,12 +144,14 @@ import {
108
144
  tierRewardSchema,
109
145
  tieredRewardDefinitionSchema,
110
146
  triggerSchema
111
- } from "./chunk-C2KOMNLG.js";
147
+ } from "./chunk-3IQ4KUKF.js";
112
148
  export {
113
149
  QuestUpdatedError,
114
150
  RelayError,
151
+ accountConnectionSchema,
115
152
  artifactSchema,
116
153
  attemptSchema,
154
+ authProviderSchema,
117
155
  authScopeSchema,
118
156
  batchReleaseSchema,
119
157
  beginHandoverSchema,
@@ -131,8 +169,13 @@ export {
131
169
  confirmHandoverSchema,
132
170
  createRelayClient,
133
171
  decisionSchema,
172
+ defineLeaderboard,
173
+ defineReferral,
134
174
  deploymentPreviewSchema,
135
175
  deploymentResultSchema,
176
+ discordMemberInputSchema,
177
+ discordMemberSchema,
178
+ discordServerSchema,
136
179
  entitlementSchema,
137
180
  errorSchema,
138
181
  eventSchema,
@@ -143,7 +186,17 @@ export {
143
186
  identityIntegrationInputSchema,
144
187
  identityIntegrationSchema,
145
188
  identityIntegrationSecretSchema,
189
+ integrationProviderSchema,
146
190
  interactionSchema,
191
+ leaderboardArtifactSchema,
192
+ leaderboardDefinitionSchema,
193
+ leaderboardExclusionSchema,
194
+ leaderboardGroupSchema,
195
+ leaderboardPageSchema,
196
+ leaderboardPreviewSchema,
197
+ leaderboardQuerySchema,
198
+ leaderboardRowSchema,
199
+ leaderboardWindowSchema,
147
200
  mediaUrlSchema,
148
201
  memberListSchema,
149
202
  memberPageSchema,
@@ -156,12 +209,20 @@ export {
156
209
  pickupCatalogSchema,
157
210
  pickupPolicySchema,
158
211
  pickupSelectionSchema,
212
+ pointsAccountSchema,
213
+ pointsEntrySchema,
214
+ pointsMutationSchema,
215
+ pointsResultSchema,
159
216
  pointsRewardSchema,
160
217
  prerequisiteSchema,
161
218
  principalSchema,
219
+ projectCatalogArtifactSchema,
162
220
  projectDeploymentSchema,
221
+ projectIntegrationSchema,
163
222
  publishDeploymentSchema,
164
223
  publishQuestDraftSchema,
224
+ publishedLeaderboardSchema,
225
+ publishedReferralSchema,
165
226
  publishedReleaseSchema,
166
227
  questActions,
167
228
  questAvailabilitySchema,
@@ -186,6 +247,15 @@ export {
186
247
  quizQuestionSchema,
187
248
  quizQuestionsSchema,
188
249
  reconcileQuestDraft,
250
+ referralAcceptSchema,
251
+ referralAccountSchema,
252
+ referralArtifactSchema,
253
+ referralControlSchema,
254
+ referralDefinitionSchema,
255
+ referralHistorySchema,
256
+ referralManagementSchema,
257
+ referralRelationshipSchema,
258
+ referralSummarySchema,
189
259
  releaseSchema,
190
260
  reservationSchema,
191
261
  reviewItemSchema,
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  exchangeResultSchema
3
- } from "./chunk-6IXQRMGW.js";
4
- import "./chunk-C2KOMNLG.js";
3
+ } from "./chunk-QWRSUSNB.js";
4
+ import "./chunk-3IQ4KUKF.js";
5
5
 
6
6
  // src/portal-proxy.ts
7
7
  async function proxyParticipant(request, upstream) {
8
8
  const incoming = new URL(request.url);
9
9
  const path = incoming.pathname.slice("/relay".length);
10
- const allowed = incoming.pathname.startsWith("/relay/") && (/^\/v1\/auth\/(providers|connections|start|authorize|complete|session|logout|email\/start|email\/verify|callback\/(google|apple|x|discord))$/.test(
10
+ const allowed = incoming.pathname.startsWith("/relay/") && (/^\/v1\/auth\/(providers|connections|accounts(?:\/disconnect)?|start|authorize|complete|session|logout|email\/start|email\/verify|callback\/[a-z][a-z0-9-]*)$/.test(
11
11
  path
12
12
  ) || /^\/v1\/me\/(progress|experience|attempts|evidence|pass|collection-pass|wallet(?:\/challenge|\/verify)?)$/.test(
13
13
  path
14
- ) || /^\/v1\/attempts\/[\w-]+(?:\/retry)?$/.test(path));
14
+ ) || /^\/v1\/attempts\/[\w-]+(?:\/retry)?$/.test(path) || /^\/v1\/referrals(?:\/(me|history))?$/.test(path) && request.method === "GET" || path === "/v1/referrals/accept" && request.method === "POST" || request.method === "GET" && /^\/v1\/leaderboards(?:\/[\w-]+)?$/.test(path));
15
15
  if (!allowed || !["GET", "POST"].includes(request.method))
16
16
  return Response.json({ error: "Route not found" }, { status: 404 });
17
17
  const target = new URL(upstream.baseUrl);
@@ -60,7 +60,7 @@ function createParticipantBackend(options) {
60
60
  "Use an identity integration server key from Console Settings"
61
61
  );
62
62
  const send = options.fetch ?? fetch;
63
- const cookie = (token) => `domino_app_session=${token}; Path=/relay; HttpOnly; Secure; SameSite=Strict; Max-Age=${token ? 28800 : 0}`;
63
+ const cookie = (token) => `domino_app_session=${token}; Path=/relay; HttpOnly; Secure; SameSite=Lax; Max-Age=${token ? 28800 : 0}`;
64
64
  return async (request) => {
65
65
  const url = new URL(request.url);
66
66
  const reject = (error, status) => Response.json(
@@ -83,7 +83,7 @@ function createParticipantBackend(options) {
83
83
  const previousToken = request.headers.get("Cookie")?.split(";").map((value) => value.trim()).find((value) => value.startsWith("domino_app_session="))?.slice("domino_app_session=".length);
84
84
  const exchanged = await send(options.baseUrl + "/v1/auth/exchange", {
85
85
  method: "POST",
86
- redirect: "error",
86
+ redirect: "manual",
87
87
  headers: {
88
88
  Authorization: "Bearer " + options.integrationKey,
89
89
  "Content-Type": "application/json"
@@ -101,14 +101,16 @@ function createParticipantBackend(options) {
101
101
  fetch: async (target, init) => {
102
102
  const headers2 = new Headers(init?.headers);
103
103
  headers2.delete("Cookie");
104
+ const returnBinding = request.headers.get("Cookie")?.split(";").map((value) => value.trim()).find((value) => value.startsWith("relay_auth_return="));
105
+ if (returnBinding) headers2.set("Cookie", returnBinding);
104
106
  headers2.set("Authorization", "Bearer " + token);
105
107
  headers2.set("X-Relay-Integration-Key", options.integrationKey);
106
108
  headers2.set("Origin", options.origin);
107
- return send(target, { ...init, headers: headers2, redirect: "error" });
109
+ return send(target, { ...init, headers: headers2, redirect: "manual" });
108
110
  }
109
111
  });
110
112
  const headers = new Headers(response.headers);
111
- headers.set(
113
+ headers.append(
112
114
  "Set-Cookie",
113
115
  cookie(url.pathname === "/relay/v1/auth/logout" ? "" : token)
114
116
  );
package/dist/schema.d.ts CHANGED
@@ -219,6 +219,9 @@ declare const questDescriptionSchema: z.ZodObject<{
219
219
  }, z.core.$strict>>;
220
220
  }, z.core.$strict>>;
221
221
  }, z.core.$strict>>;
222
+ integrations: z.ZodDefault<z.ZodArray<z.ZodEnum<{
223
+ discord: "discord";
224
+ }>>>;
222
225
  fields: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
223
226
  kind: z.ZodLiteral<"quiz">;
224
227
  default: z.ZodArray<z.ZodObject<{
@@ -401,6 +404,9 @@ declare const publishedReleaseSchema: z.ZodUnion<readonly [z.ZodObject<{
401
404
  }, z.core.$strict>>;
402
405
  }, z.core.$strict>>;
403
406
  }, z.core.$strict>>;
407
+ integrations: z.ZodDefault<z.ZodArray<z.ZodEnum<{
408
+ discord: "discord";
409
+ }>>>;
404
410
  fields: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
405
411
  kind: z.ZodLiteral<"quiz">;
406
412
  default: z.ZodArray<z.ZodObject<{
@@ -595,6 +601,7 @@ declare const publishedReleaseSchema: z.ZodUnion<readonly [z.ZodObject<{
595
601
  } | undefined;
596
602
  } | undefined;
597
603
  };
604
+ integrations: "discord"[];
598
605
  fields: Record<string, {
599
606
  kind: "quiz";
600
607
  default: {
@@ -770,6 +777,9 @@ declare const templateSchema: z.ZodObject<{
770
777
  }, z.core.$strict>>;
771
778
  }, z.core.$strict>>;
772
779
  }, z.core.$strict>>;
780
+ integrations: z.ZodDefault<z.ZodArray<z.ZodEnum<{
781
+ discord: "discord";
782
+ }>>>;
773
783
  fields: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
774
784
  kind: z.ZodLiteral<"quiz">;
775
785
  default: z.ZodArray<z.ZodObject<{
@@ -1179,6 +1189,12 @@ declare const memberProgressSchema: z.ZodObject<{
1179
1189
  }, z.core.$strict>>;
1180
1190
  }, z.core.$strict>>;
1181
1191
  }, z.core.$strict>>;
1192
+ connections: z.ZodDefault<z.ZodArray<z.ZodEnum<{
1193
+ discord: "discord";
1194
+ google: "google";
1195
+ apple: "apple";
1196
+ x: "x";
1197
+ }>>>;
1182
1198
  trigger: z.ZodUnion<readonly [z.ZodObject<{
1183
1199
  kind: z.ZodLiteral<"manual">;
1184
1200
  input: z.ZodEnum<{
@@ -1380,6 +1396,9 @@ declare const snapshotSchema: z.ZodObject<{
1380
1396
  }, z.core.$strict>>;
1381
1397
  }, z.core.$strict>>;
1382
1398
  }, z.core.$strict>>;
1399
+ integrations: z.ZodDefault<z.ZodArray<z.ZodEnum<{
1400
+ discord: "discord";
1401
+ }>>>;
1383
1402
  fields: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
1384
1403
  kind: z.ZodLiteral<"quiz">;
1385
1404
  default: z.ZodArray<z.ZodObject<{
@@ -1574,6 +1593,7 @@ declare const snapshotSchema: z.ZodObject<{
1574
1593
  } | undefined;
1575
1594
  } | undefined;
1576
1595
  };
1596
+ integrations: "discord"[];
1577
1597
  fields: Record<string, {
1578
1598
  kind: "quiz";
1579
1599
  default: {
package/dist/schema.js CHANGED
@@ -48,7 +48,7 @@ import {
48
48
  tierRewardSchema,
49
49
  tieredRewardDefinitionSchema,
50
50
  triggerSchema
51
- } from "./chunk-C2KOMNLG.js";
51
+ } from "./chunk-3IQ4KUKF.js";
52
52
  export {
53
53
  artifactSchema,
54
54
  attemptSchema,