flit-modulo-exportacoes 2.0.29 → 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.
@@ -1,110 +1,36 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
54
3
  exports.ContasElastic = void 0;
55
- var elastic_base_1 = require("./elastic-base");
56
- var ContasElastic = /** @class */ (function (_super) {
57
- __extends(ContasElastic, _super);
58
- function ContasElastic() {
59
- return _super !== null && _super.apply(this, arguments) || this;
60
- }
61
- ContasElastic.prototype.internalGetContasElastic = function (contaId) {
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: 'contas',
68
- size: this.totalRegistrosFiltradosElastic,
69
- _source: [
70
- 'parametros.horario_noturno'
71
- ],
72
- query: {
73
- bool: {
74
- must: [{
75
- match: {
76
- i_id: contaId
77
- }
78
- }, {
79
- match: {
80
- excluido: false
81
- }
82
- }]
83
- }
84
- },
85
- sort: [{
86
- i_id: 'asc'
87
- }]
88
- })];
89
- case 1: return [2 /*return*/, _a.sent()];
90
- }
91
- });
92
- });
93
- };
94
- ContasElastic.prototype.getContaElastic = function (contaId) {
95
- return __awaiter(this, void 0, void 0, function () {
96
- var _a;
97
- return __generator(this, function (_b) {
98
- switch (_b.label) {
99
- case 0:
100
- _a = this.retornaTodosDadosPaginacaoElastic;
101
- return [4 /*yield*/, this.internalGetContasElastic(contaId)];
102
- case 1: return [4 /*yield*/, _a.apply(this, [_b.sent()])];
103
- case 2: return [2 /*return*/, (_b.sent())[0]];
4
+ const elastic_base_1 = require("./elastic-base");
5
+ class ContasElastic extends elastic_base_1.ElasticBase {
6
+ async internalGetContasElastic(contaId) {
7
+ return await this.elasticClient.search({
8
+ scroll: '1m',
9
+ index: 'contas',
10
+ size: this.totalRegistrosFiltradosElastic,
11
+ _source: [
12
+ 'parametros.horario_noturno'
13
+ ],
14
+ query: {
15
+ bool: {
16
+ must: [{
17
+ match: {
18
+ i_id: contaId
19
+ }
20
+ }, {
21
+ match: {
22
+ excluido: false
23
+ }
24
+ }]
104
25
  }
105
- });
26
+ },
27
+ sort: [{
28
+ i_id: 'asc'
29
+ }]
106
30
  });
107
- };
108
- return ContasElastic;
109
- }(elastic_base_1.ElasticBase));
31
+ }
32
+ async getContaElastic(contaId) {
33
+ return (await this.retornaTodosDadosPaginacaoElastic(await this.internalGetContasElastic(contaId)))[0];
34
+ }
35
+ }
110
36
  exports.ContasElastic = ContasElastic;
@@ -1,110 +1,38 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- 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;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
2
  Object.defineProperty(exports, "__esModule", { value: true });
39
3
  exports.ElasticBase = void 0;
40
- var ElasticBase = /** @class */ (function () {
41
- function ElasticBase(elasticClient) {
42
- this.totalRegistrosFiltradosElastic = 500;
4
+ class ElasticBase {
5
+ elasticClient;
6
+ totalRegistrosFiltradosElastic = 500;
7
+ constructor(elasticClient) {
43
8
  this.elasticClient = elasticClient;
44
9
  }
45
- ElasticBase.prototype.searchScrollObjectElastic = function (scrollId) {
46
- return __awaiter(this, void 0, void 0, function () {
47
- return __generator(this, function (_a) {
48
- switch (_a.label) {
49
- case 0: return [4 /*yield*/, this.elasticClient.scroll({
50
- scroll: '1m',
51
- scroll_id: scrollId
52
- })];
53
- case 1: return [2 /*return*/, _a.sent()];
54
- }
55
- });
56
- });
57
- };
58
- ElasticBase.prototype.adicionarRegistrosPaginacaoElastic = function (_a) {
59
- var _b, _c, _d, _e;
60
- var scrollId = _a.scrollId, retorno = _a.retorno;
61
- return __awaiter(this, void 0, void 0, function () {
62
- var objetosPaginacao;
63
- return __generator(this, function (_f) {
64
- switch (_f.label) {
65
- case 0: return [4 /*yield*/, this.searchScrollObjectElastic(scrollId)];
66
- case 1:
67
- objetosPaginacao = _f.sent();
68
- _f.label = 2;
69
- case 2:
70
- if (!(((_c = (_b = objetosPaginacao === null || objetosPaginacao === void 0 ? void 0 : objetosPaginacao.hits) === null || _b === void 0 ? void 0 : _b.hits) !== null && _c !== void 0 ? _c : []).length > 0)) return [3 /*break*/, 4];
71
- ((_e = (_d = objetosPaginacao === null || objetosPaginacao === void 0 ? void 0 : objetosPaginacao.hits) === null || _d === void 0 ? void 0 : _d.hits) !== null && _e !== void 0 ? _e : []).forEach(function (objeto) { return retorno.push(objeto); });
72
- return [4 /*yield*/, this.searchScrollObjectElastic(scrollId)];
73
- case 3:
74
- objetosPaginacao = _f.sent();
75
- return [3 /*break*/, 2];
76
- case 4: return [2 /*return*/];
77
- }
78
- });
79
- });
80
- };
81
- ElasticBase.prototype.retornaTodosDadosPaginacaoElastic = function (filtroInicial) {
82
- var _a, _b, _c, _d;
83
- return __awaiter(this, void 0, void 0, function () {
84
- var retorno;
85
- return __generator(this, function (_e) {
86
- switch (_e.label) {
87
- case 0:
88
- retorno = new Array();
89
- ((_b = (_a = filtroInicial === null || filtroInicial === void 0 ? void 0 : filtroInicial.hits) === null || _a === void 0 ? void 0 : _a.hits) !== null && _b !== void 0 ? _b : []).forEach(function (objeto) { return retorno.push(objeto); });
90
- if (!(filtroInicial === null || filtroInicial === void 0 ? void 0 : filtroInicial._scroll_id)) return [3 /*break*/, 4];
91
- if (!(((_d = (_c = filtroInicial === null || filtroInicial === void 0 ? void 0 : filtroInicial.hits) === null || _c === void 0 ? void 0 : _c.total) !== null && _d !== void 0 ? _d : 0) > this.totalRegistrosFiltradosElastic)) return [3 /*break*/, 2];
92
- return [4 /*yield*/, this.adicionarRegistrosPaginacaoElastic({
93
- retorno: retorno,
94
- scrollId: filtroInicial === null || filtroInicial === void 0 ? void 0 : filtroInicial._scroll_id
95
- })];
96
- case 1:
97
- _e.sent();
98
- _e.label = 2;
99
- case 2: return [4 /*yield*/, this.elasticClient.clearScroll({ scroll_id: filtroInicial === null || filtroInicial === void 0 ? void 0 : filtroInicial._scroll_id })];
100
- case 3:
101
- _e.sent();
102
- _e.label = 4;
103
- case 4: return [2 /*return*/, retorno];
104
- }
105
- });
10
+ async searchScrollObjectElastic(scrollId) {
11
+ return await this.elasticClient.scroll({
12
+ scroll: '1m',
13
+ scroll_id: scrollId
106
14
  });
107
- };
108
- return ElasticBase;
109
- }());
15
+ }
16
+ async adicionarRegistrosPaginacaoElastic({ scrollId, retorno }) {
17
+ let objetosPaginacao = await this.searchScrollObjectElastic(scrollId);
18
+ while ((objetosPaginacao?.hits?.hits ?? []).length > 0) {
19
+ (objetosPaginacao?.hits?.hits ?? []).forEach(objeto => retorno.push(objeto));
20
+ objetosPaginacao = await this.searchScrollObjectElastic(scrollId);
21
+ }
22
+ }
23
+ async retornaTodosDadosPaginacaoElastic(filtroInicial) {
24
+ const retorno = new Array();
25
+ (filtroInicial?.hits?.hits ?? []).forEach(objeto => retorno.push(objeto));
26
+ if (filtroInicial?._scroll_id) {
27
+ if ((filtroInicial?.hits?.total ?? 0) > this.totalRegistrosFiltradosElastic) {
28
+ await this.adicionarRegistrosPaginacaoElastic({
29
+ retorno: retorno,
30
+ scrollId: filtroInicial?._scroll_id
31
+ });
32
+ }
33
+ await this.elasticClient.clearScroll({ scroll_id: filtroInicial?._scroll_id });
34
+ }
35
+ return retorno;
36
+ }
37
+ }
110
38
  exports.ElasticBase = ElasticBase;
@@ -1,116 +1,42 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
54
3
  exports.EmpresasElastic = void 0;
55
- var elastic_base_1 = require("./elastic-base");
56
- var EmpresasElastic = /** @class */ (function (_super) {
57
- __extends(EmpresasElastic, _super);
58
- function EmpresasElastic() {
59
- return _super !== null && _super.apply(this, arguments) || this;
60
- }
61
- EmpresasElastic.prototype.internalGetEmpresasElastic = function (contaId) {
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: 'contas_empresas',
68
- size: this.totalRegistrosFiltradosElastic,
69
- _source: [
70
- 'i_id',
71
- 'cnpj',
72
- 'razao',
73
- 'fantasia',
74
- 'endereco.uf',
75
- 'endereco.cidade',
76
- 'parametros.codigo_externo'
77
- ],
78
- query: {
79
- bool: {
80
- must: [{
81
- match: {
82
- i_parent_id: contaId
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*/, _a.sent()];
96
- }
97
- });
98
- });
99
- };
100
- EmpresasElastic.prototype.getEmpresasElastic = function (contaId) {
101
- return __awaiter(this, void 0, void 0, function () {
102
- var _a;
103
- return __generator(this, function (_b) {
104
- switch (_b.label) {
105
- case 0:
106
- _a = this.retornaTodosDadosPaginacaoElastic;
107
- return [4 /*yield*/, this.internalGetEmpresasElastic(contaId)];
108
- case 1: return [4 /*yield*/, _a.apply(this, [_b.sent()])];
109
- case 2: return [2 /*return*/, _b.sent()];
4
+ const elastic_base_1 = require("./elastic-base");
5
+ class EmpresasElastic extends elastic_base_1.ElasticBase {
6
+ async internalGetEmpresasElastic(contaId) {
7
+ return await this.elasticClient.search({
8
+ scroll: '1m',
9
+ index: 'contas_empresas',
10
+ size: this.totalRegistrosFiltradosElastic,
11
+ _source: [
12
+ 'i_id',
13
+ 'cnpj',
14
+ 'razao',
15
+ 'fantasia',
16
+ 'endereco.uf',
17
+ 'endereco.cidade',
18
+ 'parametros.codigo_externo'
19
+ ],
20
+ query: {
21
+ bool: {
22
+ must: [{
23
+ match: {
24
+ i_parent_id: contaId
25
+ }
26
+ }, {
27
+ match: {
28
+ excluido: false
29
+ }
30
+ }]
110
31
  }
111
- });
32
+ },
33
+ sort: [{
34
+ i_id: 'asc'
35
+ }]
112
36
  });
113
- };
114
- return EmpresasElastic;
115
- }(elastic_base_1.ElasticBase));
37
+ }
38
+ async getEmpresasElastic(contaId) {
39
+ return await this.retornaTodosDadosPaginacaoElastic(await this.internalGetEmpresasElastic(contaId));
40
+ }
41
+ }
116
42
  exports.EmpresasElastic = EmpresasElastic;
@@ -1,119 +1,43 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
54
3
  exports.EmpresasFeriadoElastic = void 0;
55
- var elastic_base_1 = require("./elastic-base");
56
- var EmpresasFeriadoElastic = /** @class */ (function (_super) {
57
- __extends(EmpresasFeriadoElastic, _super);
58
- function EmpresasFeriadoElastic() {
59
- return _super !== null && _super.apply(this, arguments) || this;
60
- }
61
- EmpresasFeriadoElastic.prototype.internalGeEmpresasFeriadoElastic = function (_a) {
62
- var empresaId = _a.empresaId, feriadoId = _a.feriadoId;
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_feriados_empresasferiado',
69
- size: this.totalRegistrosFiltradosElastic,
70
- _source: [
71
- 'i_id'
72
- ],
73
- query: {
74
- bool: {
75
- must: [{
76
- match: {
77
- i_parent_id: feriadoId
78
- }
79
- }, {
80
- match: {
81
- 'ref.i_id': empresaId
82
- }
83
- }, {
84
- match: {
85
- excluido: false
86
- }
87
- }]
88
- }
89
- },
90
- sort: [{
91
- i_id: 'asc'
92
- }]
93
- })];
94
- case 1: return [2 /*return*/, _b.sent()];
95
- }
96
- });
97
- });
98
- };
99
- EmpresasFeriadoElastic.prototype.getEmpresasFeriadoElastic = function (_a) {
100
- var empresaId = _a.empresaId, feriadoId = _a.feriadoId;
101
- return __awaiter(this, void 0, void 0, function () {
102
- var _b;
103
- return __generator(this, function (_c) {
104
- switch (_c.label) {
105
- case 0:
106
- _b = this.retornaTodosDadosPaginacaoElastic;
107
- return [4 /*yield*/, this.internalGeEmpresasFeriadoElastic({
108
- empresaId: empresaId,
109
- feriadoId: feriadoId
110
- })];
111
- case 1: return [4 /*yield*/, _b.apply(this, [_c.sent()])];
112
- case 2: return [2 /*return*/, _c.sent()];
4
+ const elastic_base_1 = require("./elastic-base");
5
+ class EmpresasFeriadoElastic extends elastic_base_1.ElasticBase {
6
+ async internalGeEmpresasFeriadoElastic({ empresaId, feriadoId }) {
7
+ return await this.elasticClient.search({
8
+ scroll: '1m',
9
+ index: 'contas_feriados_empresasferiado',
10
+ size: this.totalRegistrosFiltradosElastic,
11
+ _source: [
12
+ 'i_id'
13
+ ],
14
+ query: {
15
+ bool: {
16
+ must: [{
17
+ match: {
18
+ i_parent_id: feriadoId
19
+ }
20
+ }, {
21
+ match: {
22
+ 'ref.i_id': empresaId
23
+ }
24
+ }, {
25
+ match: {
26
+ excluido: false
27
+ }
28
+ }]
113
29
  }
114
- });
30
+ },
31
+ sort: [{
32
+ i_id: 'asc'
33
+ }]
115
34
  });
116
- };
117
- return EmpresasFeriadoElastic;
118
- }(elastic_base_1.ElasticBase));
35
+ }
36
+ async getEmpresasFeriadoElastic({ empresaId, feriadoId }) {
37
+ return await this.retornaTodosDadosPaginacaoElastic(await this.internalGeEmpresasFeriadoElastic({
38
+ empresaId: empresaId,
39
+ feriadoId: feriadoId
40
+ }));
41
+ }
42
+ }
119
43
  exports.EmpresasFeriadoElastic = EmpresasFeriadoElastic;