@warpfx/server 0.3.1 → 0.3.2
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 +31 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Schema types for Warp
|
|
2
|
+
* Schema types for Warp resource developers.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Resources define their database tables in a `warp.schema.json` file
|
|
5
5
|
* placed at the root of their FiveM resource. These types document
|
|
6
6
|
* the expected format.
|
|
7
7
|
*
|
|
@@ -81,12 +81,35 @@ interface TableDef {
|
|
|
81
81
|
*/
|
|
82
82
|
access?: AccessMode;
|
|
83
83
|
}
|
|
84
|
+
/** Parameter/field definition for actions and functions. */
|
|
85
|
+
interface ParamDef {
|
|
86
|
+
/** The data type of this parameter. */
|
|
87
|
+
type: ColumnType;
|
|
88
|
+
/** If true, this parameter is optional in the payload. */
|
|
89
|
+
optional?: boolean;
|
|
90
|
+
}
|
|
91
|
+
/** Action definition — declares the payload shape for a client-to-server action. */
|
|
92
|
+
interface ActionDef {
|
|
93
|
+
/** Parameters the action accepts from the client. */
|
|
94
|
+
params: Record<string, ParamDef>;
|
|
95
|
+
}
|
|
96
|
+
/** Function definition — declares request params and return shape for a client-to-server function. */
|
|
97
|
+
interface FunctionDef {
|
|
98
|
+
/** Parameters the function accepts from the client. */
|
|
99
|
+
params: Record<string, ParamDef>;
|
|
100
|
+
/** Fields the function returns to the client. */
|
|
101
|
+
returns: Record<string, ParamDef>;
|
|
102
|
+
}
|
|
84
103
|
/** The full warp.schema.json format. */
|
|
85
104
|
interface WarpSchema {
|
|
86
|
-
/** Unique
|
|
105
|
+
/** Unique resource name (used as table prefix in the database). */
|
|
87
106
|
module: string;
|
|
88
107
|
/** Table definitions keyed by table name. */
|
|
89
108
|
tables: Record<string, TableDef>;
|
|
109
|
+
/** Action definitions keyed by action name. */
|
|
110
|
+
actions?: Record<string, ActionDef>;
|
|
111
|
+
/** Function definitions keyed by function name. */
|
|
112
|
+
functions?: Record<string, FunctionDef>;
|
|
90
113
|
/** Schema version number (increment when making breaking changes). */
|
|
91
114
|
version?: number;
|
|
92
115
|
/** Acknowledged breaking changes (required in production for destructive schema changes). */
|
|
@@ -94,7 +117,7 @@ interface WarpSchema {
|
|
|
94
117
|
}
|
|
95
118
|
|
|
96
119
|
/**
|
|
97
|
-
* @warpfx/server — Server-side SDK for Warp
|
|
120
|
+
* @warpfx/server — Server-side SDK for Warp resource development.
|
|
98
121
|
*
|
|
99
122
|
* Clean, minimal API for building FiveM server features with Warp.
|
|
100
123
|
* All calls delegate to the Warp core via FiveM resource exports.
|
|
@@ -269,7 +292,7 @@ declare function table<T = any>(name: string): Table<T>;
|
|
|
269
292
|
* React to any change in a database table.
|
|
270
293
|
*
|
|
271
294
|
* Fires on insert, update, or delete — regardless of what caused the change
|
|
272
|
-
* (action, another
|
|
295
|
+
* (action, another resource, migration, Studio edit). Works on all tables
|
|
273
296
|
* including server-only tables without an `access` field.
|
|
274
297
|
*
|
|
275
298
|
* @example
|
|
@@ -287,9 +310,9 @@ declare function onTableChange<T = any>(table: string, handler: (change: TableCh
|
|
|
287
310
|
declare function onReady(cb: () => void): void;
|
|
288
311
|
/** Check if Warp has finished booting. */
|
|
289
312
|
declare function isReady(): boolean;
|
|
290
|
-
/** Register a service that other
|
|
313
|
+
/** Register a service that other resources can resolve via use(). */
|
|
291
314
|
declare function provide<T>(token: string, service: T): void;
|
|
292
|
-
/** Resolve a service registered by another
|
|
315
|
+
/** Resolve a service registered by another resource. */
|
|
293
316
|
declare function use<T = unknown>(token: string): T;
|
|
294
317
|
/** Get the shared event bus instance. */
|
|
295
318
|
declare function getEvents<TMap extends Record<string, any> = Record<string, any>>(): ServerEventBus<TMap>;
|
|
@@ -314,4 +337,4 @@ declare function getBridge(): any;
|
|
|
314
337
|
/** Subscribe to database tables. */
|
|
315
338
|
declare function subscribe(queries: string[]): Promise<void>;
|
|
316
339
|
|
|
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 };
|
|
340
|
+
export { type AccessMode, type ActionDef, type ActionError, type ColumnDef, type ColumnType, type CommandOptions, type CommandParam, type EntityStore, type FunctionDef, type ParamDef, 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 };
|