@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/relations/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { assign, camel, diff, flat, get, isArray, isEmpty, isEqual, isString, om
|
|
|
3
3
|
import advancedFormat from "dayjs/plugin/advancedFormat.js";
|
|
4
4
|
import dayjs from "dayjs";
|
|
5
5
|
import collect, { Collection, collect as collect$1 } from "collect.js";
|
|
6
|
-
import Knex from "knex";
|
|
6
|
+
import Knex$1 from "knex";
|
|
7
7
|
import path from "path";
|
|
8
8
|
import { existsSync } from "fs";
|
|
9
9
|
import { FileSystem } from "@h3ravel/shared";
|
|
@@ -296,8 +296,8 @@ var collection_default = Collection$1;
|
|
|
296
296
|
|
|
297
297
|
//#endregion
|
|
298
298
|
//#region src/relations/concerns/interacts-with-pivot-table.ts
|
|
299
|
-
const InteractsWithPivotTable = (Relation$
|
|
300
|
-
return class extends Relation$
|
|
299
|
+
const InteractsWithPivotTable$1 = (Relation$2) => {
|
|
300
|
+
return class extends Relation$2 {
|
|
301
301
|
newExistingPivot(attributes = []) {
|
|
302
302
|
return this.newPivot(attributes, true);
|
|
303
303
|
}
|
|
@@ -484,7 +484,7 @@ const InteractsWithPivotTable = (Relation$1) => {
|
|
|
484
484
|
}
|
|
485
485
|
};
|
|
486
486
|
};
|
|
487
|
-
var interacts_with_pivot_table_default = InteractsWithPivotTable;
|
|
487
|
+
var interacts_with_pivot_table_default = InteractsWithPivotTable$1;
|
|
488
488
|
|
|
489
489
|
//#endregion
|
|
490
490
|
//#region src/errors.ts
|
|
@@ -522,7 +522,7 @@ var InvalidArgumentError = class extends BaseError {};
|
|
|
522
522
|
|
|
523
523
|
//#endregion
|
|
524
524
|
//#region src/relations/relation.ts
|
|
525
|
-
var Relation = class {
|
|
525
|
+
var Relation$1 = class {
|
|
526
526
|
query;
|
|
527
527
|
parent;
|
|
528
528
|
related;
|
|
@@ -610,11 +610,11 @@ var Relation = class {
|
|
|
610
610
|
return (_this$getQualifiedFor = this.getQualifiedForeignKeyName) === null || _this$getQualifiedFor === void 0 ? void 0 : _this$getQualifiedFor.call(this);
|
|
611
611
|
}
|
|
612
612
|
};
|
|
613
|
-
var relation_default = Relation;
|
|
613
|
+
var relation_default = Relation$1;
|
|
614
614
|
|
|
615
615
|
//#endregion
|
|
616
616
|
//#region src/relations/belongs-to-many.ts
|
|
617
|
-
var BelongsToMany = class extends compose(relation_default, interacts_with_pivot_table_default) {
|
|
617
|
+
var BelongsToMany$1 = class extends compose(relation_default, interacts_with_pivot_table_default) {
|
|
618
618
|
table;
|
|
619
619
|
foreignPivotKey;
|
|
620
620
|
relatedPivotKey;
|
|
@@ -835,7 +835,7 @@ var BelongsToMany = class extends compose(relation_default, interacts_with_pivot
|
|
|
835
835
|
return super.getRelationExistenceQuery(query, parentQuery, columns);
|
|
836
836
|
}
|
|
837
837
|
};
|
|
838
|
-
var belongs_to_many_default = BelongsToMany;
|
|
838
|
+
var belongs_to_many_default = BelongsToMany$1;
|
|
839
839
|
|
|
840
840
|
//#endregion
|
|
841
841
|
//#region src/paginator.ts
|
|
@@ -1978,8 +1978,8 @@ var has_hooks_default = HasHooks;
|
|
|
1978
1978
|
|
|
1979
1979
|
//#endregion
|
|
1980
1980
|
//#region src/relations/has-one-or-many.ts
|
|
1981
|
-
const HasOneOrMany = (Relation$
|
|
1982
|
-
return class extends Relation$
|
|
1981
|
+
const HasOneOrMany$1 = (Relation$2) => {
|
|
1982
|
+
return class extends Relation$2 {
|
|
1983
1983
|
getRelationValue(dictionary, key, type) {
|
|
1984
1984
|
const value = dictionary[key];
|
|
1985
1985
|
return type === "one" ? value[0] : new collection_default(value);
|
|
@@ -2043,11 +2043,11 @@ const HasOneOrMany = (Relation$1) => {
|
|
|
2043
2043
|
}
|
|
2044
2044
|
};
|
|
2045
2045
|
};
|
|
2046
|
-
var has_one_or_many_default = HasOneOrMany;
|
|
2046
|
+
var has_one_or_many_default = HasOneOrMany$1;
|
|
2047
2047
|
|
|
2048
2048
|
//#endregion
|
|
2049
2049
|
//#region src/relations/has-many.ts
|
|
2050
|
-
var HasMany = class extends compose(relation_default, has_one_or_many_default) {
|
|
2050
|
+
var HasMany$1 = class extends compose(relation_default, has_one_or_many_default) {
|
|
2051
2051
|
foreignKey;
|
|
2052
2052
|
localKey;
|
|
2053
2053
|
constructor(query, parent, foreignKey, localKey) {
|
|
@@ -2082,12 +2082,12 @@ var HasMany = class extends compose(relation_default, has_one_or_many_default) {
|
|
|
2082
2082
|
this.query.whereIn(this.foreignKey, this.getKeys(models, this.localKey));
|
|
2083
2083
|
}
|
|
2084
2084
|
};
|
|
2085
|
-
var has_many_default = HasMany;
|
|
2085
|
+
var has_many_default = HasMany$1;
|
|
2086
2086
|
|
|
2087
2087
|
//#endregion
|
|
2088
2088
|
//#region src/relations/concerns/supports-default-models.ts
|
|
2089
|
-
const SupportsDefaultModels = (Relation$
|
|
2090
|
-
return class extends Relation$
|
|
2089
|
+
const SupportsDefaultModels$1 = (Relation$2) => {
|
|
2090
|
+
return class extends Relation$2 {
|
|
2091
2091
|
_withDefault;
|
|
2092
2092
|
withDefault(callback = true) {
|
|
2093
2093
|
this._withDefault = callback;
|
|
@@ -2102,11 +2102,11 @@ const SupportsDefaultModels = (Relation$1) => {
|
|
|
2102
2102
|
}
|
|
2103
2103
|
};
|
|
2104
2104
|
};
|
|
2105
|
-
var supports_default_models_default = SupportsDefaultModels;
|
|
2105
|
+
var supports_default_models_default = SupportsDefaultModels$1;
|
|
2106
2106
|
|
|
2107
2107
|
//#endregion
|
|
2108
2108
|
//#region src/relations/has-one.ts
|
|
2109
|
-
var HasOne = class extends compose(relation_default, has_one_or_many_default, supports_default_models_default) {
|
|
2109
|
+
var HasOne$1 = class extends compose(relation_default, has_one_or_many_default, supports_default_models_default) {
|
|
2110
2110
|
foreignKey;
|
|
2111
2111
|
localKey;
|
|
2112
2112
|
constructor(query, parent, foreignKey, localKey) {
|
|
@@ -2144,11 +2144,11 @@ var HasOne = class extends compose(relation_default, has_one_or_many_default, su
|
|
|
2144
2144
|
return this.related.newInstance().setAttribute(this.getForeignKeyName(), parent[this.localKey]);
|
|
2145
2145
|
}
|
|
2146
2146
|
};
|
|
2147
|
-
var has_one_default = HasOne;
|
|
2147
|
+
var has_one_default = HasOne$1;
|
|
2148
2148
|
|
|
2149
2149
|
//#endregion
|
|
2150
2150
|
//#region src/relations/has-many-through.ts
|
|
2151
|
-
var HasManyThrough = class extends relation_default {
|
|
2151
|
+
var HasManyThrough$1 = class extends relation_default {
|
|
2152
2152
|
throughParent;
|
|
2153
2153
|
farParent;
|
|
2154
2154
|
firstKey;
|
|
@@ -2326,11 +2326,11 @@ var HasManyThrough = class extends relation_default {
|
|
|
2326
2326
|
return this.secondLocalKey;
|
|
2327
2327
|
}
|
|
2328
2328
|
};
|
|
2329
|
-
var has_many_through_default = HasManyThrough;
|
|
2329
|
+
var has_many_through_default = HasManyThrough$1;
|
|
2330
2330
|
|
|
2331
2331
|
//#endregion
|
|
2332
2332
|
//#region src/relations/has-one-through.ts
|
|
2333
|
-
var HasOneThrough = class extends compose(has_many_through_default, supports_default_models_default) {
|
|
2333
|
+
var HasOneThrough$1 = class extends compose(has_many_through_default, supports_default_models_default) {
|
|
2334
2334
|
async getResults() {
|
|
2335
2335
|
return await this.first() || this.getDefaultFor(this.farParent);
|
|
2336
2336
|
}
|
|
@@ -2353,7 +2353,7 @@ var HasOneThrough = class extends compose(has_many_through_default, supports_def
|
|
|
2353
2353
|
return this.related.newInstance();
|
|
2354
2354
|
}
|
|
2355
2355
|
};
|
|
2356
|
-
var has_one_through_default = HasOneThrough;
|
|
2356
|
+
var has_one_through_default = HasOneThrough$1;
|
|
2357
2357
|
|
|
2358
2358
|
//#endregion
|
|
2359
2359
|
//#region src/concerns/has-relations.ts
|
|
@@ -2833,7 +2833,7 @@ var arquebus = class arquebus {
|
|
|
2833
2833
|
this.connectorFactory = connectorFactory;
|
|
2834
2834
|
}
|
|
2835
2835
|
static getConnectorFactory() {
|
|
2836
|
-
return this.connectorFactory ?? Knex;
|
|
2836
|
+
return this.connectorFactory ?? Knex$1;
|
|
2837
2837
|
}
|
|
2838
2838
|
static addConnection(config, name = "default") {
|
|
2839
2839
|
return this.getInstance().addConnection(config, name);
|
|
@@ -3350,7 +3350,7 @@ var model_default = Model;
|
|
|
3350
3350
|
|
|
3351
3351
|
//#endregion
|
|
3352
3352
|
//#region src/relations/belongs-to.ts
|
|
3353
|
-
var BelongsTo = class extends compose(relation_default, supports_default_models_default) {
|
|
3353
|
+
var BelongsTo$1 = class extends compose(relation_default, supports_default_models_default) {
|
|
3354
3354
|
foreignKey;
|
|
3355
3355
|
ownerKey;
|
|
3356
3356
|
child;
|
|
@@ -3435,7 +3435,20 @@ var BelongsTo = class extends compose(relation_default, supports_default_models_
|
|
|
3435
3435
|
return this.related.newInstance();
|
|
3436
3436
|
}
|
|
3437
3437
|
};
|
|
3438
|
-
var belongs_to_default = BelongsTo;
|
|
3438
|
+
var belongs_to_default = BelongsTo$1;
|
|
3439
3439
|
|
|
3440
3440
|
//#endregion
|
|
3441
|
-
|
|
3441
|
+
//#region src/relations/index.ts
|
|
3442
|
+
const BelongsTo = belongs_to_default;
|
|
3443
|
+
const BelongsToMany = belongs_to_many_default;
|
|
3444
|
+
const InteractsWithPivotTable = interacts_with_pivot_table_default;
|
|
3445
|
+
const SupportsDefaultModels = supports_default_models_default;
|
|
3446
|
+
const HasMany = has_many_default;
|
|
3447
|
+
const HasManyThrough = has_many_through_default;
|
|
3448
|
+
const HasOne = has_one_default;
|
|
3449
|
+
const HasOneOrMany = has_one_or_many_default;
|
|
3450
|
+
const HasOneThrough = has_one_through_default;
|
|
3451
|
+
const Relation = relation_default;
|
|
3452
|
+
|
|
3453
|
+
//#endregion
|
|
3454
|
+
export { BelongsTo, BelongsToMany, HasMany, HasManyThrough, HasOne, HasOneOrMany, HasOneThrough, InteractsWithPivotTable, Relation, SupportsDefaultModels };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/arquebus",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
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": {
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
|
|
3
|
-
//#region rolldown:runtime
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __export = (all) => {
|
|
6
|
-
let target = {};
|
|
7
|
-
for (var name in all) __defProp(target, name, {
|
|
8
|
-
get: all[name],
|
|
9
|
-
enumerable: true
|
|
10
|
-
});
|
|
11
|
-
return target;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
//#endregion
|
|
15
|
-
export { __export as t };
|