@domino-sdk/relay 0.4.0 → 0.5.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/dist/browser.d.ts CHANGED
@@ -897,23 +897,6 @@ declare function createBrowserRelayClient(options: Parameters<typeof createRelay
897
897
  };
898
898
  expiresAt: number;
899
899
  } | null>;
900
- demoSignIn: (code: string) => Promise<{
901
- organization: string;
902
- project: string;
903
- environment: "test" | "live";
904
- id: string;
905
- principal: {
906
- kind: "member";
907
- member: string;
908
- } | {
909
- kind: "staff";
910
- subject: string;
911
- } | {
912
- kind: "operator";
913
- subject: string;
914
- };
915
- expiresAt: number;
916
- }>;
917
900
  signOut: () => Promise<{
918
901
  ok: boolean;
919
902
  }>;
package/dist/browser.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createRelayClient
3
- } from "./chunk-KQVL6MOH.js";
3
+ } from "./chunk-LUCL63DS.js";
4
4
  import "./chunk-TXL43HL3.js";
5
5
  import "./chunk-QWRSUSNB.js";
6
6
  import "./chunk-3IQ4KUKF.js";
@@ -41,6 +41,19 @@ import {
41
41
  templateSchema
42
42
  } from "./chunk-3IQ4KUKF.js";
43
43
 
44
+ // src/resource-id.ts
45
+ var alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
46
+ function resourceId(prefix) {
47
+ let suffix = "";
48
+ while (suffix.length < 22) {
49
+ for (const byte of crypto.getRandomValues(new Uint8Array(32))) {
50
+ if (byte < 248) suffix += alphabet[byte % 62];
51
+ if (suffix.length === 22) break;
52
+ }
53
+ }
54
+ return `${prefix}_${suffix}`;
55
+ }
56
+
44
57
  // src/catalog.ts
45
58
  import { z } from "zod";
