@domino-sdk/relay 1.60.0 → 1.62.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/CHANGELOG.md +175 -8
- package/README.md +3 -2
- package/dist/{schema-CwbRkmlr.d.ts → accounts-CCqCKCVx.d.ts} +3127 -1764
- package/dist/action-9Xl0StBg.d.ts +33 -0
- package/dist/{analytics-URV-mxjH.d.ts → analytics-BwAKLi7O.d.ts} +347 -3
- package/dist/{attempt-captures-W2dgzGqE.d.ts → attempt-captures-Cm-5G0PC.d.ts} +1 -1
- package/dist/authoring.d.ts +130 -42
- package/dist/authoring.js +105 -19
- package/dist/{automatic-outcomes-Cmou89IS.d.ts → automatic-outcomes-pAsOyIVp.d.ts} +5 -1
- package/dist/avatar.d.ts +1 -1
- package/dist/browser.d.ts +15 -11
- package/dist/browser.js +15 -11
- package/dist/{integrations-CmIkP1Gi.d.ts → capability-error-DFMwSuSf.d.ts} +160 -42
- package/dist/{pages-Bti7g5mX.d.ts → catalog--ZIlskAo.d.ts} +39 -561
- package/dist/{chunk-N3LJ6GFK.js → chunk-3KLC4AMA.js} +40 -11
- package/dist/{chunk-6ZG7WNYX.js → chunk-3PYYGFSB.js} +14 -2
- package/dist/{chunk-VWMIA2TT.js → chunk-5TEYFX6X.js} +2 -2
- package/dist/chunk-6WCIWXUV.js +31 -0
- package/dist/chunk-CICDIBOF.js +373 -0
- package/dist/{chunk-MHPKEVEW.js → chunk-CZFXGGEK.js} +5 -0
- package/dist/chunk-D26YNACF.js +320 -0
- package/dist/{chunk-KUPVQXUJ.js → chunk-E6IKQHTX.js} +2 -2
- package/dist/chunk-FWLQ5XCS.js +21 -0
- package/dist/{chunk-VVRQQRMQ.js → chunk-GKIFABGN.js} +150 -61
- package/dist/chunk-GTDW453U.js +522 -0
- package/dist/{chunk-Y2IGFLD2.js → chunk-HTZHBTIL.js} +69 -27
- package/dist/chunk-K2KS3JLY.js +188 -0
- package/dist/{chunk-GBSDAD3N.js → chunk-MK425RXJ.js} +3140 -3202
- package/dist/{chunk-YOAPPIWN.js → chunk-QYPMPWVX.js} +1 -1
- package/dist/chunk-UAKYDVT3.js +565 -0
- package/dist/{chunk-KWFY7L7X.js → chunk-UPQPUJOU.js} +36 -123
- package/dist/{chunk-2FHNY52R.js → chunk-UW5232GG.js} +65 -19
- package/dist/chunk-WSBYWVTZ.js +717 -0
- package/dist/{chunk-422J3QRW.js → chunk-XJFYAXET.js} +9 -8
- package/dist/{chunk-OTEUP2SG.js → chunk-XNKSSE32.js} +1 -1
- package/dist/{chunk-4OFH4BNX.js → chunk-Y322OTCH.js} +1 -1
- package/dist/{client-Cw1pB5sv.d.ts → client-B-hbHX30.d.ts} +109 -40
- package/dist/{deployments-DI-W7fBq.d.ts → deployments-M4OHn7G3.d.ts} +407 -18
- package/dist/identity-integration-3mX6b5iH.d.ts +1241 -0
- package/dist/index.d.ts +13 -11
- package/dist/index.js +14 -11
- package/dist/internal.d.ts +14 -12
- package/dist/internal.js +26 -14
- package/dist/{offers-CqXfMIxq.d.ts → offers-DhAtss4_.d.ts} +21 -4
- package/dist/pages-B8q8Y_dQ.d.ts +715 -0
- package/dist/{participant-activity-DHL8QYks.d.ts → participant-activity-D-Drp24G.d.ts} +16 -3
- package/dist/portal-proxy.d.ts +59 -2
- package/dist/portal-proxy.js +109 -23
- package/dist/react/index.d.ts +211 -27
- package/dist/react/index.js +286 -29
- package/dist/{action-DBzILFx9.d.ts → request-error-D_dUPLwo.d.ts} +1 -31
- package/dist/runtime/authoring.js +1 -1
- package/dist/runtime/chunks/Y4OAVXFR.js +1 -0
- package/dist/runtime/manifest.json +3 -3
- package/dist/runtime/schema.js +1 -1
- package/dist/schema.d.ts +154 -30
- package/dist/schema.js +128 -75
- package/dist/server/index.d.ts +14 -12
- package/dist/server/index.js +2189 -1631
- package/dist/sign-in-providers-BkjcDsFF.d.ts +39 -0
- package/dist/submission-input-DHGKhXfp.d.ts +342 -0
- package/dist/{telegram-browser-CTJh4Ro_.d.ts → telegram-browser-BCE7zdOb.d.ts} +49 -6
- package/dist/telegram.d.ts +64 -0
- package/dist/telegram.js +23 -0
- package/dist/testing.d.ts +112 -15
- package/dist/testing.js +321 -16
- package/dist/tracker-data-Hb1uQnk5.d.ts +1855 -0
- package/dist/{transport-B8Ss5lcz.d.ts → transport-DkhX2Cbs.d.ts} +5863 -2217
- package/dist/{wallet-DZWL7lJH.d.ts → wallet-DTO7SXj7.d.ts} +27 -7
- package/package.json +5 -1
- package/dist/accounts-DoabriBX.d.ts +0 -306
- package/dist/capability-error-DufwG3G0.d.ts +0 -159
- package/dist/chunk-MJEJQH5A.js +0 -962
- package/dist/chunk-N7YOS4ZU.js +0 -13
- package/dist/chunk-XQKUJL7H.js +0 -602
- package/dist/chunk-YNW2ZUUP.js +0 -247
- package/dist/groups-9Jm3peq3.d.ts +0 -2827
- package/dist/runtime/chunks/ADUMK6CR.js +0 -1
- package/dist/submission-input-D9EGH_yb.d.ts +0 -146
- package/dist/x-KFJD2x8y.d.ts +0 -331
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
dashboardArtifactSchema,
|
|
3
3
|
dashboardPreviewSchema
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3KLC4AMA.js";
|
|
5
5
|
import {
|
|
6
6
|
imageAssetArtifactSchema,
|
|
7
7
|
imageComparisonSchema,
|
|
@@ -10,41 +10,34 @@ import {
|
|
|
10
10
|
imageSightingsSchema,
|
|
11
11
|
imageUploadsSchema,
|
|
12
12
|
publishedImageSchema
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-QYPMPWVX.js";
|
|
14
14
|
import {
|
|
15
|
-
|
|
15
|
+
authProvidersSchema,
|
|
16
16
|
collectionPassSchema,
|
|
17
|
-
collectionViewSchema,
|
|
18
17
|
creatorAccountsSchema,
|
|
19
|
-
interactionSchema,
|
|
20
|
-
participantActivitySchema,
|
|
21
18
|
participantDeliveriesSchema,
|
|
22
19
|
participantEntitlementsSchema,
|
|
23
|
-
questCatalogSchema,
|
|
24
|
-
questCollectionSchema,
|
|
25
20
|
questEnrollmentSchema,
|
|
26
|
-
questExperienceSchema,
|
|
27
21
|
questOutcomePageSchema,
|
|
28
22
|
questOutcomeSchema,
|
|
29
|
-
questTypeVersionSchema,
|
|
30
|
-
questViewSchema,
|
|
31
23
|
rewardDeliveriesSchema
|
|
32
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-CICDIBOF.js";
|
|
25
|
+
import {
|
|
26
|
+
catalogDeploymentSchema,
|
|
27
|
+
collectionViewSchema,
|
|
28
|
+
interactionSchema,
|
|
29
|
+
participantActivitySchema,
|
|
30
|
+
questCatalogSchema,
|
|
31
|
+
questCollectionSchema,
|
|
32
|
+
questExperienceSchema,
|
|
33
|
+
questTypeVersionSchema,
|
|
34
|
+
questViewSchema
|
|
35
|
+
} from "./chunk-D26YNACF.js";
|
|
33
36
|
import {
|
|
34
|
-
badgeArtifactSchema,
|
|
35
|
-
badgeSchema,
|
|
36
37
|
engagementArtifactSchema,
|
|
37
38
|
engagementBoundaryPageSchema,
|
|
38
39
|
engagementDeploymentEntrySchema,
|
|
39
40
|
engagementPageSchema,
|
|
40
|
-
leaderboardArtifactSchema,
|
|
41
|
-
leaderboardDefinitionSchema,
|
|
42
|
-
leaderboardHistoryPageSchema,
|
|
43
|
-
leaderboardPageSchema,
|
|
44
|
-
leaderboardPlacementSchema,
|
|
45
|
-
leaderboardPreviewSchema,
|
|
46
|
-
managedBadgeSchema,
|
|
47
|
-
memberBadgesSchema,
|
|
48
41
|
offerArtifactSchema,
|
|
49
42
|
offerDefinitionSchema,
|
|
50
43
|
offerSchema,
|
|
@@ -54,8 +47,18 @@ import {
|
|
|
54
47
|
referralDefinitionSchema,
|
|
55
48
|
referralHistorySchema,
|
|
56
49
|
referralSummarySchema
|
|
57
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-GTDW453U.js";
|
|
58
51
|
import {
|
|
52
|
+
badgeArtifactSchema,
|
|
53
|
+
badgeSchema,
|
|
54
|
+
leaderboardArtifactSchema,
|
|
55
|
+
leaderboardDefinitionSchema,
|
|
56
|
+
leaderboardHistoryPageSchema,
|
|
57
|
+
leaderboardPageSchema,
|
|
58
|
+
leaderboardPlacementSchema,
|
|
59
|
+
leaderboardPreviewSchema,
|
|
60
|
+
managedBadgeSchema,
|
|
61
|
+
memberBadgesSchema,
|
|
59
62
|
ownProfileSchema,
|
|
60
63
|
pointBalancesSchema,
|
|
61
64
|
pointHistoryPageSchema,
|
|
@@ -65,12 +68,12 @@ import {
|
|
|
65
68
|
profileCompletionPageSchema,
|
|
66
69
|
profileReferralSchema,
|
|
67
70
|
profileSummarySchema
|
|
68
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-WSBYWVTZ.js";
|
|
69
72
|
import {
|
|
70
73
|
exchangeResultSchema,
|
|
71
74
|
memberSummarySchema,
|
|
72
75
|
participantSessionSchema
|
|
73
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-XJFYAXET.js";
|
|
74
77
|
import {
|
|
75
78
|
accountConnectionSchema,
|
|
76
79
|
attemptSchema,
|
|
@@ -95,8 +98,11 @@ import {
|
|
|
95
98
|
releaseSchema,
|
|
96
99
|
responseListSchema,
|
|
97
100
|
responseSchema,
|
|
101
|
+
rewardEntrySchema,
|
|
98
102
|
rewardSchema,
|
|
99
103
|
sdkRuntimeSchema,
|
|
104
|
+
signInAccountSchema,
|
|
105
|
+
signInProviderOptionSchema,
|
|
100
106
|
telegramAccountConnectionSchema,
|
|
101
107
|
tieredRewardReferenceSchema,
|
|
102
108
|
timeZoneNameSchema,
|
|
@@ -109,7 +115,7 @@ import {
|
|
|
109
115
|
walletNftsSchema,
|
|
110
116
|
walletSignInNetworksSchema,
|
|
111
117
|
walletTransactionsSchema
|
|
112
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-MK425RXJ.js";
|
|
113
119
|
|
|
114
120
|
// src/deployments.ts
|
|
115
121
|
import * as z from "zod";
|
|
@@ -133,7 +139,12 @@ var projectCatalogArtifactSchema = catalogDeploymentSchema.omit({ expectedRevisi
|
|
|
133
139
|
runtimes: z.array(sdkRuntimeSchema).max(4).default([])
|
|
134
140
|
});
|
|
135
141
|
var projectDeploymentSchema = projectCatalogArtifactSchema.extend({
|
|
136
|
-
releases: z.array(releaseSchema).max(questScaleLimits.quests).default([])
|
|
142
|
+
releases: z.array(releaseSchema).max(questScaleLimits.quests).default([]),
|
|
143
|
+
/**
|
|
144
|
+
* The deployment leaves out quests on purpose, as `domino deploy --only` does, so its preview
|
|
145
|
+
* doesn't warn about published quests it omits (`quests-not-in-bundle`).
|
|
146
|
+
*/
|
|
147
|
+
partial: z.boolean().optional()
|
|
137
148
|
}).refine(
|
|
138
149
|
(value) => value.engagement.length > 0 || value.trackers.length > 0 || value.pointLedgers.length > 0 || value.badges.length > 0 || value.offers.length > 0 || value.releases.length > 0 || value.leaderboards.length > 0 || value.referrals.length > 0 || value.images.length > 0 || value.dashboards.length > 0 || value.types.length > 0 || value.collections.length > 0 || value.supportedInteractions !== void 0 || value.calendar !== void 0,
|
|
139
150
|
"No resources configured. Add engagement, trackers, quests, questTypes, badges, pointLedgers, offers, leaderboards, referrals, images, dashboards, collections, supportedInteractions, or calendar to relay.json."
|
|
@@ -144,6 +155,14 @@ var deploymentWarningSchema = z.object({
|
|
|
144
155
|
integration: z.string().optional(),
|
|
145
156
|
quests: z.array(z.string()).default([])
|
|
146
157
|
});
|
|
158
|
+
var deploymentQuestChangeSchema = z.object({
|
|
159
|
+
/** The quest's ID. */
|
|
160
|
+
quest: identifier,
|
|
161
|
+
/** The quest's authoring key. */
|
|
162
|
+
key: identifier.optional(),
|
|
163
|
+
change: z.enum(["created", "updated", "unchanged"]),
|
|
164
|
+
replaces: z.object({ release: identifier, createdAt: z.number() }).optional()
|
|
165
|
+
});
|
|
147
166
|
var deploymentPreviewSchema = z.object({
|
|
148
167
|
id: identifier,
|
|
149
168
|
engagement: z.array(engagementDeploymentEntrySchema).default([]),
|
|
@@ -153,6 +172,11 @@ var deploymentPreviewSchema = z.object({
|
|
|
153
172
|
pointLedgers: z.array(pointLedgerSchema).default([]),
|
|
154
173
|
offers: z.array(offerDefinitionSchema).default([]),
|
|
155
174
|
releases: z.array(publishedReleaseSchema),
|
|
175
|
+
/**
|
|
176
|
+
* Each quest in `releases` and what publishing does to it (see `deploymentQuestChangeSchema`).
|
|
177
|
+
* Optional so values built for older SDKs still fit.
|
|
178
|
+
*/
|
|
179
|
+
questChanges: z.array(deploymentQuestChangeSchema).optional(),
|
|
156
180
|
types: z.array(questTypeVersionSchema),
|
|
157
181
|
collections: z.array(questCollectionSchema),
|
|
158
182
|
supportedInteractions: z.array(interactionSchema),
|
|
@@ -421,6 +445,11 @@ var automaticCatchUpPreviewSchema = z3.object({
|
|
|
421
445
|
),
|
|
422
446
|
/** Declared rewards per successful evaluation. Evaluators may choose different rewards. */
|
|
423
447
|
rewards: z3.array(rewardSchema),
|
|
448
|
+
/**
|
|
449
|
+
* The same declared rewards, kinds this SDK does not know included: the open sibling of
|
|
450
|
+
* `rewards`, which keeps SDK 1.x's closed `Reward`. Absent from older Relay versions.
|
|
451
|
+
*/
|
|
452
|
+
rewardEntries: z3.array(rewardEntrySchema).optional(),
|
|
424
453
|
/** Each budget's declared cost per successful evaluation; dynamic costs remain explicit. */
|
|
425
454
|
costs: z3.array(
|
|
426
455
|
z3.object({
|
|
@@ -486,6 +515,15 @@ var participantResponseSchemas = lazyResponseReaders({
|
|
|
486
515
|
get authProviderSchema() {
|
|
487
516
|
return knownResponse(authProviderSchema);
|
|
488
517
|
},
|
|
518
|
+
get authProvidersSchema() {
|
|
519
|
+
return knownResponse(authProvidersSchema);
|
|
520
|
+
},
|
|
521
|
+
get signInAccountSchema() {
|
|
522
|
+
return knownResponse(signInAccountSchema);
|
|
523
|
+
},
|
|
524
|
+
get signInProviderOptionSchema() {
|
|
525
|
+
return knownResponse(signInProviderOptionSchema);
|
|
526
|
+
},
|
|
489
527
|
get campaignEnrollmentSchema() {
|
|
490
528
|
return knownResponse(campaignEnrollmentSchema);
|
|
491
529
|
},
|
|
@@ -614,6 +652,9 @@ var participantResponses = {
|
|
|
614
652
|
accountConnectionSchema: responseSchema(accountConnectionSchema),
|
|
615
653
|
attemptSchema: responseSchema(attemptSchema),
|
|
616
654
|
authProviderSchema: responseSchema(authProviderSchema),
|
|
655
|
+
authProvidersSchema: responseSchema(authProvidersSchema),
|
|
656
|
+
signInAccountSchema: responseSchema(signInAccountSchema),
|
|
657
|
+
signInProviderOptionSchema: responseSchema(signInProviderOptionSchema),
|
|
617
658
|
campaignEnrollmentSchema: responseSchema(campaignEnrollmentSchema),
|
|
618
659
|
collectionPassSchema: responseSchema(collectionPassSchema),
|
|
619
660
|
contentPerformancePageSchema: responseSchema(contentPerformancePageSchema),
|
|
@@ -708,6 +749,7 @@ export {
|
|
|
708
749
|
projectCatalogArtifactSchema,
|
|
709
750
|
projectDeploymentSchema,
|
|
710
751
|
deploymentWarningSchema,
|
|
752
|
+
deploymentQuestChangeSchema,
|
|
711
753
|
deploymentPreviewSchema,
|
|
712
754
|
publishDeploymentSchema,
|
|
713
755
|
deploymentResultSchema,
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
// src/request-error.ts
|
|
2
|
+
var requestErrorBrand = /* @__PURE__ */ Symbol.for("@domino-sdk/relay.RequestError");
|
|
3
|
+
function isRequestError(value) {
|
|
4
|
+
return typeof value === "object" && value !== null && value[requestErrorBrand] === true;
|
|
5
|
+
}
|
|
6
|
+
var RequestError = class extends Error {
|
|
7
|
+
name = "RequestError";
|
|
8
|
+
[requestErrorBrand] = true;
|
|
9
|
+
kind;
|
|
10
|
+
uncertain;
|
|
11
|
+
status;
|
|
12
|
+
code;
|
|
13
|
+
operationId;
|
|
14
|
+
/** `replay` for a replay-safe operation ID, else `reconcile`; only when `uncertain`. */
|
|
15
|
+
recovery;
|
|
16
|
+
/**
|
|
17
|
+
* Milliseconds the server asked the client to wait before trying again, from the `Retry-After`
|
|
18
|
+
* header of an error answer such as a 429 or 503. The client's own retries never wait past the
|
|
19
|
+
* call's deadline, so a longer wait is left to the caller.
|
|
20
|
+
*/
|
|
21
|
+
retryAfter;
|
|
22
|
+
constructor(message, details) {
|
|
23
|
+
super(message, details.cause === void 0 ? {} : { cause: details.cause });
|
|
24
|
+
this.kind = details.kind;
|
|
25
|
+
this.uncertain = details.uncertain ?? false;
|
|
26
|
+
this.status = details.status;
|
|
27
|
+
this.code = details.code;
|
|
28
|
+
this.operationId = details.operationId;
|
|
29
|
+
this.retryAfter = details.retryAfter;
|
|
30
|
+
this.recovery = this.uncertain ? details.operationId && (details.replaySafe ?? true) ? "replay" : "reconcile" : void 0;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// src/errors.ts
|
|
35
|
+
import * as z from "zod";
|
|
36
|
+
var RelayErrorCode = {
|
|
37
|
+
/** The call needs a signed-in member. */
|
|
38
|
+
NotSignedIn: "not-signed-in",
|
|
39
|
+
/** The session changed since the app read it (the `session` option). Reload before retrying. */
|
|
40
|
+
StaleSession: "stale-session",
|
|
41
|
+
/** The input failed validation before it was sent. */
|
|
42
|
+
InvalidInput: "invalid-input",
|
|
43
|
+
/** Relay's answer was not JSON or not the expected shape (kind `invalid-response`). */
|
|
44
|
+
InvalidResponse: "invalid-response",
|
|
45
|
+
/** The transport failed, before a response or while reading its body (kind `network`). */
|
|
46
|
+
Network: "network",
|
|
47
|
+
/** The client's deadline elapsed (kind `timeout`). */
|
|
48
|
+
Timeout: "timeout",
|
|
49
|
+
/** The caller cancelled the request (kind `aborted`). */
|
|
50
|
+
Aborted: "aborted",
|
|
51
|
+
/** A quest or collection the call named is not in the member's experience. */
|
|
52
|
+
NotFound: "not-found",
|
|
53
|
+
/** The quest has no failed attempt the member can retry. */
|
|
54
|
+
RetryUnavailable: "retry-unavailable",
|
|
55
|
+
/**
|
|
56
|
+
* Durable submission storage is missing, blocked or unreadable. Nothing was lost: call the
|
|
57
|
+
* handle's `status()` or `resume()` again once storage is available.
|
|
58
|
+
*/
|
|
59
|
+
SubmissionStorage: "submission-storage",
|
|
60
|
+
/** Browser storage is full, so submission progress was not saved. Free space, then resume. */
|
|
61
|
+
SubmissionStorageQuota: "submission-storage-quota",
|
|
62
|
+
/** The saved submission is in a state that does not allow this action. */
|
|
63
|
+
SubmissionConflict: "submission-conflict",
|
|
64
|
+
/**
|
|
65
|
+
* The saved submission's operation belongs to a retired contract and cannot continue. Show the
|
|
66
|
+
* current quest and let the member `discard()` it before submitting again.
|
|
67
|
+
*/
|
|
68
|
+
OperationRetired: "operation-retired",
|
|
69
|
+
/** The quest changed since the member saw it; review it before submitting again. */
|
|
70
|
+
QuestUpdated: "quest-updated",
|
|
71
|
+
/** Wait for the deferred attempt before submitting another action. */
|
|
72
|
+
AttemptPending: "attempt-pending",
|
|
73
|
+
/**
|
|
74
|
+
* The member's last attempt was rejected and the quest's retry cooldown is running; `retryAt`
|
|
75
|
+
* says when they may submit again.
|
|
76
|
+
*/
|
|
77
|
+
RetryCooldown: "retry-cooldown",
|
|
78
|
+
/**
|
|
79
|
+
* The member's last accepted completion of the quest is more recent than its completion
|
|
80
|
+
* cooldown; `retryAt` says when they may submit again.
|
|
81
|
+
*/
|
|
82
|
+
CompletionCooldown: "completion-cooldown",
|
|
83
|
+
/** The quiz changed since the member answered it. */
|
|
84
|
+
StaleQuiz: "stale-quiz",
|
|
85
|
+
/** Relay refused the submitted evidence. */
|
|
86
|
+
InvalidSubmission: "invalid-submission",
|
|
87
|
+
/** A page cursor Relay cannot read; start again from the first page. */
|
|
88
|
+
InvalidCursor: "invalid-cursor",
|
|
89
|
+
/** No point ledger in the project has the key or ID the call named. */
|
|
90
|
+
PointLedgerNotFound: "point-ledger-not-found",
|
|
91
|
+
/** The member has not joined this project, so it holds no points here. */
|
|
92
|
+
NotJoined: "not-joined",
|
|
93
|
+
/** The quest or campaign is not open at this time. */
|
|
94
|
+
OutsideWindow: "outside-window",
|
|
95
|
+
/** The signed-in member must enroll in the campaign first. */
|
|
96
|
+
EnrollmentRequired: "enrollment-required",
|
|
97
|
+
/** The quest's current reward budget has no remaining capacity. */
|
|
98
|
+
BudgetExhausted: "budget-exhausted",
|
|
99
|
+
/** No published offer has the key or ID the call named. */
|
|
100
|
+
OfferNotFound: "offer-not-found",
|
|
101
|
+
/** The operator paused this offer. */
|
|
102
|
+
OfferPaused: "offer-paused",
|
|
103
|
+
/** This member has already used the offer's allowed number of redemptions. */
|
|
104
|
+
OfferLimitReached: "offer-limit-reached",
|
|
105
|
+
/** No declared units remain. */
|
|
106
|
+
OfferOutOfStock: "offer-out-of-stock",
|
|
107
|
+
/** The participant's available point balance is below the offer price. */
|
|
108
|
+
InsufficientPoints: "insufficient-points",
|
|
109
|
+
/** The client's `getToken` failed before anything was sent; `cause` is its own error. */
|
|
110
|
+
Credential: "credential",
|
|
111
|
+
/** A wallet signer failed or the member refused to sign; `cause` is the wallet's own error. */
|
|
112
|
+
WalletSigner: "wallet-signer",
|
|
113
|
+
/** The member has not met the quest's or offer's prerequisites; `missing` lists them. */
|
|
114
|
+
PrerequisitesIncomplete: "prerequisites-incomplete",
|
|
115
|
+
/** The quest is archived or retired: it takes no new participation. */
|
|
116
|
+
QuestClosed: "quest-closed",
|
|
117
|
+
/** An operator paused the quest. */
|
|
118
|
+
QuestPaused: "quest-paused",
|
|
119
|
+
/** An operator locked the member's profile; hiding it is still allowed. */
|
|
120
|
+
ProfileLocked: "profile-locked",
|
|
121
|
+
/** No member in the project has the invitation code the member accepted. */
|
|
122
|
+
InvitationNotFound: "invitation-not-found",
|
|
123
|
+
/** The email sign-in code is wrong; the member can type it again. */
|
|
124
|
+
InvalidCode: "invalid-code",
|
|
125
|
+
/** The email sign-in code expired, was used or had too many attempts; request another. */
|
|
126
|
+
CodeExpired: "code-expired",
|
|
127
|
+
/** The wallet sign-in challenge expired, was used or changed; start sign-in again. */
|
|
128
|
+
ChallengeExpired: "challenge-expired",
|
|
129
|
+
/** Too many requests; `retryAfter` says how long to wait when Relay knows. */
|
|
130
|
+
RateLimited: "rate-limited"
|
|
131
|
+
};
|
|
132
|
+
var relayErrorBrand = /* @__PURE__ */ Symbol.for("@domino-sdk/relay.RelayError");
|
|
133
|
+
function isRelayError(value) {
|
|
134
|
+
return isRequestError(value) && value[relayErrorBrand] === true;
|
|
135
|
+
}
|
|
136
|
+
var RelayError = class extends RequestError {
|
|
137
|
+
name = "RelayError";
|
|
138
|
+
[relayErrorBrand] = true;
|
|
139
|
+
/** Which window refused admission when `code` is `outside-window`. */
|
|
140
|
+
window;
|
|
141
|
+
/** Prerequisites the member does not currently meet, when Relay refused for that reason. */
|
|
142
|
+
missing;
|
|
143
|
+
/**
|
|
144
|
+
* Unix milliseconds when the member may submit again, when `code` is `retry-cooldown` or
|
|
145
|
+
* `completion-cooldown`.
|
|
146
|
+
*/
|
|
147
|
+
retryAt;
|
|
148
|
+
constructor(message, details) {
|
|
149
|
+
super(message, details);
|
|
150
|
+
this.window = details.window;
|
|
151
|
+
this.missing = details.missing ?? [];
|
|
152
|
+
this.retryAt = details.retryAt;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
function asRelayError(cause, fallback = "Request failed") {
|
|
156
|
+
if (isRelayError(cause)) {
|
|
157
|
+
return cause;
|
|
158
|
+
}
|
|
159
|
+
return new RelayError(
|
|
160
|
+
cause instanceof Error && cause.message ? cause.message : fallback,
|
|
161
|
+
{ kind: "client", cause }
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
function clientError(message, code, details = {}) {
|
|
165
|
+
return new RelayError(message, { ...details, kind: "client", code });
|
|
166
|
+
}
|
|
167
|
+
function parseInput(schema, value) {
|
|
168
|
+
const parsed = schema.safeParse(value);
|
|
169
|
+
if (!parsed.success) {
|
|
170
|
+
throw clientError(
|
|
171
|
+
z.prettifyError(parsed.error),
|
|
172
|
+
RelayErrorCode.InvalidInput,
|
|
173
|
+
{ cause: parsed.error }
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
return parsed.data;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export {
|
|
180
|
+
isRequestError,
|
|
181
|
+
RequestError,
|
|
182
|
+
RelayErrorCode,
|
|
183
|
+
isRelayError,
|
|
184
|
+
RelayError,
|
|
185
|
+
asRelayError,
|
|
186
|
+
clientError,
|
|
187
|
+
parseInput
|
|
188
|
+
};
|