83 lines
3.2 KiB
JavaScript
83 lines
3.2 KiB
JavaScript
"use strict";
|
|
var __create = Object.create;
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __getProtoOf = Object.getPrototypeOf;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
// file that has been converted to a CommonJS file using a Babel-
|
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
mod
|
|
));
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
var funcoes_alertas_exports = {};
|
|
__export(funcoes_alertas_exports, {
|
|
enviarHoje: () => enviarHoje,
|
|
intervalosTipos: () => intervalosTipos
|
|
});
|
|
module.exports = __toCommonJS(funcoes_alertas_exports);
|
|
var import_dayjs = __toESM(require("dayjs"));
|
|
var import_weekOfYear = __toESM(require("dayjs/plugin/weekOfYear"));
|
|
import_dayjs.default.extend(import_weekOfYear.default);
|
|
const enviarHoje = (inter, data) => {
|
|
const hoje = (0, import_dayjs.default)(data || void 0);
|
|
if (!inter) return true;
|
|
if (inter == "D") return true;
|
|
if (inter == "M" && hoje.get("D") == 1) return true;
|
|
if (inter == "S" && hoje.get("d") == 1) return true;
|
|
if (inter == "S" && hoje.get("d") == 1 && hoje.week() % 2 == 1) return true;
|
|
return false;
|
|
};
|
|
const intervalosTipos = (tipoEntrada, log) => {
|
|
log.push(`intervalosTipos -> tipoEntrada:${tipoEntrada}`);
|
|
const config = {
|
|
M: {
|
|
campo_situacao: "situacao_texto_30",
|
|
prefixo_assunto: "(Previs\xE3o para os pr\xF3ximos 30 dias) ",
|
|
tipo: "M",
|
|
enviar_hoje: enviarHoje("M")
|
|
},
|
|
Q: {
|
|
campo_situacao: "situacao_texto_15",
|
|
prefixo_assunto: "(Previs\xE3o para os pr\xF3ximos 15 dias) ",
|
|
tipo: "Q",
|
|
enviar_hoje: enviarHoje("Q")
|
|
},
|
|
S: {
|
|
campo_situacao: "situacao_texto_7",
|
|
prefixo_assunto: "(Previs\xE3o para os pr\xF3ximos 7 dias) ",
|
|
tipo: "S",
|
|
enviar_hoje: enviarHoje("S")
|
|
},
|
|
D: {
|
|
campo_situacao: "situacao_texto",
|
|
prefixo_assunto: "",
|
|
tipo: "D",
|
|
enviar_hoje: enviarHoje("D")
|
|
}
|
|
};
|
|
const { campo_situacao, enviar_hoje, prefixo_assunto, tipo } = config[tipoEntrada || "D"] || config.D;
|
|
log.push(campo_situacao, prefixo_assunto, tipo, enviar_hoje ? "S" : "N");
|
|
return { campo_situacao, prefixo_assunto, tipo, enviar_hoje };
|
|
};
|
|
// Annotate the CommonJS export names for ESM import in node:
|
|
0 && (module.exports = {
|
|
enviarHoje,
|
|
intervalosTipos
|
|
});
|