@domino-sdk/relay 0.1.0 → 0.3.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.
@@ -255,7 +255,7 @@ declare function defineQuest<T extends Record<string, z.ZodType>, const G extend
255
255
  trigger: {
256
256
  kind: "manual";
257
257
  input: "photo" | "quiz" | "none";
258
- actor?: "member" | "staff" | undefined;
258
+ actor?: "staff" | "member" | undefined;
259
259
  } | {
260
260
  kind: "automatic";
261
261
  };
package/dist/browser.d.ts CHANGED
@@ -72,7 +72,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
72
72
  quest: string;
73
73
  member: string;
74
74
  evidence: string | null;
75
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
75
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
76
76
  reason: string | null;
77
77
  retries: number;
78
78
  generation: number;
@@ -109,7 +109,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
109
109
  } | undefined;
110
110
  } | null;
111
111
  release: string;
112
- interaction: "staff" | "quiz" | "photo" | "automatic" | "claim";
112
+ interaction: "quiz" | "photo" | "staff" | "automatic" | "claim";
113
113
  lifecycle: "active" | "paused" | "archived";
114
114
  rewards: {
115
115
  label: string;
@@ -121,7 +121,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
121
121
  quest: string;
122
122
  member: string;
123
123
  evidence: string | null;
124
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
124
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
125
125
  reason: string | null;
126
126
  retries: number;
127
127
  generation: number;
@@ -225,7 +225,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
225
225
  quest: string;
226
226
  member: string;
227
227
  evidence: string | null;
228
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
228
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
229
229
  reason: string | null;
230
230
  retries: number;
231
231
  generation: number;
@@ -262,7 +262,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
262
262
  } | undefined;
263
263
  } | null;
264
264
  release: string;
265
- interaction: "staff" | "quiz" | "photo" | "automatic" | "claim";
265
+ interaction: "quiz" | "photo" | "staff" | "automatic" | "claim";
266
266
  lifecycle: "active" | "paused" | "archived";
267
267
  rewards: {
268
268
  label: string;
@@ -337,7 +337,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
337
337
  quest: string;
338
338
  member: string;
339
339
  evidence: string | null;
340
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
340
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
341
341
  reason: string | null;
342
342
  retries: number;
343
343
  generation: number;
@@ -374,7 +374,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
374
374
  } | undefined;
375
375
  } | null;
376
376
  release: string;
377
- interaction: "staff" | "quiz" | "photo" | "automatic" | "claim";
377
+ interaction: "quiz" | "photo" | "staff" | "automatic" | "claim";
378
378
  lifecycle: "active" | "paused" | "archived";
379
379
  rewards: {
380
380
  label: string;
@@ -451,7 +451,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
451
451
  quest: string;
452
452
  member: string;
453
453
  evidence: string | null;
454
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
454
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
455
455
  reason: string | null;
456
456
  retries: number;
457
457
  generation: number;
@@ -488,7 +488,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
488
488
  } | undefined;
489
489
  } | null;
490
490
  release: string;
491
- interaction: "staff" | "quiz" | "photo" | "automatic" | "claim";
491
+ interaction: "quiz" | "photo" | "staff" | "automatic" | "claim";
492
492
  lifecycle: "active" | "paused" | "archived";
