@decaf-ts/core 0.20.0 → 0.21.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/lib/cjs/index.cjs +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/types/auth/constants.d.ts +5 -0
- package/lib/types/auth/decorators.d.ts +5 -0
- package/lib/types/auth/index.d.ts +2 -0
- package/lib/types/fs/FilesystemAdapter.d.ts +70 -0
- package/lib/types/fs/FsDispatch.d.ts +7 -0
- package/lib/types/fs/helpers.d.ts +17 -0
- package/lib/types/fs/index.d.ts +4 -0
- package/lib/types/fs/indexStore.d.ts +28 -0
- package/lib/types/fs/locks/FilesystemLock.d.ts +13 -0
- package/lib/types/fs/locks/FilesystemMultiLock.d.ts +8 -0
- package/lib/types/fs/types.d.ts +40 -0
- package/lib/types/identity/decorators.d.ts +72 -0
- package/lib/types/identity/index.d.ts +6 -0
- package/lib/types/index.d.cts +1 -1
- package/lib/types/index.d.mts +1 -1
- package/lib/types/index.d.ts +34 -0
- package/lib/types/interfaces/ContextuallyLogged.d.ts +8 -0
- package/lib/types/interfaces/ErrorParser.d.ts +16 -0
- package/lib/types/interfaces/Executor.d.ts +16 -0
- package/lib/types/interfaces/Observable.d.ts +33 -0
- package/lib/types/interfaces/Observer.d.ts +15 -0
- package/lib/types/interfaces/Paginatable.d.ts +20 -0
- package/lib/types/interfaces/Queriable.d.ts +47 -0
- package/lib/types/interfaces/RawExecutor.d.ts +28 -0
- package/lib/types/interfaces/SequenceOptions.d.ts +79 -0
- package/lib/types/interfaces/index.d.ts +12 -0
- package/lib/types/migrations/Migration.d.ts +19 -0
- package/lib/types/migrations/MigrationService.d.ts +63 -0
- package/lib/types/migrations/MigrationTaskBuilder.d.ts +10 -0
- package/lib/types/migrations/MigrationTasks.d.ts +9 -0
- package/lib/types/migrations/MigrationVersioning.d.ts +7 -0
- package/lib/types/migrations/SemverMigrationVersioning.d.ts +10 -0
- package/lib/types/migrations/StandardMigrationVersioning.d.ts +12 -0
- package/lib/types/migrations/constants.d.ts +2 -0
- package/lib/types/migrations/decorators.d.ts +12 -0
- package/lib/types/migrations/index.d.ts +15 -0
- package/lib/types/migrations/types.d.ts +46 -0
- package/lib/types/model/BaseModel.d.ts +37 -0
- package/lib/types/model/SequenceModel.d.ts +32 -0
- package/lib/types/model/construction.d.ts +455 -0
- package/lib/types/model/decorators.d.ts +237 -0
- package/lib/types/model/index.d.ts +11 -0
- package/lib/types/model/indexing.d.ts +20 -0
- package/lib/types/model/types.d.ts +60 -0
- package/lib/types/overrides/Metadata.d.ts +22 -0
- package/lib/types/overrides/Model.d.ts +94 -0
- package/lib/types/overrides/ModelBuilder.d.ts +31 -0
- package/lib/types/overrides/index.d.ts +11 -0
- package/lib/types/overrides/injectables.d.ts +10 -0
- package/lib/types/overrides/overrides.d.ts +1 -0
- package/lib/types/persistence/Adapter.d.ts +469 -0
- package/lib/types/persistence/Context.d.ts +16 -0
- package/lib/types/persistence/ContextLock.d.ts +18 -0
- package/lib/types/persistence/Dispatch.d.ts +128 -0
- package/lib/types/persistence/ObserverHandler.d.ts +111 -0
- package/lib/types/persistence/Sequence.d.ts +126 -0
- package/lib/types/persistence/constants.d.ts +74 -0
- package/lib/types/persistence/decorators.d.ts +28 -0
- package/lib/types/persistence/errors.d.ts +33 -0
- package/lib/types/persistence/event-filters.d.ts +20 -0
- package/lib/types/persistence/generators.d.ts +14 -0
- package/lib/types/persistence/index.d.ts +18 -0
- package/lib/types/persistence/transactions.d.ts +4 -0
- package/lib/types/persistence/types.d.ts +86 -0
- package/lib/types/query/Condition.d.ts +131 -0
- package/lib/types/query/MethodQueryBuilder.d.ts +185 -0
- package/lib/types/query/Paginator.d.ts +105 -0
- package/lib/types/query/Statement.d.ts +136 -0
- package/lib/types/query/constants.d.ts +69 -0
- package/lib/types/query/decorators.d.ts +8 -0
- package/lib/types/query/errors.d.ts +21 -0
- package/lib/types/query/index.d.ts +16 -0
- package/lib/types/query/options.d.ts +393 -0
- package/lib/types/query/selectors.d.ts +39 -0
- package/lib/types/query/types.d.ts +158 -0
- package/lib/types/query/utils.d.ts +40 -0
- package/lib/types/ram/RamAdapter.d.ts +341 -0
- package/lib/types/ram/RamPaginator.d.ts +54 -0
- package/lib/types/ram/RamStatement.d.ts +92 -0
- package/lib/types/ram/constants.d.ts +8 -0
- package/lib/types/ram/handlers.d.ts +24 -0
- package/lib/types/ram/index.d.ts +12 -0
- package/lib/types/ram/types.d.ts +50 -0
- package/lib/types/repository/Repository.d.ts +501 -0
- package/lib/types/repository/constants.d.ts +36 -0
- package/lib/types/repository/decorators.d.ts +30 -0
- package/lib/types/repository/errors.d.ts +19 -0
- package/lib/types/repository/index.d.ts +12 -0
- package/lib/types/repository/injectables.d.ts +95 -0
- package/lib/types/repository/types.d.ts +28 -0
- package/lib/types/repository/utils.d.ts +36 -0
- package/lib/types/services/ModelService.d.ts +45 -0
- package/lib/types/services/PersistenceService.d.ts +17 -0
- package/lib/types/services/index.d.ts +8 -0
- package/lib/types/services/services.d.ts +96 -0
- package/lib/types/tasks/CleanUpTask.d.ts +15 -0
- package/lib/types/tasks/TaskContext.d.ts +30 -0
- package/lib/types/tasks/TaskEngine.d.ts +97 -0
- package/lib/types/tasks/TaskErrors.d.ts +65 -0
- package/lib/types/tasks/TaskEventBus.d.ts +17 -0
- package/lib/types/tasks/TaskEventService.d.ts +7 -0
- package/lib/types/tasks/TaskHandler.d.ts +12 -0
- package/lib/types/tasks/TaskHandlerRegistry.d.ts +8 -0
- package/lib/types/tasks/TaskService.d.ts +65 -0
- package/lib/types/tasks/TaskStateChangeError.d.ts +11 -0
- package/lib/types/tasks/TaskTracker.d.ts +47 -0
- package/lib/types/tasks/builder.d.ts +72 -0
- package/lib/types/tasks/constants.d.ts +31 -0
- package/lib/types/tasks/decorators.d.ts +4 -0
- package/lib/types/tasks/index.d.ts +23 -0
- package/lib/types/tasks/logging.d.ts +31 -0
- package/lib/types/tasks/models/TaskBackoffModel.d.ts +9 -0
- package/lib/types/tasks/models/TaskErrorModel.d.ts +8 -0
- package/lib/types/tasks/models/TaskEventModel.d.ts +11 -0
- package/lib/types/tasks/models/TaskIOSerializer.d.ts +33 -0
- package/lib/types/tasks/models/TaskLogEntryModel.d.ts +10 -0
- package/lib/types/tasks/models/TaskModel.d.ts +43 -0
- package/lib/types/tasks/models/TaskStepResultModel.d.ts +9 -0
- package/lib/types/tasks/models/TaskStepSpecModel.d.ts +9 -0
- package/lib/types/tasks/models/index.d.ts +8 -0
- package/lib/types/tasks/types.d.ts +71 -0
- package/lib/types/tasks/utils.d.ts +5 -0
- package/lib/types/utils/ContextualLoggedClass.d.ts +37 -0
- package/lib/types/utils/decorators.d.ts +27 -0
- package/lib/types/utils/errors.d.ts +56 -0
- package/lib/types/utils/index.d.ts +11 -0
- package/lib/types/utils/throttling.d.ts +9 -0
- package/lib/types/utils/types.d.ts +23 -0
- package/lib/types/utils/utils.d.ts +22 -0
- package/lib/types/workers/TaskEngine.d.ts +40 -0
- package/lib/types/workers/WorkThreadEnvironment.d.ts +35 -0
- package/lib/types/workers/index.d.ts +5 -0
- package/lib/types/workers/messages.d.ts +69 -0
- package/lib/types/workers/types.d.ts +41 -0
- package/lib/types/workers/workerThread.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Exports for the interfaces module.
|
|
3
|
+
* @summary This file exports all the necessary components for the interfaces functionality, including ErrorParser, Executor, and more.
|
|
4
|
+
* @module core/interfaces
|
|
5
|
+
*/
|
|
6
|
+
export * from "./ErrorParser";
|
|
7
|
+
export * from "./Executor";
|
|
8
|
+
export * from "./Observable";
|
|
9
|
+
export * from "./Observer";
|
|
10
|
+
export * from "./Queriable";
|
|
11
|
+
export * from "./RawExecutor";
|
|
12
|
+
export * from "./SequenceOptions";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ConnectionForAdapter, Migration } from "./types";
|
|
2
|
+
import { AbsContextual, ContextualArgs } from "../utils/ContextualLoggedClass";
|
|
3
|
+
import { Adapter } from "../persistence/Adapter";
|
|
4
|
+
import { ContextOf } from "../persistence/types";
|
|
5
|
+
export declare abstract class AbsMigration<A extends Adapter<any, any, any, any>, R = void> extends AbsContextual<ContextOf<A>> implements Migration<A, R> {
|
|
6
|
+
private _reference?;
|
|
7
|
+
private _precedence?;
|
|
8
|
+
transaction: boolean;
|
|
9
|
+
get reference(): string;
|
|
10
|
+
get precedence(): string | Migration<any, any>;
|
|
11
|
+
protected constructor();
|
|
12
|
+
protected get adapter(): A;
|
|
13
|
+
protected abstract getQueryRunner(conn: ConnectionForAdapter<A>): ConnectionForAdapter<A>;
|
|
14
|
+
private enforceRules;
|
|
15
|
+
private prefix;
|
|
16
|
+
abstract down(qr: ConnectionForAdapter<A>, adapter: A, ...args: ContextualArgs<ContextOf<A>>): Promise<void>;
|
|
17
|
+
abstract migrate(qr: ConnectionForAdapter<A>, adapter: A, ...args: ContextualArgs<ContextOf<A>>): Promise<R>;
|
|
18
|
+
abstract up(qr: ConnectionForAdapter<A>, adapter: A, ctx: ContextOf<A>): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Migration, MigrationConfig, PersistenceMigrationConfig } from "./types";
|
|
2
|
+
import { ClientBasedService } from "../services/services";
|
|
3
|
+
import { Adapter } from "../persistence/Adapter";
|
|
4
|
+
import { ContextOf } from "../persistence/types";
|
|
5
|
+
import { ContextualArgs, MaybeContextualArg } from "../utils/ContextualLoggedClass";
|
|
6
|
+
import { TaskModel } from "../tasks/models/TaskModel";
|
|
7
|
+
import { MigrationVersioning } from "./MigrationVersioning";
|
|
8
|
+
type ResolvedMigration = {
|
|
9
|
+
migration: Migration<any, any>;
|
|
10
|
+
flavour: string;
|
|
11
|
+
reference: string;
|
|
12
|
+
version: string;
|
|
13
|
+
};
|
|
14
|
+
type VersionTask = {
|
|
15
|
+
version: string;
|
|
16
|
+
task: TaskModel;
|
|
17
|
+
};
|
|
18
|
+
export declare class MigrationService<PERSIST extends boolean, A extends Adapter<any, any, any, any> = any, R = void> extends ClientBasedService<PERSIST extends boolean ? A : void, MigrationConfig<PERSIST>> implements Migration<A, R> {
|
|
19
|
+
protected versioning: MigrationVersioning;
|
|
20
|
+
protected queuedTaskChain: Array<{
|
|
21
|
+
id: string;
|
|
22
|
+
version: string;
|
|
23
|
+
}>;
|
|
24
|
+
flavour?: string;
|
|
25
|
+
readonly reference: string;
|
|
26
|
+
readonly precedence: Migration<any, any> | Migration<any, any>[] | null;
|
|
27
|
+
transaction: boolean;
|
|
28
|
+
constructor();
|
|
29
|
+
static migrateAdapters<AD extends Adapter<any, any, any, any> = Adapter<any, any, any, any>>(adapters: AD[], cfg?: PersistenceMigrationConfig<AD>, ...args: MaybeContextualArg<ContextOf<AD>>): Promise<MigrationService<true, AD>[]>;
|
|
30
|
+
initialize(...args: MaybeContextualArg<ContextOf<A>>): Promise<{
|
|
31
|
+
config: MigrationConfig<PERSIST>;
|
|
32
|
+
client: PERSIST extends boolean ? A : void;
|
|
33
|
+
}>;
|
|
34
|
+
down(qr: any, adapter: any, ...args: ContextualArgs<ContextOf<any>>): Promise<void>;
|
|
35
|
+
protected normalizeVersion(raw: string, precedenceHint?: string): string;
|
|
36
|
+
protected extractPrecedenceTokens(migration: Migration<any, any>): string[];
|
|
37
|
+
protected referencesMigration(candidate: Migration<any, any>, target: ResolvedMigration): boolean;
|
|
38
|
+
protected precedenceHint(migration: Migration<any, any>): string | undefined;
|
|
39
|
+
protected compareByPrecedence(migration1: ResolvedMigration, migration2: ResolvedMigration): number;
|
|
40
|
+
protected sort(migrations: ResolvedMigration[]): ResolvedMigration[];
|
|
41
|
+
protected resolveMigration(migration: Migration<any, any>): ResolvedMigration;
|
|
42
|
+
protected shouldIncludeMigration(migration: ResolvedMigration, targetFlavour?: string, includeGeneric?: boolean): boolean;
|
|
43
|
+
protected collectMigrations(targetFlavour?: string, includeGeneric?: boolean): ResolvedMigration[];
|
|
44
|
+
protected buildExecutionPlan(options?: {
|
|
45
|
+
fromVersion?: string;
|
|
46
|
+
toVersion?: string;
|
|
47
|
+
targetFlavour?: string;
|
|
48
|
+
includeGeneric?: boolean;
|
|
49
|
+
}): ResolvedMigration[];
|
|
50
|
+
protected executeMigration(migration: ResolvedMigration, ...args: ContextualArgs<ContextOf<any>>): Promise<void>;
|
|
51
|
+
protected buildMigrationTaskForPlan(plan: ResolvedMigration[], ...args: ContextualArgs<ContextOf<any>>): TaskModel;
|
|
52
|
+
protected buildMigrationTasksForPlan(plan: ResolvedMigration[], ...args: ContextualArgs<ContextOf<any>>): VersionTask[];
|
|
53
|
+
createMigrationTask(targetVersion?: string, fromVersion?: string, ...args: ContextualArgs<ContextOf<any>>): TaskModel;
|
|
54
|
+
createMigrationTasks(targetVersion?: string, fromVersion?: string, ...args: ContextualArgs<ContextOf<any>>): VersionTask[];
|
|
55
|
+
protected migrationTaskIdsFromContext(taskKey: string, args: ContextualArgs<ContextOf<any>>): string[];
|
|
56
|
+
migrate(qr?: any, adapter?: any, ...args: MaybeContextualArg<ContextOf<any>>): Promise<R>;
|
|
57
|
+
migrateNormally(qr?: any, adapter?: any, ...args: MaybeContextualArg<ContextOf<any>>): Promise<R>;
|
|
58
|
+
migrateViaTasks(qr?: any, adapter?: any, ...args: MaybeContextualArg<ContextOf<any>>): Promise<R>;
|
|
59
|
+
track(taskIds?: string[] | string, ...args: MaybeContextualArg<ContextOf<any>>): Promise<void>;
|
|
60
|
+
retry(taskIds?: string[] | string, ...args: MaybeContextualArg<ContextOf<any>>): Promise<void>;
|
|
61
|
+
up(qr: any, adapter: any, ...args: ContextualArgs<ContextOf<any>>): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CompositeTaskBuilder } from "../tasks/builder";
|
|
2
|
+
import { TaskModel } from "../tasks/models/TaskModel";
|
|
3
|
+
import { MigrationStepInput } from "./MigrationTasks";
|
|
4
|
+
export declare class MigrationTaskBuilder {
|
|
5
|
+
protected readonly builder: CompositeTaskBuilder;
|
|
6
|
+
constructor(name?: string);
|
|
7
|
+
addMigrationStep(step: MigrationStepInput): this;
|
|
8
|
+
addStep(classification: string, input?: any): this;
|
|
9
|
+
build(): TaskModel;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TaskHandler } from "../tasks/TaskHandler";
|
|
2
|
+
import { TaskContext } from "../tasks/TaskContext";
|
|
3
|
+
export interface MigrationStepInput {
|
|
4
|
+
reference: string;
|
|
5
|
+
args?: any[];
|
|
6
|
+
}
|
|
7
|
+
export declare class MigrationTask extends TaskHandler<MigrationStepInput, void> {
|
|
8
|
+
run(input: MigrationStepInput, ctx: TaskContext): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MigrationVersioning } from "./MigrationVersioning";
|
|
2
|
+
export declare class SemverMigrationVersioning implements MigrationVersioning {
|
|
3
|
+
private coerce;
|
|
4
|
+
private slug;
|
|
5
|
+
isVersionHint(value: string): boolean;
|
|
6
|
+
normalize(reference: string, precedenceHint?: string): string;
|
|
7
|
+
compare(a: string, b: string): number;
|
|
8
|
+
gt(a: string, b: string): boolean;
|
|
9
|
+
lte(a: string, b: string): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MigrationVersioning } from "./MigrationVersioning";
|
|
2
|
+
/**
|
|
3
|
+
* Legacy non-semver migration ordering strategy.
|
|
4
|
+
* Keeps references as-is and compares using lexical order.
|
|
5
|
+
*/
|
|
6
|
+
export declare class StandardMigrationVersioning implements MigrationVersioning {
|
|
7
|
+
isVersionHint(value: string): boolean;
|
|
8
|
+
normalize(reference: string, precedenceHint?: string): string;
|
|
9
|
+
compare(a: string, b: string): number;
|
|
10
|
+
gt(a: string, b: string): boolean;
|
|
11
|
+
lte(a: string, b: string): boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Constructor } from "@decaf-ts/decoration";
|
|
2
|
+
import { Migration, MigrationRule } from "./types";
|
|
3
|
+
export declare function migration(reference: string): (target: object) => any;
|
|
4
|
+
export declare function migration(reference: string, precedence: Constructor<Migration<any, any>> | null): (target: object) => any;
|
|
5
|
+
export declare function migration(reference: string, flavour: string, rules?: MigrationRule[]): (target: object) => any;
|
|
6
|
+
export declare function migration(reference: string, precedence: Constructor<Migration<any, any>>, flavour: string): (target: object) => any;
|
|
7
|
+
export declare function migration(reference: string, precedence?: Constructor<Migration<any, any>> | string | null, flavour?: string | MigrationRule[], rules?: MigrationRule[]): (target: object) => any;
|
|
8
|
+
export declare function migration(reference: string, opts?: {
|
|
9
|
+
precedence?: Constructor<Migration<any, any>> | string | null;
|
|
10
|
+
flavour?: string;
|
|
11
|
+
rules?: MigrationRule[];
|
|
12
|
+
}): (target: object) => any;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Exports for the migrations module.
|
|
3
|
+
* @summary This file exports all the necessary components for the migrations functionality, including constants, decorators, and more.
|
|
4
|
+
* @module core/migrations
|
|
5
|
+
*/
|
|
6
|
+
import "../overrides";
|
|
7
|
+
export * from "./constants";
|
|
8
|
+
export * from "./decorators";
|
|
9
|
+
export * from "./Migration";
|
|
10
|
+
export * from "./MigrationService";
|
|
11
|
+
export * from "./MigrationTaskBuilder";
|
|
12
|
+
export * from "./MigrationTasks";
|
|
13
|
+
export * from "./StandardMigrationVersioning";
|
|
14
|
+
export * from "./MigrationVersioning";
|
|
15
|
+
export * from "./types";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Adapter } from "../persistence/Adapter";
|
|
2
|
+
import { AdapterFlags, ContextOf } from "../persistence/types";
|
|
3
|
+
import { ContextualArgs } from "../utils/ContextualLoggedClass";
|
|
4
|
+
import { TaskService } from "../tasks/TaskService";
|
|
5
|
+
import type { MigrationVersioning } from "./MigrationVersioning";
|
|
6
|
+
export interface Migration<A extends Adapter<any, any, any, any>, R = void> {
|
|
7
|
+
flavour?: string;
|
|
8
|
+
precedence: Migration<any, any> | Migration<any, any>[] | string | null;
|
|
9
|
+
reference: string;
|
|
10
|
+
transaction: boolean;
|
|
11
|
+
up(qr: ConnectionForAdapter<A>, adapter: A, ...args: ContextualArgs<ContextOf<A>>): Promise<void>;
|
|
12
|
+
migrate(qr: ConnectionForAdapter<A>, adapter: A, ...args: ContextualArgs<ContextOf<A>>): Promise<R>;
|
|
13
|
+
down(qr: ConnectionForAdapter<A>, adapter: A, ...args: ContextualArgs<ContextOf<A>>): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export type ConnectionForAdapter<A extends Adapter<any, any, any, any>> = A extends Adapter<any, any, infer CONN, any> ? CONN : never;
|
|
16
|
+
export type MigrationRule<A extends Adapter<any, any, any, any> = any, QUERYRUNNER = ConnectionForAdapter<A>> = (qr: QUERYRUNNER, adapter: A, ctx: ContextOf<A>) => Promise<boolean>;
|
|
17
|
+
export type MigrationMetadata = {
|
|
18
|
+
precedence?: Migration<any, any> | string;
|
|
19
|
+
flavour: string;
|
|
20
|
+
rules?: MigrationRule[];
|
|
21
|
+
};
|
|
22
|
+
export type RetrieveLastVersionHandler<A extends Adapter<any, any, any, any> = Adapter<any, any, any, any>> = (adapter: A, ...args: ContextualArgs<ContextOf<A>>) => Promise<string | undefined | null>;
|
|
23
|
+
export type SetCurrentVersionHandler<A extends Adapter<any, any, any, any> = Adapter<any, any, any, any>> = (version: string, adapter: A, ...args: ContextualArgs<ContextOf<A>>) => Promise<void>;
|
|
24
|
+
export type AdapterMigrationHandlers<AD extends Adapter<any, any, any, any> = Adapter<any, any, any, any>> = {
|
|
25
|
+
retrieveLastVersion?: RetrieveLastVersionHandler<AD>;
|
|
26
|
+
setCurrentVersion?: SetCurrentVersionHandler<AD>;
|
|
27
|
+
};
|
|
28
|
+
export type PersistenceMigrationConfig<AD extends Adapter<any, any, any, any> = Adapter<any, any, any, any>> = {
|
|
29
|
+
toVersion?: string;
|
|
30
|
+
taskMode?: boolean;
|
|
31
|
+
dryRun?: boolean;
|
|
32
|
+
flavours?: string[];
|
|
33
|
+
taskService?: TaskService<any>;
|
|
34
|
+
handlers?: Partial<Record<string, AdapterMigrationHandlers<AD>>>;
|
|
35
|
+
};
|
|
36
|
+
export type MigrationConfig<PERSIST extends boolean> = AdapterFlags<any> & {
|
|
37
|
+
persistMigrationSteps: PERSIST;
|
|
38
|
+
persistenceFlavour?: string;
|
|
39
|
+
targetVersion?: string;
|
|
40
|
+
taskMode?: boolean;
|
|
41
|
+
includeGenericInTaskMode?: boolean;
|
|
42
|
+
retrieveLastVersion?: RetrieveLastVersionHandler;
|
|
43
|
+
setCurrentVersion?: SetCurrentVersionHandler;
|
|
44
|
+
taskService?: TaskService<any>;
|
|
45
|
+
versioning?: MigrationVersioning;
|
|
46
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ModelArg, Model } from "@decaf-ts/decorator-validation";
|
|
2
|
+
/**
|
|
3
|
+
* @description Base model class for all domain models
|
|
4
|
+
* @summary An abstract base class that extends the Model class from decorator-validation and adds timestamp functionality.
|
|
5
|
+
* All domain models in the application should extend this class to inherit common properties and behaviors.
|
|
6
|
+
* @param {ModelArg<BaseModel>} arg - Optional initialization data for the model
|
|
7
|
+
* @class BaseModel
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* class User extends BaseModel {
|
|
11
|
+
* @required()
|
|
12
|
+
* username!: string;
|
|
13
|
+
*
|
|
14
|
+
* @email()
|
|
15
|
+
* email!: string;
|
|
16
|
+
*
|
|
17
|
+
* constructor(data?: ModelArg<User>) {
|
|
18
|
+
* super(data);
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* const user = new User({ username: 'john', email: 'john@example.com' });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare abstract class BaseModel extends Model {
|
|
26
|
+
/**
|
|
27
|
+
* @description Creation timestamp for the model
|
|
28
|
+
* @summary Automatically set to the current date and time when the model is created
|
|
29
|
+
*/
|
|
30
|
+
createdAt: Date;
|
|
31
|
+
/**
|
|
32
|
+
* @description Last update timestamp for the model
|
|
33
|
+
* @summary Automatically updated to the current date and time whenever the model is modified
|
|
34
|
+
*/
|
|
35
|
+
updatedAt: Date;
|
|
36
|
+
protected constructor(arg?: ModelArg<BaseModel>);
|
|
37
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ModelArg } from "@decaf-ts/decorator-validation";
|
|
2
|
+
import { BaseModel } from "./BaseModel";
|
|
3
|
+
/**
|
|
4
|
+
* @description RAM sequence model for auto-incrementing values
|
|
5
|
+
* @summary A model class that represents a sequence in the RAM adapter. It stores the current value
|
|
6
|
+
* of a sequence that can be used for generating sequential identifiers for entities.
|
|
7
|
+
* The sequence is identified by its ID and maintains the current value.
|
|
8
|
+
* @param {ModelArg<Sequence>} seq - Initial sequence data
|
|
9
|
+
* @class Sequence
|
|
10
|
+
* @category Ram
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Create a new sequence
|
|
14
|
+
* const orderSequence = new Sequence({ id: 'order_seq', current: 1 });
|
|
15
|
+
*
|
|
16
|
+
* // Use the sequence to get the next value
|
|
17
|
+
* const nextOrderId = parseInt(orderSequence.current.toString()) + 1;
|
|
18
|
+
* orderSequence.current = nextOrderId;
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class SequenceModel extends BaseModel {
|
|
22
|
+
/**
|
|
23
|
+
* @description Primary key identifier for the sequence
|
|
24
|
+
*/
|
|
25
|
+
id: string;
|
|
26
|
+
/**
|
|
27
|
+
* @description Current value of the sequence
|
|
28
|
+
* Used to generate the next sequential value
|
|
29
|
+
*/
|
|
30
|
+
current: string | number;
|
|
31
|
+
constructor(seq?: ModelArg<SequenceModel>);
|
|
32
|
+
}
|