@crowdedkingdoms/crowdyjs 8.7.0 → 8.9.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.
Files changed (83) hide show
  1. package/MIGRATION.md +85 -0
  2. package/README.md +2 -2
  3. package/dist/domains/compute.d.ts +12 -1
  4. package/dist/domains/compute.d.ts.map +1 -1
  5. package/dist/domains/compute.js +18 -1
  6. package/dist/generated/graphql.d.ts +60 -0
  7. package/dist/generated/graphql.d.ts.map +1 -1
  8. package/dist/generated/graphql.js +2 -0
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +2 -2
  12. package/dist/kit/abilities.d.ts +66 -0
  13. package/dist/kit/abilities.d.ts.map +1 -0
  14. package/dist/kit/abilities.js +71 -0
  15. package/dist/kit/blueprints/index.d.ts +2 -0
  16. package/dist/kit/blueprints/index.d.ts.map +1 -1
  17. package/dist/kit/blueprints/index.js +2 -0
  18. package/dist/kit/blueprints/liveops.d.ts +42 -0
  19. package/dist/kit/blueprints/liveops.d.ts.map +1 -0
  20. package/dist/kit/blueprints/liveops.js +170 -0
  21. package/dist/kit/blueprints/moderation.d.ts +32 -0
  22. package/dist/kit/blueprints/moderation.d.ts.map +1 -0
  23. package/dist/kit/blueprints/moderation.js +140 -0
  24. package/dist/kit/decks.d.ts +33 -1
  25. package/dist/kit/decks.d.ts.map +1 -1
  26. package/dist/kit/decks.js +49 -1
  27. package/dist/kit/director.d.ts +88 -0
  28. package/dist/kit/director.d.ts.map +1 -0
  29. package/dist/kit/director.js +86 -0
  30. package/dist/kit/economy.d.ts +46 -1
  31. package/dist/kit/economy.d.ts.map +1 -1
  32. package/dist/kit/economy.js +63 -1
  33. package/dist/kit/index.d.ts +14 -3
  34. package/dist/kit/index.d.ts.map +1 -1
  35. package/dist/kit/index.js +14 -3
  36. package/dist/kit/instances.d.ts +52 -0
  37. package/dist/kit/instances.d.ts.map +1 -0
  38. package/dist/kit/instances.js +60 -0
  39. package/dist/kit/kit.d.ts +60 -0
  40. package/dist/kit/kit.d.ts.map +1 -1
  41. package/dist/kit/kit.js +47 -5
  42. package/dist/kit/leaderboards.d.ts +21 -1
  43. package/dist/kit/leaderboards.d.ts.map +1 -1
  44. package/dist/kit/leaderboards.js +40 -1
  45. package/dist/kit/liveops.d.ts +112 -0
  46. package/dist/kit/liveops.d.ts.map +1 -0
  47. package/dist/kit/liveops.js +183 -0
  48. package/dist/kit/loot.d.ts +22 -1
  49. package/dist/kit/loot.d.ts.map +1 -1
  50. package/dist/kit/loot.js +41 -1
  51. package/dist/kit/matches.d.ts +33 -1
  52. package/dist/kit/matches.d.ts.map +1 -1
  53. package/dist/kit/matches.js +56 -1
  54. package/dist/kit/matchmaking.d.ts +57 -0
  55. package/dist/kit/matchmaking.d.ts.map +1 -0
  56. package/dist/kit/matchmaking.js +59 -0
  57. package/dist/kit/minigames.d.ts +30 -0
  58. package/dist/kit/minigames.d.ts.map +1 -0
  59. package/dist/kit/minigames.js +38 -0
  60. package/dist/kit/moderation.d.ts +73 -0
  61. package/dist/kit/moderation.d.ts.map +1 -0
  62. package/dist/kit/moderation.js +103 -0
  63. package/dist/kit/movement.d.ts +78 -0
  64. package/dist/kit/movement.d.ts.map +1 -0
  65. package/dist/kit/movement.js +103 -0
  66. package/dist/kit/npcs.d.ts.map +1 -1
  67. package/dist/kit/quests.d.ts +57 -0
  68. package/dist/kit/quests.d.ts.map +1 -1
  69. package/dist/kit/quests.js +72 -0
  70. package/dist/kit/racing.d.ts +85 -0
  71. package/dist/kit/racing.d.ts.map +1 -0
  72. package/dist/kit/racing.js +99 -0
  73. package/dist/kit/social.d.ts.map +1 -1
  74. package/dist/kit/telemetry.d.ts +66 -0
  75. package/dist/kit/telemetry.d.ts.map +1 -0
  76. package/dist/kit/telemetry.js +133 -0
  77. package/dist/kit/territory.d.ts +97 -0
  78. package/dist/kit/territory.d.ts.map +1 -0
  79. package/dist/kit/territory.js +114 -0
  80. package/dist/kit/wire.d.ts +88 -0
  81. package/dist/kit/wire.d.ts.map +1 -1
  82. package/dist/kit/wire.js +110 -0
  83. package/package.json +1 -1
