@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
@@ -218,86 +218,6 @@ declare function parseSettings(fields: Record<string, SettingField>, input: unkn
218
218
  declare function missingResourceSettings(fields: Record<string, SettingField>, values: SettingsValues): string[];
219
219
  declare function compatibleSettingKinds(previous: SettingField, next: SettingField): boolean;
220
220
 
221
- declare const xIdSchema: z.ZodString;
222
- declare const xConnectionSchema: z.ZodObject<{
223
- userId: z.ZodString;
224
- }, z.core.$strip>;
225
- declare const xProfileSchema: z.ZodObject<{
226
- id: z.ZodString;
227
- username: z.ZodString;
228
- name: z.ZodString;
229
- bio: z.ZodNullable<z.ZodString>;
230
- profileImageUrl: z.ZodNullable<z.ZodString>;
231
- followersCount: z.ZodNullable<z.ZodNumber>;
232
- verified: z.ZodNullable<z.ZodBoolean>;
233
- }, z.core.$strip>;
234
- declare const xPostSchema: z.ZodObject<{
235
- id: z.ZodString;
236
- userId: z.ZodString;
237
- content: z.ZodString;
238
- createdAt: z.ZodISODateTime;
239
- author: z.ZodObject<{
240
- id: z.ZodString;
241
- username: z.ZodString;
242
- name: z.ZodString;
243
- verified: z.ZodDefault<z.ZodNullable<z.ZodBoolean>>;
244
- }, z.core.$loose>;
245
- likeCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
246
- replyCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
247
- retweetCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
248
- quoteCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
249
- viewCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
250
- bookmarkCount: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
251
- isReply: z.ZodBoolean;
252
- isRetweet: z.ZodBoolean;
253
- isQuoteTweet: z.ZodBoolean;
254
- quotedTweetId: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
255
- inReplyToUserId: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
256
- inReplyToStatusId: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
257
- retweetedTweetId: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | null, string | null | undefined>>;
258
- media: z.ZodPipe<z.ZodUnknown, z.ZodTransform<{
259
- type: string;
260
- url: string;
261
- }[], unknown>>;
262
- }, z.core.$loose>;
263
- declare const xRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
264
- operation: z.ZodLiteral<"connection">;
265
- }, z.core.$strict>, z.ZodObject<{
266
- operation: z.ZodLiteral<"profile">;
267
- }, z.core.$strict>, z.ZodObject<{
268
- operation: z.ZodLiteral<"post">;
269
- postId: z.ZodString;
270
- }, z.core.$strict>, z.ZodObject<{
271
- operation: z.ZodLiteral<"follows">;
272
- userId: z.ZodString;
273
- }, z.core.$strict>, z.ZodObject<{
274
- operation: z.ZodLiteral<"reposted">;
275
- postId: z.ZodString;
276
- }, z.core.$strict>], "operation">;
277
- type XConnection = z.infer<typeof xConnectionSchema>;
278
- type XProfile = z.infer<typeof xProfileSchema>;
279
- type XPost = z.infer<typeof xPostSchema>;
280
- /**
281
- * Reads the member's linked X account and public X data. The account is pinned at the attempt's
282
- * first X read: later links and unlinks do not change the attempt. `connection()`, `profile()`,
283
- * `follows()` and `reposted()` resolve to `null` when the member has no linked X account;
284
- * `post()` reads any public post and resolves to `null` when it does not exist. Provider failures
285
- * throw `CapabilityError` with code `"provider-unavailable"`.
286
- */
287
- interface XReader {
288
- connection(): Promise<XConnection | null>;
289
- profile(): Promise<XProfile | null>;
290
- post(input: {
291
- postId: string;
292
- }): Promise<XPost | null>;
293
- follows(input: {
294
- userId: string;
295
- }): Promise<boolean | null>;
296
- reposted(input: {
297
- postId: string;
298
- }): Promise<boolean | null>;
299
- }
300
-
301
221
  declare const completionPolicySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
302
222
  kind: z.ZodLiteral<"streak">;
303
223
  days: z.ZodNumber;
@@ -389,72 +309,4 @@ declare const projectIntegrationSchema: z.ZodObject<{
389
309
  }, z.core.$strip>;
390
310
  type ProjectIntegration = z.infer<typeof projectIntegrationSchema>;
391
311
 
