temba 0.17.0 → 0.18.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 +44 -8
- package/config/index.d.ts +10 -5
- package/config/index.js +37 -14
- package/config/index.js.map +1 -1
- package/delay/delayMiddleware.js +1 -1
- package/delay/delayMiddleware.js.map +1 -1
- package/index.js +26 -22
- package/index.js.map +1 -1
- package/package.json +16 -14
- package/queries/in-memory.d.ts +9 -8
- package/queries/in-memory.js +46 -24
- package/queries/in-memory.js.map +1 -1
- package/queries/mongo.d.ts +1 -1
- package/queries/mongo.js +170 -58
- package/queries/mongo.js.map +1 -1
- package/queries/queries.d.ts +0 -9
- package/queries/queries.js +3 -3
- package/queries/queries.js.map +1 -1
- package/queries/types.d.ts +14 -0
- package/queries/types.js +3 -0
- package/queries/types.js.map +1 -0
- package/routes/delete.d.ts +5 -2
- package/routes/delete.js +55 -17
- package/routes/delete.js.map +1 -1
- package/routes/get.d.ts +5 -2
- package/routes/get.js +92 -48
- package/routes/get.js.map +1 -1
- package/routes/interceptRequestBody.d.ts +3 -0
- package/routes/interceptRequestBody.js +19 -0
- package/routes/interceptRequestBody.js.map +1 -0
- package/routes/patch.d.ts +6 -2
- package/routes/patch.js +82 -27
- package/routes/patch.js.map +1 -1
- package/routes/post.d.ts +6 -2
- package/routes/post.js +67 -27
- package/routes/post.js.map +1 -1
- package/routes/put.d.ts +6 -2
- package/routes/put.js +82 -27
- package/routes/put.js.map +1 -1
- package/routes/routes.d.ts +3 -1
- package/routes/routes.js +51 -22
- package/routes/routes.js.map +1 -1
- package/routes/types.d.ts +9 -3
- package/routes/utils.d.ts +1 -3
- package/routes/utils.js +7 -2
- package/routes/utils.js.map +1 -1
- package/schema/compile.d.ts +2 -0
- package/schema/compile.js +41 -0
- package/schema/compile.js.map +1 -0
- package/schema/transformConfig.d.ts +2 -0
- package/schema/transformConfig.js +17 -0
- package/schema/transformConfig.js.map +1 -0
- package/schema/types.d.ts +35 -0
- package/schema/types.js +3 -0
- package/schema/types.js.map +1 -0
- package/schema/validate.d.ts +3 -0
- package/schema/validate.js +19 -0
- package/schema/validate.js.map +1 -0
- package/urls/urlMiddleware.d.ts +4 -2
- package/urls/urlMiddleware.js +18 -7
- package/urls/urlMiddleware.js.map +1 -1
- package/urls/urlParser.d.ts +3 -3
- package/urls/urlParser.js +4 -4
- package/urls/urlParser.js.map +1 -1
- package/routes/interceptors.d.ts +0 -3
- package/routes/interceptors.js +0 -22
- package/routes/interceptors.js.map +0 -1
package/README.md
CHANGED
|
@@ -109,15 +109,17 @@ The HTTP methods that are supported are `GET`, `POST`, `PATCH`, `PUT`, `DELETE`,
|
|
|
109
109
|
|
|
110
110
|
On the root URI (e.g. http://localhost:8080/) only a `GET` request is supported, which shows you a message indicating the API is working. All other HTTP methods on the root URI return a `405 Method Not Allowed` response.
|
|
111
111
|
|
|
112
|
+
The `OPTIONS` method also works, but because Temba uses Express' default implementation for that, the `Access-Control-Allow-Methods` response header might not always be correct.
|
|
113
|
+
|
|
112
114
|
### JSON
|
|
113
115
|
|
|
114
116
|
Temba supports JSON only.
|
|
115
117
|
|
|
116
118
|
Request bodies sent with a `POST`, `PATCH`, and `PUT` requests are valid when the request body is either empty, or when it's valid formatted JSON. Adding a `Content-Type: application/json` header is required. If you send a request with invalid formatted JSON, a `400 Bad Request` response is returned.
|
|
117
119
|
|
|
118
|
-
Any valid formatted JSON is accepted and stored. If you want to validate or even change the JSON in the request bodies, check out the [`requestBodyInterceptor`](#request-body-validation-or-mutation)
|
|
120
|
+
Any valid formatted JSON is accepted and stored. If you want to validate or even change the JSON in the request bodies, check out [JSON Schema request body validation](#json-schema-request-body-validation) and the [`requestBodyInterceptor`](#request-body-validation-or-mutation).
|
|
119
121
|
|
|
120
|
-
IDs are auto generated when creating resources. IDs in the JSON request body are ignored
|
|
122
|
+
IDs are auto generated when creating resources. IDs in the JSON request body are always ignored.
|
|
121
123
|
|
|
122
124
|
## Usage
|
|
123
125
|
|
|
@@ -149,7 +151,7 @@ Requests on these resources only give a `404 Not Found` if the ID does not exist
|
|
|
149
151
|
|
|
150
152
|
### Static assets
|
|
151
153
|
|
|
152
|
-
If you want to host static assets, next to the API, configure
|
|
154
|
+
If you want to host static assets, for example next to the API, a web app consuming it, you can configure a `staticFolder`:
|
|
153
155
|
|
|
154
156
|
```js
|
|
155
157
|
const config = {
|
|
@@ -160,8 +162,6 @@ const server = temba.create(config)
|
|
|
160
162
|
|
|
161
163
|
With this setting, sending a `GET` request to the root URL, returns the content that is in the `'./build'` folder in your project.
|
|
162
164
|
|
|
163
|
-
This way, you could create an API, and the web app consuming it, in one project.
|
|
164
|
-
|
|
165
165
|
Without configuring a `staticFolder`, a `GET` to the root URL returns `"It works! ツ"`. When the `staticFolder` is configured, it returns whatever is in the `build` folder in your project, for example an HTML page.
|
|
166
166
|
|
|
167
167
|
However, this might cause conflicts between the API resources and the web app routes: If the web app in the `build` folder has a route to `/products`, but there is also a `/products` API resource, the web app route is returned.
|
|
@@ -185,9 +185,9 @@ After configuring the `apiPrefix`, requests to the root URL (e.g. http://localho
|
|
|
185
185
|
|
|
186
186
|
However, if you configured both an `apiPrefix` and a `staticFolder`, a `GET` on the root URL will return the content in the `staticFolder`.
|
|
187
187
|
|
|
188
|
-
###
|
|
188
|
+
### JSON Schema request body validation
|
|
189
189
|
|
|
190
|
-
Temba does not validate request bodies.
|
|
190
|
+
By default, Temba does not validate request bodies.
|
|
191
191
|
|
|
192
192
|
This means you can store your resources in any format you like. So creating the following two (very different) _movies_ is perfectly fine:
|
|
193
193
|
|
|
@@ -205,7 +205,43 @@ POST /movies
|
|
|
205
205
|
}
|
|
206
206
|
```
|
|
207
207
|
|
|
208
|
-
You can even omit a request body when doing a `POST`, `PATCH`, or `PUT`.
|
|
208
|
+
You can even omit a request body when doing a `POST`, `PATCH`, or `PUT`. While this might be fine or even convenient when using Temba for prototyping, at some some point you might want to validate the request body.
|
|
209
|
+
|
|
210
|
+
With the `schema` setting, you can define a [JSON Schema](https://json-schema.org/), per resource, and per request method. Here we define that when creating or replacing a movie, the `title` is required, the `description` is optional, and we don't allow any other fields. Updating movies has the same schema, except there are no required fields:
|
|
211
|
+
|
|
212
|
+
```js
|
|
213
|
+
const schemaNewMovie = {
|
|
214
|
+
type: 'object',
|
|
215
|
+
properties: {
|
|
216
|
+
title: { type: 'string' },
|
|
217
|
+
description: { type: 'string' },
|
|
218
|
+
},
|
|
219
|
+
required: ['title'],
|
|
220
|
+
additionalProperties: false,
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const schemaUpdateMovie = { ...schemaNewMovie, required: [] }
|
|
224
|
+
|
|
225
|
+
const config = {
|
|
226
|
+
schema: {
|
|
227
|
+
movies: {
|
|
228
|
+
post: schemaNewMovie,
|
|
229
|
+
put: schemaNewMovie,
|
|
230
|
+
patch: schemaUpdateMovie,
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const server = temba.create(config)
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
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.
|
|
239
|
+
|
|
240
|
+
### Intercepting requests
|
|
241
|
+
|
|
242
|
+
In addition to (or instead of) validating the request using JSON Schema, you can also intercept the request body before it goes to the database, using the `requestBodyInterceptor` setting.
|
|
243
|
+
|
|
244
|
+
It allows you to implement your own validation, or even change the request body.
|
|
209
245
|
|
|
210
246
|
```js
|
|
211
247
|
const config = {
|
package/config/index.d.ts
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
2
|
import { RequestBodyInterceptor, ResponseBodyInterceptor } from '../routes/types';
|
|
3
|
+
import { ConfiguredSchemas } from '../schema/types';
|
|
3
4
|
export type Config = {
|
|
4
5
|
validateResources: boolean;
|
|
5
6
|
resources: string[];
|
|
6
|
-
apiPrefix: string;
|
|
7
|
+
apiPrefix: string | null;
|
|
7
8
|
cacheControl: string;
|
|
8
9
|
requestBodyInterceptor: RequestBodyInterceptor;
|
|
9
10
|
responseBodyInterceptor: ResponseBodyInterceptor;
|
|
10
|
-
staticFolder: string;
|
|
11
|
-
connectionString: string;
|
|
11
|
+
staticFolder: string | null;
|
|
12
|
+
connectionString: string | null;
|
|
12
13
|
delay: number;
|
|
13
|
-
customRouter: Router;
|
|
14
|
+
customRouter: Router | null;
|
|
14
15
|
returnNullFields: boolean;
|
|
15
16
|
isTesting: boolean;
|
|
16
17
|
port: number;
|
|
18
|
+
schemas: ConfiguredSchemas | null;
|
|
17
19
|
};
|
|
20
|
+
export type ConfigKey = keyof Config;
|
|
18
21
|
export type RouterConfig = Pick<Config, 'validateResources' | 'resources' | 'apiPrefix' | 'cacheControl' | 'requestBodyInterceptor' | 'responseBodyInterceptor' | 'returnNullFields'>;
|
|
19
22
|
export type UserConfig = {
|
|
20
23
|
resources?: string[];
|
|
@@ -29,5 +32,7 @@ export type UserConfig = {
|
|
|
29
32
|
returnNullFields?: boolean;
|
|
30
33
|
isTesting?: boolean;
|
|
31
34
|
port?: number;
|
|
35
|
+
schemas?: ConfiguredSchemas;
|
|
32
36
|
};
|
|
33
|
-
export declare function initConfig(userConfig
|
|
37
|
+
export declare function initConfig(userConfig?: UserConfig): Config;
|
|
38
|
+
export declare const isUndefined: (value: unknown) => value is undefined;
|
package/config/index.js
CHANGED
|
@@ -1,38 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initConfig = void 0;
|
|
4
|
-
|
|
14
|
+
exports.isUndefined = exports.initConfig = void 0;
|
|
15
|
+
var defaultConfig = {
|
|
5
16
|
resources: [],
|
|
6
17
|
validateResources: false,
|
|
7
18
|
staticFolder: null,
|
|
8
|
-
apiPrefix:
|
|
19
|
+
apiPrefix: null,
|
|
9
20
|
connectionString: null,
|
|
10
21
|
cacheControl: 'no-store',
|
|
11
22
|
delay: 0,
|
|
12
23
|
requestBodyInterceptor: {
|
|
13
|
-
post: ()
|
|
24
|
+
post: function () {
|
|
14
25
|
// do nothing
|
|
15
26
|
},
|
|
16
|
-
patch: ()
|
|
27
|
+
patch: function () {
|
|
17
28
|
// do nothing
|
|
18
29
|
},
|
|
19
|
-
put: ()
|
|
30
|
+
put: function () {
|
|
20
31
|
// do nothing
|
|
21
32
|
},
|
|
22
33
|
},
|
|
23
|
-
responseBodyInterceptor: (
|
|
34
|
+
responseBodyInterceptor: function (_a) {
|
|
35
|
+
var body = _a.body;
|
|
24
36
|
return body;
|
|
25
37
|
},
|
|
26
38
|
customRouter: null,
|
|
27
39
|
returnNullFields: true,
|
|
28
40
|
isTesting: false,
|
|
29
41
|
port: 3000,
|
|
42
|
+
schemas: null,
|
|
30
43
|
};
|
|
31
44
|
function initConfig(userConfig) {
|
|
32
|
-
var _a, _b, _c;
|
|
33
45
|
if (!userConfig)
|
|
34
46
|
return defaultConfig;
|
|
35
|
-
|
|
47
|
+
var config = __assign({}, defaultConfig);
|
|
36
48
|
if (userConfig.resources && userConfig.resources.length > 0) {
|
|
37
49
|
config.resources = userConfig.resources;
|
|
38
50
|
config.validateResources = true;
|
|
@@ -53,8 +65,8 @@ function initConfig(userConfig) {
|
|
|
53
65
|
userConfig.delay !== 0 &&
|
|
54
66
|
typeof Number(userConfig.delay) === 'number' &&
|
|
55
67
|
Number(userConfig.delay) > 0 &&
|
|
56
|
-
Number(userConfig.delay) <
|
|
57
|
-
config.delay =
|
|
68
|
+
Number(userConfig.delay) < 100000) {
|
|
69
|
+
config.delay = userConfig.delay;
|
|
58
70
|
}
|
|
59
71
|
if (userConfig.requestBodyInterceptor) {
|
|
60
72
|
if (userConfig.requestBodyInterceptor.post &&
|
|
@@ -76,10 +88,21 @@ function initConfig(userConfig) {
|
|
|
76
88
|
if (userConfig.customRouter) {
|
|
77
89
|
config.customRouter = userConfig.customRouter;
|
|
78
90
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
91
|
+
if (!(0, exports.isUndefined)(userConfig.returnNullFields)) {
|
|
92
|
+
config.returnNullFields = userConfig.returnNullFields;
|
|
93
|
+
}
|
|
94
|
+
if (!(0, exports.isUndefined)(userConfig.isTesting)) {
|
|
95
|
+
config.isTesting = userConfig.isTesting;
|
|
96
|
+
}
|
|
97
|
+
if (!(0, exports.isUndefined)(userConfig.port)) {
|
|
98
|
+
config.port = userConfig.port;
|
|
99
|
+
}
|
|
100
|
+
if (userConfig.schemas) {
|
|
101
|
+
config.schemas = userConfig.schemas;
|
|
102
|
+
}
|
|
82
103
|
return config;
|
|
83
104
|
}
|
|
84
105
|
exports.initConfig = initConfig;
|
|
106
|
+
var isUndefined = function (value) { return typeof value === 'undefined'; };
|
|
107
|
+
exports.isUndefined = isUndefined;
|
|
85
108
|
//# sourceMappingURL=index.js.map
|
package/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAkDA,IAAM,aAAa,GAAW;IAC5B,SAAS,EAAE,EAAE;IACb,iBAAiB,EAAE,KAAK;IACxB,YAAY,EAAE,IAAI;IAClB,SAAS,EAAE,IAAI;IACf,gBAAgB,EAAE,IAAI;IACtB,YAAY,EAAE,UAAU;IACxB,KAAK,EAAE,CAAC;IACR,sBAAsB,EAAE;QACtB,IAA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gBAAgB,GAAG,UAAU,CAAC,gBAAgB,CAAA;KACtD;IAED,IAAI,CAAC,IAAA,mBAAW,EAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QACtC,MAAM,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAA;KACxC;IAED,IAAI,CAAC,IAAA,mBAAW,EAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QACjC,MAAM,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAA;KAC9B;IAED,IAAI,UAAU,CAAC,OAAO,EAAE;QACtB,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAA;KACpC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAlFD,gCAkFC;AAEM,IAAM,WAAW,GAAG,UAAC,KAAc,IAAyB,OAAA,OAAO,KAAK,KAAK,WAAW,EAA5B,CAA4B,CAAA;AAAlF,QAAA,WAAW,eAAuE"}
|
package/delay/delayMiddleware.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createDelayMiddleware = void 0;
|
|
7
|
-
|
|
7
|
+
var connect_pause_1 = __importDefault(require("connect-pause"));
|
|
8
8
|
function createDelayMiddleware(delay) {
|
|
9
9
|
return function (req, res, next) {
|
|
10
10
|
console.log('Start delay...');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delayMiddleware.js","sourceRoot":"","sources":["../../src/delay/delayMiddleware.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"delayMiddleware.js","sourceRoot":"","sources":["../../src/delay/delayMiddleware.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAiC;AAEjC,SAAS,qBAAqB,CAAC,KAAK;IAClC,OAAO,UAAU,GAAG,EAAE,GAAG,EAAE,IAAI;QAC7B,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;QAC7B,IAAA,uBAAK,EAAC,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;QAC5B,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;IAChC,CAAC,CAAA;AACH,CAAC;AAEQ,sDAAqB"}
|
package/index.js
CHANGED
|
@@ -27,60 +27,64 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.create = void 0;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
var express_1 = __importStar(require("express"));
|
|
31
|
+
var morgan_1 = __importDefault(require("morgan"));
|
|
32
|
+
var routes_1 = require("./routes/routes");
|
|
33
|
+
var queries_1 = require("./queries/queries");
|
|
34
|
+
var config_1 = require("./config");
|
|
35
|
+
var cors_1 = __importDefault(require("cors"));
|
|
36
|
+
var delayMiddleware_1 = require("./delay/delayMiddleware");
|
|
37
|
+
var compile_1 = require("./schema/compile");
|
|
37
38
|
function createServer(userConfig) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
var config = (0, config_1.initConfig)(userConfig);
|
|
40
|
+
var queries = (0, queries_1.createQueries)(config.connectionString);
|
|
41
|
+
var app = (0, express_1.default)();
|
|
41
42
|
app.use((0, express_1.json)());
|
|
42
43
|
// Add HTTP request logging.
|
|
43
44
|
app.use((0, morgan_1.default)('tiny'));
|
|
44
45
|
// Enable CORS for all requests.
|
|
45
46
|
app.use((0, cors_1.default)({ origin: true, credentials: true }));
|
|
46
47
|
if (config.delay > 0) {
|
|
47
|
-
|
|
48
|
+
var delayMiddleware = (0, delayMiddleware_1.createDelayMiddleware)(config.delay);
|
|
48
49
|
app.use(delayMiddleware);
|
|
49
50
|
}
|
|
50
51
|
// Serve a static folder, if configured.
|
|
51
52
|
if (config.staticFolder) {
|
|
52
53
|
app.use(express_1.default.static(config.staticFolder));
|
|
53
54
|
}
|
|
54
|
-
// On the root URL (with apiPrefix if applicable) only a GET is allowed.
|
|
55
|
-
|
|
55
|
+
// On the root URL (with apiPrefix, if applicable) only a GET is allowed.
|
|
56
|
+
var rootPath = config.apiPrefix ? "".concat(config.apiPrefix) : '/';
|
|
56
57
|
app.use(rootPath, routes_1.rootRouter);
|
|
57
58
|
if (config.customRouter) {
|
|
58
59
|
app.use(config.customRouter);
|
|
59
60
|
}
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
// Temba supports the GET, POST, PUT, PATCH, DELETE, and HEAD methods for resource URLs.
|
|
62
|
+
// HEAD is not implemented here, because Express supports it out of the box.
|
|
63
|
+
// Create a router on all other URLs, for all supported methods
|
|
64
|
+
var resourcePath = config.apiPrefix ? "".concat(config.apiPrefix, "*") : '*';
|
|
65
|
+
var schemas = (0, compile_1.compileAndTransformSchemas)(config.schemas);
|
|
66
|
+
var resourceRouter = (0, routes_1.createResourceRouter)(queries, schemas, config);
|
|
63
67
|
app.use(resourcePath, resourceRouter);
|
|
64
|
-
// In case of an API prefix,
|
|
65
|
-
//TODO Hier missen toch HTTP methods?
|
|
68
|
+
// In case of an API prefix, resource URLs outside of the API prefix return a 404 Not Found.
|
|
66
69
|
if (config.apiPrefix) {
|
|
67
70
|
app.get('*', routes_1.handleNotFound);
|
|
68
71
|
app.post('*', routes_1.handleNotFound);
|
|
69
72
|
app.put('*', routes_1.handleNotFound);
|
|
70
73
|
app.delete('*', routes_1.handleNotFound);
|
|
74
|
+
app.patch('*', routes_1.handleNotFound);
|
|
71
75
|
}
|
|
72
76
|
// All other methods to any URL are not allowed.
|
|
73
77
|
app.all('*', routes_1.handleMethodNotAllowed);
|
|
74
78
|
if (config.apiPrefix)
|
|
75
|
-
app.all(
|
|
79
|
+
app.all("".concat(config.apiPrefix, "*"), routes_1.handleMethodNotAllowed);
|
|
76
80
|
return {
|
|
77
|
-
start: ()
|
|
81
|
+
start: function () {
|
|
78
82
|
if (config.isTesting) {
|
|
79
83
|
console.log('⛔️ Server not started. Remove or disable isTesting from your config.');
|
|
80
84
|
return;
|
|
81
85
|
}
|
|
82
|
-
app.listen(config.port, ()
|
|
83
|
-
console.log(
|
|
86
|
+
app.listen(config.port, function () {
|
|
87
|
+
console.log("\u2705 Server listening on port ".concat(config.port));
|
|
84
88
|
});
|
|
85
89
|
},
|
|
86
90
|
// Expose Express for testing purposes only, e.g. usage with supertest.
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAuC;AACvC,kDAA2B;AAC3B,0CAKwB;AACxB,6CAAiD;AACjD,mCAAyD;AACzD,8CAAuB;AACvB,2DAA+D;AAC/D,4CAA6D;AAE7D,SAAS,YAAY,CAAC,UAAuB;IAC3C,IAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,UAAU,CAAC,CAAA;IAErC,IAAM,OAAO,GAAG,IAAA,uBAAa,EAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA;IAEtD,IAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAA;IACrB,GAAG,CAAC,GAAG,CAAC,IAAA,cAAI,GAAE,CAAC,CAAA;IAEf,4BAA4B;IAC5B,GAAG,CAAC,GAAG,CAAC,IAAA,gBAAM,EAAC,MAAM,CAAC,CAAC,CAAA;IAEvB,gCAAgC;IAChC,GAAG,CAAC,GAAG,CAAC,IAAA,cAAI,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAElD,IAAI,MAAM,CAAC,KAAK,GAAG,CA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AC,MAAM,CAAC,GAAG,EAAE,uBAAc,CAAC,CAAA;QAC/B,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,uBAAc,CAAC,CAAA;KAC/B;IAED,gDAAgD;IAChD,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,+BAAsB,CAAC,CAAA;IACpC,IAAI,MAAM,CAAC,SAAS;QAAE,GAAG,CAAC,GAAG,CAAC,UAAG,MAAM,CAAC,SAAS,MAAG,EAAE,+BAAsB,CAAC,CAAA;IAE7E,OAAO;QACL,KAAK,EAAE;YACL,IAAI,MAAM,CAAC,SAAS,EAAE;gBACpB,OAAO,CAAC,GAAG,CAAC,sEAAsE,CAAC,CAAA;gBACnF,OAAM;aACP;YAED,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;gBACtB,OAAO,CAAC,GAAG,CAAC,0CAA8B,MAAM,CAAC,IAAI,CAAE,CAAC,CAAA;YAC1D,CAAC,CAAC,CAAA;QACJ,CAAC;QACD,uEAAuE;QACvE,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;KAC5C,CAAA;AACH,CAAC;AAED,SAAgB,MAAM,CAAC,UAAmB;IACxC,OAAO,YAAY,CAAC,UAAU,CAAC,CAAA;AACjC,CAAC;AAFD,wBAEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "temba",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Get a simple MongoDB REST API with zero coding in less than 30 seconds (seriously).",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,24 +18,26 @@
|
|
|
18
18
|
"author": "Bouwe (https://bouwe.io)",
|
|
19
19
|
"license": "ISC",
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@types/cors": "^2.8.
|
|
22
|
-
"@types/express": "^4.17.
|
|
23
|
-
"@types/jest": "^29.5.
|
|
24
|
-
"@types/morgan": "^1.9.
|
|
25
|
-
"@types/supertest": "^2.0.
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
27
|
-
"@typescript-eslint/parser": "^6.
|
|
28
|
-
"eslint": "^8.
|
|
29
|
-
"eslint-config-prettier": "^
|
|
30
|
-
"jest": "^29.
|
|
31
|
-
"jest-extended": "^4.0.
|
|
32
|
-
"prettier": "^3.0.
|
|
21
|
+
"@types/cors": "^2.8.15",
|
|
22
|
+
"@types/express": "^4.17.20",
|
|
23
|
+
"@types/jest": "^29.5.7",
|
|
24
|
+
"@types/morgan": "^1.9.8",
|
|
25
|
+
"@types/supertest": "^2.0.15",
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
|
27
|
+
"@typescript-eslint/parser": "^6.10.0",
|
|
28
|
+
"eslint": "^8.53.0",
|
|
29
|
+
"eslint-config-prettier": "^9.0.0",
|
|
30
|
+
"jest": "^29.7.0",
|
|
31
|
+
"jest-extended": "^4.0.2",
|
|
32
|
+
"prettier": "^3.0.3",
|
|
33
33
|
"supertest": "^6.3.3",
|
|
34
34
|
"ts-jest": "^29.1.1",
|
|
35
|
-
"
|
|
35
|
+
"ts-node": "^10.9.1",
|
|
36
|
+
"typescript": "^5.2.2"
|
|
36
37
|
},
|
|
37
38
|
"dependencies": {
|
|
38
39
|
"@rakered/mongo": "^1.6.0",
|
|
40
|
+
"ajv": "^8.12.0",
|
|
39
41
|
"connect-pause": "^0.1.0",
|
|
40
42
|
"cors": "^2.8.5",
|
|
41
43
|
"express": "^4.18.2",
|
package/queries/in-memory.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
declare function
|
|
3
|
-
declare function
|
|
4
|
-
declare function
|
|
5
|
-
declare function
|
|
6
|
-
declare function
|
|
7
|
-
declare function
|
|
8
|
-
declare function
|
|
1
|
+
import { Item } from './types';
|
|
2
|
+
declare function connectToDatabase(): Promise<void>;
|
|
3
|
+
declare function getAll(resource: string): Promise<unknown[]>;
|
|
4
|
+
declare function getById(resource: string, id: string): Promise<unknown>;
|
|
5
|
+
declare function create(resource: string, item: Item): Promise<unknown>;
|
|
6
|
+
declare function update(resource: string, item: Item): Promise<unknown>;
|
|
7
|
+
declare function replace(resource: string, item: Item): Promise<unknown>;
|
|
8
|
+
declare function deleteById(resource: string, id: string): Promise<void>;
|
|
9
|
+
declare function deleteAll(resource: string): Promise<void>;
|
|
9
10
|
declare const _default: {
|
|
10
11
|
connectToDatabase: typeof connectToDatabase;
|
|
11
12
|
getAll: typeof getAll;
|
package/queries/in-memory.js
CHANGED
|
@@ -1,34 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
2
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
23
|
+
var data = {};
|
|
4
24
|
function connectToDatabase() {
|
|
5
|
-
|
|
25
|
+
return new Promise(function (resolve) {
|
|
26
|
+
resolve();
|
|
27
|
+
});
|
|
6
28
|
}
|
|
7
29
|
function getAll(resource) {
|
|
8
30
|
createResourceArrayIfNecessary(resource);
|
|
9
|
-
return new Promise((resolve)
|
|
31
|
+
return new Promise(function (resolve) {
|
|
10
32
|
resolve(data[resource]);
|
|
11
33
|
});
|
|
12
34
|
}
|
|
13
35
|
function getById(resource, id) {
|
|
14
36
|
createResourceArrayIfNecessary(resource);
|
|
15
|
-
return new Promise((resolve)
|
|
16
|
-
resolve(data[resource].find((item)
|
|
37
|
+
return new Promise(function (resolve) {
|
|
38
|
+
resolve(data[resource].find(function (item) { return item.id === id; }));
|
|
17
39
|
});
|
|
18
40
|
}
|
|
19
41
|
function create(resource, item) {
|
|
20
42
|
createResourceArrayIfNecessary(resource);
|
|
21
|
-
|
|
22
|
-
data[resource] = [
|
|
23
|
-
return new Promise((resolve)
|
|
43
|
+
var newItem = __assign(__assign({}, item), { id: String(new Date().getTime()) });
|
|
44
|
+
data[resource] = __spreadArray(__spreadArray([], data[resource], true), [newItem], false);
|
|
45
|
+
return new Promise(function (resolve) {
|
|
24
46
|
resolve(newItem);
|
|
25
47
|
});
|
|
26
48
|
}
|
|
27
49
|
function update(resource, item) {
|
|
28
50
|
createResourceArrayIfNecessary(resource);
|
|
29
|
-
|
|
30
|
-
data[resource] = [
|
|
31
|
-
return new Promise((resolve)
|
|
51
|
+
var updatedItem = __assign({}, item);
|
|
52
|
+
data[resource] = __spreadArray(__spreadArray([], data[resource].filter(function (r) { return r.id !== item.id; }), true), [updatedItem], false);
|
|
53
|
+
return new Promise(function (resolve) {
|
|
32
54
|
resolve(updatedItem);
|
|
33
55
|
});
|
|
34
56
|
}
|
|
@@ -37,30 +59,30 @@ function replace(resource, item) {
|
|
|
37
59
|
}
|
|
38
60
|
function deleteById(resource, id) {
|
|
39
61
|
createResourceArrayIfNecessary(resource);
|
|
40
|
-
data[resource] = data[resource].filter((item)
|
|
41
|
-
return new Promise((resolve)
|
|
62
|
+
data[resource] = data[resource].filter(function (item) { return item.id !== id; });
|
|
63
|
+
return new Promise(function (resolve) {
|
|
42
64
|
resolve();
|
|
43
65
|
});
|
|
44
66
|
}
|
|
45
67
|
function deleteAll(resource) {
|
|
46
68
|
createResourceArrayIfNecessary(resource);
|
|
47
69
|
data[resource] = [];
|
|
48
|
-
return new Promise((resolve)
|
|
49
|
-
resolve(
|
|
70
|
+
return new Promise(function (resolve) {
|
|
71
|
+
resolve();
|
|
50
72
|
});
|
|
51
73
|
}
|
|
52
74
|
function createResourceArrayIfNecessary(resource) {
|
|
53
|
-
if (!
|
|
75
|
+
if (!Object.hasOwn(data, resource))
|
|
54
76
|
data[resource] = [];
|
|
55
77
|
}
|
|
56
78
|
exports.default = {
|
|
57
|
-
connectToDatabase,
|
|
58
|
-
getAll,
|
|
59
|
-
getById,
|
|
60
|
-
create,
|
|
61
|
-
update,
|
|
62
|
-
replace,
|
|
63
|
-
deleteById,
|
|
64
|
-
deleteAll,
|
|
79
|
+
connectToDatabase: connectToDatabase,
|
|
80
|
+
getAll: getAll,
|
|
81
|
+
getById: getById,
|
|
82
|
+
create: create,
|
|
83
|
+
update: update,
|
|
84
|
+
replace: replace,
|
|
85
|
+
deleteById: deleteById,
|
|
86
|
+
deleteAll: deleteAll,
|
|
65
87
|
};
|
|
66
88
|
//# sourceMappingURL=in-memory.js.map
|
package/queries/in-memory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory.js","sourceRoot":"","sources":["../../src/queries/in-memory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"in-memory.js","sourceRoot":"","sources":["../../src/queries/in-memory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,IAAI,GAA8B,EAAE,CAAA;AAE1C,SAAS,iBAAiB;IACxB,OAAO,IAAI,OAAO,CAAO,UAAC,OAAO;QAC/B,OAAO,EAAE,CAAA;IACX,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,MAAM,CAAC,QAAgB;IAC9B,8BAA8B,CA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