@h3ravel/arquebus 0.6.6 → 0.6.8
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/README.md +5 -4
- package/bin/index.cjs +270 -425
- package/bin/{index.js → index.mjs} +230 -409
- package/bin/seeders-C0schOjT.mjs +3 -0
- package/bin/seeders-D-v59HCz.cjs +3 -0
- package/dist/browser/index.cjs +4 -12
- package/dist/browser/index.d.cts +203 -203
- package/dist/browser/{index.d.ts → index.d.mts} +203 -203
- package/dist/browser/{index.js → index.mjs} +4 -11
- package/dist/index.cjs +21 -59
- package/dist/index.d.cts +133 -133
- package/dist/{index.d.ts → index.d.mts} +133 -133
- package/dist/{index.js → index.mjs} +21 -54
- package/dist/inspector/index.cjs +15 -46
- package/dist/inspector/{index.js → index.mjs} +15 -43
- package/dist/migrations/{chunk-PECeCxCb.js → chunk-BD38OWEx.mjs} +1 -1
- package/dist/migrations/index.cjs +20 -57
- package/dist/migrations/index.d.cts +186 -186
- package/dist/migrations/{index.d.ts → index.d.mts} +186 -186
- package/dist/migrations/{index.js → index.mjs} +22 -54
- package/dist/seeders/index.cjs +1 -5
- package/dist/seeders/index.d.cts +184 -184
- package/dist/seeders/{index.d.ts → index.d.mts} +184 -184
- package/dist/seeders/{index.js → index.mjs} +2 -3
- package/dist/stubs/seeder-js.stub +4 -4
- package/dist/stubs/seeder-ts.stub +5 -0
- package/package.json +5 -4
- package/bin/seeders-8GJzfIIN.js +0 -3
- package/bin/seeders-ByeSoCAQ.cjs +0 -131
- package/bin/seeders-CltigymO.js +0 -79
- package/bin/seeders-_xJ6VGVS.cjs +0 -3
- /package/bin/{index.d.ts → index.d.mts} +0 -0
- /package/dist/inspector/{index.d.ts → index.d.mts} +0 -0
|
@@ -81,7 +81,7 @@ var SeederRunner = class {
|
|
|
81
81
|
var runner_default = SeederRunner;
|
|
82
82
|
|
|
83
83
|
//#endregion
|
|
84
|
-
//#region node_modules/.pnpm/tsdown@0.
|
|
84
|
+
//#region node_modules/.pnpm/tsdown@0.16.0_typescript@5.9.3/node_modules/tsdown/esm-shims.js
|
|
85
85
|
const getFilename = () => fileURLToPath(import.meta.url);
|
|
86
86
|
const getDirname = () => path$1.dirname(getFilename());
|
|
87
87
|
const __dirname = /* @__PURE__ */ getDirname();
|
|
@@ -94,8 +94,7 @@ var SeederCreator = class {
|
|
|
94
94
|
}
|
|
95
95
|
async create(dir, name, type = "js") {
|
|
96
96
|
await mkdir(dir, { recursive: true });
|
|
97
|
-
|
|
98
|
-
let stub = await readFile(stubPath, "utf-8");
|
|
97
|
+
let stub = await readFile(this.getStubPath(type), "utf-8");
|
|
99
98
|
stub = stub.replace(/{{ name }}/g, name);
|
|
100
99
|
const filePath = path.join(dir, `${name}.${type}`);
|
|
101
100
|
await writeFile(filePath, stub);
|
|
@@ -2,10 +2,10 @@ import { Seeder } from '@h3ravel/arquebus'
|
|
|
2
2
|
|
|
3
3
|
export default class {{ name }} extends Seeder {
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
* Run the seeder.
|
|
6
|
+
*
|
|
7
|
+
* @param {(import('@h3ravel/arquebus').QueryBuilder)} connection
|
|
8
|
+
*/
|
|
9
9
|
async run(connection) {
|
|
10
10
|
// Example: insert sample data
|
|
11
11
|
await connection.table('users').insert({ name: 'John Doe' })
|
|
@@ -2,6 +2,11 @@ import type { QueryBuilder } from '@h3ravel/arquebus'
|
|
|
2
2
|
import { Seeder } from '@h3ravel/arquebus'
|
|
3
3
|
|
|
4
4
|
export default class {{ name }} extends Seeder {
|
|
5
|
+
/**
|
|
6
|
+
* Run the database seeds.
|
|
7
|
+
*
|
|
8
|
+
* @param conn The current database connection
|
|
9
|
+
*/
|
|
5
10
|
async run(connection: QueryBuilder) {
|
|
6
11
|
// Example: insert sample data
|
|
7
12
|
await connection.table('users').insert({ name: 'John Doe' })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/arquebus",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
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": {
|
|
@@ -134,10 +134,11 @@
|
|
|
134
134
|
]
|
|
135
135
|
},
|
|
136
136
|
"dependencies": {
|
|
137
|
-
"@h3ravel/shared": "^0.
|
|
138
|
-
"@h3ravel/support": "^0.
|
|
137
|
+
"@h3ravel/shared": "^0.27.0",
|
|
138
|
+
"@h3ravel/support": "^0.15.0",
|
|
139
139
|
"barrelize": "^1.6.4",
|
|
140
140
|
"chalk": "^5.6.2",
|
|
141
|
+
"chokidar": "^4.0.1",
|
|
141
142
|
"collect.js": "^4.36.1",
|
|
142
143
|
"commander": "^14.0.1",
|
|
143
144
|
"cross-env": "^10.0.0",
|
|
@@ -167,7 +168,7 @@
|
|
|
167
168
|
"sqlite3": "5.1.7",
|
|
168
169
|
"terser": "^5.44.0",
|
|
169
170
|
"ts-node": "^10.9.2",
|
|
170
|
-
"tsdown": "^0.
|
|
171
|
+
"tsdown": "^0.16.0",
|
|
171
172
|
"tsx": "^4.20.5",
|
|
172
173
|
"typescript": "^5.9.2",
|
|
173
174
|
"typescript-eslint": "^8.44.0",
|
package/bin/seeders-8GJzfIIN.js
DELETED
package/bin/seeders-ByeSoCAQ.cjs
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (all) => {
|
|
9
|
-
let target = {};
|
|
10
|
-
for (var name in all) __defProp(target, name, {
|
|
11
|
-
get: all[name],
|
|
12
|
-
enumerable: true
|
|
13
|
-
});
|
|
14
|
-
return target;
|
|
15
|
-
};
|
|
16
|
-
var __copyProps = (to, from, except, desc) => {
|
|
17
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
18
|
-
key = keys[i];
|
|
19
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
20
|
-
get: ((k) => from[k]).bind(null, key),
|
|
21
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
27
|
-
value: mod,
|
|
28
|
-
enumerable: true
|
|
29
|
-
}) : target, mod));
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
let path = require("path");
|
|
33
|
-
path = __toESM(path);
|
|
34
|
-
let node_fs_promises = require("node:fs/promises");
|
|
35
|
-
node_fs_promises = __toESM(node_fs_promises);
|
|
36
|
-
let node_path = require("node:path");
|
|
37
|
-
node_path = __toESM(node_path);
|
|
38
|
-
let node_url = require("node:url");
|
|
39
|
-
node_url = __toESM(node_url);
|
|
40
|
-
|
|
41
|
-
//#region src/seeders/runner.ts
|
|
42
|
-
async function glob(folderPath) {
|
|
43
|
-
const { default: escalade } = await import("escalade");
|
|
44
|
-
const entries = [];
|
|
45
|
-
await escalade(folderPath, async (dir, names) => {
|
|
46
|
-
await Promise.all(names.map(async (name) => {
|
|
47
|
-
const p = path.default.join(dir, name);
|
|
48
|
-
try {
|
|
49
|
-
await (0, node_fs_promises.access)(p);
|
|
50
|
-
if (p.endsWith(".js") || p.endsWith(".ts")) entries.push(p);
|
|
51
|
-
} catch {}
|
|
52
|
-
}));
|
|
53
|
-
return "";
|
|
54
|
-
});
|
|
55
|
-
return entries;
|
|
56
|
-
}
|
|
57
|
-
var SeederRunner = class {
|
|
58
|
-
resolver;
|
|
59
|
-
connection;
|
|
60
|
-
paths = [];
|
|
61
|
-
constructor(resolver) {
|
|
62
|
-
this.resolver = resolver;
|
|
63
|
-
}
|
|
64
|
-
path(p) {
|
|
65
|
-
this.paths = Array.from(new Set([...this.paths, p]));
|
|
66
|
-
}
|
|
67
|
-
getPaths() {
|
|
68
|
-
return this.paths;
|
|
69
|
-
}
|
|
70
|
-
resolveConnection(connection) {
|
|
71
|
-
var _getInstance, _ref, _instance$connections;
|
|
72
|
-
const name = connection || this.connection || "default";
|
|
73
|
-
const instance = ((_getInstance = (_ref = this.resolver).getInstance) === null || _getInstance === void 0 ? void 0 : _getInstance.call(_ref)) ?? null;
|
|
74
|
-
if (!!!(instance === null || instance === void 0 || (_instance$connections = instance.connections) === null || _instance$connections === void 0 ? void 0 : _instance$connections[name])) this.resolver.autoLoad().catch(() => {
|
|
75
|
-
/** noop */
|
|
76
|
-
});
|
|
77
|
-
return this.resolver.fire(name);
|
|
78
|
-
}
|
|
79
|
-
setConnection(connection) {
|
|
80
|
-
this.connection = connection;
|
|
81
|
-
return this;
|
|
82
|
-
}
|
|
83
|
-
async getSeederFiles(paths) {
|
|
84
|
-
const files = [];
|
|
85
|
-
for (const p of paths) {
|
|
86
|
-
if (p.endsWith(".js") || p.endsWith(".ts")) {
|
|
87
|
-
files.push(p);
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
files.push(...await glob(p));
|
|
91
|
-
}
|
|
92
|
-
return files;
|
|
93
|
-
}
|
|
94
|
-
async resolvePath(filePath) {
|
|
95
|
-
try {
|
|
96
|
-
const mod = await import(filePath);
|
|
97
|
-
return new (mod.default ?? mod.Seeder)();
|
|
98
|
-
} catch {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
async run(paths, connection) {
|
|
103
|
-
const files = await this.getSeederFiles(paths);
|
|
104
|
-
const conn = this.resolveConnection(connection);
|
|
105
|
-
for (const file of files) {
|
|
106
|
-
const seeder = await this.resolvePath(file);
|
|
107
|
-
if (seeder && typeof seeder.run === "function") await seeder.run(conn);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
var runner_default = SeederRunner;
|
|
112
|
-
|
|
113
|
-
//#endregion
|
|
114
|
-
Object.defineProperty(exports, '__export', {
|
|
115
|
-
enumerable: true,
|
|
116
|
-
get: function () {
|
|
117
|
-
return __export;
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
Object.defineProperty(exports, '__toESM', {
|
|
121
|
-
enumerable: true,
|
|
122
|
-
get: function () {
|
|
123
|
-
return __toESM;
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
Object.defineProperty(exports, 'runner_default', {
|
|
127
|
-
enumerable: true,
|
|
128
|
-
get: function () {
|
|
129
|
-
return runner_default;
|
|
130
|
-
}
|
|
131
|
-
});
|
package/bin/seeders-CltigymO.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
|
-
import { dirname } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
|
|
6
|
-
//#region src/seeders/runner.ts
|
|
7
|
-
async function glob(folderPath) {
|
|
8
|
-
const { default: escalade } = await import("escalade");
|
|
9
|
-
const entries = [];
|
|
10
|
-
await escalade(folderPath, async (dir, names) => {
|
|
11
|
-
await Promise.all(names.map(async (name) => {
|
|
12
|
-
const p = path.join(dir, name);
|
|
13
|
-
try {
|
|
14
|
-
await access(p);
|
|
15
|
-
if (p.endsWith(".js") || p.endsWith(".ts")) entries.push(p);
|
|
16
|
-
} catch {}
|
|
17
|
-
}));
|
|
18
|
-
return "";
|
|
19
|
-
});
|
|
20
|
-
return entries;
|
|
21
|
-
}
|
|
22
|
-
var SeederRunner = class {
|
|
23
|
-
resolver;
|
|
24
|
-
connection;
|
|
25
|
-
paths = [];
|
|
26
|
-
constructor(resolver) {
|
|
27
|
-
this.resolver = resolver;
|
|
28
|
-
}
|
|
29
|
-
path(p) {
|
|
30
|
-
this.paths = Array.from(new Set([...this.paths, p]));
|
|
31
|
-
}
|
|
32
|
-
getPaths() {
|
|
33
|
-
return this.paths;
|
|
34
|
-
}
|
|
35
|
-
resolveConnection(connection) {
|
|
36
|
-
var _getInstance, _ref, _instance$connections;
|
|
37
|
-
const name = connection || this.connection || "default";
|
|
38
|
-
const instance = ((_getInstance = (_ref = this.resolver).getInstance) === null || _getInstance === void 0 ? void 0 : _getInstance.call(_ref)) ?? null;
|
|
39
|
-
if (!!!(instance === null || instance === void 0 || (_instance$connections = instance.connections) === null || _instance$connections === void 0 ? void 0 : _instance$connections[name])) this.resolver.autoLoad().catch(() => {
|
|
40
|
-
/** noop */
|
|
41
|
-
});
|
|
42
|
-
return this.resolver.fire(name);
|
|
43
|
-
}
|
|
44
|
-
setConnection(connection) {
|
|
45
|
-
this.connection = connection;
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
async getSeederFiles(paths) {
|
|
49
|
-
const files = [];
|
|
50
|
-
for (const p of paths) {
|
|
51
|
-
if (p.endsWith(".js") || p.endsWith(".ts")) {
|
|
52
|
-
files.push(p);
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
files.push(...await glob(p));
|
|
56
|
-
}
|
|
57
|
-
return files;
|
|
58
|
-
}
|
|
59
|
-
async resolvePath(filePath) {
|
|
60
|
-
try {
|
|
61
|
-
const mod = await import(filePath);
|
|
62
|
-
return new (mod.default ?? mod.Seeder)();
|
|
63
|
-
} catch {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
async run(paths, connection) {
|
|
68
|
-
const files = await this.getSeederFiles(paths);
|
|
69
|
-
const conn = this.resolveConnection(connection);
|
|
70
|
-
for (const file of files) {
|
|
71
|
-
const seeder = await this.resolvePath(file);
|
|
72
|
-
if (seeder && typeof seeder.run === "function") await seeder.run(conn);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
var runner_default = SeederRunner;
|
|
77
|
-
|
|
78
|
-
//#endregion
|
|
79
|
-
export { runner_default };
|
package/bin/seeders-_xJ6VGVS.cjs
DELETED
|
File without changes
|
|
File without changes
|