@milkio/astra 1.1.2 → 1.2.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/index.d.ts +7 -1
- package/index.js +22 -3
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type AstraOptionsInit = {
|
|
|
4
4
|
execute: any;
|
|
5
5
|
ping: any;
|
|
6
6
|
__cookbook: any;
|
|
7
|
+
__astraEmitEvent: any;
|
|
7
8
|
};
|
|
8
9
|
bootstrap: () => Promise<Record<string, any>>;
|
|
9
10
|
};
|
|
@@ -12,7 +13,7 @@ type Mixin<T, U> = U & Omit<T, keyof U>;
|
|
|
12
13
|
type ExecuteOptions = {
|
|
13
14
|
headers?: Record<string, string>;
|
|
14
15
|
timeout?: number;
|
|
15
|
-
type?: "action" | "stream";
|
|
16
|
+
type?: "action" | "stream" | "event";
|
|
16
17
|
};
|
|
17
18
|
type ExecuteResultsOption = {
|
|
18
19
|
executeId: string;
|
|
@@ -49,6 +50,11 @@ export declare function createAstra<AstraOptions extends AstraOptionsInit, Gener
|
|
|
49
50
|
}>) => Promise<Generated["routeSchema"][Path]["types"]["\uD83E\uDD5B"] extends boolean ? // action
|
|
50
51
|
[Partial<Generated["rejectCode"]>, null, ExecuteResultsOption] | [null, Generated["routeSchema"][Path]["types"]["result"], ExecuteResultsOption] : // stream
|
|
51
52
|
[Partial<Generated["rejectCode"]>, null, ExecuteResultsOption] | [null, AsyncGenerator<[Partial<Generated["rejectCode"]>, null] | [null, GeneratorGeneric<Generated["routeSchema"][Path]["types"]["result"]>], ExecuteResultsOption>]>;
|
|
53
|
+
emit: <Key extends keyof Generated["events"]>(key: Key, options?: {
|
|
54
|
+
params?: Generated["events"][Key];
|
|
55
|
+
headers?: Record<string, string>;
|
|
56
|
+
timeout?: number;
|
|
57
|
+
}) => Promise<[Partial<Generated["rejectCode"]>, null, ExecuteResultsOption] | [null, Generated["events"][Key], ExecuteResultsOption]>;
|
|
52
58
|
}>]>;
|
|
53
59
|
}>;
|
|
54
60
|
export declare function fetchWithTimeout(url: string, options?: RequestInit & {
|