@mcesystems/mdm-client-g4 1.0.71 → 1.0.73
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.js +338 -158
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +338 -158
- package/dist/index.mjs.map +3 -3
- package/dist/types/logic/mdmClient.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -10104,14 +10104,14 @@ var require_form_data = __commonJS({
|
|
|
10104
10104
|
this._error(new Error("Arrays are not supported."));
|
|
10105
10105
|
return;
|
|
10106
10106
|
}
|
|
10107
|
-
var
|
|
10107
|
+
var header = this._multiPartHeader(field, value, options);
|
|
10108
10108
|
var footer = this._multiPartFooter();
|
|
10109
|
-
append(
|
|
10109
|
+
append(header);
|
|
10110
10110
|
append(value);
|
|
10111
10111
|
append(footer);
|
|
10112
|
-
this._trackLength(
|
|
10112
|
+
this._trackLength(header, value, options);
|
|
10113
10113
|
};
|
|
10114
|
-
FormData2.prototype._trackLength = function(
|
|
10114
|
+
FormData2.prototype._trackLength = function(header, value, options) {
|
|
10115
10115
|
var valueLength = 0;
|
|
10116
10116
|
if (options.knownLength != null) {
|
|
10117
10117
|
valueLength += Number(options.knownLength);
|
|
@@ -10121,7 +10121,7 @@ var require_form_data = __commonJS({
|
|
|
10121
10121
|
valueLength = Buffer.byteLength(value);
|
|
10122
10122
|
}
|
|
10123
10123
|
this._valueLength += valueLength;
|
|
10124
|
-
this._overheadLength += Buffer.byteLength(
|
|
10124
|
+
this._overheadLength += Buffer.byteLength(header) + FormData2.LINE_BREAK.length;
|
|
10125
10125
|
if (!value || !value.path && !(value.readable && hasOwn(value, "httpVersion")) && !(value instanceof Stream)) {
|
|
10126
10126
|
return;
|
|
10127
10127
|
}
|
|
@@ -10171,18 +10171,18 @@ var require_form_data = __commonJS({
|
|
|
10171
10171
|
if (typeof options.header === "object") {
|
|
10172
10172
|
populate(headers, options.header);
|
|
10173
10173
|
}
|
|
10174
|
-
var
|
|
10174
|
+
var header;
|
|
10175
10175
|
for (var prop in headers) {
|
|
10176
10176
|
if (hasOwn(headers, prop)) {
|
|
10177
|
-
|
|
10178
|
-
if (
|
|
10177
|
+
header = headers[prop];
|
|
10178
|
+
if (header == null) {
|
|
10179
10179
|
continue;
|
|
10180
10180
|
}
|
|
10181
|
-
if (!Array.isArray(
|
|
10182
|
-
|
|
10181
|
+
if (!Array.isArray(header)) {
|
|
10182
|
+
header = [header];
|
|
10183
10183
|
}
|
|
10184
|
-
if (
|
|
10185
|
-
contents += prop + ": " +
|
|
10184
|
+
if (header.length) {
|
|
10185
|
+
contents += prop + ": " + header.join("; ") + FormData2.LINE_BREAK;
|
|
10186
10186
|
}
|
|
10187
10187
|
}
|
|
10188
10188
|
}
|
|
@@ -10234,13 +10234,13 @@ var require_form_data = __commonJS({
|
|
|
10234
10234
|
return "--" + this.getBoundary() + "--" + FormData2.LINE_BREAK;
|
|
10235
10235
|
};
|
|
10236
10236
|
FormData2.prototype.getHeaders = function(userHeaders) {
|
|
10237
|
-
var
|
|
10237
|
+
var header;
|
|
10238
10238
|
var formHeaders = {
|
|
10239
10239
|
"content-type": "multipart/form-data; boundary=" + this.getBoundary()
|
|
10240
10240
|
};
|
|
10241
|
-
for (
|
|
10242
|
-
if (hasOwn(userHeaders,
|
|
10243
|
-
formHeaders[
|
|
10241
|
+
for (header in userHeaders) {
|
|
10242
|
+
if (hasOwn(userHeaders, header)) {
|
|
10243
|
+
formHeaders[header.toLowerCase()] = userHeaders[header];
|
|
10244
10244
|
}
|
|
10245
10245
|
}
|
|
10246
10246
|
return formHeaders;
|
|
@@ -35771,55 +35771,172 @@ var require_src = __commonJS2({
|
|
|
35771
35771
|
}
|
|
35772
35772
|
});
|
|
35773
35773
|
var import_debug = __toESM2(require_src());
|
|
35774
|
-
|
|
35775
|
-
|
|
35776
|
-
|
|
35777
|
-
|
|
35778
|
-
|
|
35779
|
-
|
|
35780
|
-
|
|
35781
|
-
|
|
35782
|
-
|
|
35783
|
-
|
|
35784
|
-
|
|
35785
|
-
|
|
35786
|
-
|
|
35787
|
-
|
|
35788
|
-
|
|
35789
|
-
|
|
35790
|
-
|
|
35791
|
-
|
|
35792
|
-
|
|
35793
|
-
|
|
35794
|
-
|
|
35795
|
-
}
|
|
35796
|
-
|
|
35797
|
-
|
|
35798
|
-
|
|
35799
|
-
|
|
35800
|
-
|
|
35801
|
-
|
|
35802
|
-
|
|
35803
|
-
|
|
35804
|
-
|
|
35805
|
-
|
|
35806
|
-
|
|
35807
|
-
|
|
35808
|
-
|
|
35809
|
-
|
|
35810
|
-
|
|
35811
|
-
|
|
35812
|
-
|
|
35813
|
-
|
|
35814
|
-
|
|
35815
|
-
|
|
35816
|
-
|
|
35817
|
-
|
|
35818
|
-
|
|
35819
|
-
|
|
35820
|
-
|
|
35821
|
-
|
|
35774
|
+
function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
|
|
35775
|
+
const logInfo22 = (0, import_debug.default)(`${namespace}:info`);
|
|
35776
|
+
const logTask = (0, import_debug.default)(`${namespace}:task`);
|
|
35777
|
+
const logError2 = (0, import_debug.default)(`${namespace}:error`);
|
|
35778
|
+
const logDetail = (0, import_debug.default)(`${namespace}:detail`);
|
|
35779
|
+
const logDebug = (0, import_debug.default)(`${namespace}:debug`);
|
|
35780
|
+
const logWarning2 = (0, import_debug.default)(`${namespace}:warning`);
|
|
35781
|
+
const logColor = (0, import_debug.default)(`${namespace}:color`);
|
|
35782
|
+
logInfo22.color = "19";
|
|
35783
|
+
logTask.color = "25";
|
|
35784
|
+
logError2.color = "1";
|
|
35785
|
+
logDetail.color = "199";
|
|
35786
|
+
logWarning2.color = "186";
|
|
35787
|
+
logDebug.color = "211";
|
|
35788
|
+
logColor.enabled = true;
|
|
35789
|
+
function setNamespace(namespace2) {
|
|
35790
|
+
logInfo22.namespace = `${namespace2}:info`;
|
|
35791
|
+
logTask.namespace = `${namespace2}:task`;
|
|
35792
|
+
logError2.namespace = `${namespace2}:error`;
|
|
35793
|
+
logDetail.namespace = `${namespace2}:detail`;
|
|
35794
|
+
logWarning2.namespace = `${namespace2}:warning`;
|
|
35795
|
+
logDebug.namespace = `${namespace2}:debug`;
|
|
35796
|
+
}
|
|
35797
|
+
function setLogLevel(level) {
|
|
35798
|
+
switch (level) {
|
|
35799
|
+
case "info":
|
|
35800
|
+
logInfo22.enabled = true;
|
|
35801
|
+
logTask.enabled = true;
|
|
35802
|
+
logError2.enabled = true;
|
|
35803
|
+
logWarning2.enabled = true;
|
|
35804
|
+
logDetail.enabled = false;
|
|
35805
|
+
logDebug.enabled = false;
|
|
35806
|
+
break;
|
|
35807
|
+
case "debug":
|
|
35808
|
+
logInfo22.enabled = true;
|
|
35809
|
+
logTask.enabled = true;
|
|
35810
|
+
logError2.enabled = true;
|
|
35811
|
+
logWarning2.enabled = true;
|
|
35812
|
+
logDetail.enabled = true;
|
|
35813
|
+
logDebug.enabled = true;
|
|
35814
|
+
break;
|
|
35815
|
+
case "none":
|
|
35816
|
+
logInfo22.enabled = false;
|
|
35817
|
+
logTask.enabled = false;
|
|
35818
|
+
logError2.enabled = false;
|
|
35819
|
+
logWarning2.enabled = false;
|
|
35820
|
+
logDetail.enabled = false;
|
|
35821
|
+
logDebug.enabled = false;
|
|
35822
|
+
break;
|
|
35823
|
+
}
|
|
35824
|
+
}
|
|
35825
|
+
setLogLevel(logLevel);
|
|
35826
|
+
function setColors(type, color) {
|
|
35827
|
+
switch (type) {
|
|
35828
|
+
case "info":
|
|
35829
|
+
logInfo22.color = color;
|
|
35830
|
+
break;
|
|
35831
|
+
case "task":
|
|
35832
|
+
logTask.color = color;
|
|
35833
|
+
break;
|
|
35834
|
+
case "error":
|
|
35835
|
+
logError2.color = color;
|
|
35836
|
+
break;
|
|
35837
|
+
case "detail":
|
|
35838
|
+
logDetail.color = color;
|
|
35839
|
+
break;
|
|
35840
|
+
case "warning":
|
|
35841
|
+
logWarning2.color = color;
|
|
35842
|
+
break;
|
|
35843
|
+
case "debug":
|
|
35844
|
+
logDebug.color = color;
|
|
35845
|
+
break;
|
|
35846
|
+
default:
|
|
35847
|
+
throw new Error(`Invalid log type: ${type}`);
|
|
35848
|
+
}
|
|
35849
|
+
}
|
|
35850
|
+
function printColors() {
|
|
35851
|
+
for (let i = 0; i < 256; i++) {
|
|
35852
|
+
logColor.color = `${i}`;
|
|
35853
|
+
logColor(`${i}: ${i}`);
|
|
35854
|
+
}
|
|
35855
|
+
}
|
|
35856
|
+
function logDataDetail(data, prefix = "# ") {
|
|
35857
|
+
if (data === null || data === void 0) {
|
|
35858
|
+
return `${prefix}<null or undefined>`;
|
|
35859
|
+
}
|
|
35860
|
+
if (typeof data !== "object") {
|
|
35861
|
+
return `${prefix}${String(data)}`;
|
|
35862
|
+
}
|
|
35863
|
+
const keys = Object.keys(data);
|
|
35864
|
+
let result = "";
|
|
35865
|
+
for (const key of keys) {
|
|
35866
|
+
result += `${prefix}${key}: `;
|
|
35867
|
+
if (key in data) {
|
|
35868
|
+
let dataKey = key;
|
|
35869
|
+
if (key in data) {
|
|
35870
|
+
dataKey = key;
|
|
35871
|
+
const value = data[dataKey];
|
|
35872
|
+
if (value === null || value === void 0) {
|
|
35873
|
+
result += `<${value === null ? "null" : "undefined"}>
|
|
35874
|
+
`;
|
|
35875
|
+
} else if (typeof value === "object") {
|
|
35876
|
+
result += `
|
|
35877
|
+
${logDataDetail(value, `${prefix} `)}
|
|
35878
|
+
`;
|
|
35879
|
+
} else {
|
|
35880
|
+
result += `${value}
|
|
35881
|
+
`;
|
|
35882
|
+
}
|
|
35883
|
+
}
|
|
35884
|
+
}
|
|
35885
|
+
}
|
|
35886
|
+
return result.trim();
|
|
35887
|
+
}
|
|
35888
|
+
function header(title, padding = 0) {
|
|
35889
|
+
return `${" ".repeat(padding)}${"=".repeat(80)}
|
|
35890
|
+
${" ".repeat(40 - title.length / 2)}${title}
|
|
35891
|
+
${" ".repeat(padding)}${"=".repeat(80)}`;
|
|
35892
|
+
}
|
|
35893
|
+
function logHeader(title) {
|
|
35894
|
+
logInfo22(`${header(title, 2)}`);
|
|
35895
|
+
}
|
|
35896
|
+
function logDataObject2(title, ...args) {
|
|
35897
|
+
const stack = new Error().stack?.split("\n")[2] || "";
|
|
35898
|
+
const stackMatch = stack.match(/\((.*):(\d+):(\d+)\)$/) || stack.match(/at (.*):(\d+):(\d+)$/);
|
|
35899
|
+
let callerDetails = "";
|
|
35900
|
+
if (stackMatch) {
|
|
35901
|
+
const functionMatch = stack.match(/at (.+) \(/);
|
|
35902
|
+
const functionName = functionMatch ? functionMatch[1] : "<anonymous>";
|
|
35903
|
+
callerDetails = `${functionName}`;
|
|
35904
|
+
}
|
|
35905
|
+
logDetail(`${header(`*${title}* ${callerDetails}`)}
|
|
35906
|
+
${args.reduce((acc, arg) => `${acc}
|
|
35907
|
+
${logDataDetail(arg)}`, "")}
|
|
35908
|
+
|
|
35909
|
+
${"=".repeat(80)}`);
|
|
35910
|
+
}
|
|
35911
|
+
function logErrorObject(error, extraDetails) {
|
|
35912
|
+
if (error instanceof Error) {
|
|
35913
|
+
logError2(`${extraDetails ? header(extraDetails, 1) : header(error.message, 1)}
|
|
35914
|
+
Error Message:
|
|
35915
|
+
${error.message}
|
|
35916
|
+
Error Stack:
|
|
35917
|
+
${error.stack}
|
|
35918
|
+
${"=".repeat(80)}`);
|
|
35919
|
+
} else {
|
|
35920
|
+
logError2(`${extraDetails ? header(extraDetails, 1) : header(String(error), 1)}
|
|
35921
|
+
${"=".repeat(80)}`);
|
|
35922
|
+
}
|
|
35822
35923
|
}
|
|
35924
|
+
return {
|
|
35925
|
+
logInfo: logInfo22,
|
|
35926
|
+
logTask,
|
|
35927
|
+
logError: logError2,
|
|
35928
|
+
logDetail,
|
|
35929
|
+
logDebug,
|
|
35930
|
+
logWarning: logWarning2,
|
|
35931
|
+
logColor,
|
|
35932
|
+
setColors,
|
|
35933
|
+
printColors,
|
|
35934
|
+
logHeader,
|
|
35935
|
+
logDataObject: logDataObject2,
|
|
35936
|
+
logErrorObject,
|
|
35937
|
+
setLogLevel,
|
|
35938
|
+
setNamespace
|
|
35939
|
+
};
|
|
35823
35940
|
}
|
|
35824
35941
|
var AUTHORIZE_QUERY = `
|
|
35825
35942
|
query Authorize($input: AuthorizeInput!) {
|
|
@@ -35838,8 +35955,7 @@ var TOKEN_QUERY = `
|
|
|
35838
35955
|
}
|
|
35839
35956
|
}
|
|
35840
35957
|
`;
|
|
35841
|
-
|
|
35842
|
-
logNamespace("auth");
|
|
35958
|
+
var { logInfo } = createLoggers("auth");
|
|
35843
35959
|
var random = (0, import_node_util.promisify)(import_node_crypto.randomBytes);
|
|
35844
35960
|
async function getAuthToken(credentials, apiUrl) {
|
|
35845
35961
|
const authApiUrl = apiUrl || process.env.AUTH_API_URL;
|
|
@@ -36757,115 +36873,179 @@ var require_src2 = __commonJS3({
|
|
|
36757
36873
|
}
|
|
36758
36874
|
});
|
|
36759
36875
|
var import_debug2 = __toESM3(require_src2());
|
|
36760
|
-
|
|
36761
|
-
|
|
36762
|
-
|
|
36763
|
-
|
|
36764
|
-
|
|
36765
|
-
|
|
36766
|
-
|
|
36767
|
-
|
|
36768
|
-
|
|
36769
|
-
|
|
36770
|
-
|
|
36771
|
-
|
|
36772
|
-
|
|
36773
|
-
|
|
36774
|
-
|
|
36775
|
-
|
|
36776
|
-
|
|
36777
|
-
|
|
36778
|
-
|
|
36779
|
-
|
|
36780
|
-
|
|
36781
|
-
}
|
|
36782
|
-
|
|
36783
|
-
|
|
36784
|
-
|
|
36785
|
-
|
|
36786
|
-
|
|
36787
|
-
|
|
36788
|
-
|
|
36789
|
-
|
|
36790
|
-
|
|
36791
|
-
|
|
36792
|
-
|
|
36793
|
-
|
|
36794
|
-
|
|
36795
|
-
|
|
36796
|
-
|
|
36797
|
-
|
|
36798
|
-
|
|
36799
|
-
|
|
36800
|
-
|
|
36801
|
-
|
|
36802
|
-
|
|
36803
|
-
|
|
36804
|
-
|
|
36805
|
-
|
|
36806
|
-
|
|
36807
|
-
|
|
36808
|
-
|
|
36809
|
-
}
|
|
36810
|
-
|
|
36811
|
-
|
|
36812
|
-
|
|
36813
|
-
|
|
36814
|
-
|
|
36815
|
-
|
|
36816
|
-
|
|
36817
|
-
|
|
36818
|
-
|
|
36819
|
-
|
|
36820
|
-
|
|
36821
|
-
|
|
36822
|
-
|
|
36876
|
+
function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
|
|
36877
|
+
const logInfo3 = (0, import_debug2.default)(`${namespace}:info`);
|
|
36878
|
+
const logTask = (0, import_debug2.default)(`${namespace}:task`);
|
|
36879
|
+
const logError2 = (0, import_debug2.default)(`${namespace}:error`);
|
|
36880
|
+
const logDetail = (0, import_debug2.default)(`${namespace}:detail`);
|
|
36881
|
+
const logDebug = (0, import_debug2.default)(`${namespace}:debug`);
|
|
36882
|
+
const logWarning2 = (0, import_debug2.default)(`${namespace}:warning`);
|
|
36883
|
+
const logColor = (0, import_debug2.default)(`${namespace}:color`);
|
|
36884
|
+
logInfo3.color = "19";
|
|
36885
|
+
logTask.color = "25";
|
|
36886
|
+
logError2.color = "1";
|
|
36887
|
+
logDetail.color = "199";
|
|
36888
|
+
logWarning2.color = "186";
|
|
36889
|
+
logDebug.color = "211";
|
|
36890
|
+
logColor.enabled = true;
|
|
36891
|
+
function setNamespace(namespace2) {
|
|
36892
|
+
logInfo3.namespace = `${namespace2}:info`;
|
|
36893
|
+
logTask.namespace = `${namespace2}:task`;
|
|
36894
|
+
logError2.namespace = `${namespace2}:error`;
|
|
36895
|
+
logDetail.namespace = `${namespace2}:detail`;
|
|
36896
|
+
logWarning2.namespace = `${namespace2}:warning`;
|
|
36897
|
+
logDebug.namespace = `${namespace2}:debug`;
|
|
36898
|
+
}
|
|
36899
|
+
function setLogLevel(level) {
|
|
36900
|
+
switch (level) {
|
|
36901
|
+
case "info":
|
|
36902
|
+
logInfo3.enabled = true;
|
|
36903
|
+
logTask.enabled = true;
|
|
36904
|
+
logError2.enabled = true;
|
|
36905
|
+
logWarning2.enabled = true;
|
|
36906
|
+
logDetail.enabled = false;
|
|
36907
|
+
logDebug.enabled = false;
|
|
36908
|
+
break;
|
|
36909
|
+
case "debug":
|
|
36910
|
+
logInfo3.enabled = true;
|
|
36911
|
+
logTask.enabled = true;
|
|
36912
|
+
logError2.enabled = true;
|
|
36913
|
+
logWarning2.enabled = true;
|
|
36914
|
+
logDetail.enabled = true;
|
|
36915
|
+
logDebug.enabled = true;
|
|
36916
|
+
break;
|
|
36917
|
+
case "none":
|
|
36918
|
+
logInfo3.enabled = false;
|
|
36919
|
+
logTask.enabled = false;
|
|
36920
|
+
logError2.enabled = false;
|
|
36921
|
+
logWarning2.enabled = false;
|
|
36922
|
+
logDetail.enabled = false;
|
|
36923
|
+
logDebug.enabled = false;
|
|
36924
|
+
break;
|
|
36925
|
+
}
|
|
36926
|
+
}
|
|
36927
|
+
setLogLevel(logLevel);
|
|
36928
|
+
function setColors(type, color) {
|
|
36929
|
+
switch (type) {
|
|
36930
|
+
case "info":
|
|
36931
|
+
logInfo3.color = color;
|
|
36932
|
+
break;
|
|
36933
|
+
case "task":
|
|
36934
|
+
logTask.color = color;
|
|
36935
|
+
break;
|
|
36936
|
+
case "error":
|
|
36937
|
+
logError2.color = color;
|
|
36938
|
+
break;
|
|
36939
|
+
case "detail":
|
|
36940
|
+
logDetail.color = color;
|
|
36941
|
+
break;
|
|
36942
|
+
case "warning":
|
|
36943
|
+
logWarning2.color = color;
|
|
36944
|
+
break;
|
|
36945
|
+
case "debug":
|
|
36946
|
+
logDebug.color = color;
|
|
36947
|
+
break;
|
|
36948
|
+
default:
|
|
36949
|
+
throw new Error(`Invalid log type: ${type}`);
|
|
36950
|
+
}
|
|
36951
|
+
}
|
|
36952
|
+
function printColors() {
|
|
36953
|
+
for (let i = 0; i < 256; i++) {
|
|
36954
|
+
logColor.color = `${i}`;
|
|
36955
|
+
logColor(`${i}: ${i}`);
|
|
36956
|
+
}
|
|
36957
|
+
}
|
|
36958
|
+
function logDataDetail(data, prefix = "# ") {
|
|
36959
|
+
if (data === null || data === void 0) {
|
|
36960
|
+
return `${prefix}<null or undefined>`;
|
|
36961
|
+
}
|
|
36962
|
+
if (typeof data !== "object") {
|
|
36963
|
+
return `${prefix}${String(data)}`;
|
|
36964
|
+
}
|
|
36965
|
+
const keys = Object.keys(data);
|
|
36966
|
+
let result = "";
|
|
36967
|
+
for (const key of keys) {
|
|
36968
|
+
result += `${prefix}${key}: `;
|
|
36823
36969
|
if (key in data) {
|
|
36824
|
-
dataKey = key;
|
|
36825
|
-
|
|
36826
|
-
|
|
36827
|
-
|
|
36970
|
+
let dataKey = key;
|
|
36971
|
+
if (key in data) {
|
|
36972
|
+
dataKey = key;
|
|
36973
|
+
const value = data[dataKey];
|
|
36974
|
+
if (value === null || value === void 0) {
|
|
36975
|
+
result += `<${value === null ? "null" : "undefined"}>
|
|
36828
36976
|
`;
|
|
36829
|
-
|
|
36830
|
-
|
|
36831
|
-
${logDataDetail(value, `${prefix} `)}
|
|
36977
|
+
} else if (typeof value === "object") {
|
|
36978
|
+
result += `
|
|
36979
|
+
${logDataDetail(value, `${prefix} `)}
|
|
36832
36980
|
`;
|
|
36833
|
-
|
|
36834
|
-
|
|
36981
|
+
} else {
|
|
36982
|
+
result += `${value}
|
|
36835
36983
|
`;
|
|
36984
|
+
}
|
|
36836
36985
|
}
|
|
36837
36986
|
}
|
|
36838
36987
|
}
|
|
36988
|
+
return result.trim();
|
|
36839
36989
|
}
|
|
36840
|
-
|
|
36841
|
-
}
|
|
36842
|
-
function header(title, padding = 0) {
|
|
36843
|
-
return `${" ".repeat(padding)}${"=".repeat(80)}
|
|
36990
|
+
function header(title, padding = 0) {
|
|
36991
|
+
return `${" ".repeat(padding)}${"=".repeat(80)}
|
|
36844
36992
|
${" ".repeat(40 - title.length / 2)}${title}
|
|
36845
36993
|
${" ".repeat(padding)}${"=".repeat(80)}`;
|
|
36846
|
-
}
|
|
36847
|
-
function
|
|
36848
|
-
|
|
36849
|
-
|
|
36850
|
-
|
|
36851
|
-
|
|
36852
|
-
const
|
|
36853
|
-
|
|
36854
|
-
|
|
36855
|
-
|
|
36856
|
-
|
|
36994
|
+
}
|
|
36995
|
+
function logHeader(title) {
|
|
36996
|
+
logInfo3(`${header(title, 2)}`);
|
|
36997
|
+
}
|
|
36998
|
+
function logDataObject2(title, ...args) {
|
|
36999
|
+
const stack = new Error().stack?.split("\n")[2] || "";
|
|
37000
|
+
const stackMatch = stack.match(/\((.*):(\d+):(\d+)\)$/) || stack.match(/at (.*):(\d+):(\d+)$/);
|
|
37001
|
+
let callerDetails = "";
|
|
37002
|
+
if (stackMatch) {
|
|
37003
|
+
const functionMatch = stack.match(/at (.+) \(/);
|
|
37004
|
+
const functionName = functionMatch ? functionMatch[1] : "<anonymous>";
|
|
37005
|
+
callerDetails = `${functionName}`;
|
|
37006
|
+
}
|
|
37007
|
+
logDetail(`${header(`*${title}* ${callerDetails}`)}
|
|
36857
37008
|
${args.reduce((acc, arg) => `${acc}
|
|
36858
37009
|
${logDataDetail(arg)}`, "")}
|
|
36859
|
-
|
|
37010
|
+
|
|
36860
37011
|
${"=".repeat(80)}`);
|
|
37012
|
+
}
|
|
37013
|
+
function logErrorObject(error, extraDetails) {
|
|
37014
|
+
if (error instanceof Error) {
|
|
37015
|
+
logError2(`${extraDetails ? header(extraDetails, 1) : header(error.message, 1)}
|
|
37016
|
+
Error Message:
|
|
37017
|
+
${error.message}
|
|
37018
|
+
Error Stack:
|
|
37019
|
+
${error.stack}
|
|
37020
|
+
${"=".repeat(80)}`);
|
|
37021
|
+
} else {
|
|
37022
|
+
logError2(`${extraDetails ? header(extraDetails, 1) : header(String(error), 1)}
|
|
37023
|
+
${"=".repeat(80)}`);
|
|
37024
|
+
}
|
|
37025
|
+
}
|
|
37026
|
+
return {
|
|
37027
|
+
logInfo: logInfo3,
|
|
37028
|
+
logTask,
|
|
37029
|
+
logError: logError2,
|
|
37030
|
+
logDetail,
|
|
37031
|
+
logDebug,
|
|
37032
|
+
logWarning: logWarning2,
|
|
37033
|
+
logColor,
|
|
37034
|
+
setColors,
|
|
37035
|
+
printColors,
|
|
37036
|
+
logHeader,
|
|
37037
|
+
logDataObject: logDataObject2,
|
|
37038
|
+
logErrorObject,
|
|
37039
|
+
setLogLevel,
|
|
37040
|
+
setNamespace
|
|
37041
|
+
};
|
|
36861
37042
|
}
|
|
36862
37043
|
|
|
36863
37044
|
// src/logic/mdmClient.ts
|
|
37045
|
+
var { logInfo: logInfo2, logError, logWarning, logDataObject } = createLoggers2("mdm-client");
|
|
36864
37046
|
var MdmClient = class {
|
|
36865
37047
|
constructor(config) {
|
|
36866
37048
|
this.config = config;
|
|
36867
|
-
setLogLevel2(process.env.LOG_LEVEL ?? "none");
|
|
36868
|
-
logNamespace2("mdm-client");
|
|
36869
37049
|
logDataObject("MDM Client Config", { config });
|
|
36870
37050
|
if (!config.endpoint) {
|
|
36871
37051
|
throw new Error("MDM endpoint is required");
|
|
@@ -36924,7 +37104,7 @@ var MdmClient = class {
|
|
|
36924
37104
|
return result.installApp;
|
|
36925
37105
|
} catch (error) {
|
|
36926
37106
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
36927
|
-
|
|
37107
|
+
logError(`Failed to install app: ${errorMsg}`);
|
|
36928
37108
|
throw error;
|
|
36929
37109
|
}
|
|
36930
37110
|
}
|
|
@@ -36933,7 +37113,7 @@ async function createMDMClient() {
|
|
|
36933
37113
|
const endpoint = process.env.MDM_ENDPOINT;
|
|
36934
37114
|
const credPath = process.env.CREDENTIALS_PATH;
|
|
36935
37115
|
if (!endpoint || !credPath) {
|
|
36936
|
-
|
|
37116
|
+
logWarning("MDM endpoint or credentials path is not set");
|
|
36937
37117
|
logDataObject("Environment variables", { endpoint, credPath });
|
|
36938
37118
|
return void 0;
|
|
36939
37119
|
}
|