@fugood/bricks-ctor 2.24.0-beta.40
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 +988 -0
- package/compile/index.ts +1245 -0
- package/compile/util.ts +358 -0
- package/index.ts +6 -0
- package/package.json +28 -0
- package/skills/bricks-design/LICENSE.txt +180 -0
- package/skills/bricks-design/SKILL.md +66 -0
- package/skills/bricks-project/SKILL.md +32 -0
- package/skills/bricks-project/rules/animation.md +159 -0
- package/skills/bricks-project/rules/architecture-patterns.md +69 -0
- package/skills/bricks-project/rules/automations.md +221 -0
- package/skills/bricks-project/rules/buttress.md +156 -0
- package/skills/bricks-project/rules/data-calculation.md +208 -0
- package/skills/bricks-project/rules/local-sync.md +129 -0
- package/skills/bricks-project/rules/media-flow.md +158 -0
- package/skills/bricks-project/rules/remote-data-bank.md +196 -0
- package/skills/bricks-project/rules/standby-transition.md +124 -0
- package/skills/rive-marketplace/SKILL.md +99 -0
- package/tools/deploy.ts +151 -0
- package/tools/icons/.gitattributes +1 -0
- package/tools/icons/fa6pro-glyphmap.json +4686 -0
- package/tools/icons/fa6pro-meta.json +3671 -0
- package/tools/mcp-server.ts +28 -0
- package/tools/mcp-tools/compile.ts +91 -0
- package/tools/mcp-tools/huggingface.ts +762 -0
- package/tools/mcp-tools/icons.ts +70 -0
- package/tools/mcp-tools/lottie.ts +102 -0
- package/tools/mcp-tools/media.ts +110 -0
- package/tools/postinstall.ts +229 -0
- package/tools/preview-main.mjs +293 -0
- package/tools/preview.ts +143 -0
- package/tools/pull.ts +116 -0
- package/tsconfig.json +16 -0
- package/types/animation.ts +100 -0
- package/types/automation.ts +235 -0
- package/types/brick-base.ts +80 -0
- package/types/bricks/Camera.ts +246 -0
- package/types/bricks/Chart.ts +372 -0
- package/types/bricks/GenerativeMedia.ts +276 -0
- package/types/bricks/Icon.ts +98 -0
- package/types/bricks/Image.ts +114 -0
- package/types/bricks/Items.ts +476 -0
- package/types/bricks/Lottie.ts +168 -0
- package/types/bricks/Maps.ts +262 -0
- package/types/bricks/QrCode.ts +117 -0
- package/types/bricks/Rect.ts +150 -0
- package/types/bricks/RichText.ts +128 -0
- package/types/bricks/Rive.ts +220 -0
- package/types/bricks/Slideshow.ts +201 -0
- package/types/bricks/Svg.ts +99 -0
- package/types/bricks/Text.ts +148 -0
- package/types/bricks/TextInput.ts +242 -0
- package/types/bricks/Video.ts +175 -0
- package/types/bricks/VideoStreaming.ts +112 -0
- package/types/bricks/WebRtcStream.ts +65 -0
- package/types/bricks/WebView.ts +168 -0
- package/types/bricks/index.ts +21 -0
- package/types/canvas.ts +82 -0
- package/types/common.ts +144 -0
- package/types/data-calc-command.ts +7005 -0
- package/types/data-calc-script.ts +21 -0
- package/types/data-calc.ts +11 -0
- package/types/data.ts +95 -0
- package/types/generators/AlarmClock.ts +110 -0
- package/types/generators/Assistant.ts +621 -0
- package/types/generators/BleCentral.ts +247 -0
- package/types/generators/BlePeripheral.ts +208 -0
- package/types/generators/CanvasMap.ts +74 -0
- package/types/generators/CastlesPay.ts +87 -0
- package/types/generators/DataBank.ts +160 -0
- package/types/generators/File.ts +432 -0
- package/types/generators/GraphQl.ts +132 -0
- package/types/generators/Http.ts +222 -0
- package/types/generators/HttpServer.ts +176 -0
- package/types/generators/Information.ts +103 -0
- package/types/generators/Intent.ts +168 -0
- package/types/generators/Iterator.ts +108 -0
- package/types/generators/Keyboard.ts +105 -0
- package/types/generators/LlmAnthropicCompat.ts +212 -0
- package/types/generators/LlmAppleBuiltin.ts +159 -0
- package/types/generators/LlmGgml.ts +861 -0
- package/types/generators/LlmMediaTekNeuroPilot.ts +235 -0
- package/types/generators/LlmMlx.ts +227 -0
- package/types/generators/LlmOnnx.ts +213 -0
- package/types/generators/LlmOpenAiCompat.ts +244 -0
- package/types/generators/LlmQualcommAiEngine.ts +247 -0
- package/types/generators/Mcp.ts +637 -0
- package/types/generators/McpServer.ts +289 -0
- package/types/generators/MediaFlow.ts +170 -0
- package/types/generators/MqttBroker.ts +141 -0
- package/types/generators/MqttClient.ts +141 -0
- package/types/generators/Question.ts +408 -0
- package/types/generators/RealtimeTranscription.ts +279 -0
- package/types/generators/RerankerGgml.ts +191 -0
- package/types/generators/SerialPort.ts +151 -0
- package/types/generators/SoundPlayer.ts +94 -0
- package/types/generators/SoundRecorder.ts +130 -0
- package/types/generators/SpeechToTextGgml.ts +415 -0
- package/types/generators/SpeechToTextOnnx.ts +236 -0
- package/types/generators/SpeechToTextPlatform.ts +85 -0
- package/types/generators/SqLite.ts +159 -0
- package/types/generators/Step.ts +107 -0
- package/types/generators/SttAppleBuiltin.ts +130 -0
- package/types/generators/Tcp.ts +126 -0
- package/types/generators/TcpServer.ts +147 -0
- package/types/generators/TextToSpeechAppleBuiltin.ts +127 -0
- package/types/generators/TextToSpeechGgml.ts +221 -0
- package/types/generators/TextToSpeechOnnx.ts +178 -0
- package/types/generators/TextToSpeechOpenAiLike.ts +121 -0
- package/types/generators/ThermalPrinter.ts +191 -0
- package/types/generators/Tick.ts +83 -0
- package/types/generators/Udp.ts +120 -0
- package/types/generators/VadGgml.ts +250 -0
- package/types/generators/VadOnnx.ts +231 -0
- package/types/generators/VadTraditional.ts +138 -0
- package/types/generators/VectorStore.ts +257 -0
- package/types/generators/Watchdog.ts +107 -0
- package/types/generators/WebCrawler.ts +103 -0
- package/types/generators/WebRtc.ts +181 -0
- package/types/generators/WebSocket.ts +148 -0
- package/types/generators/index.ts +57 -0
- package/types/index.ts +13 -0
- package/types/subspace.ts +59 -0
- package/types/switch.ts +51 -0
- package/types/system.ts +707 -0
- package/utils/calc.ts +126 -0
- package/utils/data.ts +497 -0
- package/utils/event-props.ts +836 -0
- package/utils/id.ts +80 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/* Auto generated by build script
|
|
2
|
+
*
|
|
3
|
+
* Local STT inference based on [transformers.js](https://huggingface.co/docs/transformers.js)
|
|
4
|
+
* You can use any converted model on HuggingFace.
|
|
5
|
+
*/
|
|
6
|
+
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
7
|
+
import type { Data, DataLink } from '../data'
|
|
8
|
+
import type {
|
|
9
|
+
Brick,
|
|
10
|
+
Generator,
|
|
11
|
+
EventAction,
|
|
12
|
+
ActionWithDataParams,
|
|
13
|
+
ActionWithParams,
|
|
14
|
+
Action,
|
|
15
|
+
EventProperty,
|
|
16
|
+
} from '../common'
|
|
17
|
+
import type { TemplateEventPropsMap } from '../../utils/event-props'
|
|
18
|
+
|
|
19
|
+
/* Load the model */
|
|
20
|
+
export type GeneratorOnnxSTTActionLoadModel = Action & {
|
|
21
|
+
__actionName: 'GENERATOR_ONNX_STT_LOAD_MODEL'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Inference */
|
|
25
|
+
export type GeneratorOnnxSTTActionInfer = ActionWithParams & {
|
|
26
|
+
__actionName: 'GENERATOR_ONNX_STT_INFER'
|
|
27
|
+
params?: Array<{
|
|
28
|
+
input: 'audioUri'
|
|
29
|
+
value?: string | DataLink | EventProperty
|
|
30
|
+
mapping?: string
|
|
31
|
+
}>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Clean cache */
|
|
35
|
+
export type GeneratorOnnxSTTActionCleanCache = Action & {
|
|
36
|
+
__actionName: 'GENERATOR_ONNX_STT_CLEAN_CACHE'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Release context */
|
|
40
|
+
export type GeneratorOnnxSTTActionReleaseContext = Action & {
|
|
41
|
+
__actionName: 'GENERATOR_ONNX_STT_RELEASE_CONTEXT'
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface GeneratorOnnxSTTDef {
|
|
45
|
+
/*
|
|
46
|
+
Default property:
|
|
47
|
+
{
|
|
48
|
+
"model": "whisper-base",
|
|
49
|
+
"modelType": "auto",
|
|
50
|
+
"returnTimestamps": "none",
|
|
51
|
+
"executionMode": "sequential"
|
|
52
|
+
}
|
|
53
|
+
*/
|
|
54
|
+
property?: {
|
|
55
|
+
/* Initialize the TTS context on generator initialization */
|
|
56
|
+
init?: boolean | DataLink
|
|
57
|
+
/* STT model */
|
|
58
|
+
model?: string | DataLink
|
|
59
|
+
/* Model type */
|
|
60
|
+
modelType?: string | DataLink
|
|
61
|
+
/* Quantize type */
|
|
62
|
+
quantizeType?:
|
|
63
|
+
| 'auto'
|
|
64
|
+
| 'none'
|
|
65
|
+
| 'fp16'
|
|
66
|
+
| 'q8'
|
|
67
|
+
| 'int8'
|
|
68
|
+
| 'uint8'
|
|
69
|
+
| 'q4'
|
|
70
|
+
| 'bnb4'
|
|
71
|
+
| 'q4f16'
|
|
72
|
+
| DataLink
|
|
73
|
+
/* Return timestamps */
|
|
74
|
+
returnTimestamps?: 'none' | 'enable' | 'word' | DataLink
|
|
75
|
+
/* Transcription language
|
|
76
|
+
Not specifying the language will auto detect the language. */
|
|
77
|
+
language?:
|
|
78
|
+
| 'English'
|
|
79
|
+
| 'Chinese'
|
|
80
|
+
| 'German'
|
|
81
|
+
| 'Spanish'
|
|
82
|
+
| 'Russian'
|
|
83
|
+
| 'Korean'
|
|
84
|
+
| 'French'
|
|
85
|
+
| 'Japanese'
|
|
86
|
+
| 'Portuguese'
|
|
87
|
+
| 'Turkish'
|
|
88
|
+
| 'Polish'
|
|
89
|
+
| 'Catalan'
|
|
90
|
+
| 'Dutch'
|
|
91
|
+
| 'Arabic'
|
|
92
|
+
| 'Swedish'
|
|
93
|
+
| 'Italian'
|
|
94
|
+
| 'Indonesian'
|
|
95
|
+
| 'Hindi'
|
|
96
|
+
| 'Finnish'
|
|
97
|
+
| 'Vietnamese'
|
|
98
|
+
| 'Hebrew'
|
|
99
|
+
| 'Ukrainian'
|
|
100
|
+
| 'Greek'
|
|
101
|
+
| 'Malay'
|
|
102
|
+
| 'Czech'
|
|
103
|
+
| 'Romanian'
|
|
104
|
+
| 'Danish'
|
|
105
|
+
| 'Hungarian'
|
|
106
|
+
| 'Tamil'
|
|
107
|
+
| 'Norwegian'
|
|
108
|
+
| 'Thai'
|
|
109
|
+
| 'Urdu'
|
|
110
|
+
| 'Croatian'
|
|
111
|
+
| 'Bulgarian'
|
|
112
|
+
| 'Lithuanian'
|
|
113
|
+
| 'Latin'
|
|
114
|
+
| 'Maori'
|
|
115
|
+
| 'Malayalam'
|
|
116
|
+
| 'Welsh'
|
|
117
|
+
| 'Slovak'
|
|
118
|
+
| 'Telugu'
|
|
119
|
+
| 'Persian'
|
|
120
|
+
| 'Latvian'
|
|
121
|
+
| 'Bengali'
|
|
122
|
+
| 'Serbian'
|
|
123
|
+
| 'Azerbaijani'
|
|
124
|
+
| 'Slovenian'
|
|
125
|
+
| 'Kannada'
|
|
126
|
+
| 'Estonian'
|
|
127
|
+
| 'Macedonian'
|
|
128
|
+
| 'Breton'
|
|
129
|
+
| 'Basque'
|
|
130
|
+
| 'Icelandic'
|
|
131
|
+
| 'Armenian'
|
|
132
|
+
| 'Nepali'
|
|
133
|
+
| 'Mongolian'
|
|
134
|
+
| 'Bosnian'
|
|
135
|
+
| 'Kazakh'
|
|
136
|
+
| 'Albanian'
|
|
137
|
+
| 'Swahili'
|
|
138
|
+
| 'Galician'
|
|
139
|
+
| 'Marathi'
|
|
140
|
+
| 'Punjabi'
|
|
141
|
+
| 'Sinhala'
|
|
142
|
+
| 'Khmer'
|
|
143
|
+
| 'Shona'
|
|
144
|
+
| 'Yoruba'
|
|
145
|
+
| 'Somali'
|
|
146
|
+
| 'Afrikaans'
|
|
147
|
+
| 'Occitan'
|
|
148
|
+
| 'Georgian'
|
|
149
|
+
| 'Belarusian'
|
|
150
|
+
| 'Tajik'
|
|
151
|
+
| 'Sindhi'
|
|
152
|
+
| 'Gujarati'
|
|
153
|
+
| 'Amharic'
|
|
154
|
+
| 'Yiddish'
|
|
155
|
+
| 'Lao'
|
|
156
|
+
| 'Uzbek'
|
|
157
|
+
| 'Faroese'
|
|
158
|
+
| 'Haitian Creole'
|
|
159
|
+
| 'Pashto'
|
|
160
|
+
| 'Turkmen'
|
|
161
|
+
| 'Nynorsk'
|
|
162
|
+
| 'Maltese'
|
|
163
|
+
| 'Sanskrit'
|
|
164
|
+
| 'Luxembourgish'
|
|
165
|
+
| 'Myanmar'
|
|
166
|
+
| 'Tibetan'
|
|
167
|
+
| 'Tagalog'
|
|
168
|
+
| 'Malagasy'
|
|
169
|
+
| 'Assamese'
|
|
170
|
+
| 'Tatar'
|
|
171
|
+
| 'Hawaiian '
|
|
172
|
+
| 'Lingala'
|
|
173
|
+
| 'Hausa'
|
|
174
|
+
| 'Bashkir'
|
|
175
|
+
| 'Javanese'
|
|
176
|
+
| 'Sundanese'
|
|
177
|
+
| DataLink
|
|
178
|
+
/* Task */
|
|
179
|
+
task?: 'transcribe' | 'translate' | DataLink
|
|
180
|
+
/* Inferencing chunk length */
|
|
181
|
+
chunkLength?: number | DataLink
|
|
182
|
+
/* Executor candidates, descending order of priority
|
|
183
|
+
Default will be xnnpack, wasm, cpu */
|
|
184
|
+
executors?:
|
|
185
|
+
| Array<'qnn' | 'dml' | 'nnapi' | 'xnnpack' | 'coreml' | 'cpu' | 'wasm' | 'webgpu' | DataLink>
|
|
186
|
+
| DataLink
|
|
187
|
+
/* Execution mode
|
|
188
|
+
Usually when the model has many branches, setting this option to `parallel` will give you better performance. */
|
|
189
|
+
executionMode?: 'sequential' | 'parallel' | DataLink
|
|
190
|
+
/* QNN backend */
|
|
191
|
+
qnnBackend?: 'HTP' | 'HTA' | 'DSP' | 'GPU' | 'CPU' | DataLink
|
|
192
|
+
/* Enable FP16 for QNN HTP */
|
|
193
|
+
qnnHtpEnableFp16?: boolean | DataLink
|
|
194
|
+
/* Enable QNN debug */
|
|
195
|
+
qnnEnableDebug?: boolean | DataLink
|
|
196
|
+
}
|
|
197
|
+
events?: {
|
|
198
|
+
/* Event triggered when state change */
|
|
199
|
+
onContextStateChange?: Array<
|
|
200
|
+
EventAction<string & keyof TemplateEventPropsMap['OnnxStt']['onContextStateChange']>
|
|
201
|
+
>
|
|
202
|
+
/* Event triggered when error occurs */
|
|
203
|
+
onError?: Array<EventAction<string & keyof TemplateEventPropsMap['OnnxStt']['onError']>>
|
|
204
|
+
}
|
|
205
|
+
outlets?: {
|
|
206
|
+
/* Context state */
|
|
207
|
+
contextState?: () => Data<string>
|
|
208
|
+
/* Inference result */
|
|
209
|
+
result?: () => Data<string>
|
|
210
|
+
/* Inference result detail */
|
|
211
|
+
resultDetail?: () => Data<{ [key: string]: any }>
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/* Local STT inference based on [transformers.js](https://huggingface.co/docs/transformers.js)
|
|
216
|
+
You can use any converted model on HuggingFace. */
|
|
217
|
+
export type GeneratorOnnxSTT = Generator &
|
|
218
|
+
GeneratorOnnxSTTDef & {
|
|
219
|
+
templateKey: 'GENERATOR_ONNX_STT'
|
|
220
|
+
switches?: Array<
|
|
221
|
+
SwitchDef &
|
|
222
|
+
GeneratorOnnxSTTDef & {
|
|
223
|
+
conds?: Array<{
|
|
224
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
225
|
+
cond:
|
|
226
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
227
|
+
| SwitchCondData
|
|
228
|
+
| {
|
|
229
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
230
|
+
outlet: 'contextState' | 'result' | 'resultDetail'
|
|
231
|
+
value: any
|
|
232
|
+
}
|
|
233
|
+
}>
|
|
234
|
+
}
|
|
235
|
+
>
|
|
236
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/* Auto generated by build script
|
|
2
|
+
*
|
|
3
|
+
* Speech-to-Text using platform's native capabilities
|
|
4
|
+
*/
|
|
5
|
+
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
6
|
+
import type { Data, DataLink } from '../data'
|
|
7
|
+
import type {
|
|
8
|
+
Brick,
|
|
9
|
+
Generator,
|
|
10
|
+
EventAction,
|
|
11
|
+
ActionWithDataParams,
|
|
12
|
+
ActionWithParams,
|
|
13
|
+
Action,
|
|
14
|
+
EventProperty,
|
|
15
|
+
} from '../common'
|
|
16
|
+
import type { TemplateEventPropsMap } from '../../utils/event-props'
|
|
17
|
+
|
|
18
|
+
/* Start speech recognition */
|
|
19
|
+
export type GeneratorPlatformSTTActionStart = Action & {
|
|
20
|
+
__actionName: 'GENERATOR_PLATFORM_STT_START'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* Stop speech recognition */
|
|
24
|
+
export type GeneratorPlatformSTTActionStop = Action & {
|
|
25
|
+
__actionName: 'GENERATOR_PLATFORM_STT_STOP'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface GeneratorPlatformSTTDef {
|
|
29
|
+
/*
|
|
30
|
+
Default property:
|
|
31
|
+
{
|
|
32
|
+
"locale": "en_US"
|
|
33
|
+
}
|
|
34
|
+
*/
|
|
35
|
+
property?: {
|
|
36
|
+
/* Locale for speech recognition */
|
|
37
|
+
locale?: string | DataLink
|
|
38
|
+
/* [iOS] An array of phrases that should be recognized, even if they are not in the system vocabulary. */
|
|
39
|
+
iosContextualStrings?: Array<string | DataLink> | DataLink
|
|
40
|
+
}
|
|
41
|
+
events?: {
|
|
42
|
+
/* Event for speech recognition start */
|
|
43
|
+
onSpeechStart?: Array<EventAction>
|
|
44
|
+
/* Event for speech recognition end */
|
|
45
|
+
onSpeechEnd?: Array<EventAction>
|
|
46
|
+
/* Event for speech recognition results */
|
|
47
|
+
onSpeechResults?: Array<
|
|
48
|
+
EventAction<string & keyof TemplateEventPropsMap['PlatformStt']['onSpeechResults']>
|
|
49
|
+
>
|
|
50
|
+
/* Event for speech recognition error */
|
|
51
|
+
onSpeechError?: Array<
|
|
52
|
+
EventAction<string & keyof TemplateEventPropsMap['PlatformStt']['onSpeechError']>
|
|
53
|
+
>
|
|
54
|
+
}
|
|
55
|
+
outlets?: {
|
|
56
|
+
/* Recognized speech text */
|
|
57
|
+
recognizedText?: () => Data<string>
|
|
58
|
+
/* Error message */
|
|
59
|
+
errorMessage?: () => Data<string>
|
|
60
|
+
/* Listening status */
|
|
61
|
+
listening?: () => Data<boolean>
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Speech-to-Text using platform's native capabilities */
|
|
66
|
+
export type GeneratorPlatformSTT = Generator &
|
|
67
|
+
GeneratorPlatformSTTDef & {
|
|
68
|
+
templateKey: 'GENERATOR_PLATFORM_STT'
|
|
69
|
+
switches?: Array<
|
|
70
|
+
SwitchDef &
|
|
71
|
+
GeneratorPlatformSTTDef & {
|
|
72
|
+
conds?: Array<{
|
|
73
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
74
|
+
cond:
|
|
75
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
76
|
+
| SwitchCondData
|
|
77
|
+
| {
|
|
78
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
79
|
+
outlet: 'recognizedText' | 'errorMessage' | 'listening'
|
|
80
|
+
value: any
|
|
81
|
+
}
|
|
82
|
+
}>
|
|
83
|
+
}
|
|
84
|
+
>
|
|
85
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/* Auto generated by build script
|
|
2
|
+
*
|
|
3
|
+
* SQLite database: create tables, query, insert, update, and delete with SQL
|
|
4
|
+
*/
|
|
5
|
+
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
6
|
+
import type { Data, DataLink } from '../data'
|
|
7
|
+
import type {
|
|
8
|
+
Brick,
|
|
9
|
+
Generator,
|
|
10
|
+
EventAction,
|
|
11
|
+
ActionWithDataParams,
|
|
12
|
+
ActionWithParams,
|
|
13
|
+
Action,
|
|
14
|
+
EventProperty,
|
|
15
|
+
} from '../common'
|
|
16
|
+
import type { TemplateEventPropsMap } from '../../utils/event-props'
|
|
17
|
+
|
|
18
|
+
/* Execute SQL statement */
|
|
19
|
+
export type GeneratorSqliteActionExecute = ActionWithParams & {
|
|
20
|
+
__actionName: 'GENERATOR_SQLITE_EXECUTE'
|
|
21
|
+
params?: Array<
|
|
22
|
+
| {
|
|
23
|
+
input: 'sql'
|
|
24
|
+
value?: string | DataLink | EventProperty
|
|
25
|
+
mapping?: string
|
|
26
|
+
}
|
|
27
|
+
| {
|
|
28
|
+
input: 'params'
|
|
29
|
+
value?: Array<any> | DataLink | EventProperty
|
|
30
|
+
mapping?: string
|
|
31
|
+
}
|
|
32
|
+
| {
|
|
33
|
+
input: 'paramsString'
|
|
34
|
+
value?: string | DataLink | EventProperty
|
|
35
|
+
mapping?: string
|
|
36
|
+
}
|
|
37
|
+
>
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Query data from database */
|
|
41
|
+
export type GeneratorSqliteActionQuery = ActionWithParams & {
|
|
42
|
+
__actionName: 'GENERATOR_SQLITE_QUERY'
|
|
43
|
+
params?: Array<
|
|
44
|
+
| {
|
|
45
|
+
input: 'sql'
|
|
46
|
+
value?: string | DataLink | EventProperty
|
|
47
|
+
mapping?: string
|
|
48
|
+
}
|
|
49
|
+
| {
|
|
50
|
+
input: 'params'
|
|
51
|
+
value?: Array<any> | DataLink | EventProperty
|
|
52
|
+
mapping?: string
|
|
53
|
+
}
|
|
54
|
+
| {
|
|
55
|
+
input: 'paramsString'
|
|
56
|
+
value?: string | DataLink | EventProperty
|
|
57
|
+
mapping?: string
|
|
58
|
+
}
|
|
59
|
+
>
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Execute multiple SQL statements in transaction */
|
|
63
|
+
export type GeneratorSqliteActionTransaction = ActionWithParams & {
|
|
64
|
+
__actionName: 'GENERATOR_SQLITE_TRANSACTION'
|
|
65
|
+
params?: Array<{
|
|
66
|
+
input: 'statements'
|
|
67
|
+
value?: Array<any> | DataLink | EventProperty
|
|
68
|
+
mapping?: string
|
|
69
|
+
}>
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Execute same SQL statement with multiple parameter sets */
|
|
73
|
+
export type GeneratorSqliteActionBatchExecute = ActionWithParams & {
|
|
74
|
+
__actionName: 'GENERATOR_SQLITE_BATCH_EXECUTE'
|
|
75
|
+
params?: Array<
|
|
76
|
+
| {
|
|
77
|
+
input: 'sql'
|
|
78
|
+
value?: string | DataLink | EventProperty
|
|
79
|
+
mapping?: string
|
|
80
|
+
}
|
|
81
|
+
| {
|
|
82
|
+
input: 'batchParams'
|
|
83
|
+
value?: Array<any> | DataLink | EventProperty
|
|
84
|
+
mapping?: string
|
|
85
|
+
}
|
|
86
|
+
>
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface GeneratorSqliteDef {
|
|
90
|
+
/*
|
|
91
|
+
Default property:
|
|
92
|
+
{
|
|
93
|
+
"init": false,
|
|
94
|
+
"dbName": "default",
|
|
95
|
+
"storageType": "file",
|
|
96
|
+
"useFile": false
|
|
97
|
+
}
|
|
98
|
+
*/
|
|
99
|
+
property?: {
|
|
100
|
+
/* Initialize database on subspace mounted */
|
|
101
|
+
init?: boolean | DataLink
|
|
102
|
+
/* Database name */
|
|
103
|
+
dbName?: string | DataLink
|
|
104
|
+
/* Storage type */
|
|
105
|
+
storageType?: 'file' | 'memory' | DataLink
|
|
106
|
+
/* Use specific file (memory type will be ignored) */
|
|
107
|
+
useFile?: boolean | DataLink
|
|
108
|
+
/* File URI for SQLite database */
|
|
109
|
+
fileUri?: string | DataLink
|
|
110
|
+
/* MD5 hash of file URI */
|
|
111
|
+
fileUriMd5?: string | DataLink
|
|
112
|
+
}
|
|
113
|
+
events?: {
|
|
114
|
+
/* Event triggered when error occurs */
|
|
115
|
+
onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Sqlite']['onError']>>
|
|
116
|
+
/* Event triggered when query result is ready */
|
|
117
|
+
onQueryResult?: Array<
|
|
118
|
+
EventAction<string & keyof TemplateEventPropsMap['Sqlite']['onQueryResult']>
|
|
119
|
+
>
|
|
120
|
+
}
|
|
121
|
+
outlets?: {
|
|
122
|
+
/* Whether the database is ready */
|
|
123
|
+
isReady?: () => Data<boolean>
|
|
124
|
+
/* Database path */
|
|
125
|
+
dbPath?: () => Data<string>
|
|
126
|
+
/* Error message */
|
|
127
|
+
error?: () => Data<string>
|
|
128
|
+
/* Last query result */
|
|
129
|
+
lastResult?: () => Data<Array<{ [key: string]: any }>>
|
|
130
|
+
/* Last execute result with metadata */
|
|
131
|
+
lastExecuteResult?: () => Data<{
|
|
132
|
+
rowsAffected?: number
|
|
133
|
+
insertId?: number
|
|
134
|
+
[key: string]: any
|
|
135
|
+
}>
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* SQLite database: create tables, query, insert, update, and delete with SQL */
|
|
140
|
+
export type GeneratorSqlite = Generator &
|
|
141
|
+
GeneratorSqliteDef & {
|
|
142
|
+
templateKey: 'GENERATOR_SQLITE'
|
|
143
|
+
switches?: Array<
|
|
144
|
+
SwitchDef &
|
|
145
|
+
GeneratorSqliteDef & {
|
|
146
|
+
conds?: Array<{
|
|
147
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
148
|
+
cond:
|
|
149
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
150
|
+
| SwitchCondData
|
|
151
|
+
| {
|
|
152
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
153
|
+
outlet: 'isReady' | 'dbPath' | 'error' | 'lastResult' | 'lastExecuteResult'
|
|
154
|
+
value: any
|
|
155
|
+
}
|
|
156
|
+
}>
|
|
157
|
+
}
|
|
158
|
+
>
|
|
159
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/* Auto generated by build script
|
|
2
|
+
*
|
|
3
|
+
* Trigger change canvas / outlet / event by setup rules
|
|
4
|
+
*/
|
|
5
|
+
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
6
|
+
import type { Data, DataLink } from '../data'
|
|
7
|
+
import type {
|
|
8
|
+
Brick,
|
|
9
|
+
Generator,
|
|
10
|
+
EventAction,
|
|
11
|
+
ActionWithDataParams,
|
|
12
|
+
ActionWithParams,
|
|
13
|
+
Action,
|
|
14
|
+
EventProperty,
|
|
15
|
+
} from '../common'
|
|
16
|
+
import type { TemplateEventPropsMap } from '../../utils/event-props'
|
|
17
|
+
|
|
18
|
+
/* Start execute the step */
|
|
19
|
+
export type GeneratorStepActionStart = Action & {
|
|
20
|
+
__actionName: 'GENERATOR_STEP_START'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* Pause steps */
|
|
24
|
+
export type GeneratorStepActionPause = Action & {
|
|
25
|
+
__actionName: 'GENERATOR_STEP_PAUSE'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Resume from pause step */
|
|
29
|
+
export type GeneratorStepActionResume = Action & {
|
|
30
|
+
__actionName: 'GENERATOR_STEP_RESUME'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Skip to the previous step and execute directly */
|
|
34
|
+
export type GeneratorStepActionPerviousStep = Action & {
|
|
35
|
+
__actionName: 'GENERATOR_STEP_PERVIOUS_STEP'
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* Skip to the next step and execute directly */
|
|
39
|
+
export type GeneratorStepActionNextStep = Action & {
|
|
40
|
+
__actionName: 'GENERATOR_STEP_NEXT_STEP'
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Skip to the first step and execute directly */
|
|
44
|
+
export type GeneratorStepActionFirstStep = Action & {
|
|
45
|
+
__actionName: 'GENERATOR_STEP_FIRST_STEP'
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Skip to the last step and execute directly */
|
|
49
|
+
export type GeneratorStepActionLastStep = Action & {
|
|
50
|
+
__actionName: 'GENERATOR_STEP_LAST_STEP'
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface GeneratorStepDef {
|
|
54
|
+
/*
|
|
55
|
+
Default property:
|
|
56
|
+
{
|
|
57
|
+
"init": false,
|
|
58
|
+
"steps": []
|
|
59
|
+
}
|
|
60
|
+
*/
|
|
61
|
+
property?: {
|
|
62
|
+
init?: boolean | DataLink
|
|
63
|
+
/* Step definition list */
|
|
64
|
+
steps?:
|
|
65
|
+
| Array<
|
|
66
|
+
| DataLink
|
|
67
|
+
| {
|
|
68
|
+
duration?: number | DataLink
|
|
69
|
+
action?: 'change-canvas' | 'outlet' | 'event' | DataLink
|
|
70
|
+
payload?: string | DataLink
|
|
71
|
+
}
|
|
72
|
+
>
|
|
73
|
+
| DataLink
|
|
74
|
+
}
|
|
75
|
+
events?: {
|
|
76
|
+
/* Event on step (If action is `event`) */
|
|
77
|
+
onStep?: Array<EventAction<string & keyof TemplateEventPropsMap['Step']['onStep']>>
|
|
78
|
+
}
|
|
79
|
+
outlets?: {
|
|
80
|
+
/* Result of step payload (If action is `outlet`) */
|
|
81
|
+
payload?: () => Data<string>
|
|
82
|
+
/* Result of step index (If action is `outlet`) */
|
|
83
|
+
index?: () => Data<number>
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Trigger change canvas / outlet / event by setup rules */
|
|
88
|
+
export type GeneratorStep = Generator &
|
|
89
|
+
GeneratorStepDef & {
|
|
90
|
+
templateKey: 'GENERATOR_STEP'
|
|
91
|
+
switches?: Array<
|
|
92
|
+
SwitchDef &
|
|
93
|
+
GeneratorStepDef & {
|
|
94
|
+
conds?: Array<{
|
|
95
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
96
|
+
cond:
|
|
97
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
98
|
+
| SwitchCondData
|
|
99
|
+
| {
|
|
100
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
101
|
+
outlet: 'payload' | 'index'
|
|
102
|
+
value: any
|
|
103
|
+
}
|
|
104
|
+
}>
|
|
105
|
+
}
|
|
106
|
+
>
|
|
107
|
+
}
|