@arrowsphere/api-client 3.168.0 → 3.169.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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4
4
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [3.169.0] - 2025.02.07
7
+
8
+ ### Added
9
+ - [order] Define a new type for programs
10
+ - [graphql-api] add queries getLocalContact, getSpecialPriceRatesHistory
11
+ ### Updated
12
+ - [graphql-api] update query findOneById
13
+
6
14
  ## [3.168.0] - 2025.02.05
7
15
 
8
16
  ### Added
@@ -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,27 +30,17 @@ 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) {
34
- var _a, _b, _c, _d, _e, _f, _g, _h;
33
+ async findOneById(id, fieldSchema, pagination, filters, exclusionFilters) {
34
+ var _a, _b, _c, _d, _e;
35
35
  const keys = Object.keys(fieldSchema);
36
36
  if (keys.length === 0) {
37
37
  return null;
38
38
  }
39
39
  const type = keys[0];
40
40
  const queryArguments = {
41
- [graphqlApiQueries_1.QueryVariablesField.FILTERS]: {
42
- [graphqlApiQueries_1.InputSearchFilterField.GROUPS]: [
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.SELECT_ONE]: {
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.SELECT_ONE]) === 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) {
79
- throw new Error((_f = (_e = result === null || result === void 0 ? void 0 : result[graphqlApiQueries_1.Queries.SELECT_ONE]) === null || _e === void 0 ? void 0 : _e[graphqlApiQueries_1.SelectableField.ERRORS]) === null || _f === void 0 ? void 0 : _f[graphqlApiQueries_1.ErrorsField.MESSAGE]);
68
+ if ((_c = (_b = result === null || result === void 0 ? void 0 : result[graphqlApiQueries_1.Queries.SELECT_ONE_BY_ID][graphqlApiQueries_1.SelectableField.ERRORS]) === null || _b === void 0 ? void 0 : _b[graphqlApiQueries_1.ErrorsField.MESSAGE]) === null || _c === void 0 ? void 0 : _c.length) {
69
+ throw new Error((_d = result === null || result === void 0 ? void 0 : result[graphqlApiQueries_1.Queries.SELECT_ONE_BY_ID][graphqlApiQueries_1.SelectableField.ERRORS]) === null || _d === void 0 ? void 0 : _d[graphqlApiQueries_1.ErrorsField.MESSAGE]);
80
70
  }
81
- return (_h = (_g = result === null || result === void 0 ? void 0 : result[graphqlApiQueries_1.Queries.SELECT_ONE]) === null || _g === void 0 ? void 0 : _g[graphqlApiQueries_1.SelectableField.DATA]) === null || _h === void 0 ? void 0 : _h[type];
71
+ return (_e = result === null || result === void 0 ? void 0 : result[graphqlApiQueries_1.Queries.SELECT_ONE_BY_ID][graphqlApiQueries_1.SelectableField.DATA]) === null || _e === void 0 ? void 0 : _e[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",
@@ -183,6 +187,30 @@ export declare type SelectOneResultType = {
183
187
  [SelectableField.PAGINATION]?: PageType;
184
188
  };
185
189
  };
190
+ export declare type SelectOneByIdResultType = {
191
+ [Queries.SELECT_ONE_BY_ID]: {
192
+ [SelectableField.DATA]?: SelectOneResponseDataType;
193
+ [SelectableField.ERRORS]?: ErrorsType;
194
+ [SelectableField.PAGINATION]?: PageType;
195
+ };
196
+ };
197
+ export declare type GetLocalContactResultType = {
198
+ [Queries.GET_LOCAL_CONTACT]: {
199
+ [SelectableField.DATA]?: {
200
+ [SelectDataField.CONTACT]: ContactsType;
201
+ };
202
+ [SelectableField.ERRORS]?: ErrorsType;
203
+ };
204
+ };
205
+ export declare type GetSpecialPriceRatesHistoryResultType = {
206
+ [Queries.GET_SPECIAL_PRICE_RATES_HISTORY]: {
207
+ [SelectableField.DATA]?: {
208
+ [SelectDataField.SPECIAL_PRICE_RATE]: SpecialPriceRateType[];
209
+ };
210
+ [SelectableField.ERRORS]?: ErrorsType;
211
+ [SelectableField.PAGINATION]?: PageType;
212
+ };
213
+ };
186
214
  export declare type SelectOneResponseDataType = {
187
215
  [SelectDataField.ARROW_COMPANY]?: ArrowCompanyType;
188
216
  [SelectDataField.CONTINENT]?: ContinentType;
@@ -217,10 +245,27 @@ export declare type QueryVariablesType = {
217
245
  [QueryVariablesField.SORT]?: InputSortFilterType[];
218
246
  [QueryVariablesField.OPTIONS]?: InputQueryOptionsType;
219
247
  };
248
+ export declare type SelectOneByIdQueryVariablesType = {
249
+ id: number;
250
+ [QueryVariablesField.EXCLUSION_FILTERS]?: InputSearchFilterType;
251
+ [QueryVariablesField.FILTERS]?: InputSearchFilterType;
252
+ [QueryVariablesField.PAGINATION]?: InputPaginationType;
253
+ };
220
254
  export declare enum Queries {
221
255
  SELECT_ALL = "selectAll",
222
- SELECT_ONE = "selectOne"
256
+ SELECT_ONE = "selectOne",
257
+ SELECT_ONE_BY_ID = "selectOneById",
258
+ GET_LOCAL_CONTACT = "getLocalContact",
259
+ GET_SPECIAL_PRICE_RATES_HISTORY = "getSpecialPriceRatesHistory"
223
260
  }
261
+ export declare type SelectAllQueryType = {
262
+ [Queries.SELECT_ALL]: {
263
+ __args?: QueryVariablesType;
264
+ [SelectableField.DATA]: SelectAllResponseDataSchema;
265
+ [SelectableField.ERRORS]?: ErrorsSchema;
266
+ [SelectableField.PAGINATION]?: PageSchema;
267
+ };
268
+ };
224
269
  export declare type SelectOneQueryType = {
225
270
  [Queries.SELECT_ONE]: {
226
271
  __args?: QueryVariablesType;
@@ -229,10 +274,34 @@ export declare type SelectOneQueryType = {
229
274
  [SelectableField.PAGINATION]?: PageSchema;
230
275
  };
231
276
  };
232
- export declare type SelectAllQueryType = {
233
- [Queries.SELECT_ALL]: {
234
- __args?: QueryVariablesType;
235
- [SelectableField.DATA]: SelectAllResponseDataSchema;
277
+ export declare type SelectOneByIdQueryType = {
278
+ [Queries.SELECT_ONE_BY_ID]: {
279
+ __args: SelectOneByIdQueryVariablesType;
280
+ [SelectableField.DATA]: SelectOneResponseDataSchema;
281
+ [SelectableField.ERRORS]?: ErrorsSchema;
282
+ [SelectableField.PAGINATION]?: PageSchema;
283
+ };
284
+ };
285
+ export declare type GetLocalContactQueryType = {
286
+ [Queries.GET_LOCAL_CONTACT]: {
287
+ __args: {
288
+ programInternalName: string;
289
+ partnerId: number;
290
+ };
291
+ [SelectableField.DATA]: {
292
+ [SelectDataField.CONTACT]: ContactsSchema;
293
+ };
294
+ [SelectableField.ERRORS]?: ErrorsSchema;
295
+ };
296
+ };
297
+ export declare type GetSpecialPriceRatesHistoryQueryType = {
298
+ [Queries.GET_SPECIAL_PRICE_RATES_HISTORY]: {
299
+ __args: {
300
+ licenseId: number;
301
+ } & QueryVariablesType;
302
+ [SelectableField.DATA]: {
303
+ [SelectDataField.SPECIAL_PRICE_RATE]: SpecialPriceRateSchema;
304
+ };
236
305
  [SelectableField.ERRORS]?: ErrorsSchema;
237
306
  [SelectableField.PAGINATION]?: PageSchema;
238
307
  };
@@ -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
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/ArrowSphere/nodejs-api-client.git"
6
6
  },
7
- "version": "3.168.0",
7
+ "version": "3.169.0",
8
8
  "description": "Node.js client for ArrowSphere's public API",
9
9
  "main": "build/index.js",
10
10
  "types": "build/index.d.ts",