From 807a452cf378eba008cc870d1f660373e29cdb9d Mon Sep 17 00:00:00 2001 From: Nitish Bhasker Date: Mon, 24 Jun 2024 11:58:29 +0530 Subject: [PATCH] prepare release 1.0.4 --- lib/connect.js | 9 +++++---- lib/connect.js.map | 2 +- lib/connection.d.ts | 12 ++++++------ lib/connection.js | 12 ++++++------ lib/connection.js.map | 2 +- lib/constants/user.d.ts | 2 +- lib/core.d.ts | 14 +++++++++----- lib/core.js | 17 ++++++++++++----- lib/core.js.map | 2 +- lib/index.d.ts | 2 +- lib/index.js | 2 +- lib/organization.d.ts | 8 +++++++- lib/organization.js | 14 +++++++++++++- lib/organization.js.map | 2 +- lib/scalekit.js | 7 ++++--- lib/scalekit.js.map | 2 +- lib/types/{user.d.ts => auth.d.ts} | 5 +++++ lib/types/{user.js => auth.js} | 2 +- lib/types/auth.js.map | 1 + lib/types/scalekit.d.ts | 5 +++-- lib/types/user.js.map | 1 - package.json | 2 +- src/core.ts | 2 +- 23 files changed, 82 insertions(+), 45 deletions(-) rename lib/types/{user.d.ts => auth.d.ts} (93%) rename lib/types/{user.js => auth.js} (70%) create mode 100644 lib/types/auth.js.map delete mode 100644 lib/types/user.js.map diff --git a/lib/connect.js b/lib/connect.js index 18af962..d8de032 100644 --- a/lib/connect.js +++ b/lib/connect.js @@ -2,6 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const connect_1 = require("@connectrpc/connect"); const connect_node_1 = require("@connectrpc/connect-node"); +const core_1 = require("./core"); class GrpcConnect { constructor(coreClient) { this.coreClient = coreClient; @@ -11,11 +12,11 @@ class GrpcConnect { interceptors: [ (next) => { return (req) => { - req.header.set("User-Agent", this.coreClient.userAgent); - req.header.set("X-Sdk-Version", this.coreClient.sdkVersion); - req.header.set("X-Api-Version", this.coreClient.apiVersion); + req.header.set(core_1.headers['user-agent'], this.coreClient.userAgent); + req.header.set(core_1.headers['x-sdk-version'], this.coreClient.sdkVersion); + req.header.set(core_1.headers['x-api-version'], this.coreClient.apiVersion); if (this.coreClient.accessToken) { - req.header.set("Authorization", `Bearer ${this.coreClient.accessToken}`); + req.header.set(core_1.headers.authorization, `Bearer ${this.coreClient.accessToken}`); } return next(req); }; diff --git a/lib/connect.js.map b/lib/connect.js.map index 40fc456..406d3c3 100644 --- a/lib/connect.js.map +++ b/lib/connect.js.map @@ -1 +1 @@ -{"version":3,"file":"connect.js","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":";;AACA,iDAAoF;AACpF,2DAA+D;AAG/D,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,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;wBACvD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;wBAC3D,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;wBAC3D,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;4BAChC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA;wBAC1E,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,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BC"} \ No newline at end of file diff --git a/lib/connection.d.ts b/lib/connection.d.ts index b6f5476..8fd804a 100644 --- a/lib/connection.d.ts +++ b/lib/connection.d.ts @@ -8,11 +8,11 @@ export default class ConnectionClient { constructor(grpcConncet: GrpcConnect, coreClient: CoreClient); /** * Get a connection by id and organization id - * @param id The connection id * @param organizationId The organization id + * @param id The connection id * @returns {Promise} The connection */ - getConnection(id: string, organizationId: string): Promise; + getConnection(organizationId: string, id: string): Promise; /** * List connections by domain * @param domain The domain @@ -27,16 +27,16 @@ export default class ConnectionClient { listConnections(organizationId: string): Promise; /** * Enable a connection by id and organization id - * @param id The connection id * @param organizationId The organization id + * @param id The connection id * @returns {Promise} The connection enable response */ - enableConnection(id: string, organizationId: string): Promise; + enableConnection(organizationId: string, id: string): Promise; /** * Disable a connection by id and organization id - * @param id The connection id * @param organizationId The organization id + * @param id The connection id * @returns {Promise} The connection enable response */ - disableConnection(id: string, organizationId: string): Promise; + disableConnection(organizationId: string, id: string): Promise; } diff --git a/lib/connection.js b/lib/connection.js index b5190fe..d0cb54d 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -18,11 +18,11 @@ class ConnectionClient { } /** * Get a connection by id and organization id - * @param id The connection id * @param organizationId The organization id + * @param id The connection id * @returns {Promise} The connection */ - getConnection(id, organizationId) { + getConnection(organizationId, id) { return __awaiter(this, void 0, void 0, function* () { return this.coreClient.connectExec(this.client.getConnection, { id, @@ -65,11 +65,11 @@ class ConnectionClient { } /** * Enable a connection by id and organization id - * @param id The connection id * @param organizationId The organization id + * @param id The connection id * @returns {Promise} The connection enable response */ - enableConnection(id, organizationId) { + enableConnection(organizationId, id) { return __awaiter(this, void 0, void 0, function* () { return this.coreClient.connectExec(this.client.enableConnection, { id, @@ -82,11 +82,11 @@ class ConnectionClient { } /** * Disable a connection by id and organization id - * @param id The connection id * @param organizationId The organization id + * @param id The connection id * @returns {Promise} The connection enable response */ - disableConnection(id, organizationId) { + disableConnection(organizationId, id) { return __awaiter(this, void 0, void 0, function* () { return this.coreClient.connectExec(this.client.disableConnection, { id, diff --git a/lib/connection.js.map b/lib/connection.js.map index 37406fa..906b904 100644 --- a/lib/connection.js.map +++ b/lib/connection.js.map @@ -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,EAAU,EAAE,cAAsB;;YACpD,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,aAAa,EACzB;gBACE,EAAE;gBACF,UAAU,EAAE;oBACV,IAAI,EAAE,gBAAgB;oBACtB,KAAK,EAAE,cAAc;iBACtB;aACF,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;OAIG;IACG,uBAAuB,CAAC,MAAc;;YAC1C,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,eAAe,EAC3B;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,MAAM;iBACd;aACF,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;OAIG;IACG,eAAe,CAAC,cAAsB;;YAC1C,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,eAAe,EAC3B;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,gBAAgB;oBACtB,KAAK,EAAE,cAAc;iBACtB;aACF,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;OAKG;IACG,gBAAgB,CAAC,EAAU,EAAE,cAAsB;;YACvD,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAC5B;gBACE,EAAE;gBACF,UAAU,EAAE;oBACV,IAAI,EAAE,gBAAgB;oBACtB,KAAK,EAAE,cAAc;iBACtB;aACF,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;OAKG;IACG,iBAAiB,CAAC,EAAU,EAAE,cAAsB;;YACxD,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAC7B;gBACE,EAAE;gBACF,UAAU,EAAE;oBACV,IAAI,EAAE,gBAAgB;oBACtB,KAAK,EAAE,cAAc;iBACtB;aACF,CACF,CAAA;QACH,CAAC;KAAA;CACF;AAnGD,mCAmGC"} \ No newline at end of file +{"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,EAAU;;YACpD,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,aAAa,EACzB;gBACE,EAAE;gBACF,UAAU,EAAE;oBACV,IAAI,EAAE,gBAAgB;oBACtB,KAAK,EAAE,cAAc;iBACtB;aACF,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;OAIG;IACG,uBAAuB,CAAC,MAAc;;YAC1C,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,eAAe,EAC3B;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,MAAM;iBACd;aACF,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;OAIG;IACG,eAAe,CAAC,cAAsB;;YAC1C,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,eAAe,EAC3B;gBACE,UAAU,EAAE;oBACV,IAAI,EAAE,gBAAgB;oBACtB,KAAK,EAAE,cAAc;iBACtB;aACF,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;OAKG;IACG,gBAAgB,CAAC,cAAsB,EAAE,EAAU;;YACvD,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAC5B;gBACE,EAAE;gBACF,UAAU,EAAE;oBACV,IAAI,EAAE,gBAAgB;oBACtB,KAAK,EAAE,cAAc;iBACtB;aACF,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;OAKG;IACG,iBAAiB,CAAC,cAAsB,EAAE,EAAU;;YACxD,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAC7B;gBACE,EAAE;gBACF,UAAU,EAAE;oBACV,IAAI,EAAE,gBAAgB;oBACtB,KAAK,EAAE,cAAc;iBACtB;aACF,CACF,CAAA;QACH,CAAC;KAAA;CACF;AAnGD,mCAmGC"} \ No newline at end of file diff --git a/lib/constants/user.d.ts b/lib/constants/user.d.ts index d2e3c30..40bd40d 100644 --- a/lib/constants/user.d.ts +++ b/lib/constants/user.d.ts @@ -1,4 +1,4 @@ -import type { IdTokenClaim, User } from '../types/user'; +import type { IdTokenClaim, User } from '../types/auth'; export declare const IdTokenClaimToUserMap: { [k in keyof IdTokenClaim]: keyof User; }; diff --git a/lib/core.d.ts b/lib/core.d.ts index 717425f..7782d89 100644 --- a/lib/core.d.ts +++ b/lib/core.d.ts @@ -1,5 +1,12 @@ import { Axios, AxiosResponse } from "axios"; import { JWK } from 'jose'; +import { TokenResponse } from './types/auth'; +export declare const headers: { + "user-agent": string; + "x-sdk-version": string; + "x-api-version": string; + authorization: string; +}; export default class CoreClient { readonly envUrl: string; readonly clientId: string; @@ -15,12 +22,9 @@ export default class CoreClient { /** * Authenticate with the code * @param {string} data Data to authenticate - * @returns {Promise>} Returns access token and id token + * @returns {Promise>} Returns access token and id token */ - authenticate(data: string): Promise>; + authenticate(data: string): Promise>; /** * Get the JWKS from the server and store it in the client instance * @returns {Promise} Returns nothing diff --git a/lib/core.js b/lib/core.js index 59d921c..2f8b3ca 100644 --- a/lib/core.js +++ b/lib/core.js @@ -35,12 +35,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); +exports.headers = void 0; const connect_1 = require("@connectrpc/connect"); const axios_1 = __importStar(require("axios")); const os_1 = __importDefault(require("os")); const qs_1 = __importDefault(require("qs")); const scalekit_1 = require("./types/scalekit"); const errdetails_pb_1 = require("./pkg/grpc/scalekit/v1/errdetails/errdetails_pb"); +exports.headers = { + "user-agent": "user-agent", + "x-sdk-version": "x-sdk-version", + "x-api-version": "x-api-version", + "authorization": "authorization" +}; const tokenEndpoint = "oauth/token"; const jwksEndpoint = "keys"; class CoreClient { @@ -55,11 +62,11 @@ class CoreClient { this.userAgent = `${this.sdkVersion} Node/${process.version} (${process.platform}; ${os_1.default.arch()})`; this.axios = axios_1.default.create({ baseURL: envUrl }); this.axios.interceptors.request.use((config) => { - config.headers["User-Agent"] = this.userAgent; - config.headers["X-Sdk-Version"] = this.sdkVersion; - config.headers["X-Api-Version"] = this.apiVersion; + config.headers[exports.headers['user-agent']] = this.userAgent; + config.headers[exports.headers['x-sdk-version']] = this.sdkVersion; + config.headers[exports.headers['x-api-version']] = this.apiVersion; if (this.accessToken) { - config.headers["Authorization"] = `Bearer ${this.accessToken}`; + config.headers[exports.headers.authorization] = `Bearer ${this.accessToken}`; } return config; }); @@ -78,7 +85,7 @@ class CoreClient { /** * Authenticate with the code * @param {string} data Data to authenticate - * @returns {Promise>} Returns access token and id token + * @returns {Promise>} Returns access token and id token */ authenticate(data) { return __awaiter(this, void 0, void 0, function* () { diff --git a/lib/core.js.map b/lib/core.js.map index 8b54f2f..a78c067 100644 --- a/lib/core.js.map +++ b/lib/core.js.map @@ -1 +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;AAE5E,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,YAAY,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;YAC9C,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,UAAU,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AAC,eAAe,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;wCACxD,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,WAAW,EAAE,CAAC,CAAA;oCACjD,CAAC,CAAC,CAAA;gCACJ,CAAC;4BACH,CAAC,CAAC,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"} \ No newline at end of file diff --git a/lib/index.d.ts b/lib/index.d.ts index ea10d09..d365322 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -2,4 +2,4 @@ import ScalekitClient from "./scalekit"; export { ScalekitClient }; export default ScalekitClient; export * from "./types/scalekit"; -export * from "./types/user"; +export * from "./types/auth"; diff --git a/lib/index.js b/lib/index.js index 7d5bba5..9a1c3ac 100644 --- a/lib/index.js +++ b/lib/index.js @@ -22,5 +22,5 @@ const scalekit_1 = __importDefault(require("./scalekit")); exports.ScalekitClient = scalekit_1.default; exports.default = scalekit_1.default; __exportStar(require("./types/scalekit"), exports); -__exportStar(require("./types/user"), exports); +__exportStar(require("./types/auth"), exports); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/organization.d.ts b/lib/organization.d.ts index c3d601d..3a6cd87 100644 --- a/lib/organization.d.ts +++ b/lib/organization.d.ts @@ -54,6 +54,12 @@ export default class OrganizationClient { * @returns {Promise} The updated organization */ updateOrganizationByExternalId(externalId: string, organization: PartialMessage): Promise; + /** + * Delete an organization by id + * @param {string} organizationId The organization id + * @returns {Promise} Returns nothing + */ + deleteOrganization(organizationId: string): Promise; /** * Generate admin portal link for an organization * @param organizationId The organization id @@ -61,7 +67,7 @@ export default class OrganizationClient { */ generatePortalLink(organizationId: string): Promise; /** - * Get admin portal link for an organization + * Get admin portal links for an organization * @param organizationId The organization id * @returns {Promise} The admin portal link object with expiration time and location */ diff --git a/lib/organization.js b/lib/organization.js index f6e8c3d..94b97cf 100644 --- a/lib/organization.js +++ b/lib/organization.js @@ -92,6 +92,18 @@ class OrganizationClient { }); }); } + /** + * Delete an organization by id + * @param {string} organizationId The organization id + * @returns {Promise} Returns nothing + */ + deleteOrganization(organizationId) { + return __awaiter(this, void 0, void 0, function* () { + return this.coreClient.connectExec(this.client.deleteOrganization, { + identities: { case: "id", value: organizationId, }, + }); + }); + } /** * Generate admin portal link for an organization * @param organizationId The organization id @@ -109,7 +121,7 @@ class OrganizationClient { }); } /** - * Get admin portal link for an organization + * Get admin portal links for an organization * @param organizationId The organization id * @returns {Promise} The admin portal link object with expiration time and location */ diff --git a/lib/organization.js.map b/lib/organization.js.map index b872fc2..de788de 100644 --- a/lib/organization.js.map +++ b/lib/organization.js.map @@ -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,E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,CAAC,kBAAkB,EAC9B;gBACE,UAAU,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,GAAG;gBACtD,YAAY;aACb,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;OAIG;IACG,kBAAkB,CAAC,cAAsB;;YAC7C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,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;;;;OAIG;IACG,cAAc,CAAC,cAAsB;;YACzC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAChD,IAAI,CAAC,MAAM,CAAC,cAAc,EAC1B;gBACE,EAAE,EAAE,cAAc;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;AAzJD,qCAyJC"} \ No newline at end of file +{"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,W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,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"} \ No newline at end of file diff --git a/lib/scalekit.js b/lib/scalekit.js index 7566575..9b3be08 100644 --- a/lib/scalekit.js +++ b/lib/scalekit.js @@ -84,7 +84,7 @@ class ScalekitClient { getAuthorizationUrl(redirectUri, options) { var _a; const defaultOptions = { - scopes: ['openid', 'profile'] + scopes: ['openid', 'profile', 'email'] }; options = Object.assign(Object.assign({}, defaultOptions), options); 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 }))); @@ -101,7 +101,7 @@ class ScalekitClient { authenticateWithCode(code, redirectUri, options) { return __awaiter(this, void 0, void 0, function* () { 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 })))); - const { id_token, access_token } = res.data; + const { id_token, access_token, expires_in } = res.data; const claims = jose.decodeJwt(id_token); const user = {}; for (const [k, v] of Object.entries(claims)) { @@ -112,7 +112,8 @@ class ScalekitClient { return { user, idToken: id_token, - accessToken: access_token + accessToken: access_token, + expiresIn: expires_in }; }); } diff --git a/lib/scalekit.js.map b/lib/scalekit.js.map index 6723c82..7755462 100644 --- a/lib/scalekit.js.map +++ b/lib/scalekit.js.map @@ -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,+CAAqH;AAGrH,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAE5C;;;;;;;;EAQE;AACF,MAAqB,cAAc;IAMjC,YACE,MAAc,EACd,QAAgB,EAChB,YAAoB;QAEpB,IAAI,CAAC,UAAU,GAAG,IAAI,cAAU,CAC9B,MAAM,EACN,QAAQ,EACR,YAAY,CACb,CAAC;QACF,IAAI,CAAC,WAAW,GAAG,IAAI,iBAAW,CAChC,IAAI,CAAC,UAAU,CAChB,CAAC;QAEF,IAAI,CAAC,YAAY,GAAG,IAAI,sBAAkB,CACxC,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,UAAU,CAChB,CAAC;QACF,IAAI,CAAC,UAAU,GAAG,IAAI,oBAAgB,CACpC,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,UAAU,CAChB,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,IAAI,gBAAY,CAC5B,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,UAAU,CAChB,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,mBAAmB,CACjB,WAAmB,EACnB,OAAiC;;QAEjC,MAAM,cAAc,GAA4B;YAC9C,MAAM,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;SAC9B,CAAA;QACD,OAAO,mCACF,cAAc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YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;KAAA;CACF;AA1ID,iCA0IC"} \ No newline at end of file +{"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,+CAAqH;AAGrH,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAE5C;;;;;;;;EAQE;AACF,MAAqB,cAAc;IAMjC,YACE,MAAc,EACd,QAAgB,EAChB,YAAoB;QAEpB,IAAI,CAAC,UAAU,GAAG,IAAI,cAAU,CAC9B,MAAM,EACN,QAAQ,EACR,YAAY,CACb,CAAC;QACF,IAAI,CAAC,WAAW,GAAG,IAAI,iBAAW,CAChC,IAAI,CAAC,UAAU,CAChB,CAAC;QAEF,IAAI,CAAC,YAAY,GAAG,IAAI,sBAAkB,CACxC,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,UAAU,CAChB,CAAC;QACF,IAAI,CAAC,UAAU,GAAG,IAAI,oBAAgB,CACpC,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,UAAU,CAChB,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,IAAI,gBAAY,CAC5B,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,UAAU,CAChB,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,mBAAmB,CACjB,WAAmB,EACnB,OAAiC;;QAEjC,MAAM,cAAc,GAA4B;YAC9C,MAAM,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;SACvC,CAAA;QACD,OAAO,mCACF,cAAc,GACd,OAAO,CACX,CAAA;QACD,MAAM,EAAE,GAAG,YAAW,CAAC,SAAS,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BACf,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;KAAA;CACF;AA3ID,iCA2IC"} \ No newline at end of file diff --git a/lib/types/user.d.ts b/lib/types/auth.d.ts similarity index 93% rename from lib/types/user.d.ts rename to lib/types/auth.d.ts index 6f4d4ad..58ba70f 100644 --- a/lib/types/user.d.ts +++ b/lib/types/auth.d.ts @@ -54,3 +54,8 @@ export type IdTokenClaim = { identities: IdTokenClaimIdentity[]; metadata: string | undefined; }; +export type TokenResponse = { + access_token: string; + id_token: string; + expires_in: number; +}; diff --git a/lib/types/user.js b/lib/types/auth.js similarity index 70% rename from lib/types/user.js rename to lib/types/auth.js index 33269d3..1bf0817 100644 --- a/lib/types/user.js +++ b/lib/types/auth.js @@ -1,3 +1,3 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=user.js.map \ No newline at end of file +//# sourceMappingURL=auth.js.map \ No newline at end of file diff --git a/lib/types/auth.js.map b/lib/types/auth.js.map new file mode 100644 index 0000000..8e51891 --- /dev/null +++ b/lib/types/auth.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/types/auth.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lib/types/scalekit.d.ts b/lib/types/scalekit.d.ts index 25c2d2c..feff268 100644 --- a/lib/types/scalekit.d.ts +++ b/lib/types/scalekit.d.ts @@ -1,4 +1,4 @@ -import { User } from './user'; +import { User } from './auth'; export declare enum GrantType { AuthorizationCode = "authorization_code", RefreshToken = "refresh_token", @@ -19,7 +19,8 @@ export type AuthenticationOptions = { codeVerifier?: string; }; export type AuthenticationResponse = { - user: Partial; + user: User; idToken: string; accessToken: string; + expiresIn: number; }; diff --git a/lib/types/user.js.map b/lib/types/user.js.map deleted file mode 100644 index 07c1726..0000000 --- a/lib/types/user.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/types/user.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/package.json b/package.json index 7fcb266..d23f50d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "1.0.3", + "version": "1.0.4", "name": "@scalekit-sdk/node", "description": "Official Scalekit Node SDK", "main": "lib/index.js", diff --git a/src/core.ts b/src/core.ts index b92bfb4..c77fb90 100644 --- a/src/core.ts +++ b/src/core.ts @@ -20,7 +20,7 @@ export default class CoreClient { public keys: JWK[] = []; public accessToken: string | null = null; public axios: Axios; - public sdkVersion = `Scalekit-Node/1.0.3`; + public sdkVersion = `Scalekit-Node/1.0.4`; public apiVersion = "20240430"; public userAgent = `${this.sdkVersion} Node/${process.version} (${process.platform}; ${os.arch()})`; constructor(