@domino-sdk/relay 1.62.0 → 1.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +145 -0
  2. package/dist/{accounts-CCqCKCVx.d.ts → accounts-_lNsiR2k.d.ts} +42 -4
  3. package/dist/{attempt-captures-Cm-5G0PC.d.ts → attempt-captures-BqPggxTU.d.ts} +1 -1
  4. package/dist/authoring.d.ts +54 -20
  5. package/dist/authoring.js +60 -31
  6. package/dist/{automatic-outcomes-pAsOyIVp.d.ts → automatic-outcomes-BzAvfcpd.d.ts} +11 -1
  7. package/dist/avatar.d.ts +1 -1
  8. package/dist/browser.d.ts +10 -10
  9. package/dist/browser.js +12 -13
  10. package/dist/capability-error-CuI_F7yM.d.ts +296 -0
  11. package/dist/{catalog--ZIlskAo.d.ts → catalog-ByZMRS7I.d.ts} +21 -10
  12. package/dist/{chunk-XNKSSE32.js → chunk-4NIV4NPV.js} +7 -7
  13. package/dist/chunk-7H4MRVQF.js +199 -0
  14. package/dist/{chunk-UPQPUJOU.js → chunk-CVQZ2YP7.js} +73 -202
  15. package/dist/{chunk-3PYYGFSB.js → chunk-DLABJSBO.js} +3 -3
  16. package/dist/{chunk-Y322OTCH.js → chunk-E22XSC4L.js} +1 -1
  17. package/dist/{chunk-E6IKQHTX.js → chunk-EDNKKVGU.js} +2 -2
  18. package/dist/{chunk-K2KS3JLY.js → chunk-EOUEAOWJ.js} +35 -4
  19. package/dist/{chunk-6WCIWXUV.js → chunk-EUEW2APU.js} +2 -2
  20. package/dist/{chunk-MK425RXJ.js → chunk-HNR6G3GV.js} +2335 -1538
  21. package/dist/{chunk-UW5232GG.js → chunk-KCUUHT2V.js} +5 -5
  22. package/dist/{chunk-CICDIBOF.js → chunk-MPTE7EIV.js} +76 -74
  23. package/dist/{chunk-4OC7REYX.js → chunk-MWMCQLCG.js} +3 -3
  24. package/dist/{chunk-GTDW453U.js → chunk-NG4GZ54I.js} +100 -114
  25. package/dist/chunk-R2KZFX6E.js +405 -0
  26. package/dist/{chunk-HTZHBTIL.js → chunk-RD3XJ4DH.js} +208 -376
  27. package/dist/{chunk-5TEYFX6X.js → chunk-SE7XHQFP.js} +2 -2
  28. package/dist/{chunk-CZFXGGEK.js → chunk-U66GUVSG.js} +2 -2
  29. package/dist/{chunk-KDR2VAJP.js → chunk-UYVJZR33.js} +2 -2
  30. package/dist/chunk-UZ765UGH.js +18 -0
  31. package/dist/{chunk-GKIFABGN.js → chunk-VBYOAT46.js} +100 -277
  32. package/dist/{chunk-QYPMPWVX.js → chunk-XVZ4YOF2.js} +43 -43
  33. package/dist/{chunk-3KLC4AMA.js → chunk-ZQ3IPCI6.js} +177 -176
  34. package/dist/chunk-ZXGBDLVB.js +1510 -0
  35. package/dist/{client-B-hbHX30.d.ts → client-D7IiwEq2.d.ts} +31 -62
  36. package/dist/{capability-error-DFMwSuSf.d.ts → dashboards-pVfclkyh.d.ts} +14 -294
  37. package/dist/{deployments-M4OHn7G3.d.ts → deployments-Cr1tfqrr.d.ts} +46 -3
  38. package/dist/{identity-integration-3mX6b5iH.d.ts → identity-integration-Ci2vGKtX.d.ts} +67 -2
  39. package/dist/index.d.ts +11 -11
  40. package/dist/index.js +11 -13
  41. package/dist/internal.d.ts +27 -13
  42. package/dist/internal.js +46 -13
  43. package/dist/{analytics-BwAKLi7O.d.ts → limits-pE04y9O2.d.ts} +131 -3
  44. package/dist/{offers-DhAtss4_.d.ts → offers-Hw2P6tcK.d.ts} +3 -2
  45. package/dist/{participant-activity-D-Drp24G.d.ts → participant-activity-DXRq4s6K.d.ts} +1 -0
  46. package/dist/portal-proxy.d.ts +21 -3
  47. package/dist/portal-proxy.js +72 -22
  48. package/dist/react/index.d.ts +29 -15
  49. package/dist/react/index.js +52 -29
  50. package/dist/{pages-B8q8Y_dQ.d.ts → reward-deliveries-BCV8hznc.d.ts} +300 -233
  51. package/dist/runtime/authoring.js +1 -1
  52. package/dist/runtime/chunks/6EBN6IZU.js +1 -0
  53. package/dist/runtime/manifest.json +3 -3
  54. package/dist/runtime/schema.js +1 -1
  55. package/dist/schema.d.ts +197 -19
  56. package/dist/schema.js +126 -124
  57. package/dist/server/index.d.ts +13 -13
  58. package/dist/server/index.js +5701 -6302
  59. package/dist/{sign-in-providers-BkjcDsFF.d.ts → sign-in-providers-BAkGjSXo.d.ts} +7 -2
  60. package/dist/{submission-input-DHGKhXfp.d.ts → submission-input-ChL1aYNH.d.ts} +3 -2
  61. package/dist/{telegram-browser-BCE7zdOb.d.ts → telegram-browser-K27t4TwM.d.ts} +5 -5
  62. package/dist/telegram.d.ts +9 -9
  63. package/dist/telegram.js +2 -2
  64. package/dist/testing.d.ts +229 -27
  65. package/dist/testing.js +146 -105
  66. package/dist/{tracker-data-Hb1uQnk5.d.ts → tracker-data-Bl-qPIvZ.d.ts} +37 -9
  67. package/dist/{transport-DkhX2Cbs.d.ts → transport-DC1m73Tp.d.ts} +40211 -37736
  68. package/dist/{wallet-DTO7SXj7.d.ts → wallet-B7e06v4m.d.ts} +14 -4
  69. package/package.json +1 -1
  70. package/dist/chunk-D26YNACF.js +0 -320
  71. package/dist/chunk-UAKYDVT3.js +0 -565
  72. package/dist/chunk-WSBYWVTZ.js +0 -717
  73. package/dist/chunk-XJFYAXET.js +0 -87
  74. package/dist/runtime/chunks/Y4OAVXFR.js +0 -1
