@punks/backend-entity-manager 0.0.348 → 0.0.350
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 +425 -292
- 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 +5 -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/abstractions/session.d.ts +7 -0
- package/dist/cjs/types/actions/parse.d.ts +9 -0
- package/dist/cjs/types/base/serializer.d.ts +1 -0
- 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 +2 -1
- 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/platforms/nest/services/session/index.d.ts +2 -1
- 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/cjs/types/testing/mocks/index.d.ts +1 -0
- package/dist/cjs/types/testing/mocks/session.d.ts +10 -0
- package/dist/esm/index.js +423 -293
- 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 +5 -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/abstractions/session.d.ts +7 -0
- package/dist/esm/types/actions/parse.d.ts +9 -0
- package/dist/esm/types/base/serializer.d.ts +1 -0
- 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 +2 -1
- 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/platforms/nest/services/session/index.d.ts +2 -1
- 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/esm/types/testing/mocks/index.d.ts +1 -0
- package/dist/esm/types/testing/mocks/session.d.ts +10 -0
- package/dist/index.d.ts +581 -486
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import { SchedulerRegistry } from '@nestjs/schedule';
|
|
|
15
15
|
import require$$0 from 'child_process';
|
|
16
16
|
import { CommandBus, CommandHandler } from '@nestjs/cqrs';
|
|
17
17
|
import require$$1 from 'fs';
|
|
18
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
18
19
|
import { ListObjectsCommand, PutObjectCommand, GetObjectCommand, DeleteObjectCommand, CopyObjectCommand, S3Client } from '@aws-sdk/client-s3';
|
|
19
20
|
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
|
|
20
21
|
import { SendEmailCommand, SESClient } from '@aws-sdk/client-ses';
|
|
@@ -210,13 +211,13 @@ class EntitySerializer {
|
|
|
210
211
|
}
|
|
211
212
|
parseCsv(data, definition) {
|
|
212
213
|
const records = csvParse(data, DEFAULT_DELIMITER);
|
|
213
|
-
return records.map((x) => this.convertSheetRecord(x, definition));
|
|
214
|
+
return records.map((x, i) => this.convertSheetRecord(x, definition, i));
|
|
214
215
|
}
|
|
215
216
|
parseXlsx(data, definition) {
|
|
216
217
|
const records = excelParse(data);
|
|
217
|
-
return records.map((x) => this.convertSheetRecord(x, definition));
|
|
218
|
+
return records.map((x, i) => this.convertSheetRecord(x, definition, i));
|
|
218
219
|
}
|
|
219
|
-
convertSheetRecord(record, definition) {
|
|
220
|
+
convertSheetRecord(record, definition, rowIndex) {
|
|
220
221
|
if (!record._type || record._type !== this.entityName) {
|
|
221
222
|
throw new Error(`Invalid record type ${record._type} -> record: \n${JSON.stringify(record)}`);
|
|
222
223
|
}
|
|
@@ -229,10 +230,26 @@ class EntitySerializer {
|
|
|
229
230
|
entity[column.selector] = this.parseColumnValue(record, column);
|
|
230
231
|
}
|
|
231
232
|
}
|
|
233
|
+
const validationErrors = [];
|
|
234
|
+
for (const column of definition.columns) {
|
|
235
|
+
for (const validator of column.validators ?? []) {
|
|
236
|
+
const result = validator.fn((item) => item[column.selector]);
|
|
237
|
+
if (!result.isValid) {
|
|
238
|
+
validationErrors.push({
|
|
239
|
+
errorCode: validator.key,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
232
244
|
const idField = definition.columns.find((x) => x.idColumn || x.selector === "id");
|
|
233
245
|
return {
|
|
234
246
|
id: idField ? entity[idField.selector] : undefined,
|
|
235
247
|
item: entity,
|
|
248
|
+
rowIndex,
|
|
249
|
+
status: {
|
|
250
|
+
isValid: validationErrors.length === 0,
|
|
251
|
+
validationErrors,
|
|
252
|
+
},
|
|
236
253
|
};
|
|
237
254
|
}
|
|
238
255
|
parseColumnValue(row, definition) {
|
|
@@ -294,6 +311,7 @@ class EntitySerializer {
|
|
|
294
311
|
async serialize(data, format) {
|
|
295
312
|
return await this.buildExportFile(data, format);
|
|
296
313
|
}
|
|
314
|
+
validateSheetItem(item, allItems, context) { }
|
|
297
315
|
async getContext() {
|
|
298
316
|
return (await this.services
|
|
299
317
|
.resolveAuthenticationContextProvider()
|
|
@@ -484,6 +502,19 @@ class EntitiesImportAction {
|
|
|
484
502
|
}
|
|
485
503
|
}
|
|
486
504
|
|
|
505
|
+
class EntitiesParseAction {
|
|
506
|
+
constructor(services) {
|
|
507
|
+
this.services = services;
|
|
508
|
+
this.logger = Log.getLogger(`${services.getEntityName()} -> Import`);
|
|
509
|
+
}
|
|
510
|
+
async execute(input) {
|
|
511
|
+
this.logger.debug("Parse action started", { input });
|
|
512
|
+
const result = await this.services.resolveParseCommand().execute(input);
|
|
513
|
+
this.logger.debug("Parse action completed", { input });
|
|
514
|
+
return result;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
487
518
|
class EntitiesSampleDownloadAction {
|
|
488
519
|
constructor(services) {
|
|
489
520
|
this.services = services;
|
|
@@ -798,6 +829,12 @@ class EntitiesExportCommand {
|
|
|
798
829
|
}
|
|
799
830
|
}
|
|
800
831
|
|
|
832
|
+
var InvalidEntityHandling;
|
|
833
|
+
(function (InvalidEntityHandling) {
|
|
834
|
+
InvalidEntityHandling["Skip"] = "skip";
|
|
835
|
+
InvalidEntityHandling["Fail"] = "fail";
|
|
836
|
+
})(InvalidEntityHandling || (InvalidEntityHandling = {}));
|
|
837
|
+
|
|
801
838
|
class EntitiesImportCommand {
|
|
802
839
|
constructor(services, settings) {
|
|
803
840
|
this.services = services;
|
|
@@ -810,10 +847,19 @@ class EntitiesImportCommand {
|
|
|
810
847
|
fileName: input.file.fileName,
|
|
811
848
|
});
|
|
812
849
|
const importEntities = await this.parseImportFile(input.file.content, input.format);
|
|
813
|
-
|
|
850
|
+
const validEntities = importEntities.filter((x) => x.status.isValid);
|
|
851
|
+
const invalidEntities = importEntities.filter((x) => !x.status.isValid);
|
|
852
|
+
if (invalidEntities.length > 0 &&
|
|
853
|
+
input.options?.invalidEntitiesHandling !== InvalidEntityHandling.Skip) {
|
|
854
|
+
throw new Error(`Cannot import file due to invalid entities: ${invalidEntities
|
|
855
|
+
.map((x) => x.id)
|
|
856
|
+
.join(", ")}`);
|
|
857
|
+
}
|
|
858
|
+
await this.services.resolveSerializer().import(validEntities.map((x) => x.item), input.payload);
|
|
814
859
|
return {
|
|
815
860
|
statistics: {
|
|
816
|
-
importedCount:
|
|
861
|
+
importedCount: validEntities.length,
|
|
862
|
+
skippedCount: invalidEntities.length,
|
|
817
863
|
createdCount: 0,
|
|
818
864
|
unchangedCount: 0,
|
|
819
865
|
updatedCount: 0,
|
|
@@ -839,6 +885,41 @@ class EntitiesImportCommand {
|
|
|
839
885
|
}
|
|
840
886
|
}
|
|
841
887
|
|
|
888
|
+
class EntitiesParseCommand {
|
|
889
|
+
constructor(services, settings) {
|
|
890
|
+
this.services = services;
|
|
891
|
+
this.settings = settings;
|
|
892
|
+
}
|
|
893
|
+
async execute(input) {
|
|
894
|
+
await this.uploadImportFile({
|
|
895
|
+
content: input.file.content,
|
|
896
|
+
contentType: input.file.contentType,
|
|
897
|
+
fileName: input.file.fileName,
|
|
898
|
+
});
|
|
899
|
+
const entries = await this.parseImportFile(input.file.content, input.format);
|
|
900
|
+
return {
|
|
901
|
+
entries,
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
async parseImportFile(content, format) {
|
|
905
|
+
return await this.services.resolveSerializer().parse(content, format);
|
|
906
|
+
}
|
|
907
|
+
async uploadImportFile(file) {
|
|
908
|
+
await this.bucket.fileUpload({
|
|
909
|
+
bucket: this.settings.exportBucket.bucket,
|
|
910
|
+
filePath: this.buildAbsoluteBucketPath(file.fileName),
|
|
911
|
+
content: file.content,
|
|
912
|
+
contentType: file.contentType,
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
buildAbsoluteBucketPath(relativePath) {
|
|
916
|
+
return `${this.settings.exportBucket.rootFolderPath ?? ""}/parsers/${createDayPath$1(new Date())}/${relativePath}`;
|
|
917
|
+
}
|
|
918
|
+
get bucket() {
|
|
919
|
+
return this.services.getRootServices().resolveDefaultBucketProvider();
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
|
|
842
923
|
class EntitiesSampleDownloadCommand {
|
|
843
924
|
constructor(services, settings) {
|
|
844
925
|
this.services = services;
|
|
@@ -1115,6 +1196,9 @@ class EntityManager {
|
|
|
1115
1196
|
get import() {
|
|
1116
1197
|
return this.services.resolveImportCommand();
|
|
1117
1198
|
}
|
|
1199
|
+
get parse() {
|
|
1200
|
+
return this.services.resolveParseCommand();
|
|
1201
|
+
}
|
|
1118
1202
|
get sampleDownload() {
|
|
1119
1203
|
return this.services.resolveSampleDownloadCommand();
|
|
1120
1204
|
}
|
|
@@ -1159,6 +1243,9 @@ class EntityActions {
|
|
|
1159
1243
|
get import() {
|
|
1160
1244
|
return this.services.resolveImportAction();
|
|
1161
1245
|
}
|
|
1246
|
+
get parse() {
|
|
1247
|
+
return this.services.resolveParseAction();
|
|
1248
|
+
}
|
|
1162
1249
|
get sampleDownload() {
|
|
1163
1250
|
return this.services.resolveSampleDownloadAction();
|
|
1164
1251
|
}
|
|
@@ -1247,6 +1334,7 @@ const EntityServices = {
|
|
|
1247
1334
|
IEntityDeleteAction: "IEntityDeleteAction",
|
|
1248
1335
|
IEntityMergeAction: "IEntityMergeAction",
|
|
1249
1336
|
IEntitiesExportAction: "IEntitiesExportAction",
|
|
1337
|
+
IEntitiesParseAction: "IEntitiesParseAction",
|
|
1250
1338
|
IEntitiesImportAction: "IEntitiesImportAction",
|
|
1251
1339
|
IEntitiesSampleDownloadAction: "IEntitiesSampleDownloadAction",
|
|
1252
1340
|
IEntityVersionsSearchAction: "IEntityVersionsSearchAction",
|
|
@@ -1265,6 +1353,7 @@ const EntityServices = {
|
|
|
1265
1353
|
IEntitiesDeleteCommand: "IEntitiesDeleteCommand",
|
|
1266
1354
|
IEntitiesExportCommand: "IEntitiesExportCommand",
|
|
1267
1355
|
IEntitiesImportCommand: "IEntitiesImportCommand",
|
|
1356
|
+
IEntitiesParseCommand: "IEntitiesParseCommand",
|
|
1268
1357
|
IEntitiesSampleDownloadCommand: "IEntitiesSampleDownloadCommand",
|
|
1269
1358
|
},
|
|
1270
1359
|
Converters: {
|
|
@@ -1345,162 +1434,6 @@ const GlobalServices = {
|
|
|
1345
1434
|
},
|
|
1346
1435
|
};
|
|
1347
1436
|
|
|
1348
|
-
class EntityServiceLocator {
|
|
1349
|
-
constructor(services, entityName) {
|
|
1350
|
-
this.services = services;
|
|
1351
|
-
this.entityName = entityName;
|
|
1352
|
-
}
|
|
1353
|
-
getRootServices() {
|
|
1354
|
-
return this.services;
|
|
1355
|
-
}
|
|
1356
|
-
resolveAuthenticationContextProvider() {
|
|
1357
|
-
return this.services.resolveAuthenticationContextProvider();
|
|
1358
|
-
}
|
|
1359
|
-
resolveEntityManager() {
|
|
1360
|
-
return this.services.resolveEntityManager(this.entityName);
|
|
1361
|
-
}
|
|
1362
|
-
resolveEntityActions() {
|
|
1363
|
-
return this.services.resolveEntityActions(this.entityName);
|
|
1364
|
-
}
|
|
1365
|
-
resolveRepository() {
|
|
1366
|
-
return this.services.resolveRepository(this.entityName);
|
|
1367
|
-
}
|
|
1368
|
-
resolveEventsManager() {
|
|
1369
|
-
return this.services.resolveEventsManager(this.entityName);
|
|
1370
|
-
}
|
|
1371
|
-
resolveVersioningProvider() {
|
|
1372
|
-
return this.services.resolveEntityVersioningProvider();
|
|
1373
|
-
}
|
|
1374
|
-
resolveEntityConfiguration() {
|
|
1375
|
-
return this.services.resolveEntityConfiguration(this.entityName);
|
|
1376
|
-
}
|
|
1377
|
-
resolveReplicaSyncManager() {
|
|
1378
|
-
return this.services.resolveReplicaSyncManager(this.entityName);
|
|
1379
|
-
}
|
|
1380
|
-
resolveReplicaConfiguration() {
|
|
1381
|
-
return this.services.resolveReplicaConfiguration(this.entityName);
|
|
1382
|
-
}
|
|
1383
|
-
resolveReplicaDeleteManager() {
|
|
1384
|
-
return this.services.resolveReplicaDeleteManager(this.entityName);
|
|
1385
|
-
}
|
|
1386
|
-
resolveConnectorSyncManager() {
|
|
1387
|
-
return this.services.resolveConnectorSyncManager(this.entityName);
|
|
1388
|
-
}
|
|
1389
|
-
resolveConnectorDeleteManager() {
|
|
1390
|
-
return this.services.resolveConnectorDeleteManager(this.entityName);
|
|
1391
|
-
}
|
|
1392
|
-
resolveConnectorsConfiguration() {
|
|
1393
|
-
return this.services.resolveConnectorsConfiguration(this.entityName);
|
|
1394
|
-
}
|
|
1395
|
-
resolveConverter() {
|
|
1396
|
-
return this.services.resolveConverter(this.entityName);
|
|
1397
|
-
}
|
|
1398
|
-
resolveSerializer() {
|
|
1399
|
-
return this.services.resolveSerializer(this.entityName);
|
|
1400
|
-
}
|
|
1401
|
-
resolveSnapshotService() {
|
|
1402
|
-
return this.services.resolveSnapshotService(this.entityName);
|
|
1403
|
-
}
|
|
1404
|
-
resolveAdapter() {
|
|
1405
|
-
return this.services.resolveAdapter(this.entityName);
|
|
1406
|
-
}
|
|
1407
|
-
resolveAuthorizationMiddleware() {
|
|
1408
|
-
return this.services.resolveAuthorizationMiddleware(this.entityName);
|
|
1409
|
-
}
|
|
1410
|
-
resolveGetQuery() {
|
|
1411
|
-
return this.services.resolveGetQuery(this.entityName);
|
|
1412
|
-
}
|
|
1413
|
-
resolveExistsQuery() {
|
|
1414
|
-
return this.services.resolveExistsQuery(this.entityName);
|
|
1415
|
-
}
|
|
1416
|
-
resolveCountQuery() {
|
|
1417
|
-
return this.services.resolveCountQuery(this.entityName);
|
|
1418
|
-
}
|
|
1419
|
-
resolveVersionsSearchQuery() {
|
|
1420
|
-
return this.services.resolveVersionsSearchQuery(this.entityName);
|
|
1421
|
-
}
|
|
1422
|
-
resolveSearchQuery() {
|
|
1423
|
-
return this.services.resolveSearchQuery(this.entityName);
|
|
1424
|
-
}
|
|
1425
|
-
resolveFindQuery() {
|
|
1426
|
-
return this.services.resolveFindQuery(this.entityName);
|
|
1427
|
-
}
|
|
1428
|
-
resolveCreateCommand() {
|
|
1429
|
-
return this.services.resolveCreateCommand(this.entityName);
|
|
1430
|
-
}
|
|
1431
|
-
resolveUpdateCommand() {
|
|
1432
|
-
return this.services.resolveUpdateCommand(this.entityName);
|
|
1433
|
-
}
|
|
1434
|
-
resolveUpsertCommand() {
|
|
1435
|
-
return this.services.resolveUpsertCommand(this.entityName);
|
|
1436
|
-
}
|
|
1437
|
-
resolveUpsertByCommand() {
|
|
1438
|
-
return this.services.resolveUpsertByCommand(this.entityName);
|
|
1439
|
-
}
|
|
1440
|
-
resolveDeleteCommand() {
|
|
1441
|
-
return this.services.resolveDeleteCommand(this.entityName);
|
|
1442
|
-
}
|
|
1443
|
-
resolveDeleteItemsCommand() {
|
|
1444
|
-
return this.services.resolveDeleteItemsCommand(this.entityName);
|
|
1445
|
-
}
|
|
1446
|
-
resolveVersionCommand() {
|
|
1447
|
-
return this.services.resolveVersionCommand(this.entityName);
|
|
1448
|
-
}
|
|
1449
|
-
resolveSampleDownloadCommand() {
|
|
1450
|
-
return this.services.resolveSampleDownloadCommand(this.entityName);
|
|
1451
|
-
}
|
|
1452
|
-
resolveImportCommand() {
|
|
1453
|
-
return this.services.resolveImportCommand(this.entityName);
|
|
1454
|
-
}
|
|
1455
|
-
resolveExportCommand() {
|
|
1456
|
-
return this.services.resolveExportCommand(this.entityName);
|
|
1457
|
-
}
|
|
1458
|
-
resolveGetAction() {
|
|
1459
|
-
return this.services.resolveGetAction(this.entityName);
|
|
1460
|
-
}
|
|
1461
|
-
resolveExistsAction() {
|
|
1462
|
-
return this.services.resolveExistsAction(this.entityName);
|
|
1463
|
-
}
|
|
1464
|
-
resolveCountAction() {
|
|
1465
|
-
return this.services.resolveCountAction(this.entityName);
|
|
1466
|
-
}
|
|
1467
|
-
resolveSearchAction() {
|
|
1468
|
-
return this.services.resolveSearchAction(this.entityName);
|
|
1469
|
-
}
|
|
1470
|
-
resolveVersionsSearchAction() {
|
|
1471
|
-
return this.services.resolveVersionsSearchAction(this.entityName);
|
|
1472
|
-
}
|
|
1473
|
-
resolveCreateAction() {
|
|
1474
|
-
return this.services.resolveCreateAction(this.entityName);
|
|
1475
|
-
}
|
|
1476
|
-
resolveUpdateAction() {
|
|
1477
|
-
return this.services.resolveUpdateAction(this.entityName);
|
|
1478
|
-
}
|
|
1479
|
-
resolveUpsertAction() {
|
|
1480
|
-
return this.services.resolveUpsertAction(this.entityName);
|
|
1481
|
-
}
|
|
1482
|
-
resolveDeleteAction() {
|
|
1483
|
-
return this.services.resolveDeleteAction(this.entityName);
|
|
1484
|
-
}
|
|
1485
|
-
resolveDeleteItemsAction() {
|
|
1486
|
-
return this.services.resolveDeleteItemsAction(this.entityName);
|
|
1487
|
-
}
|
|
1488
|
-
resolveImportAction() {
|
|
1489
|
-
return this.services.resolveImportAction(this.entityName);
|
|
1490
|
-
}
|
|
1491
|
-
resolveSampleDownloadAction() {
|
|
1492
|
-
return this.services.resolveSampleDownloadAction(this.entityName);
|
|
1493
|
-
}
|
|
1494
|
-
resolveExportAction() {
|
|
1495
|
-
return this.services.resolveExportAction(this.entityName);
|
|
1496
|
-
}
|
|
1497
|
-
resolveQueryBuilder() {
|
|
1498
|
-
return this.services.resolveQueryBuilder(this.entityName);
|
|
1499
|
-
}
|
|
1500
|
-
getEntityName() {
|
|
1501
|
-
return this.entityName;
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
1437
|
class EntitiesServiceLocator {
|
|
1505
1438
|
constructor(provider) {
|
|
1506
1439
|
this.provider = provider;
|
|
@@ -1852,6 +1785,12 @@ class EntitiesServiceLocator {
|
|
|
1852
1785
|
registerImportCommand(entityName, instance) {
|
|
1853
1786
|
this.provider.registerEntityService(EntityServices.Commands.IEntitiesImportCommand, entityName, instance);
|
|
1854
1787
|
}
|
|
1788
|
+
resolveParseCommand(entityName) {
|
|
1789
|
+
return this.provider.resolveEntityService(EntityServices.Commands.IEntitiesParseCommand, entityName);
|
|
1790
|
+
}
|
|
1791
|
+
registerParseCommand(entityName, instance) {
|
|
1792
|
+
this.provider.registerEntityService(EntityServices.Commands.IEntitiesParseCommand, entityName, instance);
|
|
1793
|
+
}
|
|
1855
1794
|
resolveSampleDownloadCommand(entityName) {
|
|
1856
1795
|
return this.provider.resolveEntityService(EntityServices.Commands.IEntitiesSampleDownloadCommand, entityName);
|
|
1857
1796
|
}
|
|
@@ -1936,6 +1875,12 @@ class EntitiesServiceLocator {
|
|
|
1936
1875
|
registerImportAction(entityName, instance) {
|
|
1937
1876
|
this.provider.registerEntityService(EntityServices.Actions.IEntitiesImportAction, entityName, instance);
|
|
1938
1877
|
}
|
|
1878
|
+
resolveParseAction(entityName) {
|
|
1879
|
+
return this.provider.resolveEntityService(EntityServices.Actions.IEntitiesParseAction, entityName);
|
|
1880
|
+
}
|
|
1881
|
+
registerParseAction(entityName, instance) {
|
|
1882
|
+
this.provider.registerEntityService(EntityServices.Actions.IEntitiesParseAction, entityName, instance);
|
|
1883
|
+
}
|
|
1939
1884
|
resolveQueryBuilder(entityName) {
|
|
1940
1885
|
return this.provider.resolveEntityService(EntityServices.Queries.IEntitiesQueryBuilder, entityName);
|
|
1941
1886
|
}
|
|
@@ -1944,6 +1889,169 @@ class EntitiesServiceLocator {
|
|
|
1944
1889
|
}
|
|
1945
1890
|
}
|
|
1946
1891
|
|
|
1892
|
+
class EntityServiceLocator {
|
|
1893
|
+
constructor(services, entityName) {
|
|
1894
|
+
this.services = services;
|
|
1895
|
+
this.entityName = entityName;
|
|
1896
|
+
}
|
|
1897
|
+
getRootServices() {
|
|
1898
|
+
return this.services;
|
|
1899
|
+
}
|
|
1900
|
+
resolveAuthenticationContextProvider() {
|
|
1901
|
+
return this.services.resolveAuthenticationContextProvider();
|
|
1902
|
+
}
|
|
1903
|
+
resolveEntityManager() {
|
|
1904
|
+
return this.services.resolveEntityManager(this.entityName);
|
|
1905
|
+
}
|
|
1906
|
+
resolveEntityActions() {
|
|
1907
|
+
return this.services.resolveEntityActions(this.entityName);
|
|
1908
|
+
}
|
|
1909
|
+
resolveRepository() {
|
|
1910
|
+
return this.services.resolveRepository(this.entityName);
|
|
1911
|
+
}
|
|
1912
|
+
resolveEventsManager() {
|
|
1913
|
+
return this.services.resolveEventsManager(this.entityName);
|
|
1914
|
+
}
|
|
1915
|
+
resolveVersioningProvider() {
|
|
1916
|
+
return this.services.resolveEntityVersioningProvider();
|
|
1917
|
+
}
|
|
1918
|
+
resolveEntityConfiguration() {
|
|
1919
|
+
return this.services.resolveEntityConfiguration(this.entityName);
|
|
1920
|
+
}
|
|
1921
|
+
resolveReplicaSyncManager() {
|
|
1922
|
+
return this.services.resolveReplicaSyncManager(this.entityName);
|
|
1923
|
+
}
|
|
1924
|
+
resolveReplicaConfiguration() {
|
|
1925
|
+
return this.services.resolveReplicaConfiguration(this.entityName);
|
|
1926
|
+
}
|
|
1927
|
+
resolveReplicaDeleteManager() {
|
|
1928
|
+
return this.services.resolveReplicaDeleteManager(this.entityName);
|
|
1929
|
+
}
|
|
1930
|
+
resolveConnectorSyncManager() {
|
|
1931
|
+
return this.services.resolveConnectorSyncManager(this.entityName);
|
|
1932
|
+
}
|
|
1933
|
+
resolveConnectorDeleteManager() {
|
|
1934
|
+
return this.services.resolveConnectorDeleteManager(this.entityName);
|
|
1935
|
+
}
|
|
1936
|
+
resolveConnectorsConfiguration() {
|
|
1937
|
+
return this.services.resolveConnectorsConfiguration(this.entityName);
|
|
1938
|
+
}
|
|
1939
|
+
resolveConverter() {
|
|
1940
|
+
return this.services.resolveConverter(this.entityName);
|
|
1941
|
+
}
|
|
1942
|
+
resolveSerializer() {
|
|
1943
|
+
return this.services.resolveSerializer(this.entityName);
|
|
1944
|
+
}
|
|
1945
|
+
resolveSnapshotService() {
|
|
1946
|
+
return this.services.resolveSnapshotService(this.entityName);
|
|
1947
|
+
}
|
|
1948
|
+
resolveAdapter() {
|
|
1949
|
+
return this.services.resolveAdapter(this.entityName);
|
|
1950
|
+
}
|
|
1951
|
+
resolveAuthorizationMiddleware() {
|
|
1952
|
+
return this.services.resolveAuthorizationMiddleware(this.entityName);
|
|
1953
|
+
}
|
|
1954
|
+
resolveGetQuery() {
|
|
1955
|
+
return this.services.resolveGetQuery(this.entityName);
|
|
1956
|
+
}
|
|
1957
|
+
resolveExistsQuery() {
|
|
1958
|
+
return this.services.resolveExistsQuery(this.entityName);
|
|
1959
|
+
}
|
|
1960
|
+
resolveCountQuery() {
|
|
1961
|
+
return this.services.resolveCountQuery(this.entityName);
|
|
1962
|
+
}
|
|
1963
|
+
resolveVersionsSearchQuery() {
|
|
1964
|
+
return this.services.resolveVersionsSearchQuery(this.entityName);
|
|
1965
|
+
}
|
|
1966
|
+
resolveSearchQuery() {
|
|
1967
|
+
return this.services.resolveSearchQuery(this.entityName);
|
|
1968
|
+
}
|
|
1969
|
+
resolveFindQuery() {
|
|
1970
|
+
return this.services.resolveFindQuery(this.entityName);
|
|
1971
|
+
}
|
|
1972
|
+
resolveCreateCommand() {
|
|
1973
|
+
return this.services.resolveCreateCommand(this.entityName);
|
|
1974
|
+
}
|
|
1975
|
+
resolveUpdateCommand() {
|
|
1976
|
+
return this.services.resolveUpdateCommand(this.entityName);
|
|
1977
|
+
}
|
|
1978
|
+
resolveUpsertCommand() {
|
|
1979
|
+
return this.services.resolveUpsertCommand(this.entityName);
|
|
1980
|
+
}
|
|
1981
|
+
resolveUpsertByCommand() {
|
|
1982
|
+
return this.services.resolveUpsertByCommand(this.entityName);
|
|
1983
|
+
}
|
|
1984
|
+
resolveDeleteCommand() {
|
|
1985
|
+
return this.services.resolveDeleteCommand(this.entityName);
|
|
1986
|
+
}
|
|
1987
|
+
resolveDeleteItemsCommand() {
|
|
1988
|
+
return this.services.resolveDeleteItemsCommand(this.entityName);
|
|
1989
|
+
}
|
|
1990
|
+
resolveVersionCommand() {
|
|
1991
|
+
return this.services.resolveVersionCommand(this.entityName);
|
|
1992
|
+
}
|
|
1993
|
+
resolveSampleDownloadCommand() {
|
|
1994
|
+
return this.services.resolveSampleDownloadCommand(this.entityName);
|
|
1995
|
+
}
|
|
1996
|
+
resolveImportCommand() {
|
|
1997
|
+
return this.services.resolveImportCommand(this.entityName);
|
|
1998
|
+
}
|
|
1999
|
+
resolveParseCommand() {
|
|
2000
|
+
return this.services.resolveParseCommand(this.entityName);
|
|
2001
|
+
}
|
|
2002
|
+
resolveExportCommand() {
|
|
2003
|
+
return this.services.resolveExportCommand(this.entityName);
|
|
2004
|
+
}
|
|
2005
|
+
resolveGetAction() {
|
|
2006
|
+
return this.services.resolveGetAction(this.entityName);
|
|
2007
|
+
}
|
|
2008
|
+
resolveExistsAction() {
|
|
2009
|
+
return this.services.resolveExistsAction(this.entityName);
|
|
2010
|
+
}
|
|
2011
|
+
resolveCountAction() {
|
|
2012
|
+
return this.services.resolveCountAction(this.entityName);
|
|
2013
|
+
}
|
|
2014
|
+
resolveSearchAction() {
|
|
2015
|
+
return this.services.resolveSearchAction(this.entityName);
|
|
2016
|
+
}
|
|
2017
|
+
resolveVersionsSearchAction() {
|
|
2018
|
+
return this.services.resolveVersionsSearchAction(this.entityName);
|
|
2019
|
+
}
|
|
2020
|
+
resolveCreateAction() {
|
|
2021
|
+
return this.services.resolveCreateAction(this.entityName);
|
|
2022
|
+
}
|
|
2023
|
+
resolveUpdateAction() {
|
|
2024
|
+
return this.services.resolveUpdateAction(this.entityName);
|
|
2025
|
+
}
|
|
2026
|
+
resolveUpsertAction() {
|
|
2027
|
+
return this.services.resolveUpsertAction(this.entityName);
|
|
2028
|
+
}
|
|
2029
|
+
resolveDeleteAction() {
|
|
2030
|
+
return this.services.resolveDeleteAction(this.entityName);
|
|
2031
|
+
}
|
|
2032
|
+
resolveDeleteItemsAction() {
|
|
2033
|
+
return this.services.resolveDeleteItemsAction(this.entityName);
|
|
2034
|
+
}
|
|
2035
|
+
resolveImportAction() {
|
|
2036
|
+
return this.services.resolveImportAction(this.entityName);
|
|
2037
|
+
}
|
|
2038
|
+
resolveParseAction() {
|
|
2039
|
+
return this.services.resolveParseAction(this.entityName);
|
|
2040
|
+
}
|
|
2041
|
+
resolveSampleDownloadAction() {
|
|
2042
|
+
return this.services.resolveSampleDownloadAction(this.entityName);
|
|
2043
|
+
}
|
|
2044
|
+
resolveExportAction() {
|
|
2045
|
+
return this.services.resolveExportAction(this.entityName);
|
|
2046
|
+
}
|
|
2047
|
+
resolveQueryBuilder() {
|
|
2048
|
+
return this.services.resolveQueryBuilder(this.entityName);
|
|
2049
|
+
}
|
|
2050
|
+
getEntityName() {
|
|
2051
|
+
return this.entityName;
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
|
|
1947
2055
|
class EntitiesCountQuery {
|
|
1948
2056
|
constructor(services) {
|
|
1949
2057
|
this.services = services;
|
|
@@ -2500,7 +2608,9 @@ class EntityManagerServiceCollection {
|
|
|
2500
2608
|
this.locator.registerExportCommand(this.entityName, new EntitiesExportCommand(this.resolver, settings));
|
|
2501
2609
|
this.locator.registerExportAction(this.entityName, new EntitiesExportAction(this.resolver));
|
|
2502
2610
|
this.locator.registerImportCommand(this.entityName, new EntitiesImportCommand(this.resolver, settings));
|
|
2611
|
+
this.locator.registerParseCommand(this.entityName, new EntitiesParseCommand(this.resolver, settings));
|
|
2503
2612
|
this.locator.registerImportAction(this.entityName, new EntitiesImportAction(this.resolver));
|
|
2613
|
+
this.locator.registerParseAction(this.entityName, new EntitiesParseAction(this.resolver));
|
|
2504
2614
|
this.locator.registerSampleDownloadCommand(this.entityName, new EntitiesSampleDownloadCommand(this.resolver, settings));
|
|
2505
2615
|
this.locator.registerSampleDownloadAction(this.entityName, new EntitiesSampleDownloadAction(this.resolver));
|
|
2506
2616
|
return this;
|
|
@@ -22070,6 +22180,26 @@ MediaLibraryService = __decorate([
|
|
|
22070
22180
|
__metadata("design:paramtypes", [EntityManagerRegistry])
|
|
22071
22181
|
], MediaLibraryService);
|
|
22072
22182
|
|
|
22183
|
+
function toInteger(dirtyNumber) {
|
|
22184
|
+
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
|
|
22185
|
+
return NaN;
|
|
22186
|
+
}
|
|
22187
|
+
|
|
22188
|
+
var number = Number(dirtyNumber);
|
|
22189
|
+
|
|
22190
|
+
if (isNaN(number)) {
|
|
22191
|
+
return number;
|
|
22192
|
+
}
|
|
22193
|
+
|
|
22194
|
+
return number < 0 ? Math.ceil(number) : Math.floor(number);
|
|
22195
|
+
}
|
|
22196
|
+
|
|
22197
|
+
function requiredArgs(required, args) {
|
|
22198
|
+
if (args.length < required) {
|
|
22199
|
+
throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
|
|
22200
|
+
}
|
|
22201
|
+
}
|
|
22202
|
+
|
|
22073
22203
|
/**
|
|
22074
22204
|
* @name toDate
|
|
22075
22205
|
* @category Common Helpers
|
|
@@ -22086,11 +22216,9 @@ MediaLibraryService = __decorate([
|
|
|
22086
22216
|
*
|
|
22087
22217
|
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
|
22088
22218
|
*
|
|
22089
|
-
* @
|
|
22090
|
-
*
|
|
22091
|
-
* @
|
|
22092
|
-
*
|
|
22093
|
-
* @returns The parsed date in the local time zone
|
|
22219
|
+
* @param {Date|Number} argument - the value to convert
|
|
22220
|
+
* @returns {Date} the parsed date in the local time zone
|
|
22221
|
+
* @throws {TypeError} 1 argument required
|
|
22094
22222
|
*
|
|
22095
22223
|
* @example
|
|
22096
22224
|
* // Clone the date:
|
|
@@ -22102,65 +22230,25 @@ MediaLibraryService = __decorate([
|
|
|
22102
22230
|
* const result = toDate(1392098430000)
|
|
22103
22231
|
* //=> Tue Feb 11 2014 11:30:30
|
|
22104
22232
|
*/
|
|
22233
|
+
|
|
22105
22234
|
function toDate(argument) {
|
|
22106
|
-
|
|
22235
|
+
requiredArgs(1, arguments);
|
|
22236
|
+
var argStr = Object.prototype.toString.call(argument); // Clone the date
|
|
22107
22237
|
|
|
22108
|
-
|
|
22109
|
-
if (
|
|
22110
|
-
argument instanceof Date ||
|
|
22111
|
-
(typeof argument === "object" && argStr === "[object Date]")
|
|
22112
|
-
) {
|
|
22238
|
+
if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
|
|
22113
22239
|
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
|
|
22114
|
-
return new argument.
|
|
22115
|
-
} else if (
|
|
22116
|
-
typeof argument === "number" ||
|
|
22117
|
-
argStr === "[object Number]" ||
|
|
22118
|
-
typeof argument === "string" ||
|
|
22119
|
-
argStr === "[object String]"
|
|
22120
|
-
) {
|
|
22121
|
-
// TODO: Can we get rid of as?
|
|
22240
|
+
return new Date(argument.getTime());
|
|
22241
|
+
} else if (typeof argument === 'number' || argStr === '[object Number]') {
|
|
22122
22242
|
return new Date(argument);
|
|
22123
22243
|
} else {
|
|
22124
|
-
|
|
22125
|
-
|
|
22126
|
-
|
|
22127
|
-
}
|
|
22244
|
+
if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
|
|
22245
|
+
// eslint-disable-next-line no-console
|
|
22246
|
+
console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"); // eslint-disable-next-line no-console
|
|
22128
22247
|
|
|
22129
|
-
|
|
22130
|
-
|
|
22131
|
-
|
|
22132
|
-
|
|
22133
|
-
*
|
|
22134
|
-
* @description
|
|
22135
|
-
* The function constructs a new date using the constructor from the reference
|
|
22136
|
-
* date and the given value. It helps to build generic functions that accept
|
|
22137
|
-
* date extensions.
|
|
22138
|
-
*
|
|
22139
|
-
* It defaults to `Date` if the passed reference date is a number or a string.
|
|
22140
|
-
*
|
|
22141
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
22142
|
-
*
|
|
22143
|
-
* @param date - The reference date to take constructor from
|
|
22144
|
-
* @param value - The value to create the date
|
|
22145
|
-
*
|
|
22146
|
-
* @returns Date initialized using the given date and value
|
|
22147
|
-
*
|
|
22148
|
-
* @example
|
|
22149
|
-
* import { constructFrom } from 'date-fns'
|
|
22150
|
-
*
|
|
22151
|
-
* // A function that clones a date preserving the original type
|
|
22152
|
-
* function cloneDate<DateType extends Date(date: DateType): DateType {
|
|
22153
|
-
* return constructFrom(
|
|
22154
|
-
* date, // Use contrustor from the given date
|
|
22155
|
-
* date.getTime() // Use the date value to create a new date
|
|
22156
|
-
* )
|
|
22157
|
-
* }
|
|
22158
|
-
*/
|
|
22159
|
-
function constructFrom(date, value) {
|
|
22160
|
-
if (date instanceof Date) {
|
|
22161
|
-
return new date.constructor(value);
|
|
22162
|
-
} else {
|
|
22163
|
-
return new Date(value);
|
|
22248
|
+
console.warn(new Error().stack);
|
|
22249
|
+
}
|
|
22250
|
+
|
|
22251
|
+
return new Date(NaN);
|
|
22164
22252
|
}
|
|
22165
22253
|
}
|
|
22166
22254
|
|
|
@@ -22172,60 +22260,37 @@ function constructFrom(date, value) {
|
|
|
22172
22260
|
* @description
|
|
22173
22261
|
* Add the specified number of days to the given date.
|
|
22174
22262
|
*
|
|
22175
|
-
*
|
|
22263
|
+
* ### v2.0.0 breaking changes:
|
|
22176
22264
|
*
|
|
22177
|
-
*
|
|
22178
|
-
* @param amount - The amount of days to be added.
|
|
22265
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
22179
22266
|
*
|
|
22180
|
-
* @
|
|
22267
|
+
* @param {Date|Number} date - the date to be changed
|
|
22268
|
+
* @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
|
|
22269
|
+
* @returns {Date} the new date with the days added
|
|
22270
|
+
* @throws {TypeError} 2 arguments required
|
|
22181
22271
|
*
|
|
22182
22272
|
* @example
|
|
22183
22273
|
* // Add 10 days to 1 September 2014:
|
|
22184
|
-
*
|
|
22274
|
+
* var result = addDays(new Date(2014, 8, 1), 10)
|
|
22185
22275
|
* //=> Thu Sep 11 2014 00:00:00
|
|
22186
22276
|
*/
|
|
22187
|
-
|
|
22188
|
-
|
|
22189
|
-
|
|
22277
|
+
|
|
22278
|
+
function addDays(dirtyDate, dirtyAmount) {
|
|
22279
|
+
requiredArgs(2, arguments);
|
|
22280
|
+
var date = toDate(dirtyDate);
|
|
22281
|
+
var amount = toInteger(dirtyAmount);
|
|
22282
|
+
|
|
22283
|
+
if (isNaN(amount)) {
|
|
22284
|
+
return new Date(NaN);
|
|
22285
|
+
}
|
|
22286
|
+
|
|
22190
22287
|
if (!amount) {
|
|
22191
22288
|
// If 0 days, no-op to avoid changing times in the hour before end of DST
|
|
22192
|
-
return
|
|
22289
|
+
return date;
|
|
22193
22290
|
}
|
|
22194
|
-
_date.setDate(_date.getDate() + amount);
|
|
22195
|
-
return _date;
|
|
22196
|
-
}
|
|
22197
22291
|
|
|
22198
|
-
|
|
22199
|
-
|
|
22200
|
-
* @summary Useful constants
|
|
22201
|
-
* @description
|
|
22202
|
-
* Collection of useful date constants.
|
|
22203
|
-
*
|
|
22204
|
-
* The constants could be imported from `date-fns/constants`:
|
|
22205
|
-
*
|
|
22206
|
-
* ```ts
|
|
22207
|
-
* import { maxTime, minTime } from "./constants/date-fns/constants";
|
|
22208
|
-
*
|
|
22209
|
-
* function isAllowedTime(time) {
|
|
22210
|
-
* return time <= maxTime && time >= minTime;
|
|
22211
|
-
* }
|
|
22212
|
-
* ```
|
|
22213
|
-
*/
|
|
22214
|
-
|
|
22215
|
-
/**
|
|
22216
|
-
* @constant
|
|
22217
|
-
* @name millisecondsInMinute
|
|
22218
|
-
* @summary Milliseconds in 1 minute
|
|
22219
|
-
*/
|
|
22220
|
-
const millisecondsInMinute = 60000;
|
|
22221
|
-
|
|
22222
|
-
function getRoundingMethod(method) {
|
|
22223
|
-
return (number) => {
|
|
22224
|
-
const round = method ? Math[method] : Math.trunc;
|
|
22225
|
-
const result = round(number);
|
|
22226
|
-
// Prevent negative zero
|
|
22227
|
-
return result === 0 ? 0 : result;
|
|
22228
|
-
};
|
|
22292
|
+
date.setDate(date.getDate() + amount);
|
|
22293
|
+
return date;
|
|
22229
22294
|
}
|
|
22230
22295
|
|
|
22231
22296
|
/**
|
|
@@ -22236,30 +22301,33 @@ function getRoundingMethod(method) {
|
|
|
22236
22301
|
* @description
|
|
22237
22302
|
* Get the number of milliseconds between the given dates.
|
|
22238
22303
|
*
|
|
22239
|
-
*
|
|
22304
|
+
* ### v2.0.0 breaking changes:
|
|
22240
22305
|
*
|
|
22241
|
-
*
|
|
22242
|
-
* @param dateRight - The earlier date
|
|
22306
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
22243
22307
|
*
|
|
22244
|
-
* @
|
|
22308
|
+
* @param {Date|Number} dateLeft - the later date
|
|
22309
|
+
* @param {Date|Number} dateRight - the earlier date
|
|
22310
|
+
* @returns {Number} the number of milliseconds
|
|
22311
|
+
* @throws {TypeError} 2 arguments required
|
|
22245
22312
|
*
|
|
22246
22313
|
* @example
|
|
22247
22314
|
* // How many milliseconds are between
|
|
22248
22315
|
* // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
|
|
22249
|
-
*
|
|
22316
|
+
* var result = differenceInMilliseconds(
|
|
22250
22317
|
* new Date(2014, 6, 2, 12, 30, 21, 700),
|
|
22251
22318
|
* new Date(2014, 6, 2, 12, 30, 20, 600)
|
|
22252
22319
|
* )
|
|
22253
22320
|
* //=> 1100
|
|
22254
22321
|
*/
|
|
22255
|
-
function differenceInMilliseconds(dateLeft, dateRight) {
|
|
22256
|
-
return +toDate(dateLeft) - +toDate(dateRight);
|
|
22257
|
-
}
|
|
22258
22322
|
|
|
22259
|
-
|
|
22260
|
-
|
|
22261
|
-
|
|
22323
|
+
function differenceInMilliseconds(dirtyDateLeft, dirtyDateRight) {
|
|
22324
|
+
requiredArgs(2, arguments);
|
|
22325
|
+
var dateLeft = toDate(dirtyDateLeft);
|
|
22326
|
+
var dateRight = toDate(dirtyDateRight);
|
|
22327
|
+
return dateLeft.getTime() - dateRight.getTime();
|
|
22328
|
+
}
|
|
22262
22329
|
|
|
22330
|
+
var MILLISECONDS_IN_MINUTE = 60000;
|
|
22263
22331
|
/**
|
|
22264
22332
|
* @name differenceInMinutes
|
|
22265
22333
|
* @category Minute Helpers
|
|
@@ -22268,34 +22336,36 @@ function differenceInMilliseconds(dateLeft, dateRight) {
|
|
|
22268
22336
|
* @description
|
|
22269
22337
|
* Get the signed number of full (rounded towards 0) minutes between the given dates.
|
|
22270
22338
|
*
|
|
22271
|
-
*
|
|
22339
|
+
* ### v2.0.0 breaking changes:
|
|
22272
22340
|
*
|
|
22273
|
-
*
|
|
22274
|
-
* @param dateRight - The earlier date
|
|
22275
|
-
* @param options - An object with options.
|
|
22341
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
22276
22342
|
*
|
|
22277
|
-
* @
|
|
22343
|
+
* @param {Date|Number} dateLeft - the later date
|
|
22344
|
+
* @param {Date|Number} dateRight - the earlier date
|
|
22345
|
+
* @returns {Number} the number of minutes
|
|
22346
|
+
* @throws {TypeError} 2 arguments required
|
|
22278
22347
|
*
|
|
22279
22348
|
* @example
|
|
22280
22349
|
* // How many minutes are between 2 July 2014 12:07:59 and 2 July 2014 12:20:00?
|
|
22281
|
-
*
|
|
22350
|
+
* var result = differenceInMinutes(
|
|
22282
22351
|
* new Date(2014, 6, 2, 12, 20, 0),
|
|
22283
22352
|
* new Date(2014, 6, 2, 12, 7, 59)
|
|
22284
22353
|
* )
|
|
22285
22354
|
* //=> 12
|
|
22286
22355
|
*
|
|
22287
22356
|
* @example
|
|
22288
|
-
* // How many minutes are
|
|
22289
|
-
*
|
|
22357
|
+
* // How many minutes are from 10:01:59 to 10:00:00
|
|
22358
|
+
* var result = differenceInMinutes(
|
|
22290
22359
|
* new Date(2000, 0, 1, 10, 0, 0),
|
|
22291
22360
|
* new Date(2000, 0, 1, 10, 1, 59)
|
|
22292
22361
|
* )
|
|
22293
22362
|
* //=> -1
|
|
22294
22363
|
*/
|
|
22295
|
-
|
|
22296
|
-
|
|
22297
|
-
|
|
22298
|
-
|
|
22364
|
+
|
|
22365
|
+
function differenceInMinutes(dirtyDateLeft, dirtyDateRight) {
|
|
22366
|
+
requiredArgs(2, arguments);
|
|
22367
|
+
var diff = differenceInMilliseconds(dirtyDateLeft, dirtyDateRight) / MILLISECONDS_IN_MINUTE;
|
|
22368
|
+
return diff > 0 ? Math.floor(diff) : Math.ceil(diff);
|
|
22299
22369
|
}
|
|
22300
22370
|
|
|
22301
22371
|
/**
|
|
@@ -22306,20 +22376,25 @@ function differenceInMinutes(dateLeft, dateRight, options) {
|
|
|
22306
22376
|
* @description
|
|
22307
22377
|
* Subtract the specified number of days from the given date.
|
|
22308
22378
|
*
|
|
22309
|
-
*
|
|
22379
|
+
* ### v2.0.0 breaking changes:
|
|
22310
22380
|
*
|
|
22311
|
-
*
|
|
22312
|
-
* @param amount - The amount of days to be subtracted.
|
|
22381
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
22313
22382
|
*
|
|
22314
|
-
* @
|
|
22383
|
+
* @param {Date|Number} date - the date to be changed
|
|
22384
|
+
* @param {Number} amount - the amount of days to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
|
|
22385
|
+
* @returns {Date} the new date with the days subtracted
|
|
22386
|
+
* @throws {TypeError} 2 arguments required
|
|
22315
22387
|
*
|
|
22316
22388
|
* @example
|
|
22317
22389
|
* // Subtract 10 days from 1 September 2014:
|
|
22318
|
-
*
|
|
22390
|
+
* var result = subDays(new Date(2014, 8, 1), 10)
|
|
22319
22391
|
* //=> Fri Aug 22 2014 00:00:00
|
|
22320
22392
|
*/
|
|
22321
|
-
|
|
22322
|
-
|
|
22393
|
+
|
|
22394
|
+
function subDays(dirtyDate, dirtyAmount) {
|
|
22395
|
+
requiredArgs(2, arguments);
|
|
22396
|
+
var amount = toInteger(dirtyAmount);
|
|
22397
|
+
return addDays(dirtyDate, -amount);
|
|
22323
22398
|
}
|
|
22324
22399
|
|
|
22325
22400
|
const WpOperationLockService = (props = {}) => applyDecorators(Injectable(), SetMetadata(EntityManagerSymbols.OperationLockService, {
|
|
@@ -34742,6 +34817,37 @@ class AppExceptionsFilterBase {
|
|
|
34742
34817
|
}
|
|
34743
34818
|
}
|
|
34744
34819
|
|
|
34820
|
+
class EntityParseValidationError {
|
|
34821
|
+
}
|
|
34822
|
+
__decorate([
|
|
34823
|
+
ApiProperty(),
|
|
34824
|
+
__metadata("design:type", String)
|
|
34825
|
+
], EntityParseValidationError.prototype, "errorCode", void 0);
|
|
34826
|
+
class EntityParseStatus {
|
|
34827
|
+
}
|
|
34828
|
+
__decorate([
|
|
34829
|
+
ApiProperty(),
|
|
34830
|
+
__metadata("design:type", Boolean)
|
|
34831
|
+
], EntityParseStatus.prototype, "isValid", void 0);
|
|
34832
|
+
__decorate([
|
|
34833
|
+
ApiProperty({ type: [EntityParseValidationError] }),
|
|
34834
|
+
__metadata("design:type", Array)
|
|
34835
|
+
], EntityParseStatus.prototype, "validationErrors", void 0);
|
|
34836
|
+
class EntityParseResult {
|
|
34837
|
+
}
|
|
34838
|
+
__decorate([
|
|
34839
|
+
ApiProperty(),
|
|
34840
|
+
__metadata("design:type", Number)
|
|
34841
|
+
], EntityParseResult.prototype, "rowIndex", void 0);
|
|
34842
|
+
__decorate([
|
|
34843
|
+
ApiProperty({ type: Object }),
|
|
34844
|
+
__metadata("design:type", Object)
|
|
34845
|
+
], EntityParseResult.prototype, "item", void 0);
|
|
34846
|
+
__decorate([
|
|
34847
|
+
ApiProperty(),
|
|
34848
|
+
__metadata("design:type", EntityParseStatus)
|
|
34849
|
+
], EntityParseResult.prototype, "status", void 0);
|
|
34850
|
+
|
|
34745
34851
|
const buildCompletedStepsSequence = (step) => {
|
|
34746
34852
|
const steps = [];
|
|
34747
34853
|
let currentStep = step;
|
|
@@ -44178,5 +44284,29 @@ InMemorySecretsProvider = __decorate([
|
|
|
44178
44284
|
WpSecretsProvider("inMemorySecretsManager")
|
|
44179
44285
|
], InMemorySecretsProvider);
|
|
44180
44286
|
|
|
44181
|
-
|
|
44287
|
+
class TestingAppSessionService {
|
|
44288
|
+
constructor() {
|
|
44289
|
+
this.values = new Map();
|
|
44290
|
+
}
|
|
44291
|
+
getValue(key) {
|
|
44292
|
+
return this.values.get(key);
|
|
44293
|
+
}
|
|
44294
|
+
setValue(key, value) {
|
|
44295
|
+
this.values.set(key, value);
|
|
44296
|
+
}
|
|
44297
|
+
clearValue(key) {
|
|
44298
|
+
this.values.set(key, undefined);
|
|
44299
|
+
}
|
|
44300
|
+
getRequest() {
|
|
44301
|
+
return this.values.get("request");
|
|
44302
|
+
}
|
|
44303
|
+
mockRequest(request) {
|
|
44304
|
+
this.values.set("request", request);
|
|
44305
|
+
}
|
|
44306
|
+
retrieveRequest() {
|
|
44307
|
+
return this.getRequest();
|
|
44308
|
+
}
|
|
44309
|
+
}
|
|
44310
|
+
|
|
44311
|
+
export { AUTHENTICATION_EVENTS_NAMESPACE, ApiKeyAccess, AppExceptionsFilterBase, AppHashingService, AppInMemorySettings, AppSession, AppSessionMiddleware, AppSessionService, AuthGuard, Authenticated, AuthenticationEmailTemplates, AuthenticationError, AuthenticationEvents, AuthenticationExtensionSymbols, AuthenticationModule, AuthenticationService, AwsBucketModule, AwsDynamoDbModule, AwsEmailModule, AwsJobsModule, AwsS3BucketError, AwsS3BucketProvider, AwsS3MediaError, AwsS3MediaModule, AwsS3MediaProvider, AwsSecretsModule, AwsSecretsProvider, AwsSesEmailTemplate, BucketItemType, CacheService, ConnectorMode, CurrentUser, CustomDiscoveryModule, CustomDiscoveryService, DynamoDbCacheInstance, DynamoDbCollection, EmailService, EntityManagerConfigurationError, EntityManagerException, EntityManagerInitializer, EntityManagerModule, EntityManagerRegistry, EntityManagerService, EntityManagerSymbols, EntityManagerUnauthorizedException, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, EntityParseResult, EntityParseValidationError, EntitySeeder, EntitySerializationFormat, EntitySerializer, EntitySnapshotService, EntityVersionOperation, EventsService, ExclusiveOperationResult, FilesManager, IEntityVersionsCursor, InMemoryBucketProvider, InMemoryEmailProvider, InMemoryFileProvider, InMemoryMediaProvider, InMemorySecretsProvider, InvalidCredentialsError, JobConcurrency, JobInstance, JobProviderState, JobRunType, JobSchedule, JobStatus, JobsModule, JobsService, LockNotFoundError, MediaLibraryService, MemberOf, MissingEntityIdError, ModulesContainerProvider, MultiTenancyModule, MultipleEntitiesFoundException, NestEntityActions, NestEntityAuthorizationMiddleware, NestEntityManager, NestEntitySerializer, NestEntitySnapshotService, NestPipelineTemplate, NestTypeOrmEntitySeeder, NestTypeOrmQueryBuilder, NestTypeOrmRepository, OperationLockService, OperationTokenMismatchError, PLATFORM_EVENT_NAMESPACE, Permissions, PipelineController, PipelineErrorType, PipelineInvocationError, PipelineStatus, PipelineStepErrorType, PipelinesBuilder, PipelinesRunner, PlatformEvents, Public, QueryBuilderBase, QueryBuilderOperation, ReplicationMode, Roles, SanityMediaError, SanityMediaModule, SanityMediaProvider, SecretsService, SendgridEmailModule, SendgridEmailTemplate, SortDirection, TestingAppSessionService, TrackingService, TypeOrmQueryBuilder, TypeOrmRepository, TypeormCacheInstance, TypeormOperationLockRepository, UserCreationError, UserRegistrationError, WpApiKeysService, WpAppInitializer, WpAwsSesEmailTemplate, WpBucketProvider, WpCacheInstance, WpEmailLogger, WpEmailProvider, WpEmailTemplate, WpEmailTemplateMiddleware, WpEntity, WpEntityActions, WpEntityAdapter, WpEntityAuthMiddleware, WpEntityConnector, WpEntityConnectorMapper, WpEntityConverter, WpEntityManager, WpEntityQueryBuilder, WpEntityRepository, WpEntitySeeder, WpEntitySerializer, WpEntitySnapshotService, WpEntityVersioningProvider, WpEventsTracker, WpFileProvider, WpFileReferenceRepository, WpGlobalAuthenticationMiddleware, WpMediaFolderRepository, WpMediaProvider, WpMediaReferenceRepository, WpPermissionsService, WpPipeline, WpRolesService, WpSendgridEmailTemplate, WpUserRolesService, WpUserService, awsBatchSettings, buildPermissionsGuard, buildProviderToken, buildRolesGuard, createContainer, createExpressFileResponse, getEntityManagerProviderToken, getLocalizedText, newUuid, renderHandlebarsTemplate, sessionStorage, toEntitiesImportInput };
|
|
44182
44312
|
//# sourceMappingURL=index.js.map
|