@stackone/connect-sdk 1.22.0 → 1.23.1

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/dist/index.es.mjs CHANGED
@@ -1 +1 @@
1
- import{StepFunctionsFactory as e,StepFunctionName as t,AUTHENTICATION_SCHEMA as o,expandCursor as r}from"@stackone/core";import{safeEvaluate as n,safeEvaluateRecord as s}from"@stackone/expressions";import{isObject as i,notMissing as a,isString as c,isMissing as p}from"@stackone/utils";import{HttpClientManager as u,isSuccessStatusCode as d}from"@stackone/transport";import{match as l}from"path-to-regexp";import{parse as y}from"yaml";import{z as g}from"zod";const m=async({block:o,stepFunctionName:r,params:n,buildStepFunction:s=e.build})=>{const i=s({functionName:r}).fn,a=await i({block:o,params:n}),c=r===t.MAP_FIELDS?{[t.MAP_FIELDS.toString()]:{output:{data:a.block.result},errors:a.errors,successful:a.successful}}:{};return{...a.block,steps:{...a?.block?.steps??{},...c}}},b=async({block:t,buildStepFunction:o=e.build})=>await h({block:t,buildStepFunction:o}),h=async({block:t,buildStepFunction:o=e.build})=>{const r=t.operation?.steps||[];let s={...t};const i=Object.keys(r);let a=!1,c=null;for(const e of i){const t=r[e],i=t.stepFunction,p=o({functionName:i.functionName,version:i.version,validateSchemas:!0}).fn;if(t.condition&&!n(t.condition,s)){s=_({block:s,stepId:e,successful:!0,skipped:!0,message:"Step skipped due to condition not met."});continue}if(a){s=_({block:s,stepId:e,successful:!1,skipped:!0,message:"Step skipped due to previous error."});continue}const u=await p({block:s,params:i.params});if(!1===u.successful){s=_({block:s,stepId:e,successful:!1,functionOutput:u});(t.ignoreError??!1)||(a=!0,c??=u.output?.statusCode??500)}else s=_({block:u.block,stepId:e,functionOutput:u})}const p=t.operation?.result?f(t.operation.result,s):void 0,u=!a,d=u?t.operation?.responses.success.statusCode??200:c??500;return{...s,outputs:p,response:{successful:u,statusCode:d,message:u?void 0:t.operation?.responses?.errors?.[d]?.description??"Error while processing the request"}}},f=(e,t)=>i(e)?s(e,t):n(e,t),_=({block:e,stepId:t,successful:o,functionOutput:r,skipped:n,message:s})=>({...e,steps:{...e.steps,[t]:{successful:o??r?.successful??!1,errors:r?.errors,output:r?.output,skipped:n,message:s}}}),k=async({inputs:e,context:t,operation:o,credentials:r,nextCursor:n,logger:s,getHttpClient:i=async()=>u.getInstance()})=>({inputs:e,fieldConfigs:[],context:t,operation:o,credentials:r,nextCursor:n,httpClient:await i(),logger:s}),C=({category:e,connectorKey:t,connectorVersion:o,authConfigKey:r,environment:n="production",operation:s,accountSecureId:i,projectSecureId:a})=>({projectSecureId:a,accountSecureId:i,connectorKey:t,connectorVersion:o,category:e,service:"",resource:"",schema:s?.schema?.key,operationType:s?.operationType??"unknown",authenticationType:r,environment:n}),v=(e,t,o)=>{const r=o.toUpperCase();if(!e.operations)return;const n=Object.keys(e.operations),s=I(t,r,n);return s?{operation:e.operations?.[s.path],params:s.params}:void 0},w=e=>{const t=e.startsWith("/")?e.slice(1):e;return t.endsWith("/")?t.slice(0,-1):t},I=(e,t,o)=>{const r=w(e);for(const e of o)if(e.startsWith(t)){const o=e.replace(`${t} `,"").trim(),n=l(w(o))(w(r));if(!1!==n)return{path:e,params:n.params}}},S=e=>{switch(e){case"list":return{statusCode:200,description:"The list of records was retrieved."};case"get":return{statusCode:200,description:"The record with the given identifier was retrieved."};case"create":return{statusCode:201,description:"The record was created successfully."};case"update":return{statusCode:200,description:"The record was updated successfully."};case"delete":return{statusCode:204,description:"The record was deleted successfully."};case"custom":return{statusCode:200,description:"The operation was executed successfully."};case"unknown":return{statusCode:200};default:throw new Error(`Unknown operation type: ${e}`)}},E=g.object({key:g.string(),label:g.string(),type:g.string(),required:g.boolean().optional(),secret:g.boolean().optional(),placeholder:g.string().optional(),description:g.string().optional(),tooltip:g.string().optional()}),T=g.object({operationId:g.string(),categories:g.string().array(),operationType:g.enum(["list","get","create","update","delete","custom","unknown"]),schema:g.string().optional(),entrypointUrl:g.string().optional(),entrypointHttpMethod:g.string().optional(),description:g.string(),responses:g.object({statusCode:g.number(),description:g.string()}).array().optional(),inputs:g.object({name:g.string(),type:g.string(),required:g.boolean(),description:g.string(),in:g.string()}).array().optional(),cursor:g.object({enabled:g.boolean(),pageSize:g.number()}).optional(),fieldConfigs:g.object({targetFieldKey:g.string(),expression:g.string(),type:g.enum(["string","number","boolean","datetime_string","enum"]),isUnified:g.boolean(),enumMapper:g.object({matcher:g.enum(["country_alpha2code_by_alpha2code","country_alpha3code_by_alpha3code","country_code_by_country_code","country_name_by_country_name","country_name_by_alpha3code","country_name_by_alpha2code","country_name_by_country_code","country_alpha3code_by_alpha2code","country_alpha3code_by_country_name","country_alpha3code_by_country_code","country_alpha2code_by_alpha3code","country_alpha2code_by_country_name","country_alpha2code_by_country_code","country_code_by_alpha2code","country_code_by_alpha3code","country_code_by_country_name","country_subdivisions_by_alpha2code","country_subdivision_code_by_subdivision_name","country_alpha2code_by_citizenship","country_subdivision_name_by_subdivision_code"]).or(g.object({matchExpression:g.string(),value:g.string()}).array())}).optional()}).array().optional(),steps:g.object({stepId:g.string(),description:g.string(),stepFunction:g.object({functionName:g.string(),version:g.string().optional(),parameters:g.record(g.string(),g.unknown())}),condition:g.string().optional(),ignoreError:g.boolean().optional()}).array(),result:g.string().or(g.record(g.string(),g.unknown())).optional()}),F=g.object({StackOne:g.string(),info:g.object({title:g.string(),version:g.string(),key:g.string(),description:g.string().optional()}),baseUrl:g.string(),authentication:g.record(g.string(),g.object({type:g.string(),label:g.string(),authorization:o,environments:g.object({key:g.string(),name:g.string()}).array(),support:g.object({link:g.string(),description:g.string().optional()}),configFields:E.array().optional(),setupFields:E.array().optional(),testOperationsIds:g.string().array().optional()})).array().optional(),operations:T.array().optional()});function j(e){try{const t=y(e),o=F.parse(t),r={title:o.info.title,version:o.info.version,key:o.info.key,description:o.info.description},n=N(o),s={baseUrl:o.baseUrl,authentication:O(n)},i=R(o,s);return r.operations=i,r.authentication=n,a(i)&&(r.categories=x(Object.values(i))),r}catch(e){throw new Error(`Error parsing YAML file: ${e.message}`)}}const O=e=>{const t={};for(const[o,r]of Object.entries(e))if(r&&"object"==typeof r){const{setupFields:e,configFields:n,support:s,testOperationsIds:i,...a}=r;t[o]=O(a)}else t[o]=r;return t},x=e=>{const t=e.reduce(((e,t)=>{for(const o of t.categories)e.add(o);return e}),new Set);return Array.from(t)},N=e=>{const t={};for(const o of e.authentication??[]){const[e]=Object.keys(o),r=o[e].environments.reduce(((t,r)=>{const{key:n,name:s}=r,{environments:i,...a}=o[e];return t[n]={...a,envKey:n,envName:s},t}),{});t[e]=r}return t},R=(e,t)=>{const o=e.operations?.reduce(((e,o)=>{const r=(e=>e.entrypointUrl&&e.entrypointHttpMethod?`${e.entrypointHttpMethod.toUpperCase()} ${e.entrypointUrl}`:void 0)(o),n=(e=>"list"===e.operationType?`GET /${e.schema}`:`GET /${e.schema}/:id`)(o),s=(e=>"list"===e.operationType?`/${e.schema}`:`/${e.schema}/:id`)(o),i=(e=>{const t={success:S(e.operationType),errors:{400:{statusCode:400,description:"Invalid request."},401:{statusCode:401,description:"Unauthorized access."},403:{statusCode:403,description:"Forbidden."},404:{statusCode:404,description:"Resource not found."},500:{statusCode:500,description:"Server error while executing the request."}}},o=e.responses?.reduce(((e,t)=>(d(t.statusCode)?e.success={statusCode:t.statusCode,description:t.description}:e.errors[t.statusCode]={statusCode:t.statusCode,description:t.description},e)),t);return o??t})(o);return e[r??n]={id:o.operationId,categories:o.categories,description:o.description,operationType:o.operationType,entrypointUrl:o.entrypointUrl??s,entrypointHttpMethod:o.entrypointHttpMethod??"get",responses:i,cursor:M(o),inputs:o.inputs,steps:o.steps.reduce(((e,r)=>(e[r.stepId]={id:r.stepId,description:r.description,condition:r.condition,ignoreError:r.ignoreError,stepFunction:{functionName:r.stepFunction.functionName,version:r.stepFunction.version,params:{..."request"===r.stepFunction.functionName?t:{},..."map_fields"===r.stepFunction.functionName||"typecast"===r.stepFunction.functionName?{fields:o.fieldConfigs}:{},...r.stepFunction.parameters}}},e)),{}),result:o.result},e}),{});return o},U=(e,t)=>{if(!e.inputs)return{};const o=$(e.inputs).parse(t);return{...o.headers??{},...o.query??{},...o.path??{},...o.body??{}}},q=e=>{const t={};return e.forEach((e=>{let o;switch(e.type.toLowerCase()){case"string":o=g.string();break;case"number":o=g.number();break;case"boolean":o=g.boolean();break;default:o=g.any()}t[e.name]=e.required?o:o.optional()})),g.object(t)},$=e=>{const t=e.filter((e=>"path"===e.in)),o=e.filter((e=>"query"===e.in)),r=e.filter((e=>"body"===e.in)),n=e.filter((e=>"headers"===e.in));return g.object({path:q(t).optional(),query:q(o).optional(),body:q(r).optional(),headers:q(n).optional()})},M=e=>{const t="list"===e.operationType,o=e.cursor??{enabled:t,pageSize:25};return{enabled:o.enabled&&t,pageSize:o.pageSize}};class K extends Error{constructor(e,t,o){super(o),this.name="ConnectSDKError",this.errorType=e,this.context=t,Error.captureStackTrace&&Error.captureStackTrace(this,K)}toString(){return`${this.name} [${this.errorType}]: ${this.message}`}}class A extends K{constructor(e,t){super("CONNECTOR_PARSE_ERROR",e,t),this.name="ConnectorParseError"}}class z extends K{constructor(e,t){super("MISSING_OPERATION_ERROR",e,t),this.name="MissingOperationError"}}class P extends K{constructor(e,t){super("INVALID_OPERATION_INPUTS_ERROR",e,t),this.name="InvalidOperationInputsError"}}class H extends K{constructor(e,t){super("INVALID_CURSOR_ERROR",e,t),this.name="InvalidCursorError"}}const L=async({account:e,connector:t,category:o,path:r,method:n="get",queryParams:s,body:i,headers:a,logger:u,parseConnector:d=j,getOperationFromUrlFn:l=v,parseOperationInputsFn:y=U,createBlockContextFn:g=C,createBlockFn:m=k,runStepOperationFn:h=b})=>{const f=e.authConfigKey,_=e.environment??"production",w=e.secureId,I=e.projectSecureId,S=e.credentials,E=g({category:o,connectorKey:e.providerKey,connectorVersion:e.providerVersion,authConfigKey:f,environment:_,accountSecureId:w,projectSecureId:I});let T;try{T=c(t)?d(t):t}catch{throw new A(E,"Error while parsing connector")}const F=l(T,r,n);if(p(F))throw new z(E,"No matching operation found");E.operationType=F.operation.operationType,E.schema=F.operation.schema?.key;const O=V(s,E);let x;try{x=y(F.operation,{query:s,body:i,headers:a,path:F.params})}catch{throw new P(E,"Error while parsing operation inputs")}const N=await m({inputs:x,context:E,operation:F.operation,credentials:S,nextCursor:O,logger:u});return await h({block:N})},V=(e,t)=>{const o=e?.next,n=a(o)&&"list"===t.operationType?r(o):void 0;if(null===n)throw new H(t,"Invalid cursor.");return n};export{K as ConnectSDKError,k as createBlock,m as executeStepFunction,v as getOperationFromUrl,U as parseOperationInputs,j as parseYamlConnector,L as runConnectorOperation,b as runStepOperation};
1
+ import{StepFunctionsFactory as e,StepFunctionName as t,minifyCursor as o,AUTHENTICATION_SCHEMA as r,expandCursor as n}from"@stackone/core";import{safeEvaluate as s,safeEvaluateRecord as i}from"@stackone/expressions";import{isMissing as a,isObject as c,notMissing as p,isString as u}from"@stackone/utils";import{HttpClientManager as d,isSuccessStatusCode as l}from"@stackone/transport";import{match as y}from"path-to-regexp";import{parse as g}from"yaml";import{z as m}from"zod";const b=async({block:o,stepFunctionName:r,params:n,buildStepFunction:s=e.build})=>{const i=s({functionName:r}).fn,a=await i({block:o,params:n}),c=r===t.MAP_FIELDS?{[t.MAP_FIELDS.toString()]:{output:{data:a.block.result},errors:a.errors,successful:a.successful}}:{};return{...a.block,steps:{...a?.block?.steps??{},...c}}},h=(e,t,r,n)=>{const s=a(e)?void 0:e.data;if(!c(e)||a(s)||(s?.length??0)<=t)return{result:e,next:null};const i=Object.keys(r).length+1,p=n?.remote?.[i].pageNumber??1,u=(p-1)*t,d=u+t,l=s.slice(u,d),y=s.length>d,g=a(n)?{remote:{[i]:{pageNumber:p+1}},version:2,timestamp:Date.now()}:{...n,remote:{...n.remote,[i]:{pageNumber:p+1}}};return{result:{...e,data:l},next:y?o(g):null}},f=async({block:t,buildStepFunction:o=e.build,virtualPaginateResultFn:r=h})=>await _({block:t,buildStepFunction:o,virtualPaginateResultFn:r}),_=async({block:t,buildStepFunction:o=e.build,virtualPaginateResultFn:r=h})=>{const n=t.operation?.steps||{};let i={...t};const a=Object.keys(n);let u=!1,d=null;for(const e of a){const t=n[e],r=t.stepFunction,a=o({functionName:r.functionName,version:r.version,validateSchemas:!0}).fn;if(t.condition&&!s(t.condition,i)){i=v({block:i,stepId:e,successful:!0,skipped:!0,message:"Step skipped due to condition not met."});continue}if(u){i=v({block:i,stepId:e,successful:!1,skipped:!0,message:"Step skipped due to previous error."});continue}const c=await a({block:i,params:r.params});if(!1===c.successful){i=v({block:i,stepId:e,successful:!1,functionOutput:c});(t.ignoreError??!1)||(u=!0,d??=c.output?.statusCode??500)}else i=v({block:c.block,stepId:e,functionOutput:c})}const l=t.operation?.result?k(t.operation.result,i):void 0,y=t.operation?.cursor.enabled?r(l,t.operation.cursor.pageSize,n,i.nextCursor):void 0,g=!u,m=g?t.operation?.responses.success.statusCode??200:d??500,b=p(y)&&c(y.result)?{next:y.next,...y.result}:l;return{...i,outputs:b,response:{successful:g,statusCode:m,message:g?void 0:t.operation?.responses?.errors?.[m]?.description??"Error while processing the request"}}},k=(e,t)=>c(e)?i(e,t):s(e,t),v=({block:e,stepId:t,successful:o,functionOutput:r,skipped:n,message:s})=>({...e,steps:{...e.steps,[t]:{successful:o??r?.successful??!1,errors:r?.errors,output:r?.output,skipped:n,message:s}}}),C=async({inputs:e,context:t,operation:o,credentials:r,nextCursor:n,logger:s,getHttpClient:i=async()=>d.getInstance()})=>({inputs:e,fieldConfigs:[],context:t,operation:o,credentials:r,nextCursor:n,httpClient:await i(),logger:s}),w=({category:e,connectorKey:t,connectorVersion:o,authConfigKey:r,environment:n="production",operation:s,accountSecureId:i,projectSecureId:a})=>({projectSecureId:a,accountSecureId:i,connectorKey:t,connectorVersion:o,category:e,service:"",resource:"",schema:s?.schema?.key,operationType:s?.operationType??"unknown",authenticationType:r,environment:n}),I=(e,t,o)=>{const r=o.toUpperCase();if(!e.operations)return;const n=Object.keys(e.operations),s=E(t,r,n);return s?{operation:e.operations?.[s.path],params:s.params}:void 0},S=e=>{const t=e.startsWith("/")?e.slice(1):e;return t.endsWith("/")?t.slice(0,-1):t},E=(e,t,o)=>{const r=S(e);for(const e of o)if(e.startsWith(t)){const o=e.replace(`${t} `,"").trim(),n=y(S(o))(S(r));if(!1!==n)return{path:e,params:n.params}}},F=e=>{switch(e){case"list":return{statusCode:200,description:"The list of records was retrieved."};case"get":return{statusCode:200,description:"The record with the given identifier was retrieved."};case"create":return{statusCode:201,description:"The record was created successfully."};case"update":return{statusCode:200,description:"The record was updated successfully."};case"delete":return{statusCode:204,description:"The record was deleted successfully."};case"custom":return{statusCode:200,description:"The operation was executed successfully."};case"unknown":return{statusCode:200};default:throw new Error(`Unknown operation type: ${e}`)}},j={key:m.string(),label:m.string(),required:m.boolean().optional().default(!1),secret:m.boolean().optional().default(!1),readOnly:m.boolean().optional().default(!1),placeholder:m.string().optional(),description:m.string().optional(),tooltip:m.string().optional()},O=m.discriminatedUnion("type",[m.object({...j,type:m.enum(["text","password"])}),m.object({...j,type:m.literal("select"),options:m.object({value:m.string(),label:m.string()}).array()})]),T=m.object({operationId:m.string(),categories:m.string().array(),operationType:m.enum(["list","get","create","update","delete","custom","unknown"]),schema:m.string().optional(),entrypointUrl:m.string().optional(),entrypointHttpMethod:m.string().optional(),description:m.string(),responses:m.object({statusCode:m.number(),description:m.string()}).array().optional(),inputs:m.object({name:m.string(),type:m.string(),required:m.boolean(),description:m.string(),in:m.string()}).array().optional(),cursor:m.object({enabled:m.boolean(),pageSize:m.number()}).optional(),fieldConfigs:m.object({targetFieldKey:m.string(),expression:m.string(),type:m.enum(["string","number","boolean","datetime_string","enum"]),isUnified:m.boolean(),enumMapper:m.object({matcher:m.enum(["country_alpha2code_by_alpha2code","country_alpha3code_by_alpha3code","country_code_by_country_code","country_name_by_country_name","country_name_by_alpha3code","country_name_by_alpha2code","country_name_by_country_code","country_alpha3code_by_alpha2code","country_alpha3code_by_country_name","country_alpha3code_by_country_code","country_alpha2code_by_alpha3code","country_alpha2code_by_country_name","country_alpha2code_by_country_code","country_code_by_alpha2code","country_code_by_alpha3code","country_code_by_country_name","country_subdivisions_by_alpha2code","country_subdivision_code_by_subdivision_name","country_alpha2code_by_citizenship","country_subdivision_name_by_subdivision_code"]).or(m.object({matchExpression:m.string(),value:m.string()}).array())}).optional()}).array().optional(),steps:m.object({stepId:m.string(),description:m.string(),stepFunction:m.object({functionName:m.string(),version:m.string().optional(),parameters:m.record(m.string(),m.unknown())}),condition:m.string().optional(),ignoreError:m.boolean().optional()}).array(),result:m.string().or(m.record(m.string(),m.unknown())).optional()}),x=m.object({StackOne:m.string(),info:m.object({title:m.string(),version:m.string(),key:m.string(),description:m.string().optional()}),baseUrl:m.string(),authentication:m.record(m.string(),m.object({type:m.string(),label:m.string(),authorization:r,environments:m.object({key:m.string(),name:m.string()}).array(),support:m.object({link:m.string(),description:m.string().optional()}),configFields:O.array().optional(),setupFields:O.array().optional(),testOperationsIds:m.string().array().optional()})).array().optional(),operations:T.array().optional()});function N(e){try{const t=g(e),o=x.parse(t),r={title:o.info.title,version:o.info.version,key:o.info.key,description:o.info.description},n=q(o),s={baseUrl:o.baseUrl,authentication:R(n)},i=$(o,s);return r.operations=i,r.authentication=n,p(i)&&(r.categories=U(Object.values(i))),r}catch(e){throw new Error(`Error parsing YAML file: ${e.message}`)}}const R=e=>{const t={};for(const[o,r]of Object.entries(e))if(r&&"object"==typeof r){const{setupFields:e,configFields:n,support:s,testOperationsIds:i,...a}=r;t[o]=R(a)}else t[o]=r;return t},U=e=>{const t=e.reduce(((e,t)=>{for(const o of t.categories)e.add(o);return e}),new Set);return Array.from(t)},q=e=>{const t={};for(const o of e.authentication??[]){const[e]=Object.keys(o),r=o[e].environments.reduce(((t,r)=>{const{key:n,name:s}=r,{environments:i,...a}=o[e];return t[n]={...a,envKey:n,envName:s},t}),{});t[e]=r}return t},$=(e,t)=>{const o=e.operations?.reduce(((e,o)=>{const r=(e=>e.entrypointUrl&&e.entrypointHttpMethod?`${e.entrypointHttpMethod.toUpperCase()} ${e.entrypointUrl}`:void 0)(o),n=(e=>"list"===e.operationType?`GET /${e.schema}`:`GET /${e.schema}/:id`)(o),s=(e=>"list"===e.operationType?`/${e.schema}`:`/${e.schema}/:id`)(o),i=(e=>{const t={success:F(e.operationType),errors:{400:{statusCode:400,description:"Invalid request."},401:{statusCode:401,description:"Unauthorized access."},403:{statusCode:403,description:"Forbidden."},404:{statusCode:404,description:"Resource not found."},500:{statusCode:500,description:"Server error while executing the request."}}},o=e.responses?.reduce(((e,t)=>(l(t.statusCode)?e.success={statusCode:t.statusCode,description:t.description}:e.errors[t.statusCode]={statusCode:t.statusCode,description:t.description},e)),t);return o??t})(o);return e[r??n]={id:o.operationId,categories:o.categories,description:o.description,operationType:o.operationType,entrypointUrl:o.entrypointUrl??s,entrypointHttpMethod:o.entrypointHttpMethod??"get",responses:i,cursor:z(o),inputs:o.inputs,steps:o.steps.reduce(((e,r)=>(e[r.stepId]={id:r.stepId,description:r.description,condition:r.condition,ignoreError:r.ignoreError,stepFunction:{functionName:r.stepFunction.functionName,version:r.stepFunction.version,params:{..."request"===r.stepFunction.functionName?t:{},..."map_fields"===r.stepFunction.functionName||"typecast"===r.stepFunction.functionName?{fields:o.fieldConfigs}:{},...r.stepFunction.parameters}}},e)),{}),result:o.result},e}),{});return o},M=(e,t)=>{if(!e.inputs)return{};const o=K(e.inputs).parse(t);return{...o.headers??{},...o.query??{},...o.path??{},...o.body??{}}},P=e=>{const t={};return e.forEach((e=>{let o;switch(e.type.toLowerCase()){case"string":o=m.string();break;case"number":o=m.number();break;case"boolean":o=m.boolean();break;default:o=m.any()}t[e.name]=e.required?o:o.optional()})),m.object(t)},K=e=>{const t=e.filter((e=>"path"===e.in)),o=e.filter((e=>"query"===e.in)),r=e.filter((e=>"body"===e.in)),n=e.filter((e=>"headers"===e.in));return m.object({path:P(t).optional(),query:P(o).optional(),body:P(r).optional(),headers:P(n).optional()})},z=e=>{const t="list"===e.operationType,o=e.cursor??{enabled:t,pageSize:25};return{enabled:o.enabled&&t,pageSize:o.pageSize}};class A extends Error{constructor(e,t,o){super(o),this.name="ConnectSDKError",this.errorType=e,this.context=t,Error.captureStackTrace&&Error.captureStackTrace(this,A)}toString(){return`${this.name} [${this.errorType}]: ${this.message}`}}class D extends A{constructor(e,t){super("CONNECTOR_PARSE_ERROR",e,t),this.name="ConnectorParseError"}}class H extends A{constructor(e,t){super("MISSING_OPERATION_ERROR",e,t),this.name="MissingOperationError"}}class L extends A{constructor(e,t){super("INVALID_OPERATION_INPUTS_ERROR",e,t),this.name="InvalidOperationInputsError"}}class V extends A{constructor(e,t){super("INVALID_CURSOR_ERROR",e,t),this.name="InvalidCursorError"}}const G=async({account:e,connector:t,category:o,path:r,method:n="get",queryParams:s,body:i,headers:c,logger:p,parseConnector:d=N,getOperationFromUrlFn:l=I,parseOperationInputsFn:y=M,createBlockContextFn:g=w,createBlockFn:m=C,runStepOperationFn:b=f})=>{const h=e.authConfigKey,_=e.environment??"production",k=e.secureId,v=e.projectSecureId,S=e.credentials,E=g({category:o,connectorKey:e.providerKey,connectorVersion:e.providerVersion,authConfigKey:h,environment:_,accountSecureId:k,projectSecureId:v});let F;try{F=u(t)?d(t):t}catch{throw new D(E,"Error while parsing connector")}const j=l(F,r,n);if(a(j))throw new H(E,"No matching operation found");E.operationType=j.operation.operationType,E.schema=j.operation.schema?.key;const O=W(s,E);let T;try{T=y(j.operation,{query:s,body:i,headers:c,path:j.params})}catch{throw new L(E,"Error while parsing operation inputs")}const x=await m({inputs:T,context:E,operation:j.operation,credentials:S,nextCursor:O,logger:p});return await b({block:x})},W=(e,t)=>{const o=e?.next,r=p(o)&&"list"===t.operationType?n(o):void 0;if(null===r)throw new V(t,"Invalid cursor.");return r};export{A as ConnectSDKError,C as createBlock,b as executeStepFunction,I as getOperationFromUrl,M as parseOperationInputs,N as parseYamlConnector,G as runConnectorOperation,f as runStepOperation};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("@stackone/core"),t=require("@stackone/expressions"),o=require("@stackone/utils"),r=require("@stackone/transport"),n=require("path-to-regexp"),s=require("yaml"),i=require("zod");const a=async({block:t,buildStepFunction:o=e.StepFunctionsFactory.build})=>await c({block:t,buildStepFunction:o}),c=async({block:o,buildStepFunction:r=e.StepFunctionsFactory.build})=>{const n=o.operation?.steps||[];let s={...o};const i=Object.keys(n);let a=!1,c=null;for(const e of i){const o=n[e],i=o.stepFunction,p=r({functionName:i.functionName,version:i.version,validateSchemas:!0}).fn;if(o.condition&&!t.safeEvaluate(o.condition,s)){s=u({block:s,stepId:e,successful:!0,skipped:!0,message:"Step skipped due to condition not met."});continue}if(a){s=u({block:s,stepId:e,successful:!1,skipped:!0,message:"Step skipped due to previous error."});continue}const d=await p({block:s,params:i.params});if(!1===d.successful){s=u({block:s,stepId:e,successful:!1,functionOutput:d});(o.ignoreError??!1)||(a=!0,c??=d.output?.statusCode??500)}else s=u({block:d.block,stepId:e,functionOutput:d})}const d=o.operation?.result?p(o.operation.result,s):void 0,l=!a,y=l?o.operation?.responses.success.statusCode??200:c??500;return{...s,outputs:d,response:{successful:l,statusCode:y,message:l?void 0:o.operation?.responses?.errors?.[y]?.description??"Error while processing the request"}}},p=(e,r)=>o.isObject(e)?t.safeEvaluateRecord(e,r):t.safeEvaluate(e,r),u=({block:e,stepId:t,successful:o,functionOutput:r,skipped:n,message:s})=>({...e,steps:{...e.steps,[t]:{successful:o??r?.successful??!1,errors:r?.errors,output:r?.output,skipped:n,message:s}}}),d=async({inputs:e,context:t,operation:o,credentials:n,nextCursor:s,logger:i,getHttpClient:a=async()=>r.HttpClientManager.getInstance()})=>({inputs:e,fieldConfigs:[],context:t,operation:o,credentials:n,nextCursor:s,httpClient:await a(),logger:i}),l=({category:e,connectorKey:t,connectorVersion:o,authConfigKey:r,environment:n="production",operation:s,accountSecureId:i,projectSecureId:a})=>({projectSecureId:a,accountSecureId:i,connectorKey:t,connectorVersion:o,category:e,service:"",resource:"",schema:s?.schema?.key,operationType:s?.operationType??"unknown",authenticationType:r,environment:n}),y=(e,t,o)=>{const r=o.toUpperCase();if(!e.operations)return;const n=Object.keys(e.operations),s=b(t,r,n);return s?{operation:e.operations?.[s.path],params:s.params}:void 0},g=e=>{const t=e.startsWith("/")?e.slice(1):e;return t.endsWith("/")?t.slice(0,-1):t},b=(e,t,o)=>{const r=g(e);for(const e of o)if(e.startsWith(t)){const o=e.replace(`${t} `,"").trim(),s=n.match(g(o))(g(r));if(!1!==s)return{path:e,params:s.params}}},h=e=>{switch(e){case"list":return{statusCode:200,description:"The list of records was retrieved."};case"get":return{statusCode:200,description:"The record with the given identifier was retrieved."};case"create":return{statusCode:201,description:"The record was created successfully."};case"update":return{statusCode:200,description:"The record was updated successfully."};case"delete":return{statusCode:204,description:"The record was deleted successfully."};case"custom":return{statusCode:200,description:"The operation was executed successfully."};case"unknown":return{statusCode:200};default:throw new Error(`Unknown operation type: ${e}`)}},m=i.z.object({key:i.z.string(),label:i.z.string(),type:i.z.string(),required:i.z.boolean().optional(),secret:i.z.boolean().optional(),placeholder:i.z.string().optional(),description:i.z.string().optional(),tooltip:i.z.string().optional()}),z=i.z.object({operationId:i.z.string(),categories:i.z.string().array(),operationType:i.z.enum(["list","get","create","update","delete","custom","unknown"]),schema:i.z.string().optional(),entrypointUrl:i.z.string().optional(),entrypointHttpMethod:i.z.string().optional(),description:i.z.string(),responses:i.z.object({statusCode:i.z.number(),description:i.z.string()}).array().optional(),inputs:i.z.object({name:i.z.string(),type:i.z.string(),required:i.z.boolean(),description:i.z.string(),in:i.z.string()}).array().optional(),cursor:i.z.object({enabled:i.z.boolean(),pageSize:i.z.number()}).optional(),fieldConfigs:i.z.object({targetFieldKey:i.z.string(),expression:i.z.string(),type:i.z.enum(["string","number","boolean","datetime_string","enum"]),isUnified:i.z.boolean(),enumMapper:i.z.object({matcher:i.z.enum(["country_alpha2code_by_alpha2code","country_alpha3code_by_alpha3code","country_code_by_country_code","country_name_by_country_name","country_name_by_alpha3code","country_name_by_alpha2code","country_name_by_country_code","country_alpha3code_by_alpha2code","country_alpha3code_by_country_name","country_alpha3code_by_country_code","country_alpha2code_by_alpha3code","country_alpha2code_by_country_name","country_alpha2code_by_country_code","country_code_by_alpha2code","country_code_by_alpha3code","country_code_by_country_name","country_subdivisions_by_alpha2code","country_subdivision_code_by_subdivision_name","country_alpha2code_by_citizenship","country_subdivision_name_by_subdivision_code"]).or(i.z.object({matchExpression:i.z.string(),value:i.z.string()}).array())}).optional()}).array().optional(),steps:i.z.object({stepId:i.z.string(),description:i.z.string(),stepFunction:i.z.object({functionName:i.z.string(),version:i.z.string().optional(),parameters:i.z.record(i.z.string(),i.z.unknown())}),condition:i.z.string().optional(),ignoreError:i.z.boolean().optional()}).array(),result:i.z.string().or(i.z.record(i.z.string(),i.z.unknown())).optional()}),_=i.z.object({StackOne:i.z.string(),info:i.z.object({title:i.z.string(),version:i.z.string(),key:i.z.string(),description:i.z.string().optional()}),baseUrl:i.z.string(),authentication:i.z.record(i.z.string(),i.z.object({type:i.z.string(),label:i.z.string(),authorization:e.AUTHENTICATION_SCHEMA,environments:i.z.object({key:i.z.string(),name:i.z.string()}).array(),support:i.z.object({link:i.z.string(),description:i.z.string().optional()}),configFields:m.array().optional(),setupFields:m.array().optional(),testOperationsIds:i.z.string().array().optional()})).array().optional(),operations:z.array().optional()});function f(e){try{const t=s.parse(e),r=_.parse(t),n={title:r.info.title,version:r.info.version,key:r.info.key,description:r.info.description},i=v(r),a={baseUrl:r.baseUrl,authentication:k(i)},c=S(r,a);return n.operations=c,n.authentication=i,o.notMissing(c)&&(n.categories=C(Object.values(c))),n}catch(e){throw new Error(`Error parsing YAML file: ${e.message}`)}}const k=e=>{const t={};for(const[o,r]of Object.entries(e))if(r&&"object"==typeof r){const{setupFields:e,configFields:n,support:s,testOperationsIds:i,...a}=r;t[o]=k(a)}else t[o]=r;return t},C=e=>{const t=e.reduce(((e,t)=>{for(const o of t.categories)e.add(o);return e}),new Set);return Array.from(t)},v=e=>{const t={};for(const o of e.authentication??[]){const[e]=Object.keys(o),r=o[e].environments.reduce(((t,r)=>{const{key:n,name:s}=r,{environments:i,...a}=o[e];return t[n]={...a,envKey:n,envName:s},t}),{});t[e]=r}return t},S=(e,t)=>{const o=e.operations?.reduce(((e,o)=>{const n=(e=>e.entrypointUrl&&e.entrypointHttpMethod?`${e.entrypointHttpMethod.toUpperCase()} ${e.entrypointUrl}`:void 0)(o),s=(e=>"list"===e.operationType?`GET /${e.schema}`:`GET /${e.schema}/:id`)(o),i=(e=>"list"===e.operationType?`/${e.schema}`:`/${e.schema}/:id`)(o),a=(e=>{const t={success:h(e.operationType),errors:{400:{statusCode:400,description:"Invalid request."},401:{statusCode:401,description:"Unauthorized access."},403:{statusCode:403,description:"Forbidden."},404:{statusCode:404,description:"Resource not found."},500:{statusCode:500,description:"Server error while executing the request."}}},o=e.responses?.reduce(((e,t)=>(r.isSuccessStatusCode(t.statusCode)?e.success={statusCode:t.statusCode,description:t.description}:e.errors[t.statusCode]={statusCode:t.statusCode,description:t.description},e)),t);return o??t})(o);return e[n??s]={id:o.operationId,categories:o.categories,description:o.description,operationType:o.operationType,entrypointUrl:o.entrypointUrl??i,entrypointHttpMethod:o.entrypointHttpMethod??"get",responses:a,cursor:F(o),inputs:o.inputs,steps:o.steps.reduce(((e,r)=>(e[r.stepId]={id:r.stepId,description:r.description,condition:r.condition,ignoreError:r.ignoreError,stepFunction:{functionName:r.stepFunction.functionName,version:r.stepFunction.version,params:{..."request"===r.stepFunction.functionName?t:{},..."map_fields"===r.stepFunction.functionName||"typecast"===r.stepFunction.functionName?{fields:o.fieldConfigs}:{},...r.stepFunction.parameters}}},e)),{}),result:o.result},e}),{});return o},I=(e,t)=>{if(!e.inputs)return{};const o=E(e.inputs).parse(t);return{...o.headers??{},...o.query??{},...o.path??{},...o.body??{}}},w=e=>{const t={};return e.forEach((e=>{let o;switch(e.type.toLowerCase()){case"string":o=i.z.string();break;case"number":o=i.z.number();break;case"boolean":o=i.z.boolean();break;default:o=i.z.any()}t[e.name]=e.required?o:o.optional()})),i.z.object(t)},E=e=>{const t=e.filter((e=>"path"===e.in)),o=e.filter((e=>"query"===e.in)),r=e.filter((e=>"body"===e.in)),n=e.filter((e=>"headers"===e.in));return i.z.object({path:w(t).optional(),query:w(o).optional(),body:w(r).optional(),headers:w(n).optional()})},F=e=>{const t="list"===e.operationType,o=e.cursor??{enabled:t,pageSize:25};return{enabled:o.enabled&&t,pageSize:o.pageSize}};class O extends Error{constructor(e,t,o){super(o),this.name="ConnectSDKError",this.errorType=e,this.context=t,Error.captureStackTrace&&Error.captureStackTrace(this,O)}toString(){return`${this.name} [${this.errorType}]: ${this.message}`}}class T extends O{constructor(e,t){super("CONNECTOR_PARSE_ERROR",e,t),this.name="ConnectorParseError"}}class x extends O{constructor(e,t){super("MISSING_OPERATION_ERROR",e,t),this.name="MissingOperationError"}}class j extends O{constructor(e,t){super("INVALID_OPERATION_INPUTS_ERROR",e,t),this.name="InvalidOperationInputsError"}}class N extends O{constructor(e,t){super("INVALID_CURSOR_ERROR",e,t),this.name="InvalidCursorError"}}const R=(t,r)=>{const n=t?.next,s=o.notMissing(n)&&"list"===r.operationType?e.expandCursor(n):void 0;if(null===s)throw new N(r,"Invalid cursor.");return s};exports.ConnectSDKError=O,exports.createBlock=d,exports.executeStepFunction=async({block:t,stepFunctionName:o,params:r,buildStepFunction:n=e.StepFunctionsFactory.build})=>{const s=n({functionName:o}).fn,i=await s({block:t,params:r}),a=o===e.StepFunctionName.MAP_FIELDS?{[e.StepFunctionName.MAP_FIELDS.toString()]:{output:{data:i.block.result},errors:i.errors,successful:i.successful}}:{};return{...i.block,steps:{...i?.block?.steps??{},...a}}},exports.getOperationFromUrl=y,exports.parseOperationInputs=I,exports.parseYamlConnector=f,exports.runConnectorOperation=async({account:e,connector:t,category:r,path:n,method:s="get",queryParams:i,body:c,headers:p,logger:u,parseConnector:g=f,getOperationFromUrlFn:b=y,parseOperationInputsFn:h=I,createBlockContextFn:m=l,createBlockFn:z=d,runStepOperationFn:_=a})=>{const k=e.authConfigKey,C=e.environment??"production",v=e.secureId,S=e.projectSecureId,w=e.credentials,E=m({category:r,connectorKey:e.providerKey,connectorVersion:e.providerVersion,authConfigKey:k,environment:C,accountSecureId:v,projectSecureId:S});let F;try{F=o.isString(t)?g(t):t}catch{throw new T(E,"Error while parsing connector")}const O=b(F,n,s);if(o.isMissing(O))throw new x(E,"No matching operation found");E.operationType=O.operation.operationType,E.schema=O.operation.schema?.key;const N=R(i,E);let q;try{q=h(O.operation,{query:i,body:c,headers:p,path:O.params})}catch{throw new j(E,"Error while parsing operation inputs")}const U=await z({inputs:q,context:E,operation:O.operation,credentials:w,nextCursor:N,logger:u});return await _({block:U})},exports.runStepOperation=a;
1
+ "use strict";var e=require("@stackone/core"),t=require("@stackone/expressions"),o=require("@stackone/utils"),r=require("@stackone/transport"),n=require("path-to-regexp"),s=require("yaml"),i=require("zod");const a=(t,r,n,s)=>{const i=o.isMissing(t)?void 0:t.data;if(!o.isObject(t)||o.isMissing(i)||(i?.length??0)<=r)return{result:t,next:null};const a=Object.keys(n).length+1,c=s?.remote?.[a].pageNumber??1,p=(c-1)*r,u=p+r,d=i.slice(p,u),l=i.length>u,y=o.isMissing(s)?{remote:{[a]:{pageNumber:c+1}},version:2,timestamp:Date.now()}:{...s,remote:{...s.remote,[a]:{pageNumber:c+1}}};return{result:{...t,data:d},next:l?e.minifyCursor(y):null}},c=async({block:t,buildStepFunction:o=e.StepFunctionsFactory.build,virtualPaginateResultFn:r=a})=>await p({block:t,buildStepFunction:o,virtualPaginateResultFn:r}),p=async({block:r,buildStepFunction:n=e.StepFunctionsFactory.build,virtualPaginateResultFn:s=a})=>{const i=r.operation?.steps||{};let c={...r};const p=Object.keys(i);let l=!1,y=null;for(const e of p){const o=i[e],r=o.stepFunction,s=n({functionName:r.functionName,version:r.version,validateSchemas:!0}).fn;if(o.condition&&!t.safeEvaluate(o.condition,c)){c=d({block:c,stepId:e,successful:!0,skipped:!0,message:"Step skipped due to condition not met."});continue}if(l){c=d({block:c,stepId:e,successful:!1,skipped:!0,message:"Step skipped due to previous error."});continue}const a=await s({block:c,params:r.params});if(!1===a.successful){c=d({block:c,stepId:e,successful:!1,functionOutput:a});(o.ignoreError??!1)||(l=!0,y??=a.output?.statusCode??500)}else c=d({block:a.block,stepId:e,functionOutput:a})}const g=r.operation?.result?u(r.operation.result,c):void 0,b=r.operation?.cursor.enabled?s(g,r.operation.cursor.pageSize,i,c.nextCursor):void 0,m=!l,h=m?r.operation?.responses.success.statusCode??200:y??500,z=o.notMissing(b)&&o.isObject(b.result)?{next:b.next,...b.result}:g;return{...c,outputs:z,response:{successful:m,statusCode:h,message:m?void 0:r.operation?.responses?.errors?.[h]?.description??"Error while processing the request"}}},u=(e,r)=>o.isObject(e)?t.safeEvaluateRecord(e,r):t.safeEvaluate(e,r),d=({block:e,stepId:t,successful:o,functionOutput:r,skipped:n,message:s})=>({...e,steps:{...e.steps,[t]:{successful:o??r?.successful??!1,errors:r?.errors,output:r?.output,skipped:n,message:s}}}),l=async({inputs:e,context:t,operation:o,credentials:n,nextCursor:s,logger:i,getHttpClient:a=async()=>r.HttpClientManager.getInstance()})=>({inputs:e,fieldConfigs:[],context:t,operation:o,credentials:n,nextCursor:s,httpClient:await a(),logger:i}),y=({category:e,connectorKey:t,connectorVersion:o,authConfigKey:r,environment:n="production",operation:s,accountSecureId:i,projectSecureId:a})=>({projectSecureId:a,accountSecureId:i,connectorKey:t,connectorVersion:o,category:e,service:"",resource:"",schema:s?.schema?.key,operationType:s?.operationType??"unknown",authenticationType:r,environment:n}),g=(e,t,o)=>{const r=o.toUpperCase();if(!e.operations)return;const n=Object.keys(e.operations),s=m(t,r,n);return s?{operation:e.operations?.[s.path],params:s.params}:void 0},b=e=>{const t=e.startsWith("/")?e.slice(1):e;return t.endsWith("/")?t.slice(0,-1):t},m=(e,t,o)=>{const r=b(e);for(const e of o)if(e.startsWith(t)){const o=e.replace(`${t} `,"").trim(),s=n.match(b(o))(b(r));if(!1!==s)return{path:e,params:s.params}}},h=e=>{switch(e){case"list":return{statusCode:200,description:"The list of records was retrieved."};case"get":return{statusCode:200,description:"The record with the given identifier was retrieved."};case"create":return{statusCode:201,description:"The record was created successfully."};case"update":return{statusCode:200,description:"The record was updated successfully."};case"delete":return{statusCode:204,description:"The record was deleted successfully."};case"custom":return{statusCode:200,description:"The operation was executed successfully."};case"unknown":return{statusCode:200};default:throw new Error(`Unknown operation type: ${e}`)}},z={key:i.z.string(),label:i.z.string(),required:i.z.boolean().optional().default(!1),secret:i.z.boolean().optional().default(!1),readOnly:i.z.boolean().optional().default(!1),placeholder:i.z.string().optional(),description:i.z.string().optional(),tooltip:i.z.string().optional()},f=i.z.discriminatedUnion("type",[i.z.object({...z,type:i.z.enum(["text","password"])}),i.z.object({...z,type:i.z.literal("select"),options:i.z.object({value:i.z.string(),label:i.z.string()}).array()})]),_=i.z.object({operationId:i.z.string(),categories:i.z.string().array(),operationType:i.z.enum(["list","get","create","update","delete","custom","unknown"]),schema:i.z.string().optional(),entrypointUrl:i.z.string().optional(),entrypointHttpMethod:i.z.string().optional(),description:i.z.string(),responses:i.z.object({statusCode:i.z.number(),description:i.z.string()}).array().optional(),inputs:i.z.object({name:i.z.string(),type:i.z.string(),required:i.z.boolean(),description:i.z.string(),in:i.z.string()}).array().optional(),cursor:i.z.object({enabled:i.z.boolean(),pageSize:i.z.number()}).optional(),fieldConfigs:i.z.object({targetFieldKey:i.z.string(),expression:i.z.string(),type:i.z.enum(["string","number","boolean","datetime_string","enum"]),isUnified:i.z.boolean(),enumMapper:i.z.object({matcher:i.z.enum(["country_alpha2code_by_alpha2code","country_alpha3code_by_alpha3code","country_code_by_country_code","country_name_by_country_name","country_name_by_alpha3code","country_name_by_alpha2code","country_name_by_country_code","country_alpha3code_by_alpha2code","country_alpha3code_by_country_name","country_alpha3code_by_country_code","country_alpha2code_by_alpha3code","country_alpha2code_by_country_name","country_alpha2code_by_country_code","country_code_by_alpha2code","country_code_by_alpha3code","country_code_by_country_name","country_subdivisions_by_alpha2code","country_subdivision_code_by_subdivision_name","country_alpha2code_by_citizenship","country_subdivision_name_by_subdivision_code"]).or(i.z.object({matchExpression:i.z.string(),value:i.z.string()}).array())}).optional()}).array().optional(),steps:i.z.object({stepId:i.z.string(),description:i.z.string(),stepFunction:i.z.object({functionName:i.z.string(),version:i.z.string().optional(),parameters:i.z.record(i.z.string(),i.z.unknown())}),condition:i.z.string().optional(),ignoreError:i.z.boolean().optional()}).array(),result:i.z.string().or(i.z.record(i.z.string(),i.z.unknown())).optional()}),k=i.z.object({StackOne:i.z.string(),info:i.z.object({title:i.z.string(),version:i.z.string(),key:i.z.string(),description:i.z.string().optional()}),baseUrl:i.z.string(),authentication:i.z.record(i.z.string(),i.z.object({type:i.z.string(),label:i.z.string(),authorization:e.AUTHENTICATION_SCHEMA,environments:i.z.object({key:i.z.string(),name:i.z.string()}).array(),support:i.z.object({link:i.z.string(),description:i.z.string().optional()}),configFields:f.array().optional(),setupFields:f.array().optional(),testOperationsIds:i.z.string().array().optional()})).array().optional(),operations:_.array().optional()});function C(e){try{const t=s.parse(e),r=k.parse(t),n={title:r.info.title,version:r.info.version,key:r.info.key,description:r.info.description},i=w(r),a={baseUrl:r.baseUrl,authentication:v(i)},c=F(r,a);return n.operations=c,n.authentication=i,o.notMissing(c)&&(n.categories=S(Object.values(c))),n}catch(e){throw new Error(`Error parsing YAML file: ${e.message}`)}}const v=e=>{const t={};for(const[o,r]of Object.entries(e))if(r&&"object"==typeof r){const{setupFields:e,configFields:n,support:s,testOperationsIds:i,...a}=r;t[o]=v(a)}else t[o]=r;return t},S=e=>{const t=e.reduce(((e,t)=>{for(const o of t.categories)e.add(o);return e}),new Set);return Array.from(t)},w=e=>{const t={};for(const o of e.authentication??[]){const[e]=Object.keys(o),r=o[e].environments.reduce(((t,r)=>{const{key:n,name:s}=r,{environments:i,...a}=o[e];return t[n]={...a,envKey:n,envName:s},t}),{});t[e]=r}return t},F=(e,t)=>{const o=e.operations?.reduce(((e,o)=>{const n=(e=>e.entrypointUrl&&e.entrypointHttpMethod?`${e.entrypointHttpMethod.toUpperCase()} ${e.entrypointUrl}`:void 0)(o),s=(e=>"list"===e.operationType?`GET /${e.schema}`:`GET /${e.schema}/:id`)(o),i=(e=>"list"===e.operationType?`/${e.schema}`:`/${e.schema}/:id`)(o),a=(e=>{const t={success:h(e.operationType),errors:{400:{statusCode:400,description:"Invalid request."},401:{statusCode:401,description:"Unauthorized access."},403:{statusCode:403,description:"Forbidden."},404:{statusCode:404,description:"Resource not found."},500:{statusCode:500,description:"Server error while executing the request."}}},o=e.responses?.reduce(((e,t)=>(r.isSuccessStatusCode(t.statusCode)?e.success={statusCode:t.statusCode,description:t.description}:e.errors[t.statusCode]={statusCode:t.statusCode,description:t.description},e)),t);return o??t})(o);return e[n??s]={id:o.operationId,categories:o.categories,description:o.description,operationType:o.operationType,entrypointUrl:o.entrypointUrl??i,entrypointHttpMethod:o.entrypointHttpMethod??"get",responses:a,cursor:x(o),inputs:o.inputs,steps:o.steps.reduce(((e,r)=>(e[r.stepId]={id:r.stepId,description:r.description,condition:r.condition,ignoreError:r.ignoreError,stepFunction:{functionName:r.stepFunction.functionName,version:r.stepFunction.version,params:{..."request"===r.stepFunction.functionName?t:{},..."map_fields"===r.stepFunction.functionName||"typecast"===r.stepFunction.functionName?{fields:o.fieldConfigs}:{},...r.stepFunction.parameters}}},e)),{}),result:o.result},e}),{});return o},I=(e,t)=>{if(!e.inputs)return{};const o=O(e.inputs).parse(t);return{...o.headers??{},...o.query??{},...o.path??{},...o.body??{}}},E=e=>{const t={};return e.forEach((e=>{let o;switch(e.type.toLowerCase()){case"string":o=i.z.string();break;case"number":o=i.z.number();break;case"boolean":o=i.z.boolean();break;default:o=i.z.any()}t[e.name]=e.required?o:o.optional()})),i.z.object(t)},O=e=>{const t=e.filter((e=>"path"===e.in)),o=e.filter((e=>"query"===e.in)),r=e.filter((e=>"body"===e.in)),n=e.filter((e=>"headers"===e.in));return i.z.object({path:E(t).optional(),query:E(o).optional(),body:E(r).optional(),headers:E(n).optional()})},x=e=>{const t="list"===e.operationType,o=e.cursor??{enabled:t,pageSize:25};return{enabled:o.enabled&&t,pageSize:o.pageSize}};class j extends Error{constructor(e,t,o){super(o),this.name="ConnectSDKError",this.errorType=e,this.context=t,Error.captureStackTrace&&Error.captureStackTrace(this,j)}toString(){return`${this.name} [${this.errorType}]: ${this.message}`}}class T extends j{constructor(e,t){super("CONNECTOR_PARSE_ERROR",e,t),this.name="ConnectorParseError"}}class N extends j{constructor(e,t){super("MISSING_OPERATION_ERROR",e,t),this.name="MissingOperationError"}}class R extends j{constructor(e,t){super("INVALID_OPERATION_INPUTS_ERROR",e,t),this.name="InvalidOperationInputsError"}}class M extends j{constructor(e,t){super("INVALID_CURSOR_ERROR",e,t),this.name="InvalidCursorError"}}const q=(t,r)=>{const n=t?.next,s=o.notMissing(n)&&"list"===r.operationType?e.expandCursor(n):void 0;if(null===s)throw new M(r,"Invalid cursor.");return s};exports.ConnectSDKError=j,exports.createBlock=l,exports.executeStepFunction=async({block:t,stepFunctionName:o,params:r,buildStepFunction:n=e.StepFunctionsFactory.build})=>{const s=n({functionName:o}).fn,i=await s({block:t,params:r}),a=o===e.StepFunctionName.MAP_FIELDS?{[e.StepFunctionName.MAP_FIELDS.toString()]:{output:{data:i.block.result},errors:i.errors,successful:i.successful}}:{};return{...i.block,steps:{...i?.block?.steps??{},...a}}},exports.getOperationFromUrl=g,exports.parseOperationInputs=I,exports.parseYamlConnector=C,exports.runConnectorOperation=async({account:e,connector:t,category:r,path:n,method:s="get",queryParams:i,body:a,headers:p,logger:u,parseConnector:d=C,getOperationFromUrlFn:b=g,parseOperationInputsFn:m=I,createBlockContextFn:h=y,createBlockFn:z=l,runStepOperationFn:f=c})=>{const _=e.authConfigKey,k=e.environment??"production",v=e.secureId,S=e.projectSecureId,w=e.credentials,F=h({category:r,connectorKey:e.providerKey,connectorVersion:e.providerVersion,authConfigKey:_,environment:k,accountSecureId:v,projectSecureId:S});let E;try{E=o.isString(t)?d(t):t}catch{throw new T(F,"Error while parsing connector")}const O=b(E,n,s);if(o.isMissing(O))throw new N(F,"No matching operation found");F.operationType=O.operation.operationType,F.schema=O.operation.schema?.key;const x=q(i,F);let j;try{j=m(O.operation,{query:i,body:a,headers:p,path:O.params})}catch{throw new R(F,"Error while parsing operation inputs")}const M=await z({inputs:j,context:F,operation:O.operation,credentials:w,nextCursor:x,logger:u});return await f({block:M})},exports.runStepOperation=c;
@@ -255,18 +255,18 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
255
255
  label: z.ZodString;
