evolution-api-sdk
Version:
Unofficial SDK for the Evolution Whatsapp API v2
58 lines (54 loc) • 2.12 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/modules/messages/schemas/location.ts
var location_exports = {};
__export(location_exports, {
LocationMessageResponseTransform: () => LocationMessageResponseTransform,
ResponseSchema: () => ResponseSchema
});
module.exports = __toCommonJS(location_exports);
// src/types/tags.ts
var Jid = (jid) => jid;
var MessageId = (id) => id;
// src/utils/phone-numer-from-jid.ts
var import_libphonenumber_js = require("libphonenumber-js");
function phoneNumberFromJid(jid) {
return (0, import_libphonenumber_js.parsePhoneNumber)(`+${jid.split("@")[0]}`).number;
}
// src/modules/messages/schemas/location.ts
var LocationMessageResponseTransform = (data) => ({
receiver: {
phoneNumber: phoneNumberFromJid(data.key.remoteJid),
jid: Jid(data.key.remoteJid)
},
location: {
latitude: data.message.locationMessage.degreesLatitude,
longitude: data.message.locationMessage.degreesLongitude,
name: data.message.locationMessage.name,
address: data.message.locationMessage.address
},
id: MessageId(data.key.id),
timestamp: new Date(data.messageTimestamp)
});
var ResponseSchema = { parse: LocationMessageResponseTransform };
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
LocationMessageResponseTransform,
ResponseSchema
});
//# sourceMappingURL=location.js.map