@sera4/essentia 3.0.12 → 3.0.13

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.
Files changed (87) hide show
  1. package/package.json +9 -3
  2. package/package.tar.gz +0 -0
  3. package/scripts/publish.sh +46 -0
  4. package/dist/ts/cache/index.d.ts +0 -33
  5. package/dist/ts/cache/index.js +0 -171
  6. package/dist/ts/cache/index.js.map +0 -1
  7. package/dist/ts/configurations/server-config.d.ts +0 -4
  8. package/dist/ts/configurations/server-config.js +0 -2
  9. package/dist/ts/configurations/server-config.js.map +0 -1
  10. package/dist/ts/constants/index.d.ts +0 -7
  11. package/dist/ts/constants/index.js +0 -8
  12. package/dist/ts/constants/index.js.map +0 -1
  13. package/dist/ts/cycle/index.d.ts +0 -53
  14. package/dist/ts/cycle/index.js +0 -169
  15. package/dist/ts/cycle/index.js.map +0 -1
  16. package/dist/ts/dns/DnsCache.d.ts +0 -50
  17. package/dist/ts/dns/DnsCache.js +0 -137
  18. package/dist/ts/dns/DnsCache.js.map +0 -1
  19. package/dist/ts/dns/index.d.ts +0 -4
  20. package/dist/ts/dns/index.js +0 -4
  21. package/dist/ts/dns/index.js.map +0 -1
  22. package/dist/ts/formatter/index.d.ts +0 -44
  23. package/dist/ts/formatter/index.js +0 -76
  24. package/dist/ts/formatter/index.js.map +0 -1
  25. package/dist/ts/hal/index.d.ts +0 -26
  26. package/dist/ts/hal/index.js +0 -70
  27. package/dist/ts/hal/index.js.map +0 -1
  28. package/dist/ts/health/index.d.ts +0 -53
  29. package/dist/ts/health/index.js +0 -165
  30. package/dist/ts/health/index.js.map +0 -1
  31. package/dist/ts/helpers/index.d.ts +0 -1
  32. package/dist/ts/helpers/index.js +0 -2
  33. package/dist/ts/helpers/index.js.map +0 -1
  34. package/dist/ts/helpers/test-server-wrapper.d.ts +0 -56
  35. package/dist/ts/helpers/test-server-wrapper.js +0 -144
  36. package/dist/ts/helpers/test-server-wrapper.js.map +0 -1
  37. package/dist/ts/index.d.ts +0 -22
  38. package/dist/ts/index.js +0 -27
  39. package/dist/ts/index.js.map +0 -1
  40. package/dist/ts/last-commit/index.d.ts +0 -12
  41. package/dist/ts/last-commit/index.js +0 -82
  42. package/dist/ts/last-commit/index.js.map +0 -1
  43. package/dist/ts/logger/index.d.ts +0 -3
  44. package/dist/ts/logger/index.js +0 -4
  45. package/dist/ts/logger/index.js.map +0 -1
  46. package/dist/ts/logger/s4-logger.d.ts +0 -23
  47. package/dist/ts/logger/s4-logger.js +0 -105
  48. package/dist/ts/logger/s4-logger.js.map +0 -1
  49. package/dist/ts/paginator/index.d.ts +0 -2
  50. package/dist/ts/paginator/index.js +0 -3
  51. package/dist/ts/paginator/index.js.map +0 -1
  52. package/dist/ts/paginator/s4-pagination.d.ts +0 -26
  53. package/dist/ts/paginator/s4-pagination.js +0 -49
  54. package/dist/ts/paginator/s4-pagination.js.map +0 -1
  55. package/dist/ts/paginator/sql-pagination.d.ts +0 -52
  56. package/dist/ts/paginator/sql-pagination.js +0 -157
  57. package/dist/ts/paginator/sql-pagination.js.map +0 -1
  58. package/dist/ts/paper-trail/helpers.d.ts +0 -14
  59. package/dist/ts/paper-trail/helpers.js +0 -74
  60. package/dist/ts/paper-trail/helpers.js.map +0 -1
  61. package/dist/ts/paper-trail/index.d.ts +0 -54
  62. package/dist/ts/paper-trail/index.js +0 -236
  63. package/dist/ts/paper-trail/index.js.map +0 -1
  64. package/dist/ts/prompts/index.d.ts +0 -21
  65. package/dist/ts/prompts/index.js +0 -68
  66. package/dist/ts/prompts/index.js.map +0 -1
  67. package/dist/ts/queue/index.d.ts +0 -232
  68. package/dist/ts/queue/index.js +0 -451
  69. package/dist/ts/queue/index.js.map +0 -1
  70. package/dist/ts/queue/publisher.d.ts +0 -41
  71. package/dist/ts/queue/publisher.js +0 -84
  72. package/dist/ts/queue/publisher.js.map +0 -1
  73. package/dist/ts/queue/queue-logger.d.ts +0 -10
  74. package/dist/ts/queue/queue-logger.js +0 -35
  75. package/dist/ts/queue/queue-logger.js.map +0 -1
  76. package/dist/ts/queue/subscriber.d.ts +0 -55
  77. package/dist/ts/queue/subscriber.js +0 -98
  78. package/dist/ts/queue/subscriber.js.map +0 -1
  79. package/dist/ts/safe-proxy/index.d.ts +0 -35
  80. package/dist/ts/safe-proxy/index.js +0 -54
  81. package/dist/ts/safe-proxy/index.js.map +0 -1
  82. package/dist/ts/serializer/index.d.ts +0 -52
  83. package/dist/ts/serializer/index.js +0 -83
  84. package/dist/ts/serializer/index.js.map +0 -1
  85. package/dist/ts/utils/index.d.ts +0 -49
  86. package/dist/ts/utils/index.js +0 -157
  87. package/dist/ts/utils/index.js.map +0 -1
