go-mokapi 0.27.2 → 0.29.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.
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "go-mokapi",
3
- "version": "0.27.2",
3
+ "version": "0.29.0",
4
4
  "description": "Easy and flexible API mocking",
5
5
  "homepage": "https://mokapi.io",
6
6
  "repository": {
@@ -23,6 +23,4 @@ export interface Base64Encoding {
23
23
  decode(input: string): string;
24
24
  }
25
25
 
26
- export const base64: Base64Encoding;
27
-
28
-
26
+ export const base64: Base64Encoding;
package/types/faker.d.ts CHANGED
@@ -160,7 +160,7 @@ export interface Request {
160
160
  * This allows for interdependent data generation — for example, creating an email
161
161
  * address using a previously generated first and last name.
162
162
  */
163
- context: Context
163
+ context: Context;
164
164
  }
165
165
 
166
166
  /**
@@ -170,7 +170,7 @@ export interface Context {
170
170
  /**
171
171
  * A map of names to previously generated values.
172
172
  */
173
- values: { [name: string]: any }
173
+ values: { [name: string]: any };
174
174
  }
175
175
 
176
176
  /**
package/types/http.d.ts CHANGED
@@ -104,7 +104,15 @@ export interface Args {
104
104
  * The number of redirects to follow for this request.
105
105
  * @default 5
106
106
  **/
107
- maxRedirects: number
107
+ maxRedirects?: number
108
+ /**
109
+ * Maximum time to wait for the request to complete. Default
110
+ * timeout is 60 seconds ("60s"). The type can also be a number, in which
111
+ * case Mokapi interprets it as milliseconds
112
+ * @example
113
+ * const res = get(url, { timeout: '5m' })
114
+ */
115
+ timeout?: number | string
108
116
  }
109
117
 
110
118
  /**
package/types/index.d.ts CHANGED
@@ -29,7 +29,7 @@ import "./mail";
29
29
  * })
30
30
  * }
31
31
  */
32
- export function on<T extends keyof EventHandler>(event: T, handler: EventHandler[T], args?: EventArgs): void;
32
+ export function on<T extends keyof EventHandler>(event: T, handler: EventHandler[T], args?: EventArgs): void | Promise<void>;
33
33
 
34
34
  /**
35
35
  * Schedules a new periodic job with interval.
@@ -210,7 +210,7 @@ export interface Url {
210
210
  * })
211
211
  * }
212
212
  */
213
- export type KafkaEventHandler = (message: KafkaEventMessage) => void;
213
+ export type KafkaEventHandler = (message: KafkaEventMessage) => void | Promise<void>;
214
214
 
215
215
  /**
216
216
  * KafkaEventMessage is an object used by KafkaEventHandler that contains Kafka-specific message data.
@@ -249,7 +249,7 @@ export interface KafkaEventMessage {
249
249
  * })
250
250
  * }
251
251
  */
252
- export type LdapEventHandler = (request: LdapSearchRequest, response: LdapSearchResponse) => void;
252
+ export type LdapEventHandler = (request: LdapSearchRequest, response: LdapSearchResponse) => void | Promise<void>;
253
253
 
254
254
  /**
255
255
  * LdapSearchRequest is an object used by LdapEventHandler that contains request-specific data.
@@ -349,7 +349,7 @@ export enum LdapResultStatus {
349
349
  SizeLimitExceeded = 4,
350
350
  }
351
351
 
352
- export type SmtpEventHandler = (record: SmtpEventMessage) => void;
352
+ export type SmtpEventHandler = (record: SmtpEventMessage) => void | Promise<void>;
353
353
 
354
354
  export interface SmtpEventMessage {
355
355
  server: string;
@@ -457,7 +457,7 @@ export interface EventArgs {
457
457
  * }, {times: 1, runFirstTimeImmediately: false})
458
458
  * }
459
459
  */
460
- export type ScheduledEventHandler = () => void;
460
+ export type ScheduledEventHandler = () => void | Promise<void>;
461
461
 
462
462
  export interface ScheduledEventArgs {
463
463
  /**
package/types/mail.d.ts CHANGED
@@ -3,56 +3,56 @@
3
3
  * @param server Host to which the message is to be sent.
4
4
  * @param message a Message object containing email details
5
5
  */
6
- export function send(server: string, message: Message): void
6
+ export function send(server: string, message: Message): void;
7
7
 
8
8
  /**
9
9
  * Represents an email message.
10
10
  */
11
11
  export interface Message {
12
12
  /** SMTP server hostname */
13
- server: string
13
+ server: string;
14
14
 
15
15
  /** The envelope sender address */
16
- sender?: Address
16
+ sender?: Address;
17
17
 
18
18
  /** The `From` header addresses */
19
- from: Address[]
19
+ from: Address[];
20
20
 
21
21
  /** The primary recipients */
22
- to: Address[]
22
+ to: Address[];
23
23
 
24
24
  /** The `Reply-To` header addresses */
25
- replyTo?: Address[]
25
+ replyTo?: Address[];
26
26
 
27
27
  /** Carbon copy recipients */
28
- cc?: Address[]
28
+ cc?: Address[];
29
29
 
30
30
  /** Blind carbon copy recipients */
31
- bcc?: Address[]
31
+ bcc?: Address[];
32
32
 
33
33
  /** Unique message ID */
34
- messageId: string
34
+ messageId: string;
35
35
 
36
36
  /** Message ID of the email being replied to */
37
- inReplyTo?: string
37
+ inReplyTo?: string;
38
38
 
39
39
  /** The date and time the message was created */
40
- time?: Date
40
+ time?: Date;
41
41
 
42
42
  /** The subject line of the email */
43
- subject: string
43
+ subject: string;
44
44
 
45
45
  /** MIME type of the message body (e.g., `text/plain` or `text/html`) */
46
- contentType: string
46
+ contentType: string;
47
47
 
48
48
  /** Content encoding (e.g., `utf-8`, `base64`) */
49
- encoding: string
49
+ encoding: string;
50
50
 
51
51
  /** Main body text of the message */
52
- body: string
52
+ body: string;
53
53
 
54
54
  /** List of file attachments */
55
- attachments: Attachment[]
55
+ attachments: Attachment[];
56
56
  }
57
57
 
58
58
  /**
@@ -60,10 +60,10 @@ export interface Message {
60
60
  */
61
61
  export interface Address {
62
62
  /** Optional display name (e.g., "John Doe") */
63
- name?: string
63
+ name?: string;
64
64
 
65
65
  /** Email address (e.g., "john@example.com") */
66
- address: string
66
+ address: string;
67
67
  }
68
68
 
69
69
  /**
@@ -71,11 +71,11 @@ export interface Address {
71
71
  */
72
72
  export interface Attachment {
73
73
  /** File name of the attachment */
74
- name: string
74
+ name: string;
75
75
 
76
76
  /** MIME type of the attachment (e.g., `application/pdf`) */
77
- contentType: string
77
+ contentType: string;
78
78
 
79
79
  /** File data as binary content */
80
- data: Uint8Array
80
+ data: Uint8Array;
81
81
  }