@wildix/xbees-kite-client 1.0.3 → 1.0.4

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.
@@ -4,6 +4,8 @@ exports.KiteClient = exports.__Client = void 0;
4
4
  const runtimeConfig_1 = require("./runtimeConfig");
5
5
  const runtimeExtensions_1 = require("./runtimeExtensions");
6
6
  const middleware_user_agent_1 = require("@aws-sdk/middleware-user-agent");
7
+ const middleware_content_length_1 = require("@smithy/middleware-content-length");
8
+ const middleware_retry_1 = require("@smithy/middleware-retry");
7
9
  const smithy_client_1 = require("@smithy/smithy-client");
8
10
  Object.defineProperty(exports, "__Client", { enumerable: true, get: function () { return smithy_client_1.Client; } });
9
11
  const smithy_utils_1 = require("@wildix/smithy-utils");
@@ -11,7 +13,8 @@ class KiteClient extends smithy_client_1.Client {
11
13
  constructor(...[configuration]) {
12
14
  let _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {});
13
15
  let _config_1 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_0);
14
- let _config_2 = (0, runtimeExtensions_1.resolveRuntimeExtensions)(_config_1, configuration?.extensions || []);
16
+ let _config_2 = (0, middleware_retry_1.resolveRetryConfig)(_config_1);
17
+ let _config_3 = (0, runtimeExtensions_1.resolveRuntimeExtensions)(_config_2, configuration?.extensions || []);
15
18
  const hostname = ['stable', 'stage'].includes(configuration.env || '') ? `api-${configuration.env}.x-bees.com` : 'api.x-bees.com';
16
19
  const endpoint = () => {
17
20
  return {
@@ -22,13 +25,15 @@ class KiteClient extends smithy_client_1.Client {
22
25
  };
23
26
  };
24
27
  const config = {
25
- ..._config_2,
28
+ ..._config_3,
26
29
  endpoint,
27
30
  };
28
31
  super(config);
29
32
  this.config = config;
30
33
  this.middlewareStack.add(smithy_utils_1.authorizationMiddleware.bind(this, configuration.token), { step: "build" });
31
34
  this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config));
35
+ this.middlewareStack.use((0, middleware_retry_1.getRetryPlugin)(this.config));
36
+ this.middlewareStack.use((0, middleware_content_length_1.getContentLengthPlugin)(this.config));
32
37
  }
