@stackone/connect-sdk 1.16.0 → 1.18.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/dist/index.es.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{StepFunctionsFactory as t,StepFunctionName as e,AUTHENTICATION_SCHEMA as o}from"@stackone/core";import{safeEvaluate as n}from"@stackone/expressions";import{notMissing as r,isString as i,isMissing as s}from"@stackone/utils";import{HttpClientManager as a}from"@stackone/transport";import{match as c}from"path-to-regexp";import{parse as p}from"yaml";import{z as u}from"zod";const l=async({block:o,stepFunctionName:n,params:r,buildStepFunction:i=t.build})=>{const s=i({functionName:n}).fn,a=await s({block:o,params:r}),c=n===e.MAP_FIELDS?{[e.MAP_FIELDS.toString()]:{output:{data:a.block.result},errors:a.errors,successful:a.successful}}:{};return{...a.block,steps:{...a?.block?.steps??{},...c}}},
|
|
1
|
+
import{StepFunctionsFactory as t,StepFunctionName as e,AUTHENTICATION_SCHEMA as o}from"@stackone/core";import{safeEvaluate as n}from"@stackone/expressions";import{notMissing as r,isString as i,isMissing as s}from"@stackone/utils";import{HttpClientManager as a}from"@stackone/transport";import{match as c}from"path-to-regexp";import{parse as p}from"yaml";import{z as u}from"zod";const l=async({block:o,stepFunctionName:n,params:r,buildStepFunction:i=t.build})=>{const s=i({functionName:n}).fn,a=await s({block:o,params:r}),c=n===e.MAP_FIELDS?{[e.MAP_FIELDS.toString()]:{output:{data:a.block.result},errors:a.errors,successful:a.successful}}:{};return{...a.block,steps:{...a?.block?.steps??{},...c}}},d=async({block:e,buildStepFunction:o=t.build})=>{const r=e.operation?.steps||[];let i={...e};const s=Object.keys(r);let a=!1;for(const t of s){const e=r[t],s=e.stepFunction,c=o({functionName:s.functionName,version:s.version,validateSchemas:!0}).fn;if(e.condition&&!n(e.condition,i)){i=y({block:i,stepId:t,successful:!0,skipped:!0,message:"Step skipped due to condition not met."});continue}if(a){i=y({block:i,stepId:t,successful:!1,skipped:!0,message:"Step skipped due to previous error."});continue}const p=await c({block:i,params:s.params});if(!1===p.successful){i=y({block:i,stepId:t,successful:!1,functionOutput:p});(e.ignoreError??!1)||(a=!0)}else i=y({block:p.block,stepId:t,functionOutput:p})}const c=e.operation?.result?n(e.operation.result,i):void 0;return{...i,outputs:c}},y=({block:t,stepId:e,successful:o,functionOutput:n,skipped:r,message:i})=>({...t,steps:{...t.steps,[e]:{successful:o??n?.successful??!1,errors:n?.errors,output:n?.output,skipped:r,message:i}}}),m=async({inputs:t,context:e,operation:o,credentials:n,logger:r,getHttpClient:i=async()=>a.getInstance()})=>({inputs:t,fieldConfigs:[],context:e,operation:o,credentials:n,httpClient:await i(),logger:r}),g=({category:t,connectorKey:e,connectorVersion:o,authConfigKey:n,environment:r="production",operation:i,accountSecureId:s,projectSecureId:a})=>({projectSecureId:a,accountSecureId:s,connectorKey:e,connectorVersion:o,category:t,service:"",resource:"",schema:i?.schema?.key,operationType:i?.operationType??"unknown",authenticationType:n,environment:r}),b=(t,e,o)=>{const n=o.toUpperCase();if(!t.operations)return;const r=Object.keys(t.operations),i=_(e,n,r);return i?{operation:t.operations?.[i.path],params:i.params}:void 0},h=t=>{const e=t.startsWith("/")?t.slice(1):t;return e.endsWith("/")?e.slice(0,-1):e},_=(t,e,o)=>{const n=h(t);for(const t of o)if(t.startsWith(e)){const o=t.replace(`${e} `,"").trim(),r=c(h(o))(h(n));if(!1!==r)return{path:t,params:r.params}}},f=u.object({key:u.string(),label:u.string(),type:u.string(),required:u.boolean().optional(),secret:u.boolean().optional(),placeholder:u.string().optional(),description:u.string().optional(),tooltip:u.string().optional()}),k=u.object({operationId:u.string(),categories:u.string().array(),operationType:u.string(),schema:u.string().optional(),entrypointUrl:u.string().optional(),entrypointHttpMethod:u.string().optional(),description:u.string(),inputs:u.object({name:u.string(),type:u.string(),required:u.boolean(),description:u.string(),in:u.string()}).array().optional(),fieldConfigs:u.object({targetFieldKey:u.string(),expression:u.string(),type:u.enum(["string","number","boolean","datetime_string","enum"]),isUnified:u.boolean(),enumMapper:u.object({matcher:u.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(u.object({matchExpression:u.string(),value:u.string()}).array())}).optional()}).array().optional(),steps:u.object({stepId:u.string(),description:u.string(),stepFunction:u.object({functionName:u.string(),version:u.string().optional(),parameters:u.record(u.string(),u.unknown())}),condition:u.string().optional(),ignoreError:u.boolean().optional()}).array(),result:u.string()}),v=u.object({StackOne:u.string(),info:u.object({title:u.string(),version:u.string(),key:u.string(),description:u.string().optional()}),baseUrl:u.string(),authentication:u.record(u.string(),u.object({type:u.string(),label:u.string(),authorization:o,environments:u.object({key:u.string(),name:u.string()}).array(),support:u.object({link:u.string(),description:u.string().optional()}),configFields:f.array().optional(),setupFields:f.array().optional(),testOperationsIds:u.string().array().optional()})).array().optional(),operations:k.array().optional()});function I(t){try{const e=p(t),o=v.parse(e),n={title:o.info.title,version:o.info.version,key:o.info.key,description:o.info.description},i=j(o),s={baseUrl:o.baseUrl,authentication:E(i)},a=F(o,s);return n.operations=a,n.authentication=i,r(a)&&(n.categories=S(Object.values(a))),n}catch(t){throw new Error(`Error parsing YAML file: ${t.message}`)}}const E=t=>{const e={};for(const[o,n]of Object.entries(t))if(n&&"object"==typeof n){const{setupFields:t,configFields:r,support:i,testOperationsIds:s,...a}=n;e[o]=E(a)}else e[o]=n;return e},S=t=>{const e=t.reduce(((t,e)=>{for(const o of e.categories)t.add(o);return t}),new Set);return Array.from(e)},j=t=>{const e={};for(const o of t.authentication??[]){const[t]=Object.keys(o),n=o[t].environments.reduce(((e,n)=>{const{key:r,name:i}=n,{environments:s,...a}=o[t];return e[r]={...a,envKey:r,envName:i},e}),{});e[t]=n}return e},F=(t,e)=>{const o=t.operations?.reduce(((t,o)=>{const n=(t=>t.entrypointUrl&&t.entrypointHttpMethod?`${t.entrypointHttpMethod.toUpperCase()} ${t.entrypointUrl}`:void 0)(o),r=(t=>"list"===t.operationType?`GET /${t.schema}`:`GET /${t.schema}/:id`)(o),i=(t=>"list"===t.operationType?`/${t.schema}`:`/${t.schema}/:id`)(o);return t[n??r]={id:o.operationId,categories:o.categories,description:o.description,operationType:o.operationType,entrypointUrl:o.entrypointUrl??i,entrypointHttpMethod:o.entrypointHttpMethod??"get",inputs:o.inputs,steps:o.steps.reduce(((t,n)=>(t[n.stepId]={id:n.stepId,description:n.description,condition:n.condition,ignoreError:n.ignoreError,stepFunction:{functionName:n.stepFunction.functionName,version:n.stepFunction.version,params:{..."request"===n.stepFunction.functionName?e:{},..."map_fields"===n.stepFunction.functionName||"typecast"===n.stepFunction.functionName?{fields:o.fieldConfigs}:{},...n.stepFunction.parameters}}},t)),{}),result:o.result},t}),{});return o},O=(t,e)=>{if(!t.inputs)return{};const o=T(t.inputs).parse(e);return{...o.headers??{},...o.query??{},...o.path??{},...o.body??{}}},w=t=>{const e={};return t.forEach((t=>{let o;switch(t.type.toLowerCase()){case"string":o=u.string();break;case"number":o=u.number();break;case"boolean":o=u.boolean();break;default:o=u.any()}e[t.name]=t.required?o:o.optional()})),u.object(e)},T=t=>{const e=t.filter((t=>"path"===t.in)),o=t.filter((t=>"query"===t.in)),n=t.filter((t=>"body"===t.in)),r=t.filter((t=>"headers"===t.in));return u.object({path:w(e).optional(),query:w(o).optional(),body:w(n).optional(),headers:w(r).optional()})};class N extends Error{constructor(t,e,o){super(o),this.name="ConnectSDKError",this.errorType=t,this.context=e,Error.captureStackTrace&&Error.captureStackTrace(this,N)}toString(){return`${this.name} [${this.errorType}]: ${this.message}`}}class C extends N{constructor(t,e){super("CONNECTOR_PARSE_ERROR",t,e),this.name="ConnectorParseError"}}class x extends N{constructor(t,e){super("MISSING_OPERATION_ERROR",t,e),this.name="MissingOperationError"}}class R extends N{constructor(t,e){super("INVALID_OPERATION_INPUTS_ERROR",t,e),this.name="InvalidOperationInputsError"}}const U=async({account:t,connector:e,category:o,path:n,method:r="get",queryParams:a,body:c,headers:p,logger:u,parseConnector:l=I,getOperationFromUrlFn:y=b,parseOperationInputsFn:h=O,createBlockContextFn:_=g,createBlockFn:f=m,runStepOperationFn:k=d})=>{const v=t.authConfigKey,E=t.environment??"production",S=t.secureId,j=t.projectSecureId,F=t.credentials,w=_({category:o,connectorKey:t.providerKey,connectorVersion:t.providerVersion,authConfigKey:v,environment:E,accountSecureId:S,projectSecureId:j});let T;try{T=i(e)?l(e):e}catch{throw new C(w,"Error while parsing connector")}const N=y(T,n,r);if(s(N))throw new x(w,"No matching operation found");let U;w.operationType=N.operation.operationType,w.schema=N.operation.schema?.key;try{U=h(N.operation,{query:a,body:c,headers:p,path:N.params})}catch{throw new R(w,"Error while parsing operation inputs")}const M=await f({inputs:U,context:w,operation:N.operation,credentials:F,logger:u});return await k({block:M})};export{N as ConnectSDKError,m as createBlock,l as executeStepFunction,b as getOperationFromUrl,O as parseOperationInputs,I as parseYamlConnector,U as runConnectorOperation,d 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"),n=require("@stackone/transport"),r=require("path-to-regexp"),i=require("yaml"),s=require("zod");const a=async({block:o,buildStepFunction:n=e.StepFunctionsFactory.build})=>{const r=o.operation?.steps||[];let i={...o};const s=Object.keys(r);for(const e of s){const
|
|
1
|
+
"use strict";var e=require("@stackone/core"),t=require("@stackone/expressions"),o=require("@stackone/utils"),n=require("@stackone/transport"),r=require("path-to-regexp"),i=require("yaml"),s=require("zod");const a=async({block:o,buildStepFunction:n=e.StepFunctionsFactory.build})=>{const r=o.operation?.steps||[];let i={...o};const s=Object.keys(r);let a=!1;for(const e of s){const o=r[e],s=o.stepFunction,p=n({functionName:s.functionName,version:s.version,validateSchemas:!0}).fn;if(o.condition&&!t.safeEvaluate(o.condition,i)){i=c({block:i,stepId:e,successful:!0,skipped:!0,message:"Step skipped due to condition not met."});continue}if(a){i=c({block:i,stepId:e,successful:!1,skipped:!0,message:"Step skipped due to previous error."});continue}const u=await p({block:i,params:s.params});if(!1===u.successful){i=c({block:i,stepId:e,successful:!1,functionOutput:u});(o.ignoreError??!1)||(a=!0)}else i=c({block:u.block,stepId:e,functionOutput:u})}const p=o.operation?.result?t.safeEvaluate(o.operation.result,i):void 0;return{...i,outputs:p}},c=({block:e,stepId:t,successful:o,functionOutput:n,skipped:r,message:i})=>({...e,steps:{...e.steps,[t]:{successful:o??n?.successful??!1,errors:n?.errors,output:n?.output,skipped:r,message:i}}}),p=async({inputs:e,context:t,operation:o,credentials:r,logger:i,getHttpClient:s=async()=>n.HttpClientManager.getInstance()})=>({inputs:e,fieldConfigs:[],context:t,operation:o,credentials:r,httpClient:await s(),logger:i}),u=({category:e,connectorKey:t,connectorVersion:o,authConfigKey:n,environment:r="production",operation:i,accountSecureId:s,projectSecureId:a})=>({projectSecureId:a,accountSecureId:s,connectorKey:t,connectorVersion:o,category:e,service:"",resource:"",schema:i?.schema?.key,operationType:i?.operationType??"unknown",authenticationType:n,environment:r}),l=(e,t,o)=>{const n=o.toUpperCase();if(!e.operations)return;const r=Object.keys(e.operations),i=y(t,n,r);return i?{operation:e.operations?.[i.path],params:i.params}:void 0},d=e=>{const t=e.startsWith("/")?e.slice(1):e;return t.endsWith("/")?t.slice(0,-1):t},y=(e,t,o)=>{const n=d(e);for(const e of o)if(e.startsWith(t)){const o=e.replace(`${t} `,"").trim(),i=r.match(d(o))(d(n));if(!1!==i)return{path:e,params:i.params}}},g=s.z.object({key:s.z.string(),label:s.z.string(),type:s.z.string(),required:s.z.boolean().optional(),secret:s.z.boolean().optional(),placeholder:s.z.string().optional(),description:s.z.string().optional(),tooltip:s.z.string().optional()}),m=s.z.object({operationId:s.z.string(),categories:s.z.string().array(),operationType:s.z.string(),schema:s.z.string().optional(),entrypointUrl:s.z.string().optional(),entrypointHttpMethod:s.z.string().optional(),description:s.z.string(),inputs:s.z.object({name:s.z.string(),type:s.z.string(),required:s.z.boolean(),description:s.z.string(),in:s.z.string()}).array().optional(),fieldConfigs:s.z.object({targetFieldKey:s.z.string(),expression:s.z.string(),type:s.z.enum(["string","number","boolean","datetime_string","enum"]),isUnified:s.z.boolean(),enumMapper:s.z.object({matcher:s.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(s.z.object({matchExpression:s.z.string(),value:s.z.string()}).array())}).optional()}).array().optional(),steps:s.z.object({stepId:s.z.string(),description:s.z.string(),stepFunction:s.z.object({functionName:s.z.string(),version:s.z.string().optional(),parameters:s.z.record(s.z.string(),s.z.unknown())}),condition:s.z.string().optional(),ignoreError:s.z.boolean().optional()}).array(),result:s.z.string()}),b=s.z.object({StackOne:s.z.string(),info:s.z.object({title:s.z.string(),version:s.z.string(),key:s.z.string(),description:s.z.string().optional()}),baseUrl:s.z.string(),authentication:s.z.record(s.z.string(),s.z.object({type:s.z.string(),label:s.z.string(),authorization:e.AUTHENTICATION_SCHEMA,environments:s.z.object({key:s.z.string(),name:s.z.string()}).array(),support:s.z.object({link:s.z.string(),description:s.z.string().optional()}),configFields:g.array().optional(),setupFields:g.array().optional(),testOperationsIds:s.z.string().array().optional()})).array().optional(),operations:m.array().optional()});function h(e){try{const t=i.parse(e),n=b.parse(t),r={title:n.info.title,version:n.info.version,key:n.info.key,description:n.info.description},s=z(n),a={baseUrl:n.baseUrl,authentication:_(s)},c=k(n,a);return r.operations=c,r.authentication=s,o.notMissing(c)&&(r.categories=f(Object.values(c))),r}catch(e){throw new Error(`Error parsing YAML file: ${e.message}`)}}const _=e=>{const t={};for(const[o,n]of Object.entries(e))if(n&&"object"==typeof n){const{setupFields:e,configFields:r,support:i,testOperationsIds:s,...a}=n;t[o]=_(a)}else t[o]=n;return t},f=e=>{const t=e.reduce(((e,t)=>{for(const o of t.categories)e.add(o);return e}),new Set);return Array.from(t)},z=e=>{const t={};for(const o of e.authentication??[]){const[e]=Object.keys(o),n=o[e].environments.reduce(((t,n)=>{const{key:r,name:i}=n,{environments:s,...a}=o[e];return t[r]={...a,envKey:r,envName:i},t}),{});t[e]=n}return t},k=(e,t)=>{const o=e.operations?.reduce(((e,o)=>{const n=(e=>e.entrypointUrl&&e.entrypointHttpMethod?`${e.entrypointHttpMethod.toUpperCase()} ${e.entrypointUrl}`:void 0)(o),r=(e=>"list"===e.operationType?`GET /${e.schema}`:`GET /${e.schema}/:id`)(o),i=(e=>"list"===e.operationType?`/${e.schema}`:`/${e.schema}/:id`)(o);return e[n??r]={id:o.operationId,categories:o.categories,description:o.description,operationType:o.operationType,entrypointUrl:o.entrypointUrl??i,entrypointHttpMethod:o.entrypointHttpMethod??"get",inputs:o.inputs,steps:o.steps.reduce(((e,n)=>(e[n.stepId]={id:n.stepId,description:n.description,condition:n.condition,ignoreError:n.ignoreError,stepFunction:{functionName:n.stepFunction.functionName,version:n.stepFunction.version,params:{..."request"===n.stepFunction.functionName?t:{},..."map_fields"===n.stepFunction.functionName||"typecast"===n.stepFunction.functionName?{fields:o.fieldConfigs}:{},...n.stepFunction.parameters}}},e)),{}),result:o.result},e}),{});return o},v=(e,t)=>{if(!e.inputs)return{};const o=S(e.inputs).parse(t);return{...o.headers??{},...o.query??{},...o.path??{},...o.body??{}}},I=e=>{const t={};return e.forEach((e=>{let o;switch(e.type.toLowerCase()){case"string":o=s.z.string();break;case"number":o=s.z.number();break;case"boolean":o=s.z.boolean();break;default:o=s.z.any()}t[e.name]=e.required?o:o.optional()})),s.z.object(t)},S=e=>{const t=e.filter((e=>"path"===e.in)),o=e.filter((e=>"query"===e.in)),n=e.filter((e=>"body"===e.in)),r=e.filter((e=>"headers"===e.in));return s.z.object({path:I(t).optional(),query:I(o).optional(),body:I(n).optional(),headers:I(r).optional()})};class E extends Error{constructor(e,t,o){super(o),this.name="ConnectSDKError",this.errorType=e,this.context=t,Error.captureStackTrace&&Error.captureStackTrace(this,E)}toString(){return`${this.name} [${this.errorType}]: ${this.message}`}}class F extends E{constructor(e,t){super("CONNECTOR_PARSE_ERROR",e,t),this.name="ConnectorParseError"}}class O extends E{constructor(e,t){super("MISSING_OPERATION_ERROR",e,t),this.name="MissingOperationError"}}class j extends E{constructor(e,t){super("INVALID_OPERATION_INPUTS_ERROR",e,t),this.name="InvalidOperationInputsError"}}exports.ConnectSDKError=E,exports.createBlock=p,exports.executeStepFunction=async({block:t,stepFunctionName:o,params:n,buildStepFunction:r=e.StepFunctionsFactory.build})=>{const i=r({functionName:o}).fn,s=await i({block:t,params:n}),a=o===e.StepFunctionName.MAP_FIELDS?{[e.StepFunctionName.MAP_FIELDS.toString()]:{output:{data:s.block.result},errors:s.errors,successful:s.successful}}:{};return{...s.block,steps:{...s?.block?.steps??{},...a}}},exports.getOperationFromUrl=l,exports.parseOperationInputs=v,exports.parseYamlConnector=h,exports.runConnectorOperation=async({account:e,connector:t,category:n,path:r,method:i="get",queryParams:s,body:c,headers:d,logger:y,parseConnector:g=h,getOperationFromUrlFn:m=l,parseOperationInputsFn:b=v,createBlockContextFn:_=u,createBlockFn:f=p,runStepOperationFn:z=a})=>{const k=e.authConfigKey,I=e.environment??"production",S=e.secureId,E=e.projectSecureId,C=e.credentials,N=_({category:n,connectorKey:e.providerKey,connectorVersion:e.providerVersion,authConfigKey:k,environment:I,accountSecureId:S,projectSecureId:E});let T;try{T=o.isString(t)?g(t):t}catch{throw new F(N,"Error while parsing connector")}const x=m(T,r,i);if(o.isMissing(x))throw new O(N,"No matching operation found");let w;N.operationType=x.operation.operationType,N.schema=x.operation.schema?.key;try{w=b(x.operation,{query:s,body:c,headers:d,path:x.params})}catch{throw new j(N,"Error while parsing operation inputs")}const q=await f({inputs:w,context:N,operation:x.operation,credentials:C,logger:y});return await z({block:q})},exports.runStepOperation=a;
|
|
@@ -26,7 +26,7 @@ export declare const OPERATION_SCHEMA: z.ZodObject<{
|
|
|
26
26
|
name: string;
|
|
27
27
|
in: string;
|
|
28
28
|
}>, "many">>;
|
|
29
|
-
fieldConfigs: z.ZodArray<z.ZodObject<{
|
|
29
|
+
fieldConfigs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
30
30
|
targetFieldKey: z.ZodString;
|
|
31
31
|
expression: z.ZodString;
|
|
32
32
|
type: z.ZodEnum<["string", "number", "boolean", "datetime_string", "enum"]>;
|
|
@@ -75,7 +75,7 @@ export declare const OPERATION_SCHEMA: z.ZodObject<{
|
|
|
75
75
|
matchExpression: string;
|
|
76
76
|
}[];
|
|
77
77
|
} | undefined;
|
|
78
|
-
}>, "many"
|
|
78
|
+
}>, "many">>;
|
|
79
79
|
steps: z.ZodArray<z.ZodObject<{
|
|
80
80
|
stepId: z.ZodString;
|
|
81
81
|
description: z.ZodString;
|
|
@@ -92,6 +92,8 @@ export declare const OPERATION_SCHEMA: z.ZodObject<{
|
|
|
92
92
|
parameters: Record<string, unknown>;
|
|
93
93
|
version?: string | undefined;
|
|
94
94
|
}>;
|
|
95
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
96
|
+
ignoreError: z.ZodOptional<z.ZodBoolean>;
|
|
95
97
|
}, "strip", z.ZodTypeAny, {
|
|
96
98
|
description: string;
|
|
97
99
|
stepId: string;
|
|
@@ -100,6 +102,8 @@ export declare const OPERATION_SCHEMA: z.ZodObject<{
|
|
|
100
102
|
parameters: Record<string, unknown>;
|
|
101
103
|
version?: string | undefined;
|
|
102
104
|
};
|
|
105
|
+
condition?: string | undefined;
|
|
106
|
+
ignoreError?: boolean | undefined;
|
|
103
107
|
}, {
|
|
104
108
|
description: string;
|
|
105
109
|
stepId: string;
|
|
@@ -108,6 +112,8 @@ export declare const OPERATION_SCHEMA: z.ZodObject<{
|
|
|
108
112
|
parameters: Record<string, unknown>;
|
|
109
113
|
version?: string | undefined;
|
|
110
114
|
};
|
|
115
|
+
condition?: string | undefined;
|
|
116
|
+
ignoreError?: boolean | undefined;
|
|
111
117
|
}>, "many">;
|
|
112
118
|
result: z.ZodString;
|
|
113
119
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -115,18 +121,6 @@ export declare const OPERATION_SCHEMA: z.ZodObject<{
|
|
|
115
121
|
operationId: string;
|
|
116
122
|
categories: string[];
|
|
117
123
|
operationType: string;
|
|
118
|
-
fieldConfigs: {
|
|
119
|
-
type: "string" | "number" | "boolean" | "datetime_string" | "enum";
|
|
120
|
-
targetFieldKey: string;
|
|
121
|
-
expression: string;
|
|
122
|
-
isUnified: boolean;
|
|
123
|
-
enumMapper?: {
|
|
124
|
-
matcher: "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" | {
|
|
125
|
-
value: string;
|
|
126
|
-
matchExpression: string;
|
|
127
|
-
}[];
|
|
128
|
-
} | undefined;
|
|
129
|
-
}[];
|
|
130
124
|
steps: {
|
|
131
125
|
description: string;
|
|
132
126
|
stepId: string;
|
|
@@ -135,6 +129,8 @@ export declare const OPERATION_SCHEMA: z.ZodObject<{
|
|
|
135
129
|
parameters: Record<string, unknown>;
|
|
136
130
|
version?: string | undefined;
|
|
137
131
|
};
|
|
132
|
+
condition?: string | undefined;
|
|
133
|
+
ignoreError?: boolean | undefined;
|
|
138
134
|
}[];
|
|
139
135
|
result: string;
|
|
140
136
|
schema?: string | undefined;
|
|
@@ -147,12 +143,7 @@ export declare const OPERATION_SCHEMA: z.ZodObject<{
|
|
|
147
143
|
name: string;
|
|
148
144
|
in: string;
|
|
149
145
|
}[] | undefined;
|
|
150
|
-
|
|
151
|
-
description: string;
|
|
152
|
-
operationId: string;
|
|
153
|
-
categories: string[];
|
|
154
|
-
operationType: string;
|
|
155
|
-
fieldConfigs: {
|
|
146
|
+
fieldConfigs?: {
|
|
156
147
|
type: "string" | "number" | "boolean" | "datetime_string" | "enum";
|
|
157
148
|
targetFieldKey: string;
|
|
158
149
|
expression: string;
|
|
@@ -163,7 +154,12 @@ export declare const OPERATION_SCHEMA: z.ZodObject<{
|
|
|
163
154
|
matchExpression: string;
|
|
164
155
|
}[];
|
|
165
156
|
} | undefined;
|
|
166
|
-
}[];
|
|
157
|
+
}[] | undefined;
|
|
158
|
+
}, {
|
|
159
|
+
description: string;
|
|
160
|
+
operationId: string;
|
|
161
|
+
categories: string[];
|
|
162
|
+
operationType: string;
|
|
167
163
|
steps: {
|
|
168
164
|
description: string;
|
|
169
165
|
stepId: string;
|
|
@@ -172,6 +168,8 @@ export declare const OPERATION_SCHEMA: z.ZodObject<{
|
|
|
172
168
|
parameters: Record<string, unknown>;
|
|
173
169
|
version?: string | undefined;
|
|
174
170
|
};
|
|
171
|
+
condition?: string | undefined;
|
|
172
|
+
ignoreError?: boolean | undefined;
|
|
175
173
|
}[];
|
|
176
174
|
result: string;
|
|
177
175
|
schema?: string | undefined;
|
|
@@ -184,6 +182,18 @@ export declare const OPERATION_SCHEMA: z.ZodObject<{
|
|
|
184
182
|
name: string;
|
|
185
183
|
in: string;
|
|
186
184
|
}[] | undefined;
|
|
185
|
+
fieldConfigs?: {
|
|
186
|
+
type: "string" | "number" | "boolean" | "datetime_string" | "enum";
|
|
187
|
+
targetFieldKey: string;
|
|
188
|
+
expression: string;
|
|
189
|
+
isUnified: boolean;
|
|
190
|
+
enumMapper?: {
|
|
191
|
+
matcher: "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" | {
|
|
192
|
+
value: string;
|
|
193
|
+
matchExpression: string;
|
|
194
|
+
}[];
|
|
195
|
+
} | undefined;
|
|
196
|
+
}[] | undefined;
|
|
187
197
|
}>;
|
|
188
198
|
export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
189
199
|
StackOne: z.ZodString;
|
|
@@ -419,7 +429,7 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
419
429
|
name: string;
|
|
420
430
|
in: string;
|
|
421
431
|
}>, "many">>;
|
|
422
|
-
fieldConfigs: z.ZodArray<z.ZodObject<{
|
|
432
|
+
fieldConfigs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
423
433
|
targetFieldKey: z.ZodString;
|
|
424
434
|
expression: z.ZodString;
|
|
425
435
|
type: z.ZodEnum<["string", "number", "boolean", "datetime_string", "enum"]>;
|
|
@@ -468,7 +478,7 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
468
478
|
matchExpression: string;
|
|
469
479
|
}[];
|
|
470
480
|
} | undefined;
|
|
471
|
-
}>, "many"
|
|
481
|
+
}>, "many">>;
|
|
472
482
|
steps: z.ZodArray<z.ZodObject<{
|
|
473
483
|
stepId: z.ZodString;
|
|
474
484
|
description: z.ZodString;
|
|
@@ -485,6 +495,8 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
485
495
|
parameters: Record<string, unknown>;
|
|
486
496
|
version?: string | undefined;
|
|
487
497
|
}>;
|
|
498
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
499
|
+
ignoreError: z.ZodOptional<z.ZodBoolean>;
|
|
488
500
|
}, "strip", z.ZodTypeAny, {
|
|
489
501
|
description: string;
|
|
490
502
|
stepId: string;
|
|
@@ -493,6 +505,8 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
493
505
|
parameters: Record<string, unknown>;
|
|
494
506
|
version?: string | undefined;
|
|
495
507
|
};
|
|
508
|
+
condition?: string | undefined;
|
|
509
|
+
ignoreError?: boolean | undefined;
|
|
496
510
|
}, {
|
|
497
511
|
description: string;
|
|
498
512
|
stepId: string;
|
|
@@ -501,6 +515,8 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
501
515
|
parameters: Record<string, unknown>;
|
|
502
516
|
version?: string | undefined;
|
|
503
517
|
};
|
|
518
|
+
condition?: string | undefined;
|
|
519
|
+
ignoreError?: boolean | undefined;
|
|
504
520
|
}>, "many">;
|
|
505
521
|
result: z.ZodString;
|
|
506
522
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -508,18 +524,6 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
508
524
|
operationId: string;
|
|
509
525
|
categories: string[];
|
|
510
526
|
operationType: string;
|
|
511
|
-
fieldConfigs: {
|
|
512
|
-
type: "string" | "number" | "boolean" | "datetime_string" | "enum";
|
|
513
|
-
targetFieldKey: string;
|
|
514
|
-
expression: string;
|
|
515
|
-
isUnified: boolean;
|
|
516
|
-
enumMapper?: {
|
|
517
|
-
matcher: "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" | {
|
|
518
|
-
value: string;
|
|
519
|
-
matchExpression: string;
|
|
520
|
-
}[];
|
|
521
|
-
} | undefined;
|
|
522
|
-
}[];
|
|
523
527
|
steps: {
|
|
524
528
|
description: string;
|
|
525
529
|
stepId: string;
|
|
@@ -528,6 +532,8 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
528
532
|
parameters: Record<string, unknown>;
|
|
529
533
|
version?: string | undefined;
|
|
530
534
|
};
|
|
535
|
+
condition?: string | undefined;
|
|
536
|
+
ignoreError?: boolean | undefined;
|
|
531
537
|
}[];
|
|
532
538
|
result: string;
|
|
533
539
|
schema?: string | undefined;
|
|
@@ -540,12 +546,7 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
540
546
|
name: string;
|
|
541
547
|
in: string;
|
|
542
548
|
}[] | undefined;
|
|
543
|
-
|
|
544
|
-
description: string;
|
|
545
|
-
operationId: string;
|
|
546
|
-
categories: string[];
|
|
547
|
-
operationType: string;
|
|
548
|
-
fieldConfigs: {
|
|
549
|
+
fieldConfigs?: {
|
|
549
550
|
type: "string" | "number" | "boolean" | "datetime_string" | "enum";
|
|
550
551
|
targetFieldKey: string;
|
|
551
552
|
expression: string;
|
|
@@ -556,7 +557,12 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
556
557
|
matchExpression: string;
|
|
557
558
|
}[];
|
|
558
559
|
} | undefined;
|
|
559
|
-
}[];
|
|
560
|
+
}[] | undefined;
|
|
561
|
+
}, {
|
|
562
|
+
description: string;
|
|
563
|
+
operationId: string;
|
|
564
|
+
categories: string[];
|
|
565
|
+
operationType: string;
|
|
560
566
|
steps: {
|
|
561
567
|
description: string;
|
|
562
568
|
stepId: string;
|
|
@@ -565,6 +571,8 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
565
571
|
parameters: Record<string, unknown>;
|
|
566
572
|
version?: string | undefined;
|
|
567
573
|
};
|
|
574
|
+
condition?: string | undefined;
|
|
575
|
+
ignoreError?: boolean | undefined;
|
|
568
576
|
}[];
|
|
569
577
|
result: string;
|
|
570
578
|
schema?: string | undefined;
|
|
@@ -577,6 +585,18 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
577
585
|
name: string;
|
|
578
586
|
in: string;
|
|
579
587
|
}[] | undefined;
|
|
588
|
+
fieldConfigs?: {
|
|
589
|
+
type: "string" | "number" | "boolean" | "datetime_string" | "enum";
|
|
590
|
+
targetFieldKey: string;
|
|
591
|
+
expression: string;
|
|
592
|
+
isUnified: boolean;
|
|
593
|
+
enumMapper?: {
|
|
594
|
+
matcher: "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" | {
|
|
595
|
+
value: string;
|
|
596
|
+
matchExpression: string;
|
|
597
|
+
}[];
|
|
598
|
+
} | undefined;
|
|
599
|
+
}[] | undefined;
|
|
580
600
|
}>, "many">>;
|
|
581
601
|
}, "strip", z.ZodTypeAny, {
|
|
582
602
|
StackOne: string;
|
|
@@ -634,18 +654,6 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
634
654
|
operationId: string;
|
|
635
655
|
categories: string[];
|
|
636
656
|
operationType: string;
|
|
637
|
-
fieldConfigs: {
|
|
638
|
-
type: "string" | "number" | "boolean" | "datetime_string" | "enum";
|
|
639
|
-
targetFieldKey: string;
|
|
640
|
-
expression: string;
|
|
641
|
-
isUnified: boolean;
|
|
642
|
-
enumMapper?: {
|
|
643
|
-
matcher: "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" | {
|
|
644
|
-
value: string;
|
|
645
|
-
matchExpression: string;
|
|
646
|
-
}[];
|
|
647
|
-
} | undefined;
|
|
648
|
-
}[];
|
|
649
657
|
steps: {
|
|
650
658
|
description: string;
|
|
651
659
|
stepId: string;
|
|
@@ -654,6 +662,8 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
654
662
|
parameters: Record<string, unknown>;
|
|
655
663
|
version?: string | undefined;
|
|
656
664
|
};
|
|
665
|
+
condition?: string | undefined;
|
|
666
|
+
ignoreError?: boolean | undefined;
|
|
657
667
|
}[];
|
|
658
668
|
result: string;
|
|
659
669
|
schema?: string | undefined;
|
|
@@ -666,6 +676,18 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
666
676
|
name: string;
|
|
667
677
|
in: string;
|
|
668
678
|
}[] | undefined;
|
|
679
|
+
fieldConfigs?: {
|
|
680
|
+
type: "string" | "number" | "boolean" | "datetime_string" | "enum";
|
|
681
|
+
targetFieldKey: string;
|
|
682
|
+
expression: string;
|
|
683
|
+
isUnified: boolean;
|
|
684
|
+
enumMapper?: {
|
|
685
|
+
matcher: "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" | {
|
|
686
|
+
value: string;
|
|
687
|
+
matchExpression: string;
|
|
688
|
+
}[];
|
|
689
|
+
} | undefined;
|
|
690
|
+
}[] | undefined;
|
|
669
691
|
}[] | undefined;
|
|
670
692
|
}, {
|
|
671
693
|
StackOne: string;
|
|
@@ -723,18 +745,6 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
723
745
|
operationId: string;
|
|
724
746
|
categories: string[];
|
|
725
747
|
operationType: string;
|
|
726
|
-
fieldConfigs: {
|
|
727
|
-
type: "string" | "number" | "boolean" | "datetime_string" | "enum";
|
|
728
|
-
targetFieldKey: string;
|
|
729
|
-
expression: string;
|
|
730
|
-
isUnified: boolean;
|
|
731
|
-
enumMapper?: {
|
|
732
|
-
matcher: "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" | {
|
|
733
|
-
value: string;
|
|
734
|
-
matchExpression: string;
|
|
735
|
-
}[];
|
|
736
|
-
} | undefined;
|
|
737
|
-
}[];
|
|
738
748
|
steps: {
|
|
739
749
|
description: string;
|
|
740
750
|
stepId: string;
|
|
@@ -743,6 +753,8 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
743
753
|
parameters: Record<string, unknown>;
|
|
744
754
|
version?: string | undefined;
|
|
745
755
|
};
|
|
756
|
+
condition?: string | undefined;
|
|
757
|
+
ignoreError?: boolean | undefined;
|
|
746
758
|
}[];
|
|
747
759
|
result: string;
|
|
748
760
|
schema?: string | undefined;
|
|
@@ -755,5 +767,17 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
755
767
|
name: string;
|
|
756
768
|
in: string;
|
|
757
769
|
}[] | undefined;
|
|
770
|
+
fieldConfigs?: {
|
|
771
|
+
type: "string" | "number" | "boolean" | "datetime_string" | "enum";
|
|
772
|
+
targetFieldKey: string;
|
|
773
|
+
expression: string;
|
|
774
|
+
isUnified: boolean;
|
|
775
|
+
enumMapper?: {
|
|
776
|
+
matcher: "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" | {
|
|
777
|
+
value: string;
|
|
778
|
+
matchExpression: string;
|
|
779
|
+
}[];
|
|
780
|
+
} | undefined;
|
|
781
|
+
}[] | undefined;
|
|
758
782
|
}[] | undefined;
|
|
759
783
|
}>;
|
|
@@ -5,13 +5,15 @@ import { createBlockContext } from '../blocks/createBlockContext';
|
|
|
5
5
|
import { getOperationFromUrl } from '../connectors/operations';
|
|
6
6
|
import { parseOperationInputs, parseYamlConnector } from '../connectors/parsers';
|
|
7
7
|
import { runStepOperation } from './runStepOperation';
|
|
8
|
-
export declare const runConnectorOperation: ({ account, connector, category, path, method, queryParams, logger, parseConnector, getOperationFromUrlFn, parseOperationInputsFn, createBlockContextFn, createBlockFn, runStepOperationFn, }: {
|
|
8
|
+
export declare const runConnectorOperation: ({ account, connector, category, path, method, queryParams, body, headers, logger, parseConnector, getOperationFromUrlFn, parseOperationInputsFn, createBlockContextFn, createBlockFn, runStepOperationFn, }: {
|
|
9
9
|
account: Account;
|
|
10
10
|
connector: Connector | string;
|
|
11
11
|
category: Category;
|
|
12
12
|
path: string;
|
|
13
13
|
method?: HttpMethod;
|
|
14
14
|
queryParams: unknown;
|
|
15
|
+
body?: unknown;
|
|
16
|
+
headers?: Record<string, string>;
|
|
15
17
|
logger?: ILogger;
|
|
16
18
|
parseConnector?: typeof parseYamlConnector;
|
|
17
19
|
getOperationFromUrlFn?: typeof getOperationFromUrl;
|