@arrowsphere/api-client 3.167.0 → 3.168.0-rc-bdj-1
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AbstractGraphQLClient } from '../abstractGraphQLClient';
|
|
2
2
|
import { ArrowCompanyType, EndCustomerType, PartnerType } from './types/entities/company';
|
|
3
|
-
import { InputPaginationType, SelectAllQueryType, SelectAllResultType, SelectOneQueryType, SelectOneResultType } from './types/graphqlApiQueries';
|
|
4
|
-
import { ArrowCompanySchema, EndCustomerSchema, PartnerSchema, SelectOneResponseDataSchema } from './types/graphqlApiSchemas';
|
|
3
|
+
import { GetLocalContactResultType, GetSpecialPriceRatesHistoryResultType, InputPaginationType, InputSearchFilterType, QueryVariablesType, SelectAllQueryType, SelectAllResultType, SelectOneQueryType, SelectOneResultType } from './types/graphqlApiQueries';
|
|
4
|
+
import { ArrowCompanySchema, ContactsSchema, EndCustomerSchema, PageSchema, PartnerSchema, SelectOneResponseDataSchema, SpecialPriceRateSchema } from './types/graphqlApiSchemas';
|
|
5
5
|
export declare class GraphqlApiClient extends AbstractGraphQLClient {
|
|
6
6
|
/**
|
|
7
7
|
* The Path of graphql catalog API
|
|
@@ -10,8 +10,10 @@ export declare class GraphqlApiClient extends AbstractGraphQLClient {
|
|
|
10
10
|
find<GraphQLResponseTypes>(request: string): Promise<GraphQLResponseTypes | null>;
|
|
11
11
|
selectAll(query: SelectAllQueryType): Promise<SelectAllResultType | null>;
|
|
12
12
|
selectOne(query: SelectOneQueryType): Promise<SelectOneResultType | null>;
|
|
13
|
-
findOneById<T>(id: number, fieldSchema: SelectOneResponseDataSchema, pagination?: InputPaginationType): Promise<T | null>;
|
|
13
|
+
findOneById<T>(id: number, fieldSchema: SelectOneResponseDataSchema, pagination?: InputPaginationType, filters?: InputSearchFilterType, exclusionFilters?: InputSearchFilterType): Promise<T | null>;
|
|
14
14
|
findEndCustomerById(id: number, fields: EndCustomerSchema, pagination?: InputPaginationType): Promise<EndCustomerType | null>;
|
|
15
15
|
findPartnerById(id: number, fields: PartnerSchema, pagination?: InputPaginationType): Promise<PartnerType | null>;
|
|
16
16
|
findArrowCompanyById(id: number, fields: ArrowCompanySchema, pagination?: InputPaginationType): Promise<ArrowCompanyType | null>;
|
|
17
|
+
getLocalContact(programInternalName: string, partnerId: number, fieldSchema: ContactsSchema): Promise<GetLocalContactResultType | null>;
|
|
18
|
+
getSpecialPriceRatesHistory(licenseId: number, fieldSchema: SpecialPriceRateSchema, pagination?: PageSchema, additionalParams?: QueryVariablesType): Promise<GetSpecialPriceRatesHistoryResultType | null>;
|
|
17
19
|
}
|
|
@@ -30,7 +30,7 @@ class GraphqlApiClient extends abstractGraphQLClient_1.AbstractGraphQLClient {
|
|
|
30
30
|
const result = await this.find(queryStr);
|
|
31
31
|
return result;
|
|
32
32
|
}
|
|
33
|
-
async findOneById(id, fieldSchema, pagination) {
|
|
33
|
+
async findOneById(id, fieldSchema, pagination, filters, exclusionFilters) {
|
|
34
34
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
35
35
|
const keys = Object.keys(fieldSchema);
|
|
36
36
|
if (keys.length === 0) {
|
|
@@ -38,19 +38,9 @@ class GraphqlApiClient extends abstractGraphQLClient_1.AbstractGraphQLClient {
|
|
|
38
38
|
}
|
|
39
39
|
const type = keys[0];
|
|
40
40
|
const queryArguments = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
[graphqlApiQueries_1.InputFiltersField.ITEMS]: [
|
|
45
|
-
{
|
|
46
|
-
[graphqlApiQueries_1.InputFilterValueField.NAME]: 'id',
|
|
47
|
-
[graphqlApiQueries_1.InputFilterValueField.OPERATOR]: graphqlApiQueries_1.ComparisonOperator.EQUALS,
|
|
48
|
-
[graphqlApiQueries_1.InputFilterValueField.VALUE]: [`${id}`],
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
},
|
|
41
|
+
id,
|
|
42
|
+
filters,
|
|
43
|
+
exclusionFilters,
|
|
54
44
|
};
|
|
55
45
|
if ((pagination === null || pagination === void 0 ? void 0 : pagination[graphqlApiQueries_1.InputPaginationField.PER_PAGE]) ||
|
|
56
46
|
(pagination === null || pagination === void 0 ? void 0 : pagination[graphqlApiQueries_1.InputPaginationField.PAGE])) {
|
|
@@ -65,7 +55,7 @@ class GraphqlApiClient extends abstractGraphQLClient_1.AbstractGraphQLClient {
|
|
|
65
55
|
}
|
|
66
56
|
}
|
|
67
57
|
const query = {
|
|
68
|
-
[graphqlApiQueries_1.Queries.
|
|
58
|
+
[graphqlApiQueries_1.Queries.SELECT_ONE_BY_ID]: {
|
|
69
59
|
__args: queryArguments,
|
|
70
60
|
[graphqlApiQueries_1.SelectableField.DATA]: fieldSchema,
|
|
71
61
|
[graphqlApiQueries_1.SelectableField.ERRORS]: {
|
|
@@ -75,10 +65,10 @@ class GraphqlApiClient extends abstractGraphQLClient_1.AbstractGraphQLClient {
|
|
|
75
65
|
};
|
|
76
66
|
const queryStr = this.stringifyQuery(query);
|
|
77
67
|
const result = await this.find(queryStr);
|
|
78
|
-
if ((_d = (_c = (_b = result === null || result === void 0 ? void 0 : result[graphqlApiQueries_1.Queries.
|
|
79
|
-
throw new Error((_f = (_e = result === null || result === void 0 ? void 0 : result[graphqlApiQueries_1.Queries.
|
|
68
|
+
if ((_d = (_c = (_b = result === null || result === void 0 ? void 0 : result[graphqlApiQueries_1.Queries.SELECT_ONE_BY_ID]) === null || _b === void 0 ? void 0 : _b[graphqlApiQueries_1.SelectableField.ERRORS]) === null || _c === void 0 ? void 0 : _c[graphqlApiQueries_1.ErrorsField.MESSAGE]) === null || _d === void 0 ? void 0 : _d.length) {
|
|
69
|
+
throw new Error((_f = (_e = result === null || result === void 0 ? void 0 : result[graphqlApiQueries_1.Queries.SELECT_ONE_BY_ID]) === null || _e === void 0 ? void 0 : _e[graphqlApiQueries_1.SelectableField.ERRORS]) === null || _f === void 0 ? void 0 : _f[graphqlApiQueries_1.ErrorsField.MESSAGE]);
|
|
80
70
|
}
|
|
81
|
-
return (_h = (_g = result === null || result === void 0 ? void 0 : result[graphqlApiQueries_1.Queries.
|
|
71
|
+
return (_h = (_g = result === null || result === void 0 ? void 0 : result[graphqlApiQueries_1.Queries.SELECT_ONE_BY_ID]) === null || _g === void 0 ? void 0 : _g[graphqlApiQueries_1.SelectableField.DATA]) === null || _h === void 0 ? void 0 : _h[type];
|
|
82
72
|
}
|
|
83
73
|
async findEndCustomerById(id, fields, pagination) {
|
|
84
74
|
return await this.findOneById(id, {
|
|
@@ -95,6 +85,41 @@ class GraphqlApiClient extends abstractGraphQLClient_1.AbstractGraphQLClient {
|
|
|
95
85
|
[graphqlApiQueries_1.SelectDataField.ARROW_COMPANY]: fields,
|
|
96
86
|
}, pagination);
|
|
97
87
|
}
|
|
88
|
+
async getLocalContact(programInternalName, partnerId, fieldSchema) {
|
|
89
|
+
const query = {
|
|
90
|
+
[graphqlApiQueries_1.Queries.GET_LOCAL_CONTACT]: {
|
|
91
|
+
__args: {
|
|
92
|
+
programInternalName,
|
|
93
|
+
partnerId,
|
|
94
|
+
},
|
|
95
|
+
[graphqlApiQueries_1.SelectableField.DATA]: {
|
|
96
|
+
contact: fieldSchema,
|
|
97
|
+
},
|
|
98
|
+
[graphqlApiQueries_1.SelectableField.ERRORS]: {
|
|
99
|
+
[graphqlApiQueries_1.ErrorsField.MESSAGE]: true,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
return await this.find(this.stringifyQuery(query));
|
|
104
|
+
}
|
|
105
|
+
async getSpecialPriceRatesHistory(licenseId, fieldSchema, pagination, additionalParams) {
|
|
106
|
+
const query = {
|
|
107
|
+
[graphqlApiQueries_1.Queries.GET_SPECIAL_PRICE_RATES_HISTORY]: {
|
|
108
|
+
__args: {
|
|
109
|
+
licenseId,
|
|
110
|
+
...additionalParams,
|
|
111
|
+
},
|
|
112
|
+
[graphqlApiQueries_1.SelectableField.DATA]: {
|
|
113
|
+
specialPriceRate: fieldSchema,
|
|
114
|
+
},
|
|
115
|
+
[graphqlApiQueries_1.SelectableField.ERRORS]: {
|
|
116
|
+
[graphqlApiQueries_1.ErrorsField.MESSAGE]: true,
|
|
117
|
+
},
|
|
118
|
+
[graphqlApiQueries_1.SelectableField.PAGINATION]: pagination,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
return await this.find(this.stringifyQuery(query));
|
|
122
|
+
}
|
|
98
123
|
}
|
|
99
124
|
exports.GraphqlApiClient = GraphqlApiClient;
|
|
100
125
|
//# sourceMappingURL=graphqlApiClient.js.map
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { ArrowCompanyType, EndCustomerType, PartnerType } from './entities/company';
|
|
2
|
+
import { ContactsType } from './entities/contact';
|
|
2
3
|
import { ContinentType, CountryType } from './entities/country';
|
|
3
4
|
import { LicenseBudgetType } from './entities/licenseBudget';
|
|
4
5
|
import { PartnertagType } from './entities/partnertag';
|
|
5
6
|
import { GraphqlApiProgramType, SubscribedProgramType } from './entities/program';
|
|
6
7
|
import { QuoteType } from './entities/quote';
|
|
8
|
+
import { SpecialPriceRateType } from './entities/specialPriceRate';
|
|
7
9
|
import { SubscriptionType } from './entities/subscription';
|
|
8
10
|
import { UserHistoryType, UserType } from './entities/user';
|
|
9
11
|
import { WorkgroupType } from './entities/workgroup';
|
|
10
|
-
import { ErrorsSchema, PageSchema, SelectAllResponseDataSchema, SelectOneResponseDataSchema } from './graphqlApiSchemas';
|
|
12
|
+
import { ContactsSchema, ErrorsSchema, PageSchema, SelectAllResponseDataSchema, SelectOneResponseDataSchema, SpecialPriceRateSchema } from './graphqlApiSchemas';
|
|
11
13
|
/**
|
|
12
14
|
* For field __args
|
|
13
15
|
*/
|
|
@@ -113,6 +115,7 @@ export declare enum SelectableField {
|
|
|
113
115
|
}
|
|
114
116
|
export declare enum SelectDataField {
|
|
115
117
|
ARROW_COMPANY = "arrowCompany",
|
|
118
|
+
CONTACT = "contact",
|
|
116
119
|
CONTINENT = "continent",
|
|
117
120
|
COUNTRY = "country",
|
|
118
121
|
END_CUSTOMER = "endCustomer",
|
|
@@ -121,6 +124,7 @@ export declare enum SelectDataField {
|
|
|
121
124
|
PARTNERTAG = "partnertag",
|
|
122
125
|
PROGRAM = "program",
|
|
123
126
|
QUOTE = "quote",
|
|
127
|
+
SPECIAL_PRICE_RATE = "specialPriceRate",
|
|
124
128
|
SUBSCRIBED_PROGRAM = "subscribedProgram",
|
|
125
129
|
SUBSCRIPTION = "subscription",
|
|
126
130
|
USER = "user",
|
|
@@ -177,12 +181,28 @@ export declare type PageType = {
|
|
|
177
181
|
[PaginationField.TOTAL_PAGES]?: number;
|
|
178
182
|
};
|
|
179
183
|
export declare type SelectOneResultType = {
|
|
180
|
-
[Queries
|
|
184
|
+
[K in Queries]?: {
|
|
181
185
|
[SelectableField.DATA]?: SelectOneResponseDataType;
|
|
182
186
|
[SelectableField.ERRORS]?: ErrorsType;
|
|
183
187
|
[SelectableField.PAGINATION]?: PageType;
|
|
184
188
|
};
|
|
185
189
|
};
|
|
190
|
+
export declare type GetLocalContactResultType = {
|
|
191
|
+
[Queries.GET_LOCAL_CONTACT]: {
|
|
192
|
+
[SelectableField.DATA]?: {
|
|
193
|
+
[SelectDataField.CONTACT]: ContactsType;
|
|
194
|
+
};
|
|
195
|
+
[SelectableField.ERRORS]?: ErrorsType;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
export declare type GetSpecialPriceRatesHistoryResultType = {
|
|
199
|
+
[Queries.GET_SPECIAL_PRICE_RATES_HISTORY]: {
|
|
200
|
+
[SelectableField.DATA]?: {
|
|
201
|
+
[SelectDataField.SPECIAL_PRICE_RATE]: SpecialPriceRateType;
|
|
202
|
+
};
|
|
203
|
+
[SelectableField.ERRORS]?: ErrorsType;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
186
206
|
export declare type SelectOneResponseDataType = {
|
|
187
207
|
[SelectDataField.ARROW_COMPANY]?: ArrowCompanyType;
|
|
188
208
|
[SelectDataField.CONTINENT]?: ContinentType;
|
|
@@ -217,10 +237,27 @@ export declare type QueryVariablesType = {
|
|
|
217
237
|
[QueryVariablesField.SORT]?: InputSortFilterType[];
|
|
218
238
|
[QueryVariablesField.OPTIONS]?: InputQueryOptionsType;
|
|
219
239
|
};
|
|
240
|
+
export declare type SelectOneByIdQueryVariablesType = {
|
|
241
|
+
id: number;
|
|
242
|
+
[QueryVariablesField.EXCLUSION_FILTERS]?: InputSearchFilterType;
|
|
243
|
+
[QueryVariablesField.FILTERS]?: InputSearchFilterType;
|
|
244
|
+
[QueryVariablesField.PAGINATION]?: InputPaginationType;
|
|
245
|
+
};
|
|
220
246
|
export declare enum Queries {
|
|
221
247
|
SELECT_ALL = "selectAll",
|
|
222
|
-
SELECT_ONE = "selectOne"
|
|
248
|
+
SELECT_ONE = "selectOne",
|
|
249
|
+
SELECT_ONE_BY_ID = "selectOneById",
|
|
250
|
+
GET_LOCAL_CONTACT = "getLocalContact",
|
|
251
|
+
GET_SPECIAL_PRICE_RATES_HISTORY = "getSpecialPriceRatesHistory"
|
|
223
252
|
}
|
|
253
|
+
export declare type SelectAllQueryType = {
|
|
254
|
+
[Queries.SELECT_ALL]: {
|
|
255
|
+
__args?: QueryVariablesType;
|
|
256
|
+
[SelectableField.DATA]: SelectAllResponseDataSchema;
|
|
257
|
+
[SelectableField.ERRORS]?: ErrorsSchema;
|
|
258
|
+
[SelectableField.PAGINATION]?: PageSchema;
|
|
259
|
+
};
|
|
260
|
+
};
|
|
224
261
|
export declare type SelectOneQueryType = {
|
|
225
262
|
[Queries.SELECT_ONE]: {
|
|
226
263
|
__args?: QueryVariablesType;
|
|
@@ -229,10 +266,34 @@ export declare type SelectOneQueryType = {
|
|
|
229
266
|
[SelectableField.PAGINATION]?: PageSchema;
|
|
230
267
|
};
|
|
231
268
|
};
|
|
232
|
-
export declare type
|
|
233
|
-
[Queries.
|
|
234
|
-
__args
|
|
235
|
-
[SelectableField.DATA]:
|
|
269
|
+
export declare type SelectOneByIdQueryType = {
|
|
270
|
+
[Queries.SELECT_ONE_BY_ID]: {
|
|
271
|
+
__args: SelectOneByIdQueryVariablesType;
|
|
272
|
+
[SelectableField.DATA]: SelectOneResponseDataSchema;
|
|
273
|
+
[SelectableField.ERRORS]?: ErrorsSchema;
|
|
274
|
+
[SelectableField.PAGINATION]?: PageSchema;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
export declare type GetLocalContactQueryType = {
|
|
278
|
+
[Queries.GET_LOCAL_CONTACT]: {
|
|
279
|
+
__args: {
|
|
280
|
+
programInternalName: string;
|
|
281
|
+
partnerId: number;
|
|
282
|
+
};
|
|
283
|
+
[SelectableField.DATA]: {
|
|
284
|
+
[SelectDataField.CONTACT]: ContactsSchema;
|
|
285
|
+
};
|
|
286
|
+
[SelectableField.ERRORS]?: ErrorsSchema;
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
export declare type GetSpecialPriceRatesHistoryQueryType = {
|
|
290
|
+
[Queries.GET_SPECIAL_PRICE_RATES_HISTORY]: {
|
|
291
|
+
__args: {
|
|
292
|
+
licenseId: number;
|
|
293
|
+
} & QueryVariablesType;
|
|
294
|
+
[SelectableField.DATA]: {
|
|
295
|
+
[SelectDataField.SPECIAL_PRICE_RATE]: SpecialPriceRateSchema;
|
|
296
|
+
};
|
|
236
297
|
[SelectableField.ERRORS]?: ErrorsSchema;
|
|
237
298
|
[SelectableField.PAGINATION]?: PageSchema;
|
|
238
299
|
};
|
|
@@ -91,6 +91,7 @@ var SelectableField;
|
|
|
91
91
|
var SelectDataField;
|
|
92
92
|
(function (SelectDataField) {
|
|
93
93
|
SelectDataField["ARROW_COMPANY"] = "arrowCompany";
|
|
94
|
+
SelectDataField["CONTACT"] = "contact";
|
|
94
95
|
SelectDataField["CONTINENT"] = "continent";
|
|
95
96
|
SelectDataField["COUNTRY"] = "country";
|
|
96
97
|
SelectDataField["END_CUSTOMER"] = "endCustomer";
|
|
@@ -99,6 +100,7 @@ var SelectDataField;
|
|
|
99
100
|
SelectDataField["PARTNERTAG"] = "partnertag";
|
|
100
101
|
SelectDataField["PROGRAM"] = "program";
|
|
101
102
|
SelectDataField["QUOTE"] = "quote";
|
|
103
|
+
SelectDataField["SPECIAL_PRICE_RATE"] = "specialPriceRate";
|
|
102
104
|
SelectDataField["SUBSCRIBED_PROGRAM"] = "subscribedProgram";
|
|
103
105
|
SelectDataField["SUBSCRIPTION"] = "subscription";
|
|
104
106
|
SelectDataField["USER"] = "user";
|
|
@@ -134,5 +136,8 @@ var Queries;
|
|
|
134
136
|
(function (Queries) {
|
|
135
137
|
Queries["SELECT_ALL"] = "selectAll";
|
|
136
138
|
Queries["SELECT_ONE"] = "selectOne";
|
|
139
|
+
Queries["SELECT_ONE_BY_ID"] = "selectOneById";
|
|
140
|
+
Queries["GET_LOCAL_CONTACT"] = "getLocalContact";
|
|
141
|
+
Queries["GET_SPECIAL_PRICE_RATES_HISTORY"] = "getSpecialPriceRatesHistory";
|
|
137
142
|
})(Queries = exports.Queries || (exports.Queries = {}));
|
|
138
143
|
//# sourceMappingURL=graphqlApiQueries.js.map
|
package/package.json
CHANGED