@h3ravel/database 11.0.0 → 11.2.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/index.d.cts CHANGED
@@ -1,5 +1,139 @@
1
- import { ServiceProvider } from '@h3ravel/core';
1
+ import { ConsoleCommand, ServiceProvider } from "@h3ravel/core";
2
+ import { Knex } from "knex";
3
+ import { Model as Model$1 } from "@h3ravel/arquebus";
2
4
 
5
+ //#region src/Commands/MigrateCommand.d.ts
6
+ declare class MigrateCommand extends ConsoleCommand {
7
+ /**
8
+ * The current database connection
9
+ */
10
+ private connection;
11
+ /**
12
+ * The base path for all database operations
13
+ */
14
+ private databasePath;
15
+ /**
16
+ * The name and signature of the console command.
17
+ *
18
+ * @var string
19
+ */
20
+ protected signature: string;
21
+ /**
22
+ * The console command description.
23
+ *
24
+ * @var string
25
+ */
26
+ protected description: string;
27
+ /**
28
+ * Execute the console command.
29
+ */
30
+ handle(): Promise<void>;
31
+ /**
32
+ * Run all pending migrations.
33
+ */
34
+ protected migrateRun(): Promise<void>;
35
+ /**
36
+ * Drop all tables and re-run all migrations.
37
+ */
38
+ protected migrateFresh(): Promise<void>;
39
+ /**
40
+ * Create the migration repository.
41
+ */
42
+ protected migrateInstall(): Promise<void>;
43
+ /**
44
+ * Reset and re-run all migrations.
45
+ */
46
+ protected migrateRefresh(): Promise<void>;
47
+ /**
48
+ * Rollback all database migrations.
49
+ */
50
+ protected migrateReset(): Promise<void>;
51
+ /**
52
+ * Rollback the last database migration.
53
+ */
54
+ protected migrateRollback(): Promise<void>;
55
+ /**
56
+ * Show the status of each migration.
57
+ */
58
+ protected migrateStatus(): Promise<void>;
59
+ /**
60
+ * Publish any migration files from installed packages.
61
+ */
62
+ protected migratePublish(): Promise<void>;
63
+ }
64
+ //#endregion
65
+ //#region src/Configuration.d.ts
66
+ type TFunction = (...args: any[]) => any;
67
+ interface TField {
68
+ type: 'VAR_STRING' | 'BLOB' | 'DATETIME' | 'TIMESTAMP' | 'LONG' | 'JSON';
69
+ length: number;
70
+ db: string;
71
+ table: string;
72
+ name: string;
73
+ string: TFunction;
74
+ buffer: TFunction;
75
+ geometry: TFunction;
76
+ }
77
+ interface TBaseConfig {
78
+ client: 'mysql' | 'mysql2' | 'sqlite3' | 'oracle' | 'mariadb' | 'pg';
79
+ connection: {
80
+ typeCast?(field: TField, next: TFunction): any;
81
+ dateStrings?: boolean;
82
+ };
83
+ pool?: {
84
+ afterCreate: (connection: TConfig, callback: (val: any, con: any) => void) => Promise<any>;
85
+ } | undefined;
86
+ connections?: Record<string, TConfig>;
87
+ migrations?: {
88
+ table: string;
89
+ path: string;
90
+ };
91
+ factories?: {
92
+ path: string;
93
+ };
94
+ seeders?: {
95
+ path: string;
96
+ };
97
+ models?: {
98
+ path: string;
99
+ };
100
+ }
101
+ type TConfig = TBaseConfig & ({
102
+ client: 'pg';
103
+ connection: Knex.PgConnectionConfig;
104
+ } | {
105
+ client: 'oracle';
106
+ connection: Knex.OracleDbConnectionConfig;
107
+ } | {
108
+ client: 'mysql2';
109
+ connection: Knex.MySql2ConnectionConfig;
110
+ } | {
111
+ client: 'mysql';
112
+ connection: Knex.MySqlConnectionConfig;
113
+ } | {
114
+ client: 'sqlite3';
115
+ connection: Knex.Sqlite3ConnectionConfig;
116
+ useNullAsDefault?: boolean;
117
+ } | {
118
+ client: 'mariadb';
119
+ connection: Knex.MariaSqlConnectionConfig;
120
+ useNullAsDefault?: boolean;
121
+ });
122
+ declare const arquebusConfig: (config: any) => TBaseConfig;
123
+ //#endregion
124
+ //#region src/Model.d.ts
125
+ declare class Model<M extends Model$1 = any> extends Model$1 {
126
+ /**
127
+ * Retrieve the model for a bound value.
128
+ *
129
+ * @param {any} value
130
+ * @param {String|null} field
131
+ * @returns
132
+ */
133
+ resolveRouteBinding(value: any, field?: undefined | string | null): Promise<M>;
134
+ }
135
+ //#endregion
136
+ //#region src/Providers/DatabaseServiceProvider.d.ts
3
137
  /**
4
138
  * Database connection, ORM, migrations.
5
139
  *
@@ -7,11 +141,11 @@ import { ServiceProvider } from '@h3ravel/core';
7
141
  * Set up ORM models and relationships.
8
142
  * Register migration and seeder commands.
9
143
  *
10
- * Auto-Registered if @h3ravel/database is installed
11
144
  */
12
145
  declare class DatabaseServiceProvider extends ServiceProvider {
13
- static priority: number;
14
- register(): void;
146
+ static priority: number;
147
+ register(): void;
15
148
  }
