@domino-sdk/relay 1.61.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +156 -8
  2. package/README.md +3 -2
  3. package/dist/{schema-CZ6Rj0ZF.d.ts → accounts-CCqCKCVx.d.ts} +3127 -1764
  4. package/dist/action-9Xl0StBg.d.ts +33 -0
  5. package/dist/{integrations-B3y36OaB.d.ts → analytics-BwAKLi7O.d.ts} +347 -57
  6. package/dist/{attempt-captures-DYnJVkfg.d.ts → attempt-captures-Cm-5G0PC.d.ts} +1 -1
  7. package/dist/authoring.d.ts +130 -42
  8. package/dist/authoring.js +112 -37
  9. package/dist/{automatic-outcomes-If88LR9f.d.ts → automatic-outcomes-pAsOyIVp.d.ts} +5 -1
  10. package/dist/avatar.d.ts +1 -1
  11. package/dist/browser.d.ts +15 -11
  12. package/dist/browser.js +15 -11
  13. package/dist/{announcements-CHx3-HBw.d.ts → capability-error-DFMwSuSf.d.ts} +161 -4
  14. package/dist/{pages-K7-KjSXw.d.ts → catalog--ZIlskAo.d.ts} +39 -561
  15. package/dist/{chunk-DYXDZFKA.js → chunk-3KLC4AMA.js} +37 -11
  16. package/dist/{chunk-XBV2CK2H.js → chunk-3PYYGFSB.js} +14 -2
  17. package/dist/{chunk-RHBS5FJL.js → chunk-5TEYFX6X.js} +2 -2
  18. package/dist/chunk-6WCIWXUV.js +31 -0
  19. package/dist/chunk-CICDIBOF.js +373 -0
  20. package/dist/{chunk-MHPKEVEW.js → chunk-CZFXGGEK.js} +5 -0
  21. package/dist/chunk-D26YNACF.js +320 -0
  22. package/dist/{chunk-5I54XBK2.js → chunk-E6IKQHTX.js} +2 -2
  23. package/dist/chunk-FWLQ5XCS.js +21 -0
  24. package/dist/{chunk-SKGTNTLF.js → chunk-GKIFABGN.js} +150 -61
  25. package/dist/chunk-GTDW453U.js +522 -0
  26. package/dist/{chunk-VURRFVNP.js → chunk-HTZHBTIL.js} +69 -27
  27. package/dist/chunk-K2KS3JLY.js +188 -0
  28. package/dist/{chunk-ZDJLPN4L.js → chunk-MK425RXJ.js} +3143 -3209
  29. package/dist/{chunk-L77O64I4.js → chunk-QYPMPWVX.js} +1 -1
  30. package/dist/chunk-UAKYDVT3.js +565 -0
  31. package/dist/{chunk-DHXDBAJF.js → chunk-UPQPUJOU.js} +36 -123
  32. package/dist/{chunk-24I4R732.js → chunk-UW5232GG.js} +34 -19
  33. package/dist/chunk-WSBYWVTZ.js +717 -0
  34. package/dist/{chunk-PPB7HALD.js → chunk-XJFYAXET.js} +9 -8
  35. package/dist/{chunk-7A4J67ZL.js → chunk-XNKSSE32.js} +1 -1
  36. package/dist/{chunk-QEAS4ZGS.js → chunk-Y322OTCH.js} +1 -1
  37. package/dist/{client-C51w7fMb.d.ts → client-B-hbHX30.d.ts} +109 -40
  38. package/dist/{deployments-kWoHFaqj.d.ts → deployments-M4OHn7G3.d.ts} +407 -18
  39. package/dist/identity-integration-3mX6b5iH.d.ts +1241 -0
  40. package/dist/index.d.ts +13 -11
  41. package/dist/index.js +14 -11
  42. package/dist/internal.d.ts +14 -12
  43. package/dist/internal.js +26 -14
  44. package/dist/{offers-BoV4ryUc.d.ts → offers-DhAtss4_.d.ts} +21 -4
  45. package/dist/pages-B8q8Y_dQ.d.ts +715 -0
  46. package/dist/{participant-activity-DHL8QYks.d.ts → participant-activity-D-Drp24G.d.ts} +16 -3
  47. package/dist/portal-proxy.d.ts +59 -2
  48. package/dist/portal-proxy.js +109 -23
  49. package/dist/react/index.d.ts +206 -26
  50. package/dist/react/index.js +153 -25
  51. package/dist/{action-DBzILFx9.d.ts → request-error-D_dUPLwo.d.ts} +1 -31
  52. package/dist/runtime/authoring.js +1 -1
  53. package/dist/runtime/chunks/Y4OAVXFR.js +1 -0
  54. package/dist/runtime/manifest.json +3 -3
  55. package/dist/runtime/schema.js +1 -1
  56. package/dist/schema.d.ts +154 -30
  57. package/dist/schema.js +126 -75
  58. package/dist/server/index.d.ts +14 -12
  59. package/dist/server/index.js +2137 -1633
  60. package/dist/sign-in-providers-BkjcDsFF.d.ts +39 -0
  61. package/dist/submission-input-DHGKhXfp.d.ts +342 -0
  62. package/dist/{telegram-browser-BUceZIGZ.d.ts → telegram-browser-BCE7zdOb.d.ts} +46 -6
  63. package/dist/telegram.d.ts +64 -0
  64. package/dist/telegram.js +23 -0
  65. package/dist/testing.d.ts +112 -15
  66. package/dist/testing.js +321 -16
  67. package/dist/tracker-data-Hb1uQnk5.d.ts +1855 -0
  68. package/dist/{transport-BrX9pIGN.d.ts → transport-DkhX2Cbs.d.ts} +5764 -2217
  69. package/dist/{wallet-CIqFoxdm.d.ts → wallet-DTO7SXj7.d.ts} +20 -7
  70. package/package.json +5 -1
  71. package/dist/accounts-DoabriBX.d.ts +0 -306
  72. package/dist/capability-error-DufwG3G0.d.ts +0 -159
  73. package/dist/chunk-3Y3L2F54.js +0 -982
  74. package/dist/chunk-EN3M5Z4J.js +0 -13
  75. package/dist/chunk-QNUHWK7R.js +0 -602
  76. package/dist/chunk-SE4PFJPT.js +0 -247
  77. package/dist/groups-CqcA2Ycs.d.ts +0 -2827
  78. package/dist/runtime/chunks/5QVFB4TU.js +0 -1
  79. package/dist/submission-input-C54Q8yAD.d.ts +0 -146
  80. package/dist/x-D1PGi8Sq.d.ts +0 -331
