@veap/database 0.1.0 → 0.1.2
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 +3 -2
- package/dist/casts.js +1 -1
- package/dist/cli/commands/make-migration.d.ts +13 -0
- package/dist/cli/commands/make-migration.js +24 -0
- package/dist/cli/commands/migrate-rollback.d.ts +14 -0
- package/dist/cli/commands/migrate-rollback.js +41 -0
- package/dist/cli/commands/migrate-status.d.ts +16 -0
- package/dist/cli/commands/migrate-status.js +79 -0
- package/dist/cli/commands/migrate.d.ts +13 -0
- package/dist/cli/commands/migrate.js +40 -0
- package/dist/cli/confirmation.d.ts +14 -0
- package/dist/cli/confirmation.js +26 -0
- package/dist/cli/migrations.d.ts +20 -0
- package/dist/cli/migrations.js +41 -0
- package/dist/composition.d.ts +15 -0
- package/dist/composition.js +26 -0
- package/dist/connection.d.ts +1 -1
- package/dist/connection.js +9 -5
- package/dist/factory.d.ts +1 -1
- package/dist/factory.js +1 -1
- package/dist/index.d.ts +18 -16
- package/dist/index.js +18 -16
- package/dist/migration-provider.d.ts +10 -0
- package/dist/migration-provider.js +50 -6
- package/dist/migrations/generator.d.ts +11 -2
- package/dist/migrations/generator.js +40 -5
- package/dist/migrations/index.d.ts +3 -3
- package/dist/migrations/index.js +3 -3
- package/dist/migrations/runner.d.ts +28 -3
- package/dist/migrations/runner.js +45 -29
- package/dist/migrations/schema-builder.js +1 -1
- package/dist/model.d.ts +4 -4
- package/dist/model.js +25 -11
- package/dist/provider.d.ts +2 -1
- package/dist/provider.js +62 -8
- package/dist/query-builder.d.ts +6 -6
- package/dist/query-builder.js +40 -6
- package/dist/relations/belongs-to-many.d.ts +3 -3
- package/dist/relations/belongs-to-many.js +2 -2
- package/dist/relations/belongs-to.d.ts +3 -3
- package/dist/relations/belongs-to.js +1 -1
- package/dist/relations/eager-loader.d.ts +1 -1
- package/dist/relations/eager-loader.js +3 -1
- package/dist/relations/has-many.d.ts +3 -3
- package/dist/relations/has-many.js +1 -1
- package/dist/relations/has-one.d.ts +3 -3
- package/dist/relations/has-one.js +1 -1
- package/dist/relations/index.d.ts +11 -11
- package/dist/relations/index.js +11 -11
- package/dist/relations/morph-many.d.ts +3 -3
- package/dist/relations/morph-many.js +2 -2
- package/dist/relations/morph-one.d.ts +3 -3
- package/dist/relations/morph-one.js +2 -2
- package/dist/relations/morph-to-many.d.ts +3 -3
- package/dist/relations/morph-to-many.js +3 -3
- package/dist/relations/morph-to.d.ts +3 -3
- package/dist/relations/morph-to.js +3 -3
- package/dist/relations/relation.d.ts +2 -2
- package/dist/scopes.d.ts +2 -2
- package/dist/seeder.js +2 -2
- package/dist/tokens.d.ts +10 -0
- package/dist/tokens.js +8 -0
- package/package.json +10 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Model } from "../model";
|
|
2
|
-
import type { ModelQueryBuilder } from "../query-builder";
|
|
3
|
-
import { Relation } from "./relation";
|
|
1
|
+
import type { Model } from "../model.js";
|
|
2
|
+
import type { ModelQueryBuilder } from "../query-builder.js";
|
|
3
|
+
import { Relation } from "./relation.js";
|
|
4
4
|
export declare class HasMany<Parent extends Model = any, Related extends Model = any> extends Relation<Parent, Related> {
|
|
5
5
|
query(): ModelQueryBuilder<Related>;
|
|
6
6
|
get(): Promise<Related[]>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Model } from "../model";
|
|
2
|
-
import type { ModelQueryBuilder } from "../query-builder";
|
|
3
|
-
import { Relation } from "./relation";
|
|
1
|
+
import type { Model } from "../model.js";
|
|
2
|
+
import type { ModelQueryBuilder } from "../query-builder.js";
|
|
3
|
+
import { Relation } from "./relation.js";
|
|
4
4
|
export declare class HasOne<Parent extends Model = any, Related extends Model = any> extends Relation<Parent, Related> {
|
|
5
5
|
query(): ModelQueryBuilder<Related>;
|
|
6
6
|
get(): Promise<Related | null>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from "./belongs-to";
|
|
2
|
-
export * from "./belongs-to-many";
|
|
3
|
-
export * from "./eager-loader";
|
|
4
|
-
export * from "./has-many";
|
|
5
|
-
export * from "./has-one";
|
|
6
|
-
export * from "./morph-many";
|
|
7
|
-
export * from "./morph-map";
|
|
8
|
-
export * from "./morph-one";
|
|
9
|
-
export * from "./morph-to";
|
|
10
|
-
export * from "./morph-to-many";
|
|
11
|
-
export * from "./relation";
|
|
1
|
+
export * from "./belongs-to.js";
|
|
2
|
+
export * from "./belongs-to-many.js";
|
|
3
|
+
export * from "./eager-loader.js";
|
|
4
|
+
export * from "./has-many.js";
|
|
5
|
+
export * from "./has-one.js";
|
|
6
|
+
export * from "./morph-many.js";
|
|
7
|
+
export * from "./morph-map.js";
|
|
8
|
+
export * from "./morph-one.js";
|
|
9
|
+
export * from "./morph-to.js";
|
|
10
|
+
export * from "./morph-to-many.js";
|
|
11
|
+
export * from "./relation.js";
|
package/dist/relations/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from "./belongs-to";
|
|
2
|
-
export * from "./belongs-to-many";
|
|
3
|
-
export * from "./eager-loader";
|
|
4
|
-
export * from "./has-many";
|
|
5
|
-
export * from "./has-one";
|
|
6
|
-
export * from "./morph-many";
|
|
7
|
-
export * from "./morph-map";
|
|
8
|
-
export * from "./morph-one";
|
|
9
|
-
export * from "./morph-to";
|
|
10
|
-
export * from "./morph-to-many";
|
|
11
|
-
export * from "./relation";
|
|
1
|
+
export * from "./belongs-to.js";
|
|
2
|
+
export * from "./belongs-to-many.js";
|
|
3
|
+
export * from "./eager-loader.js";
|
|
4
|
+
export * from "./has-many.js";
|
|
5
|
+
export * from "./has-one.js";
|
|
6
|
+
export * from "./morph-many.js";
|
|
7
|
+
export * from "./morph-map.js";
|
|
8
|
+
export * from "./morph-one.js";
|
|
9
|
+
export * from "./morph-to.js";
|
|
10
|
+
export * from "./morph-to-many.js";
|
|
11
|
+
export * from "./relation.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Model } from "../model";
|
|
2
|
-
import type { ModelQueryBuilder } from "../query-builder";
|
|
3
|
-
import { Relation } from "./relation";
|
|
1
|
+
import type { Model } from "../model.js";
|
|
2
|
+
import type { ModelQueryBuilder } from "../query-builder.js";
|
|
3
|
+
import { Relation } from "./relation.js";
|
|
4
4
|
export declare class MorphMany<Parent extends Model = any, Related extends Model = any> extends Relation<Parent, Related> {
|
|
5
5
|
morphName: string;
|
|
6
6
|
typeColumn: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Model } from "../model";
|
|
2
|
-
import type { ModelQueryBuilder } from "../query-builder";
|
|
3
|
-
import { Relation } from "./relation";
|
|
1
|
+
import type { Model } from "../model.js";
|
|
2
|
+
import type { ModelQueryBuilder } from "../query-builder.js";
|
|
3
|
+
import { Relation } from "./relation.js";
|
|
4
4
|
export declare class MorphOne<Parent extends Model = any, Related extends Model = any> extends Relation<Parent, Related> {
|
|
5
5
|
morphName: string;
|
|
6
6
|
typeColumn: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Model } from "../model";
|
|
2
|
-
import type { ModelQueryBuilder } from "../query-builder";
|
|
3
|
-
import { Relation } from "./relation";
|
|
1
|
+
import type { Model } from "../model.js";
|
|
2
|
+
import type { ModelQueryBuilder } from "../query-builder.js";
|
|
3
|
+
import { Relation } from "./relation.js";
|
|
4
4
|
/**
|
|
5
5
|
* MorphToMany represents a many-to-many polymorphic relation where the parent
|
|
6
6
|
* owns the polymorphic side of the pivot table (e.g. BlogPost -> tags via taggables).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getKnex } from "../connection";
|
|
2
|
-
import { MorphMap } from "./morph-map";
|
|
3
|
-
import { Relation } from "./relation";
|
|
1
|
+
import { getKnex } from "../connection.js";
|
|
2
|
+
import { MorphMap } from "./morph-map.js";
|
|
3
|
+
import { Relation } from "./relation.js";
|
|
4
4
|
/**
|
|
5
5
|
* MorphToMany represents a many-to-many polymorphic relation where the parent
|
|
6
6
|
* owns the polymorphic side of the pivot table (e.g. BlogPost -> tags via taggables).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Model } from "../model";
|
|
2
|
-
import type { ModelQueryBuilder } from "../query-builder";
|
|
3
|
-
import { Relation } from "./relation";
|
|
1
|
+
import type { Model } from "../model.js";
|
|
2
|
+
import type { ModelQueryBuilder } from "../query-builder.js";
|
|
3
|
+
import { Relation } from "./relation.js";
|
|
4
4
|
export declare class MorphTo<Child extends Model = any, Parent extends Model = any> extends Relation<Child, Parent> {
|
|
5
5
|
morphName: string;
|
|
6
6
|
typeColumn: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DatabaseError } from "../errors";
|
|
2
|
-
import { MorphMap } from "./morph-map";
|
|
3
|
-
import { Relation } from "./relation";
|
|
1
|
+
import { DatabaseError } from "../errors.js";
|
|
2
|
+
import { MorphMap } from "./morph-map.js";
|
|
3
|
+
import { Relation } from "./relation.js";
|
|
4
4
|
export class MorphTo extends Relation {
|
|
5
5
|
morphName;
|
|
6
6
|
typeColumn;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Model } from "../model";
|
|
2
|
-
import type { ModelQueryBuilder } from "../query-builder";
|
|
1
|
+
import type { Model } from "../model.js";
|
|
2
|
+
import type { ModelQueryBuilder } from "../query-builder.js";
|
|
3
3
|
export declare abstract class Relation<Parent extends Model = any, Related extends Model = any> {
|
|
4
4
|
parent: Parent;
|
|
5
5
|
related: any;
|
package/dist/scopes.d.ts
CHANGED
package/dist/seeder.js
CHANGED
package/dist/tokens.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Token } from "@veap/kernel";
|
|
2
|
+
import type { Knex } from "knex";
|
|
3
|
+
/**
|
|
4
|
+
* IoC Token for primary Knex database connection instance.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DATABASE: Token<Knex>;
|
|
7
|
+
/**
|
|
8
|
+
* IoC Token for application database migrations array.
|
|
9
|
+
*/
|
|
10
|
+
export declare const APP_MIGRATIONS: Token<any[]>;
|
package/dist/tokens.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IoC Token for primary Knex database connection instance.
|
|
3
|
+
*/
|
|
4
|
+
export const DATABASE = Symbol.for("veap:kernel:database");
|
|
5
|
+
/**
|
|
6
|
+
* IoC Token for application database migrations array.
|
|
7
|
+
*/
|
|
8
|
+
export const APP_MIGRATIONS = Symbol.for("veap:kernel:app-migrations");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veap/database",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Eloquent-like Active Record ORM powered by Knex with AsyncLocalStorage transactions",
|
|
5
5
|
"bugs": "https://github.com/veapjs/veap-database/issues",
|
|
6
6
|
"repository": {
|
|
@@ -16,6 +16,14 @@
|
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"default": "./dist/index.js"
|
|
18
18
|
},
|
|
19
|
+
"./migrations": {
|
|
20
|
+
"types": "./dist/migrations/index.d.ts",
|
|
21
|
+
"default": "./dist/migrations/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./relations": {
|
|
24
|
+
"types": "./dist/relations/index.d.ts",
|
|
25
|
+
"default": "./dist/relations/index.js"
|
|
26
|
+
},
|
|
19
27
|
"./package.json": "./package.json"
|
|
20
28
|
},
|
|
21
29
|
"files": [
|
|
@@ -28,7 +36,7 @@
|
|
|
28
36
|
"test": "vitest run"
|
|
29
37
|
},
|
|
30
38
|
"dependencies": {
|
|
31
|
-
"@veap/kernel": "^0.1.
|
|
39
|
+
"@veap/kernel": "^0.1.4",
|
|
32
40
|
"better-sqlite3": "^13.0.3",
|
|
33
41
|
"knex": "^3.3.0"
|
|
34
42
|
},
|