@h3ravel/arquebus 0.7.2 → 0.7.3
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 +76 -76
- package/bin/index.js +76 -76
- package/dist/browser/index.cjs +14 -3
- package/dist/browser/index.d.ts +17 -10
- package/dist/browser/index.js +14 -3
- package/dist/concerns/index.d.ts +5 -1
- package/dist/index.cjs +116 -116
- package/dist/index.d.ts +51 -42
- package/dist/index.js +114 -114
- package/dist/inspector/index.cjs +5 -5
- package/dist/inspector/index.js +4 -4
- package/dist/migrations/index.cjs +6 -6
- package/dist/migrations/index.d.ts +5 -1
- package/dist/migrations/index.js +10 -10
- package/dist/relations/index.d.ts +5 -1
- package/dist/seeders/index.d.ts +5 -1
- package/package.json +1 -1
- package/types/modeling.ts +129 -126
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
+
import fs, { access, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { dirname } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
2
6
|
import { assign, camel, dash, diff, flat, get, isArray, isEmpty, isEqual, isNullish, isString, omit, pick, set, snake, trim } from "radashi";
|
|
3
7
|
import advancedFormat from "dayjs/plugin/advancedFormat.js";
|
|
4
8
|
import dayjs from "dayjs";
|
|
5
9
|
import collect$1, { Collection, collect } from "collect.js";
|
|
6
10
|
import Knex$1 from "knex";
|
|
7
|
-
import path from "path";
|
|
8
11
|
import { existsSync } from "fs";
|
|
9
12
|
import { FileSystem, Logger, TaskManager } from "@h3ravel/shared";
|
|
10
13
|
import pluralize from "pluralize";
|
|
11
|
-
import fs, { access, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
12
14
|
import resolveFrom from "resolve-from";
|
|
13
|
-
import { dirname } from "node:path";
|
|
14
|
-
import { fileURLToPath } from "node:url";
|
|
15
15
|
|
|
16
16
|
//#region rolldown:runtime
|
|
17
17
|
var __defProp = Object.defineProperty;
|
|
@@ -24,6 +24,111 @@ var __export = (all) => {
|
|
|
24
24
|
return target;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/seeders/seeder.ts
|
|
29
|
+
var Seeder = class {};
|
|
30
|
+
var seeder_default = Seeder;
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/seeders/runner.ts
|
|
34
|
+
async function glob$1(folderPath) {
|
|
35
|
+
const { default: escalade } = await import("escalade");
|
|
36
|
+
const entries = [];
|
|
37
|
+
await escalade(folderPath, async (dir, names) => {
|
|
38
|
+
await Promise.all(names.map(async (name) => {
|
|
39
|
+
const p = path.join(dir, name);
|
|
40
|
+
try {
|
|
41
|
+
await access(p);
|
|
42
|
+
if (p.endsWith(".js") || p.endsWith(".ts")) entries.push(p);
|
|
43
|
+
} catch {}
|
|
44
|
+
}));
|
|
45
|
+
return "";
|
|
46
|
+
});
|
|
47
|
+
return entries;
|
|
48
|
+
}
|
|
49
|
+
var SeederRunner = class {
|
|
50
|
+
resolver;
|
|
51
|
+
connection;
|
|
52
|
+
paths = [];
|
|
53
|
+
constructor(resolver) {
|
|
54
|
+
this.resolver = resolver;
|
|
55
|
+
}
|
|
56
|
+
path(p) {
|
|
57
|
+
this.paths = Array.from(new Set([...this.paths, p]));
|
|
58
|
+
}
|
|
59
|
+
getPaths() {
|
|
60
|
+
return this.paths;
|
|
61
|
+
}
|
|
62
|
+
resolveConnection(connection) {
|
|
63
|
+
var _getInstance, _ref, _instance$connections;
|
|
64
|
+
const name = connection || this.connection || "default";
|
|
65
|
+
const instance = ((_getInstance = (_ref = this.resolver).getInstance) === null || _getInstance === void 0 ? void 0 : _getInstance.call(_ref)) ?? null;
|
|
66
|
+
if (!!!(instance === null || instance === void 0 || (_instance$connections = instance.connections) === null || _instance$connections === void 0 ? void 0 : _instance$connections[name])) this.resolver.autoLoad().catch(() => {
|
|
67
|
+
/** noop */
|
|
68
|
+
});
|
|
69
|
+
return this.resolver.fire(name);
|
|
70
|
+
}
|
|
71
|
+
setConnection(connection) {
|
|
72
|
+
this.connection = connection;
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
async getSeederFiles(paths) {
|
|
76
|
+
const files = [];
|
|
77
|
+
for (const p of paths) {
|
|
78
|
+
if (p.endsWith(".js") || p.endsWith(".ts")) {
|
|
79
|
+
files.push(p);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
files.push(...await glob$1(p));
|
|
83
|
+
}
|
|
84
|
+
return files;
|
|
85
|
+
}
|
|
86
|
+
async resolvePath(filePath) {
|
|
87
|
+
try {
|
|
88
|
+
const mod = await import(filePath);
|
|
89
|
+
return new (mod.default ?? mod.Seeder)();
|
|
90
|
+
} catch {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
async run(paths, connection) {
|
|
95
|
+
const files = await this.getSeederFiles(paths);
|
|
96
|
+
const conn = this.resolveConnection(connection);
|
|
97
|
+
for (const file of files) {
|
|
98
|
+
const seeder = await this.resolvePath(file);
|
|
99
|
+
if (seeder && typeof seeder.run === "function") await seeder.run(conn);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var runner_default = SeederRunner;
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/seeders/seeder-creator.ts
|
|
107
|
+
var SeederCreator = class {
|
|
108
|
+
constructor(customStubPath) {
|
|
109
|
+
this.customStubPath = customStubPath;
|
|
110
|
+
}
|
|
111
|
+
async create(dir, name, type = "js") {
|
|
112
|
+
await mkdir(dir, { recursive: true });
|
|
113
|
+
let stub = await readFile(this.getStubPath(type), "utf-8");
|
|
114
|
+
stub = stub.replace(/{{ name }}/g, name);
|
|
115
|
+
const filePath = path.join(dir, `${name}.${type}`);
|
|
116
|
+
await writeFile(filePath, stub);
|
|
117
|
+
return filePath;
|
|
118
|
+
}
|
|
119
|
+
getStubPath(type) {
|
|
120
|
+
if (this.customStubPath) return path.join(this.customStubPath, `seeder-${type}.stub`);
|
|
121
|
+
const __dirname$1 = this.getDirname(import.meta);
|
|
122
|
+
return path.join(__dirname$1, "stubs", `seeder-${type}.stub`);
|
|
123
|
+
}
|
|
124
|
+
getDirname(meta) {
|
|
125
|
+
if (typeof __dirname !== "undefined") return __dirname;
|
|
126
|
+
if (meta && meta.url) return dirname(fileURLToPath(meta.url));
|
|
127
|
+
throw new Error("Unable to determine dirname");
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
var seeder_creator_default = SeederCreator;
|
|
131
|
+
|
|
27
132
|
//#endregion
|
|
28
133
|
//#region src/casts/attribute.ts
|
|
29
134
|
var Attribute = class Attribute {
|
|
@@ -4948,7 +5053,7 @@ var SchemaInspector = class {
|
|
|
4948
5053
|
|
|
4949
5054
|
//#endregion
|
|
4950
5055
|
//#region src/migrations/migrator.ts
|
|
4951
|
-
async function glob
|
|
5056
|
+
async function glob(folderPath) {
|
|
4952
5057
|
const files = await fs.readdir(folderPath);
|
|
4953
5058
|
const allFiles = [];
|
|
4954
5059
|
for (const file of files) {
|
|
@@ -4956,7 +5061,7 @@ async function glob$1(folderPath) {
|
|
|
4956
5061
|
const stats = await fs.stat(filePath);
|
|
4957
5062
|
if (stats.isFile()) allFiles.push(filePath);
|
|
4958
5063
|
else if (stats.isDirectory()) {
|
|
4959
|
-
const subFiles = await glob
|
|
5064
|
+
const subFiles = await glob(filePath);
|
|
4960
5065
|
allFiles.push(...subFiles);
|
|
4961
5066
|
}
|
|
4962
5067
|
}
|
|
@@ -5099,7 +5204,7 @@ var Migrator = class {
|
|
|
5099
5204
|
files.push(p);
|
|
5100
5205
|
continue;
|
|
5101
5206
|
}
|
|
5102
|
-
files.push(...await glob
|
|
5207
|
+
files.push(...await glob(p));
|
|
5103
5208
|
}
|
|
5104
5209
|
return files.filter(Boolean).reduce((result, file) => {
|
|
5105
5210
|
result[this.getMigrationName(file)] = file;
|
|
@@ -5326,111 +5431,6 @@ var Migration = class extends Inference {
|
|
|
5326
5431
|
};
|
|
5327
5432
|
var migration_default = Migration;
|
|
5328
5433
|
|
|
5329
|
-
//#endregion
|
|
5330
|
-
//#region src/seeders/seeder.ts
|
|
5331
|
-
var Seeder = class {};
|
|
5332
|
-
var seeder_default = Seeder;
|
|
5333
|
-
|
|
5334
|
-
//#endregion
|
|
5335
|
-
//#region src/seeders/runner.ts
|
|
5336
|
-
async function glob(folderPath) {
|
|
5337
|
-
const { default: escalade } = await import("escalade");
|
|
5338
|
-
const entries = [];
|
|
5339
|
-
await escalade(folderPath, async (dir, names) => {
|
|
5340
|
-
await Promise.all(names.map(async (name) => {
|
|
5341
|
-
const p = path.join(dir, name);
|
|
5342
|
-
try {
|
|
5343
|
-
await access(p);
|
|
5344
|
-
if (p.endsWith(".js") || p.endsWith(".ts")) entries.push(p);
|
|
5345
|
-
} catch {}
|
|
5346
|
-
}));
|
|
5347
|
-
return "";
|
|
5348
|
-
});
|
|
5349
|
-
return entries;
|
|
5350
|
-
}
|
|
5351
|
-
var SeederRunner = class {
|
|
5352
|
-
resolver;
|
|
5353
|
-
connection;
|
|
5354
|
-
paths = [];
|
|
5355
|
-
constructor(resolver) {
|
|
5356
|
-
this.resolver = resolver;
|
|
5357
|
-
}
|
|
5358
|
-
path(p) {
|
|
5359
|
-
this.paths = Array.from(new Set([...this.paths, p]));
|
|
5360
|
-
}
|
|
5361
|
-
getPaths() {
|
|
5362
|
-
return this.paths;
|
|
5363
|
-
}
|
|
5364
|
-
resolveConnection(connection) {
|
|
5365
|
-
var _getInstance, _ref, _instance$connections;
|
|
5366
|
-
const name = connection || this.connection || "default";
|
|
5367
|
-
const instance = ((_getInstance = (_ref = this.resolver).getInstance) === null || _getInstance === void 0 ? void 0 : _getInstance.call(_ref)) ?? null;
|
|
5368
|
-
if (!!!(instance === null || instance === void 0 || (_instance$connections = instance.connections) === null || _instance$connections === void 0 ? void 0 : _instance$connections[name])) this.resolver.autoLoad().catch(() => {
|
|
5369
|
-
/** noop */
|
|
5370
|
-
});
|
|
5371
|
-
return this.resolver.fire(name);
|
|
5372
|
-
}
|
|
5373
|
-
setConnection(connection) {
|
|
5374
|
-
this.connection = connection;
|
|
5375
|
-
return this;
|
|
5376
|
-
}
|
|
5377
|
-
async getSeederFiles(paths) {
|
|
5378
|
-
const files = [];
|
|
5379
|
-
for (const p of paths) {
|
|
5380
|
-
if (p.endsWith(".js") || p.endsWith(".ts")) {
|
|
5381
|
-
files.push(p);
|
|
5382
|
-
continue;
|
|
5383
|
-
}
|
|
5384
|
-
files.push(...await glob(p));
|
|
5385
|
-
}
|
|
5386
|
-
return files;
|
|
5387
|
-
}
|
|
5388
|
-
async resolvePath(filePath) {
|
|
5389
|
-
try {
|
|
5390
|
-
const mod = await import(filePath);
|
|
5391
|
-
return new (mod.default ?? mod.Seeder)();
|
|
5392
|
-
} catch {
|
|
5393
|
-
return null;
|
|
5394
|
-
}
|
|
5395
|
-
}
|
|
5396
|
-
async run(paths, connection) {
|
|
5397
|
-
const files = await this.getSeederFiles(paths);
|
|
5398
|
-
const conn = this.resolveConnection(connection);
|
|
5399
|
-
for (const file of files) {
|
|
5400
|
-
const seeder = await this.resolvePath(file);
|
|
5401
|
-
if (seeder && typeof seeder.run === "function") await seeder.run(conn);
|
|
5402
|
-
}
|
|
5403
|
-
}
|
|
5404
|
-
};
|
|
5405
|
-
var runner_default = SeederRunner;
|
|
5406
|
-
|
|
5407
|
-
//#endregion
|
|
5408
|
-
//#region src/seeders/seeder-creator.ts
|
|
5409
|
-
var SeederCreator = class {
|
|
5410
|
-
constructor(customStubPath) {
|
|
5411
|
-
this.customStubPath = customStubPath;
|
|
5412
|
-
}
|
|
5413
|
-
async create(dir, name, type = "js") {
|
|
5414
|
-
await mkdir(dir, { recursive: true });
|
|
5415
|
-
let stub = await readFile(this.getStubPath(type), "utf-8");
|
|
5416
|
-
stub = stub.replace(/{{ name }}/g, name);
|
|
5417
|
-
const filePath = path.join(dir, `${name}.${type}`);
|
|
5418
|
-
await writeFile(filePath, stub);
|
|
5419
|
-
return filePath;
|
|
5420
|
-
}
|
|
5421
|
-
getStubPath(type) {
|
|
5422
|
-
if (this.customStubPath) return path.join(this.customStubPath, `seeder-${type}.stub`);
|
|
5423
|
-
const __dirname$1 = this.getDirname(import.meta);
|
|
5424
|
-
return path.join(__dirname$1, "stubs", `seeder-${type}.stub`);
|
|
5425
|
-
}
|
|
5426
|
-
getDirname(meta) {
|
|
5427
|
-
if (typeof __dirname !== "undefined") return __dirname;
|
|
5428
|
-
if (meta && meta.url) return dirname(fileURLToPath(meta.url));
|
|
5429
|
-
throw new Error("Unable to determine dirname");
|
|
5430
|
-
}
|
|
5431
|
-
};
|
|
5432
|
-
var seeder_creator_default = SeederCreator;
|
|
5433
|
-
|
|
5434
5434
|
//#endregion
|
|
5435
5435
|
//#region src/pivot.ts
|
|
5436
5436
|
var pivot_default = Pivot;
|
|
@@ -5602,11 +5602,11 @@ var soft_deletes_default = softDeletes;
|
|
|
5602
5602
|
const make = (model, data, options = {}) => {
|
|
5603
5603
|
const { paginated } = options;
|
|
5604
5604
|
if (paginated) return new paginator_default(data.data.map((item) => model.make(item)), data.total, data.per_page, data.current_page);
|
|
5605
|
-
if (
|
|
5605
|
+
if (isArray(data)) return new collection_default(data.map((item) => model.make(item)));
|
|
5606
5606
|
return model.make(data);
|
|
5607
5607
|
};
|
|
5608
5608
|
const makeCollection = (model, data) => new collection_default(data.map((item) => model.make(item)));
|
|
5609
|
-
const makePaginator = (model, data
|
|
5609
|
+
const makePaginator = (model, data) => new paginator_default(data.data.map((item) => model.make(item)), data.total, data.per_page, data.current_page);
|
|
5610
5610
|
|
|
5611
5611
|
//#endregion
|
|
5612
5612
|
export { attribute_default as Attribute, builder_default as Builder, casts_attributes_default as CastsAttributes, collection_default as Collection, has_unique_ids_default as HasUniqueIds, InvalidArgumentError, Migrate, migration_default as Migration, model_default as Model, ModelNotFoundError, paginator_default as Paginator, pivot_default as Pivot, query_builder_default as QueryBuilder, RelationNotFoundError, scope_default as Scope, seeder_default as Seeder, seeder_creator_default as SeederCreator, runner_default as SeederRunner, soft_deletes_default as SoftDeletes, arquebus_default as arquebus, compose, defineConfig, flatten, flattenDeep, getAttrMethod, getAttrName, getGetterMethod, getRelationMethod, getRelationName, getScopeMethod, getScopeName, getSetterMethod, kebabCase, make, makeCollection, makePaginator, now, snakeCase, tap };
|
package/dist/inspector/index.cjs
CHANGED
|
@@ -29,6 +29,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
}) : target, mod));
|
|
30
30
|
|
|
31
31
|
//#endregion
|
|
32
|
+
require("node:fs/promises");
|
|
33
|
+
let path = require("path");
|
|
34
|
+
path = __toESM(path);
|
|
35
|
+
require("node:path");
|
|
36
|
+
require("node:url");
|
|
32
37
|
let radashi = require("radashi");
|
|
33
38
|
let dayjs_plugin_advancedFormat_js = require("dayjs/plugin/advancedFormat.js");
|
|
34
39
|
dayjs_plugin_advancedFormat_js = __toESM(dayjs_plugin_advancedFormat_js);
|
|
@@ -38,16 +43,11 @@ let collect_js = require("collect.js");
|
|
|
38
43
|
collect_js = __toESM(collect_js);
|
|
39
44
|
let knex = require("knex");
|
|
40
45
|
knex = __toESM(knex);
|
|
41
|
-
let path = require("path");
|
|
42
|
-
path = __toESM(path);
|
|
43
46
|
let fs = require("fs");
|
|
44
47
|
let __h3ravel_shared = require("@h3ravel/shared");
|
|
45
48
|
let pluralize = require("pluralize");
|
|
46
49
|
pluralize = __toESM(pluralize);
|
|
47
|
-
require("node:fs/promises");
|
|
48
50
|
require("resolve-from");
|
|
49
|
-
require("node:path");
|
|
50
|
-
require("node:url");
|
|
51
51
|
|
|
52
52
|
//#region src/inspector/utils/strip-quotes.ts
|
|
53
53
|
/**
|
package/dist/inspector/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
+
import "node:fs/promises";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import "node:path";
|
|
5
|
+
import "node:url";
|
|
2
6
|
import { assign, camel, diff, flat, get, isArray, isEmpty, isEqual, isString, omit, pick, set, snake, trim } from "radashi";
|
|
3
7
|
import advancedFormat from "dayjs/plugin/advancedFormat.js";
|
|
4
8
|
import dayjs from "dayjs";
|
|
5
9
|
import collect$1, { Collection, collect } from "collect.js";
|
|
6
10
|
import Knex$1 from "knex";
|
|
7
|
-
import path from "path";
|
|
8
11
|
import { existsSync } from "fs";
|
|
9
12
|
import { FileSystem } from "@h3ravel/shared";
|
|
10
13
|
import pluralize from "pluralize";
|
|
11
|
-
import "node:fs/promises";
|
|
12
14
|
import "resolve-from";
|
|
13
|
-
import "node:path";
|
|
14
|
-
import "node:url";
|
|
15
15
|
|
|
16
16
|
//#region rolldown:runtime
|
|
17
17
|
var __defProp = Object.defineProperty;
|
|
@@ -30,6 +30,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
|
|
31
31
|
//#endregion
|
|
32
32
|
let __h3ravel_shared = require("@h3ravel/shared");
|
|
33
|
+
let node_fs_promises = require("node:fs/promises");
|
|
34
|
+
node_fs_promises = __toESM(node_fs_promises);
|
|
35
|
+
let path = require("path");
|
|
36
|
+
path = __toESM(path);
|
|
37
|
+
let node_path = require("node:path");
|
|
38
|
+
let node_url = require("node:url");
|
|
33
39
|
let radashi = require("radashi");
|
|
34
40
|
let dayjs_plugin_advancedFormat_js = require("dayjs/plugin/advancedFormat.js");
|
|
35
41
|
dayjs_plugin_advancedFormat_js = __toESM(dayjs_plugin_advancedFormat_js);
|
|
@@ -39,15 +45,9 @@ let collect_js = require("collect.js");
|
|
|
39
45
|
collect_js = __toESM(collect_js);
|
|
40
46
|
let knex = require("knex");
|
|
41
47
|
knex = __toESM(knex);
|
|
42
|
-
let path = require("path");
|
|
43
|
-
path = __toESM(path);
|
|
44
48
|
let fs = require("fs");
|
|
45
49
|
let pluralize = require("pluralize");
|
|
46
50
|
pluralize = __toESM(pluralize);
|
|
47
|
-
let node_fs_promises = require("node:fs/promises");
|
|
48
|
-
node_fs_promises = __toESM(node_fs_promises);
|
|
49
|
-
let node_path = require("node:path");
|
|
50
|
-
let node_url = require("node:url");
|
|
51
51
|
let resolve_from = require("resolve-from");
|
|
52
52
|
resolve_from = __toESM(resolve_from);
|
|
53
53
|
|
|
@@ -471,6 +471,7 @@ interface IModel {
|
|
|
471
471
|
setAppends(appends: string[]): this;
|
|
472
472
|
append(key: string | string[]): this;
|
|
473
473
|
getRelation<T$1 extends Model$1>(relation: string): T$1 | ICollection<T$1> | null | undefined;
|
|
474
|
+
getRelation<T$1 extends Model$1, IsCollection extends boolean = false>(relation: string): IsCollection extends true ? ICollection<T$1> | undefined : T$1 | null | undefined;
|
|
474
475
|
setRelation<T$1 extends Model$1>(relation: string, value: T$1 | ICollection<T$1> | null): this;
|
|
475
476
|
unsetRelation(relation: string): this;
|
|
476
477
|
relationLoaded(relation: string): boolean;
|
|
@@ -1394,7 +1395,10 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
1394
1395
|
uniqueIds(): never[];
|
|
1395
1396
|
setUniqueIds(): void;
|
|
1396
1397
|
});
|
|
1397
|
-
getRelation:
|
|
1398
|
+
getRelation: {
|
|
1399
|
+
<T$1 extends Model$1>(relation: string): T$1 | ICollection<T$1> | null | undefined;
|
|
1400
|
+
<T$1 extends Model$1, IsCollection extends boolean = false>(relation: string): IsCollection extends true ? ICollection<T$1> | undefined : T$1 | null | undefined;
|
|
1401
|
+
};
|
|
1398
1402
|
setRelation: <T$1 extends Model$1>(relation: string, value: T$1 | ICollection<T$1> | null) => (new () => IModel) & IModel & {
|
|
1399
1403
|
[x: string]: any;
|
|
1400
1404
|
timestamps: boolean;
|
package/dist/migrations/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { t as __export } from "./chunk-Bop6jNiL.js";
|
|
2
2
|
import { FileSystem, Logger, TaskManager } from "@h3ravel/shared";
|
|
3
|
+
import fs, { copyFile, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import path$1, { dirname } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
3
7
|
import { assign, camel, diff, flat, get, isArray, isEmpty, isEqual, isString, omit, pick, set, snake, trim } from "radashi";
|
|
4
8
|
import advancedFormat from "dayjs/plugin/advancedFormat.js";
|
|
5
9
|
import dayjs from "dayjs";
|
|
6
10
|
import collect, { Collection, collect as collect$1 } from "collect.js";
|
|
7
11
|
import Knex$1 from "knex";
|
|
8
|
-
import path from "path";
|
|
9
12
|
import { existsSync } from "fs";
|
|
10
13
|
import pluralize from "pluralize";
|
|
11
|
-
import fs, { copyFile, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
12
|
-
import path$1, { dirname } from "node:path";
|
|
13
|
-
import { fileURLToPath } from "node:url";
|
|
14
14
|
import resolveFrom from "resolve-from";
|
|
15
15
|
|
|
16
16
|
//#region src/migrations/migration-repository.ts
|
|
@@ -1320,6 +1320,12 @@ function extractType(type) {
|
|
|
1320
1320
|
return type.replace(/[^a-zA-Z]/g, "").toLowerCase();
|
|
1321
1321
|
}
|
|
1322
1322
|
|
|
1323
|
+
//#endregion
|
|
1324
|
+
//#region node_modules/.pnpm/tsdown@0.16.0_typescript@5.9.3/node_modules/tsdown/esm-shims.js
|
|
1325
|
+
const getFilename = () => fileURLToPath(import.meta.url);
|
|
1326
|
+
const getDirname = () => path$1.dirname(getFilename());
|
|
1327
|
+
const __dirname = /* @__PURE__ */ getDirname();
|
|
1328
|
+
|
|
1323
1329
|
//#endregion
|
|
1324
1330
|
//#region src/casts/attribute.ts
|
|
1325
1331
|
var Attribute = class Attribute {
|
|
@@ -4754,12 +4760,6 @@ var Migration = class extends Inference {
|
|
|
4754
4760
|
};
|
|
4755
4761
|
var migration_default = Migration;
|
|
4756
4762
|
|
|
4757
|
-
//#endregion
|
|
4758
|
-
//#region node_modules/.pnpm/tsdown@0.16.0_typescript@5.9.3/node_modules/tsdown/esm-shims.js
|
|
4759
|
-
const getFilename = () => fileURLToPath(import.meta.url);
|
|
4760
|
-
const getDirname = () => path$1.dirname(getFilename());
|
|
4761
|
-
const __dirname = /* @__PURE__ */ getDirname();
|
|
4762
|
-
|
|
4763
4763
|
//#endregion
|
|
4764
4764
|
//#region src/inspector/dialects/sqlite.ts
|
|
4765
4765
|
function parseDefaultValue(value) {
|
|
@@ -140,6 +140,7 @@ interface IModel {
|
|
|
140
140
|
setAppends(appends: string[]): this;
|
|
141
141
|
append(key: string | string[]): this;
|
|
142
142
|
getRelation<T$1 extends Model$1>(relation: string): T$1 | ICollection<T$1> | null | undefined;
|
|
143
|
+
getRelation<T$1 extends Model$1, IsCollection extends boolean = false>(relation: string): IsCollection extends true ? ICollection<T$1> | undefined : T$1 | null | undefined;
|
|
143
144
|
setRelation<T$1 extends Model$1>(relation: string, value: T$1 | ICollection<T$1> | null): this;
|
|
144
145
|
unsetRelation(relation: string): this;
|
|
145
146
|
relationLoaded(relation: string): boolean;
|
|
@@ -2041,7 +2042,10 @@ declare const BaseModel: (new (...args: any[]) => any) & {
|
|
|
2041
2042
|
uniqueIds(): never[];
|
|
2042
2043
|
setUniqueIds(): void;
|
|
2043
2044
|
});
|
|
2044
|
-
getRelation:
|
|
2045
|
+
getRelation: {
|
|
2046
|
+
<T$1 extends Model$1>(relation: string): T$1 | ICollection<T$1> | null | undefined;
|
|
2047
|
+
<T$1 extends Model$1, IsCollection extends boolean = false>(relation: string): IsCollection extends true ? ICollection<T$1> | undefined : T$1 | null | undefined;
|
|
2048
|
+
};
|
|
2045
2049
|
setRelation: <T$1 extends Model$1>(relation: string, value: T$1 | ICollection<T$1> | null) => (new () => IModel) & IModel & {
|
|
2046
2050
|
[x: string]: any;
|
|
2047
2051
|
timestamps: boolean;
|
package/dist/seeders/index.d.ts
CHANGED
|
@@ -468,6 +468,7 @@ interface IModel {
|
|
|
468
468
|
setAppends(appends: string[]): this;
|
|
469
469
|
append(key: string | string[]): this;
|
|
470
470
|
getRelation<T$1 extends Model$1>(relation: string): T$1 | ICollection<T$1> | null | undefined;
|
|
471
|
+
getRelation<T$1 extends Model$1, IsCollection extends boolean = false>(relation: string): IsCollection extends true ? ICollection<T$1> | undefined : T$1 | null | undefined;
|
|
471
472
|
setRelation<T$1 extends Model$1>(relation: string, value: T$1 | ICollection<T$1> | null): this;
|
|
472
473
|
unsetRelation(relation: string): this;
|
|
473
474
|
relationLoaded(relation: string): boolean;
|
|
@@ -1391,7 +1392,10 @@ declare const BaseModel$1: (new (...args: any[]) => any) & {
|
|
|
1391
1392
|
uniqueIds(): never[];
|
|
1392
1393
|
setUniqueIds(): void;
|
|
1393
1394
|
});
|
|
1394
|
-
getRelation:
|
|
1395
|
+
getRelation: {
|
|
1396
|
+
<T$1 extends Model$1>(relation: string): T$1 | ICollection<T$1> | null | undefined;
|
|
1397
|
+
<T$1 extends Model$1, IsCollection extends boolean = false>(relation: string): IsCollection extends true ? ICollection<T$1> | undefined : T$1 | null | undefined;
|
|
1398
|
+
};
|
|
1395
1399
|
setRelation: <T$1 extends Model$1>(relation: string, value: T$1 | ICollection<T$1> | null) => (new () => IModel) & IModel & {
|
|
1396
1400
|
[x: string]: any;
|
|
1397
1401
|
timestamps: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/arquebus",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
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": {
|