@@ -1,23 +1,18 @@
1
1
  import {
2
2
  MANAGEMENT_TIMEOUT,
3
+ clientIdentity,
3
4
  lifetime,
4
5
  retryAfter,
5
6
  retrying,
6
7
  validTimeout
7
- } from "./chunk-XBV2CK2H.js";
8
+ } from "./chunk-3PYYGFSB.js";
8
9
  import {
9
- clientIdentity
10
- } from "./chunk-EN3M5Z4J.js";
11
- import {
12
- authScopeSchema
13
- } from "./chunk-PPB7HALD.js";
10
+ knownResponse
11
+ } from "./chunk-MK425RXJ.js";
14
12
  import {
15
13
  RequestError,
16
- appIdentityKindSchema,
17
- isRequestError,
18
- knownResponse,
19
- openIdentityKindSchema
20
- } from "./chunk-ZDJLPN4L.js";
14
+ isRequestError
15
+ } from "./chunk-K2KS3JLY.js";
21
16
 
22
17
  // src/configuration.ts
23
18
  function questConfiguration(release) {
@@ -33,104 +28,8 @@ function questConfiguration(release) {
33
28
  };
34
29
  }
35
30
 
36
- // src/credential-secrets.ts
37
- import * as z from "zod";
38
- var credentialSecretSchema = z.object({
39
- id: z.string().uuid(),
40
- /** The secret's last four characters, to tell secrets apart; null for one issued before hints. */
41
- hint: z.string().nullable(),
42
- createdAt: z.number(),
43
- /** When the secret stops working; null when it never expires. */
44
- expiresAt: z.number().nullable(),
45
- /** When the secret last authenticated a request; null when it never has. */
46
- lastUsedAt: z.number().nullable()
47
- });
48
- var credentialSecretInputSchema = z.object({
49
- expiresInDays: z.number().int().min(1).max(3650).optional()
50
- }).strict();
51
-
52
- // src/identity-integration.ts
53
- import * as z2 from "zod";
54
- var identityIntegrationInputSchema = z2.object({
55
- name: z2.string().trim().min(1).max(80),
56
- origin: z2.string().url().refine((value) => {
57
- const url = new URL(value);
58
- return url.protocol === "https:" && url.origin === value;
59
- }, "Use an exact HTTPS application origin"),
60
- /**
61
- * The identity kind this integration owns in the project and environment, such as
62
- * `app:telegram`. Each member it signs in gets the exchanged subject as an identity of this
63
- * kind, which tracker attribution and `ctx.member.identities()` read. Its kind cannot change.
64
- * Omit it for an integration that only signs members in.
65
- *
66
- * A kind belongs to the integration that first claimed it, also after that integration is
67
- * disconnected. A new integration takes a kind that already has identities only by adopting
68
- * them with `adoptIdentitiesFrom`.
69
- */
70
- identityKind: appIdentityKindSchema.optional(),
71
- /**
72
- * Adopt the identities of a disconnected integration's `identityKind`: its ID, as
73
- * `identityIntegrations.kinds()` lists it. Adopt only when this app's user IDs mean the same
74
- * users as that integration's, because each one then signs in as the member that ID is linked
75
- * to. Needs `reason`, which the audit log keeps.
76
- */
77
- adoptIdentitiesFrom: z2.string().uuid().optional(),
78
- /** Why the identities are adopted; required with `adoptIdentitiesFrom`. */
79
- reason: z2.string().trim().min(1).max(500).optional(),
80
- /** Days until the first secret expires. Omit it for a key that never expires. */
81
- expiresInDays: z2.number().int().min(1).max(3650).optional()
82
- }).strict().refine(
83
- (input) => !input.adoptIdentitiesFrom || input.identityKind,
84
- "Adopting identities needs the identityKind they have"
85
- ).refine(
86
- (input) => !input.adoptIdentitiesFrom === !input.reason,
87
- "Give a reason when adopting identities, and only then"
88
- );
89
- var identityIntegrationSchema = z2.object({
90
- ...authScopeSchema.shape,
91
- id: z2.string().uuid(),
92
- name: z2.string(),
93
- origin: z2.string(),
94
- /**
95
- * When the integration's last working secret expires: 8640000000000000 (the latest date
96
- * JavaScript represents) when one never does.
97
- *
98
- * @deprecated Read `secrets`, which gives each secret's own expiry.
99
- */
100
- expiresAt: z2.number(),
101
- /** The integration's working secrets, oldest first. Any of them authenticates it. */
102
- secrets: z2.array(credentialSecretSchema).default([]),
103
- /** The latest use of any of its secrets, revoked ones included; null when none was used. */
104
- lastUsedAt: z2.number().nullable().default(null),
105
- /** The identity kind the integration owns; null when it only signs members in. */
106
- identityKind: openIdentityKindSchema.nullable().default(null)
107
- });
108
- var identityIntegrationSecretSchema = identityIntegrationSchema.extend(
109
- {
110
- token: z2.string()
111
- }
112
- );
113
- var identityKindClaimSchema = z2.object({
114
- kind: openIdentityKindSchema,
115
- /** The owning integration's ID; it stays after the integration is disconnected. */
116
- integration: z2.string(),
117
- /** The owning integration's name when it claimed or adopted the kind. */
118
- integrationName: z2.string(),
119
- /** Whether the owning integration is still connected. */
120
- connected: z2.boolean(),
121
- /** Linked identities of the kind; adopting them is required to reuse the kind. */
122
- linked: z2.number().int().nonnegative(),
123
- /** Identities an operator unlinked. */
124
- unlinked: z2.number().int().nonnegative(),
125
- claimedAt: z2.number().int().nonnegative()
126
- });
127
- var participantExchangeSchema = z2.object({
128
- subject: z2.string().min(1).max(200),
129
- previousToken: z2.string().max(200).optional()
130
- }).strict();
131
-
132
31
  // src/server/errors.ts
