@h3ravel/database 11.4.8 → 11.4.11
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/index.cjs +2 -2
- package/dist/{index.d.cts → index.d.ts} +4 -2
- package/dist/{index.mjs → index.js} +2 -2
- package/package.json +15 -14
- package/dist/index.d.mts +0 -316
package/dist/index.cjs
CHANGED
|
@@ -52,8 +52,8 @@ var TableGuesser = class TableGuesser {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
//#endregion
|
|
55
|
-
//#region ../../node_modules/.pnpm/dayjs@1.11.
|
|
56
|
-
var require_dayjs_min = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/dayjs@1.11.
|
|
55
|
+
//#region ../../node_modules/.pnpm/dayjs@1.11.18/node_modules/dayjs/dayjs.min.js
|
|
56
|
+
var require_dayjs_min = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/dayjs@1.11.18/node_modules/dayjs/dayjs.min.js": ((exports, module) => {
|
|
57
57
|
(function(t, e) {
|
|
58
58
|
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
|
|
59
59
|
})(exports, (function() {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference path="./app.globals.d.ts" />
|
|
2
2
|
import { Command } from "@h3ravel/musket";
|
|
3
|
+
import * as _h3ravel_arquebus0 from "@h3ravel/arquebus";
|
|
3
4
|
import { Model as Model$1, QueryBuilder, Seeder as Seeder$1 } from "@h3ravel/arquebus";
|
|
5
|
+
import * as knex0 from "knex";
|
|
4
6
|
import { Knex } from "knex";
|
|
5
7
|
import { Application, ServiceProvider } from "@h3ravel/core";
|
|
6
8
|
import { IQueryBuilder } from "@h3ravel/arquebus/types";
|
|
@@ -241,11 +243,11 @@ declare class DB {
|
|
|
241
243
|
/**
|
|
242
244
|
* Builder table instance
|
|
243
245
|
*/
|
|
244
|
-
static instance(connection?: string):
|
|
246
|
+
static instance(connection?: string): _h3ravel_arquebus0.QueryBuilder<_h3ravel_arquebus0.Model, _h3ravel_arquebus0.Model | _h3ravel_arquebus0.Model[]>;
|
|
245
247
|
/**
|
|
246
248
|
* Builder transaction instance
|
|
247
249
|
*/
|
|
248
|
-
static transaction<C>(callback: (...args: C[]) => any): any;
|
|
250
|
+
static transaction<C>(callback: (...args: C[]) => any): Promise<knex0.Knex.Transaction<any, any[]>> | undefined;
|
|
249
251
|
private builder;
|
|
250
252
|
}
|
|
251
253
|
//#endregion
|
|
@@ -52,8 +52,8 @@ var TableGuesser = class TableGuesser {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
//#endregion
|
|
55
|
-
//#region ../../node_modules/.pnpm/dayjs@1.11.
|
|
56
|
-
var require_dayjs_min = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/dayjs@1.11.
|
|
55
|
+
//#region ../../node_modules/.pnpm/dayjs@1.11.18/node_modules/dayjs/dayjs.min.js
|
|
56
|
+
var require_dayjs_min = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/dayjs@1.11.18/node_modules/dayjs/dayjs.min.js": ((exports, module) => {
|
|
57
57
|
(function(t, e) {
|
|
58
58
|
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
|
|
59
59
|
})(exports, (function() {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/database",
|
|
3
|
-
"version": "11.4.
|
|
3
|
+
"version": "11.4.11",
|
|
4
4
|
"description": "Modeling data and migration system for H3ravel.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.
|
|
7
|
-
"types": "./dist/index.d.
|
|
8
|
-
"module": "./dist/index.
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
9
|
"h3ravel": {
|
|
10
10
|
"providers": [
|
|
11
11
|
"DatabaseServiceProvider"
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
-
"
|
|
17
|
-
"import": "./dist/index.mjs",
|
|
16
|
+
"import": "./dist/index.js",
|
|
18
17
|
"require": "./dist/index.cjs"
|
|
19
|
-
}
|
|
18
|
+
},
|
|
19
|
+
"./*": "./*"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist"
|
|
@@ -41,23 +41,24 @@
|
|
|
41
41
|
"laravel"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@h3ravel/arquebus": "^0.6.
|
|
45
|
-
"@h3ravel/musket": "^0.3.
|
|
44
|
+
"@h3ravel/arquebus": "^0.6.14",
|
|
45
|
+
"@h3ravel/musket": "^0.3.10",
|
|
46
46
|
"sqlite3": "5.1.7"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@h3ravel/core": "^1.21.
|
|
50
|
-
"@h3ravel/shared": "^0.27.
|
|
51
|
-
"@h3ravel/support": "^0.15.
|
|
52
|
-
"@h3ravel/filesystem": "^0.4.
|
|
49
|
+
"@h3ravel/core": "^1.21.6",
|
|
50
|
+
"@h3ravel/shared": "^0.27.7",
|
|
51
|
+
"@h3ravel/support": "^0.15.6",
|
|
52
|
+
"@h3ravel/filesystem": "^0.4.13"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"typescript": "^5.9.2"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
|
+
"barrel": "barrelsby --directory src --delete --singleQuotes",
|
|
58
59
|
"build": "tsdown --config-loader unconfig",
|
|
59
60
|
"dev": "tsx watch src/index.ts",
|
|
60
|
-
"start": "node dist/index.
|
|
61
|
+
"start": "node dist/index.js",
|
|
61
62
|
"lint": "eslint . --ext .ts",
|
|
62
63
|
"test": "jest --passWithNoTests",
|
|
63
64
|
"version-patch": "pnpm version patch"
|
package/dist/index.d.mts
DELETED
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
/// <reference path="./app.globals.d.ts" />
|
|
2
|
-
import { Command } from "@h3ravel/musket";
|
|
3
|
-
import { Model as Model$1, QueryBuilder, Seeder as Seeder$1 } from "@h3ravel/arquebus";
|
|
4
|
-
import { Application, ServiceProvider } from "@h3ravel/core";
|
|
5
|
-
import { Knex } from "knex";
|
|
6
|
-
import { IQueryBuilder } from "@h3ravel/arquebus/types";
|
|
7
|
-
|
|
8
|
-
//#region src/Commands/MakeCommand.d.ts
|
|
9
|
-
declare class MakeCommand extends Command {
|
|
10
|
-
/**
|
|
11
|
-
* The name and signature of the console command.
|
|
12
|
-
*
|
|
13
|
-
* @var string
|
|
14
|
-
*/
|
|
15
|
-
protected signature: string;
|
|
16
|
-
/**
|
|
17
|
-
* The console command description.
|
|
18
|
-
*
|
|
19
|
-
* @var string
|
|
20
|
-
*/
|
|
21
|
-
protected description: string;
|
|
22
|
-
handle(this: any): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Generate a new database migration class
|
|
25
|
-
*/
|
|
26
|
-
protected makeMigration(): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Create a new model factory
|
|
29
|
-
*/
|
|
30
|
-
protected makeFactory(): void;
|
|
31
|
-
/**
|
|
32
|
-
* Create a new seeder class
|
|
33
|
-
*/
|
|
34
|
-
protected makeSeeder(): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Generate a new Arquebus model class
|
|
37
|
-
*/
|
|
38
|
-
protected makeModel(): Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* Ge the database migration file name
|
|
41
|
-
*
|
|
42
|
-
* @param table
|
|
43
|
-
* @param create
|
|
44
|
-
* @param type
|
|
45
|
-
* @returns
|
|
46
|
-
*/
|
|
47
|
-
getStubName(type: 'migration' | 'seeder' | 'model' | 'factory', ext?: 'ts' | 'js', {
|
|
48
|
-
table,
|
|
49
|
-
create
|
|
50
|
-
}?: {
|
|
51
|
-
table?: string;
|
|
52
|
-
create?: boolean;
|
|
53
|
-
}): string;
|
|
54
|
-
}
|
|
55
|
-
//#endregion
|
|
56
|
-
//#region src/Commands/MigrateCommand.d.ts
|
|
57
|
-
declare class MigrateCommand extends Command {
|
|
58
|
-
/**
|
|
59
|
-
* The current database connection
|
|
60
|
-
*/
|
|
61
|
-
private connection;
|
|
62
|
-
/**
|
|
63
|
-
* The base path for all database operations
|
|
64
|
-
*/
|
|
65
|
-
private databasePath;
|
|
66
|
-
/**
|
|
67
|
-
* The name and signature of the console command.
|
|
68
|
-
*
|
|
69
|
-
* @var string
|
|
70
|
-
*/
|
|
71
|
-
protected signature: string;
|
|
72
|
-
/**
|
|
73
|
-
* The console command description.
|
|
74
|
-
*
|
|
75
|
-
* @var string
|
|
76
|
-
*/
|
|
77
|
-
protected description: string;
|
|
78
|
-
/**
|
|
79
|
-
* Execute the console command.
|
|
80
|
-
*/
|
|
81
|
-
handle(this: any): Promise<void>;
|
|
82
|
-
/**
|
|
83
|
-
* Run all pending migrations.
|
|
84
|
-
*/
|
|
85
|
-
protected migrateRun(): Promise<void>;
|
|
86
|
-
/**
|
|
87
|
-
* Drop all tables and re-run all migrations.
|
|
88
|
-
*/
|
|
89
|
-
protected migrateFresh(): Promise<void>;
|
|
90
|
-
/**
|
|
91
|
-
* Reset and re-run all migrations.
|
|
92
|
-
*/
|
|
93
|
-
protected migrateRefresh(): Promise<void>;
|
|
94
|
-
/**
|
|
95
|
-
* Create the migration repository.
|
|
96
|
-
*/
|
|
97
|
-
protected migrateInstall(): Promise<void>;
|
|
98
|
-
/**
|
|
99
|
-
* Rollback all database migrations.
|
|
100
|
-
*/
|
|
101
|
-
protected migrateReset(): Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
* Rollback the last database migration.
|
|
104
|
-
*/
|
|
105
|
-
protected migrateRollback(): Promise<void>;
|
|
106
|
-
/**
|
|
107
|
-
* Show the status of each migration.
|
|
108
|
-
*/
|
|
109
|
-
protected migrateStatus(): Promise<void>;
|
|
110
|
-
/**
|
|
111
|
-
* Publish any migration files from installed packages.
|
|
112
|
-
*/
|
|
113
|
-
protected migratePublish(): Promise<void>;
|
|
114
|
-
/**
|
|
115
|
-
* Run database seeders
|
|
116
|
-
*/
|
|
117
|
-
private runSeeders;
|
|
118
|
-
}
|
|
119
|
-
//#endregion
|
|
120
|
-
//#region src/Commands/SeedCommand.d.ts
|
|
121
|
-
declare class SeedCommand extends Command {
|
|
122
|
-
/**
|
|
123
|
-
* The current query builder instance
|
|
124
|
-
*/
|
|
125
|
-
queryBuilder: QueryBuilder;
|
|
126
|
-
/**
|
|
127
|
-
* The current database connection name
|
|
128
|
-
*/
|
|
129
|
-
private connection;
|
|
130
|
-
/**
|
|
131
|
-
* The name and signature of the console command.
|
|
132
|
-
*
|
|
133
|
-
* @var string
|
|
134
|
-
*/
|
|
135
|
-
protected signature: string;
|
|
136
|
-
/**
|
|
137
|
-
* The console command description.
|
|
138
|
-
*
|
|
139
|
-
* @var string
|
|
140
|
-
*/
|
|
141
|
-
protected description: string;
|
|
142
|
-
/**
|
|
143
|
-
* Execute the console command.
|
|
144
|
-
*/
|
|
145
|
-
handle(): Promise<void>;
|
|
146
|
-
}
|
|
147
|
-
//#endregion
|
|
148
|
-
//#region src/Configuration.d.ts
|
|
149
|
-
type TFunction = (...args: any[]) => any;
|
|
150
|
-
interface TField {
|
|
151
|
-
type: 'VAR_STRING' | 'BLOB' | 'DATETIME' | 'TIMESTAMP' | 'LONG' | 'JSON';
|
|
152
|
-
length: number;
|
|
153
|
-
db: string;
|
|
154
|
-
table: string;
|
|
155
|
-
name: string;
|
|
156
|
-
string: TFunction;
|
|
157
|
-
buffer: TFunction;
|
|
158
|
-
geometry: TFunction;
|
|
159
|
-
}
|
|
160
|
-
interface TBaseConfig {
|
|
161
|
-
client: 'mysql' | 'mysql2' | 'sqlite3' | 'oracle' | 'mariadb' | 'pg';
|
|
162
|
-
connection: {
|
|
163
|
-
typeCast?(field: TField, next: TFunction): any;
|
|
164
|
-
dateStrings?: boolean;
|
|
165
|
-
};
|
|
166
|
-
pool?: {
|
|
167
|
-
afterCreate: (connection: TConfig, callback: (val: any, con: any) => void) => Promise<any>;
|
|
168
|
-
} | undefined;
|
|
169
|
-
connections?: Record<string, TConfig>;
|
|
170
|
-
migrations?: {
|
|
171
|
-
table: string;
|
|
172
|
-
path: string;
|
|
173
|
-
};
|
|
174
|
-
factories?: {
|
|
175
|
-
path: string;
|
|
176
|
-
};
|
|
177
|
-
seeders?: {
|
|
178
|
-
path: string;
|
|
179
|
-
};
|
|
180
|
-
models?: {
|
|
181
|
-
path: string;
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
type TConfig = TBaseConfig & ({
|
|
185
|
-
client: 'pg';
|
|
186
|
-
connection: Knex.PgConnectionConfig;
|
|
187
|
-
} | {
|
|
188
|
-
client: 'oracle';
|
|
189
|
-
connection: Knex.OracleDbConnectionConfig;
|
|
190
|
-
} | {
|
|
191
|
-
client: 'mysql2';
|
|
192
|
-
connection: Knex.MySql2ConnectionConfig;
|
|
193
|
-
} | {
|
|
194
|
-
client: 'mysql';
|
|
195
|
-
connection: Knex.MySqlConnectionConfig;
|
|
196
|
-
} | {
|
|
197
|
-
client: 'sqlite3';
|
|
198
|
-
connection: Knex.Sqlite3ConnectionConfig;
|
|
199
|
-
useNullAsDefault?: boolean;
|
|
200
|
-
} | {
|
|
201
|
-
client: 'mariadb';
|
|
202
|
-
connection: Knex.MariaSqlConnectionConfig;
|
|
203
|
-
useNullAsDefault?: boolean;
|
|
204
|
-
});
|
|
205
|
-
declare const arquebusConfig: (config: any) => TBaseConfig;
|
|
206
|
-
//#endregion
|
|
207
|
-
//#region src/Model.d.ts
|
|
208
|
-
declare class Model<M extends Model$1 = any> extends Model$1 {
|
|
209
|
-
/**
|
|
210
|
-
* Retrieve the model for a bound value.
|
|
211
|
-
*
|
|
212
|
-
* @param {any} value
|
|
213
|
-
* @param {String|null} field
|
|
214
|
-
* @returns
|
|
215
|
-
*/
|
|
216
|
-
resolveRouteBinding(value: any, field?: undefined | string | null): Promise<M>;
|
|
217
|
-
}
|
|
218
|
-
//#endregion
|
|
219
|
-
//#region src/Providers/DatabaseServiceProvider.d.ts
|
|
220
|
-
/**
|
|
221
|
-
* Database connection, ORM, migrations.
|
|
222
|
-
*
|
|
223
|
-
* Register DatabaseManager and QueryBuilder if required.
|
|
224
|
-
* Set up ORM models and relationships.
|
|
225
|
-
* Register migration and seeder commands.
|
|
226
|
-
*
|
|
227
|
-
*/
|
|
228
|
-
declare class DatabaseServiceProvider extends ServiceProvider {
|
|
229
|
-
static priority: number;
|
|
230
|
-
register(): void;
|
|
231
|
-
}
|
|
232
|
-
//#endregion
|
|
233
|
-
//#region src/Query/DB.d.ts
|
|
234
|
-
declare class DB {
|
|
235
|
-
connection?: string;
|
|
236
|
-
constructor(connection?: string);
|
|
237
|
-
/**
|
|
238
|
-
* New instance
|
|
239
|
-
*/
|
|
240
|
-
static table(name: string): IQueryBuilder;
|
|
241
|
-
/**
|
|
242
|
-
* Builder table instance
|
|
243
|
-
*/
|
|
244
|
-
static instance(connection?: string): any;
|
|
245
|
-
/**
|
|
246
|
-
* Builder transaction instance
|
|
247
|
-
*/
|
|
248
|
-
static transaction<C>(callback: (...args: C[]) => any): any;
|
|
249
|
-
private builder;
|
|
250
|
-
}
|
|
251
|
-
//#endregion
|
|
252
|
-
//#region src/Seeder.d.ts
|
|
253
|
-
declare class Seeder extends Seeder$1 {
|
|
254
|
-
app: Application;
|
|
255
|
-
command?: SeedCommand | undefined;
|
|
256
|
-
/**
|
|
257
|
-
* Seeders that have been called at least one time.
|
|
258
|
-
*/
|
|
259
|
-
static called: Seeder[];
|
|
260
|
-
constructor(app: Application, command?: SeedCommand | undefined);
|
|
261
|
-
run(_conn?: SeedCommand['queryBuilder'], ..._args: any[]): Promise<void>;
|
|
262
|
-
/**
|
|
263
|
-
* Run the given seeder class.
|
|
264
|
-
*
|
|
265
|
-
* @param className
|
|
266
|
-
* @param silent
|
|
267
|
-
* @param parameters
|
|
268
|
-
*
|
|
269
|
-
* @return this
|
|
270
|
-
*/
|
|
271
|
-
call(className: typeof Seeder | typeof Seeder[], silent?: boolean, parameters?: any[]): Promise<this>;
|
|
272
|
-
/**
|
|
273
|
-
* Resolve an instance of the given seeder class.
|
|
274
|
-
*
|
|
275
|
-
* @param className
|
|
276
|
-
*
|
|
277
|
-
* @return Seeder
|
|
278
|
-
*/
|
|
279
|
-
protected resolve(className: typeof Seeder): Seeder;
|
|
280
|
-
/**
|
|
281
|
-
* Run the given seeder class.
|
|
282
|
-
*
|
|
283
|
-
* @param className
|
|
284
|
-
* @param silent
|
|
285
|
-
* @param parameters
|
|
286
|
-
*
|
|
287
|
-
* @return void
|
|
288
|
-
*/
|
|
289
|
-
callWith(className: typeof Seeder | typeof Seeder[], parameters: any[]): Promise<void>;
|
|
290
|
-
/**
|
|
291
|
-
* Silently run the given seeder class.
|
|
292
|
-
*
|
|
293
|
-
* @param className
|
|
294
|
-
* @param parameters
|
|
295
|
-
*
|
|
296
|
-
* @return void
|
|
297
|
-
*/
|
|
298
|
-
callSilent(className: typeof Seeder | typeof Seeder[], parameters?: any[]): Promise<void>;
|
|
299
|
-
/**
|
|
300
|
-
* Set the console command instance.
|
|
301
|
-
*
|
|
302
|
-
* @param command
|
|
303
|
-
*
|
|
304
|
-
* @return this
|
|
305
|
-
*/
|
|
306
|
-
setCommand(command: SeedCommand): this;
|
|
307
|
-
}
|
|
308
|
-
//#endregion
|
|
309
|
-
//#region src/Utils/TableGuesser.d.ts
|
|
310
|
-
declare class TableGuesser {
|
|
311
|
-
static CREATE_PATTERNS: RegExp[];
|
|
312
|
-
static CHANGE_PATTERNS: RegExp[];
|
|
313
|
-
static guess(migration: string): (string | boolean)[];
|
|
314
|
-
}
|
|
315
|
-
//#endregion
|
|
316
|
-
export { DB, DatabaseServiceProvider, MakeCommand, MigrateCommand, Model, SeedCommand, Seeder, TBaseConfig, TConfig, TField, TableGuesser, arquebusConfig };
|