@h3ravel/arquebus 0.6.6 → 0.6.7

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.
Files changed (47) hide show
  1. package/README.md +5 -4
  2. package/package.json +4 -3
  3. package/bin/index.cjs +0 -5927
  4. package/bin/index.d.cts +0 -1
  5. package/bin/index.d.ts +0 -1
  6. package/bin/index.js +0 -5925
  7. package/bin/seeders-8GJzfIIN.js +0 -3
  8. package/bin/seeders-ByeSoCAQ.cjs +0 -131
  9. package/bin/seeders-CltigymO.js +0 -79
  10. package/bin/seeders-_xJ6VGVS.cjs +0 -3
  11. package/dist/browser/index.cjs +0 -1271
  12. package/dist/browser/index.d.cts +0 -4932
  13. package/dist/browser/index.d.ts +0 -4932
  14. package/dist/browser/index.js +0 -1218
  15. package/dist/index.cjs +0 -5713
  16. package/dist/index.d.cts +0 -5129
  17. package/dist/index.d.ts +0 -5129
  18. package/dist/index.js +0 -5644
  19. package/dist/inspector/index.cjs +0 -4908
  20. package/dist/inspector/index.d.cts +0 -83
  21. package/dist/inspector/index.d.ts +0 -83
  22. package/dist/inspector/index.js +0 -4881
  23. package/dist/migrations/chunk-PECeCxCb.js +0 -15
  24. package/dist/migrations/index.cjs +0 -5470
  25. package/dist/migrations/index.d.cts +0 -4965
  26. package/dist/migrations/index.d.ts +0 -4962
  27. package/dist/migrations/index.js +0 -5419
  28. package/dist/migrations/stubs/migration-js.stub +0 -21
  29. package/dist/migrations/stubs/migration-ts.stub +0 -18
  30. package/dist/migrations/stubs/migration.create-js.stub +0 -24
  31. package/dist/migrations/stubs/migration.create-ts.stub +0 -21
  32. package/dist/migrations/stubs/migration.update-js.stub +0 -25
  33. package/dist/migrations/stubs/migration.update-ts.stub +0 -22
  34. package/dist/seeders/index.cjs +0 -141
  35. package/dist/seeders/index.d.cts +0 -4766
  36. package/dist/seeders/index.d.ts +0 -4766
  37. package/dist/seeders/index.js +0 -118
  38. package/dist/seeders/index.ts +0 -3
  39. package/dist/seeders/runner.ts +0 -101
  40. package/dist/seeders/seeder-creator.ts +0 -42
  41. package/dist/seeders/seeder.ts +0 -10
  42. package/dist/stubs/arquebus.config-js.stub +0 -25
  43. package/dist/stubs/arquebus.config-ts.stub +0 -24
  44. package/dist/stubs/model-js.stub +0 -5
  45. package/dist/stubs/model-ts.stub +0 -5
  46. package/dist/stubs/seeder-js.stub +0 -13
  47. package/dist/stubs/seeder-ts.stub +0 -9