392
- /**
393
- * Why an evaluator capability could not answer:
394
- *
395
- * - `not-linked`: the call needs a member account that is not linked, and its result cannot be
396
- * null, such as an image check of the member's X profile picture. Readers of the member's own
397
- * accounts return `null` instead.
398
- * - `provider-unavailable`: the provider (X, Discord, a chain RPC, AI review) did not answer, or
399
- * the project's integration cannot reach it.
400
- * - `author-error`: the call cannot be answered as written: invalid input, an undeclared
401
- * integration, an unknown tracker, a chain Relay does not read, a wallet the member never
402
- * linked, or an image that does not exist.
403
- *
404
- * Later versions can add codes. Treat an unknown code as a failure its `message` explains.
405
- */
406
- declare const capabilityErrorCodes: readonly ["not-linked", "provider-unavailable", "author-error"];
407
- /** @compat open */
408
- type KnownCapabilityErrorCode = (typeof capabilityErrorCodes)[number];
409
- /** A known code, or one a newer Relay added. */
410
- type CapabilityErrorCode = KnownCapabilityErrorCode | (string & {});
411
- /**
412
- * A capability failure as it crosses the sandbox boundary and as Relay captures it. Open, so a
413
- * newer Relay can add codes and fields without breaking an older evaluator or Worker.
414
- */
415
- declare const capabilityFailureSchema: z.ZodObject<{
416
- code: z.ZodString;
417
- message: z.ZodString;
418
- /**
419
- * True when Relay retries the attempt if the error reaches it uncaught, and calls the provider
420
- * again. A failure that is not retryable is captured (or follows from the attempt's pinned
421
- * inputs), so every run of the attempt sees it again. A retryable failure that quest code
422
- * handles and moves past is final for the attempt; one that escapes the evaluation is retried.
423
- */
424
- retryable: z.ZodBoolean;
425
- }, z.core.$loose>;
426
- type CapabilityFailure = z.infer<typeof capabilityFailureSchema>;
427
- /**
428
- * Thrown by an evaluator capability (`ctx.x`, `ctx.discord`, `ctx.wallet`, `ctx.trackers`,
429
- * `ctx.images`, `ctx.review`) that could not answer. A capability whose subject is missing (an
430
- * account the member has not linked, a deleted post or message) returns `null` instead of
431
- * throwing.
432
- *
433
- * Catch it to decide yourself; rethrow anything else. An uncaught retryable error makes Relay
434
- * retry the attempt later; an uncaught one that is not retryable fails it.
435
- *
436
- * ```ts
437
- * try {
438
- * return (await ctx.x.follows({ userId })) ? decision.accept() : decision.reject({ reason })
439
- * } catch (error) {
440
- * if (error instanceof CapabilityError && error.code === "provider-unavailable")
441
- * return decision.review({ reason: "X is unavailable" })
442
- * throw error
443
- * }
444
- * ```
445
- */
446
- declare class CapabilityError extends Error {
447
- readonly code: CapabilityErrorCode;
448
- readonly retryable: boolean;
449
- constructor(code: CapabilityErrorCode, message: string, options?: {
450
- retryable?: boolean;
451
- });
452
- static [Symbol.hasInstance](value: unknown): boolean;
453
- /**
454
- * The error for a captured or transported failure. A code this SDK does not know is never
455
- * retryable: nothing tells it a retry would help.
456
- */
457
- static from(failure: CapabilityFailure): CapabilityError;
458
- }
459
-
460
- export { settingsFieldsSchema as A, type Budget as B, CapabilityError as C, settingsValuesSchema as D, type EvaluatorIntegrationProvider as E, xConnectionSchema as F, xIdSchema as G, xPostSchema as H, type IntegrationModule as I, xProfileSchema as J, type KnownCapabilityErrorCode as K, xRequestSchema as L, type ProjectIntegration as P, type ResourceSource as R, type Setting as S, type XReader as X, type IntegerSettings as a, type CapabilityErrorCode as b, capabilityErrorCodes as c, type CapabilityFailure as d, type IntegrationProvider as e, type ResourceOption as f, type SettingField as g, type SettingsValues as h, type XConnection as i, type XPost as j, type XProfile as k, budgetSchema as l, capabilityFailureSchema as m, compatibleSettingKinds as n, completionKeySchema as o, completionPolicySchema as p, discordServerSchema as q, evaluatorIntegrationProviderSchema as r, integrationProviderSchema as s, missingResourceSettings as t, parseSettings as u, projectIntegrationSchema as v, resourceOptionsSchema as w, resourceRequestSchema as x, resourceSourceSchema as y, settingFieldSchema as z };
312
+ export { type Budget as B, type EvaluatorIntegrationProvider as E, type IntegrationModule as I, type ProjectIntegration as P, type ResourceSource as R, type Setting as S, type IntegerSettings as a, type IntegrationProvider as b, type ResourceOption as c, type SettingField as d, type SettingsValues as e, budgetSchema as f, compatibleSettingKinds as g, completionKeySchema as h, completionPolicySchema as i, discordServerSchema as j, evaluatorIntegrationProviderSchema as k, integrationProviderSchema as l, missingResourceSettings as m, projectIntegrationSchema as n, resourceRequestSchema as o, parseSettings as p, resourceSourceSchema as q, resourceOptionsSchema as r, settingFieldSchema as s, settingsFieldsSchema as t, settingsValuesSchema as u };
@@ -1,8 +1,35 @@
1
- export { I as IdentityKindClaim, P as ParticipantRoute, R as REFERRAL_INTEGRATION_REWARD_ERROR, c as containsReferralIntegrationReward, i as identityIntegrationInputSchema, a as identityIntegrationSchema, b as identityIntegrationSecretSchema, d as identityKindClaimSchema, e as isIntegrationParticipantPath, f as isParticipantRoute, p as parseImageExtraction, g as parseImageResult, h as participantExchangeSchema, j as participantRoutePattern, k as participantRoutes, q as questConfiguration, s as sequenceCursorSchema, l as sourceDataSchema, m as sourceRoles, v as validateQuestShape } from './referral-reward-kinds-M3f0PdiR.js';
2
- export { E as Extracted } from './images-aw6W7vFZ.js';
1
+ import { M as ManagementCallOptions } from './referral-reward-kinds-DnvQXL8L.js';
2
+ export { I as IdentityKindClaim, P as ParticipantRoute, R as REFERRAL_INTEGRATION_REWARD_ERROR, c as containsReferralIntegrationReward, i as identityIntegrationInputSchema, a as identityIntegrationSchema, b as identityIntegrationSecretSchema, d as identityKindClaimSchema, e as isIntegrationParticipantPath, f as isParticipantRoute, p as parseImageExtraction, g as parseImageResult, h as participantExchangeSchema, j as participantRoutePattern, k as participantRoutes, q as questConfiguration, s as sequenceCursorSchema, l as sourceDataSchema, m as sourceRoles, v as validateQuestShape } from './referral-reward-kinds-DnvQXL8L.js';
3
+ export { E as Extracted } from './images-D5kpqHxv.js';
4
+ import { z } from 'zod';
3
5
  import { b as RequestErrorKind } from './request-error-D_dUPLwo.js';