16
-
17
- export { DatabaseServiceProvider };
149
+ //#endregion
150
+ export { DatabaseServiceProvider, MigrateCommand, Model, TBaseConfig, TConfig, TField, arquebusConfig };
151
+ //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,139 @@
1
- import { ServiceProvider } from '@h3ravel/core';
1
+ import { ConsoleCommand, ServiceProvider } from "@h3ravel/core";
2
+ import { Model as Model$1 } from "@h3ravel/arquebus";
3
+ import { Knex } from "knex";
2
4
 
5
+ //#region src/Commands/MigrateCommand.d.ts
6
+ declare class MigrateCommand extends ConsoleCommand {
7
+ /**
8
+ * The current database connection
9
+ */
10
+ private connection;
11
+ /**
12
+ * The base path for all database operations
13
+ */
14
+ private databasePath;
15
+ /**
16
+ * The name and signature of the console command.
17
+ *
18
+ * @var string
19
+ */
20
+ protected signature: string;
21
+ /**
22
+ * The console command description.
23
+ *
24
+ * @var string
25
+ */
26
+ protected description: string;
27
+ /**
28
+ * Execute the console command.
29
+ */
30
+ handle(): Promise<void>;
31
+ /**
32
+ * Run all pending migrations.
33
+ */
34
+ protected migrateRun(): Promise<void>;
35
+ /**
36
+ * Drop all tables and re-run all migrations.
37
+ */
38
+ protected migrateFresh(): Promise<void>;
39
+ /**
40
+ * Create the migration repository.
41
+ */
42
+ protected migrateInstall(): Promise<void>;
43
+ /**
44
+ * Reset and re-run all migrations.
45
+ */
46
+ protected migrateRefresh(): Promise<void>;
47
+ /**
48
+ * Rollback all database migrations.
49
+ */
50
+ protected migrateReset(): Promise<void>;
51
+ /**
52
+ * Rollback the last database migration.
53
+ */
54
+ protected migrateRollback(): Promise<void>;
55
+ /**
56
+ * Show the status of each migration.
57
+ */
58
+ protected migrateStatus(): Promise<void>;
59
+ /**
60
+ * Publish any migration files from installed packages.
61
+ */
62
+ protected migratePublish(): Promise<void>;
63
+ }
64
+ //#endregion
65
+ //#region src/Configuration.d.ts
66
+ type TFunction = (...args: any[]) => any;
67
+ interface TField {
68
+ type: 'VAR_STRING' | 'BLOB' | 'DATETIME' | 'TIMESTAMP' | 'LONG' | 'JSON';
69
+ length: number;
70
+ db: string;
71
+ table: string;
72
+ name: string;
73
+ string: TFunction;
74
+ buffer: TFunction;
75
+ geometry: TFunction;
76
+ }
77
+ interface TBaseConfig {
78
+ client: 'mysql' | 'mysql2' | 'sqlite3' | 'oracle' | 'mariadb' | 'pg';
79
+ connection: {
80
+ typeCast?(field: TField, next: TFunction): any;
81
+ dateStrings?: boolean;
82
+ };
83
+ pool?: {
84
+ afterCreate: (connection: TConfig, callback: (val: any, con: any) => void) => Promise<any>;
85
+ } | undefined;
86
+ connections?: Record<string, TConfig>;
87
+ migrations?: {
88
+ table: string;
89
+ path: string;
90
+ };
91
+ factories?: {
92
+ path: string;
93
+ };
94
+ seeders?: {
95
+ path: string;
96
+ };
97
+ models?: {
98
+ path: string;
99
+ };
100
+ }
101
+ type TConfig = TBaseConfig & ({
102
+ client: 'pg';
103
+ connection: Knex.PgConnectionConfig;
104
+ } | {
105
+ client: 'oracle';
106
+ connection: Knex.OracleDbConnectionConfig;
107
+ } | {
108
+ client: 'mysql2';
109
+ connection: Knex.MySql2ConnectionConfig;
110
+ } | {
111
+ client: 'mysql';
112
+ connection: Knex.MySqlConnectionConfig;
113
+ } | {
114
+ client: 'sqlite3';
115
+ connection: Knex.Sqlite3ConnectionConfig;
116
+ useNullAsDefault?: boolean;
117
+ } | {
118
+ client: 'mariadb';
119
+ connection: Knex.MariaSqlConnectionConfig;
120
+ useNullAsDefault?: boolean;
121
+ });
122
+ declare const arquebusConfig: (config: any) => TBaseConfig;
123
+ //#endregion
124
+ //#region src/Model.d.ts
125
+ declare class Model<M extends Model$1 = any> extends Model$1 {
126
+ /**
127
+ * Retrieve the model for a bound value.
128
+ *
129
+ * @param {any} value
130
+ * @param {String|null} field
131
+ * @returns
132
+ */
133
+ resolveRouteBinding(value: any, field?: undefined | string | null): Promise<M>;
134
+ }
135
+ //#endregion
136
+ //#region src/Providers/DatabaseServiceProvider.d.ts
3
137
  /**
4
138
  * Database connection, ORM, migrations.
5
139
  *
@@ -7,11 +141,11 @@ import { ServiceProvider } from '@h3ravel/core';
7
141
  * Set up ORM models and relationships.
8
142
  * Register migration and seeder commands.
9
143
  *
10
- * Auto-Registered if @h3ravel/database is installed
11
144
  */
12
145
  declare class DatabaseServiceProvider extends ServiceProvider {
13
- static priority: number;
14
- register(): void;
146
+ static priority: number;
147
+ register(): void;
15
148
  }
16
-
17
- export { DatabaseServiceProvider };
149
+ //#endregion
150
+ export { DatabaseServiceProvider, MigrateCommand, Model, TBaseConfig, TConfig, TField, arquebusConfig };
151
+ //# sourceMappingURL=index.d.ts.map