theauthapi 1.0.8 → 1.0.9

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/README.md CHANGED
@@ -6,11 +6,11 @@
6
6
  - [Installation](#installation)
7
7
  - [Configuration](#configuration)
8
8
  - [Usage](#usage)
9
- - [Example: Validating an api-key](#example-validating-an-api-key)
10
- - [Example: Listing API-keys](#example-listing-api-keys)
9
+ - [Example: Validating an API-Key](#example-validating-an-api-key)
10
+ - [Example: Listing API-Keys](#example-listing-api-keys)
11
11
  - [Example: Listing the projects of an account](#example-listing-the-projects-of-an-account)
12
- - [Example: Listing projects and associated API Keys](#example-listing-projects-and-associated-api-keys)
13
- - [Example: Creating an API Key](#example-creating-an-api-key)
12
+ - [Example: Listing projects and associated API-Keys](#example-listing-projects-and-associated-api-keys)
13
+ - [Example: Creating an API-Key](#example-creating-an-api-key)
14
14
  - [Handling Errors](#handling-errors)
15
15
  - [Typescript](#typescript)
16
16
  - [📙 Further Reading](#-further-reading)
@@ -104,7 +104,7 @@ All methods return a promise containing the returned JSON as a javascript object
104
104
  | DELETE | delete\* | `client.apiKeys.deleteKey("MY_KEY")` |
105
105
  | PATCH | update\* | `client.apiKeys.updateKey("MY_KEY", { name: "UPDATED_KEY_NAME" })` |
106
106
 
107
- #### Example: Validating an api-key
107
+ #### Example: Validating an API-Key
108
108
 
109
109
  You can easily validate an API key using `apiKeys.isValidKey` which returns `true` if the key is valid, `false` otherwise.
110
110
  `isValidKey` throws an `ApiRequestError` if there's a network issue, it's advised to wrap it in a `try/catch` to handle the potential error
@@ -182,6 +182,10 @@ try {
182
182
  }
183
183
  ```
184
184
 
185
+ **NOTE** that if your access key is at account level, you need to specify `projectId` when listing the API keys:
186
+ `getKeys({ projectId: "PROJECT_ID" })`, otherwise if your access key is created at project level, you don't have to specify `projectId`,
187
+ the access key's `projectId` will be used to get the API-keys (i.e. you'll see only the keys of the project your access key is created against)
188
+
185
189
  #### Example: Listing the projects of an account
186
190
 
187
191
  ```javascript
@@ -201,7 +205,7 @@ try {
201
205
  }
202
206
  ```
203
207
 
204
- #### Example: Listing projects and associated API Keys
208
+ #### Example: Listing projects and associated API-Keys
205
209
 
206
210
  ```javascript
207
211
  async function getProjectsWithKeys(accountId: string) {
@@ -218,7 +222,7 @@ async function getProjectsWithKeys(accountId: string) {
218
222
  }
219
223
  ```
220
224
 
221
- #### Example: Creating an API Key
225
+ #### Example: Creating an API-Key
222
226
 
223
227
  ```javascript
224
228
  theAuthAPI.apiKeys
@@ -1 +1 @@
1
- export declare const version = "1.0.6";
1
+ export declare const version = "1.0.9";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- exports.version = "1.0.6";
4
+ exports.version = "1.0.9";
@@ -1,17 +1,17 @@
1
1
  export declare type ApiKey = {
2
2
  key: string;
3
3
  name: string;
4
- customMetaData: string;
4
+ customMetaData: object;
5
5
  customAccountId: string;
6
6
  customUserId: string;
7
- env: string;
7
+ env: Environment;
8
8
  createdAt: Date;
9
9
  updatedAt: Date;
10
10
  isActive: boolean;
11
11
  };
12
12
  export declare type RateLimitConfiguration = {
13
13
  rateLimitedEntity?: string;
14
- ratelimitedEnitityId?: any;
14
+ ratelimitedEnitityId?: string;
15
15
  rateLimit: number;
16
16
  rateLimitTtl: number;
17
17
  };
@@ -21,8 +21,8 @@ export declare type ApiKeyInput = {
21
21
  key?: string;
22
22
  customMetaData?: object;
23
23
  customAccountId?: string;
24
- rateLimitConfigs?: RateLimitConfiguration;
25
24
  customUserId?: string;
25
+ rateLimitConfigs?: RateLimitConfiguration;
26
26
  };
27
27
  export declare type ApiKeyFilter = {
28
28
  projectId?: string;
@@ -53,7 +53,7 @@ export declare type Project = AuthBaseEntity & {
53
53
  id: string;
54
54
  name: string;
55
55
  accountId: string;
56
- env: string;
56
+ env: Environment;
57
57
  };
58
58
  export declare enum Environment {
59
59
  LIVE = "live",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "theauthapi",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Client library for TheAuthAPI.com",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",