@workos-inc/node
Advanced tools
Comparing version 7.22.1 to 7.23.0
@@ -6,3 +6,4 @@ export declare enum GeneratePortalLinkIntent { | ||
LogStreams = "log_streams", | ||
SSO = "sso" | ||
SSO = "sso", | ||
CertificateRenewal = "certificate_renewal" | ||
} |
@@ -11,2 +11,3 @@ "use strict"; | ||
GeneratePortalLinkIntent["SSO"] = "sso"; | ||
GeneratePortalLinkIntent["CertificateRenewal"] = "certificate_renewal"; | ||
})(GeneratePortalLinkIntent || (exports.GeneratePortalLinkIntent = GeneratePortalLinkIntent = {})); |
@@ -106,2 +106,18 @@ "use strict"; | ||
}); | ||
describe('with the `certificate_renewal` intent', () => { | ||
it('returns an Admin Portal link', () => __awaiter(void 0, void 0, void 0, function* () { | ||
(0, test_utils_1.fetchOnce)(generate_link_json_1.default, { status: 201 }); | ||
const { link } = yield workos.portal.generateLink({ | ||
intent: generate_portal_link_intent_interface_1.GeneratePortalLinkIntent.CertificateRenewal, | ||
organization: 'org_01EHQMYV6MBK39QC5PZXHY59C3', | ||
returnUrl: 'https://www.example.com', | ||
}); | ||
expect((0, test_utils_1.fetchBody)()).toEqual({ | ||
intent: generate_portal_link_intent_interface_1.GeneratePortalLinkIntent.CertificateRenewal, | ||
organization: 'org_01EHQMYV6MBK39QC5PZXHY59C3', | ||
return_url: 'https://www.example.com', | ||
}); | ||
expect(link).toEqual('https://id.workos.com/portal/launch?secret=secret'); | ||
})); | ||
}); | ||
}); | ||
@@ -126,3 +142,21 @@ describe('with an invalid organization', () => { | ||
}); | ||
describe('with an invalid organization', () => { | ||
it('throws an error', () => __awaiter(void 0, void 0, void 0, function* () { | ||
(0, test_utils_1.fetchOnce)(generate_link_invalid_json_1.default, { | ||
status: 400, | ||
headers: { 'X-Request-ID': 'a-request-id' }, | ||
}); | ||
yield expect(workos.portal.generateLink({ | ||
intent: generate_portal_link_intent_interface_1.GeneratePortalLinkIntent.SSO, | ||
organization: 'bogus-id', | ||
returnUrl: 'https://www.example.com', | ||
})).rejects.toThrowError('Could not find an organization with the id, bogus-id.'); | ||
expect((0, test_utils_1.fetchBody)()).toEqual({ | ||
intent: generate_portal_link_intent_interface_1.GeneratePortalLinkIntent.SSO, | ||
organization: 'bogus-id', | ||
return_url: 'https://www.example.com', | ||
}); | ||
})); | ||
}); | ||
}); | ||
}); |
@@ -274,3 +274,5 @@ "use strict"; | ||
} | ||
const { org_id: organizationIdFromAccessToken } = (0, jose_1.decodeJwt)(authenticationResponse.accessToken); | ||
const sessionData = { | ||
organizationId: organizationIdFromAccessToken, | ||
user: authenticationResponse.user, | ||
@@ -277,0 +279,0 @@ accessToken: authenticationResponse.accessToken, |
@@ -30,3 +30,3 @@ "use strict"; | ||
const fetch_client_1 = require("./common/net/fetch-client"); | ||
const VERSION = '7.22.1'; | ||
const VERSION = '7.23.0'; | ||
const DEFAULT_HOSTNAME = 'api.workos.com'; | ||
@@ -33,0 +33,0 @@ const HEADER_AUTHORIZATION = 'Authorization'; |
{ | ||
"version": "7.22.1", | ||
"version": "7.23.0", | ||
"name": "@workos-inc/node", | ||
@@ -4,0 +4,0 @@ "author": "WorkOS", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
632106
13586