133
- import * as z3 from "zod";
32
+ import * as z from "zod";
134
33
  var ManagementErrorCode = {
135
34
  /** The input or an option failed validation before anything was sent (kind `client`). */
136
35
  InvalidInput: "invalid-input",
@@ -141,9 +40,9 @@ var ManagementErrorCode = {
141
40
  Aborted: "aborted",
142
41
  InvalidResponse: "invalid-response"
143
42
  };
144
- var managementErrorSchema = z3.looseObject({
145
- error: z3.string(),
146
- code: z3.string().optional()
43
+ var managementErrorSchema = z.looseObject({
44
+ error: z.string(),
45
+ code: z.string().optional()
147
46
  });
148
47
  var uncertainStatuses = /* @__PURE__ */ new Set([500, 502, 504]);
149
48
  function uncertainOutcome(init) {
@@ -195,7 +94,17 @@ var ManagementError = class extends RequestError {
195
94
  var DEFAULT_MANAGEMENT_TIMEOUT = MANAGEMENT_TIMEOUT;
196
95
 
197
96
  // src/server/transport.ts
198
- import * as z4 from "zod";
97
+ import * as z2 from "zod";
98
+ var ManagementUploadBody = class {
99
+ constructor(body, headers, actionId) {
100
+ this.body = body;
101
+ this.headers = headers;
102
+ this.actionId = actionId;
103
+ }
104
+ body;
105
+ headers;
106
+ actionId;
107
+ };
199
108
  function failureCause(error) {
200
109
  if (typeof error !== "object" || error === null || !("cause" in error)) {
201
110
  return {};
@@ -204,6 +113,9 @@ function failureCause(error) {
204
113
  return typeof cause === "object" && cause !== null ? cause : {};
205
114
  }
206
115
  function actionIdOf(input) {
116
+ if (input instanceof ManagementUploadBody) {
117
+ return input.actionId;
118
+ }
207
119
  return typeof input === "object" && input !== null && "actionId" in input && typeof input.actionId === "string" ? input.actionId : void 0;
208
120
  }
209
121
  function unsent(error) {
@@ -425,7 +337,14 @@ function managementTransport(options) {
425
337
  const fetchInit = {
426
338
  method,
427
339
  headers: tolerant ? { "X-Domino-Response": "tolerant-v1" } : void 0,
428
- ...input === void 0 ? {} : {
340
+ ...input === void 0 ? {} : input instanceof ManagementUploadBody ? {
341
+ headers: {
342
+ "Content-Type": input.body.type,
343
+ ...input.headers,
344
+ ...tolerant ? { "X-Domino-Response": "tolerant-v1" } : {}
345
+ },
346
+ body: input.body
347
+ } : {
429
348
  headers: {
430
349
  "Content-Type": "application/json",
431
350
  ...tolerant ? { "X-Domino-Response": "tolerant-v1" } : {}
@@ -491,7 +410,7 @@ function managementTransport(options) {
491
410
  replaySafe
492
411
  }) => exchange(
493
412
  path,
494
- z4.unknown(),
413
+ z2.unknown(),
495
414
  body,
496
415
  method,
497
416
  void 0,
@@ -501,8 +420,8 @@ function managementTransport(options) {
501
420
  }
502
421
 
503
422
  // src/sequence-cursor.ts
504
- import * as z5 from "zod";
505
- var sequenceCursorSchema = z5.string().regex(/^[1-9][0-9]{0,15}$/, "Invalid cursor").transform(Number).pipe(z5.number().int().positive().safe());
423
+ import * as z3 from "zod";
424
+ var sequenceCursorSchema = z3.string().regex(/^[1-9][0-9]{0,15}$/, "Invalid cursor").transform(Number).pipe(z3.number().int().positive().safe());
506
425
 
507
426
  // src/referral-reward-kinds.ts
508
427
  var REFERRAL_INTEGRATION_REWARD_ERROR = "Referral programs can grant points and tiered rewards; Discord roles need a quest";
@@ -524,18 +443,12 @@ function containsReferralIntegrationReward(value) {
524
443
 
525
444
  export {
526
445
  questConfiguration,
527
- credentialSecretSchema,
528
- credentialSecretInputSchema,
529
- identityIntegrationInputSchema,
530
- identityIntegrationSchema,
531
- identityIntegrationSecretSchema,
532
- identityKindClaimSchema,
533
- participantExchangeSchema,
534
446
  ManagementErrorCode,
535
447
  managementErrorSchema,
536
448
  isManagementError,
537
449
  ManagementError,
538
450
  DEFAULT_MANAGEMENT_TIMEOUT,
451
+ ManagementUploadBody,
539
452
  actionIdOf,
540
453
  managementTransport,
541
454
  sequenceCursorSchema,
@@ -1,12 +1,14 @@
1
1
  import {
2
2
  createRelayClient
3
- } from "./chunk-SKGTNTLF.js";
3
+ } from "./chunk-GKIFABGN.js";
4
+ import {
5
+ cosmosChain
6
+ } from "./chunk-MK425RXJ.js";
4
7
  import {
5
8
  RelayErrorCode,
6
9
  asRelayError,
7
- clientError,
8
- cosmosChain
9
- } from "./chunk-ZDJLPN4L.js";
10
+ clientError
11
+ } from "./chunk-K2KS3JLY.js";
10
12
 
11
13
  // src/base58.ts
12
14
  var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
@@ -370,6 +372,10 @@ var providerLabels = {
370
372
  x: "X",
371
373
  discord: "Discord"
372
374
  };
375
+ var signInProviderLabels = new Map([
376
+ ...Object.entries(providerLabels),
377
+ ["telegram", "Telegram"]
378
+ ]);
373
379
  var familyLabels = {
374
380
  solana: "Solana",
375
381
  eip155: "EVM",
@@ -462,8 +468,22 @@ function signInOptionsFrom(methods, wallets, input) {
462
468
  });
463
469
  }
464
470
  const telegram = actions.telegram;
471
+ const start = actions.provider;
472
+ const configured = methods.signInProviders ?? [
473
+ ...methods.providers,
474
+ ...methods.telegram?.login ? ["telegram"] : []
475
+ ];
465
476
  return {
466
477
  options,
478
+ ...start ? {
479
+ signInProviders: configured.map((provider) => ({
480
+ kind: "provider",
481
+ id: provider,
482
+ label: signInProviderLabels.get(provider) ?? provider,
483
+ icon: provider,
484
+ start: () => start(provider)
485
+ }))
486
+ } : {},
467
487
  unavailable,
468
488
  ...methods.telegram?.login && telegram ? {
469
489
  telegram: {
@@ -482,6 +502,9 @@ async function readSignInMethods(relay) {
482
502
  const result = await relay.auth.providers();
483
503
  return {
484
504
  providers: result.providers.filter((entry) => entry.configured).map((entry) => entry.provider),
505
+ ...result.signInProviders ? {
506
+ signInProviders: result.signInProviders.filter((entry) => entry.configured).map((entry) => entry.provider)
507
+ } : {},
485
508
  email: result.email,
486
509
  wallets: result.wallets,
487
510
  ...result.telegram ? { telegram: result.telegram } : {}
@@ -512,6 +535,13 @@ async function signInOptions(relay, input = {}) {
512
535
  const { url } = await relay.auth.start(provider, "sign-in");
513
536
  window.location.assign(url);
514
537
  },
538
+ async provider(provider) {
539
+ const { url } = await relay.auth.start(
540
+ provider,
541
+ "sign-in"
542
+ );
543
+ window.location.assign(url);
544
+ },
515
545
  async sendCode(email) {
516
546
  challenge = null;
517
547
  challenge = (await relay.auth.emailStart(email)).challenge;
@@ -537,20 +567,6 @@ async function signInOptions(relay, input = {}) {
537
567
  });
538
568
  }
539
569
 
540
- // src/telegram-browser.ts
541
- function telegramMiniAppInitData() {
542
- const scope = globalThis;
543
- const fromScript = scope.Telegram?.WebApp?.initData;
544
- if (typeof fromScript === "string" && fromScript.length > 0) {
545
- return fromScript;
546
- }
547
- const hash = scope.location?.hash;
548
- if (!hash) {
549
- return null;
550
- }
551
- return new URLSearchParams(hash.replace(/^#/, "")).get("tgWebAppData") || null;
552
- }
553
-
554
570
  // src/member-time.ts
555
571
  function memberTime(me, at = Date.now()) {
556
572
  return at + (me.clock?.offsetMs ?? 0);
@@ -734,7 +750,6 @@ export {
734
750
  signInOptionsFrom,
735
751
  readSignInMethods,
736
752
  signInOptions,
737
- telegramMiniAppInitData,
738
753
  memberTime,
739
754
  createBrowserRelayClient,
740
755
  browserSubmissionStore