flit-models 2.1.25 → 2.1.28

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/lib/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { EmpresaFeriado, EmpresaFeriadoBase, EmpresaFeriadoFireConvert, EmpresaFeriadoFirestoreData, EnumExcecaoStatus, EnumExcecaoTipo, Excecao, Feriado, FeriadoBase, FeriadoFireConvert, FeriadoFirestoreData, FeriadoJsonConvert, FeriadoJsonData, FeriadoTipoEnum, IExcecao, Lancamento, LancamentoBase, LancamentoFireConvert, LancamentoFirestoreData, LancamentoJsonConvert, LancamentoJsonData, LancamentoStatusEnum, LogLancamento, LogLancamentoBase, LogLancamentoFireConvert, LogLancamentoFirestoreData, LogLancamentoStatusEnum, TipoAcaoLancamentoEnum, TipoOcorrenciaFrequenciaEnum, TipoReferenciaLogLancamento, UsuarioLancamento, UsuarioLancamentoBase, UsuarioLancamentoFireConvert, UsuarioLancamentoFirestoreData, } from './models/index';
1
+ export { EmpresaFeriado, EmpresaFeriadoBase, EmpresaFeriadoFireConvert, EmpresaFeriadoFirestoreData, EnumExcecaoStatus, EnumExcecaoTipo, Excecao, Feriado, FeriadoBase, FeriadoFireConvert, FeriadoFirestoreData, FeriadoJsonConvert, FeriadoJsonData, FeriadoTipoEnum, IExcecao, Lancamento, LancamentoBase, LancamentoFireConvert, LancamentoFirestoreData, LancamentoJsonConvert, LancamentoJsonData, LancamentoStatusEnum, LogLancamentoFireConvert, LogLancamentoFirestoreData, TipoAcaoLancamentoEnum, TipoOcorrenciaFrequenciaEnum, TipoReferenciaUsuarioLancamento, UsuarioLancamento, UsuarioLancamentoBase, UsuarioLancamentoFireConvert, UsuarioLancamentoFirestoreData, VerificacaoLancamento, VerificacaoLancamentoBase, } from './models/index';
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UsuarioLancamentoFirestoreData = exports.UsuarioLancamentoFireConvert = exports.UsuarioLancamento = exports.TipoReferenciaLogLancamento = exports.TipoOcorrenciaFrequenciaEnum = exports.TipoAcaoLancamentoEnum = exports.LogLancamentoStatusEnum = exports.LogLancamentoFirestoreData = exports.LogLancamentoFireConvert = exports.LogLancamento = exports.LancamentoStatusEnum = exports.LancamentoJsonData = exports.LancamentoJsonConvert = exports.LancamentoFirestoreData = exports.LancamentoFireConvert = exports.Lancamento = exports.FeriadoTipoEnum = exports.FeriadoJsonData = exports.FeriadoJsonConvert = exports.FeriadoFirestoreData = exports.FeriadoFireConvert = exports.Feriado = exports.Excecao = exports.EnumExcecaoTipo = exports.EnumExcecaoStatus = exports.EmpresaFeriadoFirestoreData = exports.EmpresaFeriadoFireConvert = exports.EmpresaFeriado = void 0;
3
+ exports.VerificacaoLancamento = exports.UsuarioLancamentoFirestoreData = exports.UsuarioLancamentoFireConvert = exports.UsuarioLancamento = exports.TipoReferenciaUsuarioLancamento = exports.TipoOcorrenciaFrequenciaEnum = exports.TipoAcaoLancamentoEnum = exports.LogLancamentoFirestoreData = exports.LogLancamentoFireConvert = exports.LancamentoStatusEnum = exports.LancamentoJsonData = exports.LancamentoJsonConvert = exports.LancamentoFirestoreData = exports.LancamentoFireConvert = exports.Lancamento = exports.FeriadoTipoEnum = exports.FeriadoJsonData = exports.FeriadoJsonConvert = exports.FeriadoFirestoreData = exports.FeriadoFireConvert = exports.Feriado = exports.Excecao = exports.EnumExcecaoTipo = exports.EnumExcecaoStatus = exports.EmpresaFeriadoFirestoreData = exports.EmpresaFeriadoFireConvert = exports.EmpresaFeriado = void 0;
4
4
  var index_1 = require("./models/index");
5
5
  Object.defineProperty(exports, "EmpresaFeriado", { enumerable: true, get: function () { return index_1.EmpresaFeriado; } });
6
6
  Object.defineProperty(exports, "EmpresaFeriadoFireConvert", { enumerable: true, get: function () { return index_1.EmpresaFeriadoFireConvert; } });
@@ -20,13 +20,12 @@ Object.defineProperty(exports, "LancamentoFirestoreData", { enumerable: true, ge
20
20
  Object.defineProperty(exports, "LancamentoJsonConvert", { enumerable: true, get: function () { return index_1.LancamentoJsonConvert; } });
21
21
  Object.defineProperty(exports, "LancamentoJsonData", { enumerable: true, get: function () { return index_1.LancamentoJsonData; } });
22
22
  Object.defineProperty(exports, "LancamentoStatusEnum", { enumerable: true, get: function () { return index_1.LancamentoStatusEnum; } });
23
- Object.defineProperty(exports, "LogLancamento", { enumerable: true, get: function () { return index_1.LogLancamento; } });
24
23
  Object.defineProperty(exports, "LogLancamentoFireConvert", { enumerable: true, get: function () { return index_1.LogLancamentoFireConvert; } });
25
24
  Object.defineProperty(exports, "LogLancamentoFirestoreData", { enumerable: true, get: function () { return index_1.LogLancamentoFirestoreData; } });
26
- Object.defineProperty(exports, "LogLancamentoStatusEnum", { enumerable: true, get: function () { return index_1.LogLancamentoStatusEnum; } });
27
25
  Object.defineProperty(exports, "TipoAcaoLancamentoEnum", { enumerable: true, get: function () { return index_1.TipoAcaoLancamentoEnum; } });
28
26
  Object.defineProperty(exports, "TipoOcorrenciaFrequenciaEnum", { enumerable: true, get: function () { return index_1.TipoOcorrenciaFrequenciaEnum; } });
29
- Object.defineProperty(exports, "TipoReferenciaLogLancamento", { enumerable: true, get: function () { return index_1.TipoReferenciaLogLancamento; } });
27
+ Object.defineProperty(exports, "TipoReferenciaUsuarioLancamento", { enumerable: true, get: function () { return index_1.TipoReferenciaUsuarioLancamento; } });
30
28
  Object.defineProperty(exports, "UsuarioLancamento", { enumerable: true, get: function () { return index_1.UsuarioLancamento; } });
31
29
  Object.defineProperty(exports, "UsuarioLancamentoFireConvert", { enumerable: true, get: function () { return index_1.UsuarioLancamentoFireConvert; } });
32
30
  Object.defineProperty(exports, "UsuarioLancamentoFirestoreData", { enumerable: true, get: function () { return index_1.UsuarioLancamentoFirestoreData; } });
31
+ Object.defineProperty(exports, "VerificacaoLancamento", { enumerable: true, get: function () { return index_1.VerificacaoLancamento; } });
@@ -1,8 +1,8 @@
1
1
  import { TipoOcorrenciaFrequenciaEnum } from '../ocorrencia_frequencia';
2
2
  export * from './lancamento-fire-convert';
3
3
  export * from './lancamento-json-convert';
4
- export * from './logs/log-lancamento-fire-convert';
5
- export * from './logs/log-lancamento';
4
+ export * from './verificacoes/verificacao-lancamento-fire-convert';
5
+ export * from './verificacoes/verificacao-lancamento';
6
6
  export * from './usuarios/usuario-lancamento-fire-convert';
7
7
  export * from './usuarios/usuario-lancamento';
8
8
  export declare enum LancamentoStatusEnum {
@@ -17,8 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.Lancamento = exports.TipoAcaoLancamentoEnum = exports.LancamentoStatusEnum = void 0;
18
18
  __exportStar(require("./lancamento-fire-convert"), exports);
19
19
  __exportStar(require("./lancamento-json-convert"), exports);
20
- __exportStar(require("./logs/log-lancamento-fire-convert"), exports);
21
- __exportStar(require("./logs/log-lancamento"), exports);
20
+ __exportStar(require("./verificacoes/verificacao-lancamento-fire-convert"), exports);
21
+ __exportStar(require("./verificacoes/verificacao-lancamento"), exports);
22
22
  __exportStar(require("./usuarios/usuario-lancamento-fire-convert"), exports);
23
23
  __exportStar(require("./usuarios/usuario-lancamento"), exports);
24
24
  var LancamentoStatusEnum;
@@ -20,20 +20,20 @@ var LogLancamentoFireConvert = /** @class */ (function () {
20
20
  return new log_lancamento_1.LogLancamento({
21
21
  _id: (_a = doc.id) !== null && _a !== void 0 ? _a : null,
22
22
  _path: (_b = doc.ref.path) !== null && _b !== void 0 ? _b : null,
23
- data_criacao: (0, type_guards_1.TipoTimestampFirestore)(doc.get('jornada.data'))
24
- ? doc.get('data_inicial').toDate()
23
+ data_criacao: (0, type_guards_1.TipoTimestampFirestore)(doc.get('data_criacao'))
24
+ ? doc.get('data_criacao').toDate()
25
25
  : null,
26
26
  referencia: {
27
- ref: (0, type_guards_1.TipoDocumentReference)(doc.get('ref'))
28
- ? doc.get('ref').path
27
+ ref: (0, type_guards_1.TipoDocumentReference)(doc.get('referencia.ref'))
28
+ ? doc.get('referencia.ref').path
29
29
  : null,
30
- data: (0, type_guards_1.TipoTimestampFirestore)(doc.get('jornada.data'))
31
- ? doc.get('data_inicial').toDate()
30
+ data: (0, type_guards_1.TipoTimestampFirestore)(doc.get('referencia.data'))
31
+ ? doc.get('referencia.data').toDate()
32
32
  : null,
33
33
  tipo: string_helper_1.StringHelper.trim(doc.get('referencia.tipo'), null),
34
34
  },
35
35
  mensagem: string_helper_1.StringHelper.trim(doc.get('mensagem'), null),
36
- tipo: string_helper_1.StringHelper.trim(doc.get('status'), null),
36
+ tipo: string_helper_1.StringHelper.trim(doc.get('tipo'), null),
37
37
  detalhes: (_c = doc.get('detalhes')) !== null && _c !== void 0 ? _c : null,
38
38
  visto: (_d = doc.get('visto')) !== null && _d !== void 0 ? _d : false,
39
39
  });
@@ -39,8 +39,8 @@ export declare class LogLancamento implements LogLancamentoBase {
39
39
  visto: boolean;
40
40
  referencia: {
41
41
  tipo: TipoReferenciaLogLancamento;
42
- data?: any;
43
- ref: any;
42
+ data?: Date;
43
+ ref: string;
44
44
  };
45
45
  /**
46
46
  * Creates an instance of UsuarioLancamento.
@@ -0,0 +1,24 @@
1
+ import { DocumentReference, DocumentSnapshot, QueryDocumentSnapshot, Timestamp } from 'firebase/firestore';
2
+ import { VerificacaoLancamento, VerificacaoLancamentoBase, TipoReferenciaUsuarioLancamento } from './verificacao-lancamento';
3
+ export declare class LogLancamentoFirestoreData implements VerificacaoLancamentoBase {
4
+ detalhes?: {
5
+ [key: string]: any;
6
+ usuario?: {
7
+ documento: string;
8
+ nome: string;
9
+ ref: DocumentReference;
10
+ };
11
+ };
12
+ referencia: {
13
+ tipo: TipoReferenciaUsuarioLancamento;
14
+ data?: Timestamp;
15
+ ref: DocumentReference;
16
+ };
17
+ visto: boolean;
18
+ data_criacao: Timestamp;
19
+ mensagem: string;
20
+ }
21
+ export declare abstract class LogLancamentoFireConvert {
22
+ static fromFirestore(doc: DocumentSnapshot<LogLancamentoFirestoreData> | QueryDocumentSnapshot<LogLancamentoFirestoreData>): VerificacaoLancamento;
23
+ static toFirestore(logLancamento: VerificacaoLancamento, timestampfromDate: (date: Date) => any, documentReferenceFromPath: (path: string) => DocumentReference<any>): Partial<LogLancamentoFirestoreData>;
24
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LogLancamentoFireConvert = exports.LogLancamentoFirestoreData = void 0;
4
+ var lodash_1 = require("lodash");
5
+ var boolean_helper_1 = require("../../../utils/boolean-helper");
6
+ var string_helper_1 = require("../../../utils/string-helper");
7
+ var type_guards_1 = require("../../../utils/type-guards");
8
+ var verificacao_lancamento_1 = require("./verificacao-lancamento");
9
+ var LogLancamentoFirestoreData = /** @class */ (function () {
10
+ function LogLancamentoFirestoreData() {
11
+ }
12
+ return LogLancamentoFirestoreData;
13
+ }());
14
+ exports.LogLancamentoFirestoreData = LogLancamentoFirestoreData;
15
+ var LogLancamentoFireConvert = /** @class */ (function () {
16
+ function LogLancamentoFireConvert() {
17
+ }
18
+ LogLancamentoFireConvert.fromFirestore = function (doc) {
19
+ var _a, _b, _c, _d, _e, _f, _g;
20
+ var fireDocument = doc.data();
21
+ return new verificacao_lancamento_1.VerificacaoLancamento({
22
+ _id: (_a = doc.id) !== null && _a !== void 0 ? _a : null,
23
+ _path: (_b = doc.ref.path) !== null && _b !== void 0 ? _b : null,
24
+ data_criacao: (0, type_guards_1.TipoTimestampFirestore)(fireDocument === null || fireDocument === void 0 ? void 0 : fireDocument.data_criacao)
25
+ ? (fireDocument === null || fireDocument === void 0 ? void 0 : fireDocument.data_criacao).toDate()
26
+ : null,
27
+ referencia: {
28
+ ref: (0, type_guards_1.TipoDocumentReference)((_c = fireDocument === null || fireDocument === void 0 ? void 0 : fireDocument.referencia) === null || _c === void 0 ? void 0 : _c.ref)
29
+ ? fireDocument.referencia.ref.path
30
+ : null,
31
+ data: (0, type_guards_1.TipoTimestampFirestore)((_d = fireDocument === null || fireDocument === void 0 ? void 0 : fireDocument.referencia) === null || _d === void 0 ? void 0 : _d.data)
32
+ ? fireDocument.referencia.data.toDate()
33
+ : null,
34
+ tipo: string_helper_1.StringHelper.check(fireDocument.referencia.tipo, null),
35
+ },
36
+ mensagem: string_helper_1.StringHelper.trim(fireDocument === null || fireDocument === void 0 ? void 0 : fireDocument.mensagem, null),
37
+ detalhes: (fireDocument === null || fireDocument === void 0 ? void 0 : fireDocument.detalhes)
38
+ ? {
39
+ usuario: ((_e = fireDocument.detalhes) === null || _e === void 0 ? void 0 : _e.usuario)
40
+ ? {
41
+ documento: string_helper_1.StringHelper.check(fireDocument.detalhes.usuario.documento, null),
42
+ nome: string_helper_1.StringHelper.check(fireDocument.detalhes.usuario.nome, null),
43
+ ref: string_helper_1.StringHelper.check((_f = fireDocument.detalhes.usuario.ref) === null || _f === void 0 ? void 0 : _f.path, null),
44
+ }
45
+ : null,
46
+ }
47
+ : null,
48
+ visto: (_g = fireDocument === null || fireDocument === void 0 ? void 0 : fireDocument.visto) !== null && _g !== void 0 ? _g : false,
49
+ });
50
+ };
51
+ LogLancamentoFireConvert.toFirestore = function (logLancamento, timestampfromDate, documentReferenceFromPath) {
52
+ var _a;
53
+ var logLancamentoFirestore = {
54
+ mensagem: logLancamento.mensagem,
55
+ detalhes: (logLancamento === null || logLancamento === void 0 ? void 0 : logLancamento.detalhes)
56
+ ? {
57
+ usuario: ((_a = logLancamento.detalhes) === null || _a === void 0 ? void 0 : _a.usuario)
58
+ ? {
59
+ documento: string_helper_1.StringHelper.check(logLancamento.detalhes.usuario.documento, null),
60
+ nome: string_helper_1.StringHelper.check(logLancamento.detalhes.usuario.nome, null),
61
+ ref: documentReferenceFromPath(logLancamento.detalhes.usuario.ref),
62
+ }
63
+ : null,
64
+ }
65
+ : null,
66
+ data_criacao: timestampfromDate(logLancamento.data_criacao),
67
+ referencia: {
68
+ data: timestampfromDate(logLancamento.referencia.data),
69
+ ref: documentReferenceFromPath(logLancamento.referencia.ref),
70
+ tipo: string_helper_1.StringHelper.trim(logLancamento.referencia.tipo, null),
71
+ },
72
+ visto: boolean_helper_1.BooleanHelper.check(logLancamento.visto, false),
73
+ };
74
+ return (0, lodash_1.omitBy)(logLancamentoFirestore, lodash_1.isUndefined);
75
+ };
76
+ return LogLancamentoFireConvert;
77
+ }());
78
+ exports.LogLancamentoFireConvert = LogLancamentoFireConvert;
@@ -0,0 +1,55 @@
1
+ export declare enum TipoReferenciaUsuarioLancamento {
2
+ JORNADA = "JORNADA",
3
+ USUARIO = "USUARIO"
4
+ }
5
+ export interface VerificacaoLancamentoBase {
6
+ data_criacao: any;
7
+ mensagem: any;
8
+ detalhes?: {
9
+ usuario?: {
10
+ documento: any;
11
+ nome: any;
12
+ ref: any;
13
+ };
14
+ [key: string]: any;
15
+ };
16
+ referencia: {
17
+ tipo: any;
18
+ data?: any;
19
+ ref: any;
20
+ };
21
+ visto: any;
22
+ }
23
+ /**
24
+ * Internal class col contas/${contaId}/lancamentos/${lancamentoId}/verificacoes_lancamentos/${usuarioId}.
25
+ *
26
+ * @export
27
+ * @class UsuarioLancamento
28
+ * @implements {VerificacaoLancamentoBase}
29
+ */
30
+ export declare class VerificacaoLancamento implements VerificacaoLancamentoBase {
31
+ _id: string;
32
+ _path: string;
33
+ data_criacao: Date;
34
+ mensagem: string;
35
+ detalhes?: {
36
+ usuario?: {
37
+ documento: string;
38
+ nome: string;
39
+ ref: string;
40
+ };
41
+ [key: string]: any;
42
+ };
43
+ visto: boolean;
44
+ referencia: {
45
+ tipo: TipoReferenciaUsuarioLancamento;
46
+ data?: Date;
47
+ ref: string;
48
+ };
49
+ /**
50
+ * Creates an instance of UsuarioLancamento.
51
+ * @param {Partial<VerificacaoLancamento>} usuarioLancamentoPayload
52
+ * @memberof Lancamento
53
+ */
54
+ constructor(usuarioLancamentoPayload: Partial<VerificacaoLancamento>);
55
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VerificacaoLancamento = exports.TipoReferenciaUsuarioLancamento = void 0;
4
+ var TipoReferenciaUsuarioLancamento;
5
+ (function (TipoReferenciaUsuarioLancamento) {
6
+ TipoReferenciaUsuarioLancamento["JORNADA"] = "JORNADA";
7
+ TipoReferenciaUsuarioLancamento["USUARIO"] = "USUARIO";
8
+ })(TipoReferenciaUsuarioLancamento = exports.TipoReferenciaUsuarioLancamento || (exports.TipoReferenciaUsuarioLancamento = {}));
9
+ /**
10
+ * Internal class col contas/${contaId}/lancamentos/${lancamentoId}/verificacoes_lancamentos/${usuarioId}.
11
+ *
12
+ * @export
13
+ * @class UsuarioLancamento
14
+ * @implements {VerificacaoLancamentoBase}
15
+ */
16
+ var VerificacaoLancamento = /** @class */ (function () {
17
+ /**
18
+ * Creates an instance of UsuarioLancamento.
19
+ * @param {Partial<VerificacaoLancamento>} usuarioLancamentoPayload
20
+ * @memberof Lancamento
21
+ */
22
+ function VerificacaoLancamento(usuarioLancamentoPayload) {
23
+ var _this = this;
24
+ var keysOfProps = ["data_criacao", "_id", "_path", "mensagem", "detalhes", "visto", "referencia"];
25
+ keysOfProps.forEach(function (key) {
26
+ _this[key] = usuarioLancamentoPayload
27
+ ? usuarioLancamentoPayload[key]
28
+ : undefined;
29
+ });
30
+ }
31
+ return VerificacaoLancamento;
32
+ }());
33
+ exports.VerificacaoLancamento = VerificacaoLancamento;
@@ -1,3 +1,4 @@
1
1
  export declare abstract class StringHelper {
2
+ static check(str: string, def: string | null): string;
2
3
  static trim(str: string, def: string | null): string;
3
4
  }
@@ -4,6 +4,14 @@ exports.StringHelper = void 0;
4
4
  var StringHelper = /** @class */ (function () {
5
5
  function StringHelper() {
6
6
  }
7
+ StringHelper.check = function (str, def) {
8
+ if (typeof str === 'string') {
9
+ return String(str);
10
+ }
11
+ else {
12
+ return def;
13
+ }
14
+ };
7
15
  StringHelper.trim = function (str, def) {
8
16
  if (typeof str === 'string') {
9
17
  return str.trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flit-models",
3
- "version": "2.1.25",
3
+ "version": "2.1.28",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",