temba 0.42.8 → 0.44.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/README.md +25 -24
- package/config/index.d.ts +0 -1
- package/config/index.d.ts.map +1 -1
- package/config/index.js +1 -1
- package/config/index.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/index.js +20 -32
- package/index.js.map +1 -1
- package/openapi/html.d.ts +2 -0
- package/openapi/html.d.ts.map +1 -0
- package/openapi/html.js +14 -0
- package/openapi/html.js.map +1 -0
- package/openapi/index.d.ts +5 -0
- package/openapi/index.d.ts.map +1 -0
- package/openapi/index.js +37 -0
- package/openapi/index.js.map +1 -0
- package/openapi/spec.d.ts +8 -0
- package/openapi/spec.d.ts.map +1 -0
- package/openapi/spec.js +486 -0
- package/openapi/spec.js.map +1 -0
- package/package.json +12 -12
- package/requestHandlers/delete.d.ts +2 -2
- package/requestHandlers/delete.js +8 -8
- package/requestHandlers/delete.js.map +1 -1
- package/requestHandlers/get.d.ts +13 -7
- package/requestHandlers/get.d.ts.map +1 -1
- package/requestHandlers/get.js +7 -7
- package/requestHandlers/get.js.map +1 -1
- package/requestHandlers/index.d.ts +40 -18
- package/requestHandlers/index.d.ts.map +1 -1
- package/requestHandlers/index.js +2 -2
- package/requestHandlers/index.js.map +1 -1
- package/requestHandlers/patch.d.ts +9 -2
- package/requestHandlers/patch.d.ts.map +1 -1
- package/requestHandlers/patch.js +10 -7
- package/requestHandlers/patch.js.map +1 -1
- package/requestHandlers/post.d.ts +5 -3
- package/requestHandlers/post.d.ts.map +1 -1
- package/requestHandlers/post.js +6 -6
- package/requestHandlers/post.js.map +1 -1
- package/requestHandlers/put.d.ts +9 -2
- package/requestHandlers/put.d.ts.map +1 -1
- package/requestHandlers/put.js +10 -7
- package/requestHandlers/put.js.map +1 -1
- package/requestHandlers/types.d.ts +4 -12
- package/requestHandlers/types.d.ts.map +1 -1
- package/requestHandlers/utils.d.ts +4 -1
- package/requestHandlers/utils.d.ts.map +1 -1
- package/requestHandlers/utils.js.map +1 -1
- package/requestInterceptor/interceptRequest.d.ts +6 -5
- package/requestInterceptor/interceptRequest.d.ts.map +1 -1
- package/requestInterceptor/interceptRequest.js +8 -8
- package/requestInterceptor/interceptRequest.js.map +1 -1
- package/requestInterceptor/types.d.ts +9 -7
- package/requestInterceptor/types.d.ts.map +1 -1
- package/resourceHandler.d.ts +2 -7
- package/resourceHandler.d.ts.map +1 -1
- package/resourceHandler.js +17 -48
- package/resourceHandler.js.map +1 -1
- package/responseHandler.d.ts +13 -0
- package/responseHandler.d.ts.map +1 -0
- package/responseHandler.js +39 -0
- package/responseHandler.js.map +1 -0
- package/root/html.d.ts +8 -0
- package/root/html.d.ts.map +1 -0
- package/root/html.js +48 -0
- package/root/html.js.map +1 -0
- package/root/root.d.ts +4 -0
- package/root/root.d.ts.map +1 -0
- package/root/root.js +37 -0
- package/root/root.js.map +1 -0
- package/schema/compile.js +10 -11
- package/schema/compile.js.map +1 -1
- package/schema/validate.d.ts +2 -1
- package/schema/validate.d.ts.map +1 -1
- package/schema/validate.js.map +1 -1
- package/staticFolder/staticFolder.d.ts +3 -5
- package/staticFolder/staticFolder.d.ts.map +1 -1
- package/staticFolder/staticFolder.js +15 -18
- package/staticFolder/staticFolder.js.map +1 -1
- package/version.js +1 -1
- package/openapi/openapi.d.ts +0 -6
- package/openapi/openapi.d.ts.map +0 -1
- package/openapi/openapi.js +0 -512
- package/openapi/openapi.js.map +0 -1
package/README.md
CHANGED
|
@@ -47,23 +47,26 @@ Prerequisites you need to have:
|
|
|
47
47
|
|
|
48
48
|
### Use the starter with `npx`
|
|
49
49
|
|
|
50
|
-
Create your own Temba server
|
|
50
|
+
Create your own Temba server instantly:
|
|
51
51
|
|
|
52
|
-
```bash
|
|
53
|
-
npx create-temba-server@latest my-rest-api
|
|
54
|
-
cd my-rest-api
|
|
55
|
-
npm start
|
|
56
52
|
```
|
|
53
|
+
npx temba-cli create my-rest-api
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
This command will:
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
* Create a new folder called `my-rest-api`
|
|
59
|
+
* Install Temba as a dependency
|
|
60
|
+
* Generate a `server.js` file
|
|
61
|
+
* Automatically start your brand-new Temba API
|
|
59
62
|
|
|
60
|
-
|
|
63
|
+
You’ll see:
|
|
61
64
|
|
|
62
65
|
```
|
|
63
66
|
✅ Server listening on port 3000
|
|
64
67
|
```
|
|
65
68
|
|
|
66
|
-
Now you can
|
|
69
|
+
Now you can send any HTTP request to any resource on localhost:3000 — and it just works.
|
|
67
70
|
|
|
68
71
|
### Adding to an existing app
|
|
69
72
|
|
|
@@ -75,8 +78,8 @@ Alternatively, add Temba to your app manually:
|
|
|
75
78
|
|
|
76
79
|
```js
|
|
77
80
|
import { create } from "temba"
|
|
78
|
-
const server = create()
|
|
79
|
-
server.start()
|
|
81
|
+
const server = await create()
|
|
82
|
+
await server.start()
|
|
80
83
|
```
|
|
81
84
|
|
|
82
85
|
3. In your console you'll see:
|
|
@@ -138,7 +141,7 @@ By default data is stored in memory. This means the data is flushed when the ser
|
|
|
138
141
|
const config = {
|
|
139
142
|
connectionString: 'data.json',
|
|
140
143
|
}
|
|
141
|
-
const server = create(config)
|
|
144
|
+
const server = await create(config)
|
|
142
145
|
```
|
|
143
146
|
|
|
144
147
|
All resources are saved in a single JSON file. The file is not created or updated unless you create, update, or delete resources.
|
|
@@ -149,7 +152,7 @@ All resources are saved in a single JSON file. The file is not created or update
|
|
|
149
152
|
const config = {
|
|
150
153
|
connectionString: 'mongodb://localhost:27017/myDatabase',
|
|
151
154
|
}
|
|
152
|
-
const server = create(config)
|
|
155
|
+
const server = await create(config)
|
|
153
156
|
```
|
|
154
157
|
|
|
155
158
|
For every resource you use in your requests, a collection is created in the database. However, not until you actually create a resource with a `POST`.
|
|
@@ -162,7 +165,7 @@ If you only want to allow specific resource names, configure them by providing a
|
|
|
162
165
|
const config = {
|
|
163
166
|
resources: ['movies', 'actors'],
|
|
164
167
|
}
|
|
165
|
-
const server = create(config)
|
|
168
|
+
const server = await create(config)
|
|
166
169
|
```
|
|
167
170
|
|
|
168
171
|
Requests on these resources only give a `404 Not Found` if the ID does not exist. Requests on any other resource will always return a `404 Not Found`.
|
|
@@ -175,12 +178,10 @@ With the `apiPrefix` config setting, all resources get an extra path segment in
|
|
|
175
178
|
const config = {
|
|
176
179
|
apiPrefix: 'api',
|
|
177
180
|
}
|
|
178
|
-
const server = create(config)
|
|
181
|
+
const server = await create(config)
|
|
179
182
|
```
|
|
180
183
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
After configuring the `apiPrefix`, requests to the root URL (e.g. http://localhost:1234/), instead of the `"It works! ツ"` response message, will now either return a `404 Not Found` on `GET` requests, or a `405 Method Not Allowed` for any other HTTP method.
|
|
184
|
+
After configuring the `apiPrefix`, requests to the root URL (e.g. http://localhost:1234/), will now either return a `404 Not Found` on `GET` requests, or a `405 Method Not Allowed` for any other HTTP method.
|
|
184
185
|
|
|
185
186
|
### Static assets
|
|
186
187
|
|
|
@@ -190,7 +191,7 @@ If you want to host static assets, for example a web app consuming the API, you
|
|
|
190
191
|
const config = {
|
|
191
192
|
staticFolder: 'build',
|
|
192
193
|
}
|
|
193
|
-
const server = create(config)
|
|
194
|
+
const server = await create(config)
|
|
194
195
|
```
|
|
195
196
|
|
|
196
197
|
With this setting, sending a `GET` request to the root URL, returns the content that is in the `'./build'` folder in your project, for example an HTML page.
|
|
@@ -244,7 +245,7 @@ const config = {
|
|
|
244
245
|
},
|
|
245
246
|
}
|
|
246
247
|
|
|
247
|
-
const server = create(config)
|
|
248
|
+
const server = await create(config)
|
|
248
249
|
```
|
|
249
250
|
|
|
250
251
|
If a request is not valid according to the schema, a `400 Bad Request` response is returned, and a message in the response body indicating the validation error.
|
|
@@ -276,7 +277,7 @@ const config = {
|
|
|
276
277
|
},
|
|
277
278
|
}
|
|
278
279
|
|
|
279
|
-
const server = create(config)
|
|
280
|
+
const server = await create(config)
|
|
280
281
|
```
|
|
281
282
|
|
|
282
283
|
The `requestInterceptor` is an object with fields for each of the HTTP methods you might want to intercept, and the callback function you want Temba to call, before processing the request, i.e. going to the database.
|
|
@@ -316,7 +317,7 @@ const config = {
|
|
|
316
317
|
},
|
|
317
318
|
}
|
|
318
319
|
|
|
319
|
-
const server = create(config)
|
|
320
|
+
const server = await create(config)
|
|
320
321
|
```
|
|
321
322
|
|
|
322
323
|
### Response body interception
|
|
@@ -346,7 +347,7 @@ const config = {
|
|
|
346
347
|
},
|
|
347
348
|
}
|
|
348
349
|
|
|
349
|
-
const server = create(config)
|
|
350
|
+
const server = await create(config)
|
|
350
351
|
```
|
|
351
352
|
|
|
352
353
|
`responseBodyInterceptor` is a callback function that provides an object containing the `resource`, `body`, and the `id`. Depending on whether it's a collection or item request, the `body` is either an array or object, and the `id` can be `undefined`.
|
|
@@ -367,7 +368,7 @@ To optimize `GET` requests, and only send JSON over the wire when it changed, yo
|
|
|
367
368
|
const config = {
|
|
368
369
|
etags: true,
|
|
369
370
|
}
|
|
370
|
-
const server = create(config)
|
|
371
|
+
const server = await create(config)
|
|
371
372
|
```
|
|
372
373
|
|
|
373
374
|
After enabling etags, every `GET` request will return an `etag` response header, which clients can (optionally) send as an `If-None-Match` header with every subsequent `GET` request. Only if the resource changed in the meantime the server will return the new JSON, and otherwise it will return a `304 Not Modified` response with an empty response body.
|
|
@@ -423,7 +424,7 @@ const config = {
|
|
|
423
424
|
},
|
|
424
425
|
staticFolder: 'build',
|
|
425
426
|
}
|
|
426
|
-
const server = create(config)
|
|
427
|
+
const server = await create(config)
|
|
427
428
|
```
|
|
428
429
|
|
|
429
430
|
These are all the possible settings:
|
package/config/index.d.ts
CHANGED
|
@@ -29,7 +29,6 @@ export type Config = {
|
|
|
29
29
|
implementations: Implementations | null;
|
|
30
30
|
};
|
|
31
31
|
export type ConfigKey = keyof Config;
|
|
32
|
-
export type RouterConfig = Pick<Config, 'validateResources' | 'resources' | 'apiPrefix' | 'requestInterceptor' | 'responseBodyInterceptor' | 'returnNullFields' | 'allowDeleteCollection' | 'etagsEnabled'>;
|
|
33
32
|
export type UserConfig = {
|
|
34
33
|
resources?: Resources;
|
|
35
34
|
staticFolder?: string;
|
package/config/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AACrE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEzD,KAAK,YAAY,GAAG,MAAM,CAAA;AAE1B,KAAK,gBAAgB,GAAG;IACtB,YAAY,EAAE,YAAY,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,KAAK,SAAS,GAAG,CAAC,YAAY,GAAG,gBAAgB,CAAC,EAAE,CAAA;AAEpD,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEtD,MAAM,MAAM,MAAM,GAAG;IACnB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,SAAS,EAAE,SAAS,CAAA;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,CAAA;IAC7C,uBAAuB,EAAE,uBAAuB,GAAG,IAAI,CAAA;IACvD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,gBAAgB,EAAE,OAAO,CAAA;IACzB,IAAI,EAAE,MAA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/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AA4DA,MAAM,aAAa,GAAW;IAC5B,SAAS,EAAE,EAAE;IACb,iBAAiB,EAAE,KAAK;IACxB,YAAY,EAAE,IAAI;IAClB,SAAS,EAAE,IAAI;IACf,gBAAgB,EAAE,IAAI;IACtB,KAAK,EAAE,CAAC;IACR,kBAAkB,EAAE,IAAI;IACxB,uBAAuB,EAAE,IAAI;IAC7B,gBAAgB,EAAE,IAAI;IACtB,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,IAAI;IACb,qBAAqB,EAAE,KAAK;IAC5B,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,IAAI;IAEb,SAAS,EAAE,KAAK;IAChB,eAAe,EAAE,IAAI;CACtB,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,UAAuB,EAAU,EAAE;IAC5D,IAAI,CAAC,UAAU;QAAE,OAAO,aAAa,CAAA;IAErC,MAAM,MAAM,GAAG,EAAE,GAAG,aAAa,EAAY,CAAA;IAE7C,IAAI,UAAU,CAAC,SAAS,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5D,MAAM,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAA;QACvC,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAA;IACjC,CAAC;IAED,IAAI,UAAU,CAAC,YAAY,EAAE,CAAC;QAC5B,sEAAsE;QACtE,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;QACzE,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,MAAM,CAAC,YAAY,GAAG,YAAY,CAAA;YAClC,kEAAkE;YAClE,MAAM,CAAC,SAAS,GAAG,KAAK,CAAA;QAC1B,CAAC;IACH,CAAC;IAED,IAAI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IACrC,CAAC;IAED,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,qBAAqB,CAAC,EAAE,CAAC;QACnD,MAAM,CAAC,qBAAqB,GAAG,UAAU,CAAC,qBAAqB,CAAA;IACjE,CAAC;IAED,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,YAAY,GAAG,UAAU,CAAC,KAAK,CAAA;IACxC,CAAC;IAED,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACrC,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAA;IACrC,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAc,EAAsB,EAAE,CAAC,OAAO,KAAK,KAAK,WAAW,CAAA"}
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type UserConfig } from './config/index.js';
|
|
2
2
|
import type { IncomingMessage, ServerResponse } from 'http';
|
|
3
3
|
import { TembaError as TembaErrorInternal } from './requestInterceptor/TembaError.js';
|
|
4
|
-
export declare const create: (userConfig?: UserConfig) => {
|
|
4
|
+
export declare const create: (userConfig?: UserConfig) => Promise<{
|
|
5
5
|
start: () => import("http").Server<typeof IncomingMessage, typeof ServerResponse> | undefined;
|
|
6
6
|
server: import("http").Server<typeof IncomingMessage, typeof ServerResponse> | undefined;
|
|
7
|
-
}
|
|
7
|
+
}>;
|
|
8
8
|
export declare const TembaError: typeof TembaErrorInternal;
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAA;AAK3D,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAoFlF,eAAO,MAAM,MAAM,GAAI,aAAa,UAAU;;;EAA6B,CAAA;AAE3E,eAAO,MAAM,UAAU,2BAAqB,CAAA"}
|
package/index.js
CHANGED
|
@@ -1,40 +1,28 @@
|
|
|
1
1
|
import { createServer as httpCreateServer } from 'node:http';
|
|
2
2
|
import { initConfig } from './config/index.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { createResourceHandler, handleMethodNotAllowed, handleNotFound, sendErrorResponse, } from './resourceHandler.js';
|
|
3
|
+
import { createResourceHandler } from './resourceHandler.js';
|
|
4
|
+
import { handleNotFound, sendErrorResponse } from './responseHandler.js';
|
|
6
5
|
import { getHttpLogger, initLogger } from './log/logger.js';
|
|
7
|
-
import { createOpenApiHandler } from './openapi/
|
|
6
|
+
import { createOpenApiHandler, getOpenApiPaths } from './openapi/index.js';
|
|
8
7
|
import { TembaError as TembaErrorInternal } from './requestInterceptor/TembaError.js';
|
|
9
8
|
import { handleStaticFolder } from './staticFolder/staticFolder.js';
|
|
10
9
|
import { getDefaultImplementations } from './implementations.js';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return handleMethodNotAllowed(req, res);
|
|
16
|
-
res.statusCode = 200;
|
|
17
|
-
res.setHeader('Content-Type', 'text/plain');
|
|
18
|
-
setCorsHeaders(res);
|
|
19
|
-
res.end(`It works! ツ\n\nTemba ${version}`);
|
|
20
|
-
};
|
|
10
|
+
import { createRootUrlHandler } from './root/root.js';
|
|
11
|
+
import { sendResponse } from './responseHandler.js';
|
|
12
|
+
import { createQueries } from './data/queries.js';
|
|
13
|
+
import { compileSchemas } from './schema/compile.js';
|
|
21
14
|
const removePendingAndTrailingSlashes = (url) => (url ? url.replace(/^\/+|\/+$/g, '') : '');
|
|
22
|
-
const handleOptionsRequest = (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
const createServer = (userConfig) => {
|
|
15
|
+
const handleOptionsRequest = (res) => sendResponse(res)({
|
|
16
|
+
statusCode: 200,
|
|
17
|
+
});
|
|
18
|
+
const createServer = async (userConfig) => {
|
|
28
19
|
const config = initConfig(userConfig);
|
|
29
20
|
const rootPath = config.apiPrefix ? removePendingAndTrailingSlashes(config.apiPrefix) : '';
|
|
30
|
-
const openapiPaths =
|
|
31
|
-
`${rootPath ? `${rootPath}/` : ''}openapi.json`,
|
|
32
|
-
`${rootPath ? `${rootPath}/` : ''}openapi.yaml`,
|
|
33
|
-
];
|
|
21
|
+
const openapiPaths = getOpenApiPaths(rootPath);
|
|
34
22
|
const { log, logLevel } = initLogger(process.env.LOG_LEVEL);
|
|
35
23
|
const queries = createQueries(config.connectionString, log);
|
|
36
24
|
const schemas = compileSchemas(config.schemas);
|
|
37
|
-
const handleResource = createResourceHandler(queries, schemas, config);
|
|
25
|
+
const handleResource = await createResourceHandler(queries, schemas, config);
|
|
38
26
|
const httpLogger = getHttpLogger(logLevel);
|
|
39
27
|
const server = httpCreateServer((req, res) => {
|
|
40
28
|
const implementations = getDefaultImplementations(config);
|
|
@@ -42,24 +30,24 @@ const createServer = (userConfig) => {
|
|
|
42
30
|
if (err)
|
|
43
31
|
return sendErrorResponse(res);
|
|
44
32
|
const requestUrl = removePendingAndTrailingSlashes(req.url);
|
|
45
|
-
const handleRequest = () => {
|
|
33
|
+
const handleRequest = async () => {
|
|
46
34
|
if (req.method === 'OPTIONS') {
|
|
47
|
-
return handleOptionsRequest(
|
|
35
|
+
return handleOptionsRequest(res);
|
|
48
36
|
}
|
|
49
37
|
if (config.staticFolder && !`${requestUrl}/`.startsWith(config.apiPrefix + '/')) {
|
|
50
|
-
handleStaticFolder(req, res, () => implementations.getStaticFileFromDisk(req.url === '/' ? 'index.html' : req.url || 'index.html'));
|
|
38
|
+
handleStaticFolder(req, res, async () => await implementations.getStaticFileFromDisk(req.url === '/' ? 'index.html' : req.url || 'index.html'));
|
|
51
39
|
}
|
|
52
40
|
else if (requestUrl === rootPath) {
|
|
53
|
-
|
|
41
|
+
createRootUrlHandler(config)(req, res);
|
|
54
42
|
}
|
|
55
43
|
else if (openapiPaths.includes(requestUrl)) {
|
|
56
|
-
createOpenApiHandler(requestUrl.
|
|
44
|
+
createOpenApiHandler(config, requestUrl, req.headers.host || '')(res);
|
|
57
45
|
}
|
|
58
46
|
else if (requestUrl.startsWith(rootPath)) {
|
|
59
|
-
handleResource(req, res);
|
|
47
|
+
await handleResource(req, res);
|
|
60
48
|
}
|
|
61
49
|
else {
|
|
62
|
-
handleNotFound(
|
|
50
|
+
handleNotFound(res);
|
|
63
51
|
}
|
|
64
52
|
};
|
|
65
53
|
if (config.delay > 0) {
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAmB,MAAM,UAAU,CAAA;AAEtD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAmB,MAAM,UAAU,CAAA;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,M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AAC,CAAA;AAE3E,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../src/openapi/html.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,cAY1B,CAAA"}
|
package/openapi/html.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const getOpenApiHtml = () => {
|
|
2
|
+
return `<!doctype html>
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<rapi-doc spec-url="openapi.json"> </rapi-doc>
|
|
10
|
+
</body>
|
|
11
|
+
</html>
|
|
12
|
+
`;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../../src/openapi/html.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,OAAO;;;;;;;;;;GAUN,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Config } from '../config/index.js';
|
|
2
|
+
import type { IncomingMessage, ServerResponse } from 'http';
|
|
3
|
+
export declare const getOpenApiPaths: (rootPath: string) => string[];
|
|
4
|
+
export declare const createOpenApiHandler: (config: Config, requestUrl: string, requestHost: string) => (res: ServerResponse<IncomingMessage>) => Promise<void>;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/openapi/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAA;AAM3D,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,aAO/C,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,EAAE,YAAY,MAAM,EAAE,aAAa,MAAM,WACvD,cAAc,CAAC,eAAe,CAAC,kBA6BnE,CAAA"}
|
package/openapi/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { handleNotFound } from '../responseHandler.js';
|
|
2
|
+
import { getSpec } from './spec.js';
|
|
3
|
+
import { getOpenApiHtml } from './html.js';
|
|
4
|
+
import { sendResponse } from '../responseHandler.js';
|
|
5
|
+
export const getOpenApiPaths = (rootPath) => {
|
|
6
|
+
return [
|
|
7
|
+
`${rootPath ? `${rootPath}/` : ''}openapi.json`,
|
|
8
|
+
`${rootPath ? `${rootPath}/` : ''}openapi.yaml`,
|
|
9
|
+
`${rootPath ? `${rootPath}/` : ''}openapi.html`,
|
|
10
|
+
`${rootPath ? `${rootPath}/` : ''}openapi`,
|
|
11
|
+
];
|
|
12
|
+
};
|
|
13
|
+
export const createOpenApiHandler = (config, requestUrl, requestHost) => {
|
|
14
|
+
const openApiHandler = async (res) => {
|
|
15
|
+
if (!config.openapi) {
|
|
16
|
+
return handleNotFound(res);
|
|
17
|
+
}
|
|
18
|
+
const format = requestUrl.endsWith('.yaml') || requestUrl.endsWith('.yml')
|
|
19
|
+
? 'yaml'
|
|
20
|
+
: requestUrl.endsWith('.json')
|
|
21
|
+
? 'json'
|
|
22
|
+
: 'html';
|
|
23
|
+
const contentType = {
|
|
24
|
+
json: 'application/json',
|
|
25
|
+
yaml: 'application/yaml',
|
|
26
|
+
html: 'text/html',
|
|
27
|
+
}[format];
|
|
28
|
+
const body = format === 'html' ? getOpenApiHtml() : getSpec(config, { format, host: requestHost });
|
|
29
|
+
sendResponse(res)({
|
|
30
|
+
statusCode: 200,
|
|
31
|
+
contentType: contentType,
|
|
32
|
+
body,
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
return openApiHandler;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/openapi/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAgB,EAAE,EAAE;IAClD,OAAO;QACL,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,cAAc;QAC/C,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,cAAc;QAC/C,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,cAAc;QAC/C,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS;KAC3C,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAc,EAAE,UAAkB,EAAE,WAAmB,EAAE,EAAE;IAC9F,MAAM,cAAc,GAAG,KAAK,EAAE,GAAoC,EAAE,EAAE;QACpE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,cAAc,CAAC,GAAG,CAAC,CAAA;QAC5B,CAAC;QAED,MAAM,MAAM,GACV,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;YACzD,CAAC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