go-mokapi 0.28.0 → 0.30.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.
- package/dist/mokapi-darwin-arm64/mokapi +0 -0
- package/dist/mokapi-linux-amd64/mokapi +0 -0
- package/dist/mokapi-windows-amd64/mokapi.exe +0 -0
- package/package.json +1 -1
- package/types/encoding.d.ts +1 -3
- package/types/faker.d.ts +2 -2
- package/types/http.d.ts +9 -1
- package/types/index.d.ts +16 -6
- package/types/mail.d.ts +21 -21
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/types/encoding.d.ts
CHANGED
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
|
|
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.
|
|
@@ -157,11 +157,16 @@ export interface HttpRequest {
|
|
|
157
157
|
/** Object contains querystring parameters specified by OpenAPI querystring parameters. */
|
|
158
158
|
readonly querystring: any;
|
|
159
159
|
|
|
160
|
+
/** API name where this request is specified */
|
|
161
|
+
readonly api: string;
|
|
162
|
+
|
|
160
163
|
/** Path value specified by the OpenAPI path */
|
|
161
164
|
readonly key: string;
|
|
162
165
|
|
|
163
166
|
/** OperationId defined in OpenAPI */
|
|
164
167
|
readonly operationId: string;
|
|
168
|
+
|
|
169
|
+
toString(): string
|
|
165
170
|
}
|
|
166
171
|
|
|
167
172
|
/**
|
|
@@ -170,7 +175,7 @@ export interface HttpRequest {
|
|
|
170
175
|
*/
|
|
171
176
|
export interface HttpResponse {
|
|
172
177
|
/** Object contains header parameters specified by OpenAPI header parameters. */
|
|
173
|
-
headers: { [key: string]:
|
|
178
|
+
headers: { [key: string]: any };
|
|
174
179
|
|
|
175
180
|
/** Specifies the http status used to select the OpenAPI response definition. */
|
|
176
181
|
statusCode: number;
|
|
@@ -192,11 +197,16 @@ export interface Url {
|
|
|
192
197
|
/** URL host. */
|
|
193
198
|
readonly host: string;
|
|
194
199
|
|
|
200
|
+
/** URL port */
|
|
201
|
+
readonly port: number;
|
|
202
|
+
|
|
195
203
|
/** URL path. */
|
|
196
204
|
readonly path: string;
|
|
197
205
|
|
|
198
206
|
/** URL query string. */
|
|
199
207
|
readonly query: string;
|
|
208
|
+
|
|
209
|
+
toString(): string
|
|
200
210
|
}
|
|
201
211
|
|
|
202
212
|
/**
|
|
@@ -210,7 +220,7 @@ export interface Url {
|
|
|
210
220
|
* })
|
|
211
221
|
* }
|
|
212
222
|
*/
|
|
213
|
-
export type KafkaEventHandler = (message: KafkaEventMessage) => void
|
|
223
|
+
export type KafkaEventHandler = (message: KafkaEventMessage) => void | Promise<void>;
|
|
214
224
|
|
|
215
225
|
/**
|
|
216
226
|
* KafkaEventMessage is an object used by KafkaEventHandler that contains Kafka-specific message data.
|
|
@@ -249,7 +259,7 @@ export interface KafkaEventMessage {
|
|
|
249
259
|
* })
|
|
250
260
|
* }
|
|
251
261
|
*/
|
|
252
|
-
export type LdapEventHandler = (request: LdapSearchRequest, response: LdapSearchResponse) => void
|
|
262
|
+
export type LdapEventHandler = (request: LdapSearchRequest, response: LdapSearchResponse) => void | Promise<void>;
|
|
253
263
|
|
|
254
264
|
/**
|
|
255
265
|
* LdapSearchRequest is an object used by LdapEventHandler that contains request-specific data.
|
|
@@ -349,7 +359,7 @@ export enum LdapResultStatus {
|
|
|
349
359
|
SizeLimitExceeded = 4,
|
|
350
360
|
}
|
|
351
361
|
|
|
352
|
-
export type SmtpEventHandler = (record: SmtpEventMessage) => void
|
|
362
|
+
export type SmtpEventHandler = (record: SmtpEventMessage) => void | Promise<void>;
|
|
353
363
|
|
|
354
364
|
export interface SmtpEventMessage {
|
|
355
365
|
server: string;
|
|
@@ -457,7 +467,7 @@ export interface EventArgs {
|
|
|
457
467
|
* }, {times: 1, runFirstTimeImmediately: false})
|
|
458
468
|
* }
|
|
459
469
|
*/
|
|
460
|
-
export type ScheduledEventHandler = () => void
|
|
470
|
+
export type ScheduledEventHandler = () => void | Promise<void>;
|
|
461
471
|
|
|
462
472
|
export interface ScheduledEventArgs {
|
|
463
473
|
/**
|
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
|
}
|