@servicelabsco/slabs-access-manager 1.0.61 → 1.0.64
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/dist/access/controllers/bulk.upload.controller.js +0 -3
- package/dist/access/controllers/bulk.upload.controller.js.map +1 -1
- package/dist/access/controllers/bulk.upload.item.controller.js +0 -3
- package/dist/access/controllers/bulk.upload.item.controller.js.map +1 -1
- package/dist/access/controllers/dashboard.report.controller.js +1 -3
- package/dist/access/controllers/dashboard.report.controller.js.map +1 -1
- package/dist/access/es6.classes.d.ts +1 -1
- package/dist/accessUtility/access.utility.module.js +2 -20
- package/dist/accessUtility/access.utility.module.js.map +1 -1
- package/dist/accessUtility/es6.classes.d.ts +4 -8
- package/dist/accessUtility/es6.classes.js +3 -10
- package/dist/accessUtility/es6.classes.js.map +1 -1
- package/dist/accessUtility/index.d.ts +0 -3
- package/dist/accessUtility/index.js +0 -3
- package/dist/accessUtility/index.js.map +1 -1
- package/dist/accessUtility/services/bulk.upload.item.store.d.ts +15 -14
- package/dist/accessUtility/services/bulk.upload.item.store.js +119 -2
- package/dist/accessUtility/services/bulk.upload.item.store.js.map +1 -1
- package/dist/accessUtility/services/index.d.ts +0 -5
- package/dist/accessUtility/services/index.js +0 -5
- package/dist/accessUtility/services/index.js.map +1 -1
- package/dist/accessUtility/subscribers/index.d.ts +0 -1
- package/dist/accessUtility/subscribers/index.js +0 -1
- package/dist/accessUtility/subscribers/index.js.map +1 -1
- package/dist/accessWorkflow/enums/approval.step.type.enum.d.ts +2 -1
- package/dist/accessWorkflow/enums/approval.step.type.enum.js +1 -0
- package/dist/accessWorkflow/enums/approval.step.type.enum.js.map +1 -1
- package/dist/migrations/1786428719439-AddCreatorApprovalStepTypeDataSeederTable.d.ts +6 -0
- package/dist/migrations/1786428719439-AddCreatorApprovalStepTypeDataSeederTable.js +29 -0
- package/dist/migrations/1786428719439-AddCreatorApprovalStepTypeDataSeederTable.js.map +1 -0
- package/package.json +1 -1
- package/dist/accessUtility/commands/bulk.upload.items.migrate.command.d.ts +0 -6
- package/dist/accessUtility/commands/bulk.upload.items.migrate.command.js +0 -53
- package/dist/accessUtility/commands/bulk.upload.items.migrate.command.js.map +0 -1
- package/dist/accessUtility/commands/index.d.ts +0 -1
- package/dist/accessUtility/commands/index.js +0 -18
- package/dist/accessUtility/commands/index.js.map +0 -1
- package/dist/accessUtility/config/bulk.upload.item.storage.config.d.ts +0 -2
- package/dist/accessUtility/config/bulk.upload.item.storage.config.js +0 -11
- package/dist/accessUtility/config/bulk.upload.item.storage.config.js.map +0 -1
- package/dist/accessUtility/config/index.d.ts +0 -1
- package/dist/accessUtility/config/index.js +0 -18
- package/dist/accessUtility/config/index.js.map +0 -1
- package/dist/accessUtility/mentities/bulk.upload.item.mentity.d.ts +0 -13
- package/dist/accessUtility/mentities/bulk.upload.item.mentity.js +0 -61
- package/dist/accessUtility/mentities/bulk.upload.item.mentity.js.map +0 -1
- package/dist/accessUtility/mentities/index.d.ts +0 -1
- package/dist/accessUtility/mentities/index.js +0 -18
- package/dist/accessUtility/mentities/index.js.map +0 -1
- package/dist/accessUtility/services/bulk.upload.item.id.allocator.service.d.ts +0 -9
- package/dist/accessUtility/services/bulk.upload.item.id.allocator.service.js +0 -68
- package/dist/accessUtility/services/bulk.upload.item.id.allocator.service.js.map +0 -1
- package/dist/accessUtility/services/bulk.upload.item.lifecycle.service.d.ts +0 -9
- package/dist/accessUtility/services/bulk.upload.item.lifecycle.service.js +0 -43
- package/dist/accessUtility/services/bulk.upload.item.lifecycle.service.js.map +0 -1
- package/dist/accessUtility/services/bulk.upload.item.migration.service.d.ts +0 -15
- package/dist/accessUtility/services/bulk.upload.item.migration.service.js +0 -66
- package/dist/accessUtility/services/bulk.upload.item.migration.service.js.map +0 -1
- package/dist/accessUtility/services/bulk.upload.item.mongo.store.d.ts +0 -36
- package/dist/accessUtility/services/bulk.upload.item.mongo.store.js +0 -280
- package/dist/accessUtility/services/bulk.upload.item.mongo.store.js.map +0 -1
- package/dist/accessUtility/services/bulk.upload.item.postgres.store.d.ts +0 -31
- package/dist/accessUtility/services/bulk.upload.item.postgres.store.js +0 -178
- package/dist/accessUtility/services/bulk.upload.item.postgres.store.js.map +0 -1
- package/dist/accessUtility/subscribers/bulk.upload.item.mongo.subscriber.d.ts +0 -12
- package/dist/accessUtility/subscribers/bulk.upload.item.mongo.subscriber.js +0 -55
- package/dist/accessUtility/subscribers/bulk.upload.item.mongo.subscriber.js.map +0 -1
|
@@ -1,280 +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 __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.BulkUploadItemMongoStore = void 0;
|
|
16
|
-
const common_1 = require("@nestjs/common");
|
|
17
|
-
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
-
const typeorm_2 = require("typeorm");
|
|
19
|
-
const bulk_upload_item_storage_config_1 = require("../config/bulk.upload.item.storage.config");
|
|
20
|
-
const bulk_upload_item_mentity_1 = require("../mentities/bulk.upload.item.mentity");
|
|
21
|
-
const bulk_upload_item_id_allocator_service_1 = require("./bulk.upload.item.id.allocator.service");
|
|
22
|
-
const bulk_upload_item_lifecycle_service_1 = require("./bulk.upload.item.lifecycle.service");
|
|
23
|
-
const bulk_upload_item_store_1 = require("./bulk.upload.item.store");
|
|
24
|
-
let BulkUploadItemMongoStore = class BulkUploadItemMongoStore extends bulk_upload_item_store_1.BulkUploadItemStore {
|
|
25
|
-
constructor(mongoDataSource, idAllocator, lifecycle) {
|
|
26
|
-
super();
|
|
27
|
-
this.mongoDataSource = mongoDataSource;
|
|
28
|
-
this.idAllocator = idAllocator;
|
|
29
|
-
this.lifecycle = lifecycle;
|
|
30
|
-
}
|
|
31
|
-
isReady() {
|
|
32
|
-
return (0, bulk_upload_item_storage_config_1.isBulkUploadItemsMongoStorage)() && this.hasMongoRepository();
|
|
33
|
-
}
|
|
34
|
-
hasMongoRepository() {
|
|
35
|
-
return !!this.getRepository();
|
|
36
|
-
}
|
|
37
|
-
usesMongo() {
|
|
38
|
-
return this.isReady();
|
|
39
|
-
}
|
|
40
|
-
async insertMany(items) {
|
|
41
|
-
const repo = this.requireRepository();
|
|
42
|
-
const ids = await this.idAllocator.allocate(items.length);
|
|
43
|
-
const now = new Date();
|
|
44
|
-
const docs = items.map((item, index) => ({
|
|
45
|
-
record_id: ids[index],
|
|
46
|
-
bulk_upload_id: item.bulk_upload_id,
|
|
47
|
-
type_id: item.type_id,
|
|
48
|
-
sheet: item.sheet,
|
|
49
|
-
row_num: item.row_num,
|
|
50
|
-
data: item.data,
|
|
51
|
-
error: item.error ?? null,
|
|
52
|
-
errors_count: item.errors_count ?? 0,
|
|
53
|
-
processed_at: item.processed_at ?? null,
|
|
54
|
-
attributes: item.attributes ?? null,
|
|
55
|
-
created_at: now,
|
|
56
|
-
updated_at: now,
|
|
57
|
-
}));
|
|
58
|
-
await repo.insertMany(docs);
|
|
59
|
-
const records = docs.map((doc) => this.toRecord(doc));
|
|
60
|
-
await this.lifecycle.onInserted(records);
|
|
61
|
-
return records;
|
|
62
|
-
}
|
|
63
|
-
async upsertOne(item) {
|
|
64
|
-
const repo = this.requireRepository();
|
|
65
|
-
const existing = await repo.findOne({
|
|
66
|
-
where: {
|
|
67
|
-
bulk_upload_id: item.bulk_upload_id,
|
|
68
|
-
row_num: item.row_num,
|
|
69
|
-
sheet: item.sheet,
|
|
70
|
-
type_id: item.type_id,
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
if (existing) {
|
|
74
|
-
existing.data = item.data;
|
|
75
|
-
if (item.error !== undefined)
|
|
76
|
-
existing.error = item.error;
|
|
77
|
-
if (item.attributes !== undefined)
|
|
78
|
-
existing.attributes = item.attributes;
|
|
79
|
-
if (item.processed_at !== undefined)
|
|
80
|
-
existing.processed_at = item.processed_at;
|
|
81
|
-
this.applyErrorsCount(existing);
|
|
82
|
-
existing.updated_at = new Date();
|
|
83
|
-
await repo.save(existing);
|
|
84
|
-
return this.toRecord(existing);
|
|
85
|
-
}
|
|
86
|
-
const [recordId] = await this.idAllocator.allocate(1);
|
|
87
|
-
const now = new Date();
|
|
88
|
-
const doc = repo.create({
|
|
89
|
-
record_id: recordId,
|
|
90
|
-
bulk_upload_id: item.bulk_upload_id,
|
|
91
|
-
type_id: item.type_id,
|
|
92
|
-
sheet: item.sheet,
|
|
93
|
-
row_num: item.row_num,
|
|
94
|
-
data: item.data,
|
|
95
|
-
error: item.error ?? null,
|
|
96
|
-
errors_count: item.errors_count ?? 0,
|
|
97
|
-
processed_at: item.processed_at ?? null,
|
|
98
|
-
attributes: item.attributes ?? null,
|
|
99
|
-
created_at: now,
|
|
100
|
-
updated_at: now,
|
|
101
|
-
});
|
|
102
|
-
await repo.save(doc);
|
|
103
|
-
return this.toRecord(doc);
|
|
104
|
-
}
|
|
105
|
-
async findById(id) {
|
|
106
|
-
const repo = this.getRepository();
|
|
107
|
-
if (!repo)
|
|
108
|
-
return null;
|
|
109
|
-
const entity = await repo.findOne({ where: { record_id: id } });
|
|
110
|
-
return entity ? this.toRecord(entity) : null;
|
|
111
|
-
}
|
|
112
|
-
async findOne(filter, order) {
|
|
113
|
-
const repo = this.getRepository();
|
|
114
|
-
if (!repo)
|
|
115
|
-
return null;
|
|
116
|
-
const entity = await repo.findOne({ where: filter, order: order });
|
|
117
|
-
return entity ? this.toRecord(entity) : null;
|
|
118
|
-
}
|
|
119
|
-
async find(filter, options) {
|
|
120
|
-
const repo = this.getRepository();
|
|
121
|
-
if (!repo)
|
|
122
|
-
return [];
|
|
123
|
-
const entities = await repo.find({
|
|
124
|
-
where: { ...filter, deleted_at: (0, typeorm_2.IsNull)() },
|
|
125
|
-
order: options?.order,
|
|
126
|
-
select: options?.select,
|
|
127
|
-
});
|
|
128
|
-
return entities.map((entity) => this.toRecord(entity));
|
|
129
|
-
}
|
|
130
|
-
async count(filter) {
|
|
131
|
-
const repo = this.getRepository();
|
|
132
|
-
if (!repo)
|
|
133
|
-
return 0;
|
|
134
|
-
return repo.count({ where: { ...filter, deleted_at: (0, typeorm_2.IsNull)() } });
|
|
135
|
-
}
|
|
136
|
-
async deleteByBulkUploadId(bulkUploadId) {
|
|
137
|
-
const repo = this.requireRepository();
|
|
138
|
-
await repo.deleteMany({ bulk_upload_id: bulkUploadId });
|
|
139
|
-
}
|
|
140
|
-
async findWithErrors(bulkUploadId) {
|
|
141
|
-
const repo = this.getRepository();
|
|
142
|
-
if (!repo)
|
|
143
|
-
return [];
|
|
144
|
-
const entities = await repo.find({
|
|
145
|
-
where: { bulk_upload_id: bulkUploadId, error: (0, typeorm_2.Not)((0, typeorm_2.IsNull)()) },
|
|
146
|
-
select: ['row_num', 'data', 'error', 'errors_count'],
|
|
147
|
-
});
|
|
148
|
-
return entities.map((entity) => ({
|
|
149
|
-
row_num: entity.row_num,
|
|
150
|
-
data: entity.data,
|
|
151
|
-
error: entity.error,
|
|
152
|
-
errors_count: entity.errors_count,
|
|
153
|
-
}));
|
|
154
|
-
}
|
|
155
|
-
async search(filter, upload) {
|
|
156
|
-
const repo = this.requireRepository();
|
|
157
|
-
const page = filter.page || 1;
|
|
158
|
-
const limit = filter.limit || 25;
|
|
159
|
-
const skip = (page - 1) * limit;
|
|
160
|
-
const where = {
|
|
161
|
-
bulk_upload_id: upload.id,
|
|
162
|
-
deleted_at: (0, typeorm_2.IsNull)(),
|
|
163
|
-
};
|
|
164
|
-
if (filter.type_id)
|
|
165
|
-
where.type_id = filter.type_id;
|
|
166
|
-
if (filter.sheet)
|
|
167
|
-
where.sheet = filter.sheet;
|
|
168
|
-
if (filter.errors === true)
|
|
169
|
-
where.error = (0, typeorm_2.Not)((0, typeorm_2.IsNull)());
|
|
170
|
-
if (filter.errors === false)
|
|
171
|
-
where.error = (0, typeorm_2.IsNull)();
|
|
172
|
-
const [entities, total] = await repo.findAndCount({
|
|
173
|
-
where,
|
|
174
|
-
order: { row_num: 'ASC' },
|
|
175
|
-
skip,
|
|
176
|
-
take: limit,
|
|
177
|
-
});
|
|
178
|
-
return {
|
|
179
|
-
stats: { total, page, limit },
|
|
180
|
-
metrics: {},
|
|
181
|
-
records: entities.map((entity) => this.toRecord(entity)),
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
async listAllForMigration(bulkUploadId) {
|
|
185
|
-
const repo = this.requireRepository();
|
|
186
|
-
const where = bulkUploadId ? { bulk_upload_id: bulkUploadId } : {};
|
|
187
|
-
const entities = await repo.find({ where, order: { record_id: 'ASC' } });
|
|
188
|
-
return entities.map((entity) => this.toRecord(entity));
|
|
189
|
-
}
|
|
190
|
-
async upsertFromMigration(record) {
|
|
191
|
-
const repo = this.requireRepository();
|
|
192
|
-
const existing = await repo.findOne({ where: { record_id: record.id } });
|
|
193
|
-
const payload = {
|
|
194
|
-
record_id: record.id,
|
|
195
|
-
bulk_upload_id: record.bulk_upload_id,
|
|
196
|
-
type_id: record.type_id,
|
|
197
|
-
sheet: record.sheet,
|
|
198
|
-
row_num: record.row_num,
|
|
199
|
-
data: record.data,
|
|
200
|
-
error: record.error,
|
|
201
|
-
errors_count: record.errors_count,
|
|
202
|
-
processed_at: record.processed_at,
|
|
203
|
-
attributes: record.attributes,
|
|
204
|
-
created_at: record.created_at || new Date(),
|
|
205
|
-
updated_at: record.updated_at || new Date(),
|
|
206
|
-
deleted_at: record.deleted_at,
|
|
207
|
-
};
|
|
208
|
-
if (existing) {
|
|
209
|
-
Object.assign(existing, payload);
|
|
210
|
-
await repo.save(existing);
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
await repo.save(repo.create(payload));
|
|
214
|
-
}
|
|
215
|
-
async insertManyForMigration(records) {
|
|
216
|
-
if (!records.length)
|
|
217
|
-
return;
|
|
218
|
-
const repo = this.requireRepository();
|
|
219
|
-
const docs = records.map((record) => ({
|
|
220
|
-
record_id: record.id,
|
|
221
|
-
bulk_upload_id: record.bulk_upload_id,
|
|
222
|
-
type_id: record.type_id,
|
|
223
|
-
sheet: record.sheet,
|
|
224
|
-
row_num: record.row_num,
|
|
225
|
-
data: record.data,
|
|
226
|
-
error: record.error,
|
|
227
|
-
errors_count: record.errors_count,
|
|
228
|
-
processed_at: record.processed_at,
|
|
229
|
-
attributes: record.attributes,
|
|
230
|
-
created_at: record.created_at || new Date(),
|
|
231
|
-
updated_at: record.updated_at || new Date(),
|
|
232
|
-
deleted_at: record.deleted_at,
|
|
233
|
-
}));
|
|
234
|
-
await repo.insertMany(docs);
|
|
235
|
-
}
|
|
236
|
-
getRepository() {
|
|
237
|
-
if (!this.mongoDataSource)
|
|
238
|
-
return null;
|
|
239
|
-
return this.mongoDataSource.getMongoRepository(bulk_upload_item_mentity_1.BulkUploadItemMentity);
|
|
240
|
-
}
|
|
241
|
-
requireRepository() {
|
|
242
|
-
const repo = this.getRepository();
|
|
243
|
-
if (!repo) {
|
|
244
|
-
throw new Error('Mongo data source is not registered');
|
|
245
|
-
}
|
|
246
|
-
return repo;
|
|
247
|
-
}
|
|
248
|
-
applyErrorsCount(entity) {
|
|
249
|
-
if (entity.error) {
|
|
250
|
-
entity.errors_count = Object.keys(entity.error).length;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
toRecord(entity) {
|
|
254
|
-
return {
|
|
255
|
-
id: entity.record_id,
|
|
256
|
-
bulk_upload_id: entity.bulk_upload_id,
|
|
257
|
-
type_id: entity.type_id,
|
|
258
|
-
sheet: entity.sheet,
|
|
259
|
-
row_num: entity.row_num,
|
|
260
|
-
data: entity.data,
|
|
261
|
-
error: entity.error,
|
|
262
|
-
errors_count: entity.errors_count,
|
|
263
|
-
processed_at: entity.processed_at,
|
|
264
|
-
attributes: entity.attributes,
|
|
265
|
-
created_at: entity.created_at,
|
|
266
|
-
updated_at: entity.updated_at,
|
|
267
|
-
deleted_at: entity.deleted_at,
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
exports.BulkUploadItemMongoStore = BulkUploadItemMongoStore;
|
|
272
|
-
exports.BulkUploadItemMongoStore = BulkUploadItemMongoStore = __decorate([
|
|
273
|
-
(0, common_1.Injectable)(),
|
|
274
|
-
__param(0, (0, common_1.Optional)()),
|
|
275
|
-
__param(0, (0, typeorm_1.InjectDataSource)(bulk_upload_item_storage_config_1.BULK_UPLOAD_MONGO_CONNECTION)),
|
|
276
|
-
__metadata("design:paramtypes", [typeorm_2.DataSource,
|
|
277
|
-
bulk_upload_item_id_allocator_service_1.BulkUploadItemIdAllocatorService,
|
|
278
|
-
bulk_upload_item_lifecycle_service_1.BulkUploadItemLifecycleService])
|
|
279
|
-
], BulkUploadItemMongoStore);
|
|
280
|
-
//# sourceMappingURL=bulk.upload.item.mongo.store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bulk.upload.item.mongo.store.js","sourceRoot":"","sources":["../../../src/accessUtility/services/bulk.upload.item.mongo.store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAsD;AACtD,6CAAmD;AACnD,qCAAmE;AAGnE,+FAAwH;AAExH,oFAA8E;AAC9E,mGAA2F;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AAM,CAAC;QAC3D,CAAC;IACL,CAAC;IAEO,QAAQ,CAAC,MAA6B;QAC1C,OAAO;YACH,EAAE,EAAE,MAAM,CAAC,SAAS;YACpB,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,UAAU,EAAE,MAAM,CAAC,UAAU;SAChC,CAAC;IACN,CAAC;CACJ,CAAA;AArRY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,mBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,0BAAgB,EAAC,8DAA4B,CAAC,CAAA;qCACb,oBAAU;QACd,wEAAgC;QAClC,mEAA8B;GANrD,wBAAwB,CAqRpC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Repository } from 'typeorm';
|
|
2
|
-
import { BulkUploadItemListFilterDto } from '../../access/dtos/bulk.upload.item.list.filter.dto';
|
|
3
|
-
import { ListResponseDto } from '../../access/dtos/list.response.dto';
|
|
4
|
-
import { BulkUploadEntity } from '../entities/bulk.upload.entity';
|
|
5
|
-
import { BulkUploadItemEntity } from '../entities/bulk.upload.item.entity';
|
|
6
|
-
import { BulkUploadItemLifecycleService } from './bulk.upload.item.lifecycle.service';
|
|
7
|
-
import { BulkUploadItemStore } from './bulk.upload.item.store';
|
|
8
|
-
import { BulkUploadItemFindFilter, BulkUploadItemInput, BulkUploadItemRecord } from '../types/bulk.upload.item.record';
|
|
9
|
-
export declare class BulkUploadItemPostgresStore extends BulkUploadItemStore {
|
|
10
|
-
private readonly repository;
|
|
11
|
-
private readonly lifecycle;
|
|
12
|
-
constructor(repository: Repository<BulkUploadItemEntity>, lifecycle: BulkUploadItemLifecycleService);
|
|
13
|
-
usesMongo(): boolean;
|
|
14
|
-
insertMany(items: BulkUploadItemInput[]): Promise<BulkUploadItemRecord[]>;
|
|
15
|
-
upsertOne(item: BulkUploadItemInput): Promise<BulkUploadItemRecord>;
|
|
16
|
-
findById(id: number): Promise<BulkUploadItemRecord | null>;
|
|
17
|
-
findOne(filter: BulkUploadItemFindFilter, order?: Record<string, 'ASC' | 'DESC'>): Promise<BulkUploadItemRecord | null>;
|
|
18
|
-
find(filter: BulkUploadItemFindFilter, options?: {
|
|
19
|
-
order?: Record<string, 'ASC' | 'DESC'>;
|
|
20
|
-
select?: (keyof BulkUploadItemRecord)[];
|
|
21
|
-
}): Promise<BulkUploadItemRecord[]>;
|
|
22
|
-
count(filter: BulkUploadItemFindFilter): Promise<number>;
|
|
23
|
-
deleteByBulkUploadId(bulkUploadId: number): Promise<void>;
|
|
24
|
-
findWithErrors(bulkUploadId: number): Promise<Partial<BulkUploadItemRecord>[]>;
|
|
25
|
-
search(_filter: BulkUploadItemListFilterDto, _upload: BulkUploadEntity): Promise<ListResponseDto>;
|
|
26
|
-
listAllForMigration(bulkUploadId?: number): Promise<BulkUploadItemRecord[]>;
|
|
27
|
-
upsertFromMigration(record: BulkUploadItemRecord): Promise<void>;
|
|
28
|
-
insertManyForMigration(records: BulkUploadItemRecord[]): Promise<void>;
|
|
29
|
-
private applyErrorsCount;
|
|
30
|
-
private toRecord;
|
|
31
|
-
}
|
|
@@ -1,178 +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 __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.BulkUploadItemPostgresStore = void 0;
|
|
16
|
-
const common_1 = require("@nestjs/common");
|
|
17
|
-
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
-
const typeorm_2 = require("typeorm");
|
|
19
|
-
const bulk_upload_item_entity_1 = require("../entities/bulk.upload.item.entity");
|
|
20
|
-
const bulk_upload_item_lifecycle_service_1 = require("./bulk.upload.item.lifecycle.service");
|
|
21
|
-
const bulk_upload_item_store_1 = require("./bulk.upload.item.store");
|
|
22
|
-
let BulkUploadItemPostgresStore = class BulkUploadItemPostgresStore extends bulk_upload_item_store_1.BulkUploadItemStore {
|
|
23
|
-
constructor(repository, lifecycle) {
|
|
24
|
-
super();
|
|
25
|
-
this.repository = repository;
|
|
26
|
-
this.lifecycle = lifecycle;
|
|
27
|
-
}
|
|
28
|
-
usesMongo() {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
async insertMany(items) {
|
|
32
|
-
if (!items.length)
|
|
33
|
-
return [];
|
|
34
|
-
const rows = items.map((item) => ({
|
|
35
|
-
bulk_upload_id: item.bulk_upload_id,
|
|
36
|
-
type_id: item.type_id,
|
|
37
|
-
sheet: item.sheet,
|
|
38
|
-
row_num: item.row_num,
|
|
39
|
-
data: item.data,
|
|
40
|
-
error: item.error ?? null,
|
|
41
|
-
errors_count: item.errors_count ?? 0,
|
|
42
|
-
processed_at: item.processed_at ?? null,
|
|
43
|
-
attributes: item.attributes ?? null,
|
|
44
|
-
}));
|
|
45
|
-
const result = await this.repository.insert(rows);
|
|
46
|
-
const ids = result.identifiers.map((identifier) => identifier.id);
|
|
47
|
-
const saved = await this.repository.find({ where: { id: (0, typeorm_2.In)(ids) }, order: { id: 'ASC' } });
|
|
48
|
-
const records = saved.map((entity) => this.toRecord(entity));
|
|
49
|
-
await this.lifecycle.onInserted(records);
|
|
50
|
-
return records;
|
|
51
|
-
}
|
|
52
|
-
async upsertOne(item) {
|
|
53
|
-
const entity = await bulk_upload_item_entity_1.BulkUploadItemEntity.firstOrNew({
|
|
54
|
-
bulk_upload_id: item.bulk_upload_id,
|
|
55
|
-
row_num: item.row_num,
|
|
56
|
-
sheet: item.sheet,
|
|
57
|
-
type_id: item.type_id,
|
|
58
|
-
});
|
|
59
|
-
entity.data = item.data;
|
|
60
|
-
if (item.error !== undefined)
|
|
61
|
-
entity.error = item.error;
|
|
62
|
-
if (item.attributes !== undefined)
|
|
63
|
-
entity.attributes = item.attributes;
|
|
64
|
-
if (item.processed_at !== undefined)
|
|
65
|
-
entity.processed_at = item.processed_at;
|
|
66
|
-
this.applyErrorsCount(entity);
|
|
67
|
-
const saved = await entity.save();
|
|
68
|
-
return this.toRecord(saved);
|
|
69
|
-
}
|
|
70
|
-
async findById(id) {
|
|
71
|
-
const entity = await this.repository.findOne({ where: { id } });
|
|
72
|
-
return entity ? this.toRecord(entity) : null;
|
|
73
|
-
}
|
|
74
|
-
async findOne(filter, order) {
|
|
75
|
-
const entity = await this.repository.findOne({ where: filter, order: order });
|
|
76
|
-
return entity ? this.toRecord(entity) : null;
|
|
77
|
-
}
|
|
78
|
-
async find(filter, options) {
|
|
79
|
-
const entities = await this.repository.find({
|
|
80
|
-
where: filter,
|
|
81
|
-
order: options?.order,
|
|
82
|
-
select: options?.select,
|
|
83
|
-
});
|
|
84
|
-
return entities.map((entity) => this.toRecord(entity));
|
|
85
|
-
}
|
|
86
|
-
async count(filter) {
|
|
87
|
-
return this.repository.count({ where: filter });
|
|
88
|
-
}
|
|
89
|
-
async deleteByBulkUploadId(bulkUploadId) {
|
|
90
|
-
await this.repository.delete({ bulk_upload_id: bulkUploadId });
|
|
91
|
-
}
|
|
92
|
-
async findWithErrors(bulkUploadId) {
|
|
93
|
-
const entities = await this.repository.find({
|
|
94
|
-
where: { bulk_upload_id: bulkUploadId, error: (0, typeorm_2.Not)((0, typeorm_2.IsNull)()) },
|
|
95
|
-
select: ['row_num', 'data', 'error', 'errors_count'],
|
|
96
|
-
});
|
|
97
|
-
return entities.map((entity) => ({
|
|
98
|
-
row_num: entity.row_num,
|
|
99
|
-
data: entity.data,
|
|
100
|
-
error: entity.error,
|
|
101
|
-
errors_count: entity.errors_count,
|
|
102
|
-
}));
|
|
103
|
-
}
|
|
104
|
-
async search(_filter, _upload) {
|
|
105
|
-
throw new Error('Postgres bulk upload item search uses ProcessBulkUploadItemList');
|
|
106
|
-
}
|
|
107
|
-
async listAllForMigration(bulkUploadId) {
|
|
108
|
-
const where = bulkUploadId ? { bulk_upload_id: bulkUploadId } : {};
|
|
109
|
-
const entities = await this.repository.find({ where, order: { id: 'ASC' } });
|
|
110
|
-
return entities.map((entity) => this.toRecord(entity));
|
|
111
|
-
}
|
|
112
|
-
async upsertFromMigration(record) {
|
|
113
|
-
await this.repository.save({
|
|
114
|
-
id: record.id,
|
|
115
|
-
bulk_upload_id: record.bulk_upload_id,
|
|
116
|
-
type_id: record.type_id,
|
|
117
|
-
sheet: record.sheet,
|
|
118
|
-
row_num: record.row_num,
|
|
119
|
-
data: record.data,
|
|
120
|
-
error: record.error,
|
|
121
|
-
errors_count: record.errors_count,
|
|
122
|
-
processed_at: record.processed_at,
|
|
123
|
-
attributes: record.attributes,
|
|
124
|
-
created_at: record.created_at,
|
|
125
|
-
updated_at: record.updated_at,
|
|
126
|
-
deleted_at: record.deleted_at,
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
async insertManyForMigration(records) {
|
|
130
|
-
if (!records.length)
|
|
131
|
-
return;
|
|
132
|
-
await this.repository.insert(records.map((record) => ({
|
|
133
|
-
id: record.id,
|
|
134
|
-
bulk_upload_id: record.bulk_upload_id,
|
|
135
|
-
type_id: record.type_id,
|
|
136
|
-
sheet: record.sheet,
|
|
137
|
-
row_num: record.row_num,
|
|
138
|
-
data: record.data,
|
|
139
|
-
error: record.error,
|
|
140
|
-
errors_count: record.errors_count,
|
|
141
|
-
processed_at: record.processed_at,
|
|
142
|
-
attributes: record.attributes,
|
|
143
|
-
created_at: record.created_at,
|
|
144
|
-
updated_at: record.updated_at,
|
|
145
|
-
deleted_at: record.deleted_at,
|
|
146
|
-
})));
|
|
147
|
-
}
|
|
148
|
-
applyErrorsCount(entity) {
|
|
149
|
-
if (entity.error) {
|
|
150
|
-
entity.errors_count = Object.keys(entity.error).length;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
toRecord(entity) {
|
|
154
|
-
return {
|
|
155
|
-
id: entity.id,
|
|
156
|
-
bulk_upload_id: entity.bulk_upload_id,
|
|
157
|
-
type_id: entity.type_id,
|
|
158
|
-
sheet: entity.sheet,
|
|
159
|
-
row_num: entity.row_num,
|
|
160
|
-
data: entity.data,
|
|
161
|
-
error: entity.error,
|
|
162
|
-
errors_count: entity.errors_count,
|
|
163
|
-
processed_at: entity.processed_at,
|
|
164
|
-
attributes: entity.attributes,
|
|
165
|
-
created_at: entity.created_at,
|
|
166
|
-
updated_at: entity.updated_at,
|
|
167
|
-
deleted_at: entity.deleted_at,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
exports.BulkUploadItemPostgresStore = BulkUploadItemPostgresStore;
|
|
172
|
-
exports.BulkUploadItemPostgresStore = BulkUploadItemPostgresStore = __decorate([
|
|
173
|
-
(0, common_1.Injectable)(),
|
|
174
|
-
__param(0, (0, typeorm_1.InjectRepository)(bulk_upload_item_entity_1.BulkUploadItemEntity)),
|
|
175
|
-
__metadata("design:paramtypes", [typeorm_2.Repository,
|
|
176
|
-
bulk_upload_item_lifecycle_service_1.BulkUploadItemLifecycleService])
|
|
177
|
-
], BulkUploadItemPostgresStore);
|
|
178
|
-
//# sourceMappingURL=bulk.upload.item.postgres.store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bulk.upload.item.postgres.store.js","sourceRoot":"","sources":["../../../src/accessUtility/services/bulk.upload.item.postgres.store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,qCAAsD;AAItD,iFAA2E;AAC3E,6FAAsF;AACtF,qEAA+D;AAQxD,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,4CAAmB;IAChE,YAEqB,UAA4C,EAC5C,SAAyC;QAE1D,KAAK,EAAE,CAAC;QAHS,eAAU,GAAV,UAAU,CAAkC;QAC5C,cAAS,GAAT,SAAS,CAAgC;IAG9D,CAAC;IAED,SAAS;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,KAA4B;QACzC,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,OAAO,EAAE,CAAC;QAE7B,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC9B,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI;YACzB,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,CAAC;Y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 'typeorm';
|
|
3
|
-
import { BulkUploadItemMentity } from '../mentities/bulk.upload.item.mentity';
|
|
4
|
-
import { BulkUploadItemJob } from '../jobs/bulk.upload.item.job';
|
|
5
|
-
export declare class BulkUploadItemMongoSubscriber extends CommonSubscriber<BulkUploadItemMentity> {
|
|
6
|
-
private readonly bulkUploadItemJob;
|
|
7
|
-
constructor(dataSource: DataSource | undefined, bulkUploadItemJob: BulkUploadItemJob);
|
|
8
|
-
listenTo(): typeof BulkUploadItemMentity;
|
|
9
|
-
afterInsert(evt: InsertEvent<BulkUploadItemMentity>): Promise<void>;
|
|
10
|
-
beforeUpdate(evt: UpdateEvent<BulkUploadItemMentity>): Promise<void>;
|
|
11
|
-
afterUpdate(evt: UpdateEvent<BulkUploadItemMentity>): Promise<void>;
|
|
12
|
-
}
|
|
@@ -1,55 +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 __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.BulkUploadItemMongoSubscriber = void 0;
|
|
16
|
-
const nestjs_utility_services_1 = require("@servicelabsco/nestjs-utility-services");
|
|
17
|
-
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
-
const common_1 = require("@nestjs/common");
|
|
19
|
-
const typeorm_2 = require("typeorm");
|
|
20
|
-
const bulk_upload_item_storage_config_1 = require("../config/bulk.upload.item.storage.config");
|
|
21
|
-
const bulk_upload_item_mentity_1 = require("../mentities/bulk.upload.item.mentity");
|
|
22
|
-
const bulk_upload_item_job_1 = require("../jobs/bulk.upload.item.job");
|
|
23
|
-
let BulkUploadItemMongoSubscriber = class BulkUploadItemMongoSubscriber extends nestjs_utility_services_1.CommonSubscriber {
|
|
24
|
-
constructor(dataSource, bulkUploadItemJob) {
|
|
25
|
-
super();
|
|
26
|
-
this.bulkUploadItemJob = bulkUploadItemJob;
|
|
27
|
-
if (dataSource) {
|
|
28
|
-
dataSource.subscribers.push(this);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
listenTo() {
|
|
32
|
-
return bulk_upload_item_mentity_1.BulkUploadItemMentity;
|
|
33
|
-
}
|
|
34
|
-
async afterInsert(evt) {
|
|
35
|
-
await this.bulkUploadItemJob.delayedDispatch(this.getEventData(evt));
|
|
36
|
-
}
|
|
37
|
-
async beforeUpdate(evt) {
|
|
38
|
-
if (evt.entity.error) {
|
|
39
|
-
const keys = Object.keys(evt.entity.error);
|
|
40
|
-
evt.entity.errors_count = keys.length;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
async afterUpdate(evt) {
|
|
44
|
-
await this.bulkUploadItemJob.delayedDispatch(this.getEventData(evt));
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
exports.BulkUploadItemMongoSubscriber = BulkUploadItemMongoSubscriber;
|
|
48
|
-
exports.BulkUploadItemMongoSubscriber = BulkUploadItemMongoSubscriber = __decorate([
|
|
49
|
-
(0, typeorm_2.EventSubscriber)(),
|
|
50
|
-
__param(0, (0, common_1.Optional)()),
|
|
51
|
-
__param(0, (0, typeorm_1.InjectDataSource)(bulk_upload_item_storage_config_1.BULK_UPLOAD_MONGO_CONNECTION)),
|
|
52
|
-
__metadata("design:paramtypes", [typeorm_2.DataSource,
|
|
53
|
-
bulk_upload_item_job_1.BulkUploadItemJob])
|
|
54
|
-
], BulkUploadItemMongoSubscriber);
|
|
55
|
-
//# sourceMappingURL=bulk.upload.item.mongo.subscriber.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bulk.upload.item.mongo.subscriber.js","sourceRoot":"","sources":["../../../src/accessUtility/subscribers/bulk.upload.item.mongo.subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oFAA0E;AAC1E,6CAAmD;AACnD,2CAA0C;AAC1C,qCAAgF;AAChF,+FAAyF;AACzF,oFAA8E;AAC9E,uEAAiE;AAG1D,IAAM,6BAA6B,GAAnC,MAAM,6BAA8B,SAAQ,0CAAuC;IACtF,YAGI,UAAkC,EACjB,iBAAoC;QAErD,KAAK,EAAE,CAAC;QAFS,sBAAiB,GAAjB,iBAAiB,CAAmB;QAGrD,IAAI,UAAU,EAAE,CAAC;YACb,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC;IACL,CAAC;IAED,QAAQ;QACJ,OAAO,gDAAqB,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,GAAuC;QACrD,MAAM,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAuC;QACtD,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACnB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC3C,GAAG,CAAC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1C,CAAC;I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