493
493
  rewards: {
494
494
  label: string;
@@ -650,7 +650,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
650
650
  quest: string;
651
651
  member: string;
652
652
  evidence: string | null;
653
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
653
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
654
654
  reason: string | null;
655
655
  retries: number;
656
656
  generation: number;
@@ -754,7 +754,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
754
754
  quest: string;
755
755
  member: string;
756
756
  evidence: string | null;
757
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
757
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
758
758
  reason: string | null;
759
759
  retries: number;
760
760
  generation: number;
@@ -878,7 +878,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
878
878
  quest: string;
879
879
  member: string;
880
880
  evidence: string | null;
881
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
881
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
882
882
  reason: string | null;
883
883
  retries: number;
884
884
  generation: number;
@@ -932,7 +932,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
932
932
  quest: string;
933
933
  member: string;
934
934
  evidence: string | null;
935
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
935
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
936
936
  reason: string | null;
937
937
  retries: number;
938
938
  generation: number;
@@ -1002,7 +1002,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
1002
1002
  code: string;
1003
1003
  definition: {
1004
1004
  quest: string;
1005
- runtimeVersion: 2 | 1;
1005
+ runtimeVersion: 1 | 2;
1006
1006
  title: string;
1007
1007
  presentation: {
1008
1008
  quiz?: {
@@ -1116,7 +1116,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
1116
1116
  code: string;
1117
1117
  definition: {
1118
1118
  quest: string;
1119
- runtimeVersion: 2 | 1;
1119
+ runtimeVersion: 1 | 2;
1120
1120
  title: string;
1121
1121
  presentation: {
1122
1122
  quiz?: {
@@ -1229,7 +1229,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
1229
1229
  snapshot: () => Promise<{
1230
1230
  releases: {
1231
1231
  quest: string;
1232
- runtimeVersion: 2 | 1;
1232
+ runtimeVersion: 1 | 2;
1233
1233
  title: string;
1234
1234
  presentation: {
1235
1235
  quiz?: {
@@ -1456,7 +1456,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
1456
1456
  quest: string;
1457
1457
  member: string;
1458
1458
  evidence: string | null;
1459
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
1459
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
1460
1460
  reason: string | null;
1461
1461
  retries: number;
1462
1462
  generation: number;
@@ -1510,7 +1510,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
1510
1510
  }>;
1511
1511
  publish: (release: ReleaseInput) => Promise<{
1512
1512
  quest: string;
1513
- runtimeVersion: 2 | 1;
1513
+ runtimeVersion: 1 | 2;
1514
1514
  title: string;
1515
1515
  presentation: {
1516
1516
  quiz?: {
@@ -1651,7 +1651,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
1651
1651
  }>;
1652
1652
  publishBatch: (releases: ReleaseInput[]) => Promise<{
1653
1653
  quest: string;
1654
- runtimeVersion: 2 | 1;
1654
+ runtimeVersion: 1 | 2;
1655
1655
  title: string;
1656
1656
  presentation: {
1657
1657
  quiz?: {
@@ -1858,7 +1858,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
1858
1858
  quest: string;
1859
1859
  member: string;
1860
1860
  evidence: string | null;
1861
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
1861
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
1862
1862
  reason: string | null;
1863
1863
  retries: number;
1864
1864
  generation: number;
@@ -2143,7 +2143,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
2143
2143
  quest: string;
2144
2144
  member: string;
2145
2145
  evidence: string | null;
2146
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
2146
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
2147
2147
  reason: string | null;
2148
2148
  retries: number;
2149
2149
  generation: number;
@@ -2185,7 +2185,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
2185
2185
  quest: string;
2186
2186
  member: string;
2187
2187
  evidence: string | null;
2188
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
2188
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
2189
2189
  reason: string | null;
2190
2190
  retries: number;
2191
2191
  generation: number;
@@ -2232,7 +2232,7 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
2232
2232
  quest: string;
2233
2233
  member: string;
2234
2234
  evidence: string | null;
2235
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
2235
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
2236
2236
  reason: string | null;
2237
2237
  retries: number;
2238
2238
  generation: number;
package/dist/browser.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  createRelayClient
3
- } from "./chunk-NC3UAP6T.js";
3
+ } from "./chunk-L757OYXZ.js";
4
+ import "./chunk-6IXQRMGW.js";
4
5
  import "./chunk-C2KOMNLG.js";
5
6
 
6
7
  // src/browser.ts
@@ -0,0 +1,37 @@
1
+ import {
2
+ identifier
3
+ } from "./chunk-C2KOMNLG.js";
4
+
5
+ // src/auth.ts
6
+ import { z } from "zod";
7
+ var authScopeSchema = z.object({
8
+ organization: identifier,
9
+ project: identifier,
10
+ environment: z.enum(["test", "live"])
11
+ }).strict();
12
+ var principalSchema = z.discriminatedUnion("kind", [
13
+ z.object({ kind: z.literal("member"), member: identifier }).strict(),
14
+ z.object({ kind: z.literal("staff"), subject: identifier }).strict(),
15
+ z.object({ kind: z.literal("operator"), subject: identifier }).strict()
16
+ ]);
17
+ var sessionSchema = authScopeSchema.extend({
18
+ id: identifier,
19
+ principal: principalSchema,
20
+ expiresAt: z.number()
21
+ });
22
+ var exchangeSchema = authScopeSchema.extend({
23
+ identity: z.object({ issuer: identifier, subject: z.string().min(1).max(200) }).strict(),
24
+ role: z.enum(["member", "staff", "operator"])
25
+ }).strict();
26
+ var exchangeResultSchema = z.object({
27
+ token: z.string(),
28
+ session: sessionSchema
29
+ });
30
+
31
+ export {
32
+ authScopeSchema,
33
+ principalSchema,
34
+ sessionSchema,
35
+ exchangeSchema,
36
+ exchangeResultSchema
37
+ };
@@ -1,3 +1,8 @@
1
+ import {
2
+ authScopeSchema,
3
+ exchangeResultSchema,
4
+ sessionSchema
5
+ } from "./chunk-6IXQRMGW.js";
1
6
  import {
2
7
  attemptSchema,
3
8
  entitlementSchema,
@@ -572,80 +577,54 @@ function observeProgress(transport, listener, options = {}, onDispose = () => {
572
577
  // src/index.ts
573
578
  import { z as z7 } from "zod";
574
579
 
575
- // src/auth.ts
576
- import { z as z3 } from "zod";
577
- var authScopeSchema = z3.object({
578
- organization: identifier,
579
- project: identifier,
580
- environment: z3.enum(["test", "live"])
581
- }).strict();
582
- var principalSchema = z3.discriminatedUnion("kind", [
583
- z3.object({ kind: z3.literal("member"), member: identifier }).strict(),
584
- z3.object({ kind: z3.literal("staff"), subject: identifier }).strict(),
585
- z3.object({ kind: z3.literal("operator"), subject: identifier }).strict()
586
- ]);
587
- var sessionSchema = authScopeSchema.extend({
588
- id: identifier,
589
- principal: principalSchema,
590
- expiresAt: z3.number()
591
- });
592
- var exchangeSchema = authScopeSchema.extend({
593
- identity: z3.object({ issuer: identifier, subject: z3.string().min(1).max(200) }).strict(),
594
- role: z3.enum(["member", "staff", "operator"])
595
- }).strict();
596
- var exchangeResultSchema = z3.object({
597
- token: z3.string(),
598
- session: sessionSchema
599
- });
600
-
601
580
  // src/wallet.ts
602
- import { z as z4 } from "zod";
603
- var solanaAddressSchema = z4.string().min(32).max(44).regex(/^[1-9A-HJ-NP-Za-km-z]+$/);
604
- var walletConnectionSchema = z4.object({
605
- chain: z4.literal("solana"),
581
+ import { z as z3 } from "zod";
582
+ var solanaAddressSchema = z3.string().min(32).max(44).regex(/^[1-9A-HJ-NP-Za-km-z]+$/);
583
+ var walletConnectionSchema = z3.object({
584
+ chain: z3.literal("solana"),
606
585
  address: solanaAddressSchema,
607
- verifiedAt: z4.number().int().nonnegative(),
608
- revision: z4.number().int().positive()
586
+ verifiedAt: z3.number().int().nonnegative(),
587
+ revision: z3.number().int().positive()
609
588
  }).strict();
610
- var walletChallengeInputSchema = z4.object({
611
- chain: z4.literal("solana"),
589
+ var walletChallengeInputSchema = z3.object({
590
+ chain: z3.literal("solana"),
612
591
  address: solanaAddressSchema
613
592
  }).strict();
614
593
  var walletChallengeSchema = walletChallengeInputSchema.extend({
615
- id: z4.string().uuid(),
616
- message: z4.string(),
617
- expiresAt: z4.number()
594
+ id: z3.string().uuid(),
595
+ message: z3.string(),
596
+ expiresAt: z3.number()
618
597
  });
619
- var walletProofSchema = z4.object({
620
- challenge: z4.string().uuid(),
621
- signature: z4.string().min(64).max(88).regex(/^[1-9A-HJ-NP-Za-km-z]+$/)
598
+ var walletProofSchema = z3.object({
599
+ challenge: z3.string().uuid(),
600
+ signature: z3.string().min(64).max(88).regex(/^[1-9A-HJ-NP-Za-km-z]+$/)
622
601
  }).strict();
623
- var solanaBalanceSchema = z4.object({
602
+ var solanaBalanceSchema = z3.object({
624
603
  address: solanaAddressSchema,
625
- network: z4.literal("mainnet-beta"),
626
- lamports: z4.string().regex(/^(0|[1-9][0-9]*)$/),
627
- slot: z4.number().int().nonnegative().safe(),
628
- observedAt: z4.number().int().nonnegative()
604
+ network: z3.literal("mainnet-beta"),
605
+ lamports: z3.string().regex(/^(0|[1-9][0-9]*)$/),
606
+ slot: z3.number().int().nonnegative().safe(),
607
+ observedAt: z3.number().int().nonnegative()
629
608
  }).strict();
630
609
 
631
610
  // src/collection.ts
632
- import { z as z5 } from "zod";
633
- var collectionCodeSchema = z5.string().regex(/^relay:collect:[a-f0-9]{64}$/);
634
- var collectionPassSchema = z5.object({
611
+ import { z as z4 } from "zod";
612
+ var collectionCodeSchema = z4.string().regex(/^relay:collect:[a-f0-9]{64}$/);
613
+ var collectionPassSchema = z4.object({
635
614
  code: collectionCodeSchema,
636
- expiresAt: z5.number(),
615
+ expiresAt: z4.number(),
637
616
  entitlement: identifier
638
617
  });
639
- var collectionResolveSchema = z5.object({ code: collectionCodeSchema }).strict();
618
+ var collectionResolveSchema = z4.object({ code: collectionCodeSchema }).strict();
640
619
  var collectionBeginSchema = collectionResolveSchema.extend({
641
620
  actionId: identifier,
642
- revision: z5.number().int().positive(),
621
+ revision: z4.number().int().positive(),
643
622
  selection: pickupSelectionSchema.optional()
644
623
  });
645
- var collectionPreviewSchema = z5.object({
624
+ var collectionPreviewSchema = z4.object({
646
625
  entitlement: entitlementSchema,
647
626
  inventory: pickupAvailabilitySchema,
648
- expiresAt: z5.number()
627
+ expiresAt: z4.number()
649
628
  });
650
629
 
651
630
  // src/configuration.ts
@@ -663,26 +642,51 @@ function questConfiguration(release) {
663
642
  }
664
643
 
665
644
  // src/deployments.ts
666
- import { z as z6 } from "zod";
645
+ import { z as z5 } from "zod";
667
646
  var projectDeploymentSchema = catalogDeploymentSchema.omit({ expectedRevision: true }).extend({
668
- releases: z6.array(releaseSchema).max(50).default([])
647
+ releases: z5.array(releaseSchema).max(50).default([])
669
648
  }).refine(
670
649
  (value) => value.releases.length > 0 || value.types.length > 0 || value.collections.length > 0 || value.supportedInteractions !== void 0,
671
650
  "No resources configured. Add quests, questTypes, collections, or supportedInteractions to relay.json."
672
651
  );
673
- var deploymentPreviewSchema = z6.object({
652
+ var deploymentPreviewSchema = z5.object({
674
653
  id: identifier,
675
- baseRevision: z6.number().int().nonnegative(),
676
- releases: z6.array(publishedReleaseSchema),
677
- types: z6.array(questTypeVersionSchema),
678
- collections: z6.array(questCollectionSchema),
679
- supportedInteractions: z6.array(interactionSchema)
654
+ baseRevision: z5.number().int().nonnegative(),
655
+ releases: z5.array(publishedReleaseSchema),
656
+ types: z5.array(questTypeVersionSchema),
657
+ collections: z5.array(questCollectionSchema),
658
+ supportedInteractions: z5.array(interactionSchema)
680
659
  });
681
- var publishDeploymentSchema = z6.object({ id: identifier }).strict();
660
+ var publishDeploymentSchema = z5.object({ id: identifier }).strict();
682
661
  var deploymentResultSchema = deploymentPreviewSchema.extend({
683
- revision: z6.number().int().positive()
662
+ revision: z5.number().int().positive()
684
663
  });
685
664
 
665
+ // src/identity-integration.ts
666
+ import { z as z6 } from "zod";
667
+ var identityIntegrationInputSchema = z6.object({
668
+ name: z6.string().trim().min(1).max(80),
669
+ origin: z6.string().url().refine((value) => {
670
+ const url = new URL(value);
671
+ return url.protocol === "https:" && url.origin === value;
672
+ }, "Use an exact HTTPS application origin")
673
+ }).strict();
674
+ var identityIntegrationSchema = authScopeSchema.extend({
675
+ id: z6.string().uuid(),
676
+ name: z6.string(),
677
+ origin: z6.string(),
678
+ expiresAt: z6.number()
679
+ });
680
+ var identityIntegrationSecretSchema = identityIntegrationSchema.extend(
681
+ {
682
+ token: z6.string()
683
+ }
684
+ );
685
+ var participantExchangeSchema = z6.object({
686
+ subject: z6.string().min(1).max(200),
687
+ previousToken: z6.string().max(200).optional()
688
+ }).strict();
689
+
686
690
  // src/index.ts
687
691
  function createRelayClient(options) {
688
692
  async function send(path, init = {}) {
@@ -904,6 +908,7 @@ function createRelayClient(options) {
904
908
  signOut: () => changeSession(
905
909
  () => request("/v1/auth/logout", z7.object({ ok: z7.boolean() }), json({}))
906
910
  ),
911
+ /** Local development only. Existing hosted apps use createParticipantBackend from /portal-proxy. */
907
912
  exchange: (input) => request("/v1/auth/exchange", exchangeResultSchema, json(input))
908
913
  },
909
914
  me: {
@@ -1031,11 +1036,6 @@ export {
1031
1036
  QuestUpdatedError,
1032
1037
  reconcileQuestDraft,
1033
1038
  questActions,
1034
- authScopeSchema,
1035
- principalSchema,
1036
- sessionSchema,
1037
- exchangeSchema,
1038
- exchangeResultSchema,
1039
1039
  solanaAddressSchema,
1040
1040
  walletConnectionSchema,
1041
1041
  walletChallengeInputSchema,
@@ -1052,5 +1052,9 @@ export {
1052
1052
  deploymentPreviewSchema,
1053
1053
  publishDeploymentSchema,
1054
1054
  deploymentResultSchema,
1055
+ identityIntegrationInputSchema,
1056
+ identityIntegrationSchema,
1057
+ identityIntegrationSecretSchema,
1058
+ participantExchangeSchema,
1055
1059
  createRelayClient
1056
1060
  };
package/dist/index.d.ts CHANGED
@@ -186,9 +186,9 @@ type ProgressObserver = {
186
186
  };
187
187
 
188
188
  declare const interactionSchema: z.ZodEnum<{
189
- staff: "staff";
190
189
  quiz: "quiz";
191
190
  photo: "photo";
191
+ staff: "staff";
192
192
  automatic: "automatic";
193
193
  claim: "claim";
194
194
  }>;
@@ -872,7 +872,7 @@ declare const questCatalogSchema: z.ZodObject<{
872
872
  createdAt: z.ZodNumber;
873
873
  }, z.core.$strip>, z.ZodTransform<{
874
874
  quest: string;
875
- runtimeVersion: 2 | 1;
875
+ runtimeVersion: 1 | 2;
876
876
  title: string;
877
877
  presentation: {
878
878
  quiz?: {
@@ -1043,9 +1043,9 @@ declare const questCatalogSchema: z.ZodObject<{
1043
1043
  createdAt: number;
1044
1044
  }>>]>>>;
1045
1045
  supportedInteractions: z.ZodArray<z.ZodEnum<{
1046
- staff: "staff";
1047
1046
  quiz: "quiz";
1048
1047
  photo: "photo";
1048
+ staff: "staff";
1049
1049
  automatic: "automatic";
1050
1050
  claim: "claim";
1051
1051
  }>>;
@@ -1067,9 +1067,9 @@ declare const catalogDeploymentSchema: z.ZodObject<{
1067
1067
  title: z.ZodString;
1068
1068
  }, z.core.$strict>>>;
1069
1069
  supportedInteractions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1070
- staff: "staff";
1071
1070
  quiz: "quiz";
1072
1071
  photo: "photo";
1072
+ staff: "staff";
1073
1073
  automatic: "automatic";
1074
1074
  claim: "claim";
1075
1075
  }>>>;
@@ -1212,9 +1212,9 @@ declare const catalogDeploymentPreviewSchema: z.ZodObject<{
1212
1212
  title: z.ZodString;
1213
1213
  }, z.core.$strict>>;
1214
1214
  supportedInteractions: z.ZodArray<z.ZodEnum<{
1215
- staff: "staff";
1216
1215
  quiz: "quiz";
1217
1216
  photo: "photo";
1217
+ staff: "staff";
1218
1218
  automatic: "automatic";
1219
1219
  claim: "claim";
1220
1220
  }>>;
@@ -1341,11 +1341,11 @@ declare const questViewSchema: z.ZodObject<{
1341
1341
  }, Record<string, string>>>;
1342
1342
  }, z.core.$strict>>;
1343
1343
  status: z.ZodEnum<{
1344
+ "needs-review": "needs-review";
1344
1345
  queued: "queued";
1345
1346
  evaluating: "evaluating";
1346
1347
  accepted: "accepted";
1347
1348
  rejected: "rejected";
1348
- "needs-review": "needs-review";
1349
1349
  failed: "failed";
1350
1350
  }>;
1351
1351
  reason: z.ZodNullable<z.ZodString>;
@@ -1378,9 +1378,9 @@ declare const questViewSchema: z.ZodObject<{
1378
1378
  }, z.core.$strip>>;
1379
1379
  release: z.ZodString;
1380
1380
  interaction: z.ZodEnum<{
1381
- staff: "staff";
1382
1381
  quiz: "quiz";
1383
1382
  photo: "photo";
1383
+ staff: "staff";
1384
1384
  automatic: "automatic";
1385
1385
  claim: "claim";
1386
1386
  }>;
@@ -1481,11 +1481,11 @@ declare const collectionViewSchema: z.ZodObject<{
1481
1481
  }, Record<string, string>>>;
1482
1482
  }, z.core.$strict>>;
1483
1483
  status: z.ZodEnum<{
1484
+ "needs-review": "needs-review";
1484
1485
  queued: "queued";
1485
1486
  evaluating: "evaluating";
1486
1487
  accepted: "accepted";
1487
1488
  rejected: "rejected";
1488
- "needs-review": "needs-review";
1489
1489
  failed: "failed";
1490
1490
  }>;
1491
1491
  reason: z.ZodNullable<z.ZodString>;
@@ -1518,9 +1518,9 @@ declare const collectionViewSchema: z.ZodObject<{
1518
1518
  }, z.core.$strip>>;
1519
1519
  release: z.ZodString;
1520
1520
  interaction: z.ZodEnum<{
1521
- staff: "staff";
1522
1521
  quiz: "quiz";
1523
1522
  photo: "photo";
1523
+ staff: "staff";
1524
1524
  automatic: "automatic";
1525
1525
  claim: "claim";
1526
1526
  }>;
@@ -1621,11 +1621,11 @@ declare const questExperienceSchema: z.ZodObject<{
1621
1621
  }, Record<string, string>>>;
1622
1622
  }, z.core.$strict>>;
1623
1623
  status: z.ZodEnum<{
1624
+ "needs-review": "needs-review";
1624
1625
  queued: "queued";
1625
1626
  evaluating: "evaluating";
1626
1627
  accepted: "accepted";
1627
1628
  rejected: "rejected";
1628
- "needs-review": "needs-review";
1629
1629
  failed: "failed";
1630
1630
  }>;
1631
1631
  reason: z.ZodNullable<z.ZodString>;
@@ -1658,9 +1658,9 @@ declare const questExperienceSchema: z.ZodObject<{
1658
1658
  }, z.core.$strip>>;
1659
1659
  release: z.ZodString;
1660
1660
  interaction: z.ZodEnum<{
1661
- staff: "staff";
1662
1661
  quiz: "quiz";
1663
1662
  photo: "photo";
1663
+ staff: "staff";
1664
1664
  automatic: "automatic";
1665
1665
  claim: "claim";
1666
1666
  }>;
@@ -1761,11 +1761,11 @@ declare const questExperienceSchema: z.ZodObject<{
1761
1761
  }, Record<string, string>>>;
1762
1762
  }, z.core.$strict>>;
1763
1763
  status: z.ZodEnum<{
1764
+ "needs-review": "needs-review";
1764
1765
  queued: "queued";
1765
1766
  evaluating: "evaluating";
1766
1767
  accepted: "accepted";
1767
1768
  rejected: "rejected";
1768
- "needs-review": "needs-review";
1769
1769
  failed: "failed";
1770
1770
  }>;
1771
1771
  reason: z.ZodNullable<z.ZodString>;
@@ -1798,9 +1798,9 @@ declare const questExperienceSchema: z.ZodObject<{
1798
1798
  }, z.core.$strip>>;
1799
1799
  release: z.ZodString;
1800
1800
  interaction: z.ZodEnum<{
1801
- staff: "staff";
1802
1801
  quiz: "quiz";
1803
1802
  photo: "photo";
1803
+ staff: "staff";
1804
1804
  automatic: "automatic";
1805
1805
  claim: "claim";
1806
1806
  }>;
@@ -2084,7 +2084,7 @@ declare const questPublicationPreviewSchema: z.ZodObject<{
2084
2084
  createdAt: z.ZodNumber;
2085
2085
  }, z.core.$strip>, z.ZodTransform<{
2086
2086
  quest: string;
2087
- runtimeVersion: 2 | 1;
2087
+ runtimeVersion: 1 | 2;
2088
2088
  title: string;
2089
2089
  presentation: {
2090
2090
  quiz?: {
@@ -2442,9 +2442,9 @@ declare const projectDeploymentSchema: z.ZodObject<{
2442
2442
  }>;
2443
2443
  }, z.core.$strip>>>;
2444
2444
  supportedInteractions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2445
- staff: "staff";
2446
2445
  quiz: "quiz";
2447
2446
  photo: "photo";
2447
+ staff: "staff";
2448
2448
  automatic: "automatic";
2449
2449
  claim: "claim";
2450
2450
  }>>>;
@@ -2669,7 +2669,7 @@ declare const deploymentPreviewSchema: z.ZodObject<{
2669
2669
  createdAt: z.ZodNumber;
2670
2670
  }, z.core.$strip>, z.ZodTransform<{
2671
2671
  quest: string;
2672
- runtimeVersion: 2 | 1;
2672
+ runtimeVersion: 1 | 2;
2673
2673
  title: string;
2674
2674
  presentation: {
2675
2675
  quiz?: {
@@ -2976,9 +2976,9 @@ declare const deploymentPreviewSchema: z.ZodObject<{
2976
2976
  quests: z.ZodArray<z.ZodString>;
2977
2977
  }, z.core.$strict>>;
2978
2978
  supportedInteractions: z.ZodArray<z.ZodEnum<{
2979
- staff: "staff";
2980
2979
  quiz: "quiz";
2981
2980
  photo: "photo";
2981
+ staff: "staff";
2982
2982
  automatic: "automatic";
2983
2983
  claim: "claim";
2984
2984
  }>>;
@@ -3185,7 +3185,7 @@ declare const deploymentResultSchema: z.ZodObject<{
3185
3185
  createdAt: z.ZodNumber;
3186
3186
  }, z.core.$strip>, z.ZodTransform<{
3187
3187
  quest: string;
3188
- runtimeVersion: 2 | 1;
3188
+ runtimeVersion: 1 | 2;
3189
3189
  title: string;
3190
3190
  presentation: {
3191
3191
  quiz?: {
@@ -3492,9 +3492,9 @@ declare const deploymentResultSchema: z.ZodObject<{
3492
3492
  quests: z.ZodArray<z.ZodString>;
3493
3493
  }, z.core.$strict>>;
3494
3494
  supportedInteractions: z.ZodArray<z.ZodEnum<{
3495
- staff: "staff";
3496
3495
  quiz: "quiz";
3497
3496
  photo: "photo";
3497
+ staff: "staff";
3498
3498
  automatic: "automatic";
3499
3499
  claim: "claim";
3500
3500
  }>>;
@@ -3502,6 +3502,40 @@ declare const deploymentResultSchema: z.ZodObject<{
3502
3502
  }, z.core.$strip>;
3503
3503
  type DeploymentPreview = z.infer<typeof deploymentPreviewSchema>;
3504
3504
 
3505
+ declare const identityIntegrationInputSchema: z.ZodObject<{
3506
+ name: z.ZodString;
3507
+ origin: z.ZodString;
3508
+ }, z.core.$strict>;
3509
+ declare const identityIntegrationSchema: z.ZodObject<{
3510
+ organization: z.ZodString;
3511
+ project: z.ZodString;
3512
+ environment: z.ZodEnum<{
3513
+ test: "test";
3514
+ live: "live";
3515
+ }>;
3516
+ id: z.ZodString;
3517
+ name: z.ZodString;
3518
+ origin: z.ZodString;
3519
+ expiresAt: z.ZodNumber;
3520
+ }, z.core.$strict>;
3521
+ declare const identityIntegrationSecretSchema: z.ZodObject<{
3522
+ organization: z.ZodString;
3523
+ project: z.ZodString;
3524
+ environment: z.ZodEnum<{
3525
+ test: "test";
3526
+ live: "live";
3527
+ }>;
3528
+ id: z.ZodString;
3529
+ name: z.ZodString;
3530
+ origin: z.ZodString;
3531
+ expiresAt: z.ZodNumber;
3532
+ token: z.ZodString;
3533
+ }, z.core.$strict>;
3534
+ declare const participantExchangeSchema: z.ZodObject<{
3535
+ subject: z.ZodString;
3536
+ previousToken: z.ZodOptional<z.ZodString>;
3537
+ }, z.core.$strict>;
3538
+
3505
3539
  declare function createRelayClient(options: {
3506
3540
  baseUrl: string;
3507
3541
  token?: string;
@@ -3577,7 +3611,7 @@ declare function createRelayClient(options: {
3577
3611
  quest: string;
3578
3612
  member: string;
3579
3613
  evidence: string | null;
3580
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
3614
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
3581
3615
  reason: string | null;
3582
3616
  retries: number;
3583
3617
  generation: number;
@@ -3614,7 +3648,7 @@ declare function createRelayClient(options: {
3614
3648
  } | undefined;
3615
3649
  } | null;
3616
3650
  release: string;
3617
- interaction: "staff" | "quiz" | "photo" | "automatic" | "claim";
3651
+ interaction: "quiz" | "photo" | "staff" | "automatic" | "claim";
3618
3652
  lifecycle: "active" | "paused" | "archived";
3619
3653
  rewards: {
3620
3654
  label: string;
@@ -3626,7 +3660,7 @@ declare function createRelayClient(options: {
3626
3660
  quest: string;
3627
3661
  member: string;
3628
3662
  evidence: string | null;
3629
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
3663
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
3630
3664
  reason: string | null;
3631
3665
  retries: number;
3632
3666
  generation: number;
@@ -3730,7 +3764,7 @@ declare function createRelayClient(options: {
3730
3764
  quest: string;
3731
3765
  member: string;
3732
3766
  evidence: string | null;
3733
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
3767
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
3734
3768
  reason: string | null;
3735
3769
  retries: number;
3736
3770
  generation: number;
@@ -3767,7 +3801,7 @@ declare function createRelayClient(options: {
3767
3801
  } | undefined;
3768
3802
  } | null;
3769
3803
  release: string;
3770
- interaction: "staff" | "quiz" | "photo" | "automatic" | "claim";
3804
+ interaction: "quiz" | "photo" | "staff" | "automatic" | "claim";
3771
3805
  lifecycle: "active" | "paused" | "archived";
3772
3806
  rewards: {
3773
3807
  label: string;
@@ -3842,7 +3876,7 @@ declare function createRelayClient(options: {
3842
3876
  quest: string;
3843
3877
  member: string;
3844
3878
  evidence: string | null;
3845
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
3879
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
3846
3880
  reason: string | null;
3847
3881
  retries: number;
3848
3882
  generation: number;
@@ -3879,7 +3913,7 @@ declare function createRelayClient(options: {
3879
3913
  } | undefined;
3880
3914
  } | null;
3881
3915
  release: string;
3882
- interaction: "staff" | "quiz" | "photo" | "automatic" | "claim";
3916
+ interaction: "quiz" | "photo" | "staff" | "automatic" | "claim";
3883
3917
  lifecycle: "active" | "paused" | "archived";
3884
3918
  rewards: {
3885
3919
  label: string;
@@ -3956,7 +3990,7 @@ declare function createRelayClient(options: {
3956
3990
  quest: string;
3957
3991
  member: string;
3958
3992
  evidence: string | null;
3959
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
3993
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
3960
3994
  reason: string | null;
3961
3995
  retries: number;
3962
3996
  generation: number;
@@ -3993,7 +4027,7 @@ declare function createRelayClient(options: {
3993
4027
  } | undefined;
3994
4028
  } | null;
3995
4029
  release: string;
3996
- interaction: "staff" | "quiz" | "photo" | "automatic" | "claim";
4030
+ interaction: "quiz" | "photo" | "staff" | "automatic" | "claim";
3997
4031
  lifecycle: "active" | "paused" | "archived";
3998
4032
  rewards: {
3999
4033
  label: string;
@@ -4101,6 +4135,7 @@ declare function createRelayClient(options: {
4101
4135
  signOut: () => Promise<{
4102
4136
  ok: boolean;
4103
4137
  }>;
4138
+ /** Local development only. Existing hosted apps use createParticipantBackend from /portal-proxy. */
4104
4139
  exchange: (input: ExchangeInput) => Promise<{
4105
4140
  token: string;
4106
4141
  session: {
@@ -4155,7 +4190,7 @@ declare function createRelayClient(options: {
4155
4190
  quest: string;
4156
4191
  member: string;
4157
4192
  evidence: string | null;
4158
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
4193
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
4159
4194
  reason: string | null;
4160
4195
  retries: number;
4161
4196
  generation: number;
@@ -4259,7 +4294,7 @@ declare function createRelayClient(options: {
4259
4294
  quest: string;
4260
4295
  member: string;
4261
4296
  evidence: string | null;
4262
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
4297
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
4263
4298
  reason: string | null;
4264
4299
  retries: number;
4265
4300
  generation: number;
@@ -4383,7 +4418,7 @@ declare function createRelayClient(options: {
4383
4418
  quest: string;
4384
4419
  member: string;
4385
4420
  evidence: string | null;
4386
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
4421
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
4387
4422
  reason: string | null;
4388
4423
  retries: number;
4389
4424
  generation: number;
@@ -4437,7 +4472,7 @@ declare function createRelayClient(options: {
4437
4472
  quest: string;
4438
4473
  member: string;
4439
4474
  evidence: string | null;
4440
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
4475
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
4441
4476
  reason: string | null;
4442
4477
  retries: number;
4443
4478
  generation: number;
@@ -4507,7 +4542,7 @@ declare function createRelayClient(options: {
4507
4542
  code: string;
4508
4543
  definition: {
4509
4544
  quest: string;
4510
- runtimeVersion: 2 | 1;
4545
+ runtimeVersion: 1 | 2;
4511
4546
  title: string;
4512
4547
  presentation: {
4513
4548
  quiz?: {
@@ -4621,7 +4656,7 @@ declare function createRelayClient(options: {
4621
4656
  code: string;
4622
4657
  definition: {
4623
4658
  quest: string;
4624
- runtimeVersion: 2 | 1;
4659
+ runtimeVersion: 1 | 2;
4625
4660
  title: string;
4626
4661
  presentation: {
4627
4662
  quiz?: {
@@ -4734,7 +4769,7 @@ declare function createRelayClient(options: {
4734
4769
  snapshot: () => Promise<{
4735
4770
  releases: {
4736
4771
  quest: string;
4737
- runtimeVersion: 2 | 1;
4772
+ runtimeVersion: 1 | 2;
4738
4773
  title: string;
4739
4774
  presentation: {
4740
4775
  quiz?: {
@@ -4961,7 +4996,7 @@ declare function createRelayClient(options: {
4961
4996
  quest: string;
4962
4997
  member: string;
4963
4998
  evidence: string | null;
4964
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
4999
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
4965
5000
  reason: string | null;
4966
5001
  retries: number;
4967
5002
  generation: number;
@@ -5015,7 +5050,7 @@ declare function createRelayClient(options: {
5015
5050
  }>;
5016
5051
  publish: (release: ReleaseInput) => Promise<{
5017
5052
  quest: string;
5018
- runtimeVersion: 2 | 1;
5053
+ runtimeVersion: 1 | 2;
5019
5054
  title: string;
5020
5055
  presentation: {
5021
5056
  quiz?: {
@@ -5156,7 +5191,7 @@ declare function createRelayClient(options: {
5156
5191
  }>;
5157
5192
  publishBatch: (releases: ReleaseInput[]) => Promise<{
5158
5193
  quest: string;
5159
- runtimeVersion: 2 | 1;
5194
+ runtimeVersion: 1 | 2;
5160
5195
  title: string;
5161
5196
  presentation: {
5162
5197
  quiz?: {
@@ -5363,7 +5398,7 @@ declare function createRelayClient(options: {
5363
5398
  quest: string;
5364
5399
  member: string;
5365
5400
  evidence: string | null;
5366
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
5401
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
5367
5402
  reason: string | null;
5368
5403
  retries: number;
5369
5404
  generation: number;
@@ -5648,7 +5683,7 @@ declare function createRelayClient(options: {
5648
5683
  quest: string;
5649
5684
  member: string;
5650
5685
  evidence: string | null;
5651
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
5686
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
5652
5687
  reason: string | null;
5653
5688
  retries: number;
5654
5689
  generation: number;
@@ -5690,7 +5725,7 @@ declare function createRelayClient(options: {
5690
5725
  quest: string;
5691
5726
  member: string;
5692
5727
  evidence: string | null;
5693
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
5728
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
5694
5729
  reason: string | null;
5695
5730
  retries: number;
5696
5731
  generation: number;
@@ -5737,7 +5772,7 @@ declare function createRelayClient(options: {
5737
5772
  quest: string;
5738
5773
  member: string;
5739
5774
  evidence: string | null;
5740
- status: "queued" | "evaluating" | "accepted" | "rejected" | "needs-review" | "failed";
5775
+ status: "needs-review" | "queued" | "evaluating" | "accepted" | "rejected" | "failed";
5741
5776
  reason: string | null;
5742
5777
  retries: number;
5743
5778
  generation: number;
@@ -5775,4 +5810,4 @@ declare function createRelayClient(options: {
5775
5810
  }>;
5776
5811
  };
5777
5812
 
5778
- export { Attempt, type ClaimSubmission, type CollectionPass, type DeploymentPreview, type ExchangeInput, MemberListOptions, MemberProgress, type PhotoSubmission, type ProgressObservation, type ProgressObserver, PublishedRelease, type QuestActionResult, type QuestCatalog, type QuestController, type QuestDraft, type QuestInstance, type QuestInteraction, QuestUpdatedError, type QuestView, QuizEvidence, type QuizSubmission, RelayError, ReleaseInput, ReviewListOptions, type Session, type SubmissionDraft, type SubmissionStatus, type SubmissionStore, SubmitInput, authScopeSchema, beginHandoverSchema, catalogDeploymentPreviewSchema, catalogDeploymentSchema, collectionBeginSchema, collectionCodeSchema, collectionPassSchema, collectionPreviewSchema, collectionResolveSchema, collectionSlotSchema, collectionViewSchema, createRelayClient, deploymentPreviewSchema, deploymentResultSchema, errorSchema, exchangeResultSchema, exchangeSchema, interactionSchema, principalSchema, projectDeploymentSchema, publishDeploymentSchema, publishQuestDraftSchema, questActions, questCatalogSchema, questCollectionSchema, questConfiguration, questDescriptionSchema, questDraftChangesSchema, questDraftSchema, questExperienceSchema, questInstanceSchema, questInteraction, questPublicationPreviewSchema, questTypeVersionSchema, questViewSchema, reconcileQuestDraft, saveQuestDraftSchema, sessionSchema, walletChallengeInputSchema, walletProofSchema };
5813
+ export { Attempt, type ClaimSubmission, type CollectionPass, type DeploymentPreview, type ExchangeInput, MemberListOptions, MemberProgress, type PhotoSubmission, type ProgressObservation, type ProgressObserver, PublishedRelease, type QuestActionResult, type QuestCatalog, type QuestController, type QuestDraft, type QuestInstance, type QuestInteraction, QuestUpdatedError, type QuestView, QuizEvidence, type QuizSubmission, RelayError, ReleaseInput, ReviewListOptions, type Session, type SubmissionDraft, type SubmissionStatus, type SubmissionStore, SubmitInput, authScopeSchema, beginHandoverSchema, catalogDeploymentPreviewSchema, catalogDeploymentSchema, collectionBeginSchema, collectionCodeSchema, collectionPassSchema, collectionPreviewSchema, collectionResolveSchema, collectionSlotSchema, collectionViewSchema, createRelayClient, deploymentPreviewSchema, deploymentResultSchema, errorSchema, exchangeResultSchema, exchangeSchema, identityIntegrationInputSchema, identityIntegrationSchema, identityIntegrationSecretSchema, interactionSchema, participantExchangeSchema, principalSchema, projectDeploymentSchema, publishDeploymentSchema, publishQuestDraftSchema, questActions, questCatalogSchema, questCollectionSchema, questConfiguration, questDescriptionSchema, questDraftChangesSchema, questDraftSchema, questExperienceSchema, questInstanceSchema, questInteraction, questPublicationPreviewSchema, questTypeVersionSchema, questViewSchema, reconcileQuestDraft, saveQuestDraftSchema, sessionSchema, walletChallengeInputSchema, walletProofSchema };
package/dist/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  QuestUpdatedError,
3
3
  RelayError,
4
- authScopeSchema,
5
4
  catalogDeploymentPreviewSchema,
6
5
  catalogDeploymentSchema,
7
6
  collectionBeginSchema,
@@ -14,10 +13,11 @@ import {
14
13
  createRelayClient,
15
14
  deploymentPreviewSchema,
16
15
  deploymentResultSchema,
17
- exchangeResultSchema,
18
- exchangeSchema,
16
+ identityIntegrationInputSchema,
17
+ identityIntegrationSchema,
18
+ identityIntegrationSecretSchema,
19
19
  interactionSchema,
20
- principalSchema,
20
+ participantExchangeSchema,
21
21
  projectDeploymentSchema,
22
22
  publishDeploymentSchema,
23
23
  publishQuestDraftSchema,
@@ -35,14 +35,20 @@ import {
35
35
  questViewSchema,
36
36
  reconcileQuestDraft,
37
37
  saveQuestDraftSchema,
38
- sessionSchema,
39
38
  solanaAddressSchema,
40
39
  solanaBalanceSchema,
41
40
  walletChallengeInputSchema,
42
41
  walletChallengeSchema,
43
42
  walletConnectionSchema,
44
43
  walletProofSchema
45
- } from "./chunk-NC3UAP6T.js";
44
+ } from "./chunk-L757OYXZ.js";
45
+ import {
46
+ authScopeSchema,
47
+ exchangeResultSchema,
48
+ exchangeSchema,
49
+ principalSchema,
50
+ sessionSchema
51
+ } from "./chunk-6IXQRMGW.js";
46
52
  import {
47
53
  artifactSchema,
48
54
  attemptSchema,
@@ -134,12 +140,16 @@ export {
134
140
  exchangeResultSchema,
135
141
  exchangeSchema,
136
142
  identifier,
143
+ identityIntegrationInputSchema,
144
+ identityIntegrationSchema,
145
+ identityIntegrationSecretSchema,
137
146
  interactionSchema,
138
147
  mediaUrlSchema,
139
148
  memberListSchema,
140
149
  memberPageSchema,
141
150
  memberProgressSchema,
142
151
  parseSettings,
152
+ participantExchangeSchema,
143
153
  photoResultSchema,
144
154
  pickupAllocationSchema,
145
155
  pickupAvailabilitySchema,
@@ -1,7 +1,22 @@
1
- /** Server-only proxy: browser cookies stay on the participant origin. */
1
+ /**
2
+ * Server-only proxy: browser cookies stay on the participant origin.
3
+ * Point upstream at a participant deployment with trusted server scope configured.
4
+ * Browser Authorization and organization/project/environment selectors are discarded.
5
+ * This does not provide backend identity exchange or configure upstream scope.
6
+ */
2
7
  declare function proxyParticipant(request: Request, upstream: {
3
8
  baseUrl: string;
4
9
  fetch: typeof fetch;
5
10
  }): Promise<Response>;
11
+ /** Use only in an app server route. authenticate must verify the app's own session. */
12
+ declare function createParticipantBackend(options: {
13
+ baseUrl: string;
14
+ integrationKey: string;
15
+ origin: string;
16
+ authenticate: (request: Request) => Promise<{
17
+ subject: string;
18
+ } | null>;
19
+ fetch?: typeof fetch;
20
+ }): (request: Request) => Promise<Response>;
6
21
 
7
- export { proxyParticipant };
22
+ export { createParticipantBackend, proxyParticipant };
@@ -1,3 +1,8 @@
1
+ import {
2
+ exchangeResultSchema
3
+ } from "./chunk-6IXQRMGW.js";
4
+ import "./chunk-C2KOMNLG.js";
5
+
1
6
  // src/portal-proxy.ts
2
7
  async function proxyParticipant(request, upstream) {
3
8
  const incoming = new URL(request.url);
@@ -43,6 +48,74 @@ async function proxyParticipant(request, upstream) {
43
48
  headers: resultHeaders
44
49
  });
45
50
  }
51
+ function createParticipantBackend(options) {
52
+ const origin = new URL(options.origin);
53
+ const base = new URL(options.baseUrl);
54
+ if (origin.protocol !== "https:" || origin.origin !== options.origin || base.protocol !== "https:" || base.origin !== options.baseUrl)
55
+ throw new Error(
56
+ "Configure exact HTTPS application and participant API origins"
57
+ );
58
+ if (!options.integrationKey.startsWith("di_"))
59
+ throw new Error(
60
+ "Use an identity integration server key from Console Settings"
61
+ );
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}`;
64
+ return async (request) => {
65
+ const url = new URL(request.url);
66
+ const reject = (error, status) => Response.json(
67
+ { error },
68
+ { status, headers: { "Cache-Control": "no-store" } }
69
+ );
70
+ if (url.origin !== options.origin)
71
+ return reject("Unexpected application origin", 403);
72
+ if (request.method !== "GET" && (request.headers.get("Origin") !== options.origin || request.headers.get("X-Relay-CSRF") !== "1"))
73
+ return reject("Untrusted browser request", 403);
74
+ const identity = await options.authenticate(request);
75
+ if (!identity)
76
+ return Response.json(
77
+ url.pathname === "/relay/v1/auth/session" ? null : { error: "Sign in to the application" },
78
+ {
79
+ status: url.pathname === "/relay/v1/auth/session" ? 200 : 401,
80
+ headers: { "Set-Cookie": cookie(""), "Cache-Control": "no-store" }
81
+ }
82
+ );
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
+ const exchanged = await send(options.baseUrl + "/v1/auth/exchange", {
85
+ method: "POST",
86
+ redirect: "error",
87
+ headers: {
88
+ Authorization: "Bearer " + options.integrationKey,
89
+ "Content-Type": "application/json"
90
+ },
91
+ body: JSON.stringify({ subject: identity.subject, previousToken })
92
+ });
93
+ if (!exchanged.ok)
94
+ return reject(
95
+ "Domino identity exchange failed. Check the server integration key and its expiry in Console Settings.",
96
+ exchanged.status
97
+ );
98
+ const { token } = exchangeResultSchema.parse(await exchanged.json());
99
+ const response = await proxyParticipant(request, {
100
+ baseUrl: options.baseUrl,
101
+ fetch: async (target, init) => {
102
+ const headers2 = new Headers(init?.headers);
103
+ headers2.delete("Cookie");
104
+ headers2.set("Authorization", "Bearer " + token);
105
+ headers2.set("X-Relay-Integration-Key", options.integrationKey);
106
+ headers2.set("Origin", options.origin);
107
+ return send(target, { ...init, headers: headers2, redirect: "error" });
108
+ }
109
+ });
110
+ const headers = new Headers(response.headers);
111
+ headers.set(
112
+ "Set-Cookie",
113
+ cookie(url.pathname === "/relay/v1/auth/logout" ? "" : token)
114
+ );
115
+ return new Response(response.body, { status: response.status, headers });
116
+ };
117
+ }
46
118
  export {
119
+ createParticipantBackend,
47
120
  proxyParticipant
48
121
  };
package/dist/schema.d.ts CHANGED
@@ -71,8 +71,8 @@ declare const triggerSchema: z.ZodUnion<readonly [z.ZodObject<{
71
71
  none: "none";
72
72
  }>;
73
73
  actor: z.ZodOptional<z.ZodEnum<{
74
- member: "member";
75
74
  staff: "staff";
75
+ member: "member";
76
76
  }>>;
77
77
  }, z.core.$strict>, z.ZodObject<{
78
78
  kind: z.ZodLiteral<"automatic">;
@@ -299,8 +299,8 @@ declare const questDescriptionSchema: z.ZodObject<{
299
299
  none: "none";
300
300
  }>;
301
301
  actor: z.ZodOptional<z.ZodEnum<{
302
- member: "member";
303
302
  staff: "staff";
303
+ member: "member";
304
304
  }>>;
305
305
  }, z.core.$strict>, z.ZodObject<{
306
306
  kind: z.ZodLiteral<"automatic">;
@@ -481,8 +481,8 @@ declare const publishedReleaseSchema: z.ZodUnion<readonly [z.ZodObject<{
481
481
  none: "none";
482
482
  }>;
483
483
  actor: z.ZodOptional<z.ZodEnum<{
484
- member: "member";
485
484
  staff: "staff";
485
+ member: "member";
486
486
  }>>;
487
487
  }, z.core.$strict>, z.ZodObject<{
488
488
  kind: z.ZodLiteral<"automatic">;
@@ -670,7 +670,7 @@ declare const publishedReleaseSchema: z.ZodUnion<readonly [z.ZodObject<{
670
670
  trigger: {
671
671
  kind: "manual";
672
672
  input: "photo" | "quiz" | "none";
673
- actor?: "member" | "staff" | undefined;
673
+ actor?: "staff" | "member" | undefined;
674
674
  } | {
675
675
  kind: "automatic";
676
676
  };
@@ -850,8 +850,8 @@ declare const templateSchema: z.ZodObject<{
850
850
  none: "none";
851
851
  }>;
852
852
  actor: z.ZodOptional<z.ZodEnum<{
853
- member: "member";
854
853
  staff: "staff";
854
+ member: "member";
855
855
  }>>;
856
856
  }, z.core.$strict>, z.ZodObject<{
857
857
  kind: z.ZodLiteral<"automatic">;
@@ -1187,8 +1187,8 @@ declare const memberProgressSchema: z.ZodObject<{
1187
1187
  none: "none";
1188
1188
  }>;
1189
1189
  actor: z.ZodOptional<z.ZodEnum<{
1190
- member: "member";
1191
1190
  staff: "staff";
1191
+ member: "member";
1192
1192
  }>>;
1193
1193
  }, z.core.$strict>, z.ZodObject<{
1194
1194
  kind: z.ZodLiteral<"automatic">;
@@ -1460,8 +1460,8 @@ declare const snapshotSchema: z.ZodObject<{
1460
1460
  none: "none";
1461
1461
  }>;
1462
1462
  actor: z.ZodOptional<z.ZodEnum<{
1463
- member: "member";
1464
1463
  staff: "staff";
1464
+ member: "member";
1465
1465
  }>>;
1466
1466
  }, z.core.$strict>, z.ZodObject<{
1467
1467
  kind: z.ZodLiteral<"automatic">;
@@ -1649,7 +1649,7 @@ declare const snapshotSchema: z.ZodObject<{
1649
1649
  trigger: {
1650
1650
  kind: "manual";
1651
1651
  input: "photo" | "quiz" | "none";
1652
- actor?: "member" | "staff" | undefined;
1652
+ actor?: "staff" | "member" | undefined;
1653
1653
  } | {
1654
1654
  kind: "automatic";
1655
1655
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domino-sdk/relay",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {