remult 0.14.2 → 0.14.5

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.
Files changed (70) hide show
  1. package/assign.js +1 -5
  2. package/classType.js +1 -2
  3. package/graphql.js +84 -146
  4. package/index.d.ts +13 -0
  5. package/index.js +25 -55
  6. package/inputTypes.js +9 -16
  7. package/package.json +6 -1
  8. package/postgres/index.js +1 -4
  9. package/postgres/postgres-data-provider.js +165 -364
  10. package/postgres/postgresColumnSyntax.js +4 -8
  11. package/remult-express.js +6 -10
  12. package/remult-knex/index.js +300 -720
  13. package/remult-middleware.js +24 -30
  14. package/remult-mongo.js +172 -406
  15. package/server/JsonEntityFileStorage.js +10 -15
  16. package/server/expressBridge.js +383 -569
  17. package/server/index.js +4 -11
  18. package/server/register-actions-on-server.js +12 -38
  19. package/server/register-entities-on-server.js +9 -13
  20. package/src/__EntityValueProvider.js +1 -2
  21. package/src/__RowsOfDataForTesting.js +1 -2
  22. package/src/backend-tests/backend-database-test-setup.backend-spec.js +72 -190
  23. package/src/backend-tests/my-test.backend-spec.js +45 -114
  24. package/src/column-interfaces.js +2 -6
  25. package/src/column.js +71 -113
  26. package/src/context.js +174 -330
  27. package/src/data-api.js +162 -326
  28. package/src/data-interfaces.js +7 -11
  29. package/src/data-providers/array-entity-data-provider.js +171 -286
  30. package/src/data-providers/in-memory-database.js +12 -27
  31. package/src/data-providers/json-data-provider.js +41 -77
  32. package/src/data-providers/rest-data-provider.js +102 -189
  33. package/src/data-providers/sql-database.js +223 -403
  34. package/src/data-providers/web-sql-data-provider.js +78 -139
  35. package/src/entity.js +1 -2
  36. package/src/filter/filter-consumer-bridge-to-sql-request.js +106 -248
  37. package/src/filter/filter-consumer-bridge-to-url-builder.js +1 -2
  38. package/src/filter/filter-interfaces.js +277 -440
  39. package/src/id-entity.js +8 -17
  40. package/src/remult3/RepositoryImplementation.js +1191 -2367
  41. package/src/remult3/index.js +2 -5
  42. package/src/remult3/remult3.js +1 -2
  43. package/src/server-action.js +294 -528
  44. package/src/shared-tests/db-tests-setup.js +49 -153
  45. package/src/shared-tests/db-tests.db-tests.js +660 -1566
  46. package/src/shared-tests/deleteAll.js +3 -20
  47. package/src/shared-tests/entityWithValidations.js +52 -79
  48. package/src/shared-tests/index.js +4 -6
  49. package/src/shared-tests/test-custom-id-column.spec.js +37 -85
  50. package/src/shared-tests/test-special-value.spec.js +64 -104
  51. package/src/shared-tests/test-update-with-null.spec.js +28 -49
  52. package/src/sort.js +38 -95
  53. package/src/sql-command.js +1 -2
  54. package/src/tests/Done.js +7 -13
  55. package/src/tests/TestDataApiResponse.js +15 -22
  56. package/src/tests/c.js +21 -27
  57. package/src/tests/createData.js +20 -48
  58. package/src/tests/d.js +19 -27
  59. package/src/tests/dWithPrefilter.js +31 -44
  60. package/src/tests/entityForCustomFilter.js +42 -66
  61. package/src/tests/entityWithValidationsOnColumn.js +21 -29
  62. package/src/tests/frontend-database-tests-setup.spec.js +35 -98
  63. package/src/tests/h.js +35 -44
  64. package/src/tests/remult-3-entities.js +71 -80
  65. package/src/tests/tasks.js +23 -29
  66. package/src/tests/testHelper.spec.js +170 -322
  67. package/src/tests/testModel/models.js +25 -33
  68. package/src/validators.js +32 -59
  69. package/urlBuilder.js +8 -14
  70. package/valueConverters.js +161 -160
