@workos-inc/node 8.0.0-rc.7 → 8.0.0-rc.8
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/README.md +54 -0
- package/lib/api-keys/api-keys.cjs +3 -0
- package/lib/api-keys/api-keys.cjs.map +1 -1
- package/lib/api-keys/api-keys.d.cts +2 -1
- package/lib/api-keys/api-keys.d.ts +2 -1
- package/lib/api-keys/api-keys.js +3 -0
- package/lib/api-keys/api-keys.js.map +1 -1
- package/lib/api-keys/interfaces/create-organization-api-key-options.interface.cjs +0 -0
- package/lib/api-keys/interfaces/create-organization-api-key-options.interface.d.cts +16 -0
- package/lib/api-keys/interfaces/create-organization-api-key-options.interface.d.ts +16 -0
- package/lib/api-keys/interfaces/create-organization-api-key-options.interface.js +1 -0
- package/lib/api-keys/interfaces/created-api-key.interface.cjs +0 -0
- package/lib/api-keys/interfaces/created-api-key.interface.d.cts +34 -0
- package/lib/api-keys/interfaces/created-api-key.interface.d.ts +34 -0
- package/lib/api-keys/interfaces/created-api-key.interface.js +1 -0
- package/lib/api-keys/interfaces/index.cjs +0 -0
- package/lib/api-keys/interfaces/index.d.cts +6 -0
- package/lib/api-keys/interfaces/index.d.ts +6 -0
- package/lib/api-keys/interfaces/index.js +1 -0
- package/lib/api-keys/interfaces/list-organization-api-keys-options.interface.cjs +0 -0
- package/lib/api-keys/interfaces/list-organization-api-keys-options.interface.d.cts +9 -0
- package/lib/api-keys/interfaces/list-organization-api-keys-options.interface.d.ts +9 -0
- package/lib/api-keys/interfaces/list-organization-api-keys-options.interface.js +1 -0
- package/lib/api-keys/serializers/create-organization-api-key-options.serializer.cjs +12 -0
- package/lib/api-keys/serializers/create-organization-api-key-options.serializer.cjs.map +1 -0
- package/lib/api-keys/serializers/create-organization-api-key-options.serializer.d.cts +7 -0
- package/lib/api-keys/serializers/create-organization-api-key-options.serializer.d.ts +7 -0
- package/lib/api-keys/serializers/create-organization-api-key-options.serializer.js +11 -0
- package/lib/api-keys/serializers/create-organization-api-key-options.serializer.js.map +1 -0
- package/lib/api-keys/serializers/created-api-key.serializer.cjs +20 -0
- package/lib/api-keys/serializers/created-api-key.serializer.cjs.map +1 -0
- package/lib/api-keys/serializers/created-api-key.serializer.d.cts +7 -0
- package/lib/api-keys/serializers/created-api-key.serializer.d.ts +7 -0
- package/lib/api-keys/serializers/created-api-key.serializer.js +19 -0
- package/lib/api-keys/serializers/created-api-key.serializer.js.map +1 -0
- package/lib/api-keys/serializers/index.cjs +9 -0
- package/lib/api-keys/serializers/index.d.cts +5 -0
- package/lib/api-keys/serializers/index.d.ts +5 -0
- package/lib/api-keys/serializers/index.js +6 -0
- package/lib/common/exceptions/api-key-required.exception.cjs +15 -0
- package/lib/common/exceptions/api-key-required.exception.cjs.map +1 -0
- package/lib/common/exceptions/api-key-required.exception.d.cts +10 -0
- package/lib/common/exceptions/api-key-required.exception.d.ts +10 -0
- package/lib/common/exceptions/api-key-required.exception.js +14 -0
- package/lib/common/exceptions/api-key-required.exception.js.map +1 -0
- package/lib/common/exceptions/index.cjs +2 -0
- package/lib/common/exceptions/index.d.cts +2 -1
- package/lib/common/exceptions/index.d.ts +2 -1
- package/lib/common/exceptions/index.js +2 -1
- package/lib/common/interfaces/event.interface.d.cts +28 -3
- package/lib/common/interfaces/event.interface.d.ts +28 -3
- package/lib/common/interfaces/get-options.interface.d.cts +2 -0
- package/lib/common/interfaces/get-options.interface.d.ts +2 -0
- package/lib/common/interfaces/index.d.cts +2 -2
- package/lib/common/interfaces/index.d.ts +2 -2
- package/lib/common/interfaces/post-options.interface.d.cts +2 -0
- package/lib/common/interfaces/post-options.interface.d.ts +2 -0
- package/lib/common/interfaces/put-options.interface.d.cts +2 -0
- package/lib/common/interfaces/put-options.interface.d.ts +2 -0
- package/lib/common/interfaces/workos-options.interface.d.cts +1 -0
- package/lib/common/interfaces/workos-options.interface.d.ts +1 -0
- package/lib/common/net/http-client.cjs.map +1 -1
- package/lib/common/net/http-client.js.map +1 -1
- package/lib/common/serializers/event.serializer.cjs +13 -5
- package/lib/common/serializers/event.serializer.cjs.map +1 -1
- package/lib/common/serializers/event.serializer.js +13 -5
- package/lib/common/serializers/event.serializer.js.map +1 -1
- package/lib/directory-sync/directory-sync.cjs +1 -1
- package/lib/directory-sync/directory-sync.js +1 -1
- package/lib/factory.cjs +10 -0
- package/lib/factory.cjs.map +1 -0
- package/lib/factory.d.cts +83 -0
- package/lib/factory.d.ts +83 -0
- package/lib/factory.js +10 -0
- package/lib/factory.js.map +1 -0
- package/lib/feature-flags/feature-flags.cjs +37 -0
- package/lib/feature-flags/feature-flags.cjs.map +1 -0
- package/lib/feature-flags/feature-flags.d.cts +21 -0
- package/lib/feature-flags/feature-flags.d.ts +21 -0
- package/lib/feature-flags/feature-flags.js +37 -0
- package/lib/feature-flags/feature-flags.js.map +1 -0
- package/lib/feature-flags/interfaces/add-flag-target-options.interface.cjs +0 -0
- package/lib/feature-flags/interfaces/add-flag-target-options.interface.d.cts +8 -0
- package/lib/feature-flags/interfaces/add-flag-target-options.interface.d.ts +8 -0
- package/lib/feature-flags/interfaces/add-flag-target-options.interface.js +1 -0
- package/lib/feature-flags/interfaces/feature-flag.interface.d.cts +8 -2
- package/lib/feature-flags/interfaces/feature-flag.interface.d.ts +8 -2
- package/lib/feature-flags/interfaces/index.d.cts +4 -1
- package/lib/feature-flags/interfaces/index.d.ts +4 -1
- package/lib/feature-flags/interfaces/list-feature-flags-options.interface.cjs +0 -0
- package/lib/feature-flags/interfaces/list-feature-flags-options.interface.d.cts +7 -0
- package/lib/feature-flags/interfaces/list-feature-flags-options.interface.d.ts +7 -0
- package/lib/feature-flags/interfaces/list-feature-flags-options.interface.js +1 -0
- package/lib/feature-flags/interfaces/remove-flag-target-options.interface.cjs +0 -0
- package/lib/feature-flags/interfaces/remove-flag-target-options.interface.d.cts +8 -0
- package/lib/feature-flags/interfaces/remove-flag-target-options.interface.d.ts +8 -0
- package/lib/feature-flags/interfaces/remove-flag-target-options.interface.js +1 -0
- package/lib/feature-flags/serializers/feature-flag.serializer.cjs +3 -0
- package/lib/feature-flags/serializers/feature-flag.serializer.cjs.map +1 -1
- package/lib/feature-flags/serializers/feature-flag.serializer.js +3 -0
- package/lib/feature-flags/serializers/feature-flag.serializer.js.map +1 -1
- package/lib/feature-flags/serializers/index.cjs +3 -0
- package/lib/feature-flags/serializers/index.d.cts +2 -0
- package/lib/feature-flags/serializers/index.d.ts +2 -0
- package/lib/feature-flags/serializers/index.js +3 -0
- package/lib/fga/serializers/query-result.serializer.cjs.map +1 -1
- package/lib/fga/serializers/query-result.serializer.js.map +1 -1
- package/lib/index.cjs +18 -9
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +18 -5
- package/lib/index.d.ts +18 -5
- package/lib/index.js +16 -10
- package/lib/index.js.map +1 -1
- package/lib/index.worker.cjs +15 -9
- package/lib/index.worker.cjs.map +1 -1
- package/lib/index.worker.d.cts +10 -5
- package/lib/index.worker.d.ts +10 -5
- package/lib/index.worker.js +13 -10
- package/lib/index.worker.js.map +1 -1
- package/lib/organizations/organizations.cjs +14 -2
- package/lib/organizations/organizations.cjs.map +1 -1
- package/lib/organizations/organizations.d.cts +6 -0
- package/lib/organizations/organizations.d.ts +6 -0
- package/lib/organizations/organizations.js +14 -2
- package/lib/organizations/organizations.js.map +1 -1
- package/lib/organizations/serializers/index.cjs +1 -1
- package/lib/organizations/serializers/index.js +1 -1
- package/lib/pkce/pkce.cjs +54 -0
- package/lib/pkce/pkce.cjs.map +1 -0
- package/lib/pkce/pkce.d.cts +38 -0
- package/lib/pkce/pkce.d.ts +38 -0
- package/lib/pkce/pkce.js +53 -0
- package/lib/pkce/pkce.js.map +1 -0
- package/lib/sso/interfaces/authorization-url-options.interface.d.cts +34 -8
- package/lib/sso/interfaces/authorization-url-options.interface.d.ts +34 -8
- package/lib/sso/interfaces/get-profile-and-token-options.interface.d.cts +6 -0
- package/lib/sso/interfaces/get-profile-and-token-options.interface.d.ts +6 -0
- package/lib/sso/interfaces/index.d.cts +2 -2
- package/lib/sso/interfaces/index.d.ts +2 -2
- package/lib/sso/sso.cjs +90 -8
- package/lib/sso/sso.cjs.map +1 -1
- package/lib/sso/sso.d.cts +41 -2
- package/lib/sso/sso.d.ts +41 -2
- package/lib/sso/sso.js +90 -8
- package/lib/sso/sso.js.map +1 -1
- package/lib/user-management/interfaces/authenticate-with-code-and-verifier-options.interface.d.cts +2 -2
- package/lib/user-management/interfaces/authenticate-with-code-and-verifier-options.interface.d.ts +2 -2
- package/lib/user-management/interfaces/authenticate-with-options-base.interface.d.cts +19 -3
- package/lib/user-management/interfaces/authenticate-with-options-base.interface.d.ts +19 -3
- package/lib/user-management/interfaces/authenticate-with-refresh-token-public-client-options.interface.cjs +0 -0
- package/lib/user-management/interfaces/authenticate-with-refresh-token-public-client-options.interface.d.cts +16 -0
- package/lib/user-management/interfaces/authenticate-with-refresh-token-public-client-options.interface.d.ts +16 -0
- package/lib/user-management/interfaces/authenticate-with-refresh-token-public-client-options.interface.js +1 -0
- package/lib/user-management/interfaces/authorization-url-options.interface.d.cts +30 -5
- package/lib/user-management/interfaces/authorization-url-options.interface.d.ts +30 -5
- package/lib/user-management/interfaces/index.d.cts +5 -3
- package/lib/user-management/interfaces/index.d.ts +5 -3
- package/lib/user-management/interfaces/logout-url-options.interface.cjs +0 -0
- package/lib/user-management/interfaces/logout-url-options.interface.d.cts +8 -0
- package/lib/user-management/interfaces/logout-url-options.interface.d.ts +8 -0
- package/lib/user-management/interfaces/logout-url-options.interface.js +1 -0
- package/lib/user-management/serializers/authenticate-with-code-and-verifier-options.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-code-and-verifier-options.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-code-and-verifier-options.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-code-and-verifier-options.serializer.js.map +1 -1
- package/lib/user-management/serializers/authenticate-with-code-options.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-code-options.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-code-options.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-code-options.serializer.js.map +1 -1
- package/lib/user-management/serializers/authenticate-with-email-verification.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-email-verification.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-email-verification.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-email-verification.serializer.js.map +1 -1
- package/lib/user-management/serializers/authenticate-with-magic-auth-options.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-magic-auth-options.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-magic-auth-options.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-magic-auth-options.serializer.js.map +1 -1
- package/lib/user-management/serializers/authenticate-with-organization-selection-options.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-organization-selection-options.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-organization-selection-options.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-organization-selection-options.serializer.js.map +1 -1
- package/lib/user-management/serializers/authenticate-with-password-options.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-password-options.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-password-options.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-password-options.serializer.js.map +1 -1
- package/lib/user-management/serializers/authenticate-with-refresh-token-public-client-options.serializer.cjs +14 -0
- package/lib/user-management/serializers/authenticate-with-refresh-token-public-client-options.serializer.cjs.map +1 -0
- package/lib/user-management/serializers/authenticate-with-refresh-token-public-client-options.serializer.d.cts +8 -0
- package/lib/user-management/serializers/authenticate-with-refresh-token-public-client-options.serializer.d.ts +8 -0
- package/lib/user-management/serializers/authenticate-with-refresh-token-public-client-options.serializer.js +13 -0
- package/lib/user-management/serializers/authenticate-with-refresh-token-public-client-options.serializer.js.map +1 -0
- package/lib/user-management/serializers/authenticate-with-refresh-token.options.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-refresh-token.options.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-refresh-token.options.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-refresh-token.options.serializer.js.map +1 -1
- package/lib/user-management/serializers/authenticate-with-totp-options.serializer.cjs.map +1 -1
- package/lib/user-management/serializers/authenticate-with-totp-options.serializer.d.cts +2 -1
- package/lib/user-management/serializers/authenticate-with-totp-options.serializer.d.ts +2 -1
- package/lib/user-management/serializers/authenticate-with-totp-options.serializer.js.map +1 -1
- package/lib/user-management/serializers/index.cjs +2 -0
- package/lib/user-management/serializers/index.d.cts +2 -1
- package/lib/user-management/serializers/index.d.ts +2 -1
- package/lib/user-management/serializers/index.js +2 -1
- package/lib/user-management/session.cjs +3 -10
- package/lib/user-management/session.cjs.map +1 -1
- package/lib/user-management/session.js +3 -10
- package/lib/user-management/session.js.map +1 -1
- package/lib/user-management/user-management.cjs +186 -31
- package/lib/user-management/user-management.cjs.map +1 -1
- package/lib/user-management/user-management.d.cts +71 -2
- package/lib/user-management/user-management.d.ts +71 -2
- package/lib/user-management/user-management.js +186 -31
- package/lib/user-management/user-management.js.map +1 -1
- package/lib/vault/vault.cjs +4 -0
- package/lib/vault/vault.cjs.map +1 -1
- package/lib/vault/vault.d.cts +1 -0
- package/lib/vault/vault.d.ts +1 -0
- package/lib/vault/vault.js +4 -0
- package/lib/vault/vault.js.map +1 -1
- package/lib/webhooks/webhooks.cjs +1 -1
- package/lib/webhooks/webhooks.js +1 -1
- package/lib/workos.cjs +68 -26
- package/lib/workos.cjs.map +1 -1
- package/lib/workos.d.cts +37 -8
- package/lib/workos.d.ts +37 -8
- package/lib/workos.js +68 -26
- package/lib/workos.js.map +1 -1
- package/package.json +4 -21
- package/lib/_virtual/rolldown_runtime.cjs +0 -19
- package/lib/_virtual/rolldown_runtime.js +0 -18
- package/lib/client/index.cjs +0 -15
- package/lib/client/index.d.cts +0 -3
- package/lib/client/index.d.ts +0 -3
- package/lib/client/index.js +0 -4
- package/lib/client/sso.cjs +0 -40
- package/lib/client/sso.cjs.map +0 -1
- package/lib/client/sso.d.cts +0 -21
- package/lib/client/sso.d.ts +0 -21
- package/lib/client/sso.js +0 -34
- package/lib/client/sso.js.map +0 -1
- package/lib/client/user-management.cjs +0 -80
- package/lib/client/user-management.cjs.map +0 -1
- package/lib/client/user-management.d.cts +0 -58
- package/lib/client/user-management.d.ts +0 -58
- package/lib/client/user-management.js +0 -72
- package/lib/client/user-management.js.map +0 -1
- package/lib/index.client.cjs +0 -15
- package/lib/index.client.d.cts +0 -3
- package/lib/index.client.d.ts +0 -3
- package/lib/index.client.js +0 -4
package/lib/client/index.cjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const require_client_user_management = require('./user-management.cjs');
|
|
2
|
-
const require_client_sso = require('./sso.cjs');
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, 'sso', {
|
|
5
|
-
enumerable: true,
|
|
6
|
-
get: function () {
|
|
7
|
-
return require_client_sso.sso_exports;
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
Object.defineProperty(exports, 'userManagement', {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return require_client_user_management.user_management_exports;
|
|
14
|
-
}
|
|
15
|
-
});
|
package/lib/client/index.d.cts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { AuthorizationURLOptions, LogoutURLOptions, user_management_d_exports } from "./user-management.cjs";
|
|
2
|
-
import { SSOAuthorizationURLOptions, sso_d_exports } from "./sso.cjs";
|
|
3
|
-
export { type LogoutURLOptions, type SSOAuthorizationURLOptions, type AuthorizationURLOptions as UserManagementAuthorizationURLOptions, sso_d_exports as sso, user_management_d_exports as userManagement };
|
package/lib/client/index.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { AuthorizationURLOptions, LogoutURLOptions, user_management_d_exports } from "./user-management.js";
|
|
2
|
-
import { SSOAuthorizationURLOptions, sso_d_exports } from "./sso.js";
|
|
3
|
-
export { type LogoutURLOptions, type SSOAuthorizationURLOptions, type AuthorizationURLOptions as UserManagementAuthorizationURLOptions, sso_d_exports as sso, user_management_d_exports as userManagement };
|
package/lib/client/index.js
DELETED
package/lib/client/sso.cjs
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_common_utils_query_string = require('../common/utils/query-string.cjs');
|
|
3
|
-
|
|
4
|
-
//#region src/client/sso.ts
|
|
5
|
-
var sso_exports = /* @__PURE__ */ require_rolldown_runtime.__export({ getAuthorizationUrl: () => getAuthorizationUrl });
|
|
6
|
-
/**
|
|
7
|
-
* Generates the authorization URL for SSO authentication.
|
|
8
|
-
* Does not require an API key, suitable for OAuth client operations.
|
|
9
|
-
*
|
|
10
|
-
* @param options - SSO authorization URL options
|
|
11
|
-
* @returns The authorization URL as a string
|
|
12
|
-
* @throws Error if required arguments are missing
|
|
13
|
-
*/
|
|
14
|
-
function getAuthorizationUrl(options) {
|
|
15
|
-
const { connection, clientId, domainHint, loginHint, organization, provider, providerQueryParams, providerScopes, redirectUri, state, baseURL = "https://api.workos.com" } = options;
|
|
16
|
-
if (!provider && !connection && !organization) throw new Error(`Incomplete arguments. Need to specify either a 'connection', 'organization', or 'provider'.`);
|
|
17
|
-
return `${baseURL}/sso/authorize?${require_common_utils_query_string.toQueryString({
|
|
18
|
-
connection,
|
|
19
|
-
organization,
|
|
20
|
-
domain_hint: domainHint,
|
|
21
|
-
login_hint: loginHint,
|
|
22
|
-
provider,
|
|
23
|
-
provider_query_params: providerQueryParams,
|
|
24
|
-
provider_scopes: providerScopes,
|
|
25
|
-
client_id: clientId,
|
|
26
|
-
redirect_uri: redirectUri,
|
|
27
|
-
response_type: "code",
|
|
28
|
-
state
|
|
29
|
-
})}`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
exports.getAuthorizationUrl = getAuthorizationUrl;
|
|
34
|
-
Object.defineProperty(exports, 'sso_exports', {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
get: function () {
|
|
37
|
-
return sso_exports;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
//# sourceMappingURL=sso.cjs.map
|
package/lib/client/sso.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sso.cjs","names":["toQueryString"],"sources":["../../src/client/sso.ts"],"sourcesContent":["import { toQueryString } from '../common/utils/query-string';\nimport type { SSOAuthorizationURLOptions as BaseSSOAuthorizationURLOptions } from '../sso/interfaces';\n\n// Extend the base options to include baseURL for internal use\nexport type SSOAuthorizationURLOptions = BaseSSOAuthorizationURLOptions & {\n baseURL?: string;\n};\n\n/**\n * Generates the authorization URL for SSO authentication.\n * Does not require an API key, suitable for OAuth client operations.\n *\n * @param options - SSO authorization URL options\n * @returns The authorization URL as a string\n * @throws Error if required arguments are missing\n */\nexport function getAuthorizationUrl(\n options: SSOAuthorizationURLOptions,\n): string {\n const {\n connection,\n clientId,\n domainHint,\n loginHint,\n organization,\n provider,\n providerQueryParams,\n providerScopes,\n redirectUri,\n state,\n baseURL = 'https://api.workos.com',\n } = options;\n\n if (!provider && !connection && !organization) {\n throw new Error(\n `Incomplete arguments. Need to specify either a 'connection', 'organization', or 'provider'.`,\n );\n }\n\n const query = toQueryString({\n connection,\n organization,\n domain_hint: domainHint,\n login_hint: loginHint,\n provider,\n provider_query_params: providerQueryParams,\n provider_scopes: providerScopes,\n client_id: clientId,\n redirect_uri: redirectUri,\n response_type: 'code',\n state,\n });\n\n return `${baseURL}/sso/authorize?${query}`;\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,SAAgB,oBACd,SACQ;CACR,MAAM,EACJ,YACA,UACA,YACA,WACA,cACA,UACA,qBACA,gBACA,aACA,OACA,UAAU,6BACR;AAEJ,KAAI,CAAC,YAAY,CAAC,cAAc,CAAC,aAC/B,OAAM,IAAI,MACR,8FACD;AAiBH,QAAO,GAAG,QAAQ,iBAdJA,gDAAc;EAC1B;EACA;EACA,aAAa;EACb,YAAY;EACZ;EACA,uBAAuB;EACvB,iBAAiB;EACjB,WAAW;EACX,cAAc;EACd,eAAe;EACf;EACD,CAAC"}
|
package/lib/client/sso.d.cts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { SSOAuthorizationURLOptions as SSOAuthorizationURLOptions$1 } from "../sso/interfaces/authorization-url-options.interface.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/client/sso.d.ts
|
|
4
|
-
declare namespace sso_d_exports {
|
|
5
|
-
export { SSOAuthorizationURLOptions, getAuthorizationUrl };
|
|
6
|
-
}
|
|
7
|
-
type SSOAuthorizationURLOptions = SSOAuthorizationURLOptions$1 & {
|
|
8
|
-
baseURL?: string;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Generates the authorization URL for SSO authentication.
|
|
12
|
-
* Does not require an API key, suitable for OAuth client operations.
|
|
13
|
-
*
|
|
14
|
-
* @param options - SSO authorization URL options
|
|
15
|
-
* @returns The authorization URL as a string
|
|
16
|
-
* @throws Error if required arguments are missing
|
|
17
|
-
*/
|
|
18
|
-
declare function getAuthorizationUrl(options: SSOAuthorizationURLOptions): string;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { SSOAuthorizationURLOptions, getAuthorizationUrl, sso_d_exports };
|
|
21
|
-
//# sourceMappingURL=sso.d.cts.map
|
package/lib/client/sso.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { SSOAuthorizationURLOptions as SSOAuthorizationURLOptions$1 } from "../sso/interfaces/authorization-url-options.interface.js";
|
|
2
|
-
|
|
3
|
-
//#region src/client/sso.d.ts
|
|
4
|
-
declare namespace sso_d_exports {
|
|
5
|
-
export { SSOAuthorizationURLOptions, getAuthorizationUrl };
|
|
6
|
-
}
|
|
7
|
-
type SSOAuthorizationURLOptions = SSOAuthorizationURLOptions$1 & {
|
|
8
|
-
baseURL?: string;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Generates the authorization URL for SSO authentication.
|
|
12
|
-
* Does not require an API key, suitable for OAuth client operations.
|
|
13
|
-
*
|
|
14
|
-
* @param options - SSO authorization URL options
|
|
15
|
-
* @returns The authorization URL as a string
|
|
16
|
-
* @throws Error if required arguments are missing
|
|
17
|
-
*/
|
|
18
|
-
declare function getAuthorizationUrl(options: SSOAuthorizationURLOptions): string;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { SSOAuthorizationURLOptions, getAuthorizationUrl, sso_d_exports };
|
|
21
|
-
//# sourceMappingURL=sso.d.ts.map
|
package/lib/client/sso.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { __export } from "../_virtual/rolldown_runtime.js";
|
|
2
|
-
import { toQueryString } from "../common/utils/query-string.js";
|
|
3
|
-
|
|
4
|
-
//#region src/client/sso.ts
|
|
5
|
-
var sso_exports = /* @__PURE__ */ __export({ getAuthorizationUrl: () => getAuthorizationUrl });
|
|
6
|
-
/**
|
|
7
|
-
* Generates the authorization URL for SSO authentication.
|
|
8
|
-
* Does not require an API key, suitable for OAuth client operations.
|
|
9
|
-
*
|
|
10
|
-
* @param options - SSO authorization URL options
|
|
11
|
-
* @returns The authorization URL as a string
|
|
12
|
-
* @throws Error if required arguments are missing
|
|
13
|
-
*/
|
|
14
|
-
function getAuthorizationUrl(options) {
|
|
15
|
-
const { connection, clientId, domainHint, loginHint, organization, provider, providerQueryParams, providerScopes, redirectUri, state, baseURL = "https://api.workos.com" } = options;
|
|
16
|
-
if (!provider && !connection && !organization) throw new Error(`Incomplete arguments. Need to specify either a 'connection', 'organization', or 'provider'.`);
|
|
17
|
-
return `${baseURL}/sso/authorize?${toQueryString({
|
|
18
|
-
connection,
|
|
19
|
-
organization,
|
|
20
|
-
domain_hint: domainHint,
|
|
21
|
-
login_hint: loginHint,
|
|
22
|
-
provider,
|
|
23
|
-
provider_query_params: providerQueryParams,
|
|
24
|
-
provider_scopes: providerScopes,
|
|
25
|
-
client_id: clientId,
|
|
26
|
-
redirect_uri: redirectUri,
|
|
27
|
-
response_type: "code",
|
|
28
|
-
state
|
|
29
|
-
})}`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
export { getAuthorizationUrl, sso_exports };
|
|
34
|
-
//# sourceMappingURL=sso.js.map
|
package/lib/client/sso.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sso.js","names":[],"sources":["../../src/client/sso.ts"],"sourcesContent":["import { toQueryString } from '../common/utils/query-string';\nimport type { SSOAuthorizationURLOptions as BaseSSOAuthorizationURLOptions } from '../sso/interfaces';\n\n// Extend the base options to include baseURL for internal use\nexport type SSOAuthorizationURLOptions = BaseSSOAuthorizationURLOptions & {\n baseURL?: string;\n};\n\n/**\n * Generates the authorization URL for SSO authentication.\n * Does not require an API key, suitable for OAuth client operations.\n *\n * @param options - SSO authorization URL options\n * @returns The authorization URL as a string\n * @throws Error if required arguments are missing\n */\nexport function getAuthorizationUrl(\n options: SSOAuthorizationURLOptions,\n): string {\n const {\n connection,\n clientId,\n domainHint,\n loginHint,\n organization,\n provider,\n providerQueryParams,\n providerScopes,\n redirectUri,\n state,\n baseURL = 'https://api.workos.com',\n } = options;\n\n if (!provider && !connection && !organization) {\n throw new Error(\n `Incomplete arguments. Need to specify either a 'connection', 'organization', or 'provider'.`,\n );\n }\n\n const query = toQueryString({\n connection,\n organization,\n domain_hint: domainHint,\n login_hint: loginHint,\n provider,\n provider_query_params: providerQueryParams,\n provider_scopes: providerScopes,\n client_id: clientId,\n redirect_uri: redirectUri,\n response_type: 'code',\n state,\n });\n\n return `${baseURL}/sso/authorize?${query}`;\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,SAAgB,oBACd,SACQ;CACR,MAAM,EACJ,YACA,UACA,YACA,WACA,cACA,UACA,qBACA,gBACA,aACA,OACA,UAAU,6BACR;AAEJ,KAAI,CAAC,YAAY,CAAC,cAAc,CAAC,aAC/B,OAAM,IAAI,MACR,8FACD;AAiBH,QAAO,GAAG,QAAQ,iBAdJ,cAAc;EAC1B;EACA;EACA,aAAa;EACb,YAAY;EACZ;EACA,uBAAuB;EACvB,iBAAiB;EACjB,WAAW;EACX,cAAc;EACd,eAAe;EACf;EACD,CAAC"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_common_utils_query_string = require('../common/utils/query-string.cjs');
|
|
3
|
-
|
|
4
|
-
//#region src/client/user-management.ts
|
|
5
|
-
var user_management_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
|
|
6
|
-
getAuthorizationUrl: () => getAuthorizationUrl,
|
|
7
|
-
getJwksUrl: () => getJwksUrl,
|
|
8
|
-
getLogoutUrl: () => getLogoutUrl
|
|
9
|
-
});
|
|
10
|
-
/**
|
|
11
|
-
* Generates the authorization URL for OAuth client authentication.
|
|
12
|
-
* Suitable for PKCE flows and other OAuth client operations that don't require an API key.
|
|
13
|
-
*
|
|
14
|
-
* @param options - Authorization URL options
|
|
15
|
-
* @returns The authorization URL as a string
|
|
16
|
-
* @throws TypeError if required arguments are missing
|
|
17
|
-
*/
|
|
18
|
-
function getAuthorizationUrl(options) {
|
|
19
|
-
const { connectionId, codeChallenge, codeChallengeMethod, clientId, domainHint, loginHint, organizationId, provider, providerQueryParams, providerScopes, prompt, redirectUri, state, screenHint, baseURL = "https://api.workos.com" } = options;
|
|
20
|
-
if (!provider && !connectionId && !organizationId) throw new TypeError(`Incomplete arguments. Need to specify either a 'connectionId', 'organizationId', or 'provider'.`);
|
|
21
|
-
if (provider !== "authkit" && screenHint) throw new TypeError(`'screenHint' is only supported for 'authkit' provider`);
|
|
22
|
-
return `${baseURL}/user_management/authorize?${require_common_utils_query_string.toQueryString({
|
|
23
|
-
connection_id: connectionId,
|
|
24
|
-
code_challenge: codeChallenge,
|
|
25
|
-
code_challenge_method: codeChallengeMethod,
|
|
26
|
-
organization_id: organizationId,
|
|
27
|
-
domain_hint: domainHint,
|
|
28
|
-
login_hint: loginHint,
|
|
29
|
-
provider,
|
|
30
|
-
provider_query_params: providerQueryParams,
|
|
31
|
-
provider_scopes: providerScopes,
|
|
32
|
-
prompt,
|
|
33
|
-
client_id: clientId,
|
|
34
|
-
redirect_uri: redirectUri,
|
|
35
|
-
response_type: "code",
|
|
36
|
-
state,
|
|
37
|
-
screen_hint: screenHint
|
|
38
|
-
})}`;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Generates the logout URL for ending a user session.
|
|
42
|
-
* This method is safe to use in browser environments as it doesn't require an API key.
|
|
43
|
-
*
|
|
44
|
-
* @param options - Logout URL options
|
|
45
|
-
* @returns The logout URL as a string
|
|
46
|
-
* @throws TypeError if sessionId is not provided
|
|
47
|
-
*/
|
|
48
|
-
function getLogoutUrl(options) {
|
|
49
|
-
const { sessionId, returnTo, baseURL = "https://api.workos.com" } = options;
|
|
50
|
-
if (!sessionId) throw new TypeError(`Incomplete arguments. Need to specify 'sessionId'.`);
|
|
51
|
-
const url = new URL("/user_management/sessions/logout", baseURL);
|
|
52
|
-
url.searchParams.set("session_id", sessionId);
|
|
53
|
-
if (returnTo) url.searchParams.set("return_to", returnTo);
|
|
54
|
-
return url.toString();
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Gets the JWKS (JSON Web Key Set) URL for a given client ID.
|
|
58
|
-
* Does not require an API key, returns the public JWKS endpoint.
|
|
59
|
-
*
|
|
60
|
-
* @param clientId - The WorkOS client ID
|
|
61
|
-
* @param baseURL - Optional base URL for the API (defaults to https://api.workos.com)
|
|
62
|
-
* @returns The JWKS URL as a string
|
|
63
|
-
* @throws TypeError if clientId is not provided
|
|
64
|
-
*/
|
|
65
|
-
function getJwksUrl(clientId, baseURL = "https://api.workos.com") {
|
|
66
|
-
if (!clientId) throw new TypeError("clientId must be a valid clientId");
|
|
67
|
-
return `${baseURL}/sso/jwks/${clientId}`;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
exports.getAuthorizationUrl = getAuthorizationUrl;
|
|
72
|
-
exports.getJwksUrl = getJwksUrl;
|
|
73
|
-
exports.getLogoutUrl = getLogoutUrl;
|
|
74
|
-
Object.defineProperty(exports, 'user_management_exports', {
|
|
75
|
-
enumerable: true,
|
|
76
|
-
get: function () {
|
|
77
|
-
return user_management_exports;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
//# sourceMappingURL=user-management.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user-management.cjs","names":["toQueryString"],"sources":["../../src/client/user-management.ts"],"sourcesContent":["import { toQueryString } from '../common/utils/query-string';\n\n// Re-export necessary interfaces for client use\nexport interface AuthorizationURLOptions {\n clientId: string;\n codeChallenge?: string;\n codeChallengeMethod?: 'S256';\n connectionId?: string;\n organizationId?: string;\n domainHint?: string;\n loginHint?: string;\n provider?: string;\n providerQueryParams?: Record<string, string | boolean | number>;\n providerScopes?: string[];\n prompt?: string;\n redirectUri: string;\n state?: string;\n screenHint?: 'sign-up' | 'sign-in';\n}\n\nexport interface LogoutURLOptions {\n sessionId: string;\n returnTo?: string;\n}\n\n/**\n * Generates the authorization URL for OAuth client authentication.\n * Suitable for PKCE flows and other OAuth client operations that don't require an API key.\n *\n * @param options - Authorization URL options\n * @returns The authorization URL as a string\n * @throws TypeError if required arguments are missing\n */\nexport function getAuthorizationUrl(\n options: AuthorizationURLOptions & { baseURL?: string },\n): string {\n const {\n connectionId,\n codeChallenge,\n codeChallengeMethod,\n clientId,\n domainHint,\n loginHint,\n organizationId,\n provider,\n providerQueryParams,\n providerScopes,\n prompt,\n redirectUri,\n state,\n screenHint,\n baseURL = 'https://api.workos.com',\n } = options;\n\n if (!provider && !connectionId && !organizationId) {\n throw new TypeError(\n `Incomplete arguments. Need to specify either a 'connectionId', 'organizationId', or 'provider'.`,\n );\n }\n\n if (provider !== 'authkit' && screenHint) {\n throw new TypeError(\n `'screenHint' is only supported for 'authkit' provider`,\n );\n }\n\n const query = toQueryString({\n connection_id: connectionId,\n code_challenge: codeChallenge,\n code_challenge_method: codeChallengeMethod,\n organization_id: organizationId,\n domain_hint: domainHint,\n login_hint: loginHint,\n provider,\n provider_query_params: providerQueryParams,\n provider_scopes: providerScopes,\n prompt,\n client_id: clientId,\n redirect_uri: redirectUri,\n response_type: 'code',\n state,\n screen_hint: screenHint,\n });\n\n return `${baseURL}/user_management/authorize?${query}`;\n}\n\n/**\n * Generates the logout URL for ending a user session.\n * This method is safe to use in browser environments as it doesn't require an API key.\n *\n * @param options - Logout URL options\n * @returns The logout URL as a string\n * @throws TypeError if sessionId is not provided\n */\nexport function getLogoutUrl(\n options: LogoutURLOptions & { baseURL?: string },\n): string {\n const { sessionId, returnTo, baseURL = 'https://api.workos.com' } = options;\n\n if (!sessionId) {\n throw new TypeError(`Incomplete arguments. Need to specify 'sessionId'.`);\n }\n\n const url = new URL('/user_management/sessions/logout', baseURL);\n\n url.searchParams.set('session_id', sessionId);\n if (returnTo) {\n url.searchParams.set('return_to', returnTo);\n }\n\n return url.toString();\n}\n\n/**\n * Gets the JWKS (JSON Web Key Set) URL for a given client ID.\n * Does not require an API key, returns the public JWKS endpoint.\n *\n * @param clientId - The WorkOS client ID\n * @param baseURL - Optional base URL for the API (defaults to https://api.workos.com)\n * @returns The JWKS URL as a string\n * @throws TypeError if clientId is not provided\n */\nexport function getJwksUrl(\n clientId: string,\n baseURL = 'https://api.workos.com',\n): string {\n if (!clientId) {\n throw new TypeError('clientId must be a valid clientId');\n }\n\n return `${baseURL}/sso/jwks/${clientId}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiCA,SAAgB,oBACd,SACQ;CACR,MAAM,EACJ,cACA,eACA,qBACA,UACA,YACA,WACA,gBACA,UACA,qBACA,gBACA,QACA,aACA,OACA,YACA,UAAU,6BACR;AAEJ,KAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,eACjC,OAAM,IAAI,UACR,kGACD;AAGH,KAAI,aAAa,aAAa,WAC5B,OAAM,IAAI,UACR,wDACD;AAqBH,QAAO,GAAG,QAAQ,6BAlBJA,gDAAc;EAC1B,eAAe;EACf,gBAAgB;EAChB,uBAAuB;EACvB,iBAAiB;EACjB,aAAa;EACb,YAAY;EACZ;EACA,uBAAuB;EACvB,iBAAiB;EACjB;EACA,WAAW;EACX,cAAc;EACd,eAAe;EACf;EACA,aAAa;EACd,CAAC;;;;;;;;;;AAaJ,SAAgB,aACd,SACQ;CACR,MAAM,EAAE,WAAW,UAAU,UAAU,6BAA6B;AAEpE,KAAI,CAAC,UACH,OAAM,IAAI,UAAU,qDAAqD;CAG3E,MAAM,MAAM,IAAI,IAAI,oCAAoC,QAAQ;AAEhE,KAAI,aAAa,IAAI,cAAc,UAAU;AAC7C,KAAI,SACF,KAAI,aAAa,IAAI,aAAa,SAAS;AAG7C,QAAO,IAAI,UAAU;;;;;;;;;;;AAYvB,SAAgB,WACd,UACA,UAAU,0BACF;AACR,KAAI,CAAC,SACH,OAAM,IAAI,UAAU,oCAAoC;AAG1D,QAAO,GAAG,QAAQ,YAAY"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
declare namespace user_management_d_exports {
|
|
2
|
-
export { AuthorizationURLOptions, LogoutURLOptions, getAuthorizationUrl, getJwksUrl, getLogoutUrl };
|
|
3
|
-
}
|
|
4
|
-
interface AuthorizationURLOptions {
|
|
5
|
-
clientId: string;
|
|
6
|
-
codeChallenge?: string;
|
|
7
|
-
codeChallengeMethod?: 'S256';
|
|
8
|
-
connectionId?: string;
|
|
9
|
-
organizationId?: string;
|
|
10
|
-
domainHint?: string;
|
|
11
|
-
loginHint?: string;
|
|
12
|
-
provider?: string;
|
|
13
|
-
providerQueryParams?: Record<string, string | boolean | number>;
|
|
14
|
-
providerScopes?: string[];
|
|
15
|
-
prompt?: string;
|
|
16
|
-
redirectUri: string;
|
|
17
|
-
state?: string;
|
|
18
|
-
screenHint?: 'sign-up' | 'sign-in';
|
|
19
|
-
}
|
|
20
|
-
interface LogoutURLOptions {
|
|
21
|
-
sessionId: string;
|
|
22
|
-
returnTo?: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Generates the authorization URL for OAuth client authentication.
|
|
26
|
-
* Suitable for PKCE flows and other OAuth client operations that don't require an API key.
|
|
27
|
-
*
|
|
28
|
-
* @param options - Authorization URL options
|
|
29
|
-
* @returns The authorization URL as a string
|
|
30
|
-
* @throws TypeError if required arguments are missing
|
|
31
|
-
*/
|
|
32
|
-
declare function getAuthorizationUrl(options: AuthorizationURLOptions & {
|
|
33
|
-
baseURL?: string;
|
|
34
|
-
}): string;
|
|
35
|
-
/**
|
|
36
|
-
* Generates the logout URL for ending a user session.
|
|
37
|
-
* This method is safe to use in browser environments as it doesn't require an API key.
|
|
38
|
-
*
|
|
39
|
-
* @param options - Logout URL options
|
|
40
|
-
* @returns The logout URL as a string
|
|
41
|
-
* @throws TypeError if sessionId is not provided
|
|
42
|
-
*/
|
|
43
|
-
declare function getLogoutUrl(options: LogoutURLOptions & {
|
|
44
|
-
baseURL?: string;
|
|
45
|
-
}): string;
|
|
46
|
-
/**
|
|
47
|
-
* Gets the JWKS (JSON Web Key Set) URL for a given client ID.
|
|
48
|
-
* Does not require an API key, returns the public JWKS endpoint.
|
|
49
|
-
*
|
|
50
|
-
* @param clientId - The WorkOS client ID
|
|
51
|
-
* @param baseURL - Optional base URL for the API (defaults to https://api.workos.com)
|
|
52
|
-
* @returns The JWKS URL as a string
|
|
53
|
-
* @throws TypeError if clientId is not provided
|
|
54
|
-
*/
|
|
55
|
-
declare function getJwksUrl(clientId: string, baseURL?: string): string;
|
|
56
|
-
//#endregion
|
|
57
|
-
export { AuthorizationURLOptions, LogoutURLOptions, getAuthorizationUrl, getJwksUrl, getLogoutUrl, user_management_d_exports };
|
|
58
|
-
//# sourceMappingURL=user-management.d.cts.map
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
declare namespace user_management_d_exports {
|
|
2
|
-
export { AuthorizationURLOptions, LogoutURLOptions, getAuthorizationUrl, getJwksUrl, getLogoutUrl };
|
|
3
|
-
}
|
|
4
|
-
interface AuthorizationURLOptions {
|
|
5
|
-
clientId: string;
|
|
6
|
-
codeChallenge?: string;
|
|
7
|
-
codeChallengeMethod?: 'S256';
|
|
8
|
-
connectionId?: string;
|
|
9
|
-
organizationId?: string;
|
|
10
|
-
domainHint?: string;
|
|
11
|
-
loginHint?: string;
|
|
12
|
-
provider?: string;
|
|
13
|
-
providerQueryParams?: Record<string, string | boolean | number>;
|
|
14
|
-
providerScopes?: string[];
|
|
15
|
-
prompt?: string;
|
|
16
|
-
redirectUri: string;
|
|
17
|
-
state?: string;
|
|
18
|
-
screenHint?: 'sign-up' | 'sign-in';
|
|
19
|
-
}
|
|
20
|
-
interface LogoutURLOptions {
|
|
21
|
-
sessionId: string;
|
|
22
|
-
returnTo?: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Generates the authorization URL for OAuth client authentication.
|
|
26
|
-
* Suitable for PKCE flows and other OAuth client operations that don't require an API key.
|
|
27
|
-
*
|
|
28
|
-
* @param options - Authorization URL options
|
|
29
|
-
* @returns The authorization URL as a string
|
|
30
|
-
* @throws TypeError if required arguments are missing
|
|
31
|
-
*/
|
|
32
|
-
declare function getAuthorizationUrl(options: AuthorizationURLOptions & {
|
|
33
|
-
baseURL?: string;
|
|
34
|
-
}): string;
|
|
35
|
-
/**
|
|
36
|
-
* Generates the logout URL for ending a user session.
|
|
37
|
-
* This method is safe to use in browser environments as it doesn't require an API key.
|
|
38
|
-
*
|
|
39
|
-
* @param options - Logout URL options
|
|
40
|
-
* @returns The logout URL as a string
|
|
41
|
-
* @throws TypeError if sessionId is not provided
|
|
42
|
-
*/
|
|
43
|
-
declare function getLogoutUrl(options: LogoutURLOptions & {
|
|
44
|
-
baseURL?: string;
|
|
45
|
-
}): string;
|
|
46
|
-
/**
|
|
47
|
-
* Gets the JWKS (JSON Web Key Set) URL for a given client ID.
|
|
48
|
-
* Does not require an API key, returns the public JWKS endpoint.
|
|
49
|
-
*
|
|
50
|
-
* @param clientId - The WorkOS client ID
|
|
51
|
-
* @param baseURL - Optional base URL for the API (defaults to https://api.workos.com)
|
|
52
|
-
* @returns The JWKS URL as a string
|
|
53
|
-
* @throws TypeError if clientId is not provided
|
|
54
|
-
*/
|
|
55
|
-
declare function getJwksUrl(clientId: string, baseURL?: string): string;
|
|
56
|
-
//#endregion
|
|
57
|
-
export { AuthorizationURLOptions, LogoutURLOptions, getAuthorizationUrl, getJwksUrl, getLogoutUrl, user_management_d_exports };
|
|
58
|
-
//# sourceMappingURL=user-management.d.ts.map
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { __export } from "../_virtual/rolldown_runtime.js";
|
|
2
|
-
import { toQueryString } from "../common/utils/query-string.js";
|
|
3
|
-
|
|
4
|
-
//#region src/client/user-management.ts
|
|
5
|
-
var user_management_exports = /* @__PURE__ */ __export({
|
|
6
|
-
getAuthorizationUrl: () => getAuthorizationUrl,
|
|
7
|
-
getJwksUrl: () => getJwksUrl,
|
|
8
|
-
getLogoutUrl: () => getLogoutUrl
|
|
9
|
-
});
|
|
10
|
-
/**
|
|
11
|
-
* Generates the authorization URL for OAuth client authentication.
|
|
12
|
-
* Suitable for PKCE flows and other OAuth client operations that don't require an API key.
|
|
13
|
-
*
|
|
14
|
-
* @param options - Authorization URL options
|
|
15
|
-
* @returns The authorization URL as a string
|
|
16
|
-
* @throws TypeError if required arguments are missing
|
|
17
|
-
*/
|
|
18
|
-
function getAuthorizationUrl(options) {
|
|
19
|
-
const { connectionId, codeChallenge, codeChallengeMethod, clientId, domainHint, loginHint, organizationId, provider, providerQueryParams, providerScopes, prompt, redirectUri, state, screenHint, baseURL = "https://api.workos.com" } = options;
|
|
20
|
-
if (!provider && !connectionId && !organizationId) throw new TypeError(`Incomplete arguments. Need to specify either a 'connectionId', 'organizationId', or 'provider'.`);
|
|
21
|
-
if (provider !== "authkit" && screenHint) throw new TypeError(`'screenHint' is only supported for 'authkit' provider`);
|
|
22
|
-
return `${baseURL}/user_management/authorize?${toQueryString({
|
|
23
|
-
connection_id: connectionId,
|
|
24
|
-
code_challenge: codeChallenge,
|
|
25
|
-
code_challenge_method: codeChallengeMethod,
|
|
26
|
-
organization_id: organizationId,
|
|
27
|
-
domain_hint: domainHint,
|
|
28
|
-
login_hint: loginHint,
|
|
29
|
-
provider,
|
|
30
|
-
provider_query_params: providerQueryParams,
|
|
31
|
-
provider_scopes: providerScopes,
|
|
32
|
-
prompt,
|
|
33
|
-
client_id: clientId,
|
|
34
|
-
redirect_uri: redirectUri,
|
|
35
|
-
response_type: "code",
|
|
36
|
-
state,
|
|
37
|
-
screen_hint: screenHint
|
|
38
|
-
})}`;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Generates the logout URL for ending a user session.
|
|
42
|
-
* This method is safe to use in browser environments as it doesn't require an API key.
|
|
43
|
-
*
|
|
44
|
-
* @param options - Logout URL options
|
|
45
|
-
* @returns The logout URL as a string
|
|
46
|
-
* @throws TypeError if sessionId is not provided
|
|
47
|
-
*/
|
|
48
|
-
function getLogoutUrl(options) {
|
|
49
|
-
const { sessionId, returnTo, baseURL = "https://api.workos.com" } = options;
|
|
50
|
-
if (!sessionId) throw new TypeError(`Incomplete arguments. Need to specify 'sessionId'.`);
|
|
51
|
-
const url = new URL("/user_management/sessions/logout", baseURL);
|
|
52
|
-
url.searchParams.set("session_id", sessionId);
|
|
53
|
-
if (returnTo) url.searchParams.set("return_to", returnTo);
|
|
54
|
-
return url.toString();
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Gets the JWKS (JSON Web Key Set) URL for a given client ID.
|
|
58
|
-
* Does not require an API key, returns the public JWKS endpoint.
|
|
59
|
-
*
|
|
60
|
-
* @param clientId - The WorkOS client ID
|
|
61
|
-
* @param baseURL - Optional base URL for the API (defaults to https://api.workos.com)
|
|
62
|
-
* @returns The JWKS URL as a string
|
|
63
|
-
* @throws TypeError if clientId is not provided
|
|
64
|
-
*/
|
|
65
|
-
function getJwksUrl(clientId, baseURL = "https://api.workos.com") {
|
|
66
|
-
if (!clientId) throw new TypeError("clientId must be a valid clientId");
|
|
67
|
-
return `${baseURL}/sso/jwks/${clientId}`;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
export { getAuthorizationUrl, getJwksUrl, getLogoutUrl, user_management_exports };
|
|
72
|
-
//# sourceMappingURL=user-management.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user-management.js","names":[],"sources":["../../src/client/user-management.ts"],"sourcesContent":["import { toQueryString } from '../common/utils/query-string';\n\n// Re-export necessary interfaces for client use\nexport interface AuthorizationURLOptions {\n clientId: string;\n codeChallenge?: string;\n codeChallengeMethod?: 'S256';\n connectionId?: string;\n organizationId?: string;\n domainHint?: string;\n loginHint?: string;\n provider?: string;\n providerQueryParams?: Record<string, string | boolean | number>;\n providerScopes?: string[];\n prompt?: string;\n redirectUri: string;\n state?: string;\n screenHint?: 'sign-up' | 'sign-in';\n}\n\nexport interface LogoutURLOptions {\n sessionId: string;\n returnTo?: string;\n}\n\n/**\n * Generates the authorization URL for OAuth client authentication.\n * Suitable for PKCE flows and other OAuth client operations that don't require an API key.\n *\n * @param options - Authorization URL options\n * @returns The authorization URL as a string\n * @throws TypeError if required arguments are missing\n */\nexport function getAuthorizationUrl(\n options: AuthorizationURLOptions & { baseURL?: string },\n): string {\n const {\n connectionId,\n codeChallenge,\n codeChallengeMethod,\n clientId,\n domainHint,\n loginHint,\n organizationId,\n provider,\n providerQueryParams,\n providerScopes,\n prompt,\n redirectUri,\n state,\n screenHint,\n baseURL = 'https://api.workos.com',\n } = options;\n\n if (!provider && !connectionId && !organizationId) {\n throw new TypeError(\n `Incomplete arguments. Need to specify either a 'connectionId', 'organizationId', or 'provider'.`,\n );\n }\n\n if (provider !== 'authkit' && screenHint) {\n throw new TypeError(\n `'screenHint' is only supported for 'authkit' provider`,\n );\n }\n\n const query = toQueryString({\n connection_id: connectionId,\n code_challenge: codeChallenge,\n code_challenge_method: codeChallengeMethod,\n organization_id: organizationId,\n domain_hint: domainHint,\n login_hint: loginHint,\n provider,\n provider_query_params: providerQueryParams,\n provider_scopes: providerScopes,\n prompt,\n client_id: clientId,\n redirect_uri: redirectUri,\n response_type: 'code',\n state,\n screen_hint: screenHint,\n });\n\n return `${baseURL}/user_management/authorize?${query}`;\n}\n\n/**\n * Generates the logout URL for ending a user session.\n * This method is safe to use in browser environments as it doesn't require an API key.\n *\n * @param options - Logout URL options\n * @returns The logout URL as a string\n * @throws TypeError if sessionId is not provided\n */\nexport function getLogoutUrl(\n options: LogoutURLOptions & { baseURL?: string },\n): string {\n const { sessionId, returnTo, baseURL = 'https://api.workos.com' } = options;\n\n if (!sessionId) {\n throw new TypeError(`Incomplete arguments. Need to specify 'sessionId'.`);\n }\n\n const url = new URL('/user_management/sessions/logout', baseURL);\n\n url.searchParams.set('session_id', sessionId);\n if (returnTo) {\n url.searchParams.set('return_to', returnTo);\n }\n\n return url.toString();\n}\n\n/**\n * Gets the JWKS (JSON Web Key Set) URL for a given client ID.\n * Does not require an API key, returns the public JWKS endpoint.\n *\n * @param clientId - The WorkOS client ID\n * @param baseURL - Optional base URL for the API (defaults to https://api.workos.com)\n * @returns The JWKS URL as a string\n * @throws TypeError if clientId is not provided\n */\nexport function getJwksUrl(\n clientId: string,\n baseURL = 'https://api.workos.com',\n): string {\n if (!clientId) {\n throw new TypeError('clientId must be a valid clientId');\n }\n\n return `${baseURL}/sso/jwks/${clientId}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiCA,SAAgB,oBACd,SACQ;CACR,MAAM,EACJ,cACA,eACA,qBACA,UACA,YACA,WACA,gBACA,UACA,qBACA,gBACA,QACA,aACA,OACA,YACA,UAAU,6BACR;AAEJ,KAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,eACjC,OAAM,IAAI,UACR,kGACD;AAGH,KAAI,aAAa,aAAa,WAC5B,OAAM,IAAI,UACR,wDACD;AAqBH,QAAO,GAAG,QAAQ,6BAlBJ,cAAc;EAC1B,eAAe;EACf,gBAAgB;EAChB,uBAAuB;EACvB,iBAAiB;EACjB,aAAa;EACb,YAAY;EACZ;EACA,uBAAuB;EACvB,iBAAiB;EACjB;EACA,WAAW;EACX,cAAc;EACd,eAAe;EACf;EACA,aAAa;EACd,CAAC;;;;;;;;;;AAaJ,SAAgB,aACd,SACQ;CACR,MAAM,EAAE,WAAW,UAAU,UAAU,6BAA6B;AAEpE,KAAI,CAAC,UACH,OAAM,IAAI,UAAU,qDAAqD;CAG3E,MAAM,MAAM,IAAI,IAAI,oCAAoC,QAAQ;AAEhE,KAAI,aAAa,IAAI,cAAc,UAAU;AAC7C,KAAI,SACF,KAAI,aAAa,IAAI,aAAa,SAAS;AAG7C,QAAO,IAAI,UAAU;;;;;;;;;;;AAYvB,SAAgB,WACd,UACA,UAAU,0BACF;AACR,KAAI,CAAC,SACH,OAAM,IAAI,UAAU,oCAAoC;AAG1D,QAAO,GAAG,QAAQ,YAAY"}
|
package/lib/index.client.cjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const require_client_user_management = require('./client/user-management.cjs');
|
|
2
|
-
const require_client_sso = require('./client/sso.cjs');
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, 'sso', {
|
|
5
|
-
enumerable: true,
|
|
6
|
-
get: function () {
|
|
7
|
-
return require_client_sso.sso_exports;
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
Object.defineProperty(exports, 'userManagement', {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return require_client_user_management.user_management_exports;
|
|
14
|
-
}
|
|
15
|
-
});
|
package/lib/index.client.d.cts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { AuthorizationURLOptions, LogoutURLOptions, user_management_d_exports } from "./client/user-management.cjs";
|
|
2
|
-
import { SSOAuthorizationURLOptions, sso_d_exports } from "./client/sso.cjs";
|
|
3
|
-
export { type LogoutURLOptions, type SSOAuthorizationURLOptions, type AuthorizationURLOptions as UserManagementAuthorizationURLOptions, sso_d_exports as sso, user_management_d_exports as userManagement };
|
package/lib/index.client.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { AuthorizationURLOptions, LogoutURLOptions, user_management_d_exports } from "./client/user-management.js";
|
|
2
|
-
import { SSOAuthorizationURLOptions, sso_d_exports } from "./client/sso.js";
|
|
3
|
-
export { type LogoutURLOptions, type SSOAuthorizationURLOptions, type AuthorizationURLOptions as UserManagementAuthorizationURLOptions, sso_d_exports as sso, user_management_d_exports as userManagement };
|
package/lib/index.client.js
DELETED