@stackone/connect-sdk 1.12.0 → 1.12.2
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{
|
|
1
|
+
import{StepFunctionsFactory as t,StepFunctionName as e,AUTHENTICATION_SCHEMA as r}from"@stackone/core";import{safeEvaluate as n}from"@stackone/expressions";import{notMissing as o,isString as s,isMissing as i}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:r,stepFunctionName:n,params:o,buildStepFunction:s=t.build})=>{const i=s({functionName:n}).fn,a=await i({block:r,params:o}),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:r=t.build})=>{const o=e.operation?.steps||[];let s={...e};const i=Object.keys(o);for(const t of i){const e=o[t].stepFunction,n=r({functionName:e.functionName,version:e.version,validateSchemas:!0}).fn,i=await n({block:s,params:e.params});s={...i.block,steps:{...i.block.steps,[t]:{successful:i.successful,errors:i.errors,output:i.output}}}}const a=e.operation?.result?n(e.operation.result,s):void 0;return{...s,outputs:a}},g=async({inputs:t,category:e,connectorKey:r,connectorVersion:n,authConfigKey:o,environment:s="production",operation:i,accountSecureId:c,projectSecureId:p,credentials:u,logger:l,getHttpClient:d=async()=>a.getInstance()})=>{const g=await d();return{inputs:t,fieldConfigs:[],context:{projectSecureId:p,accountSecureId:c,connectorKey:r,connectorVersion:n,category:e,schema:i.schema?.key,service:"",resource:"",operationType:i.operationType,authenticationType:o,environment:s},operation:i,credentials:u,httpClient:g,logger:l}},y=(t,e,r)=>{const n=r.toUpperCase();if(!t.operations)return;const o=Object.keys(t.operations),s=f(e,n,o);return s?{operation:t.operations?.[s.path],params:s.params}:void 0},m=t=>{const e=t.startsWith("/")?t.slice(1):t;return e.endsWith("/")?e.slice(0,-1):e},f=(t,e,r)=>{const n=m(t);for(const t of r)if(t.startsWith(e)){const r=t.replace(`${e} `,"").trim(),o=c(m(r))(m(n));if(!1!==o)return{path:t,params:o.params}}},h=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()}),b=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.string(),isUnified:u.boolean()}).array(),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())})}).array(),result:u.string()}),k=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:r,environments:u.object({key:u.string(),name:u.string()}).array(),support:u.object({link:u.string(),description:u.string().optional()}),configFields:h.array().optional(),setupFields:h.array().optional(),testOperationsIds:u.string().array().optional()})).array().optional(),operations:b.array().optional()});function I(t){try{const e=p(t),r=k.parse(e),n={title:r.info.title,version:r.info.version,key:r.info.key,description:r.info.description},s=S(r),i={baseUrl:r.baseUrl,authentication:v(s)},a=j(r,i);return n.operations=a,n.authentication=s,o(a)&&(n.categories=F(Object.values(a))),n}catch(t){throw new Error(`Error parsing YAML file: ${t.message}`)}}const v=t=>{const e={};for(const[r,n]of Object.entries(t))if(n&&"object"==typeof n){const{setupFields:t,configFields:o,support:s,testOperationsIds:i,...a}=n;e[r]=v(a)}else e[r]=n;return e},F=t=>{const e=t.reduce(((t,e)=>{for(const r of e.categories)t.add(r);return t}),new Set);return Array.from(e)},S=t=>{const e={};for(const r of t.authentication??[]){const[t]=Object.keys(r),n=r[t].environments.reduce(((e,n)=>{const{key:o,name:s}=n,{environments:i,...a}=r[t];return e[o]={...a,envKey:o,envName:s},e}),{});e[t]=n}return e},j=(t,e)=>{const r=t.operations?.reduce(((t,r)=>{const n=(t=>t.entrypointUrl&&t.entrypointHttpMethod?`${t.entrypointHttpMethod.toUpperCase()} ${t.entrypointUrl}`:void 0)(r),o=(t=>"list"===t.operationType?`GET /${t.schema}`:`GET /${t.schema}/:id`)(r),s=(t=>"list"===t.operationType?`/${t.schema}`:`/${t.schema}/:id`)(r);return t[n??o]={id:r.operationId,categories:r.categories,description:r.description,operationType:r.operationType,entrypointUrl:r.entrypointUrl??s,entrypointHttpMethod:r.entrypointHttpMethod??"get",inputs:r.inputs,steps:r.steps.reduce(((t,n)=>(t[n.stepId]={id:n.stepId,description:n.description,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:r.fieldConfigs}:{},...n.stepFunction.parameters}}},t)),{}),result:r.result},t}),{});return r},E=(t,e)=>{if(!t.inputs)return{};const r=w(t.inputs).parse(e);return{...r.headers??{},...r.query??{},...r.path??{},...r.body??{}}},O=t=>{const e={};return t.forEach((t=>{let r;switch(t.type.toLowerCase()){case"string":r=u.string();break;case"number":r=u.number();break;case"boolean":r=u.boolean();break;default:r=u.any()}e[t.name]=t.required?r:r.optional()})),u.object(e)},w=t=>{const e=t.filter((t=>"path"===t.in)),r=t.filter((t=>"query"===t.in)),n=t.filter((t=>"body"===t.in)),o=t.filter((t=>"headers"===t.in));return u.object({path:O(e).optional(),query:O(r).optional(),body:O(n).optional(),headers:O(o).optional()})};class N extends Error{constructor(t,e){super(e),this.name="ConnectSDKError",this.errorType=t,Error.captureStackTrace&&Error.captureStackTrace(this,N)}toString(){return`${this.name} [${this.errorType}]: ${this.message}`}}class T extends N{constructor(t){super("CONNECTOR_PARSE_ERROR",t),this.name="ConnectorParseError"}}class C extends N{constructor(t){super("MISSING_OPERATION_ERROR",t),this.name="MissingOperationError"}}class R extends N{constructor(t){super("INVALID_OPERATION_INPUTS_ERROR",t),this.name="InvalidOperationInputsError"}}const U=async({account:t,connector:e,category:r,path:n,method:o="get",queryParams:a,logger:c,parseConnector:p=I,getOperationFromUrlFn:u=y,parseOperationInputsFn:l=E,createBlockFn:m=g,runStepOperationFn:f=d})=>{const h=t.authConfigKey,b=t.environment??"production",k=t.secureId,v=t.projectSecureId,F=t.credentials;let S;try{S=s(e)?p(e):e}catch{throw new T("Error while parsing connector")}const j=u(S,n,o);if(i(j))throw new C("No matching operation found");let O;try{O=l(j.operation,{query:a,path:j.params})}catch{throw new R("Error while parsing operation inputs")}const w=await m({inputs:O,category:r,connectorKey:S.key,connectorVersion:S.version,authConfigKey:h,environment:b,operation:j.operation,accountSecureId:k,projectSecureId:v,credentials:F,logger:c});return await f({block:w})};export{N as ConnectSDKError,g as createBlock,l as executeStepFunction,y as getOperationFromUrl,E as parseOperationInputs,I as parseYamlConnector,U as runConnectorOperation,d as runStepOperation};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("@stackone/core"),e=require("@stackone/expressions"),n=require("
|
|
1
|
+
"use strict";var t=require("@stackone/core"),e=require("@stackone/expressions"),r=require("@stackone/utils"),n=require("@stackone/transport"),o=require("path-to-regexp"),s=require("yaml"),i=require("zod");const a=async({block:r,buildStepFunction:n=t.StepFunctionsFactory.build})=>{const o=r.operation?.steps||[];let s={...r};const i=Object.keys(o);for(const t of i){const e=o[t].stepFunction,r=n({functionName:e.functionName,version:e.version,validateSchemas:!0}).fn,i=await r({block:s,params:e.params});s={...i.block,steps:{...i.block.steps,[t]:{successful:i.successful,errors:i.errors,output:i.output}}}}const a=r.operation?.result?e.safeEvaluate(r.operation.result,s):void 0;return{...s,outputs:a}},c=async({inputs:t,category:e,connectorKey:r,connectorVersion:o,authConfigKey:s,environment:i="production",operation:a,accountSecureId:c,projectSecureId:p,credentials:u,logger:l,getHttpClient:d=async()=>n.HttpClientManager.getInstance()})=>{const g=await d();return{inputs:t,fieldConfigs:[],context:{projectSecureId:p,accountSecureId:c,connectorKey:r,connectorVersion:o,category:e,schema:a.schema?.key,service:"",resource:"",operationType:a.operationType,authenticationType:s,environment:i},operation:a,credentials:u,httpClient:g,logger:l}},p=(t,e,r)=>{const n=r.toUpperCase();if(!t.operations)return;const o=Object.keys(t.operations),s=l(e,n,o);return s?{operation:t.operations?.[s.path],params:s.params}:void 0},u=t=>{const e=t.startsWith("/")?t.slice(1):t;return e.endsWith("/")?e.slice(0,-1):e},l=(t,e,r)=>{const n=u(t);for(const t of r)if(t.startsWith(e)){const r=t.replace(`${e} `,"").trim(),s=o.match(u(r))(u(n));if(!1!==s)return{path:t,params:s.params}}},d=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()}),g=i.z.object({operationId:i.z.string(),categories:i.z.string().array(),operationType:i.z.string(),schema:i.z.string().optional(),entrypointUrl:i.z.string().optional(),entrypointHttpMethod:i.z.string().optional(),description:i.z.string(),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(),fieldConfigs:i.z.object({targetFieldKey:i.z.string(),expression:i.z.string(),type:i.z.string(),isUnified:i.z.boolean()}).array(),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())})}).array(),result:i.z.string()}),y=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:t.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:d.array().optional(),setupFields:d.array().optional(),testOperationsIds:i.z.string().array().optional()})).array().optional(),operations:g.array().optional()});function z(t){try{const e=s.parse(t),n=y.parse(e),o={title:n.info.title,version:n.info.version,key:n.info.key,description:n.info.description},i=h(n),a={baseUrl:n.baseUrl,authentication:m(i)},c=b(n,a);return o.operations=c,o.authentication=i,r.notMissing(c)&&(o.categories=f(Object.values(c))),o}catch(t){throw new Error(`Error parsing YAML file: ${t.message}`)}}const m=t=>{const e={};for(const[r,n]of Object.entries(t))if(n&&"object"==typeof n){const{setupFields:t,configFields:o,support:s,testOperationsIds:i,...a}=n;e[r]=m(a)}else e[r]=n;return e},f=t=>{const e=t.reduce(((t,e)=>{for(const r of e.categories)t.add(r);return t}),new Set);return Array.from(e)},h=t=>{const e={};for(const r of t.authentication??[]){const[t]=Object.keys(r),n=r[t].environments.reduce(((e,n)=>{const{key:o,name:s}=n,{environments:i,...a}=r[t];return e[o]={...a,envKey:o,envName:s},e}),{});e[t]=n}return e},b=(t,e)=>{const r=t.operations?.reduce(((t,r)=>{const n=(t=>t.entrypointUrl&&t.entrypointHttpMethod?`${t.entrypointHttpMethod.toUpperCase()} ${t.entrypointUrl}`:void 0)(r),o=(t=>"list"===t.operationType?`GET /${t.schema}`:`GET /${t.schema}/:id`)(r),s=(t=>"list"===t.operationType?`/${t.schema}`:`/${t.schema}/:id`)(r);return t[n??o]={id:r.operationId,categories:r.categories,description:r.description,operationType:r.operationType,entrypointUrl:r.entrypointUrl??s,entrypointHttpMethod:r.entrypointHttpMethod??"get",inputs:r.inputs,steps:r.steps.reduce(((t,n)=>(t[n.stepId]={id:n.stepId,description:n.description,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:r.fieldConfigs}:{},...n.stepFunction.parameters}}},t)),{}),result:r.result},t}),{});return r},k=(t,e)=>{if(!t.inputs)return{};const r=F(t.inputs).parse(e);return{...r.headers??{},...r.query??{},...r.path??{},...r.body??{}}},S=t=>{const e={};return t.forEach((t=>{let r;switch(t.type.toLowerCase()){case"string":r=i.z.string();break;case"number":r=i.z.number();break;case"boolean":r=i.z.boolean();break;default:r=i.z.any()}e[t.name]=t.required?r:r.optional()})),i.z.object(e)},F=t=>{const e=t.filter((t=>"path"===t.in)),r=t.filter((t=>"query"===t.in)),n=t.filter((t=>"body"===t.in)),o=t.filter((t=>"headers"===t.in));return i.z.object({path:S(e).optional(),query:S(r).optional(),body:S(n).optional(),headers:S(o).optional()})};class I extends Error{constructor(t,e){super(e),this.name="ConnectSDKError",this.errorType=t,Error.captureStackTrace&&Error.captureStackTrace(this,I)}toString(){return`${this.name} [${this.errorType}]: ${this.message}`}}class v extends I{constructor(t){super("CONNECTOR_PARSE_ERROR",t),this.name="ConnectorParseError"}}class E extends I{constructor(t){super("MISSING_OPERATION_ERROR",t),this.name="MissingOperationError"}}class O extends I{constructor(t){super("INVALID_OPERATION_INPUTS_ERROR",t),this.name="InvalidOperationInputsError"}}exports.ConnectSDKError=I,exports.createBlock=c,exports.executeStepFunction=async({block:e,stepFunctionName:r,params:n,buildStepFunction:o=t.StepFunctionsFactory.build})=>{const s=o({functionName:r}).fn,i=await s({block:e,params:n}),a=r===t.StepFunctionName.MAP_FIELDS?{[t.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=p,exports.parseOperationInputs=k,exports.parseYamlConnector=z,exports.runConnectorOperation=async({account:t,connector:e,category:n,path:o,method:s="get",queryParams:i,logger:u,parseConnector:l=z,getOperationFromUrlFn:d=p,parseOperationInputsFn:g=k,createBlockFn:y=c,runStepOperationFn:m=a})=>{const f=t.authConfigKey,h=t.environment??"production",b=t.secureId,S=t.projectSecureId,F=t.credentials;let I;try{I=r.isString(e)?l(e):e}catch{throw new v("Error while parsing connector")}const j=d(I,o,s);if(r.isMissing(j))throw new E("No matching operation found");let N;try{N=g(j.operation,{query:i,path:j.params})}catch{throw new O("Error while parsing operation inputs")}const C=await y({inputs:N,category:n,connectorKey:I.key,connectorVersion:I.version,authConfigKey:f,environment:h,operation:j.operation,accountSecureId:b,projectSecureId:S,credentials:F,logger:u});return await m({block:C})},exports.runStepOperation=a;
|
|
@@ -1,4 +1,144 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export declare const OPERATION_SCHEMA: z.ZodObject<{
|
|
3
|
+
operationId: z.ZodString;
|
|
4
|
+
categories: z.ZodArray<z.ZodString, "many">;
|
|
5
|
+
operationType: z.ZodString;
|
|
6
|
+
schema: z.ZodOptional<z.ZodString>;
|
|
7
|
+
entrypointUrl: z.ZodOptional<z.ZodString>;
|
|
8
|
+
entrypointHttpMethod: z.ZodOptional<z.ZodString>;
|
|
9
|
+
description: z.ZodString;
|
|
10
|
+
inputs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
type: z.ZodString;
|
|
13
|
+
required: z.ZodBoolean;
|
|
14
|
+
description: z.ZodString;
|
|
15
|
+
in: z.ZodString;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
type: string;
|
|
18
|
+
required: boolean;
|
|
19
|
+
description: string;
|
|
20
|
+
name: string;
|
|
21
|
+
in: string;
|
|
22
|
+
}, {
|
|
23
|
+
type: string;
|
|
24
|
+
required: boolean;
|
|
25
|
+
description: string;
|
|
26
|
+
name: string;
|
|
27
|
+
in: string;
|
|
28
|
+
}>, "many">>;
|
|
29
|
+
fieldConfigs: z.ZodArray<z.ZodObject<{
|
|
30
|
+
targetFieldKey: z.ZodString;
|
|
31
|
+
expression: z.ZodString;
|
|
32
|
+
type: z.ZodString;
|
|
33
|
+
isUnified: z.ZodBoolean;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
type: string;
|
|
36
|
+
targetFieldKey: string;
|
|
37
|
+
expression: string;
|
|
38
|
+
isUnified: boolean;
|
|
39
|
+
}, {
|
|
40
|
+
type: string;
|
|
41
|
+
targetFieldKey: string;
|
|
42
|
+
expression: string;
|
|
43
|
+
isUnified: boolean;
|
|
44
|
+
}>, "many">;
|
|
45
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
46
|
+
stepId: z.ZodString;
|
|
47
|
+
description: z.ZodString;
|
|
48
|
+
stepFunction: z.ZodObject<{
|
|
49
|
+
functionName: z.ZodString;
|
|
50
|
+
version: z.ZodOptional<z.ZodString>;
|
|
51
|
+
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
functionName: string;
|
|
54
|
+
parameters: Record<string, unknown>;
|
|
55
|
+
version?: string | undefined;
|
|
56
|
+
}, {
|
|
57
|
+
functionName: string;
|
|
58
|
+
parameters: Record<string, unknown>;
|
|
59
|
+
version?: string | undefined;
|
|
60
|
+
}>;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
description: string;
|
|
63
|
+
stepId: string;
|
|
64
|
+
stepFunction: {
|
|
65
|
+
functionName: string;
|
|
66
|
+
parameters: Record<string, unknown>;
|
|
67
|
+
version?: string | undefined;
|
|
68
|
+
};
|
|
69
|
+
}, {
|
|
70
|
+
description: string;
|
|
71
|
+
stepId: string;
|
|
72
|
+
stepFunction: {
|
|
73
|
+
functionName: string;
|
|
74
|
+
parameters: Record<string, unknown>;
|
|
75
|
+
version?: string | undefined;
|
|
76
|
+
};
|
|
77
|
+
}>, "many">;
|
|
78
|
+
result: z.ZodString;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
description: string;
|
|
81
|
+
operationId: string;
|
|
82
|
+
categories: string[];
|
|
83
|
+
operationType: string;
|
|
84
|
+
fieldConfigs: {
|
|
85
|
+
type: string;
|
|
86
|
+
targetFieldKey: string;
|
|
87
|
+
expression: string;
|
|
88
|
+
isUnified: boolean;
|
|
89
|
+
}[];
|
|
90
|
+
steps: {
|
|
91
|
+
description: string;
|
|
92
|
+
stepId: string;
|
|
93
|
+
stepFunction: {
|
|
94
|
+
functionName: string;
|
|
95
|
+
parameters: Record<string, unknown>;
|
|
96
|
+
version?: string | undefined;
|
|
97
|
+
};
|
|
98
|
+
}[];
|
|
99
|
+
result: string;
|
|
100
|
+
schema?: string | undefined;
|
|
101
|
+
entrypointUrl?: string | undefined;
|
|
102
|
+
entrypointHttpMethod?: string | undefined;
|
|
103
|
+
inputs?: {
|
|
104
|
+
type: string;
|
|
105
|
+
required: boolean;
|
|
106
|
+
description: string;
|
|
107
|
+
name: string;
|
|
108
|
+
in: string;
|
|
109
|
+
}[] | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
description: string;
|
|
112
|
+
operationId: string;
|
|
113
|
+
categories: string[];
|
|
114
|
+
operationType: string;
|
|
115
|
+
fieldConfigs: {
|
|
116
|
+
type: string;
|
|
117
|
+
targetFieldKey: string;
|
|
118
|
+
expression: string;
|
|
119
|
+
isUnified: boolean;
|
|
120
|
+
}[];
|
|
121
|
+
steps: {
|
|
122
|
+
description: string;
|
|
123
|
+
stepId: string;
|
|
124
|
+
stepFunction: {
|
|
125
|
+
functionName: string;
|
|
126
|
+
parameters: Record<string, unknown>;
|
|
127
|
+
version?: string | undefined;
|
|
128
|
+
};
|
|
129
|
+
}[];
|
|
130
|
+
result: string;
|
|
131
|
+
schema?: string | undefined;
|
|
132
|
+
entrypointUrl?: string | undefined;
|
|
133
|
+
entrypointHttpMethod?: string | undefined;
|
|
134
|
+
inputs?: {
|
|
135
|
+
type: string;
|
|
136
|
+
required: boolean;
|
|
137
|
+
description: string;
|
|
138
|
+
name: string;
|
|
139
|
+
in: string;
|
|
140
|
+
}[] | undefined;
|
|
141
|
+
}>;
|
|
2
142
|
export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
3
143
|
StackOne: z.ZodString;
|
|
4
144
|
info: z.ZodObject<{
|
|
@@ -8,13 +148,13 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
8
148
|
description: z.ZodOptional<z.ZodString>;
|
|
9
149
|
}, "strip", z.ZodTypeAny, {
|
|
10
150
|
key: string;
|
|
11
|
-
title: string;
|
|
12
151
|
version: string;
|
|
152
|
+
title: string;
|
|
13
153
|
description?: string | undefined;
|
|
14
154
|
}, {
|
|
15
155
|
key: string;
|
|
16
|
-
title: string;
|
|
17
156
|
version: string;
|
|
157
|
+
title: string;
|
|
18
158
|
description?: string | undefined;
|
|
19
159
|
}>;
|
|
20
160
|
baseUrl: z.ZodString;
|
|
@@ -206,7 +346,7 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
206
346
|
}[] | undefined;
|
|
207
347
|
testOperationsIds?: string[] | undefined;
|
|
208
348
|
}>>, "many">>;
|
|
209
|
-
operations: z.ZodArray<z.ZodObject<{
|
|
349
|
+
operations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
210
350
|
operationId: z.ZodString;
|
|
211
351
|
categories: z.ZodArray<z.ZodString, "many">;
|
|
212
352
|
operationType: z.ZodString;
|
|
@@ -345,48 +485,16 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
345
485
|
name: string;
|
|
346
486
|
in: string;
|
|
347
487
|
}[] | undefined;
|
|
348
|
-
}>, "many"
|
|
488
|
+
}>, "many">>;
|
|
349
489
|
}, "strip", z.ZodTypeAny, {
|
|
350
490
|
StackOne: string;
|
|
351
491
|
info: {
|
|
352
492
|
key: string;
|
|
353
|
-
title: string;
|
|
354
493
|
version: string;
|
|
494
|
+
title: string;
|
|
355
495
|
description?: string | undefined;
|
|
356
496
|
};
|
|
357
497
|
baseUrl: string;
|
|
358
|
-
operations: {
|
|
359
|
-
description: string;
|
|
360
|
-
operationId: string;
|
|
361
|
-
categories: string[];
|
|
362
|
-
operationType: string;
|
|
363
|
-
fieldConfigs: {
|
|
364
|
-
type: string;
|
|
365
|
-
targetFieldKey: string;
|
|
366
|
-
expression: string;
|
|
367
|
-
isUnified: boolean;
|
|
368
|
-
}[];
|
|
369
|
-
steps: {
|
|
370
|
-
description: string;
|
|
371
|
-
stepId: string;
|
|
372
|
-
stepFunction: {
|
|
373
|
-
functionName: string;
|
|
374
|
-
parameters: Record<string, unknown>;
|
|
375
|
-
version?: string | undefined;
|
|
376
|
-
};
|
|
377
|
-
}[];
|
|
378
|
-
result: string;
|
|
379
|
-
schema?: string | undefined;
|
|
380
|
-
entrypointUrl?: string | undefined;
|
|
381
|
-
entrypointHttpMethod?: string | undefined;
|
|
382
|
-
inputs?: {
|
|
383
|
-
type: string;
|
|
384
|
-
required: boolean;
|
|
385
|
-
description: string;
|
|
386
|
-
name: string;
|
|
387
|
-
in: string;
|
|
388
|
-
}[] | undefined;
|
|
389
|
-
}[];
|
|
390
498
|
authentication?: Record<string, {
|
|
391
499
|
label: string;
|
|
392
500
|
type: string;
|
|
@@ -429,16 +537,7 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
429
537
|
}[] | undefined;
|
|
430
538
|
testOperationsIds?: string[] | undefined;
|
|
431
539
|
}>[] | undefined;
|
|
432
|
-
|
|
433
|
-
StackOne: string;
|
|
434
|
-
info: {
|
|
435
|
-
key: string;
|
|
436
|
-
title: string;
|
|
437
|
-
version: string;
|
|
438
|
-
description?: string | undefined;
|
|
439
|
-
};
|
|
440
|
-
baseUrl: string;
|
|
441
|
-
operations: {
|
|
540
|
+
operations?: {
|
|
442
541
|
description: string;
|
|
443
542
|
operationId: string;
|
|
444
543
|
categories: string[];
|
|
@@ -469,7 +568,16 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
469
568
|
name: string;
|
|
470
569
|
in: string;
|
|
471
570
|
}[] | undefined;
|
|
472
|
-
}[];
|
|
571
|
+
}[] | undefined;
|
|
572
|
+
}, {
|
|
573
|
+
StackOne: string;
|
|
574
|
+
info: {
|
|
575
|
+
key: string;
|
|
576
|
+
version: string;
|
|
577
|
+
title: string;
|
|
578
|
+
description?: string | undefined;
|
|
579
|
+
};
|
|
580
|
+
baseUrl: string;
|
|
473
581
|
authentication?: Record<string, {
|
|
474
582
|
label: string;
|
|
475
583
|
type: string;
|
|
@@ -512,4 +620,36 @@ export declare const CONNECTOR_YAML_SCHEMA: z.ZodObject<{
|
|
|
512
620
|
}[] | undefined;
|
|
513
621
|
testOperationsIds?: string[] | undefined;
|
|
514
622
|
}>[] | undefined;
|
|
623
|
+
operations?: {
|
|
624
|
+
description: string;
|
|
625
|
+
operationId: string;
|
|
626
|
+
categories: string[];
|
|
627
|
+
operationType: string;
|
|
628
|
+
fieldConfigs: {
|
|
629
|
+
type: string;
|
|
630
|
+
targetFieldKey: string;
|
|
631
|
+
expression: string;
|
|
632
|
+
isUnified: boolean;
|
|
633
|
+
}[];
|
|
634
|
+
steps: {
|
|
635
|
+
description: string;
|
|
636
|
+
stepId: string;
|
|
637
|
+
stepFunction: {
|
|
638
|
+
functionName: string;
|
|
639
|
+
parameters: Record<string, unknown>;
|
|
640
|
+
version?: string | undefined;
|
|
641
|
+
};
|
|
642
|
+
}[];
|
|
643
|
+
result: string;
|
|
644
|
+
schema?: string | undefined;
|
|
645
|
+
entrypointUrl?: string | undefined;
|
|
646
|
+
entrypointHttpMethod?: string | undefined;
|
|
647
|
+
inputs?: {
|
|
648
|
+
type: string;
|
|
649
|
+
required: boolean;
|
|
650
|
+
description: string;
|
|
651
|
+
name: string;
|
|
652
|
+
in: string;
|
|
653
|
+
}[] | undefined;
|
|
654
|
+
}[] | undefined;
|
|
515
655
|
}>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export { executeStepFunction } from './runners/executeStepFunctions';
|
|
2
2
|
export { runStepOperation } from './runners/runStepOperation';
|
|
3
|
+
export { runConnectorOperation } from './runners/runConnectorOperation';
|
|
3
4
|
export { parseYamlConnector, parseOperationInputs } from './connectors/parsers';
|
|
4
5
|
export { createBlock } from './blocks/createBlock';
|
|
5
6
|
export { getOperationFromUrl } from './connectors/operations';
|
|
7
|
+
export { ConnectSDKError } from './errors/connectSDKErrors';
|
|
8
|
+
export { ErrorType } from './errors/types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackone/connect-sdk",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es.mjs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@stackone/open-api": "*",
|
|
38
38
|
"@stackone/transport": "*",
|
|
39
39
|
"@stackone/utils": "*",
|
|
40
|
-
"path-to-regexp": "
|
|
41
|
-
"yaml": "
|
|
40
|
+
"path-to-regexp": "8.2.0",
|
|
41
|
+
"yaml": "2.7.1"
|
|
42
42
|
}
|
|
43
43
|
}
|