@@ -1,77 +1,64 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JobsInQueueEntity = exports.EntityQueueStorage = exports.ExpressRequestBridgeToDataApiRequest = exports.SiteArea = exports.remultMiddlewareBase = void 0;
4
- var tslib_1 = require("tslib");
5
- var __1 = require("../");
6
- var register_actions_on_server_1 = require("./register-actions-on-server");
7
- var register_entities_on_server_1 = require("./register-entities-on-server");
8
- var JsonEntityFileStorage_1 = require("./JsonEntityFileStorage");
9
- var server_action_1 = require("../src/server-action");
10
- var data_api_1 = require("../src/data-api");
11
- var context_1 = require("../src/context");
12
- var remult3_1 = require("../src/remult3");
13
- function remultMiddlewareBase(app, options) {
14
- var _this = this;
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { Remult, IdEntity, Entity, Fields, JsonDataProvider } from '../';
3
+ import { registerActionsOnServer } from './register-actions-on-server';
4
+ import { registerEntitiesOnServer } from './register-entities-on-server';
5
+ import { JsonEntityFileStorage } from './JsonEntityFileStorage';
6
+ import { Action, actionInfo } from '../src/server-action';
7
+ import { DataApi, serializeError } from '../src/data-api';
8
+ import { allEntities } from '../src/context';
9
+ import { getEntityKey } from '../src/remult3';
10
+ export function remultMiddlewareBase(app, options) {
15
11
  if (!options) {
16
12
  options = {};
17
13
  }
18
- server_action_1.actionInfo.runningOnServer = true;
14
+ actionInfo.runningOnServer = true;
19
15
  if (options.defaultGetLimit) {
20
- data_api_1.DataApi.defaultGetLimit = options.defaultGetLimit;
16
+ DataApi.defaultGetLimit = options.defaultGetLimit;
21
17
  }
22
18
  if (!options.queueStorage) {
23
19
  options.queueStorage = new InMemoryQueueStorage();
24
20
  }
25
- var dataProvider;
21
+ let dataProvider;
26
22
  if (typeof options.dataProvider === "function") {
27
23
  dataProvider = options.dataProvider();
28
24
  }
29
25
  else
30
26
  dataProvider = Promise.resolve(options.dataProvider);
31
- dataProvider = dataProvider.then(function (dp) {
27
+ dataProvider = dataProvider.then(dp => {
32
28
  if (dp)
33
29
  return dp;
34
- return new __1.JsonDataProvider(new JsonEntityFileStorage_1.JsonEntityFileStorage('./db'));
30
+ return new JsonDataProvider(new JsonEntityFileStorage('./db'));
35
31
  });
36
32
  if (options.initApi) {
37
- dataProvider = dataProvider.then(function (dp) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
38
- var remult;
39
- return tslib_1.__generator(this, function (_a) {
40
- switch (_a.label) {
41
- case 0:
42
- remult = new __1.Remult(dp);
43
- return [4 /*yield*/, options.initApi(remult)];
44
- case 1:
45
- _a.sent();
46
- return [2 /*return*/, dp];
47
- }
48
- });
49
- }); });
33
+ dataProvider = dataProvider.then(async (dp) => {
34
+ var remult = new Remult(dp);
35
+ await options.initApi(remult);
36
+ return dp;
37
+ });
50
38
  }
51
- var bridge = new ExpressBridge(app, new inProcessQueueHandler(options.queueStorage), options.initRequest, dataProvider);
39
+ let bridge = new ExpressBridge(app, new inProcessQueueHandler(options.queueStorage), options.initRequest, dataProvider);
52
40
  if (options.logApiEndPoints !== undefined)
53
41
  bridge.logApiEndPoints = options.logApiEndPoints;
54
42
  if (options.rootPath === undefined)
55
- options.rootPath = __1.Remult.apiBaseUrl;
56
- var apiArea = bridge.addArea(options.rootPath);
43
+ options.rootPath = Remult.apiBaseUrl;
44
+ let apiArea = bridge.addArea(options.rootPath);
57
45
  if (!options.disableAutoApi) {
58
- var actions = [];
46
+ let actions = [];
59
47
  if (options.entities)
60
- actions.push.apply(actions, tslib_1.__spread(options.entities));
48
+ actions.push(...options.entities);
61
49
  if (options.controllers)
62
- actions.push.apply(actions, tslib_1.__spread(options.controllers));
63
- register_actions_on_server_1.registerActionsOnServer(apiArea, actions);
64
- register_entities_on_server_1.registerEntitiesOnServer(apiArea, options.entities);
50
+ actions.push(...options.controllers);
51
+ registerActionsOnServer(apiArea, actions);
52
+ registerEntitiesOnServer(apiArea, options.entities);
65
53
  }
66
54
  return Object.assign(app, {
67
- getRemult: function (req) { return bridge.getRemult(req); },
68
- openApiDoc: function (options) { return bridge.openApiDoc(options); },
69
- addArea: function (x) { return bridge.addArea(x); }
55
+ getRemult: (req) => bridge.getRemult(req),
56
+ openApiDoc: (options) => bridge.openApiDoc(options),
57
+ addArea: x => bridge.addArea(x)
70
58
  });
71
59
  }
