@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,289 @@
|
|
|
1
|
+
/* Auto generated by build script
|
|
2
|
+
*
|
|
3
|
+
* MCP server exposing tools, resources (static/detect-data-change/script), and prompts. Supports HTTP listening with Bearer auth or direct-link from in-app MCP client
|
|
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
|
+
/* Refresh tools and resources, used for case if tools or resources are changed. Note that the current connections will be closed. */
|
|
19
|
+
export type GeneratorMCPServerActionRefreshResources = Action & {
|
|
20
|
+
__actionName: 'GENERATOR_MCP_SERVER_REFRESH_RESOURCES'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface GeneratorMCPServerDef {
|
|
24
|
+
/*
|
|
25
|
+
Default property:
|
|
26
|
+
{
|
|
27
|
+
"enabled": true,
|
|
28
|
+
"listening": true,
|
|
29
|
+
"authType": "none",
|
|
30
|
+
"name": "bricks-foundation-mcp-server-default",
|
|
31
|
+
"version": "1.0.0",
|
|
32
|
+
"resources": [],
|
|
33
|
+
"tools": [],
|
|
34
|
+
"prompts": []
|
|
35
|
+
}
|
|
36
|
+
*/
|
|
37
|
+
property?: {
|
|
38
|
+
/* Enable MCP server. If enabled and Listening is false, the generator can still provide application-scoped resources. */
|
|
39
|
+
enabled?: boolean | DataLink
|
|
40
|
+
/* Application-scoped generator key, key cannot be the same with other application-scoped generators */
|
|
41
|
+
globalGeneratorKey?: string | DataLink
|
|
42
|
+
/* Start MCP server */
|
|
43
|
+
listening?: boolean | DataLink
|
|
44
|
+
/* HTTP server port */
|
|
45
|
+
port?: number | DataLink
|
|
46
|
+
/* Authorization type of HTTP request */
|
|
47
|
+
authType?: 'none' | 'bearer' | DataLink
|
|
48
|
+
/* Token of bearer auth */
|
|
49
|
+
bearerToken?: string | DataLink
|
|
50
|
+
/* Name of the MCP server */
|
|
51
|
+
name?: string | DataLink
|
|
52
|
+
/* Version of the MCP server */
|
|
53
|
+
version?: string | DataLink
|
|
54
|
+
/* Resources
|
|
55
|
+
Type:
|
|
56
|
+
`static`: Return static data
|
|
57
|
+
`detect-data-change`: Watch data target change to return data,
|
|
58
|
+
please update data with ({ id: string, content: string | object }),
|
|
59
|
+
and ensure the id is same with request id
|
|
60
|
+
`script`: Run a JavaScript code to return data
|
|
61
|
+
- Script can define members to call generator functions
|
|
62
|
+
- Script support async/await */
|
|
63
|
+
resources?:
|
|
64
|
+
| Array<
|
|
65
|
+
| DataLink
|
|
66
|
+
| {
|
|
67
|
+
enabled?: boolean | DataLink
|
|
68
|
+
name?: string | DataLink
|
|
69
|
+
description?: string | DataLink
|
|
70
|
+
uriOrTemplate?: string | DataLink
|
|
71
|
+
type?: 'static' | 'detect-data-change' | 'script' | DataLink
|
|
72
|
+
staticData?: any
|
|
73
|
+
dataChangeConfig?:
|
|
74
|
+
| DataLink
|
|
75
|
+
| {
|
|
76
|
+
target?: string | DataLink | (() => Data)
|
|
77
|
+
timeout?: number | DataLink
|
|
78
|
+
additionalParams?: {} | DataLink
|
|
79
|
+
}
|
|
80
|
+
scriptConfig?:
|
|
81
|
+
| DataLink
|
|
82
|
+
| {
|
|
83
|
+
code?: string | DataLink
|
|
84
|
+
timeout?: number | DataLink
|
|
85
|
+
members?:
|
|
86
|
+
| Array<
|
|
87
|
+
| DataLink
|
|
88
|
+
| {
|
|
89
|
+
handler?: string | DataLink | (() => Generator)
|
|
90
|
+
varName?: string | DataLink
|
|
91
|
+
}
|
|
92
|
+
>
|
|
93
|
+
| DataLink
|
|
94
|
+
additionalParams?: {} | DataLink
|
|
95
|
+
}
|
|
96
|
+
responseType?: 'text' | 'object' | DataLink
|
|
97
|
+
}
|
|
98
|
+
>
|
|
99
|
+
| DataLink
|
|
100
|
+
/* Tools
|
|
101
|
+
Type:
|
|
102
|
+
`static`: Return static data
|
|
103
|
+
`detect-data-change`: Watch data target change to return data,
|
|
104
|
+
please update data with ({ id: string, content: string | object }),
|
|
105
|
+
and ensure the id is same with request id.
|
|
106
|
+
`script`: Run a JavaScript code to return data
|
|
107
|
+
- Script can define members to call generator functions
|
|
108
|
+
- Script support async/await */
|
|
109
|
+
tools?:
|
|
110
|
+
| Array<
|
|
111
|
+
| DataLink
|
|
112
|
+
| {
|
|
113
|
+
enabled?: boolean | DataLink
|
|
114
|
+
name?: string | DataLink
|
|
115
|
+
description?: string | DataLink
|
|
116
|
+
params?: {} | DataLink
|
|
117
|
+
type?: 'static' | 'detect-data-change' | 'script' | DataLink
|
|
118
|
+
staticData?: any
|
|
119
|
+
dataChangeConfig?:
|
|
120
|
+
| DataLink
|
|
121
|
+
| {
|
|
122
|
+
target?: string | DataLink | (() => Data)
|
|
123
|
+
timeout?: number | DataLink
|
|
124
|
+
additionalParams?: {} | DataLink
|
|
125
|
+
}
|
|
126
|
+
scriptConfig?:
|
|
127
|
+
| DataLink
|
|
128
|
+
| {
|
|
129
|
+
code?: string | DataLink
|
|
130
|
+
timeout?: number | DataLink
|
|
131
|
+
members?:
|
|
132
|
+
| Array<
|
|
133
|
+
| DataLink
|
|
134
|
+
| {
|
|
135
|
+
handler?: string | DataLink | (() => Generator)
|
|
136
|
+
varName?: string | DataLink
|
|
137
|
+
}
|
|
138
|
+
>
|
|
139
|
+
| DataLink
|
|
140
|
+
additionalParams?: {} | DataLink
|
|
141
|
+
}
|
|
142
|
+
responseType?: 'text' | 'object' | DataLink
|
|
143
|
+
}
|
|
144
|
+
>
|
|
145
|
+
| DataLink
|
|
146
|
+
/* Prompts
|
|
147
|
+
Type:
|
|
148
|
+
`static`: Return static data
|
|
149
|
+
`detect-data-change`: Watch data target change to return data,
|
|
150
|
+
please update data with ({ id: string, content: string | object }),
|
|
151
|
+
and ensure the id is same with request id
|
|
152
|
+
`script`: Run a JavaScript code to return data
|
|
153
|
+
- Script can define members to call generator functions
|
|
154
|
+
- Script support async/await */
|
|
155
|
+
prompts?:
|
|
156
|
+
| Array<
|
|
157
|
+
| DataLink
|
|
158
|
+
| {
|
|
159
|
+
enabled?: boolean | DataLink
|
|
160
|
+
name?: string | DataLink
|
|
161
|
+
description?: string | DataLink
|
|
162
|
+
arguments?: {} | DataLink
|
|
163
|
+
type?: 'static' | 'detect-data-change' | 'script' | DataLink
|
|
164
|
+
staticData?: any
|
|
165
|
+
dataChangeConfig?:
|
|
166
|
+
| DataLink
|
|
167
|
+
| {
|
|
168
|
+
target?: string | DataLink | (() => Data)
|
|
169
|
+
timeout?: number | DataLink
|
|
170
|
+
additionalParams?: {} | DataLink
|
|
171
|
+
}
|
|
172
|
+
scriptConfig?:
|
|
173
|
+
| DataLink
|
|
174
|
+
| {
|
|
175
|
+
code?: string | DataLink
|
|
176
|
+
timeout?: number | DataLink
|
|
177
|
+
members?:
|
|
178
|
+
| Array<
|
|
179
|
+
| DataLink
|
|
180
|
+
| {
|
|
181
|
+
handler?: string | DataLink | (() => Generator)
|
|
182
|
+
varName?: string | DataLink
|
|
183
|
+
}
|
|
184
|
+
>
|
|
185
|
+
| DataLink
|
|
186
|
+
additionalParams?: {} | DataLink
|
|
187
|
+
}
|
|
188
|
+
responseType?: 'text' | 'object' | DataLink
|
|
189
|
+
}
|
|
190
|
+
>
|
|
191
|
+
| DataLink
|
|
192
|
+
}
|
|
193
|
+
events?: {
|
|
194
|
+
/* Listening of HTTP server */
|
|
195
|
+
onListening?: Array<EventAction>
|
|
196
|
+
/* Error of HTTP server */
|
|
197
|
+
onError?: Array<EventAction<string & keyof TemplateEventPropsMap['McpServer']['onError']>>
|
|
198
|
+
/* Client error of HTTP server */
|
|
199
|
+
onClientError?: Array<
|
|
200
|
+
EventAction<string & keyof TemplateEventPropsMap['McpServer']['onClientError']>
|
|
201
|
+
>
|
|
202
|
+
/* Client close of HTTP server */
|
|
203
|
+
onClientClose?: Array<
|
|
204
|
+
EventAction<string & keyof TemplateEventPropsMap['McpServer']['onClientClose']>
|
|
205
|
+
>
|
|
206
|
+
/* On request resource (Request: { name: string, uri: string, params: object }) */
|
|
207
|
+
onRequestResource?: Array<
|
|
208
|
+
EventAction<string & keyof TemplateEventPropsMap['McpServer']['onRequestResource']>
|
|
209
|
+
>
|
|
210
|
+
/* On call tool (Request: { name: string, params: object }) */
|
|
211
|
+
onCallTool?: Array<EventAction<string & keyof TemplateEventPropsMap['McpServer']['onCallTool']>>
|
|
212
|
+
/* On get prompt (Request: { name: string, arguments: object }) */
|
|
213
|
+
onGetPrompt?: Array<
|
|
214
|
+
EventAction<string & keyof TemplateEventPropsMap['McpServer']['onGetPrompt']>
|
|
215
|
+
>
|
|
216
|
+
}
|
|
217
|
+
outlets?: {
|
|
218
|
+
/* Whether the HTTP server is listening */
|
|
219
|
+
isListening?: () => Data<boolean>
|
|
220
|
+
/* Last error of HTTP server */
|
|
221
|
+
lastError?: () => Data<string>
|
|
222
|
+
/* MCP server endpoint URL */
|
|
223
|
+
endpoint?: () => Data<string>
|
|
224
|
+
/* Connected remotes (Session ID) */
|
|
225
|
+
connectedRemotes?: () => Data<Array<string>>
|
|
226
|
+
/* Last resource request ({ name: string, uri: string, params: object }) */
|
|
227
|
+
lastResourceRequest?: () => Data<{
|
|
228
|
+
type?: string
|
|
229
|
+
id?: string
|
|
230
|
+
name?: string
|
|
231
|
+
uri?: string
|
|
232
|
+
params?: { [key: string]: any }
|
|
233
|
+
arguments?: { [key: string]: any }
|
|
234
|
+
timeout?: number
|
|
235
|
+
[key: string]: any
|
|
236
|
+
}>
|
|
237
|
+
/* Last tool call ({ name: string, params: object }) */
|
|
238
|
+
lastToolCall?: () => Data<{
|
|
239
|
+
type?: string
|
|
240
|
+
id?: string
|
|
241
|
+
name?: string
|
|
242
|
+
uri?: string
|
|
243
|
+
params?: { [key: string]: any }
|
|
244
|
+
arguments?: { [key: string]: any }
|
|
245
|
+
timeout?: number
|
|
246
|
+
[key: string]: any
|
|
247
|
+
}>
|
|
248
|
+
/* Last prompt get ({ name: string, arguments: object }) */
|
|
249
|
+
lastPromptGet?: () => Data<{
|
|
250
|
+
type?: string
|
|
251
|
+
id?: string
|
|
252
|
+
name?: string
|
|
253
|
+
uri?: string
|
|
254
|
+
params?: { [key: string]: any }
|
|
255
|
+
arguments?: { [key: string]: any }
|
|
256
|
+
timeout?: number
|
|
257
|
+
[key: string]: any
|
|
258
|
+
}>
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* MCP server exposing tools, resources (static/detect-data-change/script), and prompts. Supports HTTP listening with Bearer auth or direct-link from in-app MCP client */
|
|
263
|
+
export type GeneratorMCPServer = Generator &
|
|
264
|
+
GeneratorMCPServerDef & {
|
|
265
|
+
templateKey: 'GENERATOR_MCP_SERVER'
|
|
266
|
+
switches?: Array<
|
|
267
|
+
SwitchDef &
|
|
268
|
+
GeneratorMCPServerDef & {
|
|
269
|
+
conds?: Array<{
|
|
270
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
271
|
+
cond:
|
|
272
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
273
|
+
| SwitchCondData
|
|
274
|
+
| {
|
|
275
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
276
|
+
outlet:
|
|
277
|
+
| 'isListening'
|
|
278
|
+
| 'lastError'
|
|
279
|
+
| 'endpoint'
|
|
280
|
+
| 'connectedRemotes'
|
|
281
|
+
| 'lastResourceRequest'
|
|
282
|
+
| 'lastToolCall'
|
|
283
|
+
| 'lastPromptGet'
|
|
284
|
+
value: any
|
|
285
|
+
}
|
|
286
|
+
}>
|
|
287
|
+
}
|
|
288
|
+
>
|
|
289
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/* Auto generated by build script
|
|
2
|
+
*
|
|
3
|
+
* Fetch box's file list from Media Flow
|
|
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 fetcn Media box file list */
|
|
19
|
+
export type GeneratorMediaFlowActionFetch = Action & {
|
|
20
|
+
__actionName: 'GENERATOR_MEDIA_FLOW_FETCH'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* Reset cache */
|
|
24
|
+
export type GeneratorMediaFlowActionResetCache = Action & {
|
|
25
|
+
__actionName: 'GENERATOR_MEDIA_FLOW_RESET_CACHE'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Abort current fetch request of media list */
|
|
29
|
+
export type GeneratorMediaFlowActionAbortFetch = Action & {
|
|
30
|
+
__actionName: 'GENERATOR_MEDIA_FLOW_ABORT_FETCH'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface GeneratorMediaFlowDef {
|
|
34
|
+
/*
|
|
35
|
+
Default property:
|
|
36
|
+
{
|
|
37
|
+
"includeTypes": [
|
|
38
|
+
"IMAGE",
|
|
39
|
+
"VIDEO",
|
|
40
|
+
"AUDIO",
|
|
41
|
+
"FILE"
|
|
42
|
+
],
|
|
43
|
+
"fetchPolicy": "cache-first",
|
|
44
|
+
"subscribeBoxChange": false,
|
|
45
|
+
"saveToStorageDownloadMode": "sequence",
|
|
46
|
+
"loadSizeLimit": "",
|
|
47
|
+
"allowLoadSizeLimitExceed": true,
|
|
48
|
+
"source": "original",
|
|
49
|
+
"sourceVersionAlternatives": []
|
|
50
|
+
}
|
|
51
|
+
*/
|
|
52
|
+
property?: {
|
|
53
|
+
/* The box id of Media Flow */
|
|
54
|
+
boxId?: string | DataLink
|
|
55
|
+
/* Authorize accessToken, use `passcode` if `accessToken` is empty */
|
|
56
|
+
accessToken?: string | DataLink
|
|
57
|
+
/* Authorize passcode */
|
|
58
|
+
passcode?: string | DataLink
|
|
59
|
+
/* Include File Types */
|
|
60
|
+
includeTypes?: Array<'IMAGE' | 'VIDEO' | 'AUDIO' | 'FILE' | DataLink> | DataLink
|
|
61
|
+
/* Determine the cache behavior
|
|
62
|
+
|
|
63
|
+
cache-first: Cache first if existing, then fetch from network
|
|
64
|
+
network-and-cache: Fetch from network, then save cache
|
|
65
|
+
network-only: Fetch from network only */
|
|
66
|
+
fetchPolicy?: 'cache-first' | 'network-and-cache' | 'network-only' | DataLink
|
|
67
|
+
/* Subscribe box change to refresh file list (file deleted / new file uploaded) */
|
|
68
|
+
subscribeBoxChange?: boolean | DataLink
|
|
69
|
+
/* Save files into local file storage */
|
|
70
|
+
saveToStorage?: boolean | DataLink
|
|
71
|
+
/* Concurrent download files or sequence for saveToStorage */
|
|
72
|
+
saveToStorageDownloadMode?: 'sequence' | 'concurrent' | DataLink
|
|
73
|
+
/* Limit the load size (* GB, * MB, * KB) */
|
|
74
|
+
loadSizeLimit?: string | DataLink
|
|
75
|
+
/* Allow Load size limit exceed, just call event */
|
|
76
|
+
allowLoadSizeLimitExceed?: boolean | DataLink
|
|
77
|
+
/* Select download source */
|
|
78
|
+
source?:
|
|
79
|
+
| 'original'
|
|
80
|
+
| 'auto'
|
|
81
|
+
| 'converted'
|
|
82
|
+
| 'video-thumbnail-original'
|
|
83
|
+
| 'use-source-versions'
|
|
84
|
+
| DataLink
|
|
85
|
+
/* Select download source with image version (use width, e.g. [250, 360]) */
|
|
86
|
+
sourceVersionAlternatives?: Array<number | DataLink> | DataLink
|
|
87
|
+
/* Allowlist patterns to filter media files (supports regex or plain text) */
|
|
88
|
+
allowlist?: Array<string | DataLink> | DataLink
|
|
89
|
+
/* Blocklist patterns to filter media files (supports regex or plain text) */
|
|
90
|
+
blocklist?: Array<string | DataLink> | DataLink
|
|
91
|
+
}
|
|
92
|
+
events?: {
|
|
93
|
+
/* Event of media box fetch error */
|
|
94
|
+
fetchError?: Array<EventAction<string & keyof TemplateEventPropsMap['MediaFlow']['fetchError']>>
|
|
95
|
+
/* Event of subscribe box change connected (If set `Subscribe Box Change`) */
|
|
96
|
+
subscribeBoxConnect?: Array<EventAction>
|
|
97
|
+
/* Event of subscribe box change error (If set `Subscribe Box Change`) */
|
|
98
|
+
subscribeBoxError?: Array<
|
|
99
|
+
EventAction<string & keyof TemplateEventPropsMap['MediaFlow']['subscribeBoxError']>
|
|
100
|
+
>
|
|
101
|
+
/* Event of subscribe box change connection error (If set `Subscribe Box Change`) */
|
|
102
|
+
subscribeBoxConnectError?: Array<
|
|
103
|
+
EventAction<string & keyof TemplateEventPropsMap['MediaFlow']['subscribeBoxConnectError']>
|
|
104
|
+
>
|
|
105
|
+
/* Event of file sync completed for used `saveToStorage` */
|
|
106
|
+
saveStorageCompleted?: Array<EventAction>
|
|
107
|
+
/* Event when file list size exceed of Load size limit */
|
|
108
|
+
fileSizeExceed?: Array<EventAction>
|
|
109
|
+
}
|
|
110
|
+
outlets?: {
|
|
111
|
+
/* File sync status */
|
|
112
|
+
downloadStatus?: () => Data<string>
|
|
113
|
+
/* File sync progress */
|
|
114
|
+
downloadProgress?: () => Data<
|
|
115
|
+
Array<{
|
|
116
|
+
key?: string
|
|
117
|
+
progress?: number
|
|
118
|
+
finished?: boolean
|
|
119
|
+
[key: string]: any
|
|
120
|
+
}>
|
|
121
|
+
>
|
|
122
|
+
/* File sync download errors */
|
|
123
|
+
downloadErrors?: () => Data<Array<string>>
|
|
124
|
+
/* Media box info */
|
|
125
|
+
box?: () => Data<{ [key: string]: any }>
|
|
126
|
+
/* Save Media Flow fetch result [ { "url": "https://d1kk0369g9vrck.cloudfront.net/box/5b431e29efd40c01e8b2019c/photo5b431e37efd40c01e8b201d1" "extension": "", // enum("jpg", "png", "mp4") "id": "5b431e37efd40c01e8b201d1", "md5": "6134ab412351651324" // md5 came from media resource api } ] */
|
|
127
|
+
result?: () => Data<
|
|
128
|
+
Array<{
|
|
129
|
+
id?: string
|
|
130
|
+
key?: string
|
|
131
|
+
mediaType?: string
|
|
132
|
+
extension?: string
|
|
133
|
+
original?: string
|
|
134
|
+
url?: string
|
|
135
|
+
metadata?: { [key: string]: any }
|
|
136
|
+
[key: string]: any
|
|
137
|
+
}>
|
|
138
|
+
>
|
|
139
|
+
/* File sync result [ { "url": "/storage/emulated/0/Download/SyncFolder/Asset/1.png", "mediaType": "photo" // enum("photo", "video"), used to distingiush "id": "", } ] */
|
|
140
|
+
downloadFileUrls?: () => Data<Array<string>>
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* Fetch box's file list from Media Flow */
|
|
145
|
+
export type GeneratorMediaFlow = Generator &
|
|
146
|
+
GeneratorMediaFlowDef & {
|
|
147
|
+
templateKey: 'GENERATOR_MEDIA_FLOW'
|
|
148
|
+
switches?: Array<
|
|
149
|
+
SwitchDef &
|
|
150
|
+
GeneratorMediaFlowDef & {
|
|
151
|
+
conds?: Array<{
|
|
152
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
153
|
+
cond:
|
|
154
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
155
|
+
| SwitchCondData
|
|
156
|
+
| {
|
|
157
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
158
|
+
outlet:
|
|
159
|
+
| 'downloadStatus'
|
|
160
|
+
| 'downloadProgress'
|
|
161
|
+
| 'downloadErrors'
|
|
162
|
+
| 'box'
|
|
163
|
+
| 'result'
|
|
164
|
+
| 'downloadFileUrls'
|
|
165
|
+
value: any
|
|
166
|
+
}
|
|
167
|
+
}>
|
|
168
|
+
}
|
|
169
|
+
>
|
|
170
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/* Auto generated by build script
|
|
2
|
+
*
|
|
3
|
+
* Embedded MQTT broker server with client authentication, publish/subscribe messaging, keepalive, and retry support
|
|
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 MQTT broker server */
|
|
19
|
+
export type GeneratorMQTTBrokerActionStart = Action & {
|
|
20
|
+
__actionName: 'GENERATOR_MQTT_BROKER_START'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* Publish message to topic */
|
|
24
|
+
export type GeneratorMQTTBrokerActionPublish = ActionWithParams & {
|
|
25
|
+
__actionName: 'GENERATOR_MQTT_BROKER_PUBLISH'
|
|
26
|
+
params?: Array<
|
|
27
|
+
| {
|
|
28
|
+
input: 'topic'
|
|
29
|
+
value?: string | DataLink | EventProperty
|
|
30
|
+
mapping?: string
|
|
31
|
+
}
|
|
32
|
+
| {
|
|
33
|
+
input: 'payload'
|
|
34
|
+
value?: string | DataLink | EventProperty
|
|
35
|
+
mapping?: string
|
|
36
|
+
}
|
|
37
|
+
| {
|
|
38
|
+
input: 'messageId'
|
|
39
|
+
value?: number | DataLink | EventProperty
|
|
40
|
+
mapping?: string
|
|
41
|
+
}
|
|
42
|
+
>
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Stop MQTT broker server */
|
|
46
|
+
export type GeneratorMQTTBrokerActionStop = Action & {
|
|
47
|
+
__actionName: 'GENERATOR_MQTT_BROKER_STOP'
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface GeneratorMQTTBrokerDef {
|
|
51
|
+
/*
|
|
52
|
+
Default property:
|
|
53
|
+
{
|
|
54
|
+
"init": false,
|
|
55
|
+
"port": 1883,
|
|
56
|
+
"retryInterval": 5,
|
|
57
|
+
"keepalive": 60,
|
|
58
|
+
"authenticate": false
|
|
59
|
+
}
|
|
60
|
+
*/
|
|
61
|
+
property?: {
|
|
62
|
+
/* Start MQTT broker on generator initialized */
|
|
63
|
+
init?: boolean | DataLink
|
|
64
|
+
/* Bind port of MQTT server */
|
|
65
|
+
port?: number | DataLink
|
|
66
|
+
/* Retry interval when publish failed */
|
|
67
|
+
retryInterval?: number | DataLink
|
|
68
|
+
/* Keep-alive interval */
|
|
69
|
+
keepalive?: number | DataLink
|
|
70
|
+
/* Enable authentication */
|
|
71
|
+
authenticate?: boolean | DataLink
|
|
72
|
+
/* Authentication table */
|
|
73
|
+
authTable?:
|
|
74
|
+
| Array<
|
|
75
|
+
| DataLink
|
|
76
|
+
| {
|
|
77
|
+
username?: string | DataLink
|
|
78
|
+
password?: string | DataLink
|
|
79
|
+
}
|
|
80
|
+
>
|
|
81
|
+
| DataLink
|
|
82
|
+
}
|
|
83
|
+
events?: {
|
|
84
|
+
/* Event of MQTT server is ready */
|
|
85
|
+
onReady?: Array<EventAction>
|
|
86
|
+
/* Event of server or connection error */
|
|
87
|
+
onError?: Array<EventAction<string & keyof TemplateEventPropsMap['MqttBroker']['onError']>>
|
|
88
|
+
/* Event of client connected */
|
|
89
|
+
onClientConnected?: Array<
|
|
90
|
+
EventAction<string & keyof TemplateEventPropsMap['MqttBroker']['onClientConnected']>
|
|
91
|
+
>
|
|
92
|
+
/* Event of client disconnected */
|
|
93
|
+
onClientDisconnected?: Array<
|
|
94
|
+
EventAction<string & keyof TemplateEventPropsMap['MqttBroker']['onClientDisconnected']>
|
|
95
|
+
>
|
|
96
|
+
/* Event of message received */
|
|
97
|
+
onMessageReceived?: Array<
|
|
98
|
+
EventAction<string & keyof TemplateEventPropsMap['MqttBroker']['onMessageReceived']>
|
|
99
|
+
>
|
|
100
|
+
/* Event of message published */
|
|
101
|
+
onMessagePublished?: Array<
|
|
102
|
+
EventAction<string & keyof TemplateEventPropsMap['MqttBroker']['onMessagePublished']>
|
|
103
|
+
>
|
|
104
|
+
}
|
|
105
|
+
outlets?: {
|
|
106
|
+
/* Is server started */
|
|
107
|
+
started?: () => Data<boolean>
|
|
108
|
+
/* Last received message */
|
|
109
|
+
lastMessage?: () => Data<{
|
|
110
|
+
topic?: string
|
|
111
|
+
payload?: any
|
|
112
|
+
qos?: number
|
|
113
|
+
retain?: boolean
|
|
114
|
+
[key: string]: any
|
|
115
|
+
}>
|
|
116
|
+
/* Error message */
|
|
117
|
+
errorMessage?: () => Data<string>
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* Embedded MQTT broker server with client authentication, publish/subscribe messaging, keepalive, and retry support */
|
|
122
|
+
export type GeneratorMQTTBroker = Generator &
|
|
123
|
+
GeneratorMQTTBrokerDef & {
|
|
124
|
+
templateKey: 'GENERATOR_MQTT_BROKER'
|
|
125
|
+
switches?: Array<
|
|
126
|
+
SwitchDef &
|
|
127
|
+
GeneratorMQTTBrokerDef & {
|
|
128
|
+
conds?: Array<{
|
|
129
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
130
|
+
cond:
|
|
131
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
132
|
+
| SwitchCondData
|
|
133
|
+
| {
|
|
134
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
135
|
+
outlet: 'started' | 'lastMessage' | 'errorMessage'
|
|
136
|
+
value: any
|
|
137
|
+
}
|
|
138
|
+
}>
|
|
139
|
+
}
|
|
140
|
+
>
|
|
141
|
+
}
|