@acorex/connectivity 21.0.0-next.13 → 21.0.0-next.15
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.
|
@@ -2,7 +2,7 @@ import { AXSafePipe } from '@acorex/core/pipes';
|
|
|
2
2
|
import * as i2$2 from '@acorex/platform/auth';
|
|
3
3
|
import { AXPSessionService, AXP_APPLICATION_LOADER, AXP_FEATURE_LOADER, AXP_PERMISSION_LOADER, AXP_TENANT_LOADER, AXP_PERMISSION_CHECKER, AXP_FEATURE_CHECKER, AXPLoginChallengeComponentBase, AXPLoginChallengeProvider, AXPAuthStrategy, AXPAuthModule, AXP_LOGIN_CHALLENGE_PROVIDER } from '@acorex/platform/auth';
|
|
4
4
|
import * as i1$2 from '@acorex/platform/core';
|
|
5
|
-
import { AXPDataGenerator, AXPIconLogoConfig, AXPModuleManifestRegistry, AXPActivityLogProvider, AXPExpressionEvaluatorService, AXP_ACTIVITY_LOG_PROVIDER, AXPDataSourceDefinitionProviderService, AXP_DATASOURCE_DEFINITION_PROVIDER, applySortArray, applyFilterArray, AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER } from '@acorex/platform/core';
|
|
5
|
+
import { AXPDataGenerator, AXPIconLogoConfig, AXPModuleManifestRegistry, AXPActivityLogProvider, AXPExpressionEvaluatorService, AXP_ACTIVITY_LOG_PROVIDER, AXPDataSourceDefinitionProviderService, AXPPlatformScope, AXP_DATASOURCE_DEFINITION_PROVIDER, applySortArray, applyFilterArray, AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER } from '@acorex/platform/core';
|
|
6
6
|
import { AXPEntityStorageService, AXP_DATA_SEEDER_TOKEN, AXP_ENTITY_STORAGE_BACKEND, AXPEntityService, AXMEntityCrudServiceImpl, AXPEntityDefinitionRegistryService, 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, signal, Component } from '@angular/core';
|
|
@@ -18,7 +18,7 @@ import { RootConfig as RootConfig$3 } from '@acorex/modules/locale-management';
|
|
|
18
18
|
import { AXMPermissionsKeys as AXMPermissionsKeys$1, AXMSubscriptionManagementSubscriptionEntityService, AXMSubscriptionManagementSubscriptionPlanItemEntityService, RootConfig as RootConfig$u } from '@acorex/modules/subscription-management';
|
|
19
19
|
import { AXPSecurityManagementPermissionKeys, RootConfig as RootConfig$5, AXMUsersEntityService, AXMPolicyService } from '@acorex/modules/security-management';
|
|
20
20
|
import { AXMTenantManagementPermissionsKeys, AXMTenantService, AXMTenantManagementTenantUserEntityService, RootConfig as RootConfig$x } from '@acorex/modules/tenant-management';
|
|
21
|
-
import { AXMPermissionsKeys as AXMPermissionsKeys$3, AXMFolderServiceImpl, AXMDocumentServiceImpl, AXMDocumentTypeServiceImpl, RootConfig as RootConfig$d,
|
|
21
|
+
import { AXMPermissionsKeys as AXMPermissionsKeys$3, AXMFolderServiceImpl, AXMDocumentServiceImpl, AXMFolderService, AXMDocumentTypeServiceImpl, RootConfig as RootConfig$d, AXMDocumentService, AXPDocumentManagementService } from '@acorex/modules/document-management';
|
|
22
22
|
import { AXMSettingsManagementPermissionKeys } from '@acorex/modules/settings-management';
|
|
23
23
|
import { RootConfig as RootConfig$6 } from '@acorex/modules/business-core';
|
|
24
24
|
import { RootConfig as RootConfig$7 } from '@acorex/modules/calendar-management';
|
|
@@ -33754,7 +33754,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
33754
33754
|
type: Injectable
|
|
33755
33755
|
}] });
|
|
33756
33756
|
|
|
33757
|
+
/**
|
|
33758
|
+
* Mock folder service. Backend sets ownershipInfo (tenant/user) from request context when not provided on insert.
|
|
33759
|
+
*/
|
|
33757
33760
|
class AXCFolderMockService extends AXMFolderServiceImpl {
|
|
33761
|
+
constructor() {
|
|
33762
|
+
super(...arguments);
|
|
33763
|
+
this.sessionService = inject(AXPSessionService);
|
|
33764
|
+
}
|
|
33758
33765
|
async updateParentFolders(folder) {
|
|
33759
33766
|
if (folder.parentId) {
|
|
33760
33767
|
const parent = await this.getOne(folder.parentId);
|
|
@@ -33788,16 +33795,36 @@ class AXCFolderMockService extends AXMFolderServiceImpl {
|
|
|
33788
33795
|
// Set default value for inherit if not provided
|
|
33789
33796
|
const requestWithInherit = {
|
|
33790
33797
|
...request,
|
|
33791
|
-
inherit: request.inherit !== undefined ? request.inherit : 'Extends'
|
|
33798
|
+
inherit: request.inherit !== undefined ? request.inherit : 'Extends',
|
|
33792
33799
|
};
|
|
33793
|
-
|
|
33800
|
+
// Backend sets ownershipInfo from request context when not provided (security: client does not send tenant/user)
|
|
33801
|
+
const requestWithOwnership = this.enrichOwnershipFromContext(requestWithInherit);
|
|
33802
|
+
const newId = await super.insertOne(requestWithOwnership);
|
|
33794
33803
|
const folderData = {
|
|
33795
|
-
...
|
|
33804
|
+
...requestWithOwnership,
|
|
33796
33805
|
id: newId,
|
|
33797
33806
|
};
|
|
33798
33807
|
await this.updateParentFolders(folderData);
|
|
33799
33808
|
return newId;
|
|
33800
33809
|
}
|
|
33810
|
+
/**
|
|
33811
|
+
* Enriches request with ownershipInfo from current session when not provided (backend resolves tenant/user).
|
|
33812
|
+
*/
|
|
33813
|
+
enrichOwnershipFromContext(request) {
|
|
33814
|
+
const existing = request.ownershipInfo;
|
|
33815
|
+
const tenantId = this.sessionService.tenant?.id ?? existing?.tenantId;
|
|
33816
|
+
const userId = this.sessionService.user?.id ?? existing?.userId;
|
|
33817
|
+
if (tenantId == null && userId == null)
|
|
33818
|
+
return request;
|
|
33819
|
+
return {
|
|
33820
|
+
...request,
|
|
33821
|
+
ownershipInfo: {
|
|
33822
|
+
...existing,
|
|
33823
|
+
tenantId: existing?.tenantId ?? tenantId,
|
|
33824
|
+
userId: existing?.userId ?? userId,
|
|
33825
|
+
},
|
|
33826
|
+
};
|
|
33827
|
+
}
|
|
33801
33828
|
async updateOne(id, values) {
|
|
33802
33829
|
const currentFolder = await this.getOne(id);
|
|
33803
33830
|
const updatedFolder = await super.updateOne(id, values);
|
|
@@ -33989,14 +34016,129 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
33989
34016
|
type: Injectable
|
|
33990
34017
|
}], ctorParameters: () => [] });
|
|
33991
34018
|
|
|
34019
|
+
/**
|
|
34020
|
+
* Mock document management service.
|
|
34021
|
+
* getRoot(scope) is handled by the backend: only scope is sent; tenant/user are resolved from request context (session in mock).
|
|
34022
|
+
*/
|
|
33992
34023
|
class AXCDocumentManagementService {
|
|
33993
34024
|
constructor() {
|
|
33994
|
-
|
|
33995
|
-
|
|
33996
|
-
this.folderService = new AXCFolderMockService();
|
|
34025
|
+
this.folderService = inject(AXMFolderService);
|
|
34026
|
+
this.sessionService = inject(AXPSessionService);
|
|
33997
34027
|
this.documentService = new AXMFileMockService();
|
|
33998
34028
|
this.documentTypeService = new AXMDocumentTypeServiceImpl();
|
|
33999
34029
|
}
|
|
34030
|
+
//#region ---- Root (backend resolves tenant/user from context) ----
|
|
34031
|
+
async getRoot(scope) {
|
|
34032
|
+
const tenantId = this.sessionService.tenant?.id;
|
|
34033
|
+
const userId = this.sessionService.user?.id;
|
|
34034
|
+
const rootFolder = await this.getPlatformRootFolder();
|
|
34035
|
+
switch (scope) {
|
|
34036
|
+
case AXPPlatformScope.Platform:
|
|
34037
|
+
return rootFolder;
|
|
34038
|
+
case AXPPlatformScope.Tenant:
|
|
34039
|
+
if (!tenantId)
|
|
34040
|
+
throw new Error('Tenant scope requires current session tenant');
|
|
34041
|
+
return this.getTenantRootFolder(rootFolder, tenantId);
|
|
34042
|
+
case AXPPlatformScope.User:
|
|
34043
|
+
if (!tenantId || !userId)
|
|
34044
|
+
throw new Error('User scope requires current session tenant and user');
|
|
34045
|
+
const tenantRoot = await this.getTenantRootFolder(rootFolder, tenantId);
|
|
34046
|
+
const usersFolderId = await this.getUsersFolderId(tenantRoot.id);
|
|
34047
|
+
return this.getUserRootFolder(usersFolderId, tenantId, userId);
|
|
34048
|
+
default:
|
|
34049
|
+
throw new Error(`Invalid scope: ${scope}`);
|
|
34050
|
+
}
|
|
34051
|
+
}
|
|
34052
|
+
async getPlatformRootFolder() {
|
|
34053
|
+
const result = await this.folderService.query({
|
|
34054
|
+
skip: 0,
|
|
34055
|
+
take: 1,
|
|
34056
|
+
filter: {
|
|
34057
|
+
operator: null,
|
|
34058
|
+
logic: 'and',
|
|
34059
|
+
filters: [
|
|
34060
|
+
{ field: 'parentId', operator: { type: 'isNull' } },
|
|
34061
|
+
{ field: 'ownershipInfo.tenantId', operator: { type: 'isNull' } },
|
|
34062
|
+
{ field: 'ownershipInfo.userId', operator: { type: 'isNull' } },
|
|
34063
|
+
],
|
|
34064
|
+
},
|
|
34065
|
+
});
|
|
34066
|
+
if (result.items.length === 0)
|
|
34067
|
+
throw new Error('Platform root folder not found');
|
|
34068
|
+
return result.items[0];
|
|
34069
|
+
}
|
|
34070
|
+
async getTenantRootFolder(rootFolder, tenantId) {
|
|
34071
|
+
const tenantsFolderId = await this.getTenantsFolderId(rootFolder.id);
|
|
34072
|
+
const result = await this.folderService.query({
|
|
34073
|
+
skip: 0,
|
|
34074
|
+
take: 1,
|
|
34075
|
+
filter: {
|
|
34076
|
+
operator: null,
|
|
34077
|
+
logic: 'and',
|
|
34078
|
+
filters: [
|
|
34079
|
+
{ field: 'parentId', operator: { type: 'equal' }, value: tenantsFolderId },
|
|
34080
|
+
{ field: 'ownershipInfo.tenantId', operator: { type: 'equal' }, value: tenantId },
|
|
34081
|
+
{ field: 'ownershipInfo.userId', operator: { type: 'isNull' } },
|
|
34082
|
+
],
|
|
34083
|
+
},
|
|
34084
|
+
});
|
|
34085
|
+
if (result.items.length === 0)
|
|
34086
|
+
throw new Error('Tenant root folder not found');
|
|
34087
|
+
return result.items[0];
|
|
34088
|
+
}
|
|
34089
|
+
async getTenantsFolderId(platformRootId) {
|
|
34090
|
+
const list = await this.folderService.query({
|
|
34091
|
+
skip: 0,
|
|
34092
|
+
take: 50,
|
|
34093
|
+
filter: {
|
|
34094
|
+
operator: null,
|
|
34095
|
+
logic: 'and',
|
|
34096
|
+
filters: [
|
|
34097
|
+
{ field: 'parentId', operator: { type: 'equal' }, value: platformRootId },
|
|
34098
|
+
{ field: 'title', operator: { type: 'equal' }, value: 'Tenants' },
|
|
34099
|
+
],
|
|
34100
|
+
},
|
|
34101
|
+
});
|
|
34102
|
+
if (list.items.length === 0)
|
|
34103
|
+
throw new Error('Tenants folder not found under platform root');
|
|
34104
|
+
return list.items[0].id;
|
|
34105
|
+
}
|
|
34106
|
+
async getUserRootFolder(tenantFolderId, tenantId, userId) {
|
|
34107
|
+
const result = await this.folderService.query({
|
|
34108
|
+
skip: 0,
|
|
34109
|
+
take: 1,
|
|
34110
|
+
filter: {
|
|
34111
|
+
operator: null,
|
|
34112
|
+
logic: 'and',
|
|
34113
|
+
filters: [
|
|
34114
|
+
{ field: 'parentId', operator: { type: 'equal' }, value: tenantFolderId },
|
|
34115
|
+
{ field: 'ownershipInfo.tenantId', operator: { type: 'equal' }, value: tenantId },
|
|
34116
|
+
{ field: 'ownershipInfo.userId', operator: { type: 'equal' }, value: userId },
|
|
34117
|
+
],
|
|
34118
|
+
},
|
|
34119
|
+
});
|
|
34120
|
+
if (result.items.length === 0)
|
|
34121
|
+
throw new Error('User root folder not found');
|
|
34122
|
+
return result.items[0];
|
|
34123
|
+
}
|
|
34124
|
+
async getUsersFolderId(tenantRootFolderId) {
|
|
34125
|
+
const list = await this.folderService.query({
|
|
34126
|
+
skip: 0,
|
|
34127
|
+
take: 50,
|
|
34128
|
+
filter: {
|
|
34129
|
+
operator: null,
|
|
34130
|
+
logic: 'and',
|
|
34131
|
+
filters: [
|
|
34132
|
+
{ field: 'parentId', operator: { type: 'equal' }, value: tenantRootFolderId },
|
|
34133
|
+
{ field: 'title', operator: { type: 'equal' }, value: 'Users' },
|
|
34134
|
+
],
|
|
34135
|
+
},
|
|
34136
|
+
});
|
|
34137
|
+
if (list.items.length === 0)
|
|
34138
|
+
throw new Error('Users folder not found under tenant root');
|
|
34139
|
+
return list.items[0].id;
|
|
34140
|
+
}
|
|
34141
|
+
//#endregion
|
|
34000
34142
|
//#region ---- Document Methods ----
|
|
34001
34143
|
async getDocumentPath(documentId, stopFolderId) {
|
|
34002
34144
|
const file = await this.documentService.getOne(documentId);
|
|
@@ -34131,7 +34273,7 @@ class AXCDocumentManagementService {
|
|
|
34131
34273
|
}
|
|
34132
34274
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXCDocumentManagementService, decorators: [{
|
|
34133
34275
|
type: Injectable
|
|
34134
|
-
}]
|
|
34276
|
+
}] });
|
|
34135
34277
|
|
|
34136
34278
|
const DOCUMENT_TYPES = [
|
|
34137
34279
|
{
|