From 521122864dc8c1a0d590034dc2969323da320805 Mon Sep 17 00:00:00 2001 From: Julia Kondlatsch Date: Wed, 17 Jul 2024 14:49:13 -0300 Subject: [PATCH 1/2] feat(esocial): added evtToxic (S-2221) esocial message type --- src/esocial/index.ts | 3 ++ src/esocial/messages.ts | 2 ++ src/esocial/schemas/evtToxic.ts | 54 +++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 src/esocial/schemas/evtToxic.ts diff --git a/src/esocial/index.ts b/src/esocial/index.ts index 2a3f5a2..2b9eda2 100644 --- a/src/esocial/index.ts +++ b/src/esocial/index.ts @@ -2,6 +2,7 @@ import * as t from 'io-ts' import { eSocial as evtCAT } from './schemas/evtCAT' import { eSocial as evtMonit } from './schemas/evtMonit' +import { eSocial as evtToxic } from './schemas/evtMonit' import { eSocial as evtExpRisco } from './schemas/evtExpRisco' import { eSocial as evtExclusao } from './schemas/evtExclusao' import { eSocial as evtInfoEmpregador } from './schemas/evtInfoEmpregador' @@ -11,6 +12,7 @@ import { T_ideEmpregador } from './schemas/tipos' export { evtCAT, evtMonit, + evtToxic, evtExpRisco, evtExclusao, evtInfoEmpregador, @@ -24,6 +26,7 @@ export type IdeEmpregador = t.TypeOf export type eSocialObject = | evtCAT | evtMonit + | evtToxic | evtExpRisco | evtExclusao | evtInfoEmpregador diff --git a/src/esocial/messages.ts b/src/esocial/messages.ts index e7f390a..c6d57d3 100644 --- a/src/esocial/messages.ts +++ b/src/esocial/messages.ts @@ -2,6 +2,7 @@ import * as t from 'io-ts' import { eSocial as evtCAT } from './schemas/evtCAT' import { eSocial as evtMonit } from './schemas/evtMonit' +import { eSocial as evtToxic } from './schemas/evtToxic' import { eSocial as evtExclusao } from './schemas/evtExclusao' import { eSocial as evtExpRisco } from './schemas/evtExpRisco' import { eSocial as evtInfoEmpregador } from './schemas/evtInfoEmpregador' @@ -34,6 +35,7 @@ export const ESocialRequest = t.intersection([ message: t.union([ dataMessage('evtCAT', evtCAT), dataMessage('evtMonit', evtMonit), + dataMessage('evtToxic', evtToxic), dataMessage('evtExclusao', evtExclusao), dataMessage('evtExpRisco', evtExpRisco), dataMessage('evtInfoEmpregador', evtInfoEmpregador) diff --git a/src/esocial/schemas/evtToxic.ts b/src/esocial/schemas/evtToxic.ts new file mode 100644 index 0000000..e7de338 --- /dev/null +++ b/src/esocial/schemas/evtToxic.ts @@ -0,0 +1,54 @@ +import * as t from 'io-ts'; +import * as tipos from './tipos' + +/// S-2221 - Exame Toxicológico do Motorista Profissional Empregado +export const eSocial = t.type({ + /// Evento Exame Toxicológico do Motorista Profissional Empregado + /// CHAVE_GRUPO: {Id} + /// REGRA:REGRA_ENVIO_PROC_FECHAMENTO + /// REGRA:REGRA_EVENTOS_EXTEMP + /// REGRA:REGRA_EVENTO_EXT_SEM_IMPACTO_FOPAG + /// REGRA:REGRA_EVENTO_POSTERIOR_CAT_OBITO + /// REGRA:REGRA_EXISTE_INFO_EMPREGADOR + /// REGRA:REGRA_EXISTE_VINCULO + /// REGRA:REGRA_EXTEMP_REINTEGRACAO + /// REGRA:REGRA_MESMO_PROCEMI + /// REGRA:REGRA_RETIFICA_MESMO_VINCULO + evtToxic: t.type({ + $: t.type({ + Id: tipos.TS_Id + }), + ideEvento: tipos.T_ideEvento_trab, + ideEmpregador: tipos.T_ideEmpregador, + ideVinculo: tipos.T_ideVinculo_sst, + /// Informações do exame toxicológico do motorista profissional. + /// CHAVE_GRUPO: {dtExame*} + toxicologico: t.intersection([ + t.type({ + /// Data da realização do exame toxicológico. + /// Validação: Deve ser uma data válida, igual ou anterior à data atual e igual ou posterior à data de início da obrigatoriedade deste evento para o empregador no eSocial. + dtExame: tipos.date, + /// CNPJ do laboratório responsável pela realização do exame. + /// Validação: Deve ser um CNPJ válido, com 14 (catorze) algarismos. + cnpjLab: tipos.TS_cnpj, + /// Código do exame toxicológico. + /// Validação: Deve possuir 11 (onze) caracteres, composto por duas letras (dois primeiros caracteres) e nove algarismos (últimos nove caracteres). + codSeqExame: t.string, // Use um tipo string para o código do exame, já que ele possui letras e números + /// Preencher com o nome do médico. + nmMed: tipos.TS_nome, + }), + t.partial({ + /// Número de inscrição do médico no Conselho Regional de Medicina - CRM. + /// Validação: Preenchimento obrigatório, exceto se o endereço do trabalhador em S-2200 ou S-2205 vigente em {dtExame}(./dtExame) for no exterior. + nrCRM: tipos.TS_crm, // CRM pode ser nulo se o endereço for no exterior + /// Preencher com a sigla da Unidade da Federação - UF de expedição do CRM. + /// Validação: Preenchimento obrigatório, exceto se o endereço do trabalhador em S-2200 ou S-2205 vigente em {dtExame}(./dtExame) for no exterior. + ufCRM: tipos.TS_uf // UF do CRM pode ser nula se o endereço for no exterior + }) + ]) + + }) +}) + +export type eSocial = t.TypeOf + From 219bd6935a16c458ff8a7960adc6590705b1ebac Mon Sep 17 00:00:00 2001 From: Julia Kondlatsch Date: Wed, 17 Jul 2024 14:52:37 -0300 Subject: [PATCH 2/2] feat(version): updated version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 55e8deb..f105a14 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "quirons-broker", - "version": "0.0.1-alpha.125", + "version": "0.0.1-alpha.126", "description": "A small library to expose the broker types", "main": "index.ts", "typings": "index.d.ts",