@domino-sdk/relay 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,208 @@
1
+ import {
2
+ QuestUpdatedError,
3
+ RelayError,
4
+ authScopeSchema,
5
+ catalogDeploymentPreviewSchema,
6
+ catalogDeploymentSchema,
7
+ collectionBeginSchema,
8
+ collectionCodeSchema,
9
+ collectionPassSchema,
10
+ collectionPreviewSchema,
11
+ collectionResolveSchema,
12
+ collectionSlotSchema,
13
+ collectionViewSchema,
14
+ createRelayClient,
15
+ deploymentPreviewSchema,
16
+ deploymentResultSchema,
17
+ exchangeResultSchema,
18
+ exchangeSchema,
19
+ interactionSchema,
20
+ principalSchema,
21
+ projectDeploymentSchema,
22
+ publishDeploymentSchema,
23
+ publishQuestDraftSchema,
24
+ questActions,
25
+ questCatalogSchema,
26
+ questCollectionSchema,
27
+ questConfiguration,
28
+ questDraftChangesSchema,
29
+ questDraftSchema,
30
+ questExperienceSchema,
31
+ questInstanceSchema,
32
+ questInteraction,
33
+ questPublicationPreviewSchema,
34
+ questTypeVersionSchema,
35
+ questViewSchema,
36
+ reconcileQuestDraft,
37
+ saveQuestDraftSchema,
38
+ sessionSchema,
39
+ solanaAddressSchema,
40
+ solanaBalanceSchema,
41
+ walletChallengeInputSchema,
42
+ walletChallengeSchema,
43
+ walletConnectionSchema,
44
+ walletProofSchema
45
+ } from "./chunk-NC3UAP6T.js";
46
+ import {
47
+ artifactSchema,
48
+ attemptSchema,
49
+ batchReleaseSchema,
50
+ beginHandoverSchema,
51
+ completionRecordSchema,
52
+ configurePickupSchema,
53
+ confirmHandoverSchema,
54
+ decisionSchema,
55
+ entitlementSchema,
56
+ errorSchema,
57
+ eventSchema,
58
+ evidenceSchema,
59
+ identifier,
60
+ mediaUrlSchema,
61
+ memberListSchema,
62
+ memberPageSchema,
63
+ memberProgressSchema,
64
+ parseSettings,
65
+ photoResultSchema,
66
+ pickupAllocationSchema,
67
+ pickupAvailabilitySchema,
68
+ pickupCatalogSchema,
69
+ pickupPolicySchema,
70
+ pickupSelectionSchema,
71
+ pointsRewardSchema,
72
+ prerequisiteSchema,
73
+ publishedReleaseSchema,
74
+ questAvailabilitySchema,
75
+ questDescriptionSchema,
76
+ questPresentationSchema,
77
+ questSettingsInputSchema,
78
+ quizAnswersSchema,
79
+ quizChoiceSchema,
80
+ quizContentSchema,
81
+ quizEvidenceSchema,
82
+ quizQuestionSchema,
83
+ quizQuestionsSchema,
84
+ releaseSchema,
85
+ reservationSchema,
86
+ reviewItemSchema,
87
+ reviewListSchema,
88
+ reviewModeSchema,
89
+ reviewPageSchema,
90
+ rewardBundleSchema,
91
+ rewardKey,
92
+ rewardSchema,
93
+ settingFieldSchema,
94
+ settings,
95
+ settingsFieldsSchema,
96
+ settingsValuesSchema,
97
+ snapshotSchema,
98
+ staffDecisionSchema,
99
+ stockSchema,
100
+ submitSchema,
101
+ templateSchema,
102
+ tierRewardSchema,
103
+ tieredRewardDefinitionSchema,
104
+ triggerSchema
105
+ } from "./chunk-C2KOMNLG.js";
106
+ export {
107
+ QuestUpdatedError,
108
+ RelayError,
109
+ artifactSchema,
110
+ attemptSchema,
111
+ authScopeSchema,
112
+ batchReleaseSchema,
113
+ beginHandoverSchema,
114
+ catalogDeploymentPreviewSchema,
115
+ catalogDeploymentSchema,
116
+ collectionBeginSchema,
117
+ collectionCodeSchema,
118
+ collectionPassSchema,
119
+ collectionPreviewSchema,
120
+ collectionResolveSchema,
121
+ collectionSlotSchema,
122
+ collectionViewSchema,
123
+ completionRecordSchema,
124
+ configurePickupSchema,
125
+ confirmHandoverSchema,
126
+ createRelayClient,
127
+ decisionSchema,
128
+ deploymentPreviewSchema,
129
+ deploymentResultSchema,
130
+ entitlementSchema,
131
+ errorSchema,
132
+ eventSchema,
133
+ evidenceSchema,
134
+ exchangeResultSchema,
135
+ exchangeSchema,
136
+ identifier,
137
+ interactionSchema,
138
+ mediaUrlSchema,
139
+ memberListSchema,
140
+ memberPageSchema,
141
+ memberProgressSchema,
142
+ parseSettings,
143
+ photoResultSchema,
144
+ pickupAllocationSchema,
145
+ pickupAvailabilitySchema,
146
+ pickupCatalogSchema,
147
+ pickupPolicySchema,
148
+ pickupSelectionSchema,
149
+ pointsRewardSchema,
150
+ prerequisiteSchema,
151
+ principalSchema,
152
+ projectDeploymentSchema,
153
+ publishDeploymentSchema,
154
+ publishQuestDraftSchema,
155
+ publishedReleaseSchema,
156
+ questActions,
157
+ questAvailabilitySchema,
158
+ questCatalogSchema,
159
+ questCollectionSchema,
160
+ questConfiguration,
161
+ questDescriptionSchema,
162
+ questDraftChangesSchema,
163
+ questDraftSchema,
164
+ questExperienceSchema,
165
+ questInstanceSchema,
166
+ questInteraction,
167
+ questPresentationSchema,
168
+ questPublicationPreviewSchema,
169
+ questSettingsInputSchema,
170
+ questTypeVersionSchema,
171
+ questViewSchema,
172
+ quizAnswersSchema,
173
+ quizChoiceSchema,
174
+ quizContentSchema,
175
+ quizEvidenceSchema,
176
+ quizQuestionSchema,
177
+ quizQuestionsSchema,
178
+ reconcileQuestDraft,
179
+ releaseSchema,
180
+ reservationSchema,
181
+ reviewItemSchema,
182
+ reviewListSchema,
183
+ reviewModeSchema,
184
+ reviewPageSchema,
185
+ rewardBundleSchema,
186
+ rewardKey,
187
+ rewardSchema,
188
+ saveQuestDraftSchema,
189
+ sessionSchema,
190
+ settingFieldSchema,
191
+ settings,
192
+ settingsFieldsSchema,
193
+ settingsValuesSchema,
194
+ snapshotSchema,
195
+ solanaAddressSchema,
196
+ solanaBalanceSchema,
197
+ staffDecisionSchema,
198
+ stockSchema,
199
+ submitSchema,
200
+ templateSchema,
201
+ tierRewardSchema,
202
+ tieredRewardDefinitionSchema,
203
+ triggerSchema,
204
+ walletChallengeInputSchema,
205
+ walletChallengeSchema,
206
+ walletConnectionSchema,
207
+ walletProofSchema
208
+ };
@@ -0,0 +1,7 @@
1
+ /** Server-only proxy: browser cookies stay on the participant origin. */
2
+ declare function proxyParticipant(request: Request, upstream: {
3
+ baseUrl: string;
4
+ fetch: typeof fetch;
5
+ }): Promise<Response>;
6
+
7
+ export { proxyParticipant };
@@ -0,0 +1,48 @@
1
+ // src/portal-proxy.ts
2
+ async function proxyParticipant(request, upstream) {
3
+ const incoming = new URL(request.url);
4
+ const path = incoming.pathname.slice("/relay".length);
5
+ 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(
6
+ path
7
+ ) || /^\/v1\/me\/(progress|experience|attempts|evidence|pass|collection-pass|wallet(?:\/challenge|\/verify)?)$/.test(
8
+ path
9
+ ) || /^\/v1\/attempts\/[\w-]+(?:\/retry)?$/.test(path));
10
+ if (!allowed || !["GET", "POST"].includes(request.method))
11
+ return Response.json({ error: "Route not found" }, { status: 404 });
12
+ const target = new URL(upstream.baseUrl);
13
+ if (target.protocol !== "https:" || target.username || target.password || target.pathname !== "/" || target.search || target.hash)
14
+ return Response.json(
15
+ { error: "Participant API is not configured" },
16
+ { status: 503 }
17
+ );
18
+ target.pathname = path;
19
+ target.search = incoming.search;
20
+ const headers = new Headers();
21
+ for (const name of [
22
+ "Cookie",
23
+ "Origin",
24
+ "Content-Type",
25
+ "X-Relay-CSRF",
26
+ "X-Relay-Session",
27
+ "X-Relay-Upload-ID",
28
+ "CF-Connecting-IP"
29
+ ]) {
30
+ const value = request.headers.get(name);
31
+ if (value) headers.set(name, value);
32
+ }
33
+ const response = await upstream.fetch(target, {
34
+ method: request.method,
35
+ headers,
36
+ body: request.method === "GET" ? void 0 : await request.arrayBuffer(),
37
+ redirect: "manual"
38
+ });
39
+ const resultHeaders = new Headers(response.headers);
40
+ resultHeaders.set("Cache-Control", "no-store");
41
+ return new Response(response.body, {
42
+ status: response.status,
43
+ headers: resultHeaders
44
+ });
45
+ }
46
+ export {
47
+ proxyParticipant
48
+ };