flit-modulo-exportacoes 2.0.28 → 2.0.30
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/dao/contas-elastic.js +110 -0
- package/lib/dao/elastic-base.js +110 -0
- package/lib/dao/empresas-elastic.js +116 -0
- package/lib/dao/empresas-feriado-elastic.js +119 -0
- package/lib/dao/eventos-exportacoes-elastic.js +122 -0
- package/lib/dao/feriados-elastic.js +132 -0
- package/lib/dao/jornadas-elastic.js +163 -0
- package/lib/dao/usuarios-elastic.js +109 -0
- package/{dist → lib}/index.d.ts +2 -1
- package/lib/index.js +523 -0
- package/{dist → lib}/models.d.ts +49 -0
- package/{dist → lib}/models.js +17 -1
- package/{dist → lib}/unificacao-eventos-repetidos.js +94 -63
- package/lib/utils.js +301 -0
- package/package.json +12 -15
- package/dist/dao/contas-elastic.js +0 -36
- package/dist/dao/elastic-base.js +0 -37
- package/dist/dao/empresas-elastic.js +0 -42
- package/dist/dao/empresas-feriado-elastic.js +0 -43
- package/dist/dao/eventos-exportacoes-elastic.js +0 -45
- package/dist/dao/feriados-elastic.js +0 -56
- package/dist/dao/jornadas-elastic.js +0 -85
- package/dist/dao/usuarios-elastic.js +0 -35
- package/dist/eventos-exportacoes-model.d.ts +0 -49
- package/dist/eventos-exportacoes-model.js +0 -19
- package/dist/index.js +0 -458
- package/dist/utils.js +0 -244
- package/tslint.json +0 -118
- /package/{dist → lib}/dao/contas-elastic.d.ts +0 -0
- /package/{dist → lib}/dao/elastic-base.d.ts +0 -0
- /package/{dist → lib}/dao/empresas-elastic.d.ts +0 -0
- /package/{dist → lib}/dao/empresas-feriado-elastic.d.ts +0 -0
- /package/{dist → lib}/dao/eventos-exportacoes-elastic.d.ts +0 -0
- /package/{dist → lib}/dao/feriados-elastic.d.ts +0 -0
- /package/{dist → lib}/dao/jornadas-elastic.d.ts +0 -0
- /package/{dist → lib}/dao/usuarios-elastic.d.ts +0 -0
- /package/{dist → lib}/unificacao-eventos-repetidos.d.ts +0 -0
- /package/{dist → lib}/utils.d.ts +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
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.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]];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
return ContasElastic;
|
|
109
|
+
}(elastic_base_1.ElasticBase));
|
|
110
|
+
exports.ContasElastic = ContasElastic;
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.ElasticBase = void 0;
|
|
40
|
+
var ElasticBase = /** @class */ (function () {
|
|
41
|
+
function ElasticBase(elasticClient) {
|
|
42
|
+
this.totalRegistrosFiltradosElastic = 500;
|
|
43
|
+
this.elasticClient = elasticClient;
|
|
44
|
+
}
|
|
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
|
+
});
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
return ElasticBase;
|
|
109
|
+
}());
|
|
110
|
+
exports.ElasticBase = ElasticBase;
|
|
@@ -0,0 +1,116 @@
|
|
|
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.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()];
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
return EmpresasElastic;
|
|
115
|
+
}(elastic_base_1.ElasticBase));
|
|
116
|
+
exports.EmpresasElastic = EmpresasElastic;
|
|
@@ -0,0 +1,119 @@
|
|
|
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.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()];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
return EmpresasFeriadoElastic;
|
|
118
|
+
}(elastic_base_1.ElasticBase));
|
|
119
|
+
exports.EmpresasFeriadoElastic = EmpresasFeriadoElastic;
|
|
@@ -0,0 +1,122 @@
|
|
|
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;
|