@types/rascal 10.0.2 → 10.0.5

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 (4) hide show
  1. rascal/LICENSE +0 -0
  2. rascal/README.md +1 -1
  3. rascal/index.d.ts +147 -124
  4. rascal/package.json +4 -3
rascal/LICENSE CHANGED
File without changes
rascal/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for rascal (https://guidesmiths.github.io
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/rascal.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Fri, 10 Jul 2020 14:16:15 GMT
11
+ * Last updated: Mon, 09 May 2022 20:31:35 GMT
12
12
  * Dependencies: [@types/amqplib](https://npmjs.com/package/@types/amqplib), [@types/node](https://npmjs.com/package/@types/node)
13
13
  * Global values: none
14
14
 
rascal/index.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  // MartinTechy <https://github.com/MartinTechy>
5
5
  // Nikita Volodin <https://github.com/qlonik>
6
6
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
- // TypeScript Version: 3.2
7
+ // TypeScript Version: 3.4
8
8
 
9
9
  /// <reference types="node" />
10
10
 
@@ -12,118 +12,122 @@ import { EventEmitter } from 'events';
12
12
  import { Message, Options, Connection, Channel } from 'amqplib';
13
13
 
14
14
  export interface BindingConfig {
15
- source?: string;
16
- destination?: string;
17
- destinationType?: 'queue' | 'exchange';
18
- bindingKey?: string;
19
- bindingKeys?: string[];
15
+ source?: string | undefined;
16
+ destination?: string | undefined;
17
+ destinationType?: 'queue' | 'exchange' | undefined;
18
+ bindingKey?: string | undefined;
19
+ bindingKeys?: string[] | undefined;
20
20
  options?: any;
21
21
  }
22
22
 
23
23
  export interface QueueConfig {
24
- assert?: boolean;
25
- check?: boolean;
26
- options?: Options.AssertQueue;
24
+ assert?: boolean | undefined;
25
+ check?: boolean | undefined;
26
+ options?: Options.AssertQueue | undefined;
27
27
  }
28
28
 
29
29
  export interface ExchangeConfig {
30
- assert?: boolean;
31
- check?: boolean;
32
- type?: 'direct' | 'fanout' | 'headers' | 'topic';
33
- options?: Options.AssertExchange;
30
+ assert?: boolean | undefined;
31
+ check?: boolean | undefined;
32
+ type?: 'direct' | 'fanout' | 'headers' | 'topic' | undefined;
33
+ options?: Options.AssertExchange | undefined;
34
34
  }
35
35
 
36
36
  export interface ConnectionAttributes {
37
- slashes?: boolean;
38
- protocol?: string;
39
- hostname?: string;
40
- user?: string;
41
- password?: string;
42
- port?: string | number;
43
- vhost?: string;
44
- auth?: string;
45
- pathname?: string;
46
- query?: string;
47
- url?: string;
48
- loggableUrl?: string;
37
+ slashes?: boolean | undefined;
38
+ protocol?: string | undefined;
39
+ hostname?: string | undefined;
40
+ user?: string | undefined;
41
+ password?: string | undefined;
42
+ port?: string | number | undefined;
43
+ vhost?: string | undefined;
44
+ auth?: string | undefined;
45
+ pathname?: string | undefined;
46
+ query?: string | undefined;
47
+ url?: string | undefined;
48
+ loggableUrl?: string | undefined;
49
49
  options?: {
50
- heartbeat?: number;
51
- timeout?: number;
52
- channelMax?: number;
53
- connection_timeout?: number;
50
+ heartbeat?: number | undefined;
51
+ timeout?: number | undefined;
52
+ channelMax?: number | undefined;
53
+ connection_timeout?: number | undefined;
54
54
  [key: string]: any;
55
- };
55
+ } | undefined;
56
56
  socketOptions?: {
57
- timeout?: number;
58
- };
57
+ timeout?: number | undefined;
58
+ clientProperties?: {
59
+ connection_name?: string | undefined;
60
+ [key: string]: string | undefined;
61
+ }
62
+ } | undefined;
59
63
  }
60
64
 
61
65
  export interface RetryConfig {
62
- factor?: number;
63
- max?: number;
64
- min?: number;
65
- strategy?: 'exponential' | 'linear';
66
- delay?: number;
66
+ factor?: number | undefined;
67
+ max?: number | undefined;
68
+ min?: number | undefined;
69
+ strategy?: 'exponential' | 'linear' | undefined;
70
+ delay?: number | undefined;
67
71
  }
68
72
 
69
73
  export interface ConnectionConfig extends ConnectionAttributes {
70
- retry?: RetryConfig;
71
- management?: ConnectionAttributes;
74
+ retry?: RetryConfig | undefined;
75
+ management?: ConnectionAttributes | undefined;
72
76
  }
