@nats-io/services 3.0.0-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/LICENSE +201 -0
- package/README.md +139 -0
- package/build/src/internal_mod.ts +52 -0
- package/build/src/mod.ts +27 -0
- package/build/src/service.ts +712 -0
- package/build/src/serviceclient.ts +106 -0
- package/build/src/types.ts +300 -0
- package/lib/internal_mod.d.ts +10 -0
- package/lib/internal_mod.js +31 -0
- package/lib/internal_mod.js.map +1 -0
- package/lib/mod.d.ts +2 -0
- package/lib/mod.js +11 -0
- package/lib/mod.js.map +1 -0
- package/lib/service.d.ts +105 -0
- package/lib/service.js +554 -0
- package/lib/service.js.map +1 -0
- package/lib/serviceclient.d.ts +13 -0
- package/lib/serviceclient.js +71 -0
- package/lib/serviceclient.js.map +1 -0
- package/lib/types.d.ts +246 -0
- package/lib/types.js +38 -0
- package/lib/types.js.map +1 -0
- package/package.json +38 -0
package/lib/service.js
ADDED
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceImpl = exports.ServiceGroupImpl = exports.ServiceMsgImpl = exports.ServiceApiPrefix = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2022-2023 The NATS Authors
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
const internal_1 = require("@nats-io/nats-core/internal");
|
|
19
|
+
const types_1 = require("./types");
|
|
20
|
+
function validateName(context, name = "") {
|
|
21
|
+
if (name === "") {
|
|
22
|
+
throw Error(`${context} name required`);
|
|
23
|
+
}
|
|
24
|
+
const m = validName(name);
|
|
25
|
+
if (m.length) {
|
|
26
|
+
throw new Error(`invalid ${context} name - ${context} name ${m}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function validName(name = "") {
|
|
30
|
+
if (name === "") {
|
|
31
|
+
throw Error(`name required`);
|
|
32
|
+
}
|
|
33
|
+
const RE = /^[-\w]+$/g;
|
|
34
|
+
const m = name.match(RE);
|
|
35
|
+
if (m === null) {
|
|
36
|
+
for (const c of name.split("")) {
|
|
37
|
+
const mm = c.match(RE);
|
|
38
|
+
if (mm === null) {
|
|
39
|
+
return `cannot contain '${c}'`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return "";
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Services have common backplane subject pattern:
|
|
47
|
+
*
|
|
48
|
+
* `$SRV.PING|STATS|INFO` - pings or retrieves status for all services
|
|
49
|
+
* `$SRV.PING|STATS|INFO.<name>` - pings or retrieves status for all services having the specified name
|
|
50
|
+
* `$SRV.PING|STATS|INFO.<name>.<id>` - pings or retrieves status of a particular service
|
|
51
|
+
*
|
|
52
|
+
* Note that <name> and <id> are upper-cased.
|
|
53
|
+
*/
|
|
54
|
+
exports.ServiceApiPrefix = "$SRV";
|
|
55
|
+
class ServiceMsgImpl {
|
|
56
|
+
msg;
|
|
57
|
+
constructor(msg) {
|
|
58
|
+
this.msg = msg;
|
|
59
|
+
}
|
|
60
|
+
get data() {
|
|
61
|
+
return this.msg.data;
|
|
62
|
+
}
|
|
63
|
+
get sid() {
|
|
64
|
+
return this.msg.sid;
|
|
65
|
+
}
|
|
66
|
+
get subject() {
|
|
67
|
+
return this.msg.subject;
|
|
68
|
+
}
|
|
69
|
+
get reply() {
|
|
70
|
+
return this.msg.reply || "";
|
|
71
|
+
}
|
|
72
|
+
get headers() {
|
|
73
|
+
return this.msg.headers;
|
|
74
|
+
}
|
|
75
|
+
respond(data, opts) {
|
|
76
|
+
return this.msg.respond(data, opts);
|
|
77
|
+
}
|
|
78
|
+
respondError(code, description, data, opts) {
|
|
79
|
+
opts = opts || {};
|
|
80
|
+
opts.headers = opts.headers || (0, internal_1.headers)();
|
|
81
|
+
opts.headers?.set(types_1.ServiceErrorCodeHeader, `${code}`);
|
|
82
|
+
opts.headers?.set(types_1.ServiceErrorHeader, description);
|
|
83
|
+
return this.msg.respond(data, opts);
|
|
84
|
+
}
|
|
85
|
+
json(reviver) {
|
|
86
|
+
return this.msg.json(reviver);
|
|
87
|
+
}
|
|
88
|
+
string() {
|
|
89
|
+
return this.msg.string();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.ServiceMsgImpl = ServiceMsgImpl;
|
|
93
|
+
class ServiceGroupImpl {
|
|
94
|
+
subject;
|
|
95
|
+
queue;
|
|
96
|
+
srv;
|
|
97
|
+
constructor(parent, name = "", queue = "") {
|
|
98
|
+
if (name !== "") {
|
|
99
|
+
validInternalToken("service group", name);
|
|
100
|
+
}
|
|
101
|
+
let root = "";
|
|
102
|
+
if (parent instanceof ServiceImpl) {
|
|
103
|
+
this.srv = parent;
|
|
104
|
+
root = "";
|
|
105
|
+
}
|
|
106
|
+
else if (parent instanceof ServiceGroupImpl) {
|
|
107
|
+
const sg = parent;
|
|
108
|
+
this.srv = sg.srv;
|
|
109
|
+
if (queue === "" && sg.queue !== "") {
|
|
110
|
+
queue = sg.queue;
|
|
111
|
+
}
|
|
112
|
+
root = sg.subject;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
throw new Error("unknown ServiceGroup type");
|
|
116
|
+
}
|
|
117
|
+
this.subject = this.calcSubject(root, name);
|
|
118
|
+
this.queue = queue;
|
|
119
|
+
}
|
|
120
|
+
calcSubject(root, name = "") {
|
|
121
|
+
if (name === "") {
|
|
122
|
+
return root;
|
|
123
|
+
}
|
|
124
|
+
return root !== "" ? `${root}.${name}` : name;
|
|
125
|
+
}
|
|
126
|
+
addEndpoint(name = "", opts) {
|
|
127
|
+
opts = opts || { subject: name };
|
|
128
|
+
const args = typeof opts === "function"
|
|
129
|
+
? { handler: opts, subject: name }
|
|
130
|
+
: opts;
|
|
131
|
+
validateName("endpoint", name);
|
|
132
|
+
let { subject, handler, metadata, queue } = args;
|
|
133
|
+
subject = subject || name;
|
|
134
|
+
queue = queue || this.queue;
|
|
135
|
+
validSubjectName("endpoint subject", subject);
|
|
136
|
+
subject = this.calcSubject(this.subject, subject);
|
|
137
|
+
const ne = { name, subject, queue, handler, metadata };
|
|
138
|
+
return this.srv._addEndpoint(ne);
|
|
139
|
+
}
|
|
140
|
+
addGroup(name = "", queue = "") {
|
|
141
|
+
return new ServiceGroupImpl(this, name, queue);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
exports.ServiceGroupImpl = ServiceGroupImpl;
|
|
145
|
+
function validSubjectName(context, subj) {
|
|
146
|
+
if (subj === "") {
|
|
147
|
+
throw new Error(`${context} cannot be empty`);
|
|
148
|
+
}
|
|
149
|
+
if (subj.indexOf(" ") !== -1) {
|
|
150
|
+
throw new Error(`${context} cannot contain spaces: '${subj}'`);
|
|
151
|
+
}
|
|
152
|
+
const tokens = subj.split(".");
|
|
153
|
+
tokens.forEach((v, idx) => {
|
|
154
|
+
if (v === ">" && idx !== tokens.length - 1) {
|
|
155
|
+
throw new Error(`${context} cannot have internal '>': '${subj}'`);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function validInternalToken(context, subj) {
|
|
160
|
+
if (subj.indexOf(" ") !== -1) {
|
|
161
|
+
throw new Error(`${context} cannot contain spaces: '${subj}'`);
|
|
162
|
+
}
|
|
163
|
+
const tokens = subj.split(".");
|
|
164
|
+
tokens.forEach((v) => {
|
|
165
|
+
if (v === ">") {
|
|
166
|
+
throw new Error(`${context} name cannot contain internal '>': '${subj}'`);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
class ServiceImpl {
|
|
171
|
+
nc;
|
|
172
|
+
_id;
|
|
173
|
+
config;
|
|
174
|
+
handlers;
|
|
175
|
+
internal;
|
|
176
|
+
_stopped;
|
|
177
|
+
_done;
|
|
178
|
+
started;
|
|
179
|
+
/**
|
|
180
|
+
* @param verb
|
|
181
|
+
* @param name
|
|
182
|
+
* @param id
|
|
183
|
+
* @param prefix - this is only supplied by tooling when building control subject that crosses an account
|
|
184
|
+
*/
|
|
185
|
+
static controlSubject(verb, name = "", id = "", prefix) {
|
|
186
|
+
// the prefix is used as is, because it is an
|
|
187
|
+
// account boundary permission
|
|
188
|
+
const pre = prefix ?? exports.ServiceApiPrefix;
|
|
189
|
+
if (name === "" && id === "") {
|
|
190
|
+
return `${pre}.${verb}`;
|
|
191
|
+
}
|
|
192
|
+
validateName("control subject name", name);
|
|
193
|
+
if (id !== "") {
|
|
194
|
+
validateName("control subject id", id);
|
|
195
|
+
return `${pre}.${verb}.${name}.${id}`;
|
|
196
|
+
}
|
|
197
|
+
return `${pre}.${verb}.${name}`;
|
|
198
|
+
}
|
|
199
|
+
constructor(nc, config = { name: "", version: "" }) {
|
|
200
|
+
this.nc = nc;
|
|
201
|
+
this.config = Object.assign({}, config);
|
|
202
|
+
if (!this.config.queue) {
|
|
203
|
+
this.config.queue = "q";
|
|
204
|
+
}
|
|
205
|
+
// this will throw if no name
|
|
206
|
+
validateName("name", this.config.name);
|
|
207
|
+
validateName("queue", this.config.queue);
|
|
208
|
+
// this will throw if not semver
|
|
209
|
+
(0, internal_1.parseSemVer)(this.config.version);
|
|
210
|
+
this._id = internal_1.nuid.next();
|
|
211
|
+
this.internal = [];
|
|
212
|
+
this._done = (0, internal_1.deferred)();
|
|
213
|
+
this._stopped = false;
|
|
214
|
+
this.handlers = [];
|
|
215
|
+
this.started = new Date().toISOString();
|
|
216
|
+
// initialize the stats
|
|
217
|
+
this.reset();
|
|
218
|
+
// close if the connection closes
|
|
219
|
+
this.nc.closed()
|
|
220
|
+
.then(() => {
|
|
221
|
+
this.close().catch();
|
|
222
|
+
})
|
|
223
|
+
.catch((err) => {
|
|
224
|
+
this.close(err).catch();
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
get subjects() {
|
|
228
|
+
return this.handlers.filter((s) => {
|
|
229
|
+
return s.internal === false;
|
|
230
|
+
}).map((s) => {
|
|
231
|
+
return s.subject;
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
get id() {
|
|
235
|
+
return this._id;
|
|
236
|
+
}
|
|
237
|
+
get name() {
|
|
238
|
+
return this.config.name;
|
|
239
|
+
}
|
|
240
|
+
get description() {
|
|
241
|
+
return this.config.description ?? "";
|
|
242
|
+
}
|
|
243
|
+
get version() {
|
|
244
|
+
return this.config.version;
|
|
245
|
+
}
|
|
246
|
+
get metadata() {
|
|
247
|
+
return this.config.metadata;
|
|
248
|
+
}
|
|
249
|
+
errorToHeader(err) {
|
|
250
|
+
const h = (0, internal_1.headers)();
|
|
251
|
+
if (err instanceof types_1.ServiceError) {
|
|
252
|
+
const se = err;
|
|
253
|
+
h.set(types_1.ServiceErrorHeader, se.message);
|
|
254
|
+
h.set(types_1.ServiceErrorCodeHeader, `${se.code}`);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
h.set(types_1.ServiceErrorHeader, err.message);
|
|
258
|
+
h.set(types_1.ServiceErrorCodeHeader, "500");
|
|
259
|
+
}
|
|
260
|
+
return h;
|
|
261
|
+
}
|
|
262
|
+
setupHandler(h, internal = false) {
|
|
263
|
+
// internals don't use a queue
|
|
264
|
+
const queue = internal ? "" : (h.queue ? h.queue : this.config.queue);
|
|
265
|
+
const { name, subject, handler } = h;
|
|
266
|
+
const sv = h;
|
|
267
|
+
sv.internal = internal;
|
|
268
|
+
if (internal) {
|
|
269
|
+
this.internal.push(sv);
|
|
270
|
+
}
|
|
271
|
+
sv.stats = new NamedEndpointStatsImpl(name, subject, queue);
|
|
272
|
+
sv.queue = queue;
|
|
273
|
+
const callback = handler
|
|
274
|
+
? (err, msg) => {
|
|
275
|
+
if (err) {
|
|
276
|
+
this.close(err);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
const start = Date.now();
|
|
280
|
+
try {
|
|
281
|
+
handler(err, new ServiceMsgImpl(msg));
|
|
282
|
+
}
|
|
283
|
+
catch (err) {
|
|
284
|
+
sv.stats.countError(err);
|
|
285
|
+
msg?.respond(internal_1.Empty, { headers: this.errorToHeader(err) });
|
|
286
|
+
}
|
|
287
|
+
finally {
|
|
288
|
+
sv.stats.countLatency(start);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
: undefined;
|
|
292
|
+
sv.sub = this.nc.subscribe(subject, {
|
|
293
|
+
callback,
|
|
294
|
+
queue,
|
|
295
|
+
});
|
|
296
|
+
sv.sub.closed
|
|
297
|
+
.then(() => {
|
|
298
|
+
if (!this._stopped) {
|
|
299
|
+
this.close(new Error(`required subscription ${h.subject} stopped`))
|
|
300
|
+
.catch();
|
|
301
|
+
}
|
|
302
|
+
})
|
|
303
|
+
.catch((err) => {
|
|
304
|
+
if (!this._stopped) {
|
|
305
|
+
const ne = new Error(`required subscription ${h.subject} errored: ${err.message}`);
|
|
306
|
+
ne.stack = err.stack;
|
|
307
|
+
this.close(ne).catch();
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
return sv;
|
|
311
|
+
}
|
|
312
|
+
info() {
|
|
313
|
+
return {
|
|
314
|
+
type: types_1.ServiceResponseType.INFO,
|
|
315
|
+
name: this.name,
|
|
316
|
+
id: this.id,
|
|
317
|
+
version: this.version,
|
|
318
|
+
description: this.description,
|
|
319
|
+
metadata: this.metadata,
|
|
320
|
+
endpoints: this.endpoints(),
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
endpoints() {
|
|
324
|
+
return this.handlers.map((v) => {
|
|
325
|
+
const { subject, metadata, name, queue } = v;
|
|
326
|
+
return { subject, metadata, name, queue_group: queue };
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
async stats() {
|
|
330
|
+
const endpoints = [];
|
|
331
|
+
for (const h of this.handlers) {
|
|
332
|
+
if (typeof this.config.statsHandler === "function") {
|
|
333
|
+
try {
|
|
334
|
+
h.stats.data = await this.config.statsHandler(h);
|
|
335
|
+
}
|
|
336
|
+
catch (err) {
|
|
337
|
+
h.stats.countError(err);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
endpoints.push(h.stats.stats(h.qi));
|
|
341
|
+
}
|
|
342
|
+
return {
|
|
343
|
+
type: types_1.ServiceResponseType.STATS,
|
|
344
|
+
name: this.name,
|
|
345
|
+
id: this.id,
|
|
346
|
+
version: this.version,
|
|
347
|
+
started: this.started,
|
|
348
|
+
metadata: this.metadata,
|
|
349
|
+
endpoints,
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
addInternalHandler(verb, handler) {
|
|
353
|
+
const v = `${verb}`.toUpperCase();
|
|
354
|
+
this._doAddInternalHandler(`${v}-all`, verb, handler);
|
|
355
|
+
this._doAddInternalHandler(`${v}-kind`, verb, handler, this.name);
|
|
356
|
+
this._doAddInternalHandler(`${v}`, verb, handler, this.name, this.id);
|
|
357
|
+
}
|
|
358
|
+
_doAddInternalHandler(name, verb, handler, kind = "", id = "") {
|
|
359
|
+
const endpoint = {};
|
|
360
|
+
endpoint.name = name;
|
|
361
|
+
endpoint.subject = ServiceImpl.controlSubject(verb, kind, id);
|
|
362
|
+
endpoint.handler = handler;
|
|
363
|
+
this.setupHandler(endpoint, true);
|
|
364
|
+
}
|
|
365
|
+
start() {
|
|
366
|
+
const jc = (0, internal_1.JSONCodec)();
|
|
367
|
+
const statsHandler = (err, msg) => {
|
|
368
|
+
if (err) {
|
|
369
|
+
this.close(err);
|
|
370
|
+
return Promise.reject(err);
|
|
371
|
+
}
|
|
372
|
+
return this.stats().then((s) => {
|
|
373
|
+
msg?.respond(jc.encode(s));
|
|
374
|
+
return Promise.resolve();
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
const infoHandler = (err, msg) => {
|
|
378
|
+
if (err) {
|
|
379
|
+
this.close(err);
|
|
380
|
+
return Promise.reject(err);
|
|
381
|
+
}
|
|
382
|
+
msg?.respond(jc.encode(this.info()));
|
|
383
|
+
return Promise.resolve();
|
|
384
|
+
};
|
|
385
|
+
const ping = jc.encode(this.ping());
|
|
386
|
+
const pingHandler = (err, msg) => {
|
|
387
|
+
if (err) {
|
|
388
|
+
this.close(err).then().catch();
|
|
389
|
+
return Promise.reject(err);
|
|
390
|
+
}
|
|
391
|
+
msg.respond(ping);
|
|
392
|
+
return Promise.resolve();
|
|
393
|
+
};
|
|
394
|
+
this.addInternalHandler(types_1.ServiceVerb.PING, pingHandler);
|
|
395
|
+
this.addInternalHandler(types_1.ServiceVerb.STATS, statsHandler);
|
|
396
|
+
this.addInternalHandler(types_1.ServiceVerb.INFO, infoHandler);
|
|
397
|
+
// now the actual service
|
|
398
|
+
this.handlers.forEach((h) => {
|
|
399
|
+
const { subject } = h;
|
|
400
|
+
if (typeof subject !== "string") {
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
// this is expected in cases where main subject is just
|
|
404
|
+
// a root subject for multiple endpoints - user can disable
|
|
405
|
+
// listening to the root endpoint, by specifying null
|
|
406
|
+
if (h.handler === null) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
this.setupHandler(h);
|
|
410
|
+
});
|
|
411
|
+
return Promise.resolve(this);
|
|
412
|
+
}
|
|
413
|
+
close(err) {
|
|
414
|
+
if (this._stopped) {
|
|
415
|
+
return this._done;
|
|
416
|
+
}
|
|
417
|
+
this._stopped = true;
|
|
418
|
+
let buf = [];
|
|
419
|
+
if (!this.nc.isClosed()) {
|
|
420
|
+
buf = this.handlers.concat(this.internal).map((h) => {
|
|
421
|
+
return h.sub.drain();
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
Promise.allSettled(buf)
|
|
425
|
+
.then(() => {
|
|
426
|
+
this._done.resolve(err ? err : null);
|
|
427
|
+
});
|
|
428
|
+
return this._done;
|
|
429
|
+
}
|
|
430
|
+
get stopped() {
|
|
431
|
+
return this._done;
|
|
432
|
+
}
|
|
433
|
+
get isStopped() {
|
|
434
|
+
return this._stopped;
|
|
435
|
+
}
|
|
436
|
+
stop(err) {
|
|
437
|
+
return this.close(err);
|
|
438
|
+
}
|
|
439
|
+
ping() {
|
|
440
|
+
return {
|
|
441
|
+
type: types_1.ServiceResponseType.PING,
|
|
442
|
+
name: this.name,
|
|
443
|
+
id: this.id,
|
|
444
|
+
version: this.version,
|
|
445
|
+
metadata: this.metadata,
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
reset() {
|
|
449
|
+
// pretend we restarted
|
|
450
|
+
this.started = new Date().toISOString();
|
|
451
|
+
if (this.handlers) {
|
|
452
|
+
for (const h of this.handlers) {
|
|
453
|
+
h.stats.reset(h.qi);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
addGroup(name, queue) {
|
|
458
|
+
return new ServiceGroupImpl(this, name, queue);
|
|
459
|
+
}
|
|
460
|
+
addEndpoint(name, handler) {
|
|
461
|
+
const sg = new ServiceGroupImpl(this);
|
|
462
|
+
return sg.addEndpoint(name, handler);
|
|
463
|
+
}
|
|
464
|
+
_addEndpoint(e) {
|
|
465
|
+
const qi = new internal_1.QueuedIteratorImpl();
|
|
466
|
+
qi.noIterator = typeof e.handler === "function";
|
|
467
|
+
if (!qi.noIterator) {
|
|
468
|
+
e.handler = (err, msg) => {
|
|
469
|
+
err ? this.stop(err).catch() : qi.push(new ServiceMsgImpl(msg));
|
|
470
|
+
};
|
|
471
|
+
// close the service if the iterator closes
|
|
472
|
+
qi.iterClosed.then(() => {
|
|
473
|
+
this.close().catch();
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
// track the iterator for stats
|
|
477
|
+
const ss = this.setupHandler(e, false);
|
|
478
|
+
ss.qi = qi;
|
|
479
|
+
this.handlers.push(ss);
|
|
480
|
+
return qi;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
exports.ServiceImpl = ServiceImpl;
|
|
484
|
+
class NamedEndpointStatsImpl {
|
|
485
|
+
name;
|
|
486
|
+
subject;
|
|
487
|
+
average_processing_time;
|
|
488
|
+
num_requests;
|
|
489
|
+
processing_time;
|
|
490
|
+
num_errors;
|
|
491
|
+
last_error;
|
|
492
|
+
data;
|
|
493
|
+
metadata;
|
|
494
|
+
queue;
|
|
495
|
+
constructor(name, subject, queue = "") {
|
|
496
|
+
this.name = name;
|
|
497
|
+
this.subject = subject;
|
|
498
|
+
this.average_processing_time = 0;
|
|
499
|
+
this.num_errors = 0;
|
|
500
|
+
this.num_requests = 0;
|
|
501
|
+
this.processing_time = 0;
|
|
502
|
+
this.queue = queue;
|
|
503
|
+
}
|
|
504
|
+
reset(qi) {
|
|
505
|
+
this.num_requests = 0;
|
|
506
|
+
this.processing_time = 0;
|
|
507
|
+
this.average_processing_time = 0;
|
|
508
|
+
this.num_errors = 0;
|
|
509
|
+
this.last_error = undefined;
|
|
510
|
+
this.data = undefined;
|
|
511
|
+
const qii = qi;
|
|
512
|
+
if (qii) {
|
|
513
|
+
qii.time = 0;
|
|
514
|
+
qii.processed = 0;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
countLatency(start) {
|
|
518
|
+
this.num_requests++;
|
|
519
|
+
this.processing_time += (0, internal_1.nanos)(Date.now() - start);
|
|
520
|
+
this.average_processing_time = Math.round(this.processing_time / this.num_requests);
|
|
521
|
+
}
|
|
522
|
+
countError(err) {
|
|
523
|
+
this.num_errors++;
|
|
524
|
+
this.last_error = err.message;
|
|
525
|
+
}
|
|
526
|
+
_stats() {
|
|
527
|
+
const { name, subject, average_processing_time, num_errors, num_requests, processing_time, last_error, data, queue, } = this;
|
|
528
|
+
return {
|
|
529
|
+
name,
|
|
530
|
+
subject,
|
|
531
|
+
average_processing_time,
|
|
532
|
+
num_errors,
|
|
533
|
+
num_requests,
|
|
534
|
+
processing_time,
|
|
535
|
+
last_error,
|
|
536
|
+
data,
|
|
537
|
+
queue_group: queue,
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
stats(qi) {
|
|
541
|
+
const qii = qi;
|
|
542
|
+
if (qii?.noIterator === false) {
|
|
543
|
+
// grab stats in the iterator
|
|
544
|
+
this.processing_time = qii.time;
|
|
545
|
+
this.num_requests = qii.processed;
|
|
546
|
+
this.average_processing_time =
|
|
547
|
+
this.processing_time > 0 && this.num_requests > 0
|
|
548
|
+
? this.processing_time / this.num_requests
|
|
549
|
+
: 0;
|
|
550
|
+
}
|
|
551
|
+
return this._stats();
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../build/src/service.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACH,0DASqC;AAerC,mCAMiB;AAiBjB,SAAS,YAAY,CAAC,OAAe,EAAE,IAAI,GAAG,EAAE;IAC9C,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QAChB,MAAM,KAAK,CAAC,GAAG,OAAO,gBAAgB,CAAC,CAAC;IAC1C,CAAC;IACD,MAAM,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC1B,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,WAAW,OAAO,WAAW,OAAO,SAAS,CAAC,EAAE,CAAC,CAAC;IACpE,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAI,GAAG,EAAE;IAC1B,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QAChB,MAAM,KAAK,CAAC,eAAe,CAAC,CAAC;IAC/B,CAAC;IACD,MAAM,EAAE,GA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CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC;QAClD,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,KAAK,CACvC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,YAAY,CACzC,CAAC;IACJ,CAAC;IACD,UAAU,CAAC,GAAU;QACnB,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC;IAChC,CAAC;IAED,MAAM;QACJ,MAAM,EACJ,IAAI,EACJ,OAAO,EACP,uBAAuB,EACvB,UAAU,EACV,YAAY,EACZ,eAAe,EACf,UAAU,EACV,IAAI,EACJ,KAAK,GACN,GAAG,IAAI,CAAC;QACT,OAAO;YACL,IAAI;YACJ,OAAO;YACP,uBAAuB;YACvB,UAAU;YACV,YAAY;YACZ,eAAe;YACf,UAAU;YACV,IAAI;YACJ,WAAW,EAAE,KAAK;SACnB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,EAA4B;QAChC,MAAM,GAAG,GAAG,EAAiC,CAAC;QAC9C,IAAI,GAAG,EAAE,UAAU,KAAK,KAAK,EAAE,CAAC;YAC9B,6BAA6B;YAC7B,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC,IAAI,CAAC;YAChC,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,SAAS,CAAC;YAClC,IAAI,CAAC,uBAAuB;gBAC1B,IAAI,CAAC,eAAe,GAAG,CAAC,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC;oBAC/C,CAAC,CAAC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,YAAY;oBAC1C,CAAC,CAAC,CAAC,CAAC;QACV,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NatsConnection, QueuedIterator, RequestManyOptions } from "@nats-io/nats-core/internal";
|
|
2
|
+
import { ServiceVerb } from "./types";
|
|
3
|
+
import type { ServiceClient, ServiceIdentity, ServiceInfo, ServiceStats } from "./types";
|
|
4
|
+
export declare class ServiceClientImpl implements ServiceClient {
|
|
5
|
+
nc: NatsConnection;
|
|
6
|
+
prefix: string | undefined;
|
|
7
|
+
opts: RequestManyOptions;
|
|
8
|
+
constructor(nc: NatsConnection, opts?: RequestManyOptions, prefix?: string);
|
|
9
|
+
ping(name?: string, id?: string): Promise<QueuedIterator<ServiceIdentity>>;
|
|
10
|
+
stats(name?: string, id?: string): Promise<QueuedIterator<ServiceStats>>;
|
|
11
|
+
info(name?: string, id?: string): Promise<QueuedIterator<ServiceInfo>>;
|
|
12
|
+
q<T>(v: ServiceVerb, name?: string, id?: string): Promise<QueuedIterator<T>>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceClientImpl = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2022-2024 The NATS Authors
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
const internal_1 = require("@nats-io/nats-core/internal");
|
|
19
|
+
const service_1 = require("./service");
|
|
20
|
+
const types_1 = require("./types");
|
|
21
|
+
class ServiceClientImpl {
|
|
22
|
+
nc;
|
|
23
|
+
prefix;
|
|
24
|
+
opts;
|
|
25
|
+
constructor(nc, opts = {
|
|
26
|
+
strategy: internal_1.RequestStrategy.JitterTimer,
|
|
27
|
+
maxWait: 2000,
|
|
28
|
+
}, prefix) {
|
|
29
|
+
this.nc = nc;
|
|
30
|
+
this.prefix = prefix;
|
|
31
|
+
this.opts = opts;
|
|
32
|
+
}
|
|
33
|
+
ping(name = "", id = "") {
|
|
34
|
+
return this.q(types_1.ServiceVerb.PING, name, id);
|
|
35
|
+
}
|
|
36
|
+
stats(name = "", id = "") {
|
|
37
|
+
return this.q(types_1.ServiceVerb.STATS, name, id);
|
|
38
|
+
}
|
|
39
|
+
info(name = "", id = "") {
|
|
40
|
+
return this.q(types_1.ServiceVerb.INFO, name, id);
|
|
41
|
+
}
|
|
42
|
+
async q(v, name = "", id = "") {
|
|
43
|
+
const iter = new internal_1.QueuedIteratorImpl();
|
|
44
|
+
const jc = (0, internal_1.JSONCodec)();
|
|
45
|
+
const subj = service_1.ServiceImpl.controlSubject(v, name, id, this.prefix);
|
|
46
|
+
const responses = await this.nc.requestMany(subj, internal_1.Empty, this.opts);
|
|
47
|
+
(async () => {
|
|
48
|
+
for await (const m of responses) {
|
|
49
|
+
try {
|
|
50
|
+
const s = jc.decode(m.data);
|
|
51
|
+
iter.push(s);
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
// @ts-ignore: pushing fn
|
|
55
|
+
iter.push(() => {
|
|
56
|
+
iter.stop(err);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//@ts-ignore: push a fn
|
|
61
|
+
iter.push(() => {
|
|
62
|
+
iter.stop();
|
|
63
|
+
});
|
|
64
|
+
})().catch((err) => {
|
|
65
|
+
iter.stop(err);
|
|
66
|
+
});
|
|
67
|
+
return iter;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.ServiceClientImpl = ServiceClientImpl;
|
|
71
|
+
//# sourceMappingURL=serviceclient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceclient.js","sourceRoot":"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