@arrowsphere/api-client 3.180.0-rc-bdj-5 → 3.180.0-rc.fdi.10
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/build/axiosSingleton.d.ts +1 -8
- package/build/axiosSingleton.js +51 -31
- package/build/graphqlApi/index.d.ts +0 -1
- package/build/graphqlApi/index.js +0 -1
- package/build/graphqlApi/types/entities/order.d.ts +0 -26
- package/build/graphqlApi/types/entities/program.d.ts +1 -5
- package/build/graphqlApi/types/graphqlApiQueries.d.ts +0 -4
- package/build/graphqlApi/types/graphqlApiQueries.js +0 -1
- package/build/graphqlApi/types/graphqlApiSchemas.d.ts +0 -1
- package/package.json +2 -2
- package/build/graphqlApi/types/entities/disclaimer.d.ts +0 -8
- package/build/graphqlApi/types/entities/disclaimer.js +0 -3
|
@@ -18,12 +18,5 @@ export declare class AxiosSingleton {
|
|
|
18
18
|
* @param isLogging - Must log
|
|
19
19
|
*/
|
|
20
20
|
private static _handleResponse;
|
|
21
|
-
|
|
22
|
-
* @param request - Axios Request
|
|
23
|
-
*/
|
|
24
|
-
private static cleanRequestLog;
|
|
25
|
-
/**
|
|
26
|
-
* @param response - Axios Response
|
|
27
|
-
*/
|
|
28
|
-
private static cleanResponseLog;
|
|
21
|
+
private static sanitizeObject;
|
|
29
22
|
}
|
package/build/axiosSingleton.js
CHANGED
|
@@ -5,7 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.AxiosSingleton = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
|
|
8
|
+
var DefaultObfuscateFields;
|
|
9
|
+
(function (DefaultObfuscateFields) {
|
|
10
|
+
DefaultObfuscateFields["API_KEY"] = "apiKey";
|
|
11
|
+
DefaultObfuscateFields["PASSWORD"] = "password";
|
|
12
|
+
DefaultObfuscateFields["AUTHORIZATION"] = "Authorization";
|
|
13
|
+
DefaultObfuscateFields["NEW_PASSWORD"] = "newPassword";
|
|
14
|
+
DefaultObfuscateFields["OLD_PASSWORD"] = "oldPassword";
|
|
15
|
+
})(DefaultObfuscateFields || (DefaultObfuscateFields = {}));
|
|
9
16
|
class AxiosSingleton {
|
|
10
17
|
static getInstance(configuration = {}) {
|
|
11
18
|
this._isLogging = !!configuration.isLogging;
|
|
@@ -29,7 +36,7 @@ class AxiosSingleton {
|
|
|
29
36
|
*/
|
|
30
37
|
static _handleRequest(request, isLogging = false) {
|
|
31
38
|
if (isLogging) {
|
|
32
|
-
console.info('AXIOS - Request : ', AxiosSingleton.
|
|
39
|
+
console.info('AXIOS - Request : ', AxiosSingleton.sanitizeObject(request));
|
|
33
40
|
}
|
|
34
41
|
return request;
|
|
35
42
|
}
|
|
@@ -39,39 +46,52 @@ class AxiosSingleton {
|
|
|
39
46
|
*/
|
|
40
47
|
static _handleResponse(response, isLogging = false) {
|
|
41
48
|
if (isLogging) {
|
|
42
|
-
console.info('AXIOS - Response : ', AxiosSingleton.
|
|
49
|
+
console.info('AXIOS - Response : ', AxiosSingleton.sanitizeObject(response));
|
|
43
50
|
}
|
|
44
51
|
return response;
|
|
45
52
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
53
|
+
static sanitizeObject(obj, fieldsToObfuscate = [
|
|
54
|
+
DefaultObfuscateFields.API_KEY,
|
|
55
|
+
DefaultObfuscateFields.PASSWORD,
|
|
56
|
+
DefaultObfuscateFields.AUTHORIZATION,
|
|
57
|
+
DefaultObfuscateFields.NEW_PASSWORD,
|
|
58
|
+
DefaultObfuscateFields.OLD_PASSWORD,
|
|
59
|
+
], seen = new WeakMap()) {
|
|
60
|
+
if (!obj || typeof obj !== 'object')
|
|
61
|
+
return obj;
|
|
62
|
+
// Vérifie si l'objet a déjà été traité (évite les boucles infinies)
|
|
63
|
+
if (seen.has(obj))
|
|
64
|
+
return seen.get(obj);
|
|
65
|
+
// Crée une copie de l'objet pour éviter de le modifier directement
|
|
66
|
+
const sanitizedCopy = Array.isArray(obj) ? [] : {};
|
|
67
|
+
// Stocke l'objet dans WeakMap avant la récursion
|
|
68
|
+
seen.set(obj, sanitizedCopy);
|
|
69
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
70
|
+
if (fieldsToObfuscate
|
|
71
|
+
.map((field) => field.toUpperCase())
|
|
72
|
+
.includes(key.toUpperCase())) {
|
|
73
|
+
let obfuscatedFields = '';
|
|
74
|
+
switch (key.toUpperCase()) {
|
|
75
|
+
case DefaultObfuscateFields.API_KEY.toUpperCase():
|
|
76
|
+
case DefaultObfuscateFields.AUTHORIZATION.toUpperCase():
|
|
77
|
+
obfuscatedFields =
|
|
78
|
+
'****************************' +
|
|
79
|
+
value.substring(value.length - 4);
|
|
80
|
+
break;
|
|
81
|
+
default:
|
|
82
|
+
obfuscatedFields = '***';
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
sanitizedCopy[key] = obfuscatedFields;
|
|
86
|
+
}
|
|
87
|
+
else if (typeof value === 'object' && value !== null) {
|
|
88
|
+
sanitizedCopy[key] = AxiosSingleton.sanitizeObject(value, fieldsToObfuscate, seen); // 🔄 Récursion avec WeakMap
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
sanitizedCopy[key] = value;
|
|
92
|
+
}
|
|
72
93
|
}
|
|
73
|
-
|
|
74
|
-
return tempResponse;
|
|
94
|
+
return sanitizedCopy;
|
|
75
95
|
}
|
|
76
96
|
}
|
|
77
97
|
exports.AxiosSingleton = AxiosSingleton;
|
|
@@ -4,7 +4,6 @@ export * from './types/entities/contact';
|
|
|
4
4
|
export * from './types/entities/company';
|
|
5
5
|
export * from './types/entities/country';
|
|
6
6
|
export * from './types/entities/currency';
|
|
7
|
-
export * from './types/entities/disclaimer';
|
|
8
7
|
export * from './types/entities/licenseBudget';
|
|
9
8
|
export * from './types/entities/order';
|
|
10
9
|
export * from './types/entities/organizationUnit';
|
|
@@ -20,7 +20,6 @@ __exportStar(require("./types/entities/contact"), exports);
|
|
|
20
20
|
__exportStar(require("./types/entities/company"), exports);
|
|
21
21
|
__exportStar(require("./types/entities/country"), exports);
|
|
22
22
|
__exportStar(require("./types/entities/currency"), exports);
|
|
23
|
-
__exportStar(require("./types/entities/disclaimer"), exports);
|
|
24
23
|
__exportStar(require("./types/entities/licenseBudget"), exports);
|
|
25
24
|
__exportStar(require("./types/entities/order"), exports);
|
|
26
25
|
__exportStar(require("./types/entities/organizationUnit"), exports);
|
|
@@ -1,34 +1,12 @@
|
|
|
1
|
-
import { ArrowCompanyType, EndCustomerType, PartnerType } from './company';
|
|
2
|
-
import { ContactsType } from './contact';
|
|
3
|
-
import { GraphqlApiProgramType } from './program';
|
|
4
|
-
import { ItemData } from './quote';
|
|
5
1
|
import { SpecialPriceRateType } from './specialPriceRate';
|
|
6
2
|
import { GraphqlApiUnitType } from './unit';
|
|
7
3
|
export declare type OrdersType = {
|
|
8
4
|
id?: number;
|
|
9
|
-
arrowCompany?: ArrowCompanyType;
|
|
10
|
-
arrowContact?: ContactsType;
|
|
11
|
-
commitmentAmountTotal?: number;
|
|
12
|
-
createdAt?: string;
|
|
13
|
-
endCustomer?: EndCustomerType;
|
|
14
|
-
endCustomerContact?: ContactsType;
|
|
15
5
|
items?: OrderItemsType[];
|
|
16
|
-
partner?: PartnerType;
|
|
17
|
-
partnerContact?: ContactsType;
|
|
18
|
-
poNumber?: string;
|
|
19
|
-
reference?: string;
|
|
20
|
-
status?: GraphqlApiOrderStatusType;
|
|
21
|
-
totalRecurringPrice?: number;
|
|
22
|
-
updatedAt?: string;
|
|
23
6
|
};
|
|
24
7
|
export declare type OrderItemsType = {
|
|
25
8
|
id?: number;
|
|
26
|
-
itemData?: ItemData;
|
|
27
|
-
name?: string;
|
|
28
9
|
priceRates?: SpecialPriceRateType[];
|
|
29
|
-
program?: GraphqlApiProgramType;
|
|
30
|
-
reference?: string;
|
|
31
|
-
status?: GraphqlApiOrderStatusType;
|
|
32
10
|
};
|
|
33
11
|
export declare type GraphqlApiOrderSoftwareType = {
|
|
34
12
|
id?: number;
|
|
@@ -36,7 +14,3 @@ export declare type GraphqlApiOrderSoftwareType = {
|
|
|
36
14
|
totalAmount?: number;
|
|
37
15
|
unit?: GraphqlApiUnitType;
|
|
38
16
|
};
|
|
39
|
-
export declare type GraphqlApiOrderStatusType = {
|
|
40
|
-
id?: number;
|
|
41
|
-
name?: string;
|
|
42
|
-
};
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import { PartnerType } from './company';
|
|
2
|
-
import { GraphqlApiDisclaimerType } from './disclaimer';
|
|
3
2
|
import { SubscriptionType } from './subscription';
|
|
4
3
|
import { VendorsType } from './vendor';
|
|
5
4
|
export declare type GraphqlApiProgramType = {
|
|
6
5
|
id?: number;
|
|
7
6
|
bypassReport?: number;
|
|
8
7
|
description?: string;
|
|
9
|
-
disclaimer?: GraphqlApiDisclaimerType;
|
|
10
8
|
internalName?: string;
|
|
11
9
|
introduction?: string;
|
|
12
10
|
levels?: ProgramLevelType[];
|
|
13
11
|
name?: string;
|
|
14
12
|
subscriptionExtraFields?: SubscriptionExtraFieldType[];
|
|
15
|
-
type?: GraphqlApiProgramTypeType;
|
|
16
13
|
url?: string;
|
|
17
14
|
vendor?: VendorsType;
|
|
18
|
-
|
|
19
|
-
xacVendorCode?: string;
|
|
15
|
+
type?: GraphqlApiProgramTypeType;
|
|
20
16
|
};
|
|
21
17
|
export declare type GraphqlApiProgramTypeType = {
|
|
22
18
|
id?: number;
|
|
@@ -2,7 +2,6 @@ import { ArrowCompanyType, EndCustomerType, PartnerType } from './entities/compa
|
|
|
2
2
|
import { ContactsType } from './entities/contact';
|
|
3
3
|
import { ContinentType, CountryType } from './entities/country';
|
|
4
4
|
import { LicenseBudgetType } from './entities/licenseBudget';
|
|
5
|
-
import { OrdersType } from './entities/order';
|
|
6
5
|
import { OrganizationUnitsType } from './entities/organizationUnit';
|
|
7
6
|
import { PartnertagType } from './entities/partnertag';
|
|
8
7
|
import { GraphqlApiProgramType, ProgramLevelOptionGroupType, SubscribedProgramType } from './entities/program';
|
|
@@ -124,7 +123,6 @@ export declare enum SelectDataField {
|
|
|
124
123
|
END_CUSTOMER = "endCustomer",
|
|
125
124
|
LICENSE_BUDGET = "licenseBudget",
|
|
126
125
|
ORGANIZATION_UNIT = "organizationUnit",
|
|
127
|
-
ORDER = "order",
|
|
128
126
|
PARTNER = "partner",
|
|
129
127
|
PARTNERTAG = "partnertag",
|
|
130
128
|
PROGRAM = "program",
|
|
@@ -154,7 +152,6 @@ export declare type SelectAllResponseDataType = {
|
|
|
154
152
|
[SelectDataField.END_CUSTOMER]?: EndCustomerType[];
|
|
155
153
|
[SelectDataField.LICENSE_BUDGET]?: LicenseBudgetType[];
|
|
156
154
|
[SelectDataField.ORGANIZATION_UNIT]?: OrganizationUnitsType[];
|
|
157
|
-
[SelectDataField.ORDER]?: OrdersType[];
|
|
158
155
|
[SelectDataField.PARTNER]?: PartnerType[];
|
|
159
156
|
[SelectDataField.PARTNERTAG]?: PartnertagType[];
|
|
160
157
|
[SelectDataField.PROGRAM]?: GraphqlApiProgramType[];
|
|
@@ -233,7 +230,6 @@ export declare type SelectOneResponseDataType = {
|
|
|
233
230
|
[SelectDataField.END_CUSTOMER]?: EndCustomerType;
|
|
234
231
|
[SelectDataField.LICENSE_BUDGET]?: LicenseBudgetType;
|
|
235
232
|
[SelectDataField.ORGANIZATION_UNIT]?: OrganizationUnitsType;
|
|
236
|
-
[SelectDataField.ORDER]?: OrdersType;
|
|
237
233
|
[SelectDataField.PARTNER]?: PartnerType;
|
|
238
234
|
[SelectDataField.PARTNERTAG]?: PartnertagType;
|
|
239
235
|
[SelectDataField.PROGRAM]?: GraphqlApiProgramType;
|
|
@@ -97,7 +97,6 @@ var SelectDataField;
|
|
|
97
97
|
SelectDataField["END_CUSTOMER"] = "endCustomer";
|
|
98
98
|
SelectDataField["LICENSE_BUDGET"] = "licenseBudget";
|
|
99
99
|
SelectDataField["ORGANIZATION_UNIT"] = "organizationUnit";
|
|
100
|
-
SelectDataField["ORDER"] = "order";
|
|
101
100
|
SelectDataField["PARTNER"] = "partner";
|
|
102
101
|
SelectDataField["PARTNERTAG"] = "partnertag";
|
|
103
102
|
SelectDataField["PROGRAM"] = "program";
|
|
@@ -143,7 +143,6 @@ export declare type SelectAllResponseDataSchema = {
|
|
|
143
143
|
[SelectDataField.END_CUSTOMER]?: EndCustomerSchema;
|
|
144
144
|
[SelectDataField.LICENSE_BUDGET]?: LicenseBudgetSchema;
|
|
145
145
|
[SelectDataField.ORGANIZATION_UNIT]?: OrganizationUnitSchema;
|
|
146
|
-
[SelectDataField.ORDER]?: OrdersSchema;
|
|
147
146
|
[SelectDataField.PARTNER]?: PartnerSchema;
|
|
148
147
|
[SelectDataField.PARTNERTAG]?: PartnertagSchema;
|
|
149
148
|
[SelectDataField.PROGRAM]?: GraphqlApiProgramSchema;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "git",
|
|
5
5
|
"url": "https://github.com/ArrowSphere/nodejs-api-client.git"
|
|
6
6
|
},
|
|
7
|
-
"version": "3.180.0-rc
|
|
7
|
+
"version": "3.180.0-rc.fdi.10",
|
|
8
8
|
"description": "Node.js client for ArrowSphere's public API",
|
|
9
9
|
"main": "build/index.js",
|
|
10
10
|
"types": "build/index.d.ts",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
84
|
"@types/validatorjs": "3.15.0",
|
|
85
|
-
"axios": "1.
|
|
85
|
+
"axios": "1.8.2",
|
|
86
86
|
"graphql": "^16.3.0",
|
|
87
87
|
"graphql-request": "4.2.0",
|
|
88
88
|
"json-to-graphql-query": "^2.2.5",
|