@scalekit-sdk/node 1.0.3 → 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.
@@ -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,OAA8C;;YACrE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YACrC,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAC9B;gBACE,YAAY,EAAE;oBACZ,WAAW,EAAE,IAAI;oBACjB,UAAU,EAAE,UAAU;iBACvB;aACF,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;OAMG;IACG,gBAAgB,CAAC,OAGtB;;YACC,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAC5B,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CACvB,CAAA;QACH,CAAC;KAAA;IAED;;;;OAIG;IACG,eAAe,CAAC,EAAU;;YAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,eAAe,EAC3B,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAC1C,CAAA;QACH,CAAC;KAAA;IAED;;;;OAIG;IACG,2BAA2B,CAAC,UAAkB;;YAClD,OA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Ac;aACnB,CACF,CAAA;YAED,OAAO,QAAQ,CAAC,KAAK,CAAA;QACvB,CAAC;KAAA;IAED;;;;;OAKG;IACG,gBAAgB,CAAC,cAAsB,EAAE,MAAc;;YAC3D,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAC5B;gBACE,EAAE,EAAE,cAAc;gBAClB,MAAM;aACP,CACF,CAAA;QACH,CAAC;KAAA;CACF;AAvKD,qCAuKC"}
package/lib/scalekit.d.ts CHANGED
@@ -1,18 +1,17 @@
1
1
  import ConnectionClient from './connection';
2
2
  import DomainClient from './domain';
3
3
  import OrganizationClient from './organization';
4
- import { AuthorizationUrlOptions, CodeAuthenticationOptions } from './types/scalekit';
5
- import { User } from './types/user';
4
+ import { AuthorizationUrlOptions, AuthenticationOptions, AuthenticationResponse } from './types/scalekit';
6
5
  /**
7
6
  * To initiate scalekit
8
7
  * @param {string} envUrl The environment url
9
8
  * @param {string} clientId The client id
10
9
  * @param {string} clientSecret The client secret
11
- * @returns {Scalekit} Returns the scalekit instance
10
+ * @returns {ScalekitClient} Returns the scalekit instance
12
11
  * @example
13
12
  * const scalekit = new Scalekit(envUrl, clientId, clientSecret);
14
13
  */
