nicot 1.4.1 → 1.4.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/dist/index.cjs +107 -53
- package/dist/index.cjs.map +4 -4
- package/dist/index.mjs +61 -7
- package/dist/index.mjs.map +4 -4
- package/dist/src/restful.d.ts +3 -3
- package/dist/src/utility/get-api-property.d.ts +3 -0
- package/dist/src/utility/patch-column-in-get.d.ts +1 -1
- package/dist/src/utility/swagger-decorators.d.ts +23 -0
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -3067,10 +3067,9 @@ function CrudService(entityClass, crudOptions = {}) {
|
|
|
3067
3067
|
|
|
3068
3068
|
// src/restful.ts
|
|
3069
3069
|
var import_common3 = require("@nestjs/common");
|
|
3070
|
-
var
|
|
3070
|
+
var import_nesties12 = require("nesties");
|
|
3071
3071
|
var import_swagger6 = require("@nestjs/swagger");
|
|
3072
3072
|
var import_lodash6 = __toESM(require("lodash"));
|
|
3073
|
-
var import_nesties14 = require("nesties");
|
|
3074
3073
|
|
|
3075
3074
|
// src/bases/base-restful-controller.ts
|
|
3076
3075
|
var RestfulMethods = [
|
|
@@ -3136,9 +3135,64 @@ var OmitTypeExclude = (cl, keys) => {
|
|
|
3136
3135
|
};
|
|
3137
3136
|
|
|
3138
3137
|
// src/utility/patch-column-in-get.ts
|
|
3139
|
-
var import_nesties12 = require("nesties");
|
|
3140
3138
|
var import_lodash5 = __toESM(require("lodash"));
|
|
3141
|
-
|
|
3139
|
+
|
|
3140
|
+
// src/utility/swagger-decorators.ts
|
|
3141
|
+
var DECORATORS_PREFIX = "swagger";
|
|
3142
|
+
var FALLBACK_DECORATORS = {
|
|
3143
|
+
API_OPERATION: `${DECORATORS_PREFIX}/apiOperation`,
|
|
3144
|
+
API_RESPONSE: `${DECORATORS_PREFIX}/apiResponse`,
|
|
3145
|
+
API_PRODUCES: `${DECORATORS_PREFIX}/apiProduces`,
|
|
3146
|
+
API_CONSUMES: `${DECORATORS_PREFIX}/apiConsumes`,
|
|
3147
|
+
API_TAGS: `${DECORATORS_PREFIX}/apiUseTags`,
|
|
3148
|
+
API_WEBHOOK: `${DECORATORS_PREFIX}/apiWebhook`,
|
|
3149
|
+
API_CALLBACKS: `${DECORATORS_PREFIX}/apiCallbacks`,
|
|
3150
|
+
API_PARAMETERS: `${DECORATORS_PREFIX}/apiParameters`,
|
|
3151
|
+
API_HEADERS: `${DECORATORS_PREFIX}/apiHeaders`,
|
|
3152
|
+
API_MODEL_PROPERTIES: `${DECORATORS_PREFIX}/apiModelProperties`,
|
|
3153
|
+
API_MODEL_PROPERTIES_ARRAY: `${DECORATORS_PREFIX}/apiModelPropertiesArray`,
|
|
3154
|
+
API_SECURITY: `${DECORATORS_PREFIX}/apiSecurity`,
|
|
3155
|
+
API_EXCLUDE_ENDPOINT: `${DECORATORS_PREFIX}/apiExcludeEndpoint`,
|
|
3156
|
+
API_INCLUDE_ENDPOINT: `${DECORATORS_PREFIX}/apiIncludeEndpoint`,
|
|
3157
|
+
API_EXCLUDE_CONTROLLER: `${DECORATORS_PREFIX}/apiExcludeController`,
|
|
3158
|
+
API_EXTRA_MODELS: `${DECORATORS_PREFIX}/apiExtraModels`,
|
|
3159
|
+
API_EXTENSION: `${DECORATORS_PREFIX}/apiExtension`,
|
|
3160
|
+
API_SCHEMA: `${DECORATORS_PREFIX}/apiSchema`,
|
|
3161
|
+
API_DEFAULT_GETTER: `${DECORATORS_PREFIX}/apiDefaultGetter`,
|
|
3162
|
+
API_LINK: `${DECORATORS_PREFIX}/apiLink`
|
|
3163
|
+
};
|
|
3164
|
+
function loadSwaggerDecorators() {
|
|
3165
|
+
try {
|
|
3166
|
+
const req = typeof require === "function" ? require : void 0;
|
|
3167
|
+
const decorators = req?.("@nestjs/swagger/dist/constants")?.DECORATORS;
|
|
3168
|
+
if (decorators) {
|
|
3169
|
+
return {
|
|
3170
|
+
...FALLBACK_DECORATORS,
|
|
3171
|
+
...decorators
|
|
3172
|
+
};
|
|
3173
|
+
}
|
|
3174
|
+
} catch {
|
|
3175
|
+
}
|
|
3176
|
+
return FALLBACK_DECORATORS;
|
|
3177
|
+
}
|
|
3178
|
+
var DECORATORS = loadSwaggerDecorators();
|
|
3179
|
+
|
|
3180
|
+
// src/utility/get-api-property.ts
|
|
3181
|
+
var getApiProperty = (cls, key) => {
|
|
3182
|
+
let proto = cls.prototype;
|
|
3183
|
+
while (proto && proto !== Object.prototype) {
|
|
3184
|
+
const meta = Reflect.getMetadata(
|
|
3185
|
+
DECORATORS.API_MODEL_PROPERTIES,
|
|
3186
|
+
proto,
|
|
3187
|
+
key
|
|
3188
|
+
);
|
|
3189
|
+
if (meta) return meta;
|
|
3190
|
+
proto = Object.getPrototypeOf(proto);
|
|
3191
|
+
}
|
|
3192
|
+
return {};
|
|
3193
|
+
};
|
|
3194
|
+
|
|
3195
|
+
// src/utility/patch-column-in-get.ts
|
|
3142
3196
|
var PatchColumnsInGet = (cl, originalCl = cl, fieldsToOmit = []) => {
|
|
3143
3197
|
const omit2 = new Set(fieldsToOmit);
|
|
3144
3198
|
const useCl = originalCl || cl;
|
|
@@ -3146,10 +3200,10 @@ var PatchColumnsInGet = (cl, originalCl = cl, fieldsToOmit = []) => {
|
|
|
3146
3200
|
(f) => !omit2.has(f)
|
|
3147
3201
|
);
|
|
3148
3202
|
for (const field of mutateFields) {
|
|
3149
|
-
const originalApiProp =
|
|
3203
|
+
const originalApiProp = getApiProperty(originalCl, field);
|
|
3150
3204
|
const info = reflector.get("getMutator", useCl, field);
|
|
3151
3205
|
Reflect.defineMetadata(
|
|
3152
|
-
|
|
3206
|
+
DECORATORS.API_MODEL_PROPERTIES,
|
|
3153
3207
|
{
|
|
3154
3208
|
...originalApiProp,
|
|
3155
3209
|
type: String,
|
|
@@ -3168,9 +3222,9 @@ var PatchColumnsInGet = (cl, originalCl = cl, fieldsToOmit = []) => {
|
|
|
3168
3222
|
mutateFields
|
|
3169
3223
|
);
|
|
3170
3224
|
for (const field of queryableFieldsRemaining) {
|
|
3171
|
-
const originalApiProp =
|
|
3225
|
+
const originalApiProp = getApiProperty(originalCl, field);
|
|
3172
3226
|
Reflect.defineMetadata(
|
|
3173
|
-
|
|
3227
|
+
DECORATORS.API_MODEL_PROPERTIES,
|
|
3174
3228
|
{
|
|
3175
3229
|
...originalApiProp,
|
|
3176
3230
|
default: void 0
|
|
@@ -3379,7 +3433,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3379
3433
|
]);
|
|
3380
3434
|
}
|
|
3381
3435
|
get createDto() {
|
|
3382
|
-
return (0,
|
|
3436
|
+
return (0, import_nesties12.RenameClass)(
|
|
3383
3437
|
OmitTypeExclude(this.entityClass, this.fieldsInCreateToOmit),
|
|
3384
3438
|
`Create${this.entityClassName}Dto`
|
|
3385
3439
|
);
|
|
@@ -3394,7 +3448,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3394
3448
|
]);
|
|
3395
3449
|
}
|
|
3396
3450
|
get updateDto() {
|
|
3397
|
-
return (0,
|
|
3451
|
+
return (0, import_nesties12.RenameClass)(
|
|
3398
3452
|
(0, import_swagger6.PartialType)(OmitTypeExclude(this.entityClass, this.fieldsInUpdateToOmit)),
|
|
3399
3453
|
`Update${this.entityClassName}Dto`
|
|
3400
3454
|
);
|
|
@@ -3409,7 +3463,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3409
3463
|
]);
|
|
3410
3464
|
}
|
|
3411
3465
|
get upsertDto() {
|
|
3412
|
-
return (0,
|
|
3466
|
+
return (0, import_nesties12.RenameClass)(
|
|
3413
3467
|
OmitTypeExclude(this.entityClass, this.fieldsInUpsertToOmit),
|
|
3414
3468
|
`Upsert${this.entityClassName}Dto`
|
|
3415
3469
|
);
|
|
@@ -3455,10 +3509,10 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3455
3509
|
if (this.options.skipNonQueryableFields) {
|
|
3456
3510
|
cl = (0, import_swagger6.PickType)(cl, this.queryableFields);
|
|
3457
3511
|
}
|
|
3458
|
-
return (0,
|
|
3512
|
+
return (0, import_nesties12.RenameClass)(cl, `Find${this.entityClassName}Dto`);
|
|
3459
3513
|
}
|
|
3460
3514
|
get findAllCursorPaginatedDto() {
|
|
3461
|
-
return (0,
|
|
3515
|
+
return (0, import_nesties12.RenameClass)(
|
|
3462
3516
|
(0, import_swagger6.IntersectionType)(
|
|
3463
3517
|
OmitTypeExclude(this.findAllDto, ["pageCount"]),
|
|
3464
3518
|
CursorPaginationDto
|
|
@@ -3486,7 +3540,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3486
3540
|
if (outputFieldsToOmit.has(relation.propertyName)) continue;
|
|
3487
3541
|
if (nonTransformableTypes.has(relation.propertyClass)) continue;
|
|
3488
3542
|
const replace = (useClass) => {
|
|
3489
|
-
const oldApiProperty =
|
|
3543
|
+
const oldApiProperty = getApiProperty(
|
|
3490
3544
|
this.entityClass,
|
|
3491
3545
|
relation.propertyName
|
|
3492
3546
|
);
|
|
@@ -3529,13 +3583,13 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3529
3583
|
"notRequiredButHasDefault"
|
|
3530
3584
|
).filter((f) => !outputFieldsToOmit.has(f));
|
|
3531
3585
|
for (const field of notRequiredButHasDefaultFields) {
|
|
3532
|
-
const oldApiProperty =
|
|
3586
|
+
const oldApiProperty = getApiProperty(resultDto, field);
|
|
3533
3587
|
(0, import_swagger6.ApiProperty)({
|
|
3534
3588
|
...oldApiProperty,
|
|
3535
3589
|
required: true
|
|
3536
3590
|
})(resultDto.prototype, field);
|
|
3537
3591
|
}
|
|
3538
|
-
const res = (0,
|
|
3592
|
+
const res = (0, import_nesties12.RenameClass)(
|
|
3539
3593
|
resultDto,
|
|
3540
3594
|
`${this.entityClassName}ResultDto`
|
|
3541
3595
|
);
|
|
@@ -3546,7 +3600,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3546
3600
|
return res;
|
|
3547
3601
|
}
|
|
3548
3602
|
get entityCreateResultDto() {
|
|
3549
|
-
return (0,
|
|
3603
|
+
return (0, import_nesties12.RenameClass)(
|
|
3550
3604
|
(0, import_swagger6.OmitType)(this.entityResultDto, [
|
|
3551
3605
|
...getTypeormRelations(this.entityClass).map(
|
|
3552
3606
|
(r) => r.propertyName
|
|
@@ -3561,7 +3615,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3561
3615
|
);
|
|
3562
3616
|
}
|
|
3563
3617
|
get entityUpsertResultDto() {
|
|
3564
|
-
return (0,
|
|
3618
|
+
return (0, import_nesties12.RenameClass)(
|
|
3565
3619
|
(0, import_swagger6.OmitType)(this.entityResultDto, [
|
|
3566
3620
|
...this.options.upsertIncludeRelations ? [] : getTypeormRelations(this.entityClass).map(
|
|
3567
3621
|
(r) => r.propertyName
|
|
@@ -3576,19 +3630,19 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3576
3630
|
);
|
|
3577
3631
|
}
|
|
3578
3632
|
get entityReturnMessageDto() {
|
|
3579
|
-
return (0,
|
|
3633
|
+
return (0, import_nesties12.ReturnMessageDto)(this.entityResultDto);
|
|
3580
3634
|
}
|
|
3581
3635
|
get entityCreateReturnMessageDto() {
|
|
3582
|
-
return (0,
|
|
3636
|
+
return (0, import_nesties12.ReturnMessageDto)(this.entityCreateResultDto);
|
|
3583
3637
|
}
|
|
3584
3638
|
get entityArrayReturnMessageDto() {
|
|
3585
|
-
return (0,
|
|
3639
|
+
return (0, import_nesties12.PaginatedReturnMessageDto)(this.entityResultDto);
|
|
3586
3640
|
}
|
|
3587
3641
|
get entityCursorPaginationReturnMessageDto() {
|
|
3588
3642
|
return CursorPaginationReturnMessageDto(this.entityResultDto);
|
|
3589
3643
|
}
|
|
3590
3644
|
get importReturnMessageDto() {
|
|
3591
|
-
return (0,
|
|
3645
|
+
return (0, import_nesties12.ReturnMessageDto)([ImportEntryDto(this.entityCreateResultDto)]);
|
|
3592
3646
|
}
|
|
3593
3647
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
3594
3648
|
get idType() {
|
|
@@ -3605,7 +3659,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3605
3659
|
}
|
|
3606
3660
|
}
|
|
3607
3661
|
create(extras = {}) {
|
|
3608
|
-
return (0,
|
|
3662
|
+
return (0, import_nesties12.MergeMethodDecorators)([
|
|
3609
3663
|
this.usePrefix(import_common3.Post, extras.prefix),
|
|
3610
3664
|
(0, import_common3.HttpCode)(200),
|
|
3611
3665
|
(0, import_swagger6.ApiOperation)({
|
|
@@ -3614,11 +3668,11 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3614
3668
|
}),
|
|
3615
3669
|
(0, import_swagger6.ApiBody)({ type: this.createDto }),
|
|
3616
3670
|
(0, import_swagger6.ApiOkResponse)({ type: this.entityCreateReturnMessageDto }),
|
|
3617
|
-
(0,
|
|
3671
|
+
(0, import_nesties12.ApiError)(400, `The ${this.entityClassName} is not valid`)
|
|
3618
3672
|
]);
|
|
3619
3673
|
}
|
|
3620
3674
|
createParam() {
|
|
3621
|
-
return (0, import_common3.Body)((0,
|
|
3675
|
+
return (0, import_common3.Body)((0, import_nesties12.DataPipe)(), OmitPipe(this.fieldsInCreateToOmit));
|
|
3622
3676
|
}
|
|
3623
3677
|
isUpsertable() {
|
|
3624
3678
|
return !!reflector.get("upsertableEntity", this.entityClass);
|
|
@@ -3629,7 +3683,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3629
3683
|
`Entity ${this.entityClass.name} is not upsertable. Please define at least one UpsertColumn or BindingColumn, and set @UpsertableEntity() decorator.`
|
|
3630
3684
|
);
|
|
3631
3685
|
}
|
|
3632
|
-
return (0,
|
|
3686
|
+
return (0, import_nesties12.MergeMethodDecorators)([
|
|
3633
3687
|
this.usePrefix(import_common3.Put, extras.prefix),
|
|
3634
3688
|
(0, import_common3.HttpCode)(200),
|
|
3635
3689
|
(0, import_swagger6.ApiOperation)({
|
|
@@ -3638,14 +3692,14 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3638
3692
|
}),
|
|
3639
3693
|
(0, import_swagger6.ApiBody)({ type: this.upsertDto }),
|
|
3640
3694
|
(0, import_swagger6.ApiOkResponse)({ type: this.entityUpsertResultDto }),
|
|
3641
|
-
(0,
|
|
3695
|
+
(0, import_nesties12.ApiError)(400, `The ${this.entityClassName} is not valid`)
|
|
3642
3696
|
]);
|
|
3643
3697
|
}
|
|
3644
3698
|
upsertParam() {
|
|
3645
|
-
return (0, import_common3.Body)((0,
|
|
3699
|
+
return (0, import_common3.Body)((0, import_nesties12.DataPipe)(), OmitPipe(this.fieldsInUpsertToOmit));
|
|
3646
3700
|
}
|
|
3647
3701
|
findOne(extras = {}) {
|
|
3648
|
-
return (0,
|
|
3702
|
+
return (0, import_nesties12.MergeMethodDecorators)([
|
|
3649
3703
|
this.usePrefix(import_common3.Get, extras.prefix, ":id"),
|
|
3650
3704
|
(0, import_swagger6.ApiOperation)({
|
|
3651
3705
|
summary: `Find a ${this.entityClassName} by id`,
|
|
@@ -3653,7 +3707,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3653
3707
|
}),
|
|
3654
3708
|
(0, import_swagger6.ApiParam)({ name: "id", type: this.idType, required: true }),
|
|
3655
3709
|
(0, import_swagger6.ApiOkResponse)({ type: this.entityReturnMessageDto }),
|
|
3656
|
-
(0,
|
|
3710
|
+
(0, import_nesties12.ApiError)(
|
|
3657
3711
|
404,
|
|
3658
3712
|
`The ${this.entityClassName} with the given id was not found`
|
|
3659
3713
|
)
|
|
@@ -3667,7 +3721,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3667
3721
|
}
|
|
3668
3722
|
}
|
|
3669
3723
|
findAll(extras = {}) {
|
|
3670
|
-
return (0,
|
|
3724
|
+
return (0, import_nesties12.MergeMethodDecorators)([
|
|
3671
3725
|
this.usePrefix(import_common3.Get, extras.prefix),
|
|
3672
3726
|
(0, import_swagger6.ApiOperation)({
|
|
3673
3727
|
summary: `Find all ${this.entityClassName}`,
|
|
@@ -3677,7 +3731,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3677
3731
|
]);
|
|
3678
3732
|
}
|
|
3679
3733
|
findAllCursorPaginated(extras = {}) {
|
|
3680
|
-
return (0,
|
|
3734
|
+
return (0, import_nesties12.MergeMethodDecorators)([
|
|
3681
3735
|
this.usePrefix(import_common3.Get, extras.prefix),
|
|
3682
3736
|
(0, import_swagger6.ApiOperation)({
|
|
3683
3737
|
summary: `Find all ${this.entityClassName}`,
|
|
@@ -3703,7 +3757,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3703
3757
|
}
|
|
3704
3758
|
}
|
|
3705
3759
|
update(extras = {}) {
|
|
3706
|
-
return (0,
|
|
3760
|
+
return (0, import_nesties12.MergeMethodDecorators)([
|
|
3707
3761
|
this.usePrefix(import_common3.Patch, extras.prefix, ":id"),
|
|
3708
3762
|
(0, import_common3.HttpCode)(200),
|
|
3709
3763
|
(0, import_swagger6.ApiOperation)({
|
|
@@ -3712,20 +3766,20 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3712
3766
|
}),
|
|
3713
3767
|
(0, import_swagger6.ApiParam)({ name: "id", type: this.idType, required: true }),
|
|
3714
3768
|
(0, import_swagger6.ApiBody)({ type: this.updateDto }),
|
|
3715
|
-
(0,
|
|
3716
|
-
(0,
|
|
3769
|
+
(0, import_nesties12.ApiBlankResponse)(),
|
|
3770
|
+
(0, import_nesties12.ApiError)(
|
|
3717
3771
|
404,
|
|
3718
3772
|
`The ${this.entityClassName} with the given id was not found`
|
|
3719
3773
|
),
|
|
3720
|
-
(0,
|
|
3721
|
-
(0,
|
|
3774
|
+
(0, import_nesties12.ApiError)(400, `The ${this.entityClassName} is not valid`),
|
|
3775
|
+
(0, import_nesties12.ApiError)(500, "Internal error")
|
|
3722
3776
|
]);
|
|
3723
3777
|
}
|
|
3724
3778
|
updateParam() {
|
|
3725
3779
|
return (0, import_common3.Body)(OptionalDataPipe(), OmitPipe(this.fieldsInUpdateToOmit));
|
|
3726
3780
|
}
|
|
3727
3781
|
delete(extras = {}) {
|
|
3728
|
-
return (0,
|
|
3782
|
+
return (0, import_nesties12.MergeMethodDecorators)([
|
|
3729
3783
|
this.usePrefix(import_common3.Delete, extras.prefix, ":id"),
|
|
3730
3784
|
(0, import_common3.HttpCode)(200),
|
|
3731
3785
|
(0, import_swagger6.ApiOperation)({
|
|
@@ -3733,16 +3787,16 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3733
3787
|
...import_lodash6.default.omit(extras, "prefix")
|
|
3734
3788
|
}),
|
|
3735
3789
|
(0, import_swagger6.ApiParam)({ name: "id", type: this.idType, required: true }),
|
|
3736
|
-
(0,
|
|
3737
|
-
(0,
|
|
3790
|
+
(0, import_nesties12.ApiBlankResponse)(),
|
|
3791
|
+
(0, import_nesties12.ApiError)(
|
|
3738
3792
|
404,
|
|
3739
3793
|
`The ${this.entityClassName} with the given id was not found`
|
|
3740
3794
|
),
|
|
3741
|
-
(0,
|
|
3795
|
+
(0, import_nesties12.ApiError)(500, "Internal error")
|
|
3742
3796
|
]);
|
|
3743
3797
|
}
|
|
3744
3798
|
import(extras = {}) {
|
|
3745
|
-
return (0,
|
|
3799
|
+
return (0, import_nesties12.MergeMethodDecorators)([
|
|
3746
3800
|
this.usePrefix(import_common3.Post, extras.prefix, "import"),
|
|
3747
3801
|
(0, import_common3.HttpCode)(200),
|
|
3748
3802
|
(0, import_swagger6.ApiOperation)({
|
|
@@ -3751,19 +3805,19 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3751
3805
|
}),
|
|
3752
3806
|
(0, import_swagger6.ApiBody)({ type: this.importDto }),
|
|
3753
3807
|
(0, import_swagger6.ApiOkResponse)({ type: this.importReturnMessageDto }),
|
|
3754
|
-
(0,
|
|
3808
|
+
(0, import_nesties12.ApiError)(500, "Internal error")
|
|
3755
3809
|
]);
|
|
3756
3810
|
}
|
|
3757
3811
|
operation(operationName, options = {}) {
|
|
3758
|
-
return (0,
|
|
3812
|
+
return (0, import_nesties12.MergeMethodDecorators)([
|
|
3759
3813
|
this.usePrefix(import_common3.Post, options.prefix, ":id", operationName),
|
|
3760
3814
|
(0, import_common3.HttpCode)(200),
|
|
3761
3815
|
(0, import_swagger6.ApiOperation)({
|
|
3762
3816
|
summary: `${(0, import_lodash6.upperFirst)(operationName)} a ${this.entityClassName} by id`,
|
|
3763
3817
|
...import_lodash6.default.omit(options, "prefix", "returnType")
|
|
3764
3818
|
}),
|
|
3765
|
-
options.returnType ? (0,
|
|
3766
|
-
(0,
|
|
3819
|
+
options.returnType ? (0, import_nesties12.ApiTypeResponse)(options.returnType) : (0, import_nesties12.ApiBlankResponse)(),
|
|
3820
|
+
(0, import_nesties12.ApiError)(
|
|
3767
3821
|
404,
|
|
3768
3822
|
`The ${this.entityClassName} with the given id pessimistic_write`
|
|
3769
3823
|
)
|
|
@@ -3888,7 +3942,7 @@ var _RestfulFactory = class _RestfulFactory {
|
|
|
3888
3942
|
Object.defineProperty(cl.prototype, method, descriptor);
|
|
3889
3943
|
});
|
|
3890
3944
|
}
|
|
3891
|
-
return (0,
|
|
3945
|
+
return (0, import_nesties12.RenameClass)(cl, `${this.entityClassName}Controller`);
|
|
3892
3946
|
}
|
|
3893
3947
|
crudService(options = {}) {
|
|
3894
3948
|
const keysToMigrate = [
|
|
@@ -3969,7 +4023,7 @@ __decorateClass([
|
|
|
3969
4023
|
var RestfulFactory = _RestfulFactory;
|
|
3970
4024
|
|
|
3971
4025
|
// src/utility/query.ts
|
|
3972
|
-
var
|
|
4026
|
+
var import_nesties13 = require("nesties");
|
|
3973
4027
|
function createQueryCondition(cond) {
|
|
3974
4028
|
return (obj, qb, entityName, ...fields) => {
|
|
3975
4029
|
for (const field of fields) {
|
|
@@ -4013,7 +4067,7 @@ var applyQueryPropertyZeroNullable = createQueryCondition(
|
|
|
4013
4067
|
);
|
|
4014
4068
|
var applyQueryMatchBoolean = createQueryCondition(
|
|
4015
4069
|
(obj, qb, entityName, field) => {
|
|
4016
|
-
const value = (0,
|
|
4070
|
+
const value = (0, import_nesties13.parseBool)(obj[field]);
|
|
4017
4071
|
if (value === true) {
|
|
4018
4072
|
qb.andWhere(`${entityName}.${field} = TRUE`);
|
|
4019
4073
|
}
|
|
@@ -4024,7 +4078,7 @@ var applyQueryMatchBoolean = createQueryCondition(
|
|
|
4024
4078
|
);
|
|
4025
4079
|
var applyQueryMatchBooleanMySQL = createQueryCondition(
|
|
4026
4080
|
(obj, qb, entityName, field) => {
|
|
4027
|
-
const value = (0,
|
|
4081
|
+
const value = (0, import_nesties13.parseBool)(obj[field]);
|
|
4028
4082
|
if (value === true) {
|
|
4029
4083
|
qb.andWhere(`${entityName}.${field} = 1`);
|
|
4030
4084
|
}
|
|
@@ -4038,7 +4092,7 @@ var applyQueryMatchBooleanMySQL = createQueryCondition(
|
|
|
4038
4092
|
var import_typeorm9 = __toESM(require_typeorm());
|
|
4039
4093
|
var import_typeorm10 = require("typeorm");
|
|
4040
4094
|
var import_common5 = require("@nestjs/common");
|
|
4041
|
-
var
|
|
4095
|
+
var import_nesties14 = require("nesties");
|
|
4042
4096
|
var import_core = require("@nestjs/core");
|
|
4043
4097
|
|
|
4044
4098
|
// src/utility/create-dynamic-fetcher-proxy.ts
|
|
@@ -4150,7 +4204,7 @@ var TransactionalTypeOrmInterceptor = (dataSource) => {
|
|
|
4150
4204
|
return interceptorClass;
|
|
4151
4205
|
};
|
|
4152
4206
|
var getTransactionalEntityManagerToken = (dataSource) => `Transactional${normalizeDataSourceToken((0, import_typeorm9.getEntityManagerToken)(dataSource))}`;
|
|
4153
|
-
var getTransactionalEntityManagerProvider = (dataSource) => (0,
|
|
4207
|
+
var getTransactionalEntityManagerProvider = (dataSource) => (0, import_nesties14.createProvider)(
|
|
4154
4208
|
{
|
|
4155
4209
|
provide: getTransactionalEntityManagerToken(dataSource),
|
|
4156
4210
|
inject: [(0, import_typeorm9.getEntityManagerToken)(dataSource), import_core.REQUEST],
|
|
@@ -4172,7 +4226,7 @@ var InjectTransactionalEntityManager = createInjectFromTokenFactory(
|
|
|
4172
4226
|
var getTransactionalRepositoryToken = (entity, dataSource) => `Transactional${normalizeDataSourceToken(
|
|
4173
4227
|
(0, import_typeorm9.getEntityManagerToken)(dataSource)
|
|
4174
4228
|
)}Repository_${entity.name || entity.toString()}`;
|
|
4175
|
-
var getTransactionalRepositoryProvider = (entity, dataSource) => (0,
|
|
4229
|
+
var getTransactionalRepositoryProvider = (entity, dataSource) => (0, import_nesties14.createProvider)(
|
|
4176
4230
|
{
|
|
4177
4231
|
provide: getTransactionalRepositoryToken(entity, dataSource),
|
|
4178
4232
|
inject: [(0, import_typeorm9.getEntityManagerToken)(dataSource), import_core.REQUEST],
|