@bodhiapp/bodhi-js-core 0.0.26 → 0.0.28
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 +4 -4
- package/dist/bodhi-core.cjs.js +3 -3
- package/dist/bodhi-core.esm.js +275 -290
- package/dist/cli/setup-modal.js +2 -2
- package/dist/direct-client-base.d.ts +7 -8
- package/dist/errors.d.ts +9 -9
- package/dist/facade-client-base.d.ts +7 -8
- package/dist/index.d.ts +1 -2
- package/dist/interface.d.ts +13 -10
- package/dist/openai-client-compat.d.ts +2 -2
- package/dist/types/client-state.d.ts +4 -4
- package/dist/types/index.cjs.js +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.esm.js +168 -38
- package/package.json +4 -4
- package/dist/protocol-utils-7g8EeigP.cjs +0 -1
- package/dist/protocol-utils-DqAh8xyi.js +0 -182
- package/dist/types/api.d.ts +0 -33
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { isOperationErrorStructure as c, isOpenAiApiErrorBody as d } from "@bodhiapp/bodhi-browser-types";
|
|
2
|
-
function S(e) {
|
|
3
|
-
return e !== null && typeof e == "object" && "error" in e && !("body" in e) && c(e.error);
|
|
4
|
-
}
|
|
5
|
-
function v(e) {
|
|
6
|
-
return "body" in e && "status" in e && typeof e.status == "number" && e.status >= 200 && e.status < 300;
|
|
7
|
-
}
|
|
8
|
-
function T(e) {
|
|
9
|
-
return "body" in e && "status" in e && typeof e.status == "number" && e.status >= 400 && d(e.body);
|
|
10
|
-
}
|
|
11
|
-
const I = (e, n, r, t) => {
|
|
12
|
-
const o = new Error(e);
|
|
13
|
-
return o.response = { status: n, body: r, headers: t }, o;
|
|
14
|
-
}, O = (e, n) => {
|
|
15
|
-
const r = new Error(e);
|
|
16
|
-
return r.error = { message: e, type: n }, r;
|
|
17
|
-
}, s = {
|
|
18
|
-
NOT_REACHABLE: {
|
|
19
|
-
message: "server is not reachable on given url",
|
|
20
|
-
type: "network_error"
|
|
21
|
-
},
|
|
22
|
-
SERVER_NOT_READY: {
|
|
23
|
-
message: "server is not in ready state, configure to complete setup",
|
|
24
|
-
type: "extension_error"
|
|
25
|
-
}
|
|
26
|
-
}, E = {
|
|
27
|
-
status: "not-reachable",
|
|
28
|
-
version: null,
|
|
29
|
-
error: s.NOT_REACHABLE
|
|
30
|
-
}, i = {
|
|
31
|
-
status: "pending-extension-ready",
|
|
32
|
-
version: null,
|
|
33
|
-
error: null
|
|
34
|
-
}, l = {
|
|
35
|
-
status: "not-connected",
|
|
36
|
-
version: null,
|
|
37
|
-
error: null
|
|
38
|
-
};
|
|
39
|
-
function u(e) {
|
|
40
|
-
return e.status === "ready";
|
|
41
|
-
}
|
|
42
|
-
function x(e, n = "unknown", r = s.SERVER_NOT_READY, t, o) {
|
|
43
|
-
return {
|
|
44
|
-
status: e,
|
|
45
|
-
version: n,
|
|
46
|
-
error: r,
|
|
47
|
-
deployment: t ?? null,
|
|
48
|
-
client_id: o ?? null
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function a(e) {
|
|
52
|
-
return e.type === "extension";
|
|
53
|
-
}
|
|
54
|
-
function y(e) {
|
|
55
|
-
return e.type === "direct";
|
|
56
|
-
}
|
|
57
|
-
function D(e) {
|
|
58
|
-
return typeof e.server == "object" && e.server.status !== "not-connected" && u(e.server);
|
|
59
|
-
}
|
|
60
|
-
function p(e) {
|
|
61
|
-
return e.url !== null;
|
|
62
|
-
}
|
|
63
|
-
const b = {
|
|
64
|
-
type: "direct",
|
|
65
|
-
url: null,
|
|
66
|
-
server: l
|
|
67
|
-
};
|
|
68
|
-
function C(e, n = "unknown") {
|
|
69
|
-
return { type: "direct", server: { status: "ready", version: n, error: null }, url: e };
|
|
70
|
-
}
|
|
71
|
-
function h(e) {
|
|
72
|
-
return { type: "direct", server: E, url: e };
|
|
73
|
-
}
|
|
74
|
-
function k(e, n) {
|
|
75
|
-
return { type: "direct", server: n, url: e };
|
|
76
|
-
}
|
|
77
|
-
const f = {
|
|
78
|
-
type: "extension",
|
|
79
|
-
extension: "not-initialized",
|
|
80
|
-
extensionId: null,
|
|
81
|
-
server: i
|
|
82
|
-
}, R = {
|
|
83
|
-
type: "extension",
|
|
84
|
-
extension: "not-found",
|
|
85
|
-
extensionId: null,
|
|
86
|
-
server: i
|
|
87
|
-
};
|
|
88
|
-
function B(e) {
|
|
89
|
-
return e.extension === "ready" && e.server.status !== "pending-extension-ready" && u(e.server);
|
|
90
|
-
}
|
|
91
|
-
function A(e) {
|
|
92
|
-
return e.extension === "ready";
|
|
93
|
-
}
|
|
94
|
-
function L() {
|
|
95
|
-
return f;
|
|
96
|
-
}
|
|
97
|
-
function g() {
|
|
98
|
-
return R;
|
|
99
|
-
}
|
|
100
|
-
function w(e) {
|
|
101
|
-
return a(e) ? A(e) : p(e);
|
|
102
|
-
}
|
|
103
|
-
function m(e) {
|
|
104
|
-
return e.server;
|
|
105
|
-
}
|
|
106
|
-
function H(e) {
|
|
107
|
-
return a(e) ? e.extensionId ?? void 0 : void 0;
|
|
108
|
-
}
|
|
109
|
-
function V(e) {
|
|
110
|
-
return y(e) ? e.url ?? void 0 : void 0;
|
|
111
|
-
}
|
|
112
|
-
function j(e) {
|
|
113
|
-
return e.status === "authenticated";
|
|
114
|
-
}
|
|
115
|
-
function q(e) {
|
|
116
|
-
return e.status === "loading";
|
|
117
|
-
}
|
|
118
|
-
function z(e) {
|
|
119
|
-
return e.status === "error";
|
|
120
|
-
}
|
|
121
|
-
const F = {
|
|
122
|
-
status: "idle",
|
|
123
|
-
user: null,
|
|
124
|
-
accessToken: null,
|
|
125
|
-
error: null
|
|
126
|
-
}, K = () => {
|
|
127
|
-
};
|
|
128
|
-
function P(e, n) {
|
|
129
|
-
return { kind: "event", type: e, payload: n };
|
|
130
|
-
}
|
|
131
|
-
function N(e, n, r) {
|
|
132
|
-
return { kind: "response", type: n, requestId: e, payload: r };
|
|
133
|
-
}
|
|
134
|
-
function U(e, n) {
|
|
135
|
-
return { kind: "error", requestId: e, error: n };
|
|
136
|
-
}
|
|
137
|
-
function X(e, n) {
|
|
138
|
-
const r = n[e.type];
|
|
139
|
-
if (!r) return null;
|
|
140
|
-
const t = r(e.payload);
|
|
141
|
-
return N(e.requestId, e.type, t);
|
|
142
|
-
}
|
|
143
|
-
export {
|
|
144
|
-
j as A,
|
|
145
|
-
l as B,
|
|
146
|
-
U as C,
|
|
147
|
-
b as D,
|
|
148
|
-
R as E,
|
|
149
|
-
P as F,
|
|
150
|
-
N as G,
|
|
151
|
-
X as H,
|
|
152
|
-
F as I,
|
|
153
|
-
K as N,
|
|
154
|
-
i as P,
|
|
155
|
-
s as S,
|
|
156
|
-
S as a,
|
|
157
|
-
v as b,
|
|
158
|
-
I as c,
|
|
159
|
-
O as d,
|
|
160
|
-
E as e,
|
|
161
|
-
x as f,
|
|
162
|
-
h as g,
|
|
163
|
-
k as h,
|
|
164
|
-
T as i,
|
|
165
|
-
C as j,
|
|
166
|
-
g as k,
|
|
167
|
-
L as l,
|
|
168
|
-
f as m,
|
|
169
|
-
m as n,
|
|
170
|
-
H as o,
|
|
171
|
-
V as p,
|
|
172
|
-
w as q,
|
|
173
|
-
p as r,
|
|
174
|
-
D as s,
|
|
175
|
-
y as t,
|
|
176
|
-
A as u,
|
|
177
|
-
B as v,
|
|
178
|
-
a as w,
|
|
179
|
-
u as x,
|
|
180
|
-
z as y,
|
|
181
|
-
q as z
|
|
182
|
-
};
|
package/dist/types/api.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ApiResponse, OperationErrorResponse } from '@bodhiapp/bodhi-browser-types';
|
|
2
|
-
import { OpenAiApiError } from '@bodhiapp/ts-client';
|
|
3
|
-
/**
|
|
4
|
-
* Public API result type - discriminated union without protocol fields
|
|
5
|
-
*
|
|
6
|
-
* This is the return type for sendApiRequest() and similar methods.
|
|
7
|
-
* Unlike ApiResponseMessage<T> (which includes type and requestId for internal routing),
|
|
8
|
-
* this is the clean public interface without protocol overhead.
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* if ('error' in result) → { error: OperationErrorResponse } (network/extension error)
|
|
12
|
-
* if ('body' in result) → ApiResponse<T> (HTTP completed - check status for success/error)
|
|
13
|
-
*/
|
|
14
|
-
export type ApiResponseResult<T> = ApiResponse<T> | {
|
|
15
|
-
error: OperationErrorResponse;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Type guard for operation error response
|
|
19
|
-
*/
|
|
20
|
-
export declare function isApiResultOperationError<T>(result: ApiResponseResult<T>): result is {
|
|
21
|
-
error: OperationErrorResponse;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Type guard for API response (success or HTTP error)
|
|
25
|
-
*/
|
|
26
|
-
export declare function isApiResultSuccess<T>(result: ApiResponseResult<T>): result is ApiResponse<T> & {
|
|
27
|
-
body: T;
|
|
28
|
-
status: number;
|
|
29
|
-
};
|
|
30
|
-
export declare function isApiResultError<T>(result: ApiResponseResult<T>): result is ApiResponse<T> & {
|
|
31
|
-
body: OpenAiApiError;
|
|
32
|
-
status: number;
|
|
33
|
-
};
|