@stackone/core 1.7.0 → 1.8.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{HttpClient as t}from"@stackone/transport";import e from"jsonpath";import*as r from"date-fns";const n=(t,e="")=>{if("object"===t.type&&t.properties){const r=""===e||e.endsWith(".")?e:`${e}.`;return Object.entries(t.properties).flatMap((([t,e])=>n(e,`${r}${t}`)))}return"array"===t.type&&t.items?n(t.items,`${e}[].`):[{name:e.endsWith(".")?e.slice(0,-1):e,type:t.type,description:t.description}]};class s{constructor({version:e="1",key:r,name:s,services:o={},httpOperations:a={},auth:i,proxy:u,httpClient:c=new t}){this.listOperations=()=>Object.keys(this.httpOperations||{}),this.getOperation=t=>{const e=this.httpOperations?.[t];if(!e)throw new Error(`Operation ${t} not found`);return e},this.getOperationResponseFieldsMetadata=t=>{const e=this.getOperation(t).responses;if(!e)return null;const r=(t=>{const e=Object.entries(t).find((([t])=>t.startsWith("2")));return e?e[1]:null})(e);return r?.content["application/json"]?.schema?n(r.content["application/json"]?.schema):null},this.callOperation=async({operationId:t,params:e,credentials:r})=>{const n=this.httpOperations?.[t];if(!n)throw new Error(`Operation ${t} not found`);const s=(({params:t,httpOperation:e})=>{const{url:r,method:n}=e;let s=r;const o=[],a=[],i={};let u;Object.entries(t||{}).forEach((([t,r])=>{const n=e.parameters?.[t];if(n)switch(n.in){case"path":s=s.replace(`{${t}}`,r).replace(`:${t}`,r);break;case"query":o.push(`${t}=${r}`);break;case"header":i[t]=r;break;case"cookie":a.push(`${t}=${r}; `);break;case"body":u=r}}));const c=o.length>0?`?${o.join("&")}`:"";return a.length>0&&(i.cookie=a.join("")),{url:`${s}${c}`,method:n,headers:Object.keys(i).length>0?i:void 0,body:u||void 0}})({params:e,httpOperation:n}),{method:o,url:a,headers:i,body:u}=s,{apiKey:c}=r;return{connector:this,input:{operationId:t,params:e},response:await this.httpClient.request({method:o,url:a,headers:{...i,authorization:c},payload:u}),credentials:r}},this.version=e,this.key=r,this.name=s,this.services=o,this.httpOperations=a,this.auth=i,this.proxy=u,this.httpClient=c}}const o="request_body";var a;!function(t){t.MAP="map",t.TYPECAST="typecast"}(a||(a={}));const i=async({blockSteps:t,block:e})=>t.reduce((async(t,e)=>e({block:await t})),Promise.resolve(e)),u=async({block:t})=>{const e=t?.fieldConfigs;if(!e||"disabled"===t?.debug?.custom_mappings)return t;let r;const n=t.providerResponse;return r=Array.isArray(t.result)?t.result.map((r=>{const s=(n?.data?.[t.context.resource]).find((t=>t.id===r.id||t.id===r.remote_id));return c(r,e,s)})):c(t.result,e,n?.data),{...t,result:r}},c=(t,r,n)=>{if(!n)return t;const s={},o={...t};return r.forEach((r=>{const{expression:a,targetFieldKey:i}=r,u=a&&e.query(n,a)[0];a&&u&&(t[i]?o[i]=u:s[i]=u)})),{...o,unified_custom_fields:Object.keys(s).length>0?s:void 0}},l=t=>"string"==typeof t,p=t=>t instanceof Date,d="yyyy-MM-dd",y=["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:t})=>{const e=r.parseISO(t);if(r.isValid(e))return e;const n=new Date;for(const e of y){const s=r.parse(t,e,n);if(r.isValid(s))return s.setUTCHours(0,0,0,0),s}return null},f=({value:t,format:e=d})=>{const n=(({value:t,format:e=d})=>{if(p(t))return t;if(!l(t))return null;try{const n=r.parse(t,e,new Date);return r.isValid(n)?n:h({value:t})}catch(t){return null}})({value:t,format:e});return n?n.toISOString():null};var m;!function(t){t.String="string",t.Number="number",t.Boolean="boolean",t.DateTimeString="datetime_string"}(m||(m={}));const b=({value:t,type:e,format:r})=>{if(!t)return null;switch(e){case m.String:return(({value:t})=>l(t)?t:p(t)?t.toISOString():(t=>"object"==typeof t&&null!==t)(t)?JSON.stringify(t):String(t))({value:t});case m.Number:return(({value:t})=>{if((t=>"number"==typeof t)(t))return t;if(p(t))return null;const e=Number(t);return isNaN(e)?null:e})({value:t});case m.Boolean:return(({value:t})=>(t=>"boolean"==typeof t)(t)?t:"false"!==t&&"0"!==t&&0!==t&&Boolean(t))({value:t});case m.DateTimeString:return f({value:t,format:r});default:return t}},g=async({block:t})=>{const e=t?.fieldConfigs;if(!e||"disabled"===t?.debug?.custom_mappings)return t;let r;return r=Array.isArray(t.result)?t.result.map((t=>v(t,e))):v(t.result,e),{...t,result:r}},v=(t,e)=>{const r={...t};return e.forEach((e=>{const{targetFieldKey:n,type:s}=e;(t=>Object.values(m).includes(t))(s)&&t[n]&&(r[n]=b({value:t[n],type:s}))})),{...r}},O={build({type:t}){switch(t){case a.MAP:return u;case a.TYPECAST:return g;default:throw new Error(`Unknown block step: ${t}`)}}},M=({fieldConfigs:t})=>{const e=[];return t&&e.push(O.build({type:a.MAP}),O.build({type:a.TYPECAST})),e};export{s as BaseConnector,a as BlockStepType,o as REQUEST_BODY_PARAM,i as blockPipe,M as getBlockPipeStepsFromConfigs};
1
+ import{HttpClient as t}from"@stackone/transport";import e from"jsonpath";import*as r from"date-fns";const n=(t,e="")=>{if("object"===t.type&&t.properties){const r=""===e||e.endsWith(".")?e:`${e}.`;return Object.entries(t.properties).flatMap((([t,e])=>n(e,`${r}${t}`)))}return"array"===t.type&&t.items?n(t.items,`${e}[].`):[{name:e.endsWith(".")?e.slice(0,-1):e,type:t.type,description:t.description}]};class s{constructor({version:e="1",key:r,name:s,services:o={},httpOperations:i={},auth:a,proxy:u,httpClient:c=new t}){this.listOperations=()=>Object.keys(this.httpOperations||{}),this.getOperation=t=>{const e=this.httpOperations?.[t];if(!e)throw new Error(`Operation ${t} not found`);return e},this.getOperationResponseFieldsMetadata=t=>{const e=this.getOperation(t).responses;if(!e)return null;const r=(t=>{const e=Object.entries(t).find((([t])=>t.startsWith("2")));return e?e[1]:null})(e);return r?.content["application/json"]?.schema?n(r.content["application/json"]?.schema):null},this.callOperation=async({operationId:t,params:e,credentials:r})=>{const n=this.httpOperations?.[t];if(!n)throw new Error(`Operation ${t} not found`);const s=(({params:t,httpOperation:e})=>{const{url:r,method:n}=e;let s=r;const o=[],i=[],a={};let u;Object.entries(t||{}).forEach((([t,r])=>{const n=e.parameters?.[t];if(n)switch(n.in){case"path":s=s.replace(`{${t}}`,r).replace(`:${t}`,r);break;case"query":o.push(`${t}=${r}`);break;case"header":a[t]=r;break;case"cookie":i.push(`${t}=${r}; `);break;case"body":u=r}}));const c=o.length>0?`?${o.join("&")}`:"";return i.length>0&&(a.cookie=i.join("")),{url:`${s}${c}`,method:n,headers:Object.keys(a).length>0?a:void 0,body:u||void 0}})({params:e,httpOperation:n}),{method:o,url:i,headers:a,body:u}=s,{apiKey:c}=r;return{connector:this,input:{operationId:t,params:e},response:await this.httpClient.request({method:o,url:i,headers:{...a,authorization:c},payload:u}),credentials:r}},this.version=e,this.key=r,this.name=s,this.services=o,this.httpOperations=i,this.auth=a,this.proxy=u,this.httpClient=c}}const o="request_body";var i;!function(t){t.MAP="map",t.TYPECAST="typecast"}(i||(i={}));const a=async({blockSteps:t,block:e})=>t.reduce((async(t,e)=>e({block:await t})),Promise.resolve(e)),u=async({block:t})=>{const e=t?.fieldConfigs;if(!e||"disabled"===t?.debug?.custom_mappings)return t;let r;const n=t.providerData;return r=Array.isArray(t.result)?t.result.map((r=>{const s=n?.[t.context.resource]?.items;if(!s)return r;const o=c(r.id,r.remote_id,n);return l(r,e,o)})):l(t.result,e,n),{...t,result:r}},c=(t,e,r)=>r?Object.keys(r).reduce(((n,s)=>{const o=r[s];if(!o.items)return n;const i=o.items.find((r=>r.id===t||r.id===e));return i?{...n,[s]:i}:n}),{}):{},l=(t,r,n)=>{if(!n)return t;const s={},o={...t};return r.forEach((r=>{const{expression:i,targetFieldKey:a}=r,u=i&&e.query(n,i)[0];i&&u&&(t[a]?o[a]=u:s[a]=u)})),{...o,unified_custom_fields:Object.keys(s).length>0?s:void 0}},p=t=>"string"==typeof t,y=t=>t instanceof Date,d="yyyy-MM-dd",h=["yyyy-MM-dd","yyyy/MM/dd","dd/MM/yyyy","dd-MM-yyyy","yyyy-dd-MM","yyyy/dd/MM","MM/dd/yyyy","MM-dd-yyyy"],f=({value:t})=>{const e=r.parseISO(t);if(r.isValid(e))return e;const n=new Date;for(const e of h){const s=r.parse(t,e,n);if(r.isValid(s))return s.setUTCHours(0,0,0,0),s}return null},m=({value:t,format:e=d})=>{const n=(({value:t,format:e=d})=>{if(y(t))return t;if(!p(t))return null;try{const n=r.parse(t,e,new Date);return r.isValid(n)?n:f({value:t})}catch(t){return null}})({value:t,format:e});return n?n.toISOString():null};var b;!function(t){t.String="string",t.Number="number",t.Boolean="boolean",t.DateTimeString="datetime_string"}(b||(b={}));const g=({value:t,type:e,format:r})=>{if(!t)return null;switch(e){case b.String:return(({value:t})=>p(t)?t:y(t)?t.toISOString():(t=>"object"==typeof t&&null!==t)(t)?JSON.stringify(t):String(t))({value:t});case b.Number:return(({value:t})=>{if((t=>"number"==typeof t)(t))return t;if(y(t))return null;const e=Number(t);return isNaN(e)?null:e})({value:t});case b.Boolean:return(({value:t})=>(t=>"boolean"==typeof t)(t)?t:"false"!==t&&"0"!==t&&0!==t&&Boolean(t))({value:t});case b.DateTimeString:return m({value:t,format:r});default:return t}},v=async({block:t})=>{const e=t?.fieldConfigs;if(!e||"disabled"===t?.debug?.custom_mappings)return t;let r;return r=Array.isArray(t.result)?t.result.map((t=>O(t,e))):O(t.result,e),{...t,result:r}},O=(t,e)=>{const r={...t};return e.forEach((e=>{const{targetFieldKey:n,type:s}=e;(t=>Object.values(b).includes(t))(s)&&t[n]&&(r[n]=g({value:t[n],type:s}))})),{...r}},M={build({type:t}){switch(t){case i.MAP:return u;case i.TYPECAST:return v;default:throw new Error(`Unknown block step: ${t}`)}}},k=({fieldConfigs:t})=>{const e=[];return t&&e.push(M.build({type:i.MAP}),M.build({type:i.TYPECAST})),e};export{s as BaseConnector,i as BlockStepType,o as REQUEST_BODY_PARAM,a as blockPipe,k as getBlockPipeStepsFromConfigs};
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 n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=r(require("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}]};var o;exports.BlockStepType=void 0,(o=exports.BlockStepType||(exports.BlockStepType={})).MAP="map",o.TYPECAST="typecast";const a=async({block:e})=>{const t=e?.fieldConfigs;if(!t||"disabled"===e?.debug?.custom_mappings)return e;let r;const n=e.providerResponse;return r=Array.isArray(e.result)?e.result.map((r=>{const s=(n?.data?.[e.context.resource]).find((e=>e.id===r.id||e.id===r.remote_id));return i(r,t,s)})):i(e.result,t,n?.data),{...e,result:r}},i=(e,r,n)=>{if(!n)return e;const s={},o={...e};return r.forEach((r=>{const{expression:a,targetFieldKey:i}=r,c=a&&t.query(n,a)[0];a&&c&&(e[i]?o[i]=c:s[i]=c)})),{...o,unified_custom_fields:Object.keys(s).length>0?s:void 0}},c=e=>"string"==typeof e,u=e=>e instanceof Date,p="yyyy-MM-dd",l=["yyyy-MM-dd","yyyy/MM/dd","dd/MM/yyyy","dd-MM-yyyy","yyyy-dd-MM","yyyy/dd/MM","MM/dd/yyyy","MM-dd-yyyy"],y=({value:e})=>{const t=n.parseISO(e);if(n.isValid(t))return t;const r=new Date;for(const t of l){const s=n.parse(e,t,r);if(n.isValid(s))return s.setUTCHours(0,0,0,0),s}return null},d=({value:e,format:t=p})=>{const r=(({value:e,format:t=p})=>{if(u(e))return e;if(!c(e))return null;try{const r=n.parse(e,t,new Date);return n.isValid(r)?r:y({value:e})}catch(e){return null}})({value:e,format:t});return r?r.toISOString():null};var h;!function(e){e.String="string",e.Number="number",e.Boolean="boolean",e.DateTimeString="datetime_string"}(h||(h={}));const f=({value:e,type:t,format:r})=>{if(!e)return null;switch(t){case h.String:return(({value:e})=>c(e)?e:u(e)?e.toISOString():(e=>"object"==typeof e&&null!==e)(e)?JSON.stringify(e):String(e))({value:e});case h.Number:return(({value:e})=>{if((e=>"number"==typeof e)(e))return e;if(u(e))return null;const t=Number(e);return isNaN(t)?null:t})({value:e});case h.Boolean:return(({value:e})=>(e=>"boolean"==typeof e)(e)?e:"false"!==e&&"0"!==e&&0!==e&&Boolean(e))({value:e});case h.DateTimeString:return d({value:e,format:r});default:return e}},b=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=>m(e,t))):m(e.result,t),{...e,result:r}},m=(e,t)=>{const r={...e};return t.forEach((t=>{const{targetFieldKey:n,type:s}=t;(e=>Object.values(h).includes(e))(s)&&e[n]&&(r[n]=f({value:e[n],type:s}))})),{...r}},g={build({type:e}){switch(e){case exports.BlockStepType.MAP:return a;case exports.BlockStepType.TYPECAST:return b;default:throw new Error(`Unknown block step: ${e}`)}}};exports.BaseConnector=class{constructor({version:t="1",key:r,name:n,services:o={},httpOperations:a={},auth:i,proxy:c,httpClient:u=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?s(r.content["application/json"]?.schema):null},this.callOperation=async({operationId:e,params:t,credentials:r})=>{const n=this.httpOperations?.[e];if(!n)throw new Error(`Operation ${e} not found`);const s=(({params:e,httpOperation:t})=>{const{url:r,method:n}=t;let s=r;const o=[],a=[],i={};let c;Object.entries(e||{}).forEach((([e,r])=>{const n=t.parameters?.[e];if(n)switch(n.in){case"path":s=s.replace(`{${e}}`,r).replace(`:${e}`,r);break;case"query":o.push(`${e}=${r}`);break;case"header":i[e]=r;break;case"cookie":a.push(`${e}=${r}; `);break;case"body":c=r}}));const u=o.length>0?`?${o.join("&")}`:"";return a.length>0&&(i.cookie=a.join("")),{url:`${s}${u}`,method:n,headers:Object.keys(i).length>0?i:void 0,body:c||void 0}})({params:t,httpOperation:n}),{method:o,url:a,headers:i,body:c}=s,{apiKey:u}=r;return{connector:this,input:{operationId:e,params:t},response:await this.httpClient.request({method:o,url:a,headers:{...i,authorization:u},payload:c}),credentials:r}},this.version=t,this.key=r,this.name=n,this.services=o,this.httpOperations=a,this.auth=i,this.proxy=c,this.httpClient=u}},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(g.build({type:exports.BlockStepType.MAP}),g.build({type:exports.BlockStepType.TYPECAST})),t};
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 n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=r(require("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}]};var o;exports.BlockStepType=void 0,(o=exports.BlockStepType||(exports.BlockStepType={})).MAP="map",o.TYPECAST="typecast";const i=async({block:e})=>{const t=e?.fieldConfigs;if(!t||"disabled"===e?.debug?.custom_mappings)return e;let r;const n=e.providerData;return r=Array.isArray(e.result)?e.result.map((r=>{const s=n?.[e.context.resource]?.items;if(!s)return r;const o=a(r.id,r.remote_id,n);return c(r,t,o)})):c(e.result,t,n),{...e,result:r}},a=(e,t,r)=>r?Object.keys(r).reduce(((n,s)=>{const o=r[s];if(!o.items)return n;const i=o.items.find((r=>r.id===e||r.id===t));return i?{...n,[s]:i}:n}),{}):{},c=(e,r,n)=>{if(!n)return e;const s={},o={...e};return r.forEach((r=>{const{expression:i,targetFieldKey:a}=r,c=i&&t.query(n,i)[0];i&&c&&(e[a]?o[a]=c:s[a]=c)})),{...o,unified_custom_fields:Object.keys(s).length>0?s:void 0}},u=e=>"string"==typeof e,l=e=>e instanceof Date,p="yyyy-MM-dd",y=["yyyy-MM-dd","yyyy/MM/dd","dd/MM/yyyy","dd-MM-yyyy","yyyy-dd-MM","yyyy/dd/MM","MM/dd/yyyy","MM-dd-yyyy"],d=({value:e})=>{const t=n.parseISO(e);if(n.isValid(t))return t;const r=new Date;for(const t of y){const s=n.parse(e,t,r);if(n.isValid(s))return s.setUTCHours(0,0,0,0),s}return null},h=({value:e,format:t=p})=>{const r=(({value:e,format:t=p})=>{if(l(e))return e;if(!u(e))return null;try{const r=n.parse(e,t,new Date);return n.isValid(r)?r:d({value:e})}catch(e){return null}})({value:e,format:t});return r?r.toISOString():null};var f;!function(e){e.String="string",e.Number="number",e.Boolean="boolean",e.DateTimeString="datetime_string"}(f||(f={}));const b=({value:e,type:t,format:r})=>{if(!e)return null;switch(t){case f.String:return(({value:e})=>u(e)?e:l(e)?e.toISOString():(e=>"object"==typeof e&&null!==e)(e)?JSON.stringify(e):String(e))({value:e});case f.Number:return(({value:e})=>{if((e=>"number"==typeof e)(e))return e;if(l(e))return null;const t=Number(e);return isNaN(t)?null:t})({value:e});case f.Boolean:return(({value:e})=>(e=>"boolean"==typeof e)(e)?e:"false"!==e&&"0"!==e&&0!==e&&Boolean(e))({value:e});case f.DateTimeString:return h({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=>O(e,t))):O(e.result,t),{...e,result:r}},O=(e,t)=>{const r={...e};return t.forEach((t=>{const{targetFieldKey:n,type:s}=t;(e=>Object.values(f).includes(e))(s)&&e[n]&&(r[n]=b({value:e[n],type:s}))})),{...r}},g={build({type:e}){switch(e){case exports.BlockStepType.MAP:return i;case exports.BlockStepType.TYPECAST:return m;default:throw new Error(`Unknown block step: ${e}`)}}};exports.BaseConnector=class{constructor({version:t="1",key:r,name:n,services:o={},httpOperations:i={},auth:a,proxy:c,httpClient:u=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?s(r.content["application/json"]?.schema):null},this.callOperation=async({operationId:e,params:t,credentials:r})=>{const n=this.httpOperations?.[e];if(!n)throw new Error(`Operation ${e} not found`);const s=(({params:e,httpOperation:t})=>{const{url:r,method:n}=t;let s=r;const o=[],i=[],a={};let c;Object.entries(e||{}).forEach((([e,r])=>{const n=t.parameters?.[e];if(n)switch(n.in){case"path":s=s.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":c=r}}));const u=o.length>0?`?${o.join("&")}`:"";return i.length>0&&(a.cookie=i.join("")),{url:`${s}${u}`,method:n,headers:Object.keys(a).length>0?a:void 0,body:c||void 0}})({params:t,httpOperation:n}),{method:o,url:i,headers:a,body:c}=s,{apiKey:u}=r;return{connector:this,input:{operationId:e,params:t},response:await this.httpClient.request({method:o,url:i,headers:{...a,authorization:u},payload:c}),credentials:r}},this.version=t,this.key=r,this.name=n,this.services=o,this.httpOperations=i,this.auth=a,this.proxy=c,this.httpClient=u}},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(g.build({type:exports.BlockStepType.MAP}),g.build({type:exports.BlockStepType.TYPECAST})),t};
@@ -1,7 +1,7 @@
1
- import { HttpResponse } from '@stackone/transport';
1
+ import { HttpMethod } from '@stackone/transport';
2
2
  export type Block = {
3
3
  fieldConfigs?: BlockFieldConfig[];
4
- providerResponse?: HttpResponse;
4
+ providerData?: ProviderData;
5
5
  result?: BlockIndexedRecord[] | BlockIndexedRecord;
6
6
  context: BlockContext;
7
7
  debug?: BlockDebugParams;
@@ -16,6 +16,7 @@ export type BlockContext = {
16
16
  };
17
17
  export type BlockIndexedRecord = {
18
18
  id: string;
19
+ remote_id?: string;
19
20
  [key: string]: unknown;
20
21
  };
21
22
  export type BlockFieldConfig = {
@@ -29,3 +30,17 @@ export type BlockStep = ({ block, }: {
29
30
  export type BlockDebugParams = {
30
31
  custom_mappings?: 'disabled' | 'enabled';
31
32
  };
33
+ export type ProviderData = {
34
+ [key: string]: ProviderDataObject;
35
+ };
36
+ export type ProviderDataObject<T = unknown> = {
37
+ [key: string]: T | ProviderDataRequestDetails;
38
+ request_details: ProviderDataRequestDetails;
39
+ };
40
+ export type ProviderDataRequestDetails = {
41
+ method: HttpMethod;
42
+ url: string;
43
+ body?: {
44
+ [key: string]: string | number | boolean;
45
+ };
46
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackone/core",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",