rascal 13.1.3 → 14.2.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.
Files changed (69) hide show
  1. package/.prettierrc.json +4 -1
  2. package/CHANGELOG.md +23 -0
  3. package/README.md +200 -209
  4. package/examples/advanced/cluster.js +4 -4
  5. package/examples/advanced/config.js +45 -50
  6. package/examples/advanced/handlers/deleteUser.js +9 -16
  7. package/examples/advanced/handlers/saveUser.js +11 -18
  8. package/examples/advanced/index.js +81 -103
  9. package/examples/busy-publisher/config.json +40 -0
  10. package/examples/busy-publisher/index.js +14 -20
  11. package/examples/default-exchange/config.json +25 -0
  12. package/examples/default-exchange/index.js +10 -15
  13. package/examples/mocha/config.json +21 -0
  14. package/examples/mocha/test.js +16 -24
  15. package/examples/promises/config.json +27 -0
  16. package/examples/promises/index.js +9 -14
  17. package/examples/simple/config.json +37 -0
  18. package/examples/simple/index.js +11 -15
  19. package/index.js +6 -6
  20. package/lib/amqp/Broker.js +65 -95
  21. package/lib/amqp/BrokerAsPromised.js +7 -16
  22. package/lib/amqp/Publication.js +72 -212
  23. package/lib/amqp/PublicationSession.js +8 -8
  24. package/lib/amqp/SubscriberError.js +107 -233
  25. package/lib/amqp/SubscriberSession.js +56 -76
  26. package/lib/amqp/SubscriberSessionAsPromised.js +3 -3
  27. package/lib/amqp/Subscription.js +96 -313
  28. package/lib/amqp/Vhost.js +120 -265
  29. package/lib/amqp/tasks/applyBindings.js +12 -42
  30. package/lib/amqp/tasks/assertExchanges.js +6 -11
  31. package/lib/amqp/tasks/assertQueues.js +4 -4
  32. package/lib/amqp/tasks/assertVhost.js +6 -4
  33. package/lib/amqp/tasks/checkExchanges.js +4 -4
  34. package/lib/amqp/tasks/checkQueues.js +4 -4
  35. package/lib/amqp/tasks/checkVhost.js +6 -4
  36. package/lib/amqp/tasks/closeChannel.js +3 -3
  37. package/lib/amqp/tasks/closeConnection.js +3 -3
  38. package/lib/amqp/tasks/createChannel.js +3 -3
  39. package/lib/amqp/tasks/createConnection.js +38 -53
  40. package/lib/amqp/tasks/deleteExchanges.js +5 -5
  41. package/lib/amqp/tasks/deleteQueues.js +4 -4
  42. package/lib/amqp/tasks/deleteVhost.js +12 -16
  43. package/lib/amqp/tasks/index.js +25 -25
  44. package/lib/amqp/tasks/initCounters.js +5 -6
  45. package/lib/amqp/tasks/initPublications.js +4 -4
  46. package/lib/amqp/tasks/initShovels.js +15 -20
  47. package/lib/amqp/tasks/initSubscriptions.js +5 -11
  48. package/lib/amqp/tasks/initVhosts.js +8 -8
  49. package/lib/amqp/tasks/purgeQueues.js +4 -4
  50. package/lib/backoff/exponential.js +6 -8
  51. package/lib/backoff/index.js +2 -2
  52. package/lib/backoff/linear.js +3 -3
  53. package/lib/config/baseline.js +15 -16
  54. package/lib/config/configure.js +68 -193
  55. package/lib/config/fqn.js +3 -3
  56. package/lib/config/schema.json +686 -0
  57. package/lib/config/tests.js +3 -3
  58. package/lib/config/validate.js +87 -458
  59. package/lib/counters/inMemory.js +3 -3
  60. package/lib/counters/inMemoryCluster.js +16 -23
  61. package/lib/counters/index.js +3 -3
  62. package/lib/management/Client.js +55 -0
  63. package/package.json +2 -1
  64. package/examples/busy-publisher/config.js +0 -39
  65. package/examples/default-exchange/config.js +0 -24
  66. package/examples/mocha/config.js +0 -20
  67. package/examples/promises/config.js +0 -26
  68. package/examples/simple/config.js +0 -36
  69. package/lib/management/client.js +0 -90