33
38
  destroy() {
34
39
  super.destroy();
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ListAgentsFilter = exports.WidgetNotFoundException = exports.TargetNotFoundException = exports.KiteVariant = exports.KiteFeatures = exports.WidgetTarget = exports.WidgetRouteRule = exports.WidgetRouteTimeFrameDay = exports.LimitExceededException = exports.ForbiddenException = exports.ValidationException = void 0;
3
+ exports.ListAgentsFilter = exports.WidgetNotFoundException = exports.TargetNotFoundException = exports.KiteVariant = exports.KiteFeatures = exports.WidgetTarget = exports.WidgetRouteRule = exports.WidgetRouteTimeFrameDay = exports.RateLimitExceededException = exports.ForbiddenException = exports.ValidationException = void 0;
4
4
  const KiteServiceException_1 = require("./KiteServiceException");
5
5
  class ValidationException extends KiteServiceException_1.KiteServiceException {
6
6
  constructor(opts) {
@@ -28,23 +28,23 @@ class ForbiddenException extends KiteServiceException_1.KiteServiceException {
28
28
  }
29
29
  }
30
30
  exports.ForbiddenException = ForbiddenException;
31
- class LimitExceededException extends KiteServiceException_1.KiteServiceException {
31
+ class RateLimitExceededException extends KiteServiceException_1.KiteServiceException {
32
32
  constructor(opts) {
33
33
  super({
34
- name: "LimitExceededException",
34
+ name: "RateLimitExceededException",
35
35
  $fault: "client",
36
36
  ...opts
37
37
  });
38
- this.name = "LimitExceededException";
38
+ this.name = "RateLimitExceededException";
39
39
  this.$fault = "client";
40
- Object.setPrototypeOf(this, LimitExceededException.prototype);
40
+ Object.setPrototypeOf(this, RateLimitExceededException.prototype);
41
41
  this.rateLimit = opts.rateLimit;
42
42
  this.rateLimitRemaining = opts.rateLimitRemaining;
43
43
  this.rateLimitReset = opts.rateLimitReset;
44
44
  this.retryAfter = opts.retryAfter;
45
45
  }
46
46
  }
47
- exports.LimitExceededException = LimitExceededException;
47
+ exports.RateLimitExceededException = RateLimitExceededException;
48
48
  exports.WidgetRouteTimeFrameDay = {
49
49
  EVERY_DAY: "EVERY_DAY",
50
50
  FRIDAY: "FRIDAY",
@@ -270,9 +270,9 @@ const de_CommandError = async (output, context) => {
270
270
  case "ForbiddenException":
271
271
  case "smithy.framework#ForbiddenException":
272
272
  throw await de_ForbiddenExceptionRes(parsedOutput, context);
273
- case "LimitExceededException":
274
- case "smithy.framework#LimitExceededException":
275
- throw await de_LimitExceededExceptionRes(parsedOutput, context);
273
+ case "RateLimitExceededException":
274
+ case "smithy.framework#RateLimitExceededException":
275
+ throw await de_RateLimitExceededExceptionRes(parsedOutput, context);
276
276
  case "ValidationException":
277
277
  case "smithy.framework#ValidationException":
278
278
  throw await de_ValidationExceptionRes(parsedOutput, context);
@@ -305,7 +305,7 @@ const de_ForbiddenExceptionRes = async (parsedOutput, context) => {
305
305
  });
306
306
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
307
307
  };
308
- const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
308
+ const de_RateLimitExceededExceptionRes = async (parsedOutput, context) => {
309
309
  const contents = (0, smithy_client_1.map)({
310
310
  [_rL]: [, parsedOutput.headers[_xrl]],
311
311
  [_rLR]: [() => void 0 !== parsedOutput.headers[_xrr], () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers[_xrr])],
@@ -317,7 +317,7 @@ const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
317
317
  'message': smithy_client_1.expectString,
318
318
  });
319
319
  Object.assign(contents, doc);
320
- const exception = new models_0_1.LimitExceededException({
320
+ const exception = new models_0_1.RateLimitExceededException({
321
321
  $metadata: deserializeMetadata(parsedOutput),
322
322
  ...contents
323
323
  });
@@ -1,6 +1,8 @@
1
1
  import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
2
2
  import { resolveRuntimeExtensions, } from "./runtimeExtensions";
3
3
  import { getUserAgentPlugin, resolveUserAgentConfig, } from "@aws-sdk/middleware-user-agent";
4
+ import { getContentLengthPlugin } from "@smithy/middleware-content-length";
5
+ import { getRetryPlugin, resolveRetryConfig, } from "@smithy/middleware-retry";
4
6
  import { Client as __Client, } from "@smithy/smithy-client";
5
7
  import { authorizationMiddleware } from '@wildix/smithy-utils';
6
8
  export { __Client };
@@ -8,7 +10,8 @@ export class KiteClient extends __Client {
8
10
  constructor(...[configuration]) {
9
11
  let _config_0 = __getRuntimeConfig(configuration || {});
10
12
  let _config_1 = resolveUserAgentConfig(_config_0);
11
- let _config_2 = resolveRuntimeExtensions(_config_1, configuration?.extensions || []);
13
+ let _config_2 = resolveRetryConfig(_config_1);
14
+ let _config_3 = resolveRuntimeExtensions(_config_2, configuration?.extensions || []);
12
15
  const hostname = ['stable', 'stage'].includes(configuration.env || '') ? `api-${configuration.env}.x-bees.com` : 'api.x-bees.com';
13
16
  const endpoint = () => {
14
17
  return {
@@ -19,13 +22,15 @@ export class KiteClient extends __Client {
19
22
  };
20
23
  };
21
24
  const config = {
22
- ..._config_2,
25
+ ..._config_3,
23
26
  endpoint,
24
27
  };
25
28
  super(config);
26
29
  this.config = config;
27
30
  this.middlewareStack.add(authorizationMiddleware.bind(this, configuration.token), { step: "build" });
28
31
  this.middlewareStack.use(getUserAgentPlugin(this.config));
32
+ this.middlewareStack.use(getRetryPlugin(this.config));
33
+ this.middlewareStack.use(getContentLengthPlugin(this.config));
29
34
  }
30
35
  destroy() {
31
36
  super.destroy();
@@ -23,16 +23,16 @@ export class ForbiddenException extends __BaseException {
23
23
  Object.setPrototypeOf(this, ForbiddenException.prototype);
24
24
  }
25
25
  }
26
- export class LimitExceededException extends __BaseException {
26
+ export class RateLimitExceededException extends __BaseException {
27
27
  constructor(opts) {
28
28
  super({
29
- name: "LimitExceededException",
29
+ name: "RateLimitExceededException",
30
30
  $fault: "client",
31
31
  ...opts
32
32
  });
33
- this.name = "LimitExceededException";
33
+ this.name = "RateLimitExceededException";
34
34
  this.$fault = "client";
35
- Object.setPrototypeOf(this, LimitExceededException.prototype);
35
+ Object.setPrototypeOf(this, RateLimitExceededException.prototype);
36
36
  this.rateLimit = opts.rateLimit;
37
37
  this.rateLimitRemaining = opts.rateLimitRemaining;
38
38
  this.rateLimitReset = opts.rateLimitReset;
@@ -1,5 +1,5 @@
1
1
  import { KiteServiceException as __BaseException } from "../models/KiteServiceException";
2
- import { ForbiddenException, LimitExceededException, TargetNotFoundException, ValidationException, WidgetNotFoundException, } from "../models/models_0";
2
+ import { ForbiddenException, RateLimitExceededException, TargetNotFoundException, ValidationException, WidgetNotFoundException, } from "../models/models_0";
3
3
  import { requestBuilder as rb } from "@smithy/core";
4
4
  import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, strictParseInt32 as __strictParseInt32, _json, collectBody, map, take, withBaseException, } from "@smithy/smithy-client";
5
5
  export const se_CreateWidgetCommand = async (input, context) => {
@@ -251,9 +251,9 @@ const de_CommandError = async (output, context) => {
251
251
  case "ForbiddenException":
252
252
  case "smithy.framework#ForbiddenException":
253
253
  throw await de_ForbiddenExceptionRes(parsedOutput, context);
254
- case "LimitExceededException":
255
- case "smithy.framework#LimitExceededException":
256
- throw await de_LimitExceededExceptionRes(parsedOutput, context);
254
+ case "RateLimitExceededException":
255
+ case "smithy.framework#RateLimitExceededException":
256
+ throw await de_RateLimitExceededExceptionRes(parsedOutput, context);
257
257
  case "ValidationException":
258
258
  case "smithy.framework#ValidationException":
259
259
  throw await de_ValidationExceptionRes(parsedOutput, context);
@@ -286,7 +286,7 @@ const de_ForbiddenExceptionRes = async (parsedOutput, context) => {
286
286
  });
287
287
  return __decorateServiceException(exception, parsedOutput.body);
288
288
  };
289
- const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
289
+ const de_RateLimitExceededExceptionRes = async (parsedOutput, context) => {
290
290
  const contents = map({
291
291
  [_rL]: [, parsedOutput.headers[_xrl]],
292
292
  [_rLR]: [() => void 0 !== parsedOutput.headers[_xrr], () => __strictParseInt32(parsedOutput.headers[_xrr])],
@@ -298,7 +298,7 @@ const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
298
298
  'message': __expectString,
299
299
  });
300
300
  Object.assign(contents, doc);
301
- const exception = new LimitExceededException({
301
+ const exception = new RateLimitExceededException({
302
302
  $metadata: deserializeMetadata(parsedOutput),
303
303
  ...contents
304
304
  });
@@ -8,6 +8,7 @@ import { ListWidgetsCommandInput, ListWidgetsCommandOutput } from "./commands/Li
8
8
  import { UpdateWidgetCommandInput, UpdateWidgetCommandOutput } from "./commands/UpdateWidgetCommand";
9
9
  import { RuntimeExtension, RuntimeExtensionsConfig } from "./runtimeExtensions";
10
10
  import { UserAgentInputConfig, UserAgentResolvedConfig } from "@aws-sdk/middleware-user-agent";
11
+ import { RetryInputConfig, RetryResolvedConfig } from "@smithy/middleware-retry";
11
12
  import { HttpHandlerUserInput as __HttpHandlerUserInput } from "@smithy/protocol-http";
12
13
  import { Client as __Client, DefaultsMode as __DefaultsMode, SmithyConfiguration as __SmithyConfiguration, SmithyResolvedConfiguration as __SmithyResolvedConfiguration } from "@smithy/smithy-client";
13
14
  import { Provider, BodyLengthCalculator as __BodyLengthCalculator, CheckOptionalClientConfig as __CheckOptionalClientConfig, ChecksumConstructor as __ChecksumConstructor, Decoder as __Decoder, Encoder as __Encoder, HashConstructor as __HashConstructor, HttpHandlerOptions as __HttpHandlerOptions, Logger as __Logger, Provider as __Provider, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent } from "@smithy/types";
@@ -111,7 +112,7 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
111
112
  /**
112
113
  * @public
113
114
  */
114
- export type KiteClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & ClientDefaults & UserAgentInputConfig;
115
+ export type KiteClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & ClientDefaults & UserAgentInputConfig & RetryInputConfig;
115
116
  /**
116
117
  * @public
117
118
  *
@@ -124,7 +125,7 @@ export interface KiteClientConfig extends KiteClientConfigType {
124
125
  /**
125
126
  * @public
126
127
  */
127
- export type KiteClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & Required<ClientDefaults> & RuntimeExtensionsConfig & UserAgentResolvedConfig;
128
+ export type KiteClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & Required<ClientDefaults> & RuntimeExtensionsConfig & UserAgentResolvedConfig & RetryResolvedConfig;
128
129
  /**
129
130
  * @public
130
131
  *
@@ -188,7 +188,7 @@ declare const CreateWidgetCommand_base: {
188
188
  *
189
189
  * @throws {@link ForbiddenException} (client fault)
190
190
  *
191
- * @throws {@link LimitExceededException} (client fault)
191
+ * @throws {@link RateLimitExceededException} (client fault)
192
192
  *
193
193
  * @throws {@link KiteServiceException}
194
194
  * <p>Base exception class for all service exceptions from Kite service.</p>
@@ -53,7 +53,7 @@ declare const DeleteWidgetCommand_base: {
53
53
  *
54
54
  * @throws {@link ForbiddenException} (client fault)
55
55
  *
56
- * @throws {@link LimitExceededException} (client fault)
56
+ * @throws {@link RateLimitExceededException} (client fault)
57
57
  *
58
58
  * @throws {@link KiteServiceException}
59
59
  * <p>Base exception class for all service exceptions from Kite service.</p>
@@ -45,7 +45,11 @@ declare const GetConfigCommand_base: {
45
45
  * // config: { // KiteConfig
46
46
  * // targetId: "STRING_VALUE", // required
47
47
  * // targetRouteId: "STRING_VALUE",
48
- * // targetVariant: "group" || "direct",
48
+ * // targetVariant: "group" || "direct", // required
49
+ * // targetService: { // KiteTargetService
50
+ * // uri: "STRING_VALUE", // required
51
+ * // title: "STRING_VALUE", // required
52
+ * // },
49
53
  * // agents: [ // UsersList // required
50
54
  * // { // User
51
55
  * // id: "STRING_VALUE", // required
@@ -110,7 +114,7 @@ declare const GetConfigCommand_base: {
110
114
  *
111
115
  * @throws {@link ForbiddenException} (client fault)
112
116
  *
113
- * @throws {@link LimitExceededException} (client fault)
117
+ * @throws {@link RateLimitExceededException} (client fault)
114
118
  *
115
119
  * @throws {@link KiteServiceException}
116
120
  * <p>Base exception class for all service exceptions from Kite service.</p>
@@ -126,7 +126,7 @@ declare const GetWidgetCommand_base: {
126
126
  *
127
127
  * @throws {@link ForbiddenException} (client fault)
128
128
  *
129
- * @throws {@link LimitExceededException} (client fault)
129
+ * @throws {@link RateLimitExceededException} (client fault)
130
130
  *
131
131
  * @throws {@link KiteServiceException}
132
132
  * <p>Base exception class for all service exceptions from Kite service.</p>
@@ -84,7 +84,7 @@ declare const ListAgentsCommand_base: {
84
84
  *
85
85
  * @throws {@link ForbiddenException} (client fault)
86
86
  *
87
- * @throws {@link LimitExceededException} (client fault)
87
+ * @throws {@link RateLimitExceededException} (client fault)
88
88
  *
89
89
  * @throws {@link KiteServiceException}
90
90
  * <p>Base exception class for all service exceptions from Kite service.</p>
@@ -70,7 +70,7 @@ declare const ListServicesCommand_base: {
70
70
  *
71
71
  * @throws {@link ForbiddenException} (client fault)
72
72
  *
73
- * @throws {@link LimitExceededException} (client fault)
73
+ * @throws {@link RateLimitExceededException} (client fault)
74
74
  *
75
75
  * @throws {@link KiteServiceException}
76
76
  * <p>Base exception class for all service exceptions from Kite service.</p>
@@ -127,7 +127,7 @@ declare const ListWidgetsCommand_base: {
127
127
  *
128
128
  * @throws {@link ForbiddenException} (client fault)
129
129
  *
130
- * @throws {@link LimitExceededException} (client fault)
130
+ * @throws {@link RateLimitExceededException} (client fault)
131
131
  *
132
132
  * @throws {@link KiteServiceException}
133
133
  * <p>Base exception class for all service exceptions from Kite service.</p>
@@ -189,7 +189,7 @@ declare const UpdateWidgetCommand_base: {
189
189
  *
190
190
  * @throws {@link ForbiddenException} (client fault)
191
191
  *
192
- * @throws {@link LimitExceededException} (client fault)
192
+ * @throws {@link RateLimitExceededException} (client fault)
193
193
  *
194
194
  * @throws {@link KiteServiceException}
195
195
  * <p>Base exception class for all service exceptions from Kite service.</p>
@@ -25,8 +25,8 @@ export declare class ForbiddenException extends __BaseException {
25
25
  /**
26
26
  * @public
27
27
  */
28
- export declare class LimitExceededException extends __BaseException {
29
- readonly name: "LimitExceededException";
28
+ export declare class RateLimitExceededException extends __BaseException {
29
+ readonly name: "RateLimitExceededException";
30
30
  readonly $fault: "client";
31
31
  /**
32
32
  * Displays the applicable rate limits for the current request.
@@ -51,7 +51,7 @@ export declare class LimitExceededException extends __BaseException {
51
51
  /**
52
52
  * @internal
53
53
  */
54
- constructor(opts: __ExceptionOptionType<LimitExceededException, __BaseException>);
54
+ constructor(opts: __ExceptionOptionType<RateLimitExceededException, __BaseException>);
55
55
  }
56
56
  /**
57
57
  * @public
@@ -432,6 +432,13 @@ export declare const KiteFeatures: {
432
432
  * @public
433
433
  */
434
434
  export type KiteFeatures = typeof KiteFeatures[keyof typeof KiteFeatures];
435
+ /**
436
+ * @public
437
+ */
438
+ export interface KiteTargetService {
439
+ uri: string;
440
+ title: string;
441
+ }
435
442
  /**
436
443
  * @public
437
444
  * @enum
@@ -458,7 +465,8 @@ export interface KiteConfig {
458
465
  * @public
459
466
  */
460
467
  targetRouteId?: string;
461
- targetVariant?: KiteVariant;
468
+ targetVariant: KiteVariant;
469
+ targetService?: KiteTargetService;
462
470
  agents: (User)[];
463
471
  /**
464
472
  * The appearance settings like color scheme or custom texts.
@@ -25,4 +25,5 @@ export declare const getRuntimeConfig: (config: KiteClientConfig) => {
25
25
  logger: import("@smithy/types").Logger;
26
26
  extensions: import("./runtimeExtensions").RuntimeExtension[];
27
27
  customUserAgent?: string | import("@smithy/types").UserAgent | undefined;
28
+ retryStrategy?: import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2 | undefined;
28
29
  };
@@ -25,4 +25,5 @@ export declare const getRuntimeConfig: (config: KiteClientConfig) => {
25
25
  logger: import("@smithy/types").Logger;
26
26
  extensions: import("./runtimeExtensions").RuntimeExtension[];
27
27
  customUserAgent?: string | import("@smithy/types").UserAgent | undefined;
28
+ retryStrategy?: import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2 | undefined;
28
29
  };
@@ -24,4 +24,5 @@ export declare const getRuntimeConfig: (config: KiteClientConfig) => {
24
24
  extensions: import("./runtimeExtensions").RuntimeExtension[];
25
25
  defaultsMode: import("@smithy/smithy-client").DefaultsMode | import("@smithy/types").Provider<import("@smithy/smithy-client").DefaultsMode>;
26
26
  customUserAgent?: string | import("@smithy/types").UserAgent | undefined;
27
+ retryStrategy?: import("@smithy/types").RetryStrategy | import("@smithy/types").RetryStrategyV2 | undefined;
27
28
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wildix/xbees-kite-client",
3
3
  "description": "@wildix/xbees-kite-client client",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",