72
- exports.remultMiddlewareBase = remultMiddlewareBase;
73
- var ExpressBridge = /** @class */ (function () {
74
- function ExpressBridge(app, queue, initRequest, dataProvider) {
60
+ class ExpressBridge {
61
+ constructor(app, queue, initRequest, dataProvider) {
75
62
  this.app = app;
76
63
  this.queue = queue;
77
64
  this.initRequest = initRequest;
@@ -80,12 +67,11 @@ var ExpressBridge = /** @class */ (function () {
80
67
  this.backendMethodsOpenApi = [];
81
68
  this.logApiEndPoints = true;
82
69
  }
83
- ExpressBridge.prototype.openApiDoc = function (options) {
84
- var e_1, _a, e_2, _b;
85
- var r = new __1.Remult();
70
+ openApiDoc(options) {
71
+ let r = new Remult();
86
72
  if (!options.version)
87
73
  options.version = "1.0.0";
88
- var spec = {
74
+ let spec = {
89
75
  info: { title: options.title, version: options.version },
90
76
  openapi: "3.0.0",
91
77
  //swagger: "2.0",
@@ -101,7 +87,7 @@ var ExpressBridge = /** @class */ (function () {
101
87
  },
102
88
  paths: {}
103
89
  };
104
- var validationError = {
90
+ let validationError = {
105
91
  "400": {
106
92
  "description": "Error: Bad Request",
107
93
  "content": {
@@ -113,86 +99,75 @@ var ExpressBridge = /** @class */ (function () {
113
99
  }
114
100
  }
115
101
  };
116
- var security = {
102
+ let security = {
117
103
  "security": [
118
104
  {
119
105
  "bearerAuth": []
120
106
  }
121
107
  ]
122
108
  };
123
- var secureBase = function (condition, def, item) {
109
+ let secureBase = (condition, def, item) => {
124
110
  if (condition === undefined)
125
111
  condition = def;
126
112
  if (condition != false) {
127
113
  if (condition != true) {
128
- item = tslib_1.__assign(tslib_1.__assign({}, item), security);
114
+ item = { ...item, ...security };
129
115
  item.responses["403"] = { description: "forbidden" };
130
116
  }
131
117
  return item;
132
118
  }
133
119
  };
134
- var _loop_1 = function (e) {
135
- var e_3, _a;
136
- var meta = r.repo(e).metadata;
137
- var key = remult3_1.getEntityKey(e);
138
- var parameters = [];
120
+ for (const e of allEntities) {
121
+ let meta = r.repo(e).metadata;
122
+ let key = getEntityKey(e);
123
+ let parameters = [];
139
124
  if (key) {
140
- var properties = {};
141
- try {
142
- for (var _b = (e_3 = void 0, tslib_1.__values(meta.fields)), _c = _b.next(); !_c.done; _c = _b.next()) {
143
- var f = _c.value;
144
- var type = f.valueType == String ? "string" :
145
- f.valueType == Boolean ? "boolean" :
146
- f.valueType == Date ? "string" :
147
- f.valueType == Number ? "number" :
148
- "object";
149
- properties[f.key] = {
150
- type: type
151
- };
152
- parameters.push({
153
- "name": f.key,
154
- "in": "query",
155
- "description": "filter equal to " + f.key,
156
- "required": false,
157
- "style": "simple",
158
- type: type
159
- });
160
- parameters.push({
161
- "name": f.key + "_ne",
162
- "in": "query",
163
- "description": "filter not equal to " + f.key,
164
- "required": false,
165
- "style": "simple",
166
- type: type
167
- });
168
- }
169
- }
170
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
171
- finally {
172
- try {
173
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
174
- }
175
- finally { if (e_3) throw e_3.error; }
125
+ let properties = {};
126
+ for (const f of meta.fields) {
127
+ let type = f.valueType == String ? "string" :
128
+ f.valueType == Boolean ? "boolean" :
129
+ f.valueType == Date ? "string" :
130
+ f.valueType == Number ? "number" :
131
+ "object";
132
+ properties[f.key] = {
133
+ type
134
+ };
135
+ parameters.push({
136
+ "name": f.key,
137
+ "in": "query",
138
+ "description": "filter equal to " + f.key,
139
+ "required": false,
140
+ "style": "simple",
141
+ type
142
+ });
143
+ parameters.push({
144
+ "name": f.key + "_ne",
145
+ "in": "query",
146
+ "description": "filter not equal to " + f.key,
147
+ "required": false,
148
+ "style": "simple",
149
+ type
150
+ });
176
151
  }
177
152
  spec.components.schemas[key] = {
178
153
  type: "object",
179
- properties: properties
154
+ properties
180
155
  };
181
- var definition = {
156
+ let definition = {
182
157
  "$ref": "#/components/schemas/" + key
183
158
  };
184
- var secure = function (condition, def, item) {
159
+ let secure = (condition, def, item) => {
185
160
  item.tags = [meta.key];
186
161
  if (condition === undefined)
187
162
  condition = meta.options.allowApiCrud;
188
163
  return secureBase(condition, def, item);
189
164
  };
190
- var apiPath = spec.paths['/api/' + key] = {};
191
- var apiPathWithId = spec.paths['/api/' + key + "/{id}"] = {};
165
+ let apiPath = spec.paths['/api/' + key] = {};
166
+ let apiPathWithId = spec.paths['/api/' + key + "/{id}"] = {};
192
167
  //https://github.com/2fd/open-api.d.ts
193
168
  apiPath.get = secure(meta.options.allowApiRead, true, {
194
169
  description: "return an array of " + key + ". supports filter operators. For more info on filtering [see this article](https://remult.dev/docs/rest-api.html#filter)",
195
- parameters: tslib_1.__spread([{
170
+ parameters: [{
196
171
  "name": "_limit",
197
172
  "in": "query",
198
173
  "description": "limit the number of returned rows, default 100",
@@ -220,7 +195,7 @@ var ExpressBridge = /** @class */ (function () {
220
195
  "description": "the sort order to user for the columns in `_sort`",
221
196
  "required": false,
222
197
  "schema": { "type": "string" }
223
- }], parameters),
198
+ }, ...parameters],
224
199
  responses: {
225
200
  "200": {
226
201
  "description": "returns an array of " + key,
@@ -235,14 +210,14 @@ var ExpressBridge = /** @class */ (function () {
235
210
  },
236
211
  }
237
212
  });
238
- var idParameter = {
213
+ let idParameter = {
239
214
  "name": "id",
240
215
  "in": "path",
241
216
  "description": "id of " + key,
242
217
  "required": true,
243
218
  "schema": { "type": "string" },
244
219
  };
245
- var itemInBody = {
220
+ let itemInBody = {
246
221
  "requestBody": {
247
222
  "content": {
248
223
  "application/json": {
@@ -253,10 +228,13 @@ var ExpressBridge = /** @class */ (function () {
253
228
  }
254
229
  }
255
230
  };
256
- apiPath.post = secure(meta.options.allowApiInsert, false, tslib_1.__assign(tslib_1.__assign({
231
+ apiPath.post = secure(meta.options.allowApiInsert, false, {
257
232
  //"summary": "insert a " + key,
258
233
  //"description": "insert a " + key,
259
- "produces": ["application/json"] }, itemInBody), { "responses": tslib_1.__assign({ "201": {
234
+ "produces": ["application/json"],
235
+ ...itemInBody,
236
+ "responses": {
237
+ "201": {
260
238
  "description": "Created",
261
239
  "content": {
262
240
  "application/json": {
@@ -265,7 +243,10 @@ var ExpressBridge = /** @class */ (function () {
265
243
  }
266
244
  }
267
245
  }
268
- } }, validationError) }));
246
+ },
247
+ ...validationError
248
+ }
249
+ });
269
250
  apiPathWithId.get = secure(meta.options.allowApiRead, true, {
270
251
  parameters: [idParameter],
271
252
  responses: {
@@ -281,12 +262,16 @@ var ExpressBridge = /** @class */ (function () {
281
262
  },
282
263
  }
283
264
  });
284
- apiPathWithId.put = secure(meta.options.allowApiUpdate, false, tslib_1.__assign(tslib_1.__assign({
265
+ apiPathWithId.put = secure(meta.options.allowApiUpdate, false, {
285
266
  //"summary": "Update a " + key,
286
267
  //"description": "Update a " + key,
287
- "produces": ["application/json"], "parameters": [
268
+ "produces": ["application/json"],
269
+ "parameters": [
288
270
  idParameter
289
- ] }, itemInBody), { "responses": tslib_1.__assign({ "200": {
271
+ ],
272
+ ...itemInBody,
273
+ "responses": {
274
+ "200": {
290
275
  "description": "successful operation",
291
276
  "content": {
292
277
  "application/json": {
@@ -295,7 +280,10 @@ var ExpressBridge = /** @class */ (function () {
295
280
  }
296
281
  }
297
282
  }
298
- } }, validationError) }));
283
+ },
284
+ ...validationError
285
+ }
286
+ });
299
287
  apiPathWithId.delete = secure(meta.options.allowApiDelete, false, {
300
288
  // "summary": "Delete a " + key,
301
289
  // "description": "Delete a " + key,
@@ -303,72 +291,55 @@ var ExpressBridge = /** @class */ (function () {
303
291
  "parameters": [
304
292
  idParameter
305
293
  ],
306
- "responses": tslib_1.__assign({ "204": {
294
+ "responses": {
295
+ "204": {
307
296
  "description": "Deleted"
308
- } }, validationError)
297
+ },
298
+ ...validationError
299
+ }
309
300
  });
310
301
  }
311
- };
312
- try {
313
- for (var allEntities_1 = tslib_1.__values(context_1.allEntities), allEntities_1_1 = allEntities_1.next(); !allEntities_1_1.done; allEntities_1_1 = allEntities_1.next()) {
314
- var e = allEntities_1_1.value;
315
- _loop_1(e);
316
- }
317
- }
318
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
319
- finally {
320
- try {
321
- if (allEntities_1_1 && !allEntities_1_1.done && (_a = allEntities_1.return)) _a.call(allEntities_1);
322
- }
323
- finally { if (e_1) throw e_1.error; }
324
302
  }
325
- try {
326
- for (var _c = tslib_1.__values(this.backendMethodsOpenApi), _d = _c.next(); !_d.done; _d = _c.next()) {
327
- var b = _d.value;
328
- spec.paths[b.path] = {
329
- post: secureBase(b.allowed, false, {
330
- "produces": ["application/json"],
331
- "tags": [b.tag],
332
- "requestBody": {
303
+ for (const b of this.backendMethodsOpenApi) {
304
+ spec.paths[b.path] = {
305
+ post: secureBase(b.allowed, false, {
306
+ "produces": ["application/json"],
307
+ "tags": [b.tag],
308
+ "requestBody": {
309
+ "content": {
310
+ "application/json": {
311
+ "schema": {
312
+ "type": "object",
313
+ properties: {
314
+ "args": {
315
+ "type": "array",
316
+ "items": { "type": "string" }
317
+ }
318
+ }
319
+ }
320
+ }
321
+ }
322
+ },
323
+ "responses": {
324
+ "201": {
325
+ "description": "Created",
333
326
  "content": {
334
327
  "application/json": {
335
328
  "schema": {
336
329
  "type": "object",
337
330
  properties: {
338
- "args": {
339
- "type": "array",
340
- "items": { "type": "string" }
331
+ "data": {
332
+ "type": "object"
341
333
  }
342
334
  }
343
335
  }
344
336
  }
345
337
  }
346
338
  },
347
- "responses": tslib_1.__assign({ "201": {
348
- "description": "Created",
349
- "content": {
350
- "application/json": {
351
- "schema": {
352
- "type": "object",
353
- properties: {
354
- "data": {
355
- "type": "object"
356
- }
357
- }
358
- }
359
- }
360
- }
361
- } }, validationError)
362
- })
363
- };
364
- }
365
- }
366
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
367
- finally {
368
- try {
369
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
370
- }
371
- finally { if (e_2) throw e_2.error; }
339
+ ...validationError
340
+ }
341
+ })
342
+ };
372
343
  }
373
344
  spec.components.schemas["InvalidResponse"] = {
374
345
  "type": "object",
@@ -382,472 +353,315 @@ var ExpressBridge = /** @class */ (function () {
382
353
  }
383
354
  };
384
355
  return spec;
385
- };
386
- ExpressBridge.prototype.addArea = function (rootUrl) {
356
+ }
357
+ addArea(rootUrl) {
387
358
  var r = new SiteArea(this, this.app, rootUrl, this.logApiEndPoints);
388
359
  if (!this.firstArea) {
389
360
  this.firstArea = r;
390
361
  }
391
362
  return r;
392
- };
393
- ExpressBridge.prototype.getRemult = function (req) {
394
- return tslib_1.__awaiter(this, void 0, void 0, function () {
395
- return tslib_1.__generator(this, function (_a) {
396
- return [2 /*return*/, this.firstArea.getRemult(req)];
397
- });
398
- });
399
- };
400
- return ExpressBridge;
401
- }());
402
- var SiteArea = /** @class */ (function () {
403
- function SiteArea(bridge, app, rootUrl, logApiEndpoints) {
363
+ }
364
+ async getRemult(req) {
365
+ return this.firstArea.getRemult(req);
366
+ }
367
+ }
368
+ export class SiteArea {
369
+ constructor(bridge, app, rootUrl, logApiEndpoints) {
404
370
  this.bridge = bridge;
405
371
  this.app = app;
406
372
  this.rootUrl = rootUrl;
407
373
  this.logApiEndpoints = logApiEndpoints;
408
374
  }
409
- SiteArea.prototype.add = function (key, dataApiFactory) {
410
- var _this = this;
411
- var myRoute = this.rootUrl + '/' + key;
375
+ add(key, dataApiFactory) {
376
+ let myRoute = this.rootUrl + '/' + key;
412
377
  if (this.logApiEndpoints)
413
378
  console.log(myRoute);
414
379
  this.app.route(myRoute)
415
- .get(this.process(function (c, req, res) {
416
- return dataApiFactory(c).httpGet(res, req);
417
- })).put(this.process(function (c, req, res, orig) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
418
- return [2 /*return*/, dataApiFactory(c).put(res, '', orig.body)];
419
- }); }); }))
420
- .delete(this.process(function (c, req, res, orig) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
421
- return [2 /*return*/, dataApiFactory(c).delete(res, '')];
422
- }); }); }))
423
- .post(this.process(function (c, req, res, orig) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
424
- return [2 /*return*/, dataApiFactory(c).httpPost(res, req, orig.body)];
425
- }); }); }));
380
+ .get(this.process((c, req, res) => dataApiFactory(c).httpGet(res, req))).put(this.process(async (c, req, res, orig) => dataApiFactory(c).put(res, '', orig.body)))
381
+ .delete(this.process(async (c, req, res, orig) => dataApiFactory(c).delete(res, '')))
382
+ .post(this.process(async (c, req, res, orig) => dataApiFactory(c).httpPost(res, req, orig.body)));
426
383
  this.app.route(myRoute + '/:id')
427
384
  //@ts-ignore
428
- .get(this.process(function (c, req, res, orig) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
429
- return [2 /*return*/, dataApiFactory(c).get(res, orig.params.id)];
430
- }); }); }))
385
+ .get(this.process(async (c, req, res, orig) => dataApiFactory(c).get(res, orig.params.id)))
431
386
  //@ts-ignore
432
- .put(this.process(function (c, req, res, orig) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
433
- return [2 /*return*/, dataApiFactory(c).put(res, orig.params.id, orig.body)];
434
- }); }); }))
387
+ .put(this.process(async (c, req, res, orig) => dataApiFactory(c).put(res, orig.params.id, orig.body)))
435
388
  //@ts-ignore
436
- .delete(this.process(function (c, req, res, orig) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
437
- return [2 /*return*/, dataApiFactory(c).delete(res, orig.params.id)];
438
- }); }); }));
439
- };
440
- SiteArea.prototype.process = function (what) {
441
- var _this = this;
442
- return function (req, res) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
443
- var myReq, myRes, remult, _a, _b, user;
444
- return tslib_1.__generator(this, function (_c) {
445
- switch (_c.label) {
446
- case 0:
447
- myReq = new ExpressRequestBridgeToDataApiRequest(req);
448
- myRes = new ExpressResponseBridgeToDataApiResponse(res, req);
449
- remult = new __1.Remult();
450
- _b = (_a = remult).setDataProvider;
451
- return [4 /*yield*/, this.bridge.dataProvider];
452
- case 1:
453
- _b.apply(_a, [_c.sent()]);
454
- if (req) {
455
- user = req['user'];
456
- if (!user)
457
- user = req['auth'];
458
- if (user)
459
- remult.setUser(user);
460
- }
461
- if (!this.bridge.initRequest) return [3 /*break*/, 3];
462
- return [4 /*yield*/, this.bridge.initRequest(remult, req)];
463
- case 2:
464
- _c.sent();
465
- _c.label = 3;
466
- case 3:
467
- what(remult, myReq, myRes, req);
468
- return [2 /*return*/];
469
- }
470
- });
471
- }); };
472
- };
389
+ .delete(this.process(async (c, req, res, orig) => dataApiFactory(c).delete(res, orig.params.id)));
390
+ }
391
+ process(what) {
392
+ return async (req, res) => {
393
+ let myReq = new ExpressRequestBridgeToDataApiRequest(req);
394
+ let myRes = new ExpressResponseBridgeToDataApiResponse(res, req);
395
+ let remult = new Remult();
396
+ remult.setDataProvider(await this.bridge.dataProvider);
397
+ if (req) {
398
+ let user = req['user'];
399
+ if (!user)
400
+ user = req['auth'];
401
+ if (user)
402
+ remult.setUser(user);
403
+ }
404
+ if (this.bridge.initRequest) {
405
+ await this.bridge.initRequest(remult, req);
406
+ }
407
+ what(remult, myReq, myRes, req);
408
+ };
409
+ }
473
410
  ;
474
- SiteArea.prototype.getRemult = function (req) {
475
- return tslib_1.__awaiter(this, void 0, void 0, function () {
476
- var remult;
477
- var _this = this;
478
- return tslib_1.__generator(this, function (_a) {
479
- switch (_a.label) {
480
- case 0: return [4 /*yield*/, this.process(function (c) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
481
- return tslib_1.__generator(this, function (_a) {
482
- remult = c;
483
- return [2 /*return*/];
484
- });
485
- }); })(req, undefined)];
486
- case 1:
487
- _a.sent();
488
- return [2 /*return*/, remult];
489
- }
490
- });
491
- });
492
- };
493
- SiteArea.prototype.initQueue = function () {
494
- var _this = this;
411
+ async getRemult(req) {
412
+ let remult;
413
+ await this.process(async (c) => {
414
+ remult = c;
415
+ })(req, undefined);
416
+ return remult;
417
+ }
418
+ initQueue() {
495
419
  this.addAction({
496
- __register: function (x) {
497
- x(server_action_1.Action.apiUrlForJobStatus, false, function () { return true; }, function (data, req, res) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
498
- var job, userId;
499
- return tslib_1.__generator(this, function (_a) {
500
- switch (_a.label) {
501
- case 0: return [4 /*yield*/, this.bridge.queue.getJobInfo(data.queuedJobId)];
502
- case 1:
503
- job = _a.sent();
504
- userId = undefined;
505
- if (req === null || req === void 0 ? void 0 : req.user)
506
- userId = req.user.id;
507
- if (job.userId == '')
508
- job.userId = undefined;
509
- if (userId != job.userId)
510
- res.forbidden();
511
- else
512
- res.success(job.info);
513
- return [2 /*return*/];
514
- }
515
- });
516
- }); });
420
+ __register: x => {
421
+ x(Action.apiUrlForJobStatus, false, () => true, async (data, req, res) => {
422
+ let job = await this.bridge.queue.getJobInfo(data.queuedJobId);
423
+ let userId = undefined;
424
+ if (req?.user)
425
+ userId = req.user.id;
426
+ if (job.userId == '')
427
+ job.userId = undefined;
428
+ if (userId != job.userId)
429
+ res.forbidden();
430
+ else
431
+ res.success(job.info);
432
+ });
517
433
  }
518
434
  });
