@my-devkit/firebase 1.0.98 → 1.0.102

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 (146) hide show
  1. package/package.json +10 -11
  2. package/dist/aggregate.d.ts +0 -13
  3. package/dist/aggregate.js +0 -85
  4. package/dist/aggregate.js.map +0 -1
  5. package/dist/app-factory.d.ts +0 -31
  6. package/dist/app-factory.js +0 -331
  7. package/dist/app-factory.js.map +0 -1
  8. package/dist/bus.d.ts +0 -17
  9. package/dist/bus.js +0 -128
  10. package/dist/bus.js.map +0 -1
  11. package/dist/constants.d.ts +0 -5
  12. package/dist/constants.js +0 -9
  13. package/dist/constants.js.map +0 -1
  14. package/dist/context.d.ts +0 -28
  15. package/dist/context.js +0 -102
  16. package/dist/context.js.map +0 -1
  17. package/dist/decorators/controller/body.d.ts +0 -1
  18. package/dist/decorators/controller/body.js +0 -17
  19. package/dist/decorators/controller/body.js.map +0 -1
  20. package/dist/decorators/controller/body.spec.d.ts +0 -1
  21. package/dist/decorators/controller/body.spec.js +0 -120
  22. package/dist/decorators/controller/body.spec.js.map +0 -1
  23. package/dist/decorators/controller/controller.d.ts +0 -1
  24. package/dist/decorators/controller/controller.js +0 -14
  25. package/dist/decorators/controller/controller.js.map +0 -1
  26. package/dist/decorators/controller/controller.spec.d.ts +0 -1
  27. package/dist/decorators/controller/controller.spec.js +0 -68
  28. package/dist/decorators/controller/controller.spec.js.map +0 -1
  29. package/dist/decorators/controller/get.d.ts +0 -1
  30. package/dist/decorators/controller/get.js +0 -12
  31. package/dist/decorators/controller/get.js.map +0 -1
  32. package/dist/decorators/controller/get.spec.d.ts +0 -1
  33. package/dist/decorators/controller/get.spec.js +0 -87
  34. package/dist/decorators/controller/get.spec.js.map +0 -1
  35. package/dist/decorators/controller/index.d.ts +0 -6
  36. package/dist/decorators/controller/index.js +0 -19
  37. package/dist/decorators/controller/index.js.map +0 -1
  38. package/dist/decorators/controller/param.d.ts +0 -1
  39. package/dist/decorators/controller/param.js +0 -21
  40. package/dist/decorators/controller/param.js.map +0 -1
  41. package/dist/decorators/controller/param.spec.d.ts +0 -1
  42. package/dist/decorators/controller/param.spec.js +0 -113
  43. package/dist/decorators/controller/param.spec.js.map +0 -1
  44. package/dist/decorators/controller/post.d.ts +0 -1
  45. package/dist/decorators/controller/post.js +0 -12
  46. package/dist/decorators/controller/post.js.map +0 -1
  47. package/dist/decorators/controller/post.spec.d.ts +0 -1
  48. package/dist/decorators/controller/post.spec.js +0 -133
  49. package/dist/decorators/controller/post.spec.js.map +0 -1
  50. package/dist/decorators/controller/query.d.ts +0 -1
  51. package/dist/decorators/controller/query.js +0 -21
  52. package/dist/decorators/controller/query.js.map +0 -1
  53. package/dist/decorators/controller/query.spec.d.ts +0 -1
  54. package/dist/decorators/controller/query.spec.js +0 -113
  55. package/dist/decorators/controller/query.spec.js.map +0 -1
  56. package/dist/decorators/handler/command-handler.d.ts +0 -1
  57. package/dist/decorators/handler/command-handler.js +0 -22
  58. package/dist/decorators/handler/command-handler.js.map +0 -1
  59. package/dist/decorators/handler/command-handler.spec.d.ts +0 -1
  60. package/dist/decorators/handler/command-handler.spec.js +0 -211
  61. package/dist/decorators/handler/command-handler.spec.js.map +0 -1
  62. package/dist/decorators/handler/event-handler.d.ts +0 -2
  63. package/dist/decorators/handler/event-handler.js +0 -22
  64. package/dist/decorators/handler/event-handler.js.map +0 -1
  65. package/dist/decorators/handler/event-handler.spec.d.ts +0 -1
  66. package/dist/decorators/handler/event-handler.spec.js +0 -214
  67. package/dist/decorators/handler/event-handler.spec.js.map +0 -1
  68. package/dist/decorators/handler/index.d.ts +0 -2
  69. package/dist/decorators/handler/index.js +0 -15
  70. package/dist/decorators/handler/index.js.map +0 -1
  71. package/dist/decorators/index.d.ts +0 -5
  72. package/dist/decorators/index.js +0 -18
  73. package/dist/decorators/index.js.map +0 -1
  74. package/dist/decorators/injectable.d.ts +0 -1
  75. package/dist/decorators/injectable.js +0 -11
  76. package/dist/decorators/injectable.js.map +0 -1
  77. package/dist/decorators/module.d.ts +0 -18
  78. package/dist/decorators/module.js +0 -14
  79. package/dist/decorators/module.js.map +0 -1
  80. package/dist/decorators/transactional-client.d.ts +0 -1
  81. package/dist/decorators/transactional-client.js +0 -11
  82. package/dist/decorators/transactional-client.js.map +0 -1
  83. package/dist/execution-mode-enum.d.ts +0 -4
  84. package/dist/execution-mode-enum.js +0 -9
  85. package/dist/execution-mode-enum.js.map +0 -1
  86. package/dist/firestore-client.d.ts +0 -29
  87. package/dist/firestore-client.js +0 -236
  88. package/dist/firestore-client.js.map +0 -1
  89. package/dist/handler-helper.d.ts +0 -9
  90. package/dist/handler-helper.js +0 -159
  91. package/dist/handler-helper.js.map +0 -1
  92. package/dist/index.d.ts +0 -7
  93. package/dist/index.js +0 -20
  94. package/dist/index.js.map +0 -1
  95. package/dist/injector.d.ts +0 -7
  96. package/dist/injector.js +0 -42
  97. package/dist/injector.js.map +0 -1
  98. package/dist/interfaces/app-config.d.ts +0 -0
  99. package/dist/interfaces/app-config.js +0 -1
  100. package/dist/interfaces/app-config.js.map +0 -1
  101. package/dist/interfaces/from-array.d.ts +0 -1
  102. package/dist/interfaces/from-array.js +0 -3
  103. package/dist/interfaces/from-array.js.map +0 -1
  104. package/dist/interfaces/index.d.ts +0 -4
  105. package/dist/interfaces/index.js +0 -17
  106. package/dist/interfaces/index.js.map +0 -1
  107. package/dist/interfaces/newable.d.ts +0 -1
  108. package/dist/interfaces/newable.js +0 -3
  109. package/dist/interfaces/newable.js.map +0 -1
  110. package/dist/interfaces/transactional-client.d.ts +0 -3
  111. package/dist/interfaces/transactional-client.js +0 -3
  112. package/dist/interfaces/transactional-client.js.map +0 -1
  113. package/dist/interfaces/type.d.ts +0 -3
  114. package/dist/interfaces/type.js +0 -3
  115. package/dist/interfaces/type.js.map +0 -1
  116. package/dist/reflect.d.ts +0 -62
  117. package/dist/reflect.js +0 -113
  118. package/dist/reflect.js.map +0 -1
  119. package/dist/request-method.enum.d.ts +0 -4
  120. package/dist/request-method.enum.js +0 -9
  121. package/dist/request-method.enum.js.map +0 -1
  122. package/dist/server/index.d.ts +0 -1
  123. package/dist/server/index.js +0 -14
  124. package/dist/server/index.js.map +0 -1
  125. package/dist/server/middlewares/authentication-middleware.d.ts +0 -3
  126. package/dist/server/middlewares/authentication-middleware.js +0 -110
  127. package/dist/server/middlewares/authentication-middleware.js.map +0 -1
  128. package/dist/server/middlewares/create-context-middleware.d.ts +0 -3
  129. package/dist/server/middlewares/create-context-middleware.js +0 -55
  130. package/dist/server/middlewares/create-context-middleware.js.map +0 -1
  131. package/dist/server/middlewares/error-middleware.d.ts +0 -2
  132. package/dist/server/middlewares/error-middleware.js +0 -78
  133. package/dist/server/middlewares/error-middleware.js.map +0 -1
  134. package/dist/server/middlewares/headers-middleware.d.ts +0 -2
  135. package/dist/server/middlewares/headers-middleware.js +0 -58
  136. package/dist/server/middlewares/headers-middleware.js.map +0 -1
  137. package/dist/server/middlewares/index.d.ts +0 -5
  138. package/dist/server/middlewares/index.js +0 -18
  139. package/dist/server/middlewares/index.js.map +0 -1
  140. package/dist/server/middlewares/not-found-middleware.d.ts +0 -2
  141. package/dist/server/middlewares/not-found-middleware.js +0 -50
  142. package/dist/server/middlewares/not-found-middleware.js.map +0 -1
  143. package/dist/server/server.d.ts +0 -33
  144. package/dist/server/server.js +0 -139
  145. package/dist/server/server.js.map +0 -1
  146. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,29 +0,0 @@
