diff --git a/dist/config.js b/dist/config.js index 8f07e5f..b5ff185 100644 --- a/dist/config.js +++ b/dist/config.js @@ -3,7 +3,9 @@ * What info we need to read actions from Proca action queue? * */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.DEFAULT_URL = exports.configFromOptions = exports.help = void 0; +exports.DEFAULT_URL = void 0; +exports.help = help; +exports.configFromOptions = configFromOptions; function help() { console.error(`set --env=path/to/.env and at minima CRM @@ -12,7 +14,6 @@ function help() { PROCA_QUEUE= [eg: cus.123.deliver] `); } -exports.help = help; // you can also use env vars, or any other config style function configFromOptions(opt, argv) { if (!process.env.PROCA_QUEUE) @@ -37,6 +38,5 @@ function configFromOptions(opt, argv) { concurrency: parseInt(process.env.concurrency || "1") || 1 }; } -exports.configFromOptions = configFromOptions; // our default queue server exports.DEFAULT_URL = "amqps://api.proca.app"; diff --git a/dist/crm.js b/dist/crm.js index 1d1b3e0..a4d94ad 100644 --- a/dist/crm.js +++ b/dist/crm.js @@ -35,7 +35,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.init = exports.CRM = exports.CRMType = exports.ProcessStatus = void 0; +exports.init = exports.CRM = exports.CRMType = exports.ProcaCampaign = exports.EventMessage = exports.ActionMessage = exports.ProcessStatus = void 0; +const queue_1 = require("@proca/queue"); +Object.defineProperty(exports, "ProcaCampaign", { enumerable: true, get: function () { return queue_1.Campaign; } }); +Object.defineProperty(exports, "ActionMessage", { enumerable: true, get: function () { return queue_1.ActionMessageV2; } }); +Object.defineProperty(exports, "EventMessage", { enumerable: true, get: function () { return queue_1.EventMessageV2; } }); const cli_color_1 = __importDefault(require("cli-color")); const spinner_1 = require("./spinner"); var ProcessStatus; @@ -94,98 +98,102 @@ class CRM { this.handleContact = (message) => __awaiter(this, void 0, void 0, function* () { throw new Error("you need to implement handleContact in your CRM"); }); + this.handleMessage = (message) => { + throw new Error("handleMessage method not implemented."); + }; this.formatResult = (result) => { if (typeof result === "boolean") return result; return result.processed; }; this.handleActionContact = (message) => __awaiter(this, void 0, void 0, function* () { - var _a, _b, _c, _d; - console.log(message); - //TODO DEAL WITH typescript tantrum here - // if (message.eventType) {// we are dealing with an event, not a contact - // const r = await this.handleEvent(message); - // } + var _a, _b, _c, _d, _e; + //DEAL WITH typescript tantrum + const email = 'privacy' in message ? (_a = message.contact) === null || _a === void 0 ? void 0 : _a.email : message.supporter.contact.email; + const actionId = 'privacy' in message ? message.actionId : 'event message'; switch (this.crmType) { case CRMType.Contact: - if (message.privacy.withConsent) { + // type guard: 'privacy' in message + if ('privacy' in message && message.privacy.withConsent) { const r = this.formatResult(yield this.handleContact(message)); if (r) { - this.log("added " + message.contact.email + " " + message.action.createdAt, ProcessStatus.processed); + this.log("added " + email + " " + message.action.createdAt, ProcessStatus.processed); } else { - this.log("failed " + message.contact.email + " " + message.action.createdAt, ProcessStatus.error); + this.log("failed " + email + " " + message.action.createdAt, ProcessStatus.error); } return r; } this.verbose && (console.log(message)); - this.log("don't know how to process " + message.contact.email, ProcessStatus.error); + this.log("don't know how to process " + email + " " + actionId, ProcessStatus.error); break; case CRMType.OptIn: - console.log(message.privacy, message.privacy.withConsent); - if (!message.privacy.withConsent) { - this.log("no withConsent " + message.actionId + " ," + message.action.actionType, ProcessStatus.skipped); - return true; - } - if (message.privacy.withConsent && message.privacy.optIn) { - const r = this.formatResult(yield this.handleContact(message)); - if (r) { - this.log("added " + message.contact.email + " " + message.action.createdAt, ProcessStatus.processed); + // type guard: 'privacy' in message + if ('privacy' in message) { + if (!message.privacy.withConsent) { + this.log("no withConsent " + message.actionId + " ," + message.action.actionType, ProcessStatus.skipped); + return true; } - else { - this.log("failed " + message.contact.email + " " + message.action.createdAt, ProcessStatus.error); + if (message.privacy.withConsent && message.privacy.optIn) { + const r = this.formatResult(yield this.handleContact(message)); + if (r) { + this.log("added " + email + " " + message.action.createdAt, ProcessStatus.processed); + } + else { + this.log("failed " + email + " " + message.action.createdAt, ProcessStatus.error); + } + return r; } - return r; - } - if (message.privacy.optIn === false) { - this.log("opt-out " + message.actionId, ProcessStatus.skipped); - // this.verbose && console.log('opt-out',message.actionId); - return true; //OptOut contact, we don't need to process - } - if (message.privacy.optIn === true) { - this.log("opt-in, but no withConsent " + message.actionId + ' ' + ((_a = message.action) === null || _a === void 0 ? void 0 : _a.actionType), ProcessStatus.skipped); - // this.verbose && console.log('opt-out',message.actionId); - return true; //OptOut contact, we don't need to process - } - if (((_b = message.privacy) === null || _b === void 0 ? void 0 : _b.emailStatus) === 'double_opt_in') { // double opt-in is optin (eg by email) - const r = this.formatResult(yield this.handleContact(message)); - if (r) { - this.log("added doi" + message.contact.email, ProcessStatus.processed); + if (message.privacy.optIn === false) { + this.log("opt-out " + actionId, ProcessStatus.skipped); + // this.verbose && console.log('opt-out',message.actionId); + return true; //OptOut contact, we don't need to process } - else { - this.log("failed doi" + message.contact.email, ProcessStatus.error); + if (message.privacy.optIn === true) { + this.log("opt-in, but no withConsent " + actionId + ' ' + ((_b = message.action) === null || _b === void 0 ? void 0 : _b.actionType), ProcessStatus.skipped); + // this.verbose && console.log('opt-out',message.actionId); + return true; //OptOut contact, we don't need to process } - return r; - } - if (message.privacy.optIn === null) { - this.log("optIn null (implicit) withConsent " + message.actionId + ' ' + ((_c = message.action) === null || _c === void 0 ? void 0 : _c.actionType), ProcessStatus.skipped); - return true; - /* - const r = this.formatResult(await this.handleContact(message)); - if (r) { - this.log("added with implicit optin" + message.contact.email+ " "+message.action.createdAt, ProcessStatus.processed); - } else { - this.log("failed with implicit optin" + message.contact.email+ " "+message.action.createdAt, ProcessStatus.error); + if (((_c = message.privacy) === null || _c === void 0 ? void 0 : _c.emailStatus) === 'double_opt_in') { // double opt-in is optin (eg by email) + const r = this.formatResult(yield this.handleContact(message)); + if (r) { + this.log("added doi" + email, ProcessStatus.processed); + } + else { + this.log("failed doi" + email, ProcessStatus.error); + } + return r; + } + if (message.privacy.optIn === null) { + this.log("optIn null (implicit) withConsent " + actionId + ' ' + ((_d = message.action) === null || _d === void 0 ? void 0 : _d.actionType), ProcessStatus.skipped); + return true; + /* + const r = this.formatResult(await this.handleContact(message)); + if (r) { + this.log("added with implicit optin" + message.contact.email+ " "+message.action.createdAt, ProcessStatus.processed); + } else { + this.log("failed with implicit optin" + message.contact.email+ " "+message.action.createdAt, ProcessStatus.error); + } + return r; */ } - return r; */ } - console.log(message); - this.log("don't know how to process -optin " + message.actionId, ProcessStatus.error); + this.log("don't know how to process -optin " + email + " " + actionId, ProcessStatus.error); break; case CRMType.DoubleOptIn: - if (((_d = message.privacy) === null || _d === void 0 ? void 0 : _d.emailStatus) === 'double_opt_in') { - const r = this.formatResult(yield this.handleContact(message)); + const emailStatus = 'privacy' in message ? (_e = message.privacy) === null || _e === void 0 ? void 0 : _e.emailStatus : message.supporter.privacy.emailStatus; + if (emailStatus === 'double_opt_in') { + const r = this.formatResult(yield this.handleMessage(message)); if (r) { - this.log("added doi " + message.contact.email + " " + message.actionId, ProcessStatus.processed); + this.log("added doi " + email + " " + actionId, ProcessStatus.processed); return true; } else { - this.log("failed doi " + message.contact.email + " " + message.actionId, ProcessStatus.error); + this.log("failed doi " + email + " " + actionId, ProcessStatus.error); return false; } } ; - this.log("skip sending, it is not double opt in " + message.contact.email + " " + message.actionId, ProcessStatus.error); + this.log("skip sending, it is not double opt in " + email + " " + actionId, ProcessStatus.error); return true; break; case CRMType.ActionContact: @@ -228,6 +236,7 @@ class CRM { case "double_opt_in": { console.log(`Double opt in from ${event.supporter.contact.email}`); yield this.setSubscribed(cont.id, true); + yield this.handleEvent(event); break; } // Different kinds of problems with email delivery: diff --git a/dist/crm/cleverreach.js b/dist/crm/cleverreach.js new file mode 100644 index 0000000..c1e94e4 --- /dev/null +++ b/dist/crm/cleverreach.js @@ -0,0 +1,70 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const crm_1 = require("../crm"); +const client_1 = require("./cleverreach/client"); +const data_1 = require("./cleverreach/data"); +class CleverreachCRM extends crm_1.CRM { + constructor(opt) { + super(opt); + this.token = null; + this.initializeToken = () => __awaiter(this, void 0, void 0, function* () { + try { + this.token = yield (0, client_1.getToken)(); + } + catch (error) { + throw new Error("Failed to retrieve token"); + } + }); + this.handleMessage = (message) => __awaiter(this, void 0, void 0, function* () { + if (message.schema === "proca:action:2") { + console.log("Action taken from the queue", message.action.id); + } + else if (message.schema === "proca:event:2") { + console.log("Event taken from queue", message.actionId); + message.contact = message.supporter.contact; + message.privacy = message.supporter.privacy; + } + if (this.verbose) { + console.log(message); + } + if (!message.campaign.externalId) { + console.error(`List ID missing, set the externalId for the campaign ${message.campaign.name}`); + return false; + } + ; + yield this.initializeToken(); + const listId = parseInt(message.campaign.externalId.toString().slice(0, 6), 10); + if (!this.token) { + throw new Error("Token is not available"); + } + const status = yield (0, client_1.postContact)(this.token, (0, data_1.formatAction)(message), listId); + console.log("status", status); + if (status === 200) { + console.log(`Message ${message.actionId} sent`); + return true; + } + else { + const retryStatus = yield (0, client_1.postContact)(this.token, (0, data_1.formatAction)(message, true), listId, true); + if (retryStatus === 200) { + return true; + } + else { + console.log(`Message ${message.actionId} not sent`); + return false; + } + } + }); + this.crmType = crm_1.CRMType.DoubleOptIn; + this.initializeToken(); + } +} +exports.default = CleverreachCRM; diff --git a/dist/crm/cleverreach/client.js b/dist/crm/cleverreach/client.js new file mode 100644 index 0000000..0061708 --- /dev/null +++ b/dist/crm/cleverreach/client.js @@ -0,0 +1,122 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.postContact = exports.getGroups = exports.getContact = exports.getToken = void 0; +const dotenv_1 = __importDefault(require("dotenv")); +dotenv_1.default.config(); +const authUrl = process.env.CRM_URL; +const tokenUrl = process.env.CRM_TOKEN_URL; +const ID = process.env.CRM_ID; //letters +const secret = process.env.CRM_SECRET; +const apiUrl = process.env.CRM_URL; +if (!authUrl || !tokenUrl || !ID || !tokenUrl || !apiUrl) { + console.error("No credentials"); + process.exit(1); +} +const getToken = () => __awaiter(void 0, void 0, void 0, function* () { + const authHeader = 'Basic ' + Buffer.from(`${ID}:${secret}`).toString('base64'); + try { + const response = yield fetch(tokenUrl, { + method: 'POST', + headers: { + 'Authorization': authHeader, + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + 'grant_type': 'client_credentials' + }) + }); + if (!response.ok) { + const errorBody = yield response.text(); + throw new Error(`Error fetching token: ${response.statusText} - ${errorBody}`); + } + const data = yield response.json(); + return data.access_token; + } + catch (error) { + console.error('Error:', error.message); + } +}); +exports.getToken = getToken; +const getContact = (email, token, listId) => __awaiter(void 0, void 0, void 0, function* () { + try { + const response = yield fetch(apiUrl + `/v3/receivers.json/${email}?group_id=${listId}`, { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` + } + }); + if (!response.ok) { + throw new Error(`Get receiver failed: ${response.statusText}`); + } + const data = yield response; + if (response.status === 200) + return true; + } + catch (error) { + console.error('Get groups contact error:', error.message); + } + return false; +}); +exports.getContact = getContact; +const getGroups = (token, listId) => __awaiter(void 0, void 0, void 0, function* () { + try { + const response = yield fetch(apiUrl + '/v3/groups/' + listId + '/receivers', { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}` + } + }); + if (!response.ok) { + throw new Error(`Get groups failed: ${response.statusText}`); + } + const data = yield response.text(); + console.log('Get groups response status:', data); + return data; + } + catch (error) { + console.error('Get groups contact error:', error.message); + } +}); +exports.getGroups = getGroups; +// '/receivers' returns Bad request, status 400 if contact already exists and not accepted +const postContact = (token_1, postData_1, listId_1, ...args_1) => __awaiter(void 0, [token_1, postData_1, listId_1, ...args_1], void 0, function* (token, postData, listId, update = false) { + const group = update ? '/receivers/upsert' : '/receivers/'; + try { + const response = yield fetch(apiUrl + '/v3/groups/' + listId + group, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}`, //, + 'name': 'Proca CR Import Export' + }, + body: JSON.stringify(postData) + }); + if (!response.ok && update === false) { + return response.status; + } + if (!response.ok) { + console.error('Post contact errooor:', response); + throw new Error(`Post contact failed: ${response.statusText}`); + } + const data = yield response; + return data.status; + } + catch (error) { + console.error('Post contact errooor:', error.message); + } +}); +exports.postContact = postContact; diff --git a/dist/crm/cleverreach/data.js b/dist/crm/cleverreach/data.js new file mode 100644 index 0000000..4663dc0 --- /dev/null +++ b/dist/crm/cleverreach/data.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.formatAction = void 0; +const formatAction = (message, update = false) => { + var _a, _b, _c; + const global = { + "petition": message.campaign.title, + "language": message.actionPage.locale, + "phone": ((_a = message.contact) === null || _a === void 0 ? void 0 : _a.phone) || "", + "double_opt_in": "yes", + "street": message.contact.street || "", + "zip": message.contact.postcode || "", + "lastname": message.contact.lastName || "", + "firstname": message.contact.firstName, + "country": message.contact.country || message.contact.area || "", + "company": ((_b = message.action.customFields) === null || _b === void 0 ? void 0 : _b.organisation) + ? (_c = message.action.customFields) === null || _c === void 0 ? void 0 : _c.organisation.toString() + : "", + "city": message.contact.locality || "", + "last_changed": message.privacy.emailStatusChanged || "" + }; + const attributes = { + created_at: message.action.createdAt + }; + // do not overwrite 'quelle' + if (!update) + global.quelle = message.campaign.title; + return ({ + "email": message.contact.email, + "source": message.tracking.location || "", + "attributes": attributes, + "global_attributes": global + }); +}; +exports.formatAction = formatAction; diff --git a/dist/crm/mailchimp.js b/dist/crm/mailchimp.js index 5526ce7..973b63a 100644 --- a/dist/crm/mailchimp.js +++ b/dist/crm/mailchimp.js @@ -69,7 +69,7 @@ class MailchimpCRM extends crm_1.CRM { return campaign; }); this.addContactToList = (client_2, list_id_1, member_1, ...args_1) => __awaiter(this, [client_2, list_id_1, member_1, ...args_1], void 0, function* (client, list_id, member, verbose = false) { - var _b, _c; + var _a, _b; if (!member.status) { member.status = member.status_if_new; } @@ -82,7 +82,7 @@ class MailchimpCRM extends crm_1.CRM { const response = yield client.lists.addListMember(list_id, member, { skipMergeValidation: true, }); - if ((_b = response.errors) === null || _b === void 0 ? void 0 : _b.length) { + if ((_a = response.errors) === null || _a === void 0 ? void 0 : _a.length) { console.error(response); throw new Error(response.errors); } @@ -95,7 +95,7 @@ class MailchimpCRM extends crm_1.CRM { return true; } catch (e) { - const b = ((_c = e === null || e === void 0 ? void 0 : e.response) === null || _c === void 0 ? void 0 : _c.body) || e; + const b = ((_b = e === null || e === void 0 ? void 0 : e.response) === null || _b === void 0 ? void 0 : _b.body) || e; switch (b === null || b === void 0 ? void 0 : b.title) { case "Member Exists": if (verbose) { diff --git a/dist/crm/publicComment.js b/dist/crm/publicComment.js new file mode 100644 index 0000000..e8ec51c --- /dev/null +++ b/dist/crm/publicComment.js @@ -0,0 +1,97 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const crm_1 = require("../crm"); +const supabase_js_1 = require("@supabase/supabase-js"); +class PublicCommentCRM extends crm_1.CRM { + constructor(opt) { + super(opt); + this.init = () => __awaiter(this, void 0, void 0, function* () { + // build the api connection, potentially load some constant or extra data you might need + if (this.config.user) { + const { data, error } = yield this.crmAPI.auth.signInWithPassword({ + email: this.config.user, + password: this.config.password, + }); + console.log(data, error); + if (error) + throw new Error(error); + this.crmAPI.auth.startAutoRefresh(); + } + else { + console.info("Starting as anonymous. Consider adding AUTH_USER and AUTH_PATH in your env instead."); + // const { data, error } = await this.crmAPI.auth.signInAnonymously(); + // console.log(data, error); + //if (error) throw new Error (error); + //this.crmAPI.auth.startAutoRefresh(); + } + return true; + }); + this.fetchCampaign = (campaign) => __awaiter(this, void 0, void 0, function* () { + return campaign; + }); + this.handleContact = (message) => __awaiter(this, void 0, void 0, function* () { + if (this.verbose) { + console.log("processing...", message); + } + const camp = yield this.campaign(message.campaign); + const comment = message.action.customFields.comment; + if (!comment) { + console.log("nothing to save, no comment on the action"); + return true; + } + const data = { + // id: message.actionId, let's keep the sequence + created_at: message.action.createdAt, + comment: comment.toString(), + campaign: camp.name, + widget_id: message.actionPageId, + uuid: message.contact.contactRef, + lang: message.actionPage.locale, + }; + if (message.contact.area) + data.area = message.contact.area; + if (message.contact.firstName) { + data.name = message.contact.firstName.trim(); + if (message.contact.lastName) { + data.name += " " + message.contact.lastName.charAt(0).toUpperCase().trim(); + } + if (message.action.customFields.locality) { + data.locality = message.action.customFields.locality.toString(); + data.name = data.name + ", " + data.locality; + } + } + console.log(data); + const { error } = yield this.crmAPI.from("comments").insert(data); + if (!error) + return true; + if (error.code === "23505") + //ack already processed 'duplicate key value violates unique constraint "actions_proca_id_key"' + return true; + console.log(error); + return false; + }); + this.crmType = crm_1.CRMType.Contact; + if (!process.env.CRM_URL) { + console.error("you need to set the url of your crm endpoint in the .env.xx"); + process.exit(1); + } + let config = { + server: process.env.CRM_URL || "missing", + publicKey: process.env.AUTH_ANON_KEY || "missing", + user: process.env.AUTH_USER, + password: process.env.AUTH_PASS, + }; + this.crmAPI = (0, supabase_js_1.createClient)(config.server, config.publicKey); + this.config = config; + } +} +exports.default = PublicCommentCRM; diff --git a/dist/crm/stdout.js b/dist/crm/stdout.js new file mode 100644 index 0000000..ccb3454 --- /dev/null +++ b/dist/crm/stdout.js @@ -0,0 +1,26 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const crm_1 = require("../crm"); +class StdOut extends crm_1.CRM { + constructor(opt) { + super(opt); + this.init = () => __awaiter(this, void 0, void 0, function* () { + return true; + }); + this.handleContact = (message) => __awaiter(this, void 0, void 0, function* () { + console.log(message); + return false; // do not empty the queue + }); + this.crmType = crm_1.CRMType.OptIn; + } +} +exports.default = StdOut; diff --git a/dist/proca.js b/dist/proca.js index cc65d88..64e33e1 100644 --- a/dist/proca.js +++ b/dist/proca.js @@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.fetchCampaign = exports.graphQL = void 0; +exports.fetchCampaign = void 0; +exports.graphQL = graphQL; //export const graphQL: Promise = async (operation, query, options) => { function graphQL(operation, query, options) { return __awaiter(this, void 0, void 0, function* () { @@ -77,7 +78,6 @@ function graphQL(operation, query, options) { return data; }); } -exports.graphQL = graphQL; ; const fetchCampaign = (id) => __awaiter(void 0, void 0, void 0, function* () { var _a; diff --git a/package-lock.json b/package-lock.json index 870ec42..838f0f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "proca-sync", - "version": "1.0.1", + "name": "@proca/sync", + "version": "1.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "proca-sync", - "version": "1.0.1", + "name": "@proca/sync", + "version": "1.1.1", "license": "AGPL-3.0-or-later", "dependencies": { "@mailchimp/mailchimp_marketing": "^3.0.80", @@ -23,7 +23,10 @@ "jsforce": "^1.11.1", "lodash": "^4.17.21", "minimist": "^1.2.8", - "node-mailjet": "^6.0.5" + "node-mailjet": "^6.0.6" + }, + "bin": { + "sync": "bin/sync" }, "devDependencies": { "@sentry/types": "^8.25.0", @@ -1026,11 +1029,11 @@ "integrity": "sha512-u5w79Rd7SU4JaIlA/zFqG+gOiuq25q5VLyZ8E+ijJeILuTxVzZgp2CaGw/UTw6pXYN9XMO9yiqj/nEHmhTG5CA==" }, "node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz", + "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", "dependencies": { - "follow-redirects": "^1.15.0", + "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } @@ -1582,9 +1585,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.15.6", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", - "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "version": "1.15.8", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.8.tgz", + "integrity": "sha512-xgrmBhBToVKay1q2Tao5LI26B83UhrB/vM1avwVSDzt8rx3rO6AizBAaF46EgksTVr+rFTQaqZZ9MVBfUe4nig==", "funding": [ { "type": "individual", @@ -2161,11 +2164,11 @@ "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" }, "node_modules/node-mailjet": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/node-mailjet/-/node-mailjet-6.0.5.tgz", - "integrity": "sha512-upufsTkMyrDF7Z6OiJ4M4Yw4L6MkB0vOQB27W1V9q0CxxSA6e2xOJif3koPwwwgDELpbJNG7asZjKFdghtxUCw==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/node-mailjet/-/node-mailjet-6.0.6.tgz", + "integrity": "sha512-cr8ciqtHuxyFd3+3bpDy+oKuNzctZfRQZtwRjurVAzE+DZLTfyxjgD+GTqQ1kr0ClAjDjSh3ERlZvd5MV0fKHg==", "dependencies": { - "axios": "1.6.2", + "axios": "1.7.4", "json-bigint": "^1.0.0", "url-join": "^4.0.0" }, diff --git a/package.json b/package.json index 577d822..a38f375 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,6 @@ "jsforce": "^1.11.1", "lodash": "^4.17.21", "minimist": "^1.2.8", - "node-mailjet": "^6.0.5" + "node-mailjet": "^6.0.6" } } \ No newline at end of file