@easbot/gateway-sdk 0.0.0-stage → 0.3.29
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/LICENSE +21 -0
- package/README.en.md +123 -0
- package/README.md +122 -2
- package/dist/index.cjs +7 -0
- package/dist/index.d.cts +489 -0
- package/dist/index.d.ts +489 -0
- package/dist/index.mjs +7 -0
- package/package.json +75 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
type ClientOptions$1 = {
|
|
2
|
+
baseUrl: 'http://localhost:8080' | (string & {});
|
|
3
|
+
};
|
|
4
|
+
type HealthResponse = {
|
|
5
|
+
status: string;
|
|
6
|
+
timestamp: number;
|
|
7
|
+
version: string;
|
|
8
|
+
};
|
|
9
|
+
type StatusResponse = {
|
|
10
|
+
status: string;
|
|
11
|
+
connections: number;
|
|
12
|
+
sessions: number;
|
|
13
|
+
messageSubscriptions: number;
|
|
14
|
+
agentSubscriptions: number;
|
|
15
|
+
uptime: number;
|
|
16
|
+
version: string;
|
|
17
|
+
agents?: {
|
|
18
|
+
total: number;
|
|
19
|
+
healthy: number;
|
|
20
|
+
unhealthy: number;
|
|
21
|
+
};
|
|
22
|
+
channels?: Array<{
|
|
23
|
+
id: string;
|
|
24
|
+
platform: string;
|
|
25
|
+
name: string;
|
|
26
|
+
version: string;
|
|
27
|
+
}>;
|
|
28
|
+
};
|
|
29
|
+
type ChannelListResponse = {
|
|
30
|
+
channels: Array<{
|
|
31
|
+
id: string;
|
|
32
|
+
platform: string;
|
|
33
|
+
name: string;
|
|
34
|
+
version?: string;
|
|
35
|
+
}>;
|
|
36
|
+
total: number;
|
|
37
|
+
};
|
|
38
|
+
type ContactListResponse = {
|
|
39
|
+
contacts: Array<ContactInfo>;
|
|
40
|
+
total: number;
|
|
41
|
+
hasMore: boolean;
|
|
42
|
+
};
|
|
43
|
+
type ContactInfo = {
|
|
44
|
+
uid: string;
|
|
45
|
+
platform: string;
|
|
46
|
+
stableId: string;
|
|
47
|
+
profile: {
|
|
48
|
+
displayName?: string;
|
|
49
|
+
username?: string;
|
|
50
|
+
};
|
|
51
|
+
lastSeenAt: number;
|
|
52
|
+
createdAt: number;
|
|
53
|
+
};
|
|
54
|
+
type SessionListResponse = {
|
|
55
|
+
sessions: Array<SessionInfo>;
|
|
56
|
+
total: number;
|
|
57
|
+
hasMore: boolean;
|
|
58
|
+
};
|
|
59
|
+
type SessionInfo = {
|
|
60
|
+
id: string;
|
|
61
|
+
platform?: string;
|
|
62
|
+
channelId?: string;
|
|
63
|
+
userId?: string;
|
|
64
|
+
chatId?: string;
|
|
65
|
+
chatType?: string;
|
|
66
|
+
chatTitle?: string;
|
|
67
|
+
state: string;
|
|
68
|
+
createdAt: number;
|
|
69
|
+
lastActiveAt: number;
|
|
70
|
+
};
|
|
71
|
+
type CreateSessionResponse = {
|
|
72
|
+
id: string;
|
|
73
|
+
createdAt: number;
|
|
74
|
+
};
|
|
75
|
+
type SendMessageResponse = {
|
|
76
|
+
messageId: string;
|
|
77
|
+
sessionId: string;
|
|
78
|
+
createdAt: number;
|
|
79
|
+
metadata?: {
|
|
80
|
+
channel?: string;
|
|
81
|
+
channelSource?: string;
|
|
82
|
+
channelInfo?: {
|
|
83
|
+
platform?: string;
|
|
84
|
+
channelId?: string;
|
|
85
|
+
chatId?: string;
|
|
86
|
+
userId?: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
type HealthCheckData = {
|
|
91
|
+
body?: never;
|
|
92
|
+
path?: never;
|
|
93
|
+
query?: never;
|
|
94
|
+
url: '/health';
|
|
95
|
+
};
|
|
96
|
+
type HealthCheckResponses = {
|
|
97
|
+
200: HealthResponse;
|
|
98
|
+
};
|
|
99
|
+
type HealthCheckResponse = HealthCheckResponses[keyof HealthCheckResponses];
|
|
100
|
+
type GetStatusData = {
|
|
101
|
+
body?: never;
|
|
102
|
+
path?: never;
|
|
103
|
+
query?: never;
|
|
104
|
+
url: '/status';
|
|
105
|
+
};
|
|
106
|
+
type GetStatusResponses = {
|
|
107
|
+
200: StatusResponse;
|
|
108
|
+
};
|
|
109
|
+
type GetStatusResponse = GetStatusResponses[keyof GetStatusResponses];
|
|
110
|
+
type ListChannelsData = {
|
|
111
|
+
body?: never;
|
|
112
|
+
path?: never;
|
|
113
|
+
query?: never;
|
|
114
|
+
url: '/channels';
|
|
115
|
+
};
|
|
116
|
+
type ListChannelsResponses = {
|
|
117
|
+
200: ChannelListResponse;
|
|
118
|
+
};
|
|
119
|
+
type ListChannelsResponse = ListChannelsResponses[keyof ListChannelsResponses];
|
|
120
|
+
type ListContactsData = {
|
|
121
|
+
body?: never;
|
|
122
|
+
path?: never;
|
|
123
|
+
query: {
|
|
124
|
+
platform: string;
|
|
125
|
+
limit?: number;
|
|
126
|
+
offset?: number;
|
|
127
|
+
};
|
|
128
|
+
url: '/contacts';
|
|
129
|
+
};
|
|
130
|
+
type ListContactsResponses = {
|
|
131
|
+
200: ContactListResponse;
|
|
132
|
+
};
|
|
133
|
+
type ListContactsResponse = ListContactsResponses[keyof ListContactsResponses];
|
|
134
|
+
type GetContactData = {
|
|
135
|
+
body?: never;
|
|
136
|
+
path: {
|
|
137
|
+
uid: string;
|
|
138
|
+
};
|
|
139
|
+
query?: never;
|
|
140
|
+
url: '/contacts/{uid}';
|
|
141
|
+
};
|
|
142
|
+
type GetContactErrors = {
|
|
143
|
+
404: unknown;
|
|
144
|
+
};
|
|
145
|
+
type GetContactResponses = {
|
|
146
|
+
200: ContactInfo & {
|
|
147
|
+
aliases?: {
|
|
148
|
+
[key: string]: unknown;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
type GetContactResponse = GetContactResponses[keyof GetContactResponses];
|
|
153
|
+
type ListSessionsData = {
|
|
154
|
+
body?: never;
|
|
155
|
+
path?: never;
|
|
156
|
+
query?: {
|
|
157
|
+
limit?: number;
|
|
158
|
+
offset?: number;
|
|
159
|
+
platform?: string;
|
|
160
|
+
channelId?: string;
|
|
161
|
+
userId?: string;
|
|
162
|
+
chatId?: string;
|
|
163
|
+
};
|
|
164
|
+
url: '/sessions';
|
|
165
|
+
};
|
|
166
|
+
type ListSessionsResponses = {
|
|
167
|
+
200: SessionListResponse;
|
|
168
|
+
};
|
|
169
|
+
type ListSessionsResponse = ListSessionsResponses[keyof ListSessionsResponses];
|
|
170
|
+
type GetSessionData = {
|
|
171
|
+
body?: never;
|
|
172
|
+
path: {
|
|
173
|
+
id: string;
|
|
174
|
+
};
|
|
175
|
+
query?: never;
|
|
176
|
+
url: '/sessions/{id}';
|
|
177
|
+
};
|
|
178
|
+
type GetSessionErrors = {
|
|
179
|
+
404: unknown;
|
|
180
|
+
};
|
|
181
|
+
type GetSessionResponses = {
|
|
182
|
+
200: SessionInfo & {
|
|
183
|
+
subscriberCount?: number;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
type GetSessionResponse = GetSessionResponses[keyof GetSessionResponses];
|
|
187
|
+
type CreateSessionData = {
|
|
188
|
+
body?: {
|
|
189
|
+
title?: string;
|
|
190
|
+
channel?: {
|
|
191
|
+
platform?: string;
|
|
192
|
+
channelId?: string;
|
|
193
|
+
userId?: string;
|
|
194
|
+
chatId?: string;
|
|
195
|
+
};
|
|
196
|
+
};
|
|
197
|
+
path?: never;
|
|
198
|
+
query?: never;
|
|
199
|
+
url: '/session';
|
|
200
|
+
};
|
|
201
|
+
type CreateSessionResponses = {
|
|
202
|
+
200: CreateSessionResponse;
|
|
203
|
+
};
|
|
204
|
+
type CreateSessionResponse2 = CreateSessionResponses[keyof CreateSessionResponses];
|
|
205
|
+
type SendMessageData = {
|
|
206
|
+
body: {
|
|
207
|
+
content: Array<{
|
|
208
|
+
type: string;
|
|
209
|
+
text?: string;
|
|
210
|
+
image?: string;
|
|
211
|
+
data?: string;
|
|
212
|
+
}>;
|
|
213
|
+
channel?: string;
|
|
214
|
+
userId?: string;
|
|
215
|
+
chatId?: string;
|
|
216
|
+
messageType?: string;
|
|
217
|
+
processorId?: string;
|
|
218
|
+
agent?: string;
|
|
219
|
+
replyToMessageId?: string;
|
|
220
|
+
};
|
|
221
|
+
path: {
|
|
222
|
+
id: string;
|
|
223
|
+
};
|
|
224
|
+
query?: never;
|
|
225
|
+
url: '/session/{id}/prompt';
|
|
226
|
+
};
|
|
227
|
+
type SendMessageErrors = {
|
|
228
|
+
404: unknown;
|
|
229
|
+
};
|
|
230
|
+
type SendMessageResponses = {
|
|
231
|
+
200: SendMessageResponse;
|
|
232
|
+
};
|
|
233
|
+
type SendMessageResponse2 = SendMessageResponses[keyof SendMessageResponses];
|
|
234
|
+
|
|
235
|
+
type AuthToken = string | undefined;
|
|
236
|
+
interface Auth {
|
|
237
|
+
in?: 'header' | 'query' | 'cookie';
|
|
238
|
+
key?: string;
|
|
239
|
+
name?: string;
|
|
240
|
+
scheme?: 'basic' | 'bearer';
|
|
241
|
+
type: 'apiKey' | 'http';
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
interface SerializerOptions<T> {
|
|
245
|
+
explode: boolean;
|
|
246
|
+
style: T;
|
|
247
|
+
}
|
|
248
|
+
type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
|
|
249
|
+
type ObjectStyle = 'form' | 'deepObject';
|
|
250
|
+
|
|
251
|
+
type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
252
|
+
type BodySerializer = (body: unknown) => unknown;
|
|
253
|
+
type QuerySerializerOptionsObject = {
|
|
254
|
+
allowReserved?: boolean;
|
|
255
|
+
array?: Partial<SerializerOptions<ArrayStyle>>;
|
|
256
|
+
object?: Partial<SerializerOptions<ObjectStyle>>;
|
|
257
|
+
};
|
|
258
|
+
type QuerySerializerOptions = QuerySerializerOptionsObject & {
|
|
259
|
+
parameters?: Record<string, QuerySerializerOptionsObject>;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
|
|
263
|
+
type Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
|
|
264
|
+
buildUrl: BuildUrlFn;
|
|
265
|
+
getConfig: () => Config;
|
|
266
|
+
request: RequestFn;
|
|
267
|
+
setConfig: (config: Config) => Config;
|
|
268
|
+
} & {
|
|
269
|
+
[K in HttpMethod]: MethodFn;
|
|
270
|
+
} & ([SseFn] extends [never] ? {
|
|
271
|
+
sse?: never;
|
|
272
|
+
} : {
|
|
273
|
+
sse: {
|
|
274
|
+
[K in HttpMethod]: SseFn;
|
|
275
|
+
};
|
|
276
|
+
});
|
|
277
|
+
interface Config$1 {
|
|
278
|
+
auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
|
|
279
|
+
bodySerializer?: BodySerializer | null;
|
|
280
|
+
headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
|
|
281
|
+
method?: Uppercase<HttpMethod>;
|
|
282
|
+
querySerializer?: QuerySerializer | QuerySerializerOptions;
|
|
283
|
+
requestValidator?: (data: unknown) => Promise<unknown>;
|
|
284
|
+
responseTransformer?: (data: unknown) => Promise<unknown>;
|
|
285
|
+
responseValidator?: (data: unknown) => Promise<unknown>;
|
|
286
|
+
}
|
|
287
|
+
interface ClientMeta {
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$1, 'method' | 'responseTransformer' | 'responseValidator'> & {
|
|
291
|
+
fetch?: typeof fetch;
|
|
292
|
+
onRequest?: (url: string, init: RequestInit) => Promise<Request>;
|
|
293
|
+
onSseError?: (error: unknown) => void;
|
|
294
|
+
onSseEvent?: (event: StreamEvent<TData>) => void;
|
|
295
|
+
serializedBody?: RequestInit['body'];
|
|
296
|
+
sseDefaultRetryDelay?: number;
|
|
297
|
+
sseMaxRetryAttempts?: number;
|
|
298
|
+
sseMaxRetryDelay?: number;
|
|
299
|
+
sseSleepFn?: (ms: number) => Promise<void>;
|
|
300
|
+
url: string;
|
|
301
|
+
};
|
|
302
|
+
interface StreamEvent<TData = unknown> {
|
|
303
|
+
data: TData;
|
|
304
|
+
event?: string;
|
|
305
|
+
id?: string;
|
|
306
|
+
retry?: number;
|
|
307
|
+
}
|
|
308
|
+
type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
|
|
309
|
+
stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
type ErrInterceptor<Err, Res, Req, Options> = (error: Err, response: Res | undefined, request: Req | undefined, options: Options) => Err | Promise<Err>;
|
|
313
|
+
type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
|
|
314
|
+
type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
|
|
315
|
+
declare class Interceptors<Interceptor> {
|
|
316
|
+
fns: Array<Interceptor | null>;
|
|
317
|
+
clear(): void;
|
|
318
|
+
eject(id: number | Interceptor): void;
|
|
319
|
+
exists(id: number | Interceptor): boolean;
|
|
320
|
+
getInterceptorIndex(id: number | Interceptor): number;
|
|
321
|
+
update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
|
|
322
|
+
use(fn: Interceptor): number;
|
|
323
|
+
}
|
|
324
|
+
interface Middleware<Req, Res, Err, Options> {
|
|
325
|
+
error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
|
|
326
|
+
request: Interceptors<ReqInterceptor<Req, Options>>;
|
|
327
|
+
response: Interceptors<ResInterceptor<Res, Req, Options>>;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
type ResponseStyle = 'data' | 'fields';
|
|
331
|
+
interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
|
|
332
|
+
baseUrl?: T['baseUrl'];
|
|
333
|
+
fetch?: typeof fetch;
|
|
334
|
+
next?: never;
|
|
335
|
+
parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
|
|
336
|
+
responseStyle?: ResponseStyle;
|
|
337
|
+
throwOnError?: T['throwOnError'];
|
|
338
|
+
}
|
|
339
|
+
interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
|
|
340
|
+
responseStyle: TResponseStyle;
|
|
341
|
+
throwOnError: ThrowOnError;
|
|
342
|
+
}>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
343
|
+
body?: unknown;
|
|
344
|
+
path?: Record<string, unknown>;
|
|
345
|
+
query?: Record<string, unknown>;
|
|
346
|
+
security?: ReadonlyArray<Auth>;
|
|
347
|
+
url: Url;
|
|
348
|
+
}
|
|
349
|
+
interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
|
|
350
|
+
headers: Headers;
|
|
351
|
+
serializedBody?: string;
|
|
352
|
+
}
|
|
353
|
+
type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = ThrowOnError extends true ? Promise<TResponseStyle extends 'data' ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
|
|
354
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
355
|
+
request: Request;
|
|
356
|
+
response: Response;
|
|
357
|
+
}> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
|
|
358
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
359
|
+
error: undefined;
|
|
360
|
+
} | {
|
|
361
|
+
data: undefined;
|
|
362
|
+
error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
|
|
363
|
+
}) & {
|
|
364
|
+
request?: Request;
|
|
365
|
+
response?: Response;
|
|
366
|
+
}>;
|
|
367
|
+
interface ClientOptions {
|
|
368
|
+
baseUrl?: string;
|
|
369
|
+
responseStyle?: ResponseStyle;
|
|
370
|
+
throwOnError?: boolean;
|
|
371
|
+
}
|
|
372
|
+
type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
373
|
+
type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
|
|
374
|
+
type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
375
|
+
type BuildUrlFn = <TData extends {
|
|
376
|
+
body?: unknown;
|
|
377
|
+
path?: Record<string, unknown>;
|
|
378
|
+
query?: Record<string, unknown>;
|
|
379
|
+
url: string;
|
|
380
|
+
}>(options: TData & Options$1<TData>) => string;
|
|
381
|
+
type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
|
|
382
|
+
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
|
|
383
|
+
};
|
|
384
|
+
interface TDataShape {
|
|
385
|
+
body?: unknown;
|
|
386
|
+
headers?: unknown;
|
|
387
|
+
path?: unknown;
|
|
388
|
+
query?: unknown;
|
|
389
|
+
url: string;
|
|
390
|
+
}
|
|
391
|
+
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
392
|
+
type Options$1<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
|
|
393
|
+
|
|
394
|
+
type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
|
|
395
|
+
client?: Client;
|
|
396
|
+
meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
|
|
397
|
+
};
|
|
398
|
+
declare class HeyApiClient {
|
|
399
|
+
client: Client;
|
|
400
|
+
constructor(args?: {
|
|
401
|
+
client?: Client;
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
declare class HeyApiRegistry<T> {
|
|
405
|
+
private readonly defaultKey;
|
|
406
|
+
private readonly instances;
|
|
407
|
+
get(key?: string): T;
|
|
408
|
+
set(value: T, key?: string): void;
|
|
409
|
+
}
|
|
410
|
+
declare class EasbotGatewayClient extends HeyApiClient {
|
|
411
|
+
static readonly __registry: HeyApiRegistry<EasbotGatewayClient>;
|
|
412
|
+
constructor(args?: {
|
|
413
|
+
client?: Client;
|
|
414
|
+
key?: string;
|
|
415
|
+
});
|
|
416
|
+
healthCheck<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>): RequestResult<HealthCheckResponses, unknown, ThrowOnError>;
|
|
417
|
+
getStatus<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>): RequestResult<GetStatusResponses, unknown, ThrowOnError>;
|
|
418
|
+
listChannels<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>): RequestResult<ListChannelsResponses, unknown, ThrowOnError>;
|
|
419
|
+
listContacts<ThrowOnError extends boolean = false>(parameters: {
|
|
420
|
+
platform: string;
|
|
421
|
+
limit?: number;
|
|
422
|
+
offset?: number;
|
|
423
|
+
}, options?: Options<never, ThrowOnError>): RequestResult<ListContactsResponses, unknown, ThrowOnError>;
|
|
424
|
+
getContact<ThrowOnError extends boolean = false>(parameters: {
|
|
425
|
+
uid: string;
|
|
426
|
+
}, options?: Options<never, ThrowOnError>): RequestResult<GetContactResponses, GetContactErrors, ThrowOnError>;
|
|
427
|
+
listSessions<ThrowOnError extends boolean = false>(parameters?: {
|
|
428
|
+
limit?: number;
|
|
429
|
+
offset?: number;
|
|
430
|
+
platform?: string;
|
|
431
|
+
channelId?: string;
|
|
432
|
+
userId?: string;
|
|
433
|
+
chatId?: string;
|
|
434
|
+
}, options?: Options<never, ThrowOnError>): RequestResult<ListSessionsResponses, unknown, ThrowOnError>;
|
|
435
|
+
getSession<ThrowOnError extends boolean = false>(parameters: {
|
|
436
|
+
id: string;
|
|
437
|
+
}, options?: Options<never, ThrowOnError>): RequestResult<GetSessionResponses, GetSessionErrors, ThrowOnError>;
|
|
438
|
+
createSession<ThrowOnError extends boolean = false>(parameters?: {
|
|
439
|
+
title?: string;
|
|
440
|
+
channel?: {
|
|
441
|
+
platform?: string;
|
|
442
|
+
channelId?: string;
|
|
443
|
+
userId?: string;
|
|
444
|
+
chatId?: string;
|
|
445
|
+
};
|
|
446
|
+
}, options?: Options<never, ThrowOnError>): RequestResult<CreateSessionResponses, unknown, ThrowOnError>;
|
|
447
|
+
sendMessage<ThrowOnError extends boolean = false>(parameters: {
|
|
448
|
+
id: string;
|
|
449
|
+
content: Array<{
|
|
450
|
+
type: string;
|
|
451
|
+
text?: string;
|
|
452
|
+
image?: string;
|
|
453
|
+
data?: string;
|
|
454
|
+
}>;
|
|
455
|
+
channel?: string;
|
|
456
|
+
userId?: string;
|
|
457
|
+
chatId?: string;
|
|
458
|
+
messageType?: string;
|
|
459
|
+
processorId?: string;
|
|
460
|
+
agent?: string;
|
|
461
|
+
replyToMessageId?: string;
|
|
462
|
+
}, options?: Options<never, ThrowOnError>): RequestResult<SendMessageResponses, SendMessageErrors, ThrowOnError>;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
declare function createEasbotGatewayClient(config?: Config & {
|
|
466
|
+
directory?: string;
|
|
467
|
+
}): EasbotGatewayClient;
|
|
468
|
+
|
|
469
|
+
type ServerOptions = {
|
|
470
|
+
hostname?: string;
|
|
471
|
+
port?: number;
|
|
472
|
+
signal?: AbortSignal;
|
|
473
|
+
timeout?: number;
|
|
474
|
+
config?: Config;
|
|
475
|
+
};
|
|
476
|
+
declare function createEasbotGatewayServer(options?: ServerOptions): Promise<{
|
|
477
|
+
url: string;
|
|
478
|
+
close(): void;
|
|
479
|
+
}>;
|
|
480
|
+
|
|
481
|
+
declare function createEasbotGateway(options?: ServerOptions): Promise<{
|
|
482
|
+
client: EasbotGatewayClient;
|
|
483
|
+
server: {
|
|
484
|
+
url: string;
|
|
485
|
+
close(): void;
|
|
486
|
+
};
|
|
487
|
+
}>;
|
|
488
|
+
|
|
489
|
+
export { type ChannelListResponse, type Client, type ClientOptions$1 as ClientOptions, type ContactInfo, type ContactListResponse, type CreateSessionData, type CreateSessionResponse, type CreateSessionResponse2, type CreateSessionResponses, EasbotGatewayClient, type Config as EasbotGatewayClientConfig, type GetContactData, type GetContactErrors, type GetContactResponse, type GetContactResponses, type GetSessionData, type GetSessionErrors, type GetSessionResponse, type GetSessionResponses, type GetStatusData, type GetStatusResponse, type GetStatusResponses, type HealthCheckData, type HealthCheckResponse, type HealthCheckResponses, type HealthResponse, type ListChannelsData, type ListChannelsResponse, type ListChannelsResponses, type ListContactsData, type ListContactsResponse, type ListContactsResponses, type ListSessionsData, type ListSessionsResponse, type ListSessionsResponses, type Options$1 as Options, type RequestResult, type SendMessageData, type SendMessageErrors, type SendMessageResponse, type SendMessageResponse2, type SendMessageResponses, type ServerOptions, type SessionInfo, type SessionListResponse, type StatusResponse, createEasbotGateway, createEasbotGatewayClient, createEasbotGatewayServer };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import {spawn}from'child_process';var ye=Object.defineProperty;var fe=(r,e,t)=>e in r?ye(r,e,{enumerable:true,configurable:true,writable:true,value:t}):r[e]=t;var I=(r,e,t)=>fe(r,typeof e!="symbol"?e+"":e,t);function Y({onRequest:r,onSseError:e,onSseEvent:t,responseTransformer:n,responseValidator:a,sseDefaultRetryDelay:l,sseMaxRetryAttempts:o,sseMaxRetryDelay:i,sseSleepFn:s,url:c,...p}){let u,g=s??(y=>new Promise(d=>setTimeout(d,y)));return {stream:async function*(){let y=l??3e3,d=0,m=p.signal??new AbortController().signal;for(;!m.aborted;){d++;let C=p.headers instanceof Headers?p.headers:new Headers(p.headers);u!==void 0&&C.set("Last-Event-ID",u);try{let O={redirect:"follow",...p,body:p.serializedBody,headers:C,signal:m},E=new Request(c,O);r&&(E=await r(c,O));let R=await(p.fetch??globalThis.fetch)(E);if(!R.ok)throw new Error(`SSE failed: ${R.status} ${R.statusText}`);if(!R.body)throw new Error("No body in SSE response");let x=R.body.pipeThrough(new TextDecoderStream).getReader(),w="",_=()=>{try{x.cancel();}catch{}};m.addEventListener("abort",_);try{for(;;){let{done:pe,value:ue}=await x.read();if(pe)break;w+=ue,w=w.replace(/\r\n?/g,`
|
|
2
|
+
`);let W=w.split(`
|
|
3
|
+
|
|
4
|
+
`);w=W.pop()??"";for(let ce of W){let de=ce.split(`
|
|
5
|
+
`),P=[],K;for(let T of de)if(T.startsWith("data:"))P.push(T.replace(/^data:\s*/,""));else if(T.startsWith("event:"))K=T.replace(/^event:\s*/,"");else if(T.startsWith("id:"))u=T.replace(/^id:\s*/,"");else if(T.startsWith("retry:")){let X=Number.parseInt(T.replace(/^retry:\s*/,""),10);Number.isNaN(X)||(y=X);}let q,Q=!1;if(P.length){let T=P.join(`
|
|
6
|
+
`);try{q=JSON.parse(T),Q=!0;}catch{q=T;}}Q&&(a&&await a(q),n&&(q=await n(q))),t?.({data:q,event:K,id:u,retry:y}),P.length&&(yield q);}}}finally{m.removeEventListener("abort",_),x.releaseLock();}break}catch(O){if(e?.(O),o!==void 0&&d>=o)break;let E=Math.min(y*2**(d-1),i??3e4);await g(E);}}}()}}var he=r=>{switch(r){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},ge=r=>{switch(r){case "form":return ",";case "pipeDelimited":return "|";case "spaceDelimited":return "%20";default:return ","}},me=r=>{switch(r){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},j=({allowReserved:r,explode:e,name:t,style:n,value:a})=>{if(!e){let i=(r?a:a.map(s=>encodeURIComponent(s))).join(ge(n));switch(n){case "label":return `.${i}`;case "matrix":return `;${t}=${i}`;case "simple":return i;default:return `${t}=${i}`}}let l=he(n),o=a.map(i=>n==="label"||n==="simple"?r?i:encodeURIComponent(i):D({allowReserved:r,name:t,value:i})).join(l);return n==="label"||n==="matrix"?l+o:o},D=({allowReserved:r,name:e,value:t})=>{if(t==null)return "";if(typeof t=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return `${e}=${r?t:encodeURIComponent(t)}`},M=({allowReserved:r,explode:e,name:t,style:n,value:a,valueOnly:l})=>{if(a instanceof Date)return l?a.toISOString():`${t}=${a.toISOString()}`;if(n!=="deepObject"&&!e){let s=[];Object.entries(a).forEach(([p,u])=>{s=[...s,p,r?u:encodeURIComponent(u)];});let c=s.join(",");switch(n){case "form":return `${t}=${c}`;case "label":return `.${c}`;case "matrix":return `;${t}=${c}`;default:return c}}let o=me(n),i=Object.entries(a).map(([s,c])=>D({allowReserved:r,name:n==="deepObject"?`${t}[${s}]`:s,value:c})).join(o);return n==="label"||n==="matrix"?o+i:i};var Re=/\{[^{}]+\}/g,be=({path:r,url:e})=>{let t=e,n=e.match(Re);if(n)for(let a of n){let l=false,o=a.substring(1,a.length-1),i="simple";o.endsWith("*")&&(l=true,o=o.substring(0,o.length-1)),o.startsWith(".")?(o=o.substring(1),i="label"):o.startsWith(";")&&(o=o.substring(1),i="matrix");let s=r[o];if(s==null)continue;if(Array.isArray(s)){t=t.replace(a,j({explode:l,name:o,style:i,value:s}));continue}if(typeof s=="object"){t=t.replace(a,M({explode:l,name:o,style:i,value:s,valueOnly:true}));continue}if(i==="matrix"){t=t.replace(a,`;${D({name:o,value:s})}`);continue}let c=encodeURIComponent(i==="label"?`.${s}`:s);t=t.replace(a,c);}return t},Z=({baseUrl:r,path:e,query:t,querySerializer:n,url:a})=>{let l=a.startsWith("/")?a:`/${a}`,o=(r??"")+l;e&&(o=be({path:e,url:o}));let i=t?n(t):"";return i.startsWith("?")&&(i=i.substring(1)),i&&(o+=`?${i}`),o};function $(r){let e=r.body!==void 0;if(e&&r.bodySerializer)return "serializedBody"in r?r.serializedBody!==void 0&&r.serializedBody!==""?r.serializedBody:null:r.body!==""?r.body:null;if(e)return r.body}var ee=async(r,e)=>{let t=typeof e=="function"?await e(r):e;if(t)return r.scheme==="bearer"?`Bearer ${t}`:r.scheme==="basic"?`Basic ${btoa(t)}`:t};var H={bodySerializer:r=>JSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString():t)};var te=({parameters:r={},...e}={})=>n=>{let a=[];if(n&&typeof n=="object")for(let l in n){let o=n[l];if(o==null)continue;let i=r[l]||e;if(Array.isArray(o)){let s=j({allowReserved:i.allowReserved,explode:true,name:l,style:"form",value:o,...i.array});s&&a.push(s);}else if(typeof o=="object"){let s=M({allowReserved:i.allowReserved,explode:true,name:l,style:"deepObject",value:o,...i.object});s&&a.push(s);}else {let s=D({allowReserved:i.allowReserved,name:l,value:o});s&&a.push(s);}}return a.join("&")},re=r=>{if(!r)return "stream";let e=r.split(";")[0]?.trim();if(e){if(e.startsWith("application/json")||e.endsWith("+json"))return "json";if(e==="multipart/form-data")return "formData";if(["application/","audio/","image/","video/"].some(t=>e.startsWith(t)))return "blob";if(e.startsWith("text/"))return "text"}},Se=(r,e)=>e?!!(r.headers.has(e)||r.query?.[e]||r.headers.get("Cookie")?.includes(`${e}=`)):false;async function ne(r){for(let e of r.security??[]){if(Se(r,e.name))continue;let t=await ee(e,r.auth);if(!t)continue;let n=e.name??"Authorization";switch(e.in){case "query":r.query||(r.query={}),r.query[n]=t;break;case "cookie":r.headers.append("Cookie",`${n}=${t}`);break;default:r.headers.set(n,t);break}}}var F=r=>Z({baseUrl:r.baseUrl,path:r.path,query:r.query,querySerializer:typeof r.querySerializer=="function"?r.querySerializer:te(r.querySerializer),url:r.url}),N=(r,e)=>{let t={...r,...e};return t.baseUrl?.endsWith("/")&&(t.baseUrl=t.baseUrl.substring(0,t.baseUrl.length-1)),t.headers=U(r.headers,e.headers),t},we=r=>{let e=[];return r.forEach((t,n)=>{e.push([n,t]);}),e},U=(...r)=>{let e=new Headers;for(let t of r){if(!t)continue;let n=t instanceof Headers?we(t):Object.entries(t);for(let[a,l]of n)if(l===null)e.delete(a);else if(Array.isArray(l))for(let o of l)e.append(a,o);else l!==void 0&&e.set(a,typeof l=="object"?JSON.stringify(l):l);}return e},v=class{constructor(){I(this,"fns",[]);}clear(){this.fns=[];}eject(e){let t=this.getInterceptorIndex(e);this.fns[t]&&(this.fns[t]=null);}exists(e){let t=this.getInterceptorIndex(e);return !!this.fns[t]}getInterceptorIndex(e){return typeof e=="number"?this.fns[e]?e:-1:this.fns.indexOf(e)}update(e,t){let n=this.getInterceptorIndex(e);return this.fns[n]?(this.fns[n]=t,e):false}use(e){return this.fns.push(e),this.fns.length-1}},se=()=>({error:new v,request:new v,response:new v}),Oe=te({allowReserved:false,array:{explode:true,style:"form"},object:{explode:true,style:"deepObject"}}),xe={"Content-Type":"application/json"},A=(r={})=>({...H,headers:xe,parseAs:"auto",querySerializer:Oe,...r});var z=(r={})=>{let e=N(A(),r),t=()=>({...e}),n=p=>(e=N(e,p),t()),a=se(),l=async p=>{let u={...e,...p,fetch:p.fetch??e.fetch??globalThis.fetch,headers:U(e.headers,p.headers),serializedBody:void 0};u.security&&await ne(u),u.requestValidator&&await u.requestValidator(u),u.body!==void 0&&u.bodySerializer&&(u.serializedBody=u.bodySerializer(u.body)),(u.body===void 0||u.serializedBody==="")&&u.headers.delete("Content-Type");let g=u,f=F(g);return {opts:g,url:f}},o=async p=>{let u=p.throwOnError??e.throwOnError,g=p.responseStyle??e.responseStyle,f,h;try{let{opts:y,url:d}=await l(p),m={redirect:"follow",...y,body:$(y)};f=new Request(d,m);for(let R of a.request.fns)R&&(f=await R(f,y));let C=y.fetch;h=await C(f);for(let R of a.response.fns)R&&(h=await R(h,f,y));let O={request:f,response:h};if(h.ok){let R=(y.parseAs==="auto"?re(h.headers.get("Content-Type")):y.parseAs)??"json";if(h.status===204||h.headers.get("Content-Length")==="0"){let w;switch(R){case "arrayBuffer":case "blob":case "text":w=await h[R]();break;case "formData":w=new FormData;break;case "stream":w=h.body;break;default:w={};break}return y.responseStyle==="data"?w:{data:w,...O}}let x;switch(R){case "arrayBuffer":case "blob":case "formData":case "text":x=await h[R]();break;case "json":{let w=await h.text();x=w?JSON.parse(w):{};break}case "stream":return y.responseStyle==="data"?h.body:{data:h.body,...O}}return R==="json"&&(y.responseValidator&&await y.responseValidator(x),y.responseTransformer&&(x=await y.responseTransformer(x))),y.responseStyle==="data"?x:{data:x,...O}}let E=await h.text(),B;try{B=JSON.parse(E);}catch{}throw B??E}catch(y){let d=y;for(let m of a.error.fns)m&&(d=await m(d,h,f,p));if(d=d||{},u)throw d;return g==="data"?void 0:{error:d,request:f,response:h}}},i=p=>u=>o({...u,method:p}),s=p=>async u=>{let{opts:g,url:f}=await l(u);return Y({...g,body:g.body,method:p,onRequest:async(h,y)=>{let d=new Request(h,y);for(let m of a.request.fns)m&&(d=await m(d,g));return d},serializedBody:$(g),url:f})};return {buildUrl:p=>F({...e,...p}),connect:i("CONNECT"),delete:i("DELETE"),get:i("GET"),getConfig:t,head:i("HEAD"),interceptors:a,options:i("OPTIONS"),patch:i("PATCH"),post:i("POST"),put:i("PUT"),request:o,setConfig:n,sse:{connect:s("CONNECT"),delete:s("DELETE"),get:s("GET"),head:s("HEAD"),options:s("OPTIONS"),patch:s("PATCH"),post:s("POST"),put:s("PUT"),trace:s("TRACE")},trace:i("TRACE")}};var Te={$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"},Ce=Object.entries(Te);function oe(r,e){e||(e=new Map);for(let t of r)"in"in t?t.key&&e.set(t.key,{in:t.in,map:t.map}):"key"in t?e.set(t.key,{map:t.map}):t.args&&oe(t.args,e);return e}function ke(r){for(let[e,t]of Object.entries(r))e!=="body"&&t&&typeof t=="object"&&!Array.isArray(t)&&!Object.keys(t).length&&delete r[e];}function k(r,e){let t={headers:Object.create(null),path:Object.create(null),query:Object.create(null)},n=oe(e);function a(o,i,s){let c=t[o];c===void 0&&(c=Object.create(null),t[o]=c),c[i]=s;}let l;for(let[o,i]of r.entries())if(e[o]&&(l=e[o]),!!l)if("in"in l)if(l.key){let s=n.get(l.key),c=s.map||l.key;s.in&&a(s.in,c,i);}else t.body=i;else for(let[s,c]of Object.entries(i??{})){let p=n.get(s);if(p)if(p.in){let u=p.map||s;a(p.in,u,c);}else t[p.map]=c;else {let u=Ce.find(([g])=>s.startsWith(g));if(u){let[g,f]=u;a(f,s.slice(g.length),c);}else if("allowExtra"in l&&l.allowExtra){for(let[g,f]of Object.entries(l.allowExtra))if(f){a(g,s,c);break}}}}return ke(t),t}var ie=z(A({baseUrl:"http://localhost:8080"}));var V=class{constructor(e){I(this,"client");this.client=e?.client??ie;}},J=class{constructor(){I(this,"defaultKey","default");I(this,"instances",new Map);}get(e){let t=this.instances.get(e??this.defaultKey);if(!t)throw new Error('No SDK client found. Create one with "new EasbotGatewayClient()" to fix this error.');return t}set(e,t){this.instances.set(t??this.defaultKey,e);}},G=class G extends V{constructor(e){super(e),G.__registry.set(this,e?.key);}healthCheck(e){return (e?.client??this.client).get({url:"/health",...e})}getStatus(e){return (e?.client??this.client).get({url:"/status",...e})}listChannels(e){return (e?.client??this.client).get({url:"/channels",...e})}listContacts(e,t){let n=k([e],[{args:[{in:"query",key:"platform"},{in:"query",key:"limit"},{in:"query",key:"offset"}]}]);return (t?.client??this.client).get({url:"/contacts",...t,...n})}getContact(e,t){let n=k([e],[{args:[{in:"path",key:"uid"}]}]);return (t?.client??this.client).get({url:"/contacts/{uid}",...t,...n})}listSessions(e,t){let n=k([e],[{args:[{in:"query",key:"limit"},{in:"query",key:"offset"},{in:"query",key:"platform"},{in:"query",key:"channelId"},{in:"query",key:"userId"},{in:"query",key:"chatId"}]}]);return (t?.client??this.client).get({url:"/sessions",...t,...n})}getSession(e,t){let n=k([e],[{args:[{in:"path",key:"id"}]}]);return (t?.client??this.client).get({url:"/sessions/{id}",...t,...n})}createSession(e,t){let n=k([e],[{args:[{in:"body",key:"title"},{in:"body",key:"channel"}]}]);return (t?.client??this.client).post({url:"/session",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}sendMessage(e,t){let n=k([e],[{args:[{in:"path",key:"id"},{in:"body",key:"content"},{in:"body",key:"channel"},{in:"body",key:"userId"},{in:"body",key:"chatId"},{in:"body",key:"messageType"},{in:"body",key:"processorId"},{in:"body",key:"agent"},{in:"body",key:"replyToMessageId"}]}]);return (t?.client??this.client).post({url:"/session/{id}/prompt",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}};I(G,"__registry",new J);var L=G;function ae(r){if(r?.fetch||(r={...r,fetch:n=>(n.timeout=false,fetch(n))}),r?.directory){let n=/[^\x00-\x7F]/.test(r.directory)?encodeURIComponent(r.directory):r.directory;r.headers={...r.headers,"x-easbot-directory|":n};}let e=z(r);return new L({client:e})}function qe(r){if(r.includes("/")||r.includes("\\"))return r;if(process.platform==="win32"){let e=r.toLowerCase();if(!e.endsWith(".cmd")&&!e.endsWith(".exe")&&!e.endsWith(".bat"))return `${r}.cmd`}return r}function Ie(r,e,t){let n=r.config??{};return {...n,server:{...n.server??{},...e!==void 0?{port:e}:{},...t?{hostname:t}:{}}}}var De=8080,ve="127.0.0.1",Ae=3e5;async function le(r){let t=Object.assign({hostname:ve,port:De,timeout:Ae},r??{}),n=r&&"port"in r?r.port:void 0,a=r&&"hostname"in r?r.hostname:void 0,l=["gateway","start"],o=spawn(qe("easbot"),l,{signal:t.signal,shell:process.platform==="win32",env:{...process.env,EASBOT_CONFIG_CONTENT:JSON.stringify(Ie(t,n,a))}});return {url:await new Promise((s,c)=>{let p=false,u=null,g=null,f=()=>{u&&clearTimeout(u),g&&clearInterval(g);},h=`${t.port===443?"https":"http"}://${t.hostname}:${t.port}/health`,y=()=>{g=setInterval(async()=>{try{let d=new AbortController,m=setTimeout(()=>d.abort(),2e3),C=await fetch(h,{signal:d.signal});clearTimeout(m),C.ok&&(p||(p=!0,f(),s(h)));}catch{}},500);};o.stdout?.on("data",d=>{let m=d.toString();for(let C of m.split(`
|
|
7
|
+
`))if(C.startsWith("easbot gateway listening")){let O=C.match(/on\s+(https?:\/\/[^\s]+)/);if(O&&!p){p=true,f(),s(O[1]);return}}}),o.stderr?.on("data",()=>{}),o.on("exit",d=>{if(p)return;f();let m=`Gateway server exited with code ${d}`;c(new Error(m));}),o.on("error",d=>{p||(f(),c(d));}),u=setTimeout(()=>{p||(f(),c(new Error(`Timeout waiting for gateway server to start after ${t.timeout}ms`)));},t.timeout),t.signal&&t.signal.addEventListener("abort",()=>{p||(f(),c(new Error("Aborted")));}),y();}),close(){o.kill();}}}async function Gt(r){let e=await le({...r});return {client:ae({baseUrl:e.url}),server:e}}export{L as EasbotGatewayClient,Gt as createEasbotGateway,ae as createEasbotGatewayClient,le as createEasbotGatewayServer};
|
package/package.json
CHANGED
|
@@ -1,6 +1,78 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easbot/gateway-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.3.29",
|
|
4
|
+
"description": "Easbot Gateway SDK — REST + WebSocket client for the EasBot Gateway server (multi-channel messaging routing hub)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"module": "dist/index.mjs",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"easbot",
|
|
19
|
+
"gateway",
|
|
20
|
+
"sdk",
|
|
21
|
+
"bot",
|
|
22
|
+
"messaging",
|
|
23
|
+
"multi-channel",
|
|
24
|
+
"client"
|
|
25
|
+
],
|
|
26
|
+
"author": "houjallen",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/houjallen/easbot.git",
|
|
31
|
+
"directory": "packages/gateway-sdk"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/houjallen/easbot/tree/main/packages/gateway-sdk#readme",
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/houjallen/easbot/issues"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"README.md",
|
|
40
|
+
"README.en.md",
|
|
41
|
+
"LICENSE"
|
|
42
|
+
],
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"commander": "^15.0.0",
|
|
45
|
+
"events": "^3.3.0",
|
|
46
|
+
"zod": "^4.4.3",
|
|
47
|
+
"@easbot/types": "0.3.29"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/node": "^25.9.5",
|
|
51
|
+
"@hey-api/openapi-ts": "0.99.0",
|
|
52
|
+
"tsup": "^8.5.1",
|
|
53
|
+
"typescript": "^6.0.3",
|
|
54
|
+
"vitest": "^4.1.10"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=22.22.2"
|
|
58
|
+
},
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"dev": "tsup --watch --env.NODE_ENV development",
|
|
64
|
+
"build": "node scripts/build.mjs",
|
|
65
|
+
"test": "vitest",
|
|
66
|
+
"test:run": "vitest run",
|
|
67
|
+
"test:coverage": "vitest run --coverage",
|
|
68
|
+
"lint": "biome check .",
|
|
69
|
+
"lint:fix": "biome check --write .",
|
|
70
|
+
"lint:report": "biome check --reporter=summary .",
|
|
71
|
+
"format": "biome format .",
|
|
72
|
+
"format:fix": "biome format --write .",
|
|
73
|
+
"type-check": "tsc --noEmit",
|
|
74
|
+
"clean": "rimraf dist node_modules",
|
|
75
|
+
"publish:npm": "bash scripts/publish.sh",
|
|
76
|
+
"publish:npm:win": "powershell -ExecutionPolicy Bypass -File scripts/publish.ps1"
|
|
77
|
+
}
|
|
6
78
|
}
|