@h3ravel/arquebus 0.6.0 → 0.6.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/bin/index.cjs CHANGED
@@ -5464,7 +5464,7 @@ var MigrationCreator = class {
5464
5464
  //#endregion
5465
5465
  //#region package.json
5466
5466
  var name = "@h3ravel/arquebus";
5467
- var version = "0.5.0";
5467
+ var version = "0.6.1";
5468
5468
  var packageManager = "pnpm@10.14.0";
5469
5469
  var description = "Arquebus ORM is a Beautiful, expressive ORM inspired by Laravel's Eloquent, designed for TypeScript applications and for the H3ravel Framework.";
5470
5470
  var homepage = "https://h3ravel.toneflix.net/arquebus";
@@ -5572,7 +5572,8 @@ var exports$1 = {
5572
5572
  "default": "./dist/browser/index.cjs"
5573
5573
  }
5574
5574
  },
5575
- "./package.json": "./package.json"
5575
+ "./package.json": "./package.json",
5576
+ "./types": "./types"
5576
5577
  };
5577
5578
  var repository = {
5578
5579
  "type": "git",
package/bin/index.js CHANGED
@@ -5459,7 +5459,7 @@ var MigrationCreator = class {
5459
5459
  //#endregion
5460
5460
  //#region package.json
5461
5461
  var name = "@h3ravel/arquebus";
5462
- var version = "0.5.0";
5462
+ var version = "0.6.1";
5463
5463
  var packageManager = "pnpm@10.14.0";
5464
5464
  var description = "Arquebus ORM is a Beautiful, expressive ORM inspired by Laravel's Eloquent, designed for TypeScript applications and for the H3ravel Framework.";
5465
5465
  var homepage = "https://h3ravel.toneflix.net/arquebus";
@@ -5567,7 +5567,8 @@ var exports = {
5567
5567
  "default": "./dist/browser/index.cjs"
5568
5568
  }
5569
5569
  },
5570
- "./package.json": "./package.json"
5570
+ "./package.json": "./package.json",
5571
+ "./types": "./types"
5571
5572
  };