15
- export default class Scalekit {
14
+ export default class ScalekitClient {
16
15
  private readonly coreClient;
17
16
  private readonly grpcConnect;
18
17
  readonly organization: OrganizationClient;
@@ -30,6 +29,8 @@ export default class Scalekit {
30
29
  * @param {string} options.domainHint Domain hint parameter
31
30
  * @param {string} options.connectionId Connection id parameter
32
31
  * @param {string} options.organizationId Organization id parameter
32
+ * @param {string} options.codeChallenge Code challenge parameter in case of PKCE
33
+ * @param {string} options.codeChallengeMethod Code challenge method parameter in case of PKCE
33
34
  *
34
35
  * @example
35
36
  * const scalekit = new Scalekit(envUrl, clientId, clientSecret);
@@ -39,17 +40,13 @@ export default class Scalekit {
39
40
  getAuthorizationUrl(redirectUri: string, options?: AuthorizationUrlOptions): string;
40
41
  /**
41
42
  * Authenticate with the code
42
- * @param {CodeAuthenticationOptions} options Code authentication options
43
- * @param {string} options.code Code
44
- * @param {string} options.redirectUri Redirect uri
45
- * @param {string} options.codeVerifier Code verifier
46
- * @returns {Promise<{ user: Partial<User>, idToken: string, accessToken: string }>} Returns user, id token and access token
43
+ * @param {string} code Code
44
+ * @param {string} redirectUri Redirect uri
45
+ * @param {AuthenticationOptions} options Code authentication options
46
+ * @param {string} options.codeVerifier Code verifier in case of PKCE
47
+ * @returns {Promise<AuthenticationResponse>} Returns user, id token and access token
47
48
  */
48
- authenticateWithCode(options: CodeAuthenticationOptions): Promise<{
49
- user: Partial<User>;
50
- idToken: string;
51
- accessToken: string;
52
- }>;
49
+ authenticateWithCode(code: string, redirectUri: string, options?: AuthenticationOptions): Promise<AuthenticationResponse>;
53
50
  /**
54
51
  * Validates the access token.
55
52
  *
package/lib/scalekit.js CHANGED
@@ -50,11 +50,11 @@ const authorizeEndpoint = "oauth/authorize";
50
50
  * @param {string} envUrl The environment url
51
51
  * @param {string} clientId The client id
52
52
  * @param {string} clientSecret The client secret
53
- * @returns {Scalekit} Returns the scalekit instance
53
+ * @returns {ScalekitClient} Returns the scalekit instance
54
54
  * @example
55
55
  * const scalekit = new Scalekit(envUrl, clientId, clientSecret);
56
56
  */
57
- class Scalekit {
57
+ class ScalekitClient {
58
58
  constructor(envUrl, clientId, clientSecret) {
59
59
  this.coreClient = new core_1.default(envUrl, clientId, clientSecret);
60
60
  this.grpcConnect = new connect_1.default(this.coreClient);
@@ -73,6 +73,8 @@ class Scalekit {
73
73
  * @param {string} options.domainHint Domain hint parameter
74
74
  * @param {string} options.connectionId Connection id parameter
75
75
  * @param {string} options.organizationId Organization id parameter
76
+ * @param {string} options.codeChallenge Code challenge parameter in case of PKCE
77
+ * @param {string} options.codeChallengeMethod Code challenge method parameter in case of PKCE
76
78
  *
77
79
  * @example
78
80
  * const scalekit = new Scalekit(envUrl, clientId, clientSecret);
@@ -82,24 +84,24 @@ class Scalekit {
82
84
  getAuthorizationUrl(redirectUri, options) {
83
85
  var _a;
84
86
  const defaultOptions = {
85
- scopes: ['openid', 'profile']
87
+ scopes: ['openid', 'profile', 'email']
86
88
  };
87
89
  options = Object.assign(Object.assign({}, defaultOptions), options);
88
- const qs = qs_1.default.stringify(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ response_type: 'code', client_id: this.coreClient.clientId, redirect_uri: redirectUri, scope: (_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(" ") }, (options.state && { state: options.state })), (options.nonce && { nonce: options.nonce })), (options.loginHint && { login_hint: options.loginHint })), (options.domainHint && { domain_hint: options.domainHint })), (options.domainHint && { domain: options.domainHint })), (options.connectionId && { connection_id: options.connectionId })), (options.organizationId && { organization_id: options.organizationId })));
90
+ const qs = qs_1.default.stringify(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ response_type: 'code', client_id: this.coreClient.clientId, redirect_uri: redirectUri, scope: (_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(" ") }, (options.state && { state: options.state })), (options.nonce && { nonce: options.nonce })), (options.loginHint && { login_hint: options.loginHint })), (options.domainHint && { domain_hint: options.domainHint })), (options.domainHint && { domain: options.domainHint })), (options.connectionId && { connection_id: options.connectionId })), (options.organizationId && { organization_id: options.organizationId })), (options.codeChallenge && { code_challenge: options.codeChallenge })), (options.codeChallengeMethod && { code_challenge_method: options.codeChallengeMethod })));
89
91
  return `${this.coreClient.envUrl}/${authorizeEndpoint}?${qs}`;
90
92
  }
91
93
  /**
92
94
  * Authenticate with the code
93
- * @param {CodeAuthenticationOptions} options Code authentication options
94
- * @param {string} options.code Code
95
- * @param {string} options.redirectUri Redirect uri
96
- * @param {string} options.codeVerifier Code verifier
97
- * @returns {Promise<{ user: Partial<User>, idToken: string, accessToken: string }>} Returns user, id token and access token
95
+ * @param {string} code Code
96
+ * @param {string} redirectUri Redirect uri
97
+ * @param {AuthenticationOptions} options Code authentication options
98
+ * @param {string} options.codeVerifier Code verifier in case of PKCE
99
+ * @returns {Promise<AuthenticationResponse>} Returns user, id token and access token
98
100
  */
