@ttoss/postgresdb 0.2.7 → 0.2.8
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/dist/esm/index.js +46 -45
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -16,12 +16,6 @@ var __commonJS = (cb, mod) => function __require2() {
|
|
|
16
16
|
exports: {}
|
|
17
17
|
}).exports, mod), mod.exports;
|
|
18
18
|
};
|
|
19
|
-
var __export = (target, all) => {
|
|
20
|
-
for (var name in all) __defProp(target, name, {
|
|
21
|
-
get: all[name],
|
|
22
|
-
enumerable: true
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
19
|
var __copyProps = (to, from, except, desc) => {
|
|
26
20
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
21
|
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
@@ -31,7 +25,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
31
25
|
}
|
|
32
26
|
return to;
|
|
33
27
|
};
|
|
34
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
35
28
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
36
29
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
37
30
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -1198,14 +1191,14 @@ var require_belongs_to = __commonJS({
|
|
|
1198
1191
|
exports.BelongsTo = void 0;
|
|
1199
1192
|
var belongs_to_association_1 = require_belongs_to_association();
|
|
1200
1193
|
var association_service_1 = require_association_service();
|
|
1201
|
-
function
|
|
1194
|
+
function BelongsTo2(associatedClassGetter, optionsOrForeignKey) {
|
|
1202
1195
|
return (target, propertyName) => {
|
|
1203
1196
|
const options = (0, association_service_1.getPreparedAssociationOptions)(optionsOrForeignKey);
|
|
1204
1197
|
if (!options.as) options.as = propertyName;
|
|
1205
1198
|
(0, association_service_1.addAssociation)(target, new belongs_to_association_1.BelongsToAssociation(associatedClassGetter, options));
|
|
1206
1199
|
};
|
|
1207
1200
|
}
|
|
1208
|
-
exports.BelongsTo =
|
|
1201
|
+
exports.BelongsTo = BelongsTo2;
|
|
1209
1202
|
}
|
|
1210
1203
|
});
|
|
1211
1204
|
|
|
@@ -1290,7 +1283,7 @@ var require_belongs_to_many = __commonJS({
|
|
|
1290
1283
|
exports.BelongsToMany = void 0;
|
|
1291
1284
|
var belongs_to_many_association_1 = require_belongs_to_many_association();
|
|
1292
1285
|
var association_service_1 = require_association_service();
|
|
1293
|
-
function
|
|
1286
|
+
function BelongsToMany2(associatedClassGetter, throughOrOptions, foreignKey, otherKey) {
|
|
1294
1287
|
return (target, propertyName) => {
|
|
1295
1288
|
let options = {
|
|
1296
1289
|
foreignKey,
|
|
@@ -1305,7 +1298,7 @@ var require_belongs_to_many = __commonJS({
|
|
|
1305
1298
|
(0, association_service_1.addAssociation)(target, new belongs_to_many_association_1.BelongsToManyAssociation(associatedClassGetter, options));
|
|
1306
1299
|
};
|
|
1307
1300
|
}
|
|
1308
|
-
exports.BelongsToMany =
|
|
1301
|
+
exports.BelongsToMany = BelongsToMany2;
|
|
1309
1302
|
}
|
|
1310
1303
|
});
|
|
1311
1304
|
|
|
@@ -1330,12 +1323,12 @@ var require_foreign_key = __commonJS({
|
|
|
1330
1323
|
});
|
|
1331
1324
|
exports.ForeignKey = void 0;
|
|
1332
1325
|
var foreign_key_service_1 = require_foreign_key_service();
|
|
1333
|
-
function
|
|
1326
|
+
function ForeignKey2(relatedClassGetter) {
|
|
1334
1327
|
return (target, propertyName) => {
|
|
1335
1328
|
(0, foreign_key_service_1.addForeignKey)(target, relatedClassGetter, propertyName);
|
|
1336
1329
|
};
|
|
1337
1330
|
}
|
|
1338
|
-
exports.ForeignKey =
|
|
1331
|
+
exports.ForeignKey = ForeignKey2;
|
|
1339
1332
|
}
|
|
1340
1333
|
});
|
|
1341
1334
|
|
|
@@ -1382,14 +1375,14 @@ var require_has_one = __commonJS({
|
|
|
1382
1375
|
var has_association_1 = require_has_association();
|
|
1383
1376
|
var association_service_1 = require_association_service();
|
|
1384
1377
|
var association_1 = require_association();
|
|
1385
|
-
function
|
|
1378
|
+
function HasOne2(associatedClassGetter, optionsOrForeignKey) {
|
|
1386
1379
|
return (target, propertyName) => {
|
|
1387
1380
|
const options = (0, association_service_1.getPreparedAssociationOptions)(optionsOrForeignKey);
|
|
1388
1381
|
if (!options.as) options.as = propertyName;
|
|
1389
1382
|
(0, association_service_1.addAssociation)(target, new has_association_1.HasAssociation(associatedClassGetter, options, association_1.Association.HasOne));
|
|
1390
1383
|
};
|
|
1391
1384
|
}
|
|
1392
|
-
exports.HasOne =
|
|
1385
|
+
exports.HasOne = HasOne2;
|
|
1393
1386
|
}
|
|
1394
1387
|
});
|
|
1395
1388
|
|
|
@@ -1405,14 +1398,14 @@ var require_has_many = __commonJS({
|
|
|
1405
1398
|
var has_association_1 = require_has_association();
|
|
1406
1399
|
var association_service_1 = require_association_service();
|
|
1407
1400
|
var association_1 = require_association();
|
|
1408
|
-
function
|
|
1401
|
+
function HasMany2(associatedClassGetter, optionsOrForeignKey) {
|
|
1409
1402
|
return (target, propertyName) => {
|
|
1410
1403
|
const options = (0, association_service_1.getPreparedAssociationOptions)(optionsOrForeignKey);
|
|
1411
1404
|
if (!options.as) options.as = propertyName;
|
|
1412
1405
|
(0, association_service_1.addAssociation)(target, new has_association_1.HasAssociation(associatedClassGetter, options, association_1.Association.HasMany));
|
|
1413
1406
|
};
|
|
1414
1407
|
}
|
|
1415
|
-
exports.HasMany =
|
|
1408
|
+
exports.HasMany = HasMany2;
|
|
1416
1409
|
}
|
|
1417
1410
|
});
|
|
1418
1411
|
|
|
@@ -2527,7 +2520,7 @@ var require_model = __commonJS({
|
|
|
2527
2520
|
var alias_inference_service_1 = require_alias_inference_service();
|
|
2528
2521
|
var model_not_initialized_error_1 = require_model_not_initialized_error();
|
|
2529
2522
|
var object_1 = require_object();
|
|
2530
|
-
var
|
|
2523
|
+
var Model2 = class extends sequelize_1.Model {
|
|
2531
2524
|
constructor(values, options) {
|
|
2532
2525
|
if (!new.target.isInitialized) {
|
|
2533
2526
|
throw new model_not_initialized_error_1.ModelNotInitializedError(new.target, `${new.target.name} cannot be instantiated.`);
|
|
@@ -2585,8 +2578,8 @@ var require_model = __commonJS({
|
|
|
2585
2578
|
return super.reload((0, alias_inference_service_1.inferAlias)(options, this));
|
|
2586
2579
|
}
|
|
2587
2580
|
};
|
|
2588
|
-
exports.Model =
|
|
2589
|
-
|
|
2581
|
+
exports.Model = Model2;
|
|
2582
|
+
Model2.isInitialized = false;
|
|
2590
2583
|
exports.INFER_ALIAS_MAP = {
|
|
2591
2584
|
bulkBuild: 1,
|
|
2592
2585
|
build: 1,
|
|
@@ -2619,8 +2612,8 @@ var require_model = __commonJS({
|
|
|
2619
2612
|
}
|
|
2620
2613
|
function addThrowNotInitializedProxy() {
|
|
2621
2614
|
staticModelFunctionProperties.forEach(key => {
|
|
2622
|
-
const superFn =
|
|
2623
|
-
|
|
2615
|
+
const superFn = Model2[key];
|
|
2616
|
+
Model2[key] = function (...args) {
|
|
2624
2617
|
if (!this.isInitialized) {
|
|
2625
2618
|
throw new model_not_initialized_error_1.ModelNotInitializedError(this, `Member "${key}" cannot be called.`);
|
|
2626
2619
|
}
|
|
@@ -2631,8 +2624,8 @@ var require_model = __commonJS({
|
|
|
2631
2624
|
function addInferAliasOverrides() {
|
|
2632
2625
|
Object.keys(exports.INFER_ALIAS_MAP).forEach(key => {
|
|
2633
2626
|
const optionIndex = exports.INFER_ALIAS_MAP[key];
|
|
2634
|
-
const superFn =
|
|
2635
|
-
|
|
2627
|
+
const superFn = Model2[key];
|
|
2628
|
+
Model2[key] = function (...args) {
|
|
2636
2629
|
args[optionIndex] = (0, alias_inference_service_1.inferAlias)(args[optionIndex], this);
|
|
2637
2630
|
return superFn.call(this, ...args);
|
|
2638
2631
|
};
|
|
@@ -2763,13 +2756,13 @@ var require_created_at = __commonJS({
|
|
|
2763
2756
|
});
|
|
2764
2757
|
exports.CreatedAt = void 0;
|
|
2765
2758
|
var model_service_1 = require_model_service();
|
|
2766
|
-
function
|
|
2759
|
+
function CreatedAt2(target, propertyName) {
|
|
2767
2760
|
(0, model_service_1.addOptions)(target, {
|
|
2768
2761
|
createdAt: propertyName,
|
|
2769
2762
|
timestamps: true
|
|
2770
2763
|
});
|
|
2771
2764
|
}
|
|
2772
|
-
exports.CreatedAt =
|
|
2765
|
+
exports.CreatedAt = CreatedAt2;
|
|
2773
2766
|
}
|
|
2774
2767
|
});
|
|
2775
2768
|
|
|
@@ -2783,14 +2776,14 @@ var require_deleted_at = __commonJS({
|
|
|
2783
2776
|
});
|
|
2784
2777
|
exports.DeletedAt = void 0;
|
|
2785
2778
|
var model_service_1 = require_model_service();
|
|
2786
|
-
function
|
|
2779
|
+
function DeletedAt2(target, propertyName) {
|
|
2787
2780
|
(0, model_service_1.addOptions)(target, {
|
|
2788
2781
|
deletedAt: propertyName,
|
|
2789
2782
|
timestamps: true,
|
|
2790
2783
|
paranoid: true
|
|
2791
2784
|
});
|
|
2792
2785
|
}
|
|
2793
|
-
exports.DeletedAt =
|
|
2786
|
+
exports.DeletedAt = DeletedAt2;
|
|
2794
2787
|
}
|
|
2795
2788
|
});
|
|
2796
2789
|
|
|
@@ -2804,13 +2797,13 @@ var require_updated_at = __commonJS({
|
|
|
2804
2797
|
});
|
|
2805
2798
|
exports.UpdatedAt = void 0;
|
|
2806
2799
|
var model_service_1 = require_model_service();
|
|
2807
|
-
function
|
|
2800
|
+
function UpdatedAt2(target, propertyName) {
|
|
2808
2801
|
(0, model_service_1.addOptions)(target, {
|
|
2809
2802
|
updatedAt: propertyName,
|
|
2810
2803
|
timestamps: true
|
|
2811
2804
|
});
|
|
2812
2805
|
}
|
|
2813
|
-
exports.UpdatedAt =
|
|
2806
|
+
exports.UpdatedAt = UpdatedAt2;
|
|
2814
2807
|
}
|
|
2815
2808
|
});
|
|
2816
2809
|
|
|
@@ -2826,7 +2819,7 @@ var require_column = __commonJS({
|
|
|
2826
2819
|
var attribute_service_1 = require_attribute_service();
|
|
2827
2820
|
var data_type_service_1 = require_data_type_service();
|
|
2828
2821
|
var model_service_1 = require_model_service();
|
|
2829
|
-
function
|
|
2822
|
+
function Column2(...args) {
|
|
2830
2823
|
if (args.length >= 2) {
|
|
2831
2824
|
const target = args[0];
|
|
2832
2825
|
const propertyName = args[1];
|
|
@@ -2838,7 +2831,7 @@ var require_column = __commonJS({
|
|
|
2838
2831
|
annotate(target, propertyName, propertyDescriptor !== null && propertyDescriptor !== void 0 ? propertyDescriptor : Object.getOwnPropertyDescriptor(target, propertyName), args[0]);
|
|
2839
2832
|
};
|
|
2840
2833
|
}
|
|
2841
|
-
exports.Column =
|
|
2834
|
+
exports.Column = Column2;
|
|
2842
2835
|
function annotate(target, propertyName, propertyDescriptor, optionsOrDataType = {}) {
|
|
2843
2836
|
let options;
|
|
2844
2837
|
if ((0, data_type_service_1.isDataType)(optionsOrDataType)) {
|
|
@@ -2907,7 +2900,7 @@ var require_table = __commonJS({
|
|
|
2907
2900
|
});
|
|
2908
2901
|
exports.Table = void 0;
|
|
2909
2902
|
var model_service_1 = require_model_service();
|
|
2910
|
-
function
|
|
2903
|
+
function Table2(arg) {
|
|
2911
2904
|
if (typeof arg === "function") {
|
|
2912
2905
|
annotate(arg);
|
|
2913
2906
|
} else {
|
|
@@ -2915,7 +2908,7 @@ var require_table = __commonJS({
|
|
|
2915
2908
|
return target => annotate(target, options);
|
|
2916
2909
|
}
|
|
2917
2910
|
}
|
|
2918
|
-
exports.Table =
|
|
2911
|
+
exports.Table = Table2;
|
|
2919
2912
|
function annotate(target, options = {}) {
|
|
2920
2913
|
(0, model_service_1.setModelName)(target.prototype, options.modelName || target.name);
|
|
2921
2914
|
(0, model_service_1.addOptions)(target.prototype, options);
|
|
@@ -3026,7 +3019,7 @@ var require_index_decorator = __commonJS({
|
|
|
3026
3019
|
});
|
|
3027
3020
|
exports.annotateModelWithIndex = exports.Index = void 0;
|
|
3028
3021
|
var index_service_1 = require_index_service();
|
|
3029
|
-
function
|
|
3022
|
+
function Index2(...args) {
|
|
3030
3023
|
if (args.length >= 2) {
|
|
3031
3024
|
const [target, propertyName] = args;
|
|
3032
3025
|
annotateModelWithIndex(target, propertyName);
|
|
@@ -3036,7 +3029,7 @@ var require_index_decorator = __commonJS({
|
|
|
3036
3029
|
annotateModelWithIndex(target, propertyName, args[0]);
|
|
3037
3030
|
};
|
|
3038
3031
|
}
|
|
3039
|
-
exports.Index =
|
|
3032
|
+
exports.Index = Index2;
|
|
3040
3033
|
function annotateModelWithIndex(target, propertyName, optionsOrName = {}, indexId) {
|
|
3041
3034
|
let indexOptions;
|
|
3042
3035
|
let fieldOptions;
|
|
@@ -6570,16 +6563,10 @@ var require_dist = __commonJS({
|
|
|
6570
6563
|
}
|
|
6571
6564
|
});
|
|
6572
6565
|
|
|
6573
|
-
// src/
|
|
6574
|
-
var
|
|
6575
|
-
__export(src_exports, {
|
|
6576
|
-
Op: () => Op,
|
|
6577
|
-
initialize: () => initialize
|
|
6578
|
-
});
|
|
6579
|
-
__reExport(src_exports, __toESM(require_dist(), 1));
|
|
6566
|
+
// src/sequelize-typescript.ts
|
|
6567
|
+
var import_sequelize_typescript = __toESM(require_dist(), 1);
|
|
6580
6568
|
|
|
6581
6569
|
// src/initialize.ts
|
|
6582
|
-
var import_sequelize_typescript = __toESM(require_dist(), 1);
|
|
6583
6570
|
var sequelize;
|
|
6584
6571
|
var initialize = async ({
|
|
6585
6572
|
models,
|
|
@@ -6617,7 +6604,21 @@ var initialize = async ({
|
|
|
6617
6604
|
|
|
6618
6605
|
// src/index.ts
|
|
6619
6606
|
import { Op } from "sequelize";
|
|
6620
|
-
|
|
6607
|
+
var export_BelongsTo = import_sequelize_typescript.BelongsTo;
|
|
6608
|
+
var export_BelongsToMany = import_sequelize_typescript.BelongsToMany;
|
|
6609
|
+
var export_Column = import_sequelize_typescript.Column;
|
|
6610
|
+
var export_CreatedAt = import_sequelize_typescript.CreatedAt;
|
|
6611
|
+
var export_DataType = import_sequelize_typescript.DataType;
|
|
6612
|
+
var export_DeletedAt = import_sequelize_typescript.DeletedAt;
|
|
6613
|
+
var export_ForeignKey = import_sequelize_typescript.ForeignKey;
|
|
6614
|
+
var export_HasMany = import_sequelize_typescript.HasMany;
|
|
6615
|
+
var export_HasOne = import_sequelize_typescript.HasOne;
|
|
6616
|
+
var export_Index = import_sequelize_typescript.Index;
|
|
6617
|
+
var export_Model = import_sequelize_typescript.Model;
|
|
6618
|
+
var export_Sequelize = import_sequelize_typescript.Sequelize;
|
|
6619
|
+
var export_Table = import_sequelize_typescript.Table;
|
|
6620
|
+
var export_UpdatedAt = import_sequelize_typescript.UpdatedAt;
|
|
6621
|
+
export { export_BelongsTo as BelongsTo, export_BelongsToMany as BelongsToMany, export_Column as Column, export_CreatedAt as CreatedAt, export_DataType as DataType, export_DeletedAt as DeletedAt, export_ForeignKey as ForeignKey, export_HasMany as HasMany, export_HasOne as HasOne, export_Index as Index, export_Model as Model, Op, export_Sequelize as Sequelize, export_Table as Table, export_UpdatedAt as UpdatedAt, initialize };
|
|
6621
6622
|
/*! Bundled license information:
|
|
6622
6623
|
|
|
6623
6624
|
reflect-metadata/Reflect.js:
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModelCtor, Sequelize, SequelizeOptions, Model } from 'sequelize-typescript';
|
|
2
|
-
export
|
|
2
|
+
export { BelongsTo, BelongsToMany, Column, CreatedAt, DataType, DeletedAt, ForeignKey, HasMany, HasOne, Index, Model, ModelCtor, Sequelize, SequelizeOptions, Table, UpdatedAt } from 'sequelize-typescript';
|
|
3
3
|
export { Op } from 'sequelize';
|
|
4
4
|
|
|
5
5
|
type Options<Models> = Omit<SequelizeOptions, 'models' | 'dialect'> & {
|