mcp-creatio 0.4.0 → 0.4.1
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/cli.d.ts +5 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +18 -11
- package/dist/cli.js.map +1 -1
- package/dist/creatio/auth/auth.d.ts +2 -0
- package/dist/creatio/auth/auth.d.ts.map +1 -1
- package/dist/creatio/auth/auth.js.map +1 -1
- package/dist/creatio/auth/providers/base-provider.d.ts +1 -0
- package/dist/creatio/auth/providers/base-provider.d.ts.map +1 -1
- package/dist/creatio/auth/providers/base-provider.js +3 -0
- package/dist/creatio/auth/providers/base-provider.js.map +1 -1
- package/dist/creatio/auth/providers/oauth2-code-provider.d.ts +3 -0
- package/dist/creatio/auth/providers/oauth2-code-provider.d.ts.map +1 -1
- package/dist/creatio/auth/providers/oauth2-code-provider.js +30 -24
- package/dist/creatio/auth/providers/oauth2-code-provider.js.map +1 -1
- package/dist/creatio/services/http-client.d.ts.map +1 -1
- package/dist/creatio/services/http-client.js +0 -1
- package/dist/creatio/services/http-client.js.map +1 -1
- package/dist/creatio/services/metadata-store.d.ts +5 -0
- package/dist/creatio/services/metadata-store.d.ts.map +1 -1
- package/dist/creatio/services/metadata-store.js +18 -6
- package/dist/creatio/services/metadata-store.js.map +1 -1
- package/dist/creatio/services/odata-crud-provider.d.ts +2 -0
- package/dist/creatio/services/odata-crud-provider.d.ts.map +1 -1
- package/dist/creatio/services/odata-crud-provider.js +10 -1
- package/dist/creatio/services/odata-crud-provider.js.map +1 -1
- package/dist/server/http/creatio-oauth-handlers.d.ts +0 -1
- package/dist/server/http/creatio-oauth-handlers.d.ts.map +1 -1
- package/dist/server/http/creatio-oauth-handlers.js +30 -23
- package/dist/server/http/creatio-oauth-handlers.js.map +1 -1
- package/dist/server/http/httpServer.d.ts +9 -0
- package/dist/server/http/httpServer.d.ts.map +1 -1
- package/dist/server/http/httpServer.js +34 -11
- package/dist/server/http/httpServer.js.map +1 -1
- package/dist/server/http/mcp-handlers.d.ts.map +1 -1
- package/dist/server/http/mcp-handlers.js +4 -1
- package/dist/server/http/mcp-handlers.js.map +1 -1
- package/dist/server/http/mcp-oauth-handlers.d.ts.map +1 -1
- package/dist/server/http/mcp-oauth-handlers.js +18 -6
- package/dist/server/http/mcp-oauth-handlers.js.map +1 -1
- package/dist/server/http/middleware.d.ts +7 -0
- package/dist/server/http/middleware.d.ts.map +1 -1
- package/dist/server/http/middleware.js +23 -0
- package/dist/server/http/middleware.js.map +1 -1
- package/dist/server/http/rate-limiter.d.ts +24 -0
- package/dist/server/http/rate-limiter.d.ts.map +1 -0
- package/dist/server/http/rate-limiter.js +42 -0
- package/dist/server/http/rate-limiter.js.map +1 -0
- package/dist/server/oauth/oauth-server.d.ts +0 -1
- package/dist/server/oauth/oauth-server.d.ts.map +1 -1
- package/dist/server/oauth/oauth-server.js +11 -21
- package/dist/server/oauth/oauth-server.js.map +1 -1
- package/dist/server/oauth/storage.d.ts +0 -2
- package/dist/server/oauth/storage.d.ts.map +1 -1
- package/dist/server/oauth/storage.js +0 -6
- package/dist/server/oauth/storage.js.map +1 -1
- package/dist/server/oauth/validators.d.ts +6 -0
- package/dist/server/oauth/validators.d.ts.map +1 -1
- package/dist/server/oauth/validators.js +28 -0
- package/dist/server/oauth/validators.js.map +1 -1
- package/dist/services/session-context.d.ts +8 -7
- package/dist/services/session-context.d.ts.map +1 -1
- package/dist/services/session-context.js +7 -27
- package/dist/services/session-context.js.map +1 -1
- package/package.json +12 -3
- package/.dockerignore +0 -12
- package/.editorconfig +0 -14
- package/.eslintrc.cjs +0 -18
- package/.gitattributes +0 -8
- package/.github/workflows/docker-publish.yml +0 -50
- package/.prettierignore +0 -3
- package/.prettierrc +0 -9
- package/.vscode/launch.json +0 -23
- package/.vscode/mcp.json +0 -13
- package/.vscode/settings.json +0 -16
- package/Agent.md +0 -190
- package/Debug.md +0 -32
- package/Dockerfile +0 -23
- package/docs/coding-style.md +0 -30
- package/eslint.config.cjs +0 -95
- package/src/cli.ts +0 -162
- package/src/config-builder.ts +0 -76
- package/src/consts.ts +0 -3
- package/src/creatio/auth/auth-manager.ts +0 -27
- package/src/creatio/auth/auth.ts +0 -31
- package/src/creatio/auth/index.ts +0 -3
- package/src/creatio/auth/providers/base-oauth2-provider.ts +0 -62
- package/src/creatio/auth/providers/base-provider.ts +0 -42
- package/src/creatio/auth/providers/index.ts +0 -4
- package/src/creatio/auth/providers/legacy-provider.ts +0 -70
- package/src/creatio/auth/providers/oauth2-code-provider.ts +0 -252
- package/src/creatio/auth/providers/oauth2-provider.ts +0 -91
- package/src/creatio/auth/providers/type.ts +0 -5
- package/src/creatio/client-config.ts +0 -34
- package/src/creatio/engines/admin-operation/admin-operation-engine.ts +0 -44
- package/src/creatio/engines/configuration/configuration-engine.ts +0 -26
- package/src/creatio/engines/crud/crud-engine.ts +0 -47
- package/src/creatio/engines/engine-manager.ts +0 -157
- package/src/creatio/engines/engine-registry.ts +0 -39
- package/src/creatio/engines/engine.ts +0 -3
- package/src/creatio/engines/feature/feature-engine.ts +0 -20
- package/src/creatio/engines/index.ts +0 -10
- package/src/creatio/engines/process/process-engine.ts +0 -20
- package/src/creatio/engines/sys-settings/sys-settings-engine.ts +0 -41
- package/src/creatio/engines/user/user-engine.ts +0 -20
- package/src/creatio/index.ts +0 -6
- package/src/creatio/provider-context.ts +0 -21
- package/src/creatio/providers/admin-operation-provider.ts +0 -34
- package/src/creatio/providers/configuration-provider.ts +0 -22
- package/src/creatio/providers/crud-provider.ts +0 -45
- package/src/creatio/providers/feature-provider.ts +0 -10
- package/src/creatio/providers/index.ts +0 -7
- package/src/creatio/providers/process-provider.ts +0 -15
- package/src/creatio/providers/sys-settings-provider.ts +0 -63
- package/src/creatio/providers/user-provider.ts +0 -12
- package/src/creatio/services/admin-operation-service-provider.ts +0 -115
- package/src/creatio/services/configuration-service-provider.ts +0 -127
- package/src/creatio/services/creatio-service-context.ts +0 -55
- package/src/creatio/services/feature-service-provider.ts +0 -60
- package/src/creatio/services/http-client.ts +0 -174
- package/src/creatio/services/index.ts +0 -10
- package/src/creatio/services/metadata-store.ts +0 -181
- package/src/creatio/services/odata-crud-provider.ts +0 -210
- package/src/creatio/services/process-service-provider.ts +0 -76
- package/src/creatio/services/sys-settings-service-provider.ts +0 -192
- package/src/creatio/services/user-info-provider.ts +0 -41
- package/src/index.ts +0 -44
- package/src/log.ts +0 -183
- package/src/server/http/creatio-oauth-handlers.ts +0 -146
- package/src/server/http/httpServer.ts +0 -150
- package/src/server/http/index.ts +0 -5
- package/src/server/http/mcp-handlers.ts +0 -92
- package/src/server/http/mcp-oauth-handlers.ts +0 -108
- package/src/server/http/middleware.ts +0 -91
- package/src/server/index.ts +0 -2
- package/src/server/mcp/filters.ts +0 -97
- package/src/server/mcp/index.ts +0 -1
- package/src/server/mcp/prompts-data.ts +0 -1292
- package/src/server/mcp/server.ts +0 -442
- package/src/server/mcp/tools-data.ts +0 -748
- package/src/server/oauth/client-manager.ts +0 -47
- package/src/server/oauth/index.ts +0 -6
- package/src/server/oauth/oauth-server.ts +0 -185
- package/src/server/oauth/storage.ts +0 -106
- package/src/server/oauth/token-manager.ts +0 -80
- package/src/server/oauth/types.ts +0 -55
- package/src/server/oauth/validators.ts +0 -56
- package/src/services/index.ts +0 -2
- package/src/services/session-context.ts +0 -232
- package/src/services/token-refresh-scheduler.ts +0 -68
- package/src/types/index.ts +0 -1
- package/src/types/network.ts +0 -7
- package/src/utils/context.ts +0 -49
- package/src/utils/env.ts +0 -12
- package/src/utils/index.ts +0 -5
- package/src/utils/mcp.ts +0 -8
- package/src/utils/network.ts +0 -65
- package/src/utils/pkce.ts +0 -39
- package/src/version.ts +0 -15
- package/tsconfig.json +0 -28
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { CreatioProviderContext } from '../provider-context';
|
|
2
|
-
import {
|
|
3
|
-
AdminOperationProvider,
|
|
4
|
-
ConfigurationProvider,
|
|
5
|
-
CrudProvider,
|
|
6
|
-
FeatureProvider,
|
|
7
|
-
ProcessProvider,
|
|
8
|
-
SysSettingsProvider,
|
|
9
|
-
UserProvider,
|
|
10
|
-
} from '../providers';
|
|
11
|
-
|
|
12
|
-
import { AdminOperationEngine } from './admin-operation/admin-operation-engine';
|
|
13
|
-
import { ConfigurationEngine } from './configuration/configuration-engine';
|
|
14
|
-
import { CrudEngine } from './crud/crud-engine';
|
|
15
|
-
import { CreatioEngine } from './engine';
|
|
16
|
-
import { EngineRegistry, EngineType } from './engine-registry';
|
|
17
|
-
import { FeatureEngine } from './feature/feature-engine';
|
|
18
|
-
import { ProcessEngine } from './process/process-engine';
|
|
19
|
-
import { SysSettingsEngine } from './sys-settings/sys-settings-engine';
|
|
20
|
-
import { UserEngine } from './user/user-engine';
|
|
21
|
-
|
|
22
|
-
export interface EngineManagerOptions {
|
|
23
|
-
adminOperationProvider?: AdminOperationProvider;
|
|
24
|
-
configurationProvider?: ConfigurationProvider;
|
|
25
|
-
crudProvider?: CrudProvider;
|
|
26
|
-
featureProvider?: FeatureProvider;
|
|
27
|
-
processProvider?: ProcessProvider;
|
|
28
|
-
sysSettingsProvider?: SysSettingsProvider;
|
|
29
|
-
userProvider?: UserProvider;
|
|
30
|
-
enableAdminOperation?: boolean;
|
|
31
|
-
enableConfiguration?: boolean;
|
|
32
|
-
enableCrud?: boolean;
|
|
33
|
-
enableFeature?: boolean;
|
|
34
|
-
enableProcess?: boolean;
|
|
35
|
-
enableSysSettings?: boolean;
|
|
36
|
-
enableUser?: boolean;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export class CreatioEngineManager {
|
|
40
|
-
private readonly _context: CreatioProviderContext;
|
|
41
|
-
private readonly _options: EngineManagerOptions | undefined;
|
|
42
|
-
private readonly _registry = new EngineRegistry();
|
|
43
|
-
private readonly _engines = new Map<string, CreatioEngine>();
|
|
44
|
-
|
|
45
|
-
public get authProvider() {
|
|
46
|
-
return this._context.authProvider;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
public get registry(): EngineRegistry {
|
|
50
|
-
return this._registry;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public get adminOperation(): AdminOperationEngine {
|
|
54
|
-
return this._registry.require<AdminOperationEngine>(EngineType.AdminOperation);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public get configuration(): ConfigurationEngine {
|
|
58
|
-
return this._registry.require<ConfigurationEngine>(EngineType.Configuration);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public get crud(): CrudEngine {
|
|
62
|
-
return this._registry.require<CrudEngine>(EngineType.Crud);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public get feature(): FeatureEngine {
|
|
66
|
-
return this._registry.require<FeatureEngine>(EngineType.Feature);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public get process(): ProcessEngine {
|
|
70
|
-
return this._registry.require<ProcessEngine>(EngineType.Process);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public get sysSettings(): SysSettingsEngine {
|
|
74
|
-
return this._registry.require<SysSettingsEngine>(EngineType.SysSettings);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
public get user(): UserEngine {
|
|
78
|
-
return this._registry.require<UserEngine>(EngineType.User);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
constructor(context: CreatioProviderContext, options?: EngineManagerOptions) {
|
|
82
|
-
this._context = context;
|
|
83
|
-
this._options = options;
|
|
84
|
-
this._initialize();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
private _initialize() {
|
|
88
|
-
this._registerEngine(
|
|
89
|
-
EngineType.AdminOperation,
|
|
90
|
-
() =>
|
|
91
|
-
new AdminOperationEngine(
|
|
92
|
-
this._options?.adminOperationProvider ??
|
|
93
|
-
(this._context.adminOperation as AdminOperationProvider),
|
|
94
|
-
),
|
|
95
|
-
this._options?.enableAdminOperation ?? true,
|
|
96
|
-
);
|
|
97
|
-
this._registerEngine(
|
|
98
|
-
EngineType.Configuration,
|
|
99
|
-
() =>
|
|
100
|
-
new ConfigurationEngine(
|
|
101
|
-
this._options?.configurationProvider ??
|
|
102
|
-
(this._context.configuration as ConfigurationProvider),
|
|
103
|
-
),
|
|
104
|
-
this._options?.enableConfiguration ?? true,
|
|
105
|
-
);
|
|
106
|
-
this._registerEngine(
|
|
107
|
-
EngineType.Crud,
|
|
108
|
-
() =>
|
|
109
|
-
new CrudEngine(this._options?.crudProvider ?? (this._context.crud as CrudProvider)),
|
|
110
|
-
this._options?.enableCrud ?? true,
|
|
111
|
-
);
|
|
112
|
-
this._registerEngine(
|
|
113
|
-
EngineType.Feature,
|
|
114
|
-
() =>
|
|
115
|
-
new FeatureEngine(
|
|
116
|
-
this._options?.featureProvider ?? (this._context.feature as FeatureProvider),
|
|
117
|
-
),
|
|
118
|
-
this._options?.enableFeature ?? true,
|
|
119
|
-
);
|
|
120
|
-
this._registerEngine(
|
|
121
|
-
EngineType.Process,
|
|
122
|
-
() =>
|
|
123
|
-
new ProcessEngine(
|
|
124
|
-
this._options?.processProvider ?? (this._context.process as ProcessProvider),
|
|
125
|
-
),
|
|
126
|
-
this._options?.enableProcess ?? true,
|
|
127
|
-
);
|
|
128
|
-
this._registerEngine(
|
|
129
|
-
EngineType.SysSettings,
|
|
130
|
-
() =>
|
|
131
|
-
new SysSettingsEngine(
|
|
132
|
-
this._options?.sysSettingsProvider ??
|
|
133
|
-
(this._context.sysSettings as SysSettingsProvider),
|
|
134
|
-
),
|
|
135
|
-
this._options?.enableSysSettings ?? true,
|
|
136
|
-
);
|
|
137
|
-
this._registerEngine(
|
|
138
|
-
EngineType.User,
|
|
139
|
-
() =>
|
|
140
|
-
new UserEngine(this._options?.userProvider ?? (this._context.user as UserProvider)),
|
|
141
|
-
this._options?.enableUser ?? true,
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
private _registerEngine<T extends CreatioEngine>(
|
|
146
|
-
type: EngineType,
|
|
147
|
-
factory: () => T,
|
|
148
|
-
enabled: boolean,
|
|
149
|
-
) {
|
|
150
|
-
if (!enabled) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
const engine = factory();
|
|
154
|
-
this._engines.set(type, engine);
|
|
155
|
-
this._registry.register(engine);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { CreatioEngine } from './engine';
|
|
2
|
-
|
|
3
|
-
export enum EngineType {
|
|
4
|
-
AdminOperation = 'admin-operation',
|
|
5
|
-
Configuration = 'configuration',
|
|
6
|
-
Crud = 'crud',
|
|
7
|
-
Feature = 'feature',
|
|
8
|
-
Process = 'process',
|
|
9
|
-
SysSettings = 'sys-settings',
|
|
10
|
-
User = 'user',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class EngineRegistry {
|
|
14
|
-
private readonly _engines = new Map<string, CreatioEngine>();
|
|
15
|
-
|
|
16
|
-
public register(engine: CreatioEngine): CreatioEngine {
|
|
17
|
-
if (this._engines.has(engine.name)) {
|
|
18
|
-
throw new Error(`engine_already_registered:${engine.name}`);
|
|
19
|
-
}
|
|
20
|
-
this._engines.set(engine.name, engine);
|
|
21
|
-
return engine;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public get<T extends CreatioEngine = CreatioEngine>(name: string): T | undefined {
|
|
25
|
-
return this._engines.get(name) as T | undefined;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public require<T extends CreatioEngine = CreatioEngine>(name: string): T {
|
|
29
|
-
const engine = this.get<T>(name);
|
|
30
|
-
if (!engine) {
|
|
31
|
-
throw new Error(`engine_not_registered:${name}`);
|
|
32
|
-
}
|
|
33
|
-
return engine;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public entries(): IterableIterator<[string, CreatioEngine]> {
|
|
37
|
-
return this._engines.entries();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ClearFeatureCacheResult, FeatureProvider } from '../../providers';
|
|
2
|
-
import { CreatioEngine } from '../engine';
|
|
3
|
-
|
|
4
|
-
export class FeatureEngine implements CreatioEngine {
|
|
5
|
-
private readonly _provider: FeatureProvider;
|
|
6
|
-
|
|
7
|
-
public readonly name = 'feature';
|
|
8
|
-
|
|
9
|
-
constructor(provider: FeatureProvider) {
|
|
10
|
-
this._provider = provider;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public get kind(): string {
|
|
14
|
-
return this._provider.kind;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public clearFeaturesCache(featureCode?: string): Promise<ClearFeatureCacheResult> {
|
|
18
|
-
return this._provider.clearFeaturesCache(featureCode);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './engine';
|
|
2
|
-
export * from './engine-manager';
|
|
3
|
-
export * from './engine-registry';
|
|
4
|
-
export * from './admin-operation/admin-operation-engine';
|
|
5
|
-
export * from './configuration/configuration-engine';
|
|
6
|
-
export * from './crud/crud-engine';
|
|
7
|
-
export * from './feature/feature-engine';
|
|
8
|
-
export * from './process/process-engine';
|
|
9
|
-
export * from './sys-settings/sys-settings-engine';
|
|
10
|
-
export * from './user/user-engine';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ExecuteProcessParams, ExecuteProcessResult, ProcessProvider } from '../../providers';
|
|
2
|
-
import { CreatioEngine } from '../engine';
|
|
3
|
-
|
|
4
|
-
export class ProcessEngine implements CreatioEngine {
|
|
5
|
-
private readonly _provider: ProcessProvider;
|
|
6
|
-
|
|
7
|
-
public readonly name = 'process';
|
|
8
|
-
|
|
9
|
-
constructor(provider: ProcessProvider) {
|
|
10
|
-
this._provider = provider;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public get kind(): string {
|
|
14
|
-
return this._provider.kind;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public execute(params: ExecuteProcessParams): Promise<ExecuteProcessResult> {
|
|
18
|
-
return this._provider.executeProcess(params);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CreateSysSettingRequest,
|
|
3
|
-
CreateSysSettingResult,
|
|
4
|
-
QuerySysSettingsResponse,
|
|
5
|
-
SysSettingDefinitionUpdate,
|
|
6
|
-
SysSettingUpdateResponse,
|
|
7
|
-
SysSettingsProvider,
|
|
8
|
-
} from '../../providers';
|
|
9
|
-
import { CreatioEngine } from '../engine';
|
|
10
|
-
|
|
11
|
-
export class SysSettingsEngine implements CreatioEngine {
|
|
12
|
-
private readonly _provider: SysSettingsProvider;
|
|
13
|
-
|
|
14
|
-
public readonly name = 'sys-settings';
|
|
15
|
-
|
|
16
|
-
constructor(provider: SysSettingsProvider) {
|
|
17
|
-
this._provider = provider;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public get kind(): string {
|
|
21
|
-
return this._provider.kind;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public setValues(values: Record<string, any>): Promise<any> {
|
|
25
|
-
return this._provider.setValues(values);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public queryValues(codes: string[]): Promise<QuerySysSettingsResponse> {
|
|
29
|
-
return this._provider.queryValues(codes);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public createSetting(request: CreateSysSettingRequest): Promise<CreateSysSettingResult> {
|
|
33
|
-
return this._provider.createSetting(request);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public updateDefinition(
|
|
37
|
-
definition: SysSettingDefinitionUpdate,
|
|
38
|
-
): Promise<SysSettingUpdateResponse> {
|
|
39
|
-
return this._provider.updateDefinition(definition);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { CurrentUserInfo, UserProvider } from '../../providers';
|
|
2
|
-
import { CreatioEngine } from '../engine';
|
|
3
|
-
|
|
4
|
-
export class UserEngine implements CreatioEngine {
|
|
5
|
-
private readonly _provider: UserProvider;
|
|
6
|
-
|
|
7
|
-
public readonly name = 'user';
|
|
8
|
-
|
|
9
|
-
constructor(provider: UserProvider) {
|
|
10
|
-
this._provider = provider;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public get kind(): string {
|
|
14
|
-
return this._provider.kind;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public getCurrentUserInfo(): Promise<CurrentUserInfo> {
|
|
18
|
-
return this._provider.getCurrentUserInfo();
|
|
19
|
-
}
|
|
20
|
-
}
|
package/src/creatio/index.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ICreatioAuthProvider } from './auth';
|
|
2
|
-
import {
|
|
3
|
-
AdminOperationProvider,
|
|
4
|
-
ConfigurationProvider,
|
|
5
|
-
CrudProvider,
|
|
6
|
-
FeatureProvider,
|
|
7
|
-
ProcessProvider,
|
|
8
|
-
SysSettingsProvider,
|
|
9
|
-
UserProvider,
|
|
10
|
-
} from './providers';
|
|
11
|
-
|
|
12
|
-
export interface CreatioProviderContext {
|
|
13
|
-
authProvider: ICreatioAuthProvider;
|
|
14
|
-
adminOperation: AdminOperationProvider;
|
|
15
|
-
configuration: ConfigurationProvider;
|
|
16
|
-
crud: CrudProvider;
|
|
17
|
-
feature: FeatureProvider;
|
|
18
|
-
process: ProcessProvider;
|
|
19
|
-
sysSettings: SysSettingsProvider;
|
|
20
|
-
user: UserProvider;
|
|
21
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export interface AdminOperationServiceResult {
|
|
2
|
-
success: boolean;
|
|
3
|
-
exMessage?: string;
|
|
4
|
-
[key: string]: unknown;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface UpsertAdminOperationRequest {
|
|
8
|
-
id?: string;
|
|
9
|
-
name: string;
|
|
10
|
-
code: string;
|
|
11
|
-
description?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface UpsertAdminOperationResult extends AdminOperationServiceResult {
|
|
15
|
-
id?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface SetAdminOperationGranteeRequest {
|
|
19
|
-
adminOperationId: string;
|
|
20
|
-
adminUnitIds: string[];
|
|
21
|
-
canExecute: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface AdminOperationProvider {
|
|
25
|
-
readonly kind: string;
|
|
26
|
-
upsertAdminOperation(
|
|
27
|
-
request: UpsertAdminOperationRequest,
|
|
28
|
-
): Promise<UpsertAdminOperationResult>;
|
|
29
|
-
deleteAdminOperation(recordIds: string[]): Promise<AdminOperationServiceResult>;
|
|
30
|
-
setAdminOperationGrantee(
|
|
31
|
-
request: SetAdminOperationGranteeRequest,
|
|
32
|
-
): Promise<AdminOperationServiceResult>;
|
|
33
|
-
deleteAdminOperationGrantee(recordIds: string[]): Promise<AdminOperationServiceResult>;
|
|
34
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export type ConfigurationServiceHttpMethod = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
|
2
|
-
|
|
3
|
-
export type ConfigurationServiceQueryValue = string | number | boolean;
|
|
4
|
-
|
|
5
|
-
export interface CallConfigurationServiceRequest {
|
|
6
|
-
service: string;
|
|
7
|
-
method: string;
|
|
8
|
-
httpMethod?: ConfigurationServiceHttpMethod;
|
|
9
|
-
body?: unknown;
|
|
10
|
-
query?: Record<string, ConfigurationServiceQueryValue>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface CallConfigurationServiceResult {
|
|
14
|
-
status: number;
|
|
15
|
-
contentType?: string;
|
|
16
|
-
body: unknown;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface ConfigurationProvider {
|
|
20
|
-
readonly kind: string;
|
|
21
|
-
call(request: CallConfigurationServiceRequest): Promise<CallConfigurationServiceResult>;
|
|
22
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export interface EntitySchemaProperty {
|
|
2
|
-
name: string;
|
|
3
|
-
type: string;
|
|
4
|
-
nullable?: boolean;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface EntitySchemaDescription {
|
|
8
|
-
entitySet: string;
|
|
9
|
-
entityType: string;
|
|
10
|
-
key: string[];
|
|
11
|
-
properties: EntitySchemaProperty[];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface CrudReadParams {
|
|
15
|
-
entity: string;
|
|
16
|
-
filter?: string | undefined;
|
|
17
|
-
select?: string[] | undefined;
|
|
18
|
-
top?: number | undefined;
|
|
19
|
-
expand?: string[] | undefined;
|
|
20
|
-
orderBy?: string | undefined;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface CrudWriteParams {
|
|
24
|
-
entity: string;
|
|
25
|
-
data: any;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface CrudUpdateParams extends CrudWriteParams {
|
|
29
|
-
id: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface CrudDeleteParams {
|
|
33
|
-
entity: string;
|
|
34
|
-
id: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface CrudProvider {
|
|
38
|
-
readonly kind: string;
|
|
39
|
-
listEntitySets(): Promise<string[]>;
|
|
40
|
-
describeEntity(entitySet: string): Promise<EntitySchemaDescription>;
|
|
41
|
-
read(params: CrudReadParams): Promise<any>;
|
|
42
|
-
create(params: CrudWriteParams): Promise<any>;
|
|
43
|
-
update(params: CrudUpdateParams): Promise<any>;
|
|
44
|
-
delete(params: CrudDeleteParams): Promise<any>;
|
|
45
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './admin-operation-provider';
|
|
2
|
-
export * from './configuration-provider';
|
|
3
|
-
export * from './crud-provider';
|
|
4
|
-
export * from './feature-provider';
|
|
5
|
-
export * from './process-provider';
|
|
6
|
-
export * from './sys-settings-provider';
|
|
7
|
-
export * from './user-provider';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface ExecuteProcessParams {
|
|
2
|
-
processName: string;
|
|
3
|
-
parameters?: Record<string, any> | undefined;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface ExecuteProcessResult {
|
|
7
|
-
status?: string;
|
|
8
|
-
returnValues?: Record<string, any>;
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface ProcessProvider {
|
|
13
|
-
readonly kind: string;
|
|
14
|
-
executeProcess(params: ExecuteProcessParams): Promise<ExecuteProcessResult>;
|
|
15
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
export interface QuerySysSettingsResponse {
|
|
2
|
-
success: boolean;
|
|
3
|
-
values: Record<string, SysSettingDetail>;
|
|
4
|
-
notFoundSettings?: string[];
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface SysSettingDetail {
|
|
8
|
-
code?: string;
|
|
9
|
-
value?: unknown;
|
|
10
|
-
displayValue?: string;
|
|
11
|
-
isCacheable?: boolean;
|
|
12
|
-
dataValueType?: number | string;
|
|
13
|
-
dataValueTypeName?: number | string;
|
|
14
|
-
id?: string;
|
|
15
|
-
name?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface SysSettingDefinition extends Record<string, unknown> {
|
|
19
|
-
code: string;
|
|
20
|
-
name: string;
|
|
21
|
-
valueTypeName: string;
|
|
22
|
-
id?: string | undefined;
|
|
23
|
-
description?: string | undefined;
|
|
24
|
-
isCacheable?: boolean | undefined;
|
|
25
|
-
isPersonal?: boolean | undefined;
|
|
26
|
-
isSSPAvailable?: boolean | undefined;
|
|
27
|
-
referenceSchemaUId?: string | undefined;
|
|
28
|
-
dataValueType?: number | string | undefined;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type SysSettingDefinitionUpdate = Partial<SysSettingDefinition> & { id: string };
|
|
32
|
-
|
|
33
|
-
export interface CreateSysSettingRequest {
|
|
34
|
-
definition: SysSettingDefinition;
|
|
35
|
-
initialValue?: unknown;
|
|
36
|
-
isPersonal?: boolean;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface SysSettingInsertResponse extends Record<string, unknown> {
|
|
40
|
-
id: string;
|
|
41
|
-
success: boolean;
|
|
42
|
-
rowsAffected?: number;
|
|
43
|
-
nextPrcElReady?: boolean;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface SysSettingUpdateResponse extends Record<string, unknown> {
|
|
47
|
-
success?: boolean;
|
|
48
|
-
rowsAffected?: number;
|
|
49
|
-
nextPrcElReady?: boolean;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface CreateSysSettingResult {
|
|
53
|
-
insertResult: SysSettingInsertResponse;
|
|
54
|
-
setValueResult?: any;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface SysSettingsProvider {
|
|
58
|
-
readonly kind: string;
|
|
59
|
-
setValues(values: Record<string, any>): Promise<any>;
|
|
60
|
-
queryValues(codes: string[]): Promise<QuerySysSettingsResponse>;
|
|
61
|
-
createSetting(request: CreateSysSettingRequest): Promise<CreateSysSettingResult>;
|
|
62
|
-
updateDefinition(definition: SysSettingDefinitionUpdate): Promise<SysSettingUpdateResponse>;
|
|
63
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface CurrentUserInfo {
|
|
2
|
-
userId?: string;
|
|
3
|
-
contactId?: string;
|
|
4
|
-
userName?: string;
|
|
5
|
-
cultureName?: string;
|
|
6
|
-
[key: string]: any;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface UserProvider {
|
|
10
|
-
readonly kind: string;
|
|
11
|
-
getCurrentUserInfo(): Promise<CurrentUserInfo>;
|
|
12
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
AdminOperationProvider,
|
|
5
|
-
AdminOperationServiceResult,
|
|
6
|
-
SetAdminOperationGranteeRequest,
|
|
7
|
-
UpsertAdminOperationRequest,
|
|
8
|
-
UpsertAdminOperationResult,
|
|
9
|
-
} from '../providers';
|
|
10
|
-
|
|
11
|
-
import { CreatioHttpClient } from './http-client';
|
|
12
|
-
|
|
13
|
-
const EMPTY_GUID = '00000000-0000-0000-0000-000000000000';
|
|
14
|
-
|
|
15
|
-
interface RightsHelperInner {
|
|
16
|
-
Success: boolean;
|
|
17
|
-
ExMessage?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export class AdminOperationServiceProvider implements AdminOperationProvider {
|
|
21
|
-
private readonly _client: CreatioHttpClient;
|
|
22
|
-
|
|
23
|
-
public readonly kind = 'creatio-admin-operation-service';
|
|
24
|
-
|
|
25
|
-
constructor(client: CreatioHttpClient) {
|
|
26
|
-
this._client = client;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
private _getMethodUrl(method: string): string {
|
|
30
|
-
return `${this._client.normalizedBaseUrl}/0/rest/RightsService/${method}`;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
private _parseRightsResponse(method: string, body: any): RightsHelperInner {
|
|
34
|
-
const resultKey = `${method}Result`;
|
|
35
|
-
const wrapped = body?.[resultKey];
|
|
36
|
-
if (typeof wrapped !== 'string') {
|
|
37
|
-
throw new Error(
|
|
38
|
-
`creatio_rights_service_unexpected_response:${method}:${JSON.stringify(body)}`,
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
return JSON.parse(wrapped) as RightsHelperInner;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
private async _callRightsService(
|
|
45
|
-
method: string,
|
|
46
|
-
payload: Record<string, unknown>,
|
|
47
|
-
): Promise<AdminOperationServiceResult> {
|
|
48
|
-
const url = this._getMethodUrl(method);
|
|
49
|
-
return this._client.executeWithTiming(
|
|
50
|
-
method,
|
|
51
|
-
url,
|
|
52
|
-
async () => {
|
|
53
|
-
const requestInit = await this._client.createPostRequest(payload);
|
|
54
|
-
return this._client.fetchWithAuth(url, async () => requestInit);
|
|
55
|
-
},
|
|
56
|
-
async (response, duration) => {
|
|
57
|
-
const body = await response.json();
|
|
58
|
-
const inner = this._parseRightsResponse(method, body);
|
|
59
|
-
const success = Boolean(inner.Success);
|
|
60
|
-
this._client.logSuccess(method, response.status, duration, {
|
|
61
|
-
rightsServiceSuccess: success,
|
|
62
|
-
});
|
|
63
|
-
const result: AdminOperationServiceResult = { success };
|
|
64
|
-
if (inner.ExMessage !== undefined && inner.ExMessage !== '') {
|
|
65
|
-
result.exMessage = inner.ExMessage;
|
|
66
|
-
}
|
|
67
|
-
return result;
|
|
68
|
-
},
|
|
69
|
-
async (response, duration) =>
|
|
70
|
-
this._client.handleErrorResponse(
|
|
71
|
-
method,
|
|
72
|
-
response,
|
|
73
|
-
duration,
|
|
74
|
-
`creatio_${method.toLowerCase()}_failed`,
|
|
75
|
-
{ url },
|
|
76
|
-
),
|
|
77
|
-
{ method },
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public async upsertAdminOperation(
|
|
82
|
-
request: UpsertAdminOperationRequest,
|
|
83
|
-
): Promise<UpsertAdminOperationResult> {
|
|
84
|
-
const recordId = request.id && request.id !== EMPTY_GUID ? request.id : randomUUID();
|
|
85
|
-
const payload = {
|
|
86
|
-
recordId,
|
|
87
|
-
name: request.name,
|
|
88
|
-
code: request.code,
|
|
89
|
-
description: request.description ?? '',
|
|
90
|
-
};
|
|
91
|
-
const base = await this._callRightsService('UpsertAdminOperation', payload);
|
|
92
|
-
const result: UpsertAdminOperationResult = { ...base, id: recordId };
|
|
93
|
-
return result;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
public async deleteAdminOperation(recordIds: string[]): Promise<AdminOperationServiceResult> {
|
|
97
|
-
return this._callRightsService('DeleteAdminOperation', { recordIds });
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
public async setAdminOperationGrantee(
|
|
101
|
-
request: SetAdminOperationGranteeRequest,
|
|
102
|
-
): Promise<AdminOperationServiceResult> {
|
|
103
|
-
return this._callRightsService('SetAdminOperationGrantee', {
|
|
104
|
-
adminOperationId: request.adminOperationId,
|
|
105
|
-
adminUnitIds: request.adminUnitIds,
|
|
106
|
-
canExecute: request.canExecute,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
public async deleteAdminOperationGrantee(
|
|
111
|
-
recordIds: string[],
|
|
112
|
-
): Promise<AdminOperationServiceResult> {
|
|
113
|
-
return this._callRightsService('DeleteAdminOperationGrantee', { recordIds });
|
|
114
|
-
}
|
|
115
|
-
}
|