@arrowsphere/api-client 3.70.0-rc.bdj.3 → 3.70.0-rc.bdj.5

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,6 +1,6 @@
1
1
  import { AbstractGraphQLClient } from '../abstractGraphQLClient';
2
2
  import { ArrowCompanyType, EndCustomerType, PartnerType } from './types/entities/company';
3
- import { SelectAllQueryType, SelectAllResultType, SelectOneQueryType, SelectOneResultType } from './types/graphqlApiQueries';
3
+ import { InputPaginationType, SelectAllQueryType, SelectAllResultType, SelectOneQueryType, SelectOneResultType } from './types/graphqlApiQueries';
4
4
  import { ArrowCompanySchema, EndCustomerSchema, PartnerSchema, SelectOneResponseDataSchema } from './types/graphqlApiSchemas';
5
5
  export declare class GraphqlApiClient extends AbstractGraphQLClient {
6
6
  /**
@@ -10,8 +10,8 @@ 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): Promise<T | null>;
14
- findEndCustomerById(id: number, fields: EndCustomerSchema): Promise<EndCustomerType | null>;
15
- findPartnerById(id: number, fields: PartnerSchema): Promise<PartnerType | null>;
16
- findArrowCompanyById(id: number, fields: ArrowCompanySchema): Promise<ArrowCompanyType | null>;
13
+ findOneById<T>(id: number, fieldSchema: SelectOneResponseDataSchema, pagination?: InputPaginationType): Promise<T | null>;
14
+ findEndCustomerById(id: number, fields: EndCustomerSchema, pagination?: InputPaginationType): Promise<EndCustomerType | null>;
15
+ findPartnerById(id: number, fields: PartnerSchema, pagination?: InputPaginationType): Promise<PartnerType | null>;
16
+ findArrowCompanyById(id: number, fields: ArrowCompanySchema, pagination?: InputPaginationType): Promise<ArrowCompanyType | null>;
17
17
  }
@@ -30,30 +30,43 @@ 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) {
34
- var _a, _b, _c, _d, _e, _f, _g;
33
+ async findOneById(id, fieldSchema, pagination) {
34
+ var _a, _b, _c, _d, _e, _f, _g, _h;
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
- const query = {
41
- [graphqlApiQueries_1.Queries.SELECT_ONE]: {
42
- __args: {
43
- [graphqlApiQueries_1.QueryVariablesField.FILTERS]: {
44
- [graphqlApiQueries_1.InputSearchFilterField.GROUPS]: [
40
+ const queryArguments = {
41
+ [graphqlApiQueries_1.QueryVariablesField.FILTERS]: {
42
+ [graphqlApiQueries_1.InputSearchFilterField.GROUPS]: [
43
+ {
44
+ [graphqlApiQueries_1.InputFiltersField.ITEMS]: [
45
45
  {
46
- [graphqlApiQueries_1.InputFiltersField.ITEMS]: [
47
- {
48
- [graphqlApiQueries_1.InputFilterValueField.NAME]: 'id',
49
- [graphqlApiQueries_1.InputFilterValueField.OPERATOR]: graphqlApiQueries_1.ComparisonOperator.EQUALS,
50
- [graphqlApiQueries_1.InputFilterValueField.VALUE]: [`${id}`],
51
- },
52
- ],
46
+ [graphqlApiQueries_1.InputFilterValueField.NAME]: 'id',
47
+ [graphqlApiQueries_1.InputFilterValueField.OPERATOR]: graphqlApiQueries_1.ComparisonOperator.EQUALS,
48
+ [graphqlApiQueries_1.InputFilterValueField.VALUE]: [`${id}`],
53
49
  },
54
50
  ],
55
51
  },
56
- },
52
+ ],
53
+ },
54
+ };
55
+ if ((pagination === null || pagination === void 0 ? void 0 : pagination[graphqlApiQueries_1.InputPaginationField.PER_PAGE]) ||
56
+ (pagination === null || pagination === void 0 ? void 0 : pagination[graphqlApiQueries_1.InputPaginationField.PAGE])) {
57
+ queryArguments[graphqlApiQueries_1.QueryVariablesField.PAGINATION] = {
58
+ [graphqlApiQueries_1.InputPaginationField.PAGE]: (_a = pagination === null || pagination === void 0 ? void 0 : pagination[graphqlApiQueries_1.InputPaginationField.PAGE]) !== null && _a !== void 0 ? _a : 1,
59
+ };
60
+ if (pagination === null || pagination === void 0 ? void 0 : pagination[graphqlApiQueries_1.InputPaginationField.PER_PAGE]) {
61
+ queryArguments[graphqlApiQueries_1.QueryVariablesField.PAGINATION] = {
62
+ ...queryArguments[graphqlApiQueries_1.QueryVariablesField.PAGINATION],
63
+ [graphqlApiQueries_1.InputPaginationField.PER_PAGE]: pagination === null || pagination === void 0 ? void 0 : pagination[graphqlApiQueries_1.InputPaginationField.PER_PAGE],
64
+ };
65
+ }
66
+ }
67
+ const query = {
68
+ [graphqlApiQueries_1.Queries.SELECT_ONE]: {
69
+ __args: queryArguments,
57
70
  [graphqlApiQueries_1.SelectableField.DATA]: fieldSchema,
58
71
  [graphqlApiQueries_1.SelectableField.ERRORS]: {
59
72
  [graphqlApiQueries_1.ErrorsField.MESSAGE]: true,
@@ -62,25 +75,25 @@ class GraphqlApiClient extends abstractGraphQLClient_1.AbstractGraphQLClient {
62
75
  };
63
76
  const queryStr = this.stringifyQuery(query);
64
77
  const result = await this.find(queryStr);
65
- if ((_c = (_b = (_a = result === null || result === void 0 ? void 0 : result[graphqlApiQueries_1.Queries.SELECT_ONE]) === null || _a === void 0 ? void 0 : _a[graphqlApiQueries_1.SelectableField.ERRORS]) === null || _b === void 0 ? void 0 : _b[graphqlApiQueries_1.ErrorsField.MESSAGE]) === null || _c === void 0 ? void 0 : _c.length) {
66
- throw new Error((_e = (_d = result === null || result === void 0 ? void 0 : result[graphqlApiQueries_1.Queries.SELECT_ONE]) === null || _d === void 0 ? void 0 : _d[graphqlApiQueries_1.SelectableField.ERRORS]) === null || _e === void 0 ? void 0 : _e[graphqlApiQueries_1.ErrorsField.MESSAGE]);
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]);
67
80
  }
68
- return (_g = (_f = result === null || result === void 0 ? void 0 : result[graphqlApiQueries_1.Queries.SELECT_ONE]) === null || _f === void 0 ? void 0 : _f[graphqlApiQueries_1.SelectableField.DATA]) === null || _g === void 0 ? void 0 : _g[type];
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];
69
82
  }
70
- async findEndCustomerById(id, fields) {
83
+ async findEndCustomerById(id, fields, pagination) {
71
84
  return await this.findOneById(id, {
72
85
  [graphqlApiQueries_1.SelectDataField.END_CUSTOMER]: fields,
73
- });
86
+ }, pagination);
74
87
  }
75
- async findPartnerById(id, fields) {
88
+ async findPartnerById(id, fields, pagination) {
76
89
  return await this.findOneById(id, {
77
90
  [graphqlApiQueries_1.SelectDataField.PARTNER]: fields,
78
- });
91
+ }, pagination);
79
92
  }
80
- async findArrowCompanyById(id, fields) {
93
+ async findArrowCompanyById(id, fields, pagination) {
81
94
  return await this.findOneById(id, {
82
95
  [graphqlApiQueries_1.SelectDataField.ARROW_COMPANY]: fields,
83
- });
96
+ }, pagination);
84
97
  }
85
98
  }
86
99
  exports.GraphqlApiClient = GraphqlApiClient;
@@ -4,5 +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/partnertag';
7
+ export * from './types/entities/subscription';
7
8
  export * from './types/entities/workgroup';
8
9
  export * from './graphqlApiClient';
@@ -20,6 +20,7 @@ __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/partnertag"), exports);
23
+ __exportStar(require("./types/entities/subscription"), exports);
23
24
  __exportStar(require("./types/entities/workgroup"), exports);
24
25
  __exportStar(require("./graphqlApiClient"), exports);
25
26
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,7 @@
1
1
  import { ArrowCompanyType, EndCustomerType, PartnerType } from './entities/company';
2
2
  import { ContinentType, CountryType } from './entities/country';
3
3
  import { PartnertagType } from './entities/partnertag';
4
+ import { SubscriptionType } from './entities/subscription';
4
5
  import { WorkgroupType } from './entities/workgroup';
5
6
  import { ErrorsSchema, PageSchema, SelectAllResponseDataSchema, SelectOneResponseDataSchema } from './graphqlApiSchemas';
6
7
  /**
@@ -113,6 +114,7 @@ export declare enum SelectDataField {
113
114
  END_CUSTOMER = "endCustomer",
114
115
  PARTNER = "partner",
115
116
  PARTNERTAG = "partnertag",
117
+ SUBSCRIPTION = "subscription",
116
118
  WORKGROUP = "workgroup"
117
119
  }
118
120
  export declare type SelectAllResultType = {
@@ -129,6 +131,7 @@ export declare type SelectAllResponseDataType = {
129
131
  [SelectDataField.END_CUSTOMER]?: EndCustomerType[];
130
132
  [SelectDataField.PARTNER]?: PartnerType[];
131
133
  [SelectDataField.PARTNERTAG]?: PartnertagType[];
134
+ [SelectDataField.SUBSCRIPTION]?: SubscriptionType[];
132
135
  [SelectDataField.WORKGROUP]?: WorkgroupType[];
133
136
  };
134
137
  export declare enum ErrorsField {
@@ -170,6 +173,7 @@ export declare type SelectOneResponseDataType = {
170
173
  [SelectDataField.END_CUSTOMER]?: EndCustomerType;
171
174
  [SelectDataField.PARTNER]?: PartnerType;
172
175
  [SelectDataField.PARTNERTAG]?: PartnertagType;
176
+ [SelectDataField.SUBSCRIPTION]?: SubscriptionType;
173
177
  [SelectDataField.WORKGROUP]?: WorkgroupType;
174
178
  };
175
179
  export declare enum QueryVariablesField {
@@ -196,7 +200,7 @@ export declare enum Queries {
196
200
  }
197
201
  export declare type SelectOneQueryType = {
198
202
  [Queries.SELECT_ONE]: {
199
- __args?: Omit<QueryVariablesType, QueryVariablesField.PAGINATION>;
203
+ __args?: QueryVariablesType;
200
204
  [SelectableField.DATA]: SelectOneResponseDataSchema;
201
205
  [SelectableField.ERRORS]?: ErrorsSchema;
202
206
  };
@@ -96,6 +96,7 @@ var SelectDataField;
96
96
  SelectDataField["END_CUSTOMER"] = "endCustomer";
97
97
  SelectDataField["PARTNER"] = "partner";
98
98
  SelectDataField["PARTNERTAG"] = "partnertag";
99
+ SelectDataField["SUBSCRIPTION"] = "subscription";
99
100
  SelectDataField["WORKGROUP"] = "workgroup";
100
101
  })(SelectDataField = exports.SelectDataField || (exports.SelectDataField = {}));
101
102
  var ErrorsField;
@@ -41,6 +41,7 @@ export declare type SelectAllResponseDataSchema = {
41
41
  [SelectDataField.END_CUSTOMER]?: EndCustomerSchema;
42
42
  [SelectDataField.PARTNER]?: PartnerSchema;
43
43
  [SelectDataField.PARTNERTAG]?: PartnertagSchema;
44
+ [SelectDataField.SUBSCRIPTION]?: SubscriptionSchema;
44
45
  [SelectDataField.WORKGROUP]?: WorkgroupSchema;
45
46
  };
46
47
  export declare type SelectOneResultSchema = {
@@ -54,6 +55,7 @@ export declare type SelectOneResponseDataSchema = {
54
55
  [SelectDataField.END_CUSTOMER]?: EndCustomerSchema;
55
56
  [SelectDataField.PARTNER]?: PartnerSchema;
56
57
  [SelectDataField.PARTNERTAG]?: PartnertagSchema;
58
+ [SelectDataField.SUBSCRIPTION]?: SubscriptionSchema;
57
59
  [SelectDataField.WORKGROUP]?: WorkgroupSchema;
58
60
  };
59
61
  export declare type SelectAllQuerySchema = {
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.70.0-rc.bdj.3",
7
+ "version": "3.70.0-rc.bdj.5",
8
8
  "description": "Node.js client for ArrowSphere's public API",
9
9
  "main": "build/index.js",
10
10
  "types": "build/index.d.ts",