nicot 1.1.32 → 1.1.34

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 CHANGED
@@ -75,19 +75,23 @@ __export(index_exports, {
75
75
  QueryLessEqual: () => QueryLessEqual,
76
76
  QueryLike: () => QueryLike,
77
77
  QueryMatchBoolean: () => QueryMatchBoolean,
78
+ QueryMatchBooleanMySQL: () => QueryMatchBooleanMySQL,
78
79
  QueryNotEqual: () => QueryNotEqual,
79
80
  QueryOperator: () => QueryOperator,
80
81
  QuerySearch: () => QuerySearch,
81
82
  Relation: () => Relation,
82
83
  RelationComputed: () => RelationComputed,
83
- RenameClass: () => RenameClass,
84
84
  RestfulFactory: () => RestfulFactory,
85
+ SimpleJsonColumn: () => SimpleJsonColumn,
85
86
  StringColumn: () => StringColumn,
86
87
  StringIdBase: () => StringIdBase,
88
+ StringJsonColumn: () => StringJsonColumn,
89
+ TextColumn: () => TextColumn,
87
90
  TimeBase: () => TimeBase,
88
91
  UpdatePipe: () => UpdatePipe,
89
92
  UuidColumn: () => UuidColumn,
90
93
  applyQueryMatchBoolean: () => applyQueryMatchBoolean,
94
+ applyQueryMatchBooleanMySQL: () => applyQueryMatchBooleanMySQL,
91
95
  applyQueryProperty: () => applyQueryProperty,
92
96
  applyQueryPropertyLike: () => applyQueryPropertyLike,
93
97
  applyQueryPropertySearch: () => applyQueryPropertySearch,
@@ -274,6 +278,47 @@ var TypeTransformer = class {
274
278
  return entValue;
275
279
  }
276
280
  };
281
+ var TypeTransformerString = class extends TypeTransformer {
282
+ from(dbValue) {
283
+ if (dbValue == null) {
284
+ return dbValue;
285
+ }
286
+ return super.from(JSON.parse(dbValue));
287
+ }
288
+ to(entValue) {
289
+ if (entValue == null) {
290
+ return entValue;
291
+ }
292
+ return JSON.stringify(super.to(entValue));
293
+ }
294
+ };
295
+
296
+ // src/utility/parse-bool.ts
297
+ var parseBool = (value) => {
298
+ const trueValues = ["true", "1", "yes", "on", true, 1];
299
+ const falseValues = ["false", "0", "no", "off", false, 0];
300
+ if (trueValues.indexOf(value) !== -1) return true;
301
+ if (falseValues.indexOf(value) !== -1) return false;
302
+ if (!!value) {
303
+ return true;
304
+ }
305
+ return void 0;
306
+ };
307
+ var parseBoolObject = (obj, boolFields) => {
308
+ const newObj = { ...obj };
309
+ for (const field of boolFields) {
310
+ newObj[field] = parseBool(newObj[field]);
311
+ }
312
+ return newObj;
313
+ };
314
+ var ParseBoolObjectPipe = class {
315
+ constructor(boolFields) {
316
+ this.boolFields = boolFields;
317
+ }
318
+ transform(obj) {
319
+ return parseBoolObject(obj, this.boolFields);
320
+ }
321
+ };
277
322
 
278
323
  // src/decorators/property.ts
279
324
  function swaggerDecorator(options, injected = {}) {
@@ -303,13 +348,24 @@ function columnDecoratorOptions(options) {
303
348
  }
304
349
  var StringColumn = (length, options = {}) => {
305
350
  return (0, import_nesties3.MergePropertyDecorators)([
306
- (0, import_typeorm.Column)("varchar", { length, ...columnDecoratorOptions(options) }),
351
+ (0, import_typeorm.Column)(options.columnType || "varchar", {
352
+ length,
353
+ ...columnDecoratorOptions(options)
354
+ }),
307
355
  (0, import_class_validator3.IsString)(),
308
356
  (0, import_class_validator3.MaxLength)(length),
309
357
  validatorDecorator(options),
310
358
  swaggerDecorator(options, { type: String, maxLength: length })
311
359
  ]);
312
360
  };
361
+ var TextColumn = (options = {}) => {
362
+ return (0, import_nesties3.MergePropertyDecorators)([
363
+ (0, import_typeorm.Column)(options.columnType || "text", columnDecoratorOptions(options)),
364
+ (0, import_class_validator3.IsString)(),
365
+ validatorDecorator(options),
366
+ swaggerDecorator(options, { type: String })
367
+ ]);
368
+ };
313
369
  var UuidColumn = (options = {}) => {
314
370
  return (0, import_nesties3.MergePropertyDecorators)([
315
371
  (0, import_typeorm.Column)("uuid", {
@@ -328,8 +384,28 @@ var UuidColumn = (options = {}) => {
328
384
  })
329
385
  ]);
330
386
  };
387
+ var intMaxList = {
388
+ tinyint: 127,
389
+ smallint: 32767,
390
+ mediumint: 8388607,
391
+ int: 2147483647,
392
+ bigint: Number.MAX_SAFE_INTEGER
393
+ };
331
394
  var IntColumn = (type, options = {}) => {
332
- const decs = [
395
+ let max = intMaxList[type] || Number.MAX_SAFE_INTEGER;
396
+ if (max !== Number.MAX_SAFE_INTEGER && options.unsigned) {
397
+ max = max * 2 + 1;
398
+ }
399
+ let min = options.unsigned ? 0 : -max - 1;
400
+ if (options.range) {
401
+ if (typeof options.range.min === "number" && options.range.min > min) {
402
+ min = options.range.min;
403
+ }
404
+ if (typeof options.range.max === "number" && options.range.max < max) {
405
+ max = options.range.max;
406
+ }
407
+ }
408
+ return (0, import_nesties3.MergePropertyDecorators)([
333
409
  (0, import_typeorm.Column)(type, {
334
410
  default: options.default,
335
411
  unsigned: options.unsigned,
@@ -337,39 +413,53 @@ var IntColumn = (type, options = {}) => {
337
413
  ...columnDecoratorOptions(options)
338
414
  }),
339
415
  (0, import_class_validator3.IsInt)(),
416
+ ...min > Number.MIN_SAFE_INTEGER ? [(0, import_class_validator3.Min)(min)] : [],
417
+ ...max < Number.MAX_SAFE_INTEGER ? [(0, import_class_validator3.Max)(max)] : [],
340
418
  validatorDecorator(options),
341
419
  swaggerDecorator(options, {
342
420
  type: Number,
343
- minimum: options.unsigned ? 0 : void 0
421
+ minimum: min > Number.MIN_SAFE_INTEGER ? min : void 0,
422
+ maximum: max < Number.MAX_SAFE_INTEGER ? max : void 0
344
423
  })
345
- ];
346
- if (options.unsigned) {
347
- decs.push((0, import_class_validator3.Min)(0));
348
- }
349
- return (0, import_nesties3.MergePropertyDecorators)(decs);
424
+ ]);
350
425
  };
351
426
  var FloatColumn = (type, options = {}) => {
352
- const decs = [
427
+ let min = options.unsigned ? 0 : Number.MIN_SAFE_INTEGER;
428
+ let max = Number.MAX_SAFE_INTEGER;
429
+ if (options.columnExtras?.precision != null && options.columnExtras?.scale != null) {
430
+ const precision = options.columnExtras.precision;
431
+ const scale = options.columnExtras.scale;
432
+ const intDigits = precision - scale;
433
+ if (intDigits > 0) {
434
+ const maxIntPart = Math.pow(10, intDigits) - 1;
435
+ const maxDecimalPart = scale > 0 ? (Math.pow(10, scale) - 1) / Math.pow(10, scale) : 0;
436
+ max = maxIntPart + maxDecimalPart;
437
+ min = options.unsigned ? 0 : -max;
438
+ }
439
+ }
440
+ return (0, import_nesties3.MergePropertyDecorators)([
353
441
  (0, import_typeorm.Column)(type, {
354
442
  default: options.default,
355
443
  unsigned: options.unsigned,
356
444
  ...columnDecoratorOptions(options)
357
445
  }),
358
446
  (0, import_class_validator3.IsNumber)(),
447
+ ...min > Number.MIN_SAFE_INTEGER ? [(0, import_class_validator3.Min)(min)] : [],
448
+ ...max < Number.MAX_SAFE_INTEGER ? [(0, import_class_validator3.Max)(max)] : [],
359
449
  validatorDecorator(options),
360
450
  swaggerDecorator(options, {
361
451
  type: Number,
362
- minimum: options.unsigned ? 0 : void 0
452
+ minimum: min > Number.MIN_SAFE_INTEGER ? min : void 0,
453
+ maximum: max < Number.MAX_SAFE_INTEGER ? max : void 0
363
454
  })
364
- ];
365
- if (options.unsigned) {
366
- decs.push((0, import_class_validator3.Min)(0));
367
- }
368
- return (0, import_nesties3.MergePropertyDecorators)(decs);
455
+ ]);
369
456
  };
370
457
  var DateColumn = (options = {}) => {
371
458
  return (0, import_nesties3.MergePropertyDecorators)([
372
- (0, import_typeorm.Column)("timestamp", columnDecoratorOptions(options)),
459
+ (0, import_typeorm.Column)(
460
+ options.columnType || "timestamp",
461
+ columnDecoratorOptions(options)
462
+ ),
373
463
  (0, import_class_validator3.IsDate)(),
374
464
  (0, import_class_transformer3.Transform)(
375
465
  (v) => {
@@ -409,30 +499,33 @@ var EnumColumn = (targetEnum, options = {}) => {
409
499
  var BoolColumn = (options = {}) => (0, import_nesties3.MergePropertyDecorators)([
410
500
  (0, import_typeorm.Index)(),
411
501
  (0, import_class_transformer3.Transform)((v) => {
412
- const trueValues = ["true", "1", "yes", "on", true, 1];
413
- const falseValues = ["false", "0", "no", "off", false, 0];
414
- if (trueValues.indexOf(v.value) !== -1) return true;
415
- if (falseValues.indexOf(v.value) !== -1) return false;
416
- return void 0;
502
+ return parseBool(v.value);
417
503
  }),
418
504
  (0, import_typeorm.Column)("boolean", columnDecoratorOptions(options)),
419
505
  validatorDecorator(options),
420
- swaggerDecorator(options, { type: Boolean })
506
+ swaggerDecorator(options, { type: Boolean }),
507
+ Metadata.set("boolColumn", true, "boolColumnFields")
421
508
  ]);
422
- var JsonColumn = (definition, options = {}) => {
509
+ var createJsonColumnDef = (columnType = "jsonb", typeTransformerClass = TypeTransformer) => (definition, options = {}) => {
423
510
  const cl = (0, import_nesties4.getClassFromClassOrArray)(definition);
424
511
  return (0, import_nesties3.MergePropertyDecorators)([
425
512
  NotQueryable(),
426
513
  (0, import_class_transformer3.Type)(() => cl),
427
514
  (0, import_class_validator3.ValidateNested)(),
428
- (0, import_typeorm.Column)("jsonb", {
515
+ (0, import_typeorm.Column)(options.columnType || columnType, {
429
516
  ...columnDecoratorOptions(options),
430
- transformer: new TypeTransformer(definition)
517
+ transformer: new typeTransformerClass(definition)
431
518
  }),
432
519
  validatorDecorator(options),
433
520
  swaggerDecorator(options, { type: definition })
434
521
  ]);
435
522
  };
523
+ var JsonColumn = createJsonColumnDef();
524
+ var SimpleJsonColumn = createJsonColumnDef("json");
525
+ var StringJsonColumn = createJsonColumnDef(
526
+ "text",
527
+ TypeTransformerString
528
+ );
436
529
  var NotColumn = (options = {}, specials = {}) => (0, import_nesties3.MergePropertyDecorators)([
437
530
  (0, import_class_transformer3.Exclude)(),
438
531
  swaggerDecorator({
@@ -527,21 +620,26 @@ var applyQueryPropertyZeroNullable = createQueryCondition(
527
620
  );
528
621
  var applyQueryMatchBoolean = createQueryCondition(
529
622
  (obj, qb, entityName, field) => {
530
- const value = obj[field];
531
- if (value === true || value === "true" || value === 1 || value === "1") {
623
+ const value = parseBool(obj[field]);
624
+ if (value === true) {
532
625
  qb.andWhere(`${entityName}.${field} = TRUE`);
533
626
  }
534
- if (value === false || value === "false" || value === 0 || value === "0") {
627
+ if (value === false) {
535
628
  qb.andWhere(`${entityName}.${field} = FALSE`);
536
629
  }
537
630
  }
538
631
  );
539
-
540
- // src/utility/rename-class.ts
541
- function RenameClass(cls, name) {
542
- Object.defineProperty(cls, "name", { value: name });
543
- return cls;
544
- }
632
+ var applyQueryMatchBooleanMySQL = createQueryCondition(
633
+ (obj, qb, entityName, field) => {
634
+ const value = parseBool(obj[field]);
635
+ if (value === true) {
636
+ qb.andWhere(`${entityName}.${field} = 1`);
637
+ }
638
+ if (value === false) {
639
+ qb.andWhere(`${entityName}.${field} = 0`);
640
+ }
641
+ }
642
+ );
545
643
 
546
644
  // src/decorators/query.ts
547
645
  var import_nesties5 = require("nesties");
@@ -586,6 +684,7 @@ var QueryLike = () => QueryCondition(applyQueryPropertyLike);
586
684
  var QuerySearch = () => QueryCondition(applyQueryPropertySearch);
587
685
  var QueryEqualZeroNullable = () => QueryCondition(applyQueryPropertyZeroNullable);
588
686
  var QueryMatchBoolean = () => QueryCondition(applyQueryMatchBoolean);
687
+ var QueryMatchBooleanMySQL = () => QueryCondition(applyQueryMatchBooleanMySQL);
589
688
  var QueryOperator = (operator, field) => QueryCondition((obj, qb, entityName, key) => {
590
689
  if (obj[key] == null) return;
591
690
  const fieldName = field || key;
@@ -1739,10 +1838,10 @@ function CrudService(entityClass, crudOptions = {}) {
1739
1838
 
1740
1839
  // src/restful.ts
1741
1840
  var import_common3 = require("@nestjs/common");
1742
- var import_nesties9 = require("nesties");
1743
- var import_swagger6 = require("@nestjs/swagger");
1841
+ var import_nesties10 = require("nesties");
1842
+ var import_swagger7 = require("@nestjs/swagger");
1744
1843
  var import_lodash4 = __toESM(require("lodash"));
1745
- var import_constants = require("@nestjs/swagger/dist/constants");
1844
+ var import_nesties11 = require("nesties");
1746
1845
 
1747
1846
  // src/bases/base-restful-controller.ts
1748
1847
  var RestfulMethods = [
@@ -1803,6 +1902,27 @@ var OmitTypeExclude = (cl, keys) => {
1803
1902
  return omitted;
1804
1903
  };
1805
1904
 
1905
+ // src/utility/patch-column-in-get.ts
1906
+ var import_swagger6 = require("@nestjs/swagger");
1907
+ var import_nesties9 = require("nesties");
1908
+ var PatchColumnsInGet = (cl, originalCl = cl, fieldsToOmit = []) => {
1909
+ const omit2 = new Set(fieldsToOmit);
1910
+ const boolFields = getSpecificFields(originalCl || cl, "boolColumn").filter(
1911
+ (f) => !omit2.has(f)
1912
+ );
1913
+ for (const field of boolFields) {
1914
+ const originalApiProp = (0, import_nesties9.getApiProperty)(originalCl, field);
1915
+ (0, import_swagger6.ApiProperty)({
1916
+ ...originalApiProp,
1917
+ type: String,
1918
+ required: false,
1919
+ enum: ["0", "1"],
1920
+ default: originalApiProp?.default === true ? "1" : originalApiProp?.default === false ? "0" : void 0
1921
+ })(cl.prototype, field);
1922
+ }
1923
+ return cl;
1924
+ };
1925
+
1806
1926
  // src/restful.ts
1807
1927
  var getCurrentLevelRelations = (relations) => relations.filter((r) => !r.includes("."));
1808
1928
  var getNextLevelRelations = (relations, enteringField) => relations.filter((r) => r.includes(".") && r.startsWith(`${enteringField}.`)).map((r) => r.split(".").slice(1).join("."));
@@ -1822,7 +1942,7 @@ var RestfulFactory = class _RestfulFactory {
1822
1942
  this.entityClass,
1823
1943
  this.fieldsToOmit
1824
1944
  );
1825
- this.createDto = RenameClass(
1945
+ this.createDto = (0, import_nesties11.RenameClass)(
1826
1946
  OmitTypeExclude(
1827
1947
  this.basicInputDto,
1828
1948
  getSpecificFields(this.entityClass, "notWritable")
@@ -1830,27 +1950,35 @@ var RestfulFactory = class _RestfulFactory {
1830
1950
  `Create${this.entityClass.name}Dto`
1831
1951
  );
1832
1952
  this.importDto = ImportDataDto(this.createDto);
1833
- this.findAllDto = RenameClass(
1834
- (0, import_swagger6.PartialType)(
1835
- OmitTypeExclude(
1836
- this.entityClass instanceof PageSettingsDto ? this.basicInputDto : (0, import_swagger6.IntersectionType)(
1837
- this.basicInputDto,
1838
- PageSettingsDto
1953
+ this.fieldsInGetToOmit = import_lodash4.default.uniq([
1954
+ ...this.fieldsToOmit,
1955
+ ...getSpecificFields(this.entityClass, "notQueryable")
1956
+ ]);
1957
+ this.findAllDto = (0, import_nesties11.RenameClass)(
1958
+ (0, import_swagger7.PartialType)(
1959
+ PatchColumnsInGet(
1960
+ OmitTypeExclude(
1961
+ this.entityClass instanceof PageSettingsDto ? this.entityClass : (0, import_swagger7.IntersectionType)(
1962
+ this.entityClass,
1963
+ PageSettingsDto
1964
+ ),
1965
+ this.fieldsInGetToOmit
1839
1966
  ),
1840
- getSpecificFields(this.entityClass, "notQueryable")
1967
+ this.entityClass,
1968
+ this.fieldsInGetToOmit
1841
1969
  )
1842
1970
  ),
1843
1971
  `Find${this.entityClass.name}Dto`
1844
1972
  );
1845
- this.findAllCursorPaginatedDto = RenameClass(
1846
- (0, import_swagger6.IntersectionType)(
1973
+ this.findAllCursorPaginatedDto = (0, import_nesties11.RenameClass)(
1974
+ (0, import_swagger7.IntersectionType)(
1847
1975
  OmitTypeExclude(this.findAllDto, ["pageCount"]),
1848
1976
  CursorPaginationDto
1849
1977
  ),
1850
1978
  `Find${this.entityClass.name}CursorPaginatedDto`
1851
1979
  );
1852
- this.updateDto = RenameClass(
1853
- (0, import_swagger6.PartialType)(
1980
+ this.updateDto = (0, import_nesties11.RenameClass)(
1981
+ (0, import_swagger7.PartialType)(
1854
1982
  OmitTypeExclude(
1855
1983
  this.createDto,
1856
1984
  getSpecificFields(this.entityClass, "notChangeable")
@@ -1859,8 +1987,8 @@ var RestfulFactory = class _RestfulFactory {
1859
1987
  `Update${this.entityClass.name}Dto`
1860
1988
  );
1861
1989
  this.entityResultDto = this.resolveEntityResultDto();
1862
- this.entityCreateResultDto = RenameClass(
1863
- (0, import_swagger6.OmitType)(this.entityResultDto, [
1990
+ this.entityCreateResultDto = (0, import_nesties11.RenameClass)(
1991
+ (0, import_swagger7.OmitType)(this.entityResultDto, [
1864
1992
  ...getTypeormRelations(this.entityClass).map(
1865
1993
  (r) => r.propertyName
1866
1994
  ),
@@ -1872,15 +2000,15 @@ var RestfulFactory = class _RestfulFactory {
1872
2000
  ]),
1873
2001
  `${this.getEntityClassName()}CreateResultDto`
1874
2002
  );
1875
- this.entityReturnMessageDto = (0, import_nesties9.ReturnMessageDto)(this.entityResultDto);
1876
- this.entityCreateReturnMessageDto = (0, import_nesties9.ReturnMessageDto)(
2003
+ this.entityReturnMessageDto = (0, import_nesties10.ReturnMessageDto)(this.entityResultDto);
2004
+ this.entityCreateReturnMessageDto = (0, import_nesties10.ReturnMessageDto)(
1877
2005
  this.entityCreateResultDto
1878
2006
  );
1879
- this.entityArrayReturnMessageDto = (0, import_nesties9.PaginatedReturnMessageDto)(
2007
+ this.entityArrayReturnMessageDto = (0, import_nesties10.PaginatedReturnMessageDto)(
1880
2008
  this.entityResultDto
1881
2009
  );
1882
2010
  this.entityCursorPaginationReturnMessageDto = CursorPaginationReturnMessageDto(this.entityResultDto);
1883
- this.importReturnMessageDto = (0, import_nesties9.ReturnMessageDto)([
2011
+ this.importReturnMessageDto = (0, import_nesties10.ReturnMessageDto)([
1884
2012
  ImportEntryDto(this.entityCreateResultDto)
1885
2013
  ]);
1886
2014
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -1911,17 +2039,16 @@ var RestfulFactory = class _RestfulFactory {
1911
2039
  ...this.options.outputFieldsToOmit || [],
1912
2040
  ...this.options.relations ? relations.map((r) => r.propertyName).filter((r) => !currentLevelRelations.has(r)) : []
1913
2041
  ]);
1914
- const resultDto = (0, import_swagger6.OmitType)(this.entityClass, [...outputFieldsToOmit]);
2042
+ const resultDto = (0, import_swagger7.OmitType)(this.entityClass, [...outputFieldsToOmit]);
1915
2043
  for (const relation of relations) {
1916
2044
  if (outputFieldsToOmit.has(relation.propertyName)) continue;
1917
2045
  if (nonTransformableTypes.has(relation.propertyClass)) continue;
1918
2046
  const replace = (useClass) => {
1919
- const oldApiProperty = Reflect.getMetadata(
1920
- import_constants.DECORATORS.API_MODEL_PROPERTIES,
1921
- this.entityClass.prototype,
2047
+ const oldApiProperty = (0, import_nesties10.getApiProperty)(
2048
+ this.entityClass,
1922
2049
  relation.propertyName
1923
- ) || {};
1924
- (0, import_swagger6.ApiProperty)({
2050
+ );
2051
+ (0, import_swagger7.ApiProperty)({
1925
2052
  ...oldApiProperty,
1926
2053
  required: false,
1927
2054
  type: () => relation.isArray ? [useClass[0]] : useClass[0]
@@ -1955,7 +2082,7 @@ var RestfulFactory = class _RestfulFactory {
1955
2082
  }
1956
2083
  }
1957
2084
  }
1958
- const res = RenameClass(
2085
+ const res = (0, import_nesties11.RenameClass)(
1959
2086
  resultDto,
1960
2087
  `${this.getEntityClassName()}ResultDto`
1961
2088
  );
@@ -1981,17 +2108,17 @@ var RestfulFactory = class _RestfulFactory {
1981
2108
  }
1982
2109
  }
1983
2110
  create(extras = {}) {
1984
- return (0, import_nesties9.MergeMethodDecorators)([
2111
+ return (0, import_nesties10.MergeMethodDecorators)([
1985
2112
  this.usePrefix(import_common3.Post),
1986
2113
  (0, import_common3.HttpCode)(200),
1987
- (0, import_swagger6.ApiOperation)({
2114
+ (0, import_swagger7.ApiOperation)({
1988
2115
  summary: `Create a new ${this.getEntityClassName()}`,
1989
2116
  ...extras
1990
2117
  }),
1991
- (0, import_swagger6.ApiBody)({ type: this.createDto }),
1992
- (0, import_swagger6.ApiOkResponse)({ type: this.entityCreateReturnMessageDto }),
1993
- (0, import_swagger6.ApiBadRequestResponse)({
1994
- type: import_nesties9.BlankReturnMessageDto,
2118
+ (0, import_swagger7.ApiBody)({ type: this.createDto }),
2119
+ (0, import_swagger7.ApiOkResponse)({ type: this.entityCreateReturnMessageDto }),
2120
+ (0, import_swagger7.ApiBadRequestResponse)({
2121
+ type: import_nesties10.BlankReturnMessageDto,
1995
2122
  description: `The ${this.getEntityClassName()} is not valid`
1996
2123
  })
1997
2124
  ]);
@@ -2000,16 +2127,16 @@ var RestfulFactory = class _RestfulFactory {
2000
2127
  return (0, import_common3.Body)(CreatePipe());
2001
2128
  }
2002
2129
  findOne(extras = {}) {
2003
- return (0, import_nesties9.MergeMethodDecorators)([
2130
+ return (0, import_nesties10.MergeMethodDecorators)([
2004
2131
  this.usePrefix(import_common3.Get, ":id"),
2005
- (0, import_swagger6.ApiOperation)({
2132
+ (0, import_swagger7.ApiOperation)({
2006
2133
  summary: `Find a ${this.getEntityClassName()} by id`,
2007
2134
  ...extras
2008
2135
  }),
2009
- (0, import_swagger6.ApiParam)({ name: "id", type: this.idType, required: true }),
2010
- (0, import_swagger6.ApiOkResponse)({ type: this.entityReturnMessageDto }),
2011
- (0, import_swagger6.ApiNotFoundResponse)({
2012
- type: import_nesties9.BlankReturnMessageDto,
2136
+ (0, import_swagger7.ApiParam)({ name: "id", type: this.idType, required: true }),
2137
+ (0, import_swagger7.ApiOkResponse)({ type: this.entityReturnMessageDto }),
2138
+ (0, import_swagger7.ApiNotFoundResponse)({
2139
+ type: import_nesties10.BlankReturnMessageDto,
2013
2140
  description: `The ${this.getEntityClassName()} with the given id was not found`
2014
2141
  })
2015
2142
  ]);
@@ -2022,49 +2149,58 @@ var RestfulFactory = class _RestfulFactory {
2022
2149
  }
2023
2150
  }
2024
2151
  findAll(extras = {}) {
2025
- return (0, import_nesties9.MergeMethodDecorators)([
2152
+ return (0, import_nesties10.MergeMethodDecorators)([
2026
2153
  this.usePrefix(import_common3.Get),
2027
- (0, import_swagger6.ApiOperation)({
2154
+ (0, import_swagger7.ApiOperation)({
2028
2155
  summary: `Find all ${this.getEntityClassName()}`,
2029
2156
  ...extras
2030
2157
  }),
2031
- (0, import_swagger6.ApiOkResponse)({ type: this.entityArrayReturnMessageDto })
2158
+ (0, import_swagger7.ApiOkResponse)({ type: this.entityArrayReturnMessageDto })
2032
2159
  ]);
2033
2160
  }
2034
2161
  findAllCursorPaginated(extras = {}) {
2035
- return (0, import_nesties9.MergeMethodDecorators)([
2162
+ return (0, import_nesties10.MergeMethodDecorators)([
2036
2163
  this.usePrefix(import_common3.Get),
2037
- (0, import_swagger6.ApiOperation)({
2164
+ (0, import_swagger7.ApiOperation)({
2038
2165
  summary: `Find all ${this.getEntityClassName()}`,
2039
2166
  ...extras
2040
2167
  }),
2041
- (0, import_swagger6.ApiOkResponse)({ type: this.entityCursorPaginationReturnMessageDto })
2168
+ (0, import_swagger7.ApiOkResponse)({ type: this.entityCursorPaginationReturnMessageDto })
2042
2169
  ]);
2043
2170
  }
2171
+ getBoolColumns() {
2172
+ const boolColumns = getSpecificFields(this.entityClass, "boolColumn");
2173
+ return import_lodash4.default.difference(boolColumns, this.fieldsInGetToOmit);
2174
+ }
2044
2175
  findAllParam() {
2045
- return (0, import_common3.Query)(GetPipe());
2176
+ const boolColumns = this.getBoolColumns();
2177
+ if (boolColumns.length) {
2178
+ return (0, import_common3.Query)(new ParseBoolObjectPipe(boolColumns), GetPipe());
2179
+ } else {
2180
+ return (0, import_common3.Query)(GetPipe());
2181
+ }
2046
2182
  }
2047
2183
  update(extras = {}) {
2048
- return (0, import_nesties9.MergeMethodDecorators)([
2184
+ return (0, import_nesties10.MergeMethodDecorators)([
2049
2185
  this.usePrefix(import_common3.Patch, ":id"),
2050
2186
  (0, import_common3.HttpCode)(200),
2051
- (0, import_swagger6.ApiOperation)({
2187
+ (0, import_swagger7.ApiOperation)({
2052
2188
  summary: `Update a ${this.getEntityClassName()} by id`,
2053
2189
  ...extras
2054
2190
  }),
2055
- (0, import_swagger6.ApiParam)({ name: "id", type: this.idType, required: true }),
2056
- (0, import_swagger6.ApiBody)({ type: this.updateDto }),
2057
- (0, import_swagger6.ApiOkResponse)({ type: import_nesties9.BlankReturnMessageDto }),
2058
- (0, import_swagger6.ApiNotFoundResponse)({
2059
- type: import_nesties9.BlankReturnMessageDto,
2191
+ (0, import_swagger7.ApiParam)({ name: "id", type: this.idType, required: true }),
2192
+ (0, import_swagger7.ApiBody)({ type: this.updateDto }),
2193
+ (0, import_swagger7.ApiOkResponse)({ type: import_nesties10.BlankReturnMessageDto }),
2194
+ (0, import_swagger7.ApiNotFoundResponse)({
2195
+ type: import_nesties10.BlankReturnMessageDto,
2060
2196
  description: `The ${this.getEntityClassName()} with the given id was not found`
2061
2197
  }),
2062
- (0, import_swagger6.ApiBadRequestResponse)({
2063
- type: import_nesties9.BlankReturnMessageDto,
2198
+ (0, import_swagger7.ApiBadRequestResponse)({
2199
+ type: import_nesties10.BlankReturnMessageDto,
2064
2200
  description: `The ${this.getEntityClassName()} is not valid`
2065
2201
  }),
2066
- (0, import_swagger6.ApiInternalServerErrorResponse)({
2067
- type: import_nesties9.BlankReturnMessageDto,
2202
+ (0, import_swagger7.ApiInternalServerErrorResponse)({
2203
+ type: import_nesties10.BlankReturnMessageDto,
2068
2204
  description: "Internal error"
2069
2205
  })
2070
2206
  ]);
@@ -2073,37 +2209,37 @@ var RestfulFactory = class _RestfulFactory {
2073
2209
  return (0, import_common3.Body)(UpdatePipe());
2074
2210
  }
2075
2211
  delete(extras = {}) {
2076
- return (0, import_nesties9.MergeMethodDecorators)([
2212
+ return (0, import_nesties10.MergeMethodDecorators)([
2077
2213
  this.usePrefix(import_common3.Delete, ":id"),
2078
2214
  (0, import_common3.HttpCode)(200),
2079
- (0, import_swagger6.ApiOperation)({
2215
+ (0, import_swagger7.ApiOperation)({
2080
2216
  summary: `Delete a ${this.getEntityClassName()} by id`,
2081
2217
  ...extras
2082
2218
  }),
2083
- (0, import_swagger6.ApiParam)({ name: "id", type: this.idType, required: true }),
2084
- (0, import_swagger6.ApiOkResponse)({ type: import_nesties9.BlankReturnMessageDto }),
2085
- (0, import_swagger6.ApiNotFoundResponse)({
2086
- type: import_nesties9.BlankReturnMessageDto,
2219
+ (0, import_swagger7.ApiParam)({ name: "id", type: this.idType, required: true }),
2220
+ (0, import_swagger7.ApiOkResponse)({ type: import_nesties10.BlankReturnMessageDto }),
2221
+ (0, import_swagger7.ApiNotFoundResponse)({
2222
+ type: import_nesties10.BlankReturnMessageDto,
2087
2223
  description: `The ${this.getEntityClassName()} with the given id was not found`
2088
2224
  }),
2089
- (0, import_swagger6.ApiInternalServerErrorResponse)({
2090
- type: import_nesties9.BlankReturnMessageDto,
2225
+ (0, import_swagger7.ApiInternalServerErrorResponse)({
2226
+ type: import_nesties10.BlankReturnMessageDto,
2091
2227
  description: "Internal error"
2092
2228
  })
2093
2229
  ]);
2094
2230
  }
2095
2231
  import(extras = {}) {
2096
- return (0, import_nesties9.MergeMethodDecorators)([
2232
+ return (0, import_nesties10.MergeMethodDecorators)([
2097
2233
  (0, import_common3.Post)("import"),
2098
2234
  (0, import_common3.HttpCode)(200),
2099
- (0, import_swagger6.ApiOperation)({
2235
+ (0, import_swagger7.ApiOperation)({
2100
2236
  summary: `Import ${this.getEntityClassName()}`,
2101
2237
  ...extras
2102
2238
  }),
2103
- (0, import_swagger6.ApiBody)({ type: this.importDto }),
2104
- (0, import_swagger6.ApiOkResponse)({ type: this.importReturnMessageDto }),
2105
- (0, import_swagger6.ApiInternalServerErrorResponse)({
2106
- type: import_nesties9.BlankReturnMessageDto,
2239
+ (0, import_swagger7.ApiBody)({ type: this.importDto }),
2240
+ (0, import_swagger7.ApiOkResponse)({ type: this.importReturnMessageDto }),
2241
+ (0, import_swagger7.ApiInternalServerErrorResponse)({
2242
+ type: import_nesties10.BlankReturnMessageDto,
2107
2243
  description: "Internal error"
2108
2244
  })
2109
2245
  ]);
@@ -2136,7 +2272,7 @@ var RestfulFactory = class _RestfulFactory {
2136
2272
  },
2137
2273
  findAll: {
2138
2274
  paramTypes: [
2139
- routeOptions.paginateType === "cursor" ? this.findAllCursorPaginatedDto : routeOptions.paginateType === "none" ? (0, import_swagger6.OmitType)(this.findAllDto, [
2275
+ routeOptions.paginateType === "cursor" ? this.findAllCursorPaginatedDto : routeOptions.paginateType === "none" ? (0, import_swagger7.OmitType)(this.findAllDto, [
2140
2276
  "pageCount",
2141
2277
  "recordsPerPage"
2142
2278
  ]) : this.findAllDto
@@ -2219,7 +2355,7 @@ var RestfulFactory = class _RestfulFactory {
2219
2355
  Object.defineProperty(cl.prototype, method, descriptor);
2220
2356
  });
2221
2357
  }
2222
- return RenameClass(cl, `${this.getEntityClassName()}Controller`);
2358
+ return (0, import_nesties11.RenameClass)(cl, `${this.getEntityClassName()}Controller`);
2223
2359
  }
2224
2360
  crudService(options = {}) {
2225
2361
  return CrudService(this.entityClass, {
@@ -2267,19 +2403,23 @@ var RestfulFactory = class _RestfulFactory {
2267
2403
  QueryLessEqual,
2268
2404
  QueryLike,
2269
2405
  QueryMatchBoolean,
2406
+ QueryMatchBooleanMySQL,
2270
2407
  QueryNotEqual,
2271
2408
  QueryOperator,
2272
2409
  QuerySearch,
2273
2410
  Relation,
2274
2411
  RelationComputed,
2275
- RenameClass,
2276
2412
  RestfulFactory,
2413
+ SimpleJsonColumn,
2277
2414
  StringColumn,
2278
2415
  StringIdBase,
2416
+ StringJsonColumn,
2417
+ TextColumn,
2279
2418
  TimeBase,
2280
2419
  UpdatePipe,
2281
2420
  UuidColumn,
2282
2421
  applyQueryMatchBoolean,
2422
+ applyQueryMatchBooleanMySQL,
2283
2423
  applyQueryProperty,
2284
2424
  applyQueryPropertyLike,
2285
2425
  applyQueryPropertySearch,