chore: scripts Dokploy/BPS (cron secret, Ads MCC, sync y probes)

Incluye utilidades de ops para CRON_SECRET, login customer Google Ads, sync de seguimiento BPS y probes de conexiones.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
4Ventures
2026-09-29 16:48:44 +02:00
parent 8c5acb626f
commit 1a58af129d
17 changed files with 2913 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
import { config } from 'dotenv';
import { resolve } from 'path';
config({ path: resolve(process.cwd(), '.env.local') });
import {
buildSeguimientoRowsForDoc,
upsertSeguimientoRows,
patchSuperhumanIntegration,
findSeguimientoGoogleDoc,
} from '../src/lib/superhuman-docs';
const BPS = '8bec977a-6032-4759-aa7f-b5042081f450';
const DOC = '7TGywaNiUY';
async function main() {
const hit = await findSeguimientoGoogleDoc([
'Seguimiento BPS',
'Seguimiento Semanal BPS',
'Seguimiento Blue Parrot School',
'Seguimiento Semanal Blue Parrot School',
]);
console.log('drive hit', hit);
const rows = await buildSeguimientoRowsForDoc({
tenantId: BPS,
tenantName: 'BPS',
docId: DOC,
maxEntries: 120,
exportBodies: true,
});
const gdoc = rows.filter((r) => r.external_id.startsWith('gdoc:'));
console.log('total', rows.length, 'gdoc days', gdoc.length);
console.log(
gdoc.slice(0, 5).map((r) => ({
title: r.title,
day: r.occurred_at,
len: (r.body_md || '').length,
}))
);
const n = await upsertSeguimientoRows(rows);
await patchSuperhumanIntegration(BPS, {
status: 'connected',
external_account_id: DOC,
label: '01.BLUE PARROT SCHOOL',
last_sync_at: new Date().toISOString(),
error_message: null,
meta: {
doc_name: '01.BLUE PARROT SCHOOL',
entries: n,
gdoc_days: gdoc.length,
synced_at: new Date().toISOString(),
},
});
console.log('upserted', n);
}
main().catch((e) => {
console.error(e);
process.exit(1);
});