@tsukilabs/nil-ffi 0.7.3 → 0.7.5
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/README.md +1 -1
- package/dist/def.d.ts +8 -0
- package/dist/index.d.ts +5 -20
- package/dist/index.js +21 -1
- package/dist/queue.d.ts +1 -1
- package/package.json +6 -4
package/README.md
CHANGED
package/dist/def.d.ts
CHANGED
|
@@ -72,6 +72,14 @@ export declare const definitions: {
|
|
|
72
72
|
readonly arguments: readonly [ffi.types.UINT_32];
|
|
73
73
|
readonly return: ffi.types.VOID;
|
|
74
74
|
};
|
|
75
|
+
readonly nil_runtime_num_alive_tasks: {
|
|
76
|
+
readonly arguments: readonly [ffi.types.UINT_32];
|
|
77
|
+
readonly return: ffi.types.VOID;
|
|
78
|
+
};
|
|
79
|
+
readonly nil_runtime_num_workers: {
|
|
80
|
+
readonly arguments: readonly [ffi.types.UINT_32];
|
|
81
|
+
readonly return: ffi.types.VOID;
|
|
82
|
+
};
|
|
75
83
|
readonly nil_add_academy_recruit_order: {
|
|
76
84
|
readonly arguments: readonly [ffi.types.UINT_32, ffi.types.POINTER];
|
|
77
85
|
readonly return: ffi.types.VOID;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,29 +1,12 @@
|
|
|
1
1
|
import { definitions } from './def';
|
|
2
2
|
import { Option } from '@tb-dev/utils';
|
|
3
3
|
import { QueueOptions } from './queue';
|
|
4
|
-
import { AuthorizeRequest, GetPlayerIdsRequest, GetPlayerIdsResponse, GetPlayerRequest, GetPlayerStatusRequest, GetRemoteWorldsResponse,
|
|
4
|
+
import { AuthorizeRequest, ClientOptions, GetPlayerIdsRequest, GetPlayerIdsResponse, GetPlayerRequest, GetPlayerStatusRequest, GetRemoteWorldsResponse, LocalServer, PlayerExistsRequest, ServerAddr, SetPlayerStatusRequest, SpawnPlayerRequest, ValidateTokenRequest, ValidateTokenResponse, WorldOptions } from '@tsukilabs/nil-bindings';
|
|
5
5
|
import * as ffi from "node:ffi";
|
|
6
6
|
export * from './def';
|
|
7
7
|
export * from './error';
|
|
8
8
|
export type Handle = ffi.DynamicLibraryResult<typeof definitions>;
|
|
9
|
-
type
|
|
10
|
-
world: WorldId;
|
|
11
|
-
addr: string;
|
|
12
|
-
};
|
|
13
|
-
type ServerAddr = {
|
|
14
|
-
kind: "remote";
|
|
15
|
-
} | {
|
|
16
|
-
kind: "local";
|
|
17
|
-
addr: string;
|
|
18
|
-
};
|
|
19
|
-
type ffi_UpdateClient = {
|
|
20
|
-
server: ServerAddr;
|
|
21
|
-
world_id?: WorldId | null;
|
|
22
|
-
world_password?: Password | null;
|
|
23
|
-
player_id?: PlayerId | null;
|
|
24
|
-
player_password?: Password | null;
|
|
25
|
-
authorization_token?: Token | null;
|
|
26
|
-
};
|
|
9
|
+
export type { ErrorHandler } from './queue';
|
|
27
10
|
export declare const VERSION: string;
|
|
28
11
|
export declare const USER_AGENT: string;
|
|
29
12
|
export declare class Nil implements Disposable {
|
|
@@ -48,6 +31,8 @@ export declare class Nil implements Disposable {
|
|
|
48
31
|
getRemoteWorldLimit(): Promise<number>;
|
|
49
32
|
getRemoteWorldLimitPerUser(): Promise<number>;
|
|
50
33
|
getRemoteWorlds(): Promise<GetRemoteWorldsResponse>;
|
|
34
|
+
getRuntimeNumAliveTasks(): Promise<number>;
|
|
35
|
+
getRuntimeNumWorkers(): Promise<number>;
|
|
51
36
|
getServerAddr(): Promise<ServerAddr>;
|
|
52
37
|
getServerKind(): Promise<import('@tsukilabs/nil-bindings').ServerKind>;
|
|
53
38
|
getUserAgent(): Promise<string>;
|
|
@@ -64,7 +49,7 @@ export declare class Nil implements Disposable {
|
|
|
64
49
|
startServerWithSavedata(path: string): Promise<LocalServer>;
|
|
65
50
|
stopClient(): Promise<import('@tb-dev/utils').nil>;
|
|
66
51
|
stopServer(): Promise<import('@tb-dev/utils').nil>;
|
|
67
|
-
updateClient(options:
|
|
52
|
+
updateClient(options: ClientOptions): Promise<import('@tb-dev/utils').nil>;
|
|
68
53
|
validateToken(req: ValidateTokenRequest): Promise<ValidateTokenResponse>;
|
|
69
54
|
}
|
|
70
55
|
export interface NilOptions {
|
package/dist/index.js
CHANGED
|
@@ -82,6 +82,14 @@ var definitions = {
|
|
|
82
82
|
arguments: [ffi.types.UINT_32],
|
|
83
83
|
return: ffi.types.VOID
|
|
84
84
|
},
|
|
85
|
+
nil_runtime_num_alive_tasks: {
|
|
86
|
+
arguments: [ffi.types.UINT_32],
|
|
87
|
+
return: ffi.types.VOID
|
|
88
|
+
},
|
|
89
|
+
nil_runtime_num_workers: {
|
|
90
|
+
arguments: [ffi.types.UINT_32],
|
|
91
|
+
return: ffi.types.VOID
|
|
92
|
+
},
|
|
85
93
|
nil_add_academy_recruit_order: {
|
|
86
94
|
arguments: [ffi.types.UINT_32, ffi.types.POINTER],
|
|
87
95
|
return: ffi.types.VOID
|
|
@@ -744,7 +752,7 @@ var Queue = class Queue {
|
|
|
744
752
|
};
|
|
745
753
|
//#endregion
|
|
746
754
|
//#region package.json
|
|
747
|
-
var version = "0.7.
|
|
755
|
+
var version = "0.7.5";
|
|
748
756
|
//#endregion
|
|
749
757
|
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/decorate.js
|
|
750
758
|
function __decorate(decorators, target, key, desc) {
|
|
@@ -844,6 +852,16 @@ var Nil = class Nil {
|
|
|
844
852
|
this.functions.nil_get_remote_worlds(requestId);
|
|
845
853
|
});
|
|
846
854
|
}
|
|
855
|
+
async getRuntimeNumAliveTasks() {
|
|
856
|
+
return this.queue.request((requestId) => {
|
|
857
|
+
this.functions.nil_runtime_num_alive_tasks(requestId);
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
async getRuntimeNumWorkers() {
|
|
861
|
+
return this.queue.request((requestId) => {
|
|
862
|
+
this.functions.nil_runtime_num_workers(requestId);
|
|
863
|
+
});
|
|
864
|
+
}
|
|
847
865
|
async getServerAddr() {
|
|
848
866
|
return this.queue.request((requestId) => {
|
|
849
867
|
this.functions.nil_server_addr(requestId);
|
|
@@ -944,6 +962,8 @@ __decorate([ThrowIfClosed], Nil.prototype, "getPlayerStatus", null);
|
|
|
944
962
|
__decorate([ThrowIfClosed], Nil.prototype, "getRemoteWorldLimit", null);
|
|
945
963
|
__decorate([ThrowIfClosed], Nil.prototype, "getRemoteWorldLimitPerUser", null);
|
|
946
964
|
__decorate([ThrowIfClosed], Nil.prototype, "getRemoteWorlds", null);
|
|
965
|
+
__decorate([ThrowIfClosed], Nil.prototype, "getRuntimeNumAliveTasks", null);
|
|
966
|
+
__decorate([ThrowIfClosed], Nil.prototype, "getRuntimeNumWorkers", null);
|
|
947
967
|
__decorate([ThrowIfClosed], Nil.prototype, "getServerAddr", null);
|
|
948
968
|
__decorate([ThrowIfClosed], Nil.prototype, "getServerKind", null);
|
|
949
969
|
__decorate([ThrowIfClosed], Nil.prototype, "getUserAgent", null);
|
package/dist/queue.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare class Queue implements Disposable {
|
|
|
22
22
|
private onResponse;
|
|
23
23
|
}
|
|
24
24
|
type RequestFn = (requestId: ffi_RequestId) => void;
|
|
25
|
-
type ErrorHandler = (error: unknown) => void;
|
|
25
|
+
export type ErrorHandler = (error: unknown) => void;
|
|
26
26
|
export interface QueueOptions {
|
|
27
27
|
onError?: Option<ErrorHandler>;
|
|
28
28
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsukilabs/nil-ffi",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
|
+
"description": "FFI bindings for Call of Nil",
|
|
4
5
|
"type": "module",
|
|
5
|
-
"packageManager": "pnpm@11.
|
|
6
|
+
"packageManager": "pnpm@11.18.0",
|
|
6
7
|
"license": "AGPL-3.0-only",
|
|
7
8
|
"private": false,
|
|
8
9
|
"homepage": "https://nil.dev.br",
|
|
@@ -25,11 +26,12 @@
|
|
|
25
26
|
"keywords": ["call-of-nil", "ffi"],
|
|
26
27
|
"scripts": {
|
|
27
28
|
"build": "vite build",
|
|
28
|
-
"type-check": "tsc --noEmit"
|
|
29
|
+
"type-check": "tsc --noEmit",
|
|
30
|
+
"typedoc": "typedoc --plugin typedoc-plugin-mdn-links"
|
|
29
31
|
},
|
|
30
32
|
"dependencies": {
|
|
31
33
|
"@tb-dev/utils": "^8.1.1",
|
|
32
|
-
"@tsukilabs/nil-bindings": "^0.7.
|
|
34
|
+
"@tsukilabs/nil-bindings": "^0.7.4",
|
|
33
35
|
"es-toolkit": "^1.50.0"
|
|
34
36
|
},
|
|
35
37
|
"files": ["dist"],
|