5572
5573
  var repository = {
5573
5574
  "type": "git",
@@ -630,7 +630,7 @@ declare class QueryBuilder<M extends Model$1 = Model$1, R = M[] | M> extends Inf
630
630
  chunk(count: number, callback: TFunction): Promise<boolean>;
631
631
  paginate<F extends IPaginatorParams>(this: any, page: number | undefined, perPage: number | undefined, _pageName: string, _page: number): Promise<IPaginator<M, F>>;
632
632
  forPage(this: any, page?: number, perPage?: number): any;
633
- toSQL(...args: Parameters<typeof this.connector.toSQL>): Knex.Sql;
633
+ toSQL(...args: any[]): Knex.Sql;
634
634
  count(column: string): Promise<number>;
635
635
  min(column: string): Promise<number>;
636
636
  max(column: string): Promise<number>;
@@ -754,7 +754,7 @@ declare class arquebus<M extends Model$1 = Model$1> {
754
754
  static getConnectorFactory(): typeof Knex$1;
755
755
  static addConnection(config: TConfig | TBaseConfig, name?: string): void;
756
756
  static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
757
- static transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
757
+ static transaction<A, R>(callback: TFunction<A[], R>, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
758
758
  static table(name: string, connection?: null): IQueryBuilder<Model$1, Model$1 | Model$1[]>;
759
759
  static schema(connection?: null): SchemaBuilder;
760
760
  static destroyAll(): Promise<void>;
@@ -630,7 +630,7 @@ declare class QueryBuilder<M extends Model$1 = Model$1, R = M[] | M> extends Inf
630
630
  chunk(count: number, callback: TFunction): Promise<boolean>;
631
631
  paginate<F extends IPaginatorParams>(this: any, page: number | undefined, perPage: number | undefined, _pageName: string, _page: number): Promise<IPaginator<M, F>>;
632
632
  forPage(this: any, page?: number, perPage?: number): any;
633
- toSQL(...args: Parameters<typeof this.connector.toSQL>): Knex.Sql;
633
+ toSQL(...args: any[]): Knex.Sql;
634
634
  count(column: string): Promise<number>;
635
635
  min(column: string): Promise<number>;
636
636
  max(column: string): Promise<number>;
@@ -754,7 +754,7 @@ declare class arquebus<M extends Model$1 = Model$1> {
754
754
  static getConnectorFactory(): typeof Knex$1;
755
755
  static addConnection(config: TConfig | TBaseConfig, name?: string): void;
756
756
  static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
757
- static transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
757
+ static transaction<A, R>(callback: TFunction<A[], R>, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
758
758
  static table(name: string, connection?: null): IQueryBuilder<Model$1, Model$1 | Model$1[]>;
759
759
  static schema(connection?: null): SchemaBuilder;
760
760
  static destroyAll(): Promise<void>;
package/dist/index.d.cts CHANGED
@@ -437,7 +437,7 @@ declare class QueryBuilder<M extends Model$1 = Model$1, R = M[] | M> extends Inf
437
437
  chunk(count: number, callback: TFunction): Promise<boolean>;
438
438
  paginate<F extends IPaginatorParams>(this: any, page: number | undefined, perPage: number | undefined, _pageName: string, _page: number): Promise<IPaginator<M, F>>;
439
439
  forPage(this: any, page?: number, perPage?: number): any;
440
- toSQL(...args: Parameters<typeof this.connector.toSQL>): Knex.Sql;
440
+ toSQL(...args: any[]): Knex.Sql;
441
441
  count(column: string): Promise<number>;
442
442
  min(column: string): Promise<number>;
443
443
  max(column: string): Promise<number>;
@@ -1044,7 +1044,7 @@ declare class arquebus<M extends Model$1 = Model$1> {
1044
1044
  static getConnectorFactory(): typeof Knex$1;
1045
1045
  static addConnection(config: TConfig | TBaseConfig, name?: string): void;
1046
1046
  static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
1047
- static transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
1047
+ static transaction<A, R>(callback: TFunction<A[], R>, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
1048
1048
  static table(name: string, connection?: null): IQueryBuilder<Model$1, Model$1 | Model$1[]>;
1049
1049
  static schema(connection?: null): SchemaBuilder;
1050
1050
  static destroyAll(): Promise<void>;
@@ -4647,16 +4647,16 @@ declare class Collection$2<I extends Model$2> extends Collection$1<I> {
4647
4647
  append(attributes: any): this;
4648
4648
  only(keys: any[]): any;
4649
4649
  getDictionary(items?: ICollection<any> | any[]): TGeneric;
4650
- toData(): (I | {
4650
+ toData(): ({
4651
4651
  [x: string]: any;
4652
4652
  [x: number]: any;
4653
4653
  [x: symbol]: any;
4654
- })[];
4655
- toJSON(): (I | {
4654
+ } | I)[];
4655
+ toJSON(): ({
4656
4656
  [x: string]: any;
4657
4657
  [x: number]: any;
4658
4658
  [x: symbol]: any;
4659
- })[];
4659
+ } | I)[];
4660
4660
  toJson(...args: any[]): string;
4661
4661
  [Symbol.iterator]: () => Iterator<I>;
4662
4662
  }
package/dist/index.d.ts CHANGED
@@ -437,7 +437,7 @@ declare class QueryBuilder<M extends Model$1 = Model$1, R = M[] | M> extends Inf
437
437
  chunk(count: number, callback: TFunction): Promise<boolean>;
438
438
  paginate<F extends IPaginatorParams>(this: any, page: number | undefined, perPage: number | undefined, _pageName: string, _page: number): Promise<IPaginator<M, F>>;
439
439
  forPage(this: any, page?: number, perPage?: number): any;
440
- toSQL(...args: Parameters<typeof this.connector.toSQL>): Knex.Sql;
440
+ toSQL(...args: any[]): Knex.Sql;
441
441
  count(column: string): Promise<number>;
442
442
  min(column: string): Promise<number>;
443
443
  max(column: string): Promise<number>;
@@ -1044,7 +1044,7 @@ declare class arquebus<M extends Model$1 = Model$1> {
1044
1044
  static getConnectorFactory(): typeof Knex$1;
1045
1045
  static addConnection(config: TConfig | TBaseConfig, name?: string): void;
1046
1046
  static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
1047
- static transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
1047
+ static transaction<A, R>(callback: TFunction<A[], R>, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
1048
1048
  static table(name: string, connection?: null): IQueryBuilder<Model$1, Model$1 | Model$1[]>;
1049
1049
  static schema(connection?: null): SchemaBuilder;
1050
1050
  static destroyAll(): Promise<void>;
@@ -4647,16 +4647,16 @@ declare class Collection$2<I extends Model$2> extends Collection$1<I> {
4647
4647
  append(attributes: any): this;
4648
4648
  only(keys: any[]): any;
4649
4649
  getDictionary(items?: ICollection<any> | any[]): TGeneric;
4650
- toData(): (I | {
4650
+ toData(): ({
4651
4651
  [x: string]: any;
4652
4652
  [x: number]: any;
4653
4653
  [x: symbol]: any;
4654
- })[];
4655
- toJSON(): (I | {
4654
+ } | I)[];
4655
+ toJSON(): ({
4656
4656
  [x: string]: any;
4657
4657
  [x: number]: any;
4658
4658
  [x: symbol]: any;
4659
- })[];
4659
+ } | I)[];
4660
4660
  toJson(...args: any[]): string;
4661
4661
  [Symbol.iterator]: () => Iterator<I>;
4662
4662
  }
@@ -261,7 +261,7 @@ declare class arquebus<M extends Model = Model> {
261
261
  static getConnectorFactory(): typeof Knex$1;
262
262
  static addConnection(config: TConfig | TBaseConfig, name?: string): void;
263
263
  static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
264
- static transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
264
+ static transaction<A, R>(callback: TFunction<A[], R>, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
265
265
  static table(name: string, connection?: null): IQueryBuilder<Model, Model | Model[]>;
266
266
  static schema(connection?: null): SchemaBuilder;
267
267
  static destroyAll(): Promise<void>;
@@ -4718,7 +4718,7 @@ declare class QueryBuilder<M extends Model = Model, R = M[] | M> extends Inferen
4718
4718
  chunk(count: number, callback: TFunction): Promise<boolean>;
4719
4719
  paginate<F extends IPaginatorParams>(this: any, page: number | undefined, perPage: number | undefined, _pageName: string, _page: number): Promise<IPaginator<M, F>>;
4720
4720
  forPage(this: any, page?: number, perPage?: number): any;
4721
- toSQL(...args: Parameters<typeof this.connector.toSQL>): Knex.Sql;
4721
+ toSQL(...args: any[]): Knex.Sql;
4722
4722
  count(column: string): Promise<number>;
4723
4723
  min(column: string): Promise<number>;
4724
4724
  max(column: string): Promise<number>;
@@ -258,7 +258,7 @@ declare class arquebus<M extends Model = Model> {
258
258
  static getConnectorFactory(): typeof Knex$1;
259
259
  static addConnection(config: TConfig | TBaseConfig, name?: string): void;
260
260
  static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
261
- static transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
261
+ static transaction<A, R>(callback: TFunction<A[], R>, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
262
262
  static table(name: string, connection?: null): IQueryBuilder<Model, Model | Model[]>;
263
263
  static schema(connection?: null): SchemaBuilder;
264
264
  static destroyAll(): Promise<void>;
@@ -4715,7 +4715,7 @@ declare class QueryBuilder<M extends Model = Model, R = M[] | M> extends Inferen
4715
4715
  chunk(count: number, callback: TFunction): Promise<boolean>;
4716
4716
  paginate<F extends IPaginatorParams>(this: any, page: number | undefined, perPage: number | undefined, _pageName: string, _page: number): Promise<IPaginator<M, F>>;
4717
4717
  forPage(this: any, page?: number, perPage?: number): any;
4718
- toSQL(...args: Parameters<typeof this.connector.toSQL>): Knex.Sql;
4718
+ toSQL(...args: any[]): Knex.Sql;
4719
4719
  count(column: string): Promise<number>;
4720
4720
  min(column: string): Promise<number>;
4721
4721
  max(column: string): Promise<number>;
@@ -21,10 +21,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  }) : target, mod));
22
22
 
23
23
  //#endregion
24
- let path = require("path");
25
- path = __toESM(path);
26
24
  let node_fs_promises = require("node:fs/promises");
27
25
  node_fs_promises = __toESM(node_fs_promises);
26
+ let path = require("path");
27
+ path = __toESM(path);
28
28
  let node_path = require("node:path");
29
29
  node_path = __toESM(node_path);
30
30
  let node_url = require("node:url");
@@ -258,7 +258,7 @@ declare class arquebus<M extends Model = Model> {
258
258
  static getConnectorFactory(): typeof Knex$1;
259
259
  static addConnection(config: TConfig | TBaseConfig, name?: string): void;
260
260
  static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
261
- static transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
261
+ static transaction<A, R>(callback: TFunction<A[], R>, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
262
262
  static table(name: string, connection?: null): IQueryBuilder<Model, Model | Model[]>;
263
263
  static schema(connection?: null): SchemaBuilder;
264
264
  static destroyAll(): Promise<void>;
@@ -4715,7 +4715,7 @@ declare class QueryBuilder<M extends Model = Model, R = M[] | M> extends Inferen
4715
4715
  chunk(count: number, callback: TFunction): Promise<boolean>;
4716
4716
  paginate<F extends IPaginatorParams>(this: any, page: number | undefined, perPage: number | undefined, _pageName: string, _page: number): Promise<IPaginator<M, F>>;
4717
4717
  forPage(this: any, page?: number, perPage?: number): any;
4718
- toSQL(...args: Parameters<typeof this.connector.toSQL>): Knex.Sql;
4718
+ toSQL(...args: any[]): Knex.Sql;
4719
4719
  count(column: string): Promise<number>;
4720
4720
  min(column: string): Promise<number>;
4721
4721
  max(column: string): Promise<number>;
@@ -258,7 +258,7 @@ declare class arquebus<M extends Model = Model> {
258
258
  static getConnectorFactory(): typeof Knex$1;
259
259
  static addConnection(config: TConfig | TBaseConfig, name?: string): void;
260
260
  static beginTransaction(connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>>;
261
- static transaction(callback: TFunction, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
261
+ static transaction<A, R>(callback: TFunction<A[], R>, connection?: null): Promise<Knex$1.Knex.Transaction<any, any[]>> | undefined;
262
262
  static table(name: string, connection?: null): IQueryBuilder<Model, Model | Model[]>;
263
263
  static schema(connection?: null): SchemaBuilder;
264
264
  static destroyAll(): Promise<void>;
@@ -4715,7 +4715,7 @@ declare class QueryBuilder<M extends Model = Model, R = M[] | M> extends Inferen
4715
4715
  chunk(count: number, callback: TFunction): Promise<boolean>;
4716
4716
  paginate<F extends IPaginatorParams>(this: any, page: number | undefined, perPage: number | undefined, _pageName: string, _page: number): Promise<IPaginator<M, F>>;
4717
4717
  forPage(this: any, page?: number, perPage?: number): any;
4718
- toSQL(...args: Parameters<typeof this.connector.toSQL>): Knex.Sql;
4718
+ toSQL(...args: any[]): Knex.Sql;
4719
4719
  count(column: string): Promise<number>;
4720
4720
  min(column: string): Promise<number>;
4721
4721
  max(column: string): Promise<number>;
@@ -1,5 +1,5 @@
1
- import path from "path";
2
1
  import { access, mkdir, readFile, writeFile } from "node:fs/promises";
2
+ import path from "path";
3
3
  import path$1, { dirname } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
 
@@ -1,12 +1,11 @@
1
1
  import type QueryBuilder from 'src/query-builder'
2
+ import type Seeder from './seeder'
2
3
  import type { TBaseConfig } from 'types/container'
4
+ import { access } from 'node:fs/promises'
3
5
  import type { arquebus } from 'src'
4
6
  import path from 'path'
5
- import { access } from 'node:fs/promises'
6
-
7
- import Seeder from './seeder'
8
7
 
9
- async function glob(folderPath: string): Promise<string[]> {
8
+ async function glob (folderPath: string): Promise<string[]> {
10
9
  const { default: escalade } = await import('escalade')
11
10
  const entries: string[] = []
12
11
  const root = folderPath
@@ -36,15 +35,15 @@ export class SeederRunner {
36
35
  this.resolver = resolver
37
36
  }
38
37
 
39
- path(p: string): void {
38
+ path (p: string): void {
40
39
  this.paths = Array.from(new Set([...this.paths, p]))
41
40
  }
42
41
 
43
- getPaths(): string[] {
42
+ getPaths (): string[] {
44
43
  return this.paths
45
44
  }
46
45
 
47
- resolveConnection(connection?: TBaseConfig['client']): QueryBuilder {
46
+ resolveConnection (connection?: TBaseConfig['client']): QueryBuilder {
48
47
  const name = connection || this.connection || 'default'
49
48
  // If the resolver has no connection manager entry, attempt to autoload config
50
49
  const instance: any = (this.resolver as any).getInstance?.() ?? null
@@ -60,12 +59,12 @@ export class SeederRunner {
60
59
  return this.resolver.fire(name)
61
60
  }
62
61
 
63
- setConnection(connection: TBaseConfig['client']): this {
62
+ setConnection (connection: TBaseConfig['client']): this {
64
63
  this.connection = connection
65
64
  return this
66
65
  }
67
66
 
68
- async getSeederFiles(paths: string[]): Promise<string[]> {
67
+ async getSeederFiles (paths: string[]): Promise<string[]> {
69
68
  const files: string[] = []
70
69
  for (const p of paths) {
71
70
  if (p.endsWith('.js') || p.endsWith('.ts')) {
@@ -77,7 +76,7 @@ export class SeederRunner {
77
76
  return files
78
77
  }
79
78
 
80
- async resolvePath(filePath: string): Promise<Seeder | null> {
79
+ async resolvePath (filePath: string): Promise<Seeder | null> {
81
80
  try {
82
81
  const mod = await import(filePath)
83
82
  const instance = new (mod.default ?? mod.Seeder)()
@@ -87,7 +86,7 @@ export class SeederRunner {
87
86
  }
88
87
  }
89
88
 
90
- async run(paths: string[], connection?: TBaseConfig['client']): Promise<void> {
89
+ async run (paths: string[], connection?: TBaseConfig['client']): Promise<void> {
91
90
  const files = await this.getSeederFiles(paths)
92
91
  const conn = this.resolveConnection(connection)
93
92
  for (const file of files) {
@@ -99,4 +98,4 @@ export class SeederRunner {
99
98
  }
100
99
  }
101
100
 
102
- export default SeederRunner
101
+ export default SeederRunner
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h3ravel/arquebus",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
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": {
@@ -111,7 +111,8 @@
111
111
  "default": "./dist/browser/index.cjs"
112
112
  }
113
113
  },
114
- "./package.json": "./package.json"
114
+ "./package.json": "./package.json",
115
+ "./types": "./types"
115
116
  },
116
117
  "repository": {
117
118
  "type": "git",