@h3ravel/arquebus 0.3.6 → 0.4.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.
- package/bin/index.cjs +4365 -2840
- package/bin/index.js +4373 -2848
- package/dist/browser/index.cjs +2 -0
- package/dist/browser/index.d.cts +94 -7
- package/dist/browser/index.d.ts +94 -7
- package/dist/browser/index.js +2 -1
- package/dist/index.cjs +1499 -24
- package/dist/index.d.cts +129 -10
- package/dist/index.d.ts +129 -10
- package/dist/index.js +1500 -26
- package/dist/inspector/index.cjs +4885 -0
- package/dist/inspector/index.d.cts +83 -0
- package/dist/inspector/index.d.ts +83 -0
- package/dist/inspector/index.js +4859 -0
- package/dist/migrations/index.cjs +4386 -2912
- package/dist/migrations/index.d.cts +127 -9
- package/dist/migrations/index.d.ts +128 -10
- package/dist/migrations/index.js +4265 -2791
- package/package.json +27 -18
- package/types/query-builder.ts +37 -1
- package/src/migrations/stubs/migration-js.stub +0 -21
- package/src/migrations/stubs/migration-ts.stub +0 -18
- package/src/migrations/stubs/migration.create-js.stub +0 -24
- package/src/migrations/stubs/migration.create-ts.stub +0 -21
- package/src/migrations/stubs/migration.update-js.stub +0 -25
- package/src/migrations/stubs/migration.update-ts.stub +0 -22
- package/src/stubs/arquebus.config-js.stub +0 -25
- package/src/stubs/arquebus.config-ts.stub +0 -24
- package/src/stubs/model-js.stub +0 -5
- package/src/stubs/model-ts.stub +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/arquebus",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Arquebus ORM is a Beautiful, expressive ORM inspired by Laravel's Eloquent, designed for TypeScript applications and for the H3ravel Framework.",
|
|
5
5
|
"homepage": "https://h3ravel.toneflix.net/arquebus",
|
|
6
6
|
"bin": {
|
|
@@ -16,8 +16,6 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
18
|
"bin",
|
|
19
|
-
"src/stubs",
|
|
20
|
-
"src/migrations/stubs",
|
|
21
19
|
"types"
|
|
22
20
|
],
|
|
23
21
|
"exports": {
|
|
@@ -83,6 +81,16 @@
|
|
|
83
81
|
"default": "./dist/migrations/index.cjs"
|
|
84
82
|
}
|
|
85
83
|
},
|
|
84
|
+
"./inspector": {
|
|
85
|
+
"import": {
|
|
86
|
+
"types": "./dist/inspector/index.d.ts",
|
|
87
|
+
"default": "./dist/inspector/index.js"
|
|
88
|
+
},
|
|
89
|
+
"require": {
|
|
90
|
+
"types": "./dist/inspector/index.d.cts",
|
|
91
|
+
"default": "./dist/inspector/index.cjs"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
86
94
|
"./browser": {
|
|
87
95
|
"import": {
|
|
88
96
|
"types": "./dist/browser/index.d.ts",
|
|
@@ -115,18 +123,18 @@
|
|
|
115
123
|
]
|
|
116
124
|
},
|
|
117
125
|
"dependencies": {
|
|
118
|
-
"@h3ravel/shared": "^0.
|
|
119
|
-
"chalk": "^5.6.
|
|
126
|
+
"@h3ravel/shared": "^0.18.1",
|
|
127
|
+
"chalk": "^5.6.2",
|
|
120
128
|
"collect.js": "^4.36.1",
|
|
121
|
-
"commander": "^14.0.
|
|
129
|
+
"commander": "^14.0.1",
|
|
122
130
|
"cross-env": "^10.0.0",
|
|
123
|
-
"dayjs": "^1.11.
|
|
124
|
-
"dotenv": "^17.2.
|
|
131
|
+
"dayjs": "^1.11.18",
|
|
132
|
+
"dotenv": "^17.2.2",
|
|
125
133
|
"escalade": "^3.2.0",
|
|
126
134
|
"husky": "^9.1.7",
|
|
127
135
|
"knex": "^3.1.0",
|
|
128
|
-
"lint-staged": "^16.
|
|
129
|
-
"mysql2": "^3.
|
|
136
|
+
"lint-staged": "^16.2.0",
|
|
137
|
+
"mysql2": "^3.15.0",
|
|
130
138
|
"pg": "^8.16.3",
|
|
131
139
|
"pluralize": "^8.0.0",
|
|
132
140
|
"prettier": "^3.6.2",
|
|
@@ -135,21 +143,21 @@
|
|
|
135
143
|
"tedious": "^19.0.0"
|
|
136
144
|
},
|
|
137
145
|
"devDependencies": {
|
|
138
|
-
"@eslint/js": "^9.
|
|
139
|
-
"@types/node": "^24.
|
|
146
|
+
"@eslint/js": "^9.36.0",
|
|
147
|
+
"@types/node": "^24.5.2",
|
|
140
148
|
"@types/pluralize": "^0.0.33",
|
|
141
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
142
|
-
"@typescript-eslint/parser": "^8.
|
|
149
|
+
"@typescript-eslint/eslint-plugin": "^8.44.0",
|
|
150
|
+
"@typescript-eslint/parser": "^8.44.0",
|
|
143
151
|
"@vitest/coverage-v8": "^3.2.4",
|
|
144
|
-
"eslint": "^9.
|
|
152
|
+
"eslint": "^9.36.0",
|
|
145
153
|
"jsdom": "^26.1.0",
|
|
146
154
|
"sqlite3": "5.1.7",
|
|
147
|
-
"terser": "^5.
|
|
155
|
+
"terser": "^5.44.0",
|
|
148
156
|
"ts-node": "^10.9.2",
|
|
149
157
|
"tsdown": "^0.15.4",
|
|
150
|
-
"tsx": "^4.20.
|
|
158
|
+
"tsx": "^4.20.5",
|
|
151
159
|
"typescript": "^5.9.2",
|
|
152
|
-
"typescript-eslint": "^8.
|
|
160
|
+
"typescript-eslint": "^8.44.0",
|
|
153
161
|
"vite-tsconfig-paths": "^5.1.4",
|
|
154
162
|
"vitest": "^3.2.4"
|
|
155
163
|
},
|
|
@@ -172,6 +180,7 @@
|
|
|
172
180
|
"lint": "eslint . --ext .ts",
|
|
173
181
|
"cmd": "cross-env TEST=true tsx --experimental-specifier-resolution=node src/cli",
|
|
174
182
|
"cmd:watch": "cross-env TEST=true tsx watch --experimental-specifier-resolution=node src/cli",
|
|
183
|
+
"test": "cross-env vitest --project generic",
|
|
175
184
|
"test:mysql": "cross-env DB=mysql vitest --project node",
|
|
176
185
|
"test:postgres": "cross-env DB=postgres vitest --project node",
|
|
177
186
|
"test:sqlite": "cross-env DB=sqlite vitest --project node",
|
package/types/query-builder.ts
CHANGED
|
@@ -3,11 +3,47 @@ import type { ICollection, IPaginator, IPaginatorParams } from './utils'
|
|
|
3
3
|
import type { TFunction, TGeneric } from './generics'
|
|
4
4
|
|
|
5
5
|
import type BModel from 'src/browser/model'
|
|
6
|
+
import type { Column } from 'src/inspector/types/column'
|
|
7
|
+
import type { ForeignKey } from 'src/inspector/types/foreign-key'
|
|
6
8
|
import type { Knex } from 'knex'
|
|
7
9
|
import type Model from 'src/model'
|
|
10
|
+
import type { Table } from 'src/inspector/types/table'
|
|
8
11
|
|
|
9
12
|
export interface SchemaBuilder extends Knex.SchemaBuilder {
|
|
10
13
|
[k: string]: any
|
|
14
|
+
/**
|
|
15
|
+
* Retrieve all tables in the current database.
|
|
16
|
+
*/
|
|
17
|
+
tables (): Promise<string[]>
|
|
18
|
+
/**
|
|
19
|
+
* Retrieve the table info for the given table, or all tables if no table is specified.
|
|
20
|
+
*
|
|
21
|
+
* @param table
|
|
22
|
+
*/
|
|
23
|
+
tableInfo (table?: string): Promise<Table | Table[]>
|
|
24
|
+
/**
|
|
25
|
+
* Retrieve all columns in a given table, or all columns if no table is specified.
|
|
26
|
+
*
|
|
27
|
+
* @param table
|
|
28
|
+
*/
|
|
29
|
+
columns (table?: string): Promise<{ table: string, column: string }[]>
|
|
30
|
+
/**
|
|
31
|
+
* Retrieve all columns from a given table. Returns all columns if table parameter is undefined.
|
|
32
|
+
*
|
|
33
|
+
* @param table
|
|
34
|
+
* @param column
|
|
35
|
+
*/
|
|
36
|
+
columnInfo (table?: string, column?: string): Promise<Column[] | Column>
|
|
37
|
+
/**
|
|
38
|
+
* Retrieve the primary key column for a given table.
|
|
39
|
+
*
|
|
40
|
+
* @param table
|
|
41
|
+
*/
|
|
42
|
+
primary (table: string): Promise<string>
|
|
43
|
+
/**
|
|
44
|
+
* Retrieve all configured foreign key constraints
|
|
45
|
+
*/
|
|
46
|
+
foreignKeys (): Promise<ForeignKey>
|
|
11
47
|
};
|
|
12
48
|
|
|
13
49
|
interface AsMethod<QB extends AnyQueryBuilder> {
|
|
@@ -163,7 +199,7 @@ export interface IQueryBuilder<M extends Model | BModel = Model, R = M[] | M> {
|
|
|
163
199
|
take (count: number): this;
|
|
164
200
|
limit (count: number): this;
|
|
165
201
|
offset (count: number): this;
|
|
166
|
-
pluck<X extends Model = any> (column: string): Promise<
|
|
202
|
+
pluck<X extends Model = any> (column: string): Promise<Array<X>>;
|
|
167
203
|
chunk (count: number, callback: (rows: M[]) => any): Promise<boolean>;
|
|
168
204
|
forPage (page: number, perPage?: number): this;
|
|
169
205
|
paginate<F extends IPaginatorParams> (page?: number, perPage?: number): Promise<IPaginator<M, F>>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Migration } from '@h3ravel/arquebus'
|
|
2
|
-
|
|
3
|
-
export default class extends Migration {
|
|
4
|
-
/**
|
|
5
|
-
* Run the migrations.
|
|
6
|
-
*
|
|
7
|
-
* @param {(import('@h3ravel/arquebus/types/query-builder').SchemaBuilder)} schema
|
|
8
|
-
*/
|
|
9
|
-
async up(schema) {
|
|
10
|
-
//
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Reverse the migrations.
|
|
15
|
-
*
|
|
16
|
-
* @param {(import('@h3ravel/arquebus/types/query-builder').SchemaBuilder)} schema
|
|
17
|
-
*/
|
|
18
|
-
async down(schema) {
|
|
19
|
-
//
|
|
20
|
-
}
|
|
21
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Migration } from '@h3ravel/arquebus'
|
|
2
|
-
import { SchemaBuilder } from '@h3ravel/arquebus/types/query-builder';
|
|
3
|
-
|
|
4
|
-
export default class extends Migration {
|
|
5
|
-
/**
|
|
6
|
-
* Run the migrations.
|
|
7
|
-
*/
|
|
8
|
-
async up (schema: SchemaBuilder) {
|
|
9
|
-
//
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Reverse the migrations.
|
|
14
|
-
*/
|
|
15
|
-
async down (schema: SchemaBuilder) {
|
|
16
|
-
//
|
|
17
|
-
}
|
|
18
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Migration } from '@h3ravel/arquebus'
|
|
2
|
-
|
|
3
|
-
export default class extends Migration {
|
|
4
|
-
/**
|
|
5
|
-
* Run the migrations.
|
|
6
|
-
*
|
|
7
|
-
* @param {(import('@h3ravel/arquebus/types/query-builder').SchemaBuilder)} schema
|
|
8
|
-
*/
|
|
9
|
-
async up(schema) {
|
|
10
|
-
await schema.createTable('{{ table }}', (table) => {
|
|
11
|
-
table.increments('id');
|
|
12
|
-
table.timestamps();
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Reverse the migrations.
|
|
18
|
-
*
|
|
19
|
-
* @param {(import('@h3ravel/arquebus/types/query-builder').SchemaBuilder)} schema
|
|
20
|
-
*/
|
|
21
|
-
async down(schema) {
|
|
22
|
-
await schema.dropTableIfExists('{{ table }}');
|
|
23
|
-
}
|
|
24
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Migration } from '@h3ravel/arquebus'
|
|
2
|
-
import { SchemaBuilder } from '@h3ravel/arquebus/types/query-builder';
|
|
3
|
-
|
|
4
|
-
export default class extends Migration {
|
|
5
|
-
/**
|
|
6
|
-
* Run the migrations.
|
|
7
|
-
*/
|
|
8
|
-
async up(schema: SchemaBuilder) {
|
|
9
|
-
await schema.createTable('{{ table }}', (table) => {
|
|
10
|
-
table.increments('id');
|
|
11
|
-
table.timestamps();
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Reverse the migrations.
|
|
17
|
-
*/
|
|
18
|
-
async down(schema: SchemaBuilder) {
|
|
19
|
-
await schema.dropTableIfExists('{{ table }}');
|
|
20
|
-
}
|
|
21
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Migration } from '@h3ravel/arquebus'
|
|
2
|
-
|
|
3
|
-
export default class extends Migration {
|
|
4
|
-
/**
|
|
5
|
-
* Run the migrations.
|
|
6
|
-
*
|
|
7
|
-
* @param {(import('@h3ravel/arquebus/types/query-builder').SchemaBuilder)} schema
|
|
8
|
-
*/
|
|
9
|
-
async up(schema) {
|
|
10
|
-
await schema.table('{{ table }}', (table) => {
|
|
11
|
-
//
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Reverse the migrations.
|
|
17
|
-
*
|
|
18
|
-
* @param {(import('@h3ravel/arquebus/types/query-builder').SchemaBuilder)} schema
|
|
19
|
-
*/
|
|
20
|
-
async down(schema) {
|
|
21
|
-
await schema.table('{{ table }}', (table) => {
|
|
22
|
-
//
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Migration } from '@h3ravel/arquebus'
|
|
2
|
-
import { SchemaBuilder } from '@h3ravel/arquebus/types/query-builder';
|
|
3
|
-
|
|
4
|
-
export default class extends Migration {
|
|
5
|
-
/**
|
|
6
|
-
* Run the migrations.
|
|
7
|
-
*/
|
|
8
|
-
async up(schema: SchemaBuilder) {
|
|
9
|
-
await schema.table('{{ table }}', (table) => {
|
|
10
|
-
//
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Reverse the migrations.
|
|
16
|
-
*/
|
|
17
|
-
async down(schema: SchemaBuilder) {
|
|
18
|
-
await schema.table('{{ table }}', (table) => {
|
|
19
|
-
//
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from '@h3ravel/arquebus'
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
client: 'mysql2',
|
|
5
|
-
connection: {
|
|
6
|
-
host: 'localhost',
|
|
7
|
-
database: 'database',
|
|
8
|
-
user: 'user',
|
|
9
|
-
password: 'password'
|
|
10
|
-
},
|
|
11
|
-
migrations: {
|
|
12
|
-
table: 'migrations',
|
|
13
|
-
path: './migrations',
|
|
14
|
-
},
|
|
15
|
-
factories: {
|
|
16
|
-
path: './factories',
|
|
17
|
-
},
|
|
18
|
-
seeders: {
|
|
19
|
-
path: './seeders',
|
|
20
|
-
},
|
|
21
|
-
models: {
|
|
22
|
-
path: './models'
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from '@h3ravel/arquebus'
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
client: 'mysql2',
|
|
5
|
-
connection: {
|
|
6
|
-
host: 'localhost',
|
|
7
|
-
database: 'database',
|
|
8
|
-
user: 'user',
|
|
9
|
-
password: 'password'
|
|
10
|
-
},
|
|
11
|
-
migrations: {
|
|
12
|
-
table: 'migrations',
|
|
13
|
-
path: './migrations',
|
|
14
|
-
},
|
|
15
|
-
factories: {
|
|
16
|
-
path: './factories',
|
|
17
|
-
},
|
|
18
|
-
seeders: {
|
|
19
|
-
path: './seeders',
|
|
20
|
-
},
|
|
21
|
-
models: {
|
|
22
|
-
path: './models'
|
|
23
|
-
}
|
|
24
|
-
})
|
package/src/stubs/model-js.stub
DELETED