@stackone/core 1.15.0 → 1.17.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.
Files changed (30) hide show
  1. package/dist/index.es.mjs +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/types/blocks/types.d.ts +7 -29
  4. package/dist/types/index.d.ts +6 -8
  5. package/dist/types/stepFunctions/factory.d.ts +7 -0
  6. package/dist/types/stepFunctions/getFieldMappingStepFunctions.d.ts +5 -0
  7. package/dist/types/stepFunctions/map/mapStepFunction.d.ts +2 -0
  8. package/dist/types/stepFunctions/mapFields/mapFieldsStepFunction.d.ts +2 -0
  9. package/dist/types/{blocks/steps → stepFunctions}/typecast/parsers.d.ts +2 -2
  10. package/dist/types/{blocks/steps → stepFunctions}/typecast/typecast.d.ts +1 -1
  11. package/dist/types/stepFunctions/typecast/typecastStepFunction.d.ts +2 -0
  12. package/dist/types/stepFunctions/types.d.ts +13 -0
  13. package/dist/types/steps/stepsRunners.d.ts +6 -0
  14. package/dist/types/steps/types.d.ts +13 -0
  15. package/package.json +10 -3
  16. package/dist/types/baseConnector.d.ts +0 -43
  17. package/dist/types/blocks/blockPipe.d.ts +0 -5
  18. package/dist/types/blocks/blockStepsConfigs.d.ts +0 -4
  19. package/dist/types/blocks/blockStepsFactory.d.ts +0 -7
  20. package/dist/types/blocks/steps/map/mapBlockStep.d.ts +0 -2
  21. package/dist/types/blocks/steps/mapFields/mapFieldsBlockStep.d.ts +0 -2
  22. package/dist/types/blocks/steps/stepsDirectoryTypes.d.ts +0 -5
  23. package/dist/types/blocks/steps/typecast/typecastBlockStep.d.ts +0 -2
  24. package/dist/types/constants.d.ts +0 -1
  25. package/dist/types/mappers.d.ts +0 -11
  26. package/dist/types/responseMetaData.d.ts +0 -3
  27. package/dist/types/typeguards.d.ts +0 -7
  28. package/dist/types/types.d.ts +0 -90
  29. /package/dist/types/{blocks/steps → stepFunctions}/typecast/constants.d.ts +0 -0
  30. /package/dist/types/{blocks/steps → stepFunctions}/typecast/types.d.ts +0 -0
package/dist/index.es.mjs CHANGED
@@ -1 +1 @@
1
- import{HttpClient as e}from"@stackone/transport";import t from"jsonpath";import*as r from"date-fns";const s=(e,t="")=>{if("object"===e.type&&e.properties){const r=""===t||t.endsWith(".")?t:`${t}.`;return Object.entries(e.properties).flatMap((([e,t])=>s(t,`${r}${e}`)))}return"array"===e.type&&e.items?s(e.items,`${t}[].`):[{name:t.endsWith(".")?t.slice(0,-1):t,type:e.type,description:e.description}]};class n{constructor({version:t="1",key:r,name:n,services:i={},httpOperations:o={},auth:a,proxy:u,httpClient:c=new e}){this.listOperations=()=>Object.keys(this.httpOperations||{}),this.getOperation=e=>{const t=this.httpOperations?.[e];if(!t)throw new Error(`Operation ${e} not found`);return t},this.getOperationResponseFieldsMetadata=e=>{const t=this.getOperation(e).responses;if(!t)return null;const r=(e=>{const t=Object.entries(e).find((([e])=>e.startsWith("2")));return t?t[1]:null})(t);return r?.content["application/json"]?.schema?s(r.content["application/json"]?.schema):null},this.getOperationRequestFieldsMetadata=e=>this.getOperation(e).parameters,this.callOperation=async({operationId:e,params:t,credentials:r})=>{const s=this.httpOperations?.[e];if(!s)throw new Error(`Operation ${e} not found`);const n=(({params:e,httpOperation:t})=>{const{url:r,method:s}=t;let n=r;const i=[],o=[],a={};let u;Object.entries(e||{}).forEach((([e,r])=>{const s=t.parameters?.[e];if(s)switch(s.in){case"path":n=n.replace(`{${e}}`,r).replace(`:${e}`,r);break;case"query":i.push(`${e}=${r}`);break;case"header":a[e]=r;break;case"cookie":o.push(`${e}=${r}; `);break;case"body":u=r}}));const c=i.length>0?`?${i.join("&")}`:"";return o.length>0&&(a.cookie=o.join("")),{url:`${n}${c}`,method:s,headers:Object.keys(a).length>0?a:void 0,body:u||void 0}})({params:t,httpOperation:s}),{method:i,url:o,headers:a,body:u}=n,{apiKey:c}=r;return{connector:this,input:{operationId:e,params:t},response:await this.httpClient.request({method:i,url:o,headers:{...a,authorization:c},payload:u}),credentials:r}},this.version=t,this.key=r,this.name=n,this.services=i,this.httpOperations=o,this.auth=a,this.proxy=u,this.httpClient=c}}const i="request_body";var o;!function(e){e.MAP="map",e.TYPECAST="typecast",e.MAP_FIELDS="map_fields"}(o||(o={}));const a=async({blockSteps:e,block:t})=>e.reduce((async(e,t)=>t({block:await e})),Promise.resolve(t)),u=async({block:e})=>{const t=e?.fieldConfigs,r=[];if(!t||"disabled"===e?.debug?.custom_mappings)return e;let s;const n=e.providerData,i=e.context.childResource??e.context.subResource??e.context.resource;if(Array.isArray(e.result))s=e.result.map((e=>{const s=n?.[i]?.items;if(!s)return e;const o=c(e.id,e.remote_id,n),a=l(e,t,o);return r.push(...a.errors||[]),a.record}));else{const i=l(e.result,t,n);s=i.record,r.push(...i.errors||[])}return{...e,result:s,customMappingErrors:Object.keys(r).length>0?r:void 0}},c=(e,t,r)=>r?Object.keys(r).reduce(((s,n)=>{const i=r[n];if(!i.items)return s;const o=i.items.find((r=>r.id===e||r.id===t));return o?{...s,[n]:o}:s}),{}):{},l=(e,t,r)=>{if(!e||!r)return{record:e};const s={unified:{...e},..."object"==typeof r?r:{}},n={},i=[],o={...e};for(const r of t){const{error:t,value:a}=d(s,e.id,r);t?i.push(t):r.isUnified?o[r.targetFieldKey]=a:n[r.targetFieldKey]=a}return{record:{...o,unified_custom_fields:Object.keys(n).length>0?n:void 0},errors:i.length>0?i:void 0}},d=(e,r,s)=>{const{expression:n,targetFieldKey:i}=s;if(!n)return{error:{message:"Expression is empty",id:r,targetField:i}};try{t.parse(n)}catch(e){return{error:{message:"Invalid JSON path expression",id:r,targetField:i}}}const o=n&&t.query(e,n)[0];return o?{value:o}:{error:{message:"Expression returned no value",id:r,targetField:i}}},p=e=>null!=e,y=e=>"string"==typeof e,f=e=>e instanceof Date,h="yyyy-MM-dd",m=["yyyy-MM-dd","yyyy/MM/dd","dd/MM/yyyy","dd-MM-yyyy","yyyy-dd-MM","yyyy/dd/MM","MM/dd/yyyy","MM-dd-yyyy"],g=({value:e})=>{const t=r.parseISO(e);if(r.isValid(t))return t;const s=new Date;for(const t of m){const n=r.parse(e,t,s);if(r.isValid(n))return n.setUTCHours(0,0,0,0),n}return null},b=({value:e,format:t=h})=>{const s=(({value:e,format:t=h})=>{if(f(e))return e;if(!y(e))return null;try{const s=r.parse(e,t,new Date);return r.isValid(s)?s:g({value:e})}catch(e){return null}})({value:e,format:t});return s?s.toISOString():null};var v;!function(e){e.String="string",e.Number="number",e.Boolean="boolean",e.DateTimeString="datetime_string"}(v||(v={}));const O=({value:e,type:t,format:r})=>{if((e=>null==e||""===e)(e))return null;switch(t){case v.String:return(({value:e})=>y(e)?e:f(e)?e.toISOString():(e=>"object"==typeof e&&null!==e)(e)?JSON.stringify(e):String(e))({value:e});case v.Number:return(({value:e})=>{if((e=>"number"==typeof e)(e))return e;if(f(e))return null;const t=Number(e);return isNaN(t)?null:t})({value:e});case v.Boolean:return(({value:e})=>(e=>"boolean"==typeof e)(e)?e:"false"!==e&&"0"!==e&&0!==e&&Boolean(e))({value:e});case v.DateTimeString:return b({value:e,format:r});default:return e}},M=async({block:e})=>{const t=e?.fieldConfigs;if(!t||"disabled"===e?.debug?.custom_mappings)return e;let r;return r=Array.isArray(e.result)?e.result.map((e=>k(e,t))):k(e.result,t),{...e,result:r}},k=(e,t)=>{const r={...e};return t.forEach((t=>{const{targetFieldKey:s,type:n}=t;(e=>Object.values(v).includes(e))(n)&&(t.isUnified&&p(r[s])?r[s]=O({value:e[s],type:n}):r.unified_custom_fields&&p(r.unified_custom_fields?.[s])&&(r.unified_custom_fields[s]=O({value:e.unified_custom_fields?.[s],type:n})))})),{...r}},j=async({block:e})=>{const t=e?.fieldConfigs,r=[],s=e.steps;if(!t||"disabled"===e?.debug?.custom_mappings||!s)return e;let n;if(Array.isArray(e.result)){const i=e.result.length;n=e.result.map(((e,n)=>{const o=_(s,i,n),a=S(e,t,o);return r.push(...a.errors||[]),a.record}))}else{const i=S(e.result,t,s);n=i.record,r.push(...i.errors||[])}return{...e,result:n,customMappingErrors:Object.keys(r).length>0?r:void 0}},_=(e,t,r)=>Object.entries(e).reduce(((e,[s,n])=>{const i=n.output.data;return Array.isArray(i)&&i.length===t?e[s]={output:{data:i[r]}}:e[s]=n,e}),{}),S=(e,t,r)=>{if(!e||!r)return{record:e};const s={unified:{...e},..."object"==typeof r?r:{}},n={},i=[],o={...e};for(const r of t){const{error:t,value:a}=F(s,e.id,r);t?i.push(t):r.isUnified?o[r.targetFieldKey]=a:n[r.targetFieldKey]=a}return{record:{...o,unified_custom_fields:Object.keys(n).length>0?n:void 0},errors:i.length>0?i:void 0}},F=(e,r,s)=>{const{expression:n,targetFieldKey:i}=s;if(!n)return{error:{message:"Expression is empty",id:r,targetField:i}};try{t.parse(n)}catch(e){return{error:{message:"Invalid JSON path expression",id:r,targetField:i}}}const o=n&&t.query(e,n)[0];return void 0===o?{error:{message:"Expression returned no value",id:r,targetField:i}}:{value:o}},A={build({type:e}){switch(e){case o.MAP:return u;case o.TYPECAST:return M;case o.MAP_FIELDS:return j;default:throw new Error(`Unknown block step: ${e}`)}}},E=({fieldConfigs:e})=>{const t=[];return e&&t.push(A.build({type:o.MAP}),A.build({type:o.TYPECAST})),t};export{n as BaseConnector,o as BlockStepType,A as BlockStepsFactory,i as REQUEST_BODY_PARAM,a as blockPipe,E as getBlockPipeStepsFromConfigs};
1
+ import e from"jsonpath";import{isDate as r,isString as t,isBoolean as s,isNumber as n,isObject as i,isMissing as o,notMissing as u}from"@stackone/utils";import*as a from"date-fns";var l;!function(e){e.MAP="map",e.TYPECAST="typecast",e.MAP_FIELDS="map_fields"}(l||(l={}));const d=async({stepFunctions:e,block:r})=>e.reduce((async(e,r)=>r({block:await e})),Promise.resolve(r)),c=async({block:e})=>{const r=e?.fieldConfigs,t=[];if(!r||"disabled"===e?.debug?.custom_mappings)return e;let s;const n=e.providerData,i=e.context.childResource??e.context.subResource??e.context.resource;if(Array.isArray(e.result))s=e.result.map((e=>{const s=n?.[i]?.items;if(!s)return e;const o=y(e.id,e.remote_id,n),u=f(e,r,o);return t.push(...u.errors||[]),u.record}));else{const i=f(e.result,r,n);s=i.record,t.push(...i.errors||[])}return{...e,result:s,customMappingErrors:Object.keys(t).length>0?t:void 0}},y=(e,r,t)=>t?Object.keys(t).reduce(((s,n)=>{const i=t[n];if(!i.items)return s;const o=i.items.find((t=>t.id===e||t.id===r));return o?{...s,[n]:o}:s}),{}):{},f=(e,r,t)=>{if(!e||!t)return{record:e};const s={unified:{...e},..."object"==typeof t?t:{}},n={},i=[],o={...e};for(const t of r){const{error:r,value:u}=p(s,e.id,t);r?i.push(r):t.isUnified?o[t.targetFieldKey]=u:n[t.targetFieldKey]=u}return{record:{...o,unified_custom_fields:Object.keys(n).length>0?n:void 0},errors:i.length>0?i:void 0}},p=(r,t,s)=>{const{expression:n,targetFieldKey:i}=s;if(!n)return{error:{message:"Expression is empty",id:t,targetField:i}};try{e.parse(n)}catch(e){return{error:{message:"Invalid JSON path expression",id:t,targetField:i}}}const o=n&&e.query(r,n)[0];return o?{value:o}:{error:{message:"Expression returned no value",id:t,targetField:i}}},m=async({block:e})=>{const r=e?.fieldConfigs,t=[],s=e.steps;if(!r||"disabled"===e?.debug?.custom_mappings||!s)return e;let n;if(Array.isArray(e.result)){const i=e.result.length;n=e.result.map(((e,n)=>{const o=g(s,i,n),u=v(e,r,o);return t.push(...u.errors||[]),u.record}))}else{const i=v(e.result,r,s);n=i.record,t.push(...i.errors||[])}return{...e,result:n,customMappingErrors:Object.keys(t).length>0?t:void 0}},g=(e,r,t)=>Object.entries(e).reduce(((e,[s,n])=>{const i=n.output.data;return Array.isArray(i)&&i.length===r?e[s]={output:{data:i[t]}}:e[s]=n,e}),{}),v=(e,r,t)=>{if(!e||!t)return{record:e};const s={unified:{...e},..."object"==typeof t?t:{}},n={},i=[],o={...e};for(const t of r){const{error:r,value:u}=b(s,e.id,t);r?i.push(r):t.isUnified?o[t.targetFieldKey]=u:n[t.targetFieldKey]=u}return{record:{...o,unified_custom_fields:Object.keys(n).length>0?n:void 0},errors:i.length>0?i:void 0}},b=(r,t,s)=>{const{expression:n,targetFieldKey:i}=s;if(!n)return{error:{message:"Expression is empty",id:t,targetField:i}};try{e.parse(n)}catch(e){return{error:{message:"Invalid JSON path expression",id:t,targetField:i}}}const o=n&&e.query(r,n)[0];return void 0===o?{error:{message:"Expression returned no value",id:t,targetField:i}}:{value:o}},h="yyyy-MM-dd",M=["yyyy-MM-dd","yyyy/MM/dd","dd/MM/yyyy","dd-MM-yyyy","yyyy-dd-MM","yyyy/dd/MM","MM/dd/yyyy","MM-dd-yyyy"],_=({value:e})=>{const r=a.parseISO(e);if(a.isValid(r))return r;const t=new Date;for(const r of M){const s=a.parse(e,r,t);if(a.isValid(s))return s.setUTCHours(0,0,0,0),s}return null},S=({value:e,format:s=h})=>{const n=(({value:e,format:s=h})=>{if(r(e))return e;if(!t(e))return null;try{const r=a.parse(e,s,new Date);return a.isValid(r)?r:_({value:e})}catch(e){return null}})({value:e,format:s});return n?n.toISOString():null};var A;!function(e){e.String="string",e.Number="number",e.Boolean="boolean",e.DateTimeString="datetime_string"}(A||(A={}));const F=({value:e,type:u,format:a})=>{if(o(e))return null;switch(u){case A.String:return(({value:e})=>t(e)?e:r(e)?e.toISOString():i(e)?JSON.stringify(e):String(e))({value:e});case A.Number:return(({value:e})=>{if(n(e))return e;if(r(e))return null;const t=Number(e);return isNaN(t)?null:t})({value:e});case A.Boolean:return(({value:e})=>s(e)?e:"false"!==e&&"0"!==e&&0!==e&&Boolean(e))({value:e});case A.DateTimeString:return S({value:e,format:a});default:return e}},E=async({block:e})=>{const r=e?.fieldConfigs;if(!r||"disabled"===e?.debug?.custom_mappings)return e;let t;return t=Array.isArray(e.result)?e.result.map((e=>O(e,r))):O(e.result,r),{...e,result:t}},O=(e,r)=>{const t={...e};return r.forEach((r=>{const{targetFieldKey:s,type:n}=r;(e=>Object.values(A).includes(e))(n)&&(r.isUnified&&u(t[s])?t[s]=F({value:e[s],type:n}):t.unified_custom_fields&&u(t.unified_custom_fields?.[s])&&(t.unified_custom_fields[s]=F({value:e.unified_custom_fields?.[s],type:n})))})),{...t}},k={build({functionName:e}){switch(e){case l.MAP:return c;case l.TYPECAST:return E;case l.MAP_FIELDS:return m;default:throw new Error(`Unknown step function: ${e}`)}}},x=({fieldConfigs:e})=>{const r=[];return e&&r.push(k.build({functionName:l.MAP}),k.build({functionName:l.TYPECAST})),r};export{l as StepFunctionName,k as StepFunctionsFactory,x as getFieldMappingStepFunctions,d as stepsBasicPipeRunner};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("@stackone/transport"),t=require("jsonpath");function r(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var s=r(require("date-fns"));const n=(e,t="")=>{if("object"===e.type&&e.properties){const r=""===t||t.endsWith(".")?t:`${t}.`;return Object.entries(e.properties).flatMap((([e,t])=>n(t,`${r}${e}`)))}return"array"===e.type&&e.items?n(e.items,`${t}[].`):[{name:t.endsWith(".")?t.slice(0,-1):t,type:e.type,description:e.description}]};var o;exports.BlockStepType=void 0,(o=exports.BlockStepType||(exports.BlockStepType={})).MAP="map",o.TYPECAST="typecast",o.MAP_FIELDS="map_fields";const i=async({block:e})=>{const t=e?.fieldConfigs,r=[];if(!t||"disabled"===e?.debug?.custom_mappings)return e;let s;const n=e.providerData,o=e.context.childResource??e.context.subResource??e.context.resource;if(Array.isArray(e.result))s=e.result.map((e=>{const s=n?.[o]?.items;if(!s)return e;const i=a(e.id,e.remote_id,n),c=u(e,t,i);return r.push(...c.errors||[]),c.record}));else{const o=u(e.result,t,n);s=o.record,r.push(...o.errors||[])}return{...e,result:s,customMappingErrors:Object.keys(r).length>0?r:void 0}},a=(e,t,r)=>r?Object.keys(r).reduce(((s,n)=>{const o=r[n];if(!o.items)return s;const i=o.items.find((r=>r.id===e||r.id===t));return i?{...s,[n]:i}:s}),{}):{},u=(e,t,r)=>{if(!e||!r)return{record:e};const s={unified:{...e},..."object"==typeof r?r:{}},n={},o=[],i={...e};for(const r of t){const{error:t,value:a}=c(s,e.id,r);t?o.push(t):r.isUnified?i[r.targetFieldKey]=a:n[r.targetFieldKey]=a}return{record:{...i,unified_custom_fields:Object.keys(n).length>0?n:void 0},errors:o.length>0?o:void 0}},c=(e,r,s)=>{const{expression:n,targetFieldKey:o}=s;if(!n)return{error:{message:"Expression is empty",id:r,targetField:o}};try{t.parse(n)}catch(e){return{error:{message:"Invalid JSON path expression",id:r,targetField:o}}}const i=n&&t.query(e,n)[0];return i?{value:i}:{error:{message:"Expression returned no value",id:r,targetField:o}}},l=e=>null!=e,p=e=>"string"==typeof e,d=e=>e instanceof Date,y="yyyy-MM-dd",f=["yyyy-MM-dd","yyyy/MM/dd","dd/MM/yyyy","dd-MM-yyyy","yyyy-dd-MM","yyyy/dd/MM","MM/dd/yyyy","MM-dd-yyyy"],h=({value:e})=>{const t=s.parseISO(e);if(s.isValid(t))return t;const r=new Date;for(const t of f){const n=s.parse(e,t,r);if(s.isValid(n))return n.setUTCHours(0,0,0,0),n}return null},m=({value:e,format:t=y})=>{const r=(({value:e,format:t=y})=>{if(d(e))return e;if(!p(e))return null;try{const r=s.parse(e,t,new Date);return s.isValid(r)?r:h({value:e})}catch(e){return null}})({value:e,format:t});return r?r.toISOString():null};var g;!function(e){e.String="string",e.Number="number",e.Boolean="boolean",e.DateTimeString="datetime_string"}(g||(g={}));const b=({value:e,type:t,format:r})=>{if((e=>null==e||""===e)(e))return null;switch(t){case g.String:return(({value:e})=>p(e)?e:d(e)?e.toISOString():(e=>"object"==typeof e&&null!==e)(e)?JSON.stringify(e):String(e))({value:e});case g.Number:return(({value:e})=>{if((e=>"number"==typeof e)(e))return e;if(d(e))return null;const t=Number(e);return isNaN(t)?null:t})({value:e});case g.Boolean:return(({value:e})=>(e=>"boolean"==typeof e)(e)?e:"false"!==e&&"0"!==e&&0!==e&&Boolean(e))({value:e});case g.DateTimeString:return m({value:e,format:r});default:return e}},v=async({block:e})=>{const t=e?.fieldConfigs;if(!t||"disabled"===e?.debug?.custom_mappings)return e;let r;return r=Array.isArray(e.result)?e.result.map((e=>O(e,t))):O(e.result,t),{...e,result:r}},O=(e,t)=>{const r={...e};return t.forEach((t=>{const{targetFieldKey:s,type:n}=t;(e=>Object.values(g).includes(e))(n)&&(t.isUnified&&l(r[s])?r[s]=b({value:e[s],type:n}):r.unified_custom_fields&&l(r.unified_custom_fields?.[s])&&(r.unified_custom_fields[s]=b({value:e.unified_custom_fields?.[s],type:n})))})),{...r}},k=async({block:e})=>{const t=e?.fieldConfigs,r=[],s=e.steps;if(!t||"disabled"===e?.debug?.custom_mappings||!s)return e;let n;if(Array.isArray(e.result)){const o=e.result.length;n=e.result.map(((e,n)=>{const i=S(s,o,n),a=M(e,t,i);return r.push(...a.errors||[]),a.record}))}else{const o=M(e.result,t,s);n=o.record,r.push(...o.errors||[])}return{...e,result:n,customMappingErrors:Object.keys(r).length>0?r:void 0}},S=(e,t,r)=>Object.entries(e).reduce(((e,[s,n])=>{const o=n.output.data;return Array.isArray(o)&&o.length===t?e[s]={output:{data:o[r]}}:e[s]=n,e}),{}),M=(e,t,r)=>{if(!e||!r)return{record:e};const s={unified:{...e},..."object"==typeof r?r:{}},n={},o=[],i={...e};for(const r of t){const{error:t,value:a}=j(s,e.id,r);t?o.push(t):r.isUnified?i[r.targetFieldKey]=a:n[r.targetFieldKey]=a}return{record:{...i,unified_custom_fields:Object.keys(n).length>0?n:void 0},errors:o.length>0?o:void 0}},j=(e,r,s)=>{const{expression:n,targetFieldKey:o}=s;if(!n)return{error:{message:"Expression is empty",id:r,targetField:o}};try{t.parse(n)}catch(e){return{error:{message:"Invalid JSON path expression",id:r,targetField:o}}}const i=n&&t.query(e,n)[0];return void 0===i?{error:{message:"Expression returned no value",id:r,targetField:o}}:{value:i}},x={build({type:e}){switch(e){case exports.BlockStepType.MAP:return i;case exports.BlockStepType.TYPECAST:return v;case exports.BlockStepType.MAP_FIELDS:return k;default:throw new Error(`Unknown block step: ${e}`)}}};exports.BaseConnector=class{constructor({version:t="1",key:r,name:s,services:o={},httpOperations:i={},auth:a,proxy:u,httpClient:c=new e.HttpClient}){this.listOperations=()=>Object.keys(this.httpOperations||{}),this.getOperation=e=>{const t=this.httpOperations?.[e];if(!t)throw new Error(`Operation ${e} not found`);return t},this.getOperationResponseFieldsMetadata=e=>{const t=this.getOperation(e).responses;if(!t)return null;const r=(e=>{const t=Object.entries(e).find((([e])=>e.startsWith("2")));return t?t[1]:null})(t);return r?.content["application/json"]?.schema?n(r.content["application/json"]?.schema):null},this.getOperationRequestFieldsMetadata=e=>this.getOperation(e).parameters,this.callOperation=async({operationId:e,params:t,credentials:r})=>{const s=this.httpOperations?.[e];if(!s)throw new Error(`Operation ${e} not found`);const n=(({params:e,httpOperation:t})=>{const{url:r,method:s}=t;let n=r;const o=[],i=[],a={};let u;Object.entries(e||{}).forEach((([e,r])=>{const s=t.parameters?.[e];if(s)switch(s.in){case"path":n=n.replace(`{${e}}`,r).replace(`:${e}`,r);break;case"query":o.push(`${e}=${r}`);break;case"header":a[e]=r;break;case"cookie":i.push(`${e}=${r}; `);break;case"body":u=r}}));const c=o.length>0?`?${o.join("&")}`:"";return i.length>0&&(a.cookie=i.join("")),{url:`${n}${c}`,method:s,headers:Object.keys(a).length>0?a:void 0,body:u||void 0}})({params:t,httpOperation:s}),{method:o,url:i,headers:a,body:u}=n,{apiKey:c}=r;return{connector:this,input:{operationId:e,params:t},response:await this.httpClient.request({method:o,url:i,headers:{...a,authorization:c},payload:u}),credentials:r}},this.version=t,this.key=r,this.name=s,this.services=o,this.httpOperations=i,this.auth=a,this.proxy=u,this.httpClient=c}},exports.BlockStepsFactory=x,exports.REQUEST_BODY_PARAM="request_body",exports.blockPipe=async({blockSteps:e,block:t})=>e.reduce((async(e,t)=>t({block:await e})),Promise.resolve(t)),exports.getBlockPipeStepsFromConfigs=({fieldConfigs:e})=>{const t=[];return e&&t.push(x.build({type:exports.BlockStepType.MAP}),x.build({type:exports.BlockStepType.TYPECAST})),t};
1
+ "use strict";var e=require("jsonpath"),r=require("@stackone/utils");function t(e){var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,s.get?s:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var s,n=t(require("date-fns"));exports.StepFunctionName=void 0,(s=exports.StepFunctionName||(exports.StepFunctionName={})).MAP="map",s.TYPECAST="typecast",s.MAP_FIELDS="map_fields";const i=async({block:e})=>{const r=e?.fieldConfigs,t=[];if(!r||"disabled"===e?.debug?.custom_mappings)return e;let s;const n=e.providerData,i=e.context.childResource??e.context.subResource??e.context.resource;if(Array.isArray(e.result))s=e.result.map((e=>{const s=n?.[i]?.items;if(!s)return e;const a=o(e.id,e.remote_id,n),c=u(e,r,a);return t.push(...c.errors||[]),c.record}));else{const i=u(e.result,r,n);s=i.record,t.push(...i.errors||[])}return{...e,result:s,customMappingErrors:Object.keys(t).length>0?t:void 0}},o=(e,r,t)=>t?Object.keys(t).reduce(((s,n)=>{const i=t[n];if(!i.items)return s;const o=i.items.find((t=>t.id===e||t.id===r));return o?{...s,[n]:o}:s}),{}):{},u=(e,r,t)=>{if(!e||!t)return{record:e};const s={unified:{...e},..."object"==typeof t?t:{}},n={},i=[],o={...e};for(const t of r){const{error:r,value:u}=a(s,e.id,t);r?i.push(r):t.isUnified?o[t.targetFieldKey]=u:n[t.targetFieldKey]=u}return{record:{...o,unified_custom_fields:Object.keys(n).length>0?n:void 0},errors:i.length>0?i:void 0}},a=(r,t,s)=>{const{expression:n,targetFieldKey:i}=s;if(!n)return{error:{message:"Expression is empty",id:t,targetField:i}};try{e.parse(n)}catch(e){return{error:{message:"Invalid JSON path expression",id:t,targetField:i}}}const o=n&&e.query(r,n)[0];return o?{value:o}:{error:{message:"Expression returned no value",id:t,targetField:i}}},c=async({block:e})=>{const r=e?.fieldConfigs,t=[],s=e.steps;if(!r||"disabled"===e?.debug?.custom_mappings||!s)return e;let n;if(Array.isArray(e.result)){const i=e.result.length;n=e.result.map(((e,n)=>{const o=l(s,i,n),u=d(e,r,o);return t.push(...u.errors||[]),u.record}))}else{const i=d(e.result,r,s);n=i.record,t.push(...i.errors||[])}return{...e,result:n,customMappingErrors:Object.keys(t).length>0?t:void 0}},l=(e,r,t)=>Object.entries(e).reduce(((e,[s,n])=>{const i=n.output.data;return Array.isArray(i)&&i.length===r?e[s]={output:{data:i[t]}}:e[s]=n,e}),{}),d=(e,r,t)=>{if(!e||!t)return{record:e};const s={unified:{...e},..."object"==typeof t?t:{}},n={},i=[],o={...e};for(const t of r){const{error:r,value:u}=p(s,e.id,t);r?i.push(r):t.isUnified?o[t.targetFieldKey]=u:n[t.targetFieldKey]=u}return{record:{...o,unified_custom_fields:Object.keys(n).length>0?n:void 0},errors:i.length>0?i:void 0}},p=(r,t,s)=>{const{expression:n,targetFieldKey:i}=s;if(!n)return{error:{message:"Expression is empty",id:t,targetField:i}};try{e.parse(n)}catch(e){return{error:{message:"Invalid JSON path expression",id:t,targetField:i}}}const o=n&&e.query(r,n)[0];return void 0===o?{error:{message:"Expression returned no value",id:t,targetField:i}}:{value:o}},y="yyyy-MM-dd",f=["yyyy-MM-dd","yyyy/MM/dd","dd/MM/yyyy","dd-MM-yyyy","yyyy-dd-MM","yyyy/dd/MM","MM/dd/yyyy","MM-dd-yyyy"],g=({value:e})=>{const r=n.parseISO(e);if(n.isValid(r))return r;const t=new Date;for(const r of f){const s=n.parse(e,r,t);if(n.isValid(s))return s.setUTCHours(0,0,0,0),s}return null},m=({value:e,format:t=y})=>{const s=(({value:e,format:t=y})=>{if(r.isDate(e))return e;if(!r.isString(e))return null;try{const r=n.parse(e,t,new Date);return n.isValid(r)?r:g({value:e})}catch(e){return null}})({value:e,format:t});return s?s.toISOString():null};var v;!function(e){e.String="string",e.Number="number",e.Boolean="boolean",e.DateTimeString="datetime_string"}(v||(v={}));const b=({value:e,type:t,format:s})=>{if(r.isMissing(e))return null;switch(t){case v.String:return(({value:e})=>r.isString(e)?e:r.isDate(e)?e.toISOString():r.isObject(e)?JSON.stringify(e):String(e))({value:e});case v.Number:return(({value:e})=>{if(r.isNumber(e))return e;if(r.isDate(e))return null;const t=Number(e);return isNaN(t)?null:t})({value:e});case v.Boolean:return(({value:e})=>r.isBoolean(e)?e:"false"!==e&&"0"!==e&&0!==e&&Boolean(e))({value:e});case v.DateTimeString:return m({value:e,format:s});default:return e}},S=async({block:e})=>{const r=e?.fieldConfigs;if(!r||"disabled"===e?.debug?.custom_mappings)return e;let t;return t=Array.isArray(e.result)?e.result.map((e=>M(e,r))):M(e.result,r),{...e,result:t}},M=(e,t)=>{const s={...e};return t.forEach((t=>{const{targetFieldKey:n,type:i}=t;(e=>Object.values(v).includes(e))(i)&&(t.isUnified&&r.notMissing(s[n])?s[n]=b({value:e[n],type:i}):s.unified_custom_fields&&r.notMissing(s.unified_custom_fields?.[n])&&(s.unified_custom_fields[n]=b({value:e.unified_custom_fields?.[n],type:i})))})),{...s}},F={build({functionName:e}){switch(e){case exports.StepFunctionName.MAP:return i;case exports.StepFunctionName.TYPECAST:return S;case exports.StepFunctionName.MAP_FIELDS:return c;default:throw new Error(`Unknown step function: ${e}`)}}};exports.StepFunctionsFactory=F,exports.getFieldMappingStepFunctions=({fieldConfigs:e})=>{const r=[];return e&&r.push(F.build({functionName:exports.StepFunctionName.MAP}),F.build({functionName:exports.StepFunctionName.TYPECAST})),r},exports.stepsBasicPipeRunner=async({stepFunctions:e,block:r})=>e.reduce((async(e,r)=>r({block:await e})),Promise.resolve(r));
@@ -1,11 +1,11 @@
1
- import { HttpMethod } from '@stackone/transport';
2
- import { BlockStepType } from './steps/stepsDirectoryTypes';
1
+ import type { HttpMethod } from '@stackone/transport';
2
+ import type { StepsSnapshots } from '../steps/types';
3
3
  export type Block = {
4
- fieldConfigs?: BlockFieldConfig[];
4
+ fieldConfigs?: FieldConfig[];
5
5
  result?: BlockIndexedRecord[] | BlockIndexedRecord;
6
6
  context: BlockContext;
7
- debug?: BlockDebugParams;
8
- steps?: BlockStepSnapshots;
7
+ debug?: DebugParams;
8
+ steps?: StepsSnapshots;
9
9
  customMappingErrors?: FieldMappingError[];
10
10
  providerData?: ProviderData;
11
11
  };
@@ -27,37 +27,15 @@ export type BlockIndexedRecord = {
27
27
  [key: string]: unknown;
28
28
  };
29
29
  };
30
- export type BlockFieldConfig = {
30
+ export type FieldConfig = {
31
31
  expression?: string;
32
32
  targetFieldKey: string;
33
33
  type: string;
34
34
  isUnified?: boolean;
35
35
  };
36
- export type BlockStep = ({ block, params, }: {
37
- block: Readonly<Block>;
38
- params?: BlockStepParams;
39
- }) => Promise<Block>;
40
- export type BlockStepParams = {
41
- [key: string]: unknown;
42
- };
43
- export type BlockDebugParams = {
36
+ export type DebugParams = {
44
37
  custom_mappings?: 'disabled' | 'enabled';
45
38
  };
46
- export type BlockStepDefinition = {
47
- name: BlockStepType;
48
- params?: BlockStepParams;
49
- };
50
- export type BlockStepSnapshot = {
51
- output: {
52
- data: unknown;
53
- matcher?: string;
54
- };
55
- errors?: BlockStepError[];
56
- };
57
- export type BlockStepSnapshots = {
58
- [key: string]: BlockStepSnapshot;
59
- };
60
- export type BlockStepError = FieldMappingError;
61
39
  export type ProviderData = {
62
40
  [key: string]: ProviderDataObject;
63
41
  };
@@ -1,8 +1,6 @@
1
- export { IConnector, HttpOperations, HttpParameter, HttpParameterLocation, HttpParameterType, } from './types';
2
- export { BaseConnector } from './baseConnector';
3
- export { REQUEST_BODY_PARAM } from './constants';
4
- export { Block, BlockStep, BlockIndexedRecord, BlockContext, BlockFieldConfig, BlockStepDefinition, BlockStepParams, BlockStepSnapshots, BlockStepSnapshot, } from './blocks/types';
5
- export { BlockStepType } from './blocks/steps/stepsDirectoryTypes';
6
- export { blockPipe } from './blocks/blockPipe';
7
- export { getBlockPipeStepsFromConfigs } from './blocks/blockStepsConfigs';
8
- export { BlockStepsFactory } from './blocks/blockStepsFactory';
1
+ export { Block, BlockIndexedRecord, BlockContext, FieldConfig, } from './blocks/types';
2
+ export { StepFunction, StepFunctionParams, StepFunctionName } from './stepFunctions/types';
3
+ export { StepsSnapshots } from './steps/types';
4
+ export { stepsBasicPipeRunner } from './steps/stepsRunners';
5
+ export { getFieldMappingStepFunctions } from './stepFunctions/getFieldMappingStepFunctions';
6
+ export { StepFunctionsFactory } from './stepFunctions/factory';
@@ -0,0 +1,7 @@
1
+ import { StepFunctionName } from './types';
2
+ import type { StepFunction } from './types';
3
+ export declare const StepFunctionsFactory: {
4
+ build({ functionName }: {
5
+ functionName: StepFunctionName;
6
+ }): StepFunction;
7
+ };
@@ -0,0 +1,5 @@
1
+ import type { FieldConfig } from '../blocks/types';
2
+ import { type StepFunction } from './types';
3
+ export declare const getFieldMappingStepFunctions: ({ fieldConfigs, }: {
4
+ fieldConfigs?: FieldConfig[];
5
+ }) => StepFunction[];
@@ -0,0 +1,2 @@
1
+ import type { StepFunction } from '../types';
2
+ export declare const mapStepFunction: StepFunction;
@@ -0,0 +1,2 @@
1
+ import type { StepFunction } from '../types';
2
+ export declare const mapFieldsStepFunction: StepFunction;
@@ -9,9 +9,9 @@ export declare const safeParseToBoolean: ({ value, }: {
9
9
  }) => boolean | null;
10
10
  export declare const safeParseToDateTime: ({ value, format, }: {
11
11
  value: unknown;
12
- format?: string | undefined;
12
+ format?: string;
13
13
  }) => Date | null;
14
14
  export declare const safeParseToDateTimeString: ({ value, format, }: {
15
15
  value: unknown;
16
- format?: string | undefined;
16
+ format?: string;
17
17
  }) => string | null;
@@ -1,6 +1,6 @@
1
1
  export declare const typecast: ({ value, type, format, }: {
2
2
  value: unknown;
3
3
  type: string;
4
- format?: string | undefined;
4
+ format?: string;
5
5
  }) => unknown;
6
6
  export declare const isFieldSupportedType: (type: string) => boolean;
@@ -0,0 +1,2 @@
1
+ import type { StepFunction } from '../types';
2
+ export declare const typecastStepFunction: StepFunction;
@@ -0,0 +1,13 @@
1
+ import type { Block } from '../blocks/types';
2
+ export declare enum StepFunctionName {
3
+ MAP = "map",
4
+ TYPECAST = "typecast",
5
+ MAP_FIELDS = "map_fields"
6
+ }
7
+ export type StepFunction = ({ block, params, }: {
8
+ block: Readonly<Block>;
9
+ params?: StepFunctionParams;
10
+ }) => Promise<Block>;
11
+ export type StepFunctionParams = {
12
+ [key: string]: unknown;
13
+ };
@@ -0,0 +1,6 @@
1
+ import type { Block } from '../blocks/types';
2
+ import type { StepFunction } from '../stepFunctions/types';
3
+ export declare const stepsBasicPipeRunner: ({ stepFunctions, block, }: {
4
+ stepFunctions: StepFunction[];
5
+ block: Block;
6
+ }) => Promise<Block>;
@@ -0,0 +1,13 @@
1
+ export type StepSnapshot = {
2
+ output: {
3
+ data: unknown;
4
+ matcher?: string;
5
+ };
6
+ errors?: StepError[];
7
+ };
8
+ export type StepsSnapshots = {
9
+ [key: string]: StepSnapshot;
10
+ };
11
+ export type StepError = {
12
+ message: string;
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackone/core",
3
- "version": "1.15.0",
3
+ "version": "1.17.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -16,8 +16,14 @@
16
16
  "build": "rollup -c --environment NODE_ENV:production",
17
17
  "prebuild:dev": "npm run clean",
18
18
  "build:dev": "rollup -c --environment NODE_ENV:development",
19
- "lint": "tsc --project tsconfig.json && eslint \"src/**/*.ts\"",
20
- "lint:fix": "npm run lint -- --fix",
19
+ "code:format": "biome format ./src ./*.mjs",
20
+ "code:format:fix": "biome format --write ./src ./*.mjs",
21
+ "code:lint": "biome lint --error-on-warnings ./src ./*.mjs",
22
+ "code:lint:fix": "biome lint --write ./src ./*.mjs",
23
+ "code:check": "biome check ./src ./*.mjs",
24
+ "code:check:fix": "biome check --write ./src ./*.mjs",
25
+ "lint": "npm run code:check",
26
+ "lint:fix": "npm run code:check:fix",
21
27
  "test": "vitest run --silent",
22
28
  "test:watch": "vitest watch --silent",
23
29
  "publish-release": "npm publish --access=public"
@@ -27,6 +33,7 @@
27
33
  "license": "ISC",
28
34
  "dependencies": {
29
35
  "@stackone/transport": "*",
36
+ "@stackone/utils": "*",
30
37
  "date-fns": "^3.4.0",
31
38
  "jsonpath": "^1.1.1"
32
39
  },
@@ -1,43 +0,0 @@
1
- import { IHttpClient } from '@stackone/transport';
2
- import { Bundle, HttpOperation, HttpOperations, HttpParameter, IConnector, Operation, ResponseFieldMetaData, Service } from './types';
3
- export declare abstract class BaseConnector implements IConnector {
4
- protected httpClient: IHttpClient;
5
- version: string;
6
- key: string;
7
- name: string;
8
- services: {
9
- ats?: Service | undefined;
10
- crm?: Service | undefined;
11
- hris?: Service | undefined;
12
- marketing?: Service | undefined;
13
- };
14
- httpOperations?: HttpOperations;
15
- auth?: unknown;
16
- proxy?: Operation;
17
- constructor({ version, key, name, services, httpOperations, auth, proxy, httpClient, }: {
18
- version?: string;
19
- key: string;
20
- name: string;
21
- services?: {
22
- ats?: Service | undefined;
23
- crm?: Service | undefined;
24
- hris?: Service | undefined;
25
- marketing?: Service | undefined;
26
- };
27
- httpOperations?: HttpOperations;
28
- auth?: unknown;
29
- proxy?: Operation;
30
- httpClient?: IHttpClient;
31
- });
32
- listOperations: () => string[];
33
- getOperation: (operationId: string) => HttpOperation;
34
- getOperationResponseFieldsMetadata: (operationId: string) => ResponseFieldMetaData[] | null;
35
- getOperationRequestFieldsMetadata: (operationId: string) => {
36
- [key: string]: HttpParameter;
37
- } | undefined;
38
- callOperation: ({ operationId, params, credentials, }: {
39
- operationId: string;
40
- params?: Record<string, unknown> | undefined;
41
- credentials?: unknown;
42
- }) => Promise<Bundle>;
43
- }
@@ -1,5 +0,0 @@
1
- import type { Block, BlockStep } from './types';
2
- export declare const blockPipe: ({ blockSteps, block, }: {
3
- blockSteps: BlockStep[];
4
- block: Block;
5
- }) => Promise<Block>;
@@ -1,4 +0,0 @@
1
- import type { BlockFieldConfig, BlockStep } from './types';
2
- export declare const getBlockPipeStepsFromConfigs: ({ fieldConfigs, }: {
3
- fieldConfigs?: BlockFieldConfig[] | undefined;
4
- }) => BlockStep[];
@@ -1,7 +0,0 @@
1
- import { BlockStepType } from './steps/stepsDirectoryTypes';
2
- import type { BlockStep } from './types';
3
- export declare const BlockStepsFactory: {
4
- build({ type }: {
5
- type: BlockStepType;
6
- }): BlockStep;
7
- };
@@ -1,2 +0,0 @@
1
- import type { BlockStep } from '../../types';
2
- export declare const mapBlockStep: BlockStep;
@@ -1,2 +0,0 @@
1
- import type { BlockStep } from '../../types';
2
- export declare const mapFieldsBlockStep: BlockStep;
@@ -1,5 +0,0 @@
1
- export declare enum BlockStepType {
2
- MAP = "map",
3
- TYPECAST = "typecast",
4
- MAP_FIELDS = "map_fields"
5
- }
@@ -1,2 +0,0 @@
1
- import type { BlockStep } from '../../types';
2
- export declare const typecastBlockStep: BlockStep;
@@ -1 +0,0 @@
1
- export declare const REQUEST_BODY_PARAM = "request_body";
@@ -1,11 +0,0 @@
1
- import { HttpMethod } from '@stackone/transport';
2
- import { HttpOperation } from './types';
3
- export declare const mapParametersToHttpRequest: ({ params, httpOperation, }: {
4
- params?: Record<string, unknown> | undefined;
5
- httpOperation: HttpOperation;
6
- }) => {
7
- url: string;
8
- method: HttpMethod;
9
- headers?: Record<string, unknown> | undefined;
10
- body?: Record<string, unknown> | undefined;
11
- };
@@ -1,3 +0,0 @@
1
- import { HttpParameterSchema, HttpResponses, HttpSchemaResponse, ResponseFieldMetaData } from './types';
2
- export declare const getSuccessfulResponse: (responses: HttpResponses) => HttpSchemaResponse | null;
3
- export declare const getResponseFieldsMetaData: (schema: HttpParameterSchema, parentFieldKey?: string) => ResponseFieldMetaData[];
@@ -1,7 +0,0 @@
1
- export declare const notMissing: <T>(value: T | null | undefined) => value is T;
2
- export declare const isMissing: <T>(value: T | null | undefined) => boolean;
3
- export declare const isString: (value: unknown) => value is string;
4
- export declare const isNumber: (value: unknown) => value is number;
5
- export declare const isBoolean: (value: unknown) => value is boolean;
6
- export declare const isDate: (value: unknown) => value is Date;
7
- export declare const isObject: (value: unknown) => value is Record<string, unknown>;
@@ -1,90 +0,0 @@
1
- import { IHttpClient, HttpResponse, HttpMethod } from '@stackone/transport';
2
- export type RequestParameters = {
3
- id?: string | number;
4
- body?: Record<string, unknown>;
5
- [key: string]: unknown;
6
- };
7
- export type Operation = ({ input, credentials, getHttpClient, }: {
8
- input: RequestParameters;
9
- credentials?: unknown;
10
- getHttpClient?: () => Promise<IHttpClient>;
11
- }) => Promise<Bundle>;
12
- export interface Resource {
13
- [key: string]: Operation | Resource;
14
- }
15
- export interface Service {
16
- [key: string]: Resource;
17
- }
18
- export type Bundle = {
19
- connector: IConnector;
20
- input: RequestParameters;
21
- credentials: unknown;
22
- url?: string;
23
- response?: HttpResponse;
24
- };
25
- export type AuthenticationConfig = {
26
- [authentication: string]: Environment;
27
- };
28
- export type Environment = {
29
- default: AuthenticationConfig;
30
- production: AuthenticationConfig;
31
- } & {
32
- [environment: string]: AuthenticationConfig;
33
- };
34
- export type HttpParameterLocation = 'path' | 'query' | 'header' | 'cookie' | 'body';
35
- export type HttpParameterType = 'boolean' | 'object' | 'number' | 'string' | 'integer';
36
- export interface HttpParameter {
37
- in: HttpParameterLocation;
38
- type: HttpParameterType;
39
- isArray?: boolean;
40
- required?: boolean;
41
- }
42
- export type HttpResponses = {
43
- [key: string]: HttpSchemaResponse;
44
- };
45
- export type HttpSchemaResponse = {
46
- description: string;
47
- content: {
48
- [key: string]: {
49
- schema: HttpParameterSchema;
50
- };
51
- };
52
- };
53
- export type HttpParameterSchema = {
54
- type: string;
55
- description?: string;
56
- properties?: {
57
- [key: string]: HttpParameterSchema;
58
- };
59
- items?: HttpParameterSchema;
60
- };
61
- export type ResponseFieldMetaData = {
62
- name: string;
63
- type: HttpParameterType;
64
- description?: string;
65
- };
66
- export type HttpOperation = {
67
- url: string;
68
- method: HttpMethod;
69
- parameters?: {
70
- [key: string]: HttpParameter;
71
- };
72
- responses: HttpResponses;
73
- };
74
- export type HttpOperations = {
75
- [key: string]: HttpOperation;
76
- };
77
- export interface IConnector {
78
- version: string;
79
- key: string;
80
- name: string;
81
- services: {
82
- ats?: Service;
83
- crm?: Service;
84
- hris?: Service;
85
- marketing?: Service;
86
- };
87
- httpOperations?: HttpOperations;
88
- auth?: unknown;
89
- proxy?: Operation;
90
- }