@crowdedkingdomstudios/crowdyjs 5.0.1 → 5.2.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/MIGRATION.md CHANGED
@@ -1,3 +1,76 @@
1
+ # CrowdyJS v5.2 Notes
2
+
3
+ v5.2 is additive at the SDK API level (new optional parameters only) and
4
+ refreshes the bundled schema, but it **raises the minimum server version**.
5
+
6
+ ## Added
7
+
8
+ - **Idempotency keys on destructive mutations.** The four destructive
9
+ game-client mutations now accept an optional idempotency key. Replaying the
10
+ same call with the same key returns the first result instead of re-applying
11
+ the side effect; the same key with different arguments returns an
12
+ `IDEMPOTENCY_CONFLICT` error. Keys expire server-side after 24h.
13
+
14
+ ```ts
15
+ const key = crypto.randomUUID();
16
+ await client.actors.delete(uuid, key); // first call deletes
17
+ await client.actors.delete(uuid, key); // retry replays the first result
18
+ await client.teams.remove(groupId, key);
19
+ await client.teams.leave(groupId, key);
20
+ await client.voxels.rollback({ ...input, idempotencyKey: key }); // input field
21
+ ```
22
+
23
+ All four parameters are optional and trailing, so existing call sites are
24
+ unchanged.
25
+
26
+ - **Refreshed bundled schema.** Re-synced against `cks-management-api` and
27
+ `cks-game-api` so generated types now include the new Relay-style `*Connection`
28
+ queries (offset `limit`/`offset` args are now marked `@deprecated`), the
29
+ machine-readable `@requiresPermission` directive metadata, and the enumerated
30
+ error codes. `CrowdyGraphQLError` already surfaces these via `extensions.code`,
31
+ `extensions.remediation`, and `extensions.requiredPermission` — no new error
32
+ class is needed.
33
+
34
+ ## Requires
35
+
36
+ - `cks-game-api >= v0.10.3` and `cks-management-api >= v0.1.70`. The destructive
37
+ mutation documents now send the `idempotencyKey` argument, so those four
38
+ operations require a server that defines it. Point the SDK at an environment
39
+ running release **v0.1.19** or later.
40
+
41
+ ---
42
+
43
+ # CrowdyJS v5.1 Notes
44
+
45
+ v5.1 is additive and non-breaking.
46
+
47
+ ## Added
48
+
49
+ - **`client.teams`** — the Teams API is now a first-class sub-client, mirroring
50
+ `client.channels`. Create / update / delete teams, manage membership and
51
+ roles, set the per-app team policy, and read `mine` (`myTeams`), `list`
52
+ (`teams`), `get`, `members`, `roles`, and `policy`. Teams are app-scoped
53
+ player groups with roles and delegated management (no realtime messaging
54
+ path — that is Channels).
55
+
56
+ ```ts
57
+ const team = await client.teams.create({ appId: '1', name: 'Red Squad' });
58
+ await client.teams.join(team.groupId);
59
+ const mine = await client.teams.mine('1');
60
+ ```
61
+
62
+ ## Removed
63
+
64
+ - The `gameModelEventStream` GraphQL subscription has been removed from the Game
65
+ API and the bundled schema. It was never wrapped by a CrowdyJS method, so no
66
+ SDK call sites change. To react to game-model changes, have the mutating
67
+ client send a lightweight notification over the realtime UDP path — a channel
68
+ message (`client.udp.sendChannelMessage`, recommended) or a spatial client
69
+ event (`client.udp.sendClientEvent`) — and have peers re-pull authoritative
70
+ state via `client.gameModel.containerState(...)` / `client.gameModel.events(...)`.
71
+
72
+ ---
73
+
1
74
  # CrowdyJS v5 Migration Notes
2
75
 
3
76
  CrowdyJS v5 makes the realtime subscription **app-scoped** to fix a cross-app
package/README.md CHANGED
@@ -10,6 +10,8 @@ npm install @crowdedkingdomstudios/crowdyjs
10
10
 
11
11
  CrowdyJS v4 targets browsers by default and uses native `fetch`, `WebSocket`, `crypto`, `btoa`, and `atob`. Node tools can still use the SDK, but must provide browser-compatible globals when opening realtime connections.
12
12
 
