@celljs/rpc 3.8.0 → 3.9.0
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/esm/common/annotation/autorpc.d.ts +5 -0
- package/esm/common/annotation/autorpc.js +14 -0
- package/esm/common/annotation/autorpc.js.map +1 -0
- package/esm/common/annotation/detached/autorpc.d.ts +2 -0
- package/esm/common/annotation/detached/autorpc.js +11 -0
- package/esm/common/annotation/detached/autorpc.js.map +1 -0
- package/esm/common/annotation/detached/index.d.ts +1 -0
- package/esm/common/annotation/detached/index.js +2 -0
- package/esm/common/annotation/detached/index.js.map +1 -0
- package/esm/common/annotation/index.d.ts +2 -0
- package/esm/common/annotation/index.js +3 -0
- package/esm/common/annotation/index.js.map +1 -0
- package/esm/common/annotation/rpc.d.ts +19 -0
- package/esm/common/annotation/rpc.js +36 -0
- package/esm/common/annotation/rpc.js.map +1 -0
- package/esm/common/channal/channel-protocol.d.ts +51 -0
- package/esm/common/channal/channel-protocol.js +34 -0
- package/esm/common/channal/channel-protocol.js.map +1 -0
- package/esm/common/channal/http-channel.d.ts +8 -0
- package/esm/common/channal/http-channel.js +22 -0
- package/esm/common/channal/http-channel.js.map +1 -0
- package/esm/common/channal/index.d.ts +2 -0
- package/esm/common/channal/index.js +3 -0
- package/esm/common/channal/index.js.map +1 -0
- package/esm/common/constants.d.ts +1 -0
- package/esm/common/constants.js +2 -0
- package/esm/common/constants.js.map +1 -0
- package/esm/common/converter/converter-protocol.d.ts +6 -0
- package/esm/common/converter/converter-protocol.js +3 -0
- package/esm/common/converter/converter-protocol.js.map +1 -0
- package/esm/common/converter/index.d.ts +1 -0
- package/esm/common/converter/index.js +2 -0
- package/esm/common/converter/index.js.map +1 -0
- package/esm/common/endpoint/endpoint-protocol.d.ts +4 -0
- package/esm/common/endpoint/endpoint-protocol.js +2 -0
- package/esm/common/endpoint/endpoint-protocol.js.map +1 -0
- package/esm/common/endpoint/endpoint-resolver.d.ts +12 -0
- package/esm/common/endpoint/endpoint-resolver.js +58 -0
- package/esm/common/endpoint/endpoint-resolver.js.map +1 -0
- package/esm/common/endpoint/index.d.ts +2 -0
- package/esm/common/endpoint/index.js +3 -0
- package/esm/common/endpoint/index.js.map +1 -0
- package/esm/common/error/error.d.ts +5 -0
- package/esm/common/error/error.js +8 -0
- package/esm/common/error/error.js.map +1 -0
- package/esm/common/error/index.d.ts +1 -0
- package/esm/common/error/index.js +2 -0
- package/esm/common/error/index.js.map +1 -0
- package/esm/common/factory/connection-factory.d.ts +9 -0
- package/esm/common/factory/connection-factory.js +25 -0
- package/esm/common/factory/connection-factory.js.map +1 -0
- package/esm/common/factory/index.d.ts +4 -0
- package/esm/common/factory/index.js +5 -0
- package/esm/common/factory/index.js.map +1 -0
- package/esm/common/factory/proxy-factory.d.ts +56 -0
- package/esm/common/factory/proxy-factory.js +177 -0
- package/esm/common/factory/proxy-factory.js.map +1 -0
- package/esm/common/factory/reader.d.ts +15 -0
- package/esm/common/factory/reader.js +44 -0
- package/esm/common/factory/reader.js.map +1 -0
- package/esm/common/factory/writer.d.ts +9 -0
- package/esm/common/factory/writer.js +21 -0
- package/esm/common/factory/writer.js.map +1 -0
- package/esm/common/handler/connection-handler.d.ts +6 -0
- package/esm/common/handler/connection-handler.js +4 -0
- package/esm/common/handler/connection-handler.js.map +1 -0
- package/esm/common/handler/handler-protocol.d.ts +6 -0
- package/esm/common/handler/handler-protocol.js +2 -0
- package/esm/common/handler/handler-protocol.js.map +1 -0
- package/esm/common/handler/index.d.ts +2 -0
- package/esm/common/handler/index.js +3 -0
- package/esm/common/handler/index.js.map +1 -0
- package/esm/common/index.d.ts +11 -0
- package/esm/common/index.js +12 -0
- package/esm/common/index.js.map +1 -0
- package/esm/common/module.d.ts +3 -0
- package/esm/common/module.js +20 -0
- package/esm/common/module.js.map +1 -0
- package/esm/common/processor/client-config-processor.d.ts +5 -0
- package/esm/common/processor/client-config-processor.js +17 -0
- package/esm/common/processor/client-config-processor.js.map +1 -0
- package/esm/common/processor/index.d.ts +2 -0
- package/esm/common/processor/index.js +3 -0
- package/esm/common/processor/index.js.map +1 -0
- package/esm/common/processor/processor-protocol.d.ts +5 -0
- package/esm/common/processor/processor-protocol.js +2 -0
- package/esm/common/processor/processor-protocol.js.map +1 -0
- package/esm/common/proxy/delegating-http-proxy-creator.d.ts +23 -0
- package/esm/common/proxy/delegating-http-proxy-creator.js +86 -0
- package/esm/common/proxy/delegating-http-proxy-creator.js.map +1 -0
- package/esm/common/proxy/http-proxy-creator.d.ts +42 -0
- package/esm/common/proxy/http-proxy-creator.js +139 -0
- package/esm/common/proxy/http-proxy-creator.js.map +1 -0
- package/esm/common/proxy/index.d.ts +4 -0
- package/esm/common/proxy/index.js +5 -0
- package/esm/common/proxy/index.js.map +1 -0
- package/esm/common/proxy/proxy-protocol.d.ts +20 -0
- package/esm/common/proxy/proxy-protocol.js +3 -0
- package/esm/common/proxy/proxy-protocol.js.map +1 -0
- package/esm/common/proxy/proxy-provider.d.ts +9 -0
- package/esm/common/proxy/proxy-provider.js +40 -0
- package/esm/common/proxy/proxy-provider.js.map +1 -0
- package/esm/common/utils/converter-util.d.ts +7 -0
- package/esm/common/utils/converter-util.js +29 -0
- package/esm/common/utils/converter-util.js.map +1 -0
- package/esm/common/utils/index.d.ts +3 -0
- package/esm/common/utils/index.js +4 -0
- package/esm/common/utils/index.js.map +1 -0
- package/esm/common/utils/logger.d.ts +8 -0
- package/esm/common/utils/logger.js +18 -0
- package/esm/common/utils/logger.js.map +1 -0
- package/esm/common/utils/rpc-util.d.ts +12 -0
- package/esm/common/utils/rpc-util.js +43 -0
- package/esm/common/utils/rpc-util.js.map +1 -0
- package/esm/node/channel/channel-manager.d.ts +9 -0
- package/esm/node/channel/channel-manager.js +56 -0
- package/esm/node/channel/channel-manager.js.map +1 -0
- package/esm/node/channel/channel-middleware.d.ts +7 -0
- package/esm/node/channel/channel-middleware.js +37 -0
- package/esm/node/channel/channel-middleware.js.map +1 -0
- package/esm/node/channel/channel-protocol.d.ts +12 -0
- package/esm/node/channel/channel-protocol.js +6 -0
- package/esm/node/channel/channel-protocol.js.map +1 -0
- package/esm/node/channel/channel-strategy.d.ts +9 -0
- package/esm/node/channel/channel-strategy.js +61 -0
- package/esm/node/channel/channel-strategy.js.map +1 -0
- package/esm/node/channel/index.d.ts +4 -0
- package/esm/node/channel/index.js +5 -0
- package/esm/node/channel/index.js.map +1 -0
- package/esm/node/handler/handler-adapter.d.ts +13 -0
- package/esm/node/handler/handler-adapter.js +52 -0
- package/esm/node/handler/handler-adapter.js.map +1 -0
- package/esm/node/handler/handler-protocol.d.ts +1 -0
- package/esm/node/handler/handler-protocol.js +2 -0
- package/esm/node/handler/handler-protocol.js.map +1 -0
- package/esm/node/handler/index.d.ts +2 -0
- package/esm/node/handler/index.js +3 -0
- package/esm/node/handler/index.js.map +1 -0
- package/esm/node/index.d.ts +2 -0
- package/esm/node/index.js +3 -0
- package/esm/node/index.js.map +1 -0
- package/esm/node/module.d.ts +3 -0
- package/esm/node/module.js +4 -0
- package/esm/node/module.js.map +1 -0
- package/esm/package.json +3 -0
- package/package.json +101 -6
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { ResponseError, Emitter } from 'vscode-jsonrpc';
|
|
2
|
+
import { ApplicationError, getTargetClass, getPropertyNames } from '@celljs/core';
|
|
3
|
+
export class JsonRpcConnectionHandler {
|
|
4
|
+
constructor(path, targetFactory, errorConverters, pipeManager, logger) {
|
|
5
|
+
this.path = path;
|
|
6
|
+
this.targetFactory = targetFactory;
|
|
7
|
+
this.errorConverters = errorConverters;
|
|
8
|
+
this.pipeManager = pipeManager;
|
|
9
|
+
this.logger = logger;
|
|
10
|
+
}
|
|
11
|
+
onConnection(connection) {
|
|
12
|
+
const factory = new JsonRpcProxyFactory(undefined, this.errorConverters, this.pipeManager, this.logger);
|
|
13
|
+
const proxy = factory.createProxy();
|
|
14
|
+
factory.target = this.targetFactory(proxy);
|
|
15
|
+
factory.listen(connection);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class JsonRpcProxyFactory {
|
|
19
|
+
constructor(target, errorConverters, pipeManager, logger) {
|
|
20
|
+
this.target = target;
|
|
21
|
+
this.errorConverters = errorConverters;
|
|
22
|
+
this.pipeManager = pipeManager;
|
|
23
|
+
this.logger = logger;
|
|
24
|
+
this.onDidOpenConnectionEmitter = new Emitter();
|
|
25
|
+
this.onDidCloseConnectionEmitter = new Emitter();
|
|
26
|
+
this.waitForConnection();
|
|
27
|
+
}
|
|
28
|
+
waitForConnection() {
|
|
29
|
+
this.connectionPromise = new Promise(resolve => this.connectionPromiseResolve = resolve);
|
|
30
|
+
this.connectionPromise.then(connection => {
|
|
31
|
+
connection.onClose(() => this.onDidCloseConnectionEmitter.fire(undefined));
|
|
32
|
+
this.onDidOpenConnectionEmitter.fire(undefined);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
getRequestHandler(prop) {
|
|
36
|
+
return (...args) => this.onRequest(prop, ...args);
|
|
37
|
+
}
|
|
38
|
+
getNotificationHandler(prop) {
|
|
39
|
+
return (...args) => this.onNotification(prop, ...args);
|
|
40
|
+
}
|
|
41
|
+
registerMethods(connection) {
|
|
42
|
+
if (this.target) {
|
|
43
|
+
for (const prop of getPropertyNames(this.target)) {
|
|
44
|
+
if (typeof this.target[prop] === 'function') {
|
|
45
|
+
connection.onRequest(prop, this.getRequestHandler(prop));
|
|
46
|
+
connection.onNotification(prop, this.getNotificationHandler(prop));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
listen(connection) {
|
|
52
|
+
this.registerMethods(connection);
|
|
53
|
+
connection.onDispose(() => this.waitForConnection());
|
|
54
|
+
connection.listen();
|
|
55
|
+
this.connectionPromiseResolve(connection);
|
|
56
|
+
}
|
|
57
|
+
async onRequest(method, ...args) {
|
|
58
|
+
var _a, _b, _c, _d;
|
|
59
|
+
const now = Date.now();
|
|
60
|
+
const message = `${getTargetClass(this.target).name}.${method}`;
|
|
61
|
+
// eslint-disable-next-line no-unused-expressions
|
|
62
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.info(`starting ${message}`);
|
|
63
|
+
try {
|
|
64
|
+
// eslint-disable-next-line no-unused-expressions
|
|
65
|
+
await ((_b = this.pipeManager) === null || _b === void 0 ? void 0 : _b.apply({ target: this.target, method: method }, args));
|
|
66
|
+
return await this.target[method](...args);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
const e = this.serializeError(error);
|
|
70
|
+
if (e instanceof ResponseError) {
|
|
71
|
+
throw e;
|
|
72
|
+
}
|
|
73
|
+
const reason = e.message || '';
|
|
74
|
+
const stack = e.stack || '';
|
|
75
|
+
// eslint-disable-next-line no-unused-expressions
|
|
76
|
+
(_c = this.logger) === null || _c === void 0 ? void 0 : _c.error(`Request ${method} failed with error: ${reason}`, stack);
|
|
77
|
+
throw e;
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
// eslint-disable-next-line no-unused-expressions
|
|
81
|
+
(_d = this.logger) === null || _d === void 0 ? void 0 : _d.info(`ending ${message}, cost ${Date.now() - now}ms`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
onNotification(method, ...args) {
|
|
85
|
+
this.target[method](...args);
|
|
86
|
+
}
|
|
87
|
+
createProxy() {
|
|
88
|
+
const proxy = new Proxy(this, this);
|
|
89
|
+
return proxy;
|
|
90
|
+
}
|
|
91
|
+
get(target, p, receiver) {
|
|
92
|
+
const method = this.getInternalMethod(p.toString());
|
|
93
|
+
if (method) {
|
|
94
|
+
return method;
|
|
95
|
+
}
|
|
96
|
+
return this.createProxyMethod(p.toString());
|
|
97
|
+
}
|
|
98
|
+
getInternalMethod(method) {
|
|
99
|
+
if (method === JsonRpcProxyFactory.SET_CLIENT) {
|
|
100
|
+
return (client) => this.target = client;
|
|
101
|
+
}
|
|
102
|
+
if (method === JsonRpcProxyFactory.ON_DID_OPEN_CONNECTION) {
|
|
103
|
+
return this.onDidOpenConnectionEmitter.event;
|
|
104
|
+
}
|
|
105
|
+
if (method === JsonRpcProxyFactory.ON_DID_CLOSE_CONNECTION) {
|
|
106
|
+
return this.onDidCloseConnectionEmitter.event;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
createProxyMethod(method) {
|
|
110
|
+
if (method === 'then') {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
const isNotify = this.isNotification(method);
|
|
114
|
+
return async (...args) => {
|
|
115
|
+
const capturedError = new Error(`Request '${method}' failed`);
|
|
116
|
+
const connection = await this.connectionPromise;
|
|
117
|
+
if (isNotify) {
|
|
118
|
+
connection.sendNotification(method, ...args);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
try {
|
|
122
|
+
return await connection.sendRequest(method, ...args);
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
throw this.deserializeError(capturedError, err);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
isNotification(p) {
|
|
131
|
+
return p.toString().startsWith('notify') || p.toString().startsWith('on');
|
|
132
|
+
}
|
|
133
|
+
serializeError(e) {
|
|
134
|
+
if (this.errorConverters) {
|
|
135
|
+
for (const converter of this.errorConverters) {
|
|
136
|
+
const serialized = converter.serialize(e);
|
|
137
|
+
if (serialized) {
|
|
138
|
+
e = serialized;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (ApplicationError.is(e)) {
|
|
144
|
+
return new ResponseError(e.code, '', Object.assign({ kind: 'application' }, e.toJson()));
|
|
145
|
+
}
|
|
146
|
+
return e;
|
|
147
|
+
}
|
|
148
|
+
deserializeError(capturedError, e) {
|
|
149
|
+
if (e instanceof ResponseError) {
|
|
150
|
+
const capturedStack = capturedError.stack || '';
|
|
151
|
+
if (e.data && e.data.kind === 'application') {
|
|
152
|
+
const { stack, data, message } = e.data;
|
|
153
|
+
e = ApplicationError.fromJson(e.code, {
|
|
154
|
+
message: message || capturedError.message,
|
|
155
|
+
data,
|
|
156
|
+
stack: `${capturedStack}\nCaused by: ${stack}`
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
e.stack = capturedStack;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (this.errorConverters) {
|
|
164
|
+
for (const converter of this.errorConverters) {
|
|
165
|
+
const deserialized = converter.deserialize(e);
|
|
166
|
+
if (deserialized) {
|
|
167
|
+
return deserialized;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return e;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
JsonRpcProxyFactory.SET_CLIENT = 'setClient';
|
|
175
|
+
JsonRpcProxyFactory.ON_DID_OPEN_CONNECTION = 'onDidOpenConnection';
|
|
176
|
+
JsonRpcProxyFactory.ON_DID_CLOSE_CONNECTION = 'onDidCloseConnection';
|
|
177
|
+
//# sourceMappingURL=proxy-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy-factory.js","sourceRoot":"","sources":["../../../src/common/factory/proxy-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,OAAO,EAAS,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAsB,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAoBtG,MAAM,OAAO,wBAAwB;IACjC,YACa,IAAY,EACZ,aAA8C,EAC9C,eAAiC,EACjC,WAAwB,EACxB,MAAc;oBAJd,IAAI;6BACJ,aAAa;+BACb,eAAe;2BACf,WAAW;sBACX,MAAM;IACf,CAAC;IAEL,YAAY,CAAC,UAA6B;QACtC,MAAM,OAAO,GAAG,IAAI,mBAAmB,CAAI,SAAS,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC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;iBAAM,CAAC;gBACJ,CAAC,CAAC,KAAK,GAAG,aAAa,CAAC;YAC5B,CAAC;QACL,CAAC;QACD,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACvB,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;gBAC3C,MAAM,YAAY,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;gBAC9C,IAAI,YAAY,EAAE,CAAC;oBACf,OAAO,YAAY,CAAC;gBACxB,CAAC;YACL,CAAC;QACL,CAAC;QACD,OAAO,CAAC,CAAC;IACb,CAAC;CAEJ;AAlLkB,8BAAU,GAAG,WAAW,AAAd,CAAe;AACzB,0CAAsB,GAAG,qBAAqB,AAAxB,CAAyB;AAC/C,2CAAuB,GAAG,sBAAsB,AAAzB,CAA0B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DataCallback, AbstractMessageReader, Disposable } from 'vscode-jsonrpc';
|
|
2
|
+
import { Channel } from '../channal/channel-protocol.js';
|
|
3
|
+
export declare class ChannelMessageReader extends AbstractMessageReader {
|
|
4
|
+
protected readonly channel: Channel;
|
|
5
|
+
protected state: 'initial' | 'listening' | 'closed';
|
|
6
|
+
protected callback: DataCallback | undefined;
|
|
7
|
+
protected readonly events: {
|
|
8
|
+
message?: any;
|
|
9
|
+
error?: any;
|
|
10
|
+
}[];
|
|
11
|
+
constructor(channel: Channel);
|
|
12
|
+
listen(callback: DataCallback): Disposable;
|
|
13
|
+
protected readMessage(message: any): void;
|
|
14
|
+
protected fireError(error: any): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AbstractMessageReader, Disposable } from 'vscode-jsonrpc';
|
|
2
|
+
export class ChannelMessageReader extends AbstractMessageReader {
|
|
3
|
+
constructor(channel) {
|
|
4
|
+
super();
|
|
5
|
+
this.channel = channel;
|
|
6
|
+
this.state = 'initial';
|
|
7
|
+
this.events = [];
|
|
8
|
+
this.channel.onMessage(message => this.readMessage(message));
|
|
9
|
+
}
|
|
10
|
+
listen(callback) {
|
|
11
|
+
if (this.state === 'initial') {
|
|
12
|
+
this.state = 'listening';
|
|
13
|
+
this.callback = callback;
|
|
14
|
+
while (this.events.length !== 0) {
|
|
15
|
+
const event = this.events.pop();
|
|
16
|
+
if (event.message) {
|
|
17
|
+
this.readMessage(event.message);
|
|
18
|
+
}
|
|
19
|
+
else if (event.error) {
|
|
20
|
+
this.fireError(event.error);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return Disposable.create(() => { });
|
|
25
|
+
}
|
|
26
|
+
readMessage(message) {
|
|
27
|
+
if (this.state === 'initial') {
|
|
28
|
+
this.events.splice(0, 0, { message });
|
|
29
|
+
}
|
|
30
|
+
else if (this.state === 'listening') {
|
|
31
|
+
const data = JSON.parse(message);
|
|
32
|
+
this.callback(data);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
fireError(error) {
|
|
36
|
+
if (this.state === 'initial') {
|
|
37
|
+
this.events.splice(0, 0, { error });
|
|
38
|
+
}
|
|
39
|
+
else if (this.state === 'listening') {
|
|
40
|
+
super.fireError(error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reader.js","sourceRoot":"","sources":["../../../src/common/factory/reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,qBAAqB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjF,MAAM,OAAO,oBAAqB,SAAQ,qBAAqB;IAM3D,YAA+B,OAAgB;QAC3C,KAAK,EAAE,CAAC;QADmB,YAAO,GAAP,OAAO,CAAS;QAJrC,UAAK,GAAuC,SAAS,CAAC;QAE7C,WAAM,GAAqC,EAAE,CAAC;QAI7D,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAC7B,IAA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AAK,EAAE,CAAC,CAAC;QACxC,CAAC;aAAM,IAAI,IAAI,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;YACpC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;IACL,CAAC;CAEJ"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Message, AbstractMessageWriter } from 'vscode-jsonrpc';
|
|
2
|
+
import { Channel } from '../channal/index.js';
|
|
3
|
+
export declare class ChannelMessageWriter extends AbstractMessageWriter {
|
|
4
|
+
protected readonly channel: Channel;
|
|
5
|
+
protected errorCount: number;
|
|
6
|
+
constructor(channel: Channel);
|
|
7
|
+
write(msg: Message): Promise<void>;
|
|
8
|
+
end(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AbstractMessageWriter } from 'vscode-jsonrpc';
|
|
2
|
+
export class ChannelMessageWriter extends AbstractMessageWriter {
|
|
3
|
+
constructor(channel) {
|
|
4
|
+
super();
|
|
5
|
+
this.channel = channel;
|
|
6
|
+
this.errorCount = 0;
|
|
7
|
+
}
|
|
8
|
+
async write(msg) {
|
|
9
|
+
try {
|
|
10
|
+
const content = JSON.stringify(msg);
|
|
11
|
+
this.channel.send(content);
|
|
12
|
+
}
|
|
13
|
+
catch (e) {
|
|
14
|
+
this.errorCount++;
|
|
15
|
+
this.fireError(e, msg, this.errorCount);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
end() {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writer.js","sourceRoot":"","sources":["../../../src/common/factory/writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGhE,MAAM,OAAO,oBAAqB,SAAQ,qBAAqB;IAI3D,YAA+B,OAAgB;QAC3C,KAAK,EAAE,CAAC;QADmB,YAAO,GAAP,OAAO,CAAS;QAFrC,eAAU,GAAG,CAAC,CAAC;IAIzB,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,GAAY;QACpB,IAAI,CAAC;YACD,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YACpC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,CAAC;IACL,CAAC;IAED,GAAG;IAEH,CAAC;CAEJ"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MessageConnection } from 'vscode-jsonrpc';
|
|
2
|
+
import { ConnectionHandler } from './handler-protocol.js';
|
|
3
|
+
export declare class NoOpConnectionHandler implements ConnectionHandler {
|
|
4
|
+
readonly path: string;
|
|
5
|
+
onConnection(connection: MessageConnection): void;
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-handler.js","sourceRoot":"","sources":["../../../src/common/handler/connection-handler.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,qBAAqB;IAE9B,YAAY,CAAC,UAA6B,IAAS,CAAC;CACvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler-protocol.js","sourceRoot":"","sources":["../../../src/common/handler/handler-protocol.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/handler/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './annotation/index.js';
|
|
2
|
+
export * from './channal/index.js';
|
|
3
|
+
export * from './endpoint/index.js';
|
|
4
|
+
export * from './error/index.js';
|
|
5
|
+
export * from './factory/index.js';
|
|
6
|
+
export * from './handler/index.js';
|
|
7
|
+
export * from './proxy/index.js';
|
|
8
|
+
export * from './utils/index.js';
|
|
9
|
+
export * from './constants.js';
|
|
10
|
+
export * from './converter/index.js';
|
|
11
|
+
export * from './processor/index.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './annotation/index.js';
|
|
2
|
+
export * from './channal/index.js';
|
|
3
|
+
export * from './endpoint/index.js';
|
|
4
|
+
export * from './error/index.js';
|
|
5
|
+
export * from './factory/index.js';
|
|
6
|
+
export * from './handler/index.js';
|
|
7
|
+
export * from './proxy/index.js';
|
|
8
|
+
export * from './utils/index.js';
|
|
9
|
+
export * from './constants.js';
|
|
10
|
+
export * from './converter/index.js';
|
|
11
|
+
export * from './processor/index.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { autoBind } from '@celljs/core';
|
|
2
|
+
import { ProxyProvider } from './proxy/index.js';
|
|
3
|
+
import { ID_KEY, RPC } from './annotation/index.js';
|
|
4
|
+
import { RpcUtil, ConverterUtil } from './utils/index.js';
|
|
5
|
+
import './index.js';
|
|
6
|
+
export default autoBind(bind => {
|
|
7
|
+
bind(RPC).toDynamicValue(ctx => {
|
|
8
|
+
var _a;
|
|
9
|
+
const id = (_a = ctx.currentRequest.target.getCustomTags()) === null || _a === void 0 ? void 0 : _a.find(m => m.key === ID_KEY).value;
|
|
10
|
+
const path = RpcUtil.toPath(id);
|
|
11
|
+
const proxyProvider = ctx.container.get(ProxyProvider);
|
|
12
|
+
const errorConverters = ConverterUtil.getGlobalErrorConverters(ctx.container);
|
|
13
|
+
const errorConverter = ConverterUtil.getErrorConverters(id, ctx.container);
|
|
14
|
+
if (errorConverter) {
|
|
15
|
+
errorConverters.push(errorConverter);
|
|
16
|
+
}
|
|
17
|
+
return proxyProvider.provide(path, errorConverters);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/common/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,SAAS,CAAC;AAEjB,eAAe,QAAQ,CAAC,IAAI,CAAC,EAAE;IAE3B,IAAI,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;;QAC3B,MAAM,EAAE,GAAG,MAAA,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,EAAG,KAAK,CAAC;QACzF,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAChC,MAAM,aAAa,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAgB,aAAa,CAAC,CAAC;QACtE,MAAM,eAAe,GAAG,aAAa,CAAC,wBAAwB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC9E,MAAM,cAAc,GAAG,aAAa,CAAC,kBAAkB,CAAC,EAAE,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;QAC3E,IAAI,cAAc,EAAE,CAAC;YACjB,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Component } from '@celljs/core';
|
|
8
|
+
import { ClientConfigProcessor } from './processor-protocol.js';
|
|
9
|
+
let NoOpClientConfigProcessor = class NoOpClientConfigProcessor {
|
|
10
|
+
async process(config) {
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
NoOpClientConfigProcessor = __decorate([
|
|
14
|
+
Component(ClientConfigProcessor)
|
|
15
|
+
], NoOpClientConfigProcessor);
|
|
16
|
+
export { NoOpClientConfigProcessor };
|
|
17
|
+
//# sourceMappingURL=client-config-processor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-config-processor.js","sourceRoot":"","sources":["../../../src/common/processor/client-config-processor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAItD,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAElC,KAAK,CAAC,OAAO,CAAC,MAA0B;IAExC,CAAC;CAEJ,CAAA;AANY,yBAAyB;IADrC,SAAS,CAAC,qBAAqB,CAAC;GACpB,yBAAyB,CAMrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/processor/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processor-protocol.js","sourceRoot":"","sources":["../../../src/common/processor/processor-protocol.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RestOperations } from '@celljs/http';
|
|
2
|
+
import { ProxyCreator } from './proxy-protocol.js';
|
|
3
|
+
import { EndpointResolver } from '../endpoint/index.js';
|
|
4
|
+
import { ConnnectionFactory, JsonRpcProxy } from '../factory/index.js';
|
|
5
|
+
import { Channel } from '../channal/index.js';
|
|
6
|
+
import { ErrorConverter } from '../converter/index.js';
|
|
7
|
+
import { AxiosRequestConfig } from 'axios';
|
|
8
|
+
import { ClientConfigProcessor } from '../processor/index.js';
|
|
9
|
+
export declare class DelegatingHttpProxyCreator implements ProxyCreator {
|
|
10
|
+
protected connnectionFactory: ConnnectionFactory<Channel>;
|
|
11
|
+
protected endpointResolver: EndpointResolver;
|
|
12
|
+
protected restOperations: RestOperations;
|
|
13
|
+
protected clientConfigProcessor: ClientConfigProcessor;
|
|
14
|
+
protected readonly clientConfig: AxiosRequestConfig;
|
|
15
|
+
protected readonly maxCount: number;
|
|
16
|
+
protected readonly maxLength: number;
|
|
17
|
+
protected readonly timerDelay: number;
|
|
18
|
+
protected readonly enabled: boolean;
|
|
19
|
+
protected delegate: ProxyCreator;
|
|
20
|
+
protected init(): void;
|
|
21
|
+
create<T extends object>(path: string, errorConverters?: ErrorConverter[], target?: object | undefined): JsonRpcProxy<T>;
|
|
22
|
+
support(path: string): number;
|
|
23
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Component, Autowired, Value, PostConstruct } from '@celljs/core';
|
|
11
|
+
import { RestOperations } from '@celljs/http';
|
|
12
|
+
import { ProxyCreator } from './proxy-protocol.js';
|
|
13
|
+
import { EndpointResolver } from '../endpoint/index.js';
|
|
14
|
+
import { ConnnectionFactory } from '../factory/index.js';
|
|
15
|
+
import { ClientConfigProcessor } from '../processor/index.js';
|
|
16
|
+
import { HttpProxyCreator } from './http-proxy-creator.js';
|
|
17
|
+
let DelegatingHttpProxyCreator = class DelegatingHttpProxyCreator {
|
|
18
|
+
init() {
|
|
19
|
+
this.delegate = new HttpProxyCreator({
|
|
20
|
+
connnectionFactory: this.connnectionFactory,
|
|
21
|
+
endpointResolver: this.endpointResolver,
|
|
22
|
+
restOperations: this.restOperations,
|
|
23
|
+
clientConfigProcessor: this.clientConfigProcessor,
|
|
24
|
+
clientConfig: this.clientConfig,
|
|
25
|
+
merge: {
|
|
26
|
+
maxCount: this.maxCount,
|
|
27
|
+
maxLength: this.maxLength,
|
|
28
|
+
timerDelay: this.timerDelay,
|
|
29
|
+
enabled: this.enabled
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
create(path, errorConverters, target) {
|
|
34
|
+
return this.delegate.create(path, errorConverters, target);
|
|
35
|
+
}
|
|
36
|
+
support(path) {
|
|
37
|
+
return this.delegate.support(path);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
__decorate([
|
|
41
|
+
Autowired(ConnnectionFactory),
|
|
42
|
+
__metadata("design:type", Object)
|
|
43
|
+
], DelegatingHttpProxyCreator.prototype, "connnectionFactory", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
Autowired(EndpointResolver),
|
|
46
|
+
__metadata("design:type", Object)
|
|
47
|
+
], DelegatingHttpProxyCreator.prototype, "endpointResolver", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
Autowired(RestOperations),
|
|
50
|
+
__metadata("design:type", Function)
|
|
51
|
+
], DelegatingHttpProxyCreator.prototype, "restOperations", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
Autowired(ClientConfigProcessor),
|
|
54
|
+
__metadata("design:type", Object)
|
|
55
|
+
], DelegatingHttpProxyCreator.prototype, "clientConfigProcessor", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
Value('cell.rpc.client.config'),
|
|
58
|
+
__metadata("design:type", Object)
|
|
59
|
+
], DelegatingHttpProxyCreator.prototype, "clientConfig", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
Value('cell.rpc.merge.maxCount'),
|
|
62
|
+
__metadata("design:type", Number)
|
|
63
|
+
], DelegatingHttpProxyCreator.prototype, "maxCount", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
Value('cell.rpc.merge.maxLength'),
|
|
66
|
+
__metadata("design:type", Number)
|
|
67
|
+
], DelegatingHttpProxyCreator.prototype, "maxLength", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
Value('cell.rpc.merge.timerDelay'),
|
|
70
|
+
__metadata("design:type", Number)
|
|
71
|
+
], DelegatingHttpProxyCreator.prototype, "timerDelay", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
Value('cell.rpc.merge.enabled'),
|
|
74
|
+
__metadata("design:type", Boolean)
|
|
75
|
+
], DelegatingHttpProxyCreator.prototype, "enabled", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
PostConstruct(),
|
|
78
|
+
__metadata("design:type", Function),
|
|
79
|
+
__metadata("design:paramtypes", []),
|
|
80
|
+
__metadata("design:returntype", void 0)
|
|
81
|
+
], DelegatingHttpProxyCreator.prototype, "init", null);
|
|
82
|
+
DelegatingHttpProxyCreator = __decorate([
|
|
83
|
+
Component(ProxyCreator)
|
|
84
|
+
], DelegatingHttpProxyCreator);
|
|
85
|
+
export { DelegatingHttpProxyCreator };
|
|
86
|
+
//# sourceMappingURL=delegating-http-proxy-creator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegating-http-proxy-creator.js","sourceRoot":"","sources":["../../../src/common/proxy/delegating-http-proxy-creator.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAgB,MAAM,YAAY,CAAC;AAI9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,E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;2DACI;AAK1B;IADT,aAAa,EAAE;;;;sDAef;AA9CQ,0BAA0B;IADtC,SAAS,CAAC,YAAY,CAAC;GACX,0BAA0B,CAuDtC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { RestOperations } from '@celljs/http';
|
|
2
|
+
import { Logger } from 'vscode-jsonrpc';
|
|
3
|
+
import { ProxyCreator, ConnectionOptions, RequestTaskMeta } from './proxy-protocol.js';
|
|
4
|
+
import { EndpointResolver } from '../endpoint/index.js';
|
|
5
|
+
import { ConnnectionFactory, JsonRpcProxy } from '../factory/index.js';
|
|
6
|
+
import { Channel } from '../channal/index.js';
|
|
7
|
+
import { ErrorConverter } from '../converter/index.js';
|
|
8
|
+
import { ConnectionHandler } from '../handler/index.js';
|
|
9
|
+
import { AxiosRequestConfig } from 'axios';
|
|
10
|
+
import { ClientConfigProcessor } from '../processor/index.js';
|
|
11
|
+
export interface MergeOptions {
|
|
12
|
+
maxCount: number;
|
|
13
|
+
maxLength: number;
|
|
14
|
+
timerDelay: number;
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface HttpProxyCreatorOptions<T> {
|
|
18
|
+
connnectionFactory: ConnnectionFactory<Channel>;
|
|
19
|
+
endpointResolver: EndpointResolver;
|
|
20
|
+
restOperations: RestOperations;
|
|
21
|
+
clientConfigProcessor?: ClientConfigProcessor;
|
|
22
|
+
clientConfig: AxiosRequestConfig;
|
|
23
|
+
merge: T;
|
|
24
|
+
}
|
|
25
|
+
export declare class HttpProxyCreator implements ProxyCreator {
|
|
26
|
+
protected channelIdSeq: number;
|
|
27
|
+
protected requestMap: Map<string, RequestTaskMeta>;
|
|
28
|
+
protected channelMap: Map<number, Channel>;
|
|
29
|
+
protected options: HttpProxyCreatorOptions<MergeOptions>;
|
|
30
|
+
constructor(options: Partial<Omit<HttpProxyCreatorOptions<Partial<MergeOptions>>, 'endpointResolver'>> & Pick<HttpProxyCreatorOptions<Partial<MergeOptions>>, 'endpointResolver'>);
|
|
31
|
+
create<T extends object>(path: string, errorConverters?: ErrorConverter[], target?: object | undefined): JsonRpcProxy<T>;
|
|
32
|
+
support(path: string): number;
|
|
33
|
+
listen(handler: ConnectionHandler, options?: ConnectionOptions): void;
|
|
34
|
+
openChannel(path: string, handler: (channel: Channel) => void, options?: ConnectionOptions): void;
|
|
35
|
+
protected doOpenChannel(path: string, handler: (channel: Channel) => void, options?: ConnectionOptions): void;
|
|
36
|
+
protected createChannel(id: number, path: string): Channel;
|
|
37
|
+
protected executeTask(endpoint: string): Promise<void> | undefined;
|
|
38
|
+
protected canMerge(endpoint: string, content: string): boolean;
|
|
39
|
+
protected pushContent(endpoint: string, content: string): RequestTaskMeta;
|
|
40
|
+
protected createTask(endpoint: string): () => Promise<void>;
|
|
41
|
+
protected createLogger(): Logger;
|
|
42
|
+
}
|