@@ -0,0 +1,114 @@
1
+ import { parseControlPointEvent } from './wire.js';
2
+ /**
3
+ * Runtime helpers for the territory engine (Wave 3): control-point state,
4
+ * faction standings, and the admin CRUD for the map (factions, members,
5
+ * points). Capture itself is pure presence — stand inside a point's radius
6
+ * with your faction; the engine does the rest and announces flips as
7
+ * type-96 events.
8
+ *
9
+ * Obtained via `client.kit(appId).territory`.
10
+ */
11
+ export class TerritoryKit {
12
+ constructor(appId, gameModel, engines, options = {}) {
13
+ this.appId = appId;
14
+ this.gameModel = gameModel;
15
+ this.engines = engines;
16
+ this.moduleName = options.moduleName ?? 'territory';
17
+ }
18
+ /** Is the territory engine deployed + enabled (cached per session)? */
19
+ engineAvailable() {
20
+ return this.engines.has(this.moduleName);
21
+ }
22
+ /** Every control point with live capture state. */
23
+ async points() {
24
+ const body = await this.invoke('points', {});
25
+ return Array.isArray(body.points)
26
+ ? body.points.map((p) => ({
27
+ pointId: String(p.pointId ?? ''),
28
+ x: Number(p.x ?? 0),
29
+ z: Number(p.z ?? 0),
30
+ radius: Number(p.radius ?? 0),
31
+ owner: String(p.owner ?? ''),
32
+ challenger: String(p.challenger ?? ''),
33
+ progress: Number(p.progress ?? 0),
34
+ incomePerMin: Number(p.incomePerMin ?? 0),
35
+ siegeOpen: p.siegeOpen === true,
36
+ }))
37
+ : [];
38
+ }
39
+ /** Faction standings (id + treasury). */
40
+ async factions() {
41
+ const body = await this.invoke('factions', {});
42
+ return Array.isArray(body.factions)
43
+ ? body.factions.map((f) => ({
44
+ factionId: String(f.factionId ?? ''),
45
+ gold: Number(f.gold ?? 0),
46
+ }))
47
+ : [];
48
+ }
49
+ /** Engine totals (flips, income paid). */
50
+ async status() {
51
+ return this.invoke('status', {});
52
+ }
53
+ /** STUDIO (admin) — create a faction. */
54
+ async defineFaction(factionId, displayName) {
55
+ return this.gameModel.createContainer({
56
+ appId: this.appId,
57
+ typeName: 'Faction',
58
+ displayName: displayName ?? `faction-${factionId}`,
59
+ properties: [
60
+ { key: 'faction_id', valueType: 'string', valueJson: JSON.stringify(factionId) },
61
+ { key: 'gold', valueType: 'int', valueJson: '0' },
62
+ ],
63
+ });
64
+ }
65
+ /** STUDIO (admin) — enroll a player in a faction. */
66
+ async enroll(userId, factionId) {
67
+ return this.gameModel.createContainer({
68
+ appId: this.appId,
69
+ typeName: 'FactionMember',
70
+ displayName: `member-${userId}`,
71
+ properties: [
72
+ { key: 'user_id', valueType: 'string', valueJson: JSON.stringify(userId) },
73
+ { key: 'faction_id', valueType: 'string', valueJson: JSON.stringify(factionId) },
74
+ ],
75
+ });
76
+ }
77
+ /** STUDIO (admin) — create a control point. */
78
+ async definePoint(input) {
79
+ return this.gameModel.createContainer({
80
+ appId: this.appId,
81
+ typeName: 'ControlPoint',
82
+ displayName: input.displayName ?? `cp-${input.pointId}`,
83
+ properties: [
84
+ { key: 'point_id', valueType: 'string', valueJson: JSON.stringify(input.pointId) },
85
+ { key: 'x', valueType: 'int', valueJson: String(Math.round(input.x)) },
86
+ { key: 'z', valueType: 'int', valueJson: String(Math.round(input.z)) },
87
+ { key: 'radius', valueType: 'int', valueJson: String(Math.round(input.radius)) },
88
+ { key: 'owner_faction', valueType: 'string', valueJson: '""' },
89
+ {
90
+ key: 'income_per_min',
91
+ valueType: 'int',
92
+ valueJson: String(input.incomePerMin ?? 0),
93
+ },
94
+ ...(input.siegeFromMin !== undefined
95
+ ? [{ key: 'siege_from_min', valueType: 'int', valueJson: String(input.siegeFromMin) }]
96
+ : []),
97
+ ...(input.siegeToMin !== undefined
98
+ ? [{ key: 'siege_to_min', valueType: 'int', valueJson: String(input.siegeToMin) }]
99
+ : []),
100
+ ],
101
+ });
102
+ }
103
+ /** Parse a type-96 control-point server event (flips). */
104
+ parseControlPoint(bytes) {
105
+ return parseControlPointEvent(bytes);
106
+ }
107
+ async invoke(exportName, params) {
108
+ const result = await this.engines.invoke(this.moduleName, exportName, params);
109
+ if (!result.success) {
110
+ throw new Error(`territory.${exportName} failed: ${result.reason ?? 'unknown'}`);
111
+ }
112
+ return result.body;
113
+ }
114
+ }
@@ -60,6 +60,22 @@ export declare function engineLanes(): Record<string, (state: EnginePose) => boo
60
60
  export declare const EVENT_CONTACT_DAMAGE = 77;
