@stackone/core 1.16.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.
- package/dist/index.es.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/types/blocks/types.d.ts +7 -29
- package/dist/types/index.d.ts +6 -8
- package/dist/types/stepFunctions/factory.d.ts +7 -0
- package/dist/types/stepFunctions/getFieldMappingStepFunctions.d.ts +5 -0
- package/dist/types/stepFunctions/map/mapStepFunction.d.ts +2 -0
- package/dist/types/stepFunctions/mapFields/mapFieldsStepFunction.d.ts +2 -0
- package/dist/types/stepFunctions/typecast/typecastStepFunction.d.ts +2 -0
- package/dist/types/stepFunctions/types.d.ts +13 -0
- package/dist/types/steps/stepsRunners.d.ts +6 -0
- package/dist/types/steps/types.d.ts +13 -0
- package/package.json +1 -1
- package/dist/types/baseConnector.d.ts +0 -43
- package/dist/types/blocks/blockPipe.d.ts +0 -5
- package/dist/types/blocks/blockStepsConfigs.d.ts +0 -4
- package/dist/types/blocks/blockStepsFactory.d.ts +0 -7
- package/dist/types/blocks/steps/map/mapBlockStep.d.ts +0 -2
- package/dist/types/blocks/steps/mapFields/mapFieldsBlockStep.d.ts +0 -2
- package/dist/types/blocks/steps/stepsDirectoryTypes.d.ts +0 -5
- package/dist/types/blocks/steps/typecast/typecastBlockStep.d.ts +0 -2
- package/dist/types/constants.d.ts +0 -1
- package/dist/types/mappers.d.ts +0 -11
- package/dist/types/responseMetaData.d.ts +0 -3
- package/dist/types/types.d.ts +0 -90
- /package/dist/types/{blocks/steps → stepFunctions}/typecast/constants.d.ts +0 -0
- /package/dist/types/{blocks/steps → stepFunctions}/typecast/parsers.d.ts +0 -0
- /package/dist/types/{blocks/steps → stepFunctions}/typecast/typecast.d.ts +0 -0
- /package/dist/types/{blocks/steps → stepFunctions}/typecast/types.d.ts +0 -0
package/dist/index.es.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
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("
|
|
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 {
|
|
1
|
+
import type { HttpMethod } from '@stackone/transport';
|
|
2
|
+
import type { StepsSnapshots } from '../steps/types';
|
|
3
3
|
export type Block = {
|
|
4
|
-
fieldConfigs?:
|
|
4
|
+
fieldConfigs?: FieldConfig[];
|
|
5
5
|
result?: BlockIndexedRecord[] | BlockIndexedRecord;
|
|
6
6
|
context: BlockContext;
|
|
7
|
-
debug?:
|
|
8
|
-
steps?:
|
|
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
|
|
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
|
|
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
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
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,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
|
+
};
|
package/package.json
CHANGED
|
@@ -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>;
|
|
41
|
-
credentials?: unknown;
|
|
42
|
-
}) => Promise<Bundle>;
|
|
43
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const REQUEST_BODY_PARAM = "request_body";
|
package/dist/types/mappers.d.ts
DELETED
|
@@ -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>;
|
|
5
|
-
httpOperation: HttpOperation;
|
|
6
|
-
}) => {
|
|
7
|
-
url: string;
|
|
8
|
-
method: HttpMethod;
|
|
9
|
-
headers?: Record<string, unknown>;
|
|
10
|
-
body?: Record<string, unknown>;
|
|
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[];
|
package/dist/types/types.d.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { HttpMethod, HttpResponse, IHttpClient } 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
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|