@scalekit-sdk/node 1.0.8 → 1.0.10

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/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 16.0.0
package/README.md CHANGED
@@ -8,6 +8,7 @@
8
8
  </p>
9
9
 
10
10
  # Official Node.js SDK
11
+
11
12
  <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.
12
13
 
13
14
  <div>
@@ -18,11 +19,15 @@
18
19
  ## Pre-requisites
19
20
 
20
21
  1. [Sign up](https://scalekit.com) for a Scalekit account.
21
- 2. Get your ```env_url```, ```client_id``` and ```client_secret``` from the Scalekit dashboard.
22
+ 2. Get your `env_url`, `client_id` and `client_secret` from the Scalekit dashboard.
23
+
24
+ <div style="border: 1px solid #ccc; padding: 10px; border-radius: 5px; background-color: #f9f9f9;">
25
+ <strong>Note:</strong> Our NodeJS SDK currently supports NodeJS versions >=18 as it is the min LTS version that is maintained by the NodeJS ecosystem.
26
+ </div>
22
27
 
23
28
  ## Installation
24
29
 
25
- Install Scalekit SDK using your preferred package manager.
30
+ Install Scalekit SDK using your preferred package manager.
26
31
 
27
32
  ```sh
28
33
  npm install @scalekit-sdk/node
@@ -74,7 +79,7 @@ const redirectUri = `${process.env.HOST}/auth/callback`;
74
79
  // Get the authorization URL and redirect the user to the IdP login page
75
80
  app.get("/auth/login", (req, res) => {
76
81
  const authUrl = scalekitClient.getAuthorizationUrl(
77
- redirectUri,
82
+ redirectUri,
78
83
  {
79
84
  state: "state",
80
85
  connectionId: "connection_id",
@@ -84,7 +89,7 @@ app.get("/auth/login", (req, res) => {
84
89
  res.redirect(authUrl);
85
90
  });
86
91
 
87
- // Handle the callback from Scalekit
92
+ // Handle the callback from Scalekit
88
93
  app.get("/auth/callback", async (req, res) => {
89
94
  const { code, error, error_description, idp_initiated_login } = req.query;
90
95
  // Handle error
@@ -94,11 +99,11 @@ app.get("/auth/callback", async (req, res) => {
94
99
  // Handle IdP initiated login
95
100
  if (idp_initiated_login) {
96
101
  // Get the claims from the IdP initiated login
97
- const {
98
- connection_id,
99
- organization_id,
100
- login_hint,
101
- relay_state
102
+ const {
103
+ connection_id,
104
+ organization_id,
105
+ login_hint,
106
+ relay_state
102
107
  } = await scalekitClient.getIdpInitiatedLoginClaims(idp_initiated_login as string);
103
108
  // Get the authorization URL and redirect the user to the IdP login page
104
109
  const url = scalekitClient.getAuthorizationUrl(
@@ -123,7 +128,7 @@ app.listen(3000, () => {
123
128
  });
124
129
  ```
125
130
 
126
- ## Example Apps
131
+ ## Example Apps
127
132
 
128
133
  Fully functional sample applications written using some popular web application frameworks and Scalekit SDK. Feel free to clone the repo and run them locally.
129
134
 
package/lib/core.js CHANGED
@@ -57,7 +57,7 @@ class CoreClient {
57
57
  this.clientSecret = clientSecret;
58
58
  this.keys = [];
59
59
  this.accessToken = null;
60
- this.sdkVersion = `Scalekit-Node/1.0.8`;
60
+ this.sdkVersion = `Scalekit-Node/1.0.9`;
61
61
  this.apiVersion = "20240430";
62
62
  this.userAgent = `${this.sdkVersion} Node/${process.version} (${process.platform}; ${os_1.default.arch()})`;
63
63
  this.axios = axios_1.default.create({ baseURL: envUrl });
@@ -67,19 +67,6 @@ export default class OrganizationClient {
67
67
  * @returns {Promise<Link>} The admin portal link object with expiration time and location
68
68
  */
69
69
  generatePortalLink(organizationId: string): Promise<Link>;
70
- /**
71
- * Get admin portal links for an organization
72
- * @param organizationId The organization id
73
- * @returns {Promise<Link[]>} The admin portal link object with expiration time and location
74
- */
75
- getPortalLinks(organizationId: string): Promise<Link[]>;
76
- /**
77
- * Delete admin portal link for an organization
78
- * @param organizationId The organization id
79
- * @param linkId The link id
80
- * @returns {Promise<Empty>} Returns nothing
81
- */
82
- deletePortalLink(organizationId: string, linkId: string): Promise<Empty>;
83
70
  /**
84
71
  * Update organization settings for an organization
85
72
  * @param organizationId The organization id
@@ -120,33 +120,6 @@ class OrganizationClient {
120
120
  return response.link;
121
121
  });
122
122
  }
123
- /**
124
- * Get admin portal links for an organization
125
- * @param organizationId The organization id
126
- * @returns {Promise<Link[]>} The admin portal link object with expiration time and location
127
- */
128
- getPortalLinks(organizationId) {
129
- return __awaiter(this, void 0, void 0, function* () {
130
- const response = yield this.coreClient.connectExec(this.client.getPortalLinks, {
131
- id: organizationId
132
- });
133
- return response.links;
134
- });
135
- }
136
- /**
137
- * Delete admin portal link for an organization
138
- * @param organizationId The organization id
139
- * @param linkId The link id
140
- * @returns {Promise<Empty>} Returns nothing
141
- */
142
- deletePortalLink(organizationId, linkId) {
143
- return __awaiter(this, void 0, void 0, function* () {
144
- return this.coreClient.connectExec(this.client.deletePortalLink, {
145
- id: organizationId,
146
- linkId
147
- });
148
- });
149
- }
150
123
  /**
151
124
  * Update organization settings for an organization
152
125
  * @param organizationId The organization id
@@ -1 +1 @@
1
- {"version":3,"file":"organization.js","sourceRoot":"","sources":["../src/organization.ts"],"names":[],"mappings":";;;;;;;;;;;AAIA,sGAAiG;AAGjG,MAAqB,kBAAkB;IAErC,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,2CAAmB,CAAC,CAAC;IACnE,CAAC;IAED;;;;;;MAME;IACI,kBAAkB,CAAC,IAAY,EAAE,OAAiC;;YACtE,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAC9B;gBACE,YAAY,kBACV,WAAW,EAAE,IAAI,IACd,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,KAAI;oBACzB,UAAU,EAAE,OAAO,CAAC,UAAU;iBAC/B,CAAC,C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C,UAAU,CAAC,WAAW,CAChD,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAC9B;gBACE,EAAE,EAAE,cAAc;aACnB,CACF,CAAA;YACD,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACnB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;YAClD,CAAC;YAED,OAAO,QAAQ,CAAC,IAAI,CAAA;QACtB,CAAC;KAAA;IAED;;;;;OAKG;IACG,0BAA0B,CAAC,cAAsB,EAAE,QAA8B;;YACrF,MAAM,OAAO,GAAG;gBACd,EAAE,EAAE,cAAc;gBAClB,QAAQ,EAAE;oBACR,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;wBAC1C,IAAI,EAAE,OAAO,CAAC,IAAI;wBAClB,OAAO,EAAE,OAAO,CAAC,OAAO;qBACzB,CAAC,CAAC;iBACJ;aACF,CAAA;YAED,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,0BAA0B,EACtC,OAAO,CACR,CAAA;QACH,CAAC;KAAA;CACF;AA9JD,qCA8JC"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.8",
2
+ "version": "1.0.10",
3
3
  "name": "@scalekit-sdk/node",
4
4
  "description": "Official Scalekit Node SDK",
5
5
  "main": "lib/index.js",
@@ -44,5 +44,8 @@
44
44
  "homepage": "https://github.com/scalekit-inc/scalekit-sdk-node#readme",
45
45
  "directories": {
46
46
  "lib": "lib"
47
+ },
48
+ "engines": {
49
+ "node": ">=16.0.0"
47
50
  }
48
51
  }
package/src/core.ts CHANGED
@@ -20,7 +20,7 @@ export default class CoreClient {
20
20
  public keys: JWK[] = [];
21
21
  public accessToken: string | null = null;
22
22
  public axios: Axios;
23
- public sdkVersion = `Scalekit-Node/1.0.8`;
23
+ public sdkVersion = `Scalekit-Node/1.0.10`;
24
24
  public apiVersion = "20240430";
25
25
  public userAgent = `${this.sdkVersion} Node/${process.version} (${process.platform}; ${os.arch()})`;
26
26
  constructor(
@@ -141,38 +141,6 @@ export default class OrganizationClient {
141
141
  return response.link
142
142
  }
143
143
 
144
- /**
145
- * Get admin portal links for an organization
146
- * @param organizationId The organization id
147
- * @returns {Promise<Link[]>} The admin portal link object with expiration time and location
148
- */
149
- async getPortalLinks(organizationId: string): Promise<Link[]> {
150
- const response = await this.coreClient.connectExec(
151
- this.client.getPortalLinks,
152
- {
153
- id: organizationId
154
- },
155
- )
156
-
157
- return response.links
158
- }
159
-
160
- /**
161
- * Delete admin portal link for an organization
162
- * @param organizationId The organization id
163
- * @param linkId The link id
164
- * @returns {Promise<Empty>} Returns nothing
165
- */
166
- async deletePortalLink(organizationId: string, linkId: string): Promise<Empty> {
167
- return this.coreClient.connectExec(
168
- this.client.deletePortalLink,
169
- {
170
- id: organizationId,
171
- linkId
172
- },
173
- )
174
- }
175
-
176
144
  /**
177
145
  * Update organization settings for an organization
178
146
  * @param organizationId The organization id