99
- authenticateWithCode(options) {
101
+ authenticateWithCode(code, redirectUri, options) {
100
102
  return __awaiter(this, void 0, void 0, function* () {
101
- const res = yield this.coreClient.authenticate(qs_1.default.stringify(Object.assign({ code: options.code, redirect_uri: options.redirectUri, grant_type: scalekit_1.GrantType.AuthorizationCode, client_id: this.coreClient.clientId, client_secret: this.coreClient.clientSecret }, (options.codeVerifier && { code_verifier: options.codeVerifier }))));
102
- const { id_token, access_token } = res.data;
103
+ const res = yield this.coreClient.authenticate(qs_1.default.stringify(Object.assign({ code: code, redirect_uri: redirectUri, grant_type: scalekit_1.GrantType.AuthorizationCode, client_id: this.coreClient.clientId, client_secret: this.coreClient.clientSecret }, ((options === null || options === void 0 ? void 0 : options.codeVerifier) && { code_verifier: options.codeVerifier }))));
104
+ const { id_token, access_token, expires_in } = res.data;
103
105
  const claims = jose.decodeJwt(id_token);
104
106
  const user = {};
105
107
  for (const [k, v] of Object.entries(claims)) {
@@ -110,7 +112,8 @@ class Scalekit {
110
112
  return {
111
113
  user,
112
114
  idToken: id_token,
113
- accessToken: access_token
115
+ accessToken: access_token,
116
+ expiresIn: expires_in
114
117
  };
115
118
  });
116
119
  }
@@ -136,5 +139,5 @@ class Scalekit {
136
139
  });
137
140
  }
138
141
  }
139
- exports.default = Scalekit;
142
+ exports.default = ScalekitClient;
140
143
  //# sourceMappingURL=scalekit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scalekit.js","sourceRoot":"","sources":["../src/scalekit.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,4CAA6B;AAC7B,wDAAoC;AACpC,8DAA4C;AAC5C,2CAAyD;AACzD,kDAAgC;AAChC,sDAAoC;AACpC,kEAAgD;AAChD,+CAAiG;AAGjG,MAAM,iBAAiB,GAAG,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AC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBACrC,CAAC;YACH,CAAC;YAED,OAAO;gBACL,IAAI;gBACJ,OAAO,EAAE,QAAQ;gBACjB,WAAW,EAAE,YAAY;gBACzB,SAAS,EAAE,UAAU;aACtB,CAAA;QACH,CAAC;KAAA;IAED;;;;;OAKG;IACG,mBAAmB,CAAC,KAAa;;YACrC,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YAChC,MAAM,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC;gBAClC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI;aAC3B,CAAC,CAAA;YACF,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;gBAClC,OAAO,IAAI,CAAC;YACd,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;KAAA;CACF;AA3ID,iCA2IC"}
@@ -54,3 +54,8 @@ export type IdTokenClaim = {
54
54
  identities: IdTokenClaimIdentity[];
55
55
  metadata: string | undefined;
56
56
  };
