@h3ravel/arquebus 2.0.0 → 3.0.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.
Files changed (45) hide show
  1. package/bin/index.cjs +580 -451
  2. package/bin/index.js +566 -437
  3. package/dist/browser/index.cjs +54 -51
  4. package/dist/browser/index.d.ts +804 -737
  5. package/dist/browser/index.js +48 -44
  6. package/dist/concerns/index.cjs +152 -143
  7. package/dist/concerns/index.d.ts +849 -776
  8. package/dist/concerns/index.js +143 -133
  9. package/dist/index.cjs +186 -185
  10. package/dist/index.d.ts +856 -782
  11. package/dist/index.js +179 -177
  12. package/dist/inspector/index.cjs +175 -174
  13. package/dist/inspector/index.d.ts +0 -1
  14. package/dist/inspector/index.js +161 -159
  15. package/dist/migrations/index.cjs +183 -182
  16. package/dist/migrations/index.d.ts +799 -727
  17. package/dist/migrations/index.js +172 -170
  18. package/dist/relations/index.cjs +152 -143
  19. package/dist/relations/index.d.ts +835 -762
  20. package/dist/relations/index.js +143 -133
  21. package/dist/seeders/index.cjs +7 -5
  22. package/dist/seeders/index.d.ts +797 -724
  23. package/dist/seeders/index.js +8 -6
  24. package/dist/{migrations/stubs/stubs → stubs}/migration-js.stub +1 -0
  25. package/dist/{migrations/stubs/stubs → stubs}/migration-ts.stub +1 -0
  26. package/dist/{migrations/stubs/stubs → stubs}/migration.create-js.stub +1 -0
  27. package/dist/{migrations/stubs/stubs → stubs}/migration.create-ts.stub +1 -0
  28. package/dist/{migrations/stubs/stubs → stubs}/migration.update-js.stub +1 -0
  29. package/dist/{migrations/stubs/stubs → stubs}/migration.update-ts.stub +1 -0
  30. package/dist/stubs/model-ts.stub +9 -0
  31. package/package.json +31 -31
  32. package/types/builder.ts +1 -1
  33. package/types/database.ts +69 -0
  34. package/types/index.ts +3 -0
  35. package/types/model-builder.ts +132 -0
  36. package/types/query-builder.ts +0 -1
  37. package/types/query-methods.ts +0 -1
  38. package/types/schema.ts +92 -0
  39. package/types/utils.ts +1 -40
  40. package/dist/stubs/stubs/model-ts.stub +0 -5
  41. /package/dist/stubs/{stubs/arquebus.config-js.stub → arquebus.config-js.stub} +0 -0
  42. /package/dist/stubs/{stubs/arquebus.config-ts.stub → arquebus.config-ts.stub} +0 -0
  43. /package/dist/stubs/{stubs/model-js.stub → model-js.stub} +0 -0
  44. /package/dist/stubs/{stubs/seeder-js.stub → seeder-js.stub} +0 -0
  45. /package/dist/stubs/{stubs/seeder-ts.stub → seeder-ts.stub} +0 -0
@@ -25,6 +25,7 @@ let node_fs_promises = require("node:fs/promises");
25
25
  let path = require("path");
26
26
  path = __toESM(path, 1);
27
27
  let node_path = require("node:path");
28
+ let node_fs = require("node:fs");
28
29
  let node_url = require("node:url");
29
30
  //#region src/seeders/seeder.ts
30
31
  var Seeder = class {};
@@ -53,16 +54,14 @@ var SeederRunner = class {
53
54
  this.resolver = resolver;
54
55
  }
55
56
  path(p) {
56
- this.paths = Array.from(new Set([...this.paths, p]));
57
+ this.paths = Array.from(/* @__PURE__ */ new Set([...this.paths, p]));
57
58
  }
58
59
  getPaths() {
59
60
  return this.paths;
60
61
  }
61
62
  resolveConnection(connection) {
62
- var _getInstance, _ref, _instance$connections;
63
63
  const name = connection || this.connection || "default";
64
- const instance = ((_getInstance = (_ref = this.resolver).getInstance) === null || _getInstance === void 0 ? void 0 : _getInstance.call(_ref)) ?? null;
65
- if (!!!(instance === null || instance === void 0 || (_instance$connections = instance.connections) === null || _instance$connections === void 0 ? void 0 : _instance$connections[name])) this.resolver.autoLoad().catch(() => {
64
+ if (!!!(this.resolver.getInstance?.() ?? null)?.connections?.[name]) this.resolver.autoLoad().catch(() => {
66
65
  /** noop */
67
66
  });
68
67
  return this.resolver.fire(name);
@@ -117,7 +116,10 @@ var SeederCreator = class {
117
116
  getStubPath(type) {
118
117
  if (this.customStubPath) return path.default.join(this.customStubPath, `seeder-${type}.stub`);
119
118
  const __dirname = this.getDirname({});
120
- return path.default.join(__dirname, "stubs", `seeder-${type}.stub`);
119
+ const name = `seeder-${type}.stub`;
120
+ const resolved = [path.default.join(__dirname, "stubs", name), path.default.join(__dirname, "../stubs", name)].find((candidate) => (0, node_fs.existsSync)(candidate));
121
+ if (!resolved) throw new Error(`Seeder stub not found: ${name}`);
122
+ return resolved;
121
123
  }
122
124
  getDirname(meta) {
123
125
  if (typeof __dirname !== "undefined") return __dirname;