@warpfx/server 0.2.1 → 0.3.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/dist/index.d.ts +141 -163
- package/dist/index.js +34 -29
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -66,10 +66,20 @@ interface ColumnDef {
|
|
|
66
66
|
/** Default value for this column when inserting a row without it. */
|
|
67
67
|
default?: unknown;
|
|
68
68
|
}
|
|
69
|
+
/** Table access mode for client sync. */
|
|
70
|
+
type AccessMode = "private" | "public";
|
|
69
71
|
/** Table definition in a warp.schema.json. */
|
|
70
72
|
interface TableDef {
|
|
71
73
|
/** Column definitions keyed by column name. */
|
|
72
74
|
columns: Record<string, ColumnDef>;
|
|
75
|
+
/**
|
|
76
|
+
* Client access mode — controls automatic sync to players.
|
|
77
|
+
*
|
|
78
|
+
* - `"private"` — Only the owning player receives their rows (scope = primary key).
|
|
79
|
+
* - `"public"` — All connected players receive all rows.
|
|
80
|
+
* - Omitted — Server-only, not synced to clients.
|
|
81
|
+
*/
|
|
82
|
+
access?: AccessMode;
|
|
73
83
|
}
|
|
74
84
|
/** The full warp.schema.json format. */
|
|
75
85
|
interface WarpSchema {
|
|
@@ -84,22 +94,22 @@ interface WarpSchema {
|
|
|
84
94
|
}
|
|
85
95
|
|
|
86
96
|
/**
|
|
87
|
-
* @
|
|
97
|
+
* @warpfx/server — Server-side SDK for Warp module development.
|
|
88
98
|
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
99
|
+
* Clean, minimal API for building FiveM server features with Warp.
|
|
100
|
+
* All calls delegate to the Warp core via FiveM resource exports.
|
|
91
101
|
*
|
|
92
102
|
* Usage:
|
|
93
|
-
* import {
|
|
103
|
+
* import { action, fn, command, error, table } from '@warpfx/server';
|
|
104
|
+
* import { accounts } from './db'; // auto-generated from schema
|
|
94
105
|
*
|
|
95
|
-
*
|
|
96
|
-
* const
|
|
97
|
-
*
|
|
98
|
-
* provide('economy', new EconomyService());
|
|
106
|
+
* action('deposit', async (player, { amount }) => {
|
|
107
|
+
* const account = accounts.find(player.citizenId);
|
|
108
|
+
* accounts.update(player.citizenId, { balance: account.balance + amount });
|
|
99
109
|
* });
|
|
100
110
|
*/
|
|
101
|
-
/** Player
|
|
102
|
-
interface
|
|
111
|
+
/** Player context passed to action/function handlers. */
|
|
112
|
+
interface Player {
|
|
103
113
|
/** FiveM server-side player ID. */
|
|
104
114
|
source: number;
|
|
105
115
|
/** Citizen ID (license identifier). */
|
|
@@ -124,216 +134,184 @@ interface PlayerRow {
|
|
|
124
134
|
type PlayerState = "connecting" | "connected" | "spawned";
|
|
125
135
|
/** Player entity with ECS component access. */
|
|
126
136
|
interface PlayerEntity {
|
|
127
|
-
/** FiveM server-side player ID. */
|
|
128
137
|
readonly source: number;
|
|
129
|
-
/** Citizen ID (license identifier). */
|
|
130
138
|
readonly citizenId: string;
|
|
131
|
-
/** Display name. */
|
|
132
139
|
readonly name: string;
|
|
133
|
-
/** Discord identifier (e.g. "discord:123456789"), if linked. */
|
|
134
140
|
readonly discordId: string | undefined;
|
|
135
|
-
/** Steam identifier (e.g. "steam:110000..."), if linked. */
|
|
136
141
|
readonly steamId: string | undefined;
|
|
137
|
-
/** Current lifecycle state. */
|
|
138
142
|
readonly state: PlayerState;
|
|
139
|
-
/** Get a component attached to this player. */
|
|
140
143
|
getComponent<T>(component: string): T | undefined;
|
|
141
|
-
/** Attach or replace a component on this player. */
|
|
142
144
|
setComponent<T>(component: string, data: T): void;
|
|
143
|
-
/** Check if this player has a specific component. */
|
|
144
145
|
hasComponent(component: string): boolean;
|
|
145
|
-
/** Remove a component from this player. */
|
|
146
146
|
removeComponent(component: string): boolean;
|
|
147
147
|
}
|
|
148
148
|
/** Typed event bus for server-side and network communication. */
|
|
149
149
|
interface ServerEventBus<TMap extends Record<string, any> = Record<string, any>> {
|
|
150
|
-
/** Subscribe to a local event. Returns an unsubscribe function. */
|
|
151
150
|
on<K extends string & keyof TMap>(event: K, handler: (data: TMap[K]) => void): () => void;
|
|
152
|
-
/** Unsubscribe from a local event. */
|
|
153
151
|
off<K extends string & keyof TMap>(event: K, handler: (data: TMap[K]) => void): void;
|
|
154
|
-
/** Emit a local event to all subscribers. */
|
|
155
152
|
emit<K extends string & keyof TMap>(event: K, data: TMap[K]): void;
|
|
156
|
-
/** Send an event to a specific client. */
|
|
157
153
|
emitClient<K extends string & keyof TMap>(event: K, target: number, data: TMap[K]): void;
|
|
158
|
-
/** Broadcast an event to all connected clients. */
|
|
159
154
|
emitAllClients<K extends string & keyof TMap>(event: K, data: TMap[K]): void;
|
|
160
|
-
/** Listen for events from clients. Returns an unsubscribe function. */
|
|
161
155
|
onClient<K extends string & keyof TMap>(event: K, handler: (source: number, data: TMap[K]) => void): () => void;
|
|
162
|
-
/** Unsubscribe from a client event. */
|
|
163
156
|
offClient<K extends string & keyof TMap>(event: K, handler: (source: number, data: TMap[K]) => void): void;
|
|
164
157
|
}
|
|
165
158
|
/** ECS-inspired entity component store. */
|
|
166
159
|
interface EntityStore {
|
|
167
|
-
/** Attach a component to an entity. */
|
|
168
160
|
attach<T>(entityId: string, component: string, data: T): void;
|
|
169
|
-
/** Get a component from an entity. Returns undefined if not found. */
|
|
170
161
|
get<T>(entityId: string, component: string): T | undefined;
|
|
171
|
-
/** Remove a component from an entity. */
|
|
172
162
|
detach(entityId: string, component: string): boolean;
|
|
173
|
-
/** Remove all components for an entity. */
|
|
174
163
|
removeEntity(entityId: string): void;
|
|
175
|
-
/** Check if an entity has a specific component. */
|
|
176
164
|
has(entityId: string, component: string): boolean;
|
|
177
|
-
/** Iterate all entities that have a specific component. */
|
|
178
165
|
query<T>(component: string): IterableIterator<[string, T]>;
|
|
179
166
|
}
|
|
180
|
-
/**
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
*/
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
|
|
192
|
-
/** Get the shared event bus instance. */
|
|
193
|
-
declare function getEvents<TMap extends Record<string, any> = Record<string, any>>(): ServerEventBus<TMap>;
|
|
194
|
-
/** Get the shared entity component store. */
|
|
195
|
-
declare function getEntities(): EntityStore;
|
|
196
|
-
/** Find a player by citizenId from the database cache. */
|
|
197
|
-
declare function getPlayer(citizenId: string): PlayerRow | null;
|
|
198
|
-
/** Get all cached players. */
|
|
199
|
-
declare function getPlayers(): PlayerRow[];
|
|
200
|
-
/**
|
|
201
|
-
* Get the player entity for a citizenId.
|
|
202
|
-
* Returns the entity with lifecycle state and component access.
|
|
203
|
-
*/
|
|
204
|
-
declare function getEntity(citizenId: string): PlayerEntity | null;
|
|
205
|
-
/**
|
|
206
|
-
* Transition a player to the "spawned" state.
|
|
207
|
-
* Call after character selection (e.g. from a multichar module).
|
|
208
|
-
* Fires all onPlayerSpawned hooks.
|
|
209
|
-
*/
|
|
210
|
-
declare function spawnPlayer(citizenId: string): void;
|
|
211
|
-
/** Register a callback for when a player connects (database confirmed). */
|
|
212
|
-
declare function onPlayerConnect(cb: (player: PlayerEventContext) => void): void;
|
|
213
|
-
/** Register a callback for when a player spawns (character selected). */
|
|
214
|
-
declare function onPlayerSpawned(cb: (player: PlayerEventContext) => void): void;
|
|
215
|
-
/** Register a callback for when a player disconnects. */
|
|
216
|
-
declare function onPlayerDisconnect(cb: (player: PlayerEventContext) => void): void;
|
|
217
|
-
/**
|
|
218
|
-
* Get the database bridge for direct table and reducer access.
|
|
219
|
-
* Advanced — most modules should use the event bus and DI instead.
|
|
220
|
-
*/
|
|
221
|
-
declare function getBridge(): any;
|
|
222
|
-
/** Subscribe to database tables. Call inside onReady(). */
|
|
223
|
-
declare function subscribe(queries: string[]): Promise<void>;
|
|
224
|
-
/** Sync configuration for a table. */
|
|
225
|
-
interface SyncConfig {
|
|
226
|
-
/** Who receives updates for this table. */
|
|
227
|
-
to: "owner" | "all";
|
|
228
|
-
/** Column name for owner filtering (required when to: 'owner'). */
|
|
229
|
-
scope?: string;
|
|
230
|
-
/** Primary key column for row identity (defaults to 'id'). */
|
|
231
|
-
key?: string;
|
|
167
|
+
/** Table handle for typed database operations. */
|
|
168
|
+
interface Table<T = any> {
|
|
169
|
+
/** Find a row by primary key. */
|
|
170
|
+
find(primaryKey: any): T | null;
|
|
171
|
+
/** Get all rows in the table. */
|
|
172
|
+
all(): T[];
|
|
173
|
+
/** Insert a new row. */
|
|
174
|
+
insert(data: T): Promise<void>;
|
|
175
|
+
/** Update an existing row by primary key (partial update). */
|
|
176
|
+
update(primaryKey: any, data: Partial<T>): Promise<void>;
|
|
177
|
+
/** Delete a row by primary key. */
|
|
178
|
+
delete(primaryKey: any): Promise<void>;
|
|
232
179
|
}
|
|
233
|
-
/**
|
|
234
|
-
interface
|
|
235
|
-
/** FiveM server-side player ID. */
|
|
236
|
-
source: number;
|
|
237
|
-
/** Player's citizen ID (license identifier). */
|
|
238
|
-
citizenId: string;
|
|
239
|
-
/** Player's display name. */
|
|
180
|
+
/** Parameter hint shown in command autocomplete. */
|
|
181
|
+
interface CommandParam {
|
|
240
182
|
name: string;
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
183
|
+
help?: string;
|
|
184
|
+
}
|
|
185
|
+
/** Options for command(). */
|
|
186
|
+
interface CommandOptions {
|
|
187
|
+
description?: string;
|
|
188
|
+
ace?: string;
|
|
189
|
+
canUse?: (source: number) => boolean;
|
|
190
|
+
params?: CommandParam[];
|
|
191
|
+
}
|
|
192
|
+
/** Action error received from the server. */
|
|
193
|
+
interface ActionError {
|
|
194
|
+
action: string;
|
|
195
|
+
code: string;
|
|
196
|
+
message: string;
|
|
197
|
+
}
|
|
198
|
+
/** Describes a single table row change. */
|
|
199
|
+
interface TableChange<T = any> {
|
|
200
|
+
/** The type of change. */
|
|
201
|
+
type: "insert" | "update" | "delete";
|
|
202
|
+
/** The current row (new on insert/update, deleted row on delete). */
|
|
203
|
+
row: T;
|
|
204
|
+
/** The previous row (on update only, undefined otherwise). */
|
|
205
|
+
oldRow?: T;
|
|
249
206
|
}
|
|
250
|
-
/** Action handler function. */
|
|
251
|
-
type ActionHandler = (ctx: ActionContext, payload: any) => Promise<void> | void;
|
|
252
|
-
/** Server function handler — returns a value back to the caller. */
|
|
253
|
-
type FunctionHandler<T = any> = (ctx: ActionContext, payload: any) => Promise<T> | T;
|
|
254
207
|
/**
|
|
255
|
-
* Register
|
|
208
|
+
* Register an action handler that clients can invoke.
|
|
256
209
|
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
210
|
+
* Actions are fire-and-forget mutations — the client sends data,
|
|
211
|
+
* the server validates and mutates, state syncs back automatically.
|
|
259
212
|
*
|
|
260
213
|
* @example
|
|
261
|
-
*
|
|
262
|
-
*
|
|
214
|
+
* action('deposit', async (player, { amount }) => {
|
|
215
|
+
* const account = accounts.find(player.citizenId);
|
|
216
|
+
* accounts.update(player.citizenId, { balance: account.balance + amount });
|
|
217
|
+
* });
|
|
263
218
|
*/
|
|
264
|
-
declare function
|
|
219
|
+
declare function action(name: string, handler: (player: Player, payload: any) => Promise<void> | void): void;
|
|
265
220
|
/**
|
|
266
|
-
* Register
|
|
221
|
+
* Register a server function that clients can call and await a result.
|
|
267
222
|
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
223
|
+
* Unlike actions (fire-and-forget), functions return a value to the caller.
|
|
224
|
+
* Use for request/response patterns like data fetches or validations.
|
|
270
225
|
*
|
|
271
226
|
* @example
|
|
272
|
-
*
|
|
273
|
-
*
|
|
227
|
+
* fn('getBalance', async (player, { targetId }) => {
|
|
228
|
+
* const account = accounts.find(targetId);
|
|
229
|
+
* return { balance: account?.balance ?? 0 };
|
|
274
230
|
* });
|
|
275
231
|
*/
|
|
276
|
-
declare function
|
|
232
|
+
declare function fn<T = any>(name: string, handler: (player: Player, payload: any) => Promise<T> | T): void;
|
|
277
233
|
/**
|
|
278
|
-
* Register a
|
|
279
|
-
*
|
|
280
|
-
* Unlike actions (fire-and-forget mutations), functions return a value
|
|
281
|
-
* to the caller. Use for request/response patterns like data fetches,
|
|
282
|
-
* calculations, or validations that need a result.
|
|
234
|
+
* Register a chat command with optional autocomplete.
|
|
283
235
|
*
|
|
284
236
|
* @example
|
|
285
|
-
*
|
|
286
|
-
* const account =
|
|
287
|
-
*
|
|
237
|
+
* command('balance', (player) => {
|
|
238
|
+
* const account = accounts.find(player.citizenId);
|
|
239
|
+
* player.notify(`Balance: $${account.balance}`);
|
|
288
240
|
* });
|
|
241
|
+
*
|
|
242
|
+
* command('give', {
|
|
243
|
+
* description: 'Give money to a player',
|
|
244
|
+
* params: [{ name: 'id' }, { name: 'amount' }],
|
|
245
|
+
* }, (player, args) => { ... });
|
|
289
246
|
*/
|
|
290
|
-
declare function
|
|
247
|
+
declare function command(name: string, handlerOrOptions: CommandOptions | ((player: Player, args: string[], raw: string) => void), handler?: (player: Player, args: string[], raw: string) => void): void;
|
|
291
248
|
/**
|
|
292
|
-
*
|
|
293
|
-
*
|
|
249
|
+
* Create an error to throw from action/function handlers.
|
|
250
|
+
* The error is sent back to the client with a structured code and message.
|
|
294
251
|
*
|
|
295
252
|
* @example
|
|
296
|
-
* throw
|
|
253
|
+
* throw error('NO_ACCOUNT', 'No account found');
|
|
297
254
|
*/
|
|
298
|
-
declare
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
/** Short description shown in autocomplete. */
|
|
312
|
-
description?: string;
|
|
313
|
-
/** ACE permission required — players without it won't see the command. */
|
|
314
|
-
ace?: string;
|
|
315
|
-
/** Custom permission predicate (overrides ace check when provided). */
|
|
316
|
-
canUse?: (source: number) => boolean;
|
|
317
|
-
/** Parameter hints shown in autocomplete. */
|
|
318
|
-
params?: CommandParam[];
|
|
319
|
-
}
|
|
255
|
+
declare function error(code: string, message?: string): Error;
|
|
256
|
+
/**
|
|
257
|
+
* Get a table handle for database operations.
|
|
258
|
+
*
|
|
259
|
+
* The table name must be the full prefixed name (e.g. 'economy_accounts').
|
|
260
|
+
* For auto-generated handles with types, use the generated `db.ts` instead.
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* const accounts = table<Account>('economy_accounts');
|
|
264
|
+
* const account = accounts.find(citizenId);
|
|
265
|
+
* await accounts.update(citizenId, { balance: 500 });
|
|
266
|
+
*/
|
|
267
|
+
declare function table<T = any>(name: string): Table<T>;
|
|
320
268
|
/**
|
|
321
|
-
*
|
|
269
|
+
* React to any change in a database table.
|
|
322
270
|
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
271
|
+
* Fires on insert, update, or delete — regardless of what caused the change
|
|
272
|
+
* (action, another module, migration, Studio edit). Works on all tables
|
|
273
|
+
* including server-only tables without an `access` field.
|
|
326
274
|
*
|
|
327
275
|
* @example
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
* }, (source, args) => {
|
|
333
|
-
* const targetId = parseInt(args[0], 10);
|
|
334
|
-
* // ...
|
|
276
|
+
* onTableChange<Account>('economy_accounts', (change) => {
|
|
277
|
+
* if (change.type === 'update' && change.row.balance < 0) {
|
|
278
|
+
* accounts.update(change.row.citizenId, { frozen: true });
|
|
279
|
+
* }
|
|
335
280
|
* });
|
|
336
281
|
*/
|
|
337
|
-
declare function
|
|
282
|
+
declare function onTableChange<T = any>(table: string, handler: (change: TableChange<T>) => void): void;
|
|
283
|
+
/**
|
|
284
|
+
* Register a callback to run when Warp is fully booted.
|
|
285
|
+
* If Warp is already ready, the callback fires immediately.
|
|
286
|
+
*/
|
|
287
|
+
declare function onReady(cb: () => void): void;
|
|
288
|
+
/** Check if Warp has finished booting. */
|
|
289
|
+
declare function isReady(): boolean;
|
|
290
|
+
/** Register a service that other modules can resolve via use(). */
|
|
291
|
+
declare function provide<T>(token: string, service: T): void;
|
|
292
|
+
/** Resolve a service registered by another module. */
|
|
293
|
+
declare function use<T = unknown>(token: string): T;
|
|
294
|
+
/** Get the shared event bus instance. */
|
|
295
|
+
declare function getEvents<TMap extends Record<string, any> = Record<string, any>>(): ServerEventBus<TMap>;
|
|
296
|
+
/** Get the shared entity component store. */
|
|
297
|
+
declare function getEntities(): EntityStore;
|
|
298
|
+
/** Find a player by citizenId from the database cache. */
|
|
299
|
+
declare function getPlayer(citizenId: string): PlayerRow | null;
|
|
300
|
+
/** Get all cached players. */
|
|
301
|
+
declare function getPlayers(): PlayerRow[];
|
|
302
|
+
/** Get the player entity for a citizenId. */
|
|
303
|
+
declare function getEntity(citizenId: string): PlayerEntity | null;
|
|
304
|
+
/** Transition a player to the "spawned" state. */
|
|
305
|
+
declare function spawnPlayer(citizenId: string): void;
|
|
306
|
+
/** Register a callback for when a player connects. */
|
|
307
|
+
declare function onPlayerConnect(cb: (player: Player) => void): void;
|
|
308
|
+
/** Register a callback for when a player spawns. */
|
|
309
|
+
declare function onPlayerSpawned(cb: (player: Player) => void): void;
|
|
310
|
+
/** Register a callback for when a player disconnects. */
|
|
311
|
+
declare function onPlayerDisconnect(cb: (player: Player) => void): void;
|
|
312
|
+
/** Get the database bridge for direct table and reducer access. */
|
|
313
|
+
declare function getBridge(): any;
|
|
314
|
+
/** Subscribe to database tables. */
|
|
315
|
+
declare function subscribe(queries: string[]): Promise<void>;
|
|
338
316
|
|
|
339
|
-
export { type
|
|
317
|
+
export { type AccessMode, type ActionError, type ColumnDef, type ColumnType, type CommandOptions, type CommandParam, type EntityStore, type Player, type PlayerEntity, type PlayerRow, type PlayerState, type ServerEventBus, type Table, type TableChange, type TableDef, type WarpSchema, action, command, error, fn, getBridge, getEntities, getEntity, getEvents, getPlayer, getPlayers, isReady, onPlayerConnect, onPlayerDisconnect, onPlayerSpawned, onReady, onTableChange, provide, spawnPlayer, subscribe, table, use };
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
|
|
23
|
+
action: () => action,
|
|
24
|
+
command: () => command,
|
|
25
|
+
error: () => error,
|
|
26
|
+
fn: () => fn,
|
|
24
27
|
getBridge: () => getBridge,
|
|
25
28
|
getEntities: () => getEntities,
|
|
26
29
|
getEntity: () => getEntity,
|
|
@@ -32,19 +35,39 @@ __export(index_exports, {
|
|
|
32
35
|
onPlayerDisconnect: () => onPlayerDisconnect,
|
|
33
36
|
onPlayerSpawned: () => onPlayerSpawned,
|
|
34
37
|
onReady: () => onReady,
|
|
38
|
+
onTableChange: () => onTableChange,
|
|
35
39
|
provide: () => provide,
|
|
36
|
-
registerAction: () => registerAction,
|
|
37
|
-
registerCommand: () => registerCommand,
|
|
38
|
-
registerFunction: () => registerFunction,
|
|
39
|
-
registerSync: () => registerSync,
|
|
40
40
|
spawnPlayer: () => spawnPlayer,
|
|
41
41
|
subscribe: () => subscribe,
|
|
42
|
+
table: () => table,
|
|
42
43
|
use: () => use
|
|
43
44
|
});
|
|
44
45
|
module.exports = __toCommonJS(index_exports);
|
|
45
46
|
function warp() {
|
|
46
47
|
return globalThis.exports["warp"];
|
|
47
48
|
}
|
|
49
|
+
function action(name, handler) {
|
|
50
|
+
warp().action(name, handler);
|
|
51
|
+
}
|
|
52
|
+
function fn(name, handler) {
|
|
53
|
+
warp().fn(name, handler);
|
|
54
|
+
}
|
|
55
|
+
function command(name, handlerOrOptions, handler) {
|
|
56
|
+
if (typeof handlerOrOptions === "function") {
|
|
57
|
+
warp().command(name, {}, handlerOrOptions);
|
|
58
|
+
} else {
|
|
59
|
+
warp().command(name, handlerOrOptions, handler);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function error(code, message) {
|
|
63
|
+
return warp().error(code, message);
|
|
64
|
+
}
|
|
65
|
+
function table(name) {
|
|
66
|
+
return warp().table(name);
|
|
67
|
+
}
|
|
68
|
+
function onTableChange(table2, handler) {
|
|
69
|
+
warp().onTableChange(table2, handler);
|
|
70
|
+
}
|
|
48
71
|
function onReady(cb) {
|
|
49
72
|
warp().onReady(cb);
|
|
50
73
|
}
|
|
@@ -90,28 +113,12 @@ function getBridge() {
|
|
|
90
113
|
function subscribe(queries) {
|
|
91
114
|
return warp().subscribe(queries);
|
|
92
115
|
}
|
|
93
|
-
function registerSync(table, config) {
|
|
94
|
-
warp().registerSync(table, config);
|
|
95
|
-
}
|
|
96
|
-
function registerAction(name, handler) {
|
|
97
|
-
warp().registerAction(name, handler);
|
|
98
|
-
}
|
|
99
|
-
function registerFunction(name, handler) {
|
|
100
|
-
warp().registerFunction(name, handler);
|
|
101
|
-
}
|
|
102
|
-
var WarpError = class extends Error {
|
|
103
|
-
constructor(code, message) {
|
|
104
|
-
super(message ?? code);
|
|
105
|
-
this.code = code;
|
|
106
|
-
this.name = "WarpError";
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
function registerCommand(name, options, handler) {
|
|
110
|
-
warp().registerCommand(name, options, handler);
|
|
111
|
-
}
|
|
112
116
|
// Annotate the CommonJS export names for ESM import in node:
|
|
113
117
|
0 && (module.exports = {
|
|
114
|
-
|
|
118
|
+
action,
|
|
119
|
+
command,
|
|
120
|
+
error,
|
|
121
|
+
fn,
|
|
115
122
|
getBridge,
|
|
116
123
|
getEntities,
|
|
117
124
|
getEntity,
|
|
@@ -123,12 +130,10 @@ function registerCommand(name, options, handler) {
|
|
|
123
130
|
onPlayerDisconnect,
|
|
124
131
|
onPlayerSpawned,
|
|
125
132
|
onReady,
|
|
133
|
+
onTableChange,
|
|
126
134
|
provide,
|
|
127
|
-
registerAction,
|
|
128
|
-
registerCommand,
|
|
129
|
-
registerFunction,
|
|
130
|
-
registerSync,
|
|
131
135
|
spawnPlayer,
|
|
132
136
|
subscribe,
|
|
137
|
+
table,
|
|
133
138
|
use
|
|
134
139
|
});
|