@domino-sdk/relay 1.11.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/build.mjs +15 -0
- package/dist/accounts-5ciAkCMP.d.ts +147 -0
- package/dist/{activity-CNiPDPK6.d.ts → activity-D_R3J-gU.d.ts} +115 -115
- package/dist/attempt-captures-DZldPZJc.d.ts +285 -0
- package/dist/authoring.d.ts +49 -47
- package/dist/authoring.js +8 -6
- package/dist/{automatic-outcomes-kPIDv6X_.d.ts → automatic-outcomes-6lJGnSDe.d.ts} +1 -1
- package/dist/browser.d.ts +8 -7
- package/dist/browser.js +9 -8
- package/dist/capability-error-oTd3eYFH.d.ts +151 -0
- package/dist/chunk-2UAVZCMH.js +314 -0
- package/dist/{chunk-GXT4S5IK.js → chunk-46C33ASD.js} +37 -4
- package/dist/{chunk-ULU5ZF6R.js → chunk-4OLQYRSA.js} +1 -1
- package/dist/chunk-5TS3OAWS.js +470 -0
- package/dist/{chunk-CFTTECZZ.js → chunk-6DD7DVNQ.js} +2 -2
- package/dist/{chunk-DG4QQUH7.js → chunk-C3CB4WIQ.js} +1 -1
- package/dist/{chunk-GKTD36JW.js → chunk-LLMJ2SUT.js} +7 -3
- package/dist/chunk-NIYCAW2I.js +79 -0
- package/dist/{chunk-TV2GYBDZ.js → chunk-PT5STHFH.js} +1 -1
- package/dist/chunk-UJACD6K2.js +987 -0
- package/dist/{chunk-U4KTGJWU.js → chunk-VBHFJH3P.js} +82 -30
- package/dist/chunk-W335CWYJ.js +53 -0
- package/dist/{chunk-7JHREQ2D.js → chunk-XMBM2XD5.js} +1 -1
- package/dist/{chunk-FISNMJN3.js → chunk-ZGH6NEG6.js} +1 -1
- package/dist/{chunk-UIBDEAP2.js → chunk-ZLYBUM7K.js} +158 -59
- package/dist/{client-Dz14Kuu8.d.ts → client-BTd_CyX3.d.ts} +26 -6
- package/dist/{groups-BK8ts2yK.d.ts → groups-4Jb3uYFO.d.ts} +1 -1
- package/dist/{images-aw6W7vFZ.d.ts → images-D5kpqHxv.d.ts} +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.js +10 -8
- package/dist/{capability-error-ty3SqD_b.d.ts → integrations-Cr9EhGI_.d.ts} +1 -149
- package/dist/internal.d.ts +32 -5
- package/dist/internal.js +12 -7
- package/dist/{offers-C2FANzrG.d.ts → offers-BFI5t-e-.d.ts} +2 -2
- package/dist/{pages-tSpttGrI.d.ts → pages-nIoMT9J3.d.ts} +2 -1
- package/dist/{participant-activity-DkL3nY5a.d.ts → participant-activity-DYdUUhw2.d.ts} +1 -0
- package/dist/portal-proxy.js +3 -3
- package/dist/react/index.d.ts +246 -177
- package/dist/react/index.js +956 -385
- package/dist/{referral-reward-kinds-M3f0PdiR.d.ts → referral-reward-kinds-DnvQXL8L.d.ts} +100 -3
- package/dist/{schema-DEM8y8Fm.d.ts → schema-K-Pg5lPz.d.ts} +1 -1
- package/dist/schema.d.ts +316 -314
- package/dist/schema.js +19 -17
- package/dist/server/index.d.ts +2546 -377
- package/dist/server/index.js +973 -987
- package/dist/{sign-in-options-rPCsFr7w.d.ts → sign-in-options-DBjMzgnu.d.ts} +2 -2
- package/dist/submission-input-CPIsJt-_.d.ts +146 -0
- package/dist/testing.d.ts +641 -0
- package/dist/testing.js +1282 -0
- package/package.json +6 -2
- package/dist/chunk-DJOGMLYT.js +0 -171
- package/dist/chunk-KLF7XABH.js +0 -1295
- package/dist/submission-input-BbBJTVlT.d.ts +0 -290
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domino-sdk/relay",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
"./server": {
|
|
47
47
|
"types": "./dist/server/index.d.ts",
|
|
48
48
|
"default": "./dist/server/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./testing": {
|
|
51
|
+
"types": "./dist/testing.d.ts",
|
|
52
|
+
"default": "./dist/testing.js"
|
|
49
53
|
}
|
|
50
54
|
},
|
|
51
55
|
"sideEffects": false,
|
|
@@ -93,6 +97,6 @@
|
|
|
93
97
|
"description": "SDK for authoring quests and integrating Domino Relay",
|
|
94
98
|
"scripts": {
|
|
95
99
|
"typecheck": "tsc --noEmit",
|
|
96
|
-
"build": "tsup"
|
|
100
|
+
"build": "node --max-old-space-size=4096 ../../node_modules/tsup/dist/cli-default.js"
|
|
97
101
|
}
|
|
98
102
|
}
|
package/dist/chunk-DJOGMLYT.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
imageComparisonSchema,
|
|
3
|
-
imageExtractionSchema,
|
|
4
|
-
imageFieldsSchema,
|
|
5
|
-
imageInspectionSchema,
|
|
6
|
-
imageSightingsSchema
|
|
7
|
-
} from "./chunk-FISNMJN3.js";
|
|
8
|
-
import {
|
|
9
|
-
authScopeSchema
|
|
10
|
-
} from "./chunk-TV2GYBDZ.js";
|
|
11
|
-
import {
|
|
12
|
-
appIdentityKindSchema,
|
|
13
|
-
openIdentityKindSchema,
|
|
14
|
-
photoResultSchema
|
|
15
|
-
} from "./chunk-GXT4S5IK.js";
|
|
16
|
-
|
|
17
|
-
// src/configuration.ts
|
|
18
|
-
function questConfiguration(release) {
|
|
19
|
-
return release.configuration ?? {
|
|
20
|
-
defaults: Object.fromEntries(
|
|
21
|
-
Object.entries(release.fields).map(([key, field]) => [
|
|
22
|
-
key,
|
|
23
|
-
field.default
|
|
24
|
-
])
|
|
25
|
-
),
|
|
26
|
-
overrides: { ...release.values },
|
|
27
|
-
preserved: Object.keys(release.values)
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// src/identity-integration.ts
|
|
32
|
-
import { z } from "zod";
|
|
33
|
-
var identityIntegrationInputSchema = z.object({
|
|
34
|
-
name: z.string().trim().min(1).max(80),
|
|
35
|
-
origin: z.string().url().refine((value) => {
|
|
36
|
-
const url = new URL(value);
|
|
37
|
-
return url.protocol === "https:" && url.origin === value;
|
|
38
|
-
}, "Use an exact HTTPS application origin"),
|
|
39
|
-
/**
|
|
40
|
-
* The identity kind this integration owns in the project and environment, such as
|
|
41
|
-
* `app:telegram`. Each member it signs in gets the exchanged subject as an identity of this
|
|
42
|
-
* kind, which tracker attribution and `ctx.member.identities()` read. Its kind cannot change.
|
|
43
|
-
* Omit it for an integration that only signs members in.
|
|
44
|
-
*
|
|
45
|
-
* A kind belongs to the integration that first claimed it, also after that integration is
|
|
46
|
-
* disconnected. A new integration takes a kind that already has identities only by adopting
|
|
47
|
-
* them with `adoptIdentitiesFrom`.
|
|
48
|
-
*/
|
|
49
|
-
identityKind: appIdentityKindSchema.optional(),
|
|
50
|
-
/**
|
|
51
|
-
* Adopt the identities of a disconnected integration's `identityKind`: its ID, as
|
|
52
|
-
* `identityIntegrations.kinds()` lists it. Adopt only when this app's user IDs mean the same
|
|
53
|
-
* users as that integration's, because each one then signs in as the member that ID is linked
|
|
54
|
-
* to. Needs `reason`, which the audit log keeps.
|
|
55
|
-
*/
|
|
56
|
-
adoptIdentitiesFrom: z.string().uuid().optional(),
|
|
57
|
-
/** Why the identities are adopted; required with `adoptIdentitiesFrom`. */
|
|
58
|
-
reason: z.string().trim().min(1).max(500).optional()
|
|
59
|
-
}).strict().refine(
|
|
60
|
-
(input) => !input.adoptIdentitiesFrom || input.identityKind,
|
|
61
|
-
"Adopting identities needs the identityKind they have"
|
|
62
|
-
).refine(
|
|
63
|
-
(input) => !input.adoptIdentitiesFrom === !input.reason,
|
|
64
|
-
"Give a reason when adopting identities, and only then"
|
|
65
|
-
);
|
|
66
|
-
var identityIntegrationSchema = z.object({
|
|
67
|
-
...authScopeSchema.shape,
|
|
68
|
-
id: z.string().uuid(),
|
|
69
|
-
name: z.string(),
|
|
70
|
-
origin: z.string(),
|
|
71
|
-
expiresAt: z.number(),
|
|
72
|
-
/** The identity kind the integration owns; null when it only signs members in. */
|
|
73
|
-
identityKind: openIdentityKindSchema.nullable().default(null)
|
|
74
|
-
});
|
|
75
|
-
var identityIntegrationSecretSchema = identityIntegrationSchema.extend(
|
|
76
|
-
{
|
|
77
|
-
token: z.string()
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
var identityKindClaimSchema = z.object({
|
|
81
|
-
kind: openIdentityKindSchema,
|
|
82
|
-
/** The owning integration's ID; it stays after the integration is disconnected. */
|
|
83
|
-
integration: z.string(),
|
|
84
|
-
/** The owning integration's name when it claimed or adopted the kind. */
|
|
85
|
-
integrationName: z.string(),
|
|
86
|
-
/** Whether the owning integration is still connected. */
|
|
87
|
-
connected: z.boolean(),
|
|
88
|
-
/** Linked identities of the kind; adopting them is required to reuse the kind. */
|
|
89
|
-
linked: z.number().int().nonnegative(),
|
|
90
|
-
/** Identities an operator unlinked. */
|
|
91
|
-
unlinked: z.number().int().nonnegative(),
|
|
92
|
-
claimedAt: z.number().int().nonnegative()
|
|
93
|
-
});
|
|
94
|
-
var participantExchangeSchema = z.object({
|
|
95
|
-
subject: z.string().min(1).max(200),
|
|
96
|
-
previousToken: z.string().max(200).optional()
|
|
97
|
-
}).strict();
|
|
98
|
-
|
|
99
|
-
// src/image-results.ts
|
|
100
|
-
import { z as z2 } from "zod";
|
|
101
|
-
var invalid = (message, path) => new z2.ZodError([{ code: "custom", message, path, input: void 0 }]);
|
|
102
|
-
function parseImageExtraction(raw, value) {
|
|
103
|
-
const result = imageExtractionSchema.parse(value);
|
|
104
|
-
const fields = imageFieldsSchema.parse(raw);
|
|
105
|
-
for (const [key, field] of Object.entries(fields)) {
|
|
106
|
-
const extracted = result.values[key];
|
|
107
|
-
if (extracted === void 0) {
|
|
108
|
-
throw invalid("Image extraction omitted " + key, ["values", key]);
|
|
109
|
-
}
|
|
110
|
-
if (extracted !== null && typeof extracted !== field.type) {
|
|
111
|
-
throw invalid("Image extraction returned the wrong type for " + key, [
|
|
112
|
-
"values",
|
|
113
|
-
key
|
|
114
|
-
]);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (Object.keys(result.values).some((key) => !Object.hasOwn(fields, key))) {
|
|
118
|
-
throw invalid("Image extraction returned an undeclared field", ["values"]);
|
|
119
|
-
}
|
|
120
|
-
return result;
|
|
121
|
-
}
|
|
122
|
-
function parseImageResult(request, value) {
|
|
123
|
-
switch (request.operation) {
|
|
124
|
-
case "inspect":
|
|
125
|
-
return imageInspectionSchema.parse(value);
|
|
126
|
-
case "compare":
|
|
127
|
-
return imageComparisonSchema.parse(value);
|
|
128
|
-
case "review":
|
|
129
|
-
return photoResultSchema.parse(value);
|
|
130
|
-
case "extract":
|
|
131
|
-
return parseImageExtraction(request.fields, value);
|
|
132
|
-
case "seen":
|
|
133
|
-
return imageSightingsSchema.parse(value);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// src/sequence-cursor.ts
|
|
138
|
-
import { z as z3 } from "zod";
|
|
139
|
-
var sequenceCursorSchema = z3.string().regex(/^[1-9][0-9]{0,15}$/, "Invalid cursor").transform(Number).pipe(z3.number().int().positive().safe());
|
|
140
|
-
|
|
141
|
-
// src/referral-reward-kinds.ts
|
|
142
|
-
var REFERRAL_INTEGRATION_REWARD_ERROR = "Referral programs can grant points and tiered rewards; Discord roles need a quest";
|
|
143
|
-
var isRecord = (value) => typeof value === "object" && value !== null;
|
|
144
|
-
function containsReferralIntegrationReward(value) {
|
|
145
|
-
if (Array.isArray(value)) {
|
|
146
|
-
return value.some(
|
|
147
|
-
(reward) => isRecord(reward) && reward.kind === "integration"
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
if (!isRecord(value)) {
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
const definition = isRecord(value.definition) ? value.definition : value;
|
|
154
|
-
return isRecord(definition.rewards) && (containsReferralIntegrationReward(definition.rewards.inviter) || containsReferralIntegrationReward(definition.rewards.invitee)) || Array.isArray(definition.milestones) && definition.milestones.some(
|
|
155
|
-
(milestone) => isRecord(milestone) && containsReferralIntegrationReward(milestone.rewards)
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export {
|
|
160
|
-
questConfiguration,
|
|
161
|
-
identityIntegrationInputSchema,
|
|
162
|
-
identityIntegrationSchema,
|
|
163
|
-
identityIntegrationSecretSchema,
|
|
164
|
-
identityKindClaimSchema,
|
|
165
|
-
participantExchangeSchema,
|
|
166
|
-
parseImageExtraction,
|
|
167
|
-
parseImageResult,
|
|
168
|
-
sequenceCursorSchema,
|
|
169
|
-
REFERRAL_INTEGRATION_REWARD_ERROR,
|
|
170
|
-
containsReferralIntegrationReward
|
|
171
|
-
};
|