@acorex-platform/module-integration-management-client 0.0.21
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/fesm2022/acorex-platform-module-integration-management-client-connect-with-credentials.command-DO_zqjHV.mjs +102 -0
- package/fesm2022/acorex-platform-module-integration-management-client-connect-with-credentials.command-DO_zqjHV.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-integration-management-client-contracts.mjs +163 -0
- package/fesm2022/acorex-platform-module-integration-management-client-contracts.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-integration-management-client-delete-connection.command-DQ_kn8dH.mjs +53 -0
- package/fesm2022/acorex-platform-module-integration-management-client-delete-connection.command-DQ_kn8dH.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-integration-management-client-disconnect-connection.command-B4HeDA1n.mjs +60 -0
- package/fesm2022/acorex-platform-module-integration-management-client-disconnect-connection.command-B4HeDA1n.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-integration-management-client-get-provider.query-Ds10RwnU.mjs +30 -0
- package/fesm2022/acorex-platform-module-integration-management-client-get-provider.query-Ds10RwnU.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-integration-management-client-integration-connection-lifecycle.dispatcher-DRWR9ysx.mjs +45 -0
- package/fesm2022/acorex-platform-module-integration-management-client-integration-connection-lifecycle.dispatcher-DRWR9ysx.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-integration-management-client-integration-oauth-callback-page.component-XhloXUsZ.mjs +176 -0
- package/fesm2022/acorex-platform-module-integration-management-client-integration-oauth-callback-page.component-XhloXUsZ.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-integration-management-client-integrations-page.component-Q-SHidYA.mjs +406 -0
- package/fesm2022/acorex-platform-module-integration-management-client-integrations-page.component-Q-SHidYA.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-integration-management-client-list-domains.query--GGD6J46.mjs +52 -0
- package/fesm2022/acorex-platform-module-integration-management-client-list-domains.query--GGD6J46.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-integration-management-client-list-my-connections.query-CmHu1qFm.mjs +27 -0
- package/fesm2022/acorex-platform-module-integration-management-client-list-my-connections.query-CmHu1qFm.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-integration-management-client-list-providers.query-ODKJ_UhI.mjs +65 -0
- package/fesm2022/acorex-platform-module-integration-management-client-list-providers.query-ODKJ_UhI.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-integration-management-client-update-connection.command-BNMR-t12.mjs +42 -0
- package/fesm2022/acorex-platform-module-integration-management-client-update-connection.command-BNMR-t12.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-integration-management-client-validate-connection.command-CGtb_GPX.mjs +83 -0
- package/fesm2022/acorex-platform-module-integration-management-client-validate-connection.command-CGtb_GPX.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-integration-management-client.mjs +776 -0
- package/fesm2022/acorex-platform-module-integration-management-client.mjs.map +1 -0
- package/package.json +28 -0
- package/types/acorex-platform-module-integration-management-client-contracts.d.ts +191 -0
- package/types/acorex-platform-module-integration-management-client.d.ts +74 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { AXP_INTEGRATION_CONNECTION_STATUS, AXP_INTEGRATION_AUTH_METHOD_TYPE } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import { AXP_INTEGRATION_CONNECTION_ESTABLISHED, AXP_INTEGRATION_SECRET_STORE } from '@acorex-platform/framework-client/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, Injectable } from '@angular/core';
|
|
5
|
+
import { defaultTo, trim, get } from 'lodash';
|
|
6
|
+
import { AXMIntegrationConnectionManager, toSafeIntegrationConnectionDto } from './acorex-platform-module-integration-management-client.mjs';
|
|
7
|
+
|
|
8
|
+
//#region ---- Imports ----
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region ---- Service ----
|
|
11
|
+
class AXMIntegrationConnectionEstablishedDispatcher {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.handlers = inject(AXP_INTEGRATION_CONNECTION_ESTABLISHED, { optional: true });
|
|
14
|
+
}
|
|
15
|
+
async dispatch(connection) {
|
|
16
|
+
const list = this.handlers ?? [];
|
|
17
|
+
for (const handler of list) {
|
|
18
|
+
const resolved = handler instanceof Promise ? await handler : handler;
|
|
19
|
+
if (resolved.providerId === connection.providerId) {
|
|
20
|
+
await resolved.onEstablished(connection);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMIntegrationConnectionEstablishedDispatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
25
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMIntegrationConnectionEstablishedDispatcher, providedIn: 'root' }); }
|
|
26
|
+
}
|
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMIntegrationConnectionEstablishedDispatcher, decorators: [{
|
|
28
|
+
type: Injectable,
|
|
29
|
+
args: [{ providedIn: 'root' }]
|
|
30
|
+
}] });
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
class ConnectWithCredentialsCommand {
|
|
34
|
+
constructor() {
|
|
35
|
+
this.connectionManager = inject(AXMIntegrationConnectionManager);
|
|
36
|
+
this.secretStore = inject(AXP_INTEGRATION_SECRET_STORE);
|
|
37
|
+
this.establishedDispatcher = inject(AXMIntegrationConnectionEstablishedDispatcher);
|
|
38
|
+
}
|
|
39
|
+
async execute(input) {
|
|
40
|
+
try {
|
|
41
|
+
const { tenantId, userId } = this.connectionManager.getSessionContext();
|
|
42
|
+
const connectionScope = input.connectionScope ?? 'user';
|
|
43
|
+
const connectionKey = defaultTo(trim(input.connectionKey), 'default');
|
|
44
|
+
const displayName = defaultTo(trim(input.displayName), input.providerId);
|
|
45
|
+
const connection = await this.connectionManager.upsertConnection({
|
|
46
|
+
providerId: input.providerId,
|
|
47
|
+
connectionScope,
|
|
48
|
+
connectionKey,
|
|
49
|
+
displayName,
|
|
50
|
+
authMethodType: input.authMethodType,
|
|
51
|
+
instanceUrl: input.instanceUrl,
|
|
52
|
+
config: input.config,
|
|
53
|
+
status: AXP_INTEGRATION_CONNECTION_STATUS.Connected,
|
|
54
|
+
isRevoked: false,
|
|
55
|
+
isDisabled: false,
|
|
56
|
+
});
|
|
57
|
+
const secretPayload = this.buildSecretPayload(input.authMethodType, input.credentials);
|
|
58
|
+
const secretRef = await this.secretStore.store({
|
|
59
|
+
providerId: input.providerId,
|
|
60
|
+
connectionId: connection.id,
|
|
61
|
+
tenantId,
|
|
62
|
+
userId,
|
|
63
|
+
authMethodType: input.authMethodType,
|
|
64
|
+
}, secretPayload);
|
|
65
|
+
const updated = await this.connectionManager.updateConnection(connection.id, { secretRef });
|
|
66
|
+
const safe = toSafeIntegrationConnectionDto(updated);
|
|
67
|
+
await this.establishedDispatcher.dispatch(safe);
|
|
68
|
+
return { success: true, kind: 'object', data: safe };
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
const message = error instanceof Error ? error.message : 'Failed to connect integration.';
|
|
72
|
+
return { success: false, message: { text: message } };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
buildSecretPayload(authMethodType, credentials) {
|
|
76
|
+
switch (authMethodType) {
|
|
77
|
+
case AXP_INTEGRATION_AUTH_METHOD_TYPE.Pat:
|
|
78
|
+
return { token: get(credentials, 'token', '') };
|
|
79
|
+
case AXP_INTEGRATION_AUTH_METHOD_TYPE.Basic:
|
|
80
|
+
return {
|
|
81
|
+
username: get(credentials, 'username', ''),
|
|
82
|
+
password: get(credentials, 'password', ''),
|
|
83
|
+
};
|
|
84
|
+
case AXP_INTEGRATION_AUTH_METHOD_TYPE.ApiToken:
|
|
85
|
+
return {
|
|
86
|
+
email: get(credentials, 'email', ''),
|
|
87
|
+
apiToken: get(credentials, 'apiToken', ''),
|
|
88
|
+
};
|
|
89
|
+
default:
|
|
90
|
+
throw new Error(`Auth method '${authMethodType}' is not supported for credential connect.`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ConnectWithCredentialsCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
94
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ConnectWithCredentialsCommand, providedIn: 'root' }); }
|
|
95
|
+
}
|
|
96
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ConnectWithCredentialsCommand, decorators: [{
|
|
97
|
+
type: Injectable,
|
|
98
|
+
args: [{ providedIn: 'root' }]
|
|
99
|
+
}] });
|
|
100
|
+
|
|
101
|
+
export { ConnectWithCredentialsCommand };
|
|
102
|
+
//# sourceMappingURL=acorex-platform-module-integration-management-client-connect-with-credentials.command-DO_zqjHV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-integration-management-client-connect-with-credentials.command-DO_zqjHV.mjs","sources":["../../../../libs/modules/integration-management/client/src/lib/features/shared/integration-connection-established.dispatcher.ts","../../../../libs/modules/integration-management/client/src/lib/features/commands/connect-with-credentials.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { Injectable, inject } from '@angular/core';\nimport { AXP_INTEGRATION_CONNECTION_ESTABLISHED } from '@acorex-platform/framework-client/common';\nimport type { AXPSafeIntegrationConnectionDto } from '@acorex-platform/framework-shared/core';\n\n//#endregion\n\n//#region ---- Service ----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMIntegrationConnectionEstablishedDispatcher {\n private readonly handlers = inject(AXP_INTEGRATION_CONNECTION_ESTABLISHED, { optional: true });\n\n async dispatch(connection: AXPSafeIntegrationConnectionDto): Promise<void> {\n const list = this.handlers ?? [];\n for (const handler of list) {\n const resolved = handler instanceof Promise ? await handler : handler;\n if (resolved.providerId === connection.providerId) {\n await resolved.onEstablished(connection);\n }\n }\n }\n}\n\n//#endregion\n","\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXP_INTEGRATION_AUTH_METHOD_TYPE, AXP_INTEGRATION_CONNECTION_STATUS, type AXPRuntimeCommandResult, type AXPIntegrationAuthMethodType, type AXPIntegrationConnectionScope, type AXPIntegrationSecretPayload, type AXPSafeIntegrationConnectionDto } from '@acorex-platform/framework-shared/core';\nimport { AXP_INTEGRATION_SECRET_STORE } from '@acorex-platform/framework-client/common';\n\nimport { Injectable, inject } from '@angular/core';\nimport { defaultTo, get, trim } from 'lodash';\nimport {\n AXMIntegrationConnectionManager,\n toSafeIntegrationConnectionDto,\n} from '../shared/integration-connection.manager';\nimport { AXMIntegrationConnectionEstablishedDispatcher } from '../shared/integration-connection-established.dispatcher';\n\n//#region ---- Types ----\n\nexport interface ConnectWithCredentialsCommandInput {\n providerId: string;\n authMethodType: AXPIntegrationAuthMethodType;\n connectionScope?: AXPIntegrationConnectionScope;\n connectionKey?: string;\n displayName?: string;\n instanceUrl?: string;\n config?: Record<string, unknown>;\n credentials: Record<string, string>;\n}\n\n//#endregion\n\n@Injectable({ providedIn: 'root' })\nexport class ConnectWithCredentialsCommand\n implements AXPCommand<ConnectWithCredentialsCommandInput, AXPSafeIntegrationConnectionDto>\n{\n private readonly connectionManager = inject(AXMIntegrationConnectionManager);\n private readonly secretStore = inject(AXP_INTEGRATION_SECRET_STORE);\n private readonly establishedDispatcher = inject(AXMIntegrationConnectionEstablishedDispatcher);\n\n async execute(\n input: ConnectWithCredentialsCommandInput,\n ): AXPCommandExecuteResultPromise<AXPSafeIntegrationConnectionDto> {\n try {\n const { tenantId, userId } = this.connectionManager.getSessionContext();\n const connectionScope = input.connectionScope ?? 'user';\n const connectionKey = defaultTo(trim(input.connectionKey), 'default');\n const displayName = defaultTo(trim(input.displayName), input.providerId);\n\n const connection = await this.connectionManager.upsertConnection({\n providerId: input.providerId,\n connectionScope,\n connectionKey,\n displayName,\n authMethodType: input.authMethodType,\n instanceUrl: input.instanceUrl,\n config: input.config,\n status: AXP_INTEGRATION_CONNECTION_STATUS.Connected,\n isRevoked: false,\n isDisabled: false,\n });\n\n const secretPayload = this.buildSecretPayload(input.authMethodType, input.credentials);\n const secretRef = await this.secretStore.store(\n {\n providerId: input.providerId,\n connectionId: connection.id,\n tenantId,\n userId,\n authMethodType: input.authMethodType,\n },\n secretPayload,\n );\n\n const updated = await this.connectionManager.updateConnection(connection.id, { secretRef });\n const safe = toSafeIntegrationConnectionDto(updated);\n await this.establishedDispatcher.dispatch(safe);\n return { success: true, kind: 'object', data: safe };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to connect integration.';\n return { success: false, message: { text: message } };\n }\n }\n\n private buildSecretPayload(\n authMethodType: AXPIntegrationAuthMethodType,\n credentials: Record<string, string>,\n ): AXPIntegrationSecretPayload {\n switch (authMethodType) {\n case AXP_INTEGRATION_AUTH_METHOD_TYPE.Pat:\n return { token: get(credentials, 'token', '') };\n case AXP_INTEGRATION_AUTH_METHOD_TYPE.Basic:\n return {\n username: get(credentials, 'username', ''),\n password: get(credentials, 'password', ''),\n };\n case AXP_INTEGRATION_AUTH_METHOD_TYPE.ApiToken:\n return {\n email: get(credentials, 'email', ''),\n apiToken: get(credentials, 'apiToken', ''),\n };\n default:\n throw new Error(`Auth method '${authMethodType}' is not supported for credential connect.`);\n }\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAAA;AAMA;AAEA;MAGa,6CAA6C,CAAA;AAD1D,IAAA,WAAA,GAAA;QAEmB,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,sCAAsC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;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AAA,CAAA;;2FACnB,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBADzC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
//#region ---- Module Config ----
|
|
2
|
+
const config = {
|
|
3
|
+
i18n: 'integration-management',
|
|
4
|
+
module: 'IntegrationManagement',
|
|
5
|
+
route: 'integration-management',
|
|
6
|
+
};
|
|
7
|
+
const RootConfig = {
|
|
8
|
+
config,
|
|
9
|
+
module: {
|
|
10
|
+
name: config.module,
|
|
11
|
+
route: config.route,
|
|
12
|
+
title: `@${config.i18n}:module.title`,
|
|
13
|
+
icon: 'fa-light fa-plug',
|
|
14
|
+
},
|
|
15
|
+
entities: {
|
|
16
|
+
integrationConnection: {
|
|
17
|
+
name: 'IntegrationConnection',
|
|
18
|
+
source: `${config.module}.IntegrationConnection`,
|
|
19
|
+
title: `@${config.i18n}:connections.entities.connection.title`,
|
|
20
|
+
titlePlural: `@${config.i18n}:connections.entities.connection.plural`,
|
|
21
|
+
icon: 'fa-light fa-link',
|
|
22
|
+
},
|
|
23
|
+
integrationOAuthState: {
|
|
24
|
+
name: 'IntegrationOAuthState',
|
|
25
|
+
source: `${config.module}.IntegrationOAuthState`,
|
|
26
|
+
title: `@${config.i18n}:oauth-states.entities.oauth-state.title`,
|
|
27
|
+
titlePlural: `@${config.i18n}:oauth-states.entities.oauth-state.plural`,
|
|
28
|
+
icon: 'fa-light fa-key',
|
|
29
|
+
},
|
|
30
|
+
integrationApplication: {
|
|
31
|
+
name: 'IntegrationApplication',
|
|
32
|
+
source: `${config.module}.IntegrationApplication`,
|
|
33
|
+
title: `@${config.i18n}:applications.entities.application.title`,
|
|
34
|
+
titlePlural: `@${config.i18n}:applications.entities.application.plural`,
|
|
35
|
+
icon: 'fa-light fa-shield-keyhole',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
queries: {
|
|
39
|
+
dashboard: {
|
|
40
|
+
integrationsDonut: `${config.module}:Dashboard:IntegrationsDonut`,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Administration capabilities used by this module.
|
|
48
|
+
* Domain capability keys for this module. Root groups live in `AXPCommonPermissionGroupKeys` (common contracts).
|
|
49
|
+
*/
|
|
50
|
+
const AXPAdministrationPermissionKeys = {
|
|
51
|
+
Access: 'Administration:Permission:Access',
|
|
52
|
+
MaintainUsersAndRoles: 'Administration:Permission:MaintainUsersAndRoles',
|
|
53
|
+
ManageSessions: 'Administration:Permission:ManageSessions',
|
|
54
|
+
MaintainPolicies: 'Administration:Permission:MaintainPolicies',
|
|
55
|
+
ViewIntegrations: 'Administration:Permission:ViewIntegrations',
|
|
56
|
+
MaintainConnections: 'Administration:Permission:MaintainConnections',
|
|
57
|
+
ManageIntegrationActions: 'Administration:Permission:ManageIntegrationActions',
|
|
58
|
+
MaintainWorkflows: 'Administration:Permission:MaintainWorkflows',
|
|
59
|
+
ManageWorkflowActions: 'Administration:Permission:ManageWorkflowActions',
|
|
60
|
+
ViewRules: 'Administration:Permission:ViewRules',
|
|
61
|
+
MaintainRules: 'Administration:Permission:MaintainRules',
|
|
62
|
+
ManageRuleActions: 'Administration:Permission:ManageRuleActions',
|
|
63
|
+
MaintainAi: 'Administration:Permission:MaintainAi',
|
|
64
|
+
UseAiAssist: 'Administration:Permission:UseAiAssist',
|
|
65
|
+
MaintainDashboards: 'Administration:Permission:MaintainDashboards',
|
|
66
|
+
ViewJobs: 'Administration:Permission:ViewJobs',
|
|
67
|
+
ManageJobActions: 'Administration:Permission:ManageJobActions',
|
|
68
|
+
ViewObservability: 'Administration:Permission:ViewObservability',
|
|
69
|
+
MaintainObservability: 'Administration:Permission:MaintainObservability',
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated Prefer {@link AXPAdministrationPermissionKeys}.
|
|
73
|
+
* Legacy nested shape kept so existing imports compile during migration.
|
|
74
|
+
*/
|
|
75
|
+
const AXMIntegrationManagementPermissionKeys = {
|
|
76
|
+
Provider: {
|
|
77
|
+
View: AXPAdministrationPermissionKeys.ViewIntegrations,
|
|
78
|
+
},
|
|
79
|
+
Connection: {
|
|
80
|
+
View: AXPAdministrationPermissionKeys.ViewIntegrations,
|
|
81
|
+
Management: AXPAdministrationPermissionKeys.MaintainConnections,
|
|
82
|
+
},
|
|
83
|
+
TenantConnection: {
|
|
84
|
+
Management: AXPAdministrationPermissionKeys.MaintainConnections,
|
|
85
|
+
},
|
|
86
|
+
Application: {
|
|
87
|
+
Management: AXPAdministrationPermissionKeys.MaintainConnections,
|
|
88
|
+
},
|
|
89
|
+
ConnectionHealth: {
|
|
90
|
+
View: AXPAdministrationPermissionKeys.ViewIntegrations,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
//#region ---- Command Keys ----
|
|
95
|
+
const AXMIntegrationManagementCommandKeys = {
|
|
96
|
+
ConnectionConnectWithCredentials: 'IntegrationManagement.Connection:ConnectWithCredentials',
|
|
97
|
+
ConnectionRefreshAuthorization: 'IntegrationManagement.Connection:RefreshAuthorization',
|
|
98
|
+
ConnectionValidate: 'IntegrationManagement.Connection:Validate',
|
|
99
|
+
ConnectionUpdate: 'IntegrationManagement.Connection:Update',
|
|
100
|
+
ConnectionDisconnect: 'IntegrationManagement.Connection:Disconnect',
|
|
101
|
+
ConnectionRevoke: 'IntegrationManagement.Connection:Revoke',
|
|
102
|
+
ConnectionDelete: 'IntegrationManagement.Connection:Delete',
|
|
103
|
+
ApplicationUpsert: 'IntegrationManagement.Application:Upsert',
|
|
104
|
+
};
|
|
105
|
+
//#endregion
|
|
106
|
+
|
|
107
|
+
//#region ---- Query Keys ----
|
|
108
|
+
const AXMIntegrationManagementQueryKeys = {
|
|
109
|
+
DomainList: 'IntegrationManagement.Domain:List',
|
|
110
|
+
ProviderList: 'IntegrationManagement.Provider:List',
|
|
111
|
+
ProviderGet: 'IntegrationManagement.Provider:Get',
|
|
112
|
+
ConnectionListMine: 'IntegrationManagement.Connection:ListMine',
|
|
113
|
+
ConnectionGetStatus: 'IntegrationManagement.Connection:GetStatus',
|
|
114
|
+
ConnectionGetAuthMethods: 'IntegrationManagement.Connection:GetAuthMethods',
|
|
115
|
+
};
|
|
116
|
+
//#endregion
|
|
117
|
+
|
|
118
|
+
//#region ---- Menu Keys ----
|
|
119
|
+
const AXMIntegrationManagementMenuKeys = {
|
|
120
|
+
Integrations: 'IntegrationManagement:Menu:Integrations',
|
|
121
|
+
};
|
|
122
|
+
//#endregion
|
|
123
|
+
|
|
124
|
+
//#region ----- Route helpers -----
|
|
125
|
+
/** Tenant integrations admin page: `/{app}/admin/integrations`. */
|
|
126
|
+
function buildTenantIntegrationsPagePath(appName) {
|
|
127
|
+
return `/${appName}/admin/integrations`;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* App-agnostic OAuth callback path.
|
|
131
|
+
* Prefer this for providers with a fixed registered redirect URI (e.g. Simpro).
|
|
132
|
+
*/
|
|
133
|
+
function buildIntegrationOAuthCallbackPath(providerId) {
|
|
134
|
+
return `/integrations/oauth/callback/${providerId}`;
|
|
135
|
+
}
|
|
136
|
+
function buildIntegrationOAuthCallbackUrl(origin, providerId) {
|
|
137
|
+
return `${origin.replace(/\/+$/, '')}${buildIntegrationOAuthCallbackPath(providerId)}`;
|
|
138
|
+
}
|
|
139
|
+
/** Resolve the current app route slug — session first, then optional route/fallback. */
|
|
140
|
+
function resolveAppRouteName(applicationName, ...fallbacks) {
|
|
141
|
+
const candidates = [applicationName, ...fallbacks];
|
|
142
|
+
for (const candidate of candidates) {
|
|
143
|
+
const trimmed = String(candidate ?? '').trim();
|
|
144
|
+
if (trimmed) {
|
|
145
|
+
return trimmed;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
|
|
152
|
+
//#endregion
|
|
153
|
+
|
|
154
|
+
//#endregion
|
|
155
|
+
|
|
156
|
+
//#endregion
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Generated bundle index. Do not edit.
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
export { AXMIntegrationManagementCommandKeys, AXMIntegrationManagementMenuKeys, AXMIntegrationManagementPermissionKeys, AXMIntegrationManagementQueryKeys, AXPAdministrationPermissionKeys, RootConfig, buildIntegrationOAuthCallbackPath, buildIntegrationOAuthCallbackUrl, buildTenantIntegrationsPagePath, resolveAppRouteName };
|
|
163
|
+
//# sourceMappingURL=acorex-platform-module-integration-management-client-contracts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-integration-management-client-contracts.mjs","sources":["../../../../libs/modules/integration-management/contracts/src/root-config.ts","../../../../libs/modules/integration-management/contracts/src/permission.keys.ts","../../../../libs/modules/integration-management/contracts/src/commands.keys.ts","../../../../libs/modules/integration-management/contracts/src/queries.keys.ts","../../../../libs/modules/integration-management/contracts/src/menu.keys.ts","../../../../libs/modules/integration-management/contracts/src/route.helpers.ts","../../../../libs/modules/integration-management/contracts/src/entities/integration-application/integration-application.types.ts","../../../../libs/modules/integration-management/contracts/src/entities/integration-connection/integration-connection.types.ts","../../../../libs/modules/integration-management/contracts/src/entities/integration-oauth-state/integration-oauth-state.types.ts","../../../../libs/modules/integration-management/contracts/src/acorex-platform-module-integration-management-client-contracts.ts"],"sourcesContent":["//#region ---- Module Config ----\n\nconst config = {\n i18n: 'integration-management',\n module: 'IntegrationManagement',\n route: 'integration-management',\n};\n\nexport const RootConfig = {\n config,\n module: {\n name: config.module,\n route: config.route,\n title: `@${config.i18n}:module.title`,\n icon: 'fa-light fa-plug',\n },\n entities: {\n integrationConnection: {\n name: 'IntegrationConnection',\n source: `${config.module}.IntegrationConnection`,\n title: `@${config.i18n}:connections.entities.connection.title`,\n titlePlural: `@${config.i18n}:connections.entities.connection.plural`,\n icon: 'fa-light fa-link',\n },\n integrationOAuthState: {\n name: 'IntegrationOAuthState',\n source: `${config.module}.IntegrationOAuthState`,\n title: `@${config.i18n}:oauth-states.entities.oauth-state.title`,\n titlePlural: `@${config.i18n}:oauth-states.entities.oauth-state.plural`,\n icon: 'fa-light fa-key',\n },\n integrationApplication: {\n name: 'IntegrationApplication',\n source: `${config.module}.IntegrationApplication`,\n title: `@${config.i18n}:applications.entities.application.title`,\n titlePlural: `@${config.i18n}:applications.entities.application.plural`,\n icon: 'fa-light fa-shield-keyhole',\n },\n },\n queries: {\n dashboard: {\n integrationsDonut: `${config.module}:Dashboard:IntegrationsDonut`,\n },\n },\n};\n\n//#endregion\n","/**\n * Administration capabilities used by this module.\n * Domain capability keys for this module. Root groups live in `AXPCommonPermissionGroupKeys` (common contracts).\n */\nexport const AXPAdministrationPermissionKeys = {\n Access: 'Administration:Permission:Access',\n MaintainUsersAndRoles: 'Administration:Permission:MaintainUsersAndRoles',\n ManageSessions: 'Administration:Permission:ManageSessions',\n MaintainPolicies: 'Administration:Permission:MaintainPolicies',\n ViewIntegrations: 'Administration:Permission:ViewIntegrations',\n MaintainConnections: 'Administration:Permission:MaintainConnections',\n ManageIntegrationActions: 'Administration:Permission:ManageIntegrationActions',\n MaintainWorkflows: 'Administration:Permission:MaintainWorkflows',\n ManageWorkflowActions: 'Administration:Permission:ManageWorkflowActions',\n ViewRules: 'Administration:Permission:ViewRules',\n MaintainRules: 'Administration:Permission:MaintainRules',\n ManageRuleActions: 'Administration:Permission:ManageRuleActions',\n MaintainAi: 'Administration:Permission:MaintainAi',\n UseAiAssist: 'Administration:Permission:UseAiAssist',\n MaintainDashboards: 'Administration:Permission:MaintainDashboards',\n ViewJobs: 'Administration:Permission:ViewJobs',\n ManageJobActions: 'Administration:Permission:ManageJobActions',\n ViewObservability: 'Administration:Permission:ViewObservability',\n MaintainObservability: 'Administration:Permission:MaintainObservability',\n} as const;\n\n/**\n * @deprecated Prefer {@link AXPAdministrationPermissionKeys}.\n * Legacy nested shape kept so existing imports compile during migration.\n */\nexport const AXMIntegrationManagementPermissionKeys = {\n Provider: {\n View: AXPAdministrationPermissionKeys.ViewIntegrations,\n },\n Connection: {\n View: AXPAdministrationPermissionKeys.ViewIntegrations,\n Management: AXPAdministrationPermissionKeys.MaintainConnections,\n },\n TenantConnection: {\n Management: AXPAdministrationPermissionKeys.MaintainConnections,\n },\n Application: {\n Management: AXPAdministrationPermissionKeys.MaintainConnections,\n },\n ConnectionHealth: {\n View: AXPAdministrationPermissionKeys.ViewIntegrations,\n },\n} as const;\n","//#region ---- Command Keys ----\n\nexport const AXMIntegrationManagementCommandKeys = {\n ConnectionConnectWithCredentials: 'IntegrationManagement.Connection:ConnectWithCredentials',\n ConnectionRefreshAuthorization: 'IntegrationManagement.Connection:RefreshAuthorization',\n ConnectionValidate: 'IntegrationManagement.Connection:Validate',\n ConnectionUpdate: 'IntegrationManagement.Connection:Update',\n ConnectionDisconnect: 'IntegrationManagement.Connection:Disconnect',\n ConnectionRevoke: 'IntegrationManagement.Connection:Revoke',\n ConnectionDelete: 'IntegrationManagement.Connection:Delete',\n ApplicationUpsert: 'IntegrationManagement.Application:Upsert',\n} as const;\n\n//#endregion\n","//#region ---- Query Keys ----\n\nexport const AXMIntegrationManagementQueryKeys = {\n DomainList: 'IntegrationManagement.Domain:List',\n ProviderList: 'IntegrationManagement.Provider:List',\n ProviderGet: 'IntegrationManagement.Provider:Get',\n ConnectionListMine: 'IntegrationManagement.Connection:ListMine',\n ConnectionGetStatus: 'IntegrationManagement.Connection:GetStatus',\n ConnectionGetAuthMethods: 'IntegrationManagement.Connection:GetAuthMethods',\n} as const;\n\n//#endregion\n","//#region ---- Menu Keys ----\n\nexport const AXMIntegrationManagementMenuKeys = {\n Integrations: 'IntegrationManagement:Menu:Integrations',\n} as const;\n\n//#endregion\n","//#region ----- Route helpers -----\n\n/** Tenant integrations admin page: `/{app}/admin/integrations`. */\nexport function buildTenantIntegrationsPagePath(appName: string): string {\n return `/${appName}/admin/integrations`;\n}\n\n/**\n * App-agnostic OAuth callback path.\n * Prefer this for providers with a fixed registered redirect URI (e.g. Simpro).\n */\nexport function buildIntegrationOAuthCallbackPath(providerId: string): string {\n return `/integrations/oauth/callback/${providerId}`;\n}\n\nexport function buildIntegrationOAuthCallbackUrl(origin: string, providerId: string): string {\n return `${origin.replace(/\\/+$/, '')}${buildIntegrationOAuthCallbackPath(providerId)}`;\n}\n\n/** Resolve the current app route slug — session first, then optional route/fallback. */\nexport function resolveAppRouteName(\n applicationName?: string | null,\n ...fallbacks: Array<string | null | undefined>\n): string | null {\n const candidates = [applicationName, ...fallbacks];\n for (const candidate of candidates) {\n const trimmed = String(candidate ?? '').trim();\n if (trimmed) {\n return trimmed;\n }\n }\n return null;\n}\n\n//#endregion\n","import type { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\n//#region ---- Integration application entity model ----\n\n/**\n * Tenant/app isolation lives on {@link AXPEntityModel.scopeInfo}\n * (`tenantId`, `applicationId`).\n */\nexport interface AXMIntegrationManagementIntegrationApplicationEntityModel\n extends AXPEntityModel<string> {\n providerId: string;\n clientId: string;\n clientSecretRef: string;\n authorizationEndpoint?: string | null;\n tokenEndpoint?: string | null;\n redirectUri?: string | null;\n defaultScopes?: string[] | null;\n environment?: string | null;\n isActive: boolean;\n}\n\n//#endregion\n","import type { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\nimport type {\n AXPIntegrationAuthMethodType,\n AXPIntegrationConnectionScope,\n AXPIntegrationConnectionStatus,\n} from '@acorex-platform/framework-shared/core';\n\n//#region ---- Integration connection entity model ----\n\n/**\n * Isolation lives on {@link AXPEntityModel.scopeInfo}:\n * - `tenantId` / `applicationId` always\n * - `userId` only when `connectionScope` is `user`\n */\nexport interface AXMIntegrationManagementIntegrationConnectionEntityModel\n extends AXPEntityModel<string> {\n providerId: string;\n connectionScope: AXPIntegrationConnectionScope;\n connectionKey: string;\n displayName: string;\n authMethodType: AXPIntegrationAuthMethodType;\n status: AXPIntegrationConnectionStatus;\n instanceUrl?: string | null;\n externalAccountId?: string | null;\n externalAccountName?: string | null;\n grantedScopes?: string[] | null;\n secretRef?: string | null;\n expiresAt?: string | null;\n lastConnectedAt?: string | null;\n lastValidatedAt?: string | null;\n lastSyncAt?: string | null;\n lastErrorCode?: string | null;\n lastErrorMessage?: string | null;\n isRevoked: boolean;\n isDisabled: boolean;\n config?: Record<string, unknown> | null;\n}\n\n//#endregion\n","import type { AXPEntityModel } from '@acorex-platform/framework-shared/entity';\n\n//#region ---- Integration OAuth state entity model ----\n\n/**\n * Isolation lives on {@link AXPEntityModel.scopeInfo}\n * (`tenantId`, `applicationId`, `userId` = authorizing user).\n */\nexport interface AXMIntegrationManagementIntegrationOAuthStateEntityModel\n extends AXPEntityModel<string> {\n state: string;\n codeVerifier: string;\n providerId: string;\n redirectUri: string;\n connectionScope: string;\n connectionKey: string;\n connectionId?: string | null;\n authMethodType: string;\n expiresAt: string;\n consumedAt?: string | null;\n}\n\n//#endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;AAEA,MAAM,MAAM,GAAG;AACb,IAAA,IAAI,EAAE,wBAAwB;AAC9B,IAAA,MAAM,EAAE,uBAAuB;AAC/B,IAAA,KAAK,EAAE,wBAAwB;CAChC;AAEM,MAAM,UAAU,GAAG;IACxB,MAAM;AACN,IAAA,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC,MAAM;QACnB,KAAK,EAAE,MAAM,CAAC,KAAK;AACnB,QAAA,KAAK,EAAE,CAAA,CAAA,EAAI,MAAM,CAAC,IAAI,CAAA,aAAA,CAAe;AACrC,QAAA,IAAI,EAAE,kBAAkB;AACzB,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,qBAAqB,EAAE;AACrB,YAAA,IAAI,EAAE,uBAAuB;AAC7B,YAAA,MAAM,EAAE,CAAA,EAAG,MAAM,CAAC,MAAM,CAAA,sBAAA,CAAwB;AAChD,YAA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SECRET_STORE } from '@acorex-platform/framework-client/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, Injectable } from '@angular/core';
|
|
4
|
+
import { AXMIntegrationConnectionManager, toSafeIntegrationConnectionDto } from './acorex-platform-module-integration-management-client.mjs';
|
|
5
|
+
import { A as AXMIntegrationConnectionLifecycleDispatcher } from './acorex-platform-module-integration-management-client-integration-connection-lifecycle.dispatcher-DRWR9ysx.mjs';
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region ---- Command ----
|
|
9
|
+
class DeleteConnectionCommand {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.connectionManager = inject(AXMIntegrationConnectionManager);
|
|
12
|
+
this.secretStore = inject(AXP_INTEGRATION_SECRET_STORE);
|
|
13
|
+
this.lifecycle = inject(AXMIntegrationConnectionLifecycleDispatcher);
|
|
14
|
+
}
|
|
15
|
+
async execute(input) {
|
|
16
|
+
try {
|
|
17
|
+
const connection = await this.connectionManager.getByIdForCurrentUser(input.connectionId);
|
|
18
|
+
if (!connection) {
|
|
19
|
+
return { success: false, message: { text: 'Connection not found or access denied.' } };
|
|
20
|
+
}
|
|
21
|
+
const { tenantId, applicationId, userId } = this.connectionManager.getSessionContext();
|
|
22
|
+
if (connection.secretRef) {
|
|
23
|
+
await this.secretStore.delete(connection.secretRef, {
|
|
24
|
+
tenantId,
|
|
25
|
+
applicationId,
|
|
26
|
+
userId,
|
|
27
|
+
connectionId: connection.id,
|
|
28
|
+
providerId: connection.providerId,
|
|
29
|
+
connectionScope: connection.connectionScope,
|
|
30
|
+
connectionKey: connection.connectionKey,
|
|
31
|
+
authMethodType: connection.authMethodType,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const safe = toSafeIntegrationConnectionDto(connection);
|
|
35
|
+
await this.connectionManager.deleteConnection(connection.id);
|
|
36
|
+
await this.lifecycle.dispatchDeleted(safe);
|
|
37
|
+
return { success: true, kind: 'object', data: { deleted: true } };
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
const message = error instanceof Error ? error.message : 'Failed to remove integration connection.';
|
|
41
|
+
return { success: false, message: { text: message } };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: DeleteConnectionCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
45
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: DeleteConnectionCommand, providedIn: 'root' }); }
|
|
46
|
+
}
|
|
47
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: DeleteConnectionCommand, decorators: [{
|
|
48
|
+
type: Injectable,
|
|
49
|
+
args: [{ providedIn: 'root' }]
|
|
50
|
+
}] });
|
|
51
|
+
|
|
52
|
+
export { DeleteConnectionCommand };
|
|
53
|
+
//# sourceMappingURL=acorex-platform-module-integration-management-client-delete-connection.command-DQ_kn8dH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-integration-management-client-delete-connection.command-DQ_kn8dH.mjs","sources":["../../../../libs/modules/integration-management/client/src/lib/features/commands/delete-connection.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXP_INTEGRATION_SECRET_STORE } from '@acorex-platform/framework-client/common';\nimport { Injectable, inject } from '@angular/core';\nimport {\n AXMIntegrationConnectionManager,\n toSafeIntegrationConnectionDto,\n} from '../shared/integration-connection.manager';\nimport { AXMIntegrationConnectionLifecycleDispatcher } from '../shared/integration-connection-lifecycle.dispatcher';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface DeleteConnectionCommandInput {\n connectionId: string;\n}\n\n//#endregion\n\n//#region ---- Command ----\n\n@Injectable({ providedIn: 'root' })\nexport class DeleteConnectionCommand implements AXPCommand<DeleteConnectionCommandInput, { deleted: true }> {\n private readonly connectionManager = inject(AXMIntegrationConnectionManager);\n private readonly secretStore = inject(AXP_INTEGRATION_SECRET_STORE);\n private readonly lifecycle = inject(AXMIntegrationConnectionLifecycleDispatcher);\n\n async execute(\n input: DeleteConnectionCommandInput,\n ): AXPCommandExecuteResultPromise<{ deleted: true }> {\n try {\n const connection = await this.connectionManager.getByIdForCurrentUser(input.connectionId);\n if (!connection) {\n return { success: false, message: { text: 'Connection not found or access denied.' } };\n }\n\n const { tenantId, applicationId, userId } = this.connectionManager.getSessionContext();\n if (connection.secretRef) {\n await this.secretStore.delete(connection.secretRef, {\n tenantId,\n applicationId,\n userId,\n connectionId: connection.id,\n providerId: connection.providerId,\n connectionScope: connection.connectionScope,\n connectionKey: connection.connectionKey,\n authMethodType: connection.authMethodType,\n });\n }\n\n const safe = toSafeIntegrationConnectionDto(connection);\n await this.connectionManager.deleteConnection(connection.id);\n await this.lifecycle.dispatchDeleted(safe);\n\n return { success: true, kind: 'object', data: { deleted: true } };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to remove integration connection.';\n return { success: false, message: { text: message } };\n }\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;AAmBA;AAEA;MAGa,uBAAuB,CAAA;AADpC,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,+BAA+B,CAAC;AAC3D,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,4BAA4B,CAAC;AAClD,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,2CAA2C,CAAC;AAmCjF,IAAA;IAjCC,MAAM,OAAO,CACX,KAAmC,EAAA;AAEnC,QAAA,IAAI;AACF,YAAA,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,KAAK,CAAC,YAAY,CAAC;YACzF,IAAI,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A,CAAA,CAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,cADV,MAAM,EAAA,CAAA,CAAA;;2FACnB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { AXP_INTEGRATION_CONNECTION_STATUS } from '@acorex-platform/framework-shared/core';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, Injectable } from '@angular/core';
|
|
4
|
+
import { AXMIntegrationConnectionManager, scrubDisconnectedConnectionConfig, toSafeIntegrationConnectionDto } from './acorex-platform-module-integration-management-client.mjs';
|
|
5
|
+
import { A as AXMIntegrationConnectionLifecycleDispatcher } from './acorex-platform-module-integration-management-client-integration-connection-lifecycle.dispatcher-DRWR9ysx.mjs';
|
|
6
|
+
import { AXP_INTEGRATION_SECRET_STORE } from '@acorex-platform/framework-client/common';
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
class DisconnectConnectionCommand {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.connectionManager = inject(AXMIntegrationConnectionManager);
|
|
12
|
+
this.secretStore = inject(AXP_INTEGRATION_SECRET_STORE);
|
|
13
|
+
this.lifecycle = inject(AXMIntegrationConnectionLifecycleDispatcher);
|
|
14
|
+
}
|
|
15
|
+
async execute(input) {
|
|
16
|
+
try {
|
|
17
|
+
const connection = await this.connectionManager.getByIdForCurrentUser(input.connectionId);
|
|
18
|
+
if (!connection) {
|
|
19
|
+
return { success: false, message: { text: 'Connection not found or access denied.' } };
|
|
20
|
+
}
|
|
21
|
+
const { tenantId, applicationId, userId } = this.connectionManager.getSessionContext();
|
|
22
|
+
if (connection.secretRef) {
|
|
23
|
+
await this.secretStore.delete(connection.secretRef, {
|
|
24
|
+
tenantId,
|
|
25
|
+
applicationId,
|
|
26
|
+
userId,
|
|
27
|
+
connectionId: connection.id,
|
|
28
|
+
providerId: connection.providerId,
|
|
29
|
+
connectionScope: connection.connectionScope,
|
|
30
|
+
connectionKey: connection.connectionKey,
|
|
31
|
+
authMethodType: connection.authMethodType,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const updated = await this.connectionManager.updateConnection(connection.id, {
|
|
35
|
+
secretRef: null,
|
|
36
|
+
config: scrubDisconnectedConnectionConfig((connection.config ?? null)),
|
|
37
|
+
status: AXP_INTEGRATION_CONNECTION_STATUS.NotConnected,
|
|
38
|
+
isRevoked: false,
|
|
39
|
+
lastErrorCode: null,
|
|
40
|
+
lastErrorMessage: null,
|
|
41
|
+
});
|
|
42
|
+
const safe = toSafeIntegrationConnectionDto(updated);
|
|
43
|
+
await this.lifecycle.dispatchDisconnected(safe);
|
|
44
|
+
return { success: true, kind: 'object', data: safe };
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
const message = error instanceof Error ? error.message : 'Failed to disconnect integration.';
|
|
48
|
+
return { success: false, message: { text: message } };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: DisconnectConnectionCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
52
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: DisconnectConnectionCommand, providedIn: 'root' }); }
|
|
53
|
+
}
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: DisconnectConnectionCommand, decorators: [{
|
|
55
|
+
type: Injectable,
|
|
56
|
+
args: [{ providedIn: 'root' }]
|
|
57
|
+
}] });
|
|
58
|
+
|
|
59
|
+
export { DisconnectConnectionCommand };
|
|
60
|
+
//# sourceMappingURL=acorex-platform-module-integration-management-client-disconnect-connection.command-B4HeDA1n.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-integration-management-client-disconnect-connection.command-B4HeDA1n.mjs","sources":["../../../../libs/modules/integration-management/client/src/lib/features/commands/disconnect-connection.command.ts"],"sourcesContent":["\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { AXP_INTEGRATION_CONNECTION_STATUS, type AXPSafeIntegrationConnectionDto } from '@acorex-platform/framework-shared/core';\n\nimport { Injectable, inject } from '@angular/core';\nimport {\n AXMIntegrationConnectionManager,\n scrubDisconnectedConnectionConfig,\n toSafeIntegrationConnectionDto,\n} from '../shared/integration-connection.manager';\nimport { AXMIntegrationConnectionLifecycleDispatcher } from '../shared/integration-connection-lifecycle.dispatcher';\n\nimport { AXP_INTEGRATION_SECRET_STORE } from '@acorex-platform/framework-client/common';\n\n//#region ---- Types ----\n\nexport interface DisconnectConnectionCommandInput {\n connectionId: string;\n}\n\n//#endregion\n\n@Injectable({ providedIn: 'root' })\nexport class DisconnectConnectionCommand\n implements AXPCommand<DisconnectConnectionCommandInput, AXPSafeIntegrationConnectionDto>\n{\n private readonly connectionManager = inject(AXMIntegrationConnectionManager);\n private readonly secretStore = inject(AXP_INTEGRATION_SECRET_STORE);\n private readonly lifecycle = inject(AXMIntegrationConnectionLifecycleDispatcher);\n\n async execute(\n input: DisconnectConnectionCommandInput,\n ): AXPCommandExecuteResultPromise<AXPSafeIntegrationConnectionDto> {\n try {\n const connection = await this.connectionManager.getByIdForCurrentUser(input.connectionId);\n if (!connection) {\n return { success: false, message: { text: 'Connection not found or access denied.' } };\n }\n\n const { tenantId, applicationId, userId } = this.connectionManager.getSessionContext();\n if (connection.secretRef) {\n await this.secretStore.delete(connection.secretRef, {\n tenantId,\n applicationId,\n userId,\n connectionId: connection.id,\n providerId: connection.providerId,\n connectionScope: connection.connectionScope,\n connectionKey: connection.connectionKey,\n authMethodType: connection.authMethodType,\n });\n }\n\n const updated = await this.connectionManager.updateConnection(connection.id, {\n secretRef: null,\n config: scrubDisconnectedConnectionConfig(\n (connection.config ?? null) as Record<string, unknown> | null,\n ),\n status: AXP_INTEGRATION_CONNECTION_STATUS.NotConnected,\n isRevoked: false,\n lastErrorCode: null,\n lastErrorMessage: null,\n });\n\n const safe = toSafeIntegrationConnectionDto(updated);\n await this.lifecycle.dispatchDisconnected(safe);\n\n return { success: true, kind: 'object', data: safe };\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to disconnect integration.';\n return { success: false, message: { text: message } };\n }\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;AAoBA;MAGa,2BAA2B,CAAA;AADxC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,+BAA+B,CAAC;AAC3D,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,4BAA4B,CAAC;AAClD,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,2CAA2C,CAAC;AA6CjF,IAAA;IA3CC,MAAM,OAAO,CACX,KAAuC,EAAA;AAEvC,QAAA,IAAI;AACF,YAAA,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,KAAK,CAAC,YAAY,CAAC;YACzF,IAAI,CAAC,UAAU,EAAE;AACf,gBAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,wCAAwC,EAAE,EAAE;YACxF;AAEA,YAAA,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,EAAE;AACtF,YAAA,IAAI,UAAU,CAAC,SAAS,EAAE;gBACxB,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC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A,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,cADd,MAAM,EAAA,CAAA,CAAA;;2FACnB,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBADvC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AXPSessionService } from '@acorex-platform/framework-client/auth';
|
|
2
|
+
import { AXPIntegrationProviderRegistryService } from '@acorex-platform/framework-client/common';
|
|
3
|
+
import { runtimeQuerySuccessObject } from '@acorex-platform/framework-shared/core';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { inject, Injectable } from '@angular/core';
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region ---- Query ----
|
|
9
|
+
class GetProviderQuery {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.registry = inject(AXPIntegrationProviderRegistryService);
|
|
12
|
+
this.sessionService = inject(AXPSessionService);
|
|
13
|
+
}
|
|
14
|
+
async fetch(input) {
|
|
15
|
+
const provider = await this.registry.get(input.providerId);
|
|
16
|
+
if (!provider?.module || !this.sessionService.isModuleEnabled(provider.module)) {
|
|
17
|
+
return runtimeQuerySuccessObject(null);
|
|
18
|
+
}
|
|
19
|
+
return runtimeQuerySuccessObject(provider);
|
|
20
|
+
}
|
|
21
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: GetProviderQuery, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
22
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: GetProviderQuery, providedIn: 'root' }); }
|
|
23
|
+
}
|
|
24
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: GetProviderQuery, decorators: [{
|
|
25
|
+
type: Injectable,
|
|
26
|
+
args: [{ providedIn: 'root' }]
|
|
27
|
+
}] });
|
|
28
|
+
|
|
29
|
+
export { GetProviderQuery };
|
|
30
|
+
//# sourceMappingURL=acorex-platform-module-integration-management-client-get-provider.query-Ds10RwnU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-integration-management-client-get-provider.query-Ds10RwnU.mjs","sources":["../../../../libs/modules/integration-management/client/src/lib/features/queries/get-provider.query.ts"],"sourcesContent":["import { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPIntegrationProviderRegistryService } from '@acorex-platform/framework-client/common';\nimport {\n runtimeQuerySuccessObject,\n type AXPIntegrationProviderDefinition,\n} from '@acorex-platform/framework-shared/core';\nimport { AXPQuery, type AXPQueryFetchResultPromise } from '@acorex-platform/framework-shared/runtime';\n\nimport { Injectable, inject } from '@angular/core';\n\n//#region ---- Types ----\n\nexport interface GetProviderQueryInput {\n providerId: string;\n}\n\n//#endregion\n\n//#region ---- Query ----\n\n@Injectable({ providedIn: 'root' })\nexport class GetProviderQuery implements AXPQuery<GetProviderQueryInput, AXPIntegrationProviderDefinition | null> {\n private readonly registry = inject(AXPIntegrationProviderRegistryService);\n private readonly sessionService = inject(AXPSessionService);\n\n async fetch(\n input: GetProviderQueryInput,\n ): AXPQueryFetchResultPromise<AXPIntegrationProviderDefinition | null> {\n const provider = await this.registry.get(input.providerId);\n if (!provider?.module || !this.sessionService.isModuleEnabled(provider.module)) {\n return runtimeQuerySuccessObject(null);\n }\n return runtimeQuerySuccessObject(provider);\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;AAgBA;AAEA;MAGa,gBAAgB,CAAA;AAD7B,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,qCAAqC,CAAC;AACxD,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAW5D,IAAA;IATC,MAAM,KAAK,CACT,KAA4B,EAAA;AAE5B,QAAA,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC;AAC1D,QAAA,IAAI,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;AAC9E,YAAA,OAAO,yBAAyB,CAAC,IAAI,CAAC;QACxC;AACA,QAAA,OAAO,yBAAyB,CAAC,QAAQ,CAAC;IAC5C;8GAZW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAhB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cADH,MAAM,EAAA,CAAA,CAAA;;2FACnB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Injectable } from '@angular/core';
|
|
3
|
+
import { AXP_INTEGRATION_CONNECTION_LIFECYCLE } from '@acorex-platform/framework-client/common';
|
|
4
|
+
|
|
5
|
+
//#region ---- Imports ----
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region ---- Service ----
|
|
8
|
+
class AXMIntegrationConnectionLifecycleDispatcher {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.handlers = inject(AXP_INTEGRATION_CONNECTION_LIFECYCLE, { optional: true });
|
|
11
|
+
}
|
|
12
|
+
async dispatchDisconnected(connection) {
|
|
13
|
+
await this.forProvider(connection.providerId, async (handler) => {
|
|
14
|
+
await handler.onDisconnected?.(connection);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async dispatchDeleted(connection) {
|
|
18
|
+
await this.forProvider(connection.providerId, async (handler) => {
|
|
19
|
+
await handler.onDeleted?.(connection);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async dispatchEnabledChanged(connection, enabled) {
|
|
23
|
+
await this.forProvider(connection.providerId, async (handler) => {
|
|
24
|
+
await handler.onEnabledChanged?.(connection, enabled);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
async forProvider(providerId, run) {
|
|
28
|
+
const list = this.handlers ?? [];
|
|
29
|
+
for (const handler of list) {
|
|
30
|
+
const resolved = handler instanceof Promise ? await handler : handler;
|
|
31
|
+
if (resolved.providerId === providerId) {
|
|
32
|
+
await run(resolved);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMIntegrationConnectionLifecycleDispatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
37
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMIntegrationConnectionLifecycleDispatcher, providedIn: 'root' }); }
|
|
38
|
+
}
|
|
39
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMIntegrationConnectionLifecycleDispatcher, decorators: [{
|
|
40
|
+
type: Injectable,
|
|
41
|
+
args: [{ providedIn: 'root' }]
|
|
42
|
+
}] });
|
|
43
|
+
|
|
44
|
+
export { AXMIntegrationConnectionLifecycleDispatcher as A };
|
|
45
|
+
//# sourceMappingURL=acorex-platform-module-integration-management-client-integration-connection-lifecycle.dispatcher-DRWR9ysx.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acorex-platform-module-integration-management-client-integration-connection-lifecycle.dispatcher-DRWR9ysx.mjs","sources":["../../../../libs/modules/integration-management/client/src/lib/features/shared/integration-connection-lifecycle.dispatcher.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { Injectable, inject } from '@angular/core';\nimport { AXP_INTEGRATION_CONNECTION_LIFECYCLE } from '@acorex-platform/framework-client/common';\nimport type { AXPSafeIntegrationConnectionDto } from '@acorex-platform/framework-shared/core';\n\n//#endregion\n\n//#region ---- Service ----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMIntegrationConnectionLifecycleDispatcher {\n private readonly handlers = inject(AXP_INTEGRATION_CONNECTION_LIFECYCLE, { optional: true });\n\n async dispatchDisconnected(connection: AXPSafeIntegrationConnectionDto): Promise<void> {\n await this.forProvider(connection.providerId, async (handler) => {\n await handler.onDisconnected?.(connection);\n });\n }\n\n async dispatchDeleted(connection: AXPSafeIntegrationConnectionDto): Promise<void> {\n await this.forProvider(connection.providerId, async (handler) => {\n await handler.onDeleted?.(connection);\n });\n }\n\n async dispatchEnabledChanged(\n connection: AXPSafeIntegrationConnectionDto,\n enabled: boolean,\n ): Promise<void> {\n await this.forProvider(connection.providerId, async (handler) => {\n await handler.onEnabledChanged?.(connection, enabled);\n });\n }\n\n private async forProvider(\n providerId: string,\n run: (handler: {\n providerId: string;\n onDisconnected?(connection: AXPSafeIntegrationConnectionDto): Promise<void>;\n onDeleted?(connection: AXPSafeIntegrationConnectionDto): Promise<void>;\n onEnabledChanged?(connection: AXPSafeIntegrationConnectionDto, enabled: boolean): Promise<void>;\n }) => Promise<void>,\n ): Promise<void> {\n const list = this.handlers ?? [];\n for (const handler of list) {\n const resolved = handler instanceof Promise ? await handler : handler;\n if (resolved.providerId === providerId) {\n await run(resolved);\n }\n }\n }\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;AAAA;AAMA;AAEA;MAGa,2CAA2C,CAAA;AADxD,IAAA,WAAA,GAAA;QAEmB,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,o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