61
61
  /** Weather/season transition from a world engine (kit-sim weather). */
62
62
  export declare const EVENT_WEATHER = 90;
63
+ /** Turn changed (kit-play turns; match engines). */
64
+ export declare const EVENT_TURN = 91;
65
+ /** Score / match summary (kit-play score). */
66
+ export declare const EVENT_SCORE = 92;
67
+ /** Match proposal (matchmaking → matches handoff). */
68
+ export declare const EVENT_PROPOSAL = 93;
69
+ /** Ability cast/impact (kit-play abilities). */
70
+ export declare const EVENT_ABILITY = 94;
71
+ /** Movement-envelope violation (movement-warden, observe/flag). */
72
+ export declare const EVENT_MOVEMENT_VIOLATION = 95;
73
+ /** Control-point state change (territory). */
74
+ export declare const EVENT_CONTROL_POINT = 96;
75
+ /** Race timing: checkpoint/lap/finish (kit-play timing). */
76
+ export declare const EVENT_RACE_TIMING = 97;
77
+ /** Zone change: shrinking circles, event areas (kit-sim zones). */
78
+ export declare const EVENT_ZONE_CHANGE = 98;
63
79
  /** Split an engine server-event payload into its type + JSON body. */
64
80
  export declare function parseEngineEvent(bytes: Uint8Array): {
65
81
  eventType: number;
@@ -84,4 +100,76 @@ export interface WeatherEvent {
84
100
  }
85
101
  /** Parse a weather event; null when the payload is another type. */
86
102
  export declare function parseWeatherEvent(bytes: Uint8Array): WeatherEvent | null;
103
+ /** A parsed type-91 turn-changed event (match engines). */
104
+ export interface TurnEvent {
105
+ actorId: string;
106
+ round: number;
107
+ turnInRound: number;
108
+ body: Record<string, unknown>;
109
+ }
110
+ /** Parse a turn event; null when the payload is another type. */
111
+ export declare function parseTurnEvent(bytes: Uint8Array): TurnEvent | null;
112
+ /** A parsed type-92 score/summary event (match engines). */
113
+ export interface ScoreEvent {
114
+ /** Per-actor standings when present. */
115
+ standings: Array<{
116
+ actorId: string;
117
+ score: number;
118
+ rank: number;
119
+ }>;
120
+ winnerId: string | null;
121
+ body: Record<string, unknown>;
122
+ }
123
+ /** Parse a score event; null when the payload is another type. */
124
+ export declare function parseScoreEvent(bytes: Uint8Array): ScoreEvent | null;
125
+ /** A parsed type-93 match-proposal event (matchmaking handoff). */
126
+ export interface ProposalEvent {
127
+ proposalId: string;
128
+ mode: string;
129
+ players: string[];
130
+ body: Record<string, unknown>;
131
+ }
132
+ /** Parse a proposal event; null when the payload is another type. */
133
+ export declare function parseProposalEvent(bytes: Uint8Array): ProposalEvent | null;
134
+ /** A parsed type-94 ability cast/impact event. */
135
+ export interface AbilityEvent {
136
+ /** `'cast'` or `'impact'`. */
137
+ kind: string;
138
+ abilityId: string;
139
+ casterId: string;
140
+ victimId: string | null;
141
+ damage: number;
142
+ body: Record<string, unknown>;
143
+ }
144
+ /** Parse an ability event; null when the payload is another type. */
145
+ export declare function parseAbilityEvent(bytes: Uint8Array): AbilityEvent | null;
146
+ /** A parsed type-95 movement-violation event (observe/flag posture). */
147
+ export interface MovementViolationEvent {
148
+ /** `'speed'`, `'teleport'`, or `'bounds'`. */
149
+ kind: string;
150
+ userId: string;
151
+ detail: string;
152
+ body: Record<string, unknown>;
153
+ }
154
+ /** Parse a movement-violation event; null when the payload is another type. */
155
+ export declare function parseMovementViolation(bytes: Uint8Array): MovementViolationEvent | null;
156
+ /** A parsed type-96 control-point state event (territory flips). */
157
+ export interface ControlPointEvent {
158
+ pointId: string;
159
+ owner: string;
160
+ previousOwner: string;
161
+ body: Record<string, unknown>;
162
+ }
163
+ /** Parse a control-point event; null when the payload is another type. */
164
+ export declare function parseControlPointEvent(bytes: Uint8Array): ControlPointEvent | null;
165
+ /** A parsed type-97 race-timing event (checkpoint/lap/finish). */
166
+ export interface RaceTimingEvent {
167
+ /** `'started'`, `'checkpoint'`, `'lap'`, or `'finished'`. */
168
+ kind: string;
169
+ courseId: string;
170
+ userId: string;
171
+ body: Record<string, unknown>;
172
+ }
173
+ /** Parse a race-timing event; null when the payload is another type. */
174
+ export declare function parseRaceTimingEvent(bytes: Uint8Array): RaceTimingEvent | null;
87
175
  //# sourceMappingURL=wire.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../src/kit/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,eAAO,MAAM,UAAU,KAAK,CAAC;AAE7B,4EAA4E;AAC5E,eAAO,MAAM,aAAa,IAAS,CAAC;AACpC,eAAO,MAAM,QAAQ,IAAS,CAAC;AAC/B,eAAO,MAAM,QAAQ,IAAS,CAAC;AAC/B,eAAO,MAAM,cAAc,IAAS,CAAC;AAErC,uEAAuE;AACvE,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,gDAAgD;AAChD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU,CAiBtE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,CAqBrE;AAED,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAI3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AM,WAAW,sBAAsB;IACrC,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,+EAA+E;AAC/E,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,UAAU,GAAG,sBAAsB,GAAG,IAAI,CASvF;AAED,oEAAoE;AACpE,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,0EAA0E;AAC1E,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,UAAU,GAAG,iBAAiB,GAAG,IAAI,CASlF;AAED,kEAAkE;AAClE,MAAM,WAAW,eAAe;IAC9B,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,eAAe,GAAG,IAAI,CAS9E"}
package/dist/kit/wire.js CHANGED
@@ -114,6 +114,22 @@ export function engineLanes() {
114
114
  export const EVENT_CONTACT_DAMAGE = 77;
115
115
  /** Weather/season transition from a world engine (kit-sim weather). */
116
116
  export const EVENT_WEATHER = 90;
117
+ /** Turn changed (kit-play turns; match engines). */
118
+ export const EVENT_TURN = 91;
119
+ /** Score / match summary (kit-play score). */
120
+ export const EVENT_SCORE = 92;
121
+ /** Match proposal (matchmaking → matches handoff). */
122
+ export const EVENT_PROPOSAL = 93;
123
+ /** Ability cast/impact (kit-play abilities). */
124
+ export const EVENT_ABILITY = 94;
125
+ /** Movement-envelope violation (movement-warden, observe/flag). */
126
+ export const EVENT_MOVEMENT_VIOLATION = 95;
127
+ /** Control-point state change (territory). */
128
+ export const EVENT_CONTROL_POINT = 96;
129
+ /** Race timing: checkpoint/lap/finish (kit-play timing). */
130
+ export const EVENT_RACE_TIMING = 97;
131
+ /** Zone change: shrinking circles, event areas (kit-sim zones). */
132
+ export const EVENT_ZONE_CHANGE = 98;
117
133
  /** Split an engine server-event payload into its type + JSON body. */
118
134
  export function parseEngineEvent(bytes) {
119
135
  if (bytes.length < 2)
@@ -154,3 +170,97 @@ export function parseWeatherEvent(bytes) {
154
170
  body: parsed.body,
155
171
  };
156
172
  }
173
+ /** Parse a turn event; null when the payload is another type. */
174
+ export function parseTurnEvent(bytes) {
175
+ const parsed = parseEngineEvent(bytes);
176
+ if (!parsed || parsed.eventType !== EVENT_TURN)
177
+ return null;
178
+ return {
179
+ actorId: String(parsed.body.actorId ?? ''),
180
+ round: Number(parsed.body.round ?? 0),
181
+ turnInRound: Number(parsed.body.turnInRound ?? 0),
182
+ body: parsed.body,
183
+ };
184
+ }
185
+ /** Parse a score event; null when the payload is another type. */
186
+ export function parseScoreEvent(bytes) {
187
+ const parsed = parseEngineEvent(bytes);
188
+ if (!parsed || parsed.eventType !== EVENT_SCORE)
189
+ return null;
190
+ const standings = Array.isArray(parsed.body.standings)
191
+ ? parsed.body.standings.map((s) => ({
192
+ actorId: String(s.actorId ?? ''),
193
+ score: Number(s.score ?? 0),
194
+ rank: Number(s.rank ?? 0),
195
+ }))
196
+ : [];
197
+ return {
198
+ standings,
199
+ winnerId: parsed.body.winnerId != null ? String(parsed.body.winnerId) : null,
200
+ body: parsed.body,
201
+ };
202
+ }
203
+ /** Parse a proposal event; null when the payload is another type. */
204
+ export function parseProposalEvent(bytes) {
205
+ const parsed = parseEngineEvent(bytes);
206
+ if (!parsed || parsed.eventType !== EVENT_PROPOSAL)
207
+ return null;
208
+ return {
209
+ proposalId: String(parsed.body.proposalId ?? ''),
210
+ mode: String(parsed.body.mode ?? ''),
211
+ players: Array.isArray(parsed.body.players)
212
+ ? parsed.body.players.map(String)
213
+ : [],
214
+ body: parsed.body,
215
+ };
216
+ }
217
+ /** Parse an ability event; null when the payload is another type. */
218
+ export function parseAbilityEvent(bytes) {
219
+ const parsed = parseEngineEvent(bytes);
220
+ if (!parsed || parsed.eventType !== EVENT_ABILITY)
221
+ return null;
222
+ return {
223
+ kind: String(parsed.body.kind ?? ''),
224
+ abilityId: String(parsed.body.abilityId ?? ''),
225
+ casterId: String(parsed.body.casterId ?? ''),
226
+ victimId: parsed.body.victimId != null ? String(parsed.body.victimId) : null,
227
+ damage: Number(parsed.body.damage ?? 0),
228
+ body: parsed.body,
229
+ };
230
+ }
231
+ /** Parse a movement-violation event; null when the payload is another type. */
232
+ export function parseMovementViolation(bytes) {
233
+ const parsed = parseEngineEvent(bytes);
234
+ if (!parsed || parsed.eventType !== EVENT_MOVEMENT_VIOLATION)
235
+ return null;
236
+ return {
237
+ kind: String(parsed.body.kind ?? ''),
238
+ userId: String(parsed.body.userId ?? ''),
239
+ detail: String(parsed.body.detail ?? ''),
240
+ body: parsed.body,
241
+ };
242
+ }
243
+ /** Parse a control-point event; null when the payload is another type. */
244
+ export function parseControlPointEvent(bytes) {
245
+ const parsed = parseEngineEvent(bytes);
246
+ if (!parsed || parsed.eventType !== EVENT_CONTROL_POINT)
247
+ return null;
248
+ return {
249
+ pointId: String(parsed.body.pointId ?? ''),
250
+ owner: String(parsed.body.owner ?? ''),
251
+ previousOwner: String(parsed.body.previousOwner ?? ''),
252
+ body: parsed.body,
253
+ };
254
+ }
255
+ /** Parse a race-timing event; null when the payload is another type. */
256
+ export function parseRaceTimingEvent(bytes) {
257
+ const parsed = parseEngineEvent(bytes);
258
+ if (!parsed || parsed.eventType !== EVENT_RACE_TIMING)
259
+ return null;
260
+ return {
261
+ kind: String(parsed.body.kind ?? ''),
262
+ courseId: String(parsed.body.courseId ?? ''),
263
+ userId: String(parsed.body.userId ?? ''),
264
+ body: parsed.body,
265
+ };
266
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdedkingdoms/crowdyjs",
3
- "version": "8.7.0",
3
+ "version": "8.9.0",
4
4
  "description": "Client SDK for Crowded Kingdoms GraphQL API with UDP proxy support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",