@arrowsphere/api-client 3.62.0-rc.bdj.1 → 3.63.0-rc.bdj.2
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,11 @@
|
|
|
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.62.0] - 2023-11-08
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
- add partners delete endpoint
|
|
10
|
+
|
|
6
11
|
## [3.61.0] - 2023-11-02
|
|
7
12
|
|
|
8
13
|
### Changed
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { AbstractGraphQLClient } from '../abstractGraphQLClient';
|
|
2
|
+
import { ArrowCompanyType, EndCustomerType, PartnerType } from './types/entities/company';
|
|
2
3
|
import { SelectAllQueryType, SelectAllResultType, SelectOneQueryType, SelectOneResultType } from './types/graphqlApiQueries';
|
|
4
|
+
import { ArrowCompanySchema, EndCustomerSchema, PartnerSchema, SelectOneResponseDataSchema } from './types/graphqlApiSchemas';
|
|
3
5
|
export declare class GraphqlApiClient extends AbstractGraphQLClient {
|
|
4
6
|
/**
|
|
5
7
|
* The Path of graphql catalog API
|
|
@@ -8,4 +10,8 @@ export declare class GraphqlApiClient extends AbstractGraphQLClient {
|
|
|
8
10
|
find<GraphQLResponseTypes>(request: string): Promise<GraphQLResponseTypes | null>;
|
|
9
11
|
selectAll(query: SelectAllQueryType): Promise<SelectAllResultType | null>;
|
|
10
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>;
|
|
11
17
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GraphqlApiClient = void 0;
|
|
4
4
|
const abstractGraphQLClient_1 = require("../abstractGraphQLClient");
|
|
5
|
+
const graphqlApiQueries_1 = require("./types/graphqlApiQueries");
|
|
5
6
|
class GraphqlApiClient extends abstractGraphQLClient_1.AbstractGraphQLClient {
|
|
6
7
|
constructor() {
|
|
7
8
|
super(...arguments);
|
|
@@ -29,6 +30,58 @@ class GraphqlApiClient extends abstractGraphQLClient_1.AbstractGraphQLClient {
|
|
|
29
30
|
const result = await this.find(queryStr);
|
|
30
31
|
return result;
|
|
31
32
|
}
|
|
33
|
+
async findOneById(id, fieldSchema) {
|
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
35
|
+
const keys = Object.keys(fieldSchema);
|
|
36
|
+
if (keys.length === 0) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
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]: [
|
|
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
|
+
],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
[graphqlApiQueries_1.SelectableField.DATA]: fieldSchema,
|
|
58
|
+
[graphqlApiQueries_1.SelectableField.ERRORS]: {
|
|
59
|
+
[graphqlApiQueries_1.ErrorsField.MESSAGE]: true,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
const queryStr = this.stringifyQuery(query);
|
|
64
|
+
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]);
|
|
67
|
+
}
|
|
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];
|
|
69
|
+
}
|
|
70
|
+
async findEndCustomerById(id, fields) {
|
|
71
|
+
return await this.findOneById(id, {
|
|
72
|
+
[graphqlApiQueries_1.SelectDataField.END_CUSTOMER]: fields,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
async findPartnerById(id, fields) {
|
|
76
|
+
return await this.findOneById(id, {
|
|
77
|
+
[graphqlApiQueries_1.SelectDataField.PARTNER]: fields,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
async findArrowCompanyById(id, fields) {
|
|
81
|
+
return await this.findOneById(id, {
|
|
82
|
+
[graphqlApiQueries_1.SelectDataField.ARROW_COMPANY]: fields,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
32
85
|
}
|
|
33
86
|
exports.GraphqlApiClient = GraphqlApiClient;
|
|
34
87
|
//# sourceMappingURL=graphqlApiClient.js.map
|
|
@@ -2,7 +2,7 @@ import { ArrowCompanyType, EndCustomerType, PartnerType } from './entities/compa
|
|
|
2
2
|
import { ContinentType, CountryType } from './entities/country';
|
|
3
3
|
import { PartnertagType } from './entities/partnertag';
|
|
4
4
|
import { WorkgroupType } from './entities/workgroup';
|
|
5
|
-
import { ErrorsSchema, PageSchema, SelectAllResponseDataSchema } from './graphqlApiSchemas';
|
|
5
|
+
import { ErrorsSchema, PageSchema, SelectAllResponseDataSchema, SelectOneResponseDataSchema } from './graphqlApiSchemas';
|
|
6
6
|
/**
|
|
7
7
|
* For field __args
|
|
8
8
|
*/
|
|
@@ -197,7 +197,7 @@ export declare enum Queries {
|
|
|
197
197
|
export declare type SelectOneQueryType = {
|
|
198
198
|
[Queries.SELECT_ONE]: {
|
|
199
199
|
__args?: Omit<QueryVariablesType, QueryVariablesField.PAGINATION>;
|
|
200
|
-
[SelectableField.DATA]:
|
|
200
|
+
[SelectableField.DATA]: SelectOneResponseDataSchema;
|
|
201
201
|
[SelectableField.ERRORS]?: ErrorsSchema;
|
|
202
202
|
};
|
|
203
203
|
};
|
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.
|
|
7
|
+
"version": "3.63.0-rc.bdj.2",
|
|
8
8
|
"description": "Node.js client for ArrowSphere's public API",
|
|
9
9
|
"main": "build/index.js",
|
|
10
10
|
"types": "build/index.d.ts",
|