mcp-scraper 0.90.7 → 0.90.8

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/README.md +2 -2
  3. package/dist/{analytics-repository-FXS45ZTM.js → analytics-repository-IHOFBSUV.js} +1 -1
  4. package/dist/bin/api-server.js +1 -1
  5. package/dist/bin/mcp-scraper-cli.js +1 -1
  6. package/dist/bin/mcp-scraper-core.js +1 -1
  7. package/dist/bin/mcp-scraper-install.js +1 -1
  8. package/dist/bin/mcp-stdio-server.js +1 -1
  9. package/dist/bin/paa-harvest.js +1 -1
  10. package/dist/{chunk-5NQY2N7J.js → chunk-2F35B4U5.js} +2 -2
  11. package/dist/{chunk-BDLR4CCL.js → chunk-2SP57VCG.js} +6 -6
  12. package/dist/{chunk-ZKQRA6NQ.js → chunk-53IEEOKA.js} +167 -167
  13. package/dist/chunk-6DTXIZY2.js +1 -0
  14. package/dist/{chunk-YTEAWZEN.js → chunk-6FMIMP5Z.js} +1 -1
  15. package/dist/chunk-7SHEBDEB.js +1 -0
  16. package/dist/{chunk-LPEIHMYH.js → chunk-DKXZIIA5.js} +1 -1
  17. package/dist/{chunk-TBTA7VVZ.js → chunk-IK5BG7MO.js} +1 -1
  18. package/dist/{chunk-QUFR3KG2.js → chunk-J374DIKA.js} +1 -1
  19. package/dist/{chunk-I7IS7NTC.js → chunk-KZV2FLGG.js} +1 -1
  20. package/dist/{chunk-UKFNSXP3.js → chunk-LI7WHOII.js} +1 -1
  21. package/dist/{chunk-B2C7JU4O.js → chunk-LSFDB5XE.js} +1 -1
  22. package/dist/{chunk-DSK6RKBS.js → chunk-OIMPG6M6.js} +1 -1
  23. package/dist/{chunk-OT2HUS2G.js → chunk-OMYTA34L.js} +1 -1
  24. package/dist/chunk-ORB4RHCK.js +63 -0
  25. package/dist/chunk-OVTHAIDS.js +1 -0
  26. package/dist/{chunk-IGJKAECE.js → chunk-QTDLZTQ7.js} +1 -1
  27. package/dist/chunk-RK2VCTZI.js +1 -0
  28. package/dist/{chunk-TOJBPATJ.js → chunk-WJ4XFLS4.js} +159 -115
  29. package/dist/{chunk-74HHYSAZ.js → chunk-X7GZJU5P.js} +1 -1
  30. package/dist/{chunk-R7LCD65B.js → chunk-ZMNUI5LB.js} +7 -7
  31. package/dist/db-B5XJTOGN.js +1 -0
  32. package/dist/{extract-bundle-INT6JMJP.js → extract-bundle-II3RPATK.js} +10 -10
  33. package/dist/gmail-service-E5KORS6C.js +1 -0
  34. package/dist/index.cjs +18 -18
  35. package/dist/index.js +1 -1
  36. package/dist/{lead-list-enrichment-repository-B6Q4O4DG.js → lead-list-enrichment-repository-AWZZMY2H.js} +1 -1
  37. package/dist/{location-data-repository-CBI5K7MR.js → location-data-repository-6XAVI65Z.js} +1 -1
  38. package/dist/operation-metering-DB5F7SXN.js +1 -0
  39. package/dist/server-MI6XN25Z.js +4961 -0
  40. package/dist/{site-extract-repository-VPYOC3CP.js → site-extract-repository-JHSVJJ62.js} +1 -1
  41. package/dist/stripe-event-worker-7KNF3VH5.js +1 -0
  42. package/dist/worker-3VTFFYHH.js +1 -0
  43. package/package.json +1 -1
  44. package/dist/chunk-KDDU6BW3.js +0 -48
  45. package/dist/chunk-WEPU72WA.js +0 -1
  46. package/dist/db-SVSD2AWJ.js +0 -1
  47. package/dist/gmail-service-YCPMGW3E.js +0 -1
  48. package/dist/server-LYWW6XYE.js +0 -4956
  49. package/dist/stripe-event-worker-AQVRF24K.js +0 -1
  50. package/dist/worker-U43KLOLN.js +0 -1
@@ -1 +1 @@
1
- import{A as s,B as t,C as u,D as v,E as w,F as x,G as y,H as z,I as A,J as B,K as C,L as D,M as E,i as a,j as b,k as c,l as d,m as e,n as f,o as g,p as h,q as i,r as j,s as k,t as l,u as m,v as n,w as o,x as p,y as q,z as r}from"./chunk-LPEIHMYH.js";import"./chunk-TMB56NCA.js";import"./chunk-CTX3NMZQ.js";import"./chunk-TOJBPATJ.js";export{a as XRAY_ENTITLED_EXTRACT_BILLING_CLASS,q as abandonExtractSettlement,p as claimFailedExtractJobForRefinalize,z as completeExtractJob,w as countSuccessfulPages,d as createExtractJob,f as createOrGetExtractJob,b as extractJobLimitInfo,A as failExtractJob,o as failStaleRunningExtractJob,B as failUnfundedExtractJob,E as finalizeXRayEntitledExtractJobCharge,y as finishExtractJob,g as getExtractJob,e as getExtractJobByIdempotencyKey,v as getExtractedImageLinks,u as getExtractedPages,x as getExtractedUrls,h as listExtractJobs,t as listExtractPages,j as listFundedPendingExtractJobs,n as listStaleRunningExtractJobs,i as listUnsettledExtractJobs,k as markExtractJobDispatchAttempt,l as recordExtractJobDispatchFailure,m as recordExtractSettlementFailure,s as saveExtractPages,C as setExtractJobPublicError,r as setExtractJobTotal,D as settleExtractJob,c as terminalExtractJobStatus};
1
+ import{A as s,B as t,C as u,D as v,E as w,F as x,G as y,H as z,I as A,J as B,K as C,L as D,M as E,i as a,j as b,k as c,l as d,m as e,n as f,o as g,p as h,q as i,r as j,s as k,t as l,u as m,v as n,w as o,x as p,y as q,z as r}from"./chunk-DKXZIIA5.js";import"./chunk-TMB56NCA.js";import"./chunk-CTX3NMZQ.js";import"./chunk-WJ4XFLS4.js";export{a as XRAY_ENTITLED_EXTRACT_BILLING_CLASS,q as abandonExtractSettlement,p as claimFailedExtractJobForRefinalize,z as completeExtractJob,w as countSuccessfulPages,d as createExtractJob,f as createOrGetExtractJob,b as extractJobLimitInfo,A as failExtractJob,o as failStaleRunningExtractJob,B as failUnfundedExtractJob,E as finalizeXRayEntitledExtractJobCharge,y as finishExtractJob,g as getExtractJob,e as getExtractJobByIdempotencyKey,v as getExtractedImageLinks,u as getExtractedPages,x as getExtractedUrls,h as listExtractJobs,t as listExtractPages,j as listFundedPendingExtractJobs,n as listStaleRunningExtractJobs,i as listUnsettledExtractJobs,k as markExtractJobDispatchAttempt,l as recordExtractJobDispatchFailure,m as recordExtractSettlementFailure,s as saveExtractPages,C as setExtractJobPublicError,r as setExtractJobTotal,D as settleExtractJob,c as terminalExtractJobStatus};
@@ -0,0 +1 @@
1
+ import{fb as S,hb as h}from"./chunk-2F35B4U5.js";import"./chunk-6FMIMP5Z.js";import"./chunk-LI7WHOII.js";import"./chunk-QTDLZTQ7.js";import"./chunk-YGBTTW5D.js";import"./chunk-CTX3NMZQ.js";import"./chunk-2SP57VCG.js";import"./chunk-6DTXIZY2.js";import{I as d,J as u,K as l,L as f,M as v}from"./chunk-WJ4XFLS4.js";var g=12;function b(e){return e&&typeof e=="object"&&"code"in e&&typeof e.code=="string"?e.code:e instanceof Error?e.name:"unknown_error"}function k(e){return Math.min(21600,30*2**Math.max(0,e-1))}async function x(e={}){let w=e.stripeClient??S,E=Math.max(1,Math.min(100,e.limit??100)),r=500,i=0,s=0,c=0,m=0;for(;i<r;){let a=await d(Math.min(E,r-i),e.leaseSeconds??300);if(a.length===0)break;i+=a.length;for(let t of a)try{let n=await w.events.retrieve(t.eventId);await h(n),await u(t.eventId,t.token)&&(s+=1)}catch(n){let p=n instanceof Error?n.message:String(n),o=b(n);t.attemptCount>=g||o==="resource_missing"?await f(t.eventId,t.token,p,o)&&(m+=1):await l(t.eventId,t.token,p,o,k(t.attemptCount))&&(c+=1)}}return{claimed:i,processed:s,retried:c,deadLettered:m,capped:i>=r,health:await v()}}export{x as drainStripeEventQueue};
@@ -0,0 +1 @@
1
+ import{n as a,o as b,p as c}from"./chunk-OVTHAIDS.js";import"./chunk-XG6GCEUE.js";import"./chunk-ZMNUI5LB.js";import"./chunk-M5QHXNFZ.js";import"./chunk-KZV2FLGG.js";import"./chunk-ORB4RHCK.js";import"./chunk-CTX3NMZQ.js";import"./chunk-4FROKQJN.js";import"./chunk-2SP57VCG.js";import"./chunk-6DTXIZY2.js";import"./chunk-2TZBO52D.js";import"./chunk-2PXP7TMY.js";import"./chunk-WJ4XFLS4.js";export{b as drainQueue,c as startWorker,a as tickOnce};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-scraper",
3
- "version": "0.90.7",
3
+ "version": "0.90.8",
4
4
  "description": "MCP server for MCP Scraper web intelligence tools",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1,48 +0,0 @@
1
- import{a as re}from"./chunk-XG6GCEUE.js";import{w as Z}from"./chunk-R7LCD65B.js";import{b as N,c as ee}from"./chunk-I7IS7NTC.js";import{a as x,b as k}from"./chunk-CTX3NMZQ.js";import{a as F}from"./chunk-4FROKQJN.js";import{b as j,d as Y,g as X}from"./chunk-BDLR4CCL.js";import{Mb as b,Qb as A,Sb as I,Ua as R,b as S,g as p,gb as G,h as z,ha as J,ia as V,ib as O,j as $,ka as Q,m as W,na as E,o as B,t as l}from"./chunk-TOJBPATJ.js";async function P(e,r,t=3){for(let i=1;i<=t;i++){try{let a=await fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r),signal:AbortSignal.timeout(1e4)});if(a.ok)return;console.warn(`[webhook] attempt ${i} \u2192 ${a.status} from ${e}`)}catch(a){console.warn(`[webhook] attempt ${i} failed:`,a instanceof Error?a.message:a)}i<t&&await new Promise(a=>setTimeout(a,1e3*i*2))}console.error(`[webhook] gave up after ${t} attempts for ${e}`)}function fe(e){return e instanceof Error?e.message:String(e)}function be(e,r){return e instanceof DOMException&&(e.name==="TimeoutError"||e.name==="AbortError")?!0:/timeout|timed out|Timeout \d+ms exceeded|deadline/i.test(r)}function ye(e){return/captcha|recaptcha|unusual traffic|google\.com\/sorry|blocked/i.test(e)}function he(e){return/ERR_TUNNEL_CONNECTION_FAILED|ERR_PROXY_CONNECTION_FAILED|ERR_SOCKS_CONNECTION_FAILED|tunnel connection failed|proxy connection failed|transport error: proxy/i.test(e)}function we(e){return/proxy unavailable|proxy_unavailable|connection_test_failed|did not return a proxy id|configured fallback/i.test(e)}function ve(e){return/(?:spending|billing|organization|account).{0,80}(?:cap|limit|blocked|disabled)|(?:quota|capacity).{0,40}(?:reached|exceeded)|https?:\/\/\S*dashboard/i.test(e)}function Se(e){return/browser (?:has been )?closed|context (?:has been )?closed|target page, context or browser has been closed|session closed|page has been closed/i.test(e)}function C(e){let r=fe(e);return e instanceof W?{error_code:"request_aborted",error_type:"request_aborted",message:p("request_aborted"),retryable:!0,httpStatus:408,terminalStatus:"cancelled"}:e instanceof $||ye(r)?{error_code:"captcha_exhausted",error_type:"captcha",message:p("captcha_exhausted"),retryable:!0,httpStatus:503,terminalStatus:"failed"}:re(e,r)?{error_code:"vendor_unavailable",error_type:"service_unavailable",message:p("vendor_unavailable"),retryable:!0,httpStatus:503,terminalStatus:"failed"}:e instanceof B?{error_code:"location_mismatch",error_type:"location_mismatch",message:p("location_mismatch"),retryable:!0,httpStatus:503,terminalStatus:"failed"}:he(r)?{error_code:"proxy_tunnel_failed",error_type:"connection",message:p("proxy_tunnel_failed"),retryable:!0,httpStatus:503,terminalStatus:"failed"}:we(r)?{error_code:"proxy_unavailable",error_type:"connection",message:p("proxy_unavailable"),retryable:!0,httpStatus:503,terminalStatus:"failed"}:Se(r)?{error_code:"browser_session_interrupted",error_type:"extraction",message:p("browser_session_interrupted"),retryable:!0,httpStatus:503,terminalStatus:"failed"}:be(e,r)?{error_code:"harvest_timeout",error_type:"timeout",message:p("harvest_timeout"),retryable:!0,httpStatus:504,terminalStatus:"failed"}:ve(r)?{error_code:"service_unavailable",error_type:"service_unavailable",message:S,retryable:!0,httpStatus:503,terminalStatus:"failed"}:{error_code:"extraction_failed",error_type:"extraction",message:S,retryable:!1,httpStatus:500,terminalStatus:"failed"}}function T(e){return JSON.stringify({error_code:e.error_code,error_type:e.error_type,message:e.message,retryable:e.retryable})}function y(e,r={}){let t=z({errorCode:e.error_code,errorType:e.error_type,retryable:e.retryable,retryAfterSeconds:r.retryAfterSeconds,chargeStatus:r.chargeStatus,details:r.details});return{error:t.message,...t}}function L(e,r={}){let{error:t,...i}=y(e,r);return i}function Ce(e,r={}){let t=C(e);return{body:y(t,r),status:t.httpStatus}}import{createHash as Re}from"crypto";import{createHash as Ee,randomUUID as h}from"crypto";var M=class extends Error{constructor(){super("This idempotency key was already used with different normalized inputs."),this.name="OperationIdempotencyConflictError"}};function g(e){return Ee("sha256").update(e).digest("hex")}function H(e){return Array.isArray(e)?e.map(H):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([r],[t])=>r.localeCompare(t)).map(([r,t])=>[r,H(t)])):e}function te(e){return JSON.stringify(H(e??{}))}function d(e,r){let t=e.trim();if(!t)throw new Error(`${r} is required`);return t}function m(e,r=2e3){return e==null?null:e.slice(0,r)}async function oe(e){let r=l(),t=d(e.tool,"tool"),i=d(e.ownerScope,"ownerScope"),a=e.idempotencyKey?.trim()||null,o=e.requestFingerprint?.trim()||null;if(a==null!=(o==null))throw new Error("idempotencyKey and requestFingerprint must be supplied together");let n=a?g(`${i}\0${t}\0${a}`):null,s=e.id??h(),u=[s,e.userId??null,g(i),t,n,o,e.jobId??null,e.requestId??null,e.deploymentCommit??null,te(e.normalizedFlags),e.startedAt??new Date().toISOString()];if(n){await r.execute({sql:`INSERT OR IGNORE INTO operation_runs
2
- (id, user_id, owner_scope_hash, tool, idempotency_scope_hash, request_fingerprint,
3
- job_id, request_id, deployment_commit, normalized_flags_json, started_at)
4
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,args:u});let f=(await r.execute({sql:"SELECT id, request_fingerprint FROM operation_runs WHERE idempotency_scope_hash = ?",args:[n]})).rows[0];if(!f)throw new Error("Operation run insert did not produce an idempotency receipt");if(String(f.request_fingerprint)!==o)throw new M;return{id:String(f.id),replayed:String(f.id)!==s}}return await r.execute({sql:`INSERT INTO operation_runs
5
- (id, user_id, owner_scope_hash, tool, idempotency_scope_hash, request_fingerprint,
6
- job_id, request_id, deployment_commit, normalized_flags_json, started_at)
7
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,args:u}),{id:s,replayed:!1}}async function ne(e){let r=e.endedAt??new Date().toISOString();if((await l().execute({sql:`UPDATE operation_runs
8
- SET status = ?, failure_class = ?, ended_at = ?, updated_at = ?
9
- WHERE id = ? AND status = 'running'`,args:[e.status,m(e.failureClass,200),r,r,e.runId]})).rowsAffected===1)return;let i=m(e.failureClass,200),a=await l().execute({sql:"SELECT status, failure_class FROM operation_runs WHERE id = ?",args:[e.runId]});if(a.rows.length===0)throw new Error(`Unknown operation run: ${e.runId}`);let o=a.rows[0]?.failure_class==null?null:String(a.rows[0]?.failure_class);if(String(a.rows[0]?.status)!==e.status||o!==i)throw new Error(`Operation run ${e.runId} is already terminal as ${String(a.rows[0]?.status)}`)}async function ie(e){if(!Number.isInteger(e.attemptNumber)||e.attemptNumber<1)throw new Error("attemptNumber must be a positive integer");if(e.attemptNumber===1&&(e.parentAttemptId||e.edgeKind||e.retryKind))throw new Error("The first attempt cannot have a parent or retry edge");if(e.attemptNumber>1&&(!e.parentAttemptId||!e.edgeKind))throw new Error("Every non-first attempt requires a parentAttemptId and edgeKind");if(e.retryKind&&!["same_method_retry","provider_fallback","durable_resume","reconciliation"].includes(e.edgeKind??""))throw new Error("retryKind requires a retry or reconciliation edgeKind");let r=e.id??h();return await l().execute({sql:`INSERT INTO operation_attempts
10
- (id, run_id, parent_attempt_id, attempt_number, edge_kind, retry_kind, retry_reason, retry_owner,
11
- method, provider, normalized_flags_json, started_at)
12
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,args:[r,e.runId,e.parentAttemptId??null,e.attemptNumber,e.edgeKind??null,e.retryKind??null,m(e.retryReason,500),m(e.retryOwner,100),d(e.method,"method"),e.provider??null,te(e.normalizedFlags),e.startedAt??new Date().toISOString()]}),r}async function ae(e){if(!Number.isInteger(e.durationMs)||e.durationMs<0)throw new Error("durationMs must be a non-negative integer");let r=e.endedAt??new Date().toISOString();if((await l().execute({sql:`UPDATE operation_attempts SET
13
- status = ?, error_code = ?, error_message = ?, ended_at = ?, duration_ms = ?, updated_at = ?
14
- WHERE id = ? AND status = 'running'`,args:[e.status,m(e.errorCode,200),m(e.errorMessage),r,e.durationMs,r,e.attemptId]})).rowsAffected===1)return;let i=await l().execute({sql:"SELECT status, duration_ms FROM operation_attempts WHERE id = ?",args:[e.attemptId]});if(i.rows.length===0)throw new Error(`Unknown operation attempt: ${e.attemptId}`);if(String(i.rows[0]?.status)!==e.status||Number(i.rows[0]?.duration_ms)!==e.durationMs)throw new Error(`Operation attempt ${e.attemptId} is already terminal as ${String(i.rows[0]?.status)}`)}async function D(e){let r=d(e.provider,"provider"),t=d(e.method,"method"),i=g(d(e.accountScope,"accountScope")),a=e.providerSourceKey?.trim()||null,o=a?g(a):null,n=e.id??h(),s=await l().execute({sql:`INSERT OR IGNORE INTO provider_usage_receipts
15
- (id, attempt_id, provider, account_scope_hash, method, provider_source_key,
16
- provider_source_key_hash, provider_status)
17
- VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,args:[n,e.attemptId,r,i,t,a,o,e.providerStatus??null]});if(!o){if(s.rowsAffected===1)return{id:n,replayed:!1};let _=(await l().execute({sql:"SELECT attempt_id, provider, method FROM provider_usage_receipts WHERE id = ?",args:[n]})).rows[0];if(!_||String(_.attempt_id)!==e.attemptId||String(_.provider)!==r||String(_.method)!==t)throw new Error("Provider receipt ID is already used by a different receipt");return{id:n,replayed:!0}}let c=(await l().execute({sql:`SELECT id, attempt_id FROM provider_usage_receipts
18
- WHERE provider = ? AND account_scope_hash = ? AND method = ? AND provider_source_key_hash = ?`,args:[r,i,t,o]})).rows[0];if(!c)throw new Error("Provider receipt insert did not produce a source receipt");if(String(c.attempt_id)!==e.attemptId)throw new Error("Provider source identity is already attached to a different attempt");return{id:String(c.id),replayed:String(c.id)!==n}}async function se(e,r){let t=d(r,"providerSourceKey"),i=g(t);if((await l().execute({sql:`UPDATE provider_usage_receipts
19
- SET provider_source_key = ?, provider_source_key_hash = ?, updated_at = datetime('now')
20
- WHERE id = ? AND provider_source_key IS NULL`,args:[t,i,e]})).rowsAffected===1)return;let o=await l().execute({sql:"SELECT provider_source_key_hash FROM provider_usage_receipts WHERE id = ?",args:[e]});if(!o.rows[0])throw new Error(`Unknown provider receipt: ${e}`);if(String(o.rows[0].provider_source_key_hash)!==i)throw new Error(`Provider receipt ${e} already has a different source identity`)}async function w(e){if(e.units!=null&&(!Number.isFinite(e.units)||e.units<0))throw new Error("units must be non-negative");if(e.amountUsdNanos!=null&&(!Number.isSafeInteger(e.amountUsdNanos)||e.amountUsdNanos<0))throw new Error("amountUsdNanos must be a non-negative safe integer");if(e.costState==="actual"&&e.amountUsdNanos==null)throw new Error("actual receipts require amountUsdNanos");if(e.costState==="actual"&&e.amountUsdNanos===0&&!e.zeroCostReason?.trim())throw new Error("actual zero-cost receipts require zeroCostReason");let r=e.checkedAt??new Date().toISOString(),t=e.finalizedAt??r;if((await l().execute({sql:`UPDATE provider_usage_receipts SET
21
- cost_state = ?, units = ?, unit_type = ?, amount_usd_nanos = ?, rate_source = ?, zero_cost_reason = ?,
22
- provider_status = ?, provider_duration_ms = ?, provider_captcha = ?, error_code = ?, error_message = ?,
23
- checked_at = ?, finalized_at = ?, updated_at = ?
24
- WHERE id = ? AND (cost_state = 'pending' OR (cost_state = 'estimated' AND ? = 'actual'))`,args:[e.costState,e.units??null,e.unitType??null,e.amountUsdNanos??null,e.rateSource??null,e.zeroCostReason??null,e.providerStatus??null,e.providerDurationMs??null,e.providerCaptcha==null?null:e.providerCaptcha?1:0,m(e.errorCode,200),m(e.errorMessage),r,t,t,e.receiptId,e.costState]})).rowsAffected===1)return;let a=await l().execute({sql:"SELECT cost_state, units, unit_type, amount_usd_nanos FROM provider_usage_receipts WHERE id = ?",args:[e.receiptId]});if(a.rows.length===0)throw new Error(`Unknown provider receipt: ${e.receiptId}`);let o=a.rows[0],n=o?.units==null&&e.units==null||Number(o?.units)===e.units,s=o?.amount_usd_nanos==null&&e.amountUsdNanos==null||Number(o?.amount_usd_nanos)===e.amountUsdNanos,u=o?.unit_type==null&&e.unitType==null||String(o?.unit_type)===e.unitType;if(String(o?.cost_state)!==e.costState||!n||!s||!u)throw new Error(`Provider receipt ${e.receiptId} is already finalized as ${String(a.rows[0]?.cost_state)}`)}async function He(e){let t=(await l().execute({sql:`SELECT id FROM provider_usage_receipts
25
- WHERE provider = ? AND account_scope_hash = ? AND method = ? AND provider_source_key_hash = ?`,args:[d(e.provider,"provider"),g(d(e.accountScope,"accountScope")),d(e.method,"method"),g(d(e.providerSourceKey,"providerSourceKey"))]})).rows[0];if(!t)return!1;let{provider:i,accountScope:a,method:o,providerSourceKey:n,...s}=e;return await w({...s,receiptId:String(t.id)}),!0}async function De(e=30){if(!Number.isInteger(e)||e<1||e>365)throw new Error("retentionDays must be an integer between 1 and 365");let r=`-${e} days`,t=l(),[i,a,o]=await Promise.all([t.execute({sql:`UPDATE operation_attempts
26
- SET error_message = NULL, updated_at = datetime('now')
27
- WHERE ended_at < datetime('now', ?) AND error_message IS NOT NULL`,args:[r]}),t.execute({sql:`UPDATE provider_usage_receipts
28
- SET provider_source_key = NULL, error_message = NULL, updated_at = datetime('now')
29
- WHERE finalized_at < datetime('now', ?)
30
- AND (provider_source_key IS NOT NULL OR error_message IS NOT NULL)`,args:[r]}),t.execute({sql:`UPDATE harvest_attempts
31
- SET provider_session_id = NULL, \u006b\u0065\u0072\u006e\u0065\u006c_session_id = NULL, error = NULL,
32
- \u006b\u0065\u0072\u006e\u0065\u006c_delete_error = NULL, browser_close_error = NULL,
33
- provider_error_message = NULL, provider_detail_json = NULL,
34
- provider_disconnect_message = NULL, debug_json = NULL
35
- WHERE completed_at < datetime('now', ?)
36
- AND (provider_session_id IS NOT NULL OR \u006b\u0065\u0072\u006e\u0065\u006c_session_id IS NOT NULL OR error IS NOT NULL
37
- OR \u006b\u0065\u0072\u006e\u0065\u006c_delete_error IS NOT NULL OR browser_close_error IS NOT NULL
38
- OR provider_error_message IS NOT NULL OR provider_detail_json IS NOT NULL
39
- OR provider_disconnect_message IS NOT NULL OR debug_json IS NOT NULL)`,args:[r]})]);return{operationAttempts:i.rowsAffected,providerReceipts:a.rowsAffected,legacyHarvestAttempts:o.rowsAffected}}async function le(e){let t={billing_authorizations:{column:"id"},billing_events:{column:"id"},billing_debits:{column:"idempotency_key"},billing_credits:{column:"idempotency_key"},ledger:{column:"id"}}[e.billingTable],i=d(e.billingKey,"billingKey"),a=await l().execute({sql:`SELECT b.user_id AS billing_user_id, r.user_id AS run_user_id
40
- FROM operation_runs r
41
- JOIN ${e.billingTable} b ON CAST(b.${t.column} AS TEXT) = ?
42
- WHERE r.id = ?`,args:[i,e.runId]});if(!a.rows[0])throw new Error("Billing link target or operation run does not exist");let o=a.rows[0].billing_user_id,n=a.rows[0].run_user_id;if(n!=null&&o!=null&&String(n)!==String(o))throw new Error("Billing link owner does not match operation run owner");await l().execute({sql:`INSERT OR IGNORE INTO operation_billing_links
43
- (run_id, billing_table, billing_key, relation, amount_mc) VALUES (?, ?, ?, ?, ?)`,args:[e.runId,e.billingTable,i,e.relation,e.amountMc??null]})}async function Ue(e,r=new Date().toISOString()){let t=h();return await l().execute({sql:"INSERT INTO provider_reconciliation_runs (id, provider, started_at) VALUES (?, ?, ?)",args:[t,d(e,"provider"),r]}),t}async function qe(e){if([e.checkedCount,e.completedCount,e.pendingCount,e.unavailableCount,e.failedCount].some(a=>!Number.isInteger(a)||a<0))throw new Error("Reconciliation counts must be non-negative integers");if(e.completedCount+e.pendingCount+e.unavailableCount+e.failedCount>e.checkedCount)throw new Error("Reconciliation outcome counts cannot exceed checkedCount");let t=e.completedAt??new Date().toISOString();if((await l().execute({sql:`UPDATE provider_reconciliation_runs SET
44
- status = ?, checked_count = ?, completed_count = ?, pending_count = ?, unavailable_count = ?,
45
- failed_count = ?, error_code = ?, completed_at = ?
46
- WHERE id = ? AND status = 'running'`,args:[e.status,e.checkedCount,e.completedCount,e.pendingCount,e.unavailableCount,e.failedCount,m(e.errorCode,200),t,e.id]})).rowsAffected!==1)throw new Error(`Unknown or terminal provider reconciliation run: ${e.id}`)}async function de(e){let r=l(),[t,i,a,o]=await Promise.all([r.execute({sql:"SELECT * FROM operation_runs WHERE id = ?",args:[e]}),r.execute({sql:"SELECT * FROM operation_attempts WHERE run_id = ? ORDER BY attempt_number",args:[e]}),r.execute({sql:`SELECT r.* FROM provider_usage_receipts r
47
- JOIN operation_attempts a ON a.id = r.attempt_id
48
- WHERE a.run_id = ? ORDER BY a.attempt_number, r.rowid`,args:[e]}),r.execute({sql:"SELECT * FROM operation_billing_links WHERE run_id = ? ORDER BY created_at, billing_table, billing_key",args:[e]})]);return t.rows[0]?{run:t.rows[0],attempts:[...i.rows],providerReceipts:[...a.rows],billingLinks:[...o.rows]}:null}var Oe=1e9;function Ae(e){return Re("sha256").update(JSON.stringify(e)).digest("hex")}function v(e){return`harvest:${e}`}async function We(e){let r=v(e.jobId);try{return(await oe({id:r,userId:e.userId,ownerScope:`user:${e.userId}`,tool:e.tool,normalizedFlags:e.normalizedFlags,idempotencyKey:`job:${e.jobId}`,requestFingerprint:Ae(e.normalizedFlags),jobId:e.jobId,requestId:e.requestId??null,deploymentCommit:process.env.VERCEL_GIT_COMMIT_SHA?.trim()||process.env.GIT_COMMIT_SHA?.trim()||null})).id}catch(t){return console.warn(JSON.stringify({event:"operation_run_start_failed",job_id:e.jobId,tool:e.tool,message:t instanceof Error?t.message:String(t)})),null}}async function q(e,r,t){if(e)try{await ne({runId:e,status:r,failureClass:t})}catch(i){console.warn(JSON.stringify({event:"operation_run_finish_failed",operation_run_id:e,message:i instanceof Error?i.message:String(i)}))}}async function Be(e,r,t,i){if(!(!e||!r))try{await le({runId:e,billingTable:"billing_debits",billingKey:r,relation:t,amountMc:i})}catch(a){console.warn(JSON.stringify({event:"operation_billing_link_failed",operation_run_id:e,relation:t,message:a instanceof Error?a.message:String(a)}))}}function U(e){return e==="timeout"?"timed_out":e==="request_aborted"?"cancelled":e==="browser_session_interrupted"?"interrupted":e==="captcha"||e==="proxy_tunnel_failed"||e==="proxy_unavailable"||e==="location_mismatch"||e==="error"?"failed":"succeeded"}function Ie(e){return e==="\u0062\u0072\u0069\u0067\u0068\u0074_\u0064\u0061\u0074\u0061_browser_api"?"\u0062\u0072\u0069\u0067\u0068\u0074\u0064\u0061\u0074\u0061":"\u006b\u0065\u0072\u006e\u0065\u006c"}function ue(e,r,t=0){let i=new Map,a=null;return async o=>{if(e)try{if(o.type==="started"){let s=t+o.attemptNumber;if(s>1&&!a){let _=(await de(e))?.attempts.at(-1);a=_?.id==null?null:String(_.id)}let u=await ie({runId:e,attemptNumber:s,method:o.method,provider:o.provider,parentAttemptId:s===1?null:a,edgeKind:s===1?null:t>0&&o.attemptNumber===1?"durable_resume":o.retryKind==="provider_fallback"?"provider_fallback":"same_method_retry",retryKind:s===1?null:t>0&&o.attemptNumber===1?"durable_resume":o.retryKind,retryReason:s===1?null:t>0&&o.attemptNumber===1?"durable_worker_resume":o.retryReason,retryOwner:s===1?null:t>0&&o.attemptNumber===1?"durable_reconciler":"harvest",normalizedFlags:{maxAttempts:o.maxAttempts,maxQuestions:o.maxQuestions,hasLocation:!!o.location,plannedProvider:o.provider,planReason:o.planReason??null,planTimeoutMs:o.planTimeoutMs??null},startedAt:o.startedAt}),c=await D({attemptId:u,provider:o.provider,accountScope:r,method:o.method,providerStatus:"started"});i.set(o.attemptNumber,{attemptId:u,receiptId:c.id,plannedProvider:o.provider,observedProvider:null,providerMismatch:!1,method:o.method,startedAtMs:Date.parse(o.startedAt)}),a=u;return}let n=i.get(o.attemptNumber);if(!n)throw new Error(`Missing operation attempt state for attempt ${o.attemptNumber}`);if(o.type==="provider_session_started"){let s=Ie(o.provider);if(n.observedProvider=s,s!==n.plannedProvider){n.providerMismatch=!0,await w({receiptId:n.receiptId,costState:"unavailable",providerStatus:"provider_mismatch",errorCode:"provider_mismatch",errorMessage:`Planned ${n.plannedProvider}; observed ${s}`,finalizedAt:o.observedAt});let u=s==="\u0062\u0072\u0069\u0067\u0068\u0074\u0064\u0061\u0074\u0061"?"\u0062\u0072\u0069\u0067\u0068\u0074\u0064\u0061\u0074\u0061_browser":"\u006b\u0065\u0072\u006e\u0065\u006c_browser",c=await D({attemptId:n.attemptId,provider:s,accountScope:r,method:u,providerStatus:"observed_provider_mismatch"});n.receiptId=c.id,n.method=u}await se(n.receiptId,o.providerSessionId);return}if(await ae({attemptId:n.attemptId,status:n.providerMismatch?"failed":U(o.outcome),errorCode:n.providerMismatch?"provider_mismatch":U(o.outcome)==="succeeded"?null:o.outcome,errorMessage:o.error,durationMs:o.durationMs,endedAt:o.completedAt}),(n.observedProvider??n.plannedProvider)==="\u006b\u0065\u0072\u006e\u0065\u006c"){let s=X(o.durationMs,!0);await w({receiptId:n.receiptId,costState:"estimated",units:o.durationMs/1e3,unitType:"browser_second",amountUsdNanos:Math.round(s*Oe),rateSource:`\u006b\u0065\u0072\u006e\u0065\u006c_headful_usd_per_second:${Y}`,providerStatus:n.providerMismatch?"provider_mismatch":o.outcome,providerDurationMs:o.durationMs,errorCode:n.providerMismatch?"provider_mismatch":U(o.outcome)==="succeeded"?null:o.outcome,errorMessage:o.error,finalizedAt:o.completedAt})}}catch(n){console.warn(JSON.stringify({event:"operation_attempt_telemetry_failed",operation_run_id:e,attempt_number:o.attemptNumber,message:n instanceof Error?n.message:String(n)}))}}}function ce(e,r,t=null,i="production-default",a=0){let o=ue(t,i,a);return async n=>{if(await o(n),n.type==="started"){await J({jobId:e,userId:r,attemptNumber:n.attemptNumber,maxAttempts:n.maxAttempts,query:n.query,location:n.location,maxQuestions:n.maxQuestions,startedAt:n.startedAt});return}if(n.type==="provider_session_started"){await V({jobId:e,attemptNumber:n.attemptNumber,browserProvider:n.provider,providerSessionId:n.providerSessionId,observedAt:n.observedAt});return}await Q({jobId:e,attemptNumber:n.attemptNumber,outcome:n.outcome,\u006b\u0065\u0072\u006e\u0065\u006cSessionId:n.\u006b\u0065\u0072\u006e\u0065\u006cSessionId,questionCount:n.questionCount,durationMs:n.durationMs,error:n.error,willRetry:n.willRetry,\u006b\u0065\u0072\u006e\u0065\u006cDeleteStarted:n.cleanup.\u006b\u0065\u0072\u006e\u0065\u006cDeleteStarted,\u006b\u0065\u0072\u006e\u0065\u006cDeleteSucceeded:n.cleanup.\u006b\u0065\u0072\u006e\u0065\u006cDeleteSucceeded,\u006b\u0065\u0072\u006e\u0065\u006cDeleteError:n.cleanup.\u006b\u0065\u0072\u006e\u0065\u006cDeleteError,browserCloseSucceeded:n.cleanup.browserCloseSucceeded,browserCloseError:n.cleanup.browserCloseError,browserProvider:n.cleanup.provider??null,providerSessionId:n.cleanup.providerSessionId??null,providerLookupStatus:n.cleanup.providerSessionId?"pending":"not_applicable",providerErrorCode:n.cleanup.providerDisconnectObserved?"browser_session_interrupted":null,providerErrorMessage:n.cleanup.providerDisconnectMessage??null,providerReasonSource:n.cleanup.providerDisconnectObserved?"client_runtime":null,providerDisconnectObserved:n.cleanup.providerDisconnectObserved??!1,providerDisconnectMessage:n.cleanup.providerDisconnectMessage??null,debug:n.debug,completedAt:n.completedAt})}}var pe=2,K=0;function me(e){if(!e||typeof e!="object")return 0;let r=e;return typeof r.totalQuestions=="number"?r.totalQuestions:Array.isArray(r.flat)?r.flat.length:0}function _e(e){return x.paa_base+Math.max(1,e)*x.paa}async function ge(e){K++;try{let r=typeof e.options=="string"?JSON.parse(e.options):e.options,t={value:null},i=v(e.id),a=await j({op:r.serpOnly?"serp":"paa",userId:Number(e.user_id),headlessSentOut:t,operationRunId:i,operationAccountScope:"production-default"},()=>Z({...r,\u006b\u0065\u0072\u006e\u0065\u006cApiKey:F(),headless:!0,format:"json",outputDir:"/tmp/paa-output-api",onAttemptEvent:ce(e.id,e.user_id,i)}));await G(e.id,a),await q(i,"succeeded");let o=await E(e.id,e.user_id);if(typeof r.billingHoldMc=="number"&&r.billingDebitKey){let n=r.serpOnly?k(t.value):_e(me(a));await I(Number(e.user_id),r.billingDebitKey,n,r.serpOnly?"serp_refund":"paa_refund",r.serpOnly?"SERP search settlement":"PAA harvest settlement",r.serpOnly?"serp_search":"paa_harvest")}else if(!r.serpOnly&&typeof r.billingHoldMc=="number"){let n=_e(me(a)),s=r.billingHoldMc-n;s>0?await b(e.user_id,s,"paa_refund","overestimate refund"):s<0&&await A(e.user_id,-s,"paa",r.query??e.query)}else if(r.serpOnly&&typeof r.billingHoldMc=="number"){let n=k(t.value),s=r.billingHoldMc-n;s>0?await b(e.user_id,s,"serp_refund","headless-mode pricing settle"):s<0&&await A(e.user_id,-s,"serp",r.query??e.query)}e.callback_url&&await P(e.callback_url,{job_id:e.id,status:"done",result:ee(a),attempts:N(o)})}catch(r){console.error("[harvest/worker] failed",{jobId:e.id,error:r instanceof Error?r.message:String(r)});let t=C(r);await q(v(e.id),t.error_code==="harvest_timeout"?"timed_out":t.terminalStatus,t.error_code);let i=typeof e.options=="string"?JSON.parse(e.options):e.options,a=typeof i.billingHoldMc=="number"&&i.billingHoldMc>0;await O(e.id,T(t),L(t,{chargeStatus:a?"refund_pending":"not_charged"}));let o=await E(e.id,e.user_id);try{a&&(i.billingDebitKey?await I(Number(e.user_id),i.billingDebitKey,0,i.serpOnly?"serp_refund":"paa_refund","failed call",i.serpOnly?"serp_search":"paa_harvest"):await b(e.user_id,i.billingHoldMc,"refund","failed call"),await O(e.id,T(t),L(t,{chargeStatus:"refunded"})))}catch{}e.callback_url&&await P(e.callback_url,{job_id:e.id,status:"failed",...y(t),attempts:N(o)})}finally{K--}}async function Ne(){let e=await R();if(!e)return{claimed:!1};let r=Date.now();return await ge(e),{claimed:!0,jobId:e.id,completed:!0,durationMs:Date.now()-r}}async function ar(e){let r=[];for(let t=0;t<e.maxJobs&&!(Date.now()>=e.deadlineMs);t++){let i=await Ne();if(r.push(i),!i.claimed)break}return r}function sr(){setInterval(async()=>{if(K>=pe)return;let e=await R();e&&ge(e)},2e3),console.log(`[worker] started \u2014 polling every 2s, max ${pe} concurrent`)}export{ie as a,ae as b,D as c,se as d,w as e,He as f,De as g,Ue as h,qe as i,C as j,T as k,y as l,L as m,Ce as n,v as o,We as p,q,Be as r,ce as s,P as t,Ne as u,ar as v,sr as w};
@@ -1 +0,0 @@
1
- var o="0.90.7";export{o as a};
@@ -1 +0,0 @@
1
- import{$ as M,$a as Ma,$b as Mb,A as l,Aa as la,Ab as lb,B as m,Ba as ma,Bb as mb,C as n,Ca as na,Cb as nb,D as o,Da as oa,Db as ob,E as p,Ea as pa,Eb as pb,F as q,Fa as qa,Fb as qb,G as r,Ga as ra,Gb as rb,H as s,Ha as sa,Hb as sb,I as t,Ia as ta,Ib as tb,J as u,Ja as ua,Jb as ub,K as v,Ka as va,Kb as vb,L as w,La as wa,Lb as wb,M as x,Ma as xa,Mb as xb,N as y,Na as ya,Nb as yb,O as z,Oa as za,Ob as zb,P as A,Pa as Aa,Pb as Ab,Q as B,Qa as Ba,Qb as Bb,R as C,Ra as Ca,Rb as Cb,S as D,Sa as Da,Sb as Db,T as E,Ta as Ea,Tb as Eb,U as F,Ua as Fa,Ub as Fb,V as G,Va as Ga,Vb as Gb,W as H,Wa as Ha,Wb as Hb,X as I,Xa as Ia,Xb as Ib,Y as J,Ya as Ja,Yb as Jb,Z as K,Za as Ka,Zb as Kb,_ as L,_a as La,_b as Lb,aa as N,ab as Na,ac as Nb,ba as O,bb as Oa,bc as Ob,ca as P,cb as Pa,cc as Pb,da as Q,db as Qa,ea as R,eb as Ra,fa as S,fb as Sa,ga as T,gb as Ta,ha as U,hb as Ua,ia as V,ib as Va,ja as W,jb as Wa,ka as X,kb as Xa,la as Y,lb as Ya,ma as Z,mb as Za,na as _,nb as _a,oa as $,ob as $a,p as a,pa as aa,pb as ab,q as b,qa as ba,qb as bb,r as c,ra as ca,rb as cb,s as d,sa as da,sb as db,t as e,ta as ea,tb as eb,u as f,ua as fa,ub as fb,v as g,va as ga,vb as gb,w as h,wa as ha,wb as hb,x as i,xa as ia,xb as ib,y as j,ya as ja,yb as jb,z as k,za as ka,zb as kb}from"./chunk-TOJBPATJ.js";export{b as CORE_SCHEMA_VERSION,a as CREDIT_LOTS_EPOCH,ub as CREDIT_LOT_TTL,c as SITE_EXTRACT_COUNTER_REPAIR_VERSION,Ib as SiteAuditJobRowSchema,Jb as SiteAuditPhaseLogRowSchema,za as advanceWorkflowRunStep,xa as appendWorkflowArtifacts,lb as applySubscriptionInvoiceGrant,V as attachHarvestAttemptProviderSession,Xa as cancelJob,J as checkRateLimit,Ia as checkpointDurablePaaJob,Ha as checkpointJob,s as claimDueStripeEvents,Ga as claimDurablePaaJob,Ab as claimMonthlyFreeRefresh,Fa as claimPendingJob,Za as claimPendingKpoJob,Ka as completeDurablePaaJob,Na as completeExpiredDurablePaaJob,Ta as completeJob,ab as completeKpoJob,Ua as completeRunningJob,t as completeStripeEvent,ua as completeWorkflowRunRecord,m as consumeCode,L as consumePasswordResetToken,Ea as countActiveJobsForUser,Da as countActiveUsers,Q as createJob,R as createJobWithId,Ya as createKpoJob,K as createPasswordResetToken,S as createRunningJob,I as createUser,pa as createWorkflowRun,ia as createWorkflowSchedule,xb as creditMc,yb as creditMcIdempotent,P as deactivateUser,v as deadLetterStripeEvent,Bb as debitMc,Cb as debitMcIdempotent,ma as deleteWorkflowSchedule,r as enqueueStripeEvent,vb as expireOldLots,La as failDurablePaaJob,Oa as failExpiredDurablePaaJob,Va as failJob,bb as failKpoJob,Wa as failRunningJob,va as failWorkflowRunRecord,W as finalizeExpiredHarvestAttempts,X as finishHarvestAttempt,y as generateApiKey,Fb as getBillingLedgerSummary,k as getClient,mb as getConnectedAccountBillingState,e as getDb,Lb as getInboxMessage,$ as getJob,_a as getKpoJob,db as getKpoPhaseLog,Eb as getLedger,qb as getMemoryPlan,rb as getMemoryProvisioned,T as getOrCreateRunningJob,ea as getPageSnapshot,o as getRefresh,w as getStripeEventQueueHealth,C as getUserByApiKey,B as getUserByEmail,D as getUserById,fb as getUserByStripeCustomerId,E as getUserMemoryCreds,H as getUserStats,Ba as getWorkflowArtifact,qa as getWorkflowRun,ra as getWorkflowRunByIdempotencyKey,ya as getWorkflowRunStepState,ja as getWorkflowSchedule,z as hashPassword,Ob as insertInboxMessage,d as inspectCurrentCoreSchema,zb as ledgerExistsForOperation,Gb as ledgerExistsForStripePI,Pb as listActiveUserIds,na as listDueWorkflowSchedules,_ as listHarvestAttempts,Z as listHarvestAttemptsPendingProviderTelemetry,Kb as listInboxMessages,da as listJobs,eb as listKpoJobs,ba as listPendingExtractUrlDispatches,Pa as listRecentTerminalDurablePaaJobs,Ra as listRecoverableDurablePaaJobs,ha as listRequestEvents,Qa as listStaleRunningDurablePaaJobs,O as listUsers,ob as listUsersDueForConnectedAccountBillingReconciliation,Aa as listWorkflowArtifacts,sa as listWorkflowRuns,ka as listWorkflowSchedules,cb as logKpoPhaseComplete,ga as logRequestEvent,aa as markDispatchedJobRunning,Mb as markInboxMessageOpened,Sa as markJobBillingSettled,ta as markWorkflowRunRunning,oa as markWorkflowScheduleRan,i as migrate,wb as migrateExistingBalancesToLots,g as migrateSecuredMainOAuthSchema,la as patchWorkflowSchedule,l as putCode,n as putRefresh,Hb as reconcileBalanceMc,ca as recordExtractUrlDispatchAttempt,Ca as recordWorkflowWebhookDelivery,j as registerClient,Ja as renewDurablePaaLease,wa as replaceWorkflowArtifacts,Ma as requeueExpiredDurablePaaJob,tb as resolveUserByMemorySubscription,u as retryStripeEvent,N as revokeApiKey,p as revokeRefresh,M as rotateApiKey,q as rotateRefresh,ib as setConcurrencyPackQuantity,jb as setConcurrencySubId,nb as setConnectedAccountBillingState,f as setDbForTesting,hb as setExtraConcurrencySlots,pb as setMemoryPlan,sb as setMemoryProvisioned,G as setPassword,gb as setStripeCustomerId,kb as setSubscriptionTier,F as setUserMemoryCreds,Db as settleDebitMcIdempotent,Nb as softDeleteInboxMessage,U as startHarvestAttempt,x as stripeEventAlreadyProcessed,Y as updateHarvestAttemptProviderTelemetry,$a as updateKpoJobState,fa as upsertPageSnapshot,A as verifyPassword,h as verifySecuredMainOAuthSchema};
@@ -1 +0,0 @@
1
- import{e as a,f as b,g as c,h as d,i as e,j as f,k as g,l as h}from"./chunk-OT2HUS2G.js";import"./chunk-YTEAWZEN.js";import"./chunk-IGJKAECE.js";import"./chunk-HUV2WTRW.js";import"./chunk-CTX3NMZQ.js";import"./chunk-BDLR4CCL.js";import"./chunk-TOJBPATJ.js";export{d as GMAIL_ATTACHMENT_REF_TTL_MS,c as GMAIL_INLINE_BODY_BYTES,b as GMAIL_MAIN_CONTRACT_HASH,a as GMAIL_MAIN_CONTRACT_VERSION,h as GmailService,e as GmailServiceError,g as normalizeGmailMessage,f as parseGmailAddresses};