@@ -1,21 +0,0 @@
1
- import { Migration } from '@h3ravel/arquebus'
2
-
3
- export default class extends Migration {
4
- /**
5
- * Run the migrations.
6
- *
7
- * @param {(import('@h3ravel/arquebus/types/query-builder').SchemaBuilder)} schema
8
- */
9
- async up(schema) {
10
- //
11
- }
12
-
13
- /**
14
- * Reverse the migrations.
15
- *
16
- * @param {(import('@h3ravel/arquebus/types/query-builder').SchemaBuilder)} schema
17
- */
18
- async down(schema) {
19
- //
20
- }
21
- }
@@ -1,18 +0,0 @@
1
- import { Migration } from '@h3ravel/arquebus'
2
- import { SchemaBuilder } from '@h3ravel/arquebus/types/query-builder';
3
-
4
- export default class extends Migration {
5
- /**
6
- * Run the migrations.
7
- */
8
- async up (schema: SchemaBuilder) {
9
- //
10
- }
11
-
12
- /**
13
- * Reverse the migrations.
14
- */
15
- async down (schema: SchemaBuilder) {
16
- //
17
- }
18
- }
@@ -1,24 +0,0 @@
1
- import { Migration } from '@h3ravel/arquebus'
2
-
3
- export default class extends Migration {
4
- /**
5
- * Run the migrations.
6
- *
7
- * @param {(import('@h3ravel/arquebus/types/query-builder').SchemaBuilder)} schema
8
- */
9
- async up(schema) {
10
- await schema.createTable('{{ table }}', (table) => {
11
- table.increments('id')
12
- table.timestamps()
13
- })
14
- }
15
-
16
- /**
17
- * Reverse the migrations.
18
- *
19
- * @param {(import('@h3ravel/arquebus/types/query-builder').SchemaBuilder)} schema
20
- */
21
- async down(schema) {
22
- await schema.dropTableIfExists('{{ table }}')
23
- }
24
- }
@@ -1,21 +0,0 @@
1
- import { Migration } from '@h3ravel/arquebus'
2
- import { SchemaBuilder } from '@h3ravel/arquebus/types/query-builder';
3
-
4
- export default class extends Migration {
5
- /**
6
- * Run the migrations.
7
- */
8
- async up(schema: SchemaBuilder) {
9
- await schema.createTable('{{ table }}', (table) => {
10
- table.increments('id')
11
- table.timestamps()
12
- })
13
- }
14
-
15
- /**
16
- * Reverse the migrations.
17
- */
18
- async down(schema: SchemaBuilder) {
19
- await schema.dropTableIfExists('{{ table }}')
20
- }
21
- }
@@ -1,25 +0,0 @@
1
- import { Migration } from '@h3ravel/arquebus'
2
-
3
- export default class extends Migration {
4
- /**
5
- * Run the migrations.
6
- *
7
- * @param {(import('@h3ravel/arquebus/types/query-builder').SchemaBuilder)} schema
8
- */
9
- async up(schema) {
10
- await schema.table('{{ table }}', (table) => {
11
- //
12
- })
13
- }
14
-
15
- /**
16
- * Reverse the migrations.
17
- *
18
- * @param {(import('@h3ravel/arquebus/types/query-builder').SchemaBuilder)} schema
19
- */
20
- async down(schema) {
21
- await schema.table('{{ table }}', (table) => {
22
- //
23
- })
24
- }
25
- };
@@ -1,22 +0,0 @@
1
- import { Migration } from '@h3ravel/arquebus'
2
- import { SchemaBuilder } from '@h3ravel/arquebus/types/query-builder';
3
-
4
- export default class extends Migration {
5
- /**
6
- * Run the migrations.
7
- */
8
- async up(schema: SchemaBuilder) {
9
- await schema.table('{{ table }}', (table) => {
10
- //
11
- })
12
- }
13
-
14
- /**
15
- * Reverse the migrations.
16
- */
17
- async down(schema: SchemaBuilder) {
18
- await schema.table('{{ table }}', (table) => {
19
- //
20
- })
21
- }
22
- }
@@ -1,141 +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 __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
-
23
- //#endregion
24
- let node_fs_promises = require("node:fs/promises");
25
- node_fs_promises = __toESM(node_fs_promises);
26
- let path = require("path");
27
- path = __toESM(path);
28
- let node_path = require("node:path");
29
- node_path = __toESM(node_path);
30
- let node_url = require("node:url");
31
- node_url = __toESM(node_url);
32
-
33
- //#region src/seeders/seeder.ts
34
- var Seeder = class {};
35
- var seeder_default = Seeder;
36
-
37
- //#endregion
38
- //#region src/seeders/runner.ts
39
- async function glob(folderPath) {
40
- const { default: escalade } = await import("escalade");
41
- const entries = [];
42
- await escalade(folderPath, async (dir, names) => {
43
- await Promise.all(names.map(async (name) => {
44
- const p = path.default.join(dir, name);
45
- try {
46
- await (0, node_fs_promises.access)(p);
47
- if (p.endsWith(".js") || p.endsWith(".ts")) entries.push(p);
48
- } catch {}
49
- }));
50
- return "";
51
- });
52
- return entries;
53
- }
54
- var SeederRunner = class {
55
- resolver;
56
- connection;
57
- paths = [];
58
- constructor(resolver) {
59
- this.resolver = resolver;
60
- }
61
- path(p) {
62
- this.paths = Array.from(new Set([...this.paths, p]));
63
- }
64
- getPaths() {
65
- return this.paths;
66
- }
67
- resolveConnection(connection) {
68
- var _getInstance, _ref, _instance$connections;
69
- const name = connection || this.connection || "default";
70
- const instance = ((_getInstance = (_ref = this.resolver).getInstance) === null || _getInstance === void 0 ? void 0 : _getInstance.call(_ref)) ?? null;
71
- if (!!!(instance === null || instance === void 0 || (_instance$connections = instance.connections) === null || _instance$connections === void 0 ? void 0 : _instance$connections[name])) this.resolver.autoLoad().catch(() => {
72
- /** noop */
73
- });
74
- return this.resolver.fire(name);
75
- }
76
- setConnection(connection) {
77
- this.connection = connection;
78
- return this;
79
- }
80
- async getSeederFiles(paths) {
81
- const files = [];
82
- for (const p of paths) {
83
- if (p.endsWith(".js") || p.endsWith(".ts")) {
84
- files.push(p);
85
- continue;
86
- }
87
- files.push(...await glob(p));
88
- }
89
- return files;
90
- }
91
- async resolvePath(filePath) {
92
- try {
93
- const mod = await import(filePath);
94
- return new (mod.default ?? mod.Seeder)();
95
- } catch {
96
- return null;
97
- }
98
- }
99
- async run(paths, connection) {
100
- const files = await this.getSeederFiles(paths);
101
- const conn = this.resolveConnection(connection);
102
- for (const file of files) {
103
- const seeder = await this.resolvePath(file);
104
- if (seeder && typeof seeder.run === "function") await seeder.run(conn);
105
- }
106
- }
107
- };
108
- var runner_default = SeederRunner;
109
-
110
- //#endregion
111
- //#region src/seeders/seeder-creator.ts
112
- var SeederCreator = class {
113
- constructor(customStubPath) {
114
- this.customStubPath = customStubPath;
115
- }
116
- async create(dir, name, type = "js") {
117
- await (0, node_fs_promises.mkdir)(dir, { recursive: true });
118
- const stubPath = this.getStubPath(type);
119
- let stub = await (0, node_fs_promises.readFile)(stubPath, "utf-8");
120
- stub = stub.replace(/{{ name }}/g, name);
121
- const filePath = path.default.join(dir, `${name}.${type}`);
122
- await (0, node_fs_promises.writeFile)(filePath, stub);
123
- return filePath;
124
- }
125
- getStubPath(type) {
126
- if (this.customStubPath) return path.default.join(this.customStubPath, `seeder-${type}.stub`);
127
- const __dirname$1 = this.getDirname({});
128
- return path.default.join(__dirname$1, "stubs", `seeder-${type}.stub`);
129
- }
130
- getDirname(meta) {
131
- if (typeof __dirname !== "undefined") return __dirname;
132
- if (meta && meta.url) return (0, node_path.dirname)((0, node_url.fileURLToPath)(meta.url));
133
- throw new Error("Unable to determine dirname");
134
- }
135
- };
136
- var seeder_creator_default = SeederCreator;
137
-
138
- //#endregion
139
- exports.Seeder = seeder_default;
140
- exports.SeederCreator = seeder_creator_default;
141
- exports.SeederRunner = runner_default;