@@ -1,451 +0,0 @@
1
- import amqp from "amqplib/callback_api.js";
2
- import logger from "./queue-logger.js";
3
- import urlParse from "url-parse";
4
- import { Publisher } from "./publisher.js";
5
- import { Subscriber } from "./subscriber.js";
6
- /**
7
- * An interface to AMQP service
8
- */
9
- class S4Queue {
10
- constructor() {
11
- this.connection = null;
12
- this.connectionTestChannel = null;
13
- this.retry = 10;
14
- this.pubs = {};
15
- this.subs = {};
16
- this.fanouts = {};
17
- }
18
- /**
19
- * Tests the connection to the service.
20
- * Internally, the same connection is used for test
21
- * and production code, but a separate channel is opened.
22
- * Once the channel is obtained, there is an assert on the
23
- * existence of a topic exchange called '--health-check--'.
24
- * The following must be satisfied for the test to pass
25
- * 1. must be connected
26
- * 2. must have a test channel
27
- * 3. must assert the exchange
28
- */
29
- async testConnection() {
30
- if (!this.isConnected()) {
31
- this.connectionTestChannel = null;
32
- throw new Error("queue service not connected");
33
- }
34
- this.connectionTestChannel = this.connectionTestChannel || await this.connection.createChannel();
35
- if (!this.connectionTestChannel) {
36
- throw new Error("queue service failed to obtain a channel");
37
- }
38
- await this.connectionTestChannel.assertExchange("--health-check--", "topic", { durable: false });
39
- }
40
- /**
41
- * Opens a connection to AMQP server.
42
- * @param options Connection parameters. At the very least options.connectionUrl must be present.
43
- */
44
- async openConnection(options) {
45
- logger.setEnabled(options.logEnabled || false);
46
- if (this.connection) {
47
- logger.warn("Already initialized");
48
- return;
49
- }
50
- const retry = parseInt(options.retryInterval?.toString() || "10");
51
- this.retry = retry || 10;
52
- logger.debug("Attempting connection...");
53
- // The docs say there is amqp.connect returning
54
- // a promise, but this version doesn't seem to like
55
- // when a callback isn't provided, therefore run
56
- // in a new Promise
57
- return new Promise((resolve, reject) => {
58
- // We may run into issues with SNI TLS if
59
- // we host with 3rd parties using our own certs.
60
- // To avoid any issues, let's parse the url
61
- // and provide the server name in the socket options
62
- const urlParts = urlParse(options.connectionUrl);
63
- const socketOptions = { servername: urlParts.hostname };
64
- amqp.connect(options.connectionUrl, socketOptions, (err, conn) => {
65
- if (err) {
66
- logger.error("Error while connecting", err);
67
- logger.error("Attempting again in", this.retry, "seconds");
68
- return setTimeout(() => this.openConnection(options), this.retry * 1000);
69
- }
70
- this.connection = conn;
71
- if (!this.connection) {
72
- return reject(new Error("Failed to obtain connection"));
73
- }
74
- else {
75
- this.updatePubsAndSubsConnectionRef(conn);
76
- }
77
- this.connection.on("error", (err) => {
78
- logger.error("connection error", err);
79
- // Do not attempt to reconnect as the
80
- // 'close' event will also be emitted
81
- // if this error closes the connection
82
- });
83
- this.connection.on("close", (err) => {
84
- logger.error("connection closed");
85
- this.connection = null;
86
- if (err) {
87
- logger.error("connection closed due to error:", err);
88
- logger.error("Reconnecting in", this.retry, "seconds");
89
- setTimeout(() => this.openConnection(options), this.retry * 1000);
90
- }
91
- else {
92
- // If there was no error, it is us who closed
93
- // this connection, thus a reconnection will not
94
- // be attempted.
95
- logger.debug("Will not re-attempt");
96
- }
97
- });
98
- logger.debug("Connected");
99
- resolve();
100
- });
101
- });
102
- }
103
- /**
104
- * Closes the connection to AMQP server
105
- * and clears the registered publishers
106
- * and subscribers
107
- */
108
- async closeConnection() {
109
- return new Promise((resolve, reject) => {
110
- if (!this.connection) {
111
- return resolve();
112
- }
113
- this.connection.close((err) => {
114
- if (err) {
115
- reject(err);
116
- }
117
- else {
118
- this.subs = {};
119
- this.pubs = {};
120
- this.connection = null;
121
- resolve();
122
- }
123
- });
124
- });
125
- }
126
- /**
127
- * Returns whether we have an active connection
128
- * or not.
129
- */
130
- isConnected() {
131
- return this.connection != null && typeof (this.connection) != 'undefined';
132
- }
133
- /**
134
- * @deprecated Use registerPublisher
135
- * Registers a new direct publisher on the given exchange.
136
- * If exchange doesn't exist, one will be created.
137
- * @param exchange the name of the exchange on AMQP service.
138
- */
139
- async registerDirectPublisher(exchange) {
140
- return this.registerPublisher({ exchange: { name: exchange, type: "direct" } });
141
- }
142
- /**
143
- * @deprecated Use registerPublisher
144
- * Registers a new topic publisher on the given exchange.
145
- * If exchange doesn't exist, one will be created.
146
- * @param exchange the name of the exchange on AMQP service.
147
- */
148
- async registerTopicPublisher(exchange) {
149
- return this.registerPublisher({ exchange: { name: exchange, type: "topic" } });
150
- }
151
- /**
152
- * @deprecated Use registerPublisher
153
- * Registers a new fanout publisher on the given exchange.
154
- * If exchange doesn't exist, one will be created.
155
- * @param exchange the name of the exchange on AMQP service.
156
- */
157
- async registerFanoutPublisher(exchange) {
158
- return this.registerPublisher({ exchange: { name: exchange, type: "fanout" } });
159
- }
160
- /**
161
- * Registers a new publisher
162
- * @param options connection options.
163
- */
164
- async registerPublisher(options) {
165
- const { exchange } = options;
166
- const { name } = exchange;
167
- if (Object.keys(this.pubs).includes(name)) {
168
- throw new Error(`Publisher ${name} already registered`);
169
- }
170
- const p = new Publisher(exchange, name);
171
- await p.init(this.connection);
172
- this.pubs[name] = p;
173
- }
174
- /**
175
- * Checks whether or not a publisher with given parameters
176
- * has been registered already
177
- * @param exchange the name of the exchange.
178
- * @returns true if registered already, false otherwise
179
- */
180
- hasPublisher(exchange) {
181
- return Object.keys(this.pubs).includes(exchange);
182
- }
183
- /**
184
- * Checks whether or not a fanout with given exchange name
185
- * has been registered already
186
- * @param exchange the name of the exchange.
187
- * @returns true if registered already, false otherwise
188
- */
189
- hasFanout(exchange) {
190
- return Object.keys(this.fanouts).includes(exchange);
191
- }
192
- /**
193
- * Removes a previously registered publisher
194
- * @param options
195
- */
196
- async unregisterPublisher(options) {
197
- const { exchange } = options;
198
- const { name } = exchange;
199
- if (!Object.keys(this.pubs).includes(name)) {
200
- throw new Error(`Publisher ${name} not registered`);
201
- }
202
- const p = this.pubs[name];
203
- await p.closeChannel();
204
- delete this.pubs[name];
205
- logger.debug("Unregistered publisher", name);
206
- }
207
- /**
208
- * @deprecated Use registerSubscriber
209
- * Registers a new direct subscriber on a given exchange and queue.
210
- * If exchange and queue don't exists, they'll be created
211
- * and bound through the provided routing key.
212
- * @param exchange the name of the exchange.
213
- * @param queue the name of the queue.
214
- * @param key the name of the routing key.
215
- */
216
- async registerDirectSubscriber(exchange, queue, key) {
217
- const options = {
218
- key,
219
- exchange: { name: exchange, type: "direct" },
220
- queue: { name: queue }
221
- };
222
- return this.registerSubscriber(options);
223
- }
224
- /**
225
- * @deprecated Use registerSubscriber
226
- * Registers a new topic subscriber on a given exchange and queue.
227
- * If exchange and queue don't exists, they'll be created
228
- * and bound through the provided routing key.
229
- * @param exchange the name of the exchange.
230
- * @param queue the name of the queue.
231
- * @param key the name of the routing key.
232
- */
233
- async registerTopicSubscriber(exchange, queue, key) {
234
- const options = {
235
- key,
236
- exchange: { name: exchange, type: "topic" },
237
- queue: { name: queue }
238
- };
239
- return this.registerSubscriber(options);
240
- }
241
- /**
242
- * An overloaded version of registering a subscriber
243
- * allowing for more fine tuned parameters
244
- * @param options subscribing options
245
- */
246
- async registerSubscriber(options) {
247
- const { exchange, queue, key } = options;
248
- const name = `${exchange.name}-${queue.name}-${key}`;
249
- if (Object.keys(this.subs).includes(name)) {
250
- throw new Error(`Subscriber ${name} already registered`);
251
- }
252
- const s = new Subscriber(exchange, queue, key, name);
253
- await s.init(this.connection);
254
- this.subs[name] = s;
255
- }
256
- /**
257
- * Checks whether or not a subscriber with given parameters
258
- * has been registered already
259
- * @param exchange the name of the exchange.
260
- * @param queue the name of the queue.
261
- * @param key the name of the routing key.
262
- * @returns true if registered already, false otherwise
263
- */
264
- hasSubscriber(exchange, queue, key) {
265
- const name = `${exchange}-${queue}-${key}`;
266
- return Object.keys(this.subs).includes(name);
267
- }
268
- /**
269
- * Removes a previously registered subscriber
270
- * @param options
271
- */
272
- async unregisterSubscriber(options) {
273
- const { exchange, queue, key } = options;
274
- const name = `${exchange.name}-${queue.name}-${key}`;
275
- if (!Object.keys(this.subs).includes(name)) {
276
- throw new Error(`Subscriber ${name} not registered`);
277
- }
278
- const s = this.subs[name];
279
- await s.closeChannel();
280
- delete this.subs[name];
281
- logger.debug("Unregistered subscriber", name);
282
- }
283
- /**
284
- * Publishes a message on a given exchange with routing key.
285
- * @param exchange the name of the exchange.
286
- * @param key the name of the routing key.
287
- * @param msg a JSON object as the message.
288
- */
289
- async publishDirectMessage(exchange, key, msg) {
290
- return this.publishMessage(exchange, key, msg);
291
- }
292
- /**
293
- * Publishes a message on a given exchange with a topic.
294
- * @param exchange the name of the exchange.
295
- * @param topic the name of the topic.
296
- * @param msg a JSON object as the message.
297
- */
298
- async publishTopicMessage(exchange, topic, msg) {
299
- return this.publishMessage(exchange, topic, msg);
300
- }
301
- /**
302
- * Publish a message to the exchange
303
- * @param exchange name of exchange
304
- * @param key name of the key or topic
305
- * @param msg payload to be published
306
- */
307
- async publishMessage(exchange, key, msg) {
308
- if (!key) {
309
- throw new Error(`Key argument not defined`);
310
- }
311
- const p = this.pubs[exchange];
312
- if (!p) {
313
- throw new Error(`No PUB for ${exchange} found`);
314
- }
315
- let content = msg;
316
- if (content.constructor !== ({}).constructor) {
317
- // if not in JSON format, let's make it so
318
- content = {
319
- msg: msg
320
- };
321
- }
322
- return await p.publish({ key, content });
323
- }
324
- /**
325
- * Binds an exchange to a queue
326
- * @param exchange the name of the exchange.
327
- * @param queue the name of the queue.
328
- * @param pattern (optional) pattern for routing key
329
- */
330
- async bindQueueToExchange(exchange, queue, pattern) {
331
- const p = this.pubs[exchange];
332
- if (!p) {
333
- throw new Error(`No PUB for ${exchange} found`);
334
- }
335
- if (!queue) {
336
- throw new Error(`Binding a queue requires a queue name`);
337
- }
338
- return await p.bindQueue(queue, pattern || "");
339
- }
340
- /**
341
- * Adds a listener for a specific key.
342
- * If a subscriber that was registered was found
343
- * with that key, the listener is added, otherwise
344
- * it's ignored
345
- * @param key AMQP routing key
346
- * @param listener callback
347
- */
348
- addMessageListener(key, listener) {
349
- Object.keys(this.subs).forEach(k => {
350
- const s = this.subs[k];
351
- if (s.key === key) {
352
- s.registerCallback(listener);
353
- }
354
- });
355
- }
356
- /**
357
- * Registers a fanout exchange with multiple bound queues.
358
- * Creates the fanout exchange if it doesn't exist, then creates and binds
359
- * all specified queues to the exchange.
360
- * @param config Fanout configuration with exchange and queue definitions
361
- */
362
- async registerFanout(config) {
363
- const { exchange, queues } = config;
364
- logger.debug(`Registering fanout configuration for exchange: ${exchange.name}`);
365
- // First, register the fanout publisher (this creates the exchange)
366
- await this.registerPublisher({ exchange });
367
- // Then register subscribers for each queue
368
- for (const queueConfig of queues) {
369
- const subscriberOptions = {
370
- exchange,
371
- queue: {
372
- name: queueConfig.name,
373
- options: queueConfig.options
374
- },
375
- key: queueConfig.routingKey || "" // Fanout exchanges ignore routing keys, but we need it for the interface
376
- };
377
- await this.registerSubscriber(subscriberOptions);
378
- logger.debug(`Registered fanout subscriber for queue: ${queueConfig.name}${queueConfig.routingKey ? ` with routing key: ${queueConfig.routingKey}` : ' (no routing key - fanout ignores it)'}`);
379
- }
380
- // Store the fanout configuration
381
- this.fanouts[exchange.name] = config;
382
- logger.info(`Successfully registered fanout configuration with ${queues.length} queues`);
383
- }
384
- /**
385
- * Unregisters a fanout configuration by removing all associated subscribers
386
- * and optionally the publisher/exchange.
387
- * @param config Fanout configuration to unregister
388
- * @param removeExchange Whether to also remove the exchange (default: false)
389
- */
390
- async unregisterFanout(config, removeExchange = false) {
391
- const { exchange, queues } = config;
392
- logger.debug(`Unregistering fanout configuration for exchange: ${exchange.name}`);
393
- // Unregister all subscribers
394
- for (const queueConfig of queues) {
395
- const unregisterOptions = {
396
- exchange,
397
- queue: {
398
- name: queueConfig.name
399
- },
400
- key: queueConfig.routingKey || ""
401
- };
402
- try {
403
- await this.unregisterSubscriber(unregisterOptions);
404
- logger.debug(`Unregistered fanout subscriber for queue: ${queueConfig.name}${queueConfig.routingKey ? ` with routing key: ${queueConfig.routingKey}` : ' (no routing key)'}`);
405
- }
406
- catch (error) {
407
- logger.warn(`Failed to unregister subscriber for queue ${queueConfig.name}:`, error);
408
- }
409
- }
410
- // Optionally remove the exchange/publisher
411
- if (removeExchange) {
412
- try {
413
- await this.unregisterPublisher({ exchange });
414
- logger.debug(`Unregistered fanout publisher for exchange: ${exchange.name}`);
415
- }
416
- catch (error) {
417
- logger.warn(`Failed to unregister publisher for exchange ${exchange.name}:`, error);
418
- }
419
- }
420
- // Remove the fanout configuration from storage
421
- delete this.fanouts[exchange.name];
422
- logger.info(`Successfully unregistered fanout configuration`);
423
- }
424
- /**
425
- * Updates the connection reference to all the previously
426
- * registered publishers, subscribers, and fanouts.
427
- * After we successfully establish a connection and register pubs/subs/fanouts,
428
- * it's possible for the connection to break. This object will try
429
- * to re-establish a new connection every 3 seconds (or whatever configuration is set)
430
- * and if a new connection is established, we need to pass that connection to
431
- * all our pubs/subs, otherwise they'll be operating with old/stale references
432
- * @param connRef a new connection reference to the AMQP service
433
- */
434
- updatePubsAndSubsConnectionRef(connRef) {
435
- Object.keys(this.pubs).forEach(k => {
436
- logger.debug(`Updating publisher ${k} with a new connection object`);
437
- const p = this.pubs[k];
438
- p.init(connRef);
439
- });
440
- Object.keys(this.subs).forEach(k => {
441
- logger.debug(`Updating subscriber ${k} with a new connection object`);
442
- const s = this.subs[k];
443
- s.init(connRef);
444
- });
445
- // Note: Fanouts don't need connection updates as they use the same pubs/subs
446
- logger.debug(`Updated connection for ${Object.keys(this.pubs).length} publishers and ${Object.keys(this.subs).length} subscribers`);
447
- }
448
- }
449
- const queue = new S4Queue();
450
- export default queue;
451
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/queue/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,yBAAyB,CAAC;AAC3C,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAoD7C;;GAEG;AACH,MAAM,OAAO;IAQX;QACE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,cAAc;QAClB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;QACjG,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QAED,MAAM,IAAI,CAAC,qBAAqB,CAAC,cAAc,CAAC,kBAAkB,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IACnG,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,cAA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;AAED,MAAM,KAAK,GAAG,IAAI,OAAO,EAAE,CAAC;AAC5B,eAAe,KAAK,CAAC"}
@@ -1,41 +0,0 @@
1
- interface Exchange {
2
- name: string;
3
- type: string;
4
- options?: any;
5
- }
6
- interface PublishMessage {
7
- key: string;
8
- content: any;
9
- }
10
- /**
11
- * A publisher for AMQP service
12
- */
13
- export declare class Publisher {
14
- private exchange;
15
- private name;
16
- private channel;
17
- /**
18
- * @param exchange AMQP exchange configuration
19
- * @param name a name to identify this publisher in the logs
20
- */
21
- constructor(exchange: Exchange, name: string);
22
- /**
23
- * Initializes this publisher with a connection
24
- * and asserts the exchange exists
25
- * @param conn amqp connection object
26
- */
27
- init(conn: any): Promise<void>;
28
- /**
29
- * Publishes a message to AMQP
30
- * @param msg A json object to be published to AMQP.
31
- * A tracking uuid for the message will be returned.
32
- */
33
- publish(msg: PublishMessage): Promise<string>;
34
- /**
35
- * Closes the channel
36
- * @returns promise
37
- */
38
- closeChannel(): Promise<void>;
39
- bindQueue(queue: string, pattern: string, args?: any): Promise<void>;
40
- }
41
- export {};
@@ -1,84 +0,0 @@
1
- import logger from "./queue-logger.js";
2
- import { v4 as uuidv4 } from 'uuid';
3
- /**
4
- * A publisher for AMQP service
5
- */
6
- export class Publisher {
7
- /**
8
- * @param exchange AMQP exchange configuration
9
- * @param name a name to identify this publisher in the logs
10
- */
11
- constructor(exchange, name) {
12
- this.exchange = exchange;
13
- this.name = name;
14
- this.channel = null;
15
- }
16
- /**
17
- * Initializes this publisher with a connection
18
- * and asserts the exchange exists
19
- * @param conn amqp connection object
20
- */
21
- async init(conn) {
22
- logger.debug(`Initializing PUB channel for ${this.name}`);
23
- if (this.channel) {
24
- logger.warn(`PUB channel for ${this.name} already initialized`);
25
- return;
26
- }
27
- this.channel = await conn.createConfirmChannel();
28
- if (!this.channel) {
29
- throw new Error(`Cannot create PUB channel for ${this.name}`);
30
- }
31
- logger.debug(`Initialized PUB channel for ${this.name}`);
32
- const { name, type, options } = this.exchange;
33
- await this.channel.assertExchange(name, type, options);
34
- this.channel.on("error", (err) => {
35
- logger.debug(`Connection error for ${this.name}`, err);
36
- this.channel = null;
37
- });
38
- this.channel.on("close", () => {
39
- logger.debug(`Connection closed for ${this.name}`);
40
- this.channel = null;
41
- });
42
- }
43
- /**
44
- * Publishes a message to AMQP
45
- * @param msg A json object to be published to AMQP.
46
- * A tracking uuid for the message will be returned.
47
- */
48
- async publish(msg) {
49
- if (!this.channel) {
50
- throw new Error(`No channel for ${this.name} to publish`);
51
- }
52
- const parcel = {
53
- tracking_id: uuidv4(),
54
- timestamp: new Date(),
55
- data: msg.content
56
- };
57
- logger.debug("Publishing message");
58
- logger.debug("Key", msg.key);
59
- logger.debug("Data", parcel);
60
- const content = Buffer.from(JSON.stringify(parcel));
61
- const res = await this.channel.publish(this.exchange.name, msg.key, content, { persistent: true });
62
- if (!res) {
63
- throw new Error("Channel write buffer is full");
64
- }
65
- return parcel.tracking_id;
66
- }
67
- /**
68
- * Closes the channel
69
- * @returns promise
70
- */
71
- async closeChannel() {
72
- if (this.channel) {
73
- logger.debug("Closing publishing channel", this.name);
74
- return this.channel.close();
75
- }
76
- else {
77
- logger.error("Can't close a null publishing channel");
78
- }
79
- }
80
- async bindQueue(queue, pattern, args) {
81
- await this.channel.bindQueue(queue, this.exchange.name, pattern, args);
82
- }
83
- }
84
- //# sourceMappingURL=publisher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"publisher.js","sourceRoot":"","sources":["../../../ts/queue/publisher.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAmBpC;;GAEG;AACH,MAAM,OAAO,SAAS;IAKpB;;;OAGG;IACH,YAAY,QAAkB,EAAE,IAAY;QAC1C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAA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AC,SAAS,CAAC,KAAa,EAAE,OAAe,EAAE,IAAU;QACxD,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;CACF"}
@@ -1,10 +0,0 @@
1
- interface QueueLogger {
2
- debug(...args: any[]): void;
3
- log(...args: any[]): void;
4
- warn(...args: any[]): void;
5
- info(...args: any[]): void;
6
- error(...args: any[]): void;
7
- setEnabled(enabled: boolean): void;
8
- }
9
- declare const helpers: QueueLogger;
10
- export default helpers;
@@ -1,35 +0,0 @@
1
- import { S4Logger } from "../logger/s4-logger.js";
2
- const logger = new S4Logger();
3
- let enabled = false;
4
- const helpers = {
5
- debug(...args) {
6
- if (enabled) {
7
- logger.debug(":: AMQP ::", ...args);
8
- }
9
- },
10
- log(...args) {
11
- if (enabled) {
12
- logger.debug(":: AMQP ::", ...args);
13
- }
14
- },
15
- warn(...args) {
16
- if (enabled) {
17
- logger.warn(":: AMQP ::", ...args);
18
- }
19
- },
20
- info(...args) {
21
- if (enabled) {
22
- logger.info(":: AMQP ::", ...args);
23
- }
24
- },
25
- error(...args) {
26
- if (enabled) {
27
- logger.error(":: AMQP ::", ...args);
28
- }
29
- },
30
- setEnabled(e) {
31
- enabled = e;
32
- }
33
- };
34
- export default helpers;
35
- //# sourceMappingURL=queue-logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queue-logger.js","sourceRoot":"","sources":["../../../ts/queue/queue-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,MAAM,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;AAC9B,IAAI,OAAO,GAAG,KAAK,CAAC;AAWpB,MAAM,OAAO,GAAgB;IAC3B,KAAK,CAAC,GAAG,IAAW;QAClB,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,GAAG,CAAC,GAAG,IAAW;QAChB,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,IAAI,CAAC,GAAG,IAAW;QACjB,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED,IAAI,CAAC,GAAG,IAAW;QACjB,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,GAAG,IAAW;QAClB,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,UAAU,CAAC,CAAU;QACnB,OAAO,GAAG,CAAC,CAAC;IACd,CAAC;CACF,CAAC;AAEF,eAAe,OAAO,CAAC"}