@nanolink/mirrors 1.0.32 → 1.0.34
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/DelegateMap.js +37 -42
- package/dist/DelegateMap.js.map +1 -1
- package/dist/MirrorSync.js +111 -184
- package/dist/MirrorSync.js.map +1 -1
- package/dist/SubscriptionClient.js +102 -149
- package/dist/SubscriptionClient.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +52 -150
- package/dist/index.js.map +1 -1
- package/dist-compat/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
1
|
+
"use strict";
|
|
16
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -22,49 +8,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
22
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
9
|
});
|
|
24
10
|
};
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
-
function step(op) {
|
|
30
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
-
switch (op[0]) {
|
|
35
|
-
case 0: case 1: t = op; break;
|
|
36
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
-
default:
|
|
40
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
-
if (t[2]) _.ops.pop();
|
|
45
|
-
_.trys.pop(); continue;
|
|
46
|
-
}
|
|
47
|
-
op = body.call(thisArg, _);
|
|
48
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
-
}
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
13
|
};
|
|
52
|
-
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.SubscriptionClient = void 0;
|
|
16
|
+
const graphql_ws_1 = require("graphql-ws");
|
|
53
17
|
// Removed direct 'ws' import for browser compatibility; will resolve at runtime if needed.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
_this.hasEverConnected = false;
|
|
65
|
-
return _this;
|
|
18
|
+
const eventemitter3_1 = __importDefault(require("eventemitter3"));
|
|
19
|
+
class SubscriptionClient extends eventemitter3_1.default {
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
this.client = null;
|
|
23
|
+
this.connectAttempt = 0;
|
|
24
|
+
this.closedExplicitly = false;
|
|
25
|
+
this.reconnecting = false;
|
|
26
|
+
this.reconnectTimer = null;
|
|
27
|
+
this.hasEverConnected = false;
|
|
66
28
|
}
|
|
67
|
-
|
|
29
|
+
InitClient(opts) {
|
|
68
30
|
var _a, _b, _c, _d, _e;
|
|
69
31
|
this.options = {
|
|
70
32
|
url: opts.url,
|
|
@@ -76,8 +38,8 @@ var SubscriptionClient = /** @class */ (function (_super) {
|
|
|
76
38
|
webSocketImpl: (_e = opts.webSocketImpl) !== null && _e !== void 0 ? _e : undefined,
|
|
77
39
|
log: opts.log,
|
|
78
40
|
};
|
|
79
|
-
}
|
|
80
|
-
|
|
41
|
+
}
|
|
42
|
+
resolveWebSocketImpl() {
|
|
81
43
|
if (!this.options)
|
|
82
44
|
throw new Error('SubscriptionClient not initialized - call InitConnection first');
|
|
83
45
|
// Proxy-aware priority:
|
|
@@ -89,13 +51,13 @@ var SubscriptionClient = /** @class */ (function (_super) {
|
|
|
89
51
|
if (this.options.webSocketImpl)
|
|
90
52
|
return this.options.webSocketImpl;
|
|
91
53
|
if (process.env.BUILD_TARGET === 'browser') {
|
|
92
|
-
|
|
54
|
+
const g = globalThis;
|
|
93
55
|
if (typeof g.WebSocket === 'function')
|
|
94
56
|
return g.WebSocket;
|
|
95
57
|
throw new Error('No WebSocket implementation found in browser. Provide webSocketImpl.');
|
|
96
58
|
}
|
|
97
59
|
else {
|
|
98
|
-
|
|
60
|
+
const proxyEnv = process.env.ALL_PROXY || process.env.HTTPS_PROXY || process.env.HTTP_PROXY || process.env.GLOBAL_AGENT_HTTP_PROXY;
|
|
99
61
|
if (proxyEnv) {
|
|
100
62
|
try {
|
|
101
63
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
@@ -105,7 +67,7 @@ var SubscriptionClient = /** @class */ (function (_super) {
|
|
|
105
67
|
this.log('Proxy detected but failed to load ws package', e);
|
|
106
68
|
}
|
|
107
69
|
}
|
|
108
|
-
|
|
70
|
+
const g = globalThis;
|
|
109
71
|
if (typeof g.WebSocket === 'function')
|
|
110
72
|
return g.WebSocket;
|
|
111
73
|
try {
|
|
@@ -116,74 +78,72 @@ var SubscriptionClient = /** @class */ (function (_super) {
|
|
|
116
78
|
throw new Error('No WebSocket implementation found. Provide webSocketImpl in SubscriptionClientOptions.');
|
|
117
79
|
}
|
|
118
80
|
}
|
|
119
|
-
}
|
|
81
|
+
}
|
|
120
82
|
/** Returns true if an underlying websocket client exists (connected or in-flight). */
|
|
121
|
-
|
|
83
|
+
isConnected() {
|
|
122
84
|
return !!this.client; // createClientIfNeeded only after socket open attempt
|
|
123
|
-
}
|
|
124
|
-
|
|
85
|
+
}
|
|
86
|
+
log(msg, meta) {
|
|
125
87
|
var _a;
|
|
126
88
|
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.log)
|
|
127
89
|
this.options.log(msg, meta);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
var _this = this;
|
|
90
|
+
}
|
|
91
|
+
createClientIfNeeded(isReconnect) {
|
|
131
92
|
if (!this.options)
|
|
132
93
|
throw new Error('SubscriptionClient not initialized - call InitConnection first');
|
|
133
94
|
if (this.client)
|
|
134
95
|
return; // already have client
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
this.client = createClient({
|
|
138
|
-
url
|
|
139
|
-
connectionParams
|
|
96
|
+
const { url, connectionParams } = this.options;
|
|
97
|
+
const webSocketImpl = this.resolveWebSocketImpl();
|
|
98
|
+
this.client = (0, graphql_ws_1.createClient)({
|
|
99
|
+
url,
|
|
100
|
+
connectionParams,
|
|
140
101
|
webSocketImpl: webSocketImpl,
|
|
141
102
|
lazy: false,
|
|
142
103
|
keepAlive: 12000,
|
|
143
104
|
retryAttempts: 0,
|
|
144
|
-
shouldRetry:
|
|
105
|
+
shouldRetry: () => false,
|
|
145
106
|
on: {
|
|
146
|
-
connected:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if (wasReconnect &&
|
|
150
|
-
|
|
151
|
-
|
|
107
|
+
connected: () => {
|
|
108
|
+
const wasReconnect = isReconnect && this.connectAttempt > 0;
|
|
109
|
+
this.connectAttempt = 0;
|
|
110
|
+
if (wasReconnect && this.hasEverConnected) {
|
|
111
|
+
this.emit('reconnected');
|
|
112
|
+
this.log('reconnected');
|
|
152
113
|
}
|
|
153
114
|
else {
|
|
154
|
-
|
|
155
|
-
|
|
115
|
+
this.emit('connected');
|
|
116
|
+
this.log('connected');
|
|
156
117
|
}
|
|
157
|
-
|
|
118
|
+
this.hasEverConnected = true;
|
|
158
119
|
},
|
|
159
|
-
error:
|
|
160
|
-
|
|
161
|
-
|
|
120
|
+
error: (err) => {
|
|
121
|
+
this.emit('error', err);
|
|
122
|
+
this.log('socket error', err);
|
|
162
123
|
},
|
|
163
|
-
closed:
|
|
124
|
+
closed: (ev) => {
|
|
164
125
|
var _a, _b, _c, _d, _e;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
(_e =
|
|
169
|
-
|
|
170
|
-
if (!
|
|
171
|
-
|
|
126
|
+
const e = ev;
|
|
127
|
+
this.log('closed', e);
|
|
128
|
+
this.emit('disconnected', { code: e.code, reason: (_c = (_b = (_a = e.reason) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : '', wasClean: (_d = e.wasClean) !== null && _d !== void 0 ? _d : false });
|
|
129
|
+
(_e = this.client) === null || _e === void 0 ? void 0 : _e.dispose();
|
|
130
|
+
this.client = null; // allow recreate
|
|
131
|
+
if (!this.closedExplicitly)
|
|
132
|
+
this.scheduleReconnect();
|
|
172
133
|
},
|
|
173
134
|
},
|
|
174
135
|
});
|
|
175
|
-
}
|
|
136
|
+
}
|
|
176
137
|
// assureConnected removed per revert request
|
|
177
138
|
/** Establish the WebSocket connection if not already created. Idempotent. */
|
|
178
|
-
|
|
139
|
+
connect() {
|
|
179
140
|
if (this.client)
|
|
180
141
|
return; // already created
|
|
181
142
|
this.emit('connecting');
|
|
182
143
|
this.log('connecting');
|
|
183
144
|
this.createClientIfNeeded(false);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
var _this = this;
|
|
145
|
+
}
|
|
146
|
+
scheduleReconnect() {
|
|
187
147
|
if (!this.options)
|
|
188
148
|
throw new Error('SubscriptionClient not initialized - call InitConnection first');
|
|
189
149
|
if (this.reconnecting)
|
|
@@ -197,36 +157,36 @@ var SubscriptionClient = /** @class */ (function (_super) {
|
|
|
197
157
|
return;
|
|
198
158
|
}
|
|
199
159
|
this.reconnecting = true;
|
|
200
|
-
|
|
160
|
+
const delay = Math.min(this.options.retryDelayMs * Math.pow(2, this.connectAttempt), this.options.maxRetryDelayMs);
|
|
201
161
|
this.emit('retry', { attempt: this.connectAttempt });
|
|
202
|
-
this.log('reconnect scheduled', { attempt: this.connectAttempt, delay
|
|
162
|
+
this.log('reconnect scheduled', { attempt: this.connectAttempt, delay });
|
|
203
163
|
if (this.reconnectTimer)
|
|
204
164
|
clearTimeout(this.reconnectTimer);
|
|
205
|
-
this.reconnectTimer = setTimeout(
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
165
|
+
this.reconnectTimer = setTimeout(() => {
|
|
166
|
+
this.reconnecting = false;
|
|
167
|
+
this.connectAttempt++;
|
|
168
|
+
this.emit('connecting');
|
|
169
|
+
this.log('connecting');
|
|
170
|
+
this.createClientIfNeeded(true);
|
|
211
171
|
}, delay);
|
|
212
|
-
}
|
|
213
|
-
|
|
172
|
+
}
|
|
173
|
+
clientsubscribe(options, observer) {
|
|
214
174
|
var _a;
|
|
215
175
|
if (!this.options)
|
|
216
176
|
throw new Error('SubscriptionClient not initialized - call InitConnection first');
|
|
217
177
|
if (!this.client)
|
|
218
178
|
throw new Error('Client not connected - call connect() first');
|
|
219
|
-
|
|
179
|
+
const payload = {
|
|
220
180
|
query: options.query,
|
|
221
181
|
variables: options.variables,
|
|
222
182
|
operationName: options.operationName,
|
|
223
183
|
extensions: options.extensions,
|
|
224
184
|
};
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
185
|
+
let finished = false;
|
|
186
|
+
const timeoutMs = (_a = options.timeoutMs) !== null && _a !== void 0 ? _a : this.options.operationTimeoutMs;
|
|
187
|
+
let timeout;
|
|
228
188
|
if (timeoutMs > 0) {
|
|
229
|
-
timeout = setTimeout(
|
|
189
|
+
timeout = setTimeout(() => {
|
|
230
190
|
var _a;
|
|
231
191
|
if (finished)
|
|
232
192
|
return;
|
|
@@ -235,9 +195,9 @@ var SubscriptionClient = /** @class */ (function (_super) {
|
|
|
235
195
|
dispose();
|
|
236
196
|
}, timeoutMs);
|
|
237
197
|
}
|
|
238
|
-
|
|
239
|
-
next:
|
|
240
|
-
error:
|
|
198
|
+
const dispose = this.client.subscribe(payload, {
|
|
199
|
+
next: (data) => { var _a; return (_a = observer.next) === null || _a === void 0 ? void 0 : _a.call(observer, data); },
|
|
200
|
+
error: (err) => {
|
|
241
201
|
var _a;
|
|
242
202
|
if (finished)
|
|
243
203
|
return;
|
|
@@ -246,7 +206,7 @@ var SubscriptionClient = /** @class */ (function (_super) {
|
|
|
246
206
|
clearTimeout(timeout);
|
|
247
207
|
(_a = observer.error) === null || _a === void 0 ? void 0 : _a.call(observer, err);
|
|
248
208
|
},
|
|
249
|
-
complete:
|
|
209
|
+
complete: () => {
|
|
250
210
|
var _a;
|
|
251
211
|
if (finished)
|
|
252
212
|
return;
|
|
@@ -256,7 +216,7 @@ var SubscriptionClient = /** @class */ (function (_super) {
|
|
|
256
216
|
(_a = observer.complete) === null || _a === void 0 ? void 0 : _a.call(observer);
|
|
257
217
|
},
|
|
258
218
|
});
|
|
259
|
-
return
|
|
219
|
+
return () => {
|
|
260
220
|
if (finished)
|
|
261
221
|
return;
|
|
262
222
|
finished = true;
|
|
@@ -264,12 +224,12 @@ var SubscriptionClient = /** @class */ (function (_super) {
|
|
|
264
224
|
clearTimeout(timeout);
|
|
265
225
|
dispose();
|
|
266
226
|
};
|
|
267
|
-
}
|
|
227
|
+
}
|
|
268
228
|
/** Async iterator variant (convenience wrapper around underlying client.iterate). */
|
|
269
|
-
|
|
229
|
+
clientiterate(options) {
|
|
270
230
|
if (!this.client)
|
|
271
231
|
throw new Error('Client not connected - call connect() first');
|
|
272
|
-
|
|
232
|
+
const payload = {
|
|
273
233
|
query: options.query,
|
|
274
234
|
variables: options.variables,
|
|
275
235
|
operationName: options.operationName,
|
|
@@ -278,34 +238,27 @@ var SubscriptionClient = /** @class */ (function (_super) {
|
|
|
278
238
|
// graphql-ws client.iterate returns AsyncIterableExecutionResult
|
|
279
239
|
// We forward it directly (user can for-await over it).
|
|
280
240
|
return this.client.iterate(payload);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
return __awaiter(this, arguments, void 0, function (code, reason) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
if (
|
|
287
|
-
|
|
288
|
-
this.
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
c = this.client;
|
|
295
|
-
if (c) {
|
|
296
|
-
try {
|
|
297
|
-
c.dispose();
|
|
298
|
-
}
|
|
299
|
-
catch (_b) { }
|
|
241
|
+
}
|
|
242
|
+
close() {
|
|
243
|
+
return __awaiter(this, arguments, void 0, function* (code = 1000, reason = 'Normal Closure') {
|
|
244
|
+
this.closedExplicitly = true;
|
|
245
|
+
this.log('closing client');
|
|
246
|
+
if (this.reconnectTimer) {
|
|
247
|
+
clearTimeout(this.reconnectTimer);
|
|
248
|
+
this.reconnectTimer = null;
|
|
249
|
+
}
|
|
250
|
+
const c = this.client;
|
|
251
|
+
if (c) {
|
|
252
|
+
try {
|
|
253
|
+
c.dispose();
|
|
300
254
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
255
|
+
catch (_a) { }
|
|
256
|
+
}
|
|
257
|
+
this.client = null;
|
|
258
|
+
this.removeAllListeners();
|
|
305
259
|
});
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
export default SubscriptionClient;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
exports.SubscriptionClient = SubscriptionClient;
|
|
263
|
+
exports.default = SubscriptionClient;
|
|
311
264
|
//# sourceMappingURL=SubscriptionClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionClient.js","sourceRoot":"","sources":["../src/SubscriptionClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SubscriptionClient.js","sourceRoot":"","sources":["../src/SubscriptionClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAmF;AACnF,2FAA2F;AAC3F,kEAAyC;AAoDzC,MAAa,kBAAmB,SAAQ,uBAAY;IAShD;QACI,KAAK,EAAE,CAAC;QARJ,WAAM,GAAkB,IAAI,CAAC;QAC7B,mBAAc,GAAG,CAAC,CAAC;QACnB,qBAAgB,GAAG,KAAK,CAAC;QACzB,iBAAY,GAAG,KAAK,CAAC;QACrB,mBAAc,GAA0B,IAAI,CAAC;QAC7C,qBAAgB,GAAG,KAAK,CAAC;IAIjC,CAAC;IAC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;SACjC,CAAC;QACF,iEAAiE;QACjE,uDAAuD;QACvD,OAAQ,IAAI,CAAC,MAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAEK,KAAK;6DAAC,IAAI,GAAG,IAAI,EAAE,MAAM,GAAG,gBAAgB;YAC9C,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;YAC3B,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;gBACtB,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;gBAClC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;YAC/B,CAAC;YACD,MAAM,CAAC,GAAG,IAAI,CAAC,MAAa,CAAC;YAC7B,IAAI,CAAC,EAAE,CAAC;gBAAC,IAAI,CAAC;oBAAC,CAAC,CAAC,OAAO,EAAE,CAAC;gBAAC,CAAC;gBAAC,WAAM,CAAC,CAAC,CAAC;YAAC,CAAC;YACzC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACnB,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC9B,CAAC;KAAA;CACJ;AA1ND,gDA0NC;AAED,kBAAe,kBAAkB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,13 +3,13 @@ import { ReadonlyMapView, DelegatingObject } from "./DelegateMap";
|
|
|
3
3
|
import SubscriptionClient from "./SubscriptionClient";
|
|
4
4
|
export { SubscriptionClient, MirrorSync, DelegatingObject };
|
|
5
5
|
export type { ReadonlyMapView };
|
|
6
|
-
export declare class Connection extends SubscriptionClient {
|
|
7
|
-
Mirrors: Map<string,
|
|
6
|
+
export declare class Connection<T extends MirrorSync> extends SubscriptionClient {
|
|
7
|
+
Mirrors: Map<string, T>;
|
|
8
8
|
constructor();
|
|
9
9
|
InitConnection(url: string, connectionParams: () => Promise<Record<string, unknown> | Record<string, unknown>>): void;
|
|
10
|
-
registerMirror(name: string, subscription: string, baseVariables: Record<string, unknown>):
|
|
10
|
+
registerMirror(name: string, subscription: string, baseVariables: Record<string, unknown>): T;
|
|
11
11
|
getMirror(name: string, subscription: string, baseVariables: Record<string, unknown>): Promise<ReadonlyMapView<string, any>>;
|
|
12
|
-
createMirror(name: string, subscription: string, baseVariables: Record<string, unknown>):
|
|
12
|
+
createMirror(name: string, subscription: string, baseVariables: Record<string, unknown>): T;
|
|
13
13
|
removeMirror(name: string): void;
|
|
14
14
|
clearMirrors(): void;
|
|
15
15
|
}
|