@intuitionrobotics/db-api-generator 0.46.0 → 0.47.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +1,24 @@
1
- import { DB_Object, PartialProperties } from "@intuitionrobotics/ts-common/utils/types";
2
- import { ServerApi } from "@intuitionrobotics/thunderstorm/app-backend/modules/server/server-api";
3
- import { ExpressRequest } from "@intuitionrobotics/thunderstorm/app-backend/utils/types";
4
- import { Clause_Where, FilterKeys, FirestoreQuery } from "@intuitionrobotics/firebase/shared/types";
5
- import { ValidatorTypeResolver } from "@intuitionrobotics/ts-common/validator/validator";
1
+ import { Clause_Where, DB_Object, FilterKeys, FirestoreQuery } from "@intuitionrobotics/firebase";
2
+ import { Module, PartialProperties, ValidatorTypeResolver } from "@intuitionrobotics/ts-common";
6
3
  import { ServerApi_Create } from "./apis";
7
- import { FirestoreBackupDetails, OnFirestoreBackupSchedulerAct } from "@intuitionrobotics/thunderstorm/app-backend/modules/FirestoreBackupScheduler";
8
- import { FirestoreCollection } from "@intuitionrobotics/firebase/app-backend/firestore/FirestoreCollection";
9
- import { FirestoreTransaction } from "@intuitionrobotics/firebase/app-backend/firestore/FirestoreTransaction";
10
- import { Module } from "@intuitionrobotics/ts-common/core/module";
11
- export declare const validateId: (length: number, mandatory?: boolean) => import("@intuitionrobotics/ts-common/validator/validator").Validator<string>;
12
- export declare const validateEmail: import("@intuitionrobotics/ts-common/validator/validator").Validator<string>;
13
- export declare const validateBucketUrl: (mandatory?: boolean | undefined) => import("@intuitionrobotics/ts-common/validator/validator").Validator<string>;
14
- export declare const validateGeneralUrl: (mandatory?: boolean | undefined) => import("@intuitionrobotics/ts-common/validator/validator").Validator<string>;
15
- export declare const validateUniqueId: import("@intuitionrobotics/ts-common/validator/validator").Validator<string>;
16
- export declare const validateOptionalId: import("@intuitionrobotics/ts-common/validator/validator").Validator<string>;
17
- export declare const validateStringWithDashes: import("@intuitionrobotics/ts-common/validator/validator").Validator<string>;
18
- export declare const validateStringAndNumbersWithDashes: import("@intuitionrobotics/ts-common/validator/validator").Validator<string>;
19
- export declare const validator_JavaObjectMemberName: import("@intuitionrobotics/ts-common/validator/validator").Validator<string>;
20
- export declare const validateNameWithDashesAndDots: import("@intuitionrobotics/ts-common/validator/validator").Validator<string>;
21
- export declare const validator_LowercaseStringWithDashes: import("@intuitionrobotics/ts-common/validator/validator").Validator<string>;
22
- export declare const validator_LowerUpperStringWithSpaces: import("@intuitionrobotics/ts-common/validator/validator").Validator<string>;
23
- export declare const validator_LowerUpperStringWithDashesAndUnderscore: import("@intuitionrobotics/ts-common/validator/validator").Validator<string>;
24
- export declare const validator_InternationalPhoneNumber: import("@intuitionrobotics/ts-common/validator/validator").Validator<string>;
25
- export declare type CustomUniquenessAssertion<Type extends DB_Object> = (transaction: FirestoreTransaction, dbInstance: Type) => Promise<void>;
26
- export declare type Config<Type extends object> = {
4
+ import { ExpressRequest, FirestoreBackupDetails, OnFirestoreBackupSchedulerAct, ServerApi } from "@intuitionrobotics/thunderstorm/backend";
5
+ import { FirestoreCollection, FirestoreTransaction } from "@intuitionrobotics/firebase/backend";
6
+ export declare const validateId: (length: number, mandatory?: boolean) => import("@intuitionrobotics/ts-common").Validator<string>;
7
+ export declare const validateEmail: import("@intuitionrobotics/ts-common").Validator<string>;
8
+ export declare const validateBucketUrl: (mandatory?: boolean) => import("@intuitionrobotics/ts-common").Validator<string>;
9
+ export declare const validateGeneralUrl: (mandatory?: boolean) => import("@intuitionrobotics/ts-common").Validator<string>;
10
+ export declare const validateUniqueId: import("@intuitionrobotics/ts-common").Validator<string>;
11
+ export declare const validateOptionalId: import("@intuitionrobotics/ts-common").Validator<string>;
12
+ export declare const validateStringWithDashes: import("@intuitionrobotics/ts-common").Validator<string>;
13
+ export declare const validateStringAndNumbersWithDashes: import("@intuitionrobotics/ts-common").Validator<string>;
14
+ export declare const validator_JavaObjectMemberName: import("@intuitionrobotics/ts-common").Validator<string>;
15
+ export declare const validateNameWithDashesAndDots: import("@intuitionrobotics/ts-common").Validator<string>;
16
+ export declare const validator_LowercaseStringWithDashes: import("@intuitionrobotics/ts-common").Validator<string>;
17
+ export declare const validator_LowerUpperStringWithSpaces: import("@intuitionrobotics/ts-common").Validator<string>;
18
+ export declare const validator_LowerUpperStringWithDashesAndUnderscore: import("@intuitionrobotics/ts-common").Validator<string>;
19
+ export declare const validator_InternationalPhoneNumber: import("@intuitionrobotics/ts-common").Validator<string>;
20
+ export type CustomUniquenessAssertion<Type extends DB_Object> = (transaction: FirestoreTransaction, dbInstance: Type) => Promise<void>;
21
+ export type Config<Type extends object> = {
27
22
  projectId?: string;
28
23
  lockKeys: (keyof Type)[];
29
24
  collectionName: string;
@@ -67,7 +62,7 @@ export declare abstract class BaseDB_ApiGenerator<DBType extends DB_Object, Conf
67
62
  * @returns
68
63
  * The lock keys.
69
64
  */
70
- protected setLockKeys(keys: (keyof DBType)[]): (keyof DBType)[];
65
+ protected setLockKeys(keys: (keyof DBType)[]): ("_id" | keyof DBType)[];
71
66
  getCollectionName(): string;
72
67
  getItemName(): string;
73
68
  /**
@@ -92,7 +87,7 @@ export declare abstract class BaseDB_ApiGenerator<DBType extends DB_Object, Conf
92
87
  *
93
88
  * @throws `ApiException` for bad implementation or invalid input.
94
89
  */
95
- validateImpl(instance: DBType): Promise<void>;
90
+ validateImpl(instance: DBType): void;
96
91
  /**
97
92
  * Override this method to return a list of "where" queries that dictate uniqueness inside the collection.
98
93
  * Example return value: [{attribute1: item.attribute1, attribute2: item.attribute2}].
@@ -10,48 +10,39 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.BaseDB_ApiGenerator = exports.validator_InternationalPhoneNumber = exports.validator_LowerUpperStringWithDashesAndUnderscore = exports.validator_LowerUpperStringWithSpaces = exports.validator_LowercaseStringWithDashes = exports.validateNameWithDashesAndDots = exports.validator_JavaObjectMemberName = exports.validateStringAndNumbersWithDashes = exports.validateStringWithDashes = exports.validateOptionalId = exports.validateUniqueId = exports.validateGeneralUrl = exports.validateBucketUrl = exports.validateEmail = exports.validateId = void 0;
13
- const types_1 = require("../shared/types");
14
- const validator_1 = require("@intuitionrobotics/ts-common/validator/validator");
13
+ const ts_common_1 = require("@intuitionrobotics/ts-common");
15
14
  const apis_1 = require("./apis");
16
- const exceptions_1 = require("@intuitionrobotics/thunderstorm/app-backend/exceptions");
17
- const FirebaseModule_1 = require("@intuitionrobotics/firebase/app-backend/FirebaseModule");
18
- const FirestoreInterface_1 = require("@intuitionrobotics/firebase/app-backend/firestore/FirestoreInterface");
19
- const module_1 = require("@intuitionrobotics/ts-common/core/module");
20
- const date_time_tools_1 = require("@intuitionrobotics/ts-common/utils/date-time-tools");
21
- const exceptions_2 = require("@intuitionrobotics/ts-common/core/exceptions");
22
- const array_tools_1 = require("@intuitionrobotics/ts-common/utils/array-tools");
23
- const tools_1 = require("@intuitionrobotics/ts-common/utils/tools");
24
- const object_tools_1 = require("@intuitionrobotics/ts-common/utils/object-tools");
25
- const random_tools_1 = require("@intuitionrobotics/ts-common/utils/random-tools");
26
- const merge_tools_1 = require("@intuitionrobotics/ts-common/utils/merge-tools");
15
+ const backend_1 = require("@intuitionrobotics/thunderstorm/backend");
16
+ const backend_2 = require("@intuitionrobotics/firebase/backend");
17
+ const types_1 = require("../shared/types");
27
18
  const idLength = 32;
28
- const validateId = (length, mandatory = true) => validator_1.validateRegexp(new RegExp(`^[0-9a-f]{${length}}$`), mandatory);
19
+ const validateId = (length, mandatory = true) => (0, ts_common_1.validateRegexp)(new RegExp(`^[0-9a-f]{${length}}$`), mandatory);
29
20
  exports.validateId = validateId;
30
- exports.validateEmail = validator_1.validateEmail;
31
- const validateBucketUrl = (mandatory) => validator_1.validateRegexp(/gs?:\/\/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/, mandatory);
21
+ exports.validateEmail = ts_common_1.validateEmail;
22
+ const validateBucketUrl = (mandatory) => (0, ts_common_1.validateRegexp)(/gs?:\/\/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/, mandatory);
32
23
  exports.validateBucketUrl = validateBucketUrl;
33
- const validateGeneralUrl = (mandatory) => validator_1.validateRegexp(/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/, mandatory);
24
+ const validateGeneralUrl = (mandatory) => (0, ts_common_1.validateRegexp)(/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/, mandatory);
34
25
  exports.validateGeneralUrl = validateGeneralUrl;
35
- exports.validateUniqueId = exports.validateId(idLength);
36
- exports.validateOptionalId = exports.validateId(idLength, false);
37
- exports.validateStringWithDashes = validator_1.validateRegexp(/^[A-Za-z-]+$/);
38
- exports.validateStringAndNumbersWithDashes = validator_1.validateRegexp(/^[0-9A-Za-z-]+$/);
39
- exports.validator_JavaObjectMemberName = validator_1.validateRegexp(/^[a-z][a-zA-Z0-9]+$/);
40
- exports.validateNameWithDashesAndDots = validator_1.validateRegexp(/^[a-z-.]+$/);
41
- exports.validator_LowercaseStringWithDashes = validator_1.validateRegexp(/^[a-z-.]+$/);
42
- exports.validator_LowerUpperStringWithSpaces = validator_1.validateRegexp(/^[A-Za-z ]+$/);
43
- exports.validator_LowerUpperStringWithDashesAndUnderscore = validator_1.validateRegexp(/^[A-Za-z-_]+$/);
44
- exports.validator_InternationalPhoneNumber = validator_1.validateRegexp(/^\+(?:[0-9] ?){6,14}[0-9]$/);
26
+ exports.validateUniqueId = (0, exports.validateId)(idLength);
27
+ exports.validateOptionalId = (0, exports.validateId)(idLength, false);
28
+ exports.validateStringWithDashes = (0, ts_common_1.validateRegexp)(/^[A-Za-z-]+$/);
29
+ exports.validateStringAndNumbersWithDashes = (0, ts_common_1.validateRegexp)(/^[0-9A-Za-z-]+$/);
30
+ exports.validator_JavaObjectMemberName = (0, ts_common_1.validateRegexp)(/^[a-z][a-zA-Z0-9]+$/);
31
+ exports.validateNameWithDashesAndDots = (0, ts_common_1.validateRegexp)(/^[a-z-.]+$/);
32
+ exports.validator_LowercaseStringWithDashes = (0, ts_common_1.validateRegexp)(/^[a-z-.]+$/);
33
+ exports.validator_LowerUpperStringWithSpaces = (0, ts_common_1.validateRegexp)(/^[A-Za-z ]+$/);
34
+ exports.validator_LowerUpperStringWithDashesAndUnderscore = (0, ts_common_1.validateRegexp)(/^[A-Za-z-_]+$/);
35
+ exports.validator_InternationalPhoneNumber = (0, ts_common_1.validateRegexp)(/^\+(?:[0-9] ?){6,14}[0-9]$/);
45
36
  /**
46
37
  * An abstract base class used for implementing CRUD operations on a specific collection.
47
38
  *
48
39
  * By default, it exposes API endpoints for creating, deleting, updating, querying and querying for unique document.
49
40
  */
50
- class BaseDB_ApiGenerator extends module_1.Module {
41
+ class BaseDB_ApiGenerator extends ts_common_1.Module {
51
42
  constructor(collectionName, validator, itemName, moduleName) {
52
43
  super(moduleName);
53
44
  // @ts-ignore
54
- this.setConfig({ itemName, collectionName, externalFilterKeys: ["_id"], lockKeys: ["_id"] });
45
+ this.setDefaultConfig({ itemName, collectionName, externalFilterKeys: ["_id"], lockKeys: ["_id"] });
55
46
  this.validator = validator;
56
47
  }
57
48
  setValidator(validator) {
@@ -61,8 +52,8 @@ class BaseDB_ApiGenerator extends module_1.Module {
61
52
  return [{
62
53
  backupQuery: this.resolveBackupQuery(),
63
54
  collection: this.collection,
64
- keepInterval: 7 * date_time_tools_1.Day,
65
- interval: date_time_tools_1.Day,
55
+ keepInterval: 7 * ts_common_1.Day,
56
+ interval: ts_common_1.Day,
66
57
  moduleKey: this.config.collectionName
67
58
  }];
68
59
  }
@@ -84,7 +75,7 @@ class BaseDB_ApiGenerator extends module_1.Module {
84
75
  */
85
76
  setExternalUniqueKeys(keys) {
86
77
  if (this.initiated)
87
- throw new exceptions_2.BadImplementationException("You can only update the 'externalUniqueKeys' before the module was initialized.. preferably from its constructor");
78
+ throw new ts_common_1.BadImplementationException("You can only update the 'externalUniqueKeys' before the module was initialized.. preferably from its constructor");
88
79
  return this.config.externalFilterKeys = keys;
89
80
  }
90
81
  /**
@@ -101,8 +92,8 @@ class BaseDB_ApiGenerator extends module_1.Module {
101
92
  */
102
93
  setLockKeys(keys) {
103
94
  if (this.initiated)
104
- throw new exceptions_2.BadImplementationException("You can only update the 'lockKeys' before the module was initialized.. preferably from its constructor");
105
- return this.config.lockKeys = array_tools_1.filterDuplicates([...keys,
95
+ throw new ts_common_1.BadImplementationException("You can only update the 'lockKeys' before the module was initialized.. preferably from its constructor");
96
+ return this.config.lockKeys = (0, ts_common_1.filterDuplicates)([...keys,
106
97
  "_id"]);
107
98
  }
108
99
  getCollectionName() {
@@ -117,7 +108,7 @@ class BaseDB_ApiGenerator extends module_1.Module {
117
108
  */
118
109
  init() {
119
110
  var _a;
120
- const firestore = FirebaseModule_1.FirebaseModule.createAdminSession((_a = this.config) === null || _a === void 0 ? void 0 : _a.projectId).getFirestore();
111
+ const firestore = backend_2.FirebaseModule.createAdminSession((_a = this.config) === null || _a === void 0 ? void 0 : _a.projectId).getFirestore();
121
112
  // @ts-ignore
122
113
  this.collection = firestore.getCollection(this.config.collectionName, this.config.externalFilterKeys);
123
114
  }
@@ -125,8 +116,8 @@ class BaseDB_ApiGenerator extends module_1.Module {
125
116
  return __awaiter(this, void 0, void 0, function* () {
126
117
  const dbInstance = yield transaction.queryItem(this.collection, instance);
127
118
  if (!dbInstance) {
128
- const uniqueQuery = FirestoreInterface_1.FirestoreInterface.buildUniqueQuery(this.collection, instance);
129
- throw new exceptions_1.ApiException(404, `Could not find ${this.config.itemName} with unique query '${tools_1.__stringify(uniqueQuery)}'`);
119
+ const uniqueQuery = backend_2.FirestoreInterface.buildUniqueQuery(this.collection, instance);
120
+ throw new backend_1.ApiException(404, `Could not find ${this.config.itemName} with unique query '${(0, ts_common_1.__stringify)(uniqueQuery)}'`);
130
121
  }
131
122
  return dbInstance;
132
123
  });
@@ -153,11 +144,11 @@ class BaseDB_ApiGenerator extends module_1.Module {
153
144
  if (!dbInstance || dbInstance._id === instance._id)
154
145
  continue;
155
146
  const query = uniqueQueries[idx];
156
- const message = object_tools_1._keys(query).reduce((carry, key) => {
157
- return carry + "\n" + `${key}: ${query[key]}`;
147
+ const message = (0, ts_common_1._keys)(query).reduce((carry, key) => {
148
+ return carry + "\n" + `${String(key)}: ${query[key]}`;
158
149
  }, `${this.config.itemName} uniqueness violation. There is already a document with`);
159
150
  this.logWarning(message);
160
- throw new exceptions_1.ApiException(422, message);
151
+ throw new backend_1.ApiException(422, message);
161
152
  }
162
153
  });
163
154
  }
@@ -169,21 +160,20 @@ class BaseDB_ApiGenerator extends module_1.Module {
169
160
  * @throws `ApiException` for bad implementation or invalid input.
170
161
  */
171
162
  validateImpl(instance) {
172
- return __awaiter(this, void 0, void 0, function* () {
173
- try {
174
- yield validator_1.validate(instance, this.validator);
163
+ try {
164
+ (0, ts_common_1.validate)(instance, this.validator);
165
+ }
166
+ catch (e) {
167
+ const badImplementation = (0, ts_common_1.isErrorOfType)(e, ts_common_1.BadImplementationException);
168
+ if (badImplementation)
169
+ throw new backend_1.ApiException(500, badImplementation.message);
170
+ const error = (0, ts_common_1.isErrorOfType)(e, ts_common_1.ValidationException);
171
+ if (error) {
172
+ const errorBody = { type: types_1.ErrorKey_BadInput, body: { path: error.path, input: error.input } };
173
+ throw new backend_1.ApiException(400, error.message).setErrorBody(errorBody);
175
174
  }
176
- catch (e) {
177
- const badImplementation = exceptions_2.isErrorOfType(e, exceptions_2.BadImplementationException);
178
- if (badImplementation)
179
- throw new exceptions_1.ApiException(500, badImplementation.message);
180
- const error = exceptions_2.isErrorOfType(e, validator_1.ValidationException);
181
- if (error) {
182
- const errorBody = { type: types_1.ErrorKey_BadInput, body: { path: error.path, input: error.input } };
183
- throw new exceptions_1.ApiException(400, error.message).setErrorBody(errorBody);
184
- }
185
- }
186
- });
175
+ throw e;
176
+ }
187
177
  }
188
178
  /**
189
179
  * Override this method to return a list of "where" queries that dictate uniqueness inside the collection.
@@ -286,7 +276,7 @@ class BaseDB_ApiGenerator extends module_1.Module {
286
276
  upsert_Read(instance, transaction, request) {
287
277
  return __awaiter(this, void 0, void 0, function* () {
288
278
  if (instance._id === undefined)
289
- return this.createImpl_Read(transaction, Object.assign(Object.assign({}, instance), { _id: random_tools_1.generateHex(idLength) }), request);
279
+ return this.createImpl_Read(transaction, Object.assign(Object.assign({}, instance), { _id: (0, ts_common_1.generateHex)(idLength) }), request);
290
280
  return this.upsertImpl_Read(transaction, instance, request);
291
281
  });
292
282
  }
@@ -301,7 +291,7 @@ class BaseDB_ApiGenerator extends module_1.Module {
301
291
  */
302
292
  upsertAll_Batched(instances, request) {
303
293
  return __awaiter(this, void 0, void 0, function* () {
304
- return array_tools_1.batchAction(instances, 500, (chunked) => __awaiter(this, void 0, void 0, function* () { return this.upsertAll(chunked, undefined, request); }));
294
+ return (0, ts_common_1.batchAction)(instances, 500, (chunked) => __awaiter(this, void 0, void 0, function* () { return this.upsertAll(chunked, undefined, request); }));
305
295
  });
306
296
  }
307
297
  /**
@@ -320,7 +310,7 @@ class BaseDB_ApiGenerator extends module_1.Module {
320
310
  return __awaiter(this, void 0, void 0, function* () {
321
311
  if (instances.length > 500) {
322
312
  if (transaction)
323
- throw new exceptions_2.BadImplementationException('Firestore transaction supports maximum 500 at a time');
313
+ throw new ts_common_1.BadImplementationException('Firestore transaction supports maximum 500 at a time');
324
314
  return this.upsertAll_Batched(instances, request);
325
315
  }
326
316
  const processor = (_transaction) => __awaiter(this, void 0, void 0, function* () {
@@ -336,7 +326,7 @@ class BaseDB_ApiGenerator extends module_1.Module {
336
326
  return __awaiter(this, void 0, void 0, function* () {
337
327
  const actions = [];
338
328
  instances.reduce((carry, instance) => {
339
- carry.push(this.upsert_Read(instance, transaction, request));
329
+ (0, ts_common_1.addItemToArray)(carry, this.upsert_Read(instance, transaction, request));
340
330
  return carry;
341
331
  }, actions);
342
332
  return Promise.all(actions);
@@ -381,11 +371,11 @@ class BaseDB_ApiGenerator extends module_1.Module {
381
371
  deleteUnique(_id, transaction, request) {
382
372
  return __awaiter(this, void 0, void 0, function* () {
383
373
  if (!_id)
384
- throw new exceptions_2.BadImplementationException(`No _id for deletion provided.`);
374
+ throw new ts_common_1.BadImplementationException(`No _id for deletion provided.`);
385
375
  const processor = (_transaction) => __awaiter(this, void 0, void 0, function* () {
386
376
  const write = yield this.deleteUnique_Read(_id, _transaction, request);
387
377
  if (!write)
388
- throw new exceptions_1.ApiException(404, `Could not find ${this.config.itemName} with unique id: ${_id}`);
378
+ throw new backend_1.ApiException(404, `Could not find ${this.config.itemName} with unique id: ${_id}`);
389
379
  return write();
390
380
  });
391
381
  if (transaction)
@@ -396,11 +386,11 @@ class BaseDB_ApiGenerator extends module_1.Module {
396
386
  deleteUnique_Read(_id, transaction, request) {
397
387
  return __awaiter(this, void 0, void 0, function* () {
398
388
  if (!_id)
399
- throw new exceptions_2.BadImplementationException(`No _id for deletion provided.`);
389
+ throw new ts_common_1.BadImplementationException(`No _id for deletion provided.`);
400
390
  const ourQuery = { where: { _id } };
401
391
  const dbInstance = yield transaction.queryUnique(this.collection, ourQuery);
402
392
  if (!dbInstance)
403
- throw new exceptions_1.ApiException(404, `Could not find ${this.config.itemName} with unique id: ${_id}`);
393
+ throw new backend_1.ApiException(404, `Could not find ${this.config.itemName} with unique id: ${_id}`);
404
394
  const write = yield this.deleteImpl_Read(transaction, ourQuery, request);
405
395
  return () => __awaiter(this, void 0, void 0, function* () {
406
396
  if (!write)
@@ -425,7 +415,7 @@ class BaseDB_ApiGenerator extends module_1.Module {
425
415
  return __awaiter(this, void 0, void 0, function* () {
426
416
  const write = yield transaction.deleteUnique_Read(this.collection, ourQuery);
427
417
  if (!write)
428
- throw new exceptions_2.ThisShouldNotHappenException(`I just checked that I had an instance for query: ${tools_1.__stringify(ourQuery)}`);
418
+ throw new ts_common_1.ThisShouldNotHappenException(`I just checked that I had an instance for query: ${(0, ts_common_1.__stringify)(ourQuery)}`);
429
419
  return write;
430
420
  });
431
421
  }
@@ -455,7 +445,7 @@ class BaseDB_ApiGenerator extends module_1.Module {
455
445
  return __awaiter(this, void 0, void 0, function* () {
456
446
  const dbItem = yield this.collection.queryUnique({ where });
457
447
  if (!dbItem)
458
- throw new exceptions_1.ApiException(404, `Could not find ${this.config.itemName} with unique query: ${JSON.stringify(where)}`);
448
+ throw new backend_1.ApiException(404, `Could not find ${this.config.itemName} with unique query: ${JSON.stringify(where)}`);
459
449
  return dbItem;
460
450
  });
461
451
  }
@@ -493,16 +483,16 @@ class BaseDB_ApiGenerator extends module_1.Module {
493
483
  // If the caller has specified props to be changed, make sure the don't conflict with the lockKeys.
494
484
  const wrongKey = propsToPatch === null || propsToPatch === void 0 ? void 0 : propsToPatch.find(prop => this.config.lockKeys.includes(prop));
495
485
  if (wrongKey)
496
- throw new exceptions_2.BadImplementationException(`Key ${wrongKey} is part of the 'lockKeys' and cannot be updated.`);
486
+ throw new ts_common_1.BadImplementationException(`Key ${String(wrongKey)} is part of the 'lockKeys' and cannot be updated.`);
497
487
  // If the caller has not specified props, we remove the keys from the caller's instance
498
488
  // before merging with the original dbInstance.
499
- object_tools_1._keys(instance).forEach(key => {
489
+ (0, ts_common_1._keys)(instance).forEach(key => {
500
490
  if (this.config.lockKeys.includes(key) || (propsToPatch && !propsToPatch.includes(key))) {
501
491
  delete instance[key];
502
492
  }
503
493
  });
504
- const mergedObject = merge_tools_1.merge(dbInstance, instance);
505
- yield validator_1.validate(mergedObject, this.validator);
494
+ const mergedObject = (0, ts_common_1.merge)(dbInstance, instance);
495
+ yield (0, ts_common_1.validate)(mergedObject, this.validator);
506
496
  yield this.assertUniqueness(transaction, mergedObject, request);
507
497
  return this.upsertImpl(transaction, mergedObject, request);
508
498
  }));
@@ -532,7 +522,7 @@ class BaseDB_ApiGenerator extends module_1.Module {
532
522
  * An array of api endpoints.
533
523
  */
534
524
  apis(pathPart) {
535
- return array_tools_1.filterInstances([
525
+ return (0, ts_common_1.filterInstances)([
536
526
  this.apiCreate(pathPart),
537
527
  this.apiQuery(pathPart),
538
528
  this.apiQueryUnique(pathPart),
@@ -1 +1 @@
1
- {"version":3,"file":"BaseDB_ApiGenerator.js","sourceRoot":"","sources":["../../src/main/app-backend/BaseDB_ApiGenerator.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAAqE;AAIrE,gFAM0D;AAC1D,iCAA+G;AAC/G,uFAAoF;AAKpF,2FAAsF;AAEtF,6GAAwG;AAExG,qEAAgE;AAChE,wFAAuE;AACvE,6EAIsD;AACtD,gFAA8G;AAC9G,oEAAqE;AACrE,kFAAsE;AACtE,kFAA4E;AAC5E,gFAAqE;AAErE,MAAM,QAAQ,GAAG,EAAE,CAAC;AACb,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,YAAqB,IAAI,EAAE,EAAE,CAAC,0BAAc,CAAC,IAAI,MAAM,CAAC,aAAa,MAAM,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;AAA3H,QAAA,UAAU,cAAiH;AAC3H,QAAA,aAAa,GAAG,yBAAc,CAAC;AACrC,MAAM,iBAAiB,GAAG,CAAC,SAAmB,EAAE,EAAE,CAAC,0BAAc,CACpE,kFAAkF,EAAE,SAAS,CAAC,CAAC;AADtF,QAAA,iBAAiB,qBACqE;AAC5F,MAAM,kBAAkB,GAAG,CAAC,SAAmB,EAAE,EAAE,CAAC,0BAAc,CACrE,0EAA0E,EAAE,SAAS,CAAC,CAAC;AAD9E,QAAA,kBAAkB,sBAC4D;AAC9E,QAAA,gBAAgB,GAAG,kBAAU,CAAC,QAAQ,CAAC,CAAC;AACxC,QAAA,kBAAkB,GAAG,kBAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACjD,QAAA,wBAAwB,GAAG,0BAAc,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;IAC7C,CAAC;IAED,SAAS,CAAC,QAAiB;QAC1B,OAAO,IAAI,uBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED,SAAS,CAAC,QAAiB;QAC1B,OAAO,IAAI,uBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CAAC,QAAiB;QACrB,OAAO,IAAA,2BAAe,EACrB;YACC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;YACxB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC;YAC7B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;YACxB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;SACxB,CAAC,CAAC;IACL,CAAC;CACD;AA9gBD,kDA8gBC"}
@@ -1,11 +1,10 @@
1
1
  import { BaseDB_ApiGenerator } from "./BaseDB_ApiGenerator";
2
- import { DB_Object } from "@intuitionrobotics/ts-common/utils/types";
3
- import { ApiBinder_DBCreate, ApiBinder_DBDelete, ApiBinder_DBQuery, ApiBinder_DBUniuqe, ApiBinder_DBUpdate, GenericApiDef } from "../shared/types";
4
- import { ApiResponse, ServerApi } from "@intuitionrobotics/thunderstorm/app-backend/modules/server/server-api";
5
- import { ApiTypeBinder, DeriveBodyType, DeriveQueryType, DeriveResponseType, QueryParams } from "@intuitionrobotics/thunderstorm/shared/types";
6
- import { ExpressRequest } from "@intuitionrobotics/thunderstorm/app-backend/utils/types";
2
+ import { ApiTypeBinder, QueryParams } from "@intuitionrobotics/thunderstorm";
3
+ import { ApiBinder_DBCreate, ApiBinder_DBDelete, ApiBinder_DBQuery, ApiBinder_DBUniuqe, ApiBinder_DBUpdate, GenericApiDef } from "..";
4
+ import { DB_Object } from "@intuitionrobotics/firebase";
5
+ import { ApiResponse, ExpressRequest, ServerApi } from "@intuitionrobotics/thunderstorm/backend";
7
6
  export declare function resolveUrlPart(dbModule: BaseDB_ApiGenerator<any>, pathPart?: string, pathSuffix?: string): string;
8
- export declare abstract class GenericServerApi<DBType extends DB_Object, Binder extends ApiTypeBinder<string, R, B, P>, PostProcessor = never, R = DeriveResponseType<Binder>, B = DeriveBodyType<Binder>, P extends QueryParams | {} = DeriveQueryType<Binder>> extends ServerApi<Binder> {
7
+ export declare abstract class GenericServerApi<DBType extends DB_Object, Binder extends ApiTypeBinder<string, R, B, P>, PostProcessor = never, R = Binder["response"], B = Binder["body"], P extends QueryParams | {} = Binder["queryParams"]> extends ServerApi<Binder> {
9
8
  protected readonly dbModule: BaseDB_ApiGenerator<DBType>;
10
9
  protected readonly postProcessors: PostProcessor[];
11
10
  protected constructor(dbModule: BaseDB_ApiGenerator<DBType>, def: GenericApiDef, pathPart?: string);
@@ -1,4 +1,22 @@
1
1
  "use strict";
2
+ /*
3
+ * Permissions management system, define access level for each of
4
+ * your server apis, and restrict users by giving them access levels
5
+ *
6
+ * Copyright (C) 2020 Intuition Robotics
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
2
20
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
21
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
22
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -10,26 +28,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
28
  };
11
29
  Object.defineProperty(exports, "__esModule", { value: true });
12
30
  exports.ServerApi_Delete = exports.ServerApi_Query = exports.ServerApi_Unique = exports.ServerApi_Update = exports.ServerApi_Create = exports.GenericServerApi = exports.resolveUrlPart = void 0;
13
- const types_1 = require("../shared/types");
14
- const server_api_1 = require("@intuitionrobotics/thunderstorm/app-backend/modules/server/server-api");
31
+ const __1 = require("..");
32
+ const backend_1 = require("@intuitionrobotics/thunderstorm/backend");
33
+ const ts_common_1 = require("@intuitionrobotics/ts-common");
15
34
  function resolveUrlPart(dbModule, pathPart, pathSuffix) {
16
35
  return `${!pathPart ? dbModule.getItemName() : pathPart}${pathSuffix ? "/" + pathSuffix : ""}`;
17
36
  }
18
37
  exports.resolveUrlPart = resolveUrlPart;
19
- class GenericServerApi extends server_api_1.ServerApi {
38
+ class GenericServerApi extends backend_1.ServerApi {
20
39
  constructor(dbModule, def, pathPart) {
21
40
  super(def.method, resolveUrlPart(dbModule, pathPart, def.suffix));
22
41
  this.postProcessors = [];
23
42
  this.dbModule = dbModule;
24
43
  }
25
44
  addPostProcessor(processor) {
26
- this.postProcessors.push(processor);
45
+ (0, ts_common_1.addItemToArray)(this.postProcessors, processor);
27
46
  }
28
47
  }
29
48
  exports.GenericServerApi = GenericServerApi;
30
49
  class ServerApi_Create extends GenericServerApi {
31
50
  constructor(dbModule, pathPart) {
32
- super(dbModule, types_1.DefaultApiDefs.Create, pathPart);
51
+ super(dbModule, __1.DefaultApiDefs.Create, pathPart);
33
52
  }
34
53
  process(request, response, queryParams, body) {
35
54
  return __awaiter(this, void 0, void 0, function* () {
@@ -44,7 +63,7 @@ class ServerApi_Create extends GenericServerApi {
44
63
  exports.ServerApi_Create = ServerApi_Create;
45
64
  class ServerApi_Update extends GenericServerApi {
46
65
  constructor(dbModule, pathPart) {
47
- super(dbModule, types_1.DefaultApiDefs.Update, pathPart);
66
+ super(dbModule, __1.DefaultApiDefs.Update, pathPart);
48
67
  }
49
68
  process(request, response, queryParams, body) {
50
69
  return __awaiter(this, void 0, void 0, function* () {
@@ -55,7 +74,7 @@ class ServerApi_Update extends GenericServerApi {
55
74
  exports.ServerApi_Update = ServerApi_Update;
56
75
  class ServerApi_Unique extends GenericServerApi {
57
76
  constructor(dbModule, pathPart) {
58
- super(dbModule, types_1.DefaultApiDefs.Unique, pathPart);
77
+ super(dbModule, __1.DefaultApiDefs.Unique, pathPart);
59
78
  }
60
79
  process(request, response, queryParams, body) {
61
80
  return __awaiter(this, void 0, void 0, function* () {
@@ -66,7 +85,7 @@ class ServerApi_Unique extends GenericServerApi {
66
85
  exports.ServerApi_Unique = ServerApi_Unique;
67
86
  class ServerApi_Query extends GenericServerApi {
68
87
  constructor(dbModule, pathPart) {
69
- super(dbModule, types_1.DefaultApiDefs.Query, pathPart);
88
+ super(dbModule, __1.DefaultApiDefs.Query, pathPart);
70
89
  }
71
90
  process(request, response, queryParams, _body) {
72
91
  return __awaiter(this, void 0, void 0, function* () {
@@ -80,7 +99,7 @@ class ServerApi_Query extends GenericServerApi {
80
99
  exports.ServerApi_Query = ServerApi_Query;
81
100
  class ServerApi_Delete extends GenericServerApi {
82
101
  constructor(dbModule, pathPart) {
83
- super(dbModule, types_1.DefaultApiDefs.Delete, pathPart);
102
+ super(dbModule, __1.DefaultApiDefs.Delete, pathPart);
84
103
  }
85
104
  process(request, response, queryParams, body) {
86
105
  return __awaiter(this, void 0, void 0, function* () {
@@ -1 +1 @@
1
- {"version":3,"file":"apis.js","sourceRoot":"","sources":["../../src/main/app-backend/apis.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,2CAQyB;AACzB,sGAA6G;AAW7G,SAAgB,cAAc,CAAC,QAAkC,EAAE,QAAiB,EAAE,UAAmB;IACrG,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACnG,CAAC;AAFD,wCAEC;AAED,MAAsB,gBAClB,SAAQ,sBAAiB;IAKzB,YAA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IACrD,CAAC;IAEe,OAAO,CAAC,OAAuB,EAAE,QAAqB,EAAE,WAAsB,EAAE,IAAU;;YACtG,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAC3E,CAAC;KAAA;CACJ;AAVD,4CAUC"}
@@ -1,25 +1,24 @@
1
- import { DB_Object, PartialProperties } from "@intuitionrobotics/ts-common/utils/types";
2
- import { ApiBinder_DBCreate, ApiBinder_DBDelete, ApiBinder_DBQuery, ApiBinder_DBUniuqe, GenericApiDef } from "../shared/types";
3
- import { ThunderDispatcher } from "@intuitionrobotics/thunderstorm/app-frontend/core/thunder-dispatcher";
4
- import { BaseHttpRequest } from "@intuitionrobotics/thunderstorm/shared/BaseHttpRequest";
5
- import { ApiTypeBinder, DeriveBodyType, DeriveQueryType, DeriveResponseType, DeriveUrlType, ErrorResponse, QueryParams } from "@intuitionrobotics/thunderstorm/shared/types";
6
- import { Module } from "@intuitionrobotics/ts-common/core/module";
7
- export declare type BaseApiConfig = {
1
+ import { ApiTypeBinder, BaseHttpRequest, ErrorResponse, QueryParams } from "@intuitionrobotics/thunderstorm";
2
+ import { ApiBinder_DBCreate, ApiBinder_DBDelete, ApiBinder_DBQuery, ApiBinder_DBUniuqe, GenericApiDef } from "../index";
3
+ import { DB_Object } from "@intuitionrobotics/firebase";
4
+ import { ThunderDispatcher } from "@intuitionrobotics/thunderstorm/frontend";
5
+ import { Module, PartialProperties } from "@intuitionrobotics/ts-common";
6
+ export type BaseApiConfig = {
8
7
  relativeUrl: string;
9
8
  key: string;
10
9
  };
11
- export declare abstract class BaseDB_ApiGeneratorCaller<DBType extends DB_Object, UType extends PartialProperties<DBType, "_id"> = PartialProperties<DBType, "_id">, Config extends BaseApiConfig = BaseApiConfig> extends Module<Config> {
10
+ export declare abstract class BaseDB_ApiGeneratorCaller<DBType extends DB_Object, UType extends PartialProperties<DBType, "_id"> = PartialProperties<DBType, "_id">> extends Module<BaseApiConfig> {
12
11
  private readonly errorHandler;
13
12
  private defaultDispatcher?;
14
- constructor(config: Config, moduleName: string);
13
+ constructor(config: BaseApiConfig, moduleName: string);
15
14
  setDefaultDispatcher(defaultDispatcher: ThunderDispatcher<any, string>): void;
16
- protected createRequest<Binder extends ApiTypeBinder<U, R, B, P, any> = ApiTypeBinder<void, void, void, {}, any>, U extends string = DeriveUrlType<Binder>, R = DeriveResponseType<Binder>, B = DeriveBodyType<Binder>, P extends QueryParams = DeriveQueryType<Binder>>(apiDef: GenericApiDef): BaseHttpRequest<Binder>;
15
+ protected createRequest<Binder extends ApiTypeBinder<U, R, B, P, any>, U extends string = Binder["url"], R = Binder["response"], B = Binder["body"], P extends QueryParams = Binder["queryParams"]>(apiDef: GenericApiDef): BaseHttpRequest<Binder>;
17
16
  getRequestKey(apiDef: GenericApiDef): string;
18
17
  protected timeoutHandler(apiDef: GenericApiDef): number | void;
19
18
  protected onError(request: BaseHttpRequest<any>, resError?: ErrorResponse<any>): boolean;
20
19
  create(toCreate: UType): BaseHttpRequest<ApiBinder_DBCreate<DBType>>;
21
20
  update: (toUpdate: DBType) => BaseHttpRequest<ApiBinder_DBCreate<DBType>>;
22
- query: (query?: Partial<DBType> | undefined) => BaseHttpRequest<ApiBinder_DBQuery<DBType>>;
21
+ query: (query?: Partial<DBType>) => BaseHttpRequest<ApiBinder_DBQuery<DBType>>;
23
22
  unique: (_id: string) => BaseHttpRequest<ApiBinder_DBUniuqe<DBType>>;
24
23
  delete: (_id: string) => BaseHttpRequest<ApiBinder_DBDelete<DBType>>;
25
24
  private ids;
@@ -10,22 +10,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.BaseDB_ApiGeneratorCaller = void 0;
13
- const types_1 = require("../shared/types");
14
- const XhrHttpModule_1 = require("@intuitionrobotics/thunderstorm/app-frontend/modules/http/XhrHttpModule");
15
- const module_1 = require("@intuitionrobotics/ts-common/core/module");
16
- const array_tools_1 = require("@intuitionrobotics/ts-common/utils/array-tools");
17
- class BaseDB_ApiGeneratorCaller extends module_1.Module {
13
+ const index_1 = require("../index");
14
+ const frontend_1 = require("@intuitionrobotics/thunderstorm/frontend");
15
+ const ts_common_1 = require("@intuitionrobotics/ts-common");
16
+ class BaseDB_ApiGeneratorCaller extends ts_common_1.Module {
18
17
  // noinspection TypeScriptAbstractClassConstructorCanBeMadeProtected
19
18
  constructor(config, moduleName) {
20
19
  super(moduleName);
21
20
  this.errorHandler = (request, resError) => {
22
21
  if (this.onError(request, resError))
23
22
  return;
24
- return XhrHttpModule_1.XhrHttpModule.handleRequestFailure(request, resError);
23
+ return frontend_1.XhrHttpModule.handleRequestFailure(request, resError);
25
24
  };
26
25
  this.update = (toUpdate) => {
27
26
  return this
28
- .createRequest(types_1.DefaultApiDefs.Update)
27
+ .createRequest(index_1.DefaultApiDefs.Update)
29
28
  .setJsonBody(toUpdate)
30
29
  .execute((response) => __awaiter(this, void 0, void 0, function* () {
31
30
  return this.onEntryUpdated(response);
@@ -36,7 +35,7 @@ class BaseDB_ApiGeneratorCaller extends module_1.Module {
36
35
  if (!_query)
37
36
  _query = {};
38
37
  return this
39
- .createRequest(types_1.DefaultApiDefs.Query)
38
+ .createRequest(index_1.DefaultApiDefs.Query)
40
39
  .setJsonBody(_query)
41
40
  .execute((response) => __awaiter(this, void 0, void 0, function* () {
42
41
  return this.onQueryReturned(response);
@@ -44,7 +43,7 @@ class BaseDB_ApiGeneratorCaller extends module_1.Module {
44
43
  };
45
44
  this.unique = (_id) => {
46
45
  return this
47
- .createRequest(types_1.DefaultApiDefs.Unique)
46
+ .createRequest(index_1.DefaultApiDefs.Unique)
48
47
  .setUrlParams({ _id })
49
48
  .execute((response) => __awaiter(this, void 0, void 0, function* () {
50
49
  return this.onGotUnique(response);
@@ -52,7 +51,7 @@ class BaseDB_ApiGeneratorCaller extends module_1.Module {
52
51
  };
53
52
  this.delete = (_id) => {
54
53
  return this
55
- .createRequest(types_1.DefaultApiDefs.Delete)
54
+ .createRequest(index_1.DefaultApiDefs.Delete)
56
55
  .setUrlParams({ _id })
57
56
  .execute((response) => __awaiter(this, void 0, void 0, function* () {
58
57
  return this.onEntryDeleted(response);
@@ -62,20 +61,20 @@ class BaseDB_ApiGeneratorCaller extends module_1.Module {
62
61
  this.items = {};
63
62
  this.dispatch = () => {
64
63
  var _a, _b;
65
- (_a = this.defaultDispatcher) === null || _a === void 0 ? void 0 : _a.dispatchUI([]);
66
- (_b = this.defaultDispatcher) === null || _b === void 0 ? void 0 : _b.dispatchModule([]);
64
+ (_a = this.defaultDispatcher) === null || _a === void 0 ? void 0 : _a.dispatchUI();
65
+ (_b = this.defaultDispatcher) === null || _b === void 0 ? void 0 : _b.dispatchModule();
67
66
  };
68
67
  this.upsertId = (id) => {
69
68
  if (!this.ids.includes(id))
70
- this.ids.push(id);
69
+ (0, ts_common_1.addItemToArray)(this.ids, id);
71
70
  };
72
- this.setConfig(config);
71
+ this.setDefaultConfig(config);
73
72
  }
74
73
  setDefaultDispatcher(defaultDispatcher) {
75
74
  this.defaultDispatcher = defaultDispatcher;
76
75
  }
77
76
  createRequest(apiDef) {
78
- const request = XhrHttpModule_1.XhrHttpModule
77
+ const request = frontend_1.XhrHttpModule
79
78
  .createRequest(apiDef.method, this.getRequestKey(apiDef))
80
79
  .setRelativeUrl(`${this.config.relativeUrl}${apiDef.suffix ? "/" + apiDef.suffix : ""}`)
81
80
  .setOnError(this.errorHandler);
@@ -94,7 +93,7 @@ class BaseDB_ApiGeneratorCaller extends module_1.Module {
94
93
  }
95
94
  create(toCreate) {
96
95
  return this
97
- .createRequest(types_1.DefaultApiDefs.Create)
96
+ .createRequest(index_1.DefaultApiDefs.Create)
98
97
  .setJsonBody(toCreate)
99
98
  .execute((response) => __awaiter(this, void 0, void 0, function* () {
100
99
  return this.onEntryCreated(response);
@@ -115,7 +114,7 @@ class BaseDB_ApiGeneratorCaller extends module_1.Module {
115
114
  }
116
115
  onEntryDeleted(item) {
117
116
  return __awaiter(this, void 0, void 0, function* () {
118
- array_tools_1.removeItemFromArray(this.ids, item._id);
117
+ (0, ts_common_1.removeItemFromArray)(this.ids, item._id);
119
118
  delete this.items[item._id];
120
119
  this.dispatch();
121
120
  });
@@ -128,7 +127,8 @@ class BaseDB_ApiGeneratorCaller extends module_1.Module {
128
127
  }
129
128
  onGotUnique(item) {
130
129
  return __awaiter(this, void 0, void 0, function* () {
131
- this.upsertId(item._id);
130
+ if (!this.ids.includes(item._id))
131
+ (0, ts_common_1.addItemToArray)(this.ids, item._id);
132
132
  this.items[item._id] = item;
133
133
  this.dispatch();
134
134
  });
@@ -1 +1 @@
1
- {"version":3,"file":"BaseDB_ApiGeneratorCaller.js","sourceRoot":"","sources":["../../src/main/app-frontend/BaseDB_ApiGeneratorCaller.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAOyB;AAEzB,2GAAsG;AAatG,qEAAgE;AAChE,gFAAmF;AAQnF,MAAsB,yBAKlB,SAAQ,eAAc;IAWtB,oEAAoE;IACpE,YAAY,MAAc,EAAE,UAAkB;QAC1C,KAAK,CAAC,UAAU,CAAC,CAAC;QAXL,iBAAY,GAA6B,CAAC,OAA6B,EAAE,QAA6B,EAAE,EAAE;YACvH,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC;gBAC/B,OAAO;YAEX,OAAO,6BAAa,CAAC,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACjE,CAAC,CAAC;QAoDF,WAAM,GAAG,CAAC,QAAgB,EAA+C,EAAE;YACvE,OAAO,IAAI;iBACN,aAAa,CAA6B,sBAAc,CAAC,MAAM,CAAC;iBAChE,WAAW,CAAC,QAAQ,CAAC;iBACrB,OAAO,CAAC,CAAM,QAAQ,EAAC,EAAE;gBACtB,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;YACzC,CAAC,CAAA,CAA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KAAA;IAEe,eAAe,CAAC,KAAe;;YAC3C,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC/C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;gBACtC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;gBACvB,OAAO,KAAK,CAAC;YACjB,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YAEf,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpB,CAAC;KAAA;CAMJ;AA3JD,8DA2JC"}
package/backend.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./app-backend/apis";
2
+ export * from "./app-backend/BaseDB_ApiGenerator";
package/backend.js ADDED
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /*
3
+ * Permissions management system, define access level for each of
4
+ * your server apis, and restrict users by giving them access levels
5
+ *
6
+ * Copyright (C) 2020 Intuition Robotics
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
20
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ var desc = Object.getOwnPropertyDescriptor(m, k);
23
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24
+ desc = { enumerable: true, get: function() { return m[k]; } };
25
+ }
26
+ Object.defineProperty(o, k2, desc);
27
+ }) : (function(o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ }));
31
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
32
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ __exportStar(require("./app-backend/apis"), exports);
36
+ __exportStar(require("./app-backend/BaseDB_ApiGenerator"), exports);
37
+ //# sourceMappingURL=backend.js.map
package/backend.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/main/backend.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;AAEH,qDAAkC;AAClC,oEAAiD"}
package/frontend.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./app-frontend/BaseDB_ApiGeneratorCaller";
package/frontend.js ADDED
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /*
3
+ * Permissions management system, define access level for each of
4
+ * your server apis, and restrict users by giving them access levels
5
+ *
6
+ * Copyright (C) 2020 Intuition Robotics
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
20
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ var desc = Object.getOwnPropertyDescriptor(m, k);
23
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24
+ desc = { enumerable: true, get: function() { return m[k]; } };
25
+ }
26
+ Object.defineProperty(o, k2, desc);
27
+ }) : (function(o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ }));
31
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
32
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ __exportStar(require("./app-frontend/BaseDB_ApiGeneratorCaller"), exports);
36
+ //# sourceMappingURL=frontend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontend.js","sourceRoot":"","sources":["../src/main/frontend.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;AAEH,2EAAwD"}
package/index.d.ts CHANGED
@@ -0,0 +1 @@
1
+ export * from "./shared/types";
package/index.js CHANGED
@@ -1,2 +1,36 @@
1
1
  "use strict";
2
+ /*
3
+ * Permissions management system, define access level for each of
4
+ * your server apis, and restrict users by giving them access levels
5
+ *
6
+ * Copyright (C) 2020 Intuition Robotics
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
20
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ var desc = Object.getOwnPropertyDescriptor(m, k);
23
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24
+ desc = { enumerable: true, get: function() { return m[k]; } };
25
+ }
26
+ Object.defineProperty(o, k2, desc);
27
+ }) : (function(o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ }));
31
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
32
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ __exportStar(require("./shared/types"), exports);
2
36
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/main/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/main/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;AAEH,iDAA+B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuitionrobotics/db-api-generator",
3
- "version": "0.46.00",
3
+ "version": "0.47.1",
4
4
  "description": "db-api-generator",
5
5
  "keywords": [
6
6
  "IR",
@@ -23,19 +23,19 @@
23
23
  "main": "./index.js",
24
24
  "types": "./index.d.ts",
25
25
  "scripts": {
26
- "build": "tsc"
26
+ "build": "tsc -v && tsc -p src/main/tsconfig.json --rootDir ./src/main --outDir dist"
27
27
  },
28
28
  "dependencies": {
29
- "@intuitionrobotics/ts-common": "~0.46.0",
30
- "@intuitionrobotics/firebase": "~0.46.0",
31
- "@intuitionrobotics/thunderstorm": "~0.46.0"
29
+ "@intuitionrobotics/ts-common": "~0.47.0",
30
+ "@intuitionrobotics/firebase": "~0.47.0",
31
+ "@intuitionrobotics/thunderstorm": "~0.47.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@intuitionrobotics/testelot": "~0.46.0",
35
- "@types/node": "^16.0.0",
34
+ "@intuitionrobotics/testelot": "~0.47.0",
35
+ "@types/node": "^18.0.0",
36
36
  "module-alias": "^2.2.0",
37
37
  "ts-node": "^8.10.2",
38
38
  "tslint": "^5.16.0",
39
- "typescript": "~4.1.0"
39
+ "typescript": "^5.3.0"
40
40
  }
41
41
  }
package/shared/types.d.ts CHANGED
@@ -1,20 +1,20 @@
1
- import { ApiWithBody, ApiWithQuery, HttpMethod } from "@intuitionrobotics/thunderstorm/shared/types";
2
- import { DB_Object } from "@intuitionrobotics/ts-common/utils/types";
1
+ import { DB_Object } from "@intuitionrobotics/firebase";
2
+ import { ApiWithBody, ApiWithQuery, HttpMethod } from "@intuitionrobotics/thunderstorm";
3
3
  export declare const DefaultApiDefs: {
4
4
  [k: string]: GenericApiDef;
5
5
  };
6
6
  export declare const ErrorKey_BadInput = "bad-input";
7
- export declare type BadInputErrorBody = {
7
+ export type BadInputErrorBody = {
8
8
  path: string;
9
9
  input?: string;
10
10
  };
11
- export declare type GenericApiDef = {
11
+ export type GenericApiDef = {
12
12
  method: HttpMethod;
13
13
  key: string;
14
14
  suffix?: string;
15
15
  };
16
- export declare type ApiBinder_DBCreate<DBType extends DB_Object, RequestType extends Omit<DBType, "_id"> = Omit<DBType, "_id">> = ApiWithBody<string, RequestType, DBType>;
17
- export declare type ApiBinder_DBDelete<DBType extends DB_Object> = ApiWithQuery<string, DBType, DB_Object>;
18
- export declare type ApiBinder_DBUniuqe<DBType extends DB_Object> = ApiWithQuery<string, DBType, DB_Object>;
19
- export declare type ApiBinder_DBUpdate<DBType extends DB_Object> = ApiWithBody<string, DBType, DBType>;
20
- export declare type ApiBinder_DBQuery<DBType extends DB_Object> = ApiWithBody<string, Partial<DBType>, DBType[]>;
16
+ export type ApiBinder_DBCreate<DBType extends DB_Object, RequestType extends Omit<DBType, "_id"> = Omit<DBType, "_id">> = ApiWithBody<string, RequestType, DBType>;
17
+ export type ApiBinder_DBDelete<DBType extends DB_Object> = ApiWithQuery<string, DBType, DB_Object>;
18
+ export type ApiBinder_DBUniuqe<DBType extends DB_Object> = ApiWithQuery<string, DBType, DB_Object>;
19
+ export type ApiBinder_DBUpdate<DBType extends DB_Object> = ApiWithBody<string, DBType, DBType>;
20
+ export type ApiBinder_DBQuery<DBType extends DB_Object> = ApiWithBody<string, Partial<DBType>, DBType[]>;
package/shared/types.js CHANGED
@@ -1,30 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ErrorKey_BadInput = exports.DefaultApiDefs = void 0;
4
- const types_1 = require("@intuitionrobotics/thunderstorm/shared/types");
4
+ const thunderstorm_1 = require("@intuitionrobotics/thunderstorm");
5
5
  exports.DefaultApiDefs = {
6
6
  Create: {
7
- method: types_1.HttpMethod.POST,
7
+ method: thunderstorm_1.HttpMethod.POST,
8
8
  key: "create",
9
9
  suffix: "create"
10
10
  },
11
11
  Update: {
12
- method: types_1.HttpMethod.POST,
12
+ method: thunderstorm_1.HttpMethod.POST,
13
13
  key: "update",
14
14
  suffix: "update"
15
15
  },
16
16
  Delete: {
17
- method: types_1.HttpMethod.GET,
17
+ method: thunderstorm_1.HttpMethod.GET, // delete doesn't works, so we changed it to get
18
18
  key: "delete",
19
19
  suffix: "delete"
20
20
  },
21
21
  Unique: {
22
- method: types_1.HttpMethod.GET,
22
+ method: thunderstorm_1.HttpMethod.GET,
23
23
  key: "unique",
24
24
  suffix: "unique"
25
25
  },
26
26
  Query: {
27
- method: types_1.HttpMethod.POST,
27
+ method: thunderstorm_1.HttpMethod.POST,
28
28
  key: "query",
29
29
  suffix: "query"
30
30
  },
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/main/shared/types.ts"],"names":[],"mappings":";;;AAAA,wEAAmG;AAGtF,QAAA,cAAc,GAAoC;IAC3D,MAAM,EAAE;QACJ,MAAM,EAAE,kBAAU,CAAC,IAAI;QACvB,GAAG,EAAE,QAAQ;QACb,MAAM,EAAE,QAAQ;KACnB;IACD,MAAM,EAAE;QACJ,MAAM,EAAE,kBAAU,CAAC,IAAI;QACvB,GAAG,EAAE,QAAQ;QACb,MAAM,EAAE,QAAQ;KACnB;IACD,MAAM,EAAE;QACJ,MAAM,EAAE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