256
256
  authorization: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
257
257
  type: z.ZodLiteral<"basic">;
258
- username: z.ZodString;
259
- password: z.ZodString;
258
+ username: z.ZodOptional<z.ZodString>;
259
+ password: z.ZodOptional<z.ZodString>;
260
260
  encoding: z.ZodOptional<z.ZodString>;
261
261
  }, "strip", z.ZodTypeAny, {
262
262
  type: "basic";
263
- username: string;
264
- password: string;
263
+ username?: string | undefined;
264
+ password?: string | undefined;
265
265
  encoding?: string | undefined;
266
266
  }, {
267
267
  type: "basic";
268
- username: string;
269
- password: string;
268
+ username?: string | undefined;
269
+ password?: string | undefined;
270
270
  encoding?: string | undefined;
271
271
  }>, z.ZodObject<{
272
272
  type: z.ZodLiteral<"bearer">;
@@ -298,70 +298,172 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
298
298
  link: string;
299
299
  description?: string | undefined;
300
300
  }>;
301
- configFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
301
+ configFields: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
302
+ type: z.ZodEnum<["text", "password"]>;
302
303
  key: z.ZodString;
303
304
  label: z.ZodString;
304
- type: z.ZodString;
305
- required: z.ZodOptional<z.ZodBoolean>;
306
- secret: z.ZodOptional<z.ZodBoolean>;
305
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
306
+ secret: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
307
+ readOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
307
308
  placeholder: z.ZodOptional<z.ZodString>;
