@crowdedkingdoms/crowdyjs 17.6.0 → 17.7.0-dev.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 +41 -0
- package/README.md +33 -0
- package/dist/client.d.ts +7 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -1
- package/dist/crowdy-client.d.ts +24 -0
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +16 -0
- package/dist/crowdy-dsh/bridge.d.ts +24 -1
- package/dist/crowdy-dsh/bridge.d.ts.map +1 -1
- package/dist/crowdy-dsh/bridge.js +32 -0
- package/dist/crowdy-dsh/index.d.ts +1 -1
- package/dist/crowdy-dsh/index.d.ts.map +1 -1
- package/dist/crowdy-dsh/protocol.d.ts +64 -1
- package/dist/crowdy-dsh/protocol.d.ts.map +1 -1
- package/dist/crowdy-dsh/protocol.js +8 -1
- package/dist/crowdy-studio/starter-projects.js +1 -1
- 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/domains/actors.d.ts +38 -17
- package/dist/domains/actors.d.ts.map +1 -1
- package/dist/domains/actors.js +38 -17
- package/dist/domains/crowdyStudio.js +1 -1
- package/dist/domains/grids.d.ts +30 -0
- package/dist/domains/grids.d.ts.map +1 -0
- package/dist/domains/grids.js +39 -0
- package/dist/domains/udp.d.ts +5 -1
- package/dist/domains/udp.d.ts.map +1 -1
- package/dist/domains/udp.js +5 -1
- package/dist/generated/graphql.d.ts +169 -9
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +13 -10
- package/dist/grid-mods/grid-host-calls.d.ts +70 -0
- package/dist/grid-mods/grid-host-calls.d.ts.map +1 -0
- package/dist/grid-mods/grid-host-calls.js +220 -0
- package/dist/grid-mods/index.d.ts +3 -0
- package/dist/grid-mods/index.d.ts.map +1 -0
- package/dist/grid-mods/index.js +2 -0
- package/dist/grid-mods/mod-runtime.d.ts +52 -0
- package/dist/grid-mods/mod-runtime.d.ts.map +1 -0
- package/dist/grid-mods/mod-runtime.js +55 -0
- package/dist/grid-program/host.d.ts +88 -0
- package/dist/grid-program/host.d.ts.map +1 -0
- package/dist/grid-program/host.js +231 -0
- package/dist/grid-program/index.d.ts +14 -0
- package/dist/grid-program/index.d.ts.map +1 -0
- package/dist/grid-program/index.js +13 -0
- package/dist/grid-program/program.d.ts +19 -0
- package/dist/grid-program/program.d.ts.map +1 -0
- package/dist/grid-program/program.js +154 -0
- package/dist/grid-program/protocol.d.ts +87 -0
- package/dist/grid-program/protocol.d.ts.map +1 -0
- package/dist/grid-program/protocol.js +17 -0
- package/dist/grid-scope.d.ts +296 -0
- package/dist/grid-scope.d.ts.map +1 -0
- package/dist/grid-scope.js +183 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/kit/matches.d.ts +1 -0
- package/dist/kit/matches.d.ts.map +1 -1
- package/dist/kit/npcs.d.ts.map +1 -1
- package/dist/kit/social.d.ts.map +1 -1
- package/dist/live-coding/assets/browser-authoring-index.json +1 -1
- package/dist/live-coding/assets/manifest.json +1 -1
- package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -1
- package/dist/live-coding/browser-authoring-index.generated.js +118 -6
- package/dist/player-runtime/client-grid-event-bus.d.ts +37 -0
- package/dist/player-runtime/client-grid-event-bus.d.ts.map +1 -0
- package/dist/player-runtime/client-grid-event-bus.js +56 -0
- package/dist/player-runtime/glue-runtime.d.ts +4 -2
- package/dist/player-runtime/glue-runtime.d.ts.map +1 -1
- package/dist/player-runtime/glue-runtime.js +20 -23
- package/dist/player-runtime/host-catalog.generated.d.ts +16 -0
- package/dist/player-runtime/host-catalog.generated.d.ts.map +1 -0
- package/dist/player-runtime/host-catalog.generated.js +296 -0
- package/dist/player-runtime/player-code-broker.d.ts +38 -0
- package/dist/player-runtime/player-code-broker.d.ts.map +1 -1
- package/dist/player-runtime/player-code-broker.js +116 -35
- package/dist/player-runtime/player-glue-worker.d.ts.map +1 -1
- package/dist/player-runtime/player-glue-worker.js +5 -0
- package/dist/realtime.d.ts +7 -0
- package/dist/realtime.d.ts.map +1 -1
- package/dist/realtime.js +3 -1
- package/package.json +10 -3
package/dist/domains/actors.d.ts
CHANGED
|
@@ -16,10 +16,14 @@ import { type ActorQuery, type ActorQueryVariables, type ActorsQuery, type Actor
|
|
|
16
16
|
* `BigInt` values (`appId`, `avatarId`, `userId`) are sent and received as
|
|
17
17
|
* decimal strings.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* Actors are **game-plane** objects: every method wants an **app token for the
|
|
20
|
+
* actor's app** (minted with `client.portal.mintAppToken()` and set via
|
|
21
|
+
* `client.setToken()`), and the by-id methods ({@link get}, {@link update},
|
|
22
|
+
* {@link updateState}, {@link delete}) answer `NOT_FOUND` — the same as a
|
|
23
|
+
* missing id — for a session token or another app's token. {@link list} /
|
|
24
|
+
* {@link listConnection} are the caller's own actors and, under an app token,
|
|
25
|
+
* only the ones in that app. No token at all throws {@link CrowdyGraphQLError}
|
|
26
|
+
* `UNAUTHENTICATED`.
|
|
23
27
|
*/
|
|
24
28
|
export declare class ActorsAPI {
|
|
25
29
|
private gql;
|
|
@@ -28,17 +32,22 @@ export declare class ActorsAPI {
|
|
|
28
32
|
* Fetch a single persisted actor by its 32-character actor id.
|
|
29
33
|
*
|
|
30
34
|
* @param uuid - The actor's 32-ASCII-character id.
|
|
31
|
-
* @returns The {@link Actor}
|
|
32
|
-
*
|
|
33
|
-
*
|
|
35
|
+
* @returns The {@link Actor}. The owner sees `privateState`; anyone else in
|
|
36
|
+
* the app gets a public copy with `privateState` `null`.
|
|
37
|
+
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` if the caller has no token;
|
|
38
|
+
* `NOT_FOUND` if the uuid does not exist in the caller's app (a session
|
|
39
|
+
* token or another app's token gets the same answer).
|
|
34
40
|
*/
|
|
35
41
|
get(uuid: ActorQueryVariables['uuid']): Promise<ActorQuery['actor']>;
|
|
36
42
|
/**
|
|
37
|
-
* List persisted actors, optionally narrowed by an
|
|
38
|
-
*
|
|
43
|
+
* List the **caller's own** persisted actors, optionally narrowed by an
|
|
44
|
+
* {@link ActorFilterInput} (app, avatar, uuid, chunk). Under an app token the
|
|
45
|
+
* list is confined to that token's app whether or not `filter.appId` is
|
|
46
|
+
* given; a `filter.appId` naming another app is refused (`SCOPE_MISSING`).
|
|
47
|
+
* A session token lists the caller's actors across every app.
|
|
39
48
|
*
|
|
40
49
|
* @param filter - Optional filter; fields are ANDed together.
|
|
41
|
-
* @returns The matching actors.
|
|
50
|
+
* @returns The matching actors (full state; they are all the caller's).
|
|
42
51
|
* @throws {CrowdyGraphQLError} on auth/validation failures.
|
|
43
52
|
*/
|
|
44
53
|
list(filter?: ActorsQueryVariables['filter']): Promise<ActorsQuery['actors']>;
|
|
@@ -51,7 +60,8 @@ export declare class ActorsAPI {
|
|
|
51
60
|
* @param args - Optional `first` (default 50, max 200), `after` cursor, and
|
|
52
61
|
* {@link ActorFilterInput}.
|
|
53
62
|
* @returns An {@link ActorsConnection} (`edges { cursor node }`, `pageInfo`,
|
|
54
|
-
* `totalCount`).
|
|
63
|
+
* `totalCount`). Same scoping as {@link list}: under an app token, only
|
|
64
|
+
* that app's actors.
|
|
55
65
|
*/
|
|
56
66
|
listConnection(args?: ActorsConnectionQueryVariables): Promise<ActorsConnectionQuery['actorsConnection']>;
|
|
57
67
|
/**
|
|
@@ -60,7 +70,11 @@ export declare class ActorsAPI {
|
|
|
60
70
|
* {@link get} in a loop — it avoids N requests and N auth checks.
|
|
61
71
|
*
|
|
62
72
|
* @param input - The batch lookup keys.
|
|
63
|
-
* @returns The actors that were found
|
|
73
|
+
* @returns The actors that were found, public state only (`privateState` is
|
|
74
|
+
* `null` for every result). Unknown ids **and ids in other apps** are
|
|
75
|
+
* simply omitted.
|
|
76
|
+
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` if the caller has no token;
|
|
77
|
+
* `NOT_FOUND` for a session token (this is an app-token-only field).
|
|
64
78
|
*/
|
|
65
79
|
batchLookup(input: BatchLookupActorsQueryVariables['input']): Promise<BatchLookupActorsQuery['batchLookupActors']>;
|
|
66
80
|
/**
|
|
@@ -82,8 +96,10 @@ export declare class ActorsAPI {
|
|
|
82
96
|
* @param uuid - The actor's 32-character id.
|
|
83
97
|
* @param input - Fields to change ({@link UpdateActorInput}).
|
|
84
98
|
* @returns The updated {@link Actor}.
|
|
85
|
-
* @throws {CrowdyGraphQLError} if the
|
|
86
|
-
*
|
|
99
|
+
* @throws {CrowdyGraphQLError} `NOT_FOUND` if the uuid does not exist in the
|
|
100
|
+
* caller's app (a session token or another app's token gets the same
|
|
101
|
+
* answer); `UNAUTHENTICATED` if the caller is not the actor's owner (the
|
|
102
|
+
* owner-only rule surfaces as a 401).
|
|
87
103
|
*/
|
|
88
104
|
update(uuid: UpdateActorMutationVariables['uuid'], input: UpdateActorMutationVariables['input']): Promise<UpdateActorMutation['updateActor']>;
|
|
89
105
|
/**
|
|
@@ -98,8 +114,10 @@ export declare class ActorsAPI {
|
|
|
98
114
|
* @param uuid - The actor's 32-character id.
|
|
99
115
|
* @param idempotencyKey - Optional client-supplied key for safe retries.
|
|
100
116
|
* @returns The deleted {@link Actor} (its identifying fields).
|
|
101
|
-
* @throws {CrowdyGraphQLError} `IDEMPOTENCY_CONFLICT
|
|
102
|
-
*
|
|
117
|
+
* @throws {CrowdyGraphQLError} `IDEMPOTENCY_CONFLICT`; `NOT_FOUND` if the
|
|
118
|
+
* uuid does not exist in the caller's app (a session token or another
|
|
119
|
+
* app's token gets the same answer); `UNAUTHENTICATED` with no token or
|
|
120
|
+
* when the caller is not the owner (the owner-only rule surfaces as a 401).
|
|
103
121
|
*/
|
|
104
122
|
delete(uuid: DeleteActorMutationVariables['uuid'], idempotencyKey?: DeleteActorMutationVariables['idempotencyKey']): Promise<DeleteActorMutation['deleteActor']>;
|
|
105
123
|
/**
|
|
@@ -110,7 +128,10 @@ export declare class ActorsAPI {
|
|
|
110
128
|
* @param uuid - The actor's 32-character id.
|
|
111
129
|
* @param input - {@link UpdateActorStateInput}.
|
|
112
130
|
* @returns The updated {@link Actor}.
|
|
113
|
-
* @throws {CrowdyGraphQLError}
|
|
131
|
+
* @throws {CrowdyGraphQLError} `NOT_FOUND` if the uuid does not exist in the
|
|
132
|
+
* caller's app (a session token or another app's token gets the same
|
|
133
|
+
* answer); `UNAUTHENTICATED` if the caller is not the owner (the
|
|
134
|
+
* owner-only rule surfaces as a 401); `BAD_USER_INPUT` for a malformed blob.
|
|
114
135
|
*/
|
|
115
136
|
updateState(uuid: UpdateActorStateMutationVariables['uuid'], input: UpdateActorStateMutationVariables['input']): Promise<UpdateActorStateMutation['updateActorState']>;
|
|
116
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actors.d.ts","sourceRoot":"","sources":["../../src/domains/actors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,mBAAmB,EAExB,KAAK,WAAW,EAChB,KAAK,oBAAoB,EAEzB,KAAK,qBAAqB,EAC1B,KAAK,8BAA8B,EAEnC,KAAK,sBAAsB,EAC3B,KAAK,+BAA+B,EAEpC,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,EAEjC,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,EAEjC,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,EAEjC,KAAK,wBAAwB,EAC7B,KAAK,iCAAiC,EACvC,MAAM,yBAAyB,CAAC;AAEjC
|
|
1
|
+
{"version":3,"file":"actors.d.ts","sourceRoot":"","sources":["../../src/domains/actors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEl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O,CAAC,GAC3C,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAK9C;;;;;;;;;;;;;;;;OAgBG;IACG,MAAM,CACV,IAAI,EAAE,4BAA4B,CAAC,MAAM,CAAC,EAC1C,cAAc,CAAC,EAAE,4BAA4B,CAAC,gBAAgB,CAAC,GAC9D,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAK9C;;;;;;;;;;;;OAYG;IACG,WAAW,CACf,IAAI,EAAE,iCAAiC,CAAC,MAAM,CAAC,EAC/C,KAAK,EAAE,iCAAiC,CAAC,OAAO,CAAC,GAChD,OAAO,CAAC,wBAAwB,CAAC,kBAAkB,CAAC,CAAC;CAIzD"}
|
package/dist/domains/actors.js
CHANGED
|
@@ -15,10 +15,14 @@ import { ActorDocument, ActorsDocument, ActorsConnectionDocument, BatchLookupAct
|
|
|
15
15
|
* `BigInt` values (`appId`, `avatarId`, `userId`) are sent and received as
|
|
16
16
|
* decimal strings.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* Actors are **game-plane** objects: every method wants an **app token for the
|
|
19
|
+
* actor's app** (minted with `client.portal.mintAppToken()` and set via
|
|
20
|
+
* `client.setToken()`), and the by-id methods ({@link get}, {@link update},
|
|
21
|
+
* {@link updateState}, {@link delete}) answer `NOT_FOUND` — the same as a
|
|
22
|
+
* missing id — for a session token or another app's token. {@link list} /
|
|
23
|
+
* {@link listConnection} are the caller's own actors and, under an app token,
|
|
24
|
+
* only the ones in that app. No token at all throws {@link CrowdyGraphQLError}
|
|
25
|
+
* `UNAUTHENTICATED`.
|
|
22
26
|
*/
|
|
23
27
|
export class ActorsAPI {
|
|
24
28
|
constructor(gql) {
|
|
@@ -28,20 +32,25 @@ export class ActorsAPI {
|
|
|
28
32
|
* Fetch a single persisted actor by its 32-character actor id.
|
|
29
33
|
*
|
|
30
34
|
* @param uuid - The actor's 32-ASCII-character id.
|
|
31
|
-
* @returns The {@link Actor}
|
|
32
|
-
*
|
|
33
|
-
*
|
|
35
|
+
* @returns The {@link Actor}. The owner sees `privateState`; anyone else in
|
|
36
|
+
* the app gets a public copy with `privateState` `null`.
|
|
37
|
+
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` if the caller has no token;
|
|
38
|
+
* `NOT_FOUND` if the uuid does not exist in the caller's app (a session
|
|
39
|
+
* token or another app's token gets the same answer).
|
|
34
40
|
*/
|
|
35
41
|
async get(uuid) {
|
|
36
42
|
const data = await this.gql.request(ActorDocument, { uuid });
|
|
37
43
|
return data.actor;
|
|
38
44
|
}
|
|
39
45
|
/**
|
|
40
|
-
* List persisted actors, optionally narrowed by an
|
|
41
|
-
*
|
|
46
|
+
* List the **caller's own** persisted actors, optionally narrowed by an
|
|
47
|
+
* {@link ActorFilterInput} (app, avatar, uuid, chunk). Under an app token the
|
|
48
|
+
* list is confined to that token's app whether or not `filter.appId` is
|
|
49
|
+
* given; a `filter.appId` naming another app is refused (`SCOPE_MISSING`).
|
|
50
|
+
* A session token lists the caller's actors across every app.
|
|
42
51
|
*
|
|
43
52
|
* @param filter - Optional filter; fields are ANDed together.
|
|
44
|
-
* @returns The matching actors.
|
|
53
|
+
* @returns The matching actors (full state; they are all the caller's).
|
|
45
54
|
* @throws {CrowdyGraphQLError} on auth/validation failures.
|
|
46
55
|
*/
|
|
47
56
|
async list(filter) {
|
|
@@ -57,7 +66,8 @@ export class ActorsAPI {
|
|
|
57
66
|
* @param args - Optional `first` (default 50, max 200), `after` cursor, and
|
|
58
67
|
* {@link ActorFilterInput}.
|
|
59
68
|
* @returns An {@link ActorsConnection} (`edges { cursor node }`, `pageInfo`,
|
|
60
|
-
* `totalCount`).
|
|
69
|
+
* `totalCount`). Same scoping as {@link list}: under an app token, only
|
|
70
|
+
* that app's actors.
|
|
61
71
|
*/
|
|
62
72
|
async listConnection(args = {}) {
|
|
63
73
|
const data = await this.gql.request(ActorsConnectionDocument, args);
|
|
@@ -69,7 +79,11 @@ export class ActorsAPI {
|
|
|
69
79
|
* {@link get} in a loop — it avoids N requests and N auth checks.
|
|
70
80
|
*
|
|
71
81
|
* @param input - The batch lookup keys.
|
|
72
|
-
* @returns The actors that were found
|
|
82
|
+
* @returns The actors that were found, public state only (`privateState` is
|
|
83
|
+
* `null` for every result). Unknown ids **and ids in other apps** are
|
|
84
|
+
* simply omitted.
|
|
85
|
+
* @throws {CrowdyGraphQLError} `UNAUTHENTICATED` if the caller has no token;
|
|
86
|
+
* `NOT_FOUND` for a session token (this is an app-token-only field).
|
|
73
87
|
*/
|
|
74
88
|
async batchLookup(input) {
|
|
75
89
|
const data = await this.gql.request(BatchLookupActorsDocument, { input });
|
|
@@ -97,8 +111,10 @@ export class ActorsAPI {
|
|
|
97
111
|
* @param uuid - The actor's 32-character id.
|
|
98
112
|
* @param input - Fields to change ({@link UpdateActorInput}).
|
|
99
113
|
* @returns The updated {@link Actor}.
|
|
100
|
-
* @throws {CrowdyGraphQLError} if the
|
|
101
|
-
*
|
|
114
|
+
* @throws {CrowdyGraphQLError} `NOT_FOUND` if the uuid does not exist in the
|
|
115
|
+
* caller's app (a session token or another app's token gets the same
|
|
116
|
+
* answer); `UNAUTHENTICATED` if the caller is not the actor's owner (the
|
|
117
|
+
* owner-only rule surfaces as a 401).
|
|
102
118
|
*/
|
|
103
119
|
async update(uuid, input) {
|
|
104
120
|
const data = await this.gql.request(UpdateActorDocument, { uuid, input });
|
|
@@ -116,8 +132,10 @@ export class ActorsAPI {
|
|
|
116
132
|
* @param uuid - The actor's 32-character id.
|
|
117
133
|
* @param idempotencyKey - Optional client-supplied key for safe retries.
|
|
118
134
|
* @returns The deleted {@link Actor} (its identifying fields).
|
|
119
|
-
* @throws {CrowdyGraphQLError} `IDEMPOTENCY_CONFLICT
|
|
120
|
-
*
|
|
135
|
+
* @throws {CrowdyGraphQLError} `IDEMPOTENCY_CONFLICT`; `NOT_FOUND` if the
|
|
136
|
+
* uuid does not exist in the caller's app (a session token or another
|
|
137
|
+
* app's token gets the same answer); `UNAUTHENTICATED` with no token or
|
|
138
|
+
* when the caller is not the owner (the owner-only rule surfaces as a 401).
|
|
121
139
|
*/
|
|
122
140
|
async delete(uuid, idempotencyKey) {
|
|
123
141
|
const data = await this.gql.request(DeleteActorDocument, { uuid, idempotencyKey });
|
|
@@ -131,7 +149,10 @@ export class ActorsAPI {
|
|
|
131
149
|
* @param uuid - The actor's 32-character id.
|
|
132
150
|
* @param input - {@link UpdateActorStateInput}.
|
|
133
151
|
* @returns The updated {@link Actor}.
|
|
134
|
-
* @throws {CrowdyGraphQLError}
|
|
152
|
+
* @throws {CrowdyGraphQLError} `NOT_FOUND` if the uuid does not exist in the
|
|
153
|
+
* caller's app (a session token or another app's token gets the same
|
|
154
|
+
* answer); `UNAUTHENTICATED` if the caller is not the owner (the
|
|
155
|
+
* owner-only rule surfaces as a 401); `BAD_USER_INPUT` for a malformed blob.
|
|
135
156
|
*/
|
|
136
157
|
async updateState(uuid, input) {
|
|
137
158
|
const data = await this.gql.request(UpdateActorStateDocument, { uuid, input });
|
|
@@ -51,7 +51,7 @@ export class CrowdyStudioAPI {
|
|
|
51
51
|
serverModuleName: input.metadata.serverModuleName ?? null,
|
|
52
52
|
clientModuleName: input.metadata.clientModuleName ?? null,
|
|
53
53
|
pairingPreference: toApiPairing(input.kind, input.metadata.pairingPreference),
|
|
54
|
-
sdkVersion: '0.1.
|
|
54
|
+
sdkVersion: '0.1.6',
|
|
55
55
|
abiVersion: 0,
|
|
56
56
|
initialFiles: input.files.map(toApiFile),
|
|
57
57
|
},
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { GraphQLClient } from '../client.js';
|
|
2
|
+
import { type CreateGridChannelMutation, type CreateGridChannelMutationVariables, type GridChannelsQuery, type MintGridTokenMutation, type MintGridTokenMutationVariables } from '../generated/graphql.js';
|
|
3
|
+
export type GridToken = MintGridTokenMutation['mintGridToken'];
|
|
4
|
+
export type GridChannel = GridChannelsQuery['gridChannels'][number];
|
|
5
|
+
/**
|
|
6
|
+
* Grid-scoped platform surfaces (DN-10): grid tokens and grid channels. Most
|
|
7
|
+
* code reaches these through `client.grid(appId, gridId)`, which binds the
|
|
8
|
+
* grid once; this class is the raw per-call form.
|
|
9
|
+
*/
|
|
10
|
+
export declare class GridsAPI {
|
|
11
|
+
private readonly gql;
|
|
12
|
+
constructor(gql: GraphQLClient);
|
|
13
|
+
/**
|
|
14
|
+
* Narrow the app token this client holds to one grid. The result admits a
|
|
15
|
+
* short fixed list of gameplay fields, each confined to the grid, and is
|
|
16
|
+
* refused by the binary relay. Hand it to code that should act inside the
|
|
17
|
+
* grid and nowhere else — `GridProgramHost` does exactly that. The caller
|
|
18
|
+
* must own the grid or hold `run_client_code` on it.
|
|
19
|
+
*/
|
|
20
|
+
mintToken(input: MintGridTokenMutationVariables['input']): Promise<GridToken>;
|
|
21
|
+
/**
|
|
22
|
+
* Create a channel that belongs to a grid you own. The grid's player
|
|
23
|
+
* modules may `emit_channel` into it; their messages carry the sender uuid
|
|
24
|
+
* `grid:<gridId>`. Membership defaults to `open` so visitors can join.
|
|
25
|
+
*/
|
|
26
|
+
createChannel(input: CreateGridChannelMutationVariables['input']): Promise<CreateGridChannelMutation['createGridChannel']>;
|
|
27
|
+
/** The active channels of one grid, oldest first. */
|
|
28
|
+
channels(appId: string, gridId: string): Promise<GridChannel[]>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=grids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grids.d.ts","sourceRoot":"","sources":["../../src/domains/grids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,kCAAkC,EAEvC,KAAK,iBAAiB,EAEtB,KAAK,qBAAqB,EAC1B,KAAK,8BAA8B,EACpC,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,SAAS,GAAG,qBAAqB,CAAC,eAAe,CAAC,CAAC;AAC/D,MAAM,MAAM,WAAW,GAAG,iBAAiB,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE;;;;GAIG;AACH,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAE/C;;;;;;OAMG;IACG,SAAS,CACb,KAAK,EAAE,8BAA8B,CAAC,OAAO,CAAC,GAC7C,OAAO,CAAC,SAAS,CAAC;IAKrB;;;;OAIG;IACG,aAAa,CACjB,KAAK,EAAE,kCAAkC,CAAC,OAAO,CAAC,GACjD,OAAO,CAAC,yBAAyB,CAAC,mBAAmB,CAAC,CAAC;IAK1D,qDAAqD;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;CAOtE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CreateGridChannelDocument, GridChannelsDocument, MintGridTokenDocument, } from '../generated/graphql.js';
|
|
2
|
+
/**
|
|
3
|
+
* Grid-scoped platform surfaces (DN-10): grid tokens and grid channels. Most
|
|
4
|
+
* code reaches these through `client.grid(appId, gridId)`, which binds the
|
|
5
|
+
* grid once; this class is the raw per-call form.
|
|
6
|
+
*/
|
|
7
|
+
export class GridsAPI {
|
|
8
|
+
constructor(gql) {
|
|
9
|
+
this.gql = gql;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Narrow the app token this client holds to one grid. The result admits a
|
|
13
|
+
* short fixed list of gameplay fields, each confined to the grid, and is
|
|
14
|
+
* refused by the binary relay. Hand it to code that should act inside the
|
|
15
|
+
* grid and nowhere else — `GridProgramHost` does exactly that. The caller
|
|
16
|
+
* must own the grid or hold `run_client_code` on it.
|
|
17
|
+
*/
|
|
18
|
+
async mintToken(input) {
|
|
19
|
+
const data = await this.gql.request(MintGridTokenDocument, { input });
|
|
20
|
+
return data.mintGridToken;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Create a channel that belongs to a grid you own. The grid's player
|
|
24
|
+
* modules may `emit_channel` into it; their messages carry the sender uuid
|
|
25
|
+
* `grid:<gridId>`. Membership defaults to `open` so visitors can join.
|
|
26
|
+
*/
|
|
27
|
+
async createChannel(input) {
|
|
28
|
+
const data = await this.gql.request(CreateGridChannelDocument, { input });
|
|
29
|
+
return data.createGridChannel;
|
|
30
|
+
}
|
|
31
|
+
/** The active channels of one grid, oldest first. */
|
|
32
|
+
async channels(appId, gridId) {
|
|
33
|
+
const data = await this.gql.request(GridChannelsDocument, {
|
|
34
|
+
appId,
|
|
35
|
+
gridId,
|
|
36
|
+
});
|
|
37
|
+
return data.gridChannels;
|
|
38
|
+
}
|
|
39
|
+
}
|
package/dist/domains/udp.d.ts
CHANGED
|
@@ -253,7 +253,11 @@ export declare class UdpAPI {
|
|
|
253
253
|
* - `chunk` — `{ x, y, z }` chunk address (signed int64 decimal strings).
|
|
254
254
|
* - `uuid` — 32-ASCII-character source id (typically the player; not
|
|
255
255
|
* RFC-4122).
|
|
256
|
-
* - `audioData` — compressed audio, base64-encoded.
|
|
256
|
+
* - `audioData` — compressed audio, base64-encoded. The platform never
|
|
257
|
+
* inspects the bytes. Browser games should send G.711 µ-law, 8 kHz
|
|
258
|
+
* mono, ~60 ms frames (480 bytes), with a wrapping `sequenceNumber`
|
|
259
|
+
* so receivers can drop late/duplicate packets. See The Construct
|
|
260
|
+
* `VoiceService` and Blocks with Friends `VoiceChat`.
|
|
257
261
|
* - `distance` — replication radius in chunk units, 0-8 (clamped); defaults
|
|
258
262
|
* to 1 for audio packets.
|
|
259
263
|
* - `decayRate` — decay algorithm 0-5 (see {@link sendActorUpdate});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"udp.d.ts","sourceRoot":"","sources":["../../src/domains/udp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,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U/B;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,sBAAsB,CAC1B,KAAK,EAAE,uCAAuC,CAAC,OAAO,CAAC,GACtD,OAAO,CAAC,OAAO,CAAC;IAgBnB;;;;;;;;;;;;;;;;;;;OAmBG;IACG,kBAAkB,CACtB,KAAK,EAAE,mCAAmC,CAAC,OAAO,CAAC,GAClD,OAAO,CAAC,OAAO,CAAC;IAcnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,SAAS,CAAC,QAAQ,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,IAAI;IAIvE,OAAO,CAAC,YAAY;CAQrB"}
|
package/dist/domains/udp.js
CHANGED
|
@@ -375,7 +375,11 @@ export class UdpAPI {
|
|
|
375
375
|
* - `chunk` — `{ x, y, z }` chunk address (signed int64 decimal strings).
|
|
376
376
|
* - `uuid` — 32-ASCII-character source id (typically the player; not
|
|
377
377
|
* RFC-4122).
|
|
378
|
-
* - `audioData` — compressed audio, base64-encoded.
|
|
378
|
+
* - `audioData` — compressed audio, base64-encoded. The platform never
|
|
379
|
+
* inspects the bytes. Browser games should send G.711 µ-law, 8 kHz
|
|
380
|
+
* mono, ~60 ms frames (480 bytes), with a wrapping `sequenceNumber`
|
|
381
|
+
* so receivers can drop late/duplicate packets. See The Construct
|
|
382
|
+
* `VoiceService` and Blocks with Friends `VoiceChat`.
|
|
379
383
|
* - `distance` — replication radius in chunk units, 0-8 (clamped); defaults
|
|
380
384
|
* to 1 for audio packets.
|
|
381
385
|
* - `decayRate` — decay algorithm 0-5 (see {@link sendActorUpdate});
|