@scalekit-sdk/node 1.0.2 → 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.
- package/.github/dependabot.yml +10 -0
- package/README.md +82 -12
- package/lib/connect.js +5 -4
- package/lib/connect.js.map +1 -1
- package/lib/connection.d.ts +17 -3
- package/lib/connection.js +36 -2
- package/lib/connection.js.map +1 -1
- package/lib/constants/user.d.ts +1 -1
- package/lib/core.d.ts +9 -5
- package/lib/core.js +27 -23
- package/lib/core.js.map +1 -1
- package/lib/domain.d.ts +1 -12
- package/lib/domain.js +0 -19
- package/lib/domain.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/organization.d.ts +26 -8
- package/lib/organization.js +50 -14
- package/lib/organization.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.js +1 -1
- package/lib/pkg/grpc/scalekit/v1/connections/connections_connect.d.ts +3 -3
- package/lib/pkg/grpc/scalekit/v1/connections/connections_connect.js +2 -2
- package/lib/pkg/grpc/scalekit/v1/connections/connections_connect.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.d.ts +19 -55
- package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.js +26 -63
- package/lib/pkg/grpc/scalekit/v1/connections/connections_pb.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/domains/domains_pb.js +1 -1
- package/lib/pkg/grpc/scalekit/v1/errdetails/errdetails_pb.js +1 -1
- package/lib/pkg/grpc/scalekit/v1/options/options_pb.js +1 -1
- package/lib/pkg/grpc/scalekit/v1/organizations/organizations_connect.d.ts +15 -19
- package/lib/pkg/grpc/scalekit/v1/organizations/organizations_connect.js +14 -18
- package/lib/pkg/grpc/scalekit/v1/organizations/organizations_connect.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/organizations/organizations_pb.d.ts +58 -24
- package/lib/pkg/grpc/scalekit/v1/organizations/organizations_pb.js +94 -32
- package/lib/pkg/grpc/scalekit/v1/organizations/organizations_pb.js.map +1 -1
- package/lib/scalekit.d.ts +11 -14
- package/lib/scalekit.js +17 -14
- package/lib/scalekit.js.map +1 -1
- package/lib/types/{user.d.ts → auth.d.ts} +5 -0
- package/lib/types/{user.js → auth.js} +1 -1
- package/lib/types/auth.js.map +1 -0
- package/lib/types/scalekit.d.ts +9 -9
- package/lib/types/scalekit.js.map +1 -1
- package/package.json +1 -1
- package/src/connect.ts +5 -5
- package/src/connection.ts +41 -3
- package/src/constants/user.ts +1 -1
- package/src/core.ts +32 -25
- package/src/domain.ts +0 -21
- package/src/index.ts +4 -4
- package/src/organization.ts +59 -12
- package/src/pkg/grpc/scalekit/v1/commons/commons_pb.ts +1 -1
- package/src/pkg/grpc/scalekit/v1/connections/connections_connect.ts +3 -3
- package/src/pkg/grpc/scalekit/v1/connections/connections_pb.ts +33 -89
- package/src/pkg/grpc/scalekit/v1/domains/domains_pb.ts +1 -1
- package/src/pkg/grpc/scalekit/v1/errdetails/errdetails_pb.ts +1 -1
- package/src/pkg/grpc/scalekit/v1/options/options_pb.ts +1 -1
- package/src/pkg/grpc/scalekit/v1/organizations/organizations_connect.ts +15 -19
- package/src/pkg/grpc/scalekit/v1/organizations/organizations_pb.ts +117 -43
- package/src/scalekit.ts +26 -17
- package/src/types/{user.ts → auth.ts} +6 -0
- package/src/types/scalekit.ts +11 -11
- package/lib/types/user.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
<p align="
|
|
1
|
+
<p align="left">
|
|
2
2
|
<a href="https://scalekit.com" target="_blank" rel="noopener noreferrer">
|
|
3
3
|
<picture>
|
|
4
|
-
<img src="
|
|
4
|
+
<img src="https://cdn.scalekit.cloud/v1/scalekit-logo-dark.svg" height="64">
|
|
5
5
|
</picture>
|
|
6
6
|
</a>
|
|
7
7
|
<br/>
|
|
8
8
|
</p>
|
|
9
|
-
<h1 align="center">
|
|
10
|
-
Official Scalekit Node SDK
|
|
11
|
-
</h1>
|
|
12
9
|
|
|
13
|
-
|
|
10
|
+
# Official Node.js SDK
|
|
11
|
+
<a href="https://scalekit.com" target="_blank" rel="noopener noreferrer">Scalekit</a> is an Enterprise Authentication Platform purpose built for B2B applications. This Node.js SDK helps implement Enterprise Capabilities like Single Sign-on via SAML or OIDC in your Node.js applications within a few hours.
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
<div>
|
|
14
|
+
📚 <a target="_blank" href="https://docs.scalekit.com">Documentation</a> - 🚀 <a target="_blank" href="https://docs.scalekit.com">Quick-start Guide</a> - 💻 <a target="_blank" href="https://docs.scalekit.com/apis">API Reference</a>
|
|
15
|
+
</div>
|
|
16
|
+
<hr />
|
|
16
17
|
|
|
17
|
-
##
|
|
18
|
+
## Pre-requisites
|
|
18
19
|
|
|
19
20
|
1. [Sign up](https://scalekit.com) for a Scalekit account.
|
|
20
21
|
2. Get your ```env_url```, ```client_id``` and ```client_secret``` from the Scalekit dashboard.
|
|
21
22
|
|
|
22
23
|
## Installation
|
|
23
24
|
|
|
25
|
+
Install Scalekit SDK using your preferred package manager.
|
|
26
|
+
|
|
24
27
|
```sh
|
|
25
28
|
npm install @scalekit-sdk/node
|
|
26
29
|
#or
|
|
@@ -31,19 +34,86 @@ pnpm add @scalekit-sdk/node
|
|
|
31
34
|
|
|
32
35
|
## Usage
|
|
33
36
|
|
|
37
|
+
Initialize the Scalekit client using the appropriate credentials. Refer code sample below.
|
|
38
|
+
|
|
34
39
|
```javascript
|
|
35
|
-
import {
|
|
40
|
+
import { ScalekitClient } from "@scalekit-sdk/node";
|
|
36
41
|
|
|
37
|
-
const
|
|
42
|
+
const sc = new ScalekitClient(
|
|
38
43
|
process.env.SCALEKIT_ENV_URL!,
|
|
39
44
|
process.env.SCALEKIT_CLIENT_ID!,
|
|
40
45
|
process.env.SCALEKIT_CLIENT_SECRET!
|
|
41
46
|
);
|
|
47
|
+
|
|
48
|
+
// Use the sc object to interact with the Scalekit API
|
|
49
|
+
const authUrl = sc.getAuthorizationUrl("https://acme-corp.com/redirect-uri", {
|
|
50
|
+
state: "state",
|
|
51
|
+
connectionId: "connection_id",
|
|
52
|
+
});
|
|
53
|
+
|
|
42
54
|
```
|
|
43
55
|
|
|
56
|
+
## Examples - SSO with Express.js
|
|
57
|
+
|
|
58
|
+
Below is a simple code sample that showcases how to implement Single Sign-on using Scalekit SDK
|
|
59
|
+
|
|
60
|
+
```javascript
|
|
61
|
+
import express from "express";
|
|
62
|
+
import { ScalekitClient } from "@scalekit-sdk/node";
|
|
63
|
+
|
|
64
|
+
const app = express();
|
|
65
|
+
|
|
66
|
+
const sc = new ScalekitClient(
|
|
67
|
+
process.env.SCALEKIT_ENV_URL!,
|
|
68
|
+
process.env.SCALEKIT_CLIENT_ID!,
|
|
69
|
+
process.env.SCALEKIT_CLIENT_SECRET!
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const redirectUri = `${process.env.HOST}/auth/callback`;
|
|
73
|
+
|
|
74
|
+
// Get the authorization URL and redirect the user to the IdP login page
|
|
75
|
+
app.get("/auth/login", (req, res) => {
|
|
76
|
+
const authUrl = sc.getAuthorizationUrl(
|
|
77
|
+
redirectUri,
|
|
78
|
+
{
|
|
79
|
+
state: "state",
|
|
80
|
+
connectionId: "connection_id",
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
res.redirect(authUrl);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// Handle the callback from Scalekit
|
|
88
|
+
app.get("/auth/callback", async (req, res) => {
|
|
89
|
+
const code = req.query.code as string;
|
|
90
|
+
const authResp = await sc.authenticateWithCode(code, redirectUri);
|
|
91
|
+
res.cookie("access_token", authResp.accessToken);
|
|
92
|
+
res.json(authResp.accessToken);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
app.listen(3000, () => {
|
|
96
|
+
console.log("Server is running on port 3000");
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Example Apps
|
|
101
|
+
|
|
102
|
+
Fully functional sample applications written using some popular web application frameworks and Scalekit SDK. Feel free to clone the repo and run them locally.
|
|
103
|
+
|
|
104
|
+
- [Express.js](https://github.com/scalekit-inc/scalekit-express-example.git)
|
|
105
|
+
- [Next.js](https://github.com/scalekit-inc/scalekit-nextjs-example.git)
|
|
106
|
+
|
|
44
107
|
## API Reference
|
|
45
|
-
|
|
108
|
+
|
|
109
|
+
Refer to our [API reference docs](https://docs.scalekit.com/apis) for detailed information about all our API endpoints and their usage.
|
|
110
|
+
|
|
111
|
+
## More Information
|
|
112
|
+
|
|
113
|
+
- Quickstart Guide to implement Single Sign-on in your application: [SSO Quickstart Guide](https://docs.scalekit.com)
|
|
114
|
+
- Understand Single Sign-on basics: [SSO Basics](https://docs.scalekit.com/best-practices/single-sign-on)
|
|
46
115
|
|
|
47
116
|
## License
|
|
117
|
+
|
|
48
118
|
This project is licensed under the **MIT license**.
|
|
49
|
-
See the [LICENSE](LICENSE) file for more information.
|
|
119
|
+
See the [LICENSE](LICENSE) file for more information.
|
package/lib/connect.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const connect_1 = require("@connectrpc/connect");
|
|
4
4
|
const connect_node_1 = require("@connectrpc/connect-node");
|
|
5
|
+
const core_1 = require("./core");
|
|
5
6
|
class GrpcConnect {
|
|
6
7
|
constructor(coreClient) {
|
|
7
8
|
this.coreClient = coreClient;
|
|
@@ -11,11 +12,11 @@ class GrpcConnect {
|
|
|
11
12
|
interceptors: [
|
|
12
13
|
(next) => {
|
|
13
14
|
return (req) => {
|
|
14
|
-
req.header.set(
|
|
15
|
-
req.header.set(
|
|
16
|
-
req.header.set(
|
|
15
|
+
req.header.set(core_1.headers['user-agent'], this.coreClient.userAgent);
|
|
16
|
+
req.header.set(core_1.headers['x-sdk-version'], this.coreClient.sdkVersion);
|
|
17
|
+
req.header.set(core_1.headers['x-api-version'], this.coreClient.apiVersion);
|
|
17
18
|
if (this.coreClient.accessToken) {
|
|
18
|
-
req.header.set(
|
|
19
|
+
req.header.set(core_1.headers.authorization, `Bearer ${this.coreClient.accessToken}`);
|
|
19
20
|
}
|
|
20
21
|
return next(req);
|
|
21
22
|
};
|
package/lib/connect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":";;AACA,iDAAoF;AACpF,2DAA+D;
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":";;AACA,iDAAoF;AACpF,2DAA+D;AAC/D,iCAA6C;AAE7C,MAAqB,WAAW;IAE9B,YACmB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QAEvC,IAAI,CAAC,SAAS,GAAG,IAAA,kCAAmB,EAAC;YACnC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM;YAC/B,WAAW,EAAE,GAAG;YAChB,YAAY,EAAE;gBACZ,CAAC,IAAI,EAAE,EAAE;oBACP,OAAO,CAAC,GAAG,EAAE,EAAE;wBACb,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,cAAO,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;wBAChE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,cAAO,CAAC,eAAe,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;wBACpE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,cAAO,CAAC,eAAe,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;wBACpE,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;4BAChC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,cAAO,CAAC,aAAa,EAAE,UAAU,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;wBAChF,CAAC;wBACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;oBAClB,CAAC,CAAA;gBACH,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC;IAED,YAAY,CAAwB,OAAU;QAC5C,OAAO,IAAA,6BAAmB,EAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;CACF;AA3BD,8BA2BC"}
|
package/lib/connection.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import GrpcConnect from './connect';
|
|
2
2
|
import CoreClient from './core';
|
|
3
|
-
import { GetConnectionResponse, ListConnectionsResponse } from './pkg/grpc/scalekit/v1/connections/connections_pb';
|
|
3
|
+
import { GetConnectionResponse, ToggleConnectionResponse, ListConnectionsResponse } from './pkg/grpc/scalekit/v1/connections/connections_pb';
|
|
4
4
|
export default class ConnectionClient {
|
|
5
5
|
private readonly grpcConncet;
|
|
6
6
|
private readonly coreClient;
|
|
@@ -8,11 +8,11 @@ export default class ConnectionClient {
|
|
|
8
8
|
constructor(grpcConncet: GrpcConnect, coreClient: CoreClient);
|
|
9
9
|
/**
|
|
10
10
|
* Get a connection by id and organization id
|
|
11
|
-
* @param id The connection id
|
|
12
11
|
* @param organizationId The organization id
|
|
12
|
+
* @param id The connection id
|
|
13
13
|
* @returns {Promise<GetConnectionResponse>} The connection
|
|
14
14
|
*/
|
|
15
|
-
getConnection(
|
|
15
|
+
getConnection(organizationId: string, id: string): Promise<GetConnectionResponse>;
|
|
16
16
|
/**
|
|
17
17
|
* List connections by domain
|
|
18
18
|
* @param domain The domain
|
|
@@ -25,4 +25,18 @@ export default class ConnectionClient {
|
|
|
25
25
|
* @returns {Promise<ListConnectionsResponse>} The list of connections
|
|
26
26
|
*/
|
|
27
27
|
listConnections(organizationId: string): Promise<ListConnectionsResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* Enable a connection by id and organization id
|
|
30
|
+
* @param organizationId The organization id
|
|
31
|
+
* @param id The connection id
|
|
32
|
+
* @returns {Promise<ToggleConnectionResponse>} The connection enable response
|
|
33
|
+
*/
|
|
34
|
+
enableConnection(organizationId: string, id: string): Promise<ToggleConnectionResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Disable a connection by id and organization id
|
|
37
|
+
* @param organizationId The organization id
|
|
38
|
+
* @param id The connection id
|
|
39
|
+
* @returns {Promise<ToggleConnectionResponse>} The connection enable response
|
|
40
|
+
*/
|
|
41
|
+
disableConnection(organizationId: string, id: string): Promise<ToggleConnectionResponse>;
|
|
28
42
|
}
|
package/lib/connection.js
CHANGED
|
@@ -18,11 +18,11 @@ class ConnectionClient {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Get a connection by id and organization id
|
|
21
|
-
* @param id The connection id
|
|
22
21
|
* @param organizationId The organization id
|
|
22
|
+
* @param id The connection id
|
|
23
23
|
* @returns {Promise<GetConnectionResponse>} The connection
|
|
24
24
|
*/
|
|
25
|
-
getConnection(
|
|
25
|
+
getConnection(organizationId, id) {
|
|
26
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
27
|
return this.coreClient.connectExec(this.client.getConnection, {
|
|
28
28
|
id,
|
|
@@ -63,6 +63,40 @@ class ConnectionClient {
|
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Enable a connection by id and organization id
|
|
68
|
+
* @param organizationId The organization id
|
|
69
|
+
* @param id The connection id
|
|
70
|
+
* @returns {Promise<ToggleConnectionResponse>} The connection enable response
|
|
71
|
+
*/
|
|
72
|
+
enableConnection(organizationId, id) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
return this.coreClient.connectExec(this.client.enableConnection, {
|
|
75
|
+
id,
|
|
76
|
+
identities: {
|
|
77
|
+
case: 'organizationId',
|
|
78
|
+
value: organizationId
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Disable a connection by id and organization id
|
|
85
|
+
* @param organizationId The organization id
|
|
86
|
+
* @param id The connection id
|
|
87
|
+
* @returns {Promise<ToggleConnectionResponse>} The connection enable response
|
|
88
|
+
*/
|
|
89
|
+
disableConnection(organizationId, id) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
return this.coreClient.connectExec(this.client.disableConnection, {
|
|
92
|
+
id,
|
|
93
|
+
identities: {
|
|
94
|
+
case: 'organizationId',
|
|
95
|
+
value: organizationId
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
66
100
|
}
|
|
67
101
|
exports.default = ConnectionClient;
|
|
68
102
|
//# sourceMappingURL=connection.js.map
|
package/lib/connection.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":";;;;;;;;;;;AAGA,gGAA2F;AAG3F,MAAqB,gBAAgB;IAEnC,YACmB,WAAwB,EACxB,UAAsB;QADtB,gBAAW,GAAX,WAAW,CAAa;QACxB,eAAU,GAAV,UAAU,CAAY;QAEvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,uCAAiB,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACG,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":";;;;;;;;;;;AAGA,gGAA2F;AAG3F,MAAqB,gBAAgB;IAEnC,YACmB,WAAwB,EACxB,UAAsB;QADtB,gBAAW,GAAX,WAAW,CAAa;QACxB,eAAU,GAAV,UAAU,CAAY;QAEvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,uCAAiB,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACG,aAAa,CAAC,cAAsB,EAAE,EA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|
package/lib/constants/user.d.ts
CHANGED
package/lib/core.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Axios, AxiosResponse } from "axios";
|
|
2
2
|
import { JWK } from 'jose';
|
|
3
|
+
import { TokenResponse } from './types/auth';
|
|
4
|
+
export declare const headers: {
|
|
5
|
+
"user-agent": string;
|
|
6
|
+
"x-sdk-version": string;
|
|
7
|
+
"x-api-version": string;
|
|
8
|
+
authorization: string;
|
|
9
|
+
};
|
|
3
10
|
export default class CoreClient {
|
|
4
11
|
readonly envUrl: string;
|
|
5
12
|
readonly clientId: string;
|
|
@@ -15,12 +22,9 @@ export default class CoreClient {
|
|
|
15
22
|
/**
|
|
16
23
|
* Authenticate with the code
|
|
17
24
|
* @param {string} data Data to authenticate
|
|
18
|
-
* @returns {Promise<AxiosResponse<
|
|
25
|
+
* @returns {Promise<AxiosResponse<TokenResponse>>} Returns access token and id token
|
|
19
26
|
*/
|
|
20
|
-
authenticate(data: string): Promise<AxiosResponse<
|
|
21
|
-
access_token: string;
|
|
22
|
-
id_token: string;
|
|
23
|
-
}, any>>;
|
|
27
|
+
authenticate(data: string): Promise<AxiosResponse<TokenResponse, any>>;
|
|
24
28
|
/**
|
|
25
29
|
* Get the JWKS from the server and store it in the client instance
|
|
26
30
|
* @returns {Promise<void>} Returns nothing
|
package/lib/core.js
CHANGED
|
@@ -35,12 +35,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.headers = void 0;
|
|
38
39
|
const connect_1 = require("@connectrpc/connect");
|
|
39
40
|
const axios_1 = __importStar(require("axios"));
|
|
40
41
|
const os_1 = __importDefault(require("os"));
|
|
41
42
|
const qs_1 = __importDefault(require("qs"));
|
|
42
43
|
const scalekit_1 = require("./types/scalekit");
|
|
43
44
|
const errdetails_pb_1 = require("./pkg/grpc/scalekit/v1/errdetails/errdetails_pb");
|
|
45
|
+
exports.headers = {
|
|
46
|
+
"user-agent": "user-agent",
|
|
47
|
+
"x-sdk-version": "x-sdk-version",
|
|
48
|
+
"x-api-version": "x-api-version",
|
|
49
|
+
"authorization": "authorization"
|
|
50
|
+
};
|
|
44
51
|
const tokenEndpoint = "oauth/token";
|
|
45
52
|
const jwksEndpoint = "keys";
|
|
46
53
|
class CoreClient {
|
|
@@ -50,16 +57,16 @@ class CoreClient {
|
|
|
50
57
|
this.clientSecret = clientSecret;
|
|
51
58
|
this.keys = [];
|
|
52
59
|
this.accessToken = null;
|
|
53
|
-
this.sdkVersion = `Scalekit-Node/1.0.
|
|
60
|
+
this.sdkVersion = `Scalekit-Node/1.0.3`;
|
|
54
61
|
this.apiVersion = "20240430";
|
|
55
62
|
this.userAgent = `${this.sdkVersion} Node/${process.version} (${process.platform}; ${os_1.default.arch()})`;
|
|
56
63
|
this.axios = axios_1.default.create({ baseURL: envUrl });
|
|
57
64
|
this.axios.interceptors.request.use((config) => {
|
|
58
|
-
config.headers[
|
|
59
|
-
config.headers[
|
|
60
|
-
config.headers[
|
|
65
|
+
config.headers[exports.headers['user-agent']] = this.userAgent;
|
|
66
|
+
config.headers[exports.headers['x-sdk-version']] = this.sdkVersion;
|
|
67
|
+
config.headers[exports.headers['x-api-version']] = this.apiVersion;
|
|
61
68
|
if (this.accessToken) {
|
|
62
|
-
config.headers[
|
|
69
|
+
config.headers[exports.headers.authorization] = `Bearer ${this.accessToken}`;
|
|
63
70
|
}
|
|
64
71
|
return config;
|
|
65
72
|
});
|
|
@@ -78,7 +85,7 @@ class CoreClient {
|
|
|
78
85
|
/**
|
|
79
86
|
* Authenticate with the code
|
|
80
87
|
* @param {string} data Data to authenticate
|
|
81
|
-
* @returns {Promise<AxiosResponse<
|
|
88
|
+
* @returns {Promise<AxiosResponse<TokenResponse>>} Returns access token and id token
|
|
82
89
|
*/
|
|
83
90
|
authenticate(data) {
|
|
84
91
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -117,10 +124,10 @@ class CoreClient {
|
|
|
117
124
|
}
|
|
118
125
|
catch (error) {
|
|
119
126
|
if (retryLeft > 0) {
|
|
120
|
-
let
|
|
127
|
+
let isUnAuthenticatedError = false;
|
|
121
128
|
if (error instanceof axios_1.AxiosError) {
|
|
122
129
|
if (error.status == axios_1.HttpStatusCode.Unauthorized) {
|
|
123
|
-
|
|
130
|
+
isUnAuthenticatedError = true;
|
|
124
131
|
}
|
|
125
132
|
else {
|
|
126
133
|
throw new Error(error.message);
|
|
@@ -129,24 +136,21 @@ class CoreClient {
|
|
|
129
136
|
// ConnectError is a custom error class that extends Error class and has a code property
|
|
130
137
|
if (error instanceof connect_1.ConnectError) {
|
|
131
138
|
if (error.code == connect_1.Code.Unauthenticated) {
|
|
132
|
-
|
|
139
|
+
isUnAuthenticatedError = true;
|
|
133
140
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
throw new Error(message);
|
|
145
|
-
}
|
|
146
|
-
throw new Error(error.message);
|
|
141
|
+
if (error.code == connect_1.Code.InvalidArgument) {
|
|
142
|
+
const messages = [error.message];
|
|
143
|
+
error.findDetails(errdetails_pb_1.ErrorInfo).forEach((detail) => {
|
|
144
|
+
if (detail.validationErrorInfo) {
|
|
145
|
+
detail.validationErrorInfo.fieldViolations.forEach((fv) => {
|
|
146
|
+
messages.push(`${fv.field}: ${fv.description}`);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
throw new Error(messages.join("\n"));
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
|
-
if (
|
|
153
|
+
if (isUnAuthenticatedError) {
|
|
150
154
|
yield this.authenticateClient();
|
|
151
155
|
return this.connectExec(fn, data, retryLeft - 1);
|
|
152
156
|
}
|
package/lib/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAyD;AACzD,+CAAgF;AAEhF,4CAAoB;AACpB,4CAA6B;AAC7B,+CAA6C;AAC7C,mFAA4E;AAG/D,QAAA,OAAO,GAAG;IACrB,YAAY,EAAE,YAAY;IAC1B,eAAe,EAAE,eAAe;IAChC,eAAe,EAAE,eAAe;IAChC,eAAe,EAAE,eAAe;CACjC,CAAA;AAED,MAAM,aAAa,GAAG,aAAa,CAAC;AACpC,MAAM,YAAY,GAAG,MAAM,CAAC;AAC5B,MAAqB,UAAU;IAO7B,YACW,MAAc,EACd,QAAgB,EAChB,YAAoB;QAFpB,WAAM,GAAN,MAAM,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAQ;QAChB,iBAAY,GAAZ,YAAY,CAAQ;QATxB,SAAI,GAAU,EAAE,CAAC;QACjB,gBAAW,GAAkB,IAAI,CAAC;QAElC,eAAU,GAAG,qBAAqB,CAAC;QACnC,eAAU,GAAG,UAAU,CAAC;QACxB,cAAS,GAAG,GAAG,IAAI,CAAC,UAAU,SAAS,OAAO,CAAC,OAAO,KAAK,OAAO,CAAC,QAAQ,KAAK,YAAE,CAAC,IAAI,EAAE,GAAG,CAAC;QAMlG,IAAI,CAAC,KAAK,GAAG,eAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YAC7C,MAAM,CAAC,OAAO,CAAC,eAAO,CAAC,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;YACvD,MAAM,CAAC,OAAO,CAAC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AC,CAAA;4BAEF,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;wBACvC,CAAC;oBACH,CAAC;oBACD,IAAI,sBAAsB,EAAE,CAAC;wBAC3B,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;wBAChC,OAAO,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC;oBACnD,CAAC;gBACH,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KAAA;CACF;AAnHD,6BAmHC"}
|
package/lib/domain.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import GrpcConnect from './connect';
|
|
2
2
|
import CoreClient from './core';
|
|
3
|
-
import { CreateDomainResponse,
|
|
3
|
+
import { CreateDomainResponse, ListDomainResponse } from './pkg/grpc/scalekit/v1/domains/domains_pb';
|
|
4
4
|
export default class DomainClient {
|
|
5
5
|
private readonly grpcConncet;
|
|
6
6
|
private readonly coreClient;
|
|
@@ -13,17 +13,6 @@ export default class DomainClient {
|
|
|
13
13
|
* @returns {Promise<CreateDomainResponse>} The created domain
|
|
14
14
|
*/
|
|
15
15
|
createDomain(organizationId: string, name: string): Promise<CreateDomainResponse>;
|
|
16
|
-
/**
|
|
17
|
-
* Get a domain by id
|
|
18
|
-
* @param {object} options The options to get a domain
|
|
19
|
-
* @param {string} options.id The domain id
|
|
20
|
-
* @param {string} options.organizationId The organization id
|
|
21
|
-
* @returns {Promise<GetDomainResponse>} The domain
|
|
22
|
-
*/
|
|
23
|
-
getDomain(options: {
|
|
24
|
-
id: string;
|
|
25
|
-
organizationId: string;
|
|
26
|
-
}): Promise<GetDomainResponse>;
|
|
27
16
|
/**
|
|
28
17
|
* List domains for an organization
|
|
29
18
|
* @param organizationId The organization id
|
package/lib/domain.js
CHANGED
|
@@ -35,25 +35,6 @@ class DomainClient {
|
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
/**
|
|
39
|
-
* Get a domain by id
|
|
40
|
-
* @param {object} options The options to get a domain
|
|
41
|
-
* @param {string} options.id The domain id
|
|
42
|
-
* @param {string} options.organizationId The organization id
|
|
43
|
-
* @returns {Promise<GetDomainResponse>} The domain
|
|
44
|
-
*/
|
|
45
|
-
getDomain(options) {
|
|
46
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
const { id, organizationId } = options;
|
|
48
|
-
return this.coreClient.connectExec(this.client.getDomain, {
|
|
49
|
-
id,
|
|
50
|
-
identities: {
|
|
51
|
-
case: 'organizationId',
|
|
52
|
-
value: organizationId
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
38
|
/**
|
|
58
39
|
* List domains for an organization
|
|
59
40
|
* @param organizationId The organization id
|
package/lib/domain.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../src/domain.ts"],"names":[],"mappings":";;;;;;;;;;;AAGA,oFAA+E;AAG/E,MAAqB,YAAY;IAE/B,YACmB,WAAwB,EACxB,UAAsB;QADtB,gBAAW,GAAX,WAAW,CAAa;QACxB,eAAU,GAAV,UAAU,CAAY;QAEvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,+BAAa,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;MAKE;IACI,YAAY,CAAC,cAAsB,EAAE,IAAY;;YACrD,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,YAAY,EACxB;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,gBAAgB;oBACtB,KAAK,EAAE,cAAc;iBACtB;gBACD,MAAM,EAAE;oBACN,MAAM,EAAE,IAAI;iBACb;aACF,CACF,CAAA;QACH,CAAC;KAAA;IAED
|
|
1
|
+
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../src/domain.ts"],"names":[],"mappings":";;;;;;;;;;;AAGA,oFAA+E;AAG/E,MAAqB,YAAY;IAE/B,YACmB,WAAwB,EACxB,UAAsB;QADtB,gBAAW,GAAX,WAAW,CAAa;QACxB,eAAU,GAAV,UAAU,CAAY;QAEvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,+BAAa,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;MAKE;IACI,YAAY,CAAC,cAAsB,EAAE,IAAY;;YACrD,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,YAAY,EACxB;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,gBAAgB;oBACtB,KAAK,EAAE,cAAc;iBACtB;gBACD,MAAM,EAAE;oBACN,MAAM,EAAE,IAAI;iBACb;aACF,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;OAIG;IACG,WAAW,CAAC,cAAsB;;YACtC,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,WAAW,EACvB;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,gBAAgB;oBACtB,KAAK,EAAE,cAAc;iBACtB;aACF,CACF,CAAC;QACJ,CAAC;KAAA;CACF;AA9CD,+BA8CC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export {
|
|
3
|
-
export default
|
|
1
|
+
import ScalekitClient from "./scalekit";
|
|
2
|
+
export { ScalekitClient };
|
|
3
|
+
export default ScalekitClient;
|
|
4
4
|
export * from "./types/scalekit";
|
|
5
|
-
export * from "./types/
|
|
5
|
+
export * from "./types/auth";
|
package/lib/index.js
CHANGED
|
@@ -17,10 +17,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
20
|
+
exports.ScalekitClient = void 0;
|
|
21
21
|
const scalekit_1 = __importDefault(require("./scalekit"));
|
|
22
|
-
exports.
|
|
22
|
+
exports.ScalekitClient = scalekit_1.default;
|
|
23
23
|
exports.default = scalekit_1.default;
|
|
24
24
|
__exportStar(require("./types/scalekit"), exports);
|
|
25
|
-
__exportStar(require("./types/
|
|
25
|
+
__exportStar(require("./types/auth"), exports);
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,0DAAwC;AAE/B,yBAFF,kBAAc,CAEE;AACvB,kBAAe,kBAAc,CAAC;AAE9B,mDAAiC;AACjC,+CAA6B"}
|
package/lib/organization.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PartialMessage } from '@bufbuild/protobuf';
|
|
1
|
+
import { Empty, PartialMessage } from '@bufbuild/protobuf';
|
|
2
2
|
import GrpcConnect from './connect';
|
|
3
3
|
import CoreClient from './core';
|
|
4
|
-
import { CreateOrganizationResponse, GetOrganizationResponse, ListOrganizationsResponse, UpdateOrganization, UpdateOrganizationResponse } from './pkg/grpc/scalekit/v1/organizations/organizations_pb';
|
|
4
|
+
import { CreateOrganizationResponse, GetOrganizationResponse, Link, ListOrganizationsResponse, UpdateOrganization, UpdateOrganizationResponse } from './pkg/grpc/scalekit/v1/organizations/organizations_pb';
|
|
5
5
|
export default class OrganizationClient {
|
|
6
6
|
private readonly grpcConncet;
|
|
7
7
|
private readonly coreClient;
|
|
@@ -9,13 +9,12 @@ export default class OrganizationClient {
|
|
|
9
9
|
constructor(grpcConncet: GrpcConnect, coreClient: CoreClient);
|
|
10
10
|
/**
|
|
11
11
|
* Create an organization with the given name. Optionally, you can provide an external id.
|
|
12
|
+
* @param {string} name The organization name
|
|
12
13
|
* @param {object} options The options to create an organization
|
|
13
|
-
* @param {string} options.name The organization name
|
|
14
14
|
* @param {string} options.externalId The external id
|
|
15
15
|
* @returns {Promise<CreateOrganizationResponse>} The created organization
|
|
16
16
|
*/
|
|
17
|
-
createOrganization(
|
|
18
|
-
name: string;
|
|
17
|
+
createOrganization(name: string, options?: {
|
|
19
18
|
externalId?: string;
|
|
20
19
|
}): Promise<CreateOrganizationResponse>;
|
|
21
20
|
/**
|
|
@@ -56,9 +55,28 @@ export default class OrganizationClient {
|
|
|
56
55
|
*/
|
|
57
56
|
updateOrganizationByExternalId(externalId: string, organization: PartialMessage<UpdateOrganization>): Promise<UpdateOrganizationResponse>;
|
|
58
57
|
/**
|
|
59
|
-
*
|
|
58
|
+
* Delete an organization by id
|
|
59
|
+
* @param {string} organizationId The organization id
|
|
60
|
+
* @returns {Promise<Empty>} Returns nothing
|
|
61
|
+
*/
|
|
62
|
+
deleteOrganization(organizationId: string): Promise<Empty>;
|
|
63
|
+
/**
|
|
64
|
+
* Generate admin portal link for an organization
|
|
65
|
+
* @param organizationId The organization id
|
|
66
|
+
* @returns {Promise<Link>} The admin portal link object with expiration time and location
|
|
67
|
+
*/
|
|
68
|
+
generatePortalLink(organizationId: string): Promise<Link>;
|
|
69
|
+
/**
|
|
70
|
+
* Get admin portal links for an organization
|
|
71
|
+
* @param organizationId The organization id
|
|
72
|
+
* @returns {Promise<Link[]>} The admin portal link object with expiration time and location
|
|
73
|
+
*/
|
|
74
|
+
getPortalLinks(organizationId: string): Promise<Link[]>;
|
|
75
|
+
/**
|
|
76
|
+
* Delete admin portal link for an organization
|
|
60
77
|
* @param organizationId The organization id
|
|
61
|
-
* @
|
|
78
|
+
* @param linkId The link id
|
|
79
|
+
* @returns {Promise<Empty>} Returns nothing
|
|
62
80
|
*/
|
|
63
|
-
|
|
81
|
+
deletePortalLink(organizationId: string, linkId: string): Promise<Empty>;
|
|
64
82
|
}
|