@koloseum/utils 0.3.9 → 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/server.d.ts +9 -0
- package/dist/server.js +13 -0
- package/package.json +2 -2
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.
|
|
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.
|
|
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",
|