@bodhiapp/ts-client 0.1.4 → 0.1.5

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.
@@ -1,6 +1,5 @@
1
1
  export type AliasResponse = {
2
2
  alias: string;
3
- chat_template: string;
4
3
  context_params: GptContextParams;
5
4
  filename: string;
6
5
  model_params: {};
@@ -29,10 +28,6 @@ export type ApiTokenResponse = {
29
28
  * Application information and status
30
29
  */
31
30
  export type AppInfo = {
32
- /**
33
- * Whether authentication is enabled
34
- */
35
- authz: boolean;
36
31
  /**
37
32
  * Current application status
38
33
  */
@@ -43,6 +38,25 @@ export type AppInfo = {
43
38
  version: string;
44
39
  };
45
40
  export type AppStatus = 'setup' | 'ready' | 'resource-admin';
41
+ export type AuthCallbackRequest = {
42
+ /**
43
+ * OAuth authorization code from successful authentication
44
+ */
45
+ code?: string | null;
46
+ /**
47
+ * OAuth error code if authentication failed
48
+ */
49
+ error?: string | null;
50
+ /**
51
+ * OAuth error description if authentication failed
52
+ */
53
+ error_description?: string | null;
54
+ /**
55
+ * OAuth state parameter for CSRF protection
56
+ */
57
+ state?: string | null;
58
+ [key: string]: string | (string | null) | (string | null) | (string | null) | (string | null) | undefined;
59
+ };
46
60
  export type ChatRequest = {
47
61
  format?: string | null;
48
62
  keep_alive?: null | Duration;
@@ -51,24 +65,6 @@ export type ChatRequest = {
51
65
  options?: null | Options;
52
66
  stream?: boolean | null;
53
67
  };
54
- /**
55
- * Chat template identifier for built-in templates
56
- */
57
- export type ChatTemplateId = 'llama3' | 'llama2' | 'llama2-legacy' | 'phi3' | 'gemma' | 'deepseek' | 'command-r' | 'openchat' | 'tinyllama';
58
- /**
59
- * Chat template type that can be either built-in or from a repository
60
- */
61
- export type ChatTemplateType = 'Embedded' | {
62
- /**
63
- * Built-in chat template using Id
64
- */
65
- Id: ChatTemplateId;
66
- } | {
67
- /**
68
- * Custom chat template from a repository
69
- */
70
- Repo: Repo;
71
- };
72
68
  /**
73
69
  * Request to create a new API token
74
70
  */
@@ -217,7 +213,6 @@ export type Options = {
217
213
  export type PaginatedResponseAliasResponse = {
218
214
  data: Array<{
219
215
  alias: string;
220
- chat_template: string;
221
216
  context_params: GptContextParams;
222
217
  filename: string;
223
218
  model_params: {};
@@ -280,6 +275,12 @@ export type PingResponse = {
280
275
  */
281
276
  message: string;
282
277
  };
278
+ export type RedirectResponse = {
279
+ /**
280
+ * The URL to redirect to for OAuth authentication
281
+ */
282
+ location: string;
283
+ };
283
284
  export type Repo = {
284
285
  name: string;
285
286
  user: string;
@@ -305,15 +306,10 @@ export type SettingMetadata = {
305
306
  };
306
307
  export type SettingSource = 'system' | 'command_line' | 'environment' | 'settings_file' | 'default';
307
308
  /**
308
- * Request to setup the application in authenticated or non-authenticated mode
309
+ * Request to setup the application in authenticated mode
309
310
  */
310
311
  export type SetupRequest = {
311
- /**
312
- * Whether to enable authentication
313
- * - true: Setup app in authenticated mode with role-based access
314
- * - false: Setup app in non-authenticated mode for open access
315
- */
316
- authz: boolean;
312
+ [key: string]: unknown;
317
313
  };
318
314
  /**
319
315
  * Response containing the updated application status after setup
@@ -452,26 +448,54 @@ export type ListOllamaModelsResponses = {
452
448
  200: ModelsResponse;
453
449
  };
454
450
  export type ListOllamaModelsResponse = ListOllamaModelsResponses[keyof ListOllamaModelsResponses];
455
- export type ListChatTemplatesData = {
456
- body?: never;
451
+ export type CompleteOAuthFlowData = {
452
+ body: AuthCallbackRequest;
457
453
  path?: never;
458
454
  query?: never;
459
- url: '/bodhi/v1/chat_templates';
455
+ url: '/bodhi/v1/auth/callback';
460
456
  };
461
- export type ListChatTemplatesErrors = {
457
+ export type CompleteOAuthFlowErrors = {
458
+ /**
459
+ * OAuth error or invalid request
460
+ */
461
+ 422: OpenAiApiError;
462
462
  /**
463
463
  * Internal server error
464
464
  */
465
465
  500: OpenAiApiError;
466
466
  };
467
- export type ListChatTemplatesError = ListChatTemplatesErrors[keyof ListChatTemplatesErrors];
468
- export type ListChatTemplatesResponses = {
467
+ export type CompleteOAuthFlowError = CompleteOAuthFlowErrors[keyof CompleteOAuthFlowErrors];
468
+ export type CompleteOAuthFlowResponses = {
469
469
  /**
470
- * List of available chat templates
470
+ * OAuth flow completed successfully, return redirect URL
471
471
  */
472
- 200: Array<ChatTemplateType>;
472
+ 200: RedirectResponse;
473
+ };
474
+ export type CompleteOAuthFlowResponse = CompleteOAuthFlowResponses[keyof CompleteOAuthFlowResponses];
475
+ export type InitiateOAuthFlowData = {
476
+ body: unknown;
477
+ path?: never;
478
+ query?: never;
479
+ url: '/bodhi/v1/auth/initiate';
473
480
  };
474
- export type ListChatTemplatesResponse = ListChatTemplatesResponses[keyof ListChatTemplatesResponses];
481
+ export type InitiateOAuthFlowErrors = {
482
+ /**
483
+ * Internal server error
484
+ */
485
+ 500: OpenAiApiError;
486
+ };
487
+ export type InitiateOAuthFlowError = InitiateOAuthFlowErrors[keyof InitiateOAuthFlowErrors];
488
+ export type InitiateOAuthFlowResponses = {
489
+ /**
490
+ * User already authenticated, return home page URL
491
+ */
492
+ 200: RedirectResponse;
493
+ /**
494
+ * User not authenticated, return OAuth authorization URL
495
+ */
496
+ 201: RedirectResponse;
497
+ };
498
+ export type InitiateOAuthFlowResponse = InitiateOAuthFlowResponses[keyof InitiateOAuthFlowResponses];
475
499
  export type GetAppInfoData = {
476
500
  body?: never;
477
501
  path?: never;
@@ -507,10 +531,11 @@ export type LogoutUserErrors = {
507
531
  export type LogoutUserError = LogoutUserErrors[keyof LogoutUserErrors];
508
532
  export type LogoutUserResponses = {
509
533
  /**
510
- * Logout successful, redirects to login page
534
+ * Logout successful, return redirect URL
511
535
  */
512
- 200: unknown;
536
+ 200: RedirectResponse;
513
537
  };
538
+ export type LogoutUserResponse = LogoutUserResponses[keyof LogoutUserResponses];
514
539
  export type ListModelFilesData = {
515
540
  body?: never;
516
541
  path?: never;
@@ -2,7 +2,6 @@
2
2
 
3
3
  export type AliasResponse = {
4
4
  alias: string;
5
- chat_template: string;
6
5
  context_params: GptContextParams;
7
6
  filename: string;
8
7
  model_params: {};
@@ -34,10 +33,6 @@ export type ApiTokenResponse = {
34
33
  * Application information and status
35
34
  */
36
35
  export type AppInfo = {
37
- /**
38
- * Whether authentication is enabled
39
- */
40
- authz: boolean;
41
36
  /**
42
37
  * Current application status
43
38
  */
@@ -50,6 +45,26 @@ export type AppInfo = {
50
45
 
51
46
  export type AppStatus = 'setup' | 'ready' | 'resource-admin';
52
47
 
48
+ export type AuthCallbackRequest = {
49
+ /**
50
+ * OAuth authorization code from successful authentication
51
+ */
52
+ code?: string | null;
53
+ /**
54
+ * OAuth error code if authentication failed
55
+ */
56
+ error?: string | null;
57
+ /**
58
+ * OAuth error description if authentication failed
59
+ */
60
+ error_description?: string | null;
61
+ /**
62
+ * OAuth state parameter for CSRF protection
63
+ */
64
+ state?: string | null;
65
+ [key: string]: string | (string | null) | (string | null) | (string | null) | (string | null) | undefined;
66
+ };
67
+
53
68
  export type ChatRequest = {
54
69
  format?: string | null;
55
70
  keep_alive?: null | Duration;
@@ -59,26 +74,6 @@ export type ChatRequest = {
59
74
  stream?: boolean | null;
60
75
  };
61
76
 
62
- /**
63
- * Chat template identifier for built-in templates
64
- */
65
- export type ChatTemplateId = 'llama3' | 'llama2' | 'llama2-legacy' | 'phi3' | 'gemma' | 'deepseek' | 'command-r' | 'openchat' | 'tinyllama';
66
-
67
- /**
68
- * Chat template type that can be either built-in or from a repository
69
- */
70
- export type ChatTemplateType = 'Embedded' | {
71
- /**
72
- * Built-in chat template using Id
73
- */
74
- Id: ChatTemplateId;
75
- } | {
76
- /**
77
- * Custom chat template from a repository
78
- */
79
- Repo: Repo;
80
- };
81
-
82
77
  /**
83
78
  * Request to create a new API token
84
79
  */
@@ -244,7 +239,6 @@ export type Options = {
244
239
  export type PaginatedResponseAliasResponse = {
245
240
  data: Array<{
246
241
  alias: string;
247
- chat_template: string;
248
242
  context_params: GptContextParams;
249
243
  filename: string;
250
244
  model_params: {};
@@ -312,6 +306,13 @@ export type PingResponse = {
312
306
  message: string;
313
307
  };
314
308
 
309
+ export type RedirectResponse = {
310
+ /**
311
+ * The URL to redirect to for OAuth authentication
312
+ */
313
+ location: string;
314
+ };
315
+
315
316
  export type Repo = {
316
317
  name: string;
317
318
  user: string;
@@ -341,15 +342,10 @@ export type SettingMetadata = {
341
342
  export type SettingSource = 'system' | 'command_line' | 'environment' | 'settings_file' | 'default';
342
343
 
343
344
  /**
344
- * Request to setup the application in authenticated or non-authenticated mode
345
+ * Request to setup the application in authenticated mode
345
346
  */
346
347
  export type SetupRequest = {
347
- /**
348
- * Whether to enable authentication
349
- * - true: Setup app in authenticated mode with role-based access
350
- * - false: Setup app in non-authenticated mode for open access
351
- */
352
- authz: boolean;
348
+ [key: string]: unknown;
353
349
  };
354
350
 
355
351
  /**
@@ -510,30 +506,63 @@ export type ListOllamaModelsResponses = {
510
506
 
511
507
  export type ListOllamaModelsResponse = ListOllamaModelsResponses[keyof ListOllamaModelsResponses];
512
508
 
513
- export type ListChatTemplatesData = {
514
- body?: never;
509
+ export type CompleteOAuthFlowData = {
510
+ body: AuthCallbackRequest;
511
+ path?: never;
512
+ query?: never;
513
+ url: '/bodhi/v1/auth/callback';
514
+ };
515
+
516
+ export type CompleteOAuthFlowErrors = {
517
+ /**
518
+ * OAuth error or invalid request
519
+ */
520
+ 422: OpenAiApiError;
521
+ /**
522
+ * Internal server error
523
+ */
524
+ 500: OpenAiApiError;
525
+ };
526
+
527
+ export type CompleteOAuthFlowError = CompleteOAuthFlowErrors[keyof CompleteOAuthFlowErrors];
528
+
529
+ export type CompleteOAuthFlowResponses = {
530
+ /**
531
+ * OAuth flow completed successfully, return redirect URL
532
+ */
533
+ 200: RedirectResponse;
534
+ };
535
+
536
+ export type CompleteOAuthFlowResponse = CompleteOAuthFlowResponses[keyof CompleteOAuthFlowResponses];
537
+
538
+ export type InitiateOAuthFlowData = {
539
+ body: unknown;
515
540
  path?: never;
516
541
  query?: never;
517
- url: '/bodhi/v1/chat_templates';
542
+ url: '/bodhi/v1/auth/initiate';
518
543
  };
519
544
 
520
- export type ListChatTemplatesErrors = {
545
+ export type InitiateOAuthFlowErrors = {
521
546
  /**
522
547
  * Internal server error
523
548
  */
524
549
  500: OpenAiApiError;
525
550
  };
526
551
 
527
- export type ListChatTemplatesError = ListChatTemplatesErrors[keyof ListChatTemplatesErrors];
552
+ export type InitiateOAuthFlowError = InitiateOAuthFlowErrors[keyof InitiateOAuthFlowErrors];
528
553
 
529
- export type ListChatTemplatesResponses = {
554
+ export type InitiateOAuthFlowResponses = {
530
555
  /**
531
- * List of available chat templates
556
+ * User already authenticated, return home page URL
532
557
  */
533
- 200: Array<ChatTemplateType>;
558
+ 200: RedirectResponse;
559
+ /**
560
+ * User not authenticated, return OAuth authorization URL
561
+ */
562
+ 201: RedirectResponse;
534
563
  };
535
564
 
536
- export type ListChatTemplatesResponse = ListChatTemplatesResponses[keyof ListChatTemplatesResponses];
565
+ export type InitiateOAuthFlowResponse = InitiateOAuthFlowResponses[keyof InitiateOAuthFlowResponses];
537
566
 
538
567
  export type GetAppInfoData = {
539
568
  body?: never;
@@ -578,11 +607,13 @@ export type LogoutUserError = LogoutUserErrors[keyof LogoutUserErrors];
578
607
 
579
608
  export type LogoutUserResponses = {
580
609
  /**
581
- * Logout successful, redirects to login page
610
+ * Logout successful, return redirect URL
582
611
  */
583
- 200: unknown;
612
+ 200: RedirectResponse;
584
613
  };
585
614
 
615
+ export type LogoutUserResponse = LogoutUserResponses[keyof LogoutUserResponses];
616
+
586
617
  export type ListModelFilesData = {
587
618
  body?: never;
588
619
  path?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bodhiapp/ts-client",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "TypeScript types for Bodhi API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -36,6 +36,9 @@
36
36
  "typescript": "^5.3.3",
37
37
  "vitest": "^3.0.9"
38
38
  },
39
+ "engines": {
40
+ "node": ">=22"
41
+ },
39
42
  "publishConfig": {
40
43
  "access": "public"
41
44
  }