@faasjs/dev 8.0.0-beta.6 → 8.0.0-beta.8
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/README.md +7 -27
- package/dist/chunk-CtajNgzt.mjs +36 -0
- package/dist/cli.cjs +51 -319
- package/dist/cli.d.ts +3 -2
- package/dist/cli.mjs +50 -120
- package/dist/index.cjs +310 -582
- package/dist/index.d.ts +64 -87
- package/dist/index.mjs +273 -344
- package/dist/typegen-C6t9LIyi.cjs +183 -0
- package/dist/typegen-D5s91_xL.mjs +166 -0
- package/package.json +16 -22
- package/dist/chunk-3FXFWIBW.mjs +0 -221
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import { Plugin as Plugin$1 } from
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./chunk-CtajNgzt.mjs";
|
|
2
|
+
import { Logger } from "@faasjs/logger";
|
|
3
|
+
import { streamToObject, streamToString, streamToText } from "@faasjs/node-utils";
|
|
4
|
+
import { Config, Func, Plugin } from "@faasjs/func";
|
|
5
|
+
import { Plugin as Plugin$1 } from "vite";
|
|
6
|
+
export * from "@faasjs/func";
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
/** key of `globalThis.FaasJS_Knex`, default is `knex` */
|
|
9
|
-
name?: string;
|
|
10
|
-
/** optional config metadata passed through to `@faasjs/knex` */
|
|
11
|
-
config?: Record<string, unknown>;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Create a knex instance backed by `knex-pglite`.
|
|
15
|
-
*/
|
|
16
|
-
declare function createPgliteKnex(config?: Partial<Knex.Config>, connection?: Record<string, unknown>): Knex;
|
|
17
|
-
/**
|
|
18
|
-
* Mount a knex adapter to `globalThis.FaasJS_Knex` for `@faasjs/knex`.
|
|
19
|
-
*/
|
|
20
|
-
declare function mountFaasKnex(db: Knex, options?: MountFaasKnexOptions): void;
|
|
21
|
-
/**
|
|
22
|
-
* Remove mounted knex adapter from `globalThis.FaasJS_Knex`.
|
|
23
|
-
*/
|
|
24
|
-
declare function unmountFaasKnex(name?: string): void;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Convert ReadableStream to string.
|
|
28
|
-
* @param stream {ReadableStream<Uint8Array>} The stream to convert
|
|
29
|
-
* @returns {Promise<string>} The string content of stream
|
|
30
|
-
* @throws {TypeError} If stream is not a ReadableStream instance
|
|
31
|
-
*/
|
|
32
|
-
declare function streamToString(stream: ReadableStream<Uint8Array>): Promise<string>;
|
|
8
|
+
//#region src/test.d.ts
|
|
33
9
|
/**
|
|
34
10
|
* Test wrapper for a function.
|
|
35
11
|
*
|
|
@@ -43,50 +19,48 @@ declare function streamToString(stream: ReadableStream<Uint8Array>): Promise<str
|
|
|
43
19
|
* ```
|
|
44
20
|
*/
|
|
45
21
|
declare class FuncWarper {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
};
|
|
89
|
-
}>;
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
readonly file: string;
|
|
24
|
+
readonly staging: string;
|
|
25
|
+
readonly logger: Logger;
|
|
26
|
+
readonly func: Func;
|
|
27
|
+
readonly config: Config;
|
|
28
|
+
readonly plugins: Plugin[];
|
|
29
|
+
private readonly _handler;
|
|
30
|
+
/**
|
|
31
|
+
* @param initBy {Func} A FaasJS function
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { FuncWarper } from '@faasjs/dev'
|
|
34
|
+
*
|
|
35
|
+
* new FuncWarper(__dirname + '/../demo.func.ts')
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
constructor(initBy: Func);
|
|
39
|
+
mount(handler?: (func: FuncWarper) => Promise<void> | void): Promise<void>;
|
|
40
|
+
handler<TResult = any>(event?: any, context?: any): Promise<TResult>;
|
|
41
|
+
JSONhandler<TData = any>(body?: Record<string, any> | string | null, options?: {
|
|
42
|
+
headers?: {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
cookie?: {
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
};
|
|
48
|
+
session?: {
|
|
49
|
+
[key: string]: any;
|
|
50
|
+
};
|
|
51
|
+
}): Promise<{
|
|
52
|
+
statusCode: number;
|
|
53
|
+
headers: {
|
|
54
|
+
[key: string]: string;
|
|
55
|
+
};
|
|
56
|
+
cookie?: Record<string, any>;
|
|
57
|
+
session?: Record<string, any>;
|
|
58
|
+
body: any;
|
|
59
|
+
data?: TData;
|
|
60
|
+
error?: {
|
|
61
|
+
message: string;
|
|
62
|
+
};
|
|
63
|
+
}>;
|
|
90
64
|
}
|
|
91
65
|
/**
|
|
92
66
|
* A simple way to wrap a FaasJS function.
|
|
@@ -102,22 +76,22 @@ declare class FuncWarper {
|
|
|
102
76
|
* ```
|
|
103
77
|
*/
|
|
104
78
|
declare function test(initBy: Func): FuncWarper;
|
|
105
|
-
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/typegen.d.ts
|
|
106
81
|
type GenerateFaasTypesOptions = {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
/** optional logger instance */
|
|
110
|
-
logger?: Logger;
|
|
82
|
+
/** faas project root path, default is process.cwd() */root?: string; /** optional logger instance */
|
|
83
|
+
logger?: Logger;
|
|
111
84
|
};
|
|
112
85
|
type GenerateFaasTypesResult = {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
86
|
+
output: string;
|
|
87
|
+
changed: boolean;
|
|
88
|
+
fileCount: number;
|
|
89
|
+
routeCount: number;
|
|
117
90
|
};
|
|
118
91
|
declare function isTypegenSourceFile(filePath: string): boolean;
|
|
119
92
|
declare function generateFaasTypes(options?: GenerateFaasTypesOptions): Promise<GenerateFaasTypesResult>;
|
|
120
|
-
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/vite.d.ts
|
|
121
95
|
/**
|
|
122
96
|
* Create a Vite plugin that proxies POST requests to an in-process FaasJS server.
|
|
123
97
|
*
|
|
@@ -125,5 +99,8 @@ declare function generateFaasTypes(options?: GenerateFaasTypesOptions): Promise<
|
|
|
125
99
|
* request URL before forwarding to `@faasjs/server`.
|
|
126
100
|
*/
|
|
127
101
|
declare function viteFaasJsServer(): Plugin$1;
|
|
128
|
-
|
|
129
|
-
export { FuncWarper,
|
|
102
|
+
declare namespace index_d_exports {
|
|
103
|
+
export { FuncWarper, GenerateFaasTypesOptions, GenerateFaasTypesResult, generateFaasTypes, isTypegenSourceFile, streamToObject, streamToString, streamToText, test, viteFaasJsServer };
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
export { FuncWarper, GenerateFaasTypesOptions, GenerateFaasTypesResult, generateFaasTypes, isTypegenSourceFile, streamToObject, streamToString, streamToText, test, viteFaasJsServer };
|