playcademy 0.11.11 → 0.11.13

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.
@@ -2,12 +2,37 @@
2
2
  * Constants for game backend workers
3
3
  */
4
4
 
5
- import { TIMEBACK_ROUTES, WORKER_ENV_VARS, WORKER_NAMING } from '@playcademy/constants'
5
+ /**
6
+ * Environment variables for game backend workers
7
+ */
8
+ export const ENV_VARS = {
9
+ /** Game-specific API key for calling platform API */
10
+ PLAYCADEMY_API_KEY: 'PLAYCADEMY_API_KEY',
11
+ /** Game ID (UUID) */
12
+ GAME_ID: 'GAME_ID',
13
+ /** Platform API base URL */
14
+ PLAYCADEMY_BASE_URL: 'PLAYCADEMY_BASE_URL',
15
+ } as const
16
+
17
+ /**
18
+ * Worker naming patterns
19
+ * - Production workers: {slug} → accessible at {slug}.playcademy.gg
20
+ * - Staging workers: staging-{slug} → accessible at {slug}-staging.playcademy.gg
21
+ */
22
+ export const WORKER_NAMING = {
23
+ /** Prefix for staging worker names (e.g., "staging-bamboo") */
24
+ STAGING_PREFIX: 'staging-',
25
+ /** Suffix for staging worker hostnames (e.g., "bamboo-staging.playcademy.gg") */
26
+ STAGING_SUFFIX: '-staging',
27
+ } as const
6
28
 
7
29
  /**
8
- * Re-export shared constants from @playcademy/constants
30
+ * TimeBack integration route paths
31
+ * These are relative to /api/ - full paths are /api/integrations/timeback/*
9
32
  */
10
- export { WORKER_ENV_VARS as ENV_VARS, WORKER_NAMING }
33
+ const TIMEBACK_ROUTES = {
34
+ END_ACTIVITY: '/integrations/timeback/end-activity',
35
+ } as const
11
36
 
12
37
  /**
13
38
  * Built-in API routes
package/dist/index.js CHANGED
@@ -1789,13 +1789,9 @@ var init_system = __esm({
1789
1789
  });
1790
1790
 
1791
1791
  // ../constants/src/timeback.ts
1792
- var TIMEBACK_ROUTES;
1793
1792
  var init_timeback2 = __esm({
1794
1793
  "../constants/src/timeback.ts"() {
1795
1794
  "use strict";
1796
- TIMEBACK_ROUTES = {
1797
- END_ACTIVITY: "/integrations/timeback/end-activity"
1798
- };
1799
1795
  }
1800
1796
  });
1801
1797
 
@@ -3595,11 +3591,13 @@ var init_integrations = __esm({
3595
3591
  });
3596
3592
 
3597
3593
  // ../edge-play/src/constants.ts
3598
- var ROUTES;
3594
+ var TIMEBACK_ROUTES, ROUTES;
3599
3595
  var init_constants4 = __esm({
3600
3596
  "../edge-play/src/constants.ts"() {
3601
3597
  "use strict";
3602
- init_src();
3598
+ TIMEBACK_ROUTES = {
3599
+ END_ACTIVITY: "/integrations/timeback/end-activity"
3600
+ };
3603
3601
  ROUTES = {
3604
3602
  /** Route index (lists available routes) */
3605
3603
  INDEX: "/api",
@@ -5139,18 +5137,13 @@ async function bundleBackend(config, options = {}) {
5139
5137
  customRoutes: customRouteData
5140
5138
  };
5141
5139
  const entryCode = generateEntryCode(customRouteData);
5142
- const currentDir2 = new URL(".", import.meta.url).pathname;
5143
- const embeddedEdgeSrc = join3(currentDir2, "edge-play", "src");
5144
- const monorepoEdgeSrc = join3(currentDir2, "../../../edge-play/src");
5140
+ const distDir = new URL(".", import.meta.url).pathname;
5141
+ const embeddedEdgeSrc = join3(distDir, "edge-play", "src");
5142
+ const monorepoEdgeSrc = join3(distDir, "../../../../edge-play/src");
5145
5143
  const isBuiltPackage = existsSync3(embeddedEdgeSrc);
5146
5144
  const edgePlaySrc = isBuiltPackage ? embeddedEdgeSrc : monorepoEdgeSrc;
5147
- const cliPackageRoot = isBuiltPackage ? join3(currentDir2, "..") : join3(currentDir2, "../../..");
5145
+ const cliPackageRoot = isBuiltPackage ? join3(distDir, "../..") : join3(distDir, "../../..");
5148
5146
  const nodeModulesRoot = isBuiltPackage ? cliPackageRoot : getMonorepoRoot();