4
- export { i as TrackerDataBudget, s as schemaCheckedReader, t as trackerDataBatchSteps, j as trackerDataIssue, k as trackerDataIssues, l as trackerDataPathTypes, m as trackerDataRecordSteps, w as whereSchemaIssue } from './schema-DEM8y8Fm.js';
5
- import 'zod';
6
+ export { a5 as TrackerDataBudget, a6 as schemaCheckedReader, a7 as trackerDataBatchSteps, a8 as trackerDataIssue, a9 as trackerDataIssues, aa as trackerDataPathTypes, ab as trackerDataRecordSteps, ac as whereSchemaIssue } from './schema-K-Pg5lPz.js';
7
+
8
+ /** What `managementTransport` sends with: the management client's options, plus its own. */
9
+ type ManagementTransportOptions = {
10
+ baseUrl: string;
11
+ getToken?: () => Promise<string | null>;
12
+ organization?: string;
13
+ project?: string;
14
+ environment?: "test" | "live";
15
+ timeout?: number;
16
+ /** The `X-Domino-Client` identity; the SDK's own by default. */
17
+ client?: string;
18
+ /** fetch's redirect mode. With `"error"`, a redirect fails the call without being followed. */
19
+ redirect?: RequestInit["redirect"];
20
+ };
21
+ /** `raw` takes a fetch init plus the call's `timeout`. */
22
+ type RawInit = RequestInit & {
23
+ timeout?: number;
24
+ };
25
+ /**
26
+ * Sends management requests for one scope and credential. `exchange` is a JSON call parsed with
27
+ * `schema` (the body as it came when `schema` is undefined); `raw` answers the `Response`.
28
+ */
29
+ declare function managementTransport(options: ManagementTransportOptions): {
30
+ raw: (path: string, init?: RawInit) => Promise<Response>;
31
+ exchange: <T>(path: string, schema: z.ZodType<T> | undefined, input: unknown, method: string, call: ManagementCallOptions | undefined, replaySafe: boolean, tolerant?: boolean) => Promise<T>;
32
+ };
6
33
 
