@crowdedkingdoms/crowdyjs 18.4.0-dev.1 → 18.4.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 +13 -17
- package/dist/default-origin.d.ts +6 -6
- package/dist/default-origin.d.ts.map +1 -1
- package/dist/default-origin.js +6 -6
- package/dist/generated/graphql.d.ts +25 -3
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/grid-scope.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/kit/social.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,23 +12,19 @@ gameplay, minted per app through `client.portal`.
|
|
|
12
12
|
|
|
13
13
|
Start here:
|
|
14
14
|
|
|
15
|
-
- [SDK guide](https://docs.
|
|
15
|
+
- [SDK guide](https://docs.crowdedkingdoms.com/crowdyjs/readme) — the canonical
|
|
16
16
|
walkthrough of everything in this README.
|
|
17
|
-
- [Build a game](https://docs.
|
|
17
|
+
- [Build a game](https://docs.crowdedkingdoms.com/build-a-game/intro) — a
|
|
18
18
|
hands-on tutorial from sign-in to a playable voxel game.
|
|
19
|
-
- [Platform overview](https://docs.
|
|
19
|
+
- [Platform overview](https://docs.crowdedkingdoms.com/overview/client-workflow)
|
|
20
20
|
— how a client session flows through the platform.
|
|
21
21
|
|
|
22
22
|
## Install
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
npm install @crowdedkingdoms/crowdyjs
|
|
25
|
+
npm install @crowdedkingdoms/crowdyjs
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
This README is the `dev` branch's: it documents the release on the `dev` dist-tag
|
|
29
|
-
(`npm view @crowdedkingdoms/crowdyjs dist-tags`), and its links go to the dev docs site. A
|
|
30
|
-
plain `npm install` resolves `latest`, the production release, which has no `client.exec`.
|
|
31
|
-
|
|
32
28
|
CrowdyJS targets browsers by default and uses native `fetch`, `WebSocket`,
|
|
33
29
|
`crypto`, `btoa`, and `atob`. Node tools can still use the SDK, but must
|
|
34
30
|
provide browser-compatible globals when opening realtime connections (e.g.
|
|
@@ -187,8 +183,8 @@ Notes:
|
|
|
187
183
|
- Use `client.auth.setToken(token)` to seed a token externally (e.g. when
|
|
188
184
|
restoring auth from a non-default storage).
|
|
189
185
|
|
|
190
|
-
Deeper reading: [Portals & app-scoped tokens](https://docs.
|
|
191
|
-
and [Sign in](https://docs.
|
|
186
|
+
Deeper reading: [Portals & app-scoped tokens](https://docs.crowdedkingdoms.com/management-api/portals-and-app-tokens)
|
|
187
|
+
and [Sign in](https://docs.crowdedkingdoms.com/management-api/authentication).
|
|
192
188
|
|
|
193
189
|
### Token refresh during gameplay
|
|
194
190
|
|
|
@@ -311,7 +307,7 @@ query AppForRouting($appId: BigInt!) {
|
|
|
311
307
|
`CrowdyClient` with `httpUrl: gameApiUrl` (and the matching `wsUrl`) holding
|
|
312
308
|
that app's app-scoped token, then drive gameplay through that client. Apps
|
|
313
309
|
with no `gameApiUrl` keep working against the default `httpUrl` you
|
|
314
|
-
configured. See [Loading an app's Game API](https://docs.
|
|
310
|
+
configured. See [Loading an app's Game API](https://docs.crowdedkingdoms.com/crowdyjs/shared-environment-routing).
|
|
315
311
|
|
|
316
312
|
## Realtime notifications
|
|
317
313
|
|
|
@@ -622,7 +618,7 @@ reach your bundle. Reads are synchronous snapshots and writes happen on
|
|
|
622
618
|
WebSocket events (not `requestAnimationFrame`), so render loops read freely
|
|
623
619
|
and a backgrounded tab keeps ingesting updates; pass `workerTicker()` to also
|
|
624
620
|
keep timer-driven sends at full rate while hidden. See the
|
|
625
|
-
[World Stores guide](https://docs.
|
|
621
|
+
[World Stores guide](https://docs.crowdedkingdoms.com/crowdyjs/stores).
|
|
626
622
|
|
|
627
623
|
## Game Kit
|
|
628
624
|
|
|
@@ -705,7 +701,7 @@ exec.onReconnect((host) => console.log('moved to', host));
|
|
|
705
701
|
|
|
706
702
|
Integers above 2^53 decode as `number` and lose precision unless you pass
|
|
707
703
|
`{ decode: { useBigInt64: true } }`. The wire format is in the
|
|
708
|
-
[ck-exec docs](https://docs.
|
|
704
|
+
[ck-exec docs](https://docs.crowdedkingdoms.com/exec/intro).
|
|
709
705
|
|
|
710
706
|
### A mod's CLIENT half
|
|
711
707
|
|
|
@@ -776,7 +772,7 @@ counts what was dropped); `invoke` sends at most 256 KiB each way and is refused
|
|
|
776
772
|
module is not running. `NOT_FOUND` holds a CLIENT half back 15 s and `RATE_LIMITED` 60 s. The
|
|
777
773
|
grid's owner is asked about their own CLIENT halves like anyone; answer yes in `confirm` when
|
|
778
774
|
`prompt.authorId` is the player. See
|
|
779
|
-
[CLIENT halves](https://docs.
|
|
775
|
+
[CLIENT halves](https://docs.crowdedkingdoms.com/exec/client-halves).
|
|
780
776
|
|
|
781
777
|
## Hosting a game on Crowdy Games
|
|
782
778
|
|
|
@@ -895,8 +891,8 @@ CLIENT project needs ck-api `v2.25.1` or later. A CLIENT crate still on the lega
|
|
|
895
891
|
`mountCrowdyStudio` and the controller take `mods: client.exec`. Crowdy Studio runs nothing
|
|
896
892
|
on legacy player compute since 18.0.0.
|
|
897
893
|
|
|
898
|
-
See [CLIENT halves](https://docs.
|
|
899
|
-
and [Embed Crowdy Studio in your game](https://docs.
|
|
894
|
+
See [CLIENT halves](https://docs.crowdedkingdoms.com/exec/client-halves), [mods](https://docs.crowdedkingdoms.com/exec/mods)
|
|
895
|
+
and [Embed Crowdy Studio in your game](https://docs.crowdedkingdoms.com/crowdyjs/crowdy-studio-embed).
|
|
900
896
|
|
|
901
897
|
### The Studio agent (DeepSeek Harness in the browser)
|
|
902
898
|
|
|
@@ -1074,7 +1070,7 @@ no other repositories and no network access required:
|
|
|
1074
1070
|
- `src/generated/graphql.ts` — generated TypeScript operation types.
|
|
1075
1071
|
|
|
1076
1072
|
Schema refresh is explicit, from the published
|
|
1077
|
-
[SDL](https://docs.
|
|
1073
|
+
[SDL](https://docs.crowdedkingdoms.com/schema/game-api.graphql):
|
|
1078
1074
|
|
|
1079
1075
|
```bash
|
|
1080
1076
|
npm run schema:sync:prod
|
package/dist/default-origin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GENERATED — do not edit. The operator tooling's
|
|
3
|
-
* `sync-client-origins.mjs --write --tier
|
|
3
|
+
* `sync-client-origins.mjs --write --tier prod` writes this file, and
|
|
4
4
|
* `check-sdk-default-origin.mjs` refuses it when it names the wrong tier or a
|
|
5
5
|
* host that declaration does not carry. Regenerate; never hand-edit.
|
|
6
6
|
*
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
* than no default at all. Every fallback this SDK ever removed named a host that
|
|
11
11
|
* was already dead. A generated file plus a gate is what makes this one different.
|
|
12
12
|
*
|
|
13
|
-
* Source: the operator's per-tier public CK API origin declaration, tier '
|
|
13
|
+
* Source: the operator's per-tier public CK API origin declaration, tier 'prod'
|
|
14
14
|
*/
|
|
15
15
|
/** The tier this build of the SDK is published for. */
|
|
16
|
-
export declare const CROWDY_DEFAULT_TIER = "
|
|
16
|
+
export declare const CROWDY_DEFAULT_TIER = "prod";
|
|
17
17
|
/** The public CK API origin for that tier. */
|
|
18
|
-
export declare const CROWDY_DEFAULT_HTTP_ORIGIN = "https://ck.
|
|
18
|
+
export declare const CROWDY_DEFAULT_HTTP_ORIGIN = "https://ck.prod.crowdedkingdoms.com";
|
|
19
19
|
/** The same host over WebSocket. A scheme is composed; a hostname is looked up. */
|
|
20
|
-
export declare const CROWDY_DEFAULT_WS_ORIGIN = "wss://ck.
|
|
20
|
+
export declare const CROWDY_DEFAULT_WS_ORIGIN = "wss://ck.prod.crowdedkingdoms.com";
|
|
21
21
|
/** The bare hostname, for callers that need to compare rather than dial. */
|
|
22
|
-
export declare const CROWDY_DEFAULT_HOST = "ck.
|
|
22
|
+
export declare const CROWDY_DEFAULT_HOST = "ck.prod.crowdedkingdoms.com";
|
|
23
23
|
//# sourceMappingURL=default-origin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-origin.d.ts","sourceRoot":"","sources":["../src/default-origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"default-origin.d.ts","sourceRoot":"","sources":["../src/default-origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAE1C,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,wCAAwC,CAAC;AAEhF,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,sCAAsC,CAAC;AAE5E,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,gCAAgC,CAAC"}
|
package/dist/default-origin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GENERATED — do not edit. The operator tooling's
|
|
3
|
-
* `sync-client-origins.mjs --write --tier
|
|
3
|
+
* `sync-client-origins.mjs --write --tier prod` writes this file, and
|
|
4
4
|
* `check-sdk-default-origin.mjs` refuses it when it names the wrong tier or a
|
|
5
5
|
* host that declaration does not carry. Regenerate; never hand-edit.
|
|
6
6
|
*
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
* than no default at all. Every fallback this SDK ever removed named a host that
|
|
11
11
|
* was already dead. A generated file plus a gate is what makes this one different.
|
|
12
12
|
*
|
|
13
|
-
* Source: the operator's per-tier public CK API origin declaration, tier '
|
|
13
|
+
* Source: the operator's per-tier public CK API origin declaration, tier 'prod'
|
|
14
14
|
*/
|
|
15
15
|
/** The tier this build of the SDK is published for. */
|
|
16
|
-
export const CROWDY_DEFAULT_TIER = '
|
|
16
|
+
export const CROWDY_DEFAULT_TIER = 'prod';
|
|
17
17
|
/** The public CK API origin for that tier. */
|
|
18
|
-
export const CROWDY_DEFAULT_HTTP_ORIGIN = 'https://ck.
|
|
18
|
+
export const CROWDY_DEFAULT_HTTP_ORIGIN = 'https://ck.prod.crowdedkingdoms.com';
|
|
19
19
|
/** The same host over WebSocket. A scheme is composed; a hostname is looked up. */
|
|
20
|
-
export const CROWDY_DEFAULT_WS_ORIGIN = 'wss://ck.
|
|
20
|
+
export const CROWDY_DEFAULT_WS_ORIGIN = 'wss://ck.prod.crowdedkingdoms.com';
|
|
21
21
|
/** The bare hostname, for callers that need to compare rather than dial. */
|
|
22
|
-
export const CROWDY_DEFAULT_HOST = 'ck.
|
|
22
|
+
export const CROWDY_DEFAULT_HOST = 'ck.prod.crowdedkingdoms.com';
|
|
@@ -4635,7 +4635,7 @@ export type Mutation = {
|
|
|
4635
4635
|
setAppVisibility: App;
|
|
4636
4636
|
/** Enables or disables off-session auto-billing for an org and updates its thresholds. When enabled and the wallet falls to lowWaterThresholdCents, the saved payment method is charged rechargeAmountCents (requires setupSharedPaymentMethod first). Pass limitCents=null for no per-period cap. Requires the 'manage_billing' org permission. */
|
|
4637
4637
|
setAutoBilling: OrgAutoBilling;
|
|
4638
|
-
/** OPERATOR ONLY. Sets a metered dimension's price, the UNIT that price is quoted in, its free allowances, or any combination, and returns the new row alongside the values that moved. THIS IS THE ONLY SANCTIONED WAY TO CHANGE A PRICE OR A UNIT: the schema seeds use ON CONFLICT DO NOTHING, so a rate reaches a tier once at install and a unit corrected in the declaration never reaches a tier that already exists. Refuses an unknown or unmetered metric (a rate for a dimension nothing meters bills nobody while appearing configured), refuses a negative price, refuses unitLabel without unitQuantity (which would restate the rate card while the arithmetic kept the old divisor), and refuses a call that would change nothing. A unit change that also moves the money needs acknowledgeRepricing: true, so restating a price and cutting it cannot be confused. NOT RETROACTIVE: charges already written are history and the tick is idempotent per closed hour, so a new rate applies to hours billed from now on. Takes effect within about a minute — both billing ticks reload the card on every run, so no restart is needed. */
|
|
4638
|
+
/** OPERATOR ONLY. Sets a metered dimension's price, the UNIT that price is quoted in, its free allowances, or any combination, and returns the new row alongside the values that moved. THIS IS THE ONLY SANCTIONED WAY TO CHANGE A PRICE OR A UNIT: the schema seeds use ON CONFLICT DO NOTHING, so a rate reaches a tier once at install and a unit corrected in the declaration never reaches a tier that already exists. Refuses an unknown or unmetered metric (a rate for a dimension nothing meters bills nobody while appearing configured), refuses a negative price, refuses unitLabel without unitQuantity (which would restate the rate card while the arithmetic kept the old divisor), and refuses a call that would change nothing. A unit change that also moves the money needs acknowledgeRepricing: true, so restating a price and cutting it cannot be confused. priceBands sets a graduated schedule (SHARED aggregate_data_volume only; band 1 becomes priceCents) and clearPriceBands returns the dimension to one flat price; while a dimension is banded a bare priceCents or a unit change is refused. NOT RETROACTIVE: charges already written are history and the tick is idempotent per closed hour, so a new rate applies to hours billed from now on. Takes effect within about a minute — both billing ticks reload the card on every run, so no restart is needed. */
|
|
4639
4639
|
setBillingRate: SetRateCardResult;
|
|
4640
4640
|
/** Replace a member's channel roles with the given set (not additive — roles not listed are removed). Requires the 'manage_roles' channel permission (app admins bypass). Re-pushes the member's effective send permission to Buddy so their ability to post updates immediately. */
|
|
4641
4641
|
setChannelMemberRoles: GroupMember;
|
|
@@ -6203,6 +6203,8 @@ export type PublicRateCardEntryType = {
|
|
|
6203
6203
|
freeUnits: Maybe<Scalars['BigInt']['output']>;
|
|
6204
6204
|
/** The metered dimension, e.g. "graphql_recv_ops" or "player_wasm_compute_units". This is the key your usage is aggregated under, so it is what to match a bill line against. */
|
|
6205
6205
|
metric: Scalars['String']['output'];
|
|
6206
|
+
/** The graduated price, band by band, or null when the dimension has one flat price. Egress (aggregate_data_volume) is priced this way per app per calendar month: each GB is charged at the band the app's month-to-date total has reached, and priceCents is the first band's price. */
|
|
6207
|
+
priceBands: Maybe<Array<RateCardBandType>>;
|
|
6206
6208
|
/** Cents charged per unitQuantity raw units, above the free allowance. Fractional values are permitted. 0 means metered but not charged. */
|
|
6207
6209
|
priceCents: Scalars['Float']['output'];
|
|
6208
6210
|
/** Which card this row is on. */
|
|
@@ -7167,6 +7169,20 @@ export type QueryWalletTransactionsConnectionArgs = {
|
|
|
7167
7169
|
first?: InputMaybe<Scalars['Int']['input']>;
|
|
7168
7170
|
orgId: Scalars['BigInt']['input'];
|
|
7169
7171
|
};
|
|
7172
|
+
export type RateCardBandInput = {
|
|
7173
|
+
/** Cents per the row's unitQuantity raw units inside this band: >= 0, at most six decimals, and never more than the band below it. */
|
|
7174
|
+
priceCents: Scalars['Float']['input'];
|
|
7175
|
+
/** Exclusive upper edge of this band on the period's running total, in raw metric units, as a BigInt decimal string. Every band but the last needs one, strictly above the band before; the last band must leave it null. */
|
|
7176
|
+
upToUnits?: InputMaybe<Scalars['BigInt']['input']>;
|
|
7177
|
+
};
|
|
7178
|
+
/** One band of a graduated price. Each unit of the period's running total is priced at the band its position falls in, so the price of the next unit never rises as the total grows. Bands are edges on the whole total and count from zero: the free allowance fills the first band first. */
|
|
7179
|
+
export type RateCardBandType = {
|
|
7180
|
+
__typename?: 'RateCardBandType';
|
|
7181
|
+
/** Cents charged per the row's unitQuantity raw units for the units inside this band. Fractional values are permitted. */
|
|
7182
|
+
priceCents: Scalars['Float']['output'];
|
|
7183
|
+
/** Exclusive upper edge of this band on the period's running total, in raw metric units, as a BigInt decimal string. A band covers units from the previous band's edge up to this one. Null on the last band, which has no upper edge. */
|
|
7184
|
+
upToUnits: Maybe<Scalars['BigInt']['output']>;
|
|
7185
|
+
};
|
|
7170
7186
|
/** One priced dimension: its rate and, where it has one, its hourly free allowance. A dimension with a price of 0 is metered but not charged. */
|
|
7171
7187
|
export type RateCardEntryType = {
|
|
7172
7188
|
__typename?: 'RateCardEntryType';
|
|
@@ -7184,6 +7200,8 @@ export type RateCardEntryType = {
|
|
|
7184
7200
|
freeUnits: Maybe<Scalars['BigInt']['output']>;
|
|
7185
7201
|
/** The metered dimension, e.g. "graphql_recv_ops" or "player_wasm_compute_units". Matches a key the billing tick aggregates. */
|
|
7186
7202
|
metric: Scalars['String']['output'];
|
|
7203
|
+
/** The graduated price, band by band, or null when the dimension has one flat price. When present the bands price the period total and priceCents is the first band's price. aggregate_data_volume (egress) is the dimension priced this way. */
|
|
7204
|
+
priceBands: Maybe<Array<RateCardBandType>>;
|
|
7187
7205
|
/** Cents charged per unitQuantity raw units, above the free allowance. Fractional values are permitted (the column is NUMERIC(20,6)). 0 means metered but not charged. */
|
|
7188
7206
|
priceCents: Scalars['Float']['output'];
|
|
7189
7207
|
/** Which card this row is on. */
|
|
@@ -7196,10 +7214,10 @@ export type RateCardEntryType = {
|
|
|
7196
7214
|
/** One field that moved, with the value it held before. Reported so a price change is auditable from the response rather than reconstructed afterwards. */
|
|
7197
7215
|
export type RateChangeType = {
|
|
7198
7216
|
__typename?: 'RateChangeType';
|
|
7199
|
-
/** One of "priceCents", "unitLabel", "unitQuantity", "freeUnits", "freePeriod" or "freePerMonth". */
|
|
7217
|
+
/** One of "priceCents", "priceBands", "unitLabel", "unitQuantity", "freeUnits", "freePeriod" or "freePerMonth". */
|
|
7200
7218
|
field: Scalars['String']['output'];
|
|
7201
7219
|
metric: Scalars['String']['output'];
|
|
7202
|
-
/** The value before this call, as a decimal string. "none" when there was no allowance row. */
|
|
7220
|
+
/** The value before this call, as a decimal string; for priceBands the schedule as JSON. "none" when there was no allowance row, or no bands. */
|
|
7203
7221
|
previous: Scalars['String']['output'];
|
|
7204
7222
|
scope: RateScope;
|
|
7205
7223
|
/** The value after this call, as a decimal string. */
|
|
@@ -7804,6 +7822,8 @@ export type SetQuotaInput = {
|
|
|
7804
7822
|
export type SetRateCardInput = {
|
|
7805
7823
|
/** Required when a unit change also changes the money. Restating 19c per GiB as 1.769513c per 100 MB is the same price and needs nothing; changing 20c per 100 MB to 20c per GiB-month is a 7841x cut and must be stated deliberately. The mutation refuses rather than guessing which one you meant. */
|
|
7806
7824
|
acknowledgeRepricing?: InputMaybe<Scalars['Boolean']['input']>;
|
|
7825
|
+
/** true removes the dimension's bands so it is priced flat at priceCents (the former first band's price unless priceCents is also given). Not combinable with priceBands. */
|
|
7826
|
+
clearPriceBands?: InputMaybe<Scalars['Boolean']['input']>;
|
|
7807
7827
|
/** New hourly free allowance in raw metric units, as a BigInt decimal string. Must be >= 0. Omit to leave the allowance unchanged. */
|
|
7808
7828
|
freePerHour?: InputMaybe<Scalars['BigInt']['input']>;
|
|
7809
7829
|
/** New monthly free allowance in raw metric units, as a BigInt decimal string. Must be >= 0. On the PLAYER card with metric player_wasm_compute_units this is the pooled monthly TRIAL BUDGET per (player, app) — the only sanctioned way to change it on a live tier. Omit to leave it unchanged. */
|
|
@@ -7814,6 +7834,8 @@ export type SetRateCardInput = {
|
|
|
7814
7834
|
freeUnits?: InputMaybe<Scalars['BigInt']['input']>;
|
|
7815
7835
|
/** The metered dimension to reprice. Refused unless the platform actually meters it: a rate for an unmetered metric bills nobody while appearing configured. */
|
|
7816
7836
|
metric: Scalars['String']['input'];
|
|
7837
|
+
/** A whole graduated schedule, replacing the one the dimension holds: 1 to 10 bands, ascending edges, the last band open, no band dearer than the one below. Band 1's price becomes priceCents (supply priceCents only if it is the same). Accepted for SHARED aggregate_data_volume only. Like every price, it applies from a dimension's next period where a period has already been charged. */
|
|
7838
|
+
priceBands?: InputMaybe<Array<RateCardBandInput>>;
|
|
7817
7839
|
/** New price in cents per unitQuantity raw units. Must be >= 0; 0 means meter but do not charge. Omit to leave the price unchanged. Fractional values are accepted (the column is NUMERIC(20,6)). */
|
|
7818
7840
|
priceCents?: InputMaybe<Scalars['Float']['input']>;
|
|
7819
7841
|
/** Why this price is changing. Required: a rate change with no stated reason is not auditable after the fact. Recorded in the operator log with the before and after values. */
|