@h3ravel/arquebus 0.7.0 → 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.
- package/bin/index.cjs +1 -1
- package/bin/index.js +1 -1
- package/dist/concerns/index.cjs +35 -72
- package/dist/concerns/index.d.ts +209 -235
- package/dist/concerns/index.js +41 -26
- package/dist/relations/index.cjs +47 -24
- package/dist/relations/index.d.ts +5072 -2
- package/dist/relations/index.js +39 -26
- package/package.json +1 -1
- package/dist/concerns/chunk-Bop6jNiL.js +0 -15
package/dist/concerns/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
3472
|
+
export { HasAttributes, HasGlobalScopes, HasHooks, HasRelations, HasTimestamps, HasUniqueIds, HidesAttributes, UniqueIds };
|
package/dist/relations/index.cjs
CHANGED
|
@@ -320,8 +320,8 @@ var collection_default = Collection;
|
|
|
320
320
|
|
|
321
321
|
//#endregion
|
|
322
322
|
//#region src/relations/concerns/interacts-with-pivot-table.ts
|
|
323
|
-
const InteractsWithPivotTable = (Relation$
|
|
324
|
-
return class extends Relation$
|
|
323
|
+
const InteractsWithPivotTable$1 = (Relation$2) => {
|
|
324
|
+
return class extends Relation$2 {
|
|
325
325
|
newExistingPivot(attributes = []) {
|
|
326
326
|
return this.newPivot(attributes, true);
|
|
327
327
|
}
|
|
@@ -508,7 +508,7 @@ const InteractsWithPivotTable = (Relation$1) => {
|
|
|
508
508
|
}
|
|
509
509
|
};
|
|
510
510
|
};
|
|
511
|
-
var interacts_with_pivot_table_default = InteractsWithPivotTable;
|
|
511
|
+
var interacts_with_pivot_table_default = InteractsWithPivotTable$1;
|
|
512
512
|
|
|
513
513
|
//#endregion
|
|
514
514
|
//#region src/errors.ts
|
|
@@ -546,7 +546,7 @@ var InvalidArgumentError = class extends BaseError {};
|
|
|
546
546
|
|
|
547
547
|
//#endregion
|
|
548
548
|
//#region src/relations/relation.ts
|
|
549
|
-
var Relation = class {
|
|
549
|
+
var Relation$1 = class {
|
|
550
550
|
query;
|
|
551
551
|
parent;
|
|
552
552
|
related;
|
|
@@ -634,11 +634,11 @@ var Relation = class {
|
|
|
634
634
|
return (_this$getQualifiedFor = this.getQualifiedForeignKeyName) === null || _this$getQualifiedFor === void 0 ? void 0 : _this$getQualifiedFor.call(this);
|
|
635
635
|
}
|
|
636
636
|
};
|
|
637
|
-
var relation_default = Relation;
|
|
637
|
+
var relation_default = Relation$1;
|
|
638
638
|
|
|
639
639
|
//#endregion
|
|
640
640
|
//#region src/relations/belongs-to-many.ts
|
|
641
|
-
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) {
|
|
642
642
|
table;
|
|
643
643
|
foreignPivotKey;
|
|
644
644
|
relatedPivotKey;
|
|
@@ -859,7 +859,7 @@ var BelongsToMany = class extends compose(relation_default, interacts_with_pivot
|
|
|
859
859
|
return super.getRelationExistenceQuery(query, parentQuery, columns);
|
|
860
860
|
}
|
|
861
861
|
};
|
|
862
|
-
var belongs_to_many_default = BelongsToMany;
|
|
862
|
+
var belongs_to_many_default = BelongsToMany$1;
|
|
863
863
|
|
|
864
864
|
//#endregion
|
|
865
865
|
//#region src/paginator.ts
|
|
@@ -2002,8 +2002,8 @@ var has_hooks_default = HasHooks;
|
|
|
2002
2002
|
|
|
2003
2003
|
//#endregion
|
|
2004
2004
|
//#region src/relations/has-one-or-many.ts
|
|
2005
|
-
const HasOneOrMany = (Relation$
|
|
2006
|
-
return class extends Relation$
|
|
2005
|
+
const HasOneOrMany$1 = (Relation$2) => {
|
|
2006
|
+
return class extends Relation$2 {
|
|
2007
2007
|
getRelationValue(dictionary, key, type) {
|
|
2008
2008
|
const value = dictionary[key];
|
|
2009
2009
|
return type === "one" ? value[0] : new collection_default(value);
|
|
@@ -2067,11 +2067,11 @@ const HasOneOrMany = (Relation$1) => {
|
|
|
2067
2067
|
}
|
|
2068
2068
|
};
|
|
2069
2069
|
};
|
|
2070
|
-
var has_one_or_many_default = HasOneOrMany;
|
|
2070
|
+
var has_one_or_many_default = HasOneOrMany$1;
|
|
2071
2071
|
|
|
2072
2072
|
//#endregion
|
|
2073
2073
|
//#region src/relations/has-many.ts
|
|
2074
|
-
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) {
|
|
2075
2075
|
foreignKey;
|
|
2076
2076
|
localKey;
|
|
2077
2077
|
constructor(query, parent, foreignKey, localKey) {
|
|
@@ -2106,12 +2106,12 @@ var HasMany = class extends compose(relation_default, has_one_or_many_default) {
|
|
|
2106
2106
|
this.query.whereIn(this.foreignKey, this.getKeys(models, this.localKey));
|
|
2107
2107
|
}
|
|
2108
2108
|
};
|
|
2109
|
-
var has_many_default = HasMany;
|
|
2109
|
+
var has_many_default = HasMany$1;
|
|
2110
2110
|
|
|
2111
2111
|
//#endregion
|
|
2112
2112
|
//#region src/relations/concerns/supports-default-models.ts
|
|
2113
|
-
const SupportsDefaultModels = (Relation$
|
|
2114
|
-
return class extends Relation$
|
|
2113
|
+
const SupportsDefaultModels$1 = (Relation$2) => {
|
|
2114
|
+
return class extends Relation$2 {
|
|
2115
2115
|
_withDefault;
|
|
2116
2116
|
withDefault(callback = true) {
|
|
2117
2117
|
this._withDefault = callback;
|
|
@@ -2126,11 +2126,11 @@ const SupportsDefaultModels = (Relation$1) => {
|
|
|
2126
2126
|
}
|
|
2127
2127
|
};
|
|
2128
2128
|
};
|
|
2129
|
-
var supports_default_models_default = SupportsDefaultModels;
|
|
2129
|
+
var supports_default_models_default = SupportsDefaultModels$1;
|
|
2130
2130
|
|
|
2131
2131
|
//#endregion
|
|
2132
2132
|
//#region src/relations/has-one.ts
|
|
2133
|
-
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) {
|
|
2134
2134
|
foreignKey;
|
|
2135
2135
|
localKey;
|
|
2136
2136
|
constructor(query, parent, foreignKey, localKey) {
|
|
@@ -2168,11 +2168,11 @@ var HasOne = class extends compose(relation_default, has_one_or_many_default, su
|
|
|
2168
2168
|
return this.related.newInstance().setAttribute(this.getForeignKeyName(), parent[this.localKey]);
|
|
2169
2169
|
}
|
|
2170
2170
|
};
|
|
2171
|
-
var has_one_default = HasOne;
|
|
2171
|
+
var has_one_default = HasOne$1;
|
|
2172
2172
|
|
|
2173
2173
|
//#endregion
|
|
2174
2174
|
//#region src/relations/has-many-through.ts
|
|
2175
|
-
var HasManyThrough = class extends relation_default {
|
|
2175
|
+
var HasManyThrough$1 = class extends relation_default {
|
|
2176
2176
|
throughParent;
|
|
2177
2177
|
farParent;
|
|
2178
2178
|
firstKey;
|
|
@@ -2350,11 +2350,11 @@ var HasManyThrough = class extends relation_default {
|
|
|
2350
2350
|
return this.secondLocalKey;
|
|
2351
2351
|
}
|
|
2352
2352
|
};
|
|
2353
|
-
var has_many_through_default = HasManyThrough;
|
|
2353
|
+
var has_many_through_default = HasManyThrough$1;
|
|
2354
2354
|
|
|
2355
2355
|
//#endregion
|
|
2356
2356
|
//#region src/relations/has-one-through.ts
|
|
2357
|
-
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) {
|
|
2358
2358
|
async getResults() {
|
|
2359
2359
|
return await this.first() || this.getDefaultFor(this.farParent);
|
|
2360
2360
|
}
|
|
@@ -2377,7 +2377,7 @@ var HasOneThrough = class extends compose(has_many_through_default, supports_def
|
|
|
2377
2377
|
return this.related.newInstance();
|
|
2378
2378
|
}
|
|
2379
2379
|
};
|
|
2380
|
-
var has_one_through_default = HasOneThrough;
|
|
2380
|
+
var has_one_through_default = HasOneThrough$1;
|
|
2381
2381
|
|
|
2382
2382
|
//#endregion
|
|
2383
2383
|
//#region src/concerns/has-relations.ts
|
|
@@ -3374,7 +3374,7 @@ var model_default = Model;
|
|
|
3374
3374
|
|
|
3375
3375
|
//#endregion
|
|
3376
3376
|
//#region src/relations/belongs-to.ts
|
|
3377
|
-
var BelongsTo = class extends compose(relation_default, supports_default_models_default) {
|
|
3377
|
+
var BelongsTo$1 = class extends compose(relation_default, supports_default_models_default) {
|
|
3378
3378
|
foreignKey;
|
|
3379
3379
|
ownerKey;
|
|
3380
3380
|
child;
|
|
@@ -3459,6 +3459,29 @@ var BelongsTo = class extends compose(relation_default, supports_default_models_
|
|
|
3459
3459
|
return this.related.newInstance();
|
|
3460
3460
|
}
|
|
3461
3461
|
};
|
|
3462
|
-
var belongs_to_default = BelongsTo;
|
|
3462
|
+
var belongs_to_default = BelongsTo$1;
|
|
3463
3463
|
|
|
3464
|
-
//#endregion
|
|
3464
|
+
//#endregion
|
|
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;
|