theauthapi 1.0.11 → 1.0.12
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/dist/endpoints/ApiKeys/ApiKeys.d.ts +1 -0
- package/dist/endpoints/ApiKeys/ApiKeys.js +5 -0
- package/dist/endpoints/ApiKeys/ApiKeysInterface.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/services/ApiRequest/ApiRequest.d.ts +1 -1
- package/dist/types/index.d.ts +13 -13
- package/package.json +3 -3
- package/History.md +0 -5
- package/dist/usage.js +0 -20
- package/dist/util/index.d.ts +0 -1
- package/dist/util/index.js +0 -13
|
@@ -13,6 +13,7 @@ declare class ApiKeys implements ApiKeysInterface {
|
|
|
13
13
|
updateKey(apiKey: string, updatedKey: UpdateApiKeyInput): Promise<ApiKey>;
|
|
14
14
|
deleteKey(apiKey: string): Promise<boolean>;
|
|
15
15
|
reactivateKey(apiKey: string): Promise<ApiKey>;
|
|
16
|
+
rotateKey(apiKey: string): Promise<ApiKey>;
|
|
16
17
|
private getKeysFilterEndpoint;
|
|
17
18
|
}
|
|
18
19
|
export default ApiKeys;
|
|
@@ -69,6 +69,11 @@ class ApiKeys {
|
|
|
69
69
|
return yield this.api.request(HttpMethod_1.HttpMethod.PATCH, `/api-keys/${apiKey}/reactivate`);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
+
rotateKey(apiKey) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
return yield this.api.request(HttpMethod_1.HttpMethod.POST, `/api-keys/${apiKey}/rotate`);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
72
77
|
getKeysFilterEndpoint(filter) {
|
|
73
78
|
let filters = [];
|
|
74
79
|
if (filter !== undefined) {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import ApiRequest from "./services/ApiRequest/ApiRequest";
|
|
|
2
2
|
import ApiKeys from "./endpoints/ApiKeys/ApiKeys";
|
|
3
3
|
import Projects from "./endpoints/Projects/Projects";
|
|
4
4
|
import Accounts from "./endpoints/Accounts/Accounts";
|
|
5
|
-
|
|
5
|
+
type Options = {
|
|
6
6
|
host?: string;
|
|
7
7
|
retryCount?: number;
|
|
8
8
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type ApiKey = {
|
|
2
2
|
key: string;
|
|
3
3
|
name: string;
|
|
4
4
|
customMetaData: AnyJson;
|
|
@@ -11,11 +11,11 @@ export declare type ApiKey = {
|
|
|
11
11
|
rateLimitConfigs: RateLimitConfiguration;
|
|
12
12
|
expiry: Date;
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type RateLimitConfiguration = {
|
|
15
15
|
rateLimit: number;
|
|
16
16
|
rateLimitTtl: number;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type ApiKeyInput = {
|
|
19
19
|
name: string;
|
|
20
20
|
projectId?: string;
|
|
21
21
|
key?: string;
|
|
@@ -25,14 +25,14 @@ export declare type ApiKeyInput = {
|
|
|
25
25
|
rateLimitConfigs?: RateLimitConfiguration;
|
|
26
26
|
expiry?: Date;
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export type ApiKeyFilter = {
|
|
29
29
|
projectId?: string;
|
|
30
30
|
name?: string;
|
|
31
31
|
customAccountId?: string | null;
|
|
32
32
|
customUserId?: string | null;
|
|
33
33
|
isActive?: boolean;
|
|
34
34
|
};
|
|
35
|
-
export
|
|
35
|
+
export type UpdateApiKeyInput = {
|
|
36
36
|
name: string;
|
|
37
37
|
key?: string;
|
|
38
38
|
customMetaData?: AnyJson;
|
|
@@ -45,7 +45,7 @@ export declare enum AuthedEntityType {
|
|
|
45
45
|
USER = "USER",
|
|
46
46
|
ACCESS_KEY = "ACCESS_KEY"
|
|
47
47
|
}
|
|
48
|
-
export
|
|
48
|
+
export type AuthBaseEntity = {
|
|
49
49
|
isActive: boolean;
|
|
50
50
|
createdBy: string;
|
|
51
51
|
createdByType?: AuthedEntityType;
|
|
@@ -55,7 +55,7 @@ export declare type AuthBaseEntity = {
|
|
|
55
55
|
updatedAt: Date;
|
|
56
56
|
createdAt: Date;
|
|
57
57
|
};
|
|
58
|
-
export
|
|
58
|
+
export type Project = AuthBaseEntity & {
|
|
59
59
|
id: string;
|
|
60
60
|
name: string;
|
|
61
61
|
accountId: string;
|
|
@@ -65,21 +65,21 @@ export declare enum Environment {
|
|
|
65
65
|
LIVE = "live",
|
|
66
66
|
TEST = "test"
|
|
67
67
|
}
|
|
68
|
-
export
|
|
68
|
+
export type CreateProjectInput = {
|
|
69
69
|
name: string;
|
|
70
70
|
accountId: string;
|
|
71
71
|
env: Environment;
|
|
72
72
|
};
|
|
73
|
-
export
|
|
73
|
+
export type UpdateProjectInput = {
|
|
74
74
|
name: string;
|
|
75
75
|
};
|
|
76
|
-
export
|
|
76
|
+
export type Account = AuthBaseEntity & {
|
|
77
77
|
id: string;
|
|
78
78
|
name: string;
|
|
79
79
|
};
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
type AnyJson = boolean | number | string | null | JsonArray | JsonMap;
|
|
81
|
+
type JsonMap = {
|
|
82
82
|
[key: string]: AnyJson;
|
|
83
83
|
};
|
|
84
|
-
|
|
84
|
+
type JsonArray = Array<AnyJson>;
|
|
85
85
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "theauthapi",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Client library for TheAuthAPI.com",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"eslint": "^7.14.0",
|
|
47
47
|
"eslint-config-prettier": "^8.5.0",
|
|
48
48
|
"express": "^4.15.2",
|
|
49
|
-
"jest": "^
|
|
49
|
+
"jest": "^29.7.0",
|
|
50
50
|
"prettier": "2.6.2",
|
|
51
|
-
"ts-jest": "^
|
|
51
|
+
"ts-jest": "^29.1.1",
|
|
52
52
|
"typescript": "^4.6.3"
|
|
53
53
|
}
|
|
54
54
|
}
|
package/History.md
DELETED
package/dist/usage.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const TheAuthAPI = require("./index").default;
|
|
2
|
-
|
|
3
|
-
const accessKey = "live_access_tXhV0mDbN81n7dGRuBPAVvfwsv5N4pmlaGLCELXOtFoWU2EGV6cN5UA3LhjrUg9B";
|
|
4
|
-
const theAuthAPI = new TheAuthAPI(accessKey, {
|
|
5
|
-
host: "http://localhost:8080",
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
async function getKeys() {
|
|
9
|
-
const keys = await theAuthAPI.apiKeys.getKeys();
|
|
10
|
-
return keys.map((k) => k.key);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const apikey =
|
|
14
|
-
"test_DdRU9zW8LSHGjzuDDHYqPcDm4ocacFJl6I6wtzBGKevgnAzy8GvqFEuZIj3ykqzS";
|
|
15
|
-
(async () => {
|
|
16
|
-
console.log(await theAuthAPI.apiKeys.createKey({
|
|
17
|
-
name: "Sheesh",
|
|
18
|
-
expiry: new Date("Sheesh"),
|
|
19
|
-
}));
|
|
20
|
-
})();
|
package/dist/util/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function validateString(variableName: string, value: string): void;
|
package/dist/util/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.validateString = void 0;
|
|
7
|
-
const lodash_isstring_1 = __importDefault(require("lodash.isstring"));
|
|
8
|
-
function validateString(variableName, value) {
|
|
9
|
-
if (!value || !(0, lodash_isstring_1.default)(value)) {
|
|
10
|
-
throw new TypeError(`${variableName} must be a string, got: ${value}`);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.validateString = validateString;
|