57
+ export type TokenResponse = {
58
+ access_token: string;
59
+ id_token: string;
60
+ expires_in: number;
61
+ };
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=user.js.map
3
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/types/auth.ts"],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
+ import { User } from './auth';
1
2
  export declare enum GrantType {
2
3
  AuthorizationCode = "authorization_code",
3
4
  RefreshToken = "refresh_token",
@@ -11,16 +12,15 @@ export type AuthorizationUrlOptions = {
11
12
  nonce?: string;
12
13
  domainHint?: string;
13
14
  loginHint?: string;
15
+ codeChallenge?: string;
16
+ codeChallengeMethod?: string;
14
17
  };
15
- export type CodeAuthenticationOptions = {
16
- code: string;
17
- redirectUri: string;
18
+ export type AuthenticationOptions = {
18
19
  codeVerifier?: string;
19
20
  };
20
- export type RefreshTokenAuthenticationOptions = {
21
- code: string;
22
- redirectUri: string;
23
- };
24
- export type AuthenticationOptions = {
25
- refreshToken: string;
21
+ export type AuthenticationResponse = {
22
+ user: User;
23
+ idToken: string;
24
+ accessToken: string;
25
+ expiresIn: number;
26
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"scalekit.js","sourceRoot":"","sources":["../../src/types/scalekit.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,qDAAwC,CAAA;IACxC,2CAA8B,CAAA;IAC9B,qDAAwC,CAAA;AAC1C,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB"}
1
+ {"version":3,"file":"scalekit.js","sourceRoot":"","sources":["../../src/types/scalekit.ts"],"names":[],"mappings":";;;AAEA,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,qDAAwC,CAAA;IACxC,2CAA8B,CAAA;IAC9B,qDAAwC,CAAA;AAC1C,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.3",
2
+ "version": "1.0.4",
3
3
  "name": "@scalekit-sdk/node",
4
4
  "description": "Official Scalekit Node SDK",
5
5
  "main": "lib/index.js",
package/src/connect.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ServiceType } from '@bufbuild/protobuf';
2
2
  import { PromiseClient, Transport, createPromiseClient } from '@connectrpc/connect';
3
3
  import { createGrpcTransport } from '@connectrpc/connect-node';
4
- import CoreClient from './core';
4
+ import CoreClient, { headers } from './core';
5
5
 
6
6
  export default class GrpcConnect {
7
7
  private transport: Transport;
@@ -14,11 +14,11 @@ export default class GrpcConnect {
14
14
  interceptors: [
15
15
  (next) => {
16
16
  return (req) => {
17
- req.header.set("User-Agent", this.coreClient.userAgent)
18
- req.header.set("x-sdk-version", this.coreClient.sdkVersion)
19
- req.header.set("x-api-version", this.coreClient.apiVersion)
17
+ req.header.set(headers['user-agent'], this.coreClient.userAgent)
18
+ req.header.set(headers['x-sdk-version'], this.coreClient.sdkVersion)
19
+ req.header.set(headers['x-api-version'], this.coreClient.apiVersion)
20
20
  if (this.coreClient.accessToken) {
21
- req.header.set("Authorization", `Bearer ${this.coreClient.accessToken}`)
21
+ req.header.set(headers.authorization, `Bearer ${this.coreClient.accessToken}`)
22
22
  }
23
23
  return next(req)
24
24
  }
package/src/connection.ts CHANGED
@@ -2,7 +2,7 @@ import { PromiseClient } from '@connectrpc/connect';
2
2
  import GrpcConnect from './connect';
3
3
  import CoreClient from './core';
4
4
  import { ConnectionService } from './pkg/grpc/scalekit/v1/connections/connections_connect';
5
- import { GetConnectionResponse, ListConnectionsResponse } from './pkg/grpc/scalekit/v1/connections/connections_pb';
5
+ import { GetConnectionResponse, ToggleConnectionResponse, ListConnectionsResponse } from './pkg/grpc/scalekit/v1/connections/connections_pb';
6
6
 
7
7
  export default class ConnectionClient {
8
8
  private client: PromiseClient<typeof ConnectionService>;
@@ -15,11 +15,11 @@ export default class ConnectionClient {
15
15
 
16
16
  /**
17
17
  * Get a connection by id and organization id
18
- * @param id The connection id
19
18
  * @param organizationId The organization id
19
+ * @param id The connection id
20
20
  * @returns {Promise<GetConnectionResponse>} The connection
21
21
  */
22
- async getConnection(id: string, organizationId: string): Promise<GetConnectionResponse> {
22
+ async getConnection(organizationId: string, id: string): Promise<GetConnectionResponse> {
23
23
  return this.coreClient.connectExec(
24
24
  this.client.getConnection,
25
25
  {
@@ -65,5 +65,43 @@ export default class ConnectionClient {
65
65
  },
66
66
  )
67
67
  }
68
+
69
+ /**
70
+ * Enable a connection by id and organization id
71
+ * @param organizationId The organization id
72
+ * @param id The connection id
73
+ * @returns {Promise<ToggleConnectionResponse>} The connection enable response
74
+ */
75
+ async enableConnection(organizationId: string, id: string): Promise<ToggleConnectionResponse> {
76
+ return this.coreClient.connectExec(
77
+ this.client.enableConnection,
78
+ {
79
+ id,
80
+ identities: {
81
+ case: 'organizationId',
82
+ value: organizationId
83
+ }
84
+ },
85
+ )
86
+ }
87
+
88
+ /**
89
+ * Disable a connection by id and organization id
90
+ * @param organizationId The organization id
91
+ * @param id The connection id
92
+ * @returns {Promise<ToggleConnectionResponse>} The connection enable response
93
+ */
94
+ async disableConnection(organizationId: string, id: string): Promise<ToggleConnectionResponse> {
95
+ return this.coreClient.connectExec(
96
+ this.client.disableConnection,
97
+ {
98
+ id,
99
+ identities: {
100
+ case: 'organizationId',
101
+ value: organizationId
102
+ }
103
+ },
104
+ )
105
+ }
68
106
  }
69
107
 
@@ -1,4 +1,4 @@
1
- import type { IdTokenClaim, User } from '../types/user';
1
+ import type { IdTokenClaim, User } from '../types/auth';
2
2
 
3
3
  export const IdTokenClaimToUserMap: { [k in keyof IdTokenClaim]: keyof User } = {
4
4
  "sub": "id",
package/src/core.ts CHANGED
@@ -5,6 +5,14 @@ import os from "os";
5
5
  import QueryString from "qs";
6
6
  import { GrantType } from './types/scalekit';
7
7
  import { ErrorInfo } from './pkg/grpc/scalekit/v1/errdetails/errdetails_pb';
8
+ import { TokenResponse } from './types/auth';
9
+
10
+ export const headers = {
11
+ "user-agent": "user-agent",
12
+ "x-sdk-version": "x-sdk-version",
13
+ "x-api-version": "x-api-version",
14
+ "authorization": "authorization"
15
+ }
8
16
 
9
17
  const tokenEndpoint = "oauth/token";
10
18
  const jwksEndpoint = "keys";
@@ -12,7 +20,7 @@ export default class CoreClient {
12
20
  public keys: JWK[] = [];
13
21
  public accessToken: string | null = null;
14
22
  public axios: Axios;
15
- public sdkVersion = `Scalekit-Node/1.0.3`;
23
+ public sdkVersion = `Scalekit-Node/1.0.4`;
16
24
  public apiVersion = "20240430";
17
25
  public userAgent = `${this.sdkVersion} Node/${process.version} (${process.platform}; ${os.arch()})`;
18
26
  constructor(
@@ -22,11 +30,11 @@ export default class CoreClient {
22
30
  ) {
23
31
  this.axios = axios.create({ baseURL: envUrl });
24
32
  this.axios.interceptors.request.use((config) => {
25
- config.headers["User-Agent"] = this.userAgent;
26
- config.headers["x-sdk-version"] = this.sdkVersion;
27
- config.headers["x-api-version"] = this.apiVersion;
33
+ config.headers[headers['user-agent']] = this.userAgent;
34
+ config.headers[headers['x-sdk-version']] = this.sdkVersion;
35
+ config.headers[headers['x-api-version']] = this.apiVersion;
28
36
  if (this.accessToken) {
29
- config.headers["Authorization"] = `Bearer ${this.accessToken}`;
37
+ config.headers[headers.authorization] = `Bearer ${this.accessToken}`;
30
38
  }
31
39
 
32
40
  return config;
@@ -46,10 +54,10 @@ export default class CoreClient {
46
54
  /**
47
55
  * Authenticate with the code
48
56
  * @param {string} data Data to authenticate
49
- * @returns {Promise<AxiosResponse<{ access_token: string, id_token: string }>>} Returns access token and id token
57
+ * @returns {Promise<AxiosResponse<TokenResponse>>} Returns access token and id token
50
58
  */
51
- async authenticate(data: string): Promise<AxiosResponse<{ access_token: string; id_token: string; }, any>> {
52
- return this.axios.post<{ access_token: string, id_token: string }>(
59
+ async authenticate(data: string): Promise<AxiosResponse<TokenResponse, any>> {
60
+ return this.axios.post<TokenResponse>(
53
61
  tokenEndpoint,
54
62
  data,
55
63
  {
@@ -89,10 +97,10 @@ export default class CoreClient {
89
97
  return res;
90
98
  } catch (error) {
91
99
  if (retryLeft > 0) {
92
- let isUnauthenticatedError = false;
100
+ let isUnAuthenticatedError = false;
93
101
  if (error instanceof AxiosError) {
94
102
  if (error.status == HttpStatusCode.Unauthorized) {
95
- isUnauthenticatedError = true;
103
+ isUnAuthenticatedError = true;
96
104
  } else {
97
105
  throw new Error(error.message);
98
106
  }
@@ -100,23 +108,22 @@ export default class CoreClient {
100
108
  // ConnectError is a custom error class that extends Error class and has a code property
101
109
  if (error instanceof ConnectError) {
102
110
  if (error.code == Code.Unauthenticated) {
103
- isUnauthenticatedError = true;
104
- } else {
105
- if (error.code == Code.InvalidArgument) {
106
- const message = error.findDetails(ErrorInfo).map((detail) => {
107
- if (detail.validationErrorInfo) {
108
- return detail.validationErrorInfo.fieldViolations.map((fv) => {
109
- return `${fv.field}: ${fv.description}`
110
- }).join("\n")
111
- }
112
- return error.message;
113
- }).join("\n")
114
- throw new Error(message);
115
- }
116
- throw new Error(error.message);
111
+ isUnAuthenticatedError = true;
112
+ }
113
+ if (error.code == Code.InvalidArgument) {
114
+ const messages = [error.message]
115
+ error.findDetails(ErrorInfo).forEach((detail) => {
116
+ if (detail.validationErrorInfo) {
117
+ detail.validationErrorInfo.fieldViolations.forEach((fv) => {
118
+ messages.push(`${fv.field}: ${fv.description}`)
119
+ })
120
+ }
121
+ })
122
+
123
+ throw new Error(messages.join("\n"));
117
124
  }
118
125
  }
119
- if (isUnauthenticatedError) {
126
+ if (isUnAuthenticatedError) {
120
127
  await this.authenticateClient();
121
128
  return this.connectExec(fn, data, retryLeft - 1);
122
129
  }
package/src/domain.ts CHANGED
@@ -34,27 +34,6 @@ export default class DomainClient {
34
34
  )
35
35
  }
36
36
 
37
- /**
38
- * Get a domain by id
39
- * @param {object} options The options to get a domain
40
- * @param {string} options.id The domain id
41
- * @param {string} options.organizationId The organization id
42
- * @returns {Promise<GetDomainResponse>} The domain
43
- */
44
- async getDomain(options: { id: string, organizationId: string }): Promise<GetDomainResponse> {
45
- const { id, organizationId } = options;
46
- return this.coreClient.connectExec(
47
- this.client.getDomain,
48
- {
49
- id,
50
- identities: {
51
- case: 'organizationId',
52
- value: organizationId
53
- }
54
- }
55
- )
56
- }
57
-
58
37
  /**
59
38
  * List domains for an organization
60
39
  * @param organizationId The organization id
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
- import Scalekit from "./scalekit";
1
+ import ScalekitClient from "./scalekit";
2
2
 
3
- export { Scalekit };
4
- export default Scalekit;
3
+ export { ScalekitClient };
4
+ export default ScalekitClient;
5
5
 
6
6
  export * from "./types/scalekit";
7
- export * from "./types/user";
7
+ export * from "./types/auth";
@@ -1,4 +1,4 @@
1
- import { PartialMessage } from '@bufbuild/protobuf';
1
+ import { Empty, PartialMessage } from '@bufbuild/protobuf';
2
2
  import { PromiseClient } from '@connectrpc/connect';
3
3
  import GrpcConnect from './connect';
4
4
  import CoreClient from './core';
@@ -16,19 +16,20 @@ export default class OrganizationClient {
16
16
 
17
17
  /**
18
18
  * Create an organization with the given name. Optionally, you can provide an external id.
19
+ * @param {string} name The organization name
19
20
  * @param {object} options The options to create an organization
20
- * @param {string} options.name The organization name
21
21
  * @param {string} options.externalId The external id
22
22
  * @returns {Promise<CreateOrganizationResponse>} The created organization
23
23
  */
24
- async createOrganization(options: { name: string, externalId?: string }): Promise<CreateOrganizationResponse> {
25
- const { name, externalId } = options;
24
+ async createOrganization(name: string, options?: { externalId?: string }): Promise<CreateOrganizationResponse> {
26
25
  return this.coreClient.connectExec(
27
26
  this.client.createOrganization,
28
27
  {
29
28
  organization: {
30
29
  displayName: name,
31
- externalId: externalId
30
+ ...(options?.externalId && {
31
+ externalId: options.externalId
32
+ })
32
33
  }
33
34
  }
34
35
  )
@@ -107,6 +108,20 @@ export default class OrganizationClient {
107
108
  )
108
109
  }
109
110
 
111
+ /**
112
+ * Delete an organization by id
113
+ * @param {string} organizationId The organization id
114
+ * @returns {Promise<Empty>} Returns nothing
115
+ */
116
+ async deleteOrganization(organizationId: string): Promise<Empty> {
117
+ return this.coreClient.connectExec(
118
+ this.client.deleteOrganization,
119
+ {
120
+ identities: { case: "id", value: organizationId, },
121
+ },
122
+ )
123
+ }
124
+
110
125
  /**
111
126
  * Generate admin portal link for an organization
112
127
  * @param organizationId The organization id
@@ -125,5 +140,37 @@ export default class OrganizationClient {
125
140
 
126
141
  return response.link
127
142
  }
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
+ }
128
175
  }
129
176