package/dist/internal.js CHANGED
@@ -4,72 +4,102 @@ import {
4
4
  managementTransport,
5
5
  questConfiguration,
6
6
  sequenceCursorSchema
7
- } from "./chunk-UPQPUJOU.js";
7
+ } from "./chunk-CVQZ2YP7.js";
8
8
  import {
9
9
  parseImageExtraction,
10
10
  parseImageResult
11
- } from "./chunk-E6IKQHTX.js";
12
- import "./chunk-QYPMPWVX.js";
11
+ } from "./chunk-EDNKKVGU.js";
13
12
  import {
14
13
  sourceDataSchema,
15
14
  sourceRoles,
16
15
  validateQuestShape
17
- } from "./chunk-5TEYFX6X.js";
16
+ } from "./chunk-SE7XHQFP.js";
17
+ import {
18
+ bareOrigin,
19
+ loopbackHosts,
20
+ secureOrLoopbackOrigin
21
+ } from "./chunk-UZ765UGH.js";
18
22
  import {
19
23
  accountVouchedBySchema,
20
24
  identityIntegrationAccountVouchingInputSchema,
25
+ identityIntegrationAppSecretSchema,
21
26
  identityIntegrationInputSchema,
27
+ identityIntegrationKeySchema,
22
28
  identityIntegrationSchema,
23
29
  identityIntegrationSecretSchema,
24
30
  identityKindClaimSchema,
31
+ nextScheduleRun,
25
32
  participantExchangeAccountResultSchema,
26
33
  participantExchangeAccountsSchema,
27
34
  participantExchangeResultSchema,
28
35
  participantExchangeSchema
29
- } from "./chunk-UAKYDVT3.js";
36
+ } from "./chunk-ZXGBDLVB.js";
30
37
  import {
31
38
  isIntegrationParticipantPath,
32
39
  isParticipantRoute,
33
40
  participantRoutePattern,
34
41
  participantRoutes
35
- } from "./chunk-CZFXGGEK.js";
42
+ } from "./chunk-U66GUVSG.js";
43
+ import "./chunk-RD3XJ4DH.js";
44
+ import "./chunk-XVZ4YOF2.js";
45
+ import {
46
+ dashboardIssue,
47
+ normalizeDashboard
48
+ } from "./chunk-ZQ3IPCI6.js";
49
+ import "./chunk-MWMCQLCG.js";
36
50
  import {
37
51
  hostEnvironmentPath,
38
52
  hostEnvironmentSchema
39
- } from "./chunk-KDR2VAJP.js";
53
+ } from "./chunk-UYVJZR33.js";
54
+ import "./chunk-7H4MRVQF.js";
40
55
  import {
41
56
  MANAGEMENT_TIMEOUT,
42
57
  lifetime,
43
58
  retryAfter,
44
59
  retrying
45
- } from "./chunk-3PYYGFSB.js";
46
- import "./chunk-XJFYAXET.js";
60
+ } from "./chunk-DLABJSBO.js";
61
+ import "./chunk-MPTE7EIV.js";
62
+ import "./chunk-R2KZFX6E.js";
63
+ import "./chunk-NG4GZ54I.js";
47
64
  import {
65
+ compatibleSettingKinds,
66
+ isBoundSetting,
48
67
  schemaCheckedReader,
68
+ sourceContent,
49
69
  trackerDataBatchSteps,
50
70
  trackerDataIssue,
51
71
  trackerDataIssues,
52
72
  trackerDataPathTypes,
53
73
  trackerDataRecordSteps,
54
- whereSchemaIssue
55
- } from "./chunk-MK425RXJ.js";
56
- import "./chunk-K2KS3JLY.js";
74
+ whereSchemaIssue,
75
+ whereSettings
76
+ } from "./chunk-HNR6G3GV.js";
77
+ import "./chunk-EOUEAOWJ.js";
57
78
  export {
58
79
  MANAGEMENT_TIMEOUT,
59
80
  REFERRAL_INTEGRATION_REWARD_ERROR,
60
81
  accountVouchedBySchema,
82
+ bareOrigin,
83
+ compatibleSettingKinds,
61
84
  containsReferralIntegrationReward,
85
+ dashboardIssue,
62
86
  hostEnvironmentPath,
63
87
  hostEnvironmentSchema,
64
88
  identityIntegrationAccountVouchingInputSchema,
89
+ identityIntegrationAppSecretSchema,
65
90
  identityIntegrationInputSchema,
91
+ identityIntegrationKeySchema,
66
92
  identityIntegrationSchema,
67
93
  identityIntegrationSecretSchema,
68
94
  identityKindClaimSchema,
95
+ isBoundSetting,
69
96
  isIntegrationParticipantPath,
70
97
  isParticipantRoute,
71
98
  lifetime,
99
+ loopbackHosts,
72
100
  managementTransport,
101
+ nextScheduleRun,
102
+ normalizeDashboard,
73
103
  parseImageExtraction,
74
104
  parseImageResult,
75
105
  participantExchangeAccountResultSchema,
@@ -82,7 +112,9 @@ export {
82
112
  retryAfter,
83
113
  retrying,
84
114
  schemaCheckedReader,
115
+ secureOrLoopbackOrigin,
85
116
  sequenceCursorSchema,
117
+ sourceContent,
86
118
  sourceDataSchema,
87
119
  sourceRoles,
88
120
  trackerDataBatchSteps,
@@ -91,5 +123,6 @@ export {
91
123
  trackerDataPathTypes,
92
124
  trackerDataRecordSteps,
93
125
  validateQuestShape,
94
- whereSchemaIssue
126
+ whereSchemaIssue,
127
+ whereSettings
95
128
  };
@@ -1,5 +1,5 @@
1
1
  import * as z from 'zod';
2
- import { aa as PhotoResult, V as AttemptCodeSource } from './accounts-CCqCKCVx.js';
2
+ import { aa as PhotoResult, V as AttemptCodeSource } from './accounts-_lNsiR2k.js';
3
3
 
4
4
  /**
5
5
  * Quest code names an image; the platform fetches, decodes and pins it. No bytes or URLs cross the
@@ -729,7 +729,11 @@ declare const analyticsCatalogSchema: z.ZodObject<{
729
729
  }, z.core.$strip>>;
730
730
  }, z.core.$strip>;
731
731
  type AnalyticsCatalog = z.infer<typeof analyticsCatalogSchema>;
732
- /** A breakdown or query returns up to this many rows; the rest are summed into `other`. */
732
+ /**
733
+ * A breakdown or query returns up to this many rows; the rest are summed into `other`.
734
+ *
735
+ * @deprecated Use `limits.analyticsQueryRows`, which a 1.x release can raise.
736
+ */
733
737
  declare const analyticsQueryLimit = 100;
734
738
  /**
735
739
  * What `analytics.query` reads on the wire. The metric, breakdown and filter names are checked by
@@ -823,4 +827,128 @@ declare const analyticsMetricResultSchema: z.ZodObject<{
823
827
  type AnalyticsMetricResult = z.infer<typeof analyticsMetricResultSchema>;
824
828
  type AnalyticsBreakdownRow = NonNullable<AnalyticsMetricResult["breakdown"]>["rows"][number];
825
829
 
826
- export { analyticsBreakdowns as $, xIdSchema as A, xPostSchema as B, xProfileSchema as C, xRequestSchema as D, type Extracted as E, xUserLookupInputSchema as F, xUserSchema as G, xUsernameSchema as H, type ImageReader as I, type AnalyticsMetricId as J, analyticsCatalog as K, type AnalyticsQuery as L, type AnalyticsRead as M, type AnalyticsCatalog as N, type AnalyticsMetricQuery as O, type PublishedImage as P, type AnalyticsMetricResult as Q, type AnalyticsBreakdown as R, type AnalyticsBreakdownRow as S, type AnalyticsCatalogEntry as T, type AnalyticsChart as U, type AnalyticsFilter as V, type AnalyticsMetric as W, type XReader as X, type AnalyticsMetricKind as Y, type AnalyticsQuest as Z, type AnalyticsRange as _, type ImageAssetArtifact as a, analyticsCatalogSchema as a0, analyticsCharts as a1, analyticsFilters as a2, analyticsMetricIds as a3, analyticsMetricQuerySchema as a4, analyticsMetricResultSchema as a5, analyticsQueryLimit as a6, analyticsQuerySchema as a7, analyticsRanges as a8, analyticsReadSchema as a9, type ImageComparison as b, type ImageExtraction as c, type ImageFields as d, type ImageInspection as e, type ImageReference as f, type ImageRequest as g, type ImageSightings as h, type XConnection as i, type XPost as j, type XProfile as k, type XUser as l, type XUserLookupInput as m, imageAssetArtifactSchema as n, imageComparisonSchema as o, imageExtractionSchema as p, imageFieldSchema as q, imageFieldsSchema as r, imageInspectionSchema as s, imageReferenceSchema as t, imageRequestSchema as u, imageSightingsSchema as v, imageUploadRequestSchema as w, imageUploadsSchema as x, publishedImageSchema as y, xConnectionSchema as z };
830
+ /**
831
+ * Relay's platform limits. A 1.x release can raise them, and add new ones. Released SDKs keep
832
+ * checking the values they shipped with, so Relay answers them within those.
833
+ *
834
+ * @compat output
835
+ */
836
+ type Limits = {
837
+ /** Quests one deployment, draft or release batch can hold. */
838
+ readonly quests: number;
839
+ /** Quest types one deployment, draft or release batch can hold. */
840
+ readonly questTypes: number;
841
+ /** Collections one deployment, draft or release batch can hold. */
842
+ readonly collections: number;
843
+ /** The SDK runtime a quest bundle imports instead of bundling. */
844
+ readonly sdkRuntime: {
845
+ /** Modules in one runtime. */
846
+ readonly modules: number;
847
+ /** Characters of module source, summed over all modules. */
848
+ readonly size: number;
849
+ };
850
+ /** The most completions one `ctx.member.completions()` call returns, and its default `limit`. */
851
+ readonly memberCompletions: number;
852
+ /** Panels one dashboard holds. */
853
+ readonly dashboardPanels: number;
854
+ /** Dashboards that are not archived one project holds. */
855
+ readonly dashboards: number;
856
+ /** Bounds for successful non-terminal evaluator decisions, independent of failure retries. */
857
+ readonly defer: {
858
+ readonly minRetryAfterMs: number;
859
+ readonly maxRetryAfterMs: number;
860
+ /** The delay a defer without `retryAfterMs` waits. */
861
+ readonly retryAfterMs: number;
862
+ /** How long after the first defer an attempt can still be deferred. */
863
+ readonly horizonMs: number;
864
+ readonly maxDefers: number;
865
+ };
866
+ /**
867
+ * Bounds of a quest's retry cooldown (`retryCooldownMs`) and completion cooldown
868
+ * (`completionCooldownMs`).
869
+ */
870
+ readonly retryCooldown: {
871
+ readonly minMs: number;
872
+ readonly maxMs: number;
873
+ };
874
+ /** Rows an analytics breakdown or query returns; the rest are summed into `other`. */
875
+ readonly analyticsQueryRows: number;
876
+ /** Limits of hosted apps, per project environment. */
877
+ readonly apps: {
878
+ /** App secrets one project environment holds. */
879
+ readonly secrets: number;
880
+ /** KV stores one app declares. */
881
+ readonly kvStores: number;
882
+ /** SQL stores one app declares. */
883
+ readonly sqlStores: number;
884
+ /** Migrations one SQL store holds. */
885
+ readonly migrations: number;
886
+ /** Bytes of one migration file. */
887
+ readonly migrationFileBytes: number;
888
+ /** Bytes of one SQL store's migrations, summed. */
889
+ readonly migrationTotalBytes: number;
890
+ /** Rows per page when browsing a SQL store's table. */
891
+ readonly storageRows: number;
892
+ /** Longest text a browsed cell or KV value shows; longer values end in `truncated`. */
893
+ readonly storagePreviewCharacters: number;
894
+ /** Characters a full SQL value read returns per page. */
895
+ readonly storageCellCharacters: number;
896
+ /**
897
+ * KV keys one test storage clear deletes before answering `complete: false`: one Cloudflare
898
+ * bulk delete, which takes at most 10,000 keys.
899
+ */
900
+ readonly storageClearKeys: number;
901
+ /** KV keys a test storage clear's dry run counts before answering `complete: false`. */
902
+ readonly storageClearCountKeys: number;
903
+ /** Schedules one app declares. */
904
+ readonly schedules: number;
905
+ /** The shortest interval between two runs of one schedule, in milliseconds. */
906
+ readonly scheduleMinIntervalMs: number;
907
+ /** How long Relay waits for a scheduled route to answer, in milliseconds. */
908
+ readonly scheduleTimeoutMs: number;
909
+ /**
910
+ * The most a scheduled route's JSON answer can hold for Relay to record it as the run's result.
911
+ */
912
+ readonly scheduleResultBytes: number;
913
+ };
914
+ /** Caps on a build's staged quest and catalog code. */
915
+ readonly stagedDeployment: {
916
+ /** Bytes of JSON, uncompressed. */
917
+ readonly size: number;
918
+ /** Bytes of the Brotli-compressed object. */
919
+ readonly compressedSize: number;
920
+ };
921
+ /**
922
+ * The most capability calls one hosted evaluation run can make, shared by all capabilities. The
923
+ * next call throws a `CapabilityError` with code `capability-limit`.
924
+ */
925
+ readonly capabilityCalls: number;
926
+ /** Bounds of a tracker data schema. */
927
+ readonly trackerData: {
928
+ /** The most branches one union may list. */
929
+ readonly branches: number;
930
+ /**
931
+ * The most properties, `required` keys, enum values or allowed key names one schema node lists.
932
+ */
933
+ readonly entries: number;
934
+ };
935
+ /** Bounds of an X search preview: one sample, never stored, never a tracker. */
936
+ readonly trackerPreview: {
937
+ readonly pages: number;
938
+ readonly posts: number;
939
+ readonly days: number;
940
+ };
941
+ /**
942
+ * The most wallets of one chain family a member can have linked to one project at a time. Sign-in
943
+ * wallets do not count: signing in always links the wallet.
944
+ */
945
+ readonly walletsPerChain: number;
946
+ /** The most logs one `ctx.wallet.events()` read may match before `where` filters them. */
947
+ readonly walletEventLogs: number;
948
+ /** The most transactions one `ctx.wallet.transactions()` read fetches per wallet. */
949
+ readonly walletTransactions: number;
950
+ };
951
+ /** Relay's platform limits. A 1.x release can raise them, so read them here at run time. */
952
+ declare const limits: Limits;
953
+
954
+ export { type AnalyticsQuest as $, type AnalyticsMetricId as A, publishedImageSchema as B, xConnectionSchema as C, xIdSchema as D, type Extracted as E, xPostSchema as F, xProfileSchema as G, xRequestSchema as H, type ImageReader as I, xUserLookupInputSchema as J, xUserSchema as K, type Limits as L, xUsernameSchema as M, type AnalyticsQuery as N, type AnalyticsRead as O, type PublishedImage as P, type AnalyticsCatalog as Q, type AnalyticsMetricQuery as R, type AnalyticsMetricResult as S, type AnalyticsBreakdown as T, type AnalyticsBreakdownRow as U, type AnalyticsCatalogEntry as V, type AnalyticsChart as W, type XReader as X, type AnalyticsFilter as Y, type AnalyticsMetric as Z, type AnalyticsMetricKind as _, analyticsCatalog as a, type AnalyticsRange as a0, analyticsBreakdowns as a1, analyticsCatalogSchema as a2, analyticsCharts as a3, analyticsFilters as a4, analyticsMetricIds as a5, analyticsMetricQuerySchema as a6, analyticsMetricResultSchema as a7, analyticsQueryLimit as a8, analyticsQuerySchema as a9, analyticsRanges as aa, analyticsReadSchema as ab, type ImageAssetArtifact as b, type ImageComparison as c, type ImageExtraction as d, type ImageFields as e, type ImageInspection as f, type ImageReference as g, type ImageRequest as h, type ImageSightings as i, type XConnection as j, type XPost as k, limits as l, type XProfile as m, type XUser as n, type XUserLookupInput as o, imageAssetArtifactSchema as p, imageComparisonSchema as q, imageExtractionSchema as r, imageFieldSchema as s, imageFieldsSchema as t, imageInspectionSchema as u, imageReferenceSchema as v, imageRequestSchema as w, imageSightingsSchema as x, imageUploadRequestSchema as y, imageUploadsSchema as z };
@@ -1,6 +1,6 @@
1
1
  import * as z from 'zod';
2
- import { R as ResourceHandle } from './tracker-data-Hb1uQnk5.js';
3
- import { Z as AuthoringIdentity } from './accounts-CCqCKCVx.js';
2
+ import { R as ResourceHandle } from './tracker-data-Bl-qPIvZ.js';
3
+ import { Z as AuthoringIdentity } from './accounts-_lNsiR2k.js';
4
4
 
5
5
  declare const badgePropertiesSchema: z.ZodObject<{
6
6
  name: z.ZodString;
@@ -92,6 +92,7 @@ type ManagedBadge = z.infer<typeof managedBadgeSchema>;
92
92
  type MemberBadge = z.infer<typeof memberBadgeSchema>;
93
93
  /** @compat output */
94
94
  type MemberBadges = z.infer<typeof memberBadgesSchema>;
95
+ /** The active badge catalog, as `GET /v1/badges/catalog` returns it. */
95
96
  type BadgeCatalog = z.infer<typeof badgeCatalogSchema>;
96
97
 
97
98
  declare const offerPriceSchema: z.ZodObject<{
@@ -94,6 +94,7 @@ declare const memberSummarySchema: z.ZodObject<{
94
94
  avatarSeed: z.ZodString;
95
95
  email: z.ZodDefault<z.ZodNullable<z.ZodString>>;
96
96
  emails: z.ZodDefault<z.ZodArray<z.ZodString>>;
97
+ eligible: z.ZodDefault<z.ZodBoolean>;
97
98
  clock: z.ZodOptional<z.ZodObject<{
98
99
  now: z.ZodNumber;
99
100
  offsetMs: z.ZodNumber;
@@ -1,6 +1,6 @@
1
- import { M as MemberImportVouchedAccount, P as ParticipantExchangeAccountResult, d as ParticipantExchangeResult } from './identity-integration-3mX6b5iH.js';
1
+ import { M as MemberImportVouchedAccount, P as ParticipantExchangeAccountResult, a as ParticipantExchangeResult, I as IdentityIntegrationKey } from './identity-integration-Ci2vGKtX.js';
2
2
  import { R as RequestError } from './request-error-D_dUPLwo.js';
3
- import './tracker-data-Hb1uQnk5.js';
3
+ import './tracker-data-Bl-qPIvZ.js';
4
4
  import 'zod';
5
5
 
6
6
  /**
@@ -60,6 +60,18 @@ declare function exchangeParticipant(options: {
60
60
  accounts?: MemberImportVouchedAccount[];
61
61
  fetch?: typeof fetch;
62
62
  }): Promise<ParticipantExchangeResult>;
63
+ /**
64
+ * Which integration an app login key (`di_…`) belongs to: its organization, project, environment,
65
+ * origin and the expiry of this key, never a secret. Checking a key does not count as using it.
66
+ * `baseUrl` is the participant API origin: HTTPS, or a loopback HTTP origin for a local stack.
67
+ * Throws ParticipantExchangeError when Domino refuses the key: 401 `invalid-credential` for a key
68
+ * that is unknown, expired or revoked, or whose project was deleted.
69
+ */
70
+ declare function inspectIntegrationKey(options: {
71
+ baseUrl: string;
72
+ integrationKey: string;
73
+ fetch?: typeof fetch;
74
+ }): Promise<IdentityIntegrationKey>;
63
75
  /**
64
76
  * Use only in an app server route. authenticate must verify the app's own session.
65
77
  * `origin` is the app's exact HTTPS origin, or a loopback HTTP origin
@@ -69,6 +81,11 @@ declare function exchangeParticipant(options: {
69
81
  * `authenticate` may also return `accounts` the app vouches belong to the user, which needs the
70
82
  * key's **Vouches accounts** setting; `onAccounts` receives each one's outcome, such as an account
71
83
  * another member holds.
84
+ * `onExchangeError` receives each refused exchange as Domino answered it (status, code, message and
85
+ * `retryAfter`) before the browser gets its answer, so the server can log why sign-in failed. The
86
+ * browser's answer does not change, and a callback that throws does not change it either.
87
+ * The browser does not see the app's own sign-in or logout: under `RelayProvider`, call
88
+ * `useSession().refresh()` after each.
72
89
  */
73
90
  declare function createParticipantBackend(options: {
74
91
  baseUrl: string;
@@ -79,6 +96,7 @@ declare function createParticipantBackend(options: {
79
96
  accounts?: MemberImportVouchedAccount[];
80
97
  } | null>;
81
98
  onAccounts?: (results: ParticipantExchangeAccountResult[], request: Request) => void | Promise<void>;
99
+ onExchangeError?: (error: ParticipantExchangeError, request: Request) => void | Promise<void>;
82
100
  fetch?: typeof fetch;
83
101
  }): (request: Request) => Promise<Response>;
84
102
  /**
@@ -117,4 +135,4 @@ declare function signedInMember(request: Request, env: HostedAppEnv, options: {
117
135
  fetch?: typeof fetch;
118
136
  }): Promise<string | null>;
119
137
 
120
- export { type HostedAppEnv, ParticipantExchangeError, createParticipantBackend, exchangeParticipant, handleHostedApp, hostedAppRequest, isParticipantExchangeError, proxyParticipant, signedInMember };
138
+ export { type HostedAppEnv, ParticipantExchangeError, createParticipantBackend, exchangeParticipant, handleHostedApp, hostedAppRequest, inspectIntegrationKey, isParticipantExchangeError, proxyParticipant, signedInMember };
@@ -1,23 +1,33 @@
1
1
  import {
2
+ secureOrLoopbackOrigin
3
+ } from "./chunk-UZ765UGH.js";
4
+ import {
5
+ identityIntegrationKeySchema,
2
6
  participantExchangeAccountsSchema,
3
7
  participantExchangeResultSchema
4
- } from "./chunk-UAKYDVT3.js";
8
+ } from "./chunk-ZXGBDLVB.js";
5
9
  import {
6
10
  isParticipantRoute
7
- } from "./chunk-CZFXGGEK.js";
11
+ } from "./chunk-U66GUVSG.js";
12
+ import "./chunk-RD3XJ4DH.js";
13
+ import "./chunk-XVZ4YOF2.js";
14
+ import "./chunk-ZQ3IPCI6.js";
15
+ import "./chunk-MWMCQLCG.js";
8
16
  import {
9
17
  clientIdentity,
10
18
  retryAfter
11
- } from "./chunk-3PYYGFSB.js";
19
+ } from "./chunk-DLABJSBO.js";
20
+ import "./chunk-MPTE7EIV.js";
12
21
  import {
13
22
  participantPrincipalSchema,
14
23
  sessionMember
15
- } from "./chunk-XJFYAXET.js";
16
- import "./chunk-MK425RXJ.js";
24
+ } from "./chunk-R2KZFX6E.js";
25
+ import "./chunk-NG4GZ54I.js";
26
+ import "./chunk-HNR6G3GV.js";
17
27
  import {
18
28
  RequestError,
19
29
  isRequestError
20
- } from "./chunk-K2KS3JLY.js";
30
+ } from "./chunk-EOUEAOWJ.js";
21
31
 
22
32
  // src/portal-proxy.ts
23
33
  import * as z from "zod";
@@ -110,9 +120,9 @@ function requestExchange(options, body) {
110
120
  })
111
121
  });
112
122
  }
113
- var participantExchangeErrorBrand = /* @__PURE__ */ Symbol.for(
123
+ var participantExchangeErrorBrand = /* @__PURE__ */ (() => /* @__PURE__ */ Symbol.for(
114
124
  "@domino-sdk/relay.ParticipantExchangeError"
115
- );
125
+ ))();
116
126
  function isParticipantExchangeError(value) {
117
127
  return isRequestError(value) && value[participantExchangeErrorBrand] === true;
118
128
  }
@@ -139,24 +149,53 @@ async function exchangeParticipant(options) {
139
149
  accounts: options.accounts
140
150
  });
141
151
  if (!exchanged.ok) {
142
- const body = await exchanged.json().catch(() => null);
143
- throw new ParticipantExchangeError(
144
- typeof body?.error === "string" ? body.error : `Domino identity exchange failed with status ${exchanged.status}`,
145
- {
146
- status: exchanged.status,
147
- code: typeof body?.code === "string" ? body.code : statusCode(exchanged.status),
148
- retryAfter: retryAfter(exchanged.headers)
149
- }
150
- );
152
+ throw await refusal(exchanged, "Domino identity exchange");
151
153
  }
152
154
  return participantExchangeResultSchema.parse(await exchanged.json());
153
155
  }
154
- var loopbackHosts = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
156
+ async function refusal(response, what) {
157
+ return refusalError(response, await response.json().catch(() => null), what);
158
+ }
159
+ function refusalError(response, body, what) {
160
+ return new ParticipantExchangeError(
161
+ typeof body?.error === "string" ? body.error : `${what} failed with status ${response.status}`,
162
+ {
163
+ status: response.status,
164
+ code: typeof body?.code === "string" ? body.code : statusCode(response.status),
165
+ retryAfter: retryAfter(response.headers)
166
+ }
167
+ );
168
+ }
169
+ async function inspectIntegrationKey(options) {
170
+ const base = new URL(options.baseUrl);
171
+ if (!secureOrLoopbackOrigin(base) || base.origin !== options.baseUrl) {
172
+ throw new Error("Configure the exact participant API origin");
173
+ }
174
+ if (!options.integrationKey.startsWith("di_")) {
175
+ throw new Error(
176
+ "Use an identity integration server key from Console Settings"
177
+ );
178
+ }
179
+ const answered = await (options.fetch ?? fetch)(
180
+ options.baseUrl + "/v1/auth/integration",
181
+ {
182
+ method: "GET",
183
+ redirect: "manual",
184
+ headers: {
185
+ Authorization: "Bearer " + options.integrationKey,
186
+ "X-Domino-Client": clientIdentity()
187
+ }
188
+ }
189
+ );
190
+ if (!answered.ok) {
191
+ throw await refusal(answered, "Domino app login key check");
192
+ }
193
+ return identityIntegrationKeySchema.parse(await answered.json());
194
+ }
155
195
  function createParticipantBackend(options) {
156
196
  const origin = new URL(options.origin);
157
197
  const base = new URL(options.baseUrl);
158
- const loopback = origin.protocol === "http:" && loopbackHosts.has(origin.hostname);
159
- if (origin.protocol !== "https:" && !loopback || origin.origin !== options.origin || base.protocol !== "https:" || base.origin !== options.baseUrl) {
198
+ if (!secureOrLoopbackOrigin(origin) || origin.origin !== options.origin || base.protocol !== "https:" || base.origin !== options.baseUrl) {
160
199
  throw new Error(
161
200
  "Configure exact HTTPS application and participant API origins"
162
201
  );
@@ -167,6 +206,7 @@ function createParticipantBackend(options) {
167
206
  );
168
207
  }
169
208
  const send = options.fetch ?? fetch;
209
+ const loopback = origin.protocol === "http:";
170
210
  const cookie = (token) => (
171
211
  // WebKit drops a Secure cookie on http://localhost, so a loopback origin sets it without.
172
212
  `domino_app_session=${token}; Path=/relay; HttpOnly;${loopback ? "" : " Secure;"} SameSite=Lax; Max-Age=${token ? 28800 : 0}`
@@ -204,8 +244,15 @@ function createParticipantBackend(options) {
204
244
  });
205
245
  if (!exchanged.ok) {
206
246
  const body = await exchanged.json().catch(() => null);
207
- const code = typeof body?.code === "string" ? body.code : statusCode(exchanged.status);
247
+ const failure = refusalError(exchanged, body, "Domino identity exchange");
248
+ const { code } = failure;
208
249
  const wait = exchanged.headers.get("Retry-After");
250
+ if (options.onExchangeError) {
251
+ try {
252
+ await options.onExchangeError(failure, request);
253
+ } catch {
254
+ }
255
+ }
209
256
  return Response.json(
210
257
  {
211
258
  error: (exchanged.status === 409 || code === "ACCOUNT_VOUCHING_OFF") && typeof body?.error === "string" ? body.error : exchanged.status === 409 ? "Domino refused this account. Ask an organizer." : "Domino identity exchange failed. Check the server integration key and its expiry in Console Settings.",
@@ -229,6 +276,8 @@ function createParticipantBackend(options) {
229
276
  }
230
277
  const response = await proxyParticipant(request, {
231
278
  baseUrl: options.baseUrl,
279
+ // The integration key selects the scope; an app origin would ask for the staging pass.
280
+ hosted: false,
232
281
  fetch: async (target, init) => {
233
282
  const headers2 = new Headers(init?.headers);
234
283
  headers2.delete("Cookie");
@@ -320,13 +369,14 @@ async function signedInMember(request, env, options) {
320
369
  );
321
370
  return session.success ? sessionMember(session.data) : null;
322
371
  }
323
- var signedInSessionSchema = z.object({ principal: participantPrincipalSchema }).nullable();
372
+ var signedInSessionSchema = /* @__PURE__ */ (() => z.object({ principal: participantPrincipalSchema }).nullable())();
324
373
  export {
325
374
  ParticipantExchangeError,
326
375
  createParticipantBackend,
327
376
  exchangeParticipant,
328
377
  handleHostedApp,
329
378
  hostedAppRequest,
379
+ inspectIntegrationKey,
330
380
  isParticipantExchangeError,
331
381
  proxyParticipant,
332
382
  signedInMember
@@ -1,23 +1,23 @@
1
- import { B as Badge, c as MemberBadges, O as Offer, f as Redemption } from '../offers-DhAtss4_.js';
2
- import { b as ParticipantSession, R as RelayEvent, P as ParticipantActivity, M as MemberSummary } from '../participant-activity-D-Drp24G.js';
3
- import { g as RelayError, R as RelayClient, m as SubmissionDraft } from '../client-B-hbHX30.js';
4
- import { P as Page, s as RewardDeliveryAction, e as CreatorAccountProvider, K as KnownConsentChannel, M as MemberConsent, n as QuestOutcomeQuery, l as QuestOutcome } from '../pages-B8q8Y_dQ.js';
5
- export { C as ConsentChannel, b as ConsentSource, c as ConsentState, d as CreatorAccount, f as CreatorAccounts, g as KnownConsentSource, h as KnownConsentState } from '../pages-B8q8Y_dQ.js';
1
+ import { B as Badge, c as MemberBadges, O as Offer, f as Redemption } from '../offers-Hw2P6tcK.js';
2
+ import { b as ParticipantSession, R as RelayEvent, P as ParticipantActivity, M as MemberSummary } from '../participant-activity-DXRq4s6K.js';
3
+ import { g as RelayError, R as RelayClient, m as SubmissionDraft } from '../client-D7IiwEq2.js';
4
+ import { P as Page, u as RewardDeliveryAction, e as CreatorAccountProvider, K as KnownConsentChannel, M as MemberConsent, n as QuestOutcomeQuery, l as QuestOutcome } from '../reward-deliveries-BCV8hznc.js';
5
+ export { C as ConsentChannel, b as ConsentSource, c as ConsentState, d as CreatorAccount, f as CreatorAccounts, g as KnownConsentSource, h as KnownConsentState } from '../reward-deliveries-BCV8hznc.js';
6
6
  import * as react from 'react';
7
7
  import { ReactNode } from 'react';
8
8
  import * as z from 'zod';
9
9
  import { z as z$1 } from 'zod';
10
- import { l as collectionViewSchema, b as QuestView } from '../catalog--ZIlskAo.js';
11
- import { E as Entitlement, b as AttemptStatus, V as AttemptCodeSource, c as AuthProvider, J as SignInProvider, A as AccountConnection, I as SignInAccountStatus, p as LeaderboardPlacement, dL as referralSummarySchema, o as LeaderboardPage, u as PointEntry, t as PointBalances, y as PointLedgerReference, U as TieredRewardReference } from '../accounts-CCqCKCVx.js';
12
- export { S as SignInAccount, N as SignInProviderOption } from '../accounts-CCqCKCVx.js';
13
- import { c as SignInMethods, C as CosmosChains, d as SignInOption, P as ProviderSignInOption, f as SignInUnavailable, T as TelegramSignInOption, g as SignInWallet, D as DiscoveredWallet } from '../telegram-browser-BCE7zdOb.js';
14
- export { a as EmailSignInOption, O as OAuthSignInOption, b as SignInIcon, W as WalletSignInOption, t as telegramMiniAppInitData } from '../telegram-browser-BCE7zdOb.js';
15
- import { m as WalletSigner, k as WalletSignInNetwork, L as LinkedWallet, g as ProfileUpdate, f as ProfileSummary, b as ProfileCompletion, e as ProfileReferral } from '../wallet-DTO7SXj7.js';
16
- export { T as TelegramAccountConnection, a as TelegramSignInMethods } from '../submission-input-DHGKhXfp.js';
17
- import '../tracker-data-Hb1uQnk5.js';
10
+ import { l as collectionViewSchema, b as QuestView } from '../catalog-ByZMRS7I.js';
11
+ import { E as Entitlement, b as AttemptStatus, V as AttemptCodeSource, c as AuthProvider, J as SignInProvider, A as AccountConnection, I as SignInAccountStatus, p as LeaderboardPlacement, dN as referralSummarySchema, o as LeaderboardPage, u as PointEntry, t as PointBalances, y as PointLedgerReference, U as TieredRewardReference } from '../accounts-_lNsiR2k.js';
12
+ export { S as SignInAccount, N as SignInProviderOption } from '../accounts-_lNsiR2k.js';
13
+ import { c as SignInMethods, C as CosmosChains, d as SignInOption, P as ProviderSignInOption, f as SignInUnavailable, T as TelegramSignInOption, g as SignInWallet, D as DiscoveredWallet } from '../telegram-browser-K27t4TwM.js';
14
+ export { a as EmailSignInOption, O as OAuthSignInOption, b as SignInIcon, W as WalletSignInOption, t as telegramMiniAppInitData } from '../telegram-browser-K27t4TwM.js';
15
+ import { m as WalletSigner, k as WalletSignInNetwork, L as LinkedWallet, g as ProfileUpdate, f as ProfileSummary, b as ProfileCompletion, e as ProfileReferral } from '../wallet-B7e06v4m.js';
16
+ export { T as TelegramAccountConnection, a as TelegramSignInMethods } from '../submission-input-ChL1aYNH.js';
17
+ import '../tracker-data-Bl-qPIvZ.js';
18
18
  import '../request-error-D_dUPLwo.js';
19
19
  import '../action-9Xl0StBg.js';
20
- import '../sign-in-providers-BkjcDsFF.js';
20
+ import '../sign-in-providers-BAkGjSXo.js';
21
21
 
22
22
  /**
23
23
  * A query's identity: plain JSON values, outermost group first, such as
@@ -190,6 +190,13 @@ declare function useSetQueryData(): <T>(key: QueryKey, update: T | ((current: T
190
190
  * Independent of the quest experience: a failing experience read signs nobody out.
191
191
  */
192
192
  declare function useSession(): Query<ParticipantSession | null> & {
193
+ /**
194
+ * Reads the session again now; never rejects. With app login (`createParticipantBackend`), call
195
+ * it after the app's own sign-in route succeeds, before showing member pages, and after its
196
+ * logout route clears the app session: the provider keeps the session it read until it reads
197
+ * again. Sign out through the app, not `useSignOut()`, which the app session would undo.
198
+ */
199
+ refresh(): Promise<void>;
193
200
  /** The signed-in member's ID, or null. */
194
201
  member: string | null;
195
202
  };
@@ -342,13 +349,20 @@ declare function useRelay(): RelayClient;
342
349
  * experience every `polling.snapshotMs` (30 seconds), for changes no event announces and as the
343
350
  * fallback when the feed is unavailable. A new `polling` value takes effect like a new client.
344
351
  *
352
+ * After a wallet sign-in, the provider follows the wallet: when it switches to another account or
353
+ * locks, the member is signed out, so the page never shows one account's progress beside another
354
+ * account's wallet. Pass `followWallet={false}` to keep the session until the member signs out,
355
+ * for an app that handles `accountsChanged` itself.
356
+ *
345
357
  * On a staging host, Domino's test toolbar fires `domino:test-state-changed` on `window` after it
346
358
  * changes test data under the page; the provider then reads the session and every query again.
347
359
  */
348
- declare function RelayProvider({ client, baseUrl, polling, children, }: {
360
+ declare function RelayProvider({ client, baseUrl, polling, followWallet, children, }: {
349
361
  client?: RelayClient;
350
362
  baseUrl?: string;
351
363
  polling?: RelayPolling;
364
+ /** Sign the member out when the wallet they signed in with switches account or locks. Default true. */
365
+ followWallet?: boolean;
352
366
  children: ReactNode;
353
367
  }): react.JSX.Element;
354
368