@domino-sdk/relay 1.11.1 → 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.
Files changed (50) hide show
  1. package/README.md +1 -0
  2. package/build.mjs +15 -0
  3. package/dist/accounts-5ciAkCMP.d.ts +147 -0
  4. package/dist/{activity-CNiPDPK6.d.ts → activity-D_R3J-gU.d.ts} +115 -115
  5. package/dist/attempt-captures-DZldPZJc.d.ts +285 -0
  6. package/dist/authoring.d.ts +49 -47
  7. package/dist/authoring.js +6 -4
  8. package/dist/{automatic-outcomes-kPIDv6X_.d.ts → automatic-outcomes-6lJGnSDe.d.ts} +1 -1
  9. package/dist/browser.d.ts +8 -7
  10. package/dist/browser.js +7 -6
  11. package/dist/capability-error-oTd3eYFH.d.ts +151 -0
  12. package/dist/chunk-2UAVZCMH.js +314 -0
  13. package/dist/chunk-5TS3OAWS.js +470 -0
  14. package/dist/{chunk-PUDL4JBY.js → chunk-6DD7DVNQ.js} +2 -2
  15. package/dist/{chunk-AGFUDCNM.js → chunk-C3CB4WIQ.js} +1 -1
  16. package/dist/{chunk-T657WO56.js → chunk-LLMJ2SUT.js} +6 -2
  17. package/dist/chunk-NIYCAW2I.js +79 -0
  18. package/dist/chunk-UJACD6K2.js +987 -0
  19. package/dist/{chunk-XK5E4HAS.js → chunk-VBHFJH3P.js} +80 -28
  20. package/dist/chunk-W335CWYJ.js +53 -0
  21. package/dist/{chunk-X7ECZ3AK.js → chunk-XMBM2XD5.js} +1 -1
  22. package/dist/{chunk-2K2QBPAD.js → chunk-ZLYBUM7K.js} +6 -4
  23. package/dist/{client-fUSERMAC.d.ts → client-BTd_CyX3.d.ts} +26 -6
  24. package/dist/{groups-BK8ts2yK.d.ts → groups-4Jb3uYFO.d.ts} +1 -1
  25. package/dist/{images-aw6W7vFZ.d.ts → images-D5kpqHxv.d.ts} +1 -1
  26. package/dist/index.d.ts +9 -8
  27. package/dist/index.js +8 -6
  28. package/dist/{capability-error-ty3SqD_b.d.ts → integrations-Cr9EhGI_.d.ts} +1 -149
  29. package/dist/internal.d.ts +32 -5
  30. package/dist/internal.js +8 -3
  31. package/dist/{offers-C2FANzrG.d.ts → offers-BFI5t-e-.d.ts} +2 -2
  32. package/dist/{pages-Chb6OZSB.d.ts → pages-nIoMT9J3.d.ts} +1 -1
  33. package/dist/{participant-activity-DkL3nY5a.d.ts → participant-activity-DYdUUhw2.d.ts} +1 -0
  34. package/dist/portal-proxy.js +1 -1
  35. package/dist/react/index.d.ts +246 -177
  36. package/dist/react/index.js +954 -383
  37. package/dist/{referral-reward-kinds-M3f0PdiR.d.ts → referral-reward-kinds-DnvQXL8L.d.ts} +100 -3
  38. package/dist/{schema-DEM8y8Fm.d.ts → schema-K-Pg5lPz.d.ts} +1 -1
  39. package/dist/schema.d.ts +316 -314
  40. package/dist/schema.js +16 -14
  41. package/dist/server/index.d.ts +2546 -377
  42. package/dist/server/index.js +594 -841
  43. package/dist/{sign-in-options-iWOp9puZ.d.ts → sign-in-options-DBjMzgnu.d.ts} +2 -2
  44. package/dist/submission-input-CPIsJt-_.d.ts +146 -0
  45. package/dist/testing.d.ts +641 -0
  46. package/dist/testing.js +1282 -0
  47. package/package.json +6 -2
  48. package/dist/chunk-OCXGG75K.js +0 -171
  49. package/dist/chunk-ZFABFKIY.js +0 -1295
  50. 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.11.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
  }
@@ -1,171 +0,0 @@
1
- import {
2
- imageComparisonSchema,
3
- imageExtractionSchema,
4
- imageFieldsSchema,
5
- imageInspectionSchema,
6
- imageSightingsSchema
7
- } from "./chunk-ZGH6NEG6.js";
8
- import {
9
- authScopeSchema
10
- } from "./chunk-PT5STHFH.js";
11
- import {
12
- appIdentityKindSchema,
13
- openIdentityKindSchema,
14
- photoResultSchema
15
- } from "./chunk-46C33ASD.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
- };