remult 0.14.6 → 0.14.7

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