@punks/backend-entity-manager 0.0.349 → 0.0.351
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/cjs/index.js +322 -170
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/actions.d.ts +5 -0
- package/dist/cjs/types/abstractions/commands.d.ts +4 -0
- package/dist/cjs/types/abstractions/import.d.ts +8 -0
- package/dist/cjs/types/abstractions/index.d.ts +4 -3
- package/dist/cjs/types/abstractions/manager.d.ts +2 -1
- package/dist/cjs/types/abstractions/parse.d.ts +24 -0
- package/dist/cjs/types/abstractions/serializer.d.ts +20 -3
- package/dist/cjs/types/actions/parse.d.ts +9 -0
- package/dist/cjs/types/base/serializer.d.ts +7 -1
- package/dist/cjs/types/commands/parse.d.ts +14 -0
- package/dist/cjs/types/concrete/index.d.ts +4 -2
- package/dist/cjs/types/platforms/nest/__test__/server/app/foos/foo.controller.d.ts +4 -2
- package/dist/cjs/types/platforms/nest/__test__/server/app/foos/foo.dto.d.ts +7 -0
- package/dist/cjs/types/platforms/nest/index.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/models/index.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/models/parsing.d.ts +12 -0
- package/dist/cjs/types/providers/{services.d.ts → services/entities-locator.d.ts} +33 -72
- package/dist/cjs/types/providers/services/entity-locator.d.ts +73 -0
- package/dist/cjs/types/providers/services/index.d.ts +2 -0
- package/dist/cjs/types/symbols/ioc.d.ts +2 -0
- package/dist/esm/index.js +321 -171
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/actions.d.ts +5 -0
- package/dist/esm/types/abstractions/commands.d.ts +4 -0
- package/dist/esm/types/abstractions/import.d.ts +8 -0
- package/dist/esm/types/abstractions/index.d.ts +4 -3
- package/dist/esm/types/abstractions/manager.d.ts +2 -1
- package/dist/esm/types/abstractions/parse.d.ts +24 -0
- package/dist/esm/types/abstractions/serializer.d.ts +20 -3
- package/dist/esm/types/actions/parse.d.ts +9 -0
- package/dist/esm/types/base/serializer.d.ts +7 -1
- package/dist/esm/types/commands/parse.d.ts +14 -0
- package/dist/esm/types/concrete/index.d.ts +4 -2
- package/dist/esm/types/platforms/nest/__test__/server/app/foos/foo.controller.d.ts +4 -2
- package/dist/esm/types/platforms/nest/__test__/server/app/foos/foo.dto.d.ts +7 -0
- package/dist/esm/types/platforms/nest/index.d.ts +1 -0
- package/dist/esm/types/platforms/nest/models/index.d.ts +1 -0
- package/dist/esm/types/platforms/nest/models/parsing.d.ts +12 -0
- package/dist/esm/types/providers/{services.d.ts → services/entities-locator.d.ts} +33 -72
- package/dist/esm/types/providers/services/entity-locator.d.ts +73 -0
- package/dist/esm/types/providers/services/index.d.ts +2 -0
- package/dist/esm/types/symbols/ioc.d.ts +2 -0
- package/dist/index.d.ts +568 -486
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -19,6 +19,7 @@ var schedule = require('@nestjs/schedule');
|
|
|
19
19
|
var require$$0 = require('child_process');
|
|
20
20
|
var cqrs = require('@nestjs/cqrs');
|
|
21
21
|
var require$$1 = require('fs');
|
|
22
|
+
var swagger = require('@nestjs/swagger');
|
|
22
23
|
var clientS3 = require('@aws-sdk/client-s3');
|
|
23
24
|
var s3RequestPresigner = require('@aws-sdk/s3-request-presigner');
|
|
24
25
|
var clientSes = require('@aws-sdk/client-ses');
|
|
@@ -193,8 +194,9 @@ class EntitySeeder {
|
|
|
193
194
|
|
|
194
195
|
const DEFAULT_DELIMITER = ";";
|
|
195
196
|
class EntitySerializer {
|
|
196
|
-
constructor(services) {
|
|
197
|
+
constructor(services, options) {
|
|
197
198
|
this.services = services;
|
|
199
|
+
this.options = options;
|
|
198
200
|
this.entityName = services.getEntityName();
|
|
199
201
|
this.logger = backendCore.Log.getLogger(`${services.getEntityName()} -> Serializer`);
|
|
200
202
|
}
|
|
@@ -225,13 +227,13 @@ class EntitySerializer {
|
|
|
225
227
|
}
|
|
226
228
|
parseCsv(data, definition) {
|
|
227
229
|
const records = backendCore.csvParse(data, DEFAULT_DELIMITER);
|
|
228
|
-
return records.map((x) => this.convertSheetRecord(x, definition));
|
|
230
|
+
return records.map((x, i) => this.convertSheetRecord(x, definition, i));
|
|
229
231
|
}
|
|
230
232
|
parseXlsx(data, definition) {
|
|
231
233
|
const records = backendCore.excelParse(data);
|
|
232
|
-
return records.map((x) => this.convertSheetRecord(x, definition));
|
|
234
|
+
return records.map((x, i) => this.convertSheetRecord(x, definition, i));
|
|
233
235
|
}
|
|
234
|
-
convertSheetRecord(record, definition) {
|
|
236
|
+
convertSheetRecord(record, definition, rowIndex) {
|
|
235
237
|
if (!record._type || record._type !== this.entityName) {
|
|
236
238
|
throw new Error(`Invalid record type ${record._type} -> record: \n${JSON.stringify(record)}`);
|
|
237
239
|
}
|
|
@@ -244,10 +246,26 @@ class EntitySerializer {
|
|
|
244
246
|
entity[column.selector] = this.parseColumnValue(record, column);
|
|
245
247
|
}
|
|
246
248
|
}
|
|
249
|
+
const validationErrors = [];
|
|
250
|
+
for (const column of definition.columns) {
|
|
251
|
+
for (const validator of column.validators ?? []) {
|
|
252
|
+
const result = validator.fn((item) => item[column.selector]);
|
|
253
|
+
if (!result.isValid) {
|
|
254
|
+
validationErrors.push({
|
|
255
|
+
errorCode: validator.key,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
247
260
|
const idField = definition.columns.find((x) => x.idColumn || x.selector === "id");
|
|
248
261
|
return {
|
|
249
262
|
id: idField ? entity[idField.selector] : undefined,
|
|
250
263
|
item: entity,
|
|
264
|
+
rowIndex,
|
|
265
|
+
status: {
|
|
266
|
+
isValid: validationErrors.length === 0,
|
|
267
|
+
validationErrors,
|
|
268
|
+
},
|
|
251
269
|
};
|
|
252
270
|
}
|
|
253
271
|
parseColumnValue(row, definition) {
|
|
@@ -270,10 +288,14 @@ class EntitySerializer {
|
|
|
270
288
|
fileName,
|
|
271
289
|
contentType: "text/csv",
|
|
272
290
|
content: Buffer.from(backendCore.csvBuild([{}], [
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
291
|
+
...(this.options?.useTypeColumn
|
|
292
|
+
? [
|
|
293
|
+
{
|
|
294
|
+
name: "_type",
|
|
295
|
+
value: () => this.entityName,
|
|
296
|
+
},
|
|
297
|
+
]
|
|
298
|
+
: []),
|
|
277
299
|
...definition.columns.map((c) => ({
|
|
278
300
|
name: c.name,
|
|
279
301
|
value: () => c.sampleValue ?? "",
|
|
@@ -290,10 +312,14 @@ class EntitySerializer {
|
|
|
290
312
|
data: [{}],
|
|
291
313
|
sheetName: this.entityName,
|
|
292
314
|
columns: [
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
315
|
+
...(this.options?.useTypeColumn
|
|
316
|
+
? [
|
|
317
|
+
{
|
|
318
|
+
header: "_type",
|
|
319
|
+
value: () => this.entityName,
|
|
320
|
+
},
|
|
321
|
+
]
|
|
322
|
+
: []),
|
|
297
323
|
...definition.columns.map((c) => ({
|
|
298
324
|
header: c.name,
|
|
299
325
|
value: () => c.sampleValue ?? "",
|
|
@@ -309,6 +335,7 @@ class EntitySerializer {
|
|
|
309
335
|
async serialize(data, format) {
|
|
310
336
|
return await this.buildExportFile(data, format);
|
|
311
337
|
}
|
|
338
|
+
validateSheetItem(item, allItems, context) { }
|
|
312
339
|
async getContext() {
|
|
313
340
|
return (await this.services
|
|
314
341
|
.resolveAuthenticationContextProvider()
|
|
@@ -499,6 +526,19 @@ class EntitiesImportAction {
|
|
|
499
526
|
}
|
|
500
527
|
}
|
|
501
528
|
|
|
529
|
+
class EntitiesParseAction {
|
|
530
|
+
constructor(services) {
|
|
531
|
+
this.services = services;
|
|
532
|
+
this.logger = backendCore.Log.getLogger(`${services.getEntityName()} -> Import`);
|
|
533
|
+
}
|
|
534
|
+
async execute(input) {
|
|
535
|
+
this.logger.debug("Parse action started", { input });
|
|
536
|
+
const result = await this.services.resolveParseCommand().execute(input);
|
|
537
|
+
this.logger.debug("Parse action completed", { input });
|
|
538
|
+
return result;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
502
542
|
class EntitiesSampleDownloadAction {
|
|
503
543
|
constructor(services) {
|
|
504
544
|
this.services = services;
|
|
@@ -813,6 +853,12 @@ class EntitiesExportCommand {
|
|
|
813
853
|
}
|
|
814
854
|
}
|
|
815
855
|
|
|
856
|
+
var InvalidEntityHandling;
|
|
857
|
+
(function (InvalidEntityHandling) {
|
|
858
|
+
InvalidEntityHandling["Skip"] = "skip";
|
|
859
|
+
InvalidEntityHandling["Fail"] = "fail";
|
|
860
|
+
})(InvalidEntityHandling || (InvalidEntityHandling = {}));
|
|
861
|
+
|
|
816
862
|
class EntitiesImportCommand {
|
|
817
863
|
constructor(services, settings) {
|
|
818
864
|
this.services = services;
|
|
@@ -825,10 +871,19 @@ class EntitiesImportCommand {
|
|
|
825
871
|
fileName: input.file.fileName,
|
|
826
872
|
});
|
|
827
873
|
const importEntities = await this.parseImportFile(input.file.content, input.format);
|
|
828
|
-
|
|
874
|
+
const validEntities = importEntities.filter((x) => x.status.isValid);
|
|
875
|
+
const invalidEntities = importEntities.filter((x) => !x.status.isValid);
|
|
876
|
+
if (invalidEntities.length > 0 &&
|
|
877
|
+
input.options?.invalidEntitiesHandling !== InvalidEntityHandling.Skip) {
|
|
878
|
+
throw new Error(`Cannot import file due to invalid entities: ${invalidEntities
|
|
879
|
+
.map((x) => x.id)
|
|
880
|
+
.join(", ")}`);
|
|
881
|
+
}
|
|
882
|
+
await this.services.resolveSerializer().import(validEntities.map((x) => x.item), input.payload);
|
|
829
883
|
return {
|
|
830
884
|
statistics: {
|
|
831
|
-
importedCount:
|
|
885
|
+
importedCount: validEntities.length,
|
|
886
|
+
skippedCount: invalidEntities.length,
|
|
832
887
|
createdCount: 0,
|
|
833
888
|
unchangedCount: 0,
|
|
834
889
|
updatedCount: 0,
|
|
@@ -854,6 +909,41 @@ class EntitiesImportCommand {
|
|
|
854
909
|
}
|
|
855
910
|
}
|
|
856
911
|
|
|
912
|
+
class EntitiesParseCommand {
|
|
913
|
+
constructor(services, settings) {
|
|
914
|
+
this.services = services;
|
|
915
|
+
this.settings = settings;
|
|
916
|
+
}
|
|
917
|
+
async execute(input) {
|
|
918
|
+
await this.uploadImportFile({
|
|
919
|
+
content: input.file.content,
|
|
920
|
+
contentType: input.file.contentType,
|
|
921
|
+
fileName: input.file.fileName,
|
|
922
|
+
});
|
|
923
|
+
const entries = await this.parseImportFile(input.file.content, input.format);
|
|
924
|
+
return {
|
|
925
|
+
entries,
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
async parseImportFile(content, format) {
|
|
929
|
+
return await this.services.resolveSerializer().parse(content, format);
|
|
930
|
+
}
|
|
931
|
+
async uploadImportFile(file) {
|
|
932
|
+
await this.bucket.fileUpload({
|
|
933
|
+
bucket: this.settings.exportBucket.bucket,
|
|
934
|
+
filePath: this.buildAbsoluteBucketPath(file.fileName),
|
|
935
|
+
content: file.content,
|
|
936
|
+
contentType: file.contentType,
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
buildAbsoluteBucketPath(relativePath) {
|
|
940
|
+
return `${this.settings.exportBucket.rootFolderPath ?? ""}/parsers/${createDayPath$1(new Date())}/${relativePath}`;
|
|
941
|
+
}
|
|
942
|
+
get bucket() {
|
|
943
|
+
return this.services.getRootServices().resolveDefaultBucketProvider();
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
|
|
857
947
|
class EntitiesSampleDownloadCommand {
|
|
858
948
|
constructor(services, settings) {
|
|
859
949
|
this.services = services;
|
|
@@ -1130,6 +1220,9 @@ class EntityManager {
|
|
|
1130
1220
|
get import() {
|
|
1131
1221
|
return this.services.resolveImportCommand();
|
|
1132
1222
|
}
|
|
1223
|
+
get parse() {
|
|
1224
|
+
return this.services.resolveParseCommand();
|
|
1225
|
+
}
|
|
1133
1226
|
get sampleDownload() {
|
|
1134
1227
|
return this.services.resolveSampleDownloadCommand();
|
|
1135
1228
|
}
|
|
@@ -1174,6 +1267,9 @@ class EntityActions {
|
|
|
1174
1267
|
get import() {
|
|
1175
1268
|
return this.services.resolveImportAction();
|
|
1176
1269
|
}
|
|
1270
|
+
get parse() {
|
|
1271
|
+
return this.services.resolveParseAction();
|
|
1272
|
+
}
|
|
1177
1273
|
get sampleDownload() {
|
|
1178
1274
|
return this.services.resolveSampleDownloadAction();
|
|
1179
1275
|
}
|
|
@@ -1262,6 +1358,7 @@ const EntityServices = {
|
|
|
1262
1358
|
IEntityDeleteAction: "IEntityDeleteAction",
|
|
1263
1359
|
IEntityMergeAction: "IEntityMergeAction",
|
|
1264
1360
|
IEntitiesExportAction: "IEntitiesExportAction",
|
|
1361
|
+
IEntitiesParseAction: "IEntitiesParseAction",
|
|
1265
1362
|
IEntitiesImportAction: "IEntitiesImportAction",
|
|
1266
1363
|
IEntitiesSampleDownloadAction: "IEntitiesSampleDownloadAction",
|
|
1267
1364
|
IEntityVersionsSearchAction: "IEntityVersionsSearchAction",
|
|
@@ -1280,6 +1377,7 @@ const EntityServices = {
|
|
|
1280
1377
|
IEntitiesDeleteCommand: "IEntitiesDeleteCommand",
|
|
1281
1378
|
IEntitiesExportCommand: "IEntitiesExportCommand",
|
|
1282
1379
|
IEntitiesImportCommand: "IEntitiesImportCommand",
|
|
1380
|
+
IEntitiesParseCommand: "IEntitiesParseCommand",
|
|
1283
1381
|
IEntitiesSampleDownloadCommand: "IEntitiesSampleDownloadCommand",
|
|
1284
1382
|
},
|
|
1285
1383
|
Converters: {
|
|
@@ -1360,162 +1458,6 @@ const GlobalServices = {
|
|
|
1360
1458
|
},
|
|
1361
1459
|
};
|
|
1362
1460
|
|
|
1363
|
-
class EntityServiceLocator {
|
|
1364
|
-
constructor(services, entityName) {
|
|
1365
|
-
this.services = services;
|
|
1366
|
-
this.entityName = entityName;
|
|
1367
|
-
}
|
|
1368
|
-
getRootServices() {
|
|
1369
|
-
return this.services;
|
|
1370
|
-
}
|
|
1371
|
-
resolveAuthenticationContextProvider() {
|
|
1372
|
-
return this.services.resolveAuthenticationContextProvider();
|
|
1373
|
-
}
|
|
1374
|
-
resolveEntityManager() {
|
|
1375
|
-
return this.services.resolveEntityManager(this.entityName);
|
|
1376
|
-
}
|
|
1377
|
-
resolveEntityActions() {
|
|
1378
|
-
return this.services.resolveEntityActions(this.entityName);
|
|
1379
|
-
}
|
|
1380
|
-
resolveRepository() {
|
|
1381
|
-
return this.services.resolveRepository(this.entityName);
|
|
1382
|
-
}
|
|
1383
|
-
resolveEventsManager() {
|
|
1384
|
-
return this.services.resolveEventsManager(this.entityName);
|
|
1385
|
-
}
|
|
1386
|
-
resolveVersioningProvider() {
|
|
1387
|
-
return this.services.resolveEntityVersioningProvider();
|
|
1388
|
-
}
|
|
1389
|
-
resolveEntityConfiguration() {
|
|
1390
|
-
return this.services.resolveEntityConfiguration(this.entityName);
|
|
1391
|
-
}
|
|
1392
|
-
resolveReplicaSyncManager() {
|
|
1393
|
-
return this.services.resolveReplicaSyncManager(this.entityName);
|
|
1394
|
-
}
|
|
1395
|
-
resolveReplicaConfiguration() {
|
|
1396
|
-
return this.services.resolveReplicaConfiguration(this.entityName);
|
|
1397
|
-
}
|
|
1398
|
-
resolveReplicaDeleteManager() {
|
|
1399
|
-
return this.services.resolveReplicaDeleteManager(this.entityName);
|
|
1400
|
-
}
|
|
1401
|
-
resolveConnectorSyncManager() {
|
|
1402
|
-
return this.services.resolveConnectorSyncManager(this.entityName);
|
|
1403
|
-
}
|
|
1404
|
-
resolveConnectorDeleteManager() {
|
|
1405
|
-
return this.services.resolveConnectorDeleteManager(this.entityName);
|
|
1406
|
-
}
|
|
1407
|
-
resolveConnectorsConfiguration() {
|
|
1408
|
-
return this.services.resolveConnectorsConfiguration(this.entityName);
|
|
1409
|
-
}
|
|
1410
|
-
resolveConverter() {
|
|
1411
|
-
return this.services.resolveConverter(this.entityName);
|
|
1412
|
-
}
|
|
1413
|
-
resolveSerializer() {
|
|
1414
|
-
return this.services.resolveSerializer(this.entityName);
|
|
1415
|
-
}
|
|
1416
|
-
resolveSnapshotService() {
|
|
1417
|
-
return this.services.resolveSnapshotService(this.entityName);
|
|
1418
|
-
}
|
|
1419
|
-
resolveAdapter() {
|
|
1420
|
-
return this.services.resolveAdapter(this.entityName);
|
|
1421
|
-
}
|
|
1422
|
-
resolveAuthorizationMiddleware() {
|
|
1423
|
-
return this.services.resolveAuthorizationMiddleware(this.entityName);
|
|
1424
|
-
}
|
|
1425
|
-
resolveGetQuery() {
|
|
1426
|
-
return this.services.resolveGetQuery(this.entityName);
|
|
1427
|
-
}
|
|
1428
|
-
resolveExistsQuery() {
|
|
1429
|
-
return this.services.resolveExistsQuery(this.entityName);
|
|
1430
|
-
}
|
|
1431
|
-
resolveCountQuery() {
|
|
1432
|
-
return this.services.resolveCountQuery(this.entityName);
|
|
1433
|
-
}
|
|
1434
|
-
resolveVersionsSearchQuery() {
|
|
1435
|
-
return this.services.resolveVersionsSearchQuery(this.entityName);
|
|
1436
|
-
}
|
|
1437
|
-
resolveSearchQuery() {
|
|
1438
|
-
return this.services.resolveSearchQuery(this.entityName);
|
|
1439
|
-
}
|
|
1440
|
-
resolveFindQuery() {
|
|
1441
|
-
return this.services.resolveFindQuery(this.entityName);
|
|
1442
|
-
}
|
|
1443
|
-
resolveCreateCommand() {
|
|
1444
|
-
return this.services.resolveCreateCommand(this.entityName);
|
|
1445
|
-
}
|
|
1446
|
-
resolveUpdateCommand() {
|
|
1447
|
-
return this.services.resolveUpdateCommand(this.entityName);
|
|
1448
|
-
}
|
|
1449
|
-
resolveUpsertCommand() {
|
|
1450
|
-
return this.services.resolveUpsertCommand(this.entityName);
|
|
1451
|
-
}
|
|
1452
|
-
resolveUpsertByCommand() {
|
|
1453
|
-
return this.services.resolveUpsertByCommand(this.entityName);
|
|
1454
|
-
}
|
|
1455
|
-
resolveDeleteCommand() {
|
|
1456
|
-
return this.services.resolveDeleteCommand(this.entityName);
|
|
1457
|
-
}
|
|
1458
|
-
resolveDeleteItemsCommand() {
|
|
1459
|
-
return this.services.resolveDeleteItemsCommand(this.entityName);
|
|
1460
|
-
}
|
|
1461
|
-
resolveVersionCommand() {
|
|
1462
|
-
return this.services.resolveVersionCommand(this.entityName);
|
|
1463
|
-
}
|
|
1464
|
-
resolveSampleDownloadCommand() {
|
|
1465
|
-
return this.services.resolveSampleDownloadCommand(this.entityName);
|
|
1466
|
-
}
|
|
1467
|
-
resolveImportCommand() {
|
|
1468
|
-
return this.services.resolveImportCommand(this.entityName);
|
|
1469
|
-
}
|
|
1470
|
-
resolveExportCommand() {
|
|
1471
|
-
return this.services.resolveExportCommand(this.entityName);
|
|
1472
|
-
}
|
|
1473
|
-
resolveGetAction() {
|
|
1474
|
-
return this.services.resolveGetAction(this.entityName);
|
|
1475
|
-
}
|
|
1476
|
-
resolveExistsAction() {
|
|
1477
|
-
return this.services.resolveExistsAction(this.entityName);
|
|
1478
|
-
}
|
|
1479
|
-
resolveCountAction() {
|
|
1480
|
-
return this.services.resolveCountAction(this.entityName);
|
|
1481
|
-
}
|
|
1482
|
-
resolveSearchAction() {
|
|
1483
|
-
return this.services.resolveSearchAction(this.entityName);
|
|
1484
|
-
}
|
|
1485
|
-
resolveVersionsSearchAction() {
|
|
1486
|
-
return this.services.resolveVersionsSearchAction(this.entityName);
|
|
1487
|
-
}
|
|
1488
|
-
resolveCreateAction() {
|
|
1489
|
-
return this.services.resolveCreateAction(this.entityName);
|
|
1490
|
-
}
|
|
1491
|
-
resolveUpdateAction() {
|
|
1492
|
-
return this.services.resolveUpdateAction(this.entityName);
|
|
1493
|
-
}
|
|
1494
|
-
resolveUpsertAction() {
|
|
1495
|
-
return this.services.resolveUpsertAction(this.entityName);
|
|
1496
|
-
}
|
|
1497
|
-
resolveDeleteAction() {
|
|
1498
|
-
return this.services.resolveDeleteAction(this.entityName);
|
|
1499
|
-
}
|
|
1500
|
-
resolveDeleteItemsAction() {
|
|
1501
|
-
return this.services.resolveDeleteItemsAction(this.entityName);
|
|
1502
|
-
}
|
|
1503
|
-
resolveImportAction() {
|
|
1504
|
-
return this.services.resolveImportAction(this.entityName);
|
|
1505
|
-
}
|
|
1506
|
-
resolveSampleDownloadAction() {
|
|
1507
|
-
return this.services.resolveSampleDownloadAction(this.entityName);
|
|
1508
|
-
}
|
|
1509
|
-
resolveExportAction() {
|
|
1510
|
-
return this.services.resolveExportAction(this.entityName);
|
|
1511
|
-
}
|
|
1512
|
-
resolveQueryBuilder() {
|
|
1513
|
-
return this.services.resolveQueryBuilder(this.entityName);
|
|
1514
|
-
}
|
|
1515
|
-
getEntityName() {
|
|
1516
|
-
return this.entityName;
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
1461
|
class EntitiesServiceLocator {
|
|
1520
1462
|
constructor(provider) {
|
|
1521
1463
|
this.provider = provider;
|
|
@@ -1867,6 +1809,12 @@ class EntitiesServiceLocator {
|
|
|
1867
1809
|
registerImportCommand(entityName, instance) {
|
|
1868
1810
|
this.provider.registerEntityService(EntityServices.Commands.IEntitiesImportCommand, entityName, instance);
|
|
1869
1811
|
}
|
|
1812
|
+
resolveParseCommand(entityName) {
|
|
1813
|
+
return this.provider.resolveEntityService(EntityServices.Commands.IEntitiesParseCommand, entityName);
|
|
1814
|
+
}
|
|
1815
|
+
registerParseCommand(entityName, instance) {
|
|
1816
|
+
this.provider.registerEntityService(EntityServices.Commands.IEntitiesParseCommand, entityName, instance);
|
|
1817
|
+
}
|
|
1870
1818
|
resolveSampleDownloadCommand(entityName) {
|
|
1871
1819
|
return this.provider.resolveEntityService(EntityServices.Commands.IEntitiesSampleDownloadCommand, entityName);
|
|
1872
1820
|
}
|
|
@@ -1951,6 +1899,12 @@ class EntitiesServiceLocator {
|
|
|
1951
1899
|
registerImportAction(entityName, instance) {
|
|
1952
1900
|
this.provider.registerEntityService(EntityServices.Actions.IEntitiesImportAction, entityName, instance);
|
|
1953
1901
|
}
|
|
1902
|
+
resolveParseAction(entityName) {
|
|
1903
|
+
return this.provider.resolveEntityService(EntityServices.Actions.IEntitiesParseAction, entityName);
|
|
1904
|
+
}
|
|
1905
|
+
registerParseAction(entityName, instance) {
|
|
1906
|
+
this.provider.registerEntityService(EntityServices.Actions.IEntitiesParseAction, entityName, instance);
|
|
1907
|
+
}
|
|
1954
1908
|
resolveQueryBuilder(entityName) {
|
|
1955
1909
|
return this.provider.resolveEntityService(EntityServices.Queries.IEntitiesQueryBuilder, entityName);
|
|
1956
1910
|
}
|
|
@@ -1959,6 +1913,169 @@ class EntitiesServiceLocator {
|
|
|
1959
1913
|
}
|
|
1960
1914
|
}
|
|
1961
1915
|
|
|
1916
|
+
class EntityServiceLocator {
|
|
1917
|
+
constructor(services, entityName) {
|
|
1918
|
+
this.services = services;
|
|
1919
|
+
this.entityName = entityName;
|
|
1920
|
+
}
|
|
1921
|
+
getRootServices() {
|
|
1922
|
+
return this.services;
|
|
1923
|
+
}
|
|
1924
|
+
resolveAuthenticationContextProvider() {
|
|
1925
|
+
return this.services.resolveAuthenticationContextProvider();
|
|
1926
|
+
}
|
|
1927
|
+
resolveEntityManager() {
|
|
1928
|
+
return this.services.resolveEntityManager(this.entityName);
|
|
1929
|
+
}
|
|
1930
|
+
resolveEntityActions() {
|
|
1931
|
+
return this.services.resolveEntityActions(this.entityName);
|
|
1932
|
+
}
|
|
1933
|
+
resolveRepository() {
|
|
1934
|
+
return this.services.resolveRepository(this.entityName);
|
|
1935
|
+
}
|
|
1936
|
+
resolveEventsManager() {
|
|
1937
|
+
return this.services.resolveEventsManager(this.entityName);
|
|
1938
|
+
}
|
|
1939
|
+
resolveVersioningProvider() {
|
|
1940
|
+
return this.services.resolveEntityVersioningProvider();
|
|
1941
|
+
}
|
|
1942
|
+
resolveEntityConfiguration() {
|
|
1943
|
+
return this.services.resolveEntityConfiguration(this.entityName);
|
|
1944
|
+
}
|
|
1945
|
+
resolveReplicaSyncManager() {
|
|
1946
|
+
return this.services.resolveReplicaSyncManager(this.entityName);
|
|
1947
|
+
}
|
|
1948
|
+
resolveReplicaConfiguration() {
|
|
1949
|
+
return this.services.resolveReplicaConfiguration(this.entityName);
|
|
1950
|
+
}
|
|
1951
|
+
resolveReplicaDeleteManager() {
|
|
1952
|
+
return this.services.resolveReplicaDeleteManager(this.entityName);
|
|
1953
|
+
}
|
|
1954
|
+
resolveConnectorSyncManager() {
|
|
1955
|
+
return this.services.resolveConnectorSyncManager(this.entityName);
|
|
1956
|
+
}
|
|
1957
|
+
resolveConnectorDeleteManager() {
|
|
1958
|
+
return this.services.resolveConnectorDeleteManager(this.entityName);
|
|
1959
|
+
}
|
|
1960
|
+
resolveConnectorsConfiguration() {
|
|
1961
|
+
return this.services.resolveConnectorsConfiguration(this.entityName);
|
|
1962
|
+
}
|
|
1963
|
+
resolveConverter() {
|
|
1964
|
+
return this.services.resolveConverter(this.entityName);
|
|
1965
|
+
}
|
|
1966
|
+
resolveSerializer() {
|
|
1967
|
+
return this.services.resolveSerializer(this.entityName);
|
|
1968
|
+
}
|
|
1969
|
+
resolveSnapshotService() {
|
|
1970
|
+
return this.services.resolveSnapshotService(this.entityName);
|
|
1971
|
+
}
|
|
1972
|
+
resolveAdapter() {
|
|
1973
|
+
return this.services.resolveAdapter(this.entityName);
|
|
1974
|
+
}
|
|
1975
|
+
resolveAuthorizationMiddleware() {
|
|
1976
|
+
return this.services.resolveAuthorizationMiddleware(this.entityName);
|
|
1977
|
+
}
|
|
1978
|
+
resolveGetQuery() {
|
|
1979
|
+
return this.services.resolveGetQuery(this.entityName);
|
|
1980
|
+
}
|
|
1981
|
+
resolveExistsQuery() {
|
|
1982
|
+
return this.services.resolveExistsQuery(this.entityName);
|
|
1983
|
+
}
|
|
1984
|
+
resolveCountQuery() {
|
|
1985
|
+
return this.services.resolveCountQuery(this.entityName);
|
|
1986
|
+
}
|
|
1987
|
+
resolveVersionsSearchQuery() {
|
|
1988
|
+
return this.services.resolveVersionsSearchQuery(this.entityName);
|
|
1989
|
+
}
|
|
1990
|
+
resolveSearchQuery() {
|
|
1991
|
+
return this.services.resolveSearchQuery(this.entityName);
|
|
1992
|
+
}
|
|
1993
|
+
resolveFindQuery() {
|
|
1994
|
+
return this.services.resolveFindQuery(this.entityName);
|
|
1995
|
+
}
|
|
1996
|
+
resolveCreateCommand() {
|
|
1997
|
+
return this.services.resolveCreateCommand(this.entityName);
|
|
1998
|
+
}
|
|
1999
|
+
resolveUpdateCommand() {
|
|
2000
|
+
return this.services.resolveUpdateCommand(this.entityName);
|
|
2001
|
+
}
|
|
2002
|
+
resolveUpsertCommand() {
|
|
2003
|
+
return this.services.resolveUpsertCommand(this.entityName);
|
|
2004
|
+
}
|
|
2005
|
+
resolveUpsertByCommand() {
|
|
2006
|
+
return this.services.resolveUpsertByCommand(this.entityName);
|
|
2007
|
+
}
|
|
2008
|
+
resolveDeleteCommand() {
|
|
2009
|
+
return this.services.resolveDeleteCommand(this.entityName);
|
|
2010
|
+
}
|
|
2011
|
+
resolveDeleteItemsCommand() {
|
|
2012
|
+
return this.services.resolveDeleteItemsCommand(this.entityName);
|
|
2013
|
+
}
|
|
2014
|
+
resolveVersionCommand() {
|
|
2015
|
+
return this.services.resolveVersionCommand(this.entityName);
|
|
2016
|
+
}
|
|
2017
|
+
resolveSampleDownloadCommand() {
|
|
2018
|
+
return this.services.resolveSampleDownloadCommand(this.entityName);
|
|
2019
|
+
}
|
|
2020
|
+
resolveImportCommand() {
|
|
2021
|
+
return this.services.resolveImportCommand(this.entityName);
|
|
2022
|
+
}
|
|
2023
|
+
resolveParseCommand() {
|
|
2024
|
+
return this.services.resolveParseCommand(this.entityName);
|
|
2025
|
+
}
|
|
2026
|
+
resolveExportCommand() {
|
|
2027
|
+
return this.services.resolveExportCommand(this.entityName);
|
|
2028
|
+
}
|
|
2029
|
+
resolveGetAction() {
|
|
2030
|
+
return this.services.resolveGetAction(this.entityName);
|
|
2031
|
+
}
|
|
2032
|
+
resolveExistsAction() {
|
|
2033
|
+
return this.services.resolveExistsAction(this.entityName);
|
|
2034
|
+
}
|
|
2035
|
+
resolveCountAction() {
|
|
2036
|
+
return this.services.resolveCountAction(this.entityName);
|
|
2037
|
+
}
|
|
2038
|
+
resolveSearchAction() {
|
|
2039
|
+
return this.services.resolveSearchAction(this.entityName);
|
|
2040
|
+
}
|
|
2041
|
+
resolveVersionsSearchAction() {
|
|
2042
|
+
return this.services.resolveVersionsSearchAction(this.entityName);
|
|
2043
|
+
}
|
|
2044
|
+
resolveCreateAction() {
|
|
2045
|
+
return this.services.resolveCreateAction(this.entityName);
|
|
2046
|
+
}
|
|
2047
|
+
resolveUpdateAction() {
|
|
2048
|
+
return this.services.resolveUpdateAction(this.entityName);
|
|
2049
|
+
}
|
|
2050
|
+
resolveUpsertAction() {
|
|
2051
|
+
return this.services.resolveUpsertAction(this.entityName);
|
|
2052
|
+
}
|
|
2053
|
+
resolveDeleteAction() {
|
|
2054
|
+
return this.services.resolveDeleteAction(this.entityName);
|
|
2055
|
+
}
|
|
2056
|
+
resolveDeleteItemsAction() {
|
|
2057
|
+
return this.services.resolveDeleteItemsAction(this.entityName);
|
|
2058
|
+
}
|
|
2059
|
+
resolveImportAction() {
|
|
2060
|
+
return this.services.resolveImportAction(this.entityName);
|
|
2061
|
+
}
|
|
2062
|
+
resolveParseAction() {
|
|
2063
|
+
return this.services.resolveParseAction(this.entityName);
|
|
2064
|
+
}
|
|
2065
|
+
resolveSampleDownloadAction() {
|
|
2066
|
+
return this.services.resolveSampleDownloadAction(this.entityName);
|
|
2067
|
+
}
|
|
2068
|
+
resolveExportAction() {
|
|
2069
|
+
return this.services.resolveExportAction(this.entityName);
|
|
2070
|
+
}
|
|
2071
|
+
resolveQueryBuilder() {
|
|
2072
|
+
return this.services.resolveQueryBuilder(this.entityName);
|
|
2073
|
+
}
|
|
2074
|
+
getEntityName() {
|
|
2075
|
+
return this.entityName;
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
|
|
1962
2079
|
class EntitiesCountQuery {
|
|
1963
2080
|
constructor(services) {
|
|
1964
2081
|
this.services = services;
|
|
@@ -2515,7 +2632,9 @@ class EntityManagerServiceCollection {
|
|
|
2515
2632
|
this.locator.registerExportCommand(this.entityName, new EntitiesExportCommand(this.resolver, settings));
|
|
2516
2633
|
this.locator.registerExportAction(this.entityName, new EntitiesExportAction(this.resolver));
|
|
2517
2634
|
this.locator.registerImportCommand(this.entityName, new EntitiesImportCommand(this.resolver, settings));
|
|
2635
|
+
this.locator.registerParseCommand(this.entityName, new EntitiesParseCommand(this.resolver, settings));
|
|
2518
2636
|
this.locator.registerImportAction(this.entityName, new EntitiesImportAction(this.resolver));
|
|
2637
|
+
this.locator.registerParseAction(this.entityName, new EntitiesParseAction(this.resolver));
|
|
2519
2638
|
this.locator.registerSampleDownloadCommand(this.entityName, new EntitiesSampleDownloadCommand(this.resolver, settings));
|
|
2520
2639
|
this.locator.registerSampleDownloadAction(this.entityName, new EntitiesSampleDownloadAction(this.resolver));
|
|
2521
2640
|
return this;
|
|
@@ -34722,6 +34841,37 @@ class AppExceptionsFilterBase {
|
|
|
34722
34841
|
}
|
|
34723
34842
|
}
|
|
34724
34843
|
|
|
34844
|
+
class EntityParseValidationError {
|
|
34845
|
+
}
|
|
34846
|
+
__decorate([
|
|
34847
|
+
swagger.ApiProperty(),
|
|
34848
|
+
__metadata("design:type", String)
|
|
34849
|
+
], EntityParseValidationError.prototype, "errorCode", void 0);
|
|
34850
|
+
class EntityParseStatus {
|
|
34851
|
+
}
|
|
34852
|
+
__decorate([
|
|
34853
|
+
swagger.ApiProperty(),
|
|
34854
|
+
__metadata("design:type", Boolean)
|
|
34855
|
+
], EntityParseStatus.prototype, "isValid", void 0);
|
|
34856
|
+
__decorate([
|
|
34857
|
+
swagger.ApiProperty({ type: [EntityParseValidationError] }),
|
|
34858
|
+
__metadata("design:type", Array)
|
|
34859
|
+
], EntityParseStatus.prototype, "validationErrors", void 0);
|
|
34860
|
+
class EntityParseResult {
|
|
34861
|
+
}
|
|
34862
|
+
__decorate([
|
|
34863
|
+
swagger.ApiProperty(),
|
|
34864
|
+
__metadata("design:type", Number)
|
|
34865
|
+
], EntityParseResult.prototype, "rowIndex", void 0);
|
|
34866
|
+
__decorate([
|
|
34867
|
+
swagger.ApiProperty({ type: Object }),
|
|
34868
|
+
__metadata("design:type", Object)
|
|
34869
|
+
], EntityParseResult.prototype, "item", void 0);
|
|
34870
|
+
__decorate([
|
|
34871
|
+
swagger.ApiProperty(),
|
|
34872
|
+
__metadata("design:type", EntityParseStatus)
|
|
34873
|
+
], EntityParseResult.prototype, "status", void 0);
|
|
34874
|
+
|
|
34725
34875
|
const buildCompletedStepsSequence = (step) => {
|
|
34726
34876
|
const steps = [];
|
|
34727
34877
|
let currentStep = step;
|
|
@@ -44204,6 +44354,8 @@ exports.EntityManagerSymbols = EntityManagerSymbols;
|
|
|
44204
44354
|
exports.EntityManagerUnauthorizedException = EntityManagerUnauthorizedException;
|
|
44205
44355
|
exports.EntityNotFoundException = EntityNotFoundException;
|
|
44206
44356
|
exports.EntityOperationUnauthorizedException = EntityOperationUnauthorizedException;
|
|
44357
|
+
exports.EntityParseResult = EntityParseResult;
|
|
44358
|
+
exports.EntityParseValidationError = EntityParseValidationError;
|
|
44207
44359
|
exports.EntitySeeder = EntitySeeder;
|
|
44208
44360
|
exports.EntitySerializer = EntitySerializer;
|
|
44209
44361
|
exports.EntitySnapshotService = EntitySnapshotService;
|