|
1 | | -declare namespace BreezeRuntime { |
2 | | - export interface DeploymentInfo { |
3 | | - projectId: string; |
4 | | - environmentId: string; |
5 | | - functionId: string; |
6 | | - } |
7 | | - |
8 | | - export interface Plugin { |
9 | | - id: string; |
10 | | - endpoint: string; |
11 | | - } |
| 1 | +declare global { |
| 2 | + namespace BreezeRuntime { |
| 3 | + export interface DeploymentInfo { |
| 4 | + projectId: string; |
| 5 | + environmentId: string; |
| 6 | + functionId: string; |
| 7 | + } |
12 | 8 |
|
13 | | - /** |
14 | | - * A JWT token generated by Breeze to authorize plugin or workflow requests. |
15 | | - */ |
16 | | - export type Token = string; |
| 9 | + export interface Plugin { |
| 10 | + id: string; |
| 11 | + endpoint: string; |
| 12 | + } |
17 | 13 |
|
18 | | - export interface TokenOptions { |
19 | 14 | /** |
20 | | - * The instance name of plugin. |
| 15 | + * A JWT token generated by Breeze to authorize plugin or workflow requests. |
21 | 16 | */ |
22 | | - plugin?: string; |
| 17 | + export type Token = string; |
| 18 | + |
| 19 | + export interface TokenOptions { |
| 20 | + /** |
| 21 | + * The instance name of plugin. |
| 22 | + */ |
| 23 | + plugin?: string; |
| 24 | + } |
23 | 25 | } |
24 | 26 |
|
25 | | - /** |
26 | | - * Retrieves the current deployment information. |
27 | | - * @returns The deployment information of the current function. |
28 | | - */ |
29 | | - export function getDeploymentInfo(): DeploymentInfo; |
| 27 | + interface BreezeRuntime { |
| 28 | + /** |
| 29 | + * Generates an authentication token for a plugin or workflow request. |
| 30 | + * @param opts - Optional settings for the token generation. |
| 31 | + * @returns A JWT token. |
| 32 | + */ |
| 33 | + generateToken(opts?: BreezeRuntime.TokenOptions): BreezeRuntime.Token; |
30 | 34 |
|
31 | | - /** |
32 | | - * Retrieves a registered plugin by its name. |
33 | | - * @param plugin - The name of the plugin. |
34 | | - * @returns The plugin instance if found, otherwise `null`. |
35 | | - */ |
36 | | - export function getPlugin(plugin: string): Plugin | null; |
| 35 | + /** |
| 36 | + * Retrieves the current deployment information. |
| 37 | + * @returns The deployment information of the current function. |
| 38 | + */ |
| 39 | + getDeploymentInfo(): BreezeRuntime.DeploymentInfo; |
37 | 40 |
|
38 | | - /** |
39 | | - * Generates an authentication token for a plugin or workflow request. |
40 | | - * @param opts - Optional settings for the token generation. |
41 | | - * @returns A JWT token. |
42 | | - */ |
43 | | - export function generateToken(opts?: TokenOptions): Token; |
| 41 | + /** |
| 42 | + * Retrieves a registered plugin by its name. |
| 43 | + * @param plugin - The name of the plugin. |
| 44 | + * @returns The plugin instance if found, otherwise `null`. |
| 45 | + */ |
| 46 | + getPlugin(plugin: string): BreezeRuntime.Plugin | null; |
44 | 47 |
|
45 | | - /** |
46 | | - * Performs a fetch request to the specified plugin. |
47 | | - * @param plugin - The name of the plugin. |
48 | | - * @returns A `Promise` resolving to the response. |
49 | | - */ |
50 | | - export function pluginFetch(plugin: string): Promise<Response>; |
| 48 | + /** |
| 49 | + * Performs a fetch request to the specified plugin. |
| 50 | + * @param plugin - The name of the plugin. |
| 51 | + * @returns A `Promise` resolving to the response. |
| 52 | + */ |
| 53 | + pluginFetch(plugin: string): Promise<Response>; |
51 | 54 |
|
52 | | - /** |
53 | | - * Performs a fetch request to a specific path on the specified plugin. |
54 | | - * @param plugin - The name of the plugin. |
55 | | - * @param path - The request path. |
56 | | - * @returns A `Promise` resolving to the response. |
57 | | - */ |
58 | | - export function pluginFetch( |
59 | | - plugin: string, |
60 | | - path: string, |
61 | | - ): Promise<Response>; |
| 55 | + /** |
| 56 | + * Performs a fetch request to a specific path on the specified plugin. |
| 57 | + * @param plugin - The name of the plugin. |
| 58 | + * @param path - The request path. |
| 59 | + * @returns A `Promise` resolving to the response. |
| 60 | + */ |
| 61 | + pluginFetch(plugin: string, path: string): Promise<Response>; |
| 62 | + |
| 63 | + /** |
| 64 | + * Performs a fetch request to a plugin with custom request options. |
| 65 | + * @param plugin - The name of the plugin. |
| 66 | + * @param opts - The fetch request options. |
| 67 | + * @returns A `Promise` resolving to the response. |
| 68 | + */ |
| 69 | + pluginFetch(plugin: string, opts: RequestInit): Promise<Response>; |
62 | 70 |
|
63 | | - /** |
64 | | - * Performs a fetch request to a plugin with custom request options. |
65 | | - * @param plugin - The name of the plugin. |
66 | | - * @param opts - The fetch request options. |
67 | | - * @returns A `Promise` resolving to the response. |
68 | | - */ |
69 | | - export function pluginFetch( |
70 | | - plugin: string, |
71 | | - opts: RequestInit, |
72 | | - ): Promise<Response>; |
| 71 | + /** |
| 72 | + * Performs a fetch request to a specific path on a plugin with custom request options. |
| 73 | + * @param plugin - The name of the plugin. |
| 74 | + * @param path - The request path. |
| 75 | + * @param opts - The fetch request options. |
| 76 | + * @returns A `Promise` resolving to the response. |
| 77 | + */ |
| 78 | + pluginFetch( |
| 79 | + plugin: string, |
| 80 | + path: string, |
| 81 | + opts: RequestInit, |
| 82 | + ): Promise<Response>; |
| 83 | + } |
73 | 84 |
|
74 | | - /** |
75 | | - * Performs a fetch request to a specific path on a plugin with custom request options. |
76 | | - * @param plugin - The name of the plugin. |
77 | | - * @param path - The request path. |
78 | | - * @param opts - The fetch request options. |
79 | | - * @returns A `Promise` resolving to the response. |
80 | | - */ |
81 | | - export function pluginFetch( |
82 | | - plugin: string, |
83 | | - path: string, |
84 | | - opts: RequestInit, |
85 | | - ): Promise<Response>; |
| 85 | + const BreezeRuntime: BreezeRuntime; |
86 | 86 | } |
| 87 | + |
| 88 | +export {}; |
0 commit comments