Skip to content

Commit cdea5b6

Browse files
MesteeryBethGriggs
authored andcommitted
typings: add more bindings typings
PR-URL: #40415 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent de5c5c8 commit cdea5b6

4 files changed

Lines changed: 177 additions & 26 deletions

File tree

‎tsconfig.json‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
2-
"include": ["lib","doc"],
3-
"exclude": ["src","tools","out"],
2+
"include": ["lib","doc"],
3+
"exclude": ["src","tools","out"],
44
"files": [
5+
"./typings/internalBinding/async_wrap.d.ts",
6+
"./typings/internalBinding/blob.d.ts",
57
"./typings/internalBinding/config.d.ts",
68
"./typings/internalBinding/constants.d.ts",
79
"./typings/internalBinding/fs.d.ts",
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
import{owner_symbol}from'./symbols';
2+
3+
declarenamespaceInternalAsyncWrapBinding{
4+
interfaceResource{
5+
[owner_symbol]?: PublicResource;
6+
}
7+
typePublicResource=object;
8+
9+
typeEmitHook=(asyncId: number)=>void;
10+
11+
typePromiseHook=(promise: Promise<unknown>,parent: Promise<unknown>)=>void;
12+
13+
interfaceProviders{
14+
NONE: 0;
15+
DIRHANDLE: 1;
16+
DNSCHANNEL: 2;
17+
ELDHISTOGRAM: 3;
18+
FILEHANDLE: 4;
19+
FILEHANDLECLOSEREQ: 5;
20+
FIXEDSIZEBLOBCOPY: 6;
21+
FSEVENTWRAP: 7;
22+
FSREQCALLBACK: 8;
23+
FSREQPROMISE: 9;
24+
GETADDRINFOREQWRAP: 10;
25+
GETNAMEINFOREQWRAP: 11;
26+
HEAPSNAPSHOT: 12;
27+
HTTP2SESSION: 13;
28+
HTTP2STREAM: 14;
29+
HTTP2PING: 15;
30+
HTTP2SETTINGS: 16;
31+
HTTPINCOMINGMESSAGE: 17;
32+
HTTPCLIENTREQUEST: 18;
33+
JSSTREAM: 19;
34+
JSUDPWRAP: 20;
35+
MESSAGEPORT: 21;
36+
PIPECONNECTWRAP: 22;
37+
PIPESERVERWRAP: 23;
38+
PIPEWRAP: 24;
39+
PROCESSWRAP: 25;
40+
PROMISE: 26;
41+
QUERYWRAP: 27;
42+
SHUTDOWNWRAP: 28;
43+
SIGNALWRAP: 29;
44+
STATWATCHER: 30;
45+
STREAMPIPE: 31;
46+
TCPCONNECTWRAP: 32;
47+
TCPSERVERWRAP: 33;
48+
TCPWRAP: 34;
49+
TTYWRAP: 35;
50+
UDPSENDWRAP: 36;
51+
UDPWRAP: 37;
52+
SIGINTWATCHDOG: 38;
53+
WORKER: 39;
54+
WORKERHEAPSNAPSHOT: 40;
55+
WRITEWRAP: 41;
56+
ZLIB: 42;
57+
CHECKPRIMEREQUEST: 43;
58+
PBKDF2REQUEST: 44;
59+
KEYPAIRGENREQUEST: 45;
60+
KEYGENREQUEST: 46;
61+
KEYEXPORTREQUEST: 47;
62+
CIPHERREQUEST: 48;
63+
DERIVEBITSREQUEST: 49;
64+
HASHREQUEST: 50;
65+
RANDOMBYTESREQUEST: 51;
66+
RANDOMPRIMEREQUEST: 52;
67+
SCRYPTREQUEST: 53;
68+
SIGNREQUEST: 54;
69+
TLSWRAP: 55;
70+
VERIFYREQUEST: 56;
71+
INSPECTORJSBINDING: 57;
72+
}
73+
}
74+
75+
declarefunctionInternalBinding(binding: 'async_wrap'): {
76+
setupHooks(): {
77+
init: (
78+
asyncId: number,
79+
type: keyofInternalAsyncWrapBinding.Providers,
80+
triggerAsyncId: number,
81+
resource: InternalAsyncWrapBinding.Resource,
82+
)=>void;
83+
before: InternalAsyncWrapBinding.EmitHook;
84+
after: InternalAsyncWrapBinding.EmitHook;
85+
destroy: InternalAsyncWrapBinding.EmitHook;
86+
promise_resolve: InternalAsyncWrapBinding.EmitHook;
87+
};
88+
setCallbackTrampoline(
89+
callback: (
90+
asyncId: number,
91+
resource: InternalAsyncWrapBinding.Resource,
92+
cb: (
93+
cb: (...args: any[])=>boolean|undefined,
94+
...args: any[]
95+
)=>boolean|undefined,
96+
...args: any[]
97+
)=>boolean|undefined
98+
): void;
99+
pushAsyncContext(asyncId: number,triggerAsyncId: number): void;
100+
popAsyncContext(asyncId: number): boolean;
101+
executionAsyncResource(index: number): InternalAsyncWrapBinding.PublicResource|null;
102+
clearAsyncIdStack(): void;
103+
queueDestroyAsyncId(asyncId: number): void;
104+
setPromiseHooks(
105+
initHook: ((promise: Promise<unknown>,parent?: Promise<unknown>)=>void)|undefined,
106+
promiseBeforeHook: InternalAsyncWrapBinding.PromiseHook|undefined,
107+
promiseAfterHook: InternalAsyncWrapBinding.PromiseHook|undefined,
108+
promiseResolveHook: InternalAsyncWrapBinding.PromiseHook|undefined
109+
): void;
110+
registerDestroyHook(promise: Promise<unknown>,asyncId: number,destroyed: {destroyed: boolean}): void;
111+
async_hook_fields: Uint32Array;
112+
async_id_fields: Float64Array;
113+
async_ids_stack: Float64Array;
114+
execution_async_resources: InternalAsyncWrapBinding.Resource[];
115+
constants: {
116+
kInit: 0;
117+
kBefore: 1;
118+
kAfter: 2;
119+
kDestroy: 3;
120+
kPromiseResolve: 4;
121+
kTotals: 5;
122+
kCheck: 6;
123+
kStackLength: 7;
124+
kUsesExecutionAsyncResource: 8;
125+
126+
kExecutionAsyncId: 0;
127+
kTriggerAsyncId: 1;
128+
kAsyncIdCounter: 2;
129+
kDefaultTriggerAsyncId: 3;
130+
};
131+
Providers: InternalAsyncWrapBinding.Providers;
132+
};

‎typings/internalBinding/blob.d.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
declarenamespaceInternalBlobBinding{
2+
interfaceBlobHandle{
3+
slice(start: number,end: number): BlobHandle;
4+
}
5+
6+
classFixedSizeBlobCopyJob{
7+
constructor(handle: BlobHandle);
8+
run(): ArrayBuffer|undefined;
9+
ondone: (err: unknown,res?: ArrayBuffer)=>void;
10+
}
11+
}
12+
13+
declarefunctionInternalBinding(binding: 'blob'): {
14+
createBlob(sources: Array<Uint8Array|InternalBlobBinding.BlobHandle>,length: number): InternalBlobBinding.BlobHandle;
15+
FixedSizeBlobCopyJob: typeofInternalBlobBinding.FixedSizeBlobCopyJob;
16+
getDataObject(id: string): [handle: InternalBlobBinding.BlobHandle|undefined,length: number,type: string]|undefined;
17+
storeDataObject(id: string,handle: InternalBlobBinding.BlobHandle,size: number,type: string): void;
18+
revokeDataObject(id: string): void;
19+
};
Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
1-
declarenamespaceInternalSymbolsBinding{
2-
constasync_id_symbol: unique symbol;
3-
consthandle_onclose_symbol: unique symbol;
4-
constno_message_symbol: unique symbol;
5-
constmessaging_deserialize_symbol: unique symbol;
6-
constmessaging_transfer_symbol: unique symbol;
7-
constmessaging_clone_symbol: unique symbol;
8-
constmessaging_transfer_list_symbol: unique symbol;
9-
constoninit_symbol: unique symbol;
10-
constowner_symbol: unique symbol;
11-
constonpskexchange_symbol: unique symbol;
12-
consttrigger_async_id_symbol: unique symbol;
13-
}
1+
exportconstasync_id_symbol: unique symbol;
2+
exportconsthandle_onclose_symbol: unique symbol;
3+
exportconstno_message_symbol: unique symbol;
4+
exportconstmessaging_deserialize_symbol: unique symbol;
5+
exportconstmessaging_transfer_symbol: unique symbol;
6+
exportconstmessaging_clone_symbol: unique symbol;
7+
exportconstmessaging_transfer_list_symbol: unique symbol;
8+
exportconstoninit_symbol: unique symbol;
9+
exportconstowner_symbol: unique symbol;
10+
exportconstonpskexchange_symbol: unique symbol;
11+
exportconsttrigger_async_id_symbol: unique symbol;
1412

1513
declarefunctionInternalBinding(binding: 'symbols'): {
16-
async_id_symbol: typeofInternalSymbolsBinding.async_id_symbol;
17-
handle_onclose_symbol: typeofInternalSymbolsBinding.handle_onclose_symbol;
18-
no_message_symbol: typeofInternalSymbolsBinding.no_message_symbol;
19-
messaging_deserialize_symbol: typeofInternalSymbolsBinding.messaging_deserialize_symbol;
20-
messaging_transfer_symbol: typeofInternalSymbolsBinding.messaging_transfer_symbol;
21-
messaging_clone_symbol: typeofInternalSymbolsBinding.messaging_clone_symbol;
22-
messaging_transfer_list_symbol: typeofInternalSymbolsBinding.messaging_transfer_list_symbol;
23-
oninit_symbol: typeofInternalSymbolsBinding.oninit_symbol;
24-
owner_symbol: typeofInternalSymbolsBinding.owner_symbol;
25-
onpskexchange_symbol: typeofInternalSymbolsBinding.onpskexchange_symbol;
26-
trigger_async_id_symbol: typeofInternalSymbolsBinding.trigger_async_id_symbol;
14+
async_id_symbol: typeofasync_id_symbol;
15+
handle_onclose_symbol: typeofhandle_onclose_symbol;
16+
no_message_symbol: typeofno_message_symbol;
17+
messaging_deserialize_symbol: typeofmessaging_deserialize_symbol;
18+
messaging_transfer_symbol: typeofmessaging_transfer_symbol;
19+
messaging_clone_symbol: typeofmessaging_clone_symbol;
20+
messaging_transfer_list_symbol: typeofmessaging_transfer_list_symbol;
21+
oninit_symbol: typeofoninit_symbol;
22+
owner_symbol: typeofowner_symbol;
23+
onpskexchange_symbol: typeofonpskexchange_symbol;
24+
trigger_async_id_symbol: typeoftrigger_async_id_symbol;
2725
};

0 commit comments

Comments
 (0)