@flusys/nestjs-entity-builder 9.0.1 → 9.1.0
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/README.md +22 -28
- package/config/message-keys.d.ts +9 -62
- package/controllers/flow-api-key.controller.d.ts +14 -0
- package/controllers/flow-definition.controller.d.ts +1 -7
- package/controllers/index.d.ts +1 -0
- package/dtos/flow.dto.d.ts +20 -10
- package/entities/flow-api-key.entity.d.ts +10 -0
- package/entities/flow-definition.entity.d.ts +9 -3
- package/entities/flow-execution.entity.d.ts +0 -1
- package/entities/index.d.ts +3 -3
- package/fesm/21.js +11 -64
- package/fesm/{582.js → 489.js} +11 -20
- package/fesm/{913.js → 606.js} +295 -209
- package/fesm/719.js +186 -162
- package/fesm/794.js +187 -116
- package/fesm/{677.js → 996.js} +616 -1490
- package/fesm/controllers/index.js +6 -5
- package/fesm/docs/index.js +2 -2
- package/fesm/entities/index.js +2 -2
- package/fesm/guards/index.js +19 -12
- package/fesm/index.js +638 -50
- package/fesm/modules/index.js +625 -7
- package/fesm/rule-engine/index.js +2 -2
- package/fesm/services/index.js +25 -54
- package/flow-engine/flow-api-key.d.ts +7 -3
- package/flow-engine/flow-graph.validator.d.ts +2 -4
- package/flow-engine/flow-run.types.d.ts +4 -14
- package/flow-engine/flow.types.d.ts +9 -91
- package/interfaces/flow-definition.interface.d.ts +9 -13
- package/package.json +5 -5
- package/rule-engine/rule-engine.service.d.ts +0 -1
- package/services/entity-flow-scaffold.d.ts +1 -1
- package/services/flow-api-key.service.d.ts +31 -0
- package/services/flow-definition.service.d.ts +12 -24
- package/services/flow-execution.service.d.ts +0 -1
- package/services/flow-executor.service.d.ts +7 -7
- package/services/generic-entity.service.d.ts +1 -1
- package/services/index.d.ts +1 -0
- package/entities/flow-version.entity.d.ts +0 -10
- package/fesm/458.js +0 -649
|
@@ -1,46 +1,41 @@
|
|
|
1
1
|
import { type IPermissionActionRegistry } from '@flusys/nestjs-shared';
|
|
2
2
|
import { ApiService, HybridCache } from '@flusys/nestjs-shared/classes';
|
|
3
3
|
import { type DeleteDto } from '@flusys/nestjs-shared/dtos';
|
|
4
|
-
import { type
|
|
4
|
+
import { type ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
|
|
5
5
|
import { SharedPermissionCacheService, UtilsService } from '@flusys/nestjs-shared/modules';
|
|
6
6
|
import { NotFoundException } from '@nestjs/common';
|
|
7
7
|
import { type QueryRunner } from 'typeorm';
|
|
8
8
|
import { type CreateFlowDefinitionDto, type UpdateFlowDefinitionDto } from '../dtos/flow.dto.js';
|
|
9
9
|
import { FlowDefinition } from '../entities/flow-definition.entity.js';
|
|
10
10
|
import { type IFlowValidationResult } from '../flow-engine/flow-graph.validator.js';
|
|
11
|
-
import { type
|
|
12
|
-
import { type IFlowDefinition
|
|
11
|
+
import { type IFlowSettings } from '../flow-engine/flow.types.js';
|
|
12
|
+
import { type IFlowDefinition } from '../interfaces/flow-definition.interface.js';
|
|
13
13
|
import { EntityBuilderDataSourceProvider } from './entity-builder-datasource.provider.js';
|
|
14
14
|
export declare const defaultFlowPermissionCode: (slug: string) => string;
|
|
15
15
|
export declare const flowNotFound: () => NotFoundException;
|
|
16
|
-
export declare
|
|
17
|
-
export declare function snapshotOf(source: Partial<IFlowSnapshot>): IFlowSnapshot;
|
|
18
|
-
export declare const workingCopy: (flow: FlowDefinition) => IFlowSnapshot;
|
|
19
|
-
type FlowSettingsSource = Pick<Partial<CreateFlowDefinitionDto>, 'nodes' | 'edges'> & {
|
|
16
|
+
export declare function toFlowSettings(dto: Pick<Partial<CreateFlowDefinitionDto>, 'authMode' | 'runAs' | 'isTransactional' | 'bodyType' | 'inputSchema' | 'nodes' | 'edges' | 'timeoutMs'> & {
|
|
20
17
|
slug: string;
|
|
18
|
+
}): IFlowSettings & {
|
|
19
|
+
timeoutMs: number;
|
|
21
20
|
};
|
|
22
|
-
export declare function toFlowSettings(dto: FlowSettingsSource): IFlowSettings;
|
|
23
21
|
export declare class FlowDefinitionService extends ApiService<CreateFlowDefinitionDto, UpdateFlowDefinitionDto, IFlowDefinition, FlowDefinition> {
|
|
24
22
|
protected cacheManager: HybridCache;
|
|
25
23
|
protected utilsService: UtilsService;
|
|
26
24
|
private readonly provider;
|
|
27
25
|
private readonly permissionCache;
|
|
28
26
|
private readonly actionRegistry?;
|
|
29
|
-
|
|
30
|
-
private readonly email?;
|
|
31
|
-
private readonly companyAccess?;
|
|
32
|
-
constructor(cacheManager: HybridCache, utilsService: UtilsService, provider: EntityBuilderDataSourceProvider, permissionCache: SharedPermissionCacheService, actionRegistry?: IPermissionActionRegistry | undefined, notifications?: INotificationAdapter | undefined, email?: IEmailAdapter | undefined, companyAccess?: ICompanyAccessResolver | undefined);
|
|
27
|
+
constructor(cacheManager: HybridCache, utilsService: UtilsService, provider: EntityBuilderDataSourceProvider, permissionCache: SharedPermissionCacheService, actionRegistry?: IPermissionActionRegistry | undefined);
|
|
33
28
|
findOrFail(id: string): Promise<FlowDefinition>;
|
|
34
29
|
validate(settings: IFlowSettings): Promise<IFlowValidationResult>;
|
|
35
30
|
private callersOf;
|
|
36
31
|
private assertNotCalled;
|
|
37
|
-
private assertCallersKept;
|
|
38
|
-
private assertCallsStillValid;
|
|
39
32
|
private assertEndpointsNotCalled;
|
|
40
33
|
private assertSaveable;
|
|
41
34
|
assertMayAuthor(settings: IFlowSettings, user: ILoggedUserInfo | null): Promise<void>;
|
|
42
35
|
assertMayCreate(user: ILoggedUserInfo | null): Promise<void>;
|
|
43
|
-
assertMayTest(settings: IFlowSettings
|
|
36
|
+
assertMayTest(settings: IFlowSettings & {
|
|
37
|
+
permissionCode?: string | null;
|
|
38
|
+
}, user: ILoggedUserInfo | null, run: {
|
|
44
39
|
mode: 'dry_run' | 'live';
|
|
45
40
|
draft: boolean;
|
|
46
41
|
saved: boolean;
|
|
@@ -48,15 +43,8 @@ export declare class FlowDefinitionService extends ApiService<CreateFlowDefiniti
|
|
|
48
43
|
private assertHasPermission;
|
|
49
44
|
protected beforeInsertOperation(dto: CreateFlowDefinitionDto | CreateFlowDefinitionDto[], user: ILoggedUserInfo | null, _qr: QueryRunner): Promise<void>;
|
|
50
45
|
protected beforeUpdateOperation(dto: UpdateFlowDefinitionDto | UpdateFlowDefinitionDto[], user: ILoggedUserInfo | null, _qr: QueryRunner): Promise<void>;
|
|
51
|
-
protected convertSingleDtoToEntity(dto: CreateFlowDefinitionDto | UpdateFlowDefinitionDto, user: ILoggedUserInfo | null): Promise<FlowDefinition>;
|
|
52
|
-
publish(id: string, note: string | undefined, user: ILoggedUserInfo | null): Promise<FlowDefinition>;
|
|
53
|
-
listVersions(flowId: string): Promise<IFlowVersion[]>;
|
|
54
|
-
getVersion(flowId: string, version: number): Promise<IFlowVersion>;
|
|
55
|
-
restoreVersion(flowId: string, version: number, user: ILoggedUserInfo | null): Promise<FlowDefinition>;
|
|
56
|
-
discardDraft(flowId: string, user: ILoggedUserInfo | null): Promise<FlowDefinition>;
|
|
57
|
-
private saveDraft;
|
|
58
|
-
private clearCaches;
|
|
59
46
|
protected beforeDeleteOperation(dto: DeleteDto, user: ILoggedUserInfo | null, _qr: QueryRunner): Promise<void>;
|
|
47
|
+
protected afterInsertOperation(entities: FlowDefinition[]): Promise<void>;
|
|
48
|
+
protected afterUpdateOperation(entities: FlowDefinition[]): Promise<void>;
|
|
60
49
|
private provisionPermissions;
|
|
61
50
|
}
|
|
62
|
-
export {};
|
|
@@ -4,7 +4,6 @@ import { EntityBuilderDataSourceProvider } from './entity-builder-datasource.pro
|
|
|
4
4
|
export interface IExecutionRecord {
|
|
5
5
|
flowId: string | null;
|
|
6
6
|
flowSlug: string;
|
|
7
|
-
flowVersion: number | null;
|
|
8
7
|
trigger: 'webhook' | 'test';
|
|
9
8
|
mode: 'live' | 'dry_run';
|
|
10
9
|
input: unknown;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
|
|
2
2
|
import { SharedPermissionCacheService } from '@flusys/nestjs-shared/modules';
|
|
3
3
|
import { ModuleRef } from '@nestjs/core';
|
|
4
4
|
import { type IFlowRunResult } from '../flow-engine/flow-run.types.js';
|
|
@@ -12,23 +12,22 @@ export interface IFlowRunOptions {
|
|
|
12
12
|
input: FlowInput;
|
|
13
13
|
startAt?: string;
|
|
14
14
|
request: Record<string, unknown>;
|
|
15
|
-
authorization?: string;
|
|
16
15
|
exposeDetails: boolean;
|
|
17
16
|
systemAuthorized: boolean;
|
|
18
17
|
}
|
|
19
18
|
export declare const flowTimeout: (timeoutMs: unknown) => number;
|
|
19
|
+
type RunnableFlow = IFlowSettings & {
|
|
20
|
+
timeoutMs: number;
|
|
21
|
+
};
|
|
20
22
|
export declare class FlowExecutorService {
|
|
21
23
|
private readonly provider;
|
|
22
24
|
private readonly ruleEngine;
|
|
23
25
|
private readonly moduleRef;
|
|
24
26
|
private readonly permissionCache;
|
|
25
27
|
private readonly config;
|
|
26
|
-
private readonly companyAccess?;
|
|
27
|
-
private readonly notifications?;
|
|
28
|
-
private readonly email?;
|
|
29
28
|
private readonly logger;
|
|
30
|
-
constructor(provider: EntityBuilderDataSourceProvider, ruleEngine: RuleEngineService, moduleRef: ModuleRef, permissionCache: SharedPermissionCacheService, config: EntityBuilderConfigService
|
|
31
|
-
run(
|
|
29
|
+
constructor(provider: EntityBuilderDataSourceProvider, ruleEngine: RuleEngineService, moduleRef: ModuleRef, permissionCache: SharedPermissionCacheService, config: EntityBuilderConfigService);
|
|
30
|
+
run(definition: RunnableFlow, options: IFlowRunOptions): Promise<IFlowRunResult>;
|
|
32
31
|
private execute;
|
|
33
32
|
private limitStatementTime;
|
|
34
33
|
private commitProgress;
|
|
@@ -39,3 +38,4 @@ export declare class FlowExecutorService {
|
|
|
39
38
|
private createEnv;
|
|
40
39
|
private publishPendingEvents;
|
|
41
40
|
}
|
|
41
|
+
export {};
|
|
@@ -50,7 +50,7 @@ export declare class GenericEntityService {
|
|
|
50
50
|
private insertRow;
|
|
51
51
|
private updateRow;
|
|
52
52
|
private assertUpdatable;
|
|
53
|
-
delete(id: string, user: ILoggedUserInfo | null, options?: IGenericWriteOptions): Promise<
|
|
53
|
+
delete(id: string, user: ILoggedUserInfo | null, options?: IGenericWriteOptions): Promise<void>;
|
|
54
54
|
findById(id: string, options?: IGenericReadOptions): Promise<IGenericRecord>;
|
|
55
55
|
exists(id: string, options?: IGenericReadOptions): Promise<boolean>;
|
|
56
56
|
getAll(search: string | undefined, query: IGenericQuery, options?: IGenericReadOptions): Promise<{
|
package/services/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from './reference-scanner.service.js';
|
|
|
19
19
|
export * from './field-value-validator.js';
|
|
20
20
|
export * from './database-error.mapper.js';
|
|
21
21
|
export * from './flow-definition.service.js';
|
|
22
|
+
export * from './flow-api-key.service.js';
|
|
22
23
|
export * from './flow-execution.service.js';
|
|
23
24
|
export * from './flow-executor.service.js';
|
|
24
25
|
export * from './flow-runtime.service.js';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Identity } from '@flusys/nestjs-shared';
|
|
2
|
-
import type { IFlowSnapshot } from '../interfaces/flow-definition.interface.js';
|
|
3
|
-
export declare class FlowVersion extends Identity {
|
|
4
|
-
flowId: string;
|
|
5
|
-
version: number;
|
|
6
|
-
definition: IFlowSnapshot;
|
|
7
|
-
note: string | null;
|
|
8
|
-
publishedAt: Date | null;
|
|
9
|
-
publishedById: string | null;
|
|
10
|
-
}
|