@domino-sdk/relay 0.12.0 → 0.14.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/build.d.mts +4 -1
- package/build.mjs +15 -8
- package/dist/authoring.d.ts +4 -3
- package/dist/authoring.js +22 -9
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +6 -5
- package/dist/{chunk-CE5XVIJQ.js → chunk-CJARNIVP.js} +265 -76
- package/dist/{chunk-3UOTI4IU.js → chunk-FUQYKTOJ.js} +30 -7
- package/dist/{chunk-VDWQL6HV.js → chunk-I2CCMGN6.js} +1 -1
- package/dist/{chunk-NLMEK77N.js → chunk-YZJOZL4V.js} +146 -60
- package/dist/index.d.ts +86 -2
- package/dist/index.js +46 -6
- package/dist/portal-proxy.js +26 -13
- package/dist/schema.d.ts +12 -12
- package/dist/schema.js +1 -1
- package/dist/{settings-B61jIDDA.d.ts → settings-CU2y-wUM.d.ts} +382 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { errorSchema, QuizEvidence, Attempt, SubmitInput, MemberProgress, questDescriptionSchema, PublishedRelease, ReviewListOptions, MemberListOptions, ReleaseInput, beginHandoverSchema } from './schema.js';
|
|
3
3
|
export { Decision, Entitlement, MemberPage, PhotoResult, PickupAvailability, QuestAvailability, QuestDescription, QuestPresentation, QuestSettingsInput, ReviewPage, Reward, Snapshot, TieredRewardDefinition, artifactSchema, attemptSchema, batchReleaseSchema, completionRecordSchema, configurePickupSchema, confirmHandoverSchema, createStockItemSchema, decisionSchema, entitlementSchema, eventSchema, evidenceSchema, identifier, integrationRewardSchema, mediaUrlSchema, memberListSchema, memberPageSchema, memberProgressSchema, photoResultSchema, pickupAllocationSchema, pickupAvailabilitySchema, pickupCatalogSchema, pickupPolicySchema, pickupSelectionSchema, pointsRewardSchema, prerequisiteSchema, publishedReleaseSchema, questAvailabilitySchema, questPresentationSchema, questSettingsInputSchema, quizAnswersSchema, quizEvidenceSchema, releaseSchema, reservationSchema, reviewItemSchema, reviewListSchema, reviewModeSchema, reviewPageSchema, rewardBundleSchema, rewardKey, rewardSchema, snapshotSchema, staffDecisionSchema, stockItemSchema, stockSchema, storedReviewModeSchema, submitSchema, templateSchema, tierRewardSchema, tieredRewardDefinitionSchema, triggerSchema } from './schema.js';
|
|
4
|
-
import { r as referralAcceptSchema, L as LeaderboardQuery, w as walletChallengeInputSchema,
|
|
5
|
-
export {
|
|
4
|
+
import { r as referralAcceptSchema, L as LeaderboardQuery, w as walletChallengeInputSchema, i as walletProofSchema, j as AuthProvider } from './settings-CU2y-wUM.js';
|
|
5
|
+
export { k as AccountConnection, B as Budget, D as DiscordMember, a as DiscordMessage, I as IntegrationProvider, l as LeaderboardDefinition, m as LeaderboardPage, O as Observation, P as ProjectIntegration, Q as QuizContent, R as ReferralDefinition, n as ResourceOption, q as ResourceSource, t as SettingField, u as SettingsValues, S as SolanaBalance, b as StreakPolicy, v as StreakProgress, y as TrackerDefinition, z as TrackerPreview, C as TrackerPreviewInput, E as TrackerQuery, T as TrackerReader, F as TrackerRecord, G as TrackerStatus, W as WalletConnection, X as XTweet, H as accountConnectionSchema, J as authProviderSchema, K as budgetSchema, M as communityTimeZoneSchema, N as compatibleSettingKinds, U as completionKeySchema, V as completionPolicySchema, c as customSource, d as defineLeaderboard, e as defineReferral, f as defineTracker, g as discord, Y as discordMemberInputSchema, Z as discordMemberSchema, _ as discordMessageInputSchema, $ as discordMessageSchema, a0 as discordReactionSchema, a1 as discordServerSchema, a2 as integrationProviderSchema, a3 as leaderboardArtifactSchema, a4 as leaderboardAuthoringSchema, a5 as leaderboardDefinitionSchema, a6 as leaderboardExclusionSchema, a7 as leaderboardGroupSchema, a8 as leaderboardPageSchema, a9 as leaderboardPreviewSchema, aa as leaderboardQuerySchema, ab as leaderboardRowSchema, ac as leaderboardWindowSchema, ad as missingResourceSettings, ae as observationInputSchema, af as observationReceiptSchema, ag as observationSchema, o as observationTriggerSchema, ah as parseSettings, p as pointLedgers, ai as pointsAccountSchema, aj as pointsEntrySchema, ak as pointsMutationSchema, al as pointsResultSchema, am as projectIntegrationSchema, an as publishedLeaderboardSchema, ao as publishedReferralSchema, ap as publishedTrackerSchema, aq as quizChoiceSchema, ar as quizContentSchema, as as quizQuestionSchema, at as quizQuestionsSchema, au as referralAccountSchema, av as referralArtifactSchema, aw as referralAuthoringSchema, ax as referralControlSchema, ay as referralDefinitionSchema, az as referralHistorySchema, aA as referralManagementSchema, aB as referralRelationshipSchema, aC as referralSummarySchema, aD as resourceOptionsSchema, aE as resourceRequestSchema, aF as resourceSourceSchema, aG as settingFieldSchema, s as settings, aH as settingsFieldsSchema, aI as settingsValuesSchema, aJ as solanaAddressSchema, aK as solanaBalanceSchema, h as streak, aL as streakPolicySchema, aM as streakProgressSchema, aN as trackerArtifactSchema, aO as trackerControlSchema, aP as trackerDefinitionSchema, aQ as trackerIngestResultSchema, aR as trackerIngestSchema, aS as trackerPageSchema, aT as trackerPreviewInputSchema, aU as trackerPreviewLimits, aV as trackerPreviewSchema, aW as trackerQuerySchema, aX as trackerRecordInputSchema, aY as trackerRecordSchema, aZ as trackerSourceSchema, a_ as trackerStatusSchema, a$ as trackerSummarySchema, b0 as walletChallengeSchema, b1 as walletConnectionSchema, x, b2 as xTweetSchema } from './settings-CU2y-wUM.js';
|
|
6
6
|
|
|
7
7
|
declare class RelayError extends Error {
|
|
8
8
|
readonly status: number;
|
|
@@ -3295,6 +3295,25 @@ declare const projectCatalogArtifactSchema: z.ZodObject<{
|
|
|
3295
3295
|
automatic: "automatic";
|
|
3296
3296
|
claim: "claim";
|
|
3297
3297
|
}>>>;
|
|
3298
|
+
trackers: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
3299
|
+
key: z.ZodString;
|
|
3300
|
+
title: z.ZodString;
|
|
3301
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3302
|
+
kind: z.ZodLiteral<"x-search">;
|
|
3303
|
+
query: z.ZodString;
|
|
3304
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3305
|
+
kind: z.ZodLiteral<"custom">;
|
|
3306
|
+
namespace: z.ZodString;
|
|
3307
|
+
}, z.core.$strict>], "kind">;
|
|
3308
|
+
window: z.ZodObject<{
|
|
3309
|
+
start: z.ZodNumber;
|
|
3310
|
+
end: z.ZodOptional<z.ZodNumber>;
|
|
3311
|
+
}, z.core.$strict>;
|
|
3312
|
+
refreshSeconds: z.ZodDefault<z.ZodNumber>;
|
|
3313
|
+
maxPages: z.ZodDefault<z.ZodNumber>;
|
|
3314
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3315
|
+
code: z.ZodString;
|
|
3316
|
+
}, z.core.$strict>]>>>;
|
|
3298
3317
|
pointLedgers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
3299
3318
|
name: z.ZodString;
|
|
3300
3319
|
description: z.ZodDefault<z.ZodString>;
|
|
@@ -3766,6 +3785,25 @@ declare const projectDeploymentSchema: z.ZodObject<{
|
|
|
3766
3785
|
automatic: "automatic";
|
|
3767
3786
|
claim: "claim";
|
|
3768
3787
|
}>>>;
|
|
3788
|
+
trackers: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
3789
|
+
key: z.ZodString;
|
|
3790
|
+
title: z.ZodString;
|
|
3791
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3792
|
+
kind: z.ZodLiteral<"x-search">;
|
|
3793
|
+
query: z.ZodString;
|
|
3794
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3795
|
+
kind: z.ZodLiteral<"custom">;
|
|
3796
|
+
namespace: z.ZodString;
|
|
3797
|
+
}, z.core.$strict>], "kind">;
|
|
3798
|
+
window: z.ZodObject<{
|
|
3799
|
+
start: z.ZodNumber;
|
|
3800
|
+
end: z.ZodOptional<z.ZodNumber>;
|
|
3801
|
+
}, z.core.$strict>;
|
|
3802
|
+
refreshSeconds: z.ZodDefault<z.ZodNumber>;
|
|
3803
|
+
maxPages: z.ZodDefault<z.ZodNumber>;
|
|
3804
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3805
|
+
code: z.ZodString;
|
|
3806
|
+
}, z.core.$strict>]>>>;
|
|
3769
3807
|
pointLedgers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
3770
3808
|
name: z.ZodString;
|
|
3771
3809
|
description: z.ZodDefault<z.ZodString>;
|
|
@@ -4226,6 +4264,29 @@ declare const projectDeploymentSchema: z.ZodObject<{
|
|
|
4226
4264
|
}, z.core.$strict>;
|
|
4227
4265
|
declare const deploymentPreviewSchema: z.ZodObject<{
|
|
4228
4266
|
id: z.ZodString;
|
|
4267
|
+
trackers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
4268
|
+
id: z.ZodString;
|
|
4269
|
+
version: z.ZodString;
|
|
4270
|
+
definition: z.ZodObject<{
|
|
4271
|
+
key: z.ZodString;
|
|
4272
|
+
title: z.ZodString;
|
|
4273
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4274
|
+
kind: z.ZodLiteral<"x-search">;
|
|
4275
|
+
query: z.ZodString;
|
|
4276
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4277
|
+
kind: z.ZodLiteral<"custom">;
|
|
4278
|
+
namespace: z.ZodString;
|
|
4279
|
+
}, z.core.$strict>], "kind">;
|
|
4280
|
+
window: z.ZodObject<{
|
|
4281
|
+
start: z.ZodNumber;
|
|
4282
|
+
end: z.ZodOptional<z.ZodNumber>;
|
|
4283
|
+
}, z.core.$strict>;
|
|
4284
|
+
refreshSeconds: z.ZodDefault<z.ZodNumber>;
|
|
4285
|
+
maxPages: z.ZodDefault<z.ZodNumber>;
|
|
4286
|
+
}, z.core.$strict>;
|
|
4287
|
+
publishedAt: z.ZodNumber;
|
|
4288
|
+
actor: z.ZodNullable<z.ZodString>;
|
|
4289
|
+
}, z.core.$strip>>>;
|
|
4229
4290
|
baseRevision: z.ZodNumber;
|
|
4230
4291
|
pointLedgers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
4231
4292
|
name: z.ZodString;
|
|
@@ -5189,6 +5250,29 @@ declare const publishDeploymentSchema: z.ZodObject<{
|
|
|
5189
5250
|
}, z.core.$strict>;
|
|
5190
5251
|
declare const deploymentResultSchema: z.ZodObject<{
|
|
5191
5252
|
id: z.ZodString;
|
|
5253
|
+
trackers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
5254
|
+
id: z.ZodString;
|
|
5255
|
+
version: z.ZodString;
|
|
5256
|
+
definition: z.ZodObject<{
|
|
5257
|
+
key: z.ZodString;
|
|
5258
|
+
title: z.ZodString;
|
|
5259
|
+
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5260
|
+
kind: z.ZodLiteral<"x-search">;
|
|
5261
|
+
query: z.ZodString;
|
|
5262
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
5263
|
+
kind: z.ZodLiteral<"custom">;
|
|
5264
|
+
namespace: z.ZodString;
|
|
5265
|
+
}, z.core.$strict>], "kind">;
|
|
5266
|
+
window: z.ZodObject<{
|
|
5267
|
+
start: z.ZodNumber;
|
|
5268
|
+
end: z.ZodOptional<z.ZodNumber>;
|
|
5269
|
+
}, z.core.$strict>;
|
|
5270
|
+
refreshSeconds: z.ZodDefault<z.ZodNumber>;
|
|
5271
|
+
maxPages: z.ZodDefault<z.ZodNumber>;
|
|
5272
|
+
}, z.core.$strict>;
|
|
5273
|
+
publishedAt: z.ZodNumber;
|
|
5274
|
+
actor: z.ZodNullable<z.ZodString>;
|
|
5275
|
+
}, z.core.$strip>>>;
|
|
5192
5276
|
baseRevision: z.ZodNumber;
|
|
5193
5277
|
pointLedgers: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
5194
5278
|
name: z.ZodString;
|
package/dist/index.js
CHANGED
|
@@ -51,10 +51,12 @@ import {
|
|
|
51
51
|
walletChallengeSchema,
|
|
52
52
|
walletConnectionSchema,
|
|
53
53
|
walletProofSchema
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-YZJOZL4V.js";
|
|
55
55
|
import {
|
|
56
|
+
customSource,
|
|
56
57
|
defineLeaderboard,
|
|
57
58
|
defineReferral,
|
|
59
|
+
defineTracker,
|
|
58
60
|
leaderboardArtifactSchema,
|
|
59
61
|
leaderboardAuthoringSchema,
|
|
60
62
|
leaderboardDefinitionSchema,
|
|
@@ -71,6 +73,7 @@ import {
|
|
|
71
73
|
pointsResultSchema,
|
|
72
74
|
publishedLeaderboardSchema,
|
|
73
75
|
publishedReferralSchema,
|
|
76
|
+
publishedTrackerSchema,
|
|
74
77
|
referralAcceptSchema,
|
|
75
78
|
referralAccountSchema,
|
|
76
79
|
referralArtifactSchema,
|
|
@@ -80,15 +83,32 @@ import {
|
|
|
80
83
|
referralHistorySchema,
|
|
81
84
|
referralManagementSchema,
|
|
82
85
|
referralRelationshipSchema,
|
|
83
|
-
referralSummarySchema
|
|
84
|
-
|
|
86
|
+
referralSummarySchema,
|
|
87
|
+
trackerArtifactSchema,
|
|
88
|
+
trackerControlSchema,
|
|
89
|
+
trackerDefinitionSchema,
|
|
90
|
+
trackerIngestResultSchema,
|
|
91
|
+
trackerIngestSchema,
|
|
92
|
+
trackerPageSchema,
|
|
93
|
+
trackerPreviewInputSchema,
|
|
94
|
+
trackerPreviewLimits,
|
|
95
|
+
trackerPreviewSchema,
|
|
96
|
+
trackerQuerySchema,
|
|
97
|
+
trackerRecordInputSchema,
|
|
98
|
+
trackerRecordSchema,
|
|
99
|
+
trackerSourceSchema,
|
|
100
|
+
trackerStatusSchema,
|
|
101
|
+
trackerSummarySchema,
|
|
102
|
+
x,
|
|
103
|
+
xTweetSchema
|
|
104
|
+
} from "./chunk-CJARNIVP.js";
|
|
85
105
|
import {
|
|
86
106
|
authScopeSchema,
|
|
87
107
|
exchangeResultSchema,
|
|
88
108
|
exchangeSchema,
|
|
89
109
|
principalSchema,
|
|
90
110
|
sessionSchema
|
|
91
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-I2CCMGN6.js";
|
|
92
112
|
import {
|
|
93
113
|
accountConnectionSchema,
|
|
94
114
|
artifactSchema,
|
|
@@ -180,7 +200,7 @@ import {
|
|
|
180
200
|
tierRewardSchema,
|
|
181
201
|
tieredRewardDefinitionSchema,
|
|
182
202
|
triggerSchema
|
|
183
|
-
} from "./chunk-
|
|
203
|
+
} from "./chunk-FUQYKTOJ.js";
|
|
184
204
|
export {
|
|
185
205
|
QuestUpdatedError,
|
|
186
206
|
RelayError,
|
|
@@ -214,9 +234,11 @@ export {
|
|
|
214
234
|
createPointLedgerSchema,
|
|
215
235
|
createRelayClient,
|
|
216
236
|
createStockItemSchema,
|
|
237
|
+
customSource,
|
|
217
238
|
decisionSchema,
|
|
218
239
|
defineLeaderboard,
|
|
219
240
|
defineReferral,
|
|
241
|
+
defineTracker,
|
|
220
242
|
deploymentPreviewSchema,
|
|
221
243
|
deploymentResultSchema,
|
|
222
244
|
discord,
|
|
@@ -285,6 +307,7 @@ export {
|
|
|
285
307
|
publishedLeaderboardSchema,
|
|
286
308
|
publishedReferralSchema,
|
|
287
309
|
publishedReleaseSchema,
|
|
310
|
+
publishedTrackerSchema,
|
|
288
311
|
questActions,
|
|
289
312
|
questAvailabilitySchema,
|
|
290
313
|
questCatalogSchema,
|
|
@@ -352,9 +375,26 @@ export {
|
|
|
352
375
|
templateSchema,
|
|
353
376
|
tierRewardSchema,
|
|
354
377
|
tieredRewardDefinitionSchema,
|
|
378
|
+
trackerArtifactSchema,
|
|
379
|
+
trackerControlSchema,
|
|
380
|
+
trackerDefinitionSchema,
|
|
381
|
+
trackerIngestResultSchema,
|
|
382
|
+
trackerIngestSchema,
|
|
383
|
+
trackerPageSchema,
|
|
384
|
+
trackerPreviewInputSchema,
|
|
385
|
+
trackerPreviewLimits,
|
|
386
|
+
trackerPreviewSchema,
|
|
387
|
+
trackerQuerySchema,
|
|
388
|
+
trackerRecordInputSchema,
|
|
389
|
+
trackerRecordSchema,
|
|
390
|
+
trackerSourceSchema,
|
|
391
|
+
trackerStatusSchema,
|
|
392
|
+
trackerSummarySchema,
|
|
355
393
|
triggerSchema,
|
|
356
394
|
walletChallengeInputSchema,
|
|
357
395
|
walletChallengeSchema,
|
|
358
396
|
walletConnectionSchema,
|
|
359
|
-
walletProofSchema
|
|
397
|
+
walletProofSchema,
|
|
398
|
+
x,
|
|
399
|
+
xTweetSchema
|
|
360
400
|
};
|
package/dist/portal-proxy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
exchangeResultSchema
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-I2CCMGN6.js";
|
|
4
|
+
import "./chunk-FUQYKTOJ.js";
|
|
5
5
|
|
|
6
6
|
// src/portal-proxy.ts
|
|
7
7
|
async function proxyParticipant(request, upstream) {
|
|
@@ -12,14 +12,16 @@ async function proxyParticipant(request, upstream) {
|
|
|
12
12
|
) || /^\/v1\/me\/(progress|experience|attempts|evidence|pass|collection-pass|wallet(?:\/challenge|\/verify)?)$/.test(
|
|
13
13
|
path
|
|
14
14
|
) || /^\/v1\/attempts\/[\w-]+(?:\/retry)?$/.test(path) || /^\/v1\/referrals(?:\/(me|history))?$/.test(path) && request.method === "GET" || path === "/v1/reward-deliveries" && request.method === "GET" || path === "/v1/referrals/accept" && request.method === "POST" || request.method === "GET" && /^\/v1\/leaderboards(?:\/[\w-]+)?$/.test(path));
|
|
15
|
-
if (!allowed || !["GET", "POST"].includes(request.method))
|
|
15
|
+
if (!allowed || !["GET", "POST"].includes(request.method)) {
|
|
16
16
|
return Response.json({ error: "Route not found" }, { status: 404 });
|
|
17
|
+
}
|
|
17
18
|
const target = new URL(upstream.baseUrl);
|
|
18
|
-
if (target.protocol !== "https:" || target.username || target.password || target.pathname !== "/" || target.search || target.hash)
|
|
19
|
+
if (target.protocol !== "https:" || target.username || target.password || target.pathname !== "/" || target.search || target.hash) {
|
|
19
20
|
return Response.json(
|
|
20
21
|
{ error: "Participant API is not configured" },
|
|
21
22
|
{ status: 503 }
|
|
22
23
|
);
|
|
24
|
+
}
|
|
23
25
|
target.pathname = path;
|
|
24
26
|
target.search = incoming.search;
|
|
25
27
|
const headers = new Headers();
|
|
@@ -33,10 +35,13 @@ async function proxyParticipant(request, upstream) {
|
|
|
33
35
|
"CF-Connecting-IP"
|
|
34
36
|
]) {
|
|
35
37
|
const value = request.headers.get(name);
|
|
36
|
-
if (value)
|
|
38
|
+
if (value) {
|
|
39
|
+
headers.set(name, value);
|
|
40
|
+
}
|
|
37
41
|
}
|
|
38
|
-
if (upstream.hosted ?? true)
|
|
42
|
+
if (upstream.hosted ?? true) {
|
|
39
43
|
headers.set("X-Relay-App-Origin", incoming.origin);
|
|
44
|
+
}
|
|
40
45
|
const send = upstream.fetch;
|
|
41
46
|
const response = await send(target, {
|
|
42
47
|
method: request.method,
|
|
@@ -54,14 +59,16 @@ async function proxyParticipant(request, upstream) {
|
|
|
54
59
|
function createParticipantBackend(options) {
|
|
55
60
|
const origin = new URL(options.origin);
|
|
56
61
|
const base = new URL(options.baseUrl);
|
|
57
|
-
if (origin.protocol !== "https:" || origin.origin !== options.origin || base.protocol !== "https:" || base.origin !== options.baseUrl)
|
|
62
|
+
if (origin.protocol !== "https:" || origin.origin !== options.origin || base.protocol !== "https:" || base.origin !== options.baseUrl) {
|
|
58
63
|
throw new Error(
|
|
59
64
|
"Configure exact HTTPS application and participant API origins"
|
|
60
65
|
);
|
|
61
|
-
|
|
66
|
+
}
|
|
67
|
+
if (!options.integrationKey.startsWith("di_")) {
|
|
62
68
|
throw new Error(
|
|
63
69
|
"Use an identity integration server key from Console Settings"
|
|
64
70
|
);
|
|
71
|
+
}
|
|
65
72
|
const send = options.fetch ?? fetch;
|
|
66
73
|
const cookie = (token) => `domino_app_session=${token}; Path=/relay; HttpOnly; Secure; SameSite=Lax; Max-Age=${token ? 28800 : 0}`;
|
|
67
74
|
return async (request) => {
|
|
@@ -70,12 +77,14 @@ function createParticipantBackend(options) {
|
|
|
70
77
|
{ error },
|
|
71
78
|
{ status, headers: { "Cache-Control": "no-store" } }
|
|
72
79
|
);
|
|
73
|
-
if (url.origin !== options.origin)
|
|
80
|
+
if (url.origin !== options.origin) {
|
|
74
81
|
return reject("Unexpected application origin", 403);
|
|
75
|
-
|
|
82
|
+
}
|
|
83
|
+
if (request.method !== "GET" && (request.headers.get("Origin") !== options.origin || request.headers.get("X-Relay-CSRF") !== "1")) {
|
|
76
84
|
return reject("Untrusted browser request", 403);
|
|
85
|
+
}
|
|
77
86
|
const identity = await options.authenticate(request);
|
|
78
|
-
if (!identity)
|
|
87
|
+
if (!identity) {
|
|
79
88
|
return Response.json(
|
|
80
89
|
url.pathname === "/relay/v1/auth/session" ? null : { error: "Sign in to the application" },
|
|
81
90
|
{
|
|
@@ -83,6 +92,7 @@ function createParticipantBackend(options) {
|
|
|
83
92
|
headers: { "Set-Cookie": cookie(""), "Cache-Control": "no-store" }
|
|
84
93
|
}
|
|
85
94
|
);
|
|
95
|
+
}
|
|
86
96
|
const previousToken = request.headers.get("Cookie")?.split(";").map((value) => value.trim()).find((value) => value.startsWith("domino_app_session="))?.slice("domino_app_session=".length);
|
|
87
97
|
const exchanged = await send(options.baseUrl + "/v1/auth/exchange", {
|
|
88
98
|
method: "POST",
|
|
@@ -93,11 +103,12 @@ function createParticipantBackend(options) {
|
|
|
93
103
|
},
|
|
94
104
|
body: JSON.stringify({ subject: identity.subject, previousToken })
|
|
95
105
|
});
|
|
96
|
-
if (!exchanged.ok)
|
|
106
|
+
if (!exchanged.ok) {
|
|
97
107
|
return reject(
|
|
98
108
|
"Domino identity exchange failed. Check the server integration key and its expiry in Console Settings.",
|
|
99
109
|
exchanged.status
|
|
100
110
|
);
|
|
111
|
+
}
|
|
101
112
|
const { token } = exchangeResultSchema.parse(await exchanged.json());
|
|
102
113
|
const response = await proxyParticipant(request, {
|
|
103
114
|
baseUrl: options.baseUrl,
|
|
@@ -105,7 +116,9 @@ function createParticipantBackend(options) {
|
|
|
105
116
|
const headers2 = new Headers(init?.headers);
|
|
106
117
|
headers2.delete("Cookie");
|
|
107
118
|
const returnBinding = request.headers.get("Cookie")?.split(";").map((value) => value.trim()).find((value) => value.startsWith("relay_auth_return="));
|
|
108
|
-
if (returnBinding)
|
|
119
|
+
if (returnBinding) {
|
|
120
|
+
headers2.set("Cookie", returnBinding);
|
|
121
|
+
}
|
|
109
122
|
headers2.set("Authorization", "Bearer " + token);
|
|
110
123
|
headers2.set("X-Relay-Integration-Key", options.integrationKey);
|
|
111
124
|
headers2.set("Origin", options.origin);
|
package/dist/schema.d.ts
CHANGED
|
@@ -83,8 +83,8 @@ declare const triggerSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
83
83
|
none: "none";
|
|
84
84
|
}>;
|
|
85
85
|
actor: z.ZodOptional<z.ZodEnum<{
|
|
86
|
-
member: "member";
|
|
87
86
|
staff: "staff";
|
|
87
|
+
member: "member";
|
|
88
88
|
}>>;
|
|
89
89
|
}, z.core.$strict>, z.ZodObject<{
|
|
90
90
|
kind: z.ZodLiteral<"automatic">;
|
|
@@ -373,8 +373,8 @@ declare const questDescriptionSchema: z.ZodObject<{
|
|
|
373
373
|
none: "none";
|
|
374
374
|
}>;
|
|
375
375
|
actor: z.ZodOptional<z.ZodEnum<{
|
|
376
|
-
member: "member";
|
|
377
376
|
staff: "staff";
|
|
377
|
+
member: "member";
|
|
378
378
|
}>>;
|
|
379
379
|
}, z.core.$strict>, z.ZodObject<{
|
|
380
380
|
kind: z.ZodLiteral<"automatic">;
|
|
@@ -614,8 +614,8 @@ declare const publishedReleaseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
614
614
|
none: "none";
|
|
615
615
|
}>;
|
|
616
616
|
actor: z.ZodOptional<z.ZodEnum<{
|
|
617
|
-
member: "member";
|
|
618
617
|
staff: "staff";
|
|
618
|
+
member: "member";
|
|
619
619
|
}>>;
|
|
620
620
|
}, z.core.$strict>, z.ZodObject<{
|
|
621
621
|
kind: z.ZodLiteral<"automatic">;
|
|
@@ -672,8 +672,8 @@ declare const publishedReleaseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
672
672
|
typeVersion: z.ZodString;
|
|
673
673
|
}, z.core.$strict>>;
|
|
674
674
|
lifecycle: z.ZodDefault<z.ZodEnum<{
|
|
675
|
-
active: "active";
|
|
676
675
|
paused: "paused";
|
|
676
|
+
active: "active";
|
|
677
677
|
archived: "archived";
|
|
678
678
|
}>>;
|
|
679
679
|
configuration: z.ZodOptional<z.ZodObject<{
|
|
@@ -871,7 +871,7 @@ declare const publishedReleaseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
871
871
|
trigger: {
|
|
872
872
|
kind: "manual";
|
|
873
873
|
input: "photo" | "quiz" | "none";
|
|
874
|
-
actor?: "
|
|
874
|
+
actor?: "staff" | "member" | undefined;
|
|
875
875
|
} | {
|
|
876
876
|
kind: "automatic";
|
|
877
877
|
observation?: {
|
|
@@ -907,7 +907,7 @@ declare const publishedReleaseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
907
907
|
id: string;
|
|
908
908
|
createdAt: number;
|
|
909
909
|
legacy: boolean;
|
|
910
|
-
lifecycle: "
|
|
910
|
+
lifecycle: "paused" | "active" | "archived";
|
|
911
911
|
key?: string | undefined;
|
|
912
912
|
origin?: {
|
|
913
913
|
typeVersion: string;
|
|
@@ -1115,8 +1115,8 @@ declare const templateSchema: z.ZodObject<{
|
|
|
1115
1115
|
none: "none";
|
|
1116
1116
|
}>;
|
|
1117
1117
|
actor: z.ZodOptional<z.ZodEnum<{
|
|
1118
|
-
member: "member";
|
|
1119
1118
|
staff: "staff";
|
|
1119
|
+
member: "member";
|
|
1120
1120
|
}>>;
|
|
1121
1121
|
}, z.core.$strict>, z.ZodObject<{
|
|
1122
1122
|
kind: z.ZodLiteral<"automatic">;
|
|
@@ -1499,8 +1499,8 @@ declare const memberProgressSchema: z.ZodObject<{
|
|
|
1499
1499
|
none: "none";
|
|
1500
1500
|
}>;
|
|
1501
1501
|
actor: z.ZodOptional<z.ZodEnum<{
|
|
1502
|
-
member: "member";
|
|
1503
1502
|
staff: "staff";
|
|
1503
|
+
member: "member";
|
|
1504
1504
|
}>>;
|
|
1505
1505
|
}, z.core.$strict>, z.ZodObject<{
|
|
1506
1506
|
kind: z.ZodLiteral<"automatic">;
|
|
@@ -1868,8 +1868,8 @@ declare const snapshotSchema: z.ZodObject<{
|
|
|
1868
1868
|
none: "none";
|
|
1869
1869
|
}>;
|
|
1870
1870
|
actor: z.ZodOptional<z.ZodEnum<{
|
|
1871
|
-
member: "member";
|
|
1872
1871
|
staff: "staff";
|
|
1872
|
+
member: "member";
|
|
1873
1873
|
}>>;
|
|
1874
1874
|
}, z.core.$strict>, z.ZodObject<{
|
|
1875
1875
|
kind: z.ZodLiteral<"automatic">;
|
|
@@ -1926,8 +1926,8 @@ declare const snapshotSchema: z.ZodObject<{
|
|
|
1926
1926
|
typeVersion: z.ZodString;
|
|
1927
1927
|
}, z.core.$strict>>;
|
|
1928
1928
|
lifecycle: z.ZodDefault<z.ZodEnum<{
|
|
1929
|
-
active: "active";
|
|
1930
1929
|
paused: "paused";
|
|
1930
|
+
active: "active";
|
|
1931
1931
|
archived: "archived";
|
|
1932
1932
|
}>>;
|
|
1933
1933
|
configuration: z.ZodOptional<z.ZodObject<{
|
|
@@ -2125,7 +2125,7 @@ declare const snapshotSchema: z.ZodObject<{
|
|
|
2125
2125
|
trigger: {
|
|
2126
2126
|
kind: "manual";
|
|
2127
2127
|
input: "photo" | "quiz" | "none";
|
|
2128
|
-
actor?: "
|
|
2128
|
+
actor?: "staff" | "member" | undefined;
|
|
2129
2129
|
} | {
|
|
2130
2130
|
kind: "automatic";
|
|
2131
2131
|
observation?: {
|
|
@@ -2161,7 +2161,7 @@ declare const snapshotSchema: z.ZodObject<{
|
|
|
2161
2161
|
id: string;
|
|
2162
2162
|
createdAt: number;
|
|
2163
2163
|
legacy: boolean;
|
|
2164
|
-
lifecycle: "
|
|
2164
|
+
lifecycle: "paused" | "active" | "archived";
|
|
2165
2165
|
key?: string | undefined;
|
|
2166
2166
|
origin?: {
|
|
2167
2167
|
typeVersion: string;
|