@faasjs/react 0.0.3-beta.100 → 0.0.3-beta.101

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.
Files changed (2) hide show
  1. package/README.md +123 -15
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -16,23 +16,26 @@ React plugin for FaasJS.
16
16
 
17
17
  ### Classes
18
18
 
19
- - [FaasBrowserClient](classes/FaasBrowserClient.md)
19
+ - [ErrorBoundary](classes/ErrorBoundary.md)
20
20
  - [Response](classes/Response.md)
21
21
  - [ResponseError](classes/ResponseError.md)
22
22
 
23
23
  ### Interfaces
24
24
 
25
- - [FaasDataInjection](interfaces/FaasDataInjection.md)
26
- - [FaasDataWrapperProps](interfaces/FaasDataWrapperProps.md)
27
- - [FaasReactClientInstance](interfaces/FaasReactClientInstance.md)
25
+ - [ErrorBoundaryProps](interfaces/ErrorBoundaryProps.md)
28
26
 
29
27
  ### Type Aliases
30
28
 
29
+ - [ErrorChildrenProps](#errorchildrenprops)
31
30
  - [FaasAction](#faasaction)
32
31
  - [FaasData](#faasdata)
32
+ - [FaasDataInjection](#faasdatainjection)
33
+ - [FaasDataWrapperProps](#faasdatawrapperprops)
33
34
  - [FaasParams](#faasparams)
35
+ - [FaasReactClientInstance](#faasreactclientinstance)
34
36
  - [Options](#options)
35
37
  - [ResponseHeaders](#responseheaders)
38
+ - [useFaasOptions](#usefaasoptions)
36
39
 
37
40
  ### Functions
38
41
 
@@ -44,6 +47,21 @@ React plugin for FaasJS.
44
47
 
45
48
  ## Type Aliases
46
49
 
50
+ ### ErrorChildrenProps
51
+
52
+ Ƭ **ErrorChildrenProps**: `Object`
53
+
54
+ #### Type declaration
55
+
56
+ | Name | Type |
57
+ | :------ | :------ |
58
+ | `error?` | `Error` |
59
+ | `errorDescription?` | `string` |
60
+ | `errorMessage?` | `string` |
61
+ | `info?` | `any` |
62
+
63
+ ___
64
+
47
65
  ### FaasAction
48
66
 
49
67
  Ƭ **FaasAction**: `FaasActionPaths` \| `Record`<`string`, `any`\>
@@ -62,6 +80,62 @@ ___
62
80
 
63
81
  ___
64
82
 
83
+ ### FaasDataInjection
84
+
85
+ Ƭ **FaasDataInjection**<`Data`\>: `Object`
86
+
87
+ Injects FaasData props.
88
+
89
+ #### Type parameters
90
+
91
+ | Name | Type |
92
+ | :------ | :------ |
93
+ | `Data` | `any` |
94
+
95
+ #### Type declaration
96
+
97
+ | Name | Type |
98
+ | :------ | :------ |
99
+ | `action` | `string` \| `any` |
100
+ | `data` | `Data` |
101
+ | `error` | `any` |
102
+ | `loading` | `boolean` |
103
+ | `params` | `Record`<`string`, `any`\> |
104
+ | `promise` | `Promise`<`Response`<`Data`\>\> |
105
+ | `reloadTimes` | `number` |
106
+ | `setData` | `React.Dispatch`<`React.SetStateAction`<`Data`\>\> |
107
+ | `setError` | `React.Dispatch`<`React.SetStateAction`<`any`\>\> |
108
+ | `setLoading` | `React.Dispatch`<`React.SetStateAction`<`boolean`\>\> |
109
+ | `setPromise` | `React.Dispatch`<`React.SetStateAction`<`Promise`<`Response`<`Data`\>\>\>\> |
110
+ | `reload` | (`params?`: `Record`<`string`, `any`\>) => `Promise`<`any`\> |
111
+
112
+ ___
113
+
114
+ ### FaasDataWrapperProps
115
+
116
+ Ƭ **FaasDataWrapperProps**<`PathOrData`\>: `Object`
117
+
118
+ #### Type parameters
119
+
120
+ | Name | Type |
121
+ | :------ | :------ |
122
+ | `PathOrData` | extends `FaasAction` |
123
+
124
+ #### Type declaration
125
+
126
+ | Name | Type | Description |
127
+ | :------ | :------ | :------ |
128
+ | `action` | `string` | - |
129
+ | `children?` | `React.ReactElement`<`Partial`<[`FaasDataInjection`](#faasdatainjection)\>\> | - |
130
+ | `data?` | `FaasData`<`PathOrData`\> | use custom data, should work with setData |
131
+ | `fallback?` | `JSX.Element` \| ``false`` | - |
132
+ | `params?` | `FaasParams`<`PathOrData`\> | - |
133
+ | `setData?` | `React.Dispatch`<`React.SetStateAction`<`FaasData`<`PathOrData`\>\>\> | use custom setData, should work with data |
134
+ | `onDataChange?` | (`args`: [`FaasDataInjection`](#faasdatainjection)<`FaasData`<`PathOrData`\>\>) => `void` | - |
135
+ | `render?` | (`args`: [`FaasDataInjection`](#faasdatainjection)<`FaasData`<`PathOrData`\>\>) => `Element` \| `Element`[] | - |
136
+
137
+ ___
138
+
65
139
  ### FaasParams
66
140
 
67
141
  Ƭ **FaasParams**<`T`\>: `T` extends `FaasActionPaths` ? `FaasActions`[`T`][``"Params"``] : `any`
@@ -74,6 +148,21 @@ ___
74
148
 
75
149
  ___
76
150
 
151
+ ### FaasReactClientInstance
152
+
153
+ Ƭ **FaasReactClientInstance**: `Object`
154
+
155
+ #### Type declaration
156
+
157
+ | Name | Type |
158
+ | :------ | :------ |
159
+ | `faas` | <PathOrData\>(`action`: `string` \| `PathOrData`, `params`: `FaasParams`<`PathOrData`\>) => `Promise`<`Response`<`FaasData`<`PathOrData`\>\>\> |
160
+ | `id` | `string` |
161
+ | `useFaas` | <PathOrData\>(`action`: `string` \| `PathOrData`, `defaultParams`: `FaasParams`<`PathOrData`\>, `options?`: [`useFaasOptions`](#usefaasoptions)<`PathOrData`\>) => [`FaasDataInjection`](#faasdatainjection)<`FaasData`<`PathOrData`\>\> |
162
+ | `FaasDataWrapper` | <PathOrData\>(`props`: [`FaasDataWrapperProps`](#faasdatawrapperprops)<`PathOrData`\>) => `Element` |
163
+
164
+ ___
165
+
77
166
  ### Options
78
167
 
79
168
  Ƭ **Options**: `RequestInit` & { `beforeRequest?`: (`{
@@ -90,6 +179,28 @@ ___
90
179
 
91
180
  ▪ [key: `string`]: `string`
92
181
 
182
+ ___
183
+
184
+ ### useFaasOptions
185
+
186
+ Ƭ **useFaasOptions**<`PathOrData`\>: `Object`
187
+
188
+ #### Type parameters
189
+
190
+ | Name | Type |
191
+ | :------ | :------ |
192
+ | `PathOrData` | extends `FaasAction` |
193
+
194
+ #### Type declaration
195
+
196
+ | Name | Type | Description |
197
+ | :------ | :------ | :------ |
198
+ | `data?` | `FaasData`<`PathOrData`\> | - |
199
+ | `debounce?` | `number` | send the last request after milliseconds |
200
+ | `params?` | `FaasParams`<`PathOrData`\> | - |
201
+ | `setData?` | `React.Dispatch`<`React.SetStateAction`<`FaasData`<`PathOrData`\>\>\> | - |
202
+ | `skip?` | `boolean` | - |
203
+
93
204
  ## Functions
94
205
 
95
206
  ### FaasDataWrapper
@@ -108,7 +219,7 @@ A data wrapper for react components
108
219
 
109
220
  | Name | Type |
110
221
  | :------ | :------ |
111
- | `props` | [`FaasDataWrapperProps`](interfaces/FaasDataWrapperProps.md)<`PathOrData`\> |
222
+ | `props` | [`FaasDataWrapperProps`](#faasdatawrapperprops)<`PathOrData`\> |
112
223
 
113
224
  #### Returns
114
225
 
@@ -129,7 +240,7 @@ ___
129
240
 
130
241
  ### FaasReactClient
131
242
 
132
- ▸ **FaasReactClient**(`«destructured»`): [`FaasReactClientInstance`](interfaces/FaasReactClientInstance.md)
243
+ ▸ **FaasReactClient**(`«destructured»`): [`FaasReactClientInstance`](#faasreactclientinstance)
133
244
 
134
245
  Before use faas, you should initialize a FaasReactClient.
135
246
 
@@ -144,7 +255,7 @@ Before use faas, you should initialize a FaasReactClient.
144
255
 
145
256
  #### Returns
146
257
 
147
- [`FaasReactClientInstance`](interfaces/FaasReactClientInstance.md)
258
+ [`FaasReactClientInstance`](#faasreactclientinstance)
148
259
 
149
260
  ```ts
150
261
  const client = FaasReactClient({
@@ -187,7 +298,7 @@ ___
187
298
 
188
299
  ### getClient
189
300
 
190
- ▸ **getClient**(`domain?`): [`FaasReactClientInstance`](interfaces/FaasReactClientInstance.md)
301
+ ▸ **getClient**(`domain?`): [`FaasReactClientInstance`](#faasreactclientinstance)
191
302
 
192
303
  Get FaasReactClient instance
193
304
 
@@ -199,7 +310,7 @@ Get FaasReactClient instance
199
310
 
200
311
  #### Returns
201
312
 
202
- [`FaasReactClientInstance`](interfaces/FaasReactClientInstance.md)
313
+ [`FaasReactClientInstance`](#faasreactclientinstance)
203
314
 
204
315
  ```ts
205
316
  getClient()
@@ -211,7 +322,7 @@ ___
211
322
 
212
323
  ### useFaas
213
324
 
214
- ▸ **useFaas**<`PathOrData`\>(`action`, `defaultParams`, `options?`): [`FaasDataInjection`](interfaces/FaasDataInjection.md)<[`FaasData`](#faasdata)<`PathOrData`\>\>
325
+ ▸ **useFaas**<`PathOrData`\>(`action`, `defaultParams`, `options?`): [`FaasDataInjection`](#faasdatainjection)<[`FaasData`](#faasdata)<`PathOrData`\>\>
215
326
 
216
327
  Request faas server with React hook
217
328
 
@@ -227,14 +338,11 @@ Request faas server with React hook
227
338
  | :------ | :------ | :------ |
228
339
  | `action` | `string` \| `PathOrData` | {string} action name |
229
340
  | `defaultParams` | [`FaasParams`](#faasparams)<`PathOrData`\> | {object} initial action params |
230
- | `options?` | `Object` | - |
231
- | `options.data?` | [`FaasData`](#faasdata)<`PathOrData`\> | - |
232
- | `options.setData?` | `Dispatch`<`SetStateAction`<[`FaasData`](#faasdata)<`PathOrData`\>\>\> | - |
233
- | `options.skip?` | `boolean` | - |
341
+ | `options?` | [`useFaasOptions`](#usefaasoptions)<`PathOrData`\> | - |
234
342
 
235
343
  #### Returns
236
344
 
237
- [`FaasDataInjection`](interfaces/FaasDataInjection.md)<[`FaasData`](#faasdata)<`PathOrData`\>\>
345
+ [`FaasDataInjection`](#faasdatainjection)<[`FaasData`](#faasdata)<`PathOrData`\>\>
238
346
 
239
347
  ```ts
240
348
  function Post ({ id }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/react",
3
- "version": "0.0.3-beta.100",
3
+ "version": "0.0.3-beta.101",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -22,7 +22,7 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@faasjs/browser": "0.0.3-beta.100"
25
+ "@faasjs/browser": "0.0.3-beta.101"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": "*"