@crowdedkingdomstudios/crowdyjs 5.1.0 → 5.2.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/MIGRATION.md +64 -0
- package/README.md +19 -0
- package/dist/client.d.ts +98 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +74 -5
- package/dist/crowdy-client.d.ts +31 -0
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +8 -0
- package/dist/domains/actors.d.ts +88 -5
- package/dist/domains/actors.d.ts.map +1 -1
- package/dist/domains/actors.js +89 -6
- package/dist/domains/apps.d.ts +95 -41
- package/dist/domains/apps.d.ts.map +1 -1
- package/dist/domains/apps.js +80 -33
- package/dist/domains/auth.d.ts +139 -19
- package/dist/domains/auth.d.ts.map +1 -1
- package/dist/domains/auth.js +137 -17
- package/dist/domains/channels.d.ts +264 -5
- package/dist/domains/channels.d.ts.map +1 -1
- package/dist/domains/channels.js +264 -5
- package/dist/domains/chunks.d.ts +116 -3
- package/dist/domains/chunks.d.ts.map +1 -1
- package/dist/domains/chunks.js +116 -3
- package/dist/domains/gameModel.d.ts +412 -6
- package/dist/domains/gameModel.d.ts.map +1 -1
- package/dist/domains/gameModel.js +412 -6
- package/dist/domains/platform.d.ts +36 -20
- package/dist/domains/platform.d.ts.map +1 -1
- package/dist/domains/platform.js +29 -18
- package/dist/domains/serverStatus.d.ts +74 -6
- package/dist/domains/serverStatus.d.ts.map +1 -1
- package/dist/domains/serverStatus.js +74 -6
- package/dist/domains/state.d.ts +50 -2
- package/dist/domains/state.d.ts.map +1 -1
- package/dist/domains/state.js +50 -2
- package/dist/domains/teams.d.ts +265 -7
- package/dist/domains/teams.d.ts.map +1 -1
- package/dist/domains/teams.js +267 -9
- package/dist/domains/teleport.d.ts +30 -2
- package/dist/domains/teleport.d.ts.map +1 -1
- package/dist/domains/teleport.js +30 -2
- package/dist/domains/udp.d.ts +341 -5
- package/dist/domains/udp.d.ts.map +1 -1
- package/dist/domains/udp.js +341 -5
- package/dist/domains/users.d.ts +42 -11
- package/dist/domains/users.d.ts.map +1 -1
- package/dist/domains/users.js +41 -10
- package/dist/domains/voxels.d.ts +107 -2
- package/dist/domains/voxels.d.ts.map +1 -1
- package/dist/domains/voxels.js +107 -2
- package/dist/errors.d.ts +116 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +100 -0
- package/dist/generated/graphql.d.ts +1787 -110
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +75 -9
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/realtime.d.ts +226 -0
- package/dist/realtime.d.ts.map +1 -1
- package/dist/realtime.js +90 -0
- package/dist/session.d.ts +46 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +35 -0
- package/dist/types.d.ts +429 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +53 -0
- package/dist/utils.d.ts +86 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +86 -0
- package/dist/world.d.ts +192 -0
- package/dist/world.d.ts.map +1 -1
- package/dist/world.js +170 -0
- package/package.json +1 -1
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAG5B,MAAM,WAAW,gBAAgB;IAC/B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,qBAAqB;IACpC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAGD,MAAM,WAAW,gBAAgB;IAC/B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,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F;AAClF,MAAM,MAAM,0BAA0B,GAAG,CAAC,QAAQ,EAAE,mBAAmB,KAAK,IAAI,CAAC;AACjF,kFAAkF;AAClF,MAAM,MAAM,kBAAkB,GAAG,CAAC,YAAY,EAAE,uBAAuB,KAAK,IAAI,CAAC;AACjF,gFAAgF;AAChF,MAAM,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,sBAAsB,KAAK,IAAI,CAAC;AAC/E,mFAAmF;AACnF,MAAM,MAAM,kBAAkB,GAAG,CAAC,YAAY,EAAE,uBAAuB,KAAK,IAAI,CAAC;AACjF,wFAAwF;AACxF,MAAM,MAAM,kBAAkB,GAAG,CAAC,YAAY,EAAE,uBAAuB,KAAK,IAAI,CAAC;AACjF,kFAAkF;AAClF,MAAM,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,oBAAoB,KAAK,IAAI,CAAC;AAG3E;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -5,4 +5,57 @@
|
|
|
5
5
|
// exactly one canonical UdpErrorCode shape. The hand-written enum that
|
|
6
6
|
// used to live here drifted from the schema (`AppNotFound` etc.); see
|
|
7
7
|
// generated/graphql.ts for the source of truth.
|
|
8
|
+
/**
|
|
9
|
+
* Reason codes returned by the UDP game servers and surfaced on
|
|
10
|
+
* {@link GenericErrorResponse}'s `errorCode` (re-exported from the codegen enum
|
|
11
|
+
* so the SDK has exactly one canonical shape). `NoError` means success; every
|
|
12
|
+
* other value is a failure. The numeric value is the byte sent on the wire;
|
|
13
|
+
* the SDK exposes the name. Note that a failed message does **not** always
|
|
14
|
+
* produce an error — some auth failures are dropped silently.
|
|
15
|
+
*
|
|
16
|
+
* Each member and the server condition it represents:
|
|
17
|
+
* - `NoError` — no error (the byte `0`); the message was accepted.
|
|
18
|
+
* - `UnknownError` — unspecified server error (the byte `1`); retry, and report
|
|
19
|
+
* it if it persists.
|
|
20
|
+
* - `AppNotFound` — no app matches the supplied appId.
|
|
21
|
+
* - `AppNotLoaded` — the app exists but isn't currently loaded/active on this
|
|
22
|
+
* server.
|
|
23
|
+
* - `InvalidAppId` — the appId was missing, zero, or otherwise not valid.
|
|
24
|
+
* - `ChunkNotFound` — no chunk exists at the referenced coordinates.
|
|
25
|
+
* - `InvalidRequest` — the message was malformed or failed validation; check the
|
|
26
|
+
* byte layout.
|
|
27
|
+
* - `InvalidStateData` — the state/payload bytes were invalid for this message
|
|
28
|
+
* type.
|
|
29
|
+
* - `NameTooLong` — a supplied name exceeded the maximum length.
|
|
30
|
+
* - `UserNotAuthenticated` — this client has no authenticated session on the
|
|
31
|
+
* server; complete the UDP token handshake (or open the UDP proxy) before
|
|
32
|
+
* sending spatial messages.
|
|
33
|
+
* - `Unauthorized` — the caller lacks the runtime/grid permission for this
|
|
34
|
+
* action. Grid permissions can load asynchronously, so the first message into
|
|
35
|
+
* a newly entered region may transiently return this — retry shortly.
|
|
36
|
+
* - `UserNotAppAdmin` — the action requires app-admin privileges (the
|
|
37
|
+
* `manage_apps` permission).
|
|
38
|
+
* - `InvalidToken` — the game token was rejected (expired, malformed, or
|
|
39
|
+
* revoked); re-authenticate against the Management API for a fresh token.
|
|
40
|
+
* - `InvalidTokenLength` — the supplied token was not a valid length.
|
|
41
|
+
* - `GameTokenWrongSize` — the game token isn't the expected length; send the
|
|
42
|
+
* exact token returned by login (don't trim or re-encode it).
|
|
43
|
+
* - `GridAlreadyExists` — a grid already exists at these coordinates.
|
|
44
|
+
* - `GridOverlapsExisting` — the requested grid overlaps an existing grid.
|
|
45
|
+
* - `GridOutsideAssignment` — the target coordinates fall outside any grid
|
|
46
|
+
* assigned to the caller.
|
|
47
|
+
* - `InvalidGridCoordinates` — the grid coordinates were invalid.
|
|
48
|
+
* - `NoMatchingGridAssignment` — no grid assignment covers the referenced
|
|
49
|
+
* coordinates.
|
|
50
|
+
* - `BadPassword` — the password did not match (login validation).
|
|
51
|
+
* - `EmailNotFound` — no account matches the supplied email (login validation).
|
|
52
|
+
* - `EmailAlreadyExists` — registration failed because the email is already in
|
|
53
|
+
* use.
|
|
54
|
+
* - `EmailInvalid` — email failed format validation.
|
|
55
|
+
* - `EmailTooLong` / `EmailTooShort` — email failed maximum-/minimum-length
|
|
56
|
+
* validation.
|
|
57
|
+
* - `PasswordTooLong` / `PasswordTooShort` — password failed maximum-/minimum-
|
|
58
|
+
* length validation.
|
|
59
|
+
* - `GamertagAlreadyExists` — the requested gamertag is already taken.
|
|
60
|
+
*/
|
|
8
61
|
export { UdpErrorCode } from './generated/graphql.js';
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,12 +1,98 @@
|
|
|
1
1
|
import type { ChunkCoordinatesInput } from './generated/graphql.js';
|
|
2
|
+
/**
|
|
3
|
+
* Allocates the per-client `sequenceNumber` stamped on outgoing spatial
|
|
4
|
+
* messages (actor / voxel / audio / text / event sends). The `...AndWait`
|
|
5
|
+
* helpers use it to correlate each send with the echo or
|
|
6
|
+
* {@link GenericErrorResponse} the server fans back on the `udpNotifications`
|
|
7
|
+
* subscription (matched via `sequenceNumber`).
|
|
8
|
+
*
|
|
9
|
+
* Values are a single **unsigned byte**: they advance monotonically and wrap
|
|
10
|
+
* modulo 256 (…, 254, 255, 0, 1, …), mirroring the uint8 carried on the UDP
|
|
11
|
+
* wire. This is for **correlation only** — a `sequenceNumber` is *not* an
|
|
12
|
+
* idempotency key, and with just 256 distinct values you should treat an echo
|
|
13
|
+
* as matched as soon as it arrives rather than keeping many sends in flight at
|
|
14
|
+
* once.
|
|
15
|
+
*
|
|
16
|
+
* Allocate one instance per client/connection so its counter stays private to
|
|
17
|
+
* that session.
|
|
18
|
+
*/
|
|
2
19
|
export declare class SequenceAllocator {
|
|
3
20
|
private nextValue;
|
|
21
|
+
/**
|
|
22
|
+
* @param seed - The first value {@link next} will return, truncated to a
|
|
23
|
+
* byte (`seed & 0xff`). Defaults to `1`.
|
|
24
|
+
*/
|
|
4
25
|
constructor(seed?: number);
|
|
26
|
+
/**
|
|
27
|
+
* Return the current sequence value, then advance the counter by one
|
|
28
|
+
* (wrapping back to `0` after `255`).
|
|
29
|
+
*
|
|
30
|
+
* @returns The next sequence number to stamp on a send, in the inclusive
|
|
31
|
+
* range `0`–`255`.
|
|
32
|
+
*/
|
|
5
33
|
next(): number;
|
|
6
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Mint a fresh Crowdy actor id: 16 cryptographically random bytes rendered as
|
|
37
|
+
* **32 lowercase-hex ASCII characters** (e.g.
|
|
38
|
+
* `"0123456789abcdef0123456789abcdef"`).
|
|
39
|
+
*
|
|
40
|
+
* This is the UDP-wire actor id used throughout the SDK — it is **not** a
|
|
41
|
+
* hyphenated RFC-4122 UUID and carries no dashes or version/variant bits. The
|
|
42
|
+
* result always satisfies {@link validateCrowdyUuid} (exactly 32 ASCII bytes).
|
|
43
|
+
*
|
|
44
|
+
* Requires a Web Crypto `crypto.getRandomValues` global (present in browsers
|
|
45
|
+
* and modern Node, or polyfilled).
|
|
46
|
+
*
|
|
47
|
+
* @returns A new 32-character hex actor id.
|
|
48
|
+
*/
|
|
7
49
|
export declare function generateCrowdyUuid(): string;
|
|
50
|
+
/**
|
|
51
|
+
* Assert that `uuid` is a well-formed Crowdy actor id — **exactly 32 bytes
|
|
52
|
+
* when UTF-8 encoded**. Because the wire id is plain ASCII that means 32 ASCII
|
|
53
|
+
* characters; any non-ASCII character encodes to multiple bytes and so fails
|
|
54
|
+
* the check. Call it before sending an id you didn't obtain from
|
|
55
|
+
* {@link generateCrowdyUuid} or the server.
|
|
56
|
+
*
|
|
57
|
+
* @param uuid - The candidate actor id.
|
|
58
|
+
* @throws {CrowdyProtocolError} if the id is not exactly 32 UTF-8 bytes.
|
|
59
|
+
*/
|
|
8
60
|
export declare function validateCrowdyUuid(uuid: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Encode raw bytes as a base64 string for the SDK's binary fields — the
|
|
63
|
+
* `state`, `audioData`, `payload`, and similar blobs on spatial sends and
|
|
64
|
+
* notifications all travel as base64 over the wire.
|
|
65
|
+
*
|
|
66
|
+
* Uses the `btoa` global; each `Uint8Array` element is treated as one byte.
|
|
67
|
+
* Inverse of {@link decodeBase64}.
|
|
68
|
+
*
|
|
69
|
+
* @param bytes - The binary payload to encode.
|
|
70
|
+
* @returns The base64-encoded representation.
|
|
71
|
+
*/
|
|
9
72
|
export declare function encodeBase64(bytes: Uint8Array): string;
|
|
73
|
+
/**
|
|
74
|
+
* Decode a base64 string from a binary SDK/wire field (e.g. a notification's
|
|
75
|
+
* `state` / `audioData` / `payload`) back into raw bytes.
|
|
76
|
+
*
|
|
77
|
+
* Uses the `atob` global. Inverse of {@link encodeBase64}.
|
|
78
|
+
*
|
|
79
|
+
* @param value - The base64 text to decode.
|
|
80
|
+
* @returns The decoded bytes.
|
|
81
|
+
*/
|
|
10
82
|
export declare function decodeBase64(value: string): Uint8Array;
|
|
83
|
+
/**
|
|
84
|
+
* Assert that a chunk address fits the wire format: each of `x`, `y`, `z` must
|
|
85
|
+
* be a valid **signed 64-bit integer**
|
|
86
|
+
* (−9,223,372,036,854,775,808 … 9,223,372,036,854,775,807). Chunk coordinates
|
|
87
|
+
* travel as int64 decimal strings, so this guards against values that would
|
|
88
|
+
* overflow the server's int64 columns before you send them.
|
|
89
|
+
*
|
|
90
|
+
* Each axis is parsed with `BigInt()`, so a number or a decimal string is
|
|
91
|
+
* accepted; a non-integer literal is rejected by `BigInt()` itself (a native
|
|
92
|
+
* `SyntaxError`) before the range check runs.
|
|
93
|
+
*
|
|
94
|
+
* @param chunk - The chunk coordinates to validate.
|
|
95
|
+
* @throws {CrowdyProtocolError} if any axis is outside the signed int64 range.
|
|
96
|
+
*/
|
|
11
97
|
export declare function validateChunkCoordinates(chunk: ChunkCoordinatesInput): void;
|
|
12
98
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAW,MAAM,wBAAwB,CAAC;AAE7E,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,SAAS,CAAS;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAW,MAAM,wBAAwB,CAAC;AAE7E;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,SAAS,CAAS;IAE1B;;;OAGG;gBACS,IAAI,SAAI;IAIpB;;;;;;OAMG;IACH,IAAI,IAAI,MAAM;CAKf;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAM3C;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAMrD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAMtD;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAOtD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAS3E"}
|
package/dist/utils.js
CHANGED
|
@@ -1,14 +1,56 @@
|
|
|
1
1
|
import { CrowdyProtocolError } from './errors.js';
|
|
2
|
+
/**
|
|
3
|
+
* Allocates the per-client `sequenceNumber` stamped on outgoing spatial
|
|
4
|
+
* messages (actor / voxel / audio / text / event sends). The `...AndWait`
|
|
5
|
+
* helpers use it to correlate each send with the echo or
|
|
6
|
+
* {@link GenericErrorResponse} the server fans back on the `udpNotifications`
|
|
7
|
+
* subscription (matched via `sequenceNumber`).
|
|
8
|
+
*
|
|
9
|
+
* Values are a single **unsigned byte**: they advance monotonically and wrap
|
|
10
|
+
* modulo 256 (…, 254, 255, 0, 1, …), mirroring the uint8 carried on the UDP
|
|
11
|
+
* wire. This is for **correlation only** — a `sequenceNumber` is *not* an
|
|
12
|
+
* idempotency key, and with just 256 distinct values you should treat an echo
|
|
13
|
+
* as matched as soon as it arrives rather than keeping many sends in flight at
|
|
14
|
+
* once.
|
|
15
|
+
*
|
|
16
|
+
* Allocate one instance per client/connection so its counter stays private to
|
|
17
|
+
* that session.
|
|
18
|
+
*/
|
|
2
19
|
export class SequenceAllocator {
|
|
20
|
+
/**
|
|
21
|
+
* @param seed - The first value {@link next} will return, truncated to a
|
|
22
|
+
* byte (`seed & 0xff`). Defaults to `1`.
|
|
23
|
+
*/
|
|
3
24
|
constructor(seed = 1) {
|
|
4
25
|
this.nextValue = seed & 0xff;
|
|
5
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Return the current sequence value, then advance the counter by one
|
|
29
|
+
* (wrapping back to `0` after `255`).
|
|
30
|
+
*
|
|
31
|
+
* @returns The next sequence number to stamp on a send, in the inclusive
|
|
32
|
+
* range `0`–`255`.
|
|
33
|
+
*/
|
|
6
34
|
next() {
|
|
7
35
|
const value = this.nextValue;
|
|
8
36
|
this.nextValue = (this.nextValue + 1) & 0xff;
|
|
9
37
|
return value;
|
|
10
38
|
}
|
|
11
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Mint a fresh Crowdy actor id: 16 cryptographically random bytes rendered as
|
|
42
|
+
* **32 lowercase-hex ASCII characters** (e.g.
|
|
43
|
+
* `"0123456789abcdef0123456789abcdef"`).
|
|
44
|
+
*
|
|
45
|
+
* This is the UDP-wire actor id used throughout the SDK — it is **not** a
|
|
46
|
+
* hyphenated RFC-4122 UUID and carries no dashes or version/variant bits. The
|
|
47
|
+
* result always satisfies {@link validateCrowdyUuid} (exactly 32 ASCII bytes).
|
|
48
|
+
*
|
|
49
|
+
* Requires a Web Crypto `crypto.getRandomValues` global (present in browsers
|
|
50
|
+
* and modern Node, or polyfilled).
|
|
51
|
+
*
|
|
52
|
+
* @returns A new 32-character hex actor id.
|
|
53
|
+
*/
|
|
12
54
|
export function generateCrowdyUuid() {
|
|
13
55
|
const bytes = new Uint8Array(16);
|
|
14
56
|
crypto.getRandomValues(bytes);
|
|
@@ -16,6 +58,16 @@ export function generateCrowdyUuid() {
|
|
|
16
58
|
.map((byte) => byte.toString(16).padStart(2, '0'))
|
|
17
59
|
.join('');
|
|
18
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Assert that `uuid` is a well-formed Crowdy actor id — **exactly 32 bytes
|
|
63
|
+
* when UTF-8 encoded**. Because the wire id is plain ASCII that means 32 ASCII
|
|
64
|
+
* characters; any non-ASCII character encodes to multiple bytes and so fails
|
|
65
|
+
* the check. Call it before sending an id you didn't obtain from
|
|
66
|
+
* {@link generateCrowdyUuid} or the server.
|
|
67
|
+
*
|
|
68
|
+
* @param uuid - The candidate actor id.
|
|
69
|
+
* @throws {CrowdyProtocolError} if the id is not exactly 32 UTF-8 bytes.
|
|
70
|
+
*/
|
|
19
71
|
export function validateCrowdyUuid(uuid) {
|
|
20
72
|
if (new TextEncoder().encode(uuid).length !== 32) {
|
|
21
73
|
throw new CrowdyProtocolError({
|
|
@@ -23,6 +75,17 @@ export function validateCrowdyUuid(uuid) {
|
|
|
23
75
|
});
|
|
24
76
|
}
|
|
25
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Encode raw bytes as a base64 string for the SDK's binary fields — the
|
|
80
|
+
* `state`, `audioData`, `payload`, and similar blobs on spatial sends and
|
|
81
|
+
* notifications all travel as base64 over the wire.
|
|
82
|
+
*
|
|
83
|
+
* Uses the `btoa` global; each `Uint8Array` element is treated as one byte.
|
|
84
|
+
* Inverse of {@link decodeBase64}.
|
|
85
|
+
*
|
|
86
|
+
* @param bytes - The binary payload to encode.
|
|
87
|
+
* @returns The base64-encoded representation.
|
|
88
|
+
*/
|
|
26
89
|
export function encodeBase64(bytes) {
|
|
27
90
|
let binary = '';
|
|
28
91
|
for (const byte of bytes) {
|
|
@@ -30,6 +93,15 @@ export function encodeBase64(bytes) {
|
|
|
30
93
|
}
|
|
31
94
|
return btoa(binary);
|
|
32
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Decode a base64 string from a binary SDK/wire field (e.g. a notification's
|
|
98
|
+
* `state` / `audioData` / `payload`) back into raw bytes.
|
|
99
|
+
*
|
|
100
|
+
* Uses the `atob` global. Inverse of {@link encodeBase64}.
|
|
101
|
+
*
|
|
102
|
+
* @param value - The base64 text to decode.
|
|
103
|
+
* @returns The decoded bytes.
|
|
104
|
+
*/
|
|
33
105
|
export function decodeBase64(value) {
|
|
34
106
|
const binary = atob(value);
|
|
35
107
|
const bytes = new Uint8Array(binary.length);
|
|
@@ -38,6 +110,20 @@ export function decodeBase64(value) {
|
|
|
38
110
|
}
|
|
39
111
|
return bytes;
|
|
40
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Assert that a chunk address fits the wire format: each of `x`, `y`, `z` must
|
|
115
|
+
* be a valid **signed 64-bit integer**
|
|
116
|
+
* (−9,223,372,036,854,775,808 … 9,223,372,036,854,775,807). Chunk coordinates
|
|
117
|
+
* travel as int64 decimal strings, so this guards against values that would
|
|
118
|
+
* overflow the server's int64 columns before you send them.
|
|
119
|
+
*
|
|
120
|
+
* Each axis is parsed with `BigInt()`, so a number or a decimal string is
|
|
121
|
+
* accepted; a non-integer literal is rejected by `BigInt()` itself (a native
|
|
122
|
+
* `SyntaxError`) before the range check runs.
|
|
123
|
+
*
|
|
124
|
+
* @param chunk - The chunk coordinates to validate.
|
|
125
|
+
* @throws {CrowdyProtocolError} if any axis is outside the signed int64 range.
|
|
126
|
+
*/
|
|
41
127
|
export function validateChunkCoordinates(chunk) {
|
|
42
128
|
for (const axis of ['x', 'y', 'z']) {
|
|
43
129
|
const value = BigInt(chunk[axis]);
|
package/dist/world.d.ts
CHANGED
|
@@ -1,33 +1,212 @@
|
|
|
1
1
|
import type { UdpAPI } from './domains/udp.js';
|
|
2
2
|
import type { ActorUpdateRequestInput, ChunkCoordinatesInput, ClientEventNotificationInput, ClientTextPacketInput, Scalars, VoxelUpdateRequestInput } from './generated/graphql.js';
|
|
3
3
|
import type { SpatialNotification, UdpNotificationHandlers } from './realtime.js';
|
|
4
|
+
/**
|
|
5
|
+
* Options for {@link WorldClient.actor}. All fields are optional.
|
|
6
|
+
*/
|
|
4
7
|
export interface ActorOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The actor's id: exactly 32 ASCII characters (the UDP-wire id), **not** a
|
|
10
|
+
* hyphenated RFC-4122 UUID. Omit to mint a fresh one with
|
|
11
|
+
* {@link generateCrowdyUuid}. Validated when the {@link ActorClient} is
|
|
12
|
+
* created.
|
|
13
|
+
*/
|
|
5
14
|
uuid?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Default chunk replication radius (in chunk units, 0-8) applied to
|
|
17
|
+
* {@link ActorClient.sendState} when the call doesn't override `distance`.
|
|
18
|
+
*/
|
|
6
19
|
defaultDistance?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Default replication decay algorithm (0 none, 1 exponential, 2 linear 50%,
|
|
22
|
+
* 3 linear 25%, 4 linear 10%, 5 linear 5%) applied to
|
|
23
|
+
* {@link ActorClient.sendState} when the call doesn't override `decayRate`.
|
|
24
|
+
*/
|
|
7
25
|
defaultDecayRate?: number;
|
|
8
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Ergonomic, **app-scoped** realtime facade returned by `client.world(appId)`.
|
|
29
|
+
* Wraps {@link UdpAPI}, passing `appId` for you on every spatial send and
|
|
30
|
+
* subscription so you never repeat it — the recommended entry point for game
|
|
31
|
+
* loops; the lower-level `client.udp` remains available. Requires the same
|
|
32
|
+
* authenticated bearer game token as `client.udp`.
|
|
33
|
+
*/
|
|
9
34
|
export declare class WorldClient {
|
|
10
35
|
private readonly appId;
|
|
11
36
|
private readonly udp;
|
|
12
37
|
constructor(appId: Scalars['BigInt']['input'], udp: UdpAPI);
|
|
38
|
+
/**
|
|
39
|
+
* Create an {@link ActorClient} bound to this app. The actor tracks its
|
|
40
|
+
* current chunk after {@link ActorClient.join} (so later sends don't repeat
|
|
41
|
+
* the chunk) and allocates `sequenceNumber`s for its `...AndWait` calls.
|
|
42
|
+
*
|
|
43
|
+
* @param options - {@link ActorOptions}. If `uuid` is omitted a fresh
|
|
44
|
+
* 32-character id is generated; `defaultDistance` / `defaultDecayRate`
|
|
45
|
+
* become this actor's per-call defaults for {@link ActorClient.sendState}.
|
|
46
|
+
* @returns A new {@link ActorClient}.
|
|
47
|
+
* @throws {CrowdyProtocolError} if a supplied `uuid` is not exactly 32 bytes
|
|
48
|
+
* when UTF-8 encoded.
|
|
49
|
+
*/
|
|
13
50
|
actor(options?: ActorOptions): ActorClient;
|
|
51
|
+
/**
|
|
52
|
+
* Open an app-scoped subscription, passing this world's `appId` to
|
|
53
|
+
* {@link UdpAPI.subscribe} for you. The first subscriber opens the shared
|
|
54
|
+
* WebSocket; the last to unsubscribe closes it.
|
|
55
|
+
*
|
|
56
|
+
* @param handlers - {@link UdpNotificationHandlers} (see {@link UdpAPI.subscribe}).
|
|
57
|
+
* @returns An unsubscribe function that detaches these handlers (and closes
|
|
58
|
+
* the shared WebSocket if it was the last subscription).
|
|
59
|
+
* @throws {CrowdyRealtimeError} `code === 'AUTH_REQUIRED'` if there is no
|
|
60
|
+
* session token.
|
|
61
|
+
*/
|
|
14
62
|
subscribe(handlers: UdpNotificationHandlers): () => void;
|
|
15
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* A single actor (player / NPC) in one app's realtime world, created via
|
|
66
|
+
* `client.world(appId).actor(...)`. Holds a stable 32-character {@link uuid}
|
|
67
|
+
* and remembers the actor's current chunk after {@link join}, so the spatial
|
|
68
|
+
* helpers ({@link sendState}, {@link sendVoxelUpdate}, {@link sendText},
|
|
69
|
+
* {@link sendEvent}) don't need the chunk repeated. Those helpers use the UDP
|
|
70
|
+
* `...AndWait` path and resolve with the correlated echo/notification, so they
|
|
71
|
+
* require an active subscription (e.g. {@link WorldClient.subscribe}).
|
|
72
|
+
*/
|
|
16
73
|
export declare class ActorClient {
|
|
17
74
|
private readonly appId;
|
|
18
75
|
private readonly udp;
|
|
19
76
|
private readonly options;
|
|
77
|
+
/**
|
|
78
|
+
* This actor's id: exactly 32 ASCII characters (the UDP-wire id), **not** an
|
|
79
|
+
* RFC-4122 UUID. Set at construction and validated.
|
|
80
|
+
*/
|
|
20
81
|
readonly uuid: string;
|
|
21
82
|
private chunk;
|
|
22
83
|
constructor(appId: Scalars['BigInt']['input'], udp: UdpAPI, options: Required<Pick<ActorOptions, 'uuid'>> & Pick<ActorOptions, 'defaultDistance' | 'defaultDecayRate'>);
|
|
84
|
+
/**
|
|
85
|
+
* Enter a chunk: records it as this actor's current chunk and sends an
|
|
86
|
+
* initial actor update to register presence there. Resolves with the server's
|
|
87
|
+
* applied `ActorUpdateResponse` echo.
|
|
88
|
+
*
|
|
89
|
+
* The **first** spatial message to a brand-new chunk may be dropped
|
|
90
|
+
* server-side while grid permissions load, so if this rejects with a timeout,
|
|
91
|
+
* simply call `join` again (the two-client tests register twice).
|
|
92
|
+
*
|
|
93
|
+
* @param chunk - The chunk to enter, `{ x, y, z }` with each axis a signed
|
|
94
|
+
* int64 decimal string. A chunk is a 16x16x16 voxel cube.
|
|
95
|
+
* @param state - Initial actor state blob, base64-encoded. Defaults to `'AA=='`
|
|
96
|
+
* (a single zero byte), i.e. registration-only.
|
|
97
|
+
* @returns The correlated {@link SpatialNotification} (`ActorUpdateResponse`).
|
|
98
|
+
* @throws {CrowdyProtocolError} if `chunk` is outside signed int64 range.
|
|
99
|
+
* @throws {CrowdyGraphQLError} if the underlying send is rejected.
|
|
100
|
+
* @throws {CrowdyTimeoutError} if the HTTP send leg times out.
|
|
101
|
+
* @throws {CrowdyRealtimeError} if no echo arrives within the timeout
|
|
102
|
+
* (`code === 'UDP_SEQUENCE_TIMEOUT'`) or the server returns a matching
|
|
103
|
+
* `GenericErrorResponse`.
|
|
104
|
+
*/
|
|
23
105
|
join(chunk: ChunkCoordinatesInput, state?: string): Promise<SpatialNotification>;
|
|
106
|
+
/**
|
|
107
|
+
* Send a state update for this actor to its current chunk (set by
|
|
108
|
+
* {@link join}) or to `options.chunk` if provided. Uses the UDP `...AndWait`
|
|
109
|
+
* path and resolves with the applied `ActorUpdateResponse` echo. `appId` and
|
|
110
|
+
* `uuid` are filled in for you.
|
|
111
|
+
*
|
|
112
|
+
* @param state - Actor state blob, base64-encoded (may be `''` for a
|
|
113
|
+
* registration-only update).
|
|
114
|
+
* @param options - Optional overrides:
|
|
115
|
+
* - `chunk` — `{ x, y, z }` (signed int64 decimal strings) to send to
|
|
116
|
+
* instead of the tracked chunk.
|
|
117
|
+
* - `distance` — replication radius in chunk units, 0-8; defaults to the
|
|
118
|
+
* actor's `defaultDistance`.
|
|
119
|
+
* - `decayRate` — decay algorithm 0-5; defaults to the actor's
|
|
120
|
+
* `defaultDecayRate`.
|
|
121
|
+
* @returns The correlated {@link SpatialNotification} (`ActorUpdateResponse`).
|
|
122
|
+
* @throws {Error} `'Actor must join a chunk before sending state'` if no chunk
|
|
123
|
+
* has been joined and none is supplied.
|
|
124
|
+
* @throws {CrowdyProtocolError} if the resolved chunk is outside int64 range.
|
|
125
|
+
* @throws {CrowdyGraphQLError} if the underlying send is rejected.
|
|
126
|
+
* @throws {CrowdyTimeoutError} if the HTTP send leg times out.
|
|
127
|
+
* @throws {CrowdyRealtimeError} on echo timeout
|
|
128
|
+
* (`code === 'UDP_SEQUENCE_TIMEOUT'`) or a matching `GenericErrorResponse`.
|
|
129
|
+
*/
|
|
24
130
|
sendState(state: string, options?: Partial<Pick<ActorUpdateRequestInput, 'chunk' | 'distance' | 'decayRate'>>): Promise<SpatialNotification>;
|
|
131
|
+
/**
|
|
132
|
+
* Send a voxel (block) update from this actor to its current chunk (or
|
|
133
|
+
* `input.chunk`). Uses the UDP `...AndWait` path and resolves with the applied
|
|
134
|
+
* `VoxelUpdateResponse` echo. `appId`, `uuid`, and `chunk` are filled in for
|
|
135
|
+
* you.
|
|
136
|
+
*
|
|
137
|
+
* @param input - Voxel fields minus `appId`/`uuid`/`chunk`:
|
|
138
|
+
* - `voxel` — `{ x, y, z }` voxel coordinates within the chunk, each an
|
|
139
|
+
* int16 (-32768 to 32767).
|
|
140
|
+
* - `voxelType` — the new voxel type id.
|
|
141
|
+
* - `voxelState` — voxel state blob, base64-encoded.
|
|
142
|
+
* - `distance` — replication radius in chunk units, 0-8; defaults to 8.
|
|
143
|
+
* - `decayRate` — decay algorithm 0-5; defaults to 0 (none).
|
|
144
|
+
* - `sequenceNumber` — optional uint8 (0-255) correlation id.
|
|
145
|
+
* - `chunk` — optional `{ x, y, z }` (signed int64 decimal strings) to
|
|
146
|
+
* override the tracked chunk.
|
|
147
|
+
* @returns The correlated {@link SpatialNotification} (`VoxelUpdateResponse`).
|
|
148
|
+
* @throws {Error} `'Actor must join a chunk before sending voxel updates'` if
|
|
149
|
+
* no chunk has been joined and none is supplied.
|
|
150
|
+
* @throws {CrowdyProtocolError} if the resolved chunk is outside int64 range.
|
|
151
|
+
* @throws {CrowdyGraphQLError} if the underlying send is rejected.
|
|
152
|
+
* @throws {CrowdyTimeoutError} if the HTTP send leg times out.
|
|
153
|
+
* @throws {CrowdyRealtimeError} on echo timeout
|
|
154
|
+
* (`code === 'UDP_SEQUENCE_TIMEOUT'`) or a matching `GenericErrorResponse`.
|
|
155
|
+
*/
|
|
25
156
|
sendVoxelUpdate(input: Omit<VoxelUpdateRequestInput, 'appId' | 'uuid' | 'chunk'> & {
|
|
26
157
|
chunk?: ChunkCoordinatesInput;
|
|
27
158
|
}): Promise<SpatialNotification>;
|
|
159
|
+
/**
|
|
160
|
+
* Send a spatial text/chat packet from this actor to its current chunk (or
|
|
161
|
+
* `input.chunk`), fanned out to nearby actors as a `ClientTextNotification`.
|
|
162
|
+
*
|
|
163
|
+
* Uses the UDP `...AndWait` path, but the server does **not** echo text back
|
|
164
|
+
* to the sender, so on success there is typically no notification to resolve
|
|
165
|
+
* and this will reject with a timeout — use it to surface send errors, or
|
|
166
|
+
* prefer `client.udp.sendTextPacket(...)` for plain fire-and-forget. `appId`,
|
|
167
|
+
* `uuid`, and `chunk` are filled in for you.
|
|
168
|
+
*
|
|
169
|
+
* @param text - Message content, UTF-8 (plain text, not base64).
|
|
170
|
+
* @param input - Optional extra fields: `distance` (chunk units, 0-8, default
|
|
171
|
+
* 8), `decayRate` (0-5, default 0), `sequenceNumber` (uint8), and `chunk` to
|
|
172
|
+
* override the tracked chunk.
|
|
173
|
+
* @returns The correlated {@link SpatialNotification}, if one is delivered.
|
|
174
|
+
* @throws {Error} `'Actor must join a chunk before sending text'` if no chunk
|
|
175
|
+
* has been joined and none is supplied.
|
|
176
|
+
* @throws {CrowdyProtocolError} if the resolved chunk is outside int64 range.
|
|
177
|
+
* @throws {CrowdyGraphQLError} if the underlying send is rejected.
|
|
178
|
+
* @throws {CrowdyTimeoutError} if the HTTP send leg times out.
|
|
179
|
+
* @throws {CrowdyRealtimeError} on timeout (`code === 'UDP_SEQUENCE_TIMEOUT'`)
|
|
180
|
+
* or a matching `GenericErrorResponse`.
|
|
181
|
+
*/
|
|
28
182
|
sendText(text: string, input?: Partial<Omit<ClientTextPacketInput, 'appId' | 'uuid' | 'text' | 'chunk'>> & {
|
|
29
183
|
chunk?: ChunkCoordinatesInput;
|
|
30
184
|
}): Promise<SpatialNotification>;
|
|
185
|
+
/**
|
|
186
|
+
* Send a custom, app-defined client event from this actor to its current
|
|
187
|
+
* chunk (or `input.chunk`); nearby actors receive a `ClientEventNotification`.
|
|
188
|
+
*
|
|
189
|
+
* Uses the UDP `...AndWait` path, but the server does **not** echo events back
|
|
190
|
+
* to the sender, so on success there is typically no notification to resolve
|
|
191
|
+
* and this will reject with a timeout — use it to surface send errors, or
|
|
192
|
+
* prefer `client.udp.sendClientEvent(...)` for plain fire-and-forget. `appId`,
|
|
193
|
+
* `uuid`, and `chunk` are filled in for you.
|
|
194
|
+
*
|
|
195
|
+
* @param eventType - App-defined event id, a uint16 (0-65535).
|
|
196
|
+
* @param state - Event state blob, base64-encoded; format defined by the event
|
|
197
|
+
* type.
|
|
198
|
+
* @param input - Optional extra fields: `distance` (chunk units, 0-8, default
|
|
199
|
+
* 8), `decayRate` (0-5, default 0), `sequenceNumber` (uint8), and `chunk` to
|
|
200
|
+
* override the tracked chunk.
|
|
201
|
+
* @returns The correlated {@link SpatialNotification}, if one is delivered.
|
|
202
|
+
* @throws {Error} `'Actor must join a chunk before sending events'` if no
|
|
203
|
+
* chunk has been joined and none is supplied.
|
|
204
|
+
* @throws {CrowdyProtocolError} if the resolved chunk is outside int64 range.
|
|
205
|
+
* @throws {CrowdyGraphQLError} if the underlying send is rejected.
|
|
206
|
+
* @throws {CrowdyTimeoutError} if the HTTP send leg times out.
|
|
207
|
+
* @throws {CrowdyRealtimeError} on timeout (`code === 'UDP_SEQUENCE_TIMEOUT'`)
|
|
208
|
+
* or a matching `GenericErrorResponse`.
|
|
209
|
+
*/
|
|
31
210
|
sendEvent(eventType: number, state: string, input?: Partial<Omit<ClientEventNotificationInput, 'appId' | 'uuid' | 'eventType' | 'state' | 'chunk'>> & {
|
|
32
211
|
chunk?: ChunkCoordinatesInput;
|
|
33
212
|
}): Promise<SpatialNotification>;
|
|
@@ -36,6 +215,19 @@ export declare class ActorClient {
|
|
|
36
215
|
* the chunk it currently occupies (the sender must know the target's chunk).
|
|
37
216
|
* Only that one actor receives it. Fire-and-forget: there is no echo to the
|
|
38
217
|
* sender, so this resolves to the send acknowledgement, not a notification.
|
|
218
|
+
*
|
|
219
|
+
* @param targetUuid - The destination actor's id: exactly 32 ASCII characters
|
|
220
|
+
* (not RFC-4122).
|
|
221
|
+
* @param payload - Message body, base64-encoded; opaque to the server.
|
|
222
|
+
* @param targetChunk - The destination actor's current `{ x, y, z }` chunk
|
|
223
|
+
* (each axis a signed int64 decimal string).
|
|
224
|
+
* @param options - `sequenceNumber`: optional uint8 (0-255) correlation id
|
|
225
|
+
* (used only to correlate a `GenericErrorResponse`).
|
|
226
|
+
* @returns `true` when the datagram was accepted for sending — **not**
|
|
227
|
+
* confirmation of delivery.
|
|
228
|
+
* @throws {CrowdyProtocolError} if `targetUuid` is not exactly 32 bytes, or
|
|
229
|
+
* `targetChunk` is outside signed int64 range.
|
|
230
|
+
* @throws {CrowdyGraphQLError} on auth/validation failures.
|
|
39
231
|
*/
|
|
40
232
|
sendToActor(targetUuid: string, payload: string, targetChunk: ChunkCoordinatesInput, options?: {
|
|
41
233
|
sequenceNumber?: number;
|
package/dist/world.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"world.d.ts","sourceRoot":"","sources":["../src/world.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACrB,4BAA4B,EAC5B,qBAAqB,EACrB,OAAO,EACP,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAGlF,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,qBAAa,WAAW;IAEpB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBADH,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EACjC,GAAG,EAAE,MAAM;IAG9B,KAAK,CAAC,OAAO,GAAE,YAAiB,GAAG,WAAW;IAQ9C,SAAS,CAAC,QAAQ,EAAE,uBAAuB,GAAG,MAAM,IAAI;CAGzD;AAED,qBAAa,WAAW;
|
|
1
|
+
{"version":3,"file":"world.d.ts","sourceRoot":"","sources":["../src/world.ts"],"names":[],"mappings":"AAAA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