@fugood/bricks-project 2.22.0-beta.8 → 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 +112 -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 -7580
|
@@ -0,0 +1,223 @@
|
|
|
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
|
+
/* Load the model (Only if source is ggml) */
|
|
13
|
+
export type GeneratorVectorStoreActionModelLoad = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_VECTOR_STORE_MODEL_LOAD'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Release the model (Only if source is ggml) */
|
|
18
|
+
export type GeneratorVectorStoreActionModelRelease = Action & {
|
|
19
|
+
__actionName: 'GENERATOR_VECTOR_STORE_MODEL_RELEASE'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Reset the embedding session */
|
|
23
|
+
export type GeneratorVectorStoreActionReset = ActionWithParams & {
|
|
24
|
+
__actionName: 'GENERATOR_VECTOR_STORE_RESET'
|
|
25
|
+
params?: Array<{
|
|
26
|
+
input: 'resetType'
|
|
27
|
+
value?: 'session' | 'all' | DataLink | EventProperty
|
|
28
|
+
mapping?: string
|
|
29
|
+
}>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Insert file content with path or url, support Office / OpenOffice / PDF
|
|
33
|
+
|
|
34
|
+
PDF is not currently supprted in iOS / Android */
|
|
35
|
+
export type GeneratorVectorStoreActionInsertFile = ActionWithParams & {
|
|
36
|
+
__actionName: 'GENERATOR_VECTOR_STORE_INSERT_FILE'
|
|
37
|
+
params?: Array<
|
|
38
|
+
| {
|
|
39
|
+
input: 'filePath'
|
|
40
|
+
value?: string | DataLink | EventProperty
|
|
41
|
+
mapping?: string
|
|
42
|
+
}
|
|
43
|
+
| {
|
|
44
|
+
input: 'fileName'
|
|
45
|
+
value?: string | DataLink | EventProperty
|
|
46
|
+
mapping?: string
|
|
47
|
+
}
|
|
48
|
+
| {
|
|
49
|
+
input: 'fileExtension'
|
|
50
|
+
value?: string | DataLink | EventProperty
|
|
51
|
+
mapping?: string
|
|
52
|
+
}
|
|
53
|
+
| {
|
|
54
|
+
input: 'chunkSize'
|
|
55
|
+
value?: number | DataLink | EventProperty
|
|
56
|
+
mapping?: string
|
|
57
|
+
}
|
|
58
|
+
>
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Cancel the file download */
|
|
62
|
+
export type GeneratorVectorStoreActionCancelFileDownload = Action & {
|
|
63
|
+
__actionName: 'GENERATOR_VECTOR_STORE_CANCEL_FILE_DOWNLOAD'
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Insert pure text content to vector store */
|
|
67
|
+
export type GeneratorVectorStoreActionInsertContent = ActionWithParams & {
|
|
68
|
+
__actionName: 'GENERATOR_VECTOR_STORE_INSERT_CONTENT'
|
|
69
|
+
params?: Array<
|
|
70
|
+
| {
|
|
71
|
+
input: 'textContent'
|
|
72
|
+
value?: string | DataLink | EventProperty
|
|
73
|
+
mapping?: string
|
|
74
|
+
}
|
|
75
|
+
| {
|
|
76
|
+
input: 'fileName'
|
|
77
|
+
value?: string | DataLink | EventProperty
|
|
78
|
+
mapping?: string
|
|
79
|
+
}
|
|
80
|
+
| {
|
|
81
|
+
input: 'payload'
|
|
82
|
+
value?: {} | DataLink | EventProperty
|
|
83
|
+
mapping?: string
|
|
84
|
+
}
|
|
85
|
+
| {
|
|
86
|
+
input: 'chunkSize'
|
|
87
|
+
value?: number | DataLink | EventProperty
|
|
88
|
+
mapping?: string
|
|
89
|
+
}
|
|
90
|
+
>
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Remove file from vector store */
|
|
94
|
+
export type GeneratorVectorStoreActionRemoveFile = ActionWithParams & {
|
|
95
|
+
__actionName: 'GENERATOR_VECTOR_STORE_REMOVE_FILE'
|
|
96
|
+
params?: Array<{
|
|
97
|
+
input: 'fileName'
|
|
98
|
+
value?: string | DataLink | EventProperty
|
|
99
|
+
mapping?: string
|
|
100
|
+
}>
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Search similar text chunks in vector store */
|
|
104
|
+
export type GeneratorVectorStoreActionSearch = ActionWithParams & {
|
|
105
|
+
__actionName: 'GENERATOR_VECTOR_STORE_SEARCH'
|
|
106
|
+
params?: Array<
|
|
107
|
+
| {
|
|
108
|
+
input: 'text'
|
|
109
|
+
value?: string | DataLink | EventProperty
|
|
110
|
+
mapping?: string
|
|
111
|
+
}
|
|
112
|
+
| {
|
|
113
|
+
input: 'filename'
|
|
114
|
+
value?: string | DataLink | EventProperty
|
|
115
|
+
mapping?: string
|
|
116
|
+
}
|
|
117
|
+
| {
|
|
118
|
+
input: 'limit'
|
|
119
|
+
value?: number | DataLink | EventProperty
|
|
120
|
+
mapping?: string
|
|
121
|
+
}
|
|
122
|
+
| {
|
|
123
|
+
input: 'threshold'
|
|
124
|
+
value?: number | DataLink | EventProperty
|
|
125
|
+
mapping?: string
|
|
126
|
+
}
|
|
127
|
+
| {
|
|
128
|
+
input: 'ignoreThreshold'
|
|
129
|
+
value?: boolean | DataLink | EventProperty
|
|
130
|
+
mapping?: string
|
|
131
|
+
}
|
|
132
|
+
>
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface GeneratorVectorStoreDef {
|
|
136
|
+
/*
|
|
137
|
+
Default property:
|
|
138
|
+
{
|
|
139
|
+
"source": "ggml",
|
|
140
|
+
"ggmlContextSize": 512,
|
|
141
|
+
"openaiBaseUrl": "https://api.openai.com/v1",
|
|
142
|
+
"openaiModel": "text-embedding-3-small",
|
|
143
|
+
"embedSessionId": "default-embeddings",
|
|
144
|
+
"fileChunkSize": 256
|
|
145
|
+
}
|
|
146
|
+
*/
|
|
147
|
+
property?: {
|
|
148
|
+
/* Initialize embedding model context & tokenizer context on subspace mounted */
|
|
149
|
+
init?: boolean | DataLink
|
|
150
|
+
/* Source of embedding model. Note that you can't use the saved embedddings data in different sources. */
|
|
151
|
+
source?: 'ggml' | 'openai' | DataLink
|
|
152
|
+
/* Path of ggml model */
|
|
153
|
+
ggmlModelUrl?: string | DataLink
|
|
154
|
+
/* Hash type of ggml model */
|
|
155
|
+
ggmlModelHashType?: 'sha256' | 'sha1' | 'md5' | DataLink
|
|
156
|
+
/* Hash of ggml model */
|
|
157
|
+
ggmlModelHash?: string | DataLink
|
|
158
|
+
/* Size of ggml context */
|
|
159
|
+
ggmlContextSize?: number | DataLink
|
|
160
|
+
/* Pooling type of ggml model */
|
|
161
|
+
ggmlPoolingType?: 'none' | 'mean' | 'cls' | 'last' | 'rank' | DataLink
|
|
162
|
+
/* Accelerator variant of ggml model */
|
|
163
|
+
ggmlAccelVariant?: 'default' | 'vulkan' | 'cuda' | DataLink
|
|
164
|
+
/* Normalize */
|
|
165
|
+
ggmlEmbdNormalize?: number | DataLink
|
|
166
|
+
/* API key of OpenAI Compatible API */
|
|
167
|
+
openaiApiKey?: string | DataLink
|
|
168
|
+
/* Base URL of OpenAI Compatible API. For example, we can use ollama / llama.cpp server instead of openai */
|
|
169
|
+
openaiBaseUrl?: string | DataLink
|
|
170
|
+
/* Model of OpenAI Compatible API */
|
|
171
|
+
openaiModel?: 'text-embedding-3-small' | 'text-embedding-3-large' | DataLink
|
|
172
|
+
/* Session ID of embedding */
|
|
173
|
+
embedSessionId?: string | DataLink
|
|
174
|
+
/* Storage type of embedding */
|
|
175
|
+
embedStorageType?: 'file' | 'memory' | DataLink
|
|
176
|
+
/* Tokenizer model URL (Recommended to use same with your LLM model, the model will just load with vocab_only mode) */
|
|
177
|
+
tokenizerModelUrl?: string | DataLink
|
|
178
|
+
/* Tokenizer model hash */
|
|
179
|
+
tokenizerModelHash?: string | DataLink
|
|
180
|
+
/* Tokenizer model hash type */
|
|
181
|
+
tokenizerModelHashType?: 'sha256' | 'sha1' | 'md5' | DataLink
|
|
182
|
+
/* Chunk size to handle file content (token), must be less then embedding model context size */
|
|
183
|
+
fileChunkSize?: number | DataLink
|
|
184
|
+
}
|
|
185
|
+
events?: {
|
|
186
|
+
/* Event triggered when error occurs */
|
|
187
|
+
onError?: Array<EventAction>
|
|
188
|
+
}
|
|
189
|
+
outlets?: {
|
|
190
|
+
/* undefined */
|
|
191
|
+
isReady?: () => Data
|
|
192
|
+
/* Whether the embedding is processing */
|
|
193
|
+
processing?: () => Data
|
|
194
|
+
/* Progress of embedding processing */
|
|
195
|
+
processProgress?: () => Data
|
|
196
|
+
/* Files inserted to embedding */
|
|
197
|
+
files?: () => Data
|
|
198
|
+
/* Search result */
|
|
199
|
+
searchResult?: () => Data
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/* Vector Store - File embeddings & search */
|
|
204
|
+
export type GeneratorVectorStore = Generator &
|
|
205
|
+
GeneratorVectorStoreDef & {
|
|
206
|
+
templateKey: 'GENERATOR_VECTOR_STORE'
|
|
207
|
+
switches: Array<
|
|
208
|
+
SwitchDef &
|
|
209
|
+
GeneratorVectorStoreDef & {
|
|
210
|
+
conds?: Array<{
|
|
211
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
212
|
+
cond:
|
|
213
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
214
|
+
| SwitchCondData
|
|
215
|
+
| {
|
|
216
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
217
|
+
outlet: 'isReady' | 'processing' | 'processProgress' | 'files' | 'searchResult'
|
|
218
|
+
value: any
|
|
219
|
+
}
|
|
220
|
+
}>
|
|
221
|
+
}
|
|
222
|
+
>
|
|
223
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
/* Reset watch */
|
|
13
|
+
export type GeneratorWatchdogActionResetWatch = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_WATCHDOG_RESET_WATCH'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface GeneratorWatchdogDef {
|
|
18
|
+
/*
|
|
19
|
+
Default property:
|
|
20
|
+
{
|
|
21
|
+
"listening": false,
|
|
22
|
+
"timeout": 30000
|
|
23
|
+
}
|
|
24
|
+
*/
|
|
25
|
+
property?: {
|
|
26
|
+
/* Start listening event */
|
|
27
|
+
listening?: boolean | DataLink
|
|
28
|
+
/* If no other events are fired after the specified event is fired, it times out and fires the Watchdog event. */
|
|
29
|
+
timeout?: number | DataLink
|
|
30
|
+
/* Reset timeout timer on properties change */
|
|
31
|
+
resetTimeoutOnChange?: boolean | DataLink
|
|
32
|
+
/* Set what brick id (allow mutiple) to listen for press */
|
|
33
|
+
brickOnPress?: Array<string | DataLink> | DataLink
|
|
34
|
+
/* Set what brick id (allow mutiple) to listen for focus */
|
|
35
|
+
brickOnFocus?: Array<string | DataLink> | DataLink
|
|
36
|
+
/* Set what brick id (allow mutiple) to listen for blur */
|
|
37
|
+
brickOnBlur?: Array<string | DataLink> | DataLink
|
|
38
|
+
/* Set what canvas id (allow mutiple) to listen for enter */
|
|
39
|
+
canvasOnEnter?: Array<string | DataLink> | DataLink
|
|
40
|
+
/* Set what canvas id (allow mutiple) to listen for exit */
|
|
41
|
+
canvasOnExit?: Array<string | DataLink> | DataLink
|
|
42
|
+
/* Set what Data id (allow mutiple) to listen for change */
|
|
43
|
+
propertyBankOnChange?: Array<string | DataLink> | DataLink
|
|
44
|
+
/* Set what Data id (allow mutiple) to listen for update */
|
|
45
|
+
propertyBankOnUpdate?: Array<string | DataLink> | DataLink
|
|
46
|
+
/* Set what Data id (allow mutiple) to listen for hit */
|
|
47
|
+
propertyBankOnHit?: Array<string | DataLink> | DataLink
|
|
48
|
+
/* Set what Data id (allow mutiple) to listen for hit */
|
|
49
|
+
propertyBankOnNotHit?: Array<string | DataLink> | DataLink
|
|
50
|
+
}
|
|
51
|
+
events?: {
|
|
52
|
+
/* Event on specific sender id trigger event */
|
|
53
|
+
onEvent?: Array<EventAction>
|
|
54
|
+
/* Event on timeout */
|
|
55
|
+
onTimeout?: Array<EventAction>
|
|
56
|
+
}
|
|
57
|
+
outlets?: {
|
|
58
|
+
/* The last event */
|
|
59
|
+
lastEvent?: () => Data
|
|
60
|
+
/* The type fo last event */
|
|
61
|
+
lastEventType?: () => Data
|
|
62
|
+
/* The trigger type of last event */
|
|
63
|
+
lastEventTriggerType?: () => Data
|
|
64
|
+
/* The sender id of last event */
|
|
65
|
+
lastEventSenderId?: () => Data
|
|
66
|
+
/* Is timed out */
|
|
67
|
+
isTimedOut?: () => Data
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Triger event with timeout by listen specified events */
|
|
72
|
+
export type GeneratorWatchdog = Generator &
|
|
73
|
+
GeneratorWatchdogDef & {
|
|
74
|
+
templateKey: 'GENERATOR_WATCHDOG'
|
|
75
|
+
switches: Array<
|
|
76
|
+
SwitchDef &
|
|
77
|
+
GeneratorWatchdogDef & {
|
|
78
|
+
conds?: Array<{
|
|
79
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
80
|
+
cond:
|
|
81
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
82
|
+
| SwitchCondData
|
|
83
|
+
| {
|
|
84
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
85
|
+
outlet:
|
|
86
|
+
| 'lastEvent'
|
|
87
|
+
| 'lastEventType'
|
|
88
|
+
| 'lastEventTriggerType'
|
|
89
|
+
| 'lastEventSenderId'
|
|
90
|
+
| 'isTimedOut'
|
|
91
|
+
value: any
|
|
92
|
+
}
|
|
93
|
+
}>
|
|
94
|
+
}
|
|
95
|
+
>
|
|
96
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
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 Crawler request with defined properties */
|
|
13
|
+
export type GeneratorWebCrawlerActionRunRequest = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_WEB_CRAWLER_RUN_REQUEST'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface GeneratorWebCrawlerDef {
|
|
18
|
+
/*
|
|
19
|
+
Default property:
|
|
20
|
+
{
|
|
21
|
+
"init": false,
|
|
22
|
+
"httpMethod": "GET",
|
|
23
|
+
"timeout": 10000,
|
|
24
|
+
"attributePath": "textContent"
|
|
25
|
+
}
|
|
26
|
+
*/
|
|
27
|
+
property?: {
|
|
28
|
+
/* Start Crawler request on generator initialized */
|
|
29
|
+
init?: boolean | DataLink
|
|
30
|
+
/* URL of crawler request */
|
|
31
|
+
url?: string | DataLink
|
|
32
|
+
/* Timeout of crawler request
|
|
33
|
+
|
|
34
|
+
Platform not supported for `webview`: tvOS, Desktop, Web */
|
|
35
|
+
method?: 'webview' | 'http' | DataLink
|
|
36
|
+
/* HTTP method of crawler request (weview only supported GET, POST) */
|
|
37
|
+
httpMethod?: 'GET' | 'POST' | 'PUT' | 'DELETE' | DataLink
|
|
38
|
+
/* Body of crawler request */
|
|
39
|
+
body?: string | DataLink
|
|
40
|
+
/* User-Agent of crawler request */
|
|
41
|
+
userAgent?: string | DataLink
|
|
42
|
+
/* Headers of crawler request */
|
|
43
|
+
headers?: {} | DataLink
|
|
44
|
+
/* Timeout of crawler request */
|
|
45
|
+
timeout?: number | DataLink
|
|
46
|
+
/* CSS Query Selector of selected element */
|
|
47
|
+
selector?: string | DataLink
|
|
48
|
+
/* Attribute path of HTMLElement */
|
|
49
|
+
attributePath?: string | DataLink
|
|
50
|
+
/* Multiple selectors and attribute paths. */
|
|
51
|
+
selectorList?:
|
|
52
|
+
| Array<
|
|
53
|
+
| DataLink
|
|
54
|
+
| {
|
|
55
|
+
selector?: string | DataLink
|
|
56
|
+
attributePath?: string | DataLink
|
|
57
|
+
}
|
|
58
|
+
>
|
|
59
|
+
| DataLink
|
|
60
|
+
}
|
|
61
|
+
events?: {
|
|
62
|
+
/* Event of crawling start */
|
|
63
|
+
onStart?: Array<EventAction>
|
|
64
|
+
/* Event of crawling end */
|
|
65
|
+
onEnd?: Array<EventAction>
|
|
66
|
+
}
|
|
67
|
+
outlets?: {
|
|
68
|
+
/* Response for CRAWLER request (selector) */
|
|
69
|
+
response?: () => Data
|
|
70
|
+
/* Responses for CRAWLER request (selectorList) */
|
|
71
|
+
responseList?: () => Data
|
|
72
|
+
/* The error response of CRAWLER request, it will save to property bank */
|
|
73
|
+
error?: () => Data
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Web crawler to get specific value */
|
|
78
|
+
export type GeneratorWebCrawler = Generator &
|
|
79
|
+
GeneratorWebCrawlerDef & {
|
|
80
|
+
templateKey: 'GENERATOR_WEB_CRAWLER'
|
|
81
|
+
switches: Array<
|
|
82
|
+
SwitchDef &
|
|
83
|
+
GeneratorWebCrawlerDef & {
|
|
84
|
+
conds?: Array<{
|
|
85
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
86
|
+
cond:
|
|
87
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
88
|
+
| SwitchCondData
|
|
89
|
+
| {
|
|
90
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
91
|
+
outlet: 'response' | 'responseList' | 'error'
|
|
92
|
+
value: any
|
|
93
|
+
}
|
|
94
|
+
}>
|
|
95
|
+
}
|
|
96
|
+
>
|
|
97
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
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
|
+
/* Initiate WebRTC request */
|
|
13
|
+
export type GeneratorWebRTCActionInitiate = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_WEBRTC_INITIATE'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Process input signal */
|
|
18
|
+
export type GeneratorWebRTCActionProcessInputSignal = ActionWithParams & {
|
|
19
|
+
__actionName: 'GENERATOR_WEBRTC_PROCESS_INPUT_SIGNAL'
|
|
20
|
+
params?: Array<{
|
|
21
|
+
input: 'inputSignal'
|
|
22
|
+
value?: any | EventProperty
|
|
23
|
+
mapping?: string
|
|
24
|
+
}>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Close WebRTC */
|
|
28
|
+
export type GeneratorWebRTCActionClose = Action & {
|
|
29
|
+
__actionName: 'GENERATOR_WEBRTC_CLOSE'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Send message in data channel */
|
|
33
|
+
export type GeneratorWebRTCActionChannelSend = ActionWithParams & {
|
|
34
|
+
__actionName: 'GENERATOR_WEBRTC_CHANNEL_SEND'
|
|
35
|
+
params?: Array<{
|
|
36
|
+
input: 'textMessage'
|
|
37
|
+
value?: string | DataLink | EventProperty
|
|
38
|
+
mapping?: string
|
|
39
|
+
}>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface GeneratorWebRTCDef {
|
|
43
|
+
/*
|
|
44
|
+
Default property:
|
|
45
|
+
{
|
|
46
|
+
"enableAudio": true,
|
|
47
|
+
"enableVideo": true,
|
|
48
|
+
"videoFacing": "user",
|
|
49
|
+
"videoFrameRate": 30,
|
|
50
|
+
"videoHeight": 720,
|
|
51
|
+
"videoWidth": 1080,
|
|
52
|
+
"signalType": "json"
|
|
53
|
+
}
|
|
54
|
+
*/
|
|
55
|
+
property?: {
|
|
56
|
+
/* Caller ID */
|
|
57
|
+
callerId?: string | DataLink
|
|
58
|
+
/* Calee ID, to ilter caller signal */
|
|
59
|
+
calleeId?: string | DataLink
|
|
60
|
+
/* Target local WebRTC stream preview brick ID */
|
|
61
|
+
localVideoTarget?: string | DataLink
|
|
62
|
+
/* Target remote WebRTC stream brick ID */
|
|
63
|
+
remoteVideoTarget?: string | DataLink
|
|
64
|
+
/* ICE Server list
|
|
65
|
+
Default use Google public STUN servers if not setted. */
|
|
66
|
+
iceServers?:
|
|
67
|
+
| Array<
|
|
68
|
+
| DataLink
|
|
69
|
+
| {
|
|
70
|
+
urls?: string | DataLink
|
|
71
|
+
username?: string | DataLink
|
|
72
|
+
credential?: string | DataLink
|
|
73
|
+
}
|
|
74
|
+
>
|
|
75
|
+
| DataLink
|
|
76
|
+
/* Enable capture device microphone */
|
|
77
|
+
enableAudio?: boolean | DataLink
|
|
78
|
+
/* Enable capture device camera */
|
|
79
|
+
enableVideo?: boolean | DataLink
|
|
80
|
+
/* Camera facing */
|
|
81
|
+
videoFacing?: 'user' | 'environment' | DataLink
|
|
82
|
+
/* Camera frame rate */
|
|
83
|
+
videoFrameRate?: number | DataLink
|
|
84
|
+
/* Output video height */
|
|
85
|
+
videoHeight?: number | DataLink
|
|
86
|
+
/* Output video width */
|
|
87
|
+
videoWidth?: number | DataLink
|
|
88
|
+
/* Label of data channel */
|
|
89
|
+
dataChannelLabel?: string | DataLink
|
|
90
|
+
/* Input signal for create peer connection
|
|
91
|
+
Signal Types:
|
|
92
|
+
`initiate`: Initiate a WebRTC call
|
|
93
|
+
`offer`: WebRTC SDP offer
|
|
94
|
+
`answer`: WebRTC SDP answer
|
|
95
|
+
`candidate`: WebRTC ICE candidate
|
|
96
|
+
`close`: Close WebRTC peer connection */
|
|
97
|
+
inputSignal?: any
|
|
98
|
+
/* Signal content type */
|
|
99
|
+
signalType?: 'json' | 'object' | DataLink
|
|
100
|
+
}
|
|
101
|
+
events?: {
|
|
102
|
+
/* Event of signal update */
|
|
103
|
+
onSignalUpdate?: Array<EventAction>
|
|
104
|
+
/* Event of peer connected */
|
|
105
|
+
onConnected?: Array<EventAction>
|
|
106
|
+
/* Event of peer disconnected */
|
|
107
|
+
onDisconnected?: Array<EventAction>
|
|
108
|
+
/* Event of handshake error */
|
|
109
|
+
onError?: Array<EventAction>
|
|
110
|
+
/* Event of data channel open */
|
|
111
|
+
onChannelOpen?: Array<EventAction>
|
|
112
|
+
/* Event of data channel close */
|
|
113
|
+
onChannelClose?: Array<EventAction>
|
|
114
|
+
/* Event of received message on data channel */
|
|
115
|
+
onChannelMessage?: Array<EventAction>
|
|
116
|
+
}
|
|
117
|
+
outlets?: {
|
|
118
|
+
/* Signal to create peer connection */
|
|
119
|
+
signal?: () => Data
|
|
120
|
+
/* Local SDP offer */
|
|
121
|
+
sdpOffer?: () => Data
|
|
122
|
+
/* Local SDP answer */
|
|
123
|
+
sdpAnswer?: () => Data
|
|
124
|
+
/* Peer connection state */
|
|
125
|
+
connectionState?: () => Data
|
|
126
|
+
/* ICE connection state */
|
|
127
|
+
iceConnectionState?: () => Data
|
|
128
|
+
/* Signaling state */
|
|
129
|
+
signalingState?: () => Data
|
|
130
|
+
/* Last message from data channel */
|
|
131
|
+
lastChannelMessage?: () => Data
|
|
132
|
+
/* Error message */
|
|
133
|
+
errorMessage?: () => Data
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* WebRTC */
|
|
138
|
+
export type GeneratorWebRTC = Generator &
|
|
139
|
+
GeneratorWebRTCDef & {
|
|
140
|
+
templateKey: 'GENERATOR_WEBRTC'
|
|
141
|
+
switches: Array<
|
|
142
|
+
SwitchDef &
|
|
143
|
+
GeneratorWebRTCDef & {
|
|
144
|
+
conds?: Array<{
|
|
145
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
146
|
+
cond:
|
|
147
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
148
|
+
| SwitchCondData
|
|
149
|
+
| {
|
|
150
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
151
|
+
outlet:
|
|
152
|
+
| 'signal'
|
|
153
|
+
| 'sdpOffer'
|
|
154
|
+
| 'sdpAnswer'
|
|
155
|
+
| 'connectionState'
|
|
156
|
+
| 'iceConnectionState'
|
|
157
|
+
| 'signalingState'
|
|
158
|
+
| 'lastChannelMessage'
|
|
159
|
+
| 'errorMessage'
|
|
160
|
+
value: any
|
|
161
|
+
}
|
|
162
|
+
}>
|
|
163
|
+
}
|
|
164
|
+
>
|
|
165
|
+
}
|