@h3ravel/arquebus 0.7.1 → 0.7.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.
@@ -1,4 +1,4 @@
1
- import { t as __export } from "./chunk-Bop6jNiL.js";
1
+ import "node:module";
2
2
  import { assign, camel, diff, flat, get, isArray, isEmpty, isEqual, isString, omit, pick, set, snake, trim } from "radashi";
3
3
  import advancedFormat from "dayjs/plugin/advancedFormat.js";
4
4
  import dayjs from "dayjs";
@@ -9,6 +9,18 @@ import { existsSync } from "fs";
9
9
  import { FileSystem } from "@h3ravel/shared";
10
10
  import pluralize from "pluralize";
11
11
 
12
+ //#region rolldown:runtime
13
+ var __defProp = Object.defineProperty;
14
+ var __export = (all) => {
15
+ let target = {};
16
+ for (var name in all) __defProp(target, name, {
17
+ get: all[name],
18
+ enumerable: true
19
+ });
20
+ return target;
21
+ };
22
+
23
+ //#endregion
12
24
  //#region src/mixin.ts
13
25
  var mixin_exports = /* @__PURE__ */ __export({ compose: () => compose$1 });
14
26
  /**
@@ -137,8 +149,7 @@ var casts_attributes_default = CastsAttributes;
137
149
 
138
150
  //#endregion
139
151
  //#region src/concerns/has-attributes.ts
140
- var has_attributes_exports = /* @__PURE__ */ __export({ default: () => has_attributes_default });
141
- const HasAttributes = (Model$1) => {
152
+ const HasAttributes$1 = (Model$1) => {
142
153
  return class extends Model$1 {
143
154
  static castTypeCache = {};
144
155
  attributes = {};
@@ -380,7 +391,7 @@ const HasAttributes = (Model$1) => {
380
391
  }
381
392
  };
382
393
  };
383
- var has_attributes_default = HasAttributes;
394
+ var has_attributes_default = HasAttributes$1;
384
395
 
385
396
  //#endregion
386
397
  //#region src/errors.ts
@@ -430,8 +441,7 @@ var scope_default = Scope;
430
441
 
431
442
  //#endregion
432
443
  //#region src/concerns/has-global-scopes.ts
433
- var has_global_scopes_exports = /* @__PURE__ */ __export({ default: () => has_global_scopes_default });
434
- const HasGlobalScopes = (Model$1) => {
444
+ const HasGlobalScopes$1 = (Model$1) => {
435
445
  return class extends Model$1 {
436
446
  static globalScopes;
437
447
  static addGlobalScope(scope, implementation = null) {
@@ -462,7 +472,7 @@ const HasGlobalScopes = (Model$1) => {
462
472
  }
463
473
  };
464
474
  };
465
- var has_global_scopes_default = HasGlobalScopes;
475
+ var has_global_scopes_default = HasGlobalScopes$1;
466
476
 
467
477
  //#endregion
468
478
  //#region src/hooks.ts
@@ -495,8 +505,7 @@ var hooks_default = Hooks;
495
505
 
496
506
  //#endregion
497
507
  //#region src/concerns/has-hooks.ts
498
- var has_hooks_exports = /* @__PURE__ */ __export({ default: () => has_hooks_default });
499
- const HasHooks = (Model$1) => {
508
+ const HasHooks$1 = (Model$1) => {
500
509
  return class extends Model$1 {
501
510
  static hooks = null;
502
511
  static addHook(hook, callback) {
@@ -545,7 +554,7 @@ const HasHooks = (Model$1) => {
545
554
  }
546
555
  };
547
556
  };
548
- var has_hooks_default = HasHooks;
557
+ var has_hooks_default = HasHooks$1;
549
558
 
550
559
  //#endregion
551
560
  //#region src/collection.ts
@@ -2139,8 +2148,7 @@ var has_one_default = HasOne;
2139
2148
 
2140
2149
  //#endregion
2141
2150
  //#region src/concerns/has-timestamps.ts
2142
- var has_timestamps_exports = /* @__PURE__ */ __export({ default: () => has_timestamps_default });
2143
- const HasTimestamps = (Model$1) => {
2151
+ const HasTimestamps$1 = (Model$1) => {
2144
2152
  return class extends Model$1 {
2145
2153
  static CREATED_AT = "created_at";
2146
2154
  static UPDATED_AT = "updated_at";
@@ -2182,12 +2190,11 @@ const HasTimestamps = (Model$1) => {
2182
2190
  }
2183
2191
  };
2184
2192
  };
2185
- var has_timestamps_default = HasTimestamps;
2193
+ var has_timestamps_default = HasTimestamps$1;
2186
2194
 
2187
2195
  //#endregion
2188
2196
  //#region src/concerns/hides-attributes.ts
2189
- var hides_attributes_exports = /* @__PURE__ */ __export({ default: () => hides_attributes_default });
2190
- const HidesAttributes = (Model$1) => {
2197
+ const HidesAttributes$1 = (Model$1) => {
2191
2198
  return class extends Model$1 {
2192
2199
  hidden = [];
2193
2200
  visible = [];
@@ -2218,12 +2225,11 @@ const HidesAttributes = (Model$1) => {
2218
2225
  }
2219
2226
  };
2220
2227
  };
2221
- var hides_attributes_default = HidesAttributes;
2228
+ var hides_attributes_default = HidesAttributes$1;
2222
2229
 
2223
2230
  //#endregion
2224
2231
  //#region src/concerns/unique-ids.ts
2225
- var unique_ids_exports = /* @__PURE__ */ __export({ default: () => unique_ids_default });
2226
- const UniqueIds = (Model$1) => {
2232
+ const UniqueIds$1 = (Model$1) => {
2227
2233
  return class extends Model$1 {
2228
2234
  useUniqueIds = false;
2229
2235
  usesUniqueIds() {
@@ -2238,7 +2244,7 @@ const UniqueIds = (Model$1) => {
2238
2244
  }
2239
2245
  };
2240
2246
  };
2241
- var unique_ids_default = UniqueIds;
2247
+ var unique_ids_default = UniqueIds$1;
2242
2248
 
2243
2249
  //#endregion
2244
2250
  //#region src/casts/attribute.ts
@@ -3337,8 +3343,7 @@ var has_one_through_default = HasOneThrough;
3337
3343
 
3338
3344
  //#endregion
3339
3345
  //#region src/concerns/has-relations.ts
3340
- var has_relations_exports = /* @__PURE__ */ __export({ default: () => has_relations_default });
3341
- const HasRelations = (Model$1) => {
3346
+ const HasRelations$1 = (Model$1) => {
3342
3347
  return class extends Model$1 {
3343
3348
  relations = {};
3344
3349
  getRelation(relation) {
@@ -3430,12 +3435,11 @@ const HasRelations = (Model$1) => {
3430
3435
  }
3431
3436
  };
3432
3437
  };
3433
- var has_relations_default = HasRelations;
3438
+ var has_relations_default = HasRelations$1;
3434
3439
 
3435
3440
  //#endregion
3436
3441
  //#region src/concerns/has-unique-ids.ts
3437
- var has_unique_ids_exports = /* @__PURE__ */ __export({ default: () => has_unique_ids_default });
3438
- const HasUniqueIds = (Model$1) => {
3442
+ const HasUniqueIds$1 = (Model$1) => {
3439
3443
  return class extends Model$1 {
3440
3444
  useUniqueIds = true;
3441
3445
  uniqueIds() {
@@ -3451,7 +3455,18 @@ const HasUniqueIds = (Model$1) => {
3451
3455
  }
3452
3456
  };
3453
3457
  };
3454
- var has_unique_ids_default = HasUniqueIds;
3458
+ var has_unique_ids_default = HasUniqueIds$1;
3459
+
3460
+ //#endregion
3461
+ //#region src/concerns/index.ts
3462
+ const HasAttributes = has_attributes_default;
3463
+ const HasGlobalScopes = has_global_scopes_default;
3464
+ const HasHooks = has_hooks_default;
3465
+ const HasRelations = has_relations_default;
3466
+ const HasTimestamps = has_timestamps_default;
3467
+ const HasUniqueIds = has_unique_ids_default;
3468
+ const HidesAttributes = hides_attributes_default;
3469
+ const UniqueIds = unique_ids_default;
3455
3470
 
3456
3471
  //#endregion
3457
- export { has_attributes_exports as HasAttributes, has_global_scopes_exports as HasGlobalScopes, has_hooks_exports as HasHooks, has_relations_exports as HasRelations, has_timestamps_exports as HasTimestamps, has_unique_ids_exports as HasUniqueIds, hides_attributes_exports as HidesAttributes, unique_ids_exports as UniqueIds };
3472
+ export { HasAttributes, HasGlobalScopes, HasHooks, HasRelations, HasTimestamps, HasUniqueIds, HidesAttributes, UniqueIds };
@@ -320,9 +320,8 @@ var collection_default = Collection;
320
320
 
321
321
  //#endregion
322
322
  //#region src/relations/concerns/interacts-with-pivot-table.ts
323
- var interacts_with_pivot_table_exports = /* @__PURE__ */ __export({ default: () => interacts_with_pivot_table_default });
324
- const InteractsWithPivotTable = (Relation$1) => {
325
- return class extends Relation$1 {
323
+ const InteractsWithPivotTable$1 = (Relation$2) => {
324
+ return class extends Relation$2 {
326
325
  newExistingPivot(attributes = []) {
327
326
  return this.newPivot(attributes, true);
328
327
  }
@@ -509,7 +508,7 @@ const InteractsWithPivotTable = (Relation$1) => {
509
508
  }
510
509
  };
511
510
  };
512
- var interacts_with_pivot_table_default = InteractsWithPivotTable;
511
+ var interacts_with_pivot_table_default = InteractsWithPivotTable$1;
513
512
 
514
513
  //#endregion
515
514
  //#region src/errors.ts
@@ -547,8 +546,7 @@ var InvalidArgumentError = class extends BaseError {};
547
546
 
548
547
  //#endregion
549
548
  //#region src/relations/relation.ts
550
- var relation_exports = /* @__PURE__ */ __export({ default: () => relation_default });
551
- var Relation = class {
549
+ var Relation$1 = class {
552
550
  query;
553
551
  parent;
554
552
  related;
@@ -636,12 +634,11 @@ var Relation = class {
636
634
  return (_this$getQualifiedFor = this.getQualifiedForeignKeyName) === null || _this$getQualifiedFor === void 0 ? void 0 : _this$getQualifiedFor.call(this);
637
635
  }
638
636
  };
639
- var relation_default = Relation;
637
+ var relation_default = Relation$1;
640
638
 
641
639
  //#endregion
642
640
  //#region src/relations/belongs-to-many.ts
643
- var belongs_to_many_exports = /* @__PURE__ */ __export({ default: () => belongs_to_many_default });
644
- var BelongsToMany = class extends compose(relation_default, interacts_with_pivot_table_default) {
641
+ var BelongsToMany$1 = class extends compose(relation_default, interacts_with_pivot_table_default) {
645
642
  table;
646
643
  foreignPivotKey;
647
644
  relatedPivotKey;
@@ -862,7 +859,7 @@ var BelongsToMany = class extends compose(relation_default, interacts_with_pivot
862
859
  return super.getRelationExistenceQuery(query, parentQuery, columns);
863
860
  }
864
861
  };
865
- var belongs_to_many_default = BelongsToMany;
862
+ var belongs_to_many_default = BelongsToMany$1;
866
863
 
867
864
  //#endregion
868
865
  //#region src/paginator.ts
@@ -2005,9 +2002,8 @@ var has_hooks_default = HasHooks;
2005
2002
 
2006
2003
  //#endregion
2007
2004
  //#region src/relations/has-one-or-many.ts
2008
- var has_one_or_many_exports = /* @__PURE__ */ __export({ default: () => has_one_or_many_default });
2009
- const HasOneOrMany = (Relation$1) => {
2010
- return class extends Relation$1 {
2005
+ const HasOneOrMany$1 = (Relation$2) => {
2006
+ return class extends Relation$2 {
2011
2007
  getRelationValue(dictionary, key, type) {
2012
2008
  const value = dictionary[key];
2013
2009
  return type === "one" ? value[0] : new collection_default(value);
@@ -2071,12 +2067,11 @@ const HasOneOrMany = (Relation$1) => {
2071
2067
  }
2072
2068
  };
2073
2069
  };
2074
- var has_one_or_many_default = HasOneOrMany;
2070
+ var has_one_or_many_default = HasOneOrMany$1;
2075
2071
 
2076
2072
  //#endregion
2077
2073
  //#region src/relations/has-many.ts
2078
- var has_many_exports = /* @__PURE__ */ __export({ default: () => has_many_default });
2079
- var HasMany = class extends compose(relation_default, has_one_or_many_default) {
2074
+ var HasMany$1 = class extends compose(relation_default, has_one_or_many_default) {
2080
2075
  foreignKey;
2081
2076
  localKey;
2082
2077
  constructor(query, parent, foreignKey, localKey) {
@@ -2111,13 +2106,12 @@ var HasMany = class extends compose(relation_default, has_one_or_many_default) {
2111
2106
  this.query.whereIn(this.foreignKey, this.getKeys(models, this.localKey));
2112
2107
  }
2113
2108
  };
2114
- var has_many_default = HasMany;
2109
+ var has_many_default = HasMany$1;
2115
2110
 
2116
2111
  //#endregion
2117
2112
  //#region src/relations/concerns/supports-default-models.ts
2118
- var supports_default_models_exports = /* @__PURE__ */ __export({ default: () => supports_default_models_default });
2119
- const SupportsDefaultModels = (Relation$1) => {
2120
- return class extends Relation$1 {
2113
+ const SupportsDefaultModels$1 = (Relation$2) => {
2114
+ return class extends Relation$2 {
2121
2115
  _withDefault;
2122
2116
  withDefault(callback = true) {
2123
2117
  this._withDefault = callback;
@@ -2132,12 +2126,11 @@ const SupportsDefaultModels = (Relation$1) => {
2132
2126
  }
2133
2127
  };
2134
2128
  };
2135
- var supports_default_models_default = SupportsDefaultModels;
2129
+ var supports_default_models_default = SupportsDefaultModels$1;
2136
2130
 
2137
2131
  //#endregion
2138
2132
  //#region src/relations/has-one.ts
2139
- var has_one_exports = /* @__PURE__ */ __export({ default: () => has_one_default });
2140
- var HasOne = class extends compose(relation_default, has_one_or_many_default, supports_default_models_default) {
2133
+ var HasOne$1 = class extends compose(relation_default, has_one_or_many_default, supports_default_models_default) {
2141
2134
  foreignKey;
2142
2135
  localKey;
2143
2136
  constructor(query, parent, foreignKey, localKey) {
@@ -2175,12 +2168,11 @@ var HasOne = class extends compose(relation_default, has_one_or_many_default, su
2175
2168
  return this.related.newInstance().setAttribute(this.getForeignKeyName(), parent[this.localKey]);
2176
2169
  }
2177
2170
  };
2178
- var has_one_default = HasOne;
2171
+ var has_one_default = HasOne$1;
2179
2172
 
2180
2173
  //#endregion
2181
2174
  //#region src/relations/has-many-through.ts
2182
- var has_many_through_exports = /* @__PURE__ */ __export({ default: () => has_many_through_default });
2183
- var HasManyThrough = class extends relation_default {
2175
+ var HasManyThrough$1 = class extends relation_default {
2184
2176
  throughParent;
2185
2177
  farParent;
2186
2178
  firstKey;
@@ -2358,12 +2350,11 @@ var HasManyThrough = class extends relation_default {
2358
2350
  return this.secondLocalKey;
2359
2351
  }
2360
2352
  };
2361
- var has_many_through_default = HasManyThrough;
2353
+ var has_many_through_default = HasManyThrough$1;
2362
2354
 
2363
2355
  //#endregion
2364
2356
  //#region src/relations/has-one-through.ts
2365
- var has_one_through_exports = /* @__PURE__ */ __export({ default: () => has_one_through_default });
2366
- var HasOneThrough = class extends compose(has_many_through_default, supports_default_models_default) {
2357
+ var HasOneThrough$1 = class extends compose(has_many_through_default, supports_default_models_default) {
2367
2358
  async getResults() {
2368
2359
  return await this.first() || this.getDefaultFor(this.farParent);
2369
2360
  }
@@ -2386,7 +2377,7 @@ var HasOneThrough = class extends compose(has_many_through_default, supports_def
2386
2377
  return this.related.newInstance();
2387
2378
  }
2388
2379
  };
2389
- var has_one_through_default = HasOneThrough;
2380
+ var has_one_through_default = HasOneThrough$1;
2390
2381
 
2391
2382
  //#endregion
2392
2383
  //#region src/concerns/has-relations.ts
@@ -3383,8 +3374,7 @@ var model_default = Model;
3383
3374
 
3384
3375
  //#endregion
3385
3376
  //#region src/relations/belongs-to.ts
3386
- var belongs_to_exports = /* @__PURE__ */ __export({ default: () => belongs_to_default });
3387
- var BelongsTo = class extends compose(relation_default, supports_default_models_default) {
3377
+ var BelongsTo$1 = class extends compose(relation_default, supports_default_models_default) {
3388
3378
  foreignKey;
3389
3379
  ownerKey;
3390
3380
  child;
@@ -3469,66 +3459,29 @@ var BelongsTo = class extends compose(relation_default, supports_default_models_
3469
3459
  return this.related.newInstance();
3470
3460
  }
3471
3461
  };
3472
- var belongs_to_default = BelongsTo;
3462
+ var belongs_to_default = BelongsTo$1;
3473
3463
 
3474
3464
  //#endregion
3475
- Object.defineProperty(exports, 'BelongsTo', {
3476
- enumerable: true,
3477
- get: function () {
3478
- return belongs_to_exports;
3479
- }
3480
- });
3481
- Object.defineProperty(exports, 'BelongsToMany', {
3482
- enumerable: true,
3483
- get: function () {
3484
- return belongs_to_many_exports;
3485
- }
3486
- });
3487
- Object.defineProperty(exports, 'HasMany', {
3488
- enumerable: true,
3489
- get: function () {
3490
- return has_many_exports;
3491
- }
3492
- });
3493
- Object.defineProperty(exports, 'HasManyThrough', {
3494
- enumerable: true,
3495
- get: function () {
3496
- return has_many_through_exports;
3497
- }
3498
- });
3499
- Object.defineProperty(exports, 'HasOne', {
3500
- enumerable: true,
3501
- get: function () {
3502
- return has_one_exports;
3503
- }
3504
- });
3505
- Object.defineProperty(exports, 'HasOneOrMany', {
3506
- enumerable: true,
3507
- get: function () {
3508
- return has_one_or_many_exports;
3509
- }
3510
- });
3511
- Object.defineProperty(exports, 'HasOneThrough', {
3512
- enumerable: true,
3513
- get: function () {
3514
- return has_one_through_exports;
3515
- }
3516
- });
3517
- Object.defineProperty(exports, 'InteractsWithPivotTable', {
3518
- enumerable: true,
3519
- get: function () {
3520
- return interacts_with_pivot_table_exports;
3521
- }
3522
- });
3523
- Object.defineProperty(exports, 'Relation', {
3524
- enumerable: true,
3525
- get: function () {
3526
- return relation_exports;
3527
- }
3528
- });
3529
- Object.defineProperty(exports, 'SupportsDefaultModels', {
3530
- enumerable: true,
3531
- get: function () {
3532
- return supports_default_models_exports;
3533
- }
3534
- });
3465
+ //#region src/relations/index.ts
3466
+ const BelongsTo = belongs_to_default;
3467
+ const BelongsToMany = belongs_to_many_default;
3468
+ const InteractsWithPivotTable = interacts_with_pivot_table_default;
3469
+ const SupportsDefaultModels = supports_default_models_default;
3470
+ const HasMany = has_many_default;
3471
+ const HasManyThrough = has_many_through_default;
3472
+ const HasOne = has_one_default;
3473
+ const HasOneOrMany = has_one_or_many_default;
3474
+ const HasOneThrough = has_one_through_default;
3475
+ const Relation = relation_default;
3476
+
3477
+ //#endregion
3478
+ exports.BelongsTo = BelongsTo;
3479
+ exports.BelongsToMany = BelongsToMany;
3480
+ exports.HasMany = HasMany;
3481
+ exports.HasManyThrough = HasManyThrough;
3482
+ exports.HasOne = HasOne;
3483
+ exports.HasOneOrMany = HasOneOrMany;
3484
+ exports.HasOneThrough = HasOneThrough;
3485
+ exports.InteractsWithPivotTable = InteractsWithPivotTable;
3486
+ exports.Relation = Relation;
3487
+ exports.SupportsDefaultModels = SupportsDefaultModels;