@flusys/nestjs-entity-builder 9.1.2 → 9.2.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.
Files changed (59) hide show
  1. package/README.md +49 -25
  2. package/config/entity-builder.constants.d.ts +1 -0
  3. package/config/message-keys.d.ts +37 -2
  4. package/controllers/definition-bundle.controller.d.ts +2 -2
  5. package/controllers/entity-definition.controller.d.ts +1 -1
  6. package/controllers/field-definition.controller.d.ts +1 -1
  7. package/controllers/flow-definition.controller.d.ts +3 -1
  8. package/controllers/flow-runtime.controller.d.ts +4 -3
  9. package/dtos/definition-bundle.dto.d.ts +1 -0
  10. package/dtos/entity-definition.dto.d.ts +1 -2
  11. package/fesm/21.js +39 -5
  12. package/fesm/{458.js → 28.js} +110 -63
  13. package/fesm/677.js +1543 -513
  14. package/fesm/794.js +1 -1
  15. package/fesm/857.js +3 -3
  16. package/fesm/870.js +974 -558
  17. package/fesm/897.js +187 -51
  18. package/fesm/946.js +72 -43
  19. package/fesm/config/index.js +10 -14
  20. package/fesm/docs/index.js +1 -1
  21. package/fesm/dtos/index.js +11 -0
  22. package/fesm/guards/index.js +16 -10
  23. package/fesm/index.js +44 -26
  24. package/fesm/modules/index.js +4 -3
  25. package/fesm/services/index.js +40 -59
  26. package/flow-engine/flow-code-runner.d.ts +16 -0
  27. package/flow-engine/flow-graph.validator.d.ts +1 -0
  28. package/flow-engine/flow-input.validator.d.ts +16 -1
  29. package/flow-engine/flow-run.types.d.ts +16 -0
  30. package/flow-engine/flow.types.d.ts +18 -1
  31. package/guards/designer-writable.interceptor.d.ts +1 -0
  32. package/interfaces/definition-bundle.interface.d.ts +4 -1
  33. package/interfaces/entity-builder-module.interface.d.ts +9 -0
  34. package/modules/entity-builder.module.d.ts +1 -0
  35. package/modules/index.d.ts +1 -0
  36. package/modules/tenant-context-id.strategy.d.ts +16 -0
  37. package/package.json +3 -4
  38. package/services/definition-bundle.diff.d.ts +6 -2
  39. package/services/definition-bundle.file.d.ts +2 -1
  40. package/services/definition-bundle.service.d.ts +10 -3
  41. package/services/entity-builder-config.service.d.ts +3 -0
  42. package/services/entity-builder-datasource.provider.d.ts +1 -0
  43. package/services/entity-flow-scaffold.d.ts +2 -1
  44. package/services/entity-permission.service.d.ts +1 -0
  45. package/services/field-value-validator.d.ts +7 -0
  46. package/services/flow-definition.service.d.ts +11 -3
  47. package/services/flow-executor.service.d.ts +3 -0
  48. package/services/flow-runtime.service.d.ts +7 -1
  49. package/services/generic-entity-service.factory.d.ts +5 -1
  50. package/services/generic-entity.service.d.ts +25 -2
  51. package/services/identifier-rules.d.ts +0 -1
  52. package/services/save-loaded.d.ts +2 -0
  53. package/services/schema-change-executor.service.d.ts +1 -0
  54. package/services/schema-columns.d.ts +7 -2
  55. package/services/schema-dialect-adapter.service.d.ts +2 -0
  56. package/services/schema-evolution.service.d.ts +8 -2
  57. package/services/schema-registry.service.d.ts +12 -0
  58. package/services/schema-sync.service.d.ts +3 -1
  59. package/flow-engine/flow-code-sandbox.d.ts +0 -5
