2dai-sdk 1.4.0
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.md +1287 -0
- package/dist/client.d.ts +222 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +643 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +175 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +260 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +438 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +61 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for 2DAI SDK
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Watermark position options
|
|
6
|
+
*/
|
|
7
|
+
export type WatermarkPosition = 'center' | 'northwest' | 'north' | 'northeast' | 'west' | 'east' | 'southwest' | 'south' | 'southeast' | 'top-left' | 'top-center' | 'top-right' | 'middle-left' | 'middle-center' | 'middle-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
8
|
+
/**
|
|
9
|
+
* Watermark options for images and videos
|
|
10
|
+
*/
|
|
11
|
+
export interface WatermarkOptions {
|
|
12
|
+
watermark?: string;
|
|
13
|
+
watermarkPosition?: WatermarkPosition;
|
|
14
|
+
watermarkAsTiles?: boolean;
|
|
15
|
+
copyright?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Style preset for image generation
|
|
19
|
+
*/
|
|
20
|
+
export interface StylePreset {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Format preset for image generation
|
|
27
|
+
*/
|
|
28
|
+
export interface FormatPreset {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Options for image generation
|
|
36
|
+
*/
|
|
37
|
+
export interface ImageGenerationOptions {
|
|
38
|
+
prompt: string;
|
|
39
|
+
style?: StylePreset | string;
|
|
40
|
+
format?: FormatPreset | string;
|
|
41
|
+
negativePrompt?: string;
|
|
42
|
+
seed?: number;
|
|
43
|
+
width?: number;
|
|
44
|
+
height?: number;
|
|
45
|
+
watermark?: string;
|
|
46
|
+
watermarkPosition?: WatermarkPosition;
|
|
47
|
+
watermarkAsTiles?: boolean;
|
|
48
|
+
copyright?: string;
|
|
49
|
+
/** Enable resize padding (default: false) */
|
|
50
|
+
resizePad?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Options for video generation
|
|
54
|
+
*/
|
|
55
|
+
export interface VideoGenerationOptions {
|
|
56
|
+
imageId?: string;
|
|
57
|
+
imageBuffer?: Buffer;
|
|
58
|
+
duration?: number;
|
|
59
|
+
fps?: number;
|
|
60
|
+
watermark?: string;
|
|
61
|
+
watermarkPosition?: WatermarkPosition;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Options for text generation
|
|
65
|
+
*/
|
|
66
|
+
export interface TextGenerationOptions {
|
|
67
|
+
prompt: string;
|
|
68
|
+
system?: string;
|
|
69
|
+
memory?: string[];
|
|
70
|
+
jsonFormat?: boolean;
|
|
71
|
+
jsonTemplate?: {
|
|
72
|
+
[key: string]: string;
|
|
73
|
+
};
|
|
74
|
+
useRandomSeed?: boolean;
|
|
75
|
+
askKnowledge?: {
|
|
76
|
+
sources?: string[];
|
|
77
|
+
query?: string;
|
|
78
|
+
};
|
|
79
|
+
useMarkdown?: boolean;
|
|
80
|
+
/** Image ID from CDN for vision/image analysis */
|
|
81
|
+
imageId?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Options for AI image upscaling (img2ximg)
|
|
85
|
+
*/
|
|
86
|
+
export interface UpscaleOptions {
|
|
87
|
+
/** Upscale factor: 2, 3, or 4 (default: 2) */
|
|
88
|
+
factor?: number;
|
|
89
|
+
/** Seed for reproducible results */
|
|
90
|
+
seed?: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Result from image generation
|
|
94
|
+
*/
|
|
95
|
+
export interface ImageGenerationResult {
|
|
96
|
+
success: boolean;
|
|
97
|
+
imageId: string;
|
|
98
|
+
width: number;
|
|
99
|
+
height: number;
|
|
100
|
+
seed?: number;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Result from video generation
|
|
104
|
+
*/
|
|
105
|
+
export interface VideoGenerationResult {
|
|
106
|
+
success: boolean;
|
|
107
|
+
videoId: string;
|
|
108
|
+
duration: number;
|
|
109
|
+
fps: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Result from text generation
|
|
113
|
+
*/
|
|
114
|
+
export interface TextGenerationResult {
|
|
115
|
+
success: boolean;
|
|
116
|
+
response: string;
|
|
117
|
+
json?: any;
|
|
118
|
+
inputTokens?: number;
|
|
119
|
+
outputTokens?: number;
|
|
120
|
+
totalTokens?: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Result from AI image upscaling
|
|
124
|
+
*/
|
|
125
|
+
export interface UpscaleResult {
|
|
126
|
+
success: boolean;
|
|
127
|
+
imageId: string;
|
|
128
|
+
width: number;
|
|
129
|
+
height: number;
|
|
130
|
+
seed?: number;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* CDN file metadata
|
|
134
|
+
*/
|
|
135
|
+
export interface CDNFileMetadata {
|
|
136
|
+
fileId: string;
|
|
137
|
+
url: string;
|
|
138
|
+
mimeType: string;
|
|
139
|
+
size: number;
|
|
140
|
+
width?: number;
|
|
141
|
+
height?: number;
|
|
142
|
+
duration?: number;
|
|
143
|
+
fps?: number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* API error response
|
|
147
|
+
*/
|
|
148
|
+
export interface APIError {
|
|
149
|
+
code: string;
|
|
150
|
+
message: string;
|
|
151
|
+
details?: any;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Rate limit information
|
|
155
|
+
*/
|
|
156
|
+
export interface RateLimitInfo {
|
|
157
|
+
operation: 'image' | 'video' | 'llm' | 'cdn';
|
|
158
|
+
current: {
|
|
159
|
+
requestsPer15Min: number;
|
|
160
|
+
requestsPerDay: number;
|
|
161
|
+
tokensPer15Min?: number;
|
|
162
|
+
tokensPerDay?: number;
|
|
163
|
+
};
|
|
164
|
+
limit: {
|
|
165
|
+
requestsPer15Min: number;
|
|
166
|
+
requestsPerDay: number;
|
|
167
|
+
tokensPer15Min?: number;
|
|
168
|
+
tokensPerDay?: number;
|
|
169
|
+
};
|
|
170
|
+
resetAt: {
|
|
171
|
+
window15Min: string;
|
|
172
|
+
daily: string;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Current usage for a single operation
|
|
177
|
+
*/
|
|
178
|
+
export interface OperationUsage {
|
|
179
|
+
current: {
|
|
180
|
+
requestsPer15Min: number;
|
|
181
|
+
requestsPerDay: number;
|
|
182
|
+
tokensPer15Min?: number;
|
|
183
|
+
tokensPerDay?: number;
|
|
184
|
+
};
|
|
185
|
+
remaining: {
|
|
186
|
+
requestsPer15Min: number;
|
|
187
|
+
requestsPerDay: number;
|
|
188
|
+
};
|
|
189
|
+
resetAt: {
|
|
190
|
+
window15Min: string;
|
|
191
|
+
daily: string;
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* API key settings
|
|
196
|
+
*/
|
|
197
|
+
export interface APIKeySettings {
|
|
198
|
+
key: string;
|
|
199
|
+
name: string;
|
|
200
|
+
status: string;
|
|
201
|
+
rateLimits: {
|
|
202
|
+
image: {
|
|
203
|
+
requestsPer15Min: number;
|
|
204
|
+
requestsPerDay: number;
|
|
205
|
+
};
|
|
206
|
+
video: {
|
|
207
|
+
requestsPer15Min: number;
|
|
208
|
+
requestsPerDay: number;
|
|
209
|
+
};
|
|
210
|
+
llm: {
|
|
211
|
+
requestsPer15Min: number;
|
|
212
|
+
requestsPerDay: number;
|
|
213
|
+
tokensPer15Min: number;
|
|
214
|
+
tokensPerDay: number;
|
|
215
|
+
maxPromptLength: number;
|
|
216
|
+
};
|
|
217
|
+
cdn: {
|
|
218
|
+
requestsPer15Min: number;
|
|
219
|
+
requestsPerDay: number;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
currentUsage?: {
|
|
223
|
+
image: OperationUsage;
|
|
224
|
+
video: OperationUsage;
|
|
225
|
+
llm: OperationUsage;
|
|
226
|
+
cdn: OperationUsage;
|
|
227
|
+
};
|
|
228
|
+
llmSettings?: any;
|
|
229
|
+
createdAt?: string;
|
|
230
|
+
lastUsedAt?: string;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Client configuration options
|
|
234
|
+
*/
|
|
235
|
+
export interface ClientOptions {
|
|
236
|
+
apiKey: string;
|
|
237
|
+
baseUrl?: string;
|
|
238
|
+
timeout?: number;
|
|
239
|
+
retries?: number;
|
|
240
|
+
debug?: boolean;
|
|
241
|
+
wsAutoReconnect?: boolean;
|
|
242
|
+
wsReconnectIntervalMs?: number;
|
|
243
|
+
wsMaxReconnectDelayMs?: number;
|
|
244
|
+
wsPingIntervalMs?: number;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* WebSocket request for text-to-image generation
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```typescript
|
|
251
|
+
* await client.wsGenerateImage({
|
|
252
|
+
* prompt: 'A beautiful sunset over mountains',
|
|
253
|
+
* style: 'realistic',
|
|
254
|
+
* format: 'landscape'
|
|
255
|
+
* });
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
export interface WsImageRequest {
|
|
259
|
+
/** Text description of the image to generate */
|
|
260
|
+
prompt: string;
|
|
261
|
+
/** Style preset: 'raw' | 'realistic' | 'text' | 'ciniji' | 'portrait' | 'cine' | 'sport' | 'fashion' | 'niji' | 'anime' | 'manga' | 'paint' */
|
|
262
|
+
style?: string;
|
|
263
|
+
/** Format preset: 'portrait' | 'landscape' | 'profile' | 'story' | 'post' | 'smartphone' | 'banner' */
|
|
264
|
+
format?: string;
|
|
265
|
+
/** Negative prompt - what to avoid in the image */
|
|
266
|
+
negativePrompt?: string;
|
|
267
|
+
/** Seed for reproducible results (0-2000000000) */
|
|
268
|
+
seed?: number;
|
|
269
|
+
/** Custom width (320-1344) - overrides format */
|
|
270
|
+
width?: number;
|
|
271
|
+
/** Custom height (320-1344) - overrides format */
|
|
272
|
+
height?: number;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* WebSocket request for image-to-image editing
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```typescript
|
|
279
|
+
* await client.wsGenerateImage({
|
|
280
|
+
* imageId: 'existing-image-id',
|
|
281
|
+
* prompt: 'add dramatic lighting'
|
|
282
|
+
* });
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
export interface WsImg2ImgRequest {
|
|
286
|
+
/** Source image ID from CDN to edit */
|
|
287
|
+
imageId: string;
|
|
288
|
+
/** Edit instructions describing the changes */
|
|
289
|
+
prompt: string;
|
|
290
|
+
/** Negative prompt - what to avoid in the image */
|
|
291
|
+
negativePrompt?: string;
|
|
292
|
+
/** Seed for reproducible results */
|
|
293
|
+
seed?: number;
|
|
294
|
+
/** Custom output width (320-1344) for resizing */
|
|
295
|
+
width?: number;
|
|
296
|
+
/** Custom output height (320-1344) for resizing */
|
|
297
|
+
height?: number;
|
|
298
|
+
/** Enable resize padding (default: false) */
|
|
299
|
+
resizePad?: boolean;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* WebSocket request for image-to-video generation
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* ```typescript
|
|
306
|
+
* await client.wsGenerateVideo({
|
|
307
|
+
* imageId: 'source-image-id',
|
|
308
|
+
* duration: 5,
|
|
309
|
+
* fps: 16
|
|
310
|
+
* });
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
export interface WsVideoRequest {
|
|
314
|
+
/** Source image ID from CDN */
|
|
315
|
+
imageId: string;
|
|
316
|
+
/** Video duration in seconds (1-10, default: 5) */
|
|
317
|
+
duration?: number;
|
|
318
|
+
/** Frames per second (8-60, default: 16) */
|
|
319
|
+
fps?: number;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* WebSocket request for LLM text generation
|
|
323
|
+
*
|
|
324
|
+
* @example Basic text generation
|
|
325
|
+
* ```typescript
|
|
326
|
+
* await client.wsGenerateLlm({
|
|
327
|
+
* prompt: 'Explain quantum computing in simple terms'
|
|
328
|
+
* });
|
|
329
|
+
* ```
|
|
330
|
+
*
|
|
331
|
+
* @example With system prompt and memory
|
|
332
|
+
* ```typescript
|
|
333
|
+
* await client.wsGenerateLlm({
|
|
334
|
+
* prompt: 'What was my previous question?',
|
|
335
|
+
* system: 'You are a helpful coding assistant',
|
|
336
|
+
* memory: ['User: How do I use TypeScript?', 'Assistant: TypeScript is...']
|
|
337
|
+
* });
|
|
338
|
+
* ```
|
|
339
|
+
*
|
|
340
|
+
* @example JSON output
|
|
341
|
+
* ```typescript
|
|
342
|
+
* await client.wsGenerateLlm({
|
|
343
|
+
* prompt: 'List 3 programming languages',
|
|
344
|
+
* jsonFormat: true,
|
|
345
|
+
* jsonTemplate: { languages: 'array of language names' }
|
|
346
|
+
* });
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
export interface WsLlmRequest {
|
|
350
|
+
/** The prompt/question to send to the LLM */
|
|
351
|
+
prompt: string;
|
|
352
|
+
/** System prompt to set the LLM's behavior/persona */
|
|
353
|
+
system?: string;
|
|
354
|
+
/** Conversation history for context */
|
|
355
|
+
memory?: string[];
|
|
356
|
+
/** Enable JSON output mode */
|
|
357
|
+
jsonFormat?: boolean;
|
|
358
|
+
/** Template describing expected JSON structure */
|
|
359
|
+
jsonTemplate?: {
|
|
360
|
+
[key: string]: string;
|
|
361
|
+
};
|
|
362
|
+
/** Use random seed for varied responses */
|
|
363
|
+
useRandomSeed?: boolean;
|
|
364
|
+
/** Enable markdown formatting in response */
|
|
365
|
+
useMarkdown?: boolean;
|
|
366
|
+
/** Image ID from CDN for vision/image analysis */
|
|
367
|
+
imageId?: string;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* WebSocket request for AI image upscaling (img2ximg)
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* ```typescript
|
|
374
|
+
* await client.wsUpscaleImage({
|
|
375
|
+
* imageId: 'source-image-id',
|
|
376
|
+
* factor: 2
|
|
377
|
+
* });
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
380
|
+
export interface WsUpscaleRequest {
|
|
381
|
+
/** Source image ID from CDN to upscale */
|
|
382
|
+
imageId: string;
|
|
383
|
+
/** Upscale factor: 2, 3, or 4 (default: 2) */
|
|
384
|
+
factor?: number;
|
|
385
|
+
/** Seed for reproducible results */
|
|
386
|
+
seed?: number;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* WebSocket response for image generation
|
|
390
|
+
*/
|
|
391
|
+
export interface WsImageResponse {
|
|
392
|
+
result: {
|
|
393
|
+
imageId: string;
|
|
394
|
+
width: number;
|
|
395
|
+
height: number;
|
|
396
|
+
seed: number;
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* WebSocket response for video generation
|
|
401
|
+
*/
|
|
402
|
+
export interface WsVideoResponse {
|
|
403
|
+
result: {
|
|
404
|
+
videoId: string;
|
|
405
|
+
duration: number;
|
|
406
|
+
fps: number;
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* WebSocket response for LLM generation
|
|
411
|
+
*/
|
|
412
|
+
export interface WsLlmResponse {
|
|
413
|
+
result: {
|
|
414
|
+
text: string;
|
|
415
|
+
json?: any;
|
|
416
|
+
tokensUsed: number;
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* WebSocket response for image upscaling
|
|
421
|
+
*/
|
|
422
|
+
export interface WsUpscaleResponse {
|
|
423
|
+
result: {
|
|
424
|
+
imageId: string;
|
|
425
|
+
width: number;
|
|
426
|
+
height: number;
|
|
427
|
+
seed: number;
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Union type for all WebSocket request data
|
|
432
|
+
*/
|
|
433
|
+
export type WsRequestData = WsImageRequest | WsImg2ImgRequest | WsVideoRequest | WsLlmRequest | WsUpscaleRequest;
|
|
434
|
+
/**
|
|
435
|
+
* Union type for all WebSocket response data
|
|
436
|
+
*/
|
|
437
|
+
export type WsResponseData = WsImageResponse | WsVideoResponse | WsLlmResponse | WsUpscaleResponse;
|
|
438
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAEzB,QAAQ,GACR,WAAW,GAAG,OAAO,GAAG,WAAW,GACnC,MAAM,GAAG,MAAM,GACf,WAAW,GAAG,OAAO,GAAG,WAAW,GAEnC,UAAU,GAAG,YAAY,GAAG,WAAW,GACvC,aAAa,GAAG,eAAe,GAAG,cAAc,GAChD,aAAa,GAAG,eAAe,GAAG,cAAc,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC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;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,gBAAgB,GAAG,cAAc,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAEjH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,eAAe,GAAG,eAAe,GAAG,aAAa,GAAG,iBAAiB,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "2dai-sdk",
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"description": "Official 2DAI SDK - Multimodal AI for autonomous image/video generation, vision analysis and agentic LLM workflows",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"2dai",
|
|
7
|
+
"ai",
|
|
8
|
+
"multimodal",
|
|
9
|
+
"agentic",
|
|
10
|
+
"autonomous",
|
|
11
|
+
"image-generation",
|
|
12
|
+
"video-generation",
|
|
13
|
+
"vision",
|
|
14
|
+
"llm"
|
|
15
|
+
],
|
|
16
|
+
"author": "2DAI",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/2DAICommunity/2dai-cloud-sdk.git"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/2DAICommunity/2dai-cloud-sdk#readme",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/2DAICommunity/2dai-cloud-sdk/issues"
|
|
25
|
+
},
|
|
26
|
+
"main": "dist/index.js",
|
|
27
|
+
"types": "dist/index.d.ts",
|
|
28
|
+
"files": [
|
|
29
|
+
"dist/**/*",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc",
|
|
35
|
+
"build:watch": "tsc --watch",
|
|
36
|
+
"test": "jest",
|
|
37
|
+
"test:rest": "jest tests/rest.test.ts --forceExit",
|
|
38
|
+
"test:ws": "jest tests/websocket.test.ts --forceExit",
|
|
39
|
+
"test:coverage": "jest --coverage"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"axios": "^1.12.2",
|
|
43
|
+
"ws": "^8.18.1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/jest": "^29.5.14",
|
|
47
|
+
"@types/mocha": "^10.0.10",
|
|
48
|
+
"@types/node": "~22.1.0",
|
|
49
|
+
"@types/ws": "^8.18.1",
|
|
50
|
+
"jest": "^29.7.0",
|
|
51
|
+
"ts-jest": "^29.2.5",
|
|
52
|
+
"ts-node": "^10.9.2",
|
|
53
|
+
"typescript": "^5.7.3"
|
|
54
|
+
},
|
|
55
|
+
"overrides": {
|
|
56
|
+
"uuid": "^11.0.4"
|
|
57
|
+
},
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=18.0.0"
|
|
60
|
+
}
|
|
61
|
+
}
|