@arrowsphere/api-client 3.55.0-rc.bdj.1 → 3.55.0-rc.fdi.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.
@@ -1,9 +1,12 @@
1
1
  import { GraphQLClient } from 'graphql-request';
2
2
  import * as Dom from 'graphql-request/dist/types.dom';
3
- import { Options } from './abstractRestfulClient';
3
+ import { Options, ParameterKeys } from './abstractRestfulClient';
4
4
  import { GetProductsType } from './catalog';
5
5
  import { AbstractHttpClient } from './AbstractHttpClient';
6
6
  export declare type GraphQLResponseTypes = GetProductsType;
7
+ export declare type ConfigurationsGraphQLClient = {
8
+ [ParameterKeys.IS_LOGGING]?: boolean;
9
+ };
7
10
  export declare abstract class AbstractGraphQLClient extends AbstractHttpClient {
8
11
  /**
9
12
  * Must not be called directly.
@@ -12,9 +15,12 @@ export declare abstract class AbstractGraphQLClient extends AbstractHttpClient {
12
15
  protected graphQLClient: GraphQLClient;
13
16
  protected optionsHeader?: Dom.RequestInit['headers'];
14
17
  protected options: Options;
18
+ protected isLogging: boolean;
19
+ constructor(configuration?: ConfigurationsGraphQLClient);
15
20
  private getClientInstance;
16
21
  setOptions(options: Options): this;
17
22
  protected post<GraphQLResponseTypes>(query: string): Promise<GraphQLResponseTypes>;
23
+ private request;
18
24
  private applyHeaders;
19
25
  private generateUrl;
20
26
  protected stringifyQuery(query: any): string;
@@ -25,13 +25,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.AbstractGraphQLClient = void 0;
27
27
  const graphql_request_1 = require("graphql-request");
28
+ const abstractRestfulClient_1 = require("./abstractRestfulClient");
28
29
  const path = __importStar(require("path"));
29
30
  const json_to_graphql_query_1 = require("json-to-graphql-query");
30
31
  const AbstractHttpClient_1 = require("./AbstractHttpClient");
31
32
  class AbstractGraphQLClient extends AbstractHttpClient_1.AbstractHttpClient {
32
- constructor() {
33
- super(...arguments);
33
+ constructor(configuration) {
34
+ super();
34
35
  this.options = {};
36
+ this.isLogging = configuration
37
+ ? !!configuration[abstractRestfulClient_1.ParameterKeys.IS_LOGGING]
38
+ : false;
35
39
  }
36
40
  getClientInstance() {
37
41
  var _a;
@@ -44,7 +48,7 @@ class AbstractGraphQLClient extends AbstractHttpClient_1.AbstractHttpClient {
44
48
  async post(query) {
45
49
  try {
46
50
  this.applyHeaders();
47
- return await this.getClientInstance().request(query);
51
+ return await this.request(query);
48
52
  }
49
53
  catch (error) {
50
54
  const exception = this.mapToPublicApiException(error);
@@ -56,6 +60,16 @@ class AbstractGraphQLClient extends AbstractHttpClient_1.AbstractHttpClient {
56
60
  throw error;
57
61
  }
58
62
  }
63
+ async request(query) {
64
+ if (this.isLogging) {
65
+ console.info('GRAPHQL - Query : ', query);
66
+ }
67
+ const response = await this.getClientInstance().request(query);
68
+ if (this.isLogging) {
69
+ console.info('GRAPHQL - Response : ', response);
70
+ }
71
+ return response;
72
+ }
59
73
  applyHeaders() {
60
74
  const headers = {
61
75
  authorization: this.token,
@@ -0,0 +1,10 @@
1
+ import { AbstractGraphQLClient } from '../abstractGraphQLClient';
2
+ import { GetAccountQuery } from './types/accountGraphQLQueries';
3
+ import { GetAccountType } from './types/accountGraphQLTypes';
4
+ export declare class AccountGraphQLClient extends AbstractGraphQLClient {
5
+ /**
6
+ * The base path of the API
7
+ */
8
+ protected basePath: string;
9
+ findByQuery(query: GetAccountQuery): Promise<GetAccountType | null>;
10
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountGraphQLClient = void 0;
4
+ const abstractGraphQLClient_1 = require("../abstractGraphQLClient");
5
+ class AccountGraphQLClient extends abstractGraphQLClient_1.AbstractGraphQLClient {
6
+ constructor() {
7
+ super(...arguments);
8
+ /**
9
+ * The base path of the API
10
+ */
11
+ this.basePath = '/v2';
12
+ }
13
+ async findByQuery(query) {
14
+ this.path = '/graphql';
15
+ const queryStr = this.stringifyQuery(query);
16
+ console.log('QUERY GRAPHQL : ' + queryStr);
17
+ try {
18
+ return await this.post(queryStr);
19
+ }
20
+ catch (error) {
21
+ return null;
22
+ }
23
+ }
24
+ }
25
+ exports.AccountGraphQLClient = AccountGraphQLClient;
26
+ //# sourceMappingURL=accountGraphQLClient.js.map
@@ -0,0 +1,3 @@
1
+ export * from './types/accountGraphQLQueries';
2
+ export * from './types/accountGraphQLTypes';
3
+ export * from './accountGraphQLClient';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types/accountGraphQLQueries"), exports);
18
+ __exportStar(require("./types/accountGraphQLTypes"), exports);
19
+ __exportStar(require("./accountGraphQLClient"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,40 @@
1
+ import { Merge, Schema } from 'type-fest';
2
+ import { AccountAttributeType } from './accountGraphQLTypes';
3
+ import { AccountAttributeSchema } from './accountGraphQLSchemas';
4
+ export declare type GetAccountQuery = Merge<{
5
+ __args: QueryAccountArgument;
6
+ }, AccountAttributeSchema>;
7
+ export declare type QueryAccountArgument = {
8
+ paginate?: PaginateAccountArgument;
9
+ searchBody?: SearchBodyAccountArgument;
10
+ };
11
+ export declare type PaginateAccountArgument = {
12
+ page: number;
13
+ perPage: number;
14
+ };
15
+ export declare type SearchBodyAccountArgument = {
16
+ keywords?: string;
17
+ keywordsByField?: KeywordsByFieldsAccountArgument[];
18
+ filters?: FiltersAccountArgument[];
19
+ exclusionFilters?: FiltersAccountArgument[];
20
+ sort?: SortAccountArgument[];
21
+ highlight?: boolean;
22
+ aggregatorFilter?: string[];
23
+ scopes?: string | string[] | string[][];
24
+ rights?: string[];
25
+ };
26
+ export declare type SortAccountArgument = {
27
+ name?: string;
28
+ order?: string;
29
+ };
30
+ export declare type KeywordsByFieldsAccountArgument = {
31
+ name?: string;
32
+ values?: string[];
33
+ operator?: string;
34
+ type?: string;
35
+ };
36
+ export declare type FiltersAccountArgument = {
37
+ name?: string;
38
+ value?: string | string[];
39
+ };
40
+ export declare type AccountSchema = Schema<AccountAttributeType, boolean>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=accountGraphQLQueries.js.map
@@ -0,0 +1,34 @@
1
+ import { AccountAliasInfo, AccountExtraData, AccountFilterValues, AccountPagination, AccountPolicy } from './accountGraphQLTypes';
2
+ import { Schema } from 'type-fest';
3
+ export declare type AccountAttributeSchema = {
4
+ pagination?: Schema<AccountPagination, boolean>;
5
+ users?: AccountSchema;
6
+ filters?: AccountFilterSchema;
7
+ };
8
+ export declare type AccountFilterSchema = {
9
+ name?: boolean;
10
+ value?: Schema<AccountFilterValues, boolean>;
11
+ };
12
+ export declare type AccountSchema = {
13
+ updatedBy?: boolean;
14
+ updatedAt?: boolean;
15
+ version?: boolean;
16
+ isEnabled?: boolean;
17
+ cognitoUsername?: boolean;
18
+ authMethods?: boolean;
19
+ canSecureAccountUntil?: boolean;
20
+ extraData?: Schema<AccountExtraData, boolean>;
21
+ applications?: AccountApplicationSchema;
22
+ aliases?: Schema<AccountAliasInfo, boolean>;
23
+ };
24
+ export declare type AccountApplicationSchema = {
25
+ updatedBy?: boolean;
26
+ updatedAt?: boolean;
27
+ version?: boolean;
28
+ isEnabled?: boolean;
29
+ extraData?: Schema<AccountExtraData, boolean>;
30
+ applicationName?: boolean;
31
+ rights?: boolean;
32
+ scopes?: boolean;
33
+ policies?: Schema<AccountPolicy, boolean>;
34
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=accountGraphQLSchemas.js.map
@@ -0,0 +1,66 @@
1
+ export declare type GetAccountType = {
2
+ getUsers?: AccountAttributeType;
3
+ };
4
+ export declare type AccountAttributeType = {
5
+ pagination?: AccountPagination;
6
+ users?: Account[];
7
+ filters?: AccountFilter[];
8
+ };
9
+ export declare type Account = {
10
+ updatedBy?: string;
11
+ updatedAt?: string;
12
+ version?: number;
13
+ isEnabled?: boolean;
14
+ cognitoUsername?: string;
15
+ authMethods?: string[];
16
+ canSecureAccountUntil?: string;
17
+ extraData?: AccountExtraData[];
18
+ applications?: AccountApplication[];
19
+ aliases?: AccountAliasInfo[];
20
+ };
21
+ export declare type AccountExtraData = {
22
+ name?: string;
23
+ value?: string;
24
+ };
25
+ export declare type AccountApplication = {
26
+ updatedBy?: string;
27
+ updatedAt?: string;
28
+ version?: number;
29
+ isEnabled?: boolean;
30
+ extraData?: AccountExtraData[];
31
+ applicationName?: string;
32
+ rights?: string[];
33
+ scopes?: string[];
34
+ policies?: AccountPolicy[];
35
+ };
36
+ export declare type AccountPolicy = {
37
+ policyName?: string;
38
+ description?: string;
39
+ updatedBy?: string;
40
+ updatedAt?: string;
41
+ version?: number;
42
+ isEnabled?: boolean;
43
+ scopes?: string[];
44
+ rights?: string[];
45
+ };
46
+ export declare type AccountAliasInfo = {
47
+ username?: string;
48
+ providerName?: string;
49
+ email?: string;
50
+ };
51
+ export declare type AccountPagination = {
52
+ perPage?: number;
53
+ currentPage?: number;
54
+ totalPage?: number;
55
+ total?: number;
56
+ next?: string;
57
+ previous?: string;
58
+ };
59
+ export declare type AccountFilter = {
60
+ name?: string;
61
+ value?: AccountFilterValues[];
62
+ };
63
+ export declare type AccountFilterValues = {
64
+ value?: string;
65
+ count?: number;
66
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=accountGraphQLTypes.js.map
@@ -3,5 +3,4 @@ export declare type PartnertagType = {
3
3
  description?: string;
4
4
  id?: number;
5
5
  label?: string;
6
- labelsSerialized?: string;
7
6
  };
@@ -77,15 +77,13 @@ export declare enum InputFilterValueField {
77
77
  NAME = "name",
78
78
  OPERATOR = "operator",
79
79
  VALUE = "value",
80
- EXCLUSION = "exclusion",
81
- HAVING = "having"
80
+ EXCLUSION = "exclusion"
82
81
  }
83
82
  export declare type InputFilterValueType = {
84
83
  [InputFilterValueField.NAME]?: string;
85
84
  [InputFilterValueField.OPERATOR]?: ComparisonOperator;
86
85
  [InputFilterValueField.VALUE]?: string[];
87
86
  [InputFilterValueField.EXCLUSION]?: boolean;
88
- [InputFilterValueField.HAVING]?: boolean;
89
87
  };
90
88
  export declare enum InputQueryOptionsField {
91
89
  SKIP_PARTITION = "skipPartition"
@@ -69,7 +69,6 @@ var InputFilterValueField;
69
69
  InputFilterValueField["OPERATOR"] = "operator";
70
70
  InputFilterValueField["VALUE"] = "value";
71
71
  InputFilterValueField["EXCLUSION"] = "exclusion";
72
- InputFilterValueField["HAVING"] = "having";
73
72
  })(InputFilterValueField = exports.InputFilterValueField || (exports.InputFilterValueField = {}));
74
73
  var InputQueryOptionsField;
75
74
  (function (InputQueryOptionsField) {
package/build/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './axiosSingleton';
2
2
  export * from './abstractRestfulClient';
3
3
  export * from './abstractEntity';
4
4
  export * from './abstractGraphQLClient';
5
+ export * from './account/';
5
6
  export * from './campaign/';
6
7
  export * from './cart/';
7
8
  export * from './catalog/';
package/build/index.js CHANGED
@@ -31,6 +31,7 @@ __exportStar(require("./axiosSingleton"), exports);
31
31
  __exportStar(require("./abstractRestfulClient"), exports);
32
32
  __exportStar(require("./abstractEntity"), exports);
33
33
  __exportStar(require("./abstractGraphQLClient"), exports);
34
+ __exportStar(require("./account/"), exports);
34
35
  __exportStar(require("./campaign/"), exports);
35
36
  __exportStar(require("./cart/"), exports);
36
37
  __exportStar(require("./catalog/"), exports);
@@ -1,12 +1,15 @@
1
- import { CatalogGraphQLClient } from './catalog/catalogGraphQLClient';
2
- import { AbstractGraphQLClient } from './abstractGraphQLClient';
1
+ import { CatalogGraphQLClient } from './catalog';
2
+ import { AbstractGraphQLClient, ConfigurationsGraphQLClient } from './abstractGraphQLClient';
3
3
  import { SecurityScoreGraphQLClient } from './securityScore';
4
4
  import { GraphqlApiClient } from './graphqlApi';
5
5
  import { WellArchitectedGraphQLClient } from './wellArchitected';
6
+ import { AccountGraphQLClient } from './account';
6
7
  export declare class PublicGraphQLClient extends AbstractGraphQLClient {
7
- getCatalogGraphQLClient(): CatalogGraphQLClient;
8
- getSecurityScoreGraphQLClient(): SecurityScoreGraphQLClient;
9
- getWellArchitectedGraphQLClient(): WellArchitectedGraphQLClient;
10
- getGraphqlApiClient(): GraphqlApiClient;
8
+ constructor();
9
+ getCatalogGraphQLClient(configuration?: ConfigurationsGraphQLClient): CatalogGraphQLClient;
10
+ getSecurityScoreGraphQLClient(configuration?: ConfigurationsGraphQLClient): SecurityScoreGraphQLClient;
11
+ getWellArchitectedGraphQLClient(configuration?: ConfigurationsGraphQLClient): WellArchitectedGraphQLClient;
12
+ getGraphqlApiClient(configuration?: ConfigurationsGraphQLClient): GraphqlApiClient;
13
+ getGraphqlAccountClient(configuration?: ConfigurationsGraphQLClient): AccountGraphQLClient;
11
14
  private applyConfig;
12
15
  }
@@ -1,29 +1,38 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PublicGraphQLClient = void 0;
4
- const catalogGraphQLClient_1 = require("./catalog/catalogGraphQLClient");
4
+ const catalog_1 = require("./catalog");
5
5
  const abstractGraphQLClient_1 = require("./abstractGraphQLClient");
6
6
  const securityScore_1 = require("./securityScore");
7
7
  const graphqlApi_1 = require("./graphqlApi");
8
8
  const wellArchitected_1 = require("./wellArchitected");
9
+ const account_1 = require("./account");
9
10
  class PublicGraphQLClient extends abstractGraphQLClient_1.AbstractGraphQLClient {
10
- getCatalogGraphQLClient() {
11
- const client = new catalogGraphQLClient_1.CatalogGraphQLClient();
11
+ constructor() {
12
+ super();
13
+ }
14
+ getCatalogGraphQLClient(configuration) {
15
+ const client = new catalog_1.CatalogGraphQLClient(configuration);
16
+ this.applyConfig(client);
17
+ return client;
18
+ }
19
+ getSecurityScoreGraphQLClient(configuration) {
20
+ const client = new securityScore_1.SecurityScoreGraphQLClient(configuration);
12
21
  this.applyConfig(client);
13
22
  return client;
14
23
  }
15
- getSecurityScoreGraphQLClient() {
16
- const client = new securityScore_1.SecurityScoreGraphQLClient();
24
+ getWellArchitectedGraphQLClient(configuration) {
25
+ const client = new wellArchitected_1.WellArchitectedGraphQLClient(configuration);
17
26
  this.applyConfig(client);
18
27
  return client;
19
28
  }
20
- getWellArchitectedGraphQLClient() {
21
- const client = new wellArchitected_1.WellArchitectedGraphQLClient();
29
+ getGraphqlApiClient(configuration) {
30
+ const client = new graphqlApi_1.GraphqlApiClient(configuration);
22
31
  this.applyConfig(client);
23
32
  return client;
24
33
  }
25
- getGraphqlApiClient() {
26
- const client = new graphqlApi_1.GraphqlApiClient();
34
+ getGraphqlAccountClient(configuration) {
35
+ const client = new account_1.AccountGraphQLClient(configuration);
27
36
  this.applyConfig(client);
28
37
  return client;
29
38
  }
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.55.0-rc.bdj.1",
7
+ "version": "3.55.0-rc.fdi.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",