@dreamboard-games/sdk 0.5.0-alpha.27 → 0.5.0-alpha.28

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/index.d.ts CHANGED
@@ -113,6 +113,9 @@ declare const GameplayCloseCode: {
113
113
  readonly TooManyRequests: 4301;
114
114
  };
115
115
  declare const GameplayCredentialSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
116
+ kind: z.ZodLiteral<"room-guest">;
117
+ token: z.ZodString;
118
+ }, z.core.$strict>, z.ZodObject<{
116
119
  kind: z.ZodLiteral<"user">;
117
120
  token: z.ZodString;
118
121
  }, z.core.$strict>, z.ZodObject<{
@@ -122,6 +125,9 @@ declare const GameplayCredentialSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
122
125
  declare const AuthConnectFrameSchema: z.ZodObject<{
123
126
  type: z.ZodLiteral<"auth.connect">;
124
127
  credential: z.ZodDiscriminatedUnion<[z.ZodObject<{
128
+ kind: z.ZodLiteral<"room-guest">;
129
+ token: z.ZodString;
130
+ }, z.core.$strict>, z.ZodObject<{
125
131
  kind: z.ZodLiteral<"user">;
126
132
  token: z.ZodString;
127
133
  }, z.core.$strict>, z.ZodObject<{
@@ -134,6 +140,9 @@ declare const AuthConnectFrameSchema: z.ZodObject<{
134
140
  declare const AuthRefreshFrameSchema: z.ZodObject<{
135
141
  type: z.ZodLiteral<"auth.refresh">;
136
142
  credential: z.ZodDiscriminatedUnion<[z.ZodObject<{
143
+ kind: z.ZodLiteral<"room-guest">;
144
+ token: z.ZodString;
145
+ }, z.core.$strict>, z.ZodObject<{
137
146
  kind: z.ZodLiteral<"user">;
138
147
  token: z.ZodString;
139
148
  }, z.core.$strict>, z.ZodObject<{
@@ -663,6 +672,9 @@ declare const SessionSnapshotFrameSchema: z.ZodObject<{
663
672
  declare const ClientGameplayFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
664
673
  type: z.ZodLiteral<"auth.connect">;
665
674
  credential: z.ZodDiscriminatedUnion<[z.ZodObject<{
675
+ kind: z.ZodLiteral<"room-guest">;
676
+ token: z.ZodString;
677
+ }, z.core.$strict>, z.ZodObject<{
666
678
  kind: z.ZodLiteral<"user">;
667
679
  token: z.ZodString;
668
680
  }, z.core.$strict>, z.ZodObject<{
@@ -674,6 +686,9 @@ declare const ClientGameplayFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
674
686
  }, z.core.$strict>, z.ZodObject<{
675
687
  type: z.ZodLiteral<"auth.refresh">;
676
688
  credential: z.ZodDiscriminatedUnion<[z.ZodObject<{
689
+ kind: z.ZodLiteral<"room-guest">;
690
+ token: z.ZodString;
691
+ }, z.core.$strict>, z.ZodObject<{
677
692
  kind: z.ZodLiteral<"user">;
678
693
  token: z.ZodString;
679
694
  }, z.core.$strict>, z.ZodObject<{
package/dist/index.js CHANGED
@@ -73,7 +73,7 @@ import {
73
73
  } from "./chunk-CZRPUWCT.js";
74
74
 
75
75
  // src/package-set.ts
76
- var DREAMBOARD_SDK_VERSION = true ? "0.5.0-alpha.27" : "0.0.0-development";
76
+ var DREAMBOARD_SDK_VERSION = true ? "0.5.0-alpha.28" : "0.0.0-development";
77
77
  var DREAMBOARD_SDK_PACKAGES = {
78
78
  "@dreamboard-games/sdk": DREAMBOARD_SDK_VERSION
79
79
  };
@@ -167,6 +167,10 @@ var GameplayCloseCode = {
167
167
  TooManyRequests: 4301
168
168
  };
169
169
  var GameplayCredentialSchema = z.discriminatedUnion("kind", [
170
+ z.object({
171
+ kind: z.literal("room-guest"),
172
+ token: z.string().min(1).max(1024)
173
+ }).strict(),
170
174
  z.object({ kind: z.literal("user"), token: z.string().min(1).max(16384) }).strict(),
171
175
  z.object({ kind: z.literal("demo"), secret: z.string().min(1).max(1024) }).strict()
172
176
  ]);
@@ -344,7 +348,7 @@ function hostSource(options) {
344
348
  }
345
349
  }
346
350
  clearTimeout(refreshTimer);
347
- if (credential.kind === "user") {
351
+ if (credential.kind !== "demo") {
348
352
  const ttl = Date.parse(frame.expiresAt) - Date.now();
349
353
  if (ttl <= 0)
350
354
  throw new Error("Gameplay credential is already expired.");