@stryke/capnp 0.10.0 → 0.10.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/bin/capnpc.cjs +62 -30
- package/bin/capnpc.js +62 -30
- package/dist/chunk-3IOIINHW.js +895 -0
- package/dist/chunk-3ZOLKZQQ.cjs +895 -0
- package/dist/chunk-55455L4M.cjs +4103 -0
- package/dist/chunk-5VHN3KGS.js +3305 -0
- package/dist/chunk-CCU32X36.js +15 -0
- package/dist/chunk-GWW6WBAL.js +4103 -0
- package/dist/chunk-IBMXNAOT.cjs +4877 -0
- package/dist/chunk-KXWOF6H4.cjs +3305 -0
- package/dist/chunk-N2KNXTXN.js +4877 -0
- package/dist/chunk-R2JXWA7Q.cjs +15 -0
- package/dist/compile.cjs +7 -72
- package/dist/compile.d.cts +3 -3
- package/dist/compile.d.ts +3 -3
- package/dist/compile.js +6 -71
- package/dist/helpers.cjs +4 -49
- package/dist/helpers.d.cts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/helpers.js +3 -48
- package/dist/index.cjs +138 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +138 -4
- package/dist/rpc.cjs +6 -117
- package/dist/rpc.js +5 -116
- package/dist/types.cjs +3 -8
- package/dist/types.d.cts +13 -4
- package/dist/types.d.ts +13 -4
- package/dist/types.js +3 -8
- package/dts/index.d.cts +14 -5
- package/dts/index.d.ts +14 -5
- package/package.json +4 -4
- package/schemas/persistent.cjs +20 -20
- package/schemas/persistent.js +1 -1
- package/schemas/rpc-twoparty.cjs +32 -32
- package/schemas/rpc-twoparty.js +1 -1
- package/schemas/rpc.cjs +495 -495
- package/schemas/rpc.js +1 -1
- package/schemas/schema.cjs +675 -675
- package/schemas/schema.js +1 -1
- /package/schemas/{chunk-ZGPCLBI4.cjs → chunk-BM2HWFSD.cjs} +0 -0
- /package/schemas/{chunk-3CJYH45H.js → chunk-TAKPBFYZ.js} +0 -0
package/dist/rpc.cjs
CHANGED
|
@@ -1,121 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
|
|
4
|
-
var _capnpes = require('capnp-es');
|
|
5
|
-
var _nodeworker_threads = require('node:worker_threads');
|
|
6
|
-
class MessageChannelTransport extends _capnpes.DeferredTransport {
|
|
7
|
-
static {
|
|
8
|
-
_chunkUSNT2KNTcjs.__name.call(void 0, this, "MessageChannelTransport");
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
constructor(port) {
|
|
12
|
-
super(), this.port = port, this.close = () => {
|
|
13
|
-
this.port.off("message", this.resolve);
|
|
14
|
-
this.port.off("messageerror", this.reject);
|
|
15
|
-
this.port.off("close", this.close);
|
|
16
|
-
this.port.close();
|
|
17
|
-
super.close();
|
|
18
|
-
};
|
|
19
|
-
this.port.on("message", this.resolve);
|
|
20
|
-
this.port.on("messageerror", this.reject);
|
|
21
|
-
this.port.on("close", this.close);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
sendMessage(msg) {
|
|
25
|
-
const m = new (0, _capnpes.Message)();
|
|
26
|
-
m.setRoot(msg);
|
|
27
|
-
const buf = m.toArrayBuffer();
|
|
28
|
-
this.port.postMessage(buf, [
|
|
29
|
-
buf
|
|
30
|
-
]);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
class CapnpRPC {constructor() { CapnpRPC.prototype.__init.call(this);CapnpRPC.prototype.__init2.call(this);CapnpRPC.prototype.__init3.call(this); }
|
|
34
|
-
static {
|
|
35
|
-
_chunkUSNT2KNTcjs.__name.call(void 0, this, "CapnpRPC");
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* A queue for deferred connections that are waiting to be accepted.
|
|
39
|
-
*
|
|
40
|
-
* @remarks
|
|
41
|
-
* This is used to manage incoming connections when the accept method is called.
|
|
42
|
-
*/
|
|
43
|
-
__init() {this.acceptQueue = new Array()}
|
|
44
|
-
/**
|
|
45
|
-
* A map of connections by their ID.
|
|
46
|
-
*
|
|
47
|
-
* @remarks
|
|
48
|
-
* This is used to manage multiple connections and allows for easy retrieval by ID.
|
|
49
|
-
*/
|
|
50
|
-
__init2() {this.connections = {}}
|
|
51
|
-
/**
|
|
52
|
-
* A queue for connections that are waiting to be accepted.
|
|
53
|
-
*
|
|
54
|
-
* @remarks
|
|
55
|
-
* This is used to manage incoming connections when the accept method is called.
|
|
56
|
-
*/
|
|
57
|
-
__init3() {this.connectQueue = new Array()}
|
|
58
|
-
/**
|
|
59
|
-
* Creates a new {@link Conn} instance.
|
|
60
|
-
*
|
|
61
|
-
* @remarks
|
|
62
|
-
* This class is used to manage connections and accept incoming connections using the {@link MessageChannel} API.
|
|
63
|
-
*/
|
|
64
|
-
connect(id = 0) {
|
|
65
|
-
if (this.connections[id] !== void 0) {
|
|
66
|
-
return this.connections[id];
|
|
67
|
-
}
|
|
68
|
-
const ch = new (0, _nodeworker_threads.MessageChannel)();
|
|
69
|
-
const conn = new (0, _capnpes.Conn)(new MessageChannelTransport(ch.port1));
|
|
70
|
-
const accept = this.acceptQueue.pop();
|
|
71
|
-
this.connections[id] = conn;
|
|
72
|
-
if (accept === void 0) {
|
|
73
|
-
this.connectQueue.push(ch.port2);
|
|
74
|
-
} else {
|
|
75
|
-
accept.resolve(new (0, _capnpes.Conn)(new MessageChannelTransport(ch.port2)));
|
|
76
|
-
}
|
|
77
|
-
return conn;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Accepts a connection from the connect queue.
|
|
81
|
-
*
|
|
82
|
-
* @returns A promise that resolves to a Conn instance when a connection is accepted.
|
|
83
|
-
* @throws If no connections are available in the connect queue.
|
|
84
|
-
*/
|
|
85
|
-
async accept() {
|
|
86
|
-
const port2 = this.connectQueue.pop();
|
|
87
|
-
if (port2 !== void 0) {
|
|
88
|
-
return Promise.resolve(new (0, _capnpes.Conn)(new MessageChannelTransport(port2)));
|
|
89
|
-
}
|
|
90
|
-
const deferred = new (0, _capnpes.Deferred)();
|
|
91
|
-
this.acceptQueue.push(deferred);
|
|
92
|
-
return deferred.promise;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Closes all connections and clears the queues.
|
|
96
|
-
*
|
|
97
|
-
* @remarks
|
|
98
|
-
* This method will reject all pending accept promises and close all
|
|
99
|
-
* connections in the connect queue.
|
|
100
|
-
*/
|
|
101
|
-
close() {
|
|
102
|
-
let i = this.acceptQueue.length;
|
|
103
|
-
while (--i >= 0) {
|
|
104
|
-
_optionalChain([this, 'access', _ => _.acceptQueue, 'access', _2 => _2[i], 'optionalAccess', _3 => _3.reject, 'call', _4 => _4()]);
|
|
105
|
-
}
|
|
106
|
-
i = this.connectQueue.length;
|
|
107
|
-
while (--i >= 0) {
|
|
108
|
-
this.connectQueue[i].close();
|
|
109
|
-
}
|
|
110
|
-
for (const id in this.connections) {
|
|
111
|
-
_optionalChain([this, 'access', _5 => _5.connections, 'access', _6 => _6[id], 'optionalAccess', _7 => _7.shutdown, 'call', _8 => _8()]);
|
|
112
|
-
}
|
|
113
|
-
this.acceptQueue.length = 0;
|
|
114
|
-
this.connectQueue.length = 0;
|
|
115
|
-
this.connections = {};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
3
|
|
|
4
|
+
var _chunkIBMXNAOTcjs = require('./chunk-IBMXNAOT.cjs');
|
|
5
|
+
require('./chunk-KXWOF6H4.cjs');
|
|
6
|
+
require('./chunk-USNT2KNT.cjs');
|
|
119
7
|
|
|
120
8
|
|
|
121
|
-
|
|
9
|
+
|
|
10
|
+
exports.CapnpRPC = _chunkIBMXNAOTcjs.CapnpRPC; exports.MessageChannelTransport = _chunkIBMXNAOTcjs.MessageChannelTransport;
|
package/dist/rpc.js
CHANGED
|
@@ -1,120 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
static {
|
|
8
|
-
__name(this, "MessageChannelTransport");
|
|
9
|
-
}
|
|
10
|
-
port;
|
|
11
|
-
constructor(port) {
|
|
12
|
-
super(), this.port = port, this.close = () => {
|
|
13
|
-
this.port.off("message", this.resolve);
|
|
14
|
-
this.port.off("messageerror", this.reject);
|
|
15
|
-
this.port.off("close", this.close);
|
|
16
|
-
this.port.close();
|
|
17
|
-
super.close();
|
|
18
|
-
};
|
|
19
|
-
this.port.on("message", this.resolve);
|
|
20
|
-
this.port.on("messageerror", this.reject);
|
|
21
|
-
this.port.on("close", this.close);
|
|
22
|
-
}
|
|
23
|
-
close;
|
|
24
|
-
sendMessage(msg) {
|
|
25
|
-
const m = new Message();
|
|
26
|
-
m.setRoot(msg);
|
|
27
|
-
const buf = m.toArrayBuffer();
|
|
28
|
-
this.port.postMessage(buf, [
|
|
29
|
-
buf
|
|
30
|
-
]);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
class CapnpRPC {
|
|
34
|
-
static {
|
|
35
|
-
__name(this, "CapnpRPC");
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* A queue for deferred connections that are waiting to be accepted.
|
|
39
|
-
*
|
|
40
|
-
* @remarks
|
|
41
|
-
* This is used to manage incoming connections when the accept method is called.
|
|
42
|
-
*/
|
|
43
|
-
acceptQueue = new Array();
|
|
44
|
-
/**
|
|
45
|
-
* A map of connections by their ID.
|
|
46
|
-
*
|
|
47
|
-
* @remarks
|
|
48
|
-
* This is used to manage multiple connections and allows for easy retrieval by ID.
|
|
49
|
-
*/
|
|
50
|
-
connections = {};
|
|
51
|
-
/**
|
|
52
|
-
* A queue for connections that are waiting to be accepted.
|
|
53
|
-
*
|
|
54
|
-
* @remarks
|
|
55
|
-
* This is used to manage incoming connections when the accept method is called.
|
|
56
|
-
*/
|
|
57
|
-
connectQueue = new Array();
|
|
58
|
-
/**
|
|
59
|
-
* Creates a new {@link Conn} instance.
|
|
60
|
-
*
|
|
61
|
-
* @remarks
|
|
62
|
-
* This class is used to manage connections and accept incoming connections using the {@link MessageChannel} API.
|
|
63
|
-
*/
|
|
64
|
-
connect(id = 0) {
|
|
65
|
-
if (this.connections[id] !== void 0) {
|
|
66
|
-
return this.connections[id];
|
|
67
|
-
}
|
|
68
|
-
const ch = new MessageChannel();
|
|
69
|
-
const conn = new Conn(new MessageChannelTransport(ch.port1));
|
|
70
|
-
const accept = this.acceptQueue.pop();
|
|
71
|
-
this.connections[id] = conn;
|
|
72
|
-
if (accept === void 0) {
|
|
73
|
-
this.connectQueue.push(ch.port2);
|
|
74
|
-
} else {
|
|
75
|
-
accept.resolve(new Conn(new MessageChannelTransport(ch.port2)));
|
|
76
|
-
}
|
|
77
|
-
return conn;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Accepts a connection from the connect queue.
|
|
81
|
-
*
|
|
82
|
-
* @returns A promise that resolves to a Conn instance when a connection is accepted.
|
|
83
|
-
* @throws If no connections are available in the connect queue.
|
|
84
|
-
*/
|
|
85
|
-
async accept() {
|
|
86
|
-
const port2 = this.connectQueue.pop();
|
|
87
|
-
if (port2 !== void 0) {
|
|
88
|
-
return Promise.resolve(new Conn(new MessageChannelTransport(port2)));
|
|
89
|
-
}
|
|
90
|
-
const deferred = new Deferred();
|
|
91
|
-
this.acceptQueue.push(deferred);
|
|
92
|
-
return deferred.promise;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Closes all connections and clears the queues.
|
|
96
|
-
*
|
|
97
|
-
* @remarks
|
|
98
|
-
* This method will reject all pending accept promises and close all
|
|
99
|
-
* connections in the connect queue.
|
|
100
|
-
*/
|
|
101
|
-
close() {
|
|
102
|
-
let i = this.acceptQueue.length;
|
|
103
|
-
while (--i >= 0) {
|
|
104
|
-
this.acceptQueue[i]?.reject();
|
|
105
|
-
}
|
|
106
|
-
i = this.connectQueue.length;
|
|
107
|
-
while (--i >= 0) {
|
|
108
|
-
this.connectQueue[i].close();
|
|
109
|
-
}
|
|
110
|
-
for (const id in this.connections) {
|
|
111
|
-
this.connections[id]?.shutdown();
|
|
112
|
-
}
|
|
113
|
-
this.acceptQueue.length = 0;
|
|
114
|
-
this.connectQueue.length = 0;
|
|
115
|
-
this.connections = {};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
2
|
+
CapnpRPC,
|
|
3
|
+
MessageChannelTransport
|
|
4
|
+
} from "./chunk-N2KNXTXN.js";
|
|
5
|
+
import "./chunk-5VHN3KGS.js";
|
|
6
|
+
import "./chunk-SHUYVCID.js";
|
|
118
7
|
export {
|
|
119
8
|
CapnpRPC,
|
|
120
9
|
MessageChannelTransport
|
package/dist/types.cjs
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
static {
|
|
6
|
-
_chunkUSNT2KNTcjs.__name.call(void 0, this, "CodeGeneratorContext");
|
|
7
|
-
}
|
|
8
|
-
__init() {this.files = []}
|
|
9
|
-
}
|
|
3
|
+
var _chunkR2JXWA7Qcjs = require('./chunk-R2JXWA7Q.cjs');
|
|
4
|
+
require('./chunk-USNT2KNT.cjs');
|
|
10
5
|
|
|
11
6
|
|
|
12
|
-
exports.CodeGeneratorContext = CodeGeneratorContext;
|
|
7
|
+
exports.CodeGeneratorContext = _chunkR2JXWA7Qcjs.CodeGeneratorContext;
|
package/dist/types.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, CodeGeneratorRequest_RequestedFile_Import, Field } from 'capnp-es/capnp/schema';
|
|
2
|
-
import {
|
|
2
|
+
import { ParsedCommandLine } from 'typescript';
|
|
3
3
|
|
|
4
4
|
interface CodeGeneratorFileContext {
|
|
5
5
|
readonly nodes: Node[];
|
|
@@ -31,13 +31,22 @@ interface CapnpcCLIOptions {
|
|
|
31
31
|
workspaceRoot: string;
|
|
32
32
|
tty?: boolean;
|
|
33
33
|
}
|
|
34
|
-
type CapnpcOptions = Omit<CapnpcCLIOptions, "
|
|
35
|
-
|
|
34
|
+
type CapnpcOptions = Omit<CapnpcCLIOptions, "tsconfig" | "schema"> & {
|
|
35
|
+
schemas: string | string[];
|
|
36
|
+
} & ({
|
|
37
|
+
tsconfig: ParsedCommandLine;
|
|
38
|
+
tsconfigPath?: string;
|
|
39
|
+
} | {
|
|
40
|
+
tsconfig?: ParsedCommandLine;
|
|
41
|
+
tsconfigPath: string;
|
|
42
|
+
});
|
|
43
|
+
type CapnpcResolvedOptions = Omit<CapnpcOptions, "noTs" | "noDts"> & {
|
|
36
44
|
schemas: string[];
|
|
45
|
+
tsconfig: ParsedCommandLine;
|
|
37
46
|
};
|
|
38
47
|
interface CapnpcResult {
|
|
39
48
|
ctx: CodeGeneratorContext;
|
|
40
49
|
files: Map<string, string>;
|
|
41
50
|
}
|
|
42
51
|
|
|
43
|
-
export { type CapnpcCLIOptions, type CapnpcOptions, type CapnpcResult, CodeGeneratorContext, type CodeGeneratorFileContext };
|
|
52
|
+
export { type CapnpcCLIOptions, type CapnpcOptions, type CapnpcResolvedOptions, type CapnpcResult, CodeGeneratorContext, type CodeGeneratorFileContext };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, CodeGeneratorRequest_RequestedFile_Import, Field } from 'capnp-es/capnp/schema';
|
|
2
|
-
import {
|
|
2
|
+
import { ParsedCommandLine } from 'typescript';
|
|
3
3
|
|
|
4
4
|
interface CodeGeneratorFileContext {
|
|
5
5
|
readonly nodes: Node[];
|
|
@@ -31,13 +31,22 @@ interface CapnpcCLIOptions {
|
|
|
31
31
|
workspaceRoot: string;
|
|
32
32
|
tty?: boolean;
|
|
33
33
|
}
|
|
34
|
-
type CapnpcOptions = Omit<CapnpcCLIOptions, "
|
|
35
|
-
|
|
34
|
+
type CapnpcOptions = Omit<CapnpcCLIOptions, "tsconfig" | "schema"> & {
|
|
35
|
+
schemas: string | string[];
|
|
36
|
+
} & ({
|
|
37
|
+
tsconfig: ParsedCommandLine;
|
|
38
|
+
tsconfigPath?: string;
|
|
39
|
+
} | {
|
|
40
|
+
tsconfig?: ParsedCommandLine;
|
|
41
|
+
tsconfigPath: string;
|
|
42
|
+
});
|
|
43
|
+
type CapnpcResolvedOptions = Omit<CapnpcOptions, "noTs" | "noDts"> & {
|
|
36
44
|
schemas: string[];
|
|
45
|
+
tsconfig: ParsedCommandLine;
|
|
37
46
|
};
|
|
38
47
|
interface CapnpcResult {
|
|
39
48
|
ctx: CodeGeneratorContext;
|
|
40
49
|
files: Map<string, string>;
|
|
41
50
|
}
|
|
42
51
|
|
|
43
|
-
export { type CapnpcCLIOptions, type CapnpcOptions, type CapnpcResult, CodeGeneratorContext, type CodeGeneratorFileContext };
|
|
52
|
+
export { type CapnpcCLIOptions, type CapnpcOptions, type CapnpcResolvedOptions, type CapnpcResult, CodeGeneratorContext, type CodeGeneratorFileContext };
|
package/dist/types.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
|
|
5
|
-
static {
|
|
6
|
-
__name(this, "CodeGeneratorContext");
|
|
7
|
-
}
|
|
8
|
-
files = [];
|
|
9
|
-
}
|
|
2
|
+
CodeGeneratorContext
|
|
3
|
+
} from "./chunk-CCU32X36.js";
|
|
4
|
+
import "./chunk-SHUYVCID.js";
|
|
10
5
|
export {
|
|
11
6
|
CodeGeneratorContext
|
|
12
7
|
};
|
package/dts/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
|
|
3
3
|
import { MessagePort as MessagePort$1 } from 'node:worker_threads';
|
|
4
|
-
import {
|
|
4
|
+
import { ParsedCommandLine } from 'typescript';
|
|
5
5
|
|
|
6
6
|
export declare enum ListElementSize {
|
|
7
7
|
VOID = 0,
|
|
@@ -4109,9 +4109,18 @@ export interface CapnpcCLIOptions {
|
|
|
4109
4109
|
workspaceRoot: string;
|
|
4110
4110
|
tty?: boolean;
|
|
4111
4111
|
}
|
|
4112
|
-
export type CapnpcOptions = Omit<CapnpcCLIOptions, "
|
|
4113
|
-
|
|
4112
|
+
export type CapnpcOptions = Omit<CapnpcCLIOptions, "tsconfig" | "schema"> & {
|
|
4113
|
+
schemas: string | string[];
|
|
4114
|
+
} & ({
|
|
4115
|
+
tsconfig: ParsedCommandLine;
|
|
4116
|
+
tsconfigPath?: string;
|
|
4117
|
+
} | {
|
|
4118
|
+
tsconfig?: ParsedCommandLine;
|
|
4119
|
+
tsconfigPath: string;
|
|
4120
|
+
});
|
|
4121
|
+
export type CapnpcResolvedOptions = Omit<CapnpcOptions, "noTs" | "noDts"> & {
|
|
4114
4122
|
schemas: string[];
|
|
4123
|
+
tsconfig: ParsedCommandLine;
|
|
4115
4124
|
};
|
|
4116
4125
|
export interface CapnpcResult {
|
|
4117
4126
|
ctx: CodeGeneratorContext;
|
|
@@ -4123,7 +4132,7 @@ export interface CapnpcResult {
|
|
|
4123
4132
|
* @param options - The options for the compilation process.
|
|
4124
4133
|
* @returns A promise that resolves to the compilation result.
|
|
4125
4134
|
*/
|
|
4126
|
-
export declare function capnpc(options:
|
|
4135
|
+
export declare function capnpc(options: CapnpcResolvedOptions): Promise<CapnpcResult>;
|
|
4127
4136
|
/**
|
|
4128
4137
|
* Compiles Cap'n Proto schemas into TypeScript files.
|
|
4129
4138
|
*
|
|
@@ -4131,7 +4140,7 @@ export declare function capnpc(options: CapnpcOptions): Promise<CapnpcResult>;
|
|
|
4131
4140
|
* @param options - The options for the compilation process.
|
|
4132
4141
|
* @returns A promise that resolves to the compilation result.
|
|
4133
4142
|
*/
|
|
4134
|
-
export declare function compile(dataBuf: Buffer, options:
|
|
4143
|
+
export declare function compile(dataBuf: Buffer, options: CapnpcOptions): Promise<{
|
|
4135
4144
|
ctx: {
|
|
4136
4145
|
files: {
|
|
4137
4146
|
readonly req: CodeGeneratorRequest;
|
package/dts/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
|
|
3
3
|
import { MessagePort as MessagePort$1 } from 'node:worker_threads';
|
|
4
|
-
import {
|
|
4
|
+
import { ParsedCommandLine } from 'typescript';
|
|
5
5
|
|
|
6
6
|
export declare enum ListElementSize {
|
|
7
7
|
VOID = 0,
|
|
@@ -4109,9 +4109,18 @@ export interface CapnpcCLIOptions {
|
|
|
4109
4109
|
workspaceRoot: string;
|
|
4110
4110
|
tty?: boolean;
|
|
4111
4111
|
}
|
|
4112
|
-
export type CapnpcOptions = Omit<CapnpcCLIOptions, "
|
|
4113
|
-
|
|
4112
|
+
export type CapnpcOptions = Omit<CapnpcCLIOptions, "tsconfig" | "schema"> & {
|
|
4113
|
+
schemas: string | string[];
|
|
4114
|
+
} & ({
|
|
4115
|
+
tsconfig: ParsedCommandLine;
|
|
4116
|
+
tsconfigPath?: string;
|
|
4117
|
+
} | {
|
|
4118
|
+
tsconfig?: ParsedCommandLine;
|
|
4119
|
+
tsconfigPath: string;
|
|
4120
|
+
});
|
|
4121
|
+
export type CapnpcResolvedOptions = Omit<CapnpcOptions, "noTs" | "noDts"> & {
|
|
4114
4122
|
schemas: string[];
|
|
4123
|
+
tsconfig: ParsedCommandLine;
|
|
4115
4124
|
};
|
|
4116
4125
|
export interface CapnpcResult {
|
|
4117
4126
|
ctx: CodeGeneratorContext;
|
|
@@ -4123,7 +4132,7 @@ export interface CapnpcResult {
|
|
|
4123
4132
|
* @param options - The options for the compilation process.
|
|
4124
4133
|
* @returns A promise that resolves to the compilation result.
|
|
4125
4134
|
*/
|
|
4126
|
-
export declare function capnpc(options:
|
|
4135
|
+
export declare function capnpc(options: CapnpcResolvedOptions): Promise<CapnpcResult>;
|
|
4127
4136
|
/**
|
|
4128
4137
|
* Compiles Cap'n Proto schemas into TypeScript files.
|
|
4129
4138
|
*
|
|
@@ -4131,7 +4140,7 @@ export declare function capnpc(options: CapnpcOptions): Promise<CapnpcResult>;
|
|
|
4131
4140
|
* @param options - The options for the compilation process.
|
|
4132
4141
|
* @returns A promise that resolves to the compilation result.
|
|
4133
4142
|
*/
|
|
4134
|
-
export declare function compile(dataBuf: Buffer, options:
|
|
4143
|
+
export declare function compile(dataBuf: Buffer, options: CapnpcOptions): Promise<{
|
|
4135
4144
|
ctx: {
|
|
4136
4145
|
files: {
|
|
4137
4146
|
readonly req: CodeGeneratorRequest;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/capnp",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package to assist in running the Cap'n Proto compiler and creating Cap'n Proto serialization protocol schemas.",
|
|
6
6
|
"repository": {
|
|
@@ -129,8 +129,8 @@
|
|
|
129
129
|
"peerDependencies": { "typescript": ">=4.0.0" },
|
|
130
130
|
"peerDependenciesMeta": { "typescript": { "optional": false } },
|
|
131
131
|
"dependencies": {
|
|
132
|
-
"@stryke/fs": "^0.23.
|
|
133
|
-
"@stryke/path": "^0.12.
|
|
132
|
+
"@stryke/fs": "^0.23.3",
|
|
133
|
+
"@stryke/path": "^0.12.3",
|
|
134
134
|
"defu": "^6.1.4",
|
|
135
135
|
"hex2dec": "^1.1.2",
|
|
136
136
|
"nanotar": "^0.2.0"
|
|
@@ -148,5 +148,5 @@
|
|
|
148
148
|
"tsx": "^4.20.1"
|
|
149
149
|
},
|
|
150
150
|
"publishConfig": { "access": "public" },
|
|
151
|
-
"gitHead": "
|
|
151
|
+
"gitHead": "bd1c18c69a24e82c1b126b1e5de36008bbac52d9"
|
|
152
152
|
}
|
package/schemas/persistent.cjs
CHANGED
|
@@ -6,27 +6,27 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkBM2HWFSDcjs = require('./chunk-BM2HWFSD.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
|
|
13
13
|
|
|
14
14
|
// schemas/persistent.ts
|
|
15
15
|
var _capnpFileId = BigInt("0xb8630836983feed7");
|
|
16
|
-
var Persistent_SaveParams = (_class = class extends
|
|
16
|
+
var Persistent_SaveParams = (_class = class extends _chunkBM2HWFSDcjs.Struct {
|
|
17
17
|
static {
|
|
18
18
|
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Persistent_SaveParams");
|
|
19
19
|
}
|
|
20
20
|
static __initStatic() {this._capnp = {
|
|
21
21
|
displayName: "SaveParams",
|
|
22
22
|
id: "f76fba59183073a5",
|
|
23
|
-
size: new (0,
|
|
23
|
+
size: new (0, _chunkBM2HWFSDcjs.ObjectSize)(0, 1)
|
|
24
24
|
}}
|
|
25
25
|
_adoptSealFor(value) {
|
|
26
|
-
|
|
26
|
+
_chunkBM2HWFSDcjs.utils.adopt(value, _chunkBM2HWFSDcjs.utils.getPointer(0, this));
|
|
27
27
|
}
|
|
28
28
|
_disownSealFor() {
|
|
29
|
-
return
|
|
29
|
+
return _chunkBM2HWFSDcjs.utils.disown(this.sealFor);
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Seal the SturdyRef so that it can only be restored by the specified Owner. This is meant
|
|
@@ -38,41 +38,41 @@ var Persistent_SaveParams = (_class = class extends _chunkZGPCLBI4cjs.Struct {
|
|
|
38
38
|
*
|
|
39
39
|
*/
|
|
40
40
|
get sealFor() {
|
|
41
|
-
return
|
|
41
|
+
return _chunkBM2HWFSDcjs.utils.getPointer(0, this);
|
|
42
42
|
}
|
|
43
43
|
_hasSealFor() {
|
|
44
|
-
return !
|
|
44
|
+
return !_chunkBM2HWFSDcjs.utils.isNull(_chunkBM2HWFSDcjs.utils.getPointer(0, this));
|
|
45
45
|
}
|
|
46
46
|
set sealFor(value) {
|
|
47
|
-
|
|
47
|
+
_chunkBM2HWFSDcjs.utils.copyFrom(value, _chunkBM2HWFSDcjs.utils.getPointer(0, this));
|
|
48
48
|
}
|
|
49
49
|
toString() {
|
|
50
50
|
return "Persistent_SaveParams_" + super.toString();
|
|
51
51
|
}
|
|
52
52
|
}, _class.__initStatic(), _class);
|
|
53
|
-
var Persistent_SaveResults = (_class2 = class extends
|
|
53
|
+
var Persistent_SaveResults = (_class2 = class extends _chunkBM2HWFSDcjs.Struct {
|
|
54
54
|
static {
|
|
55
55
|
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Persistent_SaveResults");
|
|
56
56
|
}
|
|
57
57
|
static __initStatic2() {this._capnp = {
|
|
58
58
|
displayName: "SaveResults",
|
|
59
59
|
id: "b76848c18c40efbf",
|
|
60
|
-
size: new (0,
|
|
60
|
+
size: new (0, _chunkBM2HWFSDcjs.ObjectSize)(0, 1)
|
|
61
61
|
}}
|
|
62
62
|
_adoptSturdyRef(value) {
|
|
63
|
-
|
|
63
|
+
_chunkBM2HWFSDcjs.utils.adopt(value, _chunkBM2HWFSDcjs.utils.getPointer(0, this));
|
|
64
64
|
}
|
|
65
65
|
_disownSturdyRef() {
|
|
66
|
-
return
|
|
66
|
+
return _chunkBM2HWFSDcjs.utils.disown(this.sturdyRef);
|
|
67
67
|
}
|
|
68
68
|
get sturdyRef() {
|
|
69
|
-
return
|
|
69
|
+
return _chunkBM2HWFSDcjs.utils.getPointer(0, this);
|
|
70
70
|
}
|
|
71
71
|
_hasSturdyRef() {
|
|
72
|
-
return !
|
|
72
|
+
return !_chunkBM2HWFSDcjs.utils.isNull(_chunkBM2HWFSDcjs.utils.getPointer(0, this));
|
|
73
73
|
}
|
|
74
74
|
set sturdyRef(value) {
|
|
75
|
-
|
|
75
|
+
_chunkBM2HWFSDcjs.utils.copyFrom(value, _chunkBM2HWFSDcjs.utils.getPointer(0, this));
|
|
76
76
|
}
|
|
77
77
|
toString() {
|
|
78
78
|
return "Persistent_SaveResults_" + super.toString();
|
|
@@ -120,12 +120,12 @@ var Persistent$Client = (_class3 = class _Persistent$Client {
|
|
|
120
120
|
method: _Persistent$Client.methods[0],
|
|
121
121
|
paramsFunc
|
|
122
122
|
});
|
|
123
|
-
const pipeline = new (0,
|
|
123
|
+
const pipeline = new (0, _chunkBM2HWFSDcjs.Pipeline)(Persistent_SaveResults, answer);
|
|
124
124
|
return new Persistent_SaveResults$Promise(pipeline);
|
|
125
125
|
}
|
|
126
126
|
}, _class3.__initStatic3(), _class3.__initStatic4(), _class3);
|
|
127
|
-
|
|
128
|
-
var Persistent$Server = class extends
|
|
127
|
+
_chunkBM2HWFSDcjs.Registry.register(Persistent$Client.interfaceId, Persistent$Client);
|
|
128
|
+
var Persistent$Server = class extends _chunkBM2HWFSDcjs.Server {
|
|
129
129
|
static {
|
|
130
130
|
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Persistent$Server");
|
|
131
131
|
}
|
|
@@ -143,7 +143,7 @@ var Persistent$Server = class extends _chunkZGPCLBI4cjs.Server {
|
|
|
143
143
|
return new Persistent$Client(this);
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
|
-
var Persistent = (_class4 = class extends
|
|
146
|
+
var Persistent = (_class4 = class extends _chunkBM2HWFSDcjs.Interface {
|
|
147
147
|
static {
|
|
148
148
|
_chunkUSNT2KNTcjs.__name.call(void 0, this, "Persistent");
|
|
149
149
|
}
|
|
@@ -154,7 +154,7 @@ var Persistent = (_class4 = class extends _chunkZGPCLBI4cjs.Interface {
|
|
|
154
154
|
static __initStatic9() {this._capnp = {
|
|
155
155
|
displayName: "Persistent",
|
|
156
156
|
id: "c8cb212fcd9f5691",
|
|
157
|
-
size: new (0,
|
|
157
|
+
size: new (0, _chunkBM2HWFSDcjs.ObjectSize)(0, 0)
|
|
158
158
|
}}
|
|
159
159
|
toString() {
|
|
160
160
|
return "Persistent_" + super.toString();
|