@triproject/nestjs-core 1.0.43 → 1.0.46

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.
@@ -46,9 +46,9 @@ _ts_decorate([
46
46
  (0, _common.Inject)(_cache.AppCache),
47
47
  _ts_metadata("design:type", void 0 === _cache.AppCache ? Object : _cache.AppCache)
48
48
  ], AppController.prototype, "appCache", void 0), AppController = _ts_decorate([
49
- _swaggerhelper.SwaggerApiInternalServerErrorResponse,
50
- _swaggerhelper.SwaggerApiBadSwaGatewayResponse,
51
- _swaggerhelper.SwaggerApiConflictResponse,
52
- _swaggerhelper.SwaggerApiForbiddenResponse,
53
- _swaggerhelper.SwaggerApiUnauthorizedResponse
49
+ (0, _swaggerhelper.SwaggerApiInternalServerErrorResponse)(),
50
+ (0, _swaggerhelper.SwaggerApiBadSwaGatewayResponse)(),
51
+ (0, _swaggerhelper.SwaggerApiConflictResponse)(),
52
+ (0, _swaggerhelper.SwaggerApiForbiddenResponse)(),
53
+ (0, _swaggerhelper.SwaggerApiUnauthorizedResponse)()
54
54
  ], AppController);
@@ -182,7 +182,9 @@ let BasePaginateRequest = class BasePaginateRequest {
182
182
  _ts_decorate([
183
183
  (0, _swagger.ApiProperty)({
184
184
  example: 10,
185
- description: 'Number of items per page'
185
+ description: 'Number of items per page',
186
+ required: !1,
187
+ type: Number
186
188
  }),
187
189
  (0, _classvalidator.IsOptional)(),
188
190
  (0, _classvalidator.IsNumber)(),
@@ -190,7 +192,9 @@ _ts_decorate([
190
192
  ], BasePaginateRequest.prototype, "perPage", void 0), _ts_decorate([
191
193
  (0, _swagger.ApiProperty)({
192
194
  example: 'search query',
193
- description: 'Search query'
195
+ description: 'Search query',
196
+ required: !1,
197
+ type: String
194
198
  }),
195
199
  (0, _classvalidator.IsOptional)(),
196
200
  (0, _classvalidator.IsString)(),
@@ -198,10 +202,12 @@ _ts_decorate([
198
202
  ], BasePaginateRequest.prototype, "q", void 0), _ts_decorate([
199
203
  (0, _swagger.ApiProperty)({
200
204
  example: 'createdAt',
201
- description: 'Order by field'
205
+ description: 'Order by field',
206
+ required: !1,
207
+ type: String
202
208
  }),
203
- (0, _classvalidator.IsString)(),
204
209
  (0, _classvalidator.IsOptional)(),
210
+ (0, _classvalidator.IsString)(),
205
211
  _ts_metadata("design:type", "u" < typeof KeyOfModel ? Object : KeyOfModel)
206
212
  ], BasePaginateRequest.prototype, "orderBy", void 0), _ts_decorate([
207
213
  (0, _swagger.ApiProperty)({
@@ -210,8 +216,11 @@ _ts_decorate([
210
216
  'ASC',
211
217
  'DESC'
212
218
  ],
213
- description: 'Sort order'
219
+ description: 'Sort order',
220
+ required: !1,
221
+ type: String
214
222
  }),
223
+ (0, _classvalidator.IsOptional)(),
215
224
  (0, _classvalidator.IsEnum)([
216
225
  'ASC',
217
226
  'DESC'
@@ -224,7 +233,9 @@ let PaginateRequest = class PaginateRequest extends BasePaginateRequest {
224
233
  _ts_decorate([
225
234
  (0, _swagger.ApiProperty)({
226
235
  example: 1,
227
- description: 'Current page number'
236
+ description: 'Current page number',
237
+ required: !1,
238
+ type: Number
228
239
  }),
229
240
  (0, _classvalidator.IsOptional)(),
230
241
  (0, _classvalidator.IsNumber)(),
@@ -333,7 +344,9 @@ function SchedulerCol() {
333
344
  _ts_decorate([
334
345
  (0, _swagger.ApiProperty)({
335
346
  example: 'cursor_string',
336
- description: 'Cursor string for pagination'
347
+ description: 'Cursor string for pagination',
348
+ required: !1,
349
+ type: String
337
350
  }),
338
351
  (0, _classvalidator.IsOptional)(),
339
352
  (0, _classvalidator.IsString)(),
@@ -19,26 +19,28 @@ export declare class Repository<M extends Model<M, Partial<M>> & {
19
19
  label: string;
20
20
  value: string | number;
21
21
  }>(params: PaginateRequest<M>, mapInto: (data: M) => P): Promise<P[]>;
22
- protected paginate<P>(params: PaginateRequest<M>, mapInto?: (data: M) => P): Promise<PaginateResponse<P | M>>;
23
- protected paginateCursor<P>(params: PaginateCursorRequest<M>, mapInto?: (data: M) => P): Promise<PaginateCursorResponse<P | M>>;
24
- protected export(params: PaginateRequest<M>): Promise<M[]>;
25
- protected export(params: PaginateRequest<M>, mapInto?: (data: M) => string[]): Promise<string[][]>;
26
- protected updateOrCreate(values: CreationAttributes<M>, whereOptions: WhereOptions<M>, options?: CreateOptions<M> | UpdateOptions<M>): Promise<M>;
27
- protected findAll(options?: FindOptions<M>): Promise<M[]>;
28
- protected findAndCountAll(options: FindAndCountOptions<M>): Promise<{
22
+ protected _paginate<P>(params: PaginateRequest<M>): Promise<PaginateResponse<M>>;
23
+ protected _paginate<P>(params: PaginateRequest<M>, mapInto: new (data: M) => P): Promise<PaginateResponse<P>>;
24
+ protected _paginateCursor(params: PaginateCursorRequest<M>): Promise<PaginateCursorResponse<M>>;
25
+ protected _paginateCursor<P>(params: PaginateCursorRequest<M>, mapInto: new (data: M) => P): Promise<PaginateCursorResponse<P>>;
26
+ protected _export(params: PaginateRequest<M>): Promise<M[]>;
27
+ protected _export(params: PaginateRequest<M>, mapInto: new (data: M) => string[]): Promise<string[][]>;
28
+ protected _updateOrCreate(values: CreationAttributes<M>, whereOptions: WhereOptions<M>, options?: CreateOptions<M> | UpdateOptions<M>): Promise<M>;
29
+ protected _findAll(options?: FindOptions<M>): Promise<M[]>;
30
+ protected _findAndCountAll(options: FindAndCountOptions<M>): Promise<{
29
31
  rows: M[];
30
32
  count: number;
31
33
  }>;
32
- protected findOne(options: FindOptions<M>): Promise<M | null>;
33
- protected create(values: CreationAttributes<M>, options?: CreateOptions<M>): Promise<M>;
34
- protected update(entity: M | string | number, values: Partial<M>, options?: Partial<UpdateOptions<M>>): Promise<M>;
35
- protected upsert(values: CreationAttributes<M>, options?: Partial<UpsertOptions<Attributes<M>>>): Promise<[M, boolean | null]>;
36
- protected bulkUpdate(values: Partial<M>, options: UpdateOptions<M>): Promise<[number]>;
37
- protected bulkCreate(values: ReadonlyArray<CreationAttributes<M>>, options?: BulkCreateOptions<M>): Promise<M[]>;
38
- protected destroy(options: DestroyOptions<M>): Promise<number>;
39
- protected sum(field: keyof Attributes<M>, options?: AggregateOptions<M>): Promise<number>;
40
- protected sumField(params: PaginateRequest<M>, field: keyof Attributes<M>): Promise<number>;
41
- protected sumCol(params: PaginateRequest<M>, fieldToSum: string, expectedField: string): Promise<number>;
42
- protected count(options: FindOptions<M>): Promise<number>;
34
+ protected _findOne(options: FindOptions<M>): Promise<M | null>;
35
+ protected _create(values: CreationAttributes<M>, options?: CreateOptions<M>): Promise<M>;
36
+ protected _update(entity: M | string | number, values: Partial<M>, options?: Partial<UpdateOptions<M>>): Promise<M>;
37
+ protected _upsert(values: CreationAttributes<M>, options?: Partial<UpsertOptions<Attributes<M>>>): Promise<[M, boolean | null]>;
38
+ protected _bulkUpdate(values: Partial<M>, options: UpdateOptions<M>): Promise<[number]>;
39
+ protected _bulkCreate(values: ReadonlyArray<CreationAttributes<M>>, options?: BulkCreateOptions<M>): Promise<M[]>;
40
+ protected _destroy(options: DestroyOptions<M>): Promise<number>;
41
+ protected _sum(field: keyof Attributes<M>, options?: AggregateOptions<M>): Promise<number>;
42
+ protected _sumField(params: PaginateRequest<M>, field: keyof Attributes<M>): Promise<number>;
43
+ protected _sumCol(params: PaginateRequest<M>, fieldToSum: string, expectedField: string): Promise<number>;
44
+ protected _count(options: FindOptions<M>): Promise<number>;
43
45
  protected filteredFindAll(params: PaginateRequest<M>): Promise<M[]>;
44
46
  }
@@ -121,13 +121,13 @@ let Repository = class Repository {
121
121
  }
122
122
  async findForPublic(params, mapInto) {
123
123
  let options = this._getOptions(params), limit = +(params?.perPage ?? 20);
124
- return (await this.findAll({
124
+ return (await this._findAll({
125
125
  ...options,
126
126
  limit
127
127
  })).map((d)=>mapInto(d));
128
128
  }
129
- async paginate(params, mapInto) {
130
- let options = this._getOptions(params), limit = +(params?.perPage ?? 20), page = +(params?.page ?? 1), data = await this.findAndCountAll({
129
+ async _paginate(params, mapInto) {
130
+ let options = this._getOptions(params), limit = +(params?.perPage ?? 20), page = +(params?.page ?? 1), data = await this._findAndCountAll({
131
131
  limit,
132
132
  offset: page > 1 ? limit * (page - 1) : 0,
133
133
  ...options,
@@ -136,7 +136,7 @@ let Repository = class Repository {
136
136
  data.count = Array.isArray(data.count) ? data.count.length : data.count;
137
137
  let totalPage = Math.ceil(data.count / limit);
138
138
  return {
139
- data: mapInto ? data.rows.map((d)=>mapInto(d)) : data.rows,
139
+ data: mapInto ? data.rows.map((d)=>new mapInto(d)) : data.rows,
140
140
  timestamp: (0, _helpers.dateUtil)().utc().toISOString(),
141
141
  meta: {
142
142
  perPage: limit,
@@ -148,7 +148,7 @@ let Repository = class Repository {
148
148
  }
149
149
  };
150
150
  }
151
- async paginateCursor(params, mapInto) {
151
+ async _paginateCursor(params, mapInto) {
152
152
  if (!this.FIELDS?.includes('id')) throw new _common.UnprocessableEntityException('Entity must have id attribute for cursor pagination');
153
153
  params.attributes = (0, _helpers.uniqueArray)([
154
154
  ...params.attributes || [],
@@ -161,12 +161,12 @@ let Repository = class Repository {
161
161
  [_sequelize.Op.gt]: params.cursor
162
162
  }, options.where = whereClause;
163
163
  }
164
- let data = await this.findAll({
164
+ let data = await this._findAll({
165
165
  ...options,
166
166
  limit
167
167
  }), lastId = data[data.length - 1]?.id, nextCursor = data.length > 0 && lastId ? String(lastId) : null;
168
168
  return {
169
- data: mapInto ? data.map((d)=>mapInto(d)) : data,
169
+ data: mapInto ? data.map((d)=>new mapInto(d)) : data,
170
170
  timestamp: (0, _helpers.dateUtil)().utc().toISOString(),
171
171
  meta: {
172
172
  perPage: limit,
@@ -174,39 +174,39 @@ let Repository = class Repository {
174
174
  }
175
175
  };
176
176
  }
177
- async export(params, mapInto) {
178
- let options = this._getOptions(params), data = await this.findAll(options);
179
- return mapInto ? data.map((d)=>mapInto(d)) : data;
177
+ async _export(params, mapInto) {
178
+ let options = this._getOptions(params), data = await this._findAll(options);
179
+ return mapInto ? data.map((d)=>new mapInto(d)) : data;
180
180
  }
181
- async updateOrCreate(values, whereOptions, options) {
182
- let data = await this.findOne({
181
+ async _updateOrCreate(values, whereOptions, options) {
182
+ let data = await this._findOne({
183
183
  where: whereOptions
184
184
  });
185
- return data ? (await this.update(data, values, options), data) : await this.create(values, options);
185
+ return data ? (await this._update(data, values, options), data) : await this._create(values, options);
186
186
  }
187
- async findAll(options) {
187
+ async _findAll(options) {
188
188
  return this.Model.findAll(options).catch((error)=>{
189
189
  throw this._errorHandler(error);
190
190
  });
191
191
  }
192
- async findAndCountAll(options) {
192
+ async _findAndCountAll(options) {
193
193
  return this.Model.findAndCountAll(options).catch((error)=>{
194
194
  throw this._errorHandler(error);
195
195
  });
196
196
  }
197
- async findOne(options) {
197
+ async _findOne(options) {
198
198
  return this.Model.findOne(options).catch((error)=>{
199
199
  throw this._errorHandler(error);
200
200
  });
201
201
  }
202
- async create(values, options) {
202
+ async _create(values, options) {
203
203
  return this.Model.create(values, options).catch((error)=>{
204
204
  throw this._errorHandler(error);
205
205
  });
206
206
  }
207
- async update(entity, values, options) {
207
+ async _update(entity, values, options) {
208
208
  let model = entity;
209
- if (('string' == typeof entity || 'number' == typeof entity) && (model = await this.findOne({
209
+ if (('string' == typeof entity || 'number' == typeof entity) && (model = await this._findOne({
210
210
  where: {
211
211
  id: entity
212
212
  },
@@ -220,42 +220,42 @@ let Repository = class Repository {
220
220
  throw this._errorHandler(error);
221
221
  });
222
222
  }
223
- async upsert(values, options) {
223
+ async _upsert(values, options) {
224
224
  return this.Model.upsert(values, {
225
225
  ...options
226
226
  }).catch((error)=>{
227
227
  throw this._errorHandler(error);
228
228
  });
229
229
  }
230
- async bulkUpdate(values, options) {
230
+ async _bulkUpdate(values, options) {
231
231
  return this.Model.update(values, {
232
232
  ...options
233
233
  }).catch((error)=>{
234
234
  throw this._errorHandler(error);
235
235
  });
236
236
  }
237
- async bulkCreate(values, options) {
237
+ async _bulkCreate(values, options) {
238
238
  return this.Model.bulkCreate(values, options).catch((error)=>{
239
239
  throw this._errorHandler(error);
240
240
  });
241
241
  }
242
- async destroy(options) {
242
+ async _destroy(options) {
243
243
  return this.Model.destroy(options).catch((error)=>{
244
244
  throw this._errorHandler(error);
245
245
  });
246
246
  }
247
- async sum(field, options) {
247
+ async _sum(field, options) {
248
248
  return this.Model.sum(field, options).catch((error)=>{
249
249
  throw this._errorHandler(error);
250
250
  });
251
251
  }
252
- async sumField(params, field) {
252
+ async _sumField(params, field) {
253
253
  let options = this._getOptions(params);
254
- return this.sum(field, options).catch((error)=>{
254
+ return this._sum(field, options).catch((error)=>{
255
255
  throw this._errorHandler(error);
256
256
  });
257
257
  }
258
- async sumCol(params, fieldToSum, expectedField) {
258
+ async _sumCol(params, fieldToSum, expectedField) {
259
259
  let options = this._getOptions(params);
260
260
  return options.attributes = [
261
261
  [
@@ -266,7 +266,7 @@ let Repository = class Repository {
266
266
  throw this._errorHandler(error);
267
267
  })).reduce((total, row)=>total + parseFloat(String(row.get(expectedField)) || '0'), 0);
268
268
  }
269
- async count(options) {
269
+ async _count(options) {
270
270
  return this.Model.count(options).catch((error)=>{
271
271
  throw this._errorHandler(error);
272
272
  });
@@ -1,33 +1,36 @@
1
- export declare const SwaggerApiBadRequestResponse: MethodDecorator & ClassDecorator;
2
- export declare const SwaggerApiUnauthorizedResponse: MethodDecorator & ClassDecorator;
3
- export declare const SwaggerApiForbiddenResponse: MethodDecorator & ClassDecorator;
4
- export declare const SwaggerApiNotFoundResponse: MethodDecorator & ClassDecorator;
5
- export declare const SwaggerApiBadSwaGatewayResponse: MethodDecorator & ClassDecorator;
6
- export declare const SwaggerApiInternalServerErrorResponse: MethodDecorator & ClassDecorator;
7
- export declare const SwaggerApiConflictResponse: MethodDecorator & ClassDecorator;
8
- export declare const SwaggerApiNoContentResponse: MethodDecorator & ClassDecorator;
1
+ export declare const SwaggerApiBadRequestResponse: () => MethodDecorator & ClassDecorator;
2
+ export declare const SwaggerApiUnauthorizedResponse: () => MethodDecorator & ClassDecorator;
3
+ export declare const SwaggerApiForbiddenResponse: () => MethodDecorator & ClassDecorator;
4
+ export declare const SwaggerApiNotFoundResponse: () => MethodDecorator & ClassDecorator;
5
+ export declare const SwaggerApiBadSwaGatewayResponse: () => MethodDecorator & ClassDecorator;
6
+ export declare const SwaggerApiInternalServerErrorResponse: () => MethodDecorator & ClassDecorator;
7
+ export declare const SwaggerApiConflictResponse: () => MethodDecorator & ClassDecorator;
8
+ export declare const SwaggerApiNoContentResponse: () => MethodDecorator & ClassDecorator;
9
9
  export declare const SwaggerApiSuccessResponse: (classType: any) => MethodDecorator & ClassDecorator;
10
10
  export declare const SwaggerApiCreatedResponse: (classType: any) => MethodDecorator & ClassDecorator;
11
11
  export declare function SwaggerApiPaginateResponse<T extends new (...args: any[]) => any>(classType: T): MethodDecorator & ClassDecorator;
12
- export declare const ApiNameProperty: PropertyDecorator;
13
- export declare const ApiCompanyProperty: PropertyDecorator;
14
- export declare const ApiCityProperty: PropertyDecorator;
15
- export declare const ApiProvinceProperty: PropertyDecorator;
16
- export declare const ApiAddressProperty: PropertyDecorator;
17
- export declare const ApiEmailProperty: PropertyDecorator;
18
- export declare const ApiPhoneProperty: PropertyDecorator;
19
- export declare const ApiPasswordProperty: PropertyDecorator;
20
- export declare const ApiTokenProperty: PropertyDecorator;
21
- export declare const ApiUuidProperty: PropertyDecorator;
22
- export declare const ApiBooleanProperty: PropertyDecorator;
23
- export declare const ApiNumberProperty: PropertyDecorator;
24
- export declare const ApiStringProperty: PropertyDecorator;
25
- export declare const ApiEnumProperty: (enums: string[]) => PropertyDecorator;
26
- export declare const ApiDateProperty: PropertyDecorator;
27
- export declare const ApiDateOnlyProperty: PropertyDecorator;
28
- export declare const ApiTimeProperty: PropertyDecorator;
29
- export declare const ApiUrlProperty: PropertyDecorator;
30
- export declare const ApiUuidArrayProperty: PropertyDecorator;
31
- export declare const ApiStringArrayProperty: PropertyDecorator;
32
- export declare const ApiNumberArrayProperty: PropertyDecorator;
33
- export declare const ApiDateArrayProperty: PropertyDecorator;
12
+ export declare const ApiNameProperty: (required?: boolean) => PropertyDecorator;
13
+ export declare const ApiCompanyProperty: (required?: boolean) => PropertyDecorator;
14
+ export declare const ApiCityProperty: (required?: boolean) => PropertyDecorator;
15
+ export declare const ApiProvinceProperty: (required?: boolean) => PropertyDecorator;
16
+ export declare const ApiAddressProperty: (required?: boolean) => PropertyDecorator;
17
+ export declare const ApiEmailProperty: (required?: boolean) => PropertyDecorator;
18
+ export declare const ApiPhoneProperty: (required?: boolean) => PropertyDecorator;
19
+ export declare const ApiPasswordProperty: (required?: boolean) => PropertyDecorator;
20
+ export declare const ApiTokenProperty: (required?: boolean) => PropertyDecorator;
21
+ export declare const ApiUuidProperty: (required?: boolean) => PropertyDecorator;
22
+ export declare const ApiBooleanProperty: (required?: boolean) => PropertyDecorator;
23
+ export declare const ApiNumberProperty: (required?: boolean) => PropertyDecorator;
24
+ export declare const ApiStringProperty: (required?: boolean) => PropertyDecorator;
25
+ export declare const ApiEnumProperty: (enums: string[], required?: boolean) => PropertyDecorator;
26
+ export declare const ApiDateProperty: (required?: boolean) => PropertyDecorator;
27
+ export declare const ApiDateOnlyProperty: (required?: boolean) => PropertyDecorator;
28
+ export declare const ApiTimeProperty: (required?: boolean) => PropertyDecorator;
29
+ export declare const ApiUrlProperty: (required?: boolean) => PropertyDecorator;
30
+ export declare const ApiUuidArrayProperty: (required?: boolean) => PropertyDecorator;
31
+ export declare const ApiStringArrayProperty: (required?: boolean) => PropertyDecorator;
32
+ export declare const ApiNumberArrayProperty: (required?: boolean) => PropertyDecorator;
33
+ export declare const ApiDateArrayProperty: (required?: boolean) => PropertyDecorator;
34
+ export declare const ApiBooleanArrayProperty: (required?: boolean) => PropertyDecorator;
35
+ export declare const ApiEnumArrayProperty: (enums: string[], required?: boolean) => PropertyDecorator;
36
+ export declare const ApiInProperty: (enums: string[], required?: boolean) => PropertyDecorator;
@@ -6,6 +6,9 @@ var target = exports, all = {
6
6
  get ApiAddressProperty () {
7
7
  return ApiAddressProperty;
8
8
  },
9
+ get ApiBooleanArrayProperty () {
10
+ return ApiBooleanArrayProperty;
11
+ },
9
12
  get ApiBooleanProperty () {
10
13
  return ApiBooleanProperty;
11
14
  },
@@ -27,9 +30,15 @@ var target = exports, all = {
27
30
  get ApiEmailProperty () {
28
31
  return ApiEmailProperty;
29
32
  },
33
+ get ApiEnumArrayProperty () {
34
+ return ApiEnumArrayProperty;
35
+ },
30
36
  get ApiEnumProperty () {
31
37
  return ApiEnumProperty;
32
38
  },
39
+ get ApiInProperty () {
40
+ return ApiInProperty;
41
+ },
33
42
  get ApiNameProperty () {
34
43
  return ApiNameProperty;
35
44
  },
@@ -148,11 +157,11 @@ _ts_decorate([
148
157
  }),
149
158
  _ts_metadata("design:type", "u" < typeof Record ? Object : Record)
150
159
  ], BadRequestExample.prototype, "errors", void 0);
151
- let SwaggerApiBadRequestResponse = (0, _swagger.ApiResponse)({
152
- status: 400,
153
- description: 'Bad Request',
154
- type: BadRequestExample
155
- });
160
+ let SwaggerApiBadRequestResponse = ()=>(0, _swagger.ApiResponse)({
161
+ status: 400,
162
+ description: 'Bad Request',
163
+ type: BadRequestExample
164
+ });
156
165
  let UnauthorizedExample = class UnauthorizedExample {
157
166
  statusCode;
158
167
  message;
@@ -168,11 +177,11 @@ _ts_decorate([
168
177
  }),
169
178
  _ts_metadata("design:type", String)
170
179
  ], UnauthorizedExample.prototype, "message", void 0);
171
- let SwaggerApiUnauthorizedResponse = (0, _swagger.ApiResponse)({
172
- status: 401,
173
- description: 'Unauthorized',
174
- type: UnauthorizedExample
175
- });
180
+ let SwaggerApiUnauthorizedResponse = ()=>(0, _swagger.ApiResponse)({
181
+ status: 401,
182
+ description: 'Unauthorized',
183
+ type: UnauthorizedExample
184
+ });
176
185
  let ForbiddenExample = class ForbiddenExample {
177
186
  statusCode;
178
187
  message;
@@ -188,11 +197,11 @@ _ts_decorate([
188
197
  }),
189
198
  _ts_metadata("design:type", String)
190
199
  ], ForbiddenExample.prototype, "message", void 0);
191
- let SwaggerApiForbiddenResponse = (0, _swagger.ApiResponse)({
192
- status: 403,
193
- description: 'Forbidden',
194
- type: ForbiddenExample
195
- });
200
+ let SwaggerApiForbiddenResponse = ()=>(0, _swagger.ApiResponse)({
201
+ status: 403,
202
+ description: 'Forbidden',
203
+ type: ForbiddenExample
204
+ });
196
205
  let NotFoundExample = class NotFoundExample {
197
206
  statusCode;
198
207
  message;
@@ -208,11 +217,11 @@ _ts_decorate([
208
217
  }),
209
218
  _ts_metadata("design:type", String)
210
219
  ], NotFoundExample.prototype, "message", void 0);
211
- let SwaggerApiNotFoundResponse = (0, _swagger.ApiResponse)({
212
- status: 404,
213
- description: 'Not Found',
214
- type: NotFoundExample
215
- });
220
+ let SwaggerApiNotFoundResponse = ()=>(0, _swagger.ApiResponse)({
221
+ status: 404,
222
+ description: 'Not Found',
223
+ type: NotFoundExample
224
+ });
216
225
  let BadSwaGatewayExample = class BadSwaGatewayExample {
217
226
  statusCode;
218
227
  message;
@@ -228,11 +237,11 @@ _ts_decorate([
228
237
  }),
229
238
  _ts_metadata("design:type", String)
230
239
  ], BadSwaGatewayExample.prototype, "message", void 0);
231
- let SwaggerApiBadSwaGatewayResponse = (0, _swagger.ApiResponse)({
232
- status: 502,
233
- description: 'Bad Gateway',
234
- type: BadSwaGatewayExample
235
- });
240
+ let SwaggerApiBadSwaGatewayResponse = ()=>(0, _swagger.ApiResponse)({
241
+ status: 502,
242
+ description: 'Bad Gateway',
243
+ type: BadSwaGatewayExample
244
+ });
236
245
  let InternalServerErrorExample = class InternalServerErrorExample {
237
246
  statusCode;
238
247
  message;
@@ -248,11 +257,11 @@ _ts_decorate([
248
257
  }),
249
258
  _ts_metadata("design:type", String)
250
259
  ], InternalServerErrorExample.prototype, "message", void 0);
251
- let SwaggerApiInternalServerErrorResponse = (0, _swagger.ApiResponse)({
252
- status: 500,
253
- description: 'Internal Server Error',
254
- type: InternalServerErrorExample
255
- });
260
+ let SwaggerApiInternalServerErrorResponse = ()=>(0, _swagger.ApiResponse)({
261
+ status: 500,
262
+ description: 'Internal Server Error',
263
+ type: InternalServerErrorExample
264
+ });
256
265
  let ConflictExample = class ConflictExample {
257
266
  statusCode;
258
267
  message;
@@ -268,11 +277,11 @@ _ts_decorate([
268
277
  }),
269
278
  _ts_metadata("design:type", String)
270
279
  ], ConflictExample.prototype, "message", void 0);
271
- let SwaggerApiConflictResponse = (0, _swagger.ApiResponse)({
272
- status: 409,
273
- description: 'Conflict',
274
- type: ConflictExample
275
- });
280
+ let SwaggerApiConflictResponse = ()=>(0, _swagger.ApiResponse)({
281
+ status: 409,
282
+ description: 'Conflict',
283
+ type: ConflictExample
284
+ });
276
285
  let NoContentExample = class NoContentExample {
277
286
  statusCode;
278
287
  message;
@@ -288,11 +297,11 @@ _ts_decorate([
288
297
  }),
289
298
  _ts_metadata("design:type", String)
290
299
  ], NoContentExample.prototype, "message", void 0);
291
- let SwaggerApiNoContentResponse = (0, _swagger.ApiResponse)({
292
- status: 204,
293
- description: 'No Content',
294
- type: NoContentExample
295
- }), SwaggerApiSuccessResponse = (classType)=>(0, _swagger.ApiResponse)({
300
+ let SwaggerApiNoContentResponse = ()=>(0, _swagger.ApiResponse)({
301
+ status: 204,
302
+ description: 'No Content',
303
+ type: NoContentExample
304
+ }), SwaggerApiSuccessResponse = (classType)=>(0, _swagger.ApiResponse)({
296
305
  status: 200,
297
306
  description: 'Success',
298
307
  type: ((classType)=>{
@@ -407,68 +416,150 @@ function SwaggerApiPaginateResponse(classType) {
407
416
  })(classType)
408
417
  });
409
418
  }
410
- let ApiNameProperty = (0, _swagger.ApiProperty)({
411
- example: 'John Doe'
412
- }), ApiCompanyProperty = (0, _swagger.ApiProperty)({
413
- example: 'PT Gundala Permai'
414
- }), ApiCityProperty = (0, _swagger.ApiProperty)({
415
- example: 'Jakarta'
416
- }), ApiProvinceProperty = (0, _swagger.ApiProperty)({
417
- example: 'DKI Jakarta'
418
- }), ApiAddressProperty = (0, _swagger.ApiProperty)({
419
- example: 'Jl. Merdeka No. 123'
420
- }), ApiEmailProperty = (0, _swagger.ApiProperty)({
421
- example: 'john@gmail.com'
422
- }), ApiPhoneProperty = (0, _swagger.ApiProperty)({
423
- example: '+62128888888'
424
- }), ApiPasswordProperty = (0, _swagger.ApiProperty)({
425
- example: 'Password@#123'
426
- }), ApiTokenProperty = (0, _swagger.ApiProperty)({
427
- example: 'abcdef1234567890'
428
- }), ApiUuidProperty = (0, _swagger.ApiProperty)({
429
- example: '123e4567-e89b-12d3-a456-426614174000'
430
- }), ApiBooleanProperty = (0, _swagger.ApiProperty)({
431
- example: !0
432
- }), ApiNumberProperty = (0, _swagger.ApiProperty)({
433
- example: 42000
434
- }), ApiStringProperty = (0, _swagger.ApiProperty)({
435
- example: 'Some string value'
436
- }), ApiEnumProperty = (enums)=>(0, _swagger.ApiProperty)({
419
+ let ApiNameProperty = (required = !0)=>(0, _swagger.ApiProperty)({
420
+ example: 'John Doe',
421
+ required,
422
+ type: String
423
+ }), ApiCompanyProperty = (required = !0)=>(0, _swagger.ApiProperty)({
424
+ example: 'PT Gundala Permai',
425
+ required,
426
+ type: String
427
+ }), ApiCityProperty = (required = !0)=>(0, _swagger.ApiProperty)({
428
+ example: 'Jakarta',
429
+ required,
430
+ type: String
431
+ }), ApiProvinceProperty = (required = !0)=>(0, _swagger.ApiProperty)({
432
+ example: 'DKI Jakarta',
433
+ required,
434
+ type: String
435
+ }), ApiAddressProperty = (required = !0)=>(0, _swagger.ApiProperty)({
436
+ example: 'Jl. Merdeka No. 123',
437
+ required,
438
+ type: String
439
+ }), ApiEmailProperty = (required = !0)=>(0, _swagger.ApiProperty)({
440
+ example: 'john@gmail.com',
441
+ required,
442
+ type: String
443
+ }), ApiPhoneProperty = (required = !0)=>(0, _swagger.ApiProperty)({
444
+ example: '+62128888888',
445
+ required,
446
+ type: String
447
+ }), ApiPasswordProperty = (required = !0)=>(0, _swagger.ApiProperty)({
448
+ example: 'Password@#123',
449
+ required,
450
+ type: String
451
+ }), ApiTokenProperty = (required = !0)=>(0, _swagger.ApiProperty)({
452
+ example: 'abcdef1234567890',
453
+ required,
454
+ type: String
455
+ }), ApiUuidProperty = (required = !0)=>(0, _swagger.ApiProperty)({
456
+ example: '123e4567-e89b-12d3-a456-426614174000',
457
+ required,
458
+ type: String
459
+ }), ApiBooleanProperty = (required = !0)=>(0, _swagger.ApiProperty)({
460
+ example: !0,
461
+ required,
462
+ type: Boolean
463
+ }), ApiNumberProperty = (required = !0)=>(0, _swagger.ApiProperty)({
464
+ example: 42000,
465
+ required,
466
+ type: Number
467
+ }), ApiStringProperty = (required = !0)=>(0, _swagger.ApiProperty)({
468
+ example: 'Some string value',
469
+ required,
470
+ type: String
471
+ }), ApiEnumProperty = (enums, required = !0)=>(0, _swagger.ApiProperty)({
437
472
  example: enums[0],
438
- enum: enums
439
- }), ApiDateProperty = (0, _swagger.ApiProperty)({
440
- example: '2024-01-01T00:00:00.000Z'
441
- }), ApiDateOnlyProperty = (0, _swagger.ApiProperty)({
442
- example: '2024-01-01'
443
- }), ApiTimeProperty = (0, _swagger.ApiProperty)({
444
- example: '14:30:00'
445
- }), ApiUrlProperty = (0, _swagger.ApiProperty)({
446
- example: 'https://www.example.com/resource'
447
- }), ApiUuidArrayProperty = (0, _swagger.ApiProperty)({
448
- example: [
449
- '123e4567-e89b-12d3-a456-426614174000',
450
- '987e6543-e21b-12d3-a456-426614174999'
451
- ],
452
- isArray: !0
453
- }), ApiStringArrayProperty = (0, _swagger.ApiProperty)({
454
- example: [
455
- 'string1',
456
- 'string2',
457
- 'string3'
458
- ],
459
- isArray: !0
460
- }), ApiNumberArrayProperty = (0, _swagger.ApiProperty)({
461
- example: [
462
- 10,
463
- 20,
464
- 30,
465
- 40
466
- ],
467
- isArray: !0
468
- }), ApiDateArrayProperty = (0, _swagger.ApiProperty)({
469
- example: [
470
- '2024-01-01T00:00:00.000Z',
471
- '2024-02-01T00:00:00.000Z'
472
- ],
473
- isArray: !0
474
- });
473
+ enum: enums,
474
+ required
475
+ }), ApiDateProperty = (required = !0)=>(0, _swagger.ApiProperty)({
476
+ example: '2024-01-01T00:00:00.000Z',
477
+ required,
478
+ type: String
479
+ }), ApiDateOnlyProperty = (required = !0)=>(0, _swagger.ApiProperty)({
480
+ example: '2024-01-01',
481
+ required,
482
+ type: String
483
+ }), ApiTimeProperty = (required = !0)=>(0, _swagger.ApiProperty)({
484
+ example: '14:30:00',
485
+ required,
486
+ type: String
487
+ }), ApiUrlProperty = (required = !0)=>(0, _swagger.ApiProperty)({
488
+ example: 'https://www.example.com/resource',
489
+ required,
490
+ type: String
491
+ }), ApiUuidArrayProperty = (required = !0)=>(0, _swagger.ApiProperty)({
492
+ example: [
493
+ '123e4567-e89b-12d3-a456-426614174000',
494
+ '987e6543-e21b-12d3-a456-426614174999'
495
+ ],
496
+ type: [
497
+ String
498
+ ],
499
+ isArray: !0,
500
+ required
501
+ }), ApiStringArrayProperty = (required = !0)=>(0, _swagger.ApiProperty)({
502
+ example: [
503
+ 'string1',
504
+ 'string2',
505
+ 'string3'
506
+ ],
507
+ type: [
508
+ String
509
+ ],
510
+ isArray: !0,
511
+ required
512
+ }), ApiNumberArrayProperty = (required = !0)=>(0, _swagger.ApiProperty)({
513
+ example: [
514
+ 10,
515
+ 20,
516
+ 30,
517
+ 40
518
+ ],
519
+ type: [
520
+ Number
521
+ ],
522
+ isArray: !0,
523
+ required
524
+ }), ApiDateArrayProperty = (required = !0)=>(0, _swagger.ApiProperty)({
525
+ example: [
526
+ '2024-01-01T00:00:00.000Z',
527
+ '2024-02-01T00:00:00.000Z'
528
+ ],
529
+ type: [
530
+ String
531
+ ],
532
+ isArray: !0,
533
+ required
534
+ }), ApiBooleanArrayProperty = (required = !0)=>(0, _swagger.ApiProperty)({
535
+ example: [
536
+ !0,
537
+ !1,
538
+ !0
539
+ ],
540
+ type: [
541
+ Boolean
542
+ ],
543
+ isArray: !0,
544
+ required
545
+ }), ApiEnumArrayProperty = (enums, required = !0)=>(0, _swagger.ApiProperty)({
546
+ example: [
547
+ enums[0],
548
+ enums[1]
549
+ ],
550
+ isArray: !0,
551
+ type: [
552
+ String
553
+ ],
554
+ enum: enums,
555
+ required
556
+ }), ApiInProperty = (enums, required = !0)=>(0, _swagger.ApiProperty)({
557
+ example: enums.slice(0, 2),
558
+ isArray: !0,
559
+ type: [
560
+ String
561
+ ],
562
+ enum: enums,
563
+ description: 'Value must be one of the specified enum values',
564
+ required
565
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triproject/nestjs-core",
3
- "version": "1.0.43",
3
+ "version": "1.0.46",
4
4
  "author": "",
5
5
  "license": "ISC",
6
6
  "description": "A collection of NestJS modules and utilities to speed up development.",
@@ -148,7 +148,8 @@
148
148
  "sequelize": "^6.37.7",
149
149
  "sequelize-typescript": "^2.1.6",
150
150
  "speakeasy": "^2.0.0",
151
- "ua-parser-js": "^2.0.8"
151
+ "ua-parser-js": "^2.0.8",
152
+ "class-transformer": "^0.5.1"
152
153
  },
153
154
  "peerDependenciesMeta": {
154
155
  "amqplib": {
@@ -220,9 +221,6 @@
220
221
  "exceljs": {
221
222
  "optional": true
222
223
  },
223
- "rxjs": {
224
- "optional": true
225
- },
226
224
  "@nest-lab/throttler-storage-redis": {
227
225
  "optional": true
228
226
  },
@@ -291,6 +289,7 @@
291
289
  "ts-node": "^1.7.1",
292
290
  "typescript": "^5.9.3",
293
291
  "ua-parser-js": "^2.0.8",
294
- "vitest": "^4.0.17"
292
+ "vitest": "^4.0.17",
293
+ "class-transformer": "^0.5.1"
295
294
  }
296
295
  }