46
59
  var interactionSchema = z.enum([
@@ -970,9 +983,6 @@ function createRelayClient(options) {
970
983
  )
971
984
  ),
972
985
  session: () => request("/v1/auth/session", sessionSchema.nullable()),
973
- demoSignIn: (code) => changeSession(
974
- () => request("/v1/auth/demo", sessionSchema, json({ code }))
975
- ),
976
986
  signOut: () => changeSession(
977
987
  () => request("/v1/auth/logout", z7.object({ ok: z7.boolean() }), json({}))
978
988
  ),
@@ -1083,6 +1093,7 @@ function createRelayClient(options) {
1083
1093
  }
1084
1094
 
1085
1095
  export {
1096
+ resourceId,
1086
1097
  interactionSchema,
1087
1098
  questInteraction,
1088
1099
  questTypeVersionSchema,
package/dist/index.d.ts CHANGED
@@ -2334,6 +2334,9 @@ type QuestController = (ActiveController & {
2334
2334
  submit(): Promise<QuestActionResult>;
2335
2335
  });
2336
2336
 
2337
+ /** An opaque prefixed resource ID with 131 bits of cryptographic randomness. */
2338
+ declare function resourceId(prefix: string): string;
2339
+
2337
2340
  declare const collectionCodeSchema: z.ZodString;
2338
2341
  declare const collectionPassSchema: z.ZodObject<{
2339
2342
  code: z.ZodString;
@@ -5301,23 +5304,6 @@ declare function createRelayClient(options: {
5301
5304
  };
5302
5305
  expiresAt: number;
5303
5306
  } | null>;
5304
- demoSignIn: (code: string) => Promise<{
5305
- organization: string;
5306
- project: string;
5307
- environment: "test" | "live";
5308
- id: string;
5309
- principal: {
5310
- kind: "member";
5311
- member: string;
5312
- } | {
5313
- kind: "staff";
5314
- subject: string;
5315
- } | {
5316
- kind: "operator";
5317
- subject: string;
5318
- };
5319
- expiresAt: number;
5320
- }>;
5321
5307
  signOut: () => Promise<{
5322
5308
  ok: boolean;
5323
5309
  }>;
@@ -7003,4 +6989,4 @@ declare function createRelayClient(options: {
7003
6989
  }>;
7004
6990
  };
7005
6991
 
7006
- export { Attempt, AuthProvider, type ClaimSubmission, type CollectionPass, type DeploymentPreview, type ExchangeInput, LeaderboardQuery, MemberListOptions, MemberProgress, type PhotoSubmission, type ProgressObservation, type ProgressObserver, PublishedRelease, type QuestActionResult, type QuestCatalog, type QuestController, type QuestDraft, type QuestInstance, type QuestInteraction, QuestUpdatedError, type QuestView, QuizEvidence, type QuizSubmission, RelayError, ReleaseInput, ReviewListOptions, type Session, type SubmissionDraft, type SubmissionStatus, type SubmissionStore, SubmitInput, authScopeSchema, beginHandoverSchema, catalogDeploymentPreviewSchema, catalogDeploymentSchema, collectionBeginSchema, collectionCodeSchema, collectionPassSchema, collectionPreviewSchema, collectionResolveSchema, collectionSlotSchema, collectionViewSchema, createRelayClient, deploymentPreviewSchema, deploymentResultSchema, errorSchema, exchangeResultSchema, exchangeSchema, identityIntegrationInputSchema, identityIntegrationSchema, identityIntegrationSecretSchema, interactionSchema, participantExchangeSchema, principalSchema, projectCatalogArtifactSchema, projectDeploymentSchema, publishDeploymentSchema, publishQuestDraftSchema, questActions, questCatalogSchema, questCollectionSchema, questConfiguration, questDescriptionSchema, questDraftChangesSchema, questDraftSchema, questExperienceSchema, questInstanceSchema, questInteraction, questPublicationPreviewSchema, questTypeVersionSchema, questViewSchema, reconcileQuestDraft, referralAcceptSchema, saveQuestDraftSchema, sessionSchema, walletChallengeInputSchema, walletProofSchema };
6992
+ export { Attempt, AuthProvider, type ClaimSubmission, type CollectionPass, type DeploymentPreview, type ExchangeInput, LeaderboardQuery, MemberListOptions, MemberProgress, type PhotoSubmission, type ProgressObservation, type ProgressObserver, PublishedRelease, type QuestActionResult, type QuestCatalog, type QuestController, type QuestDraft, type QuestInstance, type QuestInteraction, QuestUpdatedError, type QuestView, QuizEvidence, type QuizSubmission, RelayError, ReleaseInput, ReviewListOptions, type Session, type SubmissionDraft, type SubmissionStatus, type SubmissionStore, SubmitInput, authScopeSchema, beginHandoverSchema, catalogDeploymentPreviewSchema, catalogDeploymentSchema, collectionBeginSchema, collectionCodeSchema, collectionPassSchema, collectionPreviewSchema, collectionResolveSchema, collectionSlotSchema, collectionViewSchema, createRelayClient, deploymentPreviewSchema, deploymentResultSchema, errorSchema, exchangeResultSchema, exchangeSchema, identityIntegrationInputSchema, identityIntegrationSchema, identityIntegrationSecretSchema, interactionSchema, participantExchangeSchema, principalSchema, projectCatalogArtifactSchema, projectDeploymentSchema, publishDeploymentSchema, publishQuestDraftSchema, questActions, questCatalogSchema, questCollectionSchema, questConfiguration, questDescriptionSchema, questDraftChangesSchema, questDraftSchema, questExperienceSchema, questInstanceSchema, questInteraction, questPublicationPreviewSchema, questTypeVersionSchema, questViewSchema, reconcileQuestDraft, referralAcceptSchema, resourceId, saveQuestDraftSchema, sessionSchema, walletChallengeInputSchema, walletProofSchema };
package/dist/index.js CHANGED
@@ -35,6 +35,7 @@ import {
35
35
  questTypeVersionSchema,
36
36
  questViewSchema,
37
37
  reconcileQuestDraft,
38
+ resourceId,
38
39
  saveQuestDraftSchema,
39
40
  solanaAddressSchema,
40
41
  solanaBalanceSchema,
@@ -42,7 +43,7 @@ import {
42
43
  walletChallengeSchema,
43
44
  walletConnectionSchema,
44
45
  walletProofSchema
45
- } from "./chunk-KQVL6MOH.js";
46
+ } from "./chunk-LUCL63DS.js";
46
47
  import {
47
48
  defineLeaderboard,
48
49
  defineReferral,
@@ -258,6 +259,7 @@ export {
258
259
  referralSummarySchema,
259
260
  releaseSchema,
260
261
  reservationSchema,
262
+ resourceId,
261
263
  reviewItemSchema,
262
264
  reviewListSchema,
263
265
  reviewModeSchema,
@@ -2,11 +2,13 @@
2
2
  * Server-only proxy: browser cookies stay on the participant origin.
3
3
  * Point upstream at a participant deployment with trusted server scope configured.
4
4
  * Browser Authorization and organization/project/environment selectors are discarded.
5
- * This does not provide backend identity exchange or configure upstream scope.
5
+ * Set hosted: true for the shared API to resolve a registered preview/staging origin.
6
+ * This does not provide backend identity exchange.
6
7
  */
7
8
  declare function proxyParticipant(request: Request, upstream: {
8
9
  baseUrl: string;
9
10
  fetch: typeof fetch;
11
+ hosted?: boolean;
10
12
  }): Promise<Response>;
11
13
  /** Use only in an app server route. authenticate must verify the app's own session. */
12
14
  declare function createParticipantBackend(options: {
@@ -35,7 +35,9 @@ async function proxyParticipant(request, upstream) {
35
35
  const value = request.headers.get(name);
36
36
  if (value) headers.set(name, value);
37
37
  }
38
- const response = await upstream.fetch(target, {
38
+ if (upstream.hosted) headers.set("X-Relay-App-Origin", incoming.origin);
39
+ const send = upstream.fetch;
40
+ const response = await send(target, {
39
41
  method: request.method,
40
42
  headers,
41
43
  body: request.method === "GET" ? void 0 : await request.arrayBuffer(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domino-sdk/relay",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {