@newageerp/mp-types
Advanced tools
Comparing version 1.0.26 to 1.0.27
@@ -132,9 +132,2 @@ type MpAggregateFunction = 'max' | 'min' | 'sum' | 'count' | 'countDistinct' | 'sumPercent' | 'countPercent' | 'countDistinctPercent' | 'cr'; | ||
type GetRequestParams = { | ||
dataSource: string; | ||
fields?: string[]; | ||
dataFilter?: MpFilterFactorySetUniversalItem[]; | ||
options?: AuthOptions; | ||
}; | ||
type InsertRequestBody = { | ||
@@ -149,2 +142,22 @@ table: string; | ||
type GetRequestParams<T> = { | ||
dataSource: string; | ||
fields?: string[]; | ||
dataFilter?: MpFilterFactorySetUniversalItem[]; | ||
options?: AuthOptions; | ||
}; | ||
declare function getResults<T>(props: GetRequestParams<T>): Promise<{ | ||
success: number; | ||
data: T[]; | ||
records: number; | ||
info: { | ||
order: MpOrderColumn[]; | ||
sql?: { | ||
sql: string; | ||
countSql: string; | ||
statements: (string | number)[]; | ||
}; | ||
}; | ||
}>; | ||
declare const _default: { | ||
@@ -155,3 +168,3 @@ insert: { | ||
results: { | ||
get: (props: GetRequestParams) => Promise<any>; | ||
get: typeof getResults; | ||
}; | ||
@@ -158,0 +171,0 @@ }; |
@@ -64,14 +64,16 @@ "use strict"; | ||
// src/requests/get-request.ts | ||
var getResults = (props) => __async(void 0, null, function* () { | ||
let requestUrl = `${props.options ? props.options.baseUrl : process.env.MP_URL}/data-source/${props.dataSource}/results?_t=${(/* @__PURE__ */ new Date()).getTime()}`; | ||
if (props.fields) { | ||
requestUrl += `&fields=${encodeURIComponent(JSON.stringify(props.fields))}`; | ||
} | ||
if (props.dataFilter) { | ||
requestUrl += `&dataFilter=${encodeURIComponent(JSON.stringify(props.dataFilter))}`; | ||
} | ||
const res = yield fetch(requestUrl, { headers: { "Authorization": `Bearer ${process.env.MP_KEY}` } }); | ||
const resJson = yield res.json(); | ||
return resJson; | ||
}); | ||
function getResults(props) { | ||
return __async(this, null, function* () { | ||
let requestUrl = `${props.options ? props.options.baseUrl : process.env.MP_URL}/data-source/${props.dataSource}/results?_t=${(/* @__PURE__ */ new Date()).getTime()}`; | ||
if (props.fields) { | ||
requestUrl += `&fields=${encodeURIComponent(JSON.stringify(props.fields))}`; | ||
} | ||
if (props.dataFilter) { | ||
requestUrl += `&dataFilter=${encodeURIComponent(JSON.stringify(props.dataFilter))}`; | ||
} | ||
const res = yield fetch(requestUrl, { headers: { "Authorization": `Bearer ${process.env.MP_KEY}` } }); | ||
const resJson = yield res.json(); | ||
return resJson; | ||
}); | ||
} | ||
@@ -78,0 +80,0 @@ // src/requests/index.ts |
{ | ||
"name": "@newageerp/mp-types", | ||
"version": "1.0.26", | ||
"version": "1.0.27", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
26369
312