@bodhiapp/bodhi-js-core 0.0.38 → 0.0.40
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/dist/access-request.d.ts +12 -25
- package/dist/bodhi-core.cjs.js +7 -7
- package/dist/bodhi-core.esm.js +202 -266
- package/dist/cli/setup-modal.js +1 -1
- package/dist/direct-client-base.d.ts +2 -8
- package/dist/facade-client-base.d.ts +1 -6
- package/dist/index.d.ts +0 -1
- package/dist/interface.d.ts +1 -19
- package/dist/oauth.d.ts +11 -0
- package/dist/types/index.d.ts +1 -5
- package/package.json +5 -5
- package/dist/review-manager.d.ts +0 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CreateAccessRequest, CreateAccessRequestResponse, DeploymentMode, PingResponse } from '@bodhiapp/ts-client';
|
|
2
2
|
import { ApiResponse } from '@bodhiapp/bodhi-browser-types';
|
|
3
3
|
import { IDirectClient, StreamTextResult } from './interface';
|
|
4
4
|
import { Logger } from './logger';
|
|
@@ -124,13 +124,7 @@ export declare abstract class DirectClientBase implements IDirectClient {
|
|
|
124
124
|
*/
|
|
125
125
|
debug(): Promise<Record<string, unknown>>;
|
|
126
126
|
requestAccess(body: CreateAccessRequest): Promise<ApiResponse<CreateAccessRequestResponse>>;
|
|
127
|
-
getAccessRequestStatus(requestId: string): Promise<ApiResponse<AccessRequestStatusResponse>>;
|
|
128
|
-
pollAccessRequestStatus(requestId: string, options?: {
|
|
129
|
-
intervalMs?: number;
|
|
130
|
-
timeoutMs?: number;
|
|
131
|
-
}): Promise<AccessRequestStatusResponse>;
|
|
132
127
|
abstract login(): Promise<AuthState>;
|
|
133
|
-
protected abstract performOAuthPkce(scope: string): Promise<AuthState>;
|
|
134
128
|
getAuthState(): Promise<AuthState>;
|
|
135
129
|
logout(): Promise<AuthState>;
|
|
136
130
|
protected _getAccessTokenRaw(): Promise<string | null>;
|
|
@@ -154,7 +148,7 @@ export declare abstract class DirectClientBase implements IDirectClient {
|
|
|
154
148
|
* Rebuild OAuth storage keys using the current serverUrl.
|
|
155
149
|
* Called after serverUrl is committed in `init()`. No-op if serverUrl is null.
|
|
156
150
|
*/
|
|
157
|
-
|
|
151
|
+
protected rebuildStorageKeys(): void;
|
|
158
152
|
/**
|
|
159
153
|
* Revoke + purge OAuth tokens from a previous server URL's namespace. Called
|
|
160
154
|
* when the user switches servers: the new server would not recognize the old
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CreateAccessRequest, CreateAccessRequestResponse, PingResponse } from '@bodhiapp/ts-client';
|
|
2
2
|
import { ApiResponse } from '@bodhiapp/bodhi-browser-types';
|
|
3
3
|
import { IConnectionClient, IExtensionClient, StreamTextResult } from './interface';
|
|
4
4
|
import { Logger } from './logger';
|
|
@@ -105,11 +105,6 @@ export declare abstract class BaseFacadeClient<TConfig, TExtClient extends IExte
|
|
|
105
105
|
logout(): Promise<AuthState>;
|
|
106
106
|
getAuthState(): Promise<AuthState>;
|
|
107
107
|
requestAccess(body: CreateAccessRequest): Promise<ApiResponse<CreateAccessRequestResponse>>;
|
|
108
|
-
getAccessRequestStatus(requestId: string): Promise<ApiResponse<AccessRequestStatusResponse>>;
|
|
109
|
-
pollAccessRequestStatus(requestId: string, options?: {
|
|
110
|
-
intervalMs?: number;
|
|
111
|
-
timeoutMs?: number;
|
|
112
|
-
}): Promise<AccessRequestStatusResponse>;
|
|
113
108
|
pingApi(): Promise<ApiResponse<PingResponse>>;
|
|
114
109
|
getServerState(): Promise<BackendServerState>;
|
|
115
110
|
stream<TReq = unknown, TRes = unknown>(method: string, endpoint: string, body?: TReq, headers?: Record<string, string>, authenticated?: boolean): AsyncGenerator<TRes>;
|
package/dist/index.d.ts
CHANGED
package/dist/interface.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CreateAccessRequest, CreateAccessRequestResponse, PingResponse } from '@bodhiapp/ts-client';
|
|
2
2
|
import { ApiResponse } from '@bodhiapp/bodhi-browser-types';
|
|
3
3
|
import { AuthState, BackendServerState, ClientState, ConnectionMode, DirectState, ExtensionState, InitParams, LoginOptions, StateChangeCallback } from './types';
|
|
4
4
|
import { Chat, Models, Embeddings, Mcps } from './openai-client-compat';
|
|
@@ -114,19 +114,6 @@ export interface IConnectionClient<IParams = unknown, SerialState = unknown> {
|
|
|
114
114
|
* @throws BodhiError on operational errors
|
|
115
115
|
*/
|
|
116
116
|
requestAccess(body: CreateAccessRequest): Promise<ApiResponse<CreateAccessRequestResponse>>;
|
|
117
|
-
/**
|
|
118
|
-
* Get status of an access request
|
|
119
|
-
* GET /bodhi/v1/apps/access-requests/{id}?app_client_id=xxx
|
|
120
|
-
* @throws BodhiError on operational errors
|
|
121
|
-
*/
|
|
122
|
-
getAccessRequestStatus(requestId: string): Promise<ApiResponse<AccessRequestStatusResponse>>;
|
|
123
|
-
/**
|
|
124
|
-
* Poll access request until approved/denied/failed/expired
|
|
125
|
-
*/
|
|
126
|
-
pollAccessRequestStatus(requestId: string, options?: {
|
|
127
|
-
intervalMs?: number;
|
|
128
|
-
timeoutMs?: number;
|
|
129
|
-
}): Promise<AccessRequestStatusResponse>;
|
|
130
117
|
/**
|
|
131
118
|
* Set or update the state change callback
|
|
132
119
|
* Allows setting callback after construction (for React dependency injection)
|
|
@@ -281,11 +268,6 @@ export interface IWebUIClient extends UIClient {
|
|
|
281
268
|
* @returns AuthLoggedIn with login state and user info
|
|
282
269
|
*/
|
|
283
270
|
handleOAuthCallback(code: string, state: string): Promise<AuthState>;
|
|
284
|
-
/**
|
|
285
|
-
* Handle access request callback after redirect review (web only)
|
|
286
|
-
* Called when user returns from review_url redirect
|
|
287
|
-
*/
|
|
288
|
-
handleAccessRequestCallback(requestId: string): Promise<AuthState>;
|
|
289
271
|
}
|
|
290
272
|
/**
|
|
291
273
|
* Type guard to check if client has OAuth callback handling (web mode)
|
package/dist/oauth.d.ts
CHANGED
|
@@ -28,6 +28,17 @@ export interface OAuthEndpoints {
|
|
|
28
28
|
* Create OAuth endpoints from auth server URL
|
|
29
29
|
*/
|
|
30
30
|
export declare function createOAuthEndpoints(authServerUrl: string): OAuthEndpoints;
|
|
31
|
+
export declare const BASE_OAUTH_SCOPE = "openid profile email roles";
|
|
32
|
+
export declare const ACCESS_REQUEST_ERROR_MARKER = "access_request_error";
|
|
33
|
+
export declare function buildAuthorizeUrl(endpoints: OAuthEndpoints, params: {
|
|
34
|
+
clientId: string;
|
|
35
|
+
redirectUri: string;
|
|
36
|
+
scope: string;
|
|
37
|
+
state: string;
|
|
38
|
+
codeChallenge: string;
|
|
39
|
+
}): string;
|
|
40
|
+
export declare function buildReviewUrl(reviewUrl: string, authUrl: string, errorUrl: string): string;
|
|
41
|
+
export declare function buildErrorUrl(redirectUri: string): string;
|
|
31
42
|
export interface RefreshTokenResponse {
|
|
32
43
|
access_token: string;
|
|
33
44
|
refresh_token?: string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequestedResourcesV1, UserScope } from '@bodhiapp/ts-client';
|
|
2
2
|
/**
|
|
3
3
|
* Shared types used by both ext2ext and web2ext clients
|
|
4
4
|
*/
|
|
@@ -16,11 +16,7 @@ export type LoginProgressCallback = (stage: LoginProgressStage) => void;
|
|
|
16
16
|
export interface LoginOptions {
|
|
17
17
|
userRole?: UserScope;
|
|
18
18
|
requested?: RequestedResourcesV1;
|
|
19
|
-
flowType?: FlowType;
|
|
20
|
-
redirectUrl?: string;
|
|
21
19
|
onProgress?: LoginProgressCallback;
|
|
22
|
-
pollIntervalMs?: number;
|
|
23
|
-
pollTimeoutMs?: number;
|
|
24
20
|
}
|
|
25
21
|
export type { BrowserInfo, OSInfo } from './platform';
|
|
26
22
|
export { InMemoryStorage } from './storage';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bodhiapp/bodhi-js-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"description": "Core types and interfaces for Bodhi Browser SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/bodhi-core.cjs.js",
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@bodhiapp/bodhi-browser-types": "0.0.
|
|
89
|
-
"@bodhiapp/setup-modal-types": "0.0.
|
|
90
|
-
"@bodhiapp/setup-modal-v2-types": "0.0.
|
|
91
|
-
"@bodhiapp/ts-client": "0.1.
|
|
88
|
+
"@bodhiapp/bodhi-browser-types": "0.0.40",
|
|
89
|
+
"@bodhiapp/setup-modal-types": "0.0.40",
|
|
90
|
+
"@bodhiapp/setup-modal-v2-types": "0.0.40",
|
|
91
|
+
"@bodhiapp/ts-client": "0.1.35",
|
|
92
92
|
"ua-parser-js": "^1.0.40"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
package/dist/review-manager.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface ReviewResult {
|
|
2
|
-
approved: boolean;
|
|
3
|
-
accessRequestScope?: string;
|
|
4
|
-
status?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface PollOptions {
|
|
7
|
-
intervalMs?: number;
|
|
8
|
-
timeoutMs?: number;
|
|
9
|
-
}
|
|
10
|
-
export declare function openPopupReview(reviewUrl: string, pollFn: () => Promise<ReviewResult | null>, options?: PollOptions): Promise<ReviewResult>;
|