Skip to content

Commit 9c1896e

Browse files
committed
rename from public to client
1 parent 54cb363 commit 9c1896e

File tree

11 files changed

+35
-34
lines changed

11 files changed

+35
-34
lines changed

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@
103103
"require": "./lib/cjs/index.cjs",
104104
"default": "./lib/esm/index.js"
105105
},
106-
"./public": {
106+
"./client": {
107107
"types": {
108-
"require": "./lib/cjs/index.public.d.cts",
109-
"import": "./lib/esm/index.public.d.ts"
108+
"require": "./lib/cjs/index.client.d.cts",
109+
"import": "./lib/esm/index.client.d.ts"
110110
},
111-
"import": "./lib/esm/index.public.js",
112-
"require": "./lib/cjs/index.public.cjs",
113-
"default": "./lib/esm/index.public.js"
111+
"import": "./lib/esm/index.client.js",
112+
"require": "./lib/cjs/index.client.cjs",
113+
"default": "./lib/esm/index.client.js"
114114
},
115115
"./worker": {
116116
"types": {
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/**
2-
* Public methods that can be safely used without an API key.
2+
* Client methods that can be used without a WorkOS API key.
3+
* These are OAuth client operations suitable for PKCE flows.
34
*/
45

5-
// User Management public methods and types
6+
// User Management client methods and types
67
export * as userManagement from './user-management';
78

8-
// SSO public methods and types
9+
// SSO client methods and types
910
export * as sso from './sso';
1011

1112
// Re-export specific types for convenience
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface SSOAuthorizationURLOptions {
1515

1616
/**
1717
* Generates the authorization URL for SSO authentication.
18-
* This method is safe to use in browser environments as it doesn't require an API key.
18+
* Does not require an API key, suitable for OAuth client operations.
1919
*
2020
* @param options - SSO authorization URL options
2121
* @returns The authorization URL as a string
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { toQueryString } from './utils';
22

3-
// Re-export necessary interfaces for public use
3+
// Re-export necessary interfaces for client use
44
export interface AuthorizationURLOptions {
55
clientId: string;
66
codeChallenge?: string;
@@ -29,8 +29,8 @@ export interface LogoutURLOptions {
2929
}
3030

3131
/**
32-
* Generates the authorization URL for user authentication.
33-
* This method is safe to use in browser environments as it doesn't require an API key.
32+
* Generates the authorization URL for OAuth client authentication.
33+
* Suitable for PKCE flows and other OAuth client operations that don't require an API key.
3434
*
3535
* @param options - Authorization URL options
3636
* @returns The authorization URL as a string
@@ -128,7 +128,7 @@ export function getLogoutUrl(
128128

129129
/**
130130
* Gets the JWKS (JSON Web Key Set) URL for a given client ID.
131-
* This method is safe to use in browser environments as it doesn't require an API key.
131+
* Does not require an API key, returns the public JWKS endpoint.
132132
*
133133
* @param clientId - The WorkOS client ID
134134
* @param baseURL - Optional base URL for the API (defaults to https://api.workos.com)
File renamed without changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { userManagement, sso, webhooks, actions } from './index.public';
1+
import { userManagement, sso, webhooks, actions } from './index.client';
22

3-
describe('Public Exports', () => {
3+
describe('Client Exports', () => {
44
describe('userManagement exports', () => {
55
it('should generate authorization URLs correctly', () => {
66
const url = userManagement.getAuthorizationUrl({
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
2-
* Public methods that can be safely used without an API key.
3-
* These are primarily URL builders and cryptographic utilities.
2+
* Client methods that can be used without a WorkOS API key.
3+
* These are OAuth client operations, URL builders, and cryptographic utilities.
44
*/
55

6-
// Export public methods directly - this is the recommended approach
7-
export * as userManagement from './public/user-management';
8-
export * as sso from './public/sso';
6+
// Export client methods directly - this is the recommended approach
7+
export * as userManagement from './client/user-management';
8+
export * as sso from './client/sso';
99

1010
// Export webhooks and actions (these don't need API keys)
1111
import { Webhooks } from './webhooks/webhooks';
@@ -20,9 +20,9 @@ export const actions = new Actions(cryptoProvider);
2020
export type {
2121
AuthorizationURLOptions as UserManagementAuthorizationURLOptions,
2222
LogoutURLOptions,
23-
} from './public/user-management';
23+
} from './client/user-management';
2424

25-
export type { SSOAuthorizationURLOptions } from './public/sso';
25+
export type { SSOAuthorizationURLOptions } from './client/sso';
2626

2727
// Note: If you need authenticateWithCodeAndVerifier, use the full WorkOS SDK
2828
// as it requires server-side API key authentication

src/sso/sso.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as publicSSO from '../public/sso';
1+
import * as clientSSO from '../client/sso';
22
import { UnknownRecord } from '../common/interfaces/unknown-record.interface';
33
import { fetchAndDeserialize } from '../common/utils/fetch-and-deserialize';
44
import { AutoPaginatable } from '../common/utils/pagination';
@@ -51,8 +51,8 @@ export class SSO {
5151
}
5252

5353
getAuthorizationUrl(options: SSOAuthorizationURLOptions): string {
54-
// Delegate to public implementation
55-
return publicSSO.getAuthorizationUrl({
54+
// Delegate to client implementation
55+
return clientSSO.getAuthorizationUrl({
5656
...options,
5757
baseURL: this.workos.baseURL,
5858
});

0 commit comments

Comments
 (0)