monacloud-mcp 0.4.0 → 0.4.1
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/clients.js +5 -2
- package/package.json +1 -1
package/dist/clients.js
CHANGED
|
@@ -75,8 +75,11 @@ export class CloudClients {
|
|
|
75
75
|
const status = error instanceof CloudError ? error.status ?? 0 : 0;
|
|
76
76
|
if (!(error instanceof CloudError) || ![401, 403, 404, 502, 503].includes(status))
|
|
77
77
|
throw error;
|
|
78
|
-
const
|
|
79
|
-
const
|
|
78
|
+
const root = asObject(unwrapData(await this.vibecloud('/api/me')));
|
|
79
|
+
const me = asObject(root.user ?? root); // compute trả {user:{credit_vnd, promo_credit_vnd, total_credit_vnd}}
|
|
80
|
+
const balanceVnd = me.total_credit_vnd !== undefined
|
|
81
|
+
? Number(me.total_credit_vnd)
|
|
82
|
+
: Number(me.credit_vnd ?? me.balance_vnd ?? 0) + Number(me.promo_credit_vnd ?? 0);
|
|
80
83
|
return {
|
|
81
84
|
balance_vnd: Number.isFinite(balanceVnd) ? balanceVnd : 0,
|
|
82
85
|
currency: 'VND',
|