flit-models 2.1.1 → 2.1.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.
@@ -19,9 +19,9 @@ var EmpresasFeriadoFireConvert = /** @class */ (function () {
19
19
  return new empresas_feriado_1.EmpresaFeriado({
20
20
  uid: (_a = doc.id) !== null && _a !== void 0 ? _a : null,
21
21
  path: (_b = doc.ref.path) !== null && _b !== void 0 ? _b : null,
22
- documento: string_helper_1.StringHelper.trim(doc.get('documento')),
23
- nome_fantasia: string_helper_1.StringHelper.trim(doc.get('nome_fantasia')),
24
- razao_social: string_helper_1.StringHelper.trim(doc.get('razao_social')),
22
+ documento: string_helper_1.StringHelper.trim(doc.get('documento'), null),
23
+ nome_fantasia: string_helper_1.StringHelper.trim(doc.get('nome_fantasia'), null),
24
+ razao_social: string_helper_1.StringHelper.trim(doc.get('razao_social'), null),
25
25
  ref: (0, type_guards_1.TipoDocumentReference)(doc.get('ref'))
26
26
  ? doc.get('ref').path
27
27
  : null,
@@ -24,25 +24,25 @@ var FeriadoFireConvert = /** @class */ (function () {
24
24
  data: (0, type_guards_1.TipoTimestampFirestore)(doc.get('data'))
25
25
  ? doc.get('data').toDate()
26
26
  : null,
27
- descricao: string_helper_1.StringHelper.trim(doc.get('descricao')),
27
+ descricao: string_helper_1.StringHelper.trim(doc.get('descricao'), null),
28
28
  excluido: boolean_helper_1.BooleanHelper.check(doc.get('excluido'), false),
29
- importacao_id: string_helper_1.StringHelper.trim(doc.get('importacao_id')),
30
- municipio: string_helper_1.StringHelper.trim(doc.get('municipio')),
31
- tipo: string_helper_1.StringHelper.trim(doc.get('tipo')),
29
+ importacao_id: string_helper_1.StringHelper.trim(doc.get('importacao_id'), null),
30
+ municipio: string_helper_1.StringHelper.trim(doc.get('municipio'), null),
31
+ tipo: string_helper_1.StringHelper.trim(doc.get('tipo'), null),
32
32
  todas_empresas: boolean_helper_1.BooleanHelper.check(doc.get('todas_empresas'), true),
33
- uf: string_helper_1.StringHelper.trim(doc.get('uf')),
33
+ uf: string_helper_1.StringHelper.trim(doc.get('uf'), null),
34
34
  });
35
35
  };
36
36
  FeriadoFireConvert.toFirestore = function (feriado) {
37
37
  return (0, lodash_1.omitBy)({
38
38
  data: firestore_1.Timestamp.fromDate(feriado.data),
39
- descricao: string_helper_1.StringHelper.trim(feriado.descricao),
39
+ descricao: string_helper_1.StringHelper.trim(feriado.descricao, null),
40
40
  excluido: boolean_helper_1.BooleanHelper.check(feriado.excluido, false),
41
- importacao_id: string_helper_1.StringHelper.trim(feriado.importacao_id),
42
- municipio: string_helper_1.StringHelper.trim(feriado.municipio),
43
- tipo: string_helper_1.StringHelper.trim(feriado.tipo),
41
+ importacao_id: string_helper_1.StringHelper.trim(feriado.importacao_id, null),
42
+ municipio: string_helper_1.StringHelper.trim(feriado.municipio, null),
43
+ tipo: string_helper_1.StringHelper.trim(feriado.tipo, null),
44
44
  todas_empresas: boolean_helper_1.BooleanHelper.check(feriado.todas_empresas, true),
45
- uf: string_helper_1.StringHelper.trim(feriado.uf),
45
+ uf: string_helper_1.StringHelper.trim(feriado.uf, null),
46
46
  }, lodash_1.isUndefined);
47
47
  };
48
48
  return FeriadoFireConvert;
@@ -20,14 +20,14 @@ var FeriadoJsonConvert = /** @class */ (function () {
20
20
  return new _1.Feriado({
21
21
  uid: (_a = obj.uid) !== null && _a !== void 0 ? _a : null,
22
22
  path: (_b = obj.path) !== null && _b !== void 0 ? _b : null,
23
- data: date_helper_1.DateHelper.fromString(obj.data),
24
- descricao: string_helper_1.StringHelper.trim(obj.descricao),
23
+ data: date_helper_1.DateHelper.fromString(obj.data, null),
24
+ descricao: string_helper_1.StringHelper.trim(obj.descricao, null),
25
25
  excluido: boolean_helper_1.BooleanHelper.check(obj.excluido, false),
26
- importacao_id: string_helper_1.StringHelper.trim(obj.importacao_id),
27
- municipio: string_helper_1.StringHelper.trim(obj.municipio),
28
- tipo: string_helper_1.StringHelper.trim(obj.tipo),
26
+ importacao_id: string_helper_1.StringHelper.trim(obj.importacao_id, null),
27
+ municipio: string_helper_1.StringHelper.trim(obj.municipio, null),
28
+ tipo: string_helper_1.StringHelper.trim(obj.tipo, null),
29
29
  todas_empresas: boolean_helper_1.BooleanHelper.check(obj.todas_empresas, true),
30
- uf: string_helper_1.StringHelper.trim(obj.uf),
30
+ uf: string_helper_1.StringHelper.trim(obj.uf, null),
31
31
  });
32
32
  };
33
33
  FeriadoJsonConvert.toJson = function (feriado) {
@@ -36,13 +36,13 @@ var FeriadoJsonConvert = /** @class */ (function () {
36
36
  uid: (_a = feriado.uid) !== null && _a !== void 0 ? _a : null,
37
37
  path: (_b = feriado.path) !== null && _b !== void 0 ? _b : null,
38
38
  data: feriado.data.toISOString(),
39
- descricao: string_helper_1.StringHelper.trim(feriado.descricao),
39
+ descricao: string_helper_1.StringHelper.trim(feriado.descricao, null),
40
40
  excluido: boolean_helper_1.BooleanHelper.check(feriado.excluido, false),
41
- importacao_id: string_helper_1.StringHelper.trim(feriado.importacao_id),
42
- municipio: string_helper_1.StringHelper.trim(feriado.municipio),
43
- tipo: string_helper_1.StringHelper.trim(feriado.tipo),
41
+ importacao_id: string_helper_1.StringHelper.trim(feriado.importacao_id, null),
42
+ municipio: string_helper_1.StringHelper.trim(feriado.municipio, null),
43
+ tipo: string_helper_1.StringHelper.trim(feriado.tipo, null),
44
44
  todas_empresas: boolean_helper_1.BooleanHelper.check(feriado.todas_empresas, true),
45
- uf: string_helper_1.StringHelper.trim(feriado.uf),
45
+ uf: string_helper_1.StringHelper.trim(feriado.uf, null),
46
46
  }, lodash_1.isUndefined);
47
47
  };
48
48
  return FeriadoJsonConvert;
@@ -1,4 +1,4 @@
1
1
  export declare abstract class DateHelper {
2
2
  static isValidDate(d: any): boolean;
3
- static fromString(str: string): Date;
3
+ static fromString(str: string, def: Date | null): Date;
4
4
  }
@@ -7,13 +7,13 @@ var DateHelper = /** @class */ (function () {
7
7
  DateHelper.isValidDate = function (d) {
8
8
  return d instanceof Date && !isNaN(d.getTime());
9
9
  };
10
- DateHelper.fromString = function (str) {
10
+ DateHelper.fromString = function (str, def) {
11
11
  var date = new Date(str);
12
12
  if (DateHelper.isValidDate(date)) {
13
13
  return date;
14
14
  }
15
15
  else {
16
- return null;
16
+ return def;
17
17
  }
18
18
  };
19
19
  return DateHelper;
@@ -1,3 +1,3 @@
1
1
  export declare abstract class StringHelper {
2
- static trim(str: string): string;
2
+ static trim(str: string, def: string | null): string;
3
3
  }
@@ -4,12 +4,12 @@ exports.StringHelper = void 0;
4
4
  var StringHelper = /** @class */ (function () {
5
5
  function StringHelper() {
6
6
  }
7
- StringHelper.trim = function (str) {
7
+ StringHelper.trim = function (str, def) {
8
8
  if (typeof str === 'string') {
9
9
  return str.trim();
10
10
  }
11
11
  else {
12
- return '';
12
+ return def;
13
13
  }
14
14
  };
15
15
  return StringHelper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flit-models",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",