@bodhiapp/bodhi-js 0.0.2 → 0.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.
@@ -0,0 +1 @@
1
+ export declare const BUILD_MODE: string;
@@ -20,7 +20,7 @@ export declare abstract class BaseFacadeClient<TConfig, TExtClient extends IConn
20
20
  protected authClientId: string;
21
21
  protected config: TConfig;
22
22
  protected onStateChange: StateChangeCallback;
23
- constructor(authClientId: string, config: TConfig, onStateChange?: StateChangeCallback, storagePrefix?: string);
23
+ constructor(authClientId: string, config: TConfig, onStateChange?: StateChangeCallback, storagePrefix?: string, basePath?: string);
24
24
  /**
25
25
  * Create logger instance
26
26
  * Subclasses extract logLevel from their specific config type
@@ -17,3 +17,4 @@ export * from './oauth';
17
17
  export * from './direct-client-base';
18
18
  export * from './facade-client-base';
19
19
  export { isOperationError, type OperationError } from '../../../bodhi-browser-ext/src/types';
20
+ export { BUILD_MODE as CORE_BUILD_MODE } from './build-info';
@@ -27,6 +27,18 @@ export declare const STORAGE_PREFIXES: {
27
27
  readonly WEB: "bodhi:web";
28
28
  readonly EXT: "bodhi:ext";
29
29
  };
30
+ /**
31
+ * Create storage prefix with basePath for path isolation
32
+ *
33
+ * @param basePath - Base path of app (e.g., '/', '/app1/')
34
+ * @param prefix - Storage prefix (e.g., 'bodhi:web', 'bodhijs:')
35
+ * @returns Combined prefix with basePath isolation
36
+ *
37
+ * Examples:
38
+ * - createStoragePrefixWithBasePath('/', 'bodhi:web') => '/:bodhi:web'
39
+ * - createStoragePrefixWithBasePath('/app1/', 'bodhi:web') => '/app1/:bodhi:web'
40
+ */
41
+ export declare function createStoragePrefixWithBasePath(basePath: string, prefix: string): string;
30
42
  /**
31
43
  * User Preferences Storage Manager
32
44
  *
@@ -0,0 +1 @@
1
+ export declare const BUILD_MODE: string;
@@ -1,9 +1,20 @@
1
- /**
2
- * Constants for web2ext communication
3
- */
1
+ import { StorageKeys } from '../../core/src/index.ts';
2
+
4
3
  export declare const POLL_INTERVAL = 500;
5
4
  export declare const POLL_TIMEOUT = 5000;
6
5
  /**
7
6
  * LocalStorage keys for OAuth tokens and PKCE flow (namespaced with 'bodhi:web' prefix)
7
+ * @deprecated Use createWebStorageKeys(basePath) instead for basePath-aware keys
8
+ */
9
+ export declare const STORAGE_KEYS: StorageKeys;
10
+ /**
11
+ * Create storage keys for web mode with optional basePath isolation
12
+ *
13
+ * @param basePath - Base path of app (e.g., '/', '/app1/'), defaults to '/'
14
+ * @returns Storage keys with basePath-aware prefix
15
+ *
16
+ * Examples:
17
+ * - createWebStorageKeys('/') => keys with 'bodhi:web:' prefix
18
+ * - createWebStorageKeys('/app1/') => keys with '/app1/:bodhi:web:' prefix
8
19
  */
9
- export declare const STORAGE_KEYS: import('../../core/src/index.ts').StorageKeys;
20
+ export declare function createWebStorageKeys(basePath?: string): StorageKeys;
@@ -5,6 +5,7 @@ import { DirectClientBase, AuthLoggedIn, AuthLoggedOut, DirectClientBaseConfig,
5
5
  */
6
6
  export interface DirectWebClientConfig extends DirectClientBaseConfig {
7
7
  redirectUri: string;
8
+ basePath?: string;
8
9
  }
9
10
  /**
10
11
  * DirectWebClient - Web mode implementation using browser redirect OAuth
@@ -23,7 +23,8 @@ export declare class WindowBodhiextClient implements IExtensionClient {
23
23
  private authEndpoints;
24
24
  private onStateChange;
25
25
  private refreshPromise;
26
- constructor(authClientId: string, config: WebClientConfig, onStateChange?: StateChangeCallback);
26
+ private storageKeys;
27
+ constructor(authClientId: string, config: WebClientConfig, onStateChange?: StateChangeCallback, basePath?: string);
27
28
  /**
28
29
  * Set client state and notify callback
29
30
  */
@@ -9,6 +9,7 @@ export interface WebClientConfig {
9
9
  authServerUrl: string;
10
10
  redirectUri: string;
11
11
  userScope: UserScope;
12
+ basePath?: string;
12
13
  logLevel: LogLevel;
13
14
  initParams?: {
14
15
  extension?: {
@@ -28,6 +29,7 @@ export declare class WebUIClient extends BaseFacadeClient<WebClientConfig, Windo
28
29
  redirectUri: string;
29
30
  authServerUrl?: string;
30
31
  userScope?: UserScope;
32
+ basePath?: string;
31
33
  logLevel?: LogLevel;
32
34
  initParams?: {
33
35
  extension?: {
@@ -3,3 +3,4 @@ import { IWebUIClient } from './interface';
3
3
 
4
4
  export { WebUIClient } from './facade-client';
5
5
  export type { IWebUIClient, SerializedWebExtensionState };
6
+ export { BUILD_MODE as WEB_BUILD_MODE } from './build-info';