salesprompter-cli 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -205,6 +205,7 @@ salesprompter sync:outreach --target instantly --in ./data/deel-scored.json --ca
205
205
  salesprompter sync:outreach --target instantly --in ./data/deel-scored.json --campaign-id "$INSTANTLY_CAMPAIGN_ID" --apply
206
206
  salesprompter icp:from-historical-queries:bq --vendor deel --market dach --out ./data/deel-icp-historical.json --report-out ./data/deel-historical-report.json
207
207
  salesprompter leadlists:funnel:bq --vendor deel --market dach --out ./data/deel-leadlists-funnel.json
208
+ salesprompter leadlists:direct-export:bq --vendor deel --market dach --limit 20000 --out-dir ./data/direct-path --sql-out ./data/direct-path/deel-direct-dach.sql
208
209
  salesprompter domainfinder:backlog:bq --market dach --out ./data/deel-domainfinder-backlog.json
209
210
  salesprompter domainfinder:candidates:bq --market dach --limit 500 --out ./data/domain-candidates.json --sql-out ./data/domain-candidates.sql
210
211
  salesprompter domainfinder:input-sql --market dach --out ./data/domainFinder_input_v2.sql
package/dist/bigquery.js CHANGED
@@ -2,6 +2,7 @@ import { execFile } from "node:child_process";
2
2
  import { promisify } from "node:util";
3
3
  const execFileAsync = promisify(execFile);
4
4
  const DEFAULT_BQ_PROJECT_ID = process.env.BQ_PROJECT_ID ?? process.env.GOOGLE_CLOUD_PROJECT ?? process.env.GCLOUD_PROJECT ?? "icpidentifier";
5
+ const BQ_EXEC_MAX_BUFFER = 256 * 1024 * 1024;
5
6
  function escapeSqlString(value) {
6
7
  return value.replaceAll("\\", "\\\\").replaceAll("'", "\\'");
7
8
  }
@@ -88,6 +89,10 @@ function deriveRegion(country, region) {
88
89
  }
89
90
  return normalizedCountry.length > 0 ? normalizedCountry : "unknown";
90
91
  }
92
+ function getOptionalString(row, field) {
93
+ const value = String(row[field] ?? "").trim();
94
+ return value.length > 0 ? value : null;
95
+ }
91
96
  export function normalizeBigQueryLeadRows(rows) {
92
97
  return rows.map((row) => {
93
98
  const firstName = String(row.firstName ?? "").trim();
@@ -96,7 +101,7 @@ export function normalizeBigQueryLeadRows(rows) {
96
101
  if (contactName.length === 0) {
97
102
  throw new Error("BigQuery lead row missing required name fields");
98
103
  }
99
- const companySize = requireString(row, "companySize");
104
+ const companySize = getOptionalString(row, "companySize");
100
105
  const country = String(row.country ?? "").trim();
101
106
  const region = String(row.region ?? "").trim();
102
107
  return {
@@ -104,7 +109,7 @@ export function normalizeBigQueryLeadRows(rows) {
104
109
  domain: requireString(row, "domain"),
105
110
  industry: requireString(row, "industry"),
106
111
  region: deriveRegion(country, region),
107
- employeeCount: employeeCountFromBucket(companySize),
112
+ employeeCount: employeeCountFromBucket(companySize ?? ""),
108
113
  contactName,
109
114
  title: requireString(row, "title"),
110
115
  email: requireString(row, "email"),
@@ -168,7 +173,7 @@ export async function runBigQueryQuery(sql, options = {}) {
168
173
  args.push(`--max_rows=${options.maxRows}`);
169
174
  }
170
175
  args.push(sql);
171
- const { stdout } = await execFileAsync("bq", args);
176
+ const { stdout } = await execFileAsync("bq", args, { maxBuffer: BQ_EXEC_MAX_BUFFER });
172
177
  return JSON.parse(stdout);
173
178
  }
174
179
  export async function executeBigQuerySql(sql, options = {}) {
@@ -182,7 +187,7 @@ export async function executeBigQuerySql(sql, options = {}) {
182
187
  args.push(`--max_rows=${options.maxRows}`);
183
188
  }
184
189
  args.push(sql);
185
- const { stdout } = await execFileAsync("bq", args);
190
+ const { stdout } = await execFileAsync("bq", args, { maxBuffer: BQ_EXEC_MAX_BUFFER });
186
191
  return stdout.trim();
187
192
  }
188
193
  export async function runBigQueryRows(sql, options = {}) {