13
+ > **Server compatibility:** v5.2+ targets environments on release **v0.1.19 or later** (`cks-game-api >= v0.10.3`, `cks-management-api >= v0.1.70`). The destructive mutations send an `idempotencyKey` argument that older servers don't define.
14
+
13
15
  ## Quick start
14
16
 
15
17
  ```ts
@@ -207,6 +209,23 @@ Transport and protocol failures throw structured error classes:
207
209
  - `CrowdyRealtimeError` — realtime subscription couldn't be established or was dropped.
208
210
  - `CrowdyProtocolError` — server response failed schema validation.
209
211
 
212
+ GraphQL errors carry a stable `extensions.code` (e.g. `UNAUTHENTICATED`, `SCOPE_MISSING`, `FORBIDDEN`, `IDEMPOTENCY_CONFLICT`) plus, where applicable, `extensions.remediation` and `extensions.requiredPermission`. Branch on `error.extensions?.code` rather than parsing messages.
213
+
214
+ ## Idempotent retries
215
+
216
+ Destructive game-client mutations accept an optional **idempotency key**. Pass a stable key (e.g. `crypto.randomUUID()`) and a network retry replays the first result instead of applying the side effect twice. Reusing a key with different arguments throws a `CrowdyGraphQLError` with `extensions.code === 'IDEMPOTENCY_CONFLICT'`. Keys expire server-side after 24h.
217
+
218
+ ```ts
219
+ const key = crypto.randomUUID();
220
+ await client.actors.delete(uuid, key); // first call deletes
221
+ await client.actors.delete(uuid, key); // retry → replays the first result
222
+ await client.teams.remove(groupId, key); // deleteTeam
223
+ await client.teams.leave(groupId, key); // leaveTeam
224
+ await client.voxels.rollback({ ...input, idempotencyKey: key }); // input field
225
+ ```
226
+
227
+ The key parameter is optional and trailing, so it's safe to omit. Requires a server on release v0.1.19+ (see Server compatibility above).
228
+
210
229
  ## Auth notes
211
230
 
212
231
  - Use `client.auth.setToken(token)` if you need to seed a token externally (e.g. when restoring auth from a non-default storage).
@@ -37,6 +37,7 @@ import { TeleportAPI } from './domains/teleport.js';
37
37
  import { StateAPI } from './domains/state.js';
38
38
  import { ServerStatusAPI } from './domains/serverStatus.js';
39
39
  import { ChannelsAPI } from './domains/channels.js';
40
+ import { TeamsAPI } from './domains/teams.js';
40
41
  import { UdpAPI } from './domains/udp.js';
41
42
  import { GameModelAPI } from './domains/gameModel.js';
42
43
  export interface CrowdyClientConfig {
@@ -89,6 +90,8 @@ export declare class CrowdyClient {
89
90
  readonly state: StateAPI;
90
91
  readonly serverStatus: ServerStatusAPI;
91
92
  readonly channels: ChannelsAPI;
93
+ /** Teams: app-scoped player groups with roles and delegated management. */
94
+ readonly teams: TeamsAPI;
92
95
  readonly udp: UdpAPI;
93
96
  /** Abstract game model: containers, properties, functions, sessions. */
94
97
  readonly gameModel: GameModelAPI;
@@ -1 +1 @@
1
- {"version":3,"file":"crowdy-client.d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,CAAC;IAGnC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAG/B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;gBAErB,MAAM,GAAE,kBAAuB;IA0D3C,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIpC,0DAA0D;IAC1D,QAAQ,IAAI,MAAM,GAAG,IAAI;IAIzB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAIjC,gEAAgE;IAChE,KAAK,IAAI,IAAI;CAId;AAED,wBAAgB,kBAAkB,CAChC,MAAM,GAAE,kBAAuB,GAC9B,YAAY,CAEd"}
@@ -35,6 +35,7 @@ import { TeleportAPI } from './domains/teleport.js';
35
35
  import { StateAPI } from './domains/state.js';
36
36
  import { ServerStatusAPI } from './domains/serverStatus.js';
37
37
  import { ChannelsAPI } from './domains/channels.js';
38
+ import { TeamsAPI } from './domains/teams.js';
38
39
  import { UdpAPI } from './domains/udp.js';
39
40
  import { GameModelAPI } from './domains/gameModel.js';
40
41
  export class CrowdyClient {
@@ -75,6 +76,7 @@ export class CrowdyClient {
75
76
  this.state = new StateAPI(this.graphql);
76
77
  this.serverStatus = new ServerStatusAPI(this.graphql);
77
78
  this.channels = new ChannelsAPI(this.graphql);
79
+ this.teams = new TeamsAPI(this.graphql);
78
80
  this.udp = new UdpAPI(this.graphql, this.realtime);
79
81
  this.gameModel = new GameModelAPI(this.graphql);
80
82
  }
@@ -16,7 +16,7 @@ export declare class ActorsAPI {
16
16
  batchLookup(input: BatchLookupActorsQueryVariables['input']): Promise<BatchLookupActorsQuery['batchLookupActors']>;
17
17
  create(input: CreateActorMutationVariables['input']): Promise<CreateActorMutation['createActor']>;
18
18
  update(uuid: UpdateActorMutationVariables['uuid'], input: UpdateActorMutationVariables['input']): Promise<UpdateActorMutation['updateActor']>;
19
- delete(uuid: DeleteActorMutationVariables['uuid']): Promise<DeleteActorMutation['deleteActor']>;
19
+ delete(uuid: DeleteActorMutationVariables['uuid'], idempotencyKey?: DeleteActorMutationVariables['idempotencyKey']): Promise<DeleteActorMutation['deleteActor']>;
20
20
  updateState(uuid: UpdateActorStateMutationVariables['uuid'], input: UpdateActorStateMutationVariables['input']): Promise<UpdateActorStateMutation['updateActorState']>;
21
21
  }
22
22
  //# sourceMappingURL=actors.d.ts.map
@@ -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,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,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@ export class ActorsAPI {
31
31
  const data = await this.gql.request(UpdateActorDocument, { uuid, input });
32
32
  return data.updateActor;
33
33
  }
34
- async delete(uuid) {
35
- const data = await this.gql.request(DeleteActorDocument, { uuid });
34
+ async delete(uuid, idempotencyKey) {
35
+ const data = await this.gql.request(DeleteActorDocument, { uuid, idempotencyKey });
36
36
  return data.deleteActor;
37
37
  }
38
38
  async updateState(uuid, input) {
@@ -0,0 +1,34 @@
1
+ import type { GraphQLClient } from '../client.js';
2
+ import { type MyTeamsQuery, type MyTeamsQueryVariables, type TeamsQuery, type TeamsQueryVariables, type TeamQuery, type TeamQueryVariables, type TeamMembersQuery, type TeamMembersQueryVariables, type TeamRolesQuery, type TeamRolesQueryVariables, type TeamPolicyQuery, type TeamPolicyQueryVariables, type SetTeamPolicyMutation, type SetTeamPolicyMutationVariables, type CreateTeamMutation, type CreateTeamMutationVariables, type UpdateTeamMutation, type UpdateTeamMutationVariables, type DeleteTeamMutationVariables, type JoinTeamMutation, type JoinTeamMutationVariables, type RequestToJoinTeamMutation, type RequestToJoinTeamMutationVariables, type LeaveTeamMutationVariables, type AddTeamMemberMutation, type AddTeamMemberMutationVariables, type RemoveTeamMemberMutationVariables, type SetTeamMemberRolesMutation, type SetTeamMemberRolesMutationVariables, type CreateTeamRoleMutation, type CreateTeamRoleMutationVariables, type UpdateTeamRoleMutation, type UpdateTeamRoleMutationVariables, type DeleteTeamRoleMutationVariables } from '../generated/graphql.js';
3
+ /**
4
+ * Teams: app-scoped player groups with roles and delegated management, built
5
+ * on the same generic groups subsystem as Channels (group_type='team'). Team
6
+ * CRUD, membership, and roles run over the game-api GraphQL endpoint. Unlike
7
+ * channels, teams have no realtime messaging path.
8
+ *
9
+ * Exposed as `client.teams`.
10
+ */
11
+ export declare class TeamsAPI {
12
+ private gql;
13
+ constructor(gql: GraphQLClient);
14
+ mine(appId: MyTeamsQueryVariables['appId']): Promise<MyTeamsQuery['myTeams']>;
15
+ list(appId: TeamsQueryVariables['appId']): Promise<TeamsQuery['teams']>;
16
+ get(groupId: TeamQueryVariables['groupId']): Promise<TeamQuery['team']>;
17
+ members(groupId: TeamMembersQueryVariables['groupId']): Promise<TeamMembersQuery['teamMembers']>;
18
+ roles(groupId: TeamRolesQueryVariables['groupId']): Promise<TeamRolesQuery['teamRoles']>;
19
+ policy(appId: TeamPolicyQueryVariables['appId']): Promise<TeamPolicyQuery['teamPolicy']>;
20
+ create(input: CreateTeamMutationVariables['input']): Promise<CreateTeamMutation['createTeam']>;
21
+ update(input: UpdateTeamMutationVariables['input']): Promise<UpdateTeamMutation['updateTeam']>;
22
+ remove(groupId: DeleteTeamMutationVariables['groupId'], idempotencyKey?: DeleteTeamMutationVariables['idempotencyKey']): Promise<boolean>;
23
+ setPolicy(input: SetTeamPolicyMutationVariables['input']): Promise<SetTeamPolicyMutation['setTeamPolicy']>;
24
+ join(groupId: JoinTeamMutationVariables['groupId']): Promise<JoinTeamMutation['joinTeam']>;
25
+ requestToJoin(groupId: RequestToJoinTeamMutationVariables['groupId']): Promise<RequestToJoinTeamMutation['requestToJoinTeam']>;
26
+ leave(groupId: LeaveTeamMutationVariables['groupId'], idempotencyKey?: LeaveTeamMutationVariables['idempotencyKey']): Promise<boolean>;
27
+ addMember(groupId: AddTeamMemberMutationVariables['groupId'], userId: AddTeamMemberMutationVariables['userId']): Promise<AddTeamMemberMutation['addTeamMember']>;
28
+ removeMember(groupId: RemoveTeamMemberMutationVariables['groupId'], userId: RemoveTeamMemberMutationVariables['userId']): Promise<boolean>;
29
+ setMemberRoles(input: SetTeamMemberRolesMutationVariables['input']): Promise<SetTeamMemberRolesMutation['setTeamMemberRoles']>;
30
+ createRole(input: CreateTeamRoleMutationVariables['input']): Promise<CreateTeamRoleMutation['createTeamRole']>;
31
+ updateRole(input: UpdateTeamRoleMutationVariables['input']): Promise<UpdateTeamRoleMutation['updateTeamRole']>;
32
+ deleteRole(groupRoleId: DeleteTeamRoleMutationVariables['groupRoleId']): Promise<boolean>;
33
+ }
34
+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AKb,SAAS,CACb,OAAO,EAAE,8BAA8B,CAAC,SAAS,CAAC,EAClD,MAAM,EAAE,8BAA8B,CAAC,QAAQ,CAAC,GAC/C,OAAO,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC;IAK5C,YAAY,CAChB,OAAO,EAAE,iCAAiC,CAAC,SAAS,CAAC,EACrD,MAAM,EAAE,iCAAiC,CAAC,QAAQ,CAAC,GAClD,OAAO,CAAC,OAAO,CAAC;IAKb,cAAc,CAClB,KAAK,EAAE,mCAAmC,CAAC,OAAO,CAAC,GAClD,OAAO,CAAC,0BAA0B,CAAC,oBAAoB,CAAC,CAAC;IAOtD,UAAU,CACd,KAAK,EAAE,+BAA+B,CAAC,OAAO,CAAC,GAC9C,OAAO,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;IAK9C,UAAU,CACd,KAAK,EAAE,+BAA+B,CAAC,OAAO,CAAC,GAC9C,OAAO,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;IAK9C,UAAU,CACd,WAAW,EAAE,+BAA+B,CAAC,aAAa,CAAC,GAC1D,OAAO,CAAC,OAAO,CAAC;CAIpB"}
@@ -0,0 +1,94 @@
1
+ import { MyTeamsDocument, TeamsDocument, TeamDocument, TeamMembersDocument, TeamRolesDocument, TeamPolicyDocument, SetTeamPolicyDocument, CreateTeamDocument, UpdateTeamDocument, DeleteTeamDocument, JoinTeamDocument, RequestToJoinTeamDocument, LeaveTeamDocument, AddTeamMemberDocument, RemoveTeamMemberDocument, SetTeamMemberRolesDocument, CreateTeamRoleDocument, UpdateTeamRoleDocument, DeleteTeamRoleDocument, } from '../generated/graphql.js';
2
+ /**
3
+ * Teams: app-scoped player groups with roles and delegated management, built
4
+ * on the same generic groups subsystem as Channels (group_type='team'). Team
5
+ * CRUD, membership, and roles run over the game-api GraphQL endpoint. Unlike
6
+ * channels, teams have no realtime messaging path.
7
+ *
8
+ * Exposed as `client.teams`.
9
+ */
10
+ export class TeamsAPI {
11
+ constructor(gql) {
12
+ this.gql = gql;
13
+ }
14
+ // -- Queries --------------------------------------------------------------
15
+ async mine(appId) {
16
+ const data = await this.gql.request(MyTeamsDocument, { appId });
17
+ return data.myTeams;
18
+ }
19
+ async list(appId) {
20
+ const data = await this.gql.request(TeamsDocument, { appId });
21
+ return data.teams;
22
+ }
23
+ async get(groupId) {
24
+ const data = await this.gql.request(TeamDocument, { groupId });
25
+ return data.team;
26
+ }
27
+ async members(groupId) {
28
+ const data = await this.gql.request(TeamMembersDocument, { groupId });
29
+ return data.teamMembers;
30
+ }
31
+ async roles(groupId) {
32
+ const data = await this.gql.request(TeamRolesDocument, { groupId });
33
+ return data.teamRoles;
34
+ }
35
+ async policy(appId) {
36
+ const data = await this.gql.request(TeamPolicyDocument, { appId });
37
+ return data.teamPolicy;
38
+ }
39
+ // -- Team mutations -------------------------------------------------------
40
+ async create(input) {
41
+ const data = await this.gql.request(CreateTeamDocument, { input });
42
+ return data.createTeam;
43
+ }
44
+ async update(input) {
45
+ const data = await this.gql.request(UpdateTeamDocument, { input });
46
+ return data.updateTeam;
47
+ }
48
+ async remove(groupId, idempotencyKey) {
49
+ const data = await this.gql.request(DeleteTeamDocument, { groupId, idempotencyKey });
50
+ return data.deleteTeam;
51
+ }
52
+ async setPolicy(input) {
53
+ const data = await this.gql.request(SetTeamPolicyDocument, { input });
54
+ return data.setTeamPolicy;
55
+ }
56
+ // -- Membership mutations -------------------------------------------------
57
+ async join(groupId) {
58
+ const data = await this.gql.request(JoinTeamDocument, { groupId });
59
+ return data.joinTeam;
60
+ }
61
+ async requestToJoin(groupId) {
62
+ const data = await this.gql.request(RequestToJoinTeamDocument, { groupId });
63
+ return data.requestToJoinTeam;
64
+ }
65
+ async leave(groupId, idempotencyKey) {
66
+ const data = await this.gql.request(LeaveTeamDocument, { groupId, idempotencyKey });
67
+ return data.leaveTeam;
68
+ }
69
+ async addMember(groupId, userId) {
70
+ const data = await this.gql.request(AddTeamMemberDocument, { groupId, userId });
71
+ return data.addTeamMember;
72
+ }
73
+ async removeMember(groupId, userId) {
74
+ const data = await this.gql.request(RemoveTeamMemberDocument, { groupId, userId });
75
+ return data.removeTeamMember;
76
+ }
77
+ async setMemberRoles(input) {
78
+ const data = await this.gql.request(SetTeamMemberRolesDocument, { input });
79
+ return data.setTeamMemberRoles;
80
+ }
81
+ // -- Role mutations -------------------------------------------------------
82
+ async createRole(input) {
83
+ const data = await this.gql.request(CreateTeamRoleDocument, { input });
84
+ return data.createTeamRole;
85
+ }
86
+ async updateRole(input) {
87
+ const data = await this.gql.request(UpdateTeamRoleDocument, { input });
88
+ return data.updateTeamRole;
89
+ }
90
+ async deleteRole(groupRoleId) {
91
+ const data = await this.gql.request(DeleteTeamRoleDocument, { groupRoleId });
92
+ return data.deleteTeamRole;
93
+ }
94
+ }