@my-devkit/firebase 1.0.97 → 1.0.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -9
- package/src/firestore-client.ts +9 -0
- package/dist/aggregate.d.ts +0 -13
- package/dist/aggregate.js +0 -85
- package/dist/aggregate.js.map +0 -1
- package/dist/app-factory.d.ts +0 -31
- package/dist/app-factory.js +0 -331
- package/dist/app-factory.js.map +0 -1
- package/dist/bus.d.ts +0 -17
- package/dist/bus.js +0 -128
- package/dist/bus.js.map +0 -1
- package/dist/constants.d.ts +0 -5
- package/dist/constants.js +0 -9
- package/dist/constants.js.map +0 -1
- package/dist/context.d.ts +0 -28
- package/dist/context.js +0 -102
- package/dist/context.js.map +0 -1
- package/dist/decorators/controller/body.d.ts +0 -1
- package/dist/decorators/controller/body.js +0 -17
- package/dist/decorators/controller/body.js.map +0 -1
- package/dist/decorators/controller/body.spec.d.ts +0 -1
- package/dist/decorators/controller/body.spec.js +0 -120
- package/dist/decorators/controller/body.spec.js.map +0 -1
- package/dist/decorators/controller/controller.d.ts +0 -1
- package/dist/decorators/controller/controller.js +0 -14
- package/dist/decorators/controller/controller.js.map +0 -1
- package/dist/decorators/controller/controller.spec.d.ts +0 -1
- package/dist/decorators/controller/controller.spec.js +0 -68
- package/dist/decorators/controller/controller.spec.js.map +0 -1
- package/dist/decorators/controller/get.d.ts +0 -1
- package/dist/decorators/controller/get.js +0 -12
- package/dist/decorators/controller/get.js.map +0 -1
- package/dist/decorators/controller/get.spec.d.ts +0 -1
- package/dist/decorators/controller/get.spec.js +0 -87
- package/dist/decorators/controller/get.spec.js.map +0 -1
- package/dist/decorators/controller/index.d.ts +0 -6
- package/dist/decorators/controller/index.js +0 -19
- package/dist/decorators/controller/index.js.map +0 -1
- package/dist/decorators/controller/param.d.ts +0 -1
- package/dist/decorators/controller/param.js +0 -21
- package/dist/decorators/controller/param.js.map +0 -1
- package/dist/decorators/controller/param.spec.d.ts +0 -1
- package/dist/decorators/controller/param.spec.js +0 -113
- package/dist/decorators/controller/param.spec.js.map +0 -1
- package/dist/decorators/controller/post.d.ts +0 -1
- package/dist/decorators/controller/post.js +0 -12
- package/dist/decorators/controller/post.js.map +0 -1
- package/dist/decorators/controller/post.spec.d.ts +0 -1
- package/dist/decorators/controller/post.spec.js +0 -133
- package/dist/decorators/controller/post.spec.js.map +0 -1
- package/dist/decorators/controller/query.d.ts +0 -1
- package/dist/decorators/controller/query.js +0 -21
- package/dist/decorators/controller/query.js.map +0 -1
- package/dist/decorators/controller/query.spec.d.ts +0 -1
- package/dist/decorators/controller/query.spec.js +0 -113
- package/dist/decorators/controller/query.spec.js.map +0 -1
- package/dist/decorators/handler/command-handler.d.ts +0 -1
- package/dist/decorators/handler/command-handler.js +0 -22
- package/dist/decorators/handler/command-handler.js.map +0 -1
- package/dist/decorators/handler/command-handler.spec.d.ts +0 -1
- package/dist/decorators/handler/command-handler.spec.js +0 -211
- package/dist/decorators/handler/command-handler.spec.js.map +0 -1
- package/dist/decorators/handler/event-handler.d.ts +0 -2
- package/dist/decorators/handler/event-handler.js +0 -22
- package/dist/decorators/handler/event-handler.js.map +0 -1
- package/dist/decorators/handler/event-handler.spec.d.ts +0 -1
- package/dist/decorators/handler/event-handler.spec.js +0 -214
- package/dist/decorators/handler/event-handler.spec.js.map +0 -1
- package/dist/decorators/handler/index.d.ts +0 -2
- package/dist/decorators/handler/index.js +0 -15
- package/dist/decorators/handler/index.js.map +0 -1
- package/dist/decorators/index.d.ts +0 -5
- package/dist/decorators/index.js +0 -18
- package/dist/decorators/index.js.map +0 -1
- package/dist/decorators/injectable.d.ts +0 -1
- package/dist/decorators/injectable.js +0 -11
- package/dist/decorators/injectable.js.map +0 -1
- package/dist/decorators/module.d.ts +0 -18
- package/dist/decorators/module.js +0 -14
- package/dist/decorators/module.js.map +0 -1
- package/dist/decorators/transactional-client.d.ts +0 -1
- package/dist/decorators/transactional-client.js +0 -11
- package/dist/decorators/transactional-client.js.map +0 -1
- package/dist/execution-mode-enum.d.ts +0 -4
- package/dist/execution-mode-enum.js +0 -9
- package/dist/execution-mode-enum.js.map +0 -1
- package/dist/firestore-client.d.ts +0 -28
- package/dist/firestore-client.js +0 -219
- package/dist/firestore-client.js.map +0 -1
- package/dist/handler-helper.d.ts +0 -9
- package/dist/handler-helper.js +0 -159
- package/dist/handler-helper.js.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -20
- package/dist/index.js.map +0 -1
- package/dist/injector.d.ts +0 -7
- package/dist/injector.js +0 -42
- package/dist/injector.js.map +0 -1
- package/dist/interfaces/app-config.d.ts +0 -0
- package/dist/interfaces/app-config.js +0 -1
- package/dist/interfaces/app-config.js.map +0 -1
- package/dist/interfaces/from-array.d.ts +0 -1
- package/dist/interfaces/from-array.js +0 -3
- package/dist/interfaces/from-array.js.map +0 -1
- package/dist/interfaces/index.d.ts +0 -4
- package/dist/interfaces/index.js +0 -17
- package/dist/interfaces/index.js.map +0 -1
- package/dist/interfaces/newable.d.ts +0 -1
- package/dist/interfaces/newable.js +0 -3
- package/dist/interfaces/newable.js.map +0 -1
- package/dist/interfaces/transactional-client.d.ts +0 -3
- package/dist/interfaces/transactional-client.js +0 -3
- package/dist/interfaces/transactional-client.js.map +0 -1
- package/dist/interfaces/type.d.ts +0 -3
- package/dist/interfaces/type.js +0 -3
- package/dist/interfaces/type.js.map +0 -1
- package/dist/reflect.d.ts +0 -62
- package/dist/reflect.js +0 -113
- package/dist/reflect.js.map +0 -1
- package/dist/request-method.enum.d.ts +0 -4
- package/dist/request-method.enum.js +0 -9
- package/dist/request-method.enum.js.map +0 -1
- package/dist/server/index.d.ts +0 -1
- package/dist/server/index.js +0 -14
- package/dist/server/index.js.map +0 -1
- package/dist/server/middlewares/authentication-middleware.d.ts +0 -3
- package/dist/server/middlewares/authentication-middleware.js +0 -110
- package/dist/server/middlewares/authentication-middleware.js.map +0 -1
- package/dist/server/middlewares/create-context-middleware.d.ts +0 -3
- package/dist/server/middlewares/create-context-middleware.js +0 -55
- package/dist/server/middlewares/create-context-middleware.js.map +0 -1
- package/dist/server/middlewares/error-middleware.d.ts +0 -2
- package/dist/server/middlewares/error-middleware.js +0 -78
- package/dist/server/middlewares/error-middleware.js.map +0 -1
- package/dist/server/middlewares/headers-middleware.d.ts +0 -2
- package/dist/server/middlewares/headers-middleware.js +0 -58
- package/dist/server/middlewares/headers-middleware.js.map +0 -1
- package/dist/server/middlewares/index.d.ts +0 -5
- package/dist/server/middlewares/index.js +0 -18
- package/dist/server/middlewares/index.js.map +0 -1
- package/dist/server/middlewares/not-found-middleware.d.ts +0 -2
- package/dist/server/middlewares/not-found-middleware.js +0 -50
- package/dist/server/middlewares/not-found-middleware.js.map +0 -1
- package/dist/server/server.d.ts +0 -33
- package/dist/server/server.js +0 -139
- package/dist/server/server.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,28 +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
|
-
_get<T>(path: string): Promise<T>;
|
|
10
|
-
_getAll<T>(collection: string): Promise<T[]>;
|
|
11
|
-
_getWhere<T>(collection: string, whereClauses?: [string, FirestoreClient.Operator, any | any[]][], orderBy?: string): Promise<T[]>;
|
|
12
|
-
createDocument(document: Document): void;
|
|
13
|
-
updateDocument(document: Document): void;
|
|
14
|
-
deleteDocument(document: Document): void;
|
|
15
|
-
private getCollectionReference;
|
|
16
|
-
}
|
|
17
|
-
export declare namespace FirestoreClient {
|
|
18
|
-
interface Operation {
|
|
19
|
-
document: Document;
|
|
20
|
-
action: Action;
|
|
21
|
-
}
|
|
22
|
-
enum Action {
|
|
23
|
-
Create,
|
|
24
|
-
Update,
|
|
25
|
-
Delete
|
|
26
|
-
}
|
|
27
|
-
type Operator = FirebaseFirestore.WhereFilterOp;
|
|
28
|
-
}
|
package/dist/firestore-client.js
DELETED
|
@@ -1,219 +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._get = function (path) {
|
|
118
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
119
|
-
var result;
|
|
120
|
-
return __generator(this, function (_a) {
|
|
121
|
-
switch (_a.label) {
|
|
122
|
-
case 0:
|
|
123
|
-
core_1.Logger.info("Repository: get ".concat(path));
|
|
124
|
-
return [4 /*yield*/, this._find(path)];
|
|
125
|
-
case 1:
|
|
126
|
-
result = _a.sent();
|
|
127
|
-
if (!result) {
|
|
128
|
-
throw new core_1.NotFoundError("Repository: document ".concat(path, " not found"));
|
|
129
|
-
}
|
|
130
|
-
return [2 /*return*/, result];
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
};
|
|
135
|
-
FirestoreClient.prototype._getAll = function (collection) {
|
|
136
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
-
var documents, querySnapshot;
|
|
138
|
-
return __generator(this, function (_a) {
|
|
139
|
-
switch (_a.label) {
|
|
140
|
-
case 0:
|
|
141
|
-
core_1.Logger.info("Repository: getAll ".concat(collection));
|
|
142
|
-
documents = [];
|
|
143
|
-
return [4 /*yield*/, this.getCollectionReference(collection).get()];
|
|
144
|
-
case 1:
|
|
145
|
-
querySnapshot = _a.sent();
|
|
146
|
-
querySnapshot.forEach(function (doc) {
|
|
147
|
-
documents.push((0, core_1.deserialize)(doc.data()));
|
|
148
|
-
});
|
|
149
|
-
return [2 /*return*/, documents];
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
};
|
|
154
|
-
FirestoreClient.prototype._getWhere = function (collection, whereClauses, orderBy) {
|
|
155
|
-
if (whereClauses === void 0) { whereClauses = []; }
|
|
156
|
-
if (orderBy === void 0) { orderBy = null; }
|
|
157
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
158
|
-
var documents, query, querySnapshot;
|
|
159
|
-
return __generator(this, function (_a) {
|
|
160
|
-
switch (_a.label) {
|
|
161
|
-
case 0:
|
|
162
|
-
core_1.Logger.info("Repository: getWhere ".concat(collection, " whereClauses: ").concat(JSON.stringify(whereClauses)));
|
|
163
|
-
documents = [];
|
|
164
|
-
query = this.getCollectionReference(collection);
|
|
165
|
-
whereClauses.forEach(function (where) {
|
|
166
|
-
query = query.where(where[0], where[1], where[2]);
|
|
167
|
-
});
|
|
168
|
-
if (orderBy) {
|
|
169
|
-
query = query.orderBy(orderBy);
|
|
170
|
-
}
|
|
171
|
-
return [4 /*yield*/, query.get()];
|
|
172
|
-
case 1:
|
|
173
|
-
querySnapshot = _a.sent();
|
|
174
|
-
querySnapshot.forEach(function (doc) {
|
|
175
|
-
documents.push((0, core_1.deserialize)(doc.data()));
|
|
176
|
-
});
|
|
177
|
-
return [2 /*return*/, documents];
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
};
|
|
182
|
-
FirestoreClient.prototype.createDocument = function (document) {
|
|
183
|
-
this.operations.push({ document: document, action: FirestoreClient_1.Action.Create });
|
|
184
|
-
this.cachedDocuments.set(document._path, document);
|
|
185
|
-
};
|
|
186
|
-
FirestoreClient.prototype.updateDocument = function (document) {
|
|
187
|
-
this.operations.push({ document: document, action: FirestoreClient_1.Action.Update });
|
|
188
|
-
this.cachedDocuments.set(document._path, document);
|
|
189
|
-
};
|
|
190
|
-
FirestoreClient.prototype.deleteDocument = function (document) {
|
|
191
|
-
this.operations.push({ document: document, action: FirestoreClient_1.Action.Delete });
|
|
192
|
-
this.cachedDocuments.delete(document._path);
|
|
193
|
-
};
|
|
194
|
-
FirestoreClient.prototype.getCollectionReference = function (collection) {
|
|
195
|
-
if (collection.startsWith('**/')) {
|
|
196
|
-
return this.db.collectionGroup(collection.replace('**/', ''));
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
return this.db.collection(collection);
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
var FirestoreClient_1;
|
|
203
|
-
FirestoreClient = FirestoreClient_1 = __decorate([
|
|
204
|
-
(0, decorators_1.TransactionalClient)(),
|
|
205
|
-
(0, decorators_1.Injectable)()
|
|
206
|
-
], FirestoreClient);
|
|
207
|
-
return FirestoreClient;
|
|
208
|
-
}());
|
|
209
|
-
exports.FirestoreClient = FirestoreClient;
|
|
210
|
-
(function (FirestoreClient) {
|
|
211
|
-
var Action;
|
|
212
|
-
(function (Action) {
|
|
213
|
-
Action[Action["Create"] = 'Create'] = "Create";
|
|
214
|
-
Action[Action["Update"] = 'Update'] = "Update";
|
|
215
|
-
Action[Action["Delete"] = 'Delete'] = "Delete";
|
|
216
|
-
})(Action = FirestoreClient.Action || (FirestoreClient.Action = {}));
|
|
217
|
-
})(FirestoreClient = exports.FirestoreClient || (exports.FirestoreClient = {}));
|
|
218
|
-
exports.FirestoreClient = FirestoreClient;
|
|
219
|
-
//# sourceMappingURL=firestore-client.js.map
|
|
@@ -1 +0,0 @@
|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;YACH,OAAO,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;SACzC;IACL,CAAC;;IAnGQ,eAAe;QAF3B,IAAA,gCAAmB,GAAE;QACrB,IAAA,uBAAU,GAAE;OACA,eAAe,CAoG3B;IAAD,sBAAC;CAAA,AApGD,IAoGC;AApGY,0CAAe;AAsG5B,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;AAnHY,0CAAe"}
|
package/dist/handler-helper.d.ts
DELETED
|
@@ -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
|
-
}
|
package/dist/handler-helper.js
DELETED
|
@@ -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":";;;;;;;;;;;;;;;;;;;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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"}
|
package/dist/injector.d.ts
DELETED
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
|
package/dist/injector.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"injector.js","sourceRoot":"","sources":["../src/injector.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAAoC;AAEp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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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"from-array.js","sourceRoot":"","sources":["../../src/interfaces/from-array.ts"],"names":[],"mappings":""}
|
package/dist/interfaces/index.js
DELETED
|
@@ -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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"newable.js","sourceRoot":"","sources":["../../src/interfaces/newable.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transactional-client.js","sourceRoot":"","sources":["../../src/interfaces/transactional-client.ts"],"names":[],"mappings":""}
|
package/dist/interfaces/type.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/interfaces/type.ts"],"names":[],"mappings":""}
|