@@ -1,9 +1,10 @@
1
- import { type ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
1
+ import { type ILoggedUserInfo, type IPermissionActionRegistry } from '@flusys/nestjs-shared/interfaces';
2
2
  import { type ExportBundleDto } from '../dtos/definition-bundle.dto.js';
3
3
  import { type IBundleExport, type IBundleImportPlan, type IBundleImportResult, type IImportBundleRequest } from '../interfaces/definition-bundle.interface.js';
4
4
  import { EntityBuilderConfigService } from './entity-builder-config.service.js';
5
5
  import { EntityBuilderDataSourceProvider } from './entity-builder-datasource.provider.js';
6
6
  import { FlowDefinitionService } from './flow-definition.service.js';
7
+ import { SchemaDialectAdapterService } from './schema-dialect-adapter.service.js';
7
8
  import { SchemaEvolutionService } from './schema-evolution.service.js';
8
9
  import { SchemaSyncService } from './schema-sync.service.js';
9
10
  export declare class DefinitionBundleService {
@@ -12,12 +13,15 @@ export declare class DefinitionBundleService {
12
13
  private readonly schemaSync;
13
14
  private readonly evolution;
14
15
  private readonly flows;
15
- constructor(provider: EntityBuilderDataSourceProvider, config: EntityBuilderConfigService, schemaSync: SchemaSyncService, evolution: SchemaEvolutionService, flows: FlowDefinitionService);
16
- private variables;
16
+ private readonly dialect;
17
+ private readonly actionRegistry?;
18
+ constructor(provider: EntityBuilderDataSourceProvider, config: EntityBuilderConfigService, schemaSync: SchemaSyncService, evolution: SchemaEvolutionService, flows: FlowDefinitionService, dialect: SchemaDialectAdapterService, actionRegistry?: IPermissionActionRegistry | undefined);
17
19
  export(dto: ExportBundleDto): Promise<IBundleExport>;
20
+ private leftBehind;
18
21
  private loadEntities;
19
22
  planImport(dto: IImportBundleRequest, user: ILoggedUserInfo | null): Promise<IBundleImportPlan>;
20
23
  private buildPlan;
24
+ private addPermissionWarnings;
21
25
  private relationNotYetCreated;
22
26
  private previewEntityStep;
23
27
  private diffFlows;
@@ -25,8 +29,11 @@ export declare class DefinitionBundleService {
25
29
  private createRequest;
26
30
  private changeRequest;
27
31
  applyImport(dto: IImportBundleRequest, user: ILoggedUserInfo | null): Promise<IBundleImportResult>;
32
+ private withImportLock;
33
+ private runImport;
28
34
  private applyEntityStep;
29
35
  private idIsFree;
30
36
  private freeFieldIds;
31
37
  private applyFlowStep;
38
+ private deactivateFlow;
32
39
  }
@@ -9,6 +9,9 @@ export declare class EntityBuilderConfigService implements IModuleConfigService
9
9
  isMultiTenant(): boolean;
10
10
  getOptions(): EntityBuilderModuleOptions;
11
11
  getConfig(): import("../index.js").IEntityBuilderConfig | undefined;
12
+ isFastUpdatesEnabled(): boolean;
13
+ isPartialIndexesEnabled(): boolean;
12
14
  isDesignerReadOnly(): boolean;
15
+ getCodeModules(): Record<string, string>;
13
16
  getBundleVariables(): Record<string, string>;
14
17
  }
@@ -19,6 +19,7 @@ export declare class EntityBuilderDataSourceProvider extends MultiTenantDataSour
19
19
  protected createDataSourceFromConfig(config: IDatabaseConfig): Promise<DataSource>;
20
20
  getDriver(): Promise<SupportedDbDriver>;
21
21
  registerDynamicSchema(schema: EntitySchema): Promise<void>;
22
+ registerDynamicSchemas(schemas: EntitySchema[]): Promise<void>;
22
23
  getDynamicRepository<T extends ObjectLiteral>(schema: EntitySchema<T>): Promise<Repository<T>>;
23
24
  getQueryRunner(): Promise<QueryRunner>;
24
25
  }
@@ -15,11 +15,12 @@ export interface IEntityFlowSource {
15
15
  label: string;
16
16
  fields: IEntityFlowField[];
17
17
  }
18
- type FlowInputLabel = 'id' | 'ids' | 'search';
18
+ type FlowInputLabel = 'id';
19
19
  export interface IEntityFlowTexts {
20
20
  names?: Partial<Record<EntityFlowEndpoint, string>>;
21
21
  inputLabels?: Partial<Record<FlowInputLabel, string>>;
22
22
  noMatchMessage?: string;
23
+ deleteOnlyMessage?: string;
23
24
  }
24
25
  export declare const ENTITY_FLOW_PATHS: Record<EntityFlowEndpoint, string>;
25
26
  export declare const entityFlowSlug: (entityCode: string) => string;
@@ -1,5 +1,6 @@
1
1
  import { type IPermissionActionRegistry } from '@flusys/nestjs-shared';
2
2
  import { EntityDefinition } from '../entities/entity-definition.entity.js';
3
+ export declare const entityPermissionCodes: (entityCode: string) => string[];
3
4
  export declare class EntityPermissionService {
4
5
  private readonly actionRegistry?;
5
6
  constructor(actionRegistry?: IPermissionActionRegistry | undefined);
@@ -11,6 +11,13 @@ export interface IValidatableField {
11
11
  selectOptions: unknown[] | null;
12
12
  validationRules: Record<string, unknown> | null;
13
13
  }
14
+ export declare const valueRulesOf: (field: {
15
+ code: string;
16
+ label?: string | null;
17
+ fieldType: FieldType;
18
+ selectOptions?: unknown[] | null;
19
+ validationRules?: Record<string, unknown> | null;
20
+ }) => IValidatableField;
14
21
  export declare function validateRecord(fields: IValidatableField[], values: Record<string, unknown>, mode: 'insert' | 'update'): {
15
22
  values: Record<string, unknown>;
16
23
  errors: IFieldError[];
@@ -10,9 +10,11 @@ import { FlowDefinition } from '../entities/flow-definition.entity.js';
10
10
  import { type IFlowValidationResult } from '../flow-engine/flow-graph.validator.js';
11
11
  import { type IFlowEndpoint, type IFlowSettings } from '../flow-engine/flow.types.js';
12
12
  import { type IFlowDefinition, type IFlowSnapshot, type IFlowVersion } from '../interfaces/flow-definition.interface.js';
13
+ import { EntityBuilderConfigService } from './entity-builder-config.service.js';
13
14
  import { EntityBuilderDataSourceProvider } from './entity-builder-datasource.provider.js';
14
15
  export declare const defaultFlowPermissionCode: (slug: string) => string;
15
16
  export declare const flowPermissions: (endpoint: Pick<IFlowEndpoint, "permissions">, slug: string) => ILogicNode;
17
+ export declare const asksExecutePermission: (endpoint: Pick<IFlowEndpoint, "authMode" | "permissions">) => boolean;
16
18
  export declare const flowNotFound: () => NotFoundException;
17
19
  export declare const isPublished: (flow: Pick<FlowDefinition, "version">) => boolean;
18
20
  export declare function snapshotOf(source: Partial<IFlowSnapshot>): IFlowSnapshot;
@@ -30,9 +32,11 @@ export declare class FlowDefinitionService extends ApiService<CreateFlowDefiniti
30
32
  private readonly notifications?;
31
33
  private readonly email?;
32
34
  private readonly companyAccess?;
33
- constructor(cacheManager: HybridCache, utilsService: UtilsService, provider: EntityBuilderDataSourceProvider, permissionCache: SharedPermissionCacheService, actionRegistry?: IPermissionActionRegistry | undefined, notifications?: INotificationAdapter | undefined, email?: IEmailAdapter | undefined, companyAccess?: ICompanyAccessResolver | undefined);
35
+ private readonly config?;
36
+ constructor(cacheManager: HybridCache, utilsService: UtilsService, provider: EntityBuilderDataSourceProvider, permissionCache: SharedPermissionCacheService, actionRegistry?: IPermissionActionRegistry | undefined, notifications?: INotificationAdapter | undefined, email?: IEmailAdapter | undefined, companyAccess?: ICompanyAccessResolver | undefined, config?: EntityBuilderConfigService | undefined);
34
37
  findOrFail(id: string): Promise<FlowDefinition>;
35
38
  validate(settings: IFlowSettings): Promise<IFlowValidationResult>;
39
+ codePackages(): string[];
36
40
  private callersOf;
37
41
  private assertNotCalled;
38
42
  private assertCallersKept;
@@ -56,8 +60,12 @@ export declare class FlowDefinitionService extends ApiService<CreateFlowDefiniti
56
60
  restoreVersion(flowId: string, version: number, user: ILoggedUserInfo | null): Promise<FlowDefinition>;
57
61
  discardDraft(flowId: string, user: ILoggedUserInfo | null): Promise<FlowDefinition>;
58
62
  private saveDraft;
59
- private clearCaches;
60
- protected beforeDeleteOperation(dto: DeleteDto, user: ILoggedUserInfo | null, _qr: QueryRunner): Promise<void>;
63
+ delete(option: DeleteDto, user: ILoggedUserInfo | null): Promise<null>;
64
+ protected beforeDeleteOperation(dto: DeleteDto, _user: ILoggedUserInfo | null, _qr: QueryRunner): Promise<void>;
65
+ protected afterDeleteOperation(deleted: Array<{
66
+ id: string;
67
+ }>, _dto: DeleteDto, _user: ILoggedUserInfo | null, qr: QueryRunner): Promise<void>;
68
+ private deprovisionPermissions;
61
69
  private provisionPermissions;
62
70
  }
63
71
  export {};
@@ -27,6 +27,7 @@ export declare class FlowExecutorService {
27
27
  private readonly email?;
28
28
  private readonly branchHierarchy?;
29
29
  private readonly logger;
30
+ private readonly inFlight;
30
31
  constructor(provider: EntityBuilderDataSourceProvider, ruleEngine: RuleEngineService, moduleRef: ModuleRef, permissionCache: SharedPermissionCacheService, config: EntityBuilderConfigService, companyAccess?: ICompanyAccessResolver | undefined, notifications?: INotificationAdapter | undefined, email?: IEmailAdapter | undefined, branchHierarchy?: IBranchHierarchyResolver | undefined);
31
32
  run(flow: IFlowSettings, options: IFlowRunOptions): Promise<IFlowRunResult>;
32
33
  private execute;
@@ -37,5 +38,7 @@ export declare class FlowExecutorService {
37
38
  private findCallable;
38
39
  private assertMayCall;
39
40
  private createEnv;
41
+ private publishAfterCommit;
42
+ whenPublished(): Promise<void>;
40
43
  private publishPendingEvents;
41
44
  }
@@ -1,4 +1,6 @@
1
+ import { HybridCache } from '@flusys/nestjs-shared/classes';
1
2
  import { type ILoggedUserInfo, type IMessageRef } from '@flusys/nestjs-shared/interfaces';
3
+ import { UtilsService } from '@flusys/nestjs-shared/modules';
2
4
  import { type TestFlowDto } from '../dtos/flow.dto.js';
3
5
  import { FlowDefinition } from '../entities/flow-definition.entity.js';
4
6
  import { type IFlowRunResult } from '../flow-engine/flow-run.types.js';
@@ -19,8 +21,12 @@ export declare class FlowRuntimeService {
19
21
  private readonly executor;
20
22
  private readonly executions;
21
23
  private readonly definitions;
22
- constructor(provider: EntityBuilderDataSourceProvider, executor: FlowExecutorService, executions: FlowExecutionService, definitions: FlowDefinitionService);
24
+ private readonly cache?;
25
+ private readonly utils?;
26
+ constructor(provider: EntityBuilderDataSourceProvider, executor: FlowExecutorService, executions: FlowExecutionService, definitions: FlowDefinitionService, cache?: HybridCache | undefined, utils?: UtilsService | undefined);
23
27
  findActive(slug: string): Promise<FlowDefinition | null>;
28
+ private activeFlowKey;
29
+ tenantScope(): string;
24
30
  handle(flow: FlowDefinition, endpoint: IFlowEndpoint, body: unknown, caller: IFlowCaller, user: ILoggedUserInfo | null): Promise<IFlowRunResult>;
25
31
  testRun(dto: TestFlowDto, user: ILoggedUserInfo | null, caller: IFlowCaller): Promise<{
26
32
  result: IFlowRunResult;
@@ -1,12 +1,16 @@
1
1
  import { type QueryRunner } from 'typeorm';
2
+ import { EntityBuilderConfigService } from './entity-builder-config.service.js';
2
3
  import { EntityBuilderDataSourceProvider } from './entity-builder-datasource.provider.js';
3
4
  import { GenericEntityService } from './generic-entity.service.js';
4
5
  import { SchemaRegistryService } from './schema-registry.service.js';
5
6
  export declare class GenericEntityServiceFactory {
6
7
  private readonly schemaRegistry;
7
8
  private readonly dataSourceProvider;
8
- constructor(schemaRegistry: SchemaRegistryService, dataSourceProvider: EntityBuilderDataSourceProvider);
9
+ private readonly config?;
10
+ private readonly relatedById;
11
+ constructor(schemaRegistry: SchemaRegistryService, dataSourceProvider: EntityBuilderDataSourceProvider, config?: EntityBuilderConfigService | undefined);
9
12
  forEntityCode(entityCode: string, queryRunner?: QueryRunner): Promise<GenericEntityService>;
10
13
  forEntityDefinitionId(entityDefinitionId: string, queryRunner?: QueryRunner): Promise<GenericEntityService>;
14
+ private related;
11
15
  private build;
12
16
  }
@@ -1,4 +1,5 @@
1
1
  import { type ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
2
+ import { BadRequestException } from '@nestjs/common';
2
3
  import { type EntitySchema, type QueryRunner } from 'typeorm';
3
4
  import { EntityDefinition } from '../entities/entity-definition.entity.js';
4
5
  import { FieldDefinition } from '../entities/field-definition.entity.js';
@@ -14,13 +15,19 @@ export interface IGenericQuery {
14
15
  currentPage: number;
15
16
  pageSize: number;
16
17
  };
18
+ withDeleted?: boolean;
17
19
  }
18
20
  export interface IGenericWriteOptions {
19
21
  queryRunner?: QueryRunner;
20
22
  publishEvents?: boolean;
23
+ statementTimeoutMs?: number;
21
24
  }
25
+ export declare const statementTimeoutSql: (timeoutMs: number) => string;
22
26
  export declare const ACTOR_BRANCH_METADATA_KEY = "_actorBranchId";
23
27
  export declare function actorMetadata(user: ILoggedUserInfo | null): Record<string, unknown>;
28
+ export interface IGenericEntityOptions {
29
+ fastUpdates?: boolean;
30
+ }
24
31
  export type RelatedServiceResolver = (entityDefinitionId: string, queryRunner?: QueryRunner) => Promise<GenericEntityService>;
25
32
  export declare class GenericEntityService {
26
33
  private readonly definition;
@@ -28,35 +35,51 @@ export declare class GenericEntityService {
28
35
  private readonly fields;
29
36
  private readonly dataSourceProvider;
30
37
  private readonly resolveRelated?;
38
+ private readonly options;
31
39
  private repository?;
32
40
  private readonly activeFieldCodes;
33
41
  private readonly presentSystemColumns;
34
- constructor(definition: EntityDefinition, schema: EntitySchema, fields: FieldDefinition[], dataSourceProvider: EntityBuilderDataSourceProvider, resolveRelated?: RelatedServiceResolver | undefined);
42
+ constructor(definition: EntityDefinition, schema: EntitySchema, fields: FieldDefinition[], dataSourceProvider: EntityBuilderDataSourceProvider, resolveRelated?: RelatedServiceResolver | undefined, options?: IGenericEntityOptions);
35
43
  get entityCode(): string;
36
44
  private validateValues;
37
45
  private throwIfInvalid;
46
+ private invalid;
38
47
  private assertRelationsExist;
48
+ private relatedNotFound;
49
+ private existingRelatedIds;
39
50
  private notFound;
40
51
  private auditFields;
41
- private stampDeletedBy;
42
52
  private ensureActive;
43
53
  private repositoryFor;
44
54
  private ensureRepository;
45
55
  private validateKeys;
46
56
  insert(dto: Record<string, unknown>, user: ILoggedUserInfo | null, options?: IGenericWriteOptions): Promise<IGenericRecord>;
57
+ prepareInsert(dto: Record<string, unknown>): Record<string, unknown>;
58
+ firstMissingRelation(rows: Record<string, unknown>[], queryRunner: QueryRunner): Promise<{
59
+ index: number;
60
+ error: BadRequestException;
61
+ } | null>;
62
+ insertValidated(rows: Record<string, unknown>[], user: ILoggedUserInfo | null, options: IGenericWriteOptions & {
63
+ queryRunner: QueryRunner;
64
+ }): Promise<IGenericRecord[]>;
65
+ get batchInsertable(): boolean;
66
+ private missingRelations;
47
67
  update(dto: Record<string, unknown> & {
48
68
  id: string;
49
69
  }, user: ILoggedUserInfo | null, options?: IGenericWriteOptions): Promise<IGenericRecord>;
50
70
  private insertRow;
71
+ updateLoaded(row: IGenericRecord, dto: Record<string, unknown>, user: ILoggedUserInfo | null, options?: IGenericWriteOptions): Promise<IGenericRecord>;
51
72
  private updateRow;
52
73
  private assertUpdatable;
53
74
  delete(id: string, user: ILoggedUserInfo | null, options?: IGenericWriteOptions): Promise<'deleted' | 'purged'>;
54
75
  findById(id: string, options?: IGenericReadOptions): Promise<IGenericRecord>;
55
76
  exists(id: string, options?: IGenericReadOptions): Promise<boolean>;
77
+ existingIds(ids: string[], options?: IGenericReadOptions): Promise<Set<string>>;
56
78
  getAll(search: string | undefined, query: IGenericQuery, options?: IGenericReadOptions): Promise<{
57
79
  data: IGenericRecord[];
58
80
  total: number;
59
81
  }>;
82
+ private totalOf;
60
83
  private applyFilter;
61
84
  private conditionSql;
62
85
  private listOperand;
@@ -1,5 +1,4 @@
1
1
  import { type FieldType } from '../enums/field-type.enum.js';
2
- export declare const RESERVED_WORDS: Set<string>;
3
2
  export declare function assertValidIdentifier(code: string, kind: 'entity' | 'field'): void;
4
3
  export declare function assertIndexableField(field: {
5
4
  code: string;
@@ -0,0 +1,2 @@
1
+ import { type EntityTarget, type ObjectLiteral, type QueryRunner } from 'typeorm';
2
+ export declare function saveLoaded<T extends ObjectLiteral>(queryRunner: QueryRunner, target: EntityTarget<T>, entity: T, databaseEntity: T): Promise<T>;
@@ -29,6 +29,7 @@ export declare class SchemaChangeExecutor {
29
29
  plan: ISchemaChangePlan;
30
30
  outcome: ISchemaChangeOutcome;
31
31
  }>;
32
+ private invalidateDefinitions;
32
33
  private compensate;
33
34
  private withUndo;
34
35
  private logFailure;
@@ -4,7 +4,10 @@ import { FieldType } from '../enums/field-type.enum.js';
4
4
  import { type SupportedDbDriver } from '../interfaces/schema-dialect-adapter.interface.js';
5
5
  import { type SchemaDialectAdapterService } from './schema-dialect-adapter.service.js';
6
6
  export declare const SYSTEM_COLUMN_NAMES: readonly ["id", "created_at", "updated_at", "deleted_at", "created_by_id", "updated_by_id", "deleted_by_id"];
7
- export declare const NON_INDEXABLE_FIELD_TYPES: readonly FieldType[];
7
+ export declare const indexedByDefault: (spec: {
8
+ fieldType: FieldType;
9
+ isIndexed?: boolean | null;
10
+ }) => boolean;
8
11
  export declare const isIndexableFieldType: (fieldType: FieldType) => boolean;
9
12
  export interface ISystemColumnFlags {
10
13
  isSoftDeleteEnabled: boolean;
@@ -15,7 +18,9 @@ export declare const softDeleteColumn: () => TableColumn;
15
18
  export declare const auditColumns: (driver: SupportedDbDriver) => TableColumn[];
16
19
  export declare const sameColumns: (columnNames: string[], expected: string[]) => boolean;
17
20
  export declare function indexName(prefix: 'idx' | 'uq', table: string, column: string, maxLength: number): string;
18
- export declare const plainIndex: (table: string, column: string, driver: SupportedDbDriver, adapter: SchemaDialectAdapterService) => TableIndex;
21
+ export declare const LIVE_ROWS_WHERE = "\"deleted_at\" IS NULL";
22
+ export declare const plainIndex: (table: string, column: string, driver: SupportedDbDriver, adapter: SchemaDialectAdapterService, liveOnly?: boolean) => TableIndex;
23
+ export declare const isLiveRowsIndex: (index: Pick<TableIndex, "where">) => boolean;
19
24
  export declare const tableUnique: (table: string, column: string, driver: SupportedDbDriver, adapter: SchemaDialectAdapterService) => TableUnique;
20
25
  export declare function addUnique(qr: QueryRunner, table: Table, column: string, driver: SupportedDbDriver, adapter: SchemaDialectAdapterService): Promise<void>;
21
26
  export declare function buildFieldColumn(field: Pick<FieldDefinition, 'code' | 'fieldType' | 'dbType' | 'nullable' | 'unique'>, driver: SupportedDbDriver, adapter: SchemaDialectAdapterService, options: {
@@ -9,5 +9,7 @@ export declare class SchemaDialectAdapterService implements ISchemaDialectAdapte
9
9
  sqlLiteral(value: unknown, driver: SupportedDbDriver): string;
10
10
  lockName(lockKey: string): string;
11
11
  acquireEntityLock(queryRunner: QueryRunner, lockKey: string, driver: SupportedDbDriver): Promise<void>;
12
+ tryAcquireSessionLock(queryRunner: QueryRunner, lockKey: string, driver: SupportedDbDriver): Promise<boolean>;
13
+ releaseSessionLock(queryRunner: QueryRunner, lockKey: string, driver: SupportedDbDriver): Promise<void>;
12
14
  releaseEntityLock(queryRunner: QueryRunner, lockKey: string, driver: SupportedDbDriver): Promise<void>;
13
15
  }
@@ -6,6 +6,7 @@ import { EntityPermissionService } from './entity-permission.service.js';
6
6
  import { ReferenceScannerService } from './reference-scanner.service.js';
7
7
  import { SchemaChangeExecutor } from './schema-change-executor.service.js';
8
8
  import { type ISchemaChangeApplied, type ISchemaChangePlan } from './schema-change.types.js';
9
+ import { EntityBuilderConfigService } from './entity-builder-config.service.js';
9
10
  import { SchemaDialectAdapterService } from './schema-dialect-adapter.service.js';
10
11
  export type SchemaFindingKind = 'missing_table' | 'missing_column' | 'extra_column' | 'type_mismatch' | 'nullability_mismatch' | 'missing_index' | 'missing_unique' | 'stale_metadata';
11
12
  export interface ISchemaFinding extends IMessageRef {
@@ -28,13 +29,14 @@ export declare class SchemaEvolutionService {
28
29
  private readonly executor;
29
30
  private readonly references;
30
31
  private readonly permissions;
31
- constructor(dataSourceProvider: EntityBuilderDataSourceProvider, adapter: SchemaDialectAdapterService, executor: SchemaChangeExecutor, references: ReferenceScannerService, permissions: EntityPermissionService);
32
+ private readonly config?;
33
+ constructor(dataSourceProvider: EntityBuilderDataSourceProvider, adapter: SchemaDialectAdapterService, executor: SchemaChangeExecutor, references: ReferenceScannerService, permissions: EntityPermissionService, config?: EntityBuilderConfigService | undefined);
32
34
  plan(request: SchemaChangeRequestDto, user: ILoggedUserInfo | null): Promise<ISchemaChangePlan>;
33
35
  apply(request: SchemaChangeRequestDto, user: ILoggedUserInfo | null, options?: {
34
36
  fieldId?: string;
35
37
  }): Promise<ISchemaChangeApplied>;
36
38
  inspect(entityDefinitionId: string): Promise<ISchemaCheckResult>;
37
- history(entityDefinitionId: string, limit?: number): Promise<SchemaChangeLog[]>;
39
+ history(entityDefinitionId: string): Promise<SchemaChangeLog[]>;
38
40
  private loadEntity;
39
41
  private loadField;
40
42
  private definitions;
@@ -56,12 +58,16 @@ export declare class SchemaEvolutionService {
56
58
  private dropUniques;
57
59
  private hasUnique;
58
60
  private indexOn;
61
+ private liveOnly;
62
+ private hasPlainIndex;
63
+ private rebuildPlainIndex;
59
64
  private prepareAddField;
60
65
  private prepareUpdateField;
61
66
  private prepareDeprecateField;
62
67
  private prepareRestoreField;
63
68
  private preparePurgeField;
64
69
  private prepareUpdateEntity;
70
+ private reshapePlainIndexes;
65
71
  private relationsInto;
66
72
  private prepareDropEntity;
67
73
  private diff;
@@ -1,12 +1,24 @@
1
1
  import { EntitySchema, type QueryRunner } from 'typeorm';
2
+ import { EntityDefinition } from '../entities/entity-definition.entity.js';
3
+ import { FieldDefinition } from '../entities/field-definition.entity.js';
2
4
  import { EntityBuilderDataSourceProvider } from './entity-builder-datasource.provider.js';
3
5
  import { SchemaDialectAdapterService } from './schema-dialect-adapter.service.js';
6
+ export interface IResolvedSchema {
7
+ schema: EntitySchema;
8
+ fields: FieldDefinition[];
9
+ }
4
10
  export declare class SchemaRegistryService {
5
11
  private readonly dataSourceProvider;
6
12
  private readonly dialectAdapter;
7
13
  private static readonly cache;
14
+ private static readonly warming;
15
+ private readonly logger;
8
16
  constructor(dataSourceProvider: EntityBuilderDataSourceProvider, dialectAdapter: SchemaDialectAdapterService);
9
17
  getSchema(entityDefinitionId: string, queryRunner?: QueryRunner): Promise<EntitySchema>;
18
+ resolve(definition: EntityDefinition, queryRunner?: QueryRunner): Promise<IResolvedSchema>;
19
+ warmUp(queryRunner?: QueryRunner): Promise<void>;
20
+ private registerAll;
21
+ private store;
10
22
  invalidate(entityDefinitionId: string): void;
11
23
  private cacheKey;
12
24
  private buildEntitySchema;
@@ -6,6 +6,7 @@ import { EntityPermissionService } from './entity-permission.service.js';
6
6
  import { FlowDefinitionService } from './flow-definition.service.js';
7
7
  import { SchemaChangeExecutor } from './schema-change-executor.service.js';
8
8
  import { type ISchemaChangePlan } from './schema-change.types.js';
9
+ import { EntityBuilderConfigService } from './entity-builder-config.service.js';
9
10
  import { SchemaDialectAdapterService } from './schema-dialect-adapter.service.js';
10
11
  export interface ICreatedEntity {
11
12
  definition: EntityDefinition;
@@ -21,8 +22,9 @@ export declare class SchemaSyncService {
21
22
  private readonly executor;
22
23
  private readonly entityPermissionService;
23
24
  private readonly flowDefinitionService;
25
+ private readonly config?;
24
26
  private readonly logger;
25
- constructor(dataSourceProvider: EntityBuilderDataSourceProvider, dialectAdapter: SchemaDialectAdapterService, executor: SchemaChangeExecutor, entityPermissionService: EntityPermissionService, flowDefinitionService: FlowDefinitionService);
27
+ constructor(dataSourceProvider: EntityBuilderDataSourceProvider, dialectAdapter: SchemaDialectAdapterService, executor: SchemaChangeExecutor, entityPermissionService: EntityPermissionService, flowDefinitionService: FlowDefinitionService, config?: EntityBuilderConfigService | undefined);
26
28
  private validateCreateRequest;
27
29
  private createTarget;
28
30
  private createRun;
@@ -1,5 +0,0 @@
1
- export interface ICodeRunResult {
2
- output: unknown;
3
- logs: string[];
4
- }
5
- export declare function runSandboxedCode(code: string, ctx: Record<string, unknown>, timeoutMs: number, node: string): Promise<ICodeRunResult>;