@playcademy/sdk 0.1.7 → 0.1.8

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
@@ -3214,6 +3214,8 @@ interface BackendDeploymentBundle {
3214
3214
  bindings?: BackendResourceBindings;
3215
3215
  /** Optional schema information for database setup */
3216
3216
  schema?: SchemaInfo;
3217
+ /** Optional game secrets */
3218
+ secrets?: Record<string, string>;
3217
3219
  }
3218
3220
 
3219
3221
  type TokenType = 'session' | 'apiKey' | 'gameJwt';
@@ -3854,6 +3856,12 @@ declare class PlaycademyClient {
3854
3856
  };
3855
3857
  upsert: (slug: string, metadata: UpsertGameMetadataInput) => Promise<Game>;
3856
3858
  delete: (gameId: string) => Promise<void>;
3859
+ secrets: {
3860
+ set: (slug: string, secrets: Record<string, string>) => Promise<string[]>;
3861
+ list: (slug: string) => Promise<string[]>;
3862
+ get: (slug: string) => Promise<Record<string, string>>;
3863
+ delete: (slug: string, key: string) => Promise<void>;
3864
+ };
3857
3865
  };
3858
3866
  items: {
3859
3867
  create: (gameId: string, slug: string, itemData: Omit<InsertItemInput, "slug" | "gameId">) => Promise<Item>;
@@ -3890,49 +3898,49 @@ declare class PlaycademyClient {
3890
3898
  };
3891
3899
  items: {
3892
3900
  create: (props: InsertItemInput) => Promise<{
3901
+ metadata: unknown;
3893
3902
  type: "accessory" | "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
3894
3903
  slug: string;
3895
3904
  id: string;
3896
3905
  createdAt: Date;
3897
3906
  gameId: string | null;
3898
3907
  displayName: string;
3899
- metadata: unknown;
3900
3908
  description: string | null;
3901
3909
  isPlaceable: boolean;
3902
3910
  imageUrl: string | null;
3903
3911
  }>;
3904
3912
  get: (itemId: string) => Promise<{
3913
+ metadata: unknown;
3905
3914
  type: "accessory" | "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
3906
3915
  slug: string;
3907
3916
  id: string;
3908
3917
  createdAt: Date;
3909
3918
  gameId: string | null;
3910
3919
  displayName: string;
3911
- metadata: unknown;
3912
3920
  description: string | null;
3913
3921
  isPlaceable: boolean;
3914
3922
  imageUrl: string | null;
3915
3923
  }>;
3916
3924
  list: () => Promise<{
3925
+ metadata: unknown;
3917
3926
  type: "accessory" | "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
3918
3927
  slug: string;
3919
3928
  id: string;
3920
3929
  createdAt: Date;
3921
3930
  gameId: string | null;
3922
3931
  displayName: string;
3923
- metadata: unknown;
3924
3932
  description: string | null;
3925
3933
  isPlaceable: boolean;
3926
3934
  imageUrl: string | null;
3927
3935
  }[]>;
3928
3936
  update: (itemId: string, props: UpdateItemInput) => Promise<{
3937
+ metadata: unknown;
3929
3938
  type: "accessory" | "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
3930
3939
  slug: string;
3931
3940
  id: string;
3932
3941
  createdAt: Date;
3933
3942
  gameId: string | null;
3934
3943
  displayName: string;
3935
- metadata: unknown;
3936
3944
  description: string | null;
3937
3945
  isPlaceable: boolean;
3938
3946
  imageUrl: string | null;
package/dist/index.js CHANGED
@@ -1371,7 +1371,24 @@ function createDevNamespace(client) {
1371
1371
  upsert: async (slug, metadata) => {
1372
1372
  return client.dev.games.deploy.frontend(slug, metadata, null);
1373
1373
  },
1374
- delete: (gameId) => client["request"](`/games/${gameId}`, "DELETE")
1374
+ delete: (gameId) => client["request"](`/games/${gameId}`, "DELETE"),
1375
+ secrets: {
1376
+ set: async (slug, secrets) => {
1377
+ const result = await client["request"](`/games/${slug}/secrets`, "POST", secrets);
1378
+ return result.keys;
1379
+ },
1380
+ list: async (slug) => {
1381
+ const result = await client["request"](`/games/${slug}/secrets`, "GET");
1382
+ return result.keys;
1383
+ },
1384
+ get: async (slug) => {
1385
+ const result = await client["request"](`/games/${slug}/secrets/values`, "GET");
1386
+ return result.secrets;
1387
+ },
1388
+ delete: async (slug, key) => {
1389
+ await client["request"](`/games/${slug}/secrets/${key}`, "DELETE");
1390
+ }
1391
+ }
1375
1392
  },
1376
1393
  items: {
1377
1394
  create: (gameId, slug, itemData) => client["request"](`/games/${gameId}/items`, "POST", {
package/dist/server.d.ts CHANGED
@@ -173,6 +173,8 @@ interface BackendDeploymentBundle {
173
173
  bindings?: BackendResourceBindings;
174
174
  /** Optional schema information for database setup */
175
175
  schema?: SchemaInfo;
176
+ /** Optional game secrets */
177
+ secrets?: Record<string, string>;
176
178
  }
177
179
 
178
180
  /**
package/dist/server.js CHANGED
@@ -122,7 +122,8 @@ async function loadFile(filename, options = {}) {
122
122
  required = false,
123
123
  searchUp = false,
124
124
  maxLevels = 3,
125
- parseJson = false
125
+ parseJson = false,
126
+ stripComments = false
126
127
  } = options;
127
128
  let fileResult;
128
129
  if (searchUp) {
@@ -151,8 +152,11 @@ async function loadFile(filename, options = {}) {
151
152
  return null;
152
153
  }
153
154
  try {
154
- const content = await readFile(fileResult.path, "utf-8");
155
+ let content = await readFile(fileResult.path, "utf-8");
155
156
  if (parseJson) {
157
+ if (stripComments) {
158
+ content = stripJsonComments(content);
159
+ }
156
160
  return JSON.parse(content);
157
161
  }
158
162
  return content;
@@ -178,6 +182,11 @@ async function findFile(filename, options = {}) {
178
182
  }
179
183
  return null;
180
184
  }
185
+ function stripJsonComments(jsonc) {
186
+ let result = jsonc.replace(/\/\*[\s\S]*?\*\//g, "");
187
+ result = result.replace(/\/\/.*/g, "");
188
+ return result;
189
+ }
181
190
 
182
191
  // src/server/utils/config-loader.ts
183
192
  async function findConfigPath(configPath) {
package/dist/types.d.ts CHANGED
@@ -4052,6 +4052,8 @@ interface BackendDeploymentBundle {
4052
4052
  bindings?: BackendResourceBindings;
4053
4053
  /** Optional schema information for database setup */
4054
4054
  schema?: SchemaInfo;
4055
+ /** Optional game secrets */
4056
+ secrets?: Record<string, string>;
4055
4057
  }
4056
4058
 
4057
4059
  interface UserScore {
@@ -4542,6 +4544,12 @@ declare class PlaycademyClient {
4542
4544
  };
4543
4545
  upsert: (slug: string, metadata: UpsertGameMetadataInput) => Promise<Game>;
4544
4546
  delete: (gameId: string) => Promise<void>;
4547
+ secrets: {
4548
+ set: (slug: string, secrets: Record<string, string>) => Promise<string[]>;
4549
+ list: (slug: string) => Promise<string[]>;
4550
+ get: (slug: string) => Promise<Record<string, string>>;
4551
+ delete: (slug: string, key: string) => Promise<void>;
4552
+ };
4545
4553
  };
4546
4554
  items: {
4547
4555
  create: (gameId: string, slug: string, itemData: Omit<InsertItemInput, "slug" | "gameId">) => Promise<Item>;
@@ -4578,49 +4586,49 @@ declare class PlaycademyClient {
4578
4586
  };
4579
4587
  items: {
4580
4588
  create: (props: InsertItemInput) => Promise<{
4589
+ metadata: unknown;
4581
4590
  type: "accessory" | "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
4582
4591
  slug: string;
4583
4592
  id: string;
4584
4593
  createdAt: Date;
4585
4594
  gameId: string | null;
4586
4595
  displayName: string;
4587
- metadata: unknown;
4588
4596
  description: string | null;
4589
4597
  isPlaceable: boolean;
4590
4598
  imageUrl: string | null;
4591
4599
  }>;
4592
4600
  get: (itemId: string) => Promise<{
4601
+ metadata: unknown;
4593
4602
  type: "accessory" | "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
4594
4603
  slug: string;
4595
4604
  id: string;
4596
4605
  createdAt: Date;
4597
4606
  gameId: string | null;
4598
4607
  displayName: string;
4599
- metadata: unknown;
4600
4608
  description: string | null;
4601
4609
  isPlaceable: boolean;
4602
4610
  imageUrl: string | null;
4603
4611
  }>;
4604
4612
  list: () => Promise<{
4613
+ metadata: unknown;
4605
4614
  type: "accessory" | "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
4606
4615
  slug: string;
4607
4616
  id: string;
4608
4617
  createdAt: Date;
4609
4618
  gameId: string | null;
4610
4619
  displayName: string;
4611
- metadata: unknown;
4612
4620
  description: string | null;
4613
4621
  isPlaceable: boolean;
4614
4622
  imageUrl: string | null;
4615
4623
  }[]>;
4616
4624
  update: (itemId: string, props: UpdateItemInput) => Promise<{
4625
+ metadata: unknown;
4617
4626
  type: "accessory" | "currency" | "badge" | "trophy" | "collectible" | "consumable" | "unlock" | "upgrade" | "other";
4618
4627
  slug: string;
4619
4628
  id: string;
4620
4629
  createdAt: Date;
4621
4630
  gameId: string | null;
4622
4631
  displayName: string;
4623
- metadata: unknown;
4624
4632
  description: string | null;
4625
4633
  isPlaceable: boolean;
4626
4634
  imageUrl: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcademy/sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -42,7 +42,7 @@
42
42
  "@playcademy/timeback": "0.0.1",
43
43
  "@playcademy/utils": "0.0.1",
44
44
  "@types/bun": "latest",
45
- "playcademy": "0.13.16",
45
+ "playcademy": "0.13.19",
46
46
  "rollup": "^4.50.2",
47
47
  "rollup-plugin-dts": "^6.2.3",
48
48
  "typescript": "^5.7.2",