@faasjs/func 0.0.2-beta.361 → 0.0.2-beta.365
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 +310 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,9 +1,316 @@
|
|
|
1
1
|
# @faasjs/func
|
|
2
2
|
|
|
3
|
-
云函数模块。
|
|
4
|
-
|
|
5
3
|
[](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/func/LICENSE)
|
|
6
4
|
[](https://www.npmjs.com/package/@faasjs/func)
|
|
7
5
|
[](https://www.npmjs.com/package/@faasjs/func)
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
FaasJS's function module.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
npm install @faasjs/func
|
|
12
|
+
|
|
13
|
+
## Modules
|
|
14
|
+
|
|
15
|
+
### Classes
|
|
16
|
+
|
|
17
|
+
- [Func](classes/Func.md)
|
|
18
|
+
|
|
19
|
+
### Type aliases
|
|
20
|
+
|
|
21
|
+
- [Config](#config)
|
|
22
|
+
- [DeployData](#deploydata)
|
|
23
|
+
- [ExportedHandler](#exportedhandler)
|
|
24
|
+
- [FuncConfig](#funcconfig)
|
|
25
|
+
- [Handler](#handler)
|
|
26
|
+
- [InvokeData](#invokedata)
|
|
27
|
+
- [LifeCycleKey](#lifecyclekey)
|
|
28
|
+
- [MountData](#mountdata)
|
|
29
|
+
- [Next](#next)
|
|
30
|
+
- [Plugin](#plugin)
|
|
31
|
+
- [ProviderConfig](#providerconfig)
|
|
32
|
+
- [UseifyPlugin](#useifyplugin)
|
|
33
|
+
|
|
34
|
+
### Functions
|
|
35
|
+
|
|
36
|
+
- [useFunc](#usefunc)
|
|
37
|
+
- [usePlugin](#useplugin)
|
|
38
|
+
|
|
39
|
+
## Type aliases
|
|
40
|
+
|
|
41
|
+
### Config
|
|
42
|
+
|
|
43
|
+
Ƭ **Config**: `Object`
|
|
44
|
+
|
|
45
|
+
#### Index signature
|
|
46
|
+
|
|
47
|
+
▪ [key: `string`]: `any`
|
|
48
|
+
|
|
49
|
+
#### Type declaration
|
|
50
|
+
|
|
51
|
+
| Name | Type |
|
|
52
|
+
| :------ | :------ |
|
|
53
|
+
| `plugins?` | { [key: string]: { [key: string]: `any`; `config?`: { [key: string]: `any`; } ; `provider?`: `string` \| [`ProviderConfig`](#providerconfig) ; `type`: `string` }; } |
|
|
54
|
+
| `providers?` | { [key: string]: [`ProviderConfig`](#providerconfig); } |
|
|
55
|
+
|
|
56
|
+
___
|
|
57
|
+
|
|
58
|
+
### DeployData
|
|
59
|
+
|
|
60
|
+
Ƭ **DeployData**: `Object`
|
|
61
|
+
|
|
62
|
+
#### Index signature
|
|
63
|
+
|
|
64
|
+
▪ [key: `string`]: `any`
|
|
65
|
+
|
|
66
|
+
#### Type declaration
|
|
67
|
+
|
|
68
|
+
| Name | Type |
|
|
69
|
+
| :------ | :------ |
|
|
70
|
+
| `config?` | [`Config`](#config) |
|
|
71
|
+
| `dependencies` | { [name: string]: `string`; } |
|
|
72
|
+
| `env?` | `string` |
|
|
73
|
+
| `filename` | `string` |
|
|
74
|
+
| `logger?` | `Logger` |
|
|
75
|
+
| `name?` | `string` |
|
|
76
|
+
| `plugins?` | { [name: string]: { [key: string]: `any`; `config`: { [key: string]: `any`; } ; `name?`: `string` ; `plugin`: [`Plugin`](#plugin) ; `provider?`: `string` ; `type`: `string` }; } |
|
|
77
|
+
| `root` | `string` |
|
|
78
|
+
| `version?` | `string` |
|
|
79
|
+
|
|
80
|
+
___
|
|
81
|
+
|
|
82
|
+
### ExportedHandler
|
|
83
|
+
|
|
84
|
+
Ƭ **ExportedHandler**<`TEvent`, `TContext`, `TResult`\>: (`event`: `TEvent`, `context?`: `TContext`, `callback?`: (...`args`: `any`) => `any`) => `Promise`<`TResult`\>
|
|
85
|
+
|
|
86
|
+
#### Type parameters
|
|
87
|
+
|
|
88
|
+
| Name | Type |
|
|
89
|
+
| :------ | :------ |
|
|
90
|
+
| `TEvent` | `any` |
|
|
91
|
+
| `TContext` | `any` |
|
|
92
|
+
| `TResult` | `any` |
|
|
93
|
+
|
|
94
|
+
#### Type declaration
|
|
95
|
+
|
|
96
|
+
▸ (`event`, `context?`, `callback?`): `Promise`<`TResult`\>
|
|
97
|
+
|
|
98
|
+
##### Parameters
|
|
99
|
+
|
|
100
|
+
| Name | Type |
|
|
101
|
+
| :------ | :------ |
|
|
102
|
+
| `event` | `TEvent` |
|
|
103
|
+
| `context?` | `TContext` |
|
|
104
|
+
| `callback?` | (...`args`: `any`) => `any` |
|
|
105
|
+
|
|
106
|
+
##### Returns
|
|
107
|
+
|
|
108
|
+
`Promise`<`TResult`\>
|
|
109
|
+
|
|
110
|
+
___
|
|
111
|
+
|
|
112
|
+
### FuncConfig
|
|
113
|
+
|
|
114
|
+
Ƭ **FuncConfig**<`TEvent`, `TContext`, `TResult`\>: `Object`
|
|
115
|
+
|
|
116
|
+
#### Type parameters
|
|
117
|
+
|
|
118
|
+
| Name | Type |
|
|
119
|
+
| :------ | :------ |
|
|
120
|
+
| `TEvent` | `any` |
|
|
121
|
+
| `TContext` | `any` |
|
|
122
|
+
| `TResult` | `any` |
|
|
123
|
+
|
|
124
|
+
#### Type declaration
|
|
125
|
+
|
|
126
|
+
| Name | Type |
|
|
127
|
+
| :------ | :------ |
|
|
128
|
+
| `handler?` | [`Handler`](#handler)<`TEvent`, `TContext`, `TResult`\> |
|
|
129
|
+
| `plugins?` | [`Plugin`](#plugin)[] |
|
|
130
|
+
|
|
131
|
+
___
|
|
132
|
+
|
|
133
|
+
### Handler
|
|
134
|
+
|
|
135
|
+
Ƭ **Handler**<`TEvent`, `TContext`, `TResult`\>: (`data`: [`InvokeData`](#invokedata)<`TEvent`, `TContext`\>) => `Promise`<`TResult`\>
|
|
136
|
+
|
|
137
|
+
#### Type parameters
|
|
138
|
+
|
|
139
|
+
| Name | Type |
|
|
140
|
+
| :------ | :------ |
|
|
141
|
+
| `TEvent` | `any` |
|
|
142
|
+
| `TContext` | `any` |
|
|
143
|
+
| `TResult` | `any` |
|
|
144
|
+
|
|
145
|
+
#### Type declaration
|
|
146
|
+
|
|
147
|
+
▸ (`data`): `Promise`<`TResult`\>
|
|
148
|
+
|
|
149
|
+
##### Parameters
|
|
150
|
+
|
|
151
|
+
| Name | Type |
|
|
152
|
+
| :------ | :------ |
|
|
153
|
+
| `data` | [`InvokeData`](#invokedata)<`TEvent`, `TContext`\> |
|
|
154
|
+
|
|
155
|
+
##### Returns
|
|
156
|
+
|
|
157
|
+
`Promise`<`TResult`\>
|
|
158
|
+
|
|
159
|
+
___
|
|
160
|
+
|
|
161
|
+
### InvokeData
|
|
162
|
+
|
|
163
|
+
Ƭ **InvokeData**<`TEvent`, `TContext`, `TResult`\>: `Object`
|
|
164
|
+
|
|
165
|
+
#### Type parameters
|
|
166
|
+
|
|
167
|
+
| Name | Type |
|
|
168
|
+
| :------ | :------ |
|
|
169
|
+
| `TEvent` | `any` |
|
|
170
|
+
| `TContext` | `any` |
|
|
171
|
+
| `TResult` | `any` |
|
|
172
|
+
|
|
173
|
+
#### Index signature
|
|
174
|
+
|
|
175
|
+
▪ [key: `string`]: `any`
|
|
176
|
+
|
|
177
|
+
#### Type declaration
|
|
178
|
+
|
|
179
|
+
| Name | Type |
|
|
180
|
+
| :------ | :------ |
|
|
181
|
+
| `callback` | `any` |
|
|
182
|
+
| `config` | [`Config`](#config) |
|
|
183
|
+
| `context` | `TContext` |
|
|
184
|
+
| `event` | `TEvent` |
|
|
185
|
+
| `handler?` | [`Handler`](#handler)<`TEvent`, `TContext`, `TResult`\> |
|
|
186
|
+
| `logger` | `Logger` |
|
|
187
|
+
| `response` | `any` |
|
|
188
|
+
|
|
189
|
+
___
|
|
190
|
+
|
|
191
|
+
### LifeCycleKey
|
|
192
|
+
|
|
193
|
+
Ƭ **LifeCycleKey**: ``"onDeploy"`` \| ``"onMount"`` \| ``"onInvoke"``
|
|
194
|
+
|
|
195
|
+
___
|
|
196
|
+
|
|
197
|
+
### MountData
|
|
198
|
+
|
|
199
|
+
Ƭ **MountData**: `Object`
|
|
200
|
+
|
|
201
|
+
#### Index signature
|
|
202
|
+
|
|
203
|
+
▪ [key: `string`]: `any`
|
|
204
|
+
|
|
205
|
+
#### Type declaration
|
|
206
|
+
|
|
207
|
+
| Name | Type |
|
|
208
|
+
| :------ | :------ |
|
|
209
|
+
| `config` | [`Config`](#config) |
|
|
210
|
+
| `context` | `any` |
|
|
211
|
+
| `event` | `any` |
|
|
212
|
+
|
|
213
|
+
___
|
|
214
|
+
|
|
215
|
+
### Next
|
|
216
|
+
|
|
217
|
+
Ƭ **Next**: () => `Promise`<`void`\>
|
|
218
|
+
|
|
219
|
+
#### Type declaration
|
|
220
|
+
|
|
221
|
+
▸ (): `Promise`<`void`\>
|
|
222
|
+
|
|
223
|
+
##### Returns
|
|
224
|
+
|
|
225
|
+
`Promise`<`void`\>
|
|
226
|
+
|
|
227
|
+
___
|
|
228
|
+
|
|
229
|
+
### Plugin
|
|
230
|
+
|
|
231
|
+
Ƭ **Plugin**: `Object`
|
|
232
|
+
|
|
233
|
+
#### Index signature
|
|
234
|
+
|
|
235
|
+
▪ [key: `string`]: `any`
|
|
236
|
+
|
|
237
|
+
#### Type declaration
|
|
238
|
+
|
|
239
|
+
| Name | Type |
|
|
240
|
+
| :------ | :------ |
|
|
241
|
+
| `name` | `string` |
|
|
242
|
+
| `type` | `string` |
|
|
243
|
+
| `onDeploy?` | (`data`: [`DeployData`](#deploydata), `next`: [`Next`](#next)) => `void` \| `Promise`<`void`\> |
|
|
244
|
+
| `onInvoke?` | (`data`: [`InvokeData`](#invokedata)<`any`, `any`, `any`\>, `next`: [`Next`](#next)) => `void` \| `Promise`<`void`\> |
|
|
245
|
+
| `onMount?` | (`data`: [`MountData`](#mountdata), `next`: [`Next`](#next)) => `void` \| `Promise`<`void`\> |
|
|
246
|
+
|
|
247
|
+
___
|
|
248
|
+
|
|
249
|
+
### ProviderConfig
|
|
250
|
+
|
|
251
|
+
Ƭ **ProviderConfig**: `Object`
|
|
252
|
+
|
|
253
|
+
#### Type declaration
|
|
254
|
+
|
|
255
|
+
| Name | Type |
|
|
256
|
+
| :------ | :------ |
|
|
257
|
+
| `config` | { [key: string]: `any`; } |
|
|
258
|
+
| `type` | `string` |
|
|
259
|
+
|
|
260
|
+
___
|
|
261
|
+
|
|
262
|
+
### UseifyPlugin
|
|
263
|
+
|
|
264
|
+
Ƭ **UseifyPlugin**: `Object`
|
|
265
|
+
|
|
266
|
+
#### Type declaration
|
|
267
|
+
|
|
268
|
+
| Name | Type |
|
|
269
|
+
| :------ | :------ |
|
|
270
|
+
| `mount?` | (`data`: { `config`: [`Config`](#config) }) => `Promise`<`void`\> |
|
|
271
|
+
|
|
272
|
+
## Functions
|
|
273
|
+
|
|
274
|
+
### useFunc
|
|
275
|
+
|
|
276
|
+
▸ **useFunc**<`TEvent`, `TContext`, `TResult`\>(`handler`): [`Func`](classes/Func.md)<`TEvent`, `TContext`, `TResult`\>
|
|
277
|
+
|
|
278
|
+
#### Type parameters
|
|
279
|
+
|
|
280
|
+
| Name | Type |
|
|
281
|
+
| :------ | :------ |
|
|
282
|
+
| `TEvent` | `any` |
|
|
283
|
+
| `TContext` | `any` |
|
|
284
|
+
| `TResult` | `any` |
|
|
285
|
+
|
|
286
|
+
#### Parameters
|
|
287
|
+
|
|
288
|
+
| Name | Type |
|
|
289
|
+
| :------ | :------ |
|
|
290
|
+
| `handler` | () => [`Handler`](#handler)<`TEvent`, `TContext`, `TResult`\> |
|
|
291
|
+
|
|
292
|
+
#### Returns
|
|
293
|
+
|
|
294
|
+
[`Func`](classes/Func.md)<`TEvent`, `TContext`, `TResult`\>
|
|
295
|
+
|
|
296
|
+
___
|
|
297
|
+
|
|
298
|
+
### usePlugin
|
|
299
|
+
|
|
300
|
+
▸ **usePlugin**<`T`\>(`plugin`): `T` & [`UseifyPlugin`](#useifyplugin)
|
|
301
|
+
|
|
302
|
+
#### Type parameters
|
|
303
|
+
|
|
304
|
+
| Name | Type |
|
|
305
|
+
| :------ | :------ |
|
|
306
|
+
| `T` | extends [`Plugin`](#plugin) |
|
|
307
|
+
|
|
308
|
+
#### Parameters
|
|
309
|
+
|
|
310
|
+
| Name | Type |
|
|
311
|
+
| :------ | :------ |
|
|
312
|
+
| `plugin` | `T` & [`UseifyPlugin`](#useifyplugin) |
|
|
313
|
+
|
|
314
|
+
#### Returns
|
|
315
|
+
|
|
316
|
+
`T` & [`UseifyPlugin`](#useifyplugin)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/func",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.365",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@faasjs/deep_merge": "^0.0.2-beta.
|
|
26
|
-
"@faasjs/logger": "^0.0.2-beta.
|
|
25
|
+
"@faasjs/deep_merge": "^0.0.2-beta.365",
|
|
26
|
+
"@faasjs/logger": "^0.0.2-beta.365"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"tsup": "*",
|