go-mokapi 0.7.0 → 0.7.1
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/README.md +15 -2
- 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/faker.d.ts +5 -1
- package/types/http.d.ts +11 -12
- package/types/kafka.d.ts +7 -4
- package/types/mokapi.d.ts +51 -5
- package/types/mustache.d.ts +1 -1
- package/types/yaml.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://github.com/marle3003/mokapi/raw/v0.5.0/logo.svg" alt="Mokapi" title="Mokapi" width="
|
|
2
|
+
<img src="https://github.com/marle3003/mokapi/raw/v0.5.0/logo.svg" alt="Mokapi" title="Mokapi" width="300" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
+
<h3 align="center">Create and test API designs<br />before actually building them</h3>
|
|
6
|
+
|
|
7
|
+
|
|
5
8
|
## Overview
|
|
6
9
|
|
|
7
10
|
Mokapi is a tool that allows developers to create and test API designs before actually building them. It works by emulating API responses based on the designs that have been created, which allows developers to test different configurations and edge cases without having to rely on a fully built API.
|
|
@@ -18,4 +21,14 @@ By using Mokapi, developers can reduce the time and effort required for developm
|
|
|
18
21
|
|
|
19
22
|
```shell
|
|
20
23
|
npx mokapi --Providers.File.Directory=./mokapi
|
|
21
|
-
```
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Documentation
|
|
27
|
+
|
|
28
|
+
- [Get Started](https://mokapi.io/docs/guides/get-started/welcome)
|
|
29
|
+
- [HTTP](https://mokapi.io/docs/guides/http/overview)
|
|
30
|
+
- [Kafka](https://mokapi.io/docs/guides/kafka/overview)
|
|
31
|
+
- [LDAP](https://mokapi.io/docs/guides/ldap/overview)
|
|
32
|
+
- [SMTP](https://mokapi.io/docs/guides/smtp/overview)
|
|
33
|
+
- [Javascript API](https://mokapi.io/docs/javascript-api)
|
|
34
|
+
- [Examples](https://mokapi.io/docs/examples)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/types/faker.d.ts
CHANGED
package/types/http.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
declare module '
|
|
2
|
-
function get(url: string, args
|
|
3
|
-
function post(url: string, body
|
|
4
|
-
function put(url: string, body
|
|
5
|
-
function head(url: string, args
|
|
6
|
-
function patch(url: string, args
|
|
7
|
-
function del(url: string, body
|
|
8
|
-
function options(url: string, body
|
|
1
|
+
declare module 'mokapi/http' {
|
|
2
|
+
function get(url: string, args?: Args): Response
|
|
3
|
+
function post(url: string, body?: any, args?: Args): Response
|
|
4
|
+
function put(url: string, body?: any, args?: Args): Response
|
|
5
|
+
function head(url: string, args?: Args): Response
|
|
6
|
+
function patch(url: string, args?: Args): Response
|
|
7
|
+
function del(url: string, body?: any, args?: Args): Response
|
|
8
|
+
function options(url: string, body?: any, args?: Args): Response
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
type Header = { [name: string]: string };
|
|
12
|
-
|
|
13
11
|
declare interface Args {
|
|
14
|
-
header?:
|
|
12
|
+
header?: { [name: string]: any };
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
declare interface Response {
|
|
18
16
|
body: string
|
|
19
17
|
statusCode: number
|
|
20
|
-
headers:
|
|
18
|
+
headers: { [name: string]: string[] }
|
|
19
|
+
json(): any
|
|
21
20
|
}
|
package/types/kafka.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare module 'kafka' {
|
|
1
|
+
declare module 'mokapi/kafka' {
|
|
2
2
|
function produce(args: ProduceArgs): ProduceResult
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -12,7 +12,10 @@ declare interface ProduceArgs {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
declare interface ProduceResult {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
cluster: string
|
|
16
|
+
topic: string
|
|
17
|
+
partition: number
|
|
18
|
+
offset: number
|
|
19
|
+
key: string
|
|
20
|
+
value: string
|
|
18
21
|
}
|
package/types/mokapi.d.ts
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
declare module 'mokapi' {
|
|
2
|
+
|
|
2
3
|
/** Listener for http events. */
|
|
3
|
-
function on(event: 'http', f:
|
|
4
|
+
function on(event: 'http', f: EventHandler, args: EventArgs): void
|
|
5
|
+
|
|
4
6
|
/** Schedules a new periodic job with interval.
|
|
5
7
|
* Interval string is a possibly signed sequence of
|
|
6
8
|
* decimal numbers, each with optional fraction and a unit suffix,
|
|
7
9
|
* such as "300ms", "-1.5h" or "2h45m".
|
|
8
10
|
* Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
|
|
9
11
|
*/
|
|
10
|
-
function every(interval: string, f:
|
|
12
|
+
function every(interval: string, f: ScheduledEventHandler, args: ScheduledEventArgs): void
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Schedules a new periodic job with a cron expression.
|
|
16
|
+
* @param expr cron expression
|
|
17
|
+
* @param f function to execute
|
|
18
|
+
* @param args additional arguments
|
|
19
|
+
*/
|
|
20
|
+
function cron(expr: string, f: ScheduledEventHandler, args: ScheduledEventArgs): void
|
|
21
|
+
|
|
11
22
|
/** Returns the environment variable named by the key. */
|
|
12
|
-
function env(
|
|
23
|
+
function env(name: string): string
|
|
13
24
|
|
|
14
25
|
/** Opens a file and reading all its content. */
|
|
15
26
|
function open(path: string): string
|
|
@@ -19,8 +30,17 @@ declare module 'mokapi' {
|
|
|
19
30
|
* Default layout is RFC3339.
|
|
20
31
|
* Default timestamp is current UTC */
|
|
21
32
|
function date(args?: DateArgs): string
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Suspends the execution for the specified duration.
|
|
36
|
+
* Valid time units are `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`
|
|
37
|
+
* @param time Duration in milliseconds or duration as string with unit.
|
|
38
|
+
*/
|
|
39
|
+
function sleep(time: number | string )
|
|
22
40
|
}
|
|
23
41
|
|
|
42
|
+
type EventHandler = () => boolean | HttpEventHandler
|
|
43
|
+
|
|
24
44
|
type HttpEventHandler = (request: HttpRequest, response: HttpResponse) => boolean
|
|
25
45
|
|
|
26
46
|
declare interface HttpRequest {
|
|
@@ -40,7 +60,7 @@ declare interface HttpRequest {
|
|
|
40
60
|
cookie: { [key: string]: any; }
|
|
41
61
|
/** Path defined in OpenAPI. */
|
|
42
62
|
key: string
|
|
43
|
-
/** OperationId
|
|
63
|
+
/** OperationId defined in OpenAPI. */
|
|
44
64
|
operationId: string
|
|
45
65
|
}
|
|
46
66
|
|
|
@@ -71,4 +91,30 @@ declare interface DateArgs {
|
|
|
71
91
|
timestamp?: number
|
|
72
92
|
}
|
|
73
93
|
|
|
74
|
-
|
|
94
|
+
declare interface EventArgs {
|
|
95
|
+
/**
|
|
96
|
+
* Adds or overrides existing tags used in dashboard
|
|
97
|
+
*/
|
|
98
|
+
tags: {[key: string]: string}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
type ScheduledEventHandler = () => void
|
|
102
|
+
|
|
103
|
+
declare interface ScheduledEventArgs {
|
|
104
|
+
/**
|
|
105
|
+
* Adds or overrides existing tags used in dashboard
|
|
106
|
+
*/
|
|
107
|
+
tags: {[key: string]: string}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Defines the number of times the scheduled function is executed.
|
|
111
|
+
*/
|
|
112
|
+
times: number
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Toggles behavior of first execution. Default is true
|
|
116
|
+
*/
|
|
117
|
+
runFirstTimeImmediately: boolean
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
declare const RFC3339 = "RFC3339"
|
package/types/mustache.d.ts
CHANGED
package/types/yaml.d.ts
CHANGED