@@ -0,0 +1,686 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "vhosts": {
6
+ "type": "object",
7
+ "patternProperties": {
8
+ ".*": {
9
+ "$ref": "#/definitions/vhost"
10
+ }
11
+ }
12
+ },
13
+ "publications": {
14
+ "type": "object",
15
+ "patternProperties": {
16
+ ".*": {
17
+ "$ref": "#/definitions/publication"
18
+ }
19
+ }
20
+ },
21
+ "subscriptions": {
22
+ "type": "object",
23
+ "patternProperties": {
24
+ ".*": {
25
+ "$ref": "#/definitions/subscription"
26
+ }
27
+ }
28
+ },
29
+ "redeliveries": {
30
+ "$ref": "#/definitions/redeliveries"
31
+ },
32
+ "encryption": {
33
+ "type": "object",
34
+ "patternProperties": {
35
+ ".*": {
36
+ "$ref": "#/definitions/encryption"
37
+ }
38
+ }
39
+ }
40
+ },
41
+ "definitions": {
42
+ "vhost": {
43
+ "type": "object",
44
+ "properties": {
45
+ "assert": {
46
+ "type": "boolean"
47
+ },
48
+ "check": {
49
+ "type": "boolean"
50
+ },
51
+ "connectionStrategy": {
52
+ "type": "string",
53
+ "enum": ["random", "fixed"]
54
+ },
55
+ "connection": {
56
+ "$ref": "#/definitions/connection"
57
+ },
58
+ "connections": {
59
+ "type": "array",
60
+ "items": {
61
+ "$ref": "#/definitions/connection"
62
+ }
63
+ },
64
+ "exchanges": {
65
+ "oneOf": [
66
+ {
67
+ "type": "array",
68
+ "items": {
69
+ "type": "string"
70
+ }
71
+ },
72
+ {
73
+ "type": "object",
74
+ "patternProperties": {
75
+ ".*": {
76
+ "$ref": "#/definitions/exchange"
77
+ }
78
+ }
79
+ }
80
+ ]
81
+ },
82
+ "queues": {
83
+ "oneOf": [
84
+ {
85
+ "type": "array",
86
+ "items": {
87
+ "type": "string"
88
+ }
89
+ },
90
+ {
91
+ "type": "object",
92
+ "patternProperties": {
93
+ ".*": {
94
+ "$ref": "#/definitions/queue"
95
+ }
96
+ }
97
+ }
98
+ ]
99
+ },
100
+ "bindings": {
101
+ "oneOf": [
102
+ {
103
+ "type": "array",
104
+ "items": {
105
+ "type": "string"
106
+ }
107
+ },
108
+ {
109
+ "type": "object",
110
+ "patternProperties": {
111
+ ".*": {
112
+ "$ref": "#/definitions/binding"
113
+ }
114
+ }
115
+ }
116
+ ]
117
+ },
118
+ "publications": {
119
+ "type": "object",
120
+ "patternProperties": {
121
+ ".*": {
122
+ "$ref": "#/definitions/publication"
123
+ }
124
+ }
125
+ },
126
+ "subscriptions": {
127
+ "type": "object",
128
+ "patternProperties": {
129
+ ".*": {
130
+ "$ref": "#/definitions/subscription"
131
+ }
132
+ }
133
+ },
134
+ "publicationChannelPools": {
135
+ "type": "object",
136
+ "properties": {
137
+ "regularPool": {
138
+ "$ref": "#/definitions/channelPool"
139
+ },
140
+ "confirmPool": {
141
+ "$ref": "#/definitions/channelPool"
142
+ }
143
+ }
144
+ }
145
+ }
146
+ },
147
+ "channelPool": {
148
+ "type": "object",
149
+ "properties": {
150
+ "autostart": {
151
+ "type": "boolean"
152
+ },
153
+ "max": {
154
+ "type": "integer",
155
+ "minimum": 0
156
+ },
157
+ "min": {
158
+ "type": "integer",
159
+ "minimum": 0
160
+ },
161
+ "evictionRunIntervalMillis": {
162
+ "type": "integer",
163
+ "minimum": 0
164
+ },
165
+ "idleTimeoutMillis": {
166
+ "type": "integer",
167
+ "minimum": 0
168
+ },
169
+ "rejectionDelayMillis": {
170
+ "type": "integer",
171
+ "minimum": 0
172
+ },
173
+ "testOnBorrow": {
174
+ "type": "boolean"
175
+ },
176
+ "acquireTimeoutMillis": {
177
+ "type": "integer",
178
+ "minimum": 0
179
+ },
180
+ "destroyTimeoutMillis": {
181
+ "type": "integer",
182
+ "minimum": 0
183
+ }
184
+ }
185
+ },
186
+ "connection": {
187
+ "anyOf": [
188
+ {
189
+ "type": "string"
190
+ },
191
+ {
192
+ "type": "object",
193
+ "properties": {
194
+ "url": {
195
+ "type": "string"
196
+ },
197
+ "options": {
198
+ "$ref": "#/definitions/connectOptions"
199
+ },
200
+ "socketOptions": {
201
+ "$ref": "#/definitions/socketOptions"
202
+ },
203
+ "retry": {
204
+ "$ref": "#/definitions/retry"
205
+ },
206
+ "management": {
207
+ "$ref": "#/definitions/management"
208
+ }
209
+ }
210
+ },
211
+ {
212
+ "type": "object",
213
+ "properties": {
214
+ "protocol": {
215
+ "type": "string",
216
+ "enum": ["amqp", "amqps"]
217
+ },
218
+ "hostname": {
219
+ "type": "string"
220
+ },
221
+ "user": {
222
+ "type": "string"
223
+ },
224
+ "password": {
225
+ "type": "string"
226
+ },
227
+ "port": {
228
+ "type": "integer",
229
+ "minimum": 1
230
+ },
231
+ "vhost": {
232
+ "type": "string"
233
+ },
234
+ "options": {
235
+ "$ref": "#/definitions/connectOptions"
236
+ },
237
+ "socketOptions": {
238
+ "type": "object"
239
+ },
240
+ "retry": {
241
+ "$ref": "#/definitions/retry"
242
+ },
243
+ "management": {
244
+ "$ref": "#/definitions/management"
245
+ }
246
+ }
247
+ }
248
+ ]
249
+ },
250
+ "connectOptions": {
251
+ "type": "object",
252
+ "properties": {
253
+ "frameMax": {
254
+ "type": "integer",
255
+ "minimum": 0
256
+ },
257
+ "heartbeat": {
258
+ "type": "integer",
259
+ "minimum": 0
260
+ },
261
+ "connection_timeout": {
262
+ "type": "integer",
263
+ "minimum": 0
264
+ },
265
+ "channelMax": {
266
+ "type": "integer",
267
+ "minimum": 0
268
+ }
269
+ }
270
+ },
271
+ "socketOptions": {
272
+ "type": "object",
273
+ "properties": {
274
+ "timeout": {
275
+ "type": "integer",
276
+ "minimum": 0
277
+ }
278
+ }
279
+ },
280
+ "management": {
281
+ "anyOf": [
282
+ {
283
+ "type": "object",
284
+ "properties": {
285
+ "url": {
286
+ "type": "string"
287
+ },
288
+ "options": {
289
+ "type": "object",
290
+ "properties": {
291
+ "timeout": {
292
+ "type": "integer",
293
+ "minimum": 0
294
+ }
295
+ }
296
+ }
297
+ }
298
+ },
299
+ {
300
+ "type": "object",
301
+ "properties": {
302
+ "protocol": {
303
+ "type": "string",
304
+ "enum": ["http", "https"]
305
+ },
306
+ "hostname": {
307
+ "type": "string"
308
+ },
309
+ "user": {
310
+ "type": "string"
311
+ },
312
+ "password": {
313
+ "type": "string"
314
+ },
315
+ "port": {
316
+ "type": "integer",
317
+ "minimum": 1
318
+ },
319
+ "options": {
320
+ "type": "object",
321
+ "properties": {
322
+ "timeout": {
323
+ "type": "integer",
324
+ "minimum": 0
325
+ }
326
+ }
327
+ }
328
+ }
329
+ }
330
+ ]
331
+ },
332
+ "exchange": {
333
+ "type": "object",
334
+ "properties": {
335
+ "name": {
336
+ "type": "string"
337
+ },
338
+ "assert": {
339
+ "type": "boolean"
340
+ },
341
+ "check": {
342
+ "type": "boolean"
343
+ },
344
+ "type": {
345
+ "type": "string"
346
+ },
347
+ "options": {
348
+ "type": "object",
349
+ "properties": {
350
+ "durable": {
351
+ "type": "boolean"
352
+ },
353
+ "internal": {
354
+ "type": "boolean"
355
+ },
356
+ "autoDelete": {
357
+ "type": "boolean"
358
+ },
359
+ "alternateExchange": {
360
+ "type": "string"
361
+ },
362
+ "expires": {
363
+ "type": "integer",
364
+ "minimum": 0
365
+ },
366
+ "arguments": {
367
+ "type": "object"
368
+ }
369
+ }
370
+ }
371
+ }
372
+ },
373
+ "queue": {
374
+ "type": "object",
375
+ "properties": {
376
+ "name": {
377
+ "type": "string"
378
+ },
379
+ "assert": {
380
+ "type": "boolean"
381
+ },
382
+ "check": {
383
+ "type": "boolean"
384
+ },
385
+ "type": {
386
+ "type": "string"
387
+ },
388
+ "purge": {
389
+ "type": "boolean"
390
+ },
391
+ "options": {
392
+ "type": "object",
393
+ "properties": {
394
+ "exclusive": {
395
+ "type": "boolean"
396
+ },
397
+ "durable": {
398
+ "type": "boolean"
399
+ },
400
+ "autoDelete": {
401
+ "type": "boolean"
402
+ },
403
+ "messageTtl": {
404
+ "type": "integer",
405
+ "minimum": 0
406
+ },
407
+ "expires": {
408
+ "type": "integer",
409
+ "minimum": 0
410
+ },
411
+ "deadLetterExchange": {
412
+ "type": "string"
413
+ },
414
+ "deadLetterRoutingKey": {
415
+ "type": "string"
416
+ },
417
+ "maxLength": {
418
+ "type": "integer",
419
+ "minimum": 0
420
+ },
421
+ "maxPriority": {
422
+ "type": "integer",
423
+ "minimum": 0
424
+ },
425
+ "arguments": {
426
+ "type": "object"
427
+ }
428
+ }
429
+ }
430
+ }
431
+ },
432
+ "binding": {
433
+ "type": "object",
434
+ "properties": {
435
+ "name": {
436
+ "type": "string"
437
+ },
438
+ "source": {
439
+ "type": "string"
440
+ },
441
+ "destination": {
442
+ "type": "string"
443
+ },
444
+ "destinationType": {
445
+ "type": "string",
446
+ "enum": ["queue", "exchange"]
447
+ },
448
+ "bindingKey": {
449
+ "type": "string"
450
+ },
451
+ "bindingKeys": {
452
+ "type": "array",
453
+ "items": {
454
+ "type": "string"
455
+ }
456
+ },
457
+ "qualifyBindingKeys": {
458
+ "type": "boolean"
459
+ },
460
+ "options": {
461
+ "type": "object"
462
+ }
463
+ }
464
+ },
465
+ "publication": {
466
+ "type": "object",
467
+ "properties": {
468
+ "name": {
469
+ "type": "string"
470
+ },
471
+ "vhost": {
472
+ "type": "string"
473
+ },
474
+ "exchange": {
475
+ "type": "string"
476
+ },
477
+ "queue": {
478
+ "type": "string"
479
+ },
480
+ "routingKey": {
481
+ "type": "string"
482
+ },
483
+ "confirm": {
484
+ "type": "boolean"
485
+ },
486
+ "timeout": {
487
+ "type": "integer",
488
+ "minimum": 0
489
+ },
490
+ "encryption": {
491
+ "type": "string"
492
+ },
493
+ "options": {
494
+ "type": "object",
495
+ "properties": {
496
+ "expiration": {
497
+ "type": "string"
498
+ },
499
+ "userId": {
500
+ "type": "string"
501
+ },
502
+ "CC": {
503
+ "oneOf": [
504
+ {
505
+ "type": "string"
506
+ },
507
+ {
508
+ "type": "array",
509
+ "items": {
510
+ "type": "string"
511
+ }
512
+ }
513
+ ]
514
+ },
515
+ "BCC": {
516
+ "oneOf": [
517
+ {
518
+ "type": "string"
519
+ },
520
+ {
521
+ "type": "array",
522
+ "items": {
523
+ "type": "string"
524
+ }
525
+ }
526
+ ]
527
+ },
528
+ "priority": {
529
+ "type": "integer",
530
+ "minimum": 0
531
+ },
532
+ "persistent": {
533
+ "type": "boolean"
534
+ },
535
+ "mandatory": {
536
+ "type": "boolean"
537
+ },
538
+ "contentType": {
539
+ "type": "string"
540
+ },
541
+ "contentEncoding": {
542
+ "type": "string"
543
+ },
544
+ "headers": {
545
+ "type": "object"
546
+ },
547
+ "replyTo": {
548
+ "type": "string"
549
+ },
550
+ "type": {
551
+ "type": "string"
552
+ },
553
+ "appId": {
554
+ "type": "string"
555
+ }
556
+ }
557
+ }
558
+ }
559
+ },
560
+ "subscription": {
561
+ "type": "object",
562
+ "properties": {
563
+ "name": {
564
+ "type": "string"
565
+ },
566
+ "vhost": {
567
+ "type": "string"
568
+ },
569
+ "queue": {
570
+ "type": "string"
571
+ },
572
+ "contentType": {
573
+ "type": "string"
574
+ },
575
+ "prefetch": {
576
+ "type": "integer",
577
+ "minimum": 0
578
+ },
579
+ "retry": {
580
+ "$ref": "#/definitions/retry"
581
+ },
582
+ "redeliveries": {
583
+ "properties": {
584
+ "limit": {
585
+ "type": "integer",
586
+ "minimum": 0
587
+ },
588
+ "timeout": {
589
+ "type": "integer",
590
+ "minimum": 0
591
+ },
592
+ "counter": {
593
+ "type": "string"
594
+ }
595
+ }
596
+ },
597
+ "closeTimeout": {
598
+ "type": "integer",
599
+ "minimum": 0
600
+ },
601
+ "encryption": {
602
+ "type": "string"
603
+ },
604
+ "promisifyAckOrNack": {
605
+ "type": "boolean"
606
+ },
607
+ "options": {
608
+ "type": "object",
609
+ "properties": {
610
+ "noAck": {
611
+ "type": "boolean"
612
+ },
613
+ "exclusive": {
614
+ "type": "boolean"
615
+ },
616
+ "priority": {
617
+ "type": "integer",
618
+ "minimum": 0
619
+ },
620
+ "arguments": {
621
+ "type": "object"
622
+ }
623
+ }
624
+ }
625
+ }
626
+ },
627
+ "shovel": {
628
+ "type": "object",
629
+ "properties": {
630
+ "name": {
631
+ "type": "string"
632
+ },
633
+ "subscription": {
634
+ "type": "string"
635
+ },
636
+ "publication": {
637
+ "type": "string"
638
+ }
639
+ }
640
+ },
641
+ "retry": {
642
+ "type": "object",
643
+ "properties": {
644
+ "min": {
645
+ "type": "integer",
646
+ "minimum": 0
647
+ },
648
+ "max": {
649
+ "type": "integer",
650
+ "minimum": 0
651
+ },
652
+ "factor": {
653
+ "type": "number",
654
+ "minimum": 0
655
+ },
656
+ "strategy": {
657
+ "type": "string",
658
+ "enum": ["exponential", "linear"]
659
+ }
660
+ }
661
+ },
662
+ "redeliveries": {
663
+ "type": "object",
664
+ "properties": {
665
+ "counters": {
666
+ "type": "object"
667
+ }
668
+ }
669
+ },
670
+ "encryption": {
671
+ "type": "object",
672
+ "properties": {
673
+ "key": {
674
+ "type": "string"
675
+ },
676
+ "algorithm": {
677
+ "type": "string"
678
+ },
679
+ "ivLength": {
680
+ "type": "integer",
681
+ "minimum": 1
682
+ }
683
+ }
684
+ }
685
+ }
686
+ }
@@ -1,5 +1,5 @@
1
- const _ = require("lodash").runInContext();
2
- const defaultConfig = require("./defaults");
1
+ const _ = require('lodash').runInContext();
2
+ const defaultConfig = require('./defaults');
3
3
 
4
4
  module.exports = _.defaultsDeep(
5
5
  {
@@ -29,7 +29,7 @@ module.exports = _.defaultsDeep(
29
29
  },
30
30
  },
31
31
  subscriptions: {
32
- deferCloseChannel: 100,
32
+ closeTimeout: 500,
33
33
  },
34
34
  },
35
35
  redeliveries: {