308
309
  description: z.ZodOptional<z.ZodString>;
309
310
  tooltip: z.ZodOptional<z.ZodString>;
310
311
  }, "strip", z.ZodTypeAny, {
312
+ type: "text" | "password";
313
+ key: string;
314
+ label: string;
315
+ required: boolean;
316
+ secret: boolean;
317
+ readOnly: boolean;
318
+ placeholder?: string | undefined;
319
+ description?: string | undefined;
320
+ tooltip?: string | undefined;
321
+ }, {
322
+ type: "text" | "password";
311
323
  key: string;
312
324
  label: string;
313
- type: string;
314
325
  required?: boolean | undefined;
315
326
  secret?: boolean | undefined;
327
+ readOnly?: boolean | undefined;
328
+ placeholder?: string | undefined;
329
+ description?: string | undefined;
330
+ tooltip?: string | undefined;
331
+ }>, z.ZodObject<{
332
+ type: z.ZodLiteral<"select">;
333
+ options: z.ZodArray<z.ZodObject<{
334
+ value: z.ZodString;
335
+ label: z.ZodString;
336
+ }, "strip", z.ZodTypeAny, {
337
+ value: string;
338
+ label: string;
339
+ }, {
340
+ value: string;
341
+ label: string;
342
+ }>, "many">;
343
+ key: z.ZodString;
344
+ label: z.ZodString;
345
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
346
+ secret: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
347
+ readOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
348
+ placeholder: z.ZodOptional<z.ZodString>;
349
+ description: z.ZodOptional<z.ZodString>;
350
+ tooltip: z.ZodOptional<z.ZodString>;
351
+ }, "strip", z.ZodTypeAny, {
352
+ type: "select";
353
+ options: {
354
+ value: string;
355
+ label: string;
356
+ }[];
357
+ key: string;
358
+ label: string;
359
+ required: boolean;
360
+ secret: boolean;
361
+ readOnly: boolean;
316
362
  placeholder?: string | undefined;
317
363
  description?: string | undefined;
318
364
  tooltip?: string | undefined;
319
365
  }, {
366
+ type: "select";
367
+ options: {
368
+ value: string;
369
+ label: string;
370
+ }[];
320
371
  key: string;
321
372
  label: string;
322
- type: string;
323
373
  required?: boolean | undefined;
324
374
  secret?: boolean | undefined;
375
+ readOnly?: boolean | undefined;
325
376
  placeholder?: string | undefined;
326
377
  description?: string | undefined;
327
378
  tooltip?: string | undefined;
328
- }>, "many">>;
329
- setupFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
379
+ }>]>, "many">>;
380
+ setupFields: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
381
+ type: z.ZodEnum<["text", "password"]>;
330
382
  key: z.ZodString;
