@crowdedkingdoms/crowdyjs 8.15.0 → 8.16.0
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/README.md +16 -1
- package/dist/crowdy-client.d.ts +12 -0
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +9 -0
- package/dist/domains/admin.d.ts +4 -0
- package/dist/domains/admin.d.ts.map +1 -1
- package/dist/domains/admin.js +1 -0
- package/dist/domains/apps.d.ts +28 -1
- package/dist/domains/apps.d.ts.map +1 -1
- package/dist/domains/apps.js +52 -1
- package/dist/domains/gameApps.d.ts +17 -1
- package/dist/domains/gameApps.d.ts.map +1 -1
- package/dist/domains/gameApps.js +29 -1
- package/dist/domains/marketplace.d.ts +137 -0
- package/dist/domains/marketplace.d.ts.map +1 -0
- package/dist/domains/marketplace.js +241 -0
- package/dist/domains/playerCompute.d.ts +85 -0
- package/dist/domains/playerCompute.d.ts.map +1 -0
- package/dist/domains/playerCompute.js +127 -0
- package/dist/domains/playerModel.d.ts +20 -0
- package/dist/domains/playerModel.d.ts.map +1 -0
- package/dist/domains/playerModel.js +54 -0
- package/dist/domains/playerWallet.d.ts +59 -0
- package/dist/domains/playerWallet.d.ts.map +1 -0
- package/dist/domains/playerWallet.js +106 -0
- package/dist/generated/graphql.d.ts +3357 -125
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +185 -1
- package/dist/index.d.ts +12 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/kit/npcs.d.ts.map +1 -1
- package/dist/kit/social.d.ts.map +1 -1
- package/dist/live-coding/live-coding-controller.d.ts +73 -0
- package/dist/live-coding/live-coding-controller.d.ts.map +1 -0
- package/dist/live-coding/live-coding-controller.js +140 -0
- package/dist/live-coding/mount.d.ts +26 -0
- package/dist/live-coding/mount.d.ts.map +1 -0
- package/dist/live-coding/mount.js +108 -0
- package/dist/live-coding/templates.d.ts +17 -0
- package/dist/live-coding/templates.d.ts.map +1 -0
- package/dist/live-coding/templates.js +59 -0
- package/dist/player-runtime/player-code-broker.d.ts +101 -0
- package/dist/player-runtime/player-code-broker.d.ts.map +1 -0
- package/dist/player-runtime/player-code-broker.js +251 -0
- package/dist/player-runtime/player-glue-worker.d.ts +62 -0
- package/dist/player-runtime/player-glue-worker.d.ts.map +1 -0
- package/dist/player-runtime/player-glue-worker.js +127 -0
- package/package.json +1 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { PlayerWalletBalanceDocument, PlayerWalletTransactionsDocument, PlayerUsageChargesDocument, PlayerSpendCapsDocument, SetPlayerSpendCapDocument, PlayerAutoBillingDocument, SetPlayerAutoBillingDocument, BeginPlayerCardSetupDocument, PlayerRuntimeStatesDocument, PlayerWasmPoliciesDocument, SetPlayerWasmPolicyDocument, DeletePlayerWasmPolicyDocument, PlayerRateMarkupDocument, SetPlayerRateMarkupDocument, AppPlayerUsageDocument, AppPlayerMarkupAccruedDocument, } from '../generated/graphql.js';
|
|
2
|
+
/**
|
|
3
|
+
* The player wallet and player-billing surface (player compute P2, DN-5) —
|
|
4
|
+
* exposed as `client.playerWallet` and routed to the Management API.
|
|
5
|
+
*
|
|
6
|
+
* Every viewer-scoped call operates on the CALLER's own wallet: balance,
|
|
7
|
+
* ledger, hourly usage charges (platform vs studio-markup split), self-set
|
|
8
|
+
* spend caps, auto-recharge config, and per-app gate states. Fund the wallet
|
|
9
|
+
* via `client.payments.createCheckout` with purpose `PLAYER_WALLET_TOPUP`.
|
|
10
|
+
*
|
|
11
|
+
* The studio-scoped calls (policies, markup, per-player usage, accrued
|
|
12
|
+
* markup) require the corresponding org permissions (`manage_compute`,
|
|
13
|
+
* `manage_billing`, `view_compute_diagnostics`, `view_billing`).
|
|
14
|
+
*/
|
|
15
|
+
export class PlayerWalletAPI {
|
|
16
|
+
constructor(graphql) {
|
|
17
|
+
this.graphql = graphql;
|
|
18
|
+
}
|
|
19
|
+
/** The caller's wallet, created empty on first access (never null). */
|
|
20
|
+
async balance() {
|
|
21
|
+
const data = await this.graphql.request(PlayerWalletBalanceDocument, {});
|
|
22
|
+
return data.playerWalletBalance;
|
|
23
|
+
}
|
|
24
|
+
/** The caller's wallet ledger, newest first. */
|
|
25
|
+
async transactions(variables = {}) {
|
|
26
|
+
const data = await this.graphql.request(PlayerWalletTransactionsDocument, variables);
|
|
27
|
+
return data.playerWalletTransactions;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The caller's posted hourly usage charges; each splits platformCents vs
|
|
31
|
+
* markupCents with a per-metric snapshot ("what is this grid costing me").
|
|
32
|
+
*/
|
|
33
|
+
async charges(variables = {}) {
|
|
34
|
+
const data = await this.graphql.request(PlayerUsageChargesDocument, variables);
|
|
35
|
+
return data.playerUsageCharges;
|
|
36
|
+
}
|
|
37
|
+
/** The caller's self-set spend caps with running counters. */
|
|
38
|
+
async spendCaps() {
|
|
39
|
+
const data = await this.graphql.request(PlayerSpendCapsDocument, {});
|
|
40
|
+
return data.playerSpendCaps;
|
|
41
|
+
}
|
|
42
|
+
/** Set (or clear with null limits) a global or per-app self spend cap. */
|
|
43
|
+
async setSpendCap(variables) {
|
|
44
|
+
const data = await this.graphql.request(SetPlayerSpendCapDocument, variables);
|
|
45
|
+
return data.setPlayerSpendCap;
|
|
46
|
+
}
|
|
47
|
+
/** The caller's auto-recharge settings. */
|
|
48
|
+
async autoBilling() {
|
|
49
|
+
const data = await this.graphql.request(PlayerAutoBillingDocument, {});
|
|
50
|
+
return data.playerAutoBilling;
|
|
51
|
+
}
|
|
52
|
+
/** Configure auto-recharge (requires a vaulted payment method to enable). */
|
|
53
|
+
async setAutoBilling(variables) {
|
|
54
|
+
const data = await this.graphql.request(SetPlayerAutoBillingDocument, variables);
|
|
55
|
+
return data.setPlayerAutoBilling;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Begin vaulting a card on the caller's player wallet (P4b): returns the
|
|
59
|
+
* Stripe SetupIntent client secret + publishable key the browser confirms.
|
|
60
|
+
* On success the card is saved for wallet auto-recharge and rent auto-renew.
|
|
61
|
+
*/
|
|
62
|
+
async beginCardSetup() {
|
|
63
|
+
const data = await this.graphql.request(BeginPlayerCardSetupDocument, {});
|
|
64
|
+
return data.beginPlayerCardSetup;
|
|
65
|
+
}
|
|
66
|
+
/** The caller's per-app gate states (absence means active). */
|
|
67
|
+
async runtimeStates() {
|
|
68
|
+
const data = await this.graphql.request(PlayerRuntimeStatesDocument, {});
|
|
69
|
+
return data.playerRuntimeStates;
|
|
70
|
+
}
|
|
71
|
+
/** Studio: list an app's player policy rows (`view_compute_diagnostics`). */
|
|
72
|
+
async policies(variables) {
|
|
73
|
+
const data = await this.graphql.request(PlayerWasmPoliciesDocument, variables);
|
|
74
|
+
return data.playerWasmPolicies;
|
|
75
|
+
}
|
|
76
|
+
/** Studio: upsert a player policy row (`manage_compute`). */
|
|
77
|
+
async setPolicy(variables) {
|
|
78
|
+
const data = await this.graphql.request(SetPlayerWasmPolicyDocument, variables);
|
|
79
|
+
return data.setPlayerWasmPolicy;
|
|
80
|
+
}
|
|
81
|
+
/** Studio: delete a player policy row (`manage_compute`). */
|
|
82
|
+
async deletePolicy(variables) {
|
|
83
|
+
const data = await this.graphql.request(DeletePlayerWasmPolicyDocument, variables);
|
|
84
|
+
return data.deletePlayerWasmPolicy;
|
|
85
|
+
}
|
|
86
|
+
/** Studio: read the app's player rate-card markup in bps (`view_billing`). */
|
|
87
|
+
async rateMarkup(variables) {
|
|
88
|
+
const data = await this.graphql.request(PlayerRateMarkupDocument, variables);
|
|
89
|
+
return data.playerRateMarkup;
|
|
90
|
+
}
|
|
91
|
+
/** Studio: set the app's player rate-card markup in bps (`manage_billing`). */
|
|
92
|
+
async setRateMarkup(variables) {
|
|
93
|
+
const data = await this.graphql.request(SetPlayerRateMarkupDocument, variables);
|
|
94
|
+
return data.setPlayerRateMarkup;
|
|
95
|
+
}
|
|
96
|
+
/** Studio: per-player usage aggregate (`view_compute_diagnostics`). */
|
|
97
|
+
async appPlayerUsage(variables) {
|
|
98
|
+
const data = await this.graphql.request(AppPlayerUsageDocument, variables);
|
|
99
|
+
return data.appPlayerUsage;
|
|
100
|
+
}
|
|
101
|
+
/** Studio: total accrued markup income in cents (`view_billing`). */
|
|
102
|
+
async appMarkupAccrued(variables) {
|
|
103
|
+
const data = await this.graphql.request(AppPlayerMarkupAccruedDocument, variables);
|
|
104
|
+
return data.appPlayerMarkupAccrued;
|
|
105
|
+
}
|
|
106
|
+
}
|