@imtbl/sdk 0.28.1-alpha → 0.28.3

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.
@@ -25,7 +25,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
25
25
  })($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
26
26
 
27
27
 
28
- const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.1-alpha";
28
+ const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.28.3";
29
29
  const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
30
30
  const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
31
31
 
package/dist/config.d.ts CHANGED
@@ -4,10 +4,14 @@ declare enum Environment {
4
4
  }
5
5
  declare class ImmutableConfiguration {
6
6
  readonly environment: Environment;
7
+ readonly rateLimitingKey?: string;
7
8
  readonly apiKey?: string;
9
+ readonly clientAppId?: string;
8
10
  constructor(options: {
9
11
  environment: Environment;
12
+ rateLimitingKey?: string;
10
13
  apiKey?: string;
14
+ clientAppId?: string;
11
15
  });
12
16
  }
13
17
  interface ModuleConfiguration<T> {
package/dist/config.js CHANGED
@@ -1,3 +1,5 @@
1
+ import axios from 'axios';
2
+
1
3
  var Environment;
2
4
  (function (Environment) {
3
5
  Environment["PRODUCTION"] = "production";
@@ -5,10 +7,29 @@ var Environment;
5
7
  })(Environment || (Environment = {}));
6
8
  class ImmutableConfiguration {
7
9
  environment;
10
+ rateLimitingKey;
8
11
  apiKey;
12
+ clientAppId;
9
13
  constructor(options) {
10
14
  this.environment = options.environment;
11
- this.apiKey = options.apiKey;
15
+ if (options.rateLimitingKey) {
16
+ this.rateLimitingKey = options.rateLimitingKey;
17
+ axios.defaults.headers.common['x-api-key'] = this.rateLimitingKey;
18
+ }
19
+ if (options.apiKey) {
20
+ if (!options.apiKey.startsWith('sk_imapik-')) {
21
+ throw new Error('Invalid API key');
22
+ }
23
+ this.apiKey = options.apiKey;
24
+ axios.defaults.headers.common['x-immutable-api-key'] = this.apiKey;
25
+ }
26
+ if (options.clientAppId) {
27
+ if (!options.clientAppId.startsWith('cai_imapik-')) {
28
+ throw new Error('Invalid Client App Id');
29
+ }
30
+ this.clientAppId = options.clientAppId;
31
+ axios.defaults.headers.common['x-immutable-client-app-id'] = this.clientAppId;
32
+ }
12
33
  }
13
34
  }
14
35