Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

transformHeader in import scripts

Steven Tey83f04d099a38
diff --git a/apps/web/scripts/programs/1-import-partners.ts b/apps/web/scripts/programs/1-import-partners.ts
index 7b9bfb38f1..302f5e9643 100644
--- a/apps/web/scripts/programs/1-import-partners.ts
+++ b/apps/web/scripts/programs/1-import-partners.ts
@@ -22,6 +22,8 @@ async function main() {
Papa.parse(fs.createReadStream("partners.csv", "utf-8"), {
header: true,
skipEmptyLines: true,
+ transformHeader: (header: string) =>
+ header.trim().replace(/^["']|["']$/g, ""),
step: (result: { data: PartnerData }) => {
partnersToImport.push(result.data);
},
diff --git a/apps/web/scripts/programs/2-import-partner-links.ts b/apps/web/scripts/programs/2-import-partner-links.ts
index e9841dcbae..f5bd8c1c21 100644
--- a/apps/web/scripts/programs/2-import-partner-links.ts
+++ b/apps/web/scripts/programs/2-import-partner-links.ts
@@ -18,6 +18,8 @@ async function main() {
Papa.parse(fs.createReadStream("partner_links.csv", "utf-8"), {
header: true,
skipEmptyLines: true,
+ transformHeader: (header: string) =>
+ header.trim().replace(/^["']|["']$/g, ""),
step: (result: { data: PartnerLinkData }) => {
partnerLinksToImport.push(result.data);
},
diff --git a/apps/web/scripts/programs/3-import-customer-leads.ts b/apps/web/scripts/programs/3-import-customer-leads.ts
index 5b1cfae3a9..4bf28fd762 100644
--- a/apps/web/scripts/programs/3-import-customer-leads.ts
+++ b/apps/web/scripts/programs/3-import-customer-leads.ts
@@ -24,6 +24,8 @@ async function main() {
Papa.parse(fs.createReadStream("customers.csv", "utf-8"), {
header: true,
skipEmptyLines: true,
+ transformHeader: (header: string) =>
+ header.trim().replace(/^["']|["']$/g, ""),
step: (result: { data: CustomerData }) => {
leadsToBackfill.push(result.data);
},
diff --git a/apps/web/scripts/programs/4-export-stripe-invoices.ts b/apps/web/scripts/programs/4-export-stripe-invoices.ts
index 7b7271bd16..536c9e047c 100644
--- a/apps/web/scripts/programs/4-export-stripe-invoices.ts
+++ b/apps/web/scripts/programs/4-export-stripe-invoices.ts
@@ -4,7 +4,7 @@ import * as fs from "fs";
import * as Papa from "papaparse";
import { stripeAppClient } from "../../lib/stripe";
-const programId = "prog_1K89GZ21QE2YC296FHHBMCFSM";
+const programId = "prog_xxx";
type CustomerData = {
customerExternalId: string;
partnerLinkKey: string;
@@ -18,6 +18,8 @@ async function main() {
Papa.parse(fs.createReadStream("customers.csv", "utf-8"), {
header: true,
skipEmptyLines: true,
+ transformHeader: (header: string) =>
+ header.trim().replace(/^["']|["']$/g, ""),
step: (result: { data: CustomerData }) => {
if (result.data.stripeCustomerId) {
customersToImport.push(result.data);
@@ -43,9 +45,6 @@ async function main() {
{
customer: customer.stripeCustomerId,
status: "paid",
- created: {
- gte: 1751526000,
- },
},
{
stripeAccount: program.workspace.stripeConnectId!,