@playcademy/sdk 0.1.8 → 0.1.10

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
@@ -4177,6 +4177,7 @@ declare class PlaycademyClient {
4177
4177
  delete<T = unknown>(path: string, headers?: Record<string, string>): Promise<T>;
4178
4178
  request<T = unknown>(path: string, method: Method, body?: unknown, headers?: Record<string, string>): Promise<T>;
4179
4179
  download(path: string, method?: Method, body?: unknown, headers?: Record<string, string>): Promise<Response>;
4180
+ url(pathOrStrings: string | TemplateStringsArray, ...values: unknown[]): string;
4180
4181
  };
4181
4182
  /** Auto-initializes a PlaycademyClient with context from the environment */
4182
4183
  static init: typeof init;
package/dist/index.js CHANGED
@@ -2310,6 +2310,17 @@ function createBackendNamespace(client) {
2310
2310
  },
2311
2311
  async download(path, method = "GET", body, headers) {
2312
2312
  return client["requestGameBackend"](normalizePath(path), method, body, headers, true);
2313
+ },
2314
+ url(pathOrStrings, ...values) {
2315
+ if (Array.isArray(pathOrStrings) && "raw" in pathOrStrings) {
2316
+ const strings = pathOrStrings;
2317
+ const path2 = strings.reduce((acc, str, i) => {
2318
+ return acc + str + (values[i] != null ? String(values[i]) : "");
2319
+ }, "");
2320
+ return `${client.gameUrl}/api${path2.startsWith("/") ? path2 : `/${path2}`}`;
2321
+ }
2322
+ const path = pathOrStrings;
2323
+ return `${client.gameUrl}/api${path.startsWith("/") ? path : `/${path}`}`;
2313
2324
  }
2314
2325
  };
2315
2326
  }
package/dist/types.d.ts CHANGED
@@ -4865,6 +4865,7 @@ declare class PlaycademyClient {
4865
4865
  delete<T = unknown>(path: string, headers?: Record<string, string>): Promise<T>;
4866
4866
  request<T = unknown>(path: string, method: Method, body?: unknown, headers?: Record<string, string>): Promise<T>;
4867
4867
  download(path: string, method?: Method, body?: unknown, headers?: Record<string, string>): Promise<Response>;
4868
+ url(pathOrStrings: string | TemplateStringsArray, ...values: unknown[]): string;
4868
4869
  };
4869
4870
  /** Auto-initializes a PlaycademyClient with context from the environment */
4870
4871
  static init: typeof init;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcademy/sdk",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
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.19",
45
+ "playcademy": "0.13.21",
46
46
  "rollup": "^4.50.2",
47
47
  "rollup-plugin-dts": "^6.2.3",
48
48
  "typescript": "^5.7.2",