@acorex/connectivity 20.5.0-next.0 → 20.5.0-next.2
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.
|
@@ -3,7 +3,7 @@ import * as i2$1 from '@acorex/platform/auth';
|
|
|
3
3
|
import { AXPAuthStrategy, AXP_TENANT_LOADER, AXP_APPLICATION_LOADER, AXP_FEATURE_LOADER, AXP_PERMISSION_LOADER, AXPSessionService, AXPAuthModule } from '@acorex/platform/auth';
|
|
4
4
|
import * as i1$1 from '@acorex/platform/core';
|
|
5
5
|
import { AXPDataGenerator, AXPActivityLogProvider, AXP_ACTIVITY_LOG_PROVIDER, AXP_DATASOURCE_DEFINITION_PROVIDER, objectKeyValueTransforms, AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER, AXPSystemActionType, applySortArray, applyFilterArray, AXPExpressionEvaluatorService } from '@acorex/platform/core';
|
|
6
|
-
import { AXPEntityDefinitionRegistryService, AXPEntityStorageService, AXP_DATA_SEEDER_TOKEN, AXMEntityCrudServiceImpl, AXP_ENTITY_STORAGE_BACKEND, AXPMiddlewareAbortError,
|
|
6
|
+
import { AXPEntityDefinitionRegistryService, AXPEntityStorageService, AXP_DATA_SEEDER_TOKEN, AXMEntityCrudServiceImpl, AXP_ENTITY_STORAGE_BACKEND, AXPMiddlewareAbortError, AXP_ENTITY_STORAGE_MIDDLEWARE, eventDispatchMiddleware, AXPDataSeederService } from '@acorex/platform/layout/entity';
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
8
|
import { inject, Injectable, NgModule, Injector, runInInjectionContext } from '@angular/core';
|
|
9
9
|
import { AXMDeviceSessionsService, AXMSessionStatusTypes, AXMDeviceSessionsServiceImpl, AXM_AUTH_CONFIG_TOKEN } from '@acorex/modules/auth';
|
|
@@ -38464,6 +38464,55 @@ const createFileCastMiddleware = {
|
|
|
38464
38464
|
},
|
|
38465
38465
|
};
|
|
38466
38466
|
|
|
38467
|
+
const historyLoggerMiddleware = {
|
|
38468
|
+
target: { ops: ['create', 'update', 'delete'], order: 80 },
|
|
38469
|
+
execute: async (ctx, next) => {
|
|
38470
|
+
const sessionService = inject(AXPSessionService);
|
|
38471
|
+
const versioning = inject(VersioningService);
|
|
38472
|
+
// Capture previous for update/delete
|
|
38473
|
+
if (ctx.op === 'update' || ctx.op === 'delete') {
|
|
38474
|
+
try {
|
|
38475
|
+
ctx.previous = await ctx.backend.getOne(ctx.entityName, ctx.id);
|
|
38476
|
+
}
|
|
38477
|
+
catch { /* ignore */ }
|
|
38478
|
+
}
|
|
38479
|
+
await next();
|
|
38480
|
+
// Prepare versioning payload
|
|
38481
|
+
const entityType = ctx.entityName;
|
|
38482
|
+
const changedBy = sessionService.user?.id ?? 'system';
|
|
38483
|
+
if (ctx.op === 'create') {
|
|
38484
|
+
const createdId = String(ctx.result);
|
|
38485
|
+
const snapshot = { ...ctx.data, id: createdId };
|
|
38486
|
+
const changes = computeDiff(undefined, snapshot);
|
|
38487
|
+
await versioning.createVersion(entityType, createdId, snapshot, changes, {
|
|
38488
|
+
changeType: AXVChangeType.Create,
|
|
38489
|
+
changedBy,
|
|
38490
|
+
summary: 'Created',
|
|
38491
|
+
});
|
|
38492
|
+
}
|
|
38493
|
+
else if (ctx.op === 'update') {
|
|
38494
|
+
const referenceId = String(ctx.id);
|
|
38495
|
+
const snapshot = ctx.result;
|
|
38496
|
+
const changes = computeDiff(ctx.previous, snapshot);
|
|
38497
|
+
await versioning.createVersion(entityType, referenceId, snapshot, changes, {
|
|
38498
|
+
changeType: AXVChangeType.Update,
|
|
38499
|
+
changedBy,
|
|
38500
|
+
summary: 'Updated',
|
|
38501
|
+
});
|
|
38502
|
+
}
|
|
38503
|
+
else if (ctx.op === 'delete') {
|
|
38504
|
+
const referenceId = String(ctx.id);
|
|
38505
|
+
const snapshot = ctx.previous;
|
|
38506
|
+
const changes = computeDiff(snapshot, null);
|
|
38507
|
+
await versioning.createVersion(entityType, referenceId, snapshot, changes, {
|
|
38508
|
+
changeType: AXVChangeType.Delete,
|
|
38509
|
+
changedBy,
|
|
38510
|
+
summary: 'Deleted',
|
|
38511
|
+
});
|
|
38512
|
+
}
|
|
38513
|
+
},
|
|
38514
|
+
};
|
|
38515
|
+
|
|
38467
38516
|
const identifierCommitMiddleware = {
|
|
38468
38517
|
target: { ops: ['create'], order: 30 },
|
|
38469
38518
|
execute: async (ctx, next) => {
|
|
@@ -39317,55 +39366,6 @@ const primaryMiddleware = {
|
|
|
39317
39366
|
},
|
|
39318
39367
|
};
|
|
39319
39368
|
|
|
39320
|
-
const historyLoggerMiddleware = {
|
|
39321
|
-
target: { ops: ['create', 'update', 'delete'], order: 80 },
|
|
39322
|
-
execute: async (ctx, next) => {
|
|
39323
|
-
const sessionService = inject(AXPSessionService);
|
|
39324
|
-
const versioning = inject(VersioningService);
|
|
39325
|
-
// Capture previous for update/delete
|
|
39326
|
-
if (ctx.op === 'update' || ctx.op === 'delete') {
|
|
39327
|
-
try {
|
|
39328
|
-
ctx.previous = await ctx.backend.getOne(ctx.entityName, ctx.id);
|
|
39329
|
-
}
|
|
39330
|
-
catch { /* ignore */ }
|
|
39331
|
-
}
|
|
39332
|
-
await next();
|
|
39333
|
-
// Prepare versioning payload
|
|
39334
|
-
const entityType = ctx.entityName;
|
|
39335
|
-
const changedBy = sessionService.user?.id ?? 'system';
|
|
39336
|
-
if (ctx.op === 'create') {
|
|
39337
|
-
const createdId = String(ctx.result);
|
|
39338
|
-
const snapshot = { ...ctx.data, id: createdId };
|
|
39339
|
-
const changes = computeDiff(undefined, snapshot);
|
|
39340
|
-
await versioning.createVersion(entityType, createdId, snapshot, changes, {
|
|
39341
|
-
changeType: AXVChangeType.Create,
|
|
39342
|
-
changedBy,
|
|
39343
|
-
summary: 'Created',
|
|
39344
|
-
});
|
|
39345
|
-
}
|
|
39346
|
-
else if (ctx.op === 'update') {
|
|
39347
|
-
const referenceId = String(ctx.id);
|
|
39348
|
-
const snapshot = ctx.result;
|
|
39349
|
-
const changes = computeDiff(ctx.previous, snapshot);
|
|
39350
|
-
await versioning.createVersion(entityType, referenceId, snapshot, changes, {
|
|
39351
|
-
changeType: AXVChangeType.Update,
|
|
39352
|
-
changedBy,
|
|
39353
|
-
summary: 'Updated',
|
|
39354
|
-
});
|
|
39355
|
-
}
|
|
39356
|
-
else if (ctx.op === 'delete') {
|
|
39357
|
-
const referenceId = String(ctx.id);
|
|
39358
|
-
const snapshot = ctx.previous;
|
|
39359
|
-
const changes = computeDiff(snapshot, null);
|
|
39360
|
-
await versioning.createVersion(entityType, referenceId, snapshot, changes, {
|
|
39361
|
-
changeType: AXVChangeType.Delete,
|
|
39362
|
-
changedBy,
|
|
39363
|
-
summary: 'Deleted',
|
|
39364
|
-
});
|
|
39365
|
-
}
|
|
39366
|
-
},
|
|
39367
|
-
};
|
|
39368
|
-
|
|
39369
39369
|
/**
|
|
39370
39370
|
* Signature Loader Middleware
|
|
39371
39371
|
*
|
|
@@ -39455,8 +39455,6 @@ class AXCMiddlewaresModule {
|
|
|
39455
39455
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCMiddlewaresModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
39456
39456
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: AXCMiddlewaresModule }); }
|
|
39457
39457
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXCMiddlewaresModule, providers: [
|
|
39458
|
-
// Bind the middleware wrapper as the public storage service
|
|
39459
|
-
{ provide: AXPEntityStorageService, useClass: AXPMiddlewareEntityStorageService },
|
|
39460
39458
|
// Provide the concrete backend and middlewares
|
|
39461
39459
|
{ provide: AXP_ENTITY_STORAGE_BACKEND, useClass: AXCDexieEntityStorageService },
|
|
39462
39460
|
// Middlewares
|
|
@@ -39482,8 +39480,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImpor
|
|
|
39482
39480
|
exports: [],
|
|
39483
39481
|
declarations: [],
|
|
39484
39482
|
providers: [
|
|
39485
|
-
// Bind the middleware wrapper as the public storage service
|
|
39486
|
-
{ provide: AXPEntityStorageService, useClass: AXPMiddlewareEntityStorageService },
|
|
39487
39483
|
// Provide the concrete backend and middlewares
|
|
39488
39484
|
{ provide: AXP_ENTITY_STORAGE_BACKEND, useClass: AXCDexieEntityStorageService },
|
|
39489
39485
|
// Middlewares
|