@koloseum/utils 0.3.8 → 0.3.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/client.d.ts CHANGED
@@ -128,15 +128,4 @@ export declare const Interface: {
128
128
  * @returns `true` if the page is active, `false` otherwise.
129
129
  */
130
130
  pageIsActive: (page: Page, slug: string | undefined, microservice?: Microservice<MicroserviceGroup>, base?: string) => boolean;
131
- /**
132
- * Resolves a path and returns the result.
133
- * Wraps around the `resolve` function in SvelteKit's `$app/paths` module.
134
- *
135
- * https://svelte.dev/docs/kit/$app-paths#resolve
136
- *
137
- * @param path - The path to resolve
138
- * @param params - The parameters to resolve the path with
139
- * @returns {string} The resolved path without the leading dot
140
- */
141
- resolvePath: (path: string, params?: Record<string, string>) => Promise<string>;
142
131
  };
package/dist/client.js CHANGED
@@ -693,20 +693,5 @@ export const Interface = {
693
693
  // Match exact or subpath otherwise
694
694
  const target = `${cleanBase}/${slug}`;
695
695
  return page.url.pathname === target || page.url.pathname.startsWith(`${target}/`);
696
- },
697
- /**
698
- * Resolves a path and returns the result.
699
- * Wraps around the `resolve` function in SvelteKit's `$app/paths` module.
700
- *
701
- * https://svelte.dev/docs/kit/$app-paths#resolve
702
- *
703
- * @param path - The path to resolve
704
- * @param params - The parameters to resolve the path with
705
- * @returns {string} The resolved path without the leading dot
706
- */
707
- resolvePath: async (path, params = {}) => {
708
- const { resolve } = await import("$app/paths");
709
- const resolved = resolve(path, params);
710
- return resolved.charAt(0) === "." ? resolved.slice(1) : resolved;
711
696
  }
712
697
  };
package/dist/server.d.ts CHANGED
@@ -16,6 +16,15 @@ export declare const Instance: {
16
16
  error?: string;
17
17
  context?: Record<string, any>;
18
18
  }>;
19
+ /**
20
+ * Gets the current Koloseum Credits balance for the authenticated Lounge (Superuser and Manager only).
21
+ * @param {SupabaseClient<Database>} supabase - The Supabase client
22
+ * @returns {Promise<{ credits?: number; error?: CustomError }>} The Lounge's current `credits`, or an `error` if any has occurred
23
+ */
24
+ getLoungeCreditsBalance: (supabase: SupabaseClient<Database>) => Promise<{
25
+ credits?: number;
26
+ error?: CustomError;
27
+ }>;
19
28
  /**
20
29
  * Gets the current Koloseum Experience Points (KXP) and Koloseum Credits balances for the authenticated Player.
21
30
  * @param {SupabaseClient<Database>} supabase - The Supabase client
package/dist/server.js CHANGED
@@ -72,6 +72,19 @@ export const Instance = {
72
72
  return { code: 500, error: Status.ERROR };
73
73
  }
74
74
  },
75
+ /**
76
+ * Gets the current Koloseum Credits balance for the authenticated Lounge (Superuser and Manager only).
77
+ * @param {SupabaseClient<Database>} supabase - The Supabase client
78
+ * @returns {Promise<{ credits?: number; error?: CustomError }>} The Lounge's current `credits`, or an `error` if any has occurred
79
+ */
80
+ getLoungeCreditsBalance: async (supabase) => {
81
+ // Get Lounge credits balance
82
+ const { data: credits, error: creditsError } = await supabase.schema("compliance").rpc("get_lounge_credits_balance");
83
+ if (creditsError)
84
+ return Exception.parsePostgrestError(creditsError);
85
+ // Return credits balance
86
+ return { credits: Number(credits ?? 0) };
87
+ },
75
88
  /**
76
89
  * Gets the current Koloseum Experience Points (KXP) and Koloseum Credits balances for the authenticated Player.
77
90
  * @param {SupabaseClient<Database>} supabase - The Supabase client
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koloseum/utils",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "author": "Koloseum Technologies Limited",
5
5
  "type": "module",
6
6
  "description": "Utility logic for use across Koloseum web apps (TypeScript)",
@@ -62,7 +62,7 @@
62
62
  "validator": "^13.15.15"
63
63
  },
64
64
  "devDependencies": {
65
- "@koloseum/types": "^0.3.7",
65
+ "@koloseum/types": "^0.3.10",
66
66
  "@playwright/test": "^1.55.0",
67
67
  "@suprsend/web-components": "^0.4.0",
68
68
  "@types/sanitize-html": "^2.16.0",