519
- this.initQueue = function () { };
520
- };
521
- SiteArea.prototype.addAction = function (action) {
522
- var _this = this;
523
- action.__register(function (url, queue, allowed, what) {
524
- var myUrl = _this.rootUrl + '/' + url;
525
- var tag = (function () {
526
- var split = url.split('/');
435
+ this.initQueue = () => { };
436
+ }
437
+ addAction(action) {
438
+ action.__register((url, queue, allowed, what) => {
439
+ let myUrl = this.rootUrl + '/' + url;
440
+ let tag = (() => {
441
+ let split = url.split('/');
527
442
  if (split.length == 1)
528
443
  return 'Static Backend Methods';
529
444
  else
530
445
  return split[0];
531
446
  })();
532
- _this.bridge.backendMethodsOpenApi.push({ path: myUrl, allowed: allowed, tag: tag });
533
- if (_this.logApiEndpoints)
447
+ this.bridge.backendMethodsOpenApi.push({ path: myUrl, allowed, tag });
448
+ if (this.logApiEndpoints)
534
449
  console.log(myUrl);
535
450
  if (queue) {
536
- _this.initQueue();
537
- _this.bridge.queue.mapQueuedAction(myUrl, what);
451
+ this.initQueue();
452
+ this.bridge.queue.mapQueuedAction(myUrl, what);
538
453
  }
539
- _this.app.route(myUrl).post(_this.process(function (remult, req, res, orig) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
540
- var r;
541
- var _a;
542
- return tslib_1.__generator(this, function (_b) {
543
- switch (_b.label) {
544
- case 0:
545
- if (!queue) return [3 /*break*/, 2];
546
- _a = {};
547
- return [4 /*yield*/, this.bridge.queue.submitJob(myUrl, remult, orig.body)];
548
- case 1:
549
- r = (_a.queuedJobId = _b.sent(),
550
- _a);
551
- res.success(r);
552
- return [3 /*break*/, 3];
553
- case 2: return [2 /*return*/, what(orig.body, remult, res)];
554
- case 3: return [2 /*return*/];
555
- }
556
- });
557
- }); }));
454
+ this.app.route(myUrl).post(this.process(async (remult, req, res, orig) => {
455
+ if (queue) {
456
+ let r = {
457
+ queuedJobId: await this.bridge.queue.submitJob(myUrl, remult, orig.body)
458
+ };
459
+ res.success(r);
460
+ }
461
+ else
462
+ return what(orig.body, remult, res);
463
+ }));
558
464
  });
559
- };
560
- return SiteArea;
561
- }());
562
- exports.SiteArea = SiteArea;
563
- var ExpressRequestBridgeToDataApiRequest = /** @class */ (function () {
564
- function ExpressRequestBridgeToDataApiRequest(r) {
465
+ }
466
+ }
467
+ export class ExpressRequestBridgeToDataApiRequest {
468
+ constructor(r) {
565
469
  this.r = r;
566
470
  }
567
- ExpressRequestBridgeToDataApiRequest.prototype.get = function (key) {
471
+ get(key) {
568
472
  return this.r.query[key];
569
- };
570
- return ExpressRequestBridgeToDataApiRequest;
571
- }());
572
- exports.ExpressRequestBridgeToDataApiRequest = ExpressRequestBridgeToDataApiRequest;
573
- var ExpressResponseBridgeToDataApiResponse = /** @class */ (function () {
574
- function ExpressResponseBridgeToDataApiResponse(r, req) {
473
+ }
474
+ }
475
+ class ExpressResponseBridgeToDataApiResponse {
476
+ constructor(r, req) {
575
477
  this.r = r;
576
478
  this.req = req;
577
479
  }
578
- ExpressResponseBridgeToDataApiResponse.prototype.forbidden = function () {
480
+ forbidden() {
579
481
  this.sendStatus(403);
580
- };
581
- ExpressResponseBridgeToDataApiResponse.prototype.sendStatus = function (status) {
482
+ }
483
+ sendStatus(status) {
582
484
  this.r.writeHead(status).end();
583
- };
584
- ExpressResponseBridgeToDataApiResponse.prototype.progress = function (progress) {
585
- };
586
- ExpressResponseBridgeToDataApiResponse.prototype.success = function (data) {
485
+ }
486
+ progress(progress) {
487
+ }
488
+ success(data) {
587
489
  this.r.json(data);
588
- };
589
- ExpressResponseBridgeToDataApiResponse.prototype.created = function (data) {
490
+ }
491
+ created(data) {
590
492
  this.r.statusCode = 201;
591
493
  this.r.json(data);
592
- };
593
- ExpressResponseBridgeToDataApiResponse.prototype.deleted = function () {
494
+ }
495
+ deleted() {
594
496
  this.sendStatus(204);
595
- };
596
- ExpressResponseBridgeToDataApiResponse.prototype.notFound = function () {
497
+ }
498
+ notFound() {
597
499
  this.sendStatus(404);
598
- };
599
- ExpressResponseBridgeToDataApiResponse.prototype.error = function (data) {
600
- var _a, _b;
601
- data = data_api_1.serializeError(data);
500
+ }
501
+ error(data) {
502
+ data = serializeError(data);
602
503
  console.error({
603
504
  message: data.message,
604
- stack: (_a = data.stack) === null || _a === void 0 ? void 0 : _a.split('\n'),
605
- url: (_b = this.req.originalUrl) !== null && _b !== void 0 ? _b : this.req.path,
505
+ stack: data.stack?.split('\n'),
506
+ url: this.req.originalUrl ?? this.req.path,
606
507
  method: this.req.method
607
508
  });
608
509
  this.r.status(400).json(data);
609
- };
610
- return ExpressResponseBridgeToDataApiResponse;
611
- }());
510
+ }
511
+ }
612
512
  function throwError() {
613
513
  throw "Invalid";
614
514
  }
