diff --git a/packages/mg-mailchimp-members/src/lib/member-stats.ts b/packages/mg-mailchimp-members/src/lib/member-stats.ts index dd6cbf7f8..e23074de8 100644 --- a/packages/mg-mailchimp-members/src/lib/member-stats.ts +++ b/packages/mg-mailchimp-members/src/lib/member-stats.ts @@ -1,6 +1,12 @@ import {process} from './process.js'; -const memberStats = async ({csvPath, zipPath, includeUnsubscribed = false}: {csvPath?: string | string[], zipPath?: string, includeUnsubscribed?: boolean}) => { +type memberStatsOptions = { + csvPath?: string | string[]; + zipPath?: string; + includeUnsubscribed?: boolean; +} + +const memberStats = async ({csvPath, zipPath, includeUnsubscribed = false}: memberStatsOptions) => { let allMembers: number = 0; if (csvPath) { diff --git a/packages/mg-mailchimp-members/src/lib/process.ts b/packages/mg-mailchimp-members/src/lib/process.ts index 25ca6242a..c9419626f 100644 --- a/packages/mg-mailchimp-members/src/lib/process.ts +++ b/packages/mg-mailchimp-members/src/lib/process.ts @@ -13,7 +13,6 @@ type memberObject = { type processDataOptions = { pathToCsv?: string; - pathToZip?: string; csvContent?: string; addLabel?: string | null; includeUnsubscribed: boolean; @@ -26,7 +25,7 @@ type processOptions = { includeUnsubscribed?: boolean } -const processData = async ({pathToCsv, pathToZip, csvContent, addLabel, includeUnsubscribed = false}: processDataOptions) => { +const processData = async ({pathToCsv, csvContent, addLabel, includeUnsubscribed = false}: processDataOptions) => { const csvData = (csvContent) ? await fsUtils.csv.parseString(csvContent) : await fsUtils.csv.parseCSV(pathToCsv); let theMembers: memberObject[] = []; diff --git a/packages/migrate/sources/mailchimp-members.js b/packages/migrate/sources/mailchimp-members.js index 47d18ef15..0b835441c 100644 --- a/packages/migrate/sources/mailchimp-members.js +++ b/packages/migrate/sources/mailchimp-members.js @@ -14,7 +14,7 @@ const getTaskRunner = (options, logger) => { ctx.logger = logger; // 0. Prep a file cache for the work we are about to do. - ctx.options.cacheName = options.cacheName || fsUtils.utils.cacheNameFromPath(options.pathToCsv[0]); + ctx.options.cacheName = options.cacheName || fsUtils.utils.cacheNameFromPath(options.pathToZip || options.pathToCsv[0]); ctx.fileCache = new fsUtils.FileCache(`mailchimp-members-${ctx.options.cacheName}`, { tmpPath: ctx.options.tmpPath, contentDir: false @@ -30,6 +30,7 @@ const getTaskRunner = (options, logger) => { try { ctx.result = await csvIngest({ pathToCsv: options.pathToCsv, + pathToZip: options.pathToZip, addLabel: options.addLabel, includeUnsubscribed: options.includeUnsubscribed });