@fugood/bricks-project 2.22.0-beta.9 → 2.22.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/compile/action-name-map.ts +108 -1
- package/compile/index.ts +10 -1
- package/package.json +3 -3
- package/tools/postinstall.ts +16 -9
- package/types/animation.ts +2 -1
- package/types/brick-base.ts +79 -0
- package/types/bricks/3DViewer.ts +200 -0
- package/types/bricks/Camera.ts +195 -0
- package/types/bricks/Chart.ts +362 -0
- package/types/bricks/GenerativeMedia.ts +240 -0
- package/types/bricks/Icon.ts +93 -0
- package/types/bricks/Image.ts +104 -0
- package/types/bricks/Items.ts +461 -0
- package/types/bricks/Lottie.ts +159 -0
- package/types/bricks/QrCode.ts +112 -0
- package/types/bricks/Rect.ts +110 -0
- package/types/bricks/RichText.ts +123 -0
- package/types/bricks/Rive.ts +209 -0
- package/types/bricks/Slideshow.ts +155 -0
- package/types/bricks/Svg.ts +94 -0
- package/types/bricks/Text.ts +143 -0
- package/types/bricks/TextInput.ts +231 -0
- package/types/bricks/Video.ts +170 -0
- package/types/bricks/VideoStreaming.ts +107 -0
- package/types/bricks/WebRtcStream.ts +60 -0
- package/types/bricks/WebView.ts +157 -0
- package/types/bricks/index.ts +20 -0
- package/types/common.ts +8 -3
- package/types/data.ts +6 -0
- package/types/generators/AlarmClock.ts +102 -0
- package/types/generators/Assistant.ts +546 -0
- package/types/generators/BleCentral.ts +225 -0
- package/types/generators/BlePeripheral.ts +202 -0
- package/types/generators/CanvasMap.ts +57 -0
- package/types/generators/CastlesPay.ts +77 -0
- package/types/generators/DataBank.ts +123 -0
- package/types/generators/File.ts +351 -0
- package/types/generators/GraphQl.ts +124 -0
- package/types/generators/Http.ts +117 -0
- package/types/generators/HttpServer.ts +164 -0
- package/types/generators/Information.ts +97 -0
- package/types/generators/Intent.ts +107 -0
- package/types/generators/Iterator.ts +95 -0
- package/types/generators/Keyboard.ts +85 -0
- package/types/generators/LlmAnthropicCompat.ts +188 -0
- package/types/generators/LlmGgml.ts +719 -0
- package/types/generators/LlmOnnx.ts +184 -0
- package/types/generators/LlmOpenAiCompat.ts +206 -0
- package/types/generators/LlmQualcommAiEngine.ts +213 -0
- package/types/generators/Mcp.ts +294 -0
- package/types/generators/McpServer.ts +248 -0
- package/types/generators/MediaFlow.ts +142 -0
- package/types/generators/MqttBroker.ts +121 -0
- package/types/generators/MqttClient.ts +129 -0
- package/types/generators/Question.ts +395 -0
- package/types/generators/RealtimeTranscription.ts +180 -0
- package/types/generators/RerankerGgml.ts +153 -0
- package/types/generators/SerialPort.ts +141 -0
- package/types/generators/SoundPlayer.ts +86 -0
- package/types/generators/SoundRecorder.ts +113 -0
- package/types/generators/SpeechToTextGgml.ts +462 -0
- package/types/generators/SpeechToTextOnnx.ts +227 -0
- package/types/generators/SpeechToTextPlatform.ts +75 -0
- package/types/generators/SqLite.ts +118 -0
- package/types/generators/Step.ts +101 -0
- package/types/generators/TapToPayOnIPhone.ts +175 -0
- package/types/generators/Tcp.ts +120 -0
- package/types/generators/TcpServer.ts +137 -0
- package/types/generators/TextToSpeechGgml.ts +182 -0
- package/types/generators/TextToSpeechOnnx.ts +169 -0
- package/types/generators/TextToSpeechOpenAiLike.ts +113 -0
- package/types/generators/ThermalPrinter.ts +185 -0
- package/types/generators/Tick.ts +75 -0
- package/types/generators/Udp.ts +109 -0
- package/types/generators/VadGgml.ts +211 -0
- package/types/generators/VectorStore.ts +223 -0
- package/types/generators/Watchdog.ts +96 -0
- package/types/generators/WebCrawler.ts +97 -0
- package/types/generators/WebRtc.ts +165 -0
- package/types/generators/WebSocket.ts +142 -0
- package/types/generators/index.ts +51 -0
- package/types/system.ts +64 -0
- package/utils/data.ts +45 -0
- package/utils/event-props.ts +89 -0
- package/types/bricks.ts +0 -3168
- package/types/generators.ts +0 -7633
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
2
|
+
import type { Data, DataLink } from '../data'
|
|
3
|
+
import type {
|
|
4
|
+
Generator,
|
|
5
|
+
EventAction,
|
|
6
|
+
ActionWithDataParams,
|
|
7
|
+
ActionWithParams,
|
|
8
|
+
Action,
|
|
9
|
+
EventProperty,
|
|
10
|
+
} from '../common'
|
|
11
|
+
|
|
12
|
+
/* Read stats */
|
|
13
|
+
export type GeneratorFileActionReadStats = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_FILE_READ_STATS'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Read (Currently only support text file) */
|
|
18
|
+
export type GeneratorFileActionReadContent = ActionWithParams & {
|
|
19
|
+
__actionName: 'GENERATOR_FILE_READ_CONTENT'
|
|
20
|
+
params?: Array<{
|
|
21
|
+
input: 'encoding'
|
|
22
|
+
value?: 'utf8' | 'base64' | DataLink | EventProperty
|
|
23
|
+
mapping?: string
|
|
24
|
+
}>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Delete */
|
|
28
|
+
export type GeneratorFileActionDelete = Action & {
|
|
29
|
+
__actionName: 'GENERATOR_FILE_DELETE'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Append (Currently only support text file) */
|
|
33
|
+
export type GeneratorFileActionAppendContent = ActionWithParams & {
|
|
34
|
+
__actionName: 'GENERATOR_FILE_APPEND_CONTENT'
|
|
35
|
+
params?: Array<
|
|
36
|
+
| {
|
|
37
|
+
input: 'content'
|
|
38
|
+
value?: string | DataLink | EventProperty
|
|
39
|
+
mapping?: string
|
|
40
|
+
}
|
|
41
|
+
| {
|
|
42
|
+
input: 'encoding'
|
|
43
|
+
value?: 'utf8' | 'base64' | DataLink | EventProperty
|
|
44
|
+
mapping?: string
|
|
45
|
+
}
|
|
46
|
+
| {
|
|
47
|
+
input: 'contentList'
|
|
48
|
+
value?: Array<any> | DataLink | EventProperty
|
|
49
|
+
mapping?: string
|
|
50
|
+
}
|
|
51
|
+
>
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Write (Currently only support text file) */
|
|
55
|
+
export type GeneratorFileActionWriteContent = ActionWithParams & {
|
|
56
|
+
__actionName: 'GENERATOR_FILE_WRITE_CONTENT'
|
|
57
|
+
params?: Array<
|
|
58
|
+
| {
|
|
59
|
+
input: 'content'
|
|
60
|
+
value?: string | DataLink | EventProperty
|
|
61
|
+
mapping?: string
|
|
62
|
+
}
|
|
63
|
+
| {
|
|
64
|
+
input: 'encoding'
|
|
65
|
+
value?: 'utf8' | 'base64' | DataLink | EventProperty
|
|
66
|
+
mapping?: string
|
|
67
|
+
}
|
|
68
|
+
| {
|
|
69
|
+
input: 'position'
|
|
70
|
+
value?: number | DataLink | EventProperty
|
|
71
|
+
mapping?: string
|
|
72
|
+
}
|
|
73
|
+
| {
|
|
74
|
+
input: 'contentList'
|
|
75
|
+
value?: Array<any> | DataLink | EventProperty
|
|
76
|
+
mapping?: string
|
|
77
|
+
}
|
|
78
|
+
>
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* Start upload (All or By ID or By Index) */
|
|
82
|
+
export type GeneratorFileActionStartUpload = ActionWithParams & {
|
|
83
|
+
__actionName: 'GENERATOR_FILE_START_UPLOAD'
|
|
84
|
+
params?: Array<
|
|
85
|
+
| {
|
|
86
|
+
input: 'withAll'
|
|
87
|
+
value?: boolean | DataLink | EventProperty
|
|
88
|
+
mapping?: string
|
|
89
|
+
}
|
|
90
|
+
| {
|
|
91
|
+
input: 'withId'
|
|
92
|
+
value?: string | DataLink | EventProperty
|
|
93
|
+
mapping?: string
|
|
94
|
+
}
|
|
95
|
+
| {
|
|
96
|
+
input: 'withIndex'
|
|
97
|
+
value?: number | DataLink | EventProperty
|
|
98
|
+
mapping?: string
|
|
99
|
+
}
|
|
100
|
+
>
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Stop upload (All or By ID or By Index) */
|
|
104
|
+
export type GeneratorFileActionStopUpload = ActionWithParams & {
|
|
105
|
+
__actionName: 'GENERATOR_FILE_STOP_UPLOAD'
|
|
106
|
+
params?: Array<
|
|
107
|
+
| {
|
|
108
|
+
input: 'withAll'
|
|
109
|
+
value?: boolean | DataLink | EventProperty
|
|
110
|
+
mapping?: string
|
|
111
|
+
}
|
|
112
|
+
| {
|
|
113
|
+
input: 'withId'
|
|
114
|
+
value?: string | DataLink | EventProperty
|
|
115
|
+
mapping?: string
|
|
116
|
+
}
|
|
117
|
+
| {
|
|
118
|
+
input: 'withIndex'
|
|
119
|
+
value?: number | DataLink | EventProperty
|
|
120
|
+
mapping?: string
|
|
121
|
+
}
|
|
122
|
+
>
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* Start download (All or By ID or By Index) */
|
|
126
|
+
export type GeneratorFileActionStartDownload = ActionWithParams & {
|
|
127
|
+
__actionName: 'GENERATOR_FILE_START_DOWNLOAD'
|
|
128
|
+
params?: Array<
|
|
129
|
+
| {
|
|
130
|
+
input: 'withAll'
|
|
131
|
+
value?: boolean | DataLink | EventProperty
|
|
132
|
+
mapping?: string
|
|
133
|
+
}
|
|
134
|
+
| {
|
|
135
|
+
input: 'withId'
|
|
136
|
+
value?: string | DataLink | EventProperty
|
|
137
|
+
mapping?: string
|
|
138
|
+
}
|
|
139
|
+
| {
|
|
140
|
+
input: 'withIndex'
|
|
141
|
+
value?: number | DataLink | EventProperty
|
|
142
|
+
mapping?: string
|
|
143
|
+
}
|
|
144
|
+
>
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* Stop download (All or By ID or By Index) */
|
|
148
|
+
export type GeneratorFileActionStopDownload = ActionWithParams & {
|
|
149
|
+
__actionName: 'GENERATOR_FILE_STOP_DOWNLOAD'
|
|
150
|
+
params?: Array<
|
|
151
|
+
| {
|
|
152
|
+
input: 'withAll'
|
|
153
|
+
value?: boolean | DataLink | EventProperty
|
|
154
|
+
mapping?: string
|
|
155
|
+
}
|
|
156
|
+
| {
|
|
157
|
+
input: 'withId'
|
|
158
|
+
value?: string | DataLink | EventProperty
|
|
159
|
+
mapping?: string
|
|
160
|
+
}
|
|
161
|
+
| {
|
|
162
|
+
input: 'withIndex'
|
|
163
|
+
value?: number | DataLink | EventProperty
|
|
164
|
+
mapping?: string
|
|
165
|
+
}
|
|
166
|
+
>
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* Clear download */
|
|
170
|
+
export type GeneratorFileActionClearDownload = Action & {
|
|
171
|
+
__actionName: 'GENERATOR_FILE_CLEAR_DOWNLOAD'
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
interface GeneratorFileDef {
|
|
175
|
+
/*
|
|
176
|
+
Default property:
|
|
177
|
+
{
|
|
178
|
+
"type": "single",
|
|
179
|
+
"targetDirectory": "none",
|
|
180
|
+
"hashType": "sha256",
|
|
181
|
+
"header": {},
|
|
182
|
+
"fields": {},
|
|
183
|
+
"list": [],
|
|
184
|
+
"downloadAllowLoadSizeLimitExceed": false,
|
|
185
|
+
"downloadRetryCount": 3,
|
|
186
|
+
"downloadMode": "sequence",
|
|
187
|
+
"downloadProgressFrequency": 1000,
|
|
188
|
+
"uploadRetryCount": 3,
|
|
189
|
+
"uploadMode": "sequence",
|
|
190
|
+
"uploadProgressFrequency": 1000
|
|
191
|
+
}
|
|
192
|
+
*/
|
|
193
|
+
property?: {
|
|
194
|
+
/* Type (Single or Multiple) */
|
|
195
|
+
type?: 'single' | 'multiple' | DataLink
|
|
196
|
+
/* Target directory (Default: document directory in app) */
|
|
197
|
+
targetDirectory?: 'none' | 'custom' | 'document' | 'cache' | 'tmp' | DataLink
|
|
198
|
+
/* Target directory (Default: document directory in app) */
|
|
199
|
+
customTargetDirectory?: string | DataLink
|
|
200
|
+
/* File path (If type is single) */
|
|
201
|
+
path?: string | DataLink
|
|
202
|
+
/* File encoding (If type is single) */
|
|
203
|
+
encoding?: 'utf8' | 'base64' | DataLink
|
|
204
|
+
/* URL (If type is single) */
|
|
205
|
+
url?: string | DataLink
|
|
206
|
+
/* Hash value */
|
|
207
|
+
hash?: string | DataLink
|
|
208
|
+
/* Hash type */
|
|
209
|
+
hashType?: 'md5' | 'sha256' | 'sha1' | DataLink
|
|
210
|
+
/* Request method */
|
|
211
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | DataLink
|
|
212
|
+
/* Header */
|
|
213
|
+
header?: {} | DataLink
|
|
214
|
+
/* Fields */
|
|
215
|
+
fields?: {} | DataLink
|
|
216
|
+
/* File list (If type is multiple) */
|
|
217
|
+
list?:
|
|
218
|
+
| Array<
|
|
219
|
+
| DataLink
|
|
220
|
+
| {
|
|
221
|
+
id?: string | DataLink
|
|
222
|
+
path?: string | DataLink
|
|
223
|
+
encoding?: 'utf8' | 'base64' | DataLink
|
|
224
|
+
url?: string | DataLink
|
|
225
|
+
hash?: string | DataLink
|
|
226
|
+
hashType?: 'sha256' | 'sha1' | 'md5' | DataLink
|
|
227
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | DataLink
|
|
228
|
+
header?: {} | DataLink
|
|
229
|
+
fields?: {} | DataLink
|
|
230
|
+
}
|
|
231
|
+
>
|
|
232
|
+
| DataLink
|
|
233
|
+
/* Enable download (URL is required) */
|
|
234
|
+
downloadEnabled?: boolean | DataLink
|
|
235
|
+
/* Download load size limit */
|
|
236
|
+
downloadLoadSizeLimit?: number | DataLink
|
|
237
|
+
/* Download allow load size limit exceed */
|
|
238
|
+
downloadAllowLoadSizeLimitExceed?: boolean | DataLink
|
|
239
|
+
/* Download retry count */
|
|
240
|
+
downloadRetryCount?: number | DataLink
|
|
241
|
+
/* Download mode (if type is multiple) */
|
|
242
|
+
downloadMode?: 'concurrent' | 'sequence' | DataLink
|
|
243
|
+
/* Limit of download concurrent mode */
|
|
244
|
+
downloadConcurrentLimit?: number | DataLink
|
|
245
|
+
/* Download progress frequency */
|
|
246
|
+
downloadProgressFrequency?: number | DataLink
|
|
247
|
+
/* Enable upload (Path & URL is required) */
|
|
248
|
+
uploadEnabled?: boolean | DataLink
|
|
249
|
+
/* Upload retry count */
|
|
250
|
+
uploadRetryCount?: number | DataLink
|
|
251
|
+
/* Upload mode (if type is multiple) */
|
|
252
|
+
uploadMode?: 'concurrent' | 'sequence' | DataLink
|
|
253
|
+
/* Limit of upload concurrent mode */
|
|
254
|
+
uploadConcurrentLimit?: number | DataLink
|
|
255
|
+
/* Upload progress frequency */
|
|
256
|
+
uploadProgressFrequency?: number | DataLink
|
|
257
|
+
}
|
|
258
|
+
events?: {
|
|
259
|
+
/* On file handler init error */
|
|
260
|
+
initError?: Array<EventAction>
|
|
261
|
+
/* On file status change */
|
|
262
|
+
onFileStatusChange?: Array<EventAction>
|
|
263
|
+
/* On read stats error */
|
|
264
|
+
onReadStatsError?: Array<EventAction>
|
|
265
|
+
/* On read content error */
|
|
266
|
+
onReadContentError?: Array<EventAction>
|
|
267
|
+
/* On read content error */
|
|
268
|
+
onAppendContentError?: Array<EventAction>
|
|
269
|
+
/* On write content error */
|
|
270
|
+
onWriteContentError?: Array<EventAction>
|
|
271
|
+
/* On upload progress */
|
|
272
|
+
onUploadProgress?: Array<EventAction>
|
|
273
|
+
/* On upload error */
|
|
274
|
+
onUploadError?: Array<EventAction>
|
|
275
|
+
/* On upload complete */
|
|
276
|
+
onUploadComplete?: Array<EventAction>
|
|
277
|
+
/* On upload all done */
|
|
278
|
+
onUploadAllComplete?: Array<EventAction>
|
|
279
|
+
/* On download progress */
|
|
280
|
+
onDownloadProgress?: Array<EventAction>
|
|
281
|
+
/* On download error */
|
|
282
|
+
onDownloadError?: Array<EventAction>
|
|
283
|
+
/* On download complete */
|
|
284
|
+
onDownloadComplete?: Array<EventAction>
|
|
285
|
+
/* On download all done */
|
|
286
|
+
onDownloadAllComplete?: Array<EventAction>
|
|
287
|
+
}
|
|
288
|
+
outlets?: {
|
|
289
|
+
/* File init error result will be stored in Data */
|
|
290
|
+
initError?: () => Data
|
|
291
|
+
/* File read stats result will be stored in Data */
|
|
292
|
+
readStats?: () => Data
|
|
293
|
+
/* File read content result will be stored in Data */
|
|
294
|
+
readContent?: () => Data
|
|
295
|
+
/* File read details result will be stored in Data */
|
|
296
|
+
readDetails?: () => Data
|
|
297
|
+
/* File read error result will be stored in Data */
|
|
298
|
+
readError?: () => Data
|
|
299
|
+
/* File append content result will be stored in Data */
|
|
300
|
+
appendDetails?: () => Data
|
|
301
|
+
/* File append error result will be stored in Data */
|
|
302
|
+
appendError?: () => Data
|
|
303
|
+
/* File write details result will be stored in Data */
|
|
304
|
+
writeDetails?: () => Data
|
|
305
|
+
/* File write error result will be stored in Data */
|
|
306
|
+
writeError?: () => Data
|
|
307
|
+
/* File upload progress result will be stored in Data */
|
|
308
|
+
uploadProgress?: () => Data
|
|
309
|
+
/* File upload complete result will be stored in Data */
|
|
310
|
+
uploadResult?: () => Data
|
|
311
|
+
/* File download progress result will be stored in Data */
|
|
312
|
+
downloadProgress?: () => Data
|
|
313
|
+
/* File download complete result will be stored in Data */
|
|
314
|
+
downloadResult?: () => Data
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* File handling */
|
|
319
|
+
export type GeneratorFile = Generator &
|
|
320
|
+
GeneratorFileDef & {
|
|
321
|
+
templateKey: 'GENERATOR_FILE'
|
|
322
|
+
switches: Array<
|
|
323
|
+
SwitchDef &
|
|
324
|
+
GeneratorFileDef & {
|
|
325
|
+
conds?: Array<{
|
|
326
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
327
|
+
cond:
|
|
328
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
329
|
+
| SwitchCondData
|
|
330
|
+
| {
|
|
331
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
332
|
+
outlet:
|
|
333
|
+
| 'initError'
|
|
334
|
+
| 'readStats'
|
|
335
|
+
| 'readContent'
|
|
336
|
+
| 'readDetails'
|
|
337
|
+
| 'readError'
|
|
338
|
+
| 'appendDetails'
|
|
339
|
+
| 'appendError'
|
|
340
|
+
| 'writeDetails'
|
|
341
|
+
| 'writeError'
|
|
342
|
+
| 'uploadProgress'
|
|
343
|
+
| 'uploadResult'
|
|
344
|
+
| 'downloadProgress'
|
|
345
|
+
| 'downloadResult'
|
|
346
|
+
value: any
|
|
347
|
+
}
|
|
348
|
+
}>
|
|
349
|
+
}
|
|
350
|
+
>
|
|
351
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
2
|
+
import type { Data, DataLink } from '../data'
|
|
3
|
+
import type {
|
|
4
|
+
Generator,
|
|
5
|
+
EventAction,
|
|
6
|
+
ActionWithDataParams,
|
|
7
|
+
ActionWithParams,
|
|
8
|
+
Action,
|
|
9
|
+
EventProperty,
|
|
10
|
+
} from '../common'
|
|
11
|
+
|
|
12
|
+
/* Execute GraphQL request with defined properties */
|
|
13
|
+
export type GeneratorGraphQLActionRunQuery = ActionWithParams & {
|
|
14
|
+
__actionName: 'GENERATOR_GRAPHQL_RUN_QUERY'
|
|
15
|
+
params?: Array<
|
|
16
|
+
| {
|
|
17
|
+
input: 'type'
|
|
18
|
+
value?: 'query' | 'mutation' | 'subscription' | DataLink | EventProperty
|
|
19
|
+
mapping?: string
|
|
20
|
+
}
|
|
21
|
+
| {
|
|
22
|
+
input: 'query'
|
|
23
|
+
value?: string | DataLink | EventProperty
|
|
24
|
+
mapping?: string
|
|
25
|
+
}
|
|
26
|
+
| {
|
|
27
|
+
input: 'variables'
|
|
28
|
+
value?: {} | DataLink | EventProperty
|
|
29
|
+
mapping?: string
|
|
30
|
+
}
|
|
31
|
+
>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Reset cache of GraphQL client */
|
|
35
|
+
export type GeneratorGraphQLActionResetCache = Action & {
|
|
36
|
+
__actionName: 'GENERATOR_GRAPHQL_RESET_CACHE'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Cancel current running subscription */
|
|
40
|
+
export type GeneratorGraphQLActionCancelSubscription = Action & {
|
|
41
|
+
__actionName: 'GENERATOR_GRAPHQL_CANCEL_SUBSCRIPTION'
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface GeneratorGraphQLDef {
|
|
45
|
+
/*
|
|
46
|
+
Default property:
|
|
47
|
+
{
|
|
48
|
+
"init": false,
|
|
49
|
+
"type": "query",
|
|
50
|
+
"headers": {},
|
|
51
|
+
"query": "",
|
|
52
|
+
"variables": {},
|
|
53
|
+
"firebaseEnabled": false
|
|
54
|
+
}
|
|
55
|
+
*/
|
|
56
|
+
property?: {
|
|
57
|
+
/* Start GraphQL request immediately after generator initialization */
|
|
58
|
+
init?: boolean | DataLink
|
|
59
|
+
/* GraphQL request type */
|
|
60
|
+
type?: 'query' | 'mutation' | 'subscription' | DataLink
|
|
61
|
+
/* HTTP request headers */
|
|
62
|
+
headers?: {} | DataLink
|
|
63
|
+
/* HTTP request URL endpoint */
|
|
64
|
+
endpoint?: string | DataLink
|
|
65
|
+
/* Subscription endpoint */
|
|
66
|
+
endpointForSubscription?: string | DataLink
|
|
67
|
+
/* Subscription connection params */
|
|
68
|
+
connectionParams?: {} | DataLink
|
|
69
|
+
/* Query content */
|
|
70
|
+
query?: string | DataLink
|
|
71
|
+
/* Query variables */
|
|
72
|
+
variables?: {} | DataLink
|
|
73
|
+
/* Data id from response, it is useful for caching data */
|
|
74
|
+
dataIdFromObject?: string | DataLink
|
|
75
|
+
/* Enable Firebase link */
|
|
76
|
+
firebaseEnabled?: boolean | DataLink
|
|
77
|
+
/* Firebase API Key */
|
|
78
|
+
firebaseAPIKey?: string | DataLink
|
|
79
|
+
/* Firebase Realtime Database `authDomain` field */
|
|
80
|
+
firebaseAuthDomain?: string | DataLink
|
|
81
|
+
/* Firebase Realtime Database `databaseURL` field */
|
|
82
|
+
firebaseDatabaseURL?: string | DataLink
|
|
83
|
+
/* Firebase Realtime Database `projectId` field */
|
|
84
|
+
firebaseProjectId?: string | DataLink
|
|
85
|
+
/* Firebase Realtime Database `storageBucket` field */
|
|
86
|
+
firebaseStorageBucket?: string | DataLink
|
|
87
|
+
/* Firebase Realtime Database `messagingSenderId` field */
|
|
88
|
+
firebaseMessagingSenderId?: string | DataLink
|
|
89
|
+
}
|
|
90
|
+
events?: {
|
|
91
|
+
/* Event triggered when subscription connection is successful */
|
|
92
|
+
subscriptionOnConnection?: Array<EventAction>
|
|
93
|
+
/* Event triggered when subscription connection error occurs */
|
|
94
|
+
subscriptionOnConnectionError?: Array<EventAction>
|
|
95
|
+
}
|
|
96
|
+
outlets?: {
|
|
97
|
+
/* Response for GraphQL request, it will save to Data */
|
|
98
|
+
response?: () => Data
|
|
99
|
+
/* Server response error of GraphQL request, it will save to Data */
|
|
100
|
+
error?: () => Data
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Execute GraphQL Query / Mutation / Subscriptions */
|
|
105
|
+
export type GeneratorGraphQL = Generator &
|
|
106
|
+
GeneratorGraphQLDef & {
|
|
107
|
+
templateKey: 'GENERATOR_GRAPHQL'
|
|
108
|
+
switches: Array<
|
|
109
|
+
SwitchDef &
|
|
110
|
+
GeneratorGraphQLDef & {
|
|
111
|
+
conds?: Array<{
|
|
112
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
113
|
+
cond:
|
|
114
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
115
|
+
| SwitchCondData
|
|
116
|
+
| {
|
|
117
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
118
|
+
outlet: 'response' | 'error'
|
|
119
|
+
value: any
|
|
120
|
+
}
|
|
121
|
+
}>
|
|
122
|
+
}
|
|
123
|
+
>
|
|
124
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
2
|
+
import type { Data, DataLink } from '../data'
|
|
3
|
+
import type {
|
|
4
|
+
Generator,
|
|
5
|
+
EventAction,
|
|
6
|
+
ActionWithDataParams,
|
|
7
|
+
ActionWithParams,
|
|
8
|
+
Action,
|
|
9
|
+
EventProperty,
|
|
10
|
+
} from '../common'
|
|
11
|
+
|
|
12
|
+
/* Run HTTP request with defined properties */
|
|
13
|
+
export type GeneratorHTTPActionRunRequest = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_HTTP_RUN_REQUEST'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Abort HTTP request or SSE */
|
|
18
|
+
export type GeneratorHTTPActionAbort = Action & {
|
|
19
|
+
__actionName: 'GENERATOR_HTTP_ABORT'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface GeneratorHTTPDef {
|
|
23
|
+
/*
|
|
24
|
+
Default property:
|
|
25
|
+
{
|
|
26
|
+
"init": false,
|
|
27
|
+
"method": "GET",
|
|
28
|
+
"headers": {},
|
|
29
|
+
"body": {},
|
|
30
|
+
"resType": "json",
|
|
31
|
+
"eventStream": false,
|
|
32
|
+
"eventName": "message"
|
|
33
|
+
}
|
|
34
|
+
*/
|
|
35
|
+
property?: {
|
|
36
|
+
/* Start HTTP request on generator initialized */
|
|
37
|
+
init?: boolean | DataLink
|
|
38
|
+
/* URL of HTTP request */
|
|
39
|
+
url?: string | DataLink
|
|
40
|
+
/* Method of HTTP request */
|
|
41
|
+
method?:
|
|
42
|
+
| 'GET'
|
|
43
|
+
| 'POST'
|
|
44
|
+
| 'PUT'
|
|
45
|
+
| 'DELETE'
|
|
46
|
+
| 'HEAD'
|
|
47
|
+
| 'PATCH'
|
|
48
|
+
| 'OPTIONS'
|
|
49
|
+
| 'CONNECT'
|
|
50
|
+
| 'TRACE'
|
|
51
|
+
| DataLink
|
|
52
|
+
/* HTTP request headers */
|
|
53
|
+
headers?: {} | DataLink
|
|
54
|
+
/* Timeout of HTTP request */
|
|
55
|
+
timeout?: number | DataLink
|
|
56
|
+
/* Mode of HTTP request */
|
|
57
|
+
mode?: 'same-origin' | 'no-cors' | 'cors' | DataLink
|
|
58
|
+
/* Credentials of HTTP request */
|
|
59
|
+
credentials?: 'include' | 'same-origin' | 'omit' | DataLink
|
|
60
|
+
/* Redirect of HTTP request */
|
|
61
|
+
redirect?: 'manual' | 'follow' | 'error' | DataLink
|
|
62
|
+
/* Referrer of HTTP request */
|
|
63
|
+
referrer?: 'no-referrer' | 'client' | DataLink
|
|
64
|
+
/* HTTP request body, it will transform depends on `headers.Content-Type` (`application/json`, `application/x-www-form-urlencoded` or `multipart/form-data`)
|
|
65
|
+
The multipart schema like `{ file: { uri: File, type: File MIME, name: File Name }, field: "value" }` */
|
|
66
|
+
body?: any
|
|
67
|
+
/* HTTP response type */
|
|
68
|
+
resType?: 'json' | 'text' | 'xml' | 'csv' | DataLink
|
|
69
|
+
/* Receive event stream (SSE) */
|
|
70
|
+
eventStream?: boolean | DataLink
|
|
71
|
+
/* Event name to listen on SSE */
|
|
72
|
+
eventName?: string | DataLink | Array<string | DataLink> | DataLink | DataLink
|
|
73
|
+
}
|
|
74
|
+
events?: {}
|
|
75
|
+
outlets?: {
|
|
76
|
+
/* Response for HTTP request */
|
|
77
|
+
response?: () => Data
|
|
78
|
+
/* Response details for HTTP request */
|
|
79
|
+
responseDetails?: () => Data
|
|
80
|
+
/* All received data from event stream */
|
|
81
|
+
eventLog?: () => Data
|
|
82
|
+
/* All received event details from event stream */
|
|
83
|
+
eventLogDetails?: () => Data
|
|
84
|
+
/* EventSource state */
|
|
85
|
+
sseState?: () => Data
|
|
86
|
+
/* Server response error of HTTP request */
|
|
87
|
+
error?: () => Data
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* Execute HTTP requests */
|
|
92
|
+
export type GeneratorHTTP = Generator &
|
|
93
|
+
GeneratorHTTPDef & {
|
|
94
|
+
templateKey: 'GENERATOR_HTTP'
|
|
95
|
+
switches: Array<
|
|
96
|
+
SwitchDef &
|
|
97
|
+
GeneratorHTTPDef & {
|
|
98
|
+
conds?: Array<{
|
|
99
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
100
|
+
cond:
|
|
101
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
102
|
+
| SwitchCondData
|
|
103
|
+
| {
|
|
104
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
105
|
+
outlet:
|
|
106
|
+
| 'response'
|
|
107
|
+
| 'responseDetails'
|
|
108
|
+
| 'eventLog'
|
|
109
|
+
| 'eventLogDetails'
|
|
110
|
+
| 'sseState'
|
|
111
|
+
| 'error'
|
|
112
|
+
value: any
|
|
113
|
+
}
|
|
114
|
+
}>
|
|
115
|
+
}
|
|
116
|
+
>
|
|
117
|
+
}
|