5149
- const embeddedConstantsSrcA = join3(currentDir2, "@playcademy/constants/src");
5150
- const embeddedConstantsSrcB = join3(currentDir2, "node_modules/@playcademy/constants/src");
5151
- const embeddedConstantsSrc = existsSync3(embeddedConstantsSrcA) ? embeddedConstantsSrcA : embeddedConstantsSrcB;
5152
- const monorepoConstantsSrc = join3(currentDir2, "../../../constants/src");
5153
- const constantsSrc = isBuiltPackage ? embeddedConstantsSrc : monorepoConstantsSrc;
5154
5147
  const result = await esbuild.build({
5155
5148
  stdin: {
5156
5149
  contents: entryCode,
@@ -5182,14 +5175,6 @@ async function bundleBackend(config, options = {}) {
5182
5175
  * user's game project, enabling esbuild to bundle custom routes into the worker.
5183
5176
  */
5184
5177
  "@game-api": join3(workspace, "api"),
5185
- /**
5186
- * @playcademy/constants alias for edge-play sources
5187
- *
5188
- * Map the bare import to the package entry file, and also support
5189
- * subpath imports if they are added in the future.
5190
- */
5191
- "@playcademy/constants": join3(constantsSrc, "index.ts"),
5192
- "@playcademy/constants/*": join3(constantsSrc, "*"),
5193
5178
  /**
5194
5179
  * Node.js module polyfills for Cloudflare Workers environment
5195
5180
  *
package/dist/utils.js CHANGED
@@ -262,113 +262,14 @@ var init_file_loader = __esm({
262
262
  }
263
263
  });
264
264
 
265
- // ../constants/src/auth.ts
266
- var init_auth = __esm({
267
- "../constants/src/auth.ts"() {
268
- "use strict";
269
- }
270
- });
271
-
272
- // ../constants/src/domains.ts
273
- var init_domains = __esm({
274
- "../constants/src/domains.ts"() {
275
- "use strict";
276
- }
277
- });
278
-
279
- // ../constants/src/env-vars.ts
280
- var init_env_vars = __esm({
281
- "../constants/src/env-vars.ts"() {
282
- "use strict";
283
- }
284
- });
285
-
286
- // ../constants/src/overworld.ts
287
- var ITEM_SLUGS, CURRENCIES, BADGES, CORE_GAME_UUIDS;
288
- var init_overworld = __esm({
289
- "../constants/src/overworld.ts"() {
290
- "use strict";
291
- ITEM_SLUGS = {
292
- /** Primary platform currency */
293
- PLAYCADEMY_CREDITS: "PLAYCADEMY_CREDITS",
294
- /** Experience points currency */
295
- PLAYCADEMY_XP: "PLAYCADEMY_XP",
296
- /** Core platform badges */
297
- FOUNDING_MEMBER_BADGE: "FOUNDING_MEMBER_BADGE",
298
- EARLY_ADOPTER_BADGE: "EARLY_ADOPTER_BADGE",
299
- FIRST_GAME_BADGE: "FIRST_GAME_BADGE",
300
- /** Example items */
301
- COMMON_SWORD: "COMMON_SWORD",
302
- SMALL_HEALTH_POTION: "SMALL_HEALTH_POTION",
303
- SMALL_BACKPACK: "SMALL_BACKPACK",
304
- /** Placeable items */
305
- LAVA_LAMP: "LAVA_LAMP",
306
- BOOMBOX: "BOOMBOX",
307
- CABIN_BED: "CABIN_BED"
308
- };
309
- CURRENCIES = {
310
- /** Primary platform currency slug */
311
- PRIMARY: ITEM_SLUGS.PLAYCADEMY_CREDITS,
312
- /** Experience points slug */
313
- XP: ITEM_SLUGS.PLAYCADEMY_XP
314
- };
315
- BADGES = {
316
- FOUNDING_MEMBER: ITEM_SLUGS.FOUNDING_MEMBER_BADGE,
317
- EARLY_ADOPTER: ITEM_SLUGS.EARLY_ADOPTER_BADGE,
318
- FIRST_GAME: ITEM_SLUGS.FIRST_GAME_BADGE
319
- };
320
- CORE_GAME_UUIDS = {
321
- /** Internal playground game for development and testing */
322
- PLAYGROUND: "00000000-0000-0000-0000-000000000001"
323
- };
324
- }
325
- });
326
-
327
- // ../constants/src/system.ts
328
- var init_system = __esm({
329
- "../constants/src/system.ts"() {
330
- "use strict";
331
- }
332
- });
333
-
334
- // ../constants/src/timeback.ts
335
- var TIMEBACK_ROUTES;
336
- var init_timeback = __esm({
337
- "../constants/src/timeback.ts"() {
338
- "use strict";
339
- TIMEBACK_ROUTES = {
340
- END_ACTIVITY: "/integrations/timeback/end-activity"
341
- };
342
- }
343
- });
344
-
345
- // ../constants/src/workers.ts
346
- var init_workers = __esm({
347
- "../constants/src/workers.ts"() {
348
- "use strict";
349
- }
350
- });
351
-
352
- // ../constants/src/index.ts
353
- var init_src = __esm({
354
- "../constants/src/index.ts"() {
355
- "use strict";
356
- init_auth();
357
- init_domains();
358
- init_env_vars();
359
- init_overworld();
360
- init_system();
361
- init_timeback();
362
- init_workers();
363
- }
364
- });
365
-
366
265
  // ../edge-play/src/constants.ts