615
- var inProcessQueueHandler = /** @class */ (function () {
616
- function inProcessQueueHandler(storage) {
515
+ class inProcessQueueHandler {
516
+ constructor(storage) {
617
517
  this.storage = storage;
618
518
  this.actions = new Map();
619
519
  }
620
- inProcessQueueHandler.prototype.submitJob = function (url, req, body) {
621
- return tslib_1.__awaiter(this, void 0, void 0, function () {
622
- var id, job;
623
- return tslib_1.__generator(this, function (_a) {
624
- switch (_a.label) {
625
- case 0: return [4 /*yield*/, this.storage.createJob(url, req.user ? req.user.id : undefined)];
626
- case 1:
627
- id = _a.sent();
628
- return [4 /*yield*/, this.storage.getJobInfo(id)];
629
- case 2:
630
- job = _a.sent();
631
- this.actions.get(url)(body, req, {
632
- error: function (error) { return job.setErrorResult(data_api_1.serializeError(error)); },
633
- success: function (result) { return job.setResult(result); },
634
- progress: function (progress) { return job.setProgress(progress); }
635
- });
636
- return [2 /*return*/, id];
637
- }
638
- });
520
+ async submitJob(url, req, body) {
521
+ let id = await this.storage.createJob(url, req.user ? req.user.id : undefined);
522
+ let job = await this.storage.getJobInfo(id);
523
+ this.actions.get(url)(body, req, {
524
+ error: error => job.setErrorResult(serializeError(error)),
525
+ success: result => job.setResult(result),
526
+ progress: progress => job.setProgress(progress)
639
527
  });
640
- };
641
- inProcessQueueHandler.prototype.mapQueuedAction = function (url, what) {
528
+ return id;
529
+ }
530
+ mapQueuedAction(url, what) {
642
531
  this.actions.set(url, what);
643
- };
644
- inProcessQueueHandler.prototype.getJobInfo = function (queuedJobId) {
645
- return tslib_1.__awaiter(this, void 0, void 0, function () {
646
- return tslib_1.__generator(this, function (_a) {
647
- switch (_a.label) {
648
- case 0: return [4 /*yield*/, this.storage.getJobInfo(queuedJobId)];
649
- case 1: return [2 /*return*/, _a.sent()];
650
- }
651
- });
652
- });
653
- };
654
- return inProcessQueueHandler;
655
- }());
656
- var InMemoryQueueStorage = /** @class */ (function () {
657
- function InMemoryQueueStorage() {
532
+ }
533
+ async getJobInfo(queuedJobId) {
534
+ return await this.storage.getJobInfo(queuedJobId);
535
+ }
536
+ }
537
+ class InMemoryQueueStorage {
538
+ constructor() {
658
539
  this.jobs = new Map();
659
540
  }
660
- InMemoryQueueStorage.prototype.getJobInfo = function (queuedJobId) {
661
- return tslib_1.__awaiter(this, void 0, void 0, function () {
662
- return tslib_1.__generator(this, function (_a) {
663
- return [2 /*return*/, this.jobs.get(queuedJobId)];
664
- });
665
- });
666
- };
667
- InMemoryQueueStorage.prototype.createJob = function (url, userId) {
668
- return tslib_1.__awaiter(this, void 0, void 0, function () {
669
- var id;
670
- var _this = this;
671
- return tslib_1.__generator(this, function (_a) {
672
- id = this.jobs.size.toString();
673
- this.jobs.set(id, {
674
- info: {
675
- done: false
676
- },
677
- userId: userId,
678
- setErrorResult: function (error) {
679
- var job = _this.jobs.get(id);
680
- job.info.done = true;
681
- job.info.error = error;
682
- },
683
- setResult: function (result) {
684
- var job = _this.jobs.get(id);
685
- job.info.done = true;
686
- job.info.result = result;
687
- },
688
- setProgress: function (progress) {
689
- var job = _this.jobs.get(id);
690
- job.info.progress = progress;
691
- }
692
- });
693
- return [2 /*return*/, id];
694
- });
541
+ async getJobInfo(queuedJobId) {
542
+ return this.jobs.get(queuedJobId);
543
+ }
544
+ async createJob(url, userId) {
545
+ let id = this.jobs.size.toString();
546
+ this.jobs.set(id, {
547
+ info: {
548
+ done: false
549
+ },
550
+ userId: userId,
551
+ setErrorResult: (error) => {
552
+ let job = this.jobs.get(id);
553
+ job.info.done = true;
554
+ job.info.error = error;
555
+ },
556
+ setResult: (result) => {
557
+ let job = this.jobs.get(id);
558
+ job.info.done = true;
559
+ job.info.result = result;
560
+ },
561
+ setProgress: (progress) => {
562
+ let job = this.jobs.get(id);
563
+ job.info.progress = progress;
564
+ }
695
565
  });
696
- };
697
- return InMemoryQueueStorage;
698
- }());
699
- var test = 0;
700
- var EntityQueueStorage = /** @class */ (function () {
701
- function EntityQueueStorage(repo) {
566
+ return id;
567
+ }
568
+ }
569
+ let test = 0;
570
+ export class EntityQueueStorage {
571
+ constructor(repo) {
702
572
  this.repo = repo;
703
573
  this.sync = Promise.resolve();
704
574
  }
705
- EntityQueueStorage.prototype.doSync = function (what) {
706
- return this.sync = this.sync.then(function () { return what(); });
707
- };
708
- EntityQueueStorage.prototype.getJobInfo = function (queuedJobId) {
709
- return tslib_1.__awaiter(this, void 0, void 0, function () {
710
- var q, lastProgress;
711
- var _this = this;
712
- return tslib_1.__generator(this, function (_a) {
713
- switch (_a.label) {
714
- case 0: return [4 /*yield*/, this.repo.findId(queuedJobId)];
715
- case 1:
716
- q = _a.sent();
717
- lastProgress = undefined;
718
- return [2 /*return*/, {
719
- userId: q.userId,
720
- info: {
721
- done: q.done,
722
- error: q.error ? JSON.parse(q.result) : undefined,
723
- result: q.done && !q.error ? JSON.parse(q.result) : undefined,
724
- progress: q.progress
725
- },
726
- setErrorResult: function (error) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
727
- return tslib_1.__generator(this, function (_a) {
728
- switch (_a.label) {
729
- case 0: return [4 /*yield*/, this.sync];
730
- case 1:
731
- _a.sent();
732
- q.error = true;
733
- q.done = true;
734
- q.result = JSON.stringify(error);
735
- q.doneTime = new Date();
736
- q.progress = 1;
737
- return [4 /*yield*/, this.doSync(function () { return q._.save(); })];
738
- case 2:
739
- _a.sent();
740
- return [2 /*return*/];
741
- }
742
- });
743
- }); },
744
- setResult: function (result) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
745
- return tslib_1.__generator(this, function (_a) {
746
- switch (_a.label) {
747
- case 0: return [4 /*yield*/, this.sync];
748
- case 1:
749
- _a.sent();
750
- q.done = true;
751
- q.result = JSON.stringify(result);
752
- q.doneTime = new Date();
753
- return [4 /*yield*/, this.doSync(function () { return q._.save(); })];
754
- case 2:
755
- _a.sent();
756
- return [2 /*return*/];
757
- }
758
- });
759
- }); },
760
- setProgress: function (progress) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
761
- var now;
762
- return tslib_1.__generator(this, function (_a) {
763
- switch (_a.label) {
764
- case 0:
765
- if (progress === 0)
766
- return [2 /*return*/];
767
- now = new Date();
768
- if (lastProgress && now.valueOf() - lastProgress.valueOf() < 200)
769
- return [2 /*return*/];
770
- lastProgress = new Date();
771
- return [4 /*yield*/, this.sync];
772
- case 1:
773
- _a.sent();
774
- q.progress = progress;
775
- return [4 /*yield*/, this.doSync(function () { return q._.save(); })];
776
- case 2:
777
- _a.sent();
778
- return [2 /*return*/];
779
- }
780
- });
781
- }); }
782
- }];
783
- }
784
- });
785
- });
786
- };
787
- EntityQueueStorage.prototype.createJob = function (url, userId) {
788
- return tslib_1.__awaiter(this, void 0, void 0, function () {
789
- var q;
790
- return tslib_1.__generator(this, function (_a) {
791
- switch (_a.label) {
792
- case 0:
793
- q = this.repo.create();
794
- q.userId = userId;
795
- q.submitTime = new Date();
796
- q.url = url;
797
- return [4 /*yield*/, q._.save()];
798
- case 1:
799
- _a.sent();
800
- return [2 /*return*/, q.id];
801
- }
802
- });
803
- });
804
- };
805
- return EntityQueueStorage;
806
- }());
807
- exports.EntityQueueStorage = EntityQueueStorage;
808
- var JobsInQueueEntity = /** @class */ (function (_super) {
809
- tslib_1.__extends(JobsInQueueEntity, _super);
810
- function JobsInQueueEntity() {
811
- return _super !== null && _super.apply(this, arguments) || this;
812
- }
813
- tslib_1.__decorate([
814
- __1.Fields.string(),
815
- tslib_1.__metadata("design:type", String)
816
- ], JobsInQueueEntity.prototype, "userId", void 0);
817
- tslib_1.__decorate([
818
- __1.Fields.string(),
819
- tslib_1.__metadata("design:type", String)
820
- ], JobsInQueueEntity.prototype, "url", void 0);
821
- tslib_1.__decorate([
822
- __1.Fields.date(),
823
- tslib_1.__metadata("design:type", Date)
824
- ], JobsInQueueEntity.prototype, "submitTime", void 0);
825
- tslib_1.__decorate([
826
- __1.Fields.date(),
827
- tslib_1.__metadata("design:type", Date)
828
- ], JobsInQueueEntity.prototype, "doneTime", void 0);
829
- tslib_1.__decorate([
830
- __1.Fields.string(),
831
- tslib_1.__metadata("design:type", String)
832
- ], JobsInQueueEntity.prototype, "result", void 0);
833
- tslib_1.__decorate([
834
- __1.Fields.boolean(),
835
- tslib_1.__metadata("design:type", Boolean)
836
- ], JobsInQueueEntity.prototype, "done", void 0);
837
- tslib_1.__decorate([
838
- __1.Fields.boolean(),
839
- tslib_1.__metadata("design:type", Boolean)
840
- ], JobsInQueueEntity.prototype, "error", void 0);
841
- tslib_1.__decorate([
842
- __1.Fields.number(),
843
- tslib_1.__metadata("design:type", Number)
844
- ], JobsInQueueEntity.prototype, "progress", void 0);
845
- JobsInQueueEntity = tslib_1.__decorate([
846
- __1.Entity(undefined, {
847
- dbName: 'jobsInQueue'
848
- })
849
- ], JobsInQueueEntity);
850
- return JobsInQueueEntity;
851
- }(__1.IdEntity));
852
- exports.JobsInQueueEntity = JobsInQueueEntity;
853
- context_1.allEntities.splice(context_1.allEntities.indexOf(JobsInQueueEntity), 1);
575
+ doSync(what) {
576
+ return this.sync = this.sync.then(() => what());
577
+ }
578
+ async getJobInfo(queuedJobId) {
579
+ let q = await this.repo.findId(queuedJobId);
580
+ let lastProgress = undefined;
581
+ return {
582
+ userId: q.userId,
583
+ info: {
584
+ done: q.done,
585
+ error: q.error ? JSON.parse(q.result) : undefined,
586
+ result: q.done && !q.error ? JSON.parse(q.result) : undefined,
587
+ progress: q.progress
588
+ },
589
+ setErrorResult: async (error) => {
590
+ await this.sync;
591
+ q.error = true;
592
+ q.done = true;
593
+ q.result = JSON.stringify(error);
594
+ q.doneTime = new Date();
595
+ q.progress = 1;
596
+ await this.doSync(() => q._.save());
597
+ },
598
+ setResult: async (result) => {
599
+ await this.sync;
600
+ q.done = true;
601
+ q.result = JSON.stringify(result);
602
+ q.doneTime = new Date();
603
+ await this.doSync(() => q._.save());
604
+ },
605
+ setProgress: async (progress) => {
606
+ if (progress === 0)
607
+ return;
608
+ let now = new Date();
609
+ if (lastProgress && now.valueOf() - lastProgress.valueOf() < 200)
610
+ return;
611
+ lastProgress = new Date();
612
+ await this.sync;
613
+ q.progress = progress;
614
+ await this.doSync(() => q._.save());
615
+ }
616
+ };
617
+ }
618
+ async createJob(url, userId) {
619
+ let q = this.repo.create();
620
+ q.userId = userId;
621
+ q.submitTime = new Date();
622
+ q.url = url;
623
+ await q._.save();
624
+ return q.id;
625
+ }
626
+ }
627
+ let JobsInQueueEntity = class JobsInQueueEntity extends IdEntity {
628
+ };
629
+ __decorate([
630
+ Fields.string(),
631
+ __metadata("design:type", String)
632
+ ], JobsInQueueEntity.prototype, "userId", void 0);
633
+ __decorate([
634
+ Fields.string(),
635
+ __metadata("design:type", String)
636
+ ], JobsInQueueEntity.prototype, "url", void 0);
637
+ __decorate([
638
+ Fields.date(),
639
+ __metadata("design:type", Date)
640
+ ], JobsInQueueEntity.prototype, "submitTime", void 0);
641
+ __decorate([
642
+ Fields.date(),
643
+ __metadata("design:type", Date)
644
+ ], JobsInQueueEntity.prototype, "doneTime", void 0);
645
+ __decorate([
646
+ Fields.string(),
647
+ __metadata("design:type", String)
648
+ ], JobsInQueueEntity.prototype, "result", void 0);
649
+ __decorate([
650
+ Fields.boolean(),
651
+ __metadata("design:type", Boolean)
652
+ ], JobsInQueueEntity.prototype, "done", void 0);
653
+ __decorate([
654
+ Fields.boolean(),
655
+ __metadata("design:type", Boolean)
656
+ ], JobsInQueueEntity.prototype, "error", void 0);
657
+ __decorate([
658
+ Fields.number(),
659
+ __metadata("design:type", Number)
660
+ ], JobsInQueueEntity.prototype, "progress", void 0);
661
+ JobsInQueueEntity = __decorate([
662
+ Entity(undefined, {
663
+ dbName: 'jobsInQueue'
664
+ })
665
+ ], JobsInQueueEntity);
666
+ export { JobsInQueueEntity };
667
+ allEntities.splice(allEntities.indexOf(JobsInQueueEntity), 1);