@faasjs/dev 8.0.0-beta.6 → 8.0.0-beta.7

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/dist/index.d.ts CHANGED
@@ -1,35 +1,11 @@
1
- import { Knex } from 'knex';
2
- import { Func, Config, Plugin } from '@faasjs/func';
3
- export * from '@faasjs/func';
4
- import { Logger } from '@faasjs/logger';
5
- import { Plugin as Plugin$1 } from 'vite';
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
- type MountFaasKnexOptions = {
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
- [key: string]: any;
47
- readonly file: string;
48
- readonly staging: string;
49
- readonly logger: Logger;
50
- readonly func: Func;
51
- readonly config: Config;
52
- readonly plugins: Plugin[];
53
- private readonly _handler;
54
- /**
55
- * @param initBy {Func} A FaasJS function
56
- * ```ts
57
- * import { FuncWarper } from '@faasjs/dev'
58
- *
59
- * new FuncWarper(__dirname + '/../demo.func.ts')
60
- * ```
61
- */
62
- constructor(initBy: Func);
63
- mount(handler?: (func: FuncWarper) => Promise<void> | void): Promise<void>;
64
- handler<TResult = any>(event?: any, context?: any): Promise<TResult>;
65
- JSONhandler<TData = any>(body?: {
66
- [key: string]: any;
67
- }, options?: {
68
- headers?: {
69
- [key: string]: any;
70
- };
71
- cookie?: {
72
- [key: string]: any;
73
- };
74
- session?: {
75
- [key: string]: any;
76
- };
77
- }): Promise<{
78
- statusCode: number;
79
- headers: {
80
- [key: string]: string;
81
- };
82
- cookie?: Record<string, any>;
83
- session?: Record<string, any>;
84
- body: any;
85
- data?: TData;
86
- error?: {
87
- message: string;
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
- /** faas project root path, default is process.cwd() */
108
- root?: string;
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
- output: string;
114
- changed: boolean;
115
- fileCount: number;
116
- routeCount: number;
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, type GenerateFaasTypesOptions, type GenerateFaasTypesResult, type MountFaasKnexOptions, createPgliteKnex, generateFaasTypes, isTypegenSourceFile, mountFaasKnex, streamToString, test, unmountFaasKnex, viteFaasJsServer };
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 };