367
- var ROUTES;
266
+ var TIMEBACK_ROUTES, ROUTES;
368
267
  var init_constants = __esm({
369
268
  "../edge-play/src/constants.ts"() {
370
269
  "use strict";
371
- init_src();
270
+ TIMEBACK_ROUTES = {
271
+ END_ACTIVITY: "/integrations/timeback/end-activity"
272
+ };
372
273
  ROUTES = {
373
274
  /** Route index (lists available routes) */
374
275
  INDEX: "/api",
@@ -725,8 +626,40 @@ var CONFIG_FILE_NAMES = [
725
626
  "playcademy.config.mjs"
726
627
  ];
727
628
 
728
- // src/constants/urls.ts
729
- init_src();
629
+ // ../constants/src/overworld.ts
630
+ var ITEM_SLUGS = {
631
+ /** Primary platform currency */
632
+ PLAYCADEMY_CREDITS: "PLAYCADEMY_CREDITS",
633
+ /** Experience points currency */
634
+ PLAYCADEMY_XP: "PLAYCADEMY_XP",
635
+ /** Core platform badges */
636
+ FOUNDING_MEMBER_BADGE: "FOUNDING_MEMBER_BADGE",
637
+ EARLY_ADOPTER_BADGE: "EARLY_ADOPTER_BADGE",
638
+ FIRST_GAME_BADGE: "FIRST_GAME_BADGE",
639
+ /** Example items */
640
+ COMMON_SWORD: "COMMON_SWORD",
641
+ SMALL_HEALTH_POTION: "SMALL_HEALTH_POTION",
642
+ SMALL_BACKPACK: "SMALL_BACKPACK",
643
+ /** Placeable items */
644
+ LAVA_LAMP: "LAVA_LAMP",
645
+ BOOMBOX: "BOOMBOX",
646
+ CABIN_BED: "CABIN_BED"
647
+ };
648
+ var CURRENCIES = {
649
+ /** Primary platform currency slug */
650
+ PRIMARY: ITEM_SLUGS.PLAYCADEMY_CREDITS,
651
+ /** Experience points slug */
652
+ XP: ITEM_SLUGS.PLAYCADEMY_XP
653
+ };
654
+ var BADGES = {
655
+ FOUNDING_MEMBER: ITEM_SLUGS.FOUNDING_MEMBER_BADGE,
656
+ EARLY_ADOPTER: ITEM_SLUGS.EARLY_ADOPTER_BADGE,
657
+ FIRST_GAME: ITEM_SLUGS.FIRST_GAME_BADGE
658
+ };
659
+ var CORE_GAME_UUIDS = {
660
+ /** Internal playground game for development and testing */
661
+ PLAYGROUND: "00000000-0000-0000-0000-000000000001"
662
+ };
730
663
 
731
664
  // src/lib/config/loader.ts
732
665
  var ConfigError = class extends Error {
@@ -946,7 +879,6 @@ function processConfigVariables(config) {
946
879
  }
947
880
 
948
881
  // src/lib/dev/server.ts
949
- init_src();
950
882
  import { join as join2 } from "path";
951
883
  import { serve } from "@hono/node-server";
952
884
  import { Hono } from "hono";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playcademy",
3
- "version": "0.11.11",
3
+ "version": "0.11.13",
4
4
  "type": "module",
5
5
  "module": "./dist/index.js",
6
6
  "exports": {