7
34
  /** The management client's and the CLI's default deadline per call. */
8
35
  declare const MANAGEMENT_TIMEOUT = 30000;
@@ -49,4 +76,4 @@ type Rules = {
49
76
  */
50
77
  declare function retrying<T>(life: Lifetime, rules: Rules, attempt: () => Promise<T>): Promise<T>;
51
78
 
52
- export { type AttemptFailure, type Lifetime, MANAGEMENT_TIMEOUT, lifetime, retryAfter, retrying };
79
+ export { type AttemptFailure, type Lifetime, MANAGEMENT_TIMEOUT, type ManagementTransportOptions, lifetime, managementTransport, retryAfter, retrying };
package/dist/internal.js CHANGED
@@ -5,12 +5,15 @@ import {
5
5
  identityIntegrationSchema,
6
6
  identityIntegrationSecretSchema,
7
7
  identityKindClaimSchema,
8
- parseImageExtraction,
9
- parseImageResult,
8
+ managementTransport,
10
9
  participantExchangeSchema,
11
10
  questConfiguration,
12
11
  sequenceCursorSchema
13
- } from "./chunk-OCXGG75K.js";
12
+ } from "./chunk-5TS3OAWS.js";
13
+ import {
14
+ parseImageExtraction,
15
+ parseImageResult
16
+ } from "./chunk-W335CWYJ.js";
14
17
  import "./chunk-ZGH6NEG6.js";
15
18
  import {
16
19
  sourceDataSchema,
@@ -30,6 +33,7 @@ import {
30
33
  retrying
31
34
  } from "./chunk-6QJ3LADK.js";
32
35
  import "./chunk-NPGENI7K.js";
36
+ import "./chunk-C3CB4WIQ.js";
33
37
  import "./chunk-PT5STHFH.js";
34
38
  import {
35
39
  schemaCheckedReader,
@@ -51,6 +55,7 @@ export {
51
55
  isIntegrationParticipantPath,
52
56
  isParticipantRoute,
53
57
  lifetime,
58
+ managementTransport,
54
59
  parseImageExtraction,
55
60
  parseImageResult,
56
61
  participantExchangeSchema,
@@ -1,5 +1,5 @@
1
- import { n as ResourceHandle } from './schema-DEM8y8Fm.js';
2
- import { q as AuthoringIdentity } from './groups-BK8ts2yK.js';
1
+ import { i as ResourceHandle } from './schema-K-Pg5lPz.js';
2
+ import { q as AuthoringIdentity } from './groups-4Jb3uYFO.js';
3
3
  import { z } from 'zod';
4
4
 
5
5
  declare const offerPriceSchema: z.ZodObject<{
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { a as AttemptStatus, bL as questDescriptionSchema, h as TrackerSkipCode } from './schema-DEM8y8Fm.js';
2
+ import { a as AttemptStatus, bL as questDescriptionSchema, h as TrackerSkipCode } from './schema-K-Pg5lPz.js';
3
3
 
4
4
  /**
5
5
  * The delivery actions this SDK knows. `RewardDelivery.action` is an open string: Relay can add
@@ -264,6 +264,7 @@ declare const relayEventSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.
264
264
  }>>]>;
265
265
  declare const participantActivityQuerySchema: z.ZodObject<{
266
266
  cursor: z.ZodOptional<z.ZodString>;
267
+ start: z.ZodOptional<z.ZodLiteral<"latest">>;
267
268
  limit: z.ZodDefault<z.ZodNumber>;
268
269
  }, z.core.$strict>;
269
270
  declare const participantActivitySchema: z.ZodObject<{
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-AXRMT33W.js";
4
4
  import {
5
5
  clientIdentity
6
- } from "./chunk-AGFUDCNM.js";
6
+ } from "./chunk-C3CB4WIQ.js";
7
7
  import {
8
8
  exchangeResultSchema
9
9
  } from "./chunk-PT5STHFH.js";