73
77
 
74
78
  export interface ChannelPoolConfig {
75
- autostart?: boolean;
76
- evictionRunIntervalMillis?: number;
77
- idleTimeoutMillis?: number;
78
- max?: number;
79
- min?: number;
80
- testOnBorrow?: boolean;
79
+ autostart?: boolean | undefined;
80
+ evictionRunIntervalMillis?: number | undefined;
81
+ idleTimeoutMillis?: number | undefined;
82
+ max?: number | undefined;
83
+ min?: number | undefined;
84
+ testOnBorrow?: boolean | undefined;
81
85
  }
82
86
 
83
87
  export interface VhostConfig {
84
- check?: boolean;
85
- assert?: boolean;
86
- namespace?: string | boolean;
88
+ check?: boolean | undefined;
89
+ assert?: boolean | undefined;
90
+ namespace?: string | boolean | undefined;
87
91
  publicationChannelPools?: {
88
- regularPool?: ChannelPoolConfig;
89
- confirmPool?: ChannelPoolConfig;
90
- };
91
- connection?: ConnectionConfig;
92
- connections?: ConnectionConfig[];
93
- connectionStrategy?: 'random' | 'fixed';
92
+ regularPool?: ChannelPoolConfig | undefined;
93
+ confirmPool?: ChannelPoolConfig | undefined;
94
+ } | undefined;
95
+ connection?: ConnectionConfig | undefined;
96
+ connections?: ConnectionConfig[] | undefined;
97
+ connectionStrategy?: 'random' | 'fixed' | undefined;
94
98
  exchanges?:
95
99
  | {
96
100
  [key: string]: ExchangeConfig;
97
101
  }
98
- | string[];
102
+ | string[] | undefined;
99
103
  queues?:
100
104
  | {
101
105
  [key: string]: QueueConfig;
102
106
  }
103
- | string[];
107
+ | string[] | undefined;
104
108
  bindings?:
105
109
  | {
106
110
  [key: string]: BindingConfig;
107
111
  }
108
- | string[];
112
+ | string[] | undefined;
109
113
  publications?: {
110
114
  [key: string]: PublicationConfig;
111
- };
115
+ } | undefined;
112
116
  subscriptions?: {
113
117
  [key: string]: SubscriptionConfig;
114
- };
118
+ } | undefined;
115
119
  }
116
120
 
117
121
  export interface PublicationConfig {
118
- vhost?: string;
119
- exchange?: string;
120
- queue?: string;
121
- routingKey?: string;
122
- confirm?: boolean;
123
- options?: Options.Publish;
124
- autoCreated?: boolean;
125
- deprecated?: boolean;
126
- encryption?: string;
122
+ vhost?: string | undefined;
123
+ exchange?: string | undefined;
124
+ queue?: string | undefined;
125
+ routingKey?: string | undefined;
126
+ confirm?: boolean | undefined;
127
+ options?: Options.Publish | undefined;
128
+ autoCreated?: boolean | undefined;
129
+ deprecated?: boolean | undefined;
130
+ encryption?: string | undefined;
127
131
  }
128
132
 
129
133
  export interface Encryption {
@@ -136,60 +140,60 @@ export interface Redelivery {
136
140
  counters?: {
137
141
  [key: string]: {
138
142
  type: 'stub' | 'inMemory' | 'inMemoryCluster';
139
- size?: number;
143
+ size?: number | undefined;
140
144
  };
141
- };
145
+ } | undefined;
142
146
  }
143
147
 
144
148
  export interface Recovery {
145
149
  strategy: 'ack' | 'nack' | 'republish' | 'forward';
146
- defer?: number;
147
- attempts?: number;
148
- requeue?: boolean;
149
- publication?: string;
150
- options?: PublicationConfig;
151
- xDeathFix?: boolean;
152
- immediateNack?: boolean;
150
+ defer?: number | undefined;
151
+ attempts?: number | undefined;
152
+ requeue?: boolean | undefined;
153
+ publication?: string | undefined;
154
+ options?: PublicationConfig | undefined;
155
+ xDeathFix?: boolean | undefined;
156
+ immediateNack?: boolean | undefined;
153
157
  }
154
158
 
155
159
  export interface SubscriptionConfig {
156
- vhost?: string;
157
- queue?: string;
158
- contentType?: string;
159
- options?: Options.Consume;
160
- prefetch?: number;
161
- retry?: RetryConfig | boolean;
162
- handler?: string;
163
- handlers?: string[];
160
+ vhost?: string | undefined;
161
+ queue?: string | undefined;
162
+ contentType?: string | undefined;
163
+ options?: Options.Consume | undefined;
164
+ prefetch?: number | undefined;
165
+ retry?: RetryConfig | boolean | undefined;
166
+ handler?: string | undefined;
167
+ handlers?: string[] | undefined;
164
168
  recovery?: any;
165
- deferCloseChannel?: number;
166
- encryption?: string;
167
- autoCreated?: boolean;
169
+ deferCloseChannel?: number | undefined;
170
+ encryption?: string | undefined;
171
+ autoCreated?: boolean | undefined;
168
172
  redeliveries?: {
169
173
  counter: string;
170
174
  limit: number;
171
- timeout?: number;
172
- };
175
+ timeout?: number | undefined;
176
+ } | undefined;
173
177
  }
174
178
 
175
179
  interface BrokerConfig {
176
180
  vhosts?: {
177
181
  [key: string]: VhostConfig;
178
- };
182
+ } | undefined;
179
183
  publications?: {
180
184
  [key: string]: PublicationConfig;
181
- };
185
+ } | undefined;
182
186
  subscriptions?: {
183
187
  [key: string]: SubscriptionConfig;
184
- };
185
- redeliveries?: Redelivery;
188
+ } | undefined;
189
+ redeliveries?: Redelivery | undefined;
186
190
  recovery?: {
187
191
  [key: string]: Recovery | Recovery[];
188
- };
189
- defaults?: VhostConfig;
192
+ } | undefined;
193
+ defaults?: VhostConfig | undefined;
190
194
  encryption?: {
191
195
  [key: string]: Encryption;
192
- };
196
+ } | undefined;
193
197
  }
194
198
 
195
199
  declare const defaultConfig: {
@@ -408,14 +412,14 @@ declare const testConfig: {
408
412
 
409
413
  type AckOrNack = (err?: Error, recovery?: Recovery | Recovery[]) => void;
410
414
 
411
- export class SubscriptionSession extends EventEmitter {
415
+ export class SubscriberSessionAsPromised extends EventEmitter {
412
416
  name: string;
413
- isCancelled(): boolean;
414
417
  cancel(): Promise<void>;
418
+
415
419
  on(event: 'message', listener: (message: Message, content: any, ackOrNackFn: AckOrNack) => void): this;
416
420
  on(event: 'error' | 'cancelled', listener: (err: Error) => void): this;
417
421
  on(
418
- event: 'invalid_content' | 'redeliveries_exceeded' | 'redeliveries_error' | 'redeliveries_error',
422
+ event: 'invalid_content' | 'redeliveries_exceeded' | 'redeliveries_error',
419
423
  listener: (err: Error, message: Message, ackOrNackFn: AckOrNack) => void,
420
424
  ): this;
421
425
  }
@@ -432,42 +436,56 @@ declare class BrokerAsPromised extends EventEmitter {
432
436
  publish(name: string, message: any, overrides?: PublicationConfig | string): Promise<PublicationSession>;
433
437
  forward(name: string, message: any, overrides?: PublicationConfig | string): Promise<PublicationSession>;
434
438
  unsubscribeAll(): Promise<void>;
435
- subscribe(name: string, overrides?: SubscriptionConfig): Promise<SubscriptionSession>;
436
- subscribeAll(filter?: string): Promise<SubscriptionSession[]>;
439
+ subscribe(name: string, overrides?: SubscriptionConfig): Promise<SubscriberSessionAsPromised>;
440
+ subscribeAll(filter?: (config: SubscriptionConfig) => boolean): Promise<SubscriberSessionAsPromised[]>;
437
441
  }
438
442
 
443
+ export class SubscriptionSession extends EventEmitter {
444
+ name: string;
445
+ isCancelled(): boolean;
446
+ cancel(next: ErrorCb): void;
447
+
448
+ on(event: 'message', listener: (message: Message, content: any, ackOrNackFn: AckOrNack) => void): this;
449
+ on(event: 'error' | 'cancelled', listener: (err: Error) => void): this;
450
+ on(
451
+ event: 'invalid_content' | 'redeliveries_exceeded' | 'redeliveries_error',
452
+ listener: (err: Error, message: Message, ackOrNackFn: AckOrNack) => void,
453
+ ): this;
454
+ }
455
+
456
+ type Cb<E, A> = (...x: [E, never] | [null, A]) => void;
457
+ type ErrorCb = (x: Error | null) => void;
458
+ type CreateCb = (...x: [Error, Broker] | [null, Broker]) => void;
459
+ type ConnectCb = (...x: [Error, null] | [Error, Connection] | [null, Connection]) => void;
460
+
439
461
  declare class Broker extends EventEmitter {
440
462
  readonly config: BrokerConfig;
441
- static create(config: BrokerConfig, next: (err: Error, broker: Broker) => void): any;
442
- static create(config: BrokerConfig, components: any, next: (err?: Error, broker?: Broker) => void): any;
443
- connect(name: string, next: (err?: Error, connection?: Connection) => void): void;
444
- nuke(next: (err?: Error) => void): void;
445
- purge(next: (err?: Error) => void): void;
446
- shutdown(next: (err?: Error) => void): void;
447
- bounce(next: (err?: Error) => void): void;
448
- publish(name: string, message: any, next: (err: Error, publication: PublicationSession) => void): void;
463
+ static create(config: BrokerConfig, next: CreateCb): void;
464
+ static create(config: BrokerConfig, components: unknown, next: CreateCb): void;
465
+ connect(name: string, next: ConnectCb): void;
466
+ nuke(next: ErrorCb): void;
467
+ purge(next: ErrorCb): void;
468
+ shutdown(next: ErrorCb): void;
469
+ bounce(next: ErrorCb): void;
470
+ publish(name: string, message: any, next: Cb<Error, PublicationSession>): void;
449
471
  publish(
450
472
  name: string,
451
473
  message: any,
452
474
  overrides: PublicationConfig | string,
453
- next: (err: Error, publication: PublicationSession) => void,
475
+ next: Cb<Error, PublicationSession>,
454
476
  ): void;
455
- forward(name: string, message: any, next: (err: Error, publication: PublicationSession) => void): void;
477
+ forward(name: string, message: any, next: Cb<Error, PublicationSession>): void;
456
478
  forward(
457
479
  name: string,
458
480
  message: any,
459
481
  overrides: PublicationConfig | string,
460
- next: (err: Error, publication: PublicationSession) => void,
461
- ): void;
462
- subscribe(name: string, next: (err: Error, subscription: SubscriptionSession) => void): void;
463
- subscribe(
464
- name: string,
465
- overrides: SubscriptionConfig | string,
466
- next: (err: Error, subscription: SubscriptionSession) => void,
482
+ next: Cb<Error, PublicationSession>,
467
483
  ): void;
468
- subscribeAll(next: (err: Error, results: SubscriptionSession[]) => void): void;
469
- subscribeAll(filter: string, next?: (err: Error, results: SubscriptionSession[]) => void): void;
470
- unsubscribeAll(next: (err?: Error) => void): void;
484
+ subscribe(name: string, next: Cb<Error, SubscriptionSession>): void;
485
+ subscribe(name: string, overrides: SubscriptionConfig | string, next: Cb<Error, SubscriptionSession>): void;
486
+ subscribeAll(next: Cb<Error, SubscriptionSession[]>): void;
487
+ subscribeAll(filter: (config: SubscriptionConfig) => boolean, next: Cb<Error, SubscriptionSession[]>): void;
488
+ unsubscribeAll(next: ErrorCb): void;
471
489
  }
472
490
 
473
491
  export class PublicationSession extends EventEmitter {
@@ -475,6 +493,10 @@ export class PublicationSession extends EventEmitter {
475
493
  abort(): void;
476
494
  isAborted(): boolean;
477
495
  emitPaused(): void;
496
+
497
+ on(event: 'error', cb: (err: Error, messageId: string) => void): this;
498
+ on(event: 'success', cb: (messageId: string) => void): this;
499
+ on(event: 'return', cb: (message: Message) => void): this;
478
500
  }
479
501
 
480
502
  export class Vhost extends EventEmitter {
@@ -497,9 +519,10 @@ export class Vhost extends EventEmitter {
497
519
  isPaused(): boolean;
498
520
  }
499
521
 
500
- declare function createBroker(config: BrokerConfig, components: any, next: any, ...args: any[]): any;
522
+ declare function createBroker(config: BrokerConfig, next: CreateCb): void;
523
+ declare function createBroker(config: BrokerConfig, components: unknown, next: CreateCb): void;
501
524
 
502
- declare function createBrokerAsPromised(config: BrokerConfig, components: any): Promise<BrokerAsPromised>;
525
+ declare function createBrokerAsPromised(config: BrokerConfig, components?: unknown): Promise<BrokerAsPromised>;
503
526
 
504
527
  declare function withDefaultConfig(config: BrokerConfig): BrokerConfig;
505
528
 
rascal/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@types/rascal",
3
- "version": "10.0.2",
3
+ "version": "10.0.5",
4
4
  "description": "TypeScript definitions for rascal",
5
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/rascal",
5
6
  "license": "MIT",
6
7
  "contributors": [
7
8
  {
@@ -32,6 +33,6 @@
32
33
  "@types/amqplib": "*",
33
34
  "@types/node": "*"
34
35
  },
35
- "typesPublisherContentHash": "32a66193529a5451d87b01022bf518f3e822a5328df239dd33e281cadfc2b259",
36
- "typeScriptVersion": "3.2"
36
+ "typesPublisherContentHash": "cc399a217afe3f05970965ac19dccc5ae2a64c3fee00ecf479e7c1e9fec2c99b",
37
+ "typeScriptVersion": "3.9"
37
38
  }