1
- import { Document } from '@my-devkit/core';
2
- import { ITransactionalClient } from './interfaces';
3
- export declare class FirestoreClient implements ITransactionalClient {
4
- private db;
5
- private operations;
6
- private cachedDocuments;
7
- save(): Promise<void>;
8
- _find<T>(path: string): Promise<T>;
9
- _findWhere<T>(collection: string, whereClauses?: [string, FirestoreClient.Operator, any | any[]][]): Promise<T>;
10
- _get<T>(path: string): Promise<T>;
11
- _getAll<T>(collection: string): Promise<T[]>;
12
- _getWhere<T>(collection: string, whereClauses?: [string, FirestoreClient.Operator, any | any[]][], orderBy?: string): Promise<T[]>;
13
- createDocument(document: Document): void;
14
- updateDocument(document: Document): void;
15
- deleteDocument(document: Document): void;
16
- private getCollectionReference;
17
- }
18
- export declare namespace FirestoreClient {
19
- interface Operation {
20
- document: Document;
21
- action: Action;
22
- }
23
- enum Action {
24
- Create,
25
- Update,
26
- Delete
27
- }
28
- type Operator = FirebaseFirestore.WhereFilterOp;
29
- }
@@ -1,236 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
- return new (P || (P = Promise))(function (resolve, reject) {
11
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14
- step((generator = generator.apply(thisArg, _arguments || [])).next());
15
- });
16
- };
17
- var __generator = (this && this.__generator) || function (thisArg, body) {
18
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
19
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
20
- function verb(n) { return function (v) { return step([n, v]); }; }
21
- function step(op) {
22
- if (f) throw new TypeError("Generator is already executing.");
23
- while (_) try {
24
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
25
- if (y = 0, t) op = [op[0] & 2, t.value];
26
- switch (op[0]) {
27
- case 0: case 1: t = op; break;
28
- case 4: _.label++; return { value: op[1], done: false };
29
- case 5: _.label++; y = op[1]; op = [0]; continue;
30
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
31
- default:
32
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
33
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
34
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
35
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
36
- if (t[2]) _.ops.pop();
37
- _.trys.pop(); continue;
38
- }
39
- op = body.call(thisArg, _);
40
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
41
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
42
- }
43
- };
44
- Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.FirestoreClient = void 0;
46
- var core_1 = require("@my-devkit/core");
47
- var firestore_1 = require("firebase-admin/firestore");
48
- var decorators_1 = require("./decorators");
49
- var FirestoreClient = /** @class */ (function () {
50
- function FirestoreClient() {
51
- this.db = (0, firestore_1.getFirestore)();
52
- this.operations = [];
53
- this.cachedDocuments = new Map();
54
- }
55
- FirestoreClient_1 = FirestoreClient;
56
- FirestoreClient.prototype.save = function () {
57
- return __awaiter(this, void 0, void 0, function () {
58
- var _i, _a, operation;
59
- return __generator(this, function (_b) {
60
- switch (_b.label) {
61
- case 0:
62
- core_1.Logger.info("Saving ".concat(this.operations.length, " operations"));
63
- _i = 0, _a = this.operations;
64
- _b.label = 1;
65
- case 1:
66
- if (!(_i < _a.length)) return [3 /*break*/, 9];
67
- operation = _a[_i];
68
- if (!(operation.action === FirestoreClient_1.Action.Create)) return [3 /*break*/, 3];
69
- core_1.Logger.info("Create document ".concat(operation.document._path));
70
- return [4 /*yield*/, this.db.doc(operation.document._path).set((0, core_1.serialize)(operation.document))];
71
- case 2:
72
- _b.sent();
73
- return [3 /*break*/, 8];
74
- case 3:
75
- if (!(operation.action === FirestoreClient_1.Action.Update)) return [3 /*break*/, 5];
76
- core_1.Logger.info("Update document ".concat(operation.document._path));
77
- return [4 /*yield*/, this.db.doc(operation.document._path).set((0, core_1.serialize)(operation.document))];
78
- case 4:
79
- _b.sent();
80
- return [3 /*break*/, 8];
81
- case 5:
82
- if (!(operation.action === FirestoreClient_1.Action.Delete)) return [3 /*break*/, 7];
83
- core_1.Logger.info("Delete document ".concat(operation.document._path));
84
- return [4 /*yield*/, this.db.doc(operation.document._path).delete()];
85
- case 6:
86
- _b.sent();
87
- return [3 /*break*/, 8];
88
- case 7: throw new Error("Transactional Repository: Not supported action ".concat(operation.action));
89
- case 8:
90
- _i++;
91
- return [3 /*break*/, 1];
92
- case 9: return [2 /*return*/];
93
- }
94
- });
95
- });
96
- };
97
- FirestoreClient.prototype._find = function (path) {
98
- return __awaiter(this, void 0, void 0, function () {
99
- var doc, result;
100
- return __generator(this, function (_a) {
101
- switch (_a.label) {
102
- case 0:
103
- core_1.Logger.info("Repository: find ".concat(path));
104
- if (this.cachedDocuments.has(path)) {
105
- core_1.Logger.info("Repository: document returned from transaction");
106
- return [2 /*return*/, this.cachedDocuments.get(path)];
107
- }
108
- return [4 /*yield*/, this.db.doc(path).get()];
109
- case 1:
110
- doc = _a.sent();
111
- result = doc.data();
112
- return [2 /*return*/, result ? (0, core_1.deserialize)(result) : null];
113
- }
114
- });
115
- });
116
- };
117
- FirestoreClient.prototype._findWhere = function (collection, whereClauses) {
118
- if (whereClauses === void 0) { whereClauses = []; }
119
- return __awaiter(this, void 0, void 0, function () {
120
- var documents;
121
- return __generator(this, function (_a) {
122
- switch (_a.label) {
123
- case 0: return [4 /*yield*/, this._getWhere(collection, whereClauses)];
124
- case 1:
125
- documents = _a.sent();
126
- if (documents.length > 1) {
127
- throw new Error("Transactional Repository: Too many documents found (".concat(documents.length, ")"));
128
- }
129
- return [2 /*return*/, documents[0] || null];
130
- }
131
- });
132
- });
133
- };
134
- FirestoreClient.prototype._get = function (path) {
135
- return __awaiter(this, void 0, void 0, function () {
136
- var result;
137
- return __generator(this, function (_a) {
138
- switch (_a.label) {
139
- case 0:
140
- core_1.Logger.info("Repository: get ".concat(path));
141
- return [4 /*yield*/, this._find(path)];
142
- case 1:
143
- result = _a.sent();
144
- if (!result) {
145
- throw new core_1.NotFoundError("Repository: document ".concat(path, " not found"));
146
- }
147
- return [2 /*return*/, result];
148
- }
149
- });
150
- });
151
- };
152
- FirestoreClient.prototype._getAll = function (collection) {
153
- return __awaiter(this, void 0, void 0, function () {
154
- var documents, querySnapshot;
155
- return __generator(this, function (_a) {
156
- switch (_a.label) {
157
- case 0:
158
- core_1.Logger.info("Repository: getAll ".concat(collection));
159
- documents = [];
160
- return [4 /*yield*/, this.getCollectionReference(collection).get()];
161
- case 1:
162
- querySnapshot = _a.sent();
163
- querySnapshot.forEach(function (doc) {
164
- documents.push((0, core_1.deserialize)(doc.data()));
165
- });
166
- return [2 /*return*/, documents];
167
- }
168
- });
169
- });
170
- };
171
- FirestoreClient.prototype._getWhere = function (collection, whereClauses, orderBy) {
172
- if (whereClauses === void 0) { whereClauses = []; }
173
- if (orderBy === void 0) { orderBy = null; }
174
- return __awaiter(this, void 0, void 0, function () {
175
- var documents, query, querySnapshot;
176
- return __generator(this, function (_a) {
177
- switch (_a.label) {
178
- case 0:
179
- core_1.Logger.info("Repository: getWhere ".concat(collection, " whereClauses: ").concat(JSON.stringify(whereClauses)));
180
- documents = [];
181
- query = this.getCollectionReference(collection);
182
- whereClauses.forEach(function (where) {
183
- query = query.where(where[0], where[1], where[2]);
184
- });
185
- if (orderBy) {
186
- query = query.orderBy(orderBy);
187
- }
188
- return [4 /*yield*/, query.get()];
189
- case 1:
190
- querySnapshot = _a.sent();
191
- querySnapshot.forEach(function (doc) {
192
- documents.push((0, core_1.deserialize)(doc.data()));
193
- });
194
- return [2 /*return*/, documents];
195
- }
196
- });
197
- });
198
- };
199
- FirestoreClient.prototype.createDocument = function (document) {
200
- this.operations.push({ document: document, action: FirestoreClient_1.Action.Create });
201
- this.cachedDocuments.set(document._path, document);
202
- };
203
- FirestoreClient.prototype.updateDocument = function (document) {
204
- this.operations.push({ document: document, action: FirestoreClient_1.Action.Update });
205
- this.cachedDocuments.set(document._path, document);
206
- };
207
- FirestoreClient.prototype.deleteDocument = function (document) {
208
- this.operations.push({ document: document, action: FirestoreClient_1.Action.Delete });
209
- this.cachedDocuments.delete(document._path);
210
- };
211
- FirestoreClient.prototype.getCollectionReference = function (collection) {
212
- if (collection.startsWith('**/')) {
213
- return this.db.collectionGroup(collection.replace('**/', ''));
214
- }
215
- else {
216
- return this.db.collection(collection);
217
- }
218
- };
219
- var FirestoreClient_1;
220
- FirestoreClient = FirestoreClient_1 = __decorate([
221
- (0, decorators_1.TransactionalClient)(),
222
- (0, decorators_1.Injectable)()
223
- ], FirestoreClient);
224
- return FirestoreClient;
225
- }());
226
- exports.FirestoreClient = FirestoreClient;
227
- (function (FirestoreClient) {
228
- var Action;
229
- (function (Action) {
230
- Action[Action["Create"] = 'Create'] = "Create";
231
- Action[Action["Update"] = 'Update'] = "Update";
232
- Action[Action["Delete"] = 'Delete'] = "Delete";
233
- })(Action = FirestoreClient.Action || (FirestoreClient.Action = {}));
234
- })(FirestoreClient = exports.FirestoreClient || (exports.FirestoreClient = {}));
235
- exports.FirestoreClient = FirestoreClient;
236
- //# sourceMappingURL=firestore-client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"firestore-client.js","sourceRoot":"","sources":["../src/firestore-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAA0F;AAC1F,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C;IAChD,CAAC;IAEO,gDAAsB,GAA9B,UAA+B,UAAkB;QAC7C,IAAI,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;YAC9B,OAAO,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;SACjE;aAAM;YACH,OAAO,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;SACzC;IACL,CAAC;;IA5GQ,eAAe;QAF3B,IAAA,gCAAmB,GAAE;QACrB,IAAA,uBAAU,GAAE;OACA,eAAe,CA6G3B;IAAD,sBAAC;CAAA,AA7GD,IA6GC;AA7GY,0CAAe;AA+G5B,WAAiB,eAAe;IAO5B,IAAY,MAIX;IAJD,WAAY,MAAM;QACd,0BAAc,QAAQ,YAAA,CAAA;QACtB,0BAAc,QAAQ,YAAA,CAAA;QACtB,0BAAc,QAAQ,YAAA,CAAA;IAC1B,CAAC,EAJW,MAAM,GAAN,sBAAM,KAAN,sBAAM,QAIjB;AAEL,CAAC,EAbgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAa/B;AA5HY,0CAAe"}
@@ -1,9 +0,0 @@
1
- import { Aggregate } from './aggregate';
2
- export declare class HandlerHelper {
3
- static create<A extends Aggregate, R>(aggregate: A, callback: (a: A) => Promise<R>): Promise<R>;
4
- static update<A extends Aggregate, R>(aggregateOrId: A | string, callback: (a: A) => Promise<R>): Promise<R>;
5
- static delete<A extends Aggregate, R>(aggregateOrId: A | string, callback: (a: A) => Promise<R>): Promise<R>;
6
- private static get client();
7
- private static publishEvents;
8
- private static getAggregate;
9
- }
@@ -1,159 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.HandlerHelper = void 0;
40
- var core_1 = require("@my-devkit/core");
41
- var context_1 = require("./context");
42
- var execution_mode_enum_1 = require("./execution-mode-enum");
43
- var firestore_client_1 = require("./firestore-client");
44
- var HandlerHelper = /** @class */ (function () {
45
- function HandlerHelper() {
46
- }
47
- HandlerHelper.create = function (aggregate, callback) {
48
- return __awaiter(this, void 0, void 0, function () {
49
- var result;
50
- return __generator(this, function (_a) {
51
- switch (_a.label) {
52
- case 0: return [4 /*yield*/, callback(aggregate)];
53
- case 1:
54
- result = _a.sent();
55
- this.client.createDocument(aggregate);
56
- return [4 /*yield*/, this.publishEvents(aggregate)];
57
- case 2:
58
- _a.sent();
59
- return [2 /*return*/, result];
60
- }
61
- });
62
- });
63
- };
64
- HandlerHelper.update = function (aggregateOrId, callback) {
65
- return __awaiter(this, void 0, void 0, function () {
66
- var aggregate, hashBefore, result;
67
- return __generator(this, function (_a) {
68
- switch (_a.label) {
69
- case 0: return [4 /*yield*/, this.getAggregate(aggregateOrId)];
70
- case 1:
71
- aggregate = _a.sent();
72
- if (aggregate.events.length > 0) {
73
- core_1.Logger.warn("".concat(aggregate._type, " ").concat(aggregate.id, " has ").concat(aggregate.events.length, " events!!"));
74
- }
75
- hashBefore = aggregate.hash;
76
- return [4 /*yield*/, callback(aggregate)];
77
- case 2:
78
- result = _a.sent();
79
- if (!(aggregate.hash !== hashBefore)) return [3 /*break*/, 4];
80
- this.client.updateDocument(aggregate);
81
- return [4 /*yield*/, this.publishEvents(aggregate)];
82
- case 3:
83
- _a.sent();
84
- return [3 /*break*/, 5];
85
- case 4:
86
- core_1.Logger.debug("".concat(aggregate._type, " ").concat(aggregate.id, " didn't change, ").concat(aggregate.events.length, " events skipped"));
87
- aggregate.clearEvents();
88
- _a.label = 5;
89
- case 5: return [2 /*return*/, result];
90
- }
91
- });
92
- });
93
- };
94
- HandlerHelper.delete = function (aggregateOrId, callback) {
95
- return __awaiter(this, void 0, void 0, function () {
96
- var aggregate, result;
97
- return __generator(this, function (_a) {
98
- switch (_a.label) {
99
- case 0: return [4 /*yield*/, this.getAggregate(aggregateOrId)];
100
- case 1:
101
- aggregate = _a.sent();
102
- return [4 /*yield*/, callback(aggregate)];
103
- case 2:
104
- result = _a.sent();
105
- this.client.deleteDocument(aggregate);
106
- return [4 /*yield*/, this.publishEvents(aggregate)];
107
- case 3:
108
- _a.sent();
109
- return [2 /*return*/, result];
110
- }
111
- });
112
- });
113
- };
114
- Object.defineProperty(HandlerHelper, "client", {
115
- get: function () {
116
- return context_1.Context.resolve(firestore_client_1.FirestoreClient);
117
- },
118
- enumerable: false,
119
- configurable: true
120
- });
121
- HandlerHelper.publishEvents = function (aggregate) {
122
- return __awaiter(this, void 0, void 0, function () {
123
- var events, _i, events_1, event;
124
- return __generator(this, function (_a) {
125
- switch (_a.label) {
126
- case 0:
127
- events = aggregate.events;
128
- aggregate.clearEvents();
129
- _i = 0, events_1 = events;
130
- _a.label = 1;
131
- case 1:
132
- if (!(_i < events_1.length)) return [3 /*break*/, 4];
133
- event = events_1[_i];
134
- return [4 /*yield*/, context_1.Context.bus.publish(event, execution_mode_enum_1.ExecutionMode.Synchronous)];
135
- case 2:
136
- _a.sent();
137
- _a.label = 3;
138
- case 3:
139
- _i++;
140
- return [3 /*break*/, 1];
141
- case 4: return [2 /*return*/];
142
- }
143
- });
144
- });
145
- };
146
- HandlerHelper.getAggregate = function (aggregateOrId) {
147
- return __awaiter(this, void 0, void 0, function () {
148
- return __generator(this, function (_a) {
149
- if (typeof aggregateOrId === 'string' || aggregateOrId instanceof String) {
150
- return [2 /*return*/, this.client._find("/aggregates/".concat(aggregateOrId))];
151
- }
152
- return [2 /*return*/, aggregateOrId];
153
- });
154
- });
155
- };
156
- return HandlerHelper;
157
- }());
158
- exports.HandlerHelper = HandlerHelper;
159
- //# sourceMappingURL=handler-helper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handler-helper.js","sourceRoot":"","sources":["../src/handler-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,w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ggregate';
3
- export * from './context';
4
- export * from './app-factory';
5
- export * from './firestore-client';
6
- export * from './execution-mode-enum';
7
- export * from './handler-helper';
package/dist/index.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./decorators"), exports);
14
- __exportStar(require("./aggregate"), exports);
15
- __exportStar(require("./context"), exports);
16
- __exportStar(require("./app-factory"), exports);
17
- __exportStar(require("./firestore-client"), exports);
18
- __exportStar(require("./execution-mode-enum"), exports);
19
- __exportStar(require("./handler-helper"), exports);
20
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA6B;AAC7B,8CAA4B;AAC5B,4CAA0B;AAC1B,gDAA8B;AAC9B,qDAAmC;AACnC,wDAAsC;AACtC,mDAAiC"}
@@ -1,7 +0,0 @@
1
- import { ITransactionalClient, Type } from './interfaces';
2
- export declare class Injector {
3
- private instances;
4
- private transactionalClients;
5
- resolve<T>(target: Type<T>): T;
6
- getTransactionalClients(): ITransactionalClient[];
7
- }
package/dist/injector.js DELETED
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Injector = void 0;
13
- var reflect_1 = require("./reflect");
14
- var Injector = /** @class */ (function () {
15
- function Injector() {
16
- this.instances = new Map();
17
- this.transactionalClients = [];
18
- }
19
- Injector.prototype.resolve = function (target) {
20
- var _this = this;
21
- var injectableId = (0, reflect_1.reflect)(target).getInjectableId();
22
- if (!injectableId) {
23
- throw new Error("".concat(target.name, " is not injectable"));
24
- }
25
- if (!this.instances.has(injectableId)) {
26
- var tokens = (0, reflect_1.reflect)(target).getParameters();
27
- var injections = tokens.map(function (token) { return _this.resolve(token); });
28
- var instance = new (target.bind.apply(target, __spreadArray([void 0], injections, false)))();
29
- this.instances.set(injectableId, instance);
30
- if ((0, reflect_1.reflect)(target).isTransactionalClient()) {
31
- this.transactionalClients.push(instance);
32
- }
33
- }
34
- return this.instances.get(injectableId);
35
- };
36
- Injector.prototype.getTransactionalClients = function () {
37
- return __spreadArray([], this.transactionalClients, true);
38
- };
39
- return Injector;
40
- }());
41
- exports.Injector = Injector;
42
- //# sourceMappingURL=injector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"injector.js","sourceRoot":"","sources":["../src/injector.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAAoC;AAEpC;IAAA;QACY,cAAS,GAAG,IAAI,GAAG,EAAe,CAAC;QACnC,yBAAoB,GAA2B,EAAE,CAAC;IAyB9D,CAAC;IAvBU,0BAAO,GAAd,UAAkB,MAAe;QAAjC,iBAkBC;QAjBG,IAAM,YAAY,GAAG,IAAA,iBAAO,EAAC,MAAM,CAAC,CAAC,eAAe,EAAE,CAAC;QACvD,IAAI,CAAC,YAAY,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,UAAG,MAAM,CAAC,IAAI,uBAAoB,CAAC,CAAC;SACvD;QAED,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YACnC,IAAM,MAAM,GAAG,IAAA,iBAAO,EAAC,MAAM,CAAC,CAAC,aAAa,EAAE,CAAC;YAC/C,IAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,KAAI,CAAC,OAAO,CAAM,KAAK,CAAC,EAAxB,CAAwB,CAAC,CAAC;YACjE,IAAM,QAAQ,QAAO,MAAM,YAAN,MAAM,0BAAI,UAAU,YAAC,CAAC;YAC3C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;YAE3C,IAAI,IAAA,iBAAO,EAAC,MAAM,CAAC,CAAC,qBAAqB,EAAE,EAAE;gBACzC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAM,QAAQ,CAAC,CAAC;aACjD;SACJ;QAED,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC5C,CAAC;IAEM,0CAAuB,GAA9B;QACI,yBAAW,IAAI,CAAC,oBAAoB,QAAE;IAC1C,CAAC;IACL,eAAC;AAAD,CAAC,AA3BD,IA2BC;AA3BY,4BAAQ"}
File without changes
@@ -1 +0,0 @@
1
- //# sourceMappingURL=app-config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-config.js","sourceRoot":"","sources":["../../src/interfaces/app-config.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- export declare type FromArray<T extends ReadonlyArray<unknown>> = T extends ReadonlyArray<infer FromArray> ? FromArray : never;
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=from-array.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"from-array.js","sourceRoot":"","sources":["../../src/interfaces/from-array.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- export * from './newable';
2
- export * from './from-array';
3
- export * from './type';
4
- export * from './transactional-client';
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./newable"), exports);
14
- __exportStar(require("./from-array"), exports);
15
- __exportStar(require("./type"), exports);
16
- __exportStar(require("./transactional-client"), exports);
17
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B;AAC1B,+CAA6B;AAC7B,yCAAuB;AACvB,yDAAuC"}
@@ -1 +0,0 @@
1
- export declare type Newable<T> = new () => T;
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=newable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"newable.js","sourceRoot":"","sources":["../../src/interfaces/newable.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export interface ITransactionalClient {
2
- save(): Promise<void>;
3
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=transactional-client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transactional-client.js","sourceRoot":"","sources":["../../src/interfaces/transactional-client.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export interface Type<T = any> extends Function {
2
- new (...args: any[]): T;
3
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/interfaces/type.ts"],"names":[],"mappings":""}