flit-modulo-exportacoes 2.0.30 → 2.0.31

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.
Files changed (38) hide show
  1. package/dist/dao/contas-elastic.js +36 -0
  2. package/dist/dao/elastic-base.js +38 -0
  3. package/dist/dao/empresas-elastic.js +42 -0
  4. package/dist/dao/empresas-feriado-elastic.js +43 -0
  5. package/dist/dao/eventos-exportacoes-elastic.js +45 -0
  6. package/dist/dao/feriados-elastic.js +56 -0
  7. package/dist/dao/jornadas-elastic.js +85 -0
  8. package/dist/dao/usuarios-elastic.js +35 -0
  9. package/dist/eventos-exportacoes-model.d.ts +49 -0
  10. package/dist/eventos-exportacoes-model.js +19 -0
  11. package/{lib → dist}/index.d.ts +1 -2
  12. package/dist/index.js +458 -0
  13. package/{lib → dist}/models.d.ts +0 -49
  14. package/{lib → dist}/models.js +1 -17
  15. package/{lib → dist}/unificacao-eventos-repetidos.js +63 -94
  16. package/dist/utils.js +244 -0
  17. package/package.json +13 -12
  18. package/tslint.json +118 -0
  19. package/lib/dao/contas-elastic.js +0 -110
  20. package/lib/dao/elastic-base.js +0 -110
  21. package/lib/dao/empresas-elastic.js +0 -116
  22. package/lib/dao/empresas-feriado-elastic.js +0 -119
  23. package/lib/dao/eventos-exportacoes-elastic.js +0 -122
  24. package/lib/dao/feriados-elastic.js +0 -132
  25. package/lib/dao/jornadas-elastic.js +0 -163
  26. package/lib/dao/usuarios-elastic.js +0 -109
  27. package/lib/index.js +0 -523
  28. package/lib/utils.js +0 -301
  29. /package/{lib → dist}/dao/contas-elastic.d.ts +0 -0
  30. /package/{lib → dist}/dao/elastic-base.d.ts +0 -0
  31. /package/{lib → dist}/dao/empresas-elastic.d.ts +0 -0
  32. /package/{lib → dist}/dao/empresas-feriado-elastic.d.ts +0 -0
  33. /package/{lib → dist}/dao/eventos-exportacoes-elastic.d.ts +0 -0
  34. /package/{lib → dist}/dao/feriados-elastic.d.ts +0 -0
  35. /package/{lib → dist}/dao/jornadas-elastic.d.ts +0 -0
  36. /package/{lib → dist}/dao/usuarios-elastic.d.ts +0 -0
  37. /package/{lib → dist}/unificacao-eventos-repetidos.d.ts +0 -0
  38. /package/{lib → dist}/utils.d.ts +0 -0
@@ -1,122 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
- Object.defineProperty(exports, "__esModule", { value: true });
54
- exports.EventosExportacoesElastic = void 0;
55
- var elastic_base_1 = require("./elastic-base");
56
- var EventosExportacoesElastic = /** @class */ (function (_super) {
57
- __extends(EventosExportacoesElastic, _super);
58
- function EventosExportacoesElastic() {
59
- return _super !== null && _super.apply(this, arguments) || this;
60
- }
61
- EventosExportacoesElastic.prototype.internalGetEventosExportacoesElastic = function (_a) {
62
- var contaId = _a.contaId, tabelaEventosId = _a.tabelaEventosId;
63
- return __awaiter(this, void 0, void 0, function () {
64
- return __generator(this, function (_b) {
65
- switch (_b.label) {
66
- case 0: return [4 /*yield*/, this.elasticClient.search({
67
- scroll: '1m',
68
- index: 'contas_eventosexportacoes',
69
- size: this.totalRegistrosFiltradosElastic,
70
- _source: [
71
- 'eventos',
72
- 'forma_envio_faltas'
73
- ],
74
- query: {
75
- bool: {
76
- must: [{
77
- match: {
78
- i_parent_id: contaId
79
- }
80
- }, {
81
- match: {
82
- i_id: tabelaEventosId
83
- }
84
- }, {
85
- match: {
86
- excluido: false
87
- }
88
- }]
89
- }
90
- },
91
- sort: [{
92
- i_id: 'asc'
93
- }]
94
- })];
95
- case 1: return [2 /*return*/, _b.sent()];
96
- }
97
- });
98
- });
99
- };
100
- EventosExportacoesElastic.prototype.getEventosExportacoesElastic = function (_a) {
101
- var contaId = _a.contaId, tabelaEventosId = _a.tabelaEventosId;
102
- return __awaiter(this, void 0, void 0, function () {
103
- var retorno, _b;
104
- return __generator(this, function (_c) {
105
- switch (_c.label) {
106
- case 0:
107
- _b = this.retornaTodosDadosPaginacaoElastic;
108
- return [4 /*yield*/, this.internalGetEventosExportacoesElastic({
109
- contaId: contaId,
110
- tabelaEventosId: tabelaEventosId
111
- })];
112
- case 1: return [4 /*yield*/, _b.apply(this, [_c.sent()])];
113
- case 2:
114
- retorno = _c.sent();
115
- return [2 /*return*/, retorno[0]];
116
- }
117
- });
118
- });
119
- };
120
- return EventosExportacoesElastic;
121
- }(elastic_base_1.ElasticBase));
122
- exports.EventosExportacoesElastic = EventosExportacoesElastic;
@@ -1,132 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
- var __importDefault = (this && this.__importDefault) || function (mod) {
54
- return (mod && mod.__esModule) ? mod : { "default": mod };
55
- };
56
- Object.defineProperty(exports, "__esModule", { value: true });
57
- exports.FeriadosElastic = void 0;
58
- var moment_1 = __importDefault(require("moment"));
59
- var elastic_base_1 = require("./elastic-base");
60
- var FeriadosElastic = /** @class */ (function (_super) {
61
- __extends(FeriadosElastic, _super);
62
- function FeriadosElastic() {
63
- return _super !== null && _super.apply(this, arguments) || this;
64
- }
65
- FeriadosElastic.prototype.internalGetFeriadosElastic = function (_a) {
66
- var contaId = _a.contaId, dataFinal = _a.dataFinal, dataInicial = _a.dataInicial;
67
- return __awaiter(this, void 0, void 0, function () {
68
- return __generator(this, function (_b) {
69
- switch (_b.label) {
70
- case 0: return [4 /*yield*/, this.elasticClient.search({
71
- scroll: '1m',
72
- index: 'contas_feriados',
73
- size: this.totalRegistrosFiltradosElastic,
74
- _source: [
75
- 'uf',
76
- 'i_id',
77
- 'tipo',
78
- 'data',
79
- 'municipio',
80
- 'todas_empresas'
81
- ],
82
- query: {
83
- bool: {
84
- must: [{
85
- match: {
86
- i_parent_id: contaId
87
- }
88
- }, {
89
- match: {
90
- excluido: false
91
- }
92
- }, {
93
- range: {
94
- data: {
95
- gte: (0, moment_1.default)(dataInicial).format('YYYY-MM-DDTHH:mm:ss.SSS'),
96
- lte: (0, moment_1.default)(dataFinal).format('YYYY-MM-DDTHH:mm:ss.SSS')
97
- }
98
- }
99
- }]
100
- }
101
- },
102
- sort: [{
103
- data: 'asc'
104
- }]
105
- })];
106
- case 1: return [2 /*return*/, _b.sent()];
107
- }
108
- });
109
- });
110
- };
111
- FeriadosElastic.prototype.getFeriadosElastic = function (_a) {
112
- var contaId = _a.contaId, dataFinal = _a.dataFinal, dataInicial = _a.dataInicial;
113
- return __awaiter(this, void 0, void 0, function () {
114
- var _b;
115
- return __generator(this, function (_c) {
116
- switch (_c.label) {
117
- case 0:
118
- _b = this.retornaTodosDadosPaginacaoElastic;
119
- return [4 /*yield*/, this.internalGetFeriadosElastic({
120
- contaId: contaId,
121
- dataFinal: dataFinal,
122
- dataInicial: dataInicial
123
- })];
124
- case 1: return [4 /*yield*/, _b.apply(this, [_c.sent()])];
125
- case 2: return [2 /*return*/, _c.sent()];
126
- }
127
- });
128
- });
129
- };
130
- return FeriadosElastic;
131
- }(elastic_base_1.ElasticBase));
132
- exports.FeriadosElastic = FeriadosElastic;
@@ -1,163 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
- var __importDefault = (this && this.__importDefault) || function (mod) {
54
- return (mod && mod.__esModule) ? mod : { "default": mod };
55
- };
56
- Object.defineProperty(exports, "__esModule", { value: true });
57
- exports.JornadasElastic = void 0;
58
- var moment_1 = __importDefault(require("moment"));
59
- var elastic_base_1 = require("./elastic-base");
60
- var JornadasElastic = /** @class */ (function (_super) {
61
- __extends(JornadasElastic, _super);
62
- function JornadasElastic() {
63
- return _super !== null && _super.apply(this, arguments) || this;
64
- }
65
- JornadasElastic.prototype.internalGetJornadasElastic = function (_a) {
66
- var fim = _a.fim, inicio = _a.inicio, contaId = _a.contaId, empresaId = _a.empresaId, usuarioId = _a.usuarioId;
67
- return __awaiter(this, void 0, void 0, function () {
68
- var queryMust;
69
- return __generator(this, function (_b) {
70
- switch (_b.label) {
71
- case 0:
72
- queryMust = new Array();
73
- queryMust.push({
74
- match: {
75
- i_parent_id: contaId
76
- }
77
- });
78
- queryMust.push({
79
- match: {
80
- 'usuario.empresa.uid': empresaId
81
- }
82
- });
83
- if (usuarioId) {
84
- queryMust.push({
85
- match: {
86
- 'usuario.uid': usuarioId
87
- }
88
- });
89
- }
90
- queryMust.push({
91
- range: {
92
- data_hora: {
93
- gte: (0, moment_1.default)(inicio).format('YYYY-MM-DDTHH:mm:ss.SSS'),
94
- lte: (0, moment_1.default)(fim).format('YYYY-MM-DDTHH:mm:ss.SSS')
95
- }
96
- }
97
- });
98
- return [4 /*yield*/, this.elasticClient.search({
99
- scroll: '1m',
100
- index: 'contas_jornadas',
101
- size: this.totalRegistrosFiltradosElastic,
102
- _source: [
103
- 'data_hora',
104
- 'usuario.uid',
105
- 'usuario.cpf',
106
- 'usuario.pis',
107
- 'horas_extras',
108
- 'horas_normais',
109
- 'horas_noturnas',
110
- 'horas_negativas',
111
- 'jornada_prevista',
112
- 'jornada_realizada',
113
- 'regime_compensacao',
114
- 'usuario.cargo.nome',
115
- 'usuario.empresa.uf',
116
- 'faixas_horas_extras',
117
- 'usuario.empresa.uid',
118
- 'marcacoes_ignoradas',
119
- 'usuario.empresa.cnpj',
120
- 'horas_noturnas_extras',
121
- 'usuario.empresa.cidade',
122
- 'horas_extras_intrajornada',
123
- 'usuario.parametros.codigo_externo',
124
- 'usuario.empresa.parametros.codigo_externo'
125
- ],
126
- query: {
127
- bool: {
128
- must: queryMust
129
- }
130
- },
131
- sort: [{
132
- data_hora: 'asc'
133
- }]
134
- })];
135
- case 1: return [2 /*return*/, _b.sent()];
136
- }
137
- });
138
- });
139
- };
140
- JornadasElastic.prototype.getJornadasElastic = function (_a) {
141
- var contaId = _a.contaId, dataFinal = _a.dataFinal, usuarioId = _a.usuarioId, empresaId = _a.empresaId, dataInicial = _a.dataInicial;
142
- return __awaiter(this, void 0, void 0, function () {
143
- var _b;
144
- return __generator(this, function (_c) {
145
- switch (_c.label) {
146
- case 0:
147
- _b = this.retornaTodosDadosPaginacaoElastic;
148
- return [4 /*yield*/, this.internalGetJornadasElastic({
149
- fim: dataFinal,
150
- contaId: contaId,
151
- inicio: dataInicial,
152
- empresaId: empresaId,
153
- usuarioId: usuarioId
154
- })];
155
- case 1: return [4 /*yield*/, _b.apply(this, [_c.sent()])];
156
- case 2: return [2 /*return*/, _c.sent()];
157
- }
158
- });
159
- });
160
- };
161
- return JornadasElastic;
162
- }(elastic_base_1.ElasticBase));
163
- exports.JornadasElastic = JornadasElastic;
@@ -1,109 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
- Object.defineProperty(exports, "__esModule", { value: true });
54
- exports.UsuariosElastic = void 0;
55
- var elastic_base_1 = require("./elastic-base");
56
- var UsuariosElastic = /** @class */ (function (_super) {
57
- __extends(UsuariosElastic, _super);
58
- function UsuariosElastic() {
59
- return _super !== null && _super.apply(this, arguments) || this;
60
- }
61
- UsuariosElastic.prototype.internalGetUsuariosElastic = function (idsUsuarios) {
62
- return __awaiter(this, void 0, void 0, function () {
63
- return __generator(this, function (_a) {
64
- switch (_a.label) {
65
- case 0: return [4 /*yield*/, this.elasticClient.search({
66
- scroll: '1m',
67
- index: 'usuarios',
68
- size: this.totalRegistrosFiltradosElastic,
69
- _source: [
70
- 'pis',
71
- 'cpf',
72
- 'i_id',
73
- 'parametros.codigo_externo'
74
- ],
75
- query: {
76
- bool: {
77
- filter: {
78
- terms: {
79
- i_id: idsUsuarios
80
- }
81
- }
82
- }
83
- },
84
- sort: [{
85
- i_id: 'asc'
86
- }]
87
- })];
88
- case 1: return [2 /*return*/, _a.sent()];
89
- }
90
- });
91
- });
92
- };
93
- UsuariosElastic.prototype.getUsuariosElastic = function (idsUsuarios) {
94
- return __awaiter(this, void 0, void 0, function () {
95
- var _a;
96
- return __generator(this, function (_b) {
97
- switch (_b.label) {
98
- case 0:
99
- _a = this.retornaTodosDadosPaginacaoElastic;
100
- return [4 /*yield*/, this.internalGetUsuariosElastic(idsUsuarios)];
101
- case 1: return [4 /*yield*/, _a.apply(this, [_b.sent()])];
102
- case 2: return [2 /*return*/, _b.sent()];
103
- }
104
- });
105
- });
106
- };
107
- return UsuariosElastic;
108
- }(elastic_base_1.ElasticBase));
109
- exports.UsuariosElastic = UsuariosElastic;