@corsair-dev/exa 0.1.0
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/LICENSE +191 -0
- package/dist/client.d.ts +10 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/endpoints/answer.d.ts +3 -0
- package/dist/endpoints/answer.d.ts.map +1 -0
- package/dist/endpoints/contents.d.ts +3 -0
- package/dist/endpoints/contents.d.ts.map +1 -0
- package/dist/endpoints/events.d.ts +4 -0
- package/dist/endpoints/events.d.ts.map +1 -0
- package/dist/endpoints/imports.d.ts +5 -0
- package/dist/endpoints/imports.d.ts.map +1 -0
- package/dist/endpoints/index.d.ts +360 -0
- package/dist/endpoints/index.d.ts.map +1 -0
- package/dist/endpoints/monitors.d.ts +3 -0
- package/dist/endpoints/monitors.d.ts.map +1 -0
- package/dist/endpoints/search.d.ts +4 -0
- package/dist/endpoints/search.d.ts.map +1 -0
- package/dist/endpoints/types.d.ts +2829 -0
- package/dist/endpoints/types.d.ts.map +1 -0
- package/dist/endpoints/webhooks-api.d.ts +3 -0
- package/dist/endpoints/webhooks-api.d.ts.map +1 -0
- package/dist/endpoints/websets.d.ts +5 -0
- package/dist/endpoints/websets.d.ts.map +1 -0
- package/dist/error-handlers.d.ts +46 -0
- package/dist/error-handlers.d.ts.map +1 -0
- package/dist/index.d.ts +1659 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/schema/database.d.ts +146 -0
- package/dist/schema/database.d.ts.map +1 -0
- package/dist/schema/index.d.ts +144 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/tsup.config.d.ts +3 -0
- package/dist/tsup.config.d.ts.map +1 -0
- package/dist/webhooks/content-indexed.d.ts +3 -0
- package/dist/webhooks/content-indexed.d.ts.map +1 -0
- package/dist/webhooks/index.d.ts +162 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/search-alert.d.ts +3 -0
- package/dist/webhooks/search-alert.d.ts.map +1 -0
- package/dist/webhooks/types.d.ts +626 -0
- package/dist/webhooks/types.d.ts.map +1 -0
- package/dist/webhooks/webset-items-found.d.ts +3 -0
- package/dist/webhooks/webset-items-found.d.ts.map +1 -0
- package/dist/webhooks/webset-search-completed.d.ts +3 -0
- package/dist/webhooks/webset-search-completed.d.ts.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,EACb,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EAEjB,uBAAuB,EAIvB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAe7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE/E,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,KAAK,EACX,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,0BAA0B,EAC1B,MAAM,kBAAkB,CAAC;AAY1B,MAAM,MAAM,YAAY,GAAG;IAC1B,YAAY,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IAC1C,iBAAiB,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAC;IACpD,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;IACxC,SAAS,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACpC,aAAa,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IAC5C,UAAU,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;IACtC,aAAa,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IAC5C,aAAa,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IAC5C,WAAW,EAAE,WAAW,CAAC,aAAa,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AAa,CAAC,CAAC,SAAS,gBAAgB,IAAI,aAAa,CACpE,KAAK,EACL,OAAO,SAAS,EAChB,OAAO,kBAAkB,EACzB,OAAO,iBAAiB,EACxB,CAAC,EACD,OAAO,eAAe,CACtB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAAC;AAEhE,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,gBAAgB,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;AAE7E,wBAAgB,GAAG,CAAC,KAAK,CAAC,CAAC,SAAS,gBAAgB,EACnD,eAAe,GAAE,gBAAgB,GAAG,CAA8B,GAChE,iBAAiB,CAAC,CAAC,CAAC,CAwDtB;AAMD,YAAY,EACX,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,0BAA0B,GAC1B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAMvD,YAAY,EACX,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,MAAM,EACN,UAAU,EACV,oBAAoB,EACpB,uBAAuB,EACvB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,GACf,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{logEventFromContext as Re}from"corsair/core";import{request as ke}from"corsair/http";var Ce="https://api.exa.ai",Ae={enabled:!0,maxRetries:3,initialRetryDelay:1e3,backoffMultiplier:2,headerNames:{retryAfter:"Retry-After"}};async function d(t,s,o={}){let{method:n="POST",body:r,query:p}=o;return await ke({BASE:Ce,VERSION:"1.0.0",WITH_CREDENTIALS:!1,CREDENTIALS:"omit",HEADERS:{"Content-Type":"application/json","x-api-key":s}},{method:n,url:t,body:n==="POST"||n==="PUT"||n==="PATCH"?r:void 0,mediaType:"application/json; charset=utf-8",query:n==="GET"?p:void 0},{rateLimitConfig:Ae})}var R=async(t,s)=>{let o=await d("answer",t.key,{method:"POST",body:s});if(o.citations&&t.db.searchResults)try{for(let n of o.citations)await t.db.searchResults.upsertByEntityId(n.id,{...n,query:s.query,createdAt:n.publishedDate?new Date(n.publishedDate):new Date})}catch(n){console.warn("Failed to save answer citations to database:",n)}return await Re(t,"exa.answer.get",{query:s.query},"completed"),o};import{logEventFromContext as We}from"corsair/core";var W=async(t,s)=>{let o=await d("contents",t.key,{method:"POST",body:s});if(o.results&&t.db.searchResults)try{for(let n of o.results)await t.db.searchResults.upsertByEntityId(n.id,{...n,createdAt:n.publishedDate?new Date(n.publishedDate):new Date})}catch(n){console.warn("Failed to save contents to database:",n)}return await We(t,"exa.contents.get",{idCount:s.ids.length},"completed"),o};import{logEventFromContext as D}from"corsair/core";var L=async(t,s)=>{let{websetId:o,...n}=s,r=await d(`websets/v0/websets/${o}/events`,t.key,{method:"GET",query:n});if(r.data&&t.db.events)try{for(let p of r.data)await t.db.events.upsertByEntityId(p.id,{id:p.id,type:p.type,websetId:o,createdAt:new Date(p.createdAt)})}catch(p){console.warn("Failed to save events to database:",p)}return await D(t,"exa.events.list",{websetId:o},"completed"),r},G=async(t,s)=>{let o=await d(`websets/v0/websets/${s.websetId}/events/${s.eventId}`,t.key,{method:"GET"});if(t.db.events)try{await t.db.events.upsertByEntityId(o.id,{id:o.id,type:o.type,websetId:s.websetId,createdAt:new Date(o.createdAt)})}catch(n){console.warn("Failed to save event to database:",n)}return await D(t,"exa.events.get",{websetId:s.websetId,eventId:s.eventId},"completed"),o};import{logEventFromContext as g}from"corsair/core";var F=async(t,s)=>{let o=await d(`websets/v0/websets/${s.websetId}/imports`,t.key,{method:"POST",body:{urls:s.urls}});if(t.db.imports)try{await t.db.imports.upsertByEntityId(o.id,{...o,createdAt:new Date(o.createdAt),updatedAt:o.updatedAt?new Date(o.updatedAt):void 0})}catch(n){console.warn("Failed to save import to database:",n)}return await g(t,"exa.imports.create",{websetId:s.websetId,urlCount:s.urls.length},"completed"),o},O=async(t,s)=>{let{websetId:o,...n}=s,r=await d(`websets/v0/websets/${o}/imports`,t.key,{method:"GET",query:n});if(r.data&&t.db.imports)try{for(let p of r.data)await t.db.imports.upsertByEntityId(p.id,{...p,createdAt:new Date(p.createdAt),updatedAt:p.updatedAt?new Date(p.updatedAt):void 0})}catch(p){console.warn("Failed to save imports to database:",p)}return await g(t,"exa.imports.list",{websetId:o},"completed"),r},P=async(t,s)=>{let o=await d(`websets/v0/websets/${s.websetId}/imports/${s.importId}`,t.key,{method:"DELETE"});if(o.deleted&&t.db.imports)try{await t.db.imports.deleteByEntityId(s.importId)}catch(n){console.warn("Failed to delete import from database:",n)}return await g(t,"exa.imports.delete",{websetId:s.websetId,importId:s.importId},"completed"),o};import{logEventFromContext as De}from"corsair/core";var T=async(t,s)=>{let{websetId:o,...n}=s,r=await d(`websets/v0/websets/${o}/monitors`,t.key,{method:"POST",body:n});if(t.db.monitors)try{await t.db.monitors.upsertByEntityId(r.id,{...r,createdAt:new Date(r.createdAt),updatedAt:r.updatedAt?new Date(r.updatedAt):void 0})}catch(p){console.warn("Failed to save monitor to database:",p)}return await De(t,"exa.monitors.create",{websetId:o,cadenceType:s.cadence.type},"completed"),r};import{logEventFromContext as j}from"corsair/core";var q=async(t,s)=>{let o=await d("search",t.key,{method:"POST",body:s});if(o.results&&t.db.searchResults)try{for(let n of o.results)await t.db.searchResults.upsertByEntityId(n.id,{...n,query:s.query,createdAt:n.publishedDate?new Date(n.publishedDate):new Date})}catch(n){console.warn("Failed to save search results to database:",n)}return await j(t,"exa.search.search",{query:s.query,resultCount:o.results?.length??0},"completed"),o},M=async(t,s)=>{let o=await d("findSimilar",t.key,{method:"POST",body:s});if(o.results&&t.db.searchResults)try{for(let n of o.results)await t.db.searchResults.upsertByEntityId(n.id,{...n,createdAt:n.publishedDate?new Date(n.publishedDate):new Date})}catch(n){console.warn("Failed to save search results to database:",n)}return await j(t,"exa.search.findSimilar",{url:s.url,resultCount:o.results?.length??0},"completed"),o};import{logEventFromContext as Le}from"corsair/core";var z=async(t,s)=>{let o=await d("websets/v0/webhooks",t.key,{method:"GET",query:s});if(o.data&&t.db.webhookConfigs)try{for(let n of o.data)await t.db.webhookConfigs.upsertByEntityId(n.id,{...n,createdAt:new Date(n.createdAt),updatedAt:n.updatedAt?new Date(n.updatedAt):void 0})}catch(n){console.warn("Failed to save webhook configs to database:",n)}return await Le(t,"exa.webhooksApi.list",{},"completed"),o};import{logEventFromContext as I}from"corsair/core";var B=async(t,s)=>{let o=await d("websets/v0/websets",t.key,{method:"POST",body:s});if(t.db.websets)try{await t.db.websets.upsertByEntityId(o.id,{id:o.id,status:o.status,externalId:o.externalId,createdAt:new Date(o.createdAt)})}catch(n){console.warn("Failed to save webset to database:",n)}return await I(t,"exa.websets.create",{externalId:s.externalId},"completed"),o},_=async(t,s)=>{let o=await d(`websets/v0/websets/${s.id}`,t.key,{method:"GET"});if(t.db.websets)try{await t.db.websets.upsertByEntityId(o.id,{id:o.id,status:o.status,externalId:o.externalId,createdAt:new Date(o.createdAt),updatedAt:new Date(o.updatedAt)})}catch(n){console.warn("Failed to save webset to database:",n)}return await I(t,"exa.websets.get",{id:s.id},"completed"),o},H=async(t,s)=>{let o=await d(`websets/v0/websets/${s.id}`,t.key,{method:"DELETE"});if(o.deleted&&t.db.websets)try{await t.db.websets.deleteByEntityId(s.id)}catch(n){console.warn("Failed to delete webset from database:",n)}return await I(t,"exa.websets.delete",{id:s.id},"completed"),o};import{z as e}from"zod";var N=e.object({maxCharacters:e.number().optional(),includeHtmlTags:e.boolean().optional()}),U=e.object({numSentences:e.number().optional(),highlightsPerUrl:e.number().optional(),query:e.string().optional()}),K=e.object({query:e.string().optional()}),X=e.object({text:e.union([N,e.boolean()]).optional(),highlights:e.union([U,e.boolean()]).optional(),summary:e.union([K,e.boolean()]).optional()}),y=e.object({id:e.string(),url:e.string(),title:e.string().nullable().optional(),publishedDate:e.string().nullable().optional(),author:e.string().nullable().optional(),score:e.number().optional(),text:e.string().optional(),highlights:e.array(e.string()).optional(),highlightScores:e.array(e.number()).optional(),summary:e.string().optional()}),Ge=e.object({type:e.enum(["company","person","article","research paper","repository","event","product","video","job","podcast"]).optional()}),Fe=e.object({description:e.string(),successRate:e.string().optional()}),V=e.object({query:e.string(),count:e.number().optional(),entity:Ge.optional(),criteria:e.array(Fe).optional()}),Oe=e.object({description:e.string(),format:e.enum(["text","date","number","options","boolean"]).optional(),options:e.array(e.string()).optional()}),Pe=e.object({id:e.string(),description:e.string(),format:e.enum(["text","date","number","options","boolean"]),options:e.array(e.string()).optional(),createdAt:e.string(),updatedAt:e.string()}),S=e.object({id:e.string(),object:e.literal("import"),websetId:e.string(),urls:e.array(e.string()).optional(),status:e.enum(["pending","processing","completed","failed"]).optional(),createdAt:e.string(),updatedAt:e.string().optional()}),J=e.object({type:e.enum(["realtime","hourly","daily","weekly"])}),Q=e.object({id:e.string(),object:e.literal("monitor"),websetId:e.string(),cadence:J,createdAt:e.string(),updatedAt:e.string().optional()}),$=e.object({id:e.string(),object:e.literal("webset"),status:e.enum(["idle","running","paused","done"]),externalId:e.string().optional(),searches:e.array(V).optional(),enrichments:e.array(Pe).optional(),imports:e.array(S).optional(),monitors:e.array(Q).optional(),createdAt:e.string(),updatedAt:e.string()}),Z=e.object({id:e.string(),object:e.literal("event"),type:e.string(),createdAt:e.string(),data:e.unknown().optional()}),Te=e.object({id:e.string(),object:e.literal("webhook"),url:e.string(),events:e.array(e.string()).optional(),status:e.enum(["active","inactive"]).optional(),createdAt:e.string(),updatedAt:e.string().optional()}),v=t=>e.object({data:e.array(t),hasMore:e.boolean().optional(),nextCursor:e.string().optional()}),je=e.object({query:e.string(),numResults:e.number().optional(),includeDomains:e.array(e.string()).optional(),excludeDomains:e.array(e.string()).optional(),startCrawlDate:e.string().optional(),endCrawlDate:e.string().optional(),startPublishedDate:e.string().optional(),endPublishedDate:e.string().optional(),useAutoprompt:e.boolean().optional(),type:e.enum(["keyword","neural","auto"]).optional(),category:e.string().optional(),contents:X.optional()}),qe=e.object({url:e.string(),numResults:e.number().optional(),includeDomains:e.array(e.string()).optional(),excludeDomains:e.array(e.string()).optional(),startCrawlDate:e.string().optional(),endCrawlDate:e.string().optional(),startPublishedDate:e.string().optional(),endPublishedDate:e.string().optional(),excludeSourceDomain:e.boolean().optional(),category:e.string().optional(),contents:X.optional()}),Me=e.object({ids:e.array(e.string()),text:e.union([N,e.boolean()]).optional(),highlights:e.union([U,e.boolean()]).optional(),summary:e.union([K,e.boolean()]).optional()}),ze=e.object({query:e.string(),text:e.boolean().optional(),stream:e.boolean().optional()}),Be=e.object({searches:e.array(V).optional(),enrichments:e.array(Oe).optional(),externalId:e.string().optional()}),_e=e.object({id:e.string()}),He=e.object({id:e.string()}),$e=e.object({websetId:e.string(),urls:e.array(e.string())}),Ne=e.object({websetId:e.string(),cursor:e.string().optional(),limit:e.number().optional()}),Ue=e.object({websetId:e.string(),importId:e.string()}),Ke=e.object({websetId:e.string(),cadence:J}),Xe=e.object({websetId:e.string(),cursor:e.string().optional(),limit:e.number().optional()}),Ve=e.object({websetId:e.string(),eventId:e.string()}),Je=e.object({cursor:e.string().optional(),limit:e.number().optional()}),Qe=e.object({results:e.array(y),autopromptString:e.string().optional(),requestId:e.string().optional()}),Ze=e.object({results:e.array(y),requestId:e.string().optional()}),Ye=e.object({results:e.array(y),requestId:e.string().optional()}),et=e.object({answer:e.string(),citations:e.array(y).optional(),requestId:e.string().optional()}),tt=e.object({id:e.string(),object:e.literal("webset"),deleted:e.boolean()}),ot=e.object({id:e.string(),deleted:e.boolean()}),st=v(S),nt=v(Z),rt=v(Te),l={searchSearch:je,searchFindSimilar:qe,contentsGet:Me,answerGet:ze,websetsCreate:Be,websetsGet:_e,websetsDelete:He,importsCreate:$e,importsList:Ne,importsDelete:Ue,monitorsCreate:Ke,eventsList:Xe,eventsGet:Ve,webhooksApiList:Je},u={searchSearch:Qe,searchFindSimilar:Ze,contentsGet:Ye,answerGet:et,websetsCreate:$,websetsGet:$,websetsDelete:tt,importsCreate:S,importsList:st,importsDelete:ot,monitorsCreate:Q,eventsList:nt,eventsGet:Z,webhooksApiList:rt};var k={search:q,findSimilar:M},Y={get:W},ee={get:R},E={create:B,get:_,delete:H},w={create:F,list:O,delete:P},te={create:T},C={list:L,get:G},oe={list:z};import{ApiError as h}from"corsair/http";var se={RATE_LIMIT_ERROR:{match:(t,s)=>{if(t instanceof h&&t.status===429)return!0;let o=t.message.toLowerCase();return o.includes("rate_limit")||o.includes("ratelimit")||t.message.includes("429")},handler:async(t,s)=>{let o;return t instanceof h&&t.retryAfter!==void 0&&(o=t.retryAfter),{maxRetries:5,headersRetryAfterMs:o}}},AUTH_ERROR:{match:(t,s)=>{if(t instanceof h&&t.status===401)return!0;let o=t.message.toLowerCase();return o.includes("unauthorized")||o.includes("invalid api key")||o.includes("authentication")},handler:async(t,s)=>(console.log(`[EXA:${s.operation}] Authentication failed - check your API key`),{maxRetries:0})},PERMISSION_ERROR:{match:(t,s)=>{if(t instanceof h&&t.status===403)return!0;let o=t.message.toLowerCase();return o.includes("forbidden")||o.includes("permission")||o.includes("access denied")},handler:async(t,s)=>(console.warn(`[EXA:${s.operation}] Permission denied: ${t.message}`),{maxRetries:0})},BAD_REQUEST_ERROR:{match:(t,s)=>{if(t instanceof h&&t.status===400)return!0;let o=t.message.toLowerCase();return o.includes("bad request")||o.includes("invalid request")||o.includes("validation")},handler:async(t,s)=>(console.warn(`[EXA:${s.operation}] Bad request: ${t.message}`),{maxRetries:0})},NETWORK_ERROR:{match:(t,s)=>{let o=t.message.toLowerCase();return o.includes("network")||o.includes("connection")||o.includes("econnrefused")||o.includes("enotfound")||o.includes("etimedout")||o.includes("fetch failed")||o.includes("network error")},handler:async(t,s)=>(console.warn(`[EXA:${s.operation}] Network error: ${t.message}`),{maxRetries:3})},NOT_FOUND_ERROR:{match:(t,s)=>t instanceof h&&t.status===404?!0:t.message.toLowerCase().includes("not found"),handler:async(t,s)=>(console.warn(`[EXA:${s.operation}] Resource not found: ${t.message}`),{maxRetries:0})},DEFAULT:{match:(t,s)=>!0,handler:async(t,s)=>(console.error(`[EXA:${s.operation}] Unhandled error: ${t.message}`),{maxRetries:0})}};import i from"zod";var ne=i.object({id:i.string(),url:i.string(),title:i.string().nullable().optional(),publishedDate:i.string().nullable().optional(),author:i.string().nullable().optional(),score:i.number().optional(),text:i.string().optional(),highlights:i.array(i.string()).optional(),highlightScores:i.array(i.number()).optional(),summary:i.string().optional(),query:i.string().optional(),createdAt:i.coerce.date().nullable().optional()}),re=i.object({id:i.string(),status:i.enum(["idle","running","paused","done"]).optional(),externalId:i.string().optional(),createdAt:i.coerce.date().nullable().optional(),updatedAt:i.coerce.date().nullable().optional()}),ae=i.object({id:i.string(),websetId:i.string(),urls:i.array(i.string()).optional(),status:i.enum(["pending","processing","completed","failed"]).optional(),createdAt:i.coerce.date().nullable().optional(),updatedAt:i.coerce.date().nullable().optional()}),ie=i.object({id:i.string(),websetId:i.string(),cadenceType:i.enum(["realtime","hourly","daily","weekly"]).optional(),createdAt:i.coerce.date().nullable().optional(),updatedAt:i.coerce.date().nullable().optional()}),pe=i.object({id:i.string(),type:i.string(),websetId:i.string().optional(),createdAt:i.coerce.date().nullable().optional()}),de=i.object({id:i.string(),url:i.string(),events:i.array(i.string()).optional(),status:i.enum(["active","inactive"]).optional(),createdAt:i.coerce.date().nullable().optional(),updatedAt:i.coerce.date().nullable().optional()});var ce={version:"1.2.0",entities:{searchResults:ne,websets:re,imports:ae,monitors:ie,events:pe,webhookConfigs:de}};import{logEventFromContext as dt}from"corsair/core";import{createHmac as at,timingSafeEqual as it}from"crypto";import{z as a}from"zod";var x=a.object({id:a.string(),url:a.string(),title:a.string().nullable().optional(),publishedDate:a.string().nullable().optional(),author:a.string().nullable().optional(),score:a.number().optional(),text:a.string().optional(),highlights:a.array(a.string()).optional(),summary:a.string().optional()}),f=a.object({id:a.string(),object:a.literal("webset"),status:a.enum(["idle","running","paused","done"]),externalId:a.string().optional(),createdAt:a.string(),updatedAt:a.string()}),le=a.object({type:a.literal("search.alert"),id:a.string(),created_at:a.string(),data:a.object({query:a.string(),results:a.array(x)})}),ue=a.object({type:a.literal("content.indexed"),id:a.string(),created_at:a.string(),data:a.object({url:a.string(),title:a.string().nullable().optional(),publishedDate:a.string().nullable().optional(),author:a.string().nullable().optional()})}),me=a.object({type:a.literal("webset.items_found"),id:a.string(),created_at:a.string(),data:a.object({webset:f,items:a.array(x),itemCount:a.number().optional()})}),be=a.object({type:a.literal("webset.search.completed"),id:a.string(),created_at:a.string(),data:a.object({webset:f,totalItems:a.number().optional()})}),he=a.object({query:a.string(),results:a.array(x),triggeredAt:a.string()}),ye=a.object({url:a.string(),title:a.string().nullable().optional(),publishedDate:a.string().nullable().optional(),author:a.string().nullable().optional(),indexedAt:a.string()}),Ee=a.object({webset:f,items:a.array(x),itemCount:a.number().optional(),triggeredAt:a.string()}),we=a.object({webset:f,totalItems:a.number().optional(),completedAt:a.string()});function pt(t){return typeof t=="string"?JSON.parse(t):t}function m(t){return s=>pt(s.body).type===t}function b(t,s){if(!s)return{valid:!1,error:"Missing webhook secret"};let o=t.rawBody;if(!o)return{valid:!1,error:"Missing raw body for signature verification"};let n=t.headers,r=Array.isArray(n["x-exa-signature"])?n["x-exa-signature"][0]:n["x-exa-signature"];if(!r)return{valid:!1,error:"Missing x-exa-signature header"};let p=at("sha256",s).update(o).digest("hex");try{let c=it(Buffer.from(r),Buffer.from(p));return{valid:c,error:c?void 0:"Invalid signature"}}catch{return{valid:!1,error:"Signature comparison failed"}}}var xe={match:m("content.indexed"),handler:async(t,s)=>{let o=t.key,n=b(s,o);if(!n.valid)return{success:!1,statusCode:401,error:n.error||"Signature verification failed"};let r=s.payload;if(r.type!=="content.indexed")return{success:!0,data:void 0};let p="";if(t.db.searchResults)try{p=(await t.db.searchResults.upsertByEntityId(r.id,{id:r.id,...r.data,createdAt:r.data.publishedDate?new Date(r.data.publishedDate):new Date}))?.id||""}catch(c){console.warn("Failed to save indexed content to database:",c)}return await dt(t,"exa.webhook.contentIndexed",{url:r.data.url,title:r.data.title},"completed"),{success:!0,corsairEntityId:p,data:r}}};import{logEventFromContext as ct}from"corsair/core";var fe={match:m("search.alert"),handler:async(t,s)=>{let o=t.key,n=b(s,o);if(!n.valid)return{success:!1,statusCode:401,error:n.error||"Signature verification failed"};let r=s.payload;if(r.type!=="search.alert")return{success:!0,data:void 0};if(t.db.searchResults)try{for(let p of r.data.results)await t.db.searchResults.upsertByEntityId(p.id,{...p,query:r.data.query,createdAt:p.publishedDate?new Date(p.publishedDate):new Date})}catch(p){console.warn("Failed to save search results to database:",p)}return await ct(t,"exa.webhook.searchAlert",{query:r.data.query,resultCount:r.data.results.length},"completed"),{success:!0,data:r}}};import{logEventFromContext as lt}from"corsair/core";var ge={match:m("webset.items_found"),handler:async(t,s)=>{let o=t.key,n=b(s,o);if(!n.valid)return{success:!1,statusCode:401,error:n.error||"Signature verification failed"};let r=s.payload;if(r.type!=="webset.items_found")return{success:!0,data:void 0};let p="";if(t.db.websets)try{p=(await t.db.websets.upsertByEntityId(r.data.webset.id,{id:r.data.webset.id,status:r.data.webset.status,externalId:r.data.webset.externalId,createdAt:new Date(r.data.webset.createdAt),updatedAt:new Date(r.data.webset.updatedAt)}))?.id||""}catch(c){console.warn("Failed to save webset to database:",c)}if(t.db.searchResults)try{for(let c of r.data.items)await t.db.searchResults.upsertByEntityId(c.id,{...c,createdAt:c.publishedDate?new Date(c.publishedDate):new Date})}catch(c){console.warn("Failed to save webset items to database:",c)}return await lt(t,"exa.webhook.websetItemsFound",{websetId:r.data.webset.id,itemCount:r.data.items.length},"completed"),{success:!0,corsairEntityId:p,data:r}}};import{logEventFromContext as ut}from"corsair/core";var Ie={match:m("webset.search.completed"),handler:async(t,s)=>{let o=t.key,n=b(s,o);if(!n.valid)return{success:!1,statusCode:401,error:n.error||"Signature verification failed"};let r=s.payload;if(r.type!=="webset.search.completed")return{success:!0,data:void 0};let p="";if(t.db.websets)try{p=(await t.db.websets.upsertByEntityId(r.data.webset.id,{id:r.data.webset.id,status:r.data.webset.status,externalId:r.data.webset.externalId,createdAt:new Date(r.data.webset.createdAt),updatedAt:new Date(r.data.webset.updatedAt)}))?.id||""}catch(c){console.warn("Failed to save webset to database:",c)}return await ut(t,"exa.webhook.websetSearchCompleted",{websetId:r.data.webset.id,totalItems:r.data.totalItems},"completed"),{success:!0,corsairEntityId:p,data:r}}};var Se={searchAlert:fe},ve={contentIndexed:xe},A={websetItemsFound:ge,websetSearchCompleted:Ie};var mt={search:{search:k.search,findSimilar:k.findSimilar},contents:{get:Y.get},answer:{get:ee.get},websets:{create:E.create,get:E.get,delete:E.delete},imports:{create:w.create,list:w.list,delete:w.delete},monitors:{create:te.create},events:{list:C.list,get:C.get},webhooksApi:{list:oe.list}},bt={"search.search":{input:l.searchSearch,output:u.searchSearch},"search.findSimilar":{input:l.searchFindSimilar,output:u.searchFindSimilar},"contents.get":{input:l.contentsGet,output:u.contentsGet},"answer.get":{input:l.answerGet,output:u.answerGet},"websets.create":{input:l.websetsCreate,output:u.websetsCreate},"websets.get":{input:l.websetsGet,output:u.websetsGet},"websets.delete":{input:l.websetsDelete,output:u.websetsDelete},"imports.create":{input:l.importsCreate,output:u.importsCreate},"imports.list":{input:l.importsList,output:u.importsList},"imports.delete":{input:l.importsDelete,output:u.importsDelete},"monitors.create":{input:l.monitorsCreate,output:u.monitorsCreate},"events.list":{input:l.eventsList,output:u.eventsList},"events.get":{input:l.eventsGet,output:u.eventsGet},"webhooksApi.list":{input:l.webhooksApiList,output:u.webhooksApiList}},ht={search:{searchAlert:Se.searchAlert},content:{contentIndexed:ve.contentIndexed},webset:{websetItemsFound:A.websetItemsFound,websetSearchCompleted:A.websetSearchCompleted}},yt={"search.searchAlert":{description:"A monitored search query has new matching results",payload:le,response:he},"content.contentIndexed":{description:"A new web page has been indexed by Exa",payload:ue,response:ye},"webset.websetItemsFound":{description:"New items were found for a webset search",payload:me,response:Ee},"webset.websetSearchCompleted":{description:"A webset search has completed",payload:be,response:we}},Et="api_key",wt={"search.search":{riskLevel:"read",description:"Search the web using neural or keyword search"},"search.findSimilar":{riskLevel:"read",description:"Find web pages semantically similar to a given URL"},"contents.get":{riskLevel:"read",description:"Retrieve full text, highlights, or summaries from URLs or document IDs"},"answer.get":{riskLevel:"read",description:"Generate a direct, citation-backed answer to a natural language question"},"websets.create":{riskLevel:"write",description:"Create a new webset with search, import, and enrichment setup"},"websets.get":{riskLevel:"read",description:"Get details of a specific webset by its ID"},"websets.delete":{riskLevel:"destructive",description:"Delete a webset [DESTRUCTIVE]"},"imports.create":{riskLevel:"write",description:"Create a new import to upload data into a webset"},"imports.list":{riskLevel:"read",description:"List all imports for a webset"},"imports.delete":{riskLevel:"destructive",description:"Delete an existing import [DESTRUCTIVE]"},"monitors.create":{riskLevel:"write",description:"Create a new monitor to watch a webset for changes"},"events.list":{riskLevel:"read",description:"List all events that have occurred for a webset"},"events.get":{riskLevel:"read",description:"Get details of a specific webset event by its ID"},"webhooksApi.list":{riskLevel:"read",description:"List all webhooks configured for websets"}},Mo={api_key:{account:["one"]}};function zo(t={}){let s={...t,authType:t.authType??Et};return{id:"exa",schema:ce,options:s,hooks:s.hooks,webhookHooks:s.webhookHooks,endpoints:mt,webhooks:ht,endpointMeta:wt,endpointSchemas:bt,webhookSchemas:yt,pluginWebhookMatcher:o=>"x-exa-signature"in o.headers,errorHandlers:{...se,...s.errorHandlers},keyBuilder:async(o,n)=>{if(n==="webhook"&&s.webhookSecret)return s.webhookSecret;if(n==="webhook"){let r=await o.keys.get_webhook_signature();return r||""}if(n==="endpoint"&&s.key)return s.key;if(o.authType==="api_key"){let r=await o.keys.get_api_key();return r||""}return""}}}export{m as createExaEventMatch,zo as exa,Mo as exaAuthConfig,bt as exaEndpointSchemas};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
export declare const ExaSearchResult: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
url: z.ZodString;
|
|
5
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
6
|
+
publishedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
7
|
+
author: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
score: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
text: z.ZodOptional<z.ZodString>;
|
|
10
|
+
highlights: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
11
|
+
highlightScores: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
12
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
13
|
+
query: z.ZodOptional<z.ZodString>;
|
|
14
|
+
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
id: string;
|
|
17
|
+
url: string;
|
|
18
|
+
query?: string | undefined;
|
|
19
|
+
text?: string | undefined;
|
|
20
|
+
highlights?: string[] | undefined;
|
|
21
|
+
summary?: string | undefined;
|
|
22
|
+
title?: string | null | undefined;
|
|
23
|
+
publishedDate?: string | null | undefined;
|
|
24
|
+
author?: string | null | undefined;
|
|
25
|
+
score?: number | undefined;
|
|
26
|
+
highlightScores?: number[] | undefined;
|
|
27
|
+
createdAt?: Date | null | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
id: string;
|
|
30
|
+
url: string;
|
|
31
|
+
query?: string | undefined;
|
|
32
|
+
text?: string | undefined;
|
|
33
|
+
highlights?: string[] | undefined;
|
|
34
|
+
summary?: string | undefined;
|
|
35
|
+
title?: string | null | undefined;
|
|
36
|
+
publishedDate?: string | null | undefined;
|
|
37
|
+
author?: string | null | undefined;
|
|
38
|
+
score?: number | undefined;
|
|
39
|
+
highlightScores?: number[] | undefined;
|
|
40
|
+
createdAt?: Date | null | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const ExaWebset: z.ZodObject<{
|
|
43
|
+
id: z.ZodString;
|
|
44
|
+
status: z.ZodOptional<z.ZodEnum<["idle", "running", "paused", "done"]>>;
|
|
45
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
46
|
+
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
47
|
+
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
id: string;
|
|
50
|
+
status?: "idle" | "running" | "paused" | "done" | undefined;
|
|
51
|
+
createdAt?: Date | null | undefined;
|
|
52
|
+
updatedAt?: Date | null | undefined;
|
|
53
|
+
externalId?: string | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
id: string;
|
|
56
|
+
status?: "idle" | "running" | "paused" | "done" | undefined;
|
|
57
|
+
createdAt?: Date | null | undefined;
|
|
58
|
+
updatedAt?: Date | null | undefined;
|
|
59
|
+
externalId?: string | undefined;
|
|
60
|
+
}>;
|
|
61
|
+
export declare const ExaImport: z.ZodObject<{
|
|
62
|
+
id: z.ZodString;
|
|
63
|
+
websetId: z.ZodString;
|
|
64
|
+
urls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
65
|
+
status: z.ZodOptional<z.ZodEnum<["pending", "processing", "completed", "failed"]>>;
|
|
66
|
+
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
67
|
+
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
id: string;
|
|
70
|
+
websetId: string;
|
|
71
|
+
status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
72
|
+
createdAt?: Date | null | undefined;
|
|
73
|
+
updatedAt?: Date | null | undefined;
|
|
74
|
+
urls?: string[] | undefined;
|
|
75
|
+
}, {
|
|
76
|
+
id: string;
|
|
77
|
+
websetId: string;
|
|
78
|
+
status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
79
|
+
createdAt?: Date | null | undefined;
|
|
80
|
+
updatedAt?: Date | null | undefined;
|
|
81
|
+
urls?: string[] | undefined;
|
|
82
|
+
}>;
|
|
83
|
+
export declare const ExaMonitor: z.ZodObject<{
|
|
84
|
+
id: z.ZodString;
|
|
85
|
+
websetId: z.ZodString;
|
|
86
|
+
cadenceType: z.ZodOptional<z.ZodEnum<["realtime", "hourly", "daily", "weekly"]>>;
|
|
87
|
+
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
88
|
+
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
89
|
+
}, "strip", z.ZodTypeAny, {
|
|
90
|
+
id: string;
|
|
91
|
+
websetId: string;
|
|
92
|
+
createdAt?: Date | null | undefined;
|
|
93
|
+
updatedAt?: Date | null | undefined;
|
|
94
|
+
cadenceType?: "realtime" | "hourly" | "daily" | "weekly" | undefined;
|
|
95
|
+
}, {
|
|
96
|
+
id: string;
|
|
97
|
+
websetId: string;
|
|
98
|
+
createdAt?: Date | null | undefined;
|
|
99
|
+
updatedAt?: Date | null | undefined;
|
|
100
|
+
cadenceType?: "realtime" | "hourly" | "daily" | "weekly" | undefined;
|
|
101
|
+
}>;
|
|
102
|
+
export declare const ExaEvent: z.ZodObject<{
|
|
103
|
+
id: z.ZodString;
|
|
104
|
+
type: z.ZodString;
|
|
105
|
+
websetId: z.ZodOptional<z.ZodString>;
|
|
106
|
+
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
107
|
+
}, "strip", z.ZodTypeAny, {
|
|
108
|
+
id: string;
|
|
109
|
+
type: string;
|
|
110
|
+
createdAt?: Date | null | undefined;
|
|
111
|
+
websetId?: string | undefined;
|
|
112
|
+
}, {
|
|
113
|
+
id: string;
|
|
114
|
+
type: string;
|
|
115
|
+
createdAt?: Date | null | undefined;
|
|
116
|
+
websetId?: string | undefined;
|
|
117
|
+
}>;
|
|
118
|
+
export declare const ExaWebhookConfig: z.ZodObject<{
|
|
119
|
+
id: z.ZodString;
|
|
120
|
+
url: z.ZodString;
|
|
121
|
+
events: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
122
|
+
status: z.ZodOptional<z.ZodEnum<["active", "inactive"]>>;
|
|
123
|
+
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
124
|
+
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
125
|
+
}, "strip", z.ZodTypeAny, {
|
|
126
|
+
id: string;
|
|
127
|
+
url: string;
|
|
128
|
+
status?: "active" | "inactive" | undefined;
|
|
129
|
+
createdAt?: Date | null | undefined;
|
|
130
|
+
updatedAt?: Date | null | undefined;
|
|
131
|
+
events?: string[] | undefined;
|
|
132
|
+
}, {
|
|
133
|
+
id: string;
|
|
134
|
+
url: string;
|
|
135
|
+
status?: "active" | "inactive" | undefined;
|
|
136
|
+
createdAt?: Date | null | undefined;
|
|
137
|
+
updatedAt?: Date | null | undefined;
|
|
138
|
+
events?: string[] | undefined;
|
|
139
|
+
}>;
|
|
140
|
+
export type ExaSearchResult = z.infer<typeof ExaSearchResult>;
|
|
141
|
+
export type ExaWebset = z.infer<typeof ExaWebset>;
|
|
142
|
+
export type ExaImport = z.infer<typeof ExaImport>;
|
|
143
|
+
export type ExaMonitor = z.infer<typeof ExaMonitor>;
|
|
144
|
+
export type ExaEvent = z.infer<typeof ExaEvent>;
|
|
145
|
+
export type ExaWebhookConfig = z.infer<typeof ExaWebhookConfig>;
|
|
146
|
+
//# sourceMappingURL=database.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../schema/database.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa1B,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;EAMpB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;EAOpB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;EAMrB,CAAC;AAEH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;EAKnB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;EAO3B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AACpD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAChD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
export declare const ExaSchema: {
|
|
2
|
+
readonly version: "1.2.0";
|
|
3
|
+
readonly entities: {
|
|
4
|
+
readonly searchResults: import("zod").ZodObject<{
|
|
5
|
+
id: import("zod").ZodString;
|
|
6
|
+
url: import("zod").ZodString;
|
|
7
|
+
title: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
8
|
+
publishedDate: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
9
|
+
author: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
10
|
+
score: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
11
|
+
text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
12
|
+
highlights: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
13
|
+
highlightScores: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodNumber, "many">>;
|
|
14
|
+
summary: import("zod").ZodOptional<import("zod").ZodString>;
|
|
15
|
+
query: import("zod").ZodOptional<import("zod").ZodString>;
|
|
16
|
+
createdAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodDate>>;
|
|
17
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
18
|
+
id: string;
|
|
19
|
+
url: string;
|
|
20
|
+
query?: string | undefined;
|
|
21
|
+
text?: string | undefined;
|
|
22
|
+
highlights?: string[] | undefined;
|
|
23
|
+
summary?: string | undefined;
|
|
24
|
+
title?: string | null | undefined;
|
|
25
|
+
publishedDate?: string | null | undefined;
|
|
26
|
+
author?: string | null | undefined;
|
|
27
|
+
score?: number | undefined;
|
|
28
|
+
highlightScores?: number[] | undefined;
|
|
29
|
+
createdAt?: Date | null | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
id: string;
|
|
32
|
+
url: string;
|
|
33
|
+
query?: string | undefined;
|
|
34
|
+
text?: string | undefined;
|
|
35
|
+
highlights?: string[] | undefined;
|
|
36
|
+
summary?: string | undefined;
|
|
37
|
+
title?: string | null | undefined;
|
|
38
|
+
publishedDate?: string | null | undefined;
|
|
39
|
+
author?: string | null | undefined;
|
|
40
|
+
score?: number | undefined;
|
|
41
|
+
highlightScores?: number[] | undefined;
|
|
42
|
+
createdAt?: Date | null | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
readonly websets: import("zod").ZodObject<{
|
|
45
|
+
id: import("zod").ZodString;
|
|
46
|
+
status: import("zod").ZodOptional<import("zod").ZodEnum<["idle", "running", "paused", "done"]>>;
|
|
47
|
+
externalId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
48
|
+
createdAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodDate>>;
|
|
49
|
+
updatedAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodDate>>;
|
|
50
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
51
|
+
id: string;
|
|
52
|
+
status?: "idle" | "running" | "paused" | "done" | undefined;
|
|
53
|
+
createdAt?: Date | null | undefined;
|
|
54
|
+
updatedAt?: Date | null | undefined;
|
|
55
|
+
externalId?: string | undefined;
|
|
56
|
+
}, {
|
|
57
|
+
id: string;
|
|
58
|
+
status?: "idle" | "running" | "paused" | "done" | undefined;
|
|
59
|
+
createdAt?: Date | null | undefined;
|
|
60
|
+
updatedAt?: Date | null | undefined;
|
|
61
|
+
externalId?: string | undefined;
|
|
62
|
+
}>;
|
|
63
|
+
readonly imports: import("zod").ZodObject<{
|
|
64
|
+
id: import("zod").ZodString;
|
|
65
|
+
websetId: import("zod").ZodString;
|
|
66
|
+
urls: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
67
|
+
status: import("zod").ZodOptional<import("zod").ZodEnum<["pending", "processing", "completed", "failed"]>>;
|
|
68
|
+
createdAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodDate>>;
|
|
69
|
+
updatedAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodDate>>;
|
|
70
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
71
|
+
id: string;
|
|
72
|
+
websetId: string;
|
|
73
|
+
status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
74
|
+
createdAt?: Date | null | undefined;
|
|
75
|
+
updatedAt?: Date | null | undefined;
|
|
76
|
+
urls?: string[] | undefined;
|
|
77
|
+
}, {
|
|
78
|
+
id: string;
|
|
79
|
+
websetId: string;
|
|
80
|
+
status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
81
|
+
createdAt?: Date | null | undefined;
|
|
82
|
+
updatedAt?: Date | null | undefined;
|
|
83
|
+
urls?: string[] | undefined;
|
|
84
|
+
}>;
|
|
85
|
+
readonly monitors: import("zod").ZodObject<{
|
|
86
|
+
id: import("zod").ZodString;
|
|
87
|
+
websetId: import("zod").ZodString;
|
|
88
|
+
cadenceType: import("zod").ZodOptional<import("zod").ZodEnum<["realtime", "hourly", "daily", "weekly"]>>;
|
|
89
|
+
createdAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodDate>>;
|
|
90
|
+
updatedAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodDate>>;
|
|
91
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
92
|
+
id: string;
|
|
93
|
+
websetId: string;
|
|
94
|
+
createdAt?: Date | null | undefined;
|
|
95
|
+
updatedAt?: Date | null | undefined;
|
|
96
|
+
cadenceType?: "realtime" | "hourly" | "daily" | "weekly" | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
id: string;
|
|
99
|
+
websetId: string;
|
|
100
|
+
createdAt?: Date | null | undefined;
|
|
101
|
+
updatedAt?: Date | null | undefined;
|
|
102
|
+
cadenceType?: "realtime" | "hourly" | "daily" | "weekly" | undefined;
|
|
103
|
+
}>;
|
|
104
|
+
readonly events: import("zod").ZodObject<{
|
|
105
|
+
id: import("zod").ZodString;
|
|
106
|
+
type: import("zod").ZodString;
|
|
107
|
+
websetId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
108
|
+
createdAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodDate>>;
|
|
109
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
110
|
+
id: string;
|
|
111
|
+
type: string;
|
|
112
|
+
createdAt?: Date | null | undefined;
|
|
113
|
+
websetId?: string | undefined;
|
|
114
|
+
}, {
|
|
115
|
+
id: string;
|
|
116
|
+
type: string;
|
|
117
|
+
createdAt?: Date | null | undefined;
|
|
118
|
+
websetId?: string | undefined;
|
|
119
|
+
}>;
|
|
120
|
+
readonly webhookConfigs: import("zod").ZodObject<{
|
|
121
|
+
id: import("zod").ZodString;
|
|
122
|
+
url: import("zod").ZodString;
|
|
123
|
+
events: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
124
|
+
status: import("zod").ZodOptional<import("zod").ZodEnum<["active", "inactive"]>>;
|
|
125
|
+
createdAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodDate>>;
|
|
126
|
+
updatedAt: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodDate>>;
|
|
127
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
128
|
+
id: string;
|
|
129
|
+
url: string;
|
|
130
|
+
status?: "active" | "inactive" | undefined;
|
|
131
|
+
createdAt?: Date | null | undefined;
|
|
132
|
+
updatedAt?: Date | null | undefined;
|
|
133
|
+
events?: string[] | undefined;
|
|
134
|
+
}, {
|
|
135
|
+
id: string;
|
|
136
|
+
url: string;
|
|
137
|
+
status?: "active" | "inactive" | undefined;
|
|
138
|
+
createdAt?: Date | null | undefined;
|
|
139
|
+
updatedAt?: Date | null | undefined;
|
|
140
|
+
events?: string[] | undefined;
|
|
141
|
+
}>;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../schema/index.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUZ,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const _default: import("tsup").Options | import("tsup").Options[] | ((overrideOptions: import("tsup").Options) => import("tsup").Options | import("tsup").Options[] | Promise<import("tsup").Options | import("tsup").Options[]>);
|
|
2
|
+
export default _default;
|
|
3
|
+
//# sourceMappingURL=tsup.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsup.config.d.ts","sourceRoot":"","sources":["../tsup.config.ts"],"names":[],"mappings":";AAEA,wBAYG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-indexed.d.ts","sourceRoot":"","sources":["../../webhooks/content-indexed.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAGtC,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,gBAAgB,CAqDxD,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
export declare const SearchWebhooks: {
|
|
2
|
+
searchAlert: {
|
|
3
|
+
match: import("corsair/core").CorsairWebhookMatcher;
|
|
4
|
+
handler: import("corsair/core").CorsairWebhookHandler<import("..").ExaContext, {
|
|
5
|
+
id: string;
|
|
6
|
+
created_at: string;
|
|
7
|
+
type: "search.alert";
|
|
8
|
+
data: {
|
|
9
|
+
query: string;
|
|
10
|
+
results: {
|
|
11
|
+
id: string;
|
|
12
|
+
url: string;
|
|
13
|
+
text?: string | undefined;
|
|
14
|
+
highlights?: string[] | undefined;
|
|
15
|
+
summary?: string | undefined;
|
|
16
|
+
title?: string | null | undefined;
|
|
17
|
+
publishedDate?: string | null | undefined;
|
|
18
|
+
author?: string | null | undefined;
|
|
19
|
+
score?: number | undefined;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
id: string;
|
|
24
|
+
created_at: string;
|
|
25
|
+
type: "search.alert";
|
|
26
|
+
data: {
|
|
27
|
+
query: string;
|
|
28
|
+
results: {
|
|
29
|
+
id: string;
|
|
30
|
+
url: string;
|
|
31
|
+
text?: string | undefined;
|
|
32
|
+
highlights?: string[] | undefined;
|
|
33
|
+
summary?: string | undefined;
|
|
34
|
+
title?: string | null | undefined;
|
|
35
|
+
publishedDate?: string | null | undefined;
|
|
36
|
+
author?: string | null | undefined;
|
|
37
|
+
score?: number | undefined;
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export declare const ContentWebhooks: {
|
|
44
|
+
contentIndexed: {
|
|
45
|
+
match: import("corsair/core").CorsairWebhookMatcher;
|
|
46
|
+
handler: import("corsair/core").CorsairWebhookHandler<import("..").ExaContext, {
|
|
47
|
+
id: string;
|
|
48
|
+
created_at: string;
|
|
49
|
+
type: "content.indexed";
|
|
50
|
+
data: {
|
|
51
|
+
url: string;
|
|
52
|
+
title?: string | null | undefined;
|
|
53
|
+
publishedDate?: string | null | undefined;
|
|
54
|
+
author?: string | null | undefined;
|
|
55
|
+
};
|
|
56
|
+
}, {
|
|
57
|
+
id: string;
|
|
58
|
+
created_at: string;
|
|
59
|
+
type: "content.indexed";
|
|
60
|
+
data: {
|
|
61
|
+
url: string;
|
|
62
|
+
title?: string | null | undefined;
|
|
63
|
+
publishedDate?: string | null | undefined;
|
|
64
|
+
author?: string | null | undefined;
|
|
65
|
+
};
|
|
66
|
+
}>;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export declare const WebsetWebhooks: {
|
|
70
|
+
websetItemsFound: {
|
|
71
|
+
match: import("corsair/core").CorsairWebhookMatcher;
|
|
72
|
+
handler: import("corsair/core").CorsairWebhookHandler<import("..").ExaContext, {
|
|
73
|
+
id: string;
|
|
74
|
+
created_at: string;
|
|
75
|
+
type: "webset.items_found";
|
|
76
|
+
data: {
|
|
77
|
+
webset: {
|
|
78
|
+
object: "webset";
|
|
79
|
+
id: string;
|
|
80
|
+
status: "idle" | "running" | "paused" | "done";
|
|
81
|
+
createdAt: string;
|
|
82
|
+
updatedAt: string;
|
|
83
|
+
externalId?: string | undefined;
|
|
84
|
+
};
|
|
85
|
+
items: {
|
|
86
|
+
id: string;
|
|
87
|
+
url: string;
|
|
88
|
+
text?: string | undefined;
|
|
89
|
+
highlights?: string[] | undefined;
|
|
90
|
+
summary?: string | undefined;
|
|
91
|
+
title?: string | null | undefined;
|
|
92
|
+
publishedDate?: string | null | undefined;
|
|
93
|
+
author?: string | null | undefined;
|
|
94
|
+
score?: number | undefined;
|
|
95
|
+
}[];
|
|
96
|
+
itemCount?: number | undefined;
|
|
97
|
+
};
|
|
98
|
+
}, {
|
|
99
|
+
id: string;
|
|
100
|
+
created_at: string;
|
|
101
|
+
type: "webset.items_found";
|
|
102
|
+
data: {
|
|
103
|
+
webset: {
|
|
104
|
+
object: "webset";
|
|
105
|
+
id: string;
|
|
106
|
+
status: "idle" | "running" | "paused" | "done";
|
|
107
|
+
createdAt: string;
|
|
108
|
+
updatedAt: string;
|
|
109
|
+
externalId?: string | undefined;
|
|
110
|
+
};
|
|
111
|
+
items: {
|
|
112
|
+
id: string;
|
|
113
|
+
url: string;
|
|
114
|
+
text?: string | undefined;
|
|
115
|
+
highlights?: string[] | undefined;
|
|
116
|
+
summary?: string | undefined;
|
|
117
|
+
title?: string | null | undefined;
|
|
118
|
+
publishedDate?: string | null | undefined;
|
|
119
|
+
author?: string | null | undefined;
|
|
120
|
+
score?: number | undefined;
|
|
121
|
+
}[];
|
|
122
|
+
itemCount?: number | undefined;
|
|
123
|
+
};
|
|
124
|
+
}>;
|
|
125
|
+
};
|
|
126
|
+
websetSearchCompleted: {
|
|
127
|
+
match: import("corsair/core").CorsairWebhookMatcher;
|
|
128
|
+
handler: import("corsair/core").CorsairWebhookHandler<import("..").ExaContext, {
|
|
129
|
+
id: string;
|
|
130
|
+
created_at: string;
|
|
131
|
+
type: "webset.search.completed";
|
|
132
|
+
data: {
|
|
133
|
+
webset: {
|
|
134
|
+
object: "webset";
|
|
135
|
+
id: string;
|
|
136
|
+
status: "idle" | "running" | "paused" | "done";
|
|
137
|
+
createdAt: string;
|
|
138
|
+
updatedAt: string;
|
|
139
|
+
externalId?: string | undefined;
|
|
140
|
+
};
|
|
141
|
+
totalItems?: number | undefined;
|
|
142
|
+
};
|
|
143
|
+
}, {
|
|
144
|
+
id: string;
|
|
145
|
+
created_at: string;
|
|
146
|
+
type: "webset.search.completed";
|
|
147
|
+
data: {
|
|
148
|
+
webset: {
|
|
149
|
+
object: "webset";
|
|
150
|
+
id: string;
|
|
151
|
+
status: "idle" | "running" | "paused" | "done";
|
|
152
|
+
createdAt: string;
|
|
153
|
+
updatedAt: string;
|
|
154
|
+
externalId?: string | undefined;
|
|
155
|
+
};
|
|
156
|
+
totalItems?: number | undefined;
|
|
157
|
+
};
|
|
158
|
+
}>;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
export * from './types';
|
|
162
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../webhooks/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAE1B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;CAE3B,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG1B,CAAC;AAEF,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-alert.d.ts","sourceRoot":"","sources":["../../webhooks/search-alert.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAGtC,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,aAAa,CAmDlD,CAAC"}
|