@orion-js/migrations 4.3.5 → 4.5.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/dist/MigrationsService.d.ts +9 -0
- package/dist/Repo.d.ts +17 -0
- package/dist/Schema.d.ts +17 -0
- package/dist/index.d.ts +5 -39
- package/dist/loadMigrations/index.d.ts +5 -0
- package/dist/service/index.d.ts +10 -0
- package/package.json +12 -12
- package/dist/index.d.cts +0 -39
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MigrationExecutable } from './service';
|
|
2
|
+
import { ExecutionContext } from '@orion-js/dogs';
|
|
3
|
+
export declare class MigrationsService {
|
|
4
|
+
private migrationsRepo;
|
|
5
|
+
getNextMigration(migrationsList: MigrationExecutable[]): Promise<MigrationExecutable>;
|
|
6
|
+
runMigrations(migrationsList: MigrationExecutable[], context: ExecutionContext): Promise<void>;
|
|
7
|
+
runMigration(func: (context: ExecutionContext) => Promise<void>, context: ExecutionContext): Promise<void>;
|
|
8
|
+
runAsTransaction(func: (context: ExecutionContext) => Promise<void>, context: ExecutionContext): Promise<void>;
|
|
9
|
+
}
|
package/dist/Repo.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class MigrationsRepo {
|
|
2
|
+
collection: import("@orion-js/mongodb").Collection<import("@orion-js/mongodb").InferSchemaTypeWithId<{
|
|
3
|
+
_id: {
|
|
4
|
+
type: import("@orion-js/schema").FieldType<`scnmg-${string}`> & {
|
|
5
|
+
generateId: () => `scnmg-${string}`;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
name: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
};
|
|
11
|
+
completedAt: {
|
|
12
|
+
type: DateConstructor;
|
|
13
|
+
};
|
|
14
|
+
}>>;
|
|
15
|
+
getCompletedMigrationNames(): Promise<string[]>;
|
|
16
|
+
saveCompletedMigration(name: string): Promise<void>;
|
|
17
|
+
}
|
package/dist/Schema.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TypedId } from '@orion-js/mongodb';
|
|
2
|
+
import { InferSchemaType } from '@orion-js/schema';
|
|
3
|
+
export type MigrationId = TypedId<'scnmg'>;
|
|
4
|
+
export declare const MigrationSchema: {
|
|
5
|
+
_id: {
|
|
6
|
+
type: import("@orion-js/schema").FieldType<`scnmg-${string}`> & {
|
|
7
|
+
generateId: () => `scnmg-${string}`;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
name: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
};
|
|
13
|
+
completedAt: {
|
|
14
|
+
type: DateConstructor;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type MigrationType = InferSchemaType<typeof MigrationSchema>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,39 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare const MigrationSchema: any;
|
|
7
|
-
type MigrationType = InferSchemaType<typeof MigrationSchema>;
|
|
8
|
-
|
|
9
|
-
declare class MigrationsRepo {
|
|
10
|
-
collection: any;
|
|
11
|
-
getCompletedMigrationNames(): Promise<any>;
|
|
12
|
-
saveCompletedMigration(name: string): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface Options {
|
|
16
|
-
lockTime?: number;
|
|
17
|
-
omitJob?: boolean;
|
|
18
|
-
}
|
|
19
|
-
declare function loadMigrations(migrationServices: any[], options?: Options): MigrationExecutable[];
|
|
20
|
-
|
|
21
|
-
interface MigrationServiceOptions {
|
|
22
|
-
name: string;
|
|
23
|
-
useMongoTransactions: false;
|
|
24
|
-
}
|
|
25
|
-
declare function MigrationService(options: MigrationServiceOptions): (target: any, context: ClassDecoratorContext<any>) => void;
|
|
26
|
-
type MigrationExecutable = {
|
|
27
|
-
runMigration(context: ExecutionContext): Promise<void>;
|
|
28
|
-
} & MigrationServiceOptions;
|
|
29
|
-
declare function getMigrationsFromServices(services: any[]): MigrationExecutable[];
|
|
30
|
-
|
|
31
|
-
declare class MigrationsService {
|
|
32
|
-
private migrationsRepo;
|
|
33
|
-
getNextMigration(migrationsList: MigrationExecutable[]): Promise<MigrationExecutable>;
|
|
34
|
-
runMigrations(migrationsList: MigrationExecutable[], context: ExecutionContext): Promise<void>;
|
|
35
|
-
runMigration(func: (context: ExecutionContext) => Promise<void>, context: ExecutionContext): Promise<void>;
|
|
36
|
-
runAsTransaction(func: (context: ExecutionContext) => Promise<void>, context: ExecutionContext): Promise<void>;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { type MigrationExecutable, type MigrationId, MigrationSchema, MigrationService, type MigrationServiceOptions, type MigrationType, MigrationsRepo, MigrationsService, type Options, getMigrationsFromServices, loadMigrations };
|
|
1
|
+
export * from './Schema';
|
|
2
|
+
export * from './Repo';
|
|
3
|
+
export * from './loadMigrations';
|
|
4
|
+
export * from './service';
|
|
5
|
+
export * from './MigrationsService';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ExecutionContext } from '@orion-js/dogs';
|
|
2
|
+
export interface MigrationServiceOptions {
|
|
3
|
+
name: string;
|
|
4
|
+
useMongoTransactions: false;
|
|
5
|
+
}
|
|
6
|
+
export declare function MigrationService(options: MigrationServiceOptions): (target: any, context: ClassDecoratorContext<any>) => void;
|
|
7
|
+
export type MigrationExecutable = {
|
|
8
|
+
runMigration(context: ExecutionContext): Promise<void>;
|
|
9
|
+
} & MigrationServiceOptions;
|
|
10
|
+
export declare function getMigrationsFromServices(services: any[]): MigrationExecutable[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/migrations",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"main": "./dist/index.cjs",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -9,23 +9,23 @@
|
|
|
9
9
|
"author": "nicolaslopezj",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"@orion-js/dogs": "4.
|
|
13
|
-
"@orion-js/logger": "4.
|
|
14
|
-
"@orion-js/mongodb": "4.
|
|
12
|
+
"@orion-js/dogs": "4.5.0",
|
|
13
|
+
"@orion-js/logger": "4.5.0",
|
|
14
|
+
"@orion-js/mongodb": "4.5.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@orion-js/helpers": "4.
|
|
18
|
-
"@orion-js/schema": "4.
|
|
19
|
-
"@orion-js/services": "4.
|
|
20
|
-
"@orion-js/typed-model": "4.
|
|
17
|
+
"@orion-js/helpers": "4.5.0",
|
|
18
|
+
"@orion-js/schema": "4.5.0",
|
|
19
|
+
"@orion-js/services": "4.5.0",
|
|
20
|
+
"@orion-js/typed-model": "4.5.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@orion-js/mongodb": "4.
|
|
24
|
-
"@orion-js/dogs": "4.
|
|
23
|
+
"@orion-js/mongodb": "4.5.0",
|
|
24
|
+
"@orion-js/dogs": "4.5.0",
|
|
25
25
|
"@types/node": "^18.0.0",
|
|
26
26
|
"mongodb-memory-server": "^10.1.4",
|
|
27
27
|
"tsup": "^8.0.1",
|
|
28
|
-
"typescript": "^
|
|
28
|
+
"typescript": "^7.0.2"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"scripts": {
|
|
42
42
|
"test": "bun test",
|
|
43
43
|
"clean": "rm -rf ./dist",
|
|
44
|
-
"build": "tsup",
|
|
44
|
+
"build": "tsup && bun run ../../scripts/emit-declarations.ts",
|
|
45
45
|
"dev": "tsup --watch"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/dist/index.d.cts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { TypedId } from '@orion-js/mongodb';
|
|
2
|
-
import { InferSchemaType } from '@orion-js/schema';
|
|
3
|
-
import { ExecutionContext } from '@orion-js/dogs';
|
|
4
|
-
|
|
5
|
-
type MigrationId = TypedId<'scnmg'>;
|
|
6
|
-
declare const MigrationSchema: any;
|
|
7
|
-
type MigrationType = InferSchemaType<typeof MigrationSchema>;
|
|
8
|
-
|
|
9
|
-
declare class MigrationsRepo {
|
|
10
|
-
collection: any;
|
|
11
|
-
getCompletedMigrationNames(): Promise<any>;
|
|
12
|
-
saveCompletedMigration(name: string): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface Options {
|
|
16
|
-
lockTime?: number;
|
|
17
|
-
omitJob?: boolean;
|
|
18
|
-
}
|
|
19
|
-
declare function loadMigrations(migrationServices: any[], options?: Options): MigrationExecutable[];
|
|
20
|
-
|
|
21
|
-
interface MigrationServiceOptions {
|
|
22
|
-
name: string;
|
|
23
|
-
useMongoTransactions: false;
|
|
24
|
-
}
|
|
25
|
-
declare function MigrationService(options: MigrationServiceOptions): (target: any, context: ClassDecoratorContext<any>) => void;
|
|
26
|
-
type MigrationExecutable = {
|
|
27
|
-
runMigration(context: ExecutionContext): Promise<void>;
|
|
28
|
-
} & MigrationServiceOptions;
|
|
29
|
-
declare function getMigrationsFromServices(services: any[]): MigrationExecutable[];
|
|
30
|
-
|
|
31
|
-
declare class MigrationsService {
|
|
32
|
-
private migrationsRepo;
|
|
33
|
-
getNextMigration(migrationsList: MigrationExecutable[]): Promise<MigrationExecutable>;
|
|
34
|
-
runMigrations(migrationsList: MigrationExecutable[], context: ExecutionContext): Promise<void>;
|
|
35
|
-
runMigration(func: (context: ExecutionContext) => Promise<void>, context: ExecutionContext): Promise<void>;
|
|
36
|
-
runAsTransaction(func: (context: ExecutionContext) => Promise<void>, context: ExecutionContext): Promise<void>;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { type MigrationExecutable, type MigrationId, MigrationSchema, MigrationService, type MigrationServiceOptions, type MigrationType, MigrationsRepo, MigrationsService, type Options, getMigrationsFromServices, loadMigrations };
|