331
383
  label: z.ZodString;
332
- type: z.ZodString;
333
- required: z.ZodOptional<z.ZodBoolean>;
334
- secret: z.ZodOptional<z.ZodBoolean>;
384
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
385
+ secret: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
386
+ readOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
335
387
  placeholder: z.ZodOptional<z.ZodString>;
336
388
  description: z.ZodOptional<z.ZodString>;
337
389
  tooltip: z.ZodOptional<z.ZodString>;
338
390
  }, "strip", z.ZodTypeAny, {
391
+ type: "text" | "password";
392
+ key: string;
393
+ label: string;
394
+ required: boolean;
395
+ secret: boolean;
396
+ readOnly: boolean;
397
+ placeholder?: string | undefined;
398
+ description?: string | undefined;
399
+ tooltip?: string | undefined;
400
+ }, {
401
+ type: "text" | "password";
339
402
  key: string;
340
403
  label: string;
341
- type: string;
342
404
  required?: boolean | undefined;
343
405
  secret?: boolean | undefined;
406
+ readOnly?: boolean | undefined;
407
+ placeholder?: string | undefined;
408
+ description?: string | undefined;
409
+ tooltip?: string | undefined;
410
+ }>, z.ZodObject<{
411
+ type: z.ZodLiteral<"select">;
412
+ options: z.ZodArray<z.ZodObject<{
413
+ value: z.ZodString;
414
+ label: z.ZodString;
415
+ }, "strip", z.ZodTypeAny, {
416
+ value: string;
417
+ label: string;
418
+ }, {
419
+ value: string;
420
+ label: string;
421
+ }>, "many">;
422
+ key: z.ZodString;
423
+ label: z.ZodString;
424
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
425
+ secret: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
426
+ readOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
427
+ placeholder: z.ZodOptional<z.ZodString>;
428
+ description: z.ZodOptional<z.ZodString>;
429
+ tooltip: z.ZodOptional<z.ZodString>;
430
+ }, "strip", z.ZodTypeAny, {
431
+ type: "select";
432
+ options: {
433
+ value: string;
434
+ label: string;
435
+ }[];
436
+ key: string;
437
+ label: string;
438
+ required: boolean;
439
+ secret: boolean;
440
+ readOnly: boolean;
344
441
  placeholder?: string | undefined;
345
442
  description?: string | undefined;
346
443
  tooltip?: string | undefined;
347
444
  }, {
445
+ type: "select";
446
+ options: {
447
+ value: string;
448
+ label: string;
449
+ }[];
348
450
  key: string;
349
451
  label: string;
350
- type: string;
351
452
  required?: boolean | undefined;
352
453
  secret?: boolean | undefined;
454
+ readOnly?: boolean | undefined;
353
455
  placeholder?: string | undefined;
354
456
  description?: string | undefined;
355
457
  tooltip?: string | undefined;
356
- }>, "many">>;
458
+ }>]>, "many">>;
357
459
  testOperationsIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
358
460
  }, "strip", z.ZodTypeAny, {
359
- label: string;
360
461
  type: string;
462
+ label: string;
361
463
  authorization: {
362
464
  type: "basic";
363
- username: string;
364
- password: string;
465
+ username?: string | undefined;
466
+ password?: string | undefined;
365
467
  encoding?: string | undefined;
366
468
  } | {
367
469
  type: "bearer";
@@ -375,34 +477,64 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
375
477
  link: string;
376
478
  description?: string | undefined;
377
479
  };
378
- configFields?: {
480
+ configFields?: ({
481
+ type: "text" | "password";
379
482
  key: string;
380
483
  label: string;
381
- type: string;
382
- required?: boolean | undefined;
383
- secret?: boolean | undefined;
484
+ required: boolean;
485
+ secret: boolean;
486
+ readOnly: boolean;
384
487
  placeholder?: string | undefined;
385
488
  description?: string | undefined;
386
489
  tooltip?: string | undefined;
387
- }[] | undefined;
388
- setupFields?: {
490
+ } | {
491
+ type: "select";
492
+ options: {
493
+ value: string;
494
+ label: string;
495
+ }[];
389
496
  key: string;
390
497
  label: string;
391
- type: string;
392
- required?: boolean | undefined;
393
- secret?: boolean | undefined;
498
+ required: boolean;
499
+ secret: boolean;
500
+ readOnly: boolean;
394
501
  placeholder?: string | undefined;
395
502
  description?: string | undefined;
396
503
  tooltip?: string | undefined;
397
- }[] | undefined;
504
+ })[] | undefined;
505
+ setupFields?: ({
506
+ type: "text" | "password";
507
+ key: string;
508
+ label: string;
509
+ required: boolean;
510
+ secret: boolean;
511
+ readOnly: boolean;
512
+ placeholder?: string | undefined;
513
+ description?: string | undefined;
514
+ tooltip?: string | undefined;
515
+ } | {
516
+ type: "select";
517
+ options: {
518
+ value: string;
519
+ label: string;
520
+ }[];
521
+ key: string;
522
+ label: string;
523
+ required: boolean;
524
+ secret: boolean;
525
+ readOnly: boolean;
526
+ placeholder?: string | undefined;
527
+ description?: string | undefined;
528
+ tooltip?: string | undefined;
529
+ })[] | undefined;
398
530
  testOperationsIds?: string[] | undefined;
399
531
  }, {
400
- label: string;
401
532
  type: string;
533
+ label: string;
402
534
  authorization: {
403
535
  type: "basic";
404
- username: string;
405
- password: string;
536
+ username?: string | undefined;
537
+ password?: string | undefined;
406
538
  encoding?: string | undefined;
407
539
  } | {
408
540
  type: "bearer";
@@ -416,26 +548,56 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
416
548
  link: string;
417
549
  description?: string | undefined;
418
550
  };
419
- configFields?: {
551
+ configFields?: ({
552
+ type: "text" | "password";
420
553
  key: string;
421
554
  label: string;
422
- type: string;
423
555
  required?: boolean | undefined;
424
556
  secret?: boolean | undefined;
557
+ readOnly?: boolean | undefined;
425
558
  placeholder?: string | undefined;
426
559
  description?: string | undefined;
427
560
  tooltip?: string | undefined;
428
- }[] | undefined;
429
- setupFields?: {
561
+ } | {
562
+ type: "select";
563
+ options: {
564
+ value: string;
565
+ label: string;
566
+ }[];
430
567
  key: string;
431
568
  label: string;
432
- type: string;
433
569
  required?: boolean | undefined;
434
570
  secret?: boolean | undefined;
571
+ readOnly?: boolean | undefined;
435
572
  placeholder?: string | undefined;
436
573
  description?: string | undefined;
437
574
  tooltip?: string | undefined;
438
- }[] | undefined;
575
+ })[] | undefined;
576
+ setupFields?: ({
577
+ type: "text" | "password";
578
+ key: string;
579
+ label: string;
580
+ required?: boolean | undefined;
581
+ secret?: boolean | undefined;
582
+ readOnly?: boolean | undefined;
583
+ placeholder?: string | undefined;
584
+ description?: string | undefined;
585
+ tooltip?: string | undefined;
586
+ } | {
587
+ type: "select";
588
+ options: {
589
+ value: string;
590
+ label: string;
591
+ }[];
592
+ key: string;
593
+ label: string;
594
+ required?: boolean | undefined;
595
+ secret?: boolean | undefined;
596
+ readOnly?: boolean | undefined;
597
+ placeholder?: string | undefined;
598
+ description?: string | undefined;
599
+ tooltip?: string | undefined;
600
+ })[] | undefined;
439
601
  testOperationsIds?: string[] | undefined;
440
602
  }>>, "many">>;
441
603
  operations: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -680,12 +842,12 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
680
842
  };
681
843
  baseUrl: string;
682
844
  authentication?: Record<string, {
683
- label: string;
684
845
  type: string;
846
+ label: string;
685
847
  authorization: {
686
848
  type: "basic";
687
- username: string;
688
- password: string;
849
+ username?: string | undefined;
850
+ password?: string | undefined;
689
851
  encoding?: string | undefined;
690
852
  } | {
691
853
  type: "bearer";
@@ -699,26 +861,56 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
699
861
  link: string;
700
862
  description?: string | undefined;
701
863
  };
702
- configFields?: {
864
+ configFields?: ({
865
+ type: "text" | "password";
703
866
  key: string;
704
867
  label: string;
705
- type: string;
706
- required?: boolean | undefined;
707
- secret?: boolean | undefined;
868
+ required: boolean;
869
+ secret: boolean;
870
+ readOnly: boolean;
708
871
  placeholder?: string | undefined;
709
872
  description?: string | undefined;
710
873
  tooltip?: string | undefined;
711
- }[] | undefined;
712
- setupFields?: {
874
+ } | {
875
+ type: "select";
876
+ options: {
877
+ value: string;
878
+ label: string;
879
+ }[];
713
880
  key: string;
714
881
  label: string;
715
- type: string;
716
- required?: boolean | undefined;
717
- secret?: boolean | undefined;
882
+ required: boolean;
883
+ secret: boolean;
884
+ readOnly: boolean;
718
885
  placeholder?: string | undefined;
719
886
  description?: string | undefined;
720
887
  tooltip?: string | undefined;
721
- }[] | undefined;
888
+ })[] | undefined;
889
+ setupFields?: ({
890
+ type: "text" | "password";
891
+ key: string;
892
+ label: string;
893
+ required: boolean;
894
+ secret: boolean;
895
+ readOnly: boolean;
896
+ placeholder?: string | undefined;
897
+ description?: string | undefined;
898
+ tooltip?: string | undefined;
899
+ } | {
900
+ type: "select";
901
+ options: {
902
+ value: string;
903
+ label: string;
904
+ }[];
905
+ key: string;
906
+ label: string;
907
+ required: boolean;
908
+ secret: boolean;
909
+ readOnly: boolean;
910
+ placeholder?: string | undefined;
911
+ description?: string | undefined;
912
+ tooltip?: string | undefined;
913
+ })[] | undefined;
722
914
  testOperationsIds?: string[] | undefined;
723
915
  }>[] | undefined;
724
916
  operations?: {
@@ -779,12 +971,12 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
779
971
  };
780
972
  baseUrl: string;
781
973
  authentication?: Record<string, {
782
- label: string;
783
974
  type: string;
975
+ label: string;
784
976
  authorization: {
785
977
  type: "basic";
786
- username: string;
787
- password: string;
978
+ username?: string | undefined;
979
+ password?: string | undefined;
788
980
  encoding?: string | undefined;
789
981
  } | {
790
982
  type: "bearer";
@@ -798,26 +990,56 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
798
990
  link: string;
799
991
  description?: string | undefined;
800
992
  };
801
- configFields?: {
993
+ configFields?: ({
994
+ type: "text" | "password";
802
995
  key: string;
803
996
  label: string;
804
- type: string;
805
997
  required?: boolean | undefined;
806
998
  secret?: boolean | undefined;
999
+ readOnly?: boolean | undefined;
807
1000
  placeholder?: string | undefined;
808
1001
  description?: string | undefined;
809
1002
  tooltip?: string | undefined;
810
- }[] | undefined;
811
- setupFields?: {
1003
+ } | {
1004
+ type: "select";
1005
+ options: {
1006
+ value: string;
1007
+ label: string;
1008
+ }[];
812
1009
  key: string;
813
1010
  label: string;
814
- type: string;
815
1011
  required?: boolean | undefined;
816
1012
  secret?: boolean | undefined;
1013
+ readOnly?: boolean | undefined;
817
1014
  placeholder?: string | undefined;
818
1015
  description?: string | undefined;
819
1016
  tooltip?: string | undefined;
820
- }[] | undefined;
1017
+ })[] | undefined;
1018
+ setupFields?: ({
1019
+ type: "text" | "password";
1020
+ key: string;
1021
+ label: string;
1022
+ required?: boolean | undefined;
1023
+ secret?: boolean | undefined;
1024
+ readOnly?: boolean | undefined;
1025
+ placeholder?: string | undefined;
1026
+ description?: string | undefined;
1027
+ tooltip?: string | undefined;
1028
+ } | {
1029
+ type: "select";
1030
+ options: {
1031
+ value: string;
1032
+ label: string;
1033
+ }[];
1034
+ key: string;
1035
+ label: string;
1036
+ required?: boolean | undefined;
1037
+ secret?: boolean | undefined;
1038
+ readOnly?: boolean | undefined;
1039
+ placeholder?: string | undefined;
1040
+ description?: string | undefined;
1041
+ tooltip?: string | undefined;
1042
+ })[] | undefined;
821
1043
  testOperationsIds?: string[] | undefined;
822
1044
  }>[] | undefined;
823
1045
  operations?: {
@@ -0,0 +1,7 @@
1
+ import { Cursor, Step } from '@stackone/core';
2
+ export declare const virtualPaginateResult: (result: unknown, pageSize: number, steps: {
3
+ [stepId: string]: Step;
4
+ }, cursor?: Cursor | null) => {
5
+ result: unknown;
6
+ next: string | null;
7
+ };
@@ -1,5 +1,7 @@
1
1
  import { Block, StepFunctionsFactory } from '@stackone/core';
2
- export declare const runStepOperation: ({ block, buildStepFunction, }: {
2
+ import { virtualPaginateResult } from '../pagination/virtualPagination';
3
+ export declare const runStepOperation: ({ block, buildStepFunction, virtualPaginateResultFn, }: {
3
4
  block: Block;
4
5
  buildStepFunction?: typeof StepFunctionsFactory.build;
6
+ virtualPaginateResultFn?: typeof virtualPaginateResult;
5
7
  }) => Promise<Block>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackone/connect-sdk",
3
- "version": "1.22.0",
3
+ "version": "1.23.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.mjs",