@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,225 @@
|
|
|
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
|
+
/* Start scan */
|
|
13
|
+
export type GeneratorBleCentralActionStartScan = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_BLE_CENTRAL_START_SCAN'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Stop scan */
|
|
18
|
+
export type GeneratorBleCentralActionStopScan = Action & {
|
|
19
|
+
__actionName: 'GENERATOR_BLE_CENTRAL_STOP_SCAN'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Connect device */
|
|
23
|
+
export type GeneratorBleCentralActionConnect = ActionWithParams & {
|
|
24
|
+
__actionName: 'GENERATOR_BLE_CENTRAL_CONNECT'
|
|
25
|
+
params?: Array<{
|
|
26
|
+
input: 'deviceId'
|
|
27
|
+
value?: string | DataLink | EventProperty
|
|
28
|
+
mapping?: string
|
|
29
|
+
}>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Read a characteristic */
|
|
33
|
+
export type GeneratorBleCentralActionReadCharacteristic = ActionWithParams & {
|
|
34
|
+
__actionName: 'GENERATOR_BLE_CENTRAL_READ_CHARACTERISTIC'
|
|
35
|
+
params?: Array<
|
|
36
|
+
| {
|
|
37
|
+
input: 'deviceId'
|
|
38
|
+
value?: string | DataLink | EventProperty
|
|
39
|
+
mapping?: string
|
|
40
|
+
}
|
|
41
|
+
| {
|
|
42
|
+
input: 'serviceId'
|
|
43
|
+
value?: string | DataLink | EventProperty
|
|
44
|
+
mapping?: string
|
|
45
|
+
}
|
|
46
|
+
| {
|
|
47
|
+
input: 'characteristicId'
|
|
48
|
+
value?: string | DataLink | EventProperty
|
|
49
|
+
mapping?: string
|
|
50
|
+
}
|
|
51
|
+
>
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Monitor a characteristic */
|
|
55
|
+
export type GeneratorBleCentralActionMonitorCharacteristic = ActionWithParams & {
|
|
56
|
+
__actionName: 'GENERATOR_BLE_CENTRAL_MONITOR_CHARACTERISTIC'
|
|
57
|
+
params?: Array<
|
|
58
|
+
| {
|
|
59
|
+
input: 'deviceId'
|
|
60
|
+
value?: string | DataLink | EventProperty
|
|
61
|
+
mapping?: string
|
|
62
|
+
}
|
|
63
|
+
| {
|
|
64
|
+
input: 'serviceId'
|
|
65
|
+
value?: string | DataLink | EventProperty
|
|
66
|
+
mapping?: string
|
|
67
|
+
}
|
|
68
|
+
| {
|
|
69
|
+
input: 'characteristicId'
|
|
70
|
+
value?: string | DataLink | EventProperty
|
|
71
|
+
mapping?: string
|
|
72
|
+
}
|
|
73
|
+
>
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* Cancel monitor a characteristic */
|
|
77
|
+
export type GeneratorBleCentralActionCancelMonitorCharacteristic = ActionWithParams & {
|
|
78
|
+
__actionName: 'GENERATOR_BLE_CENTRAL_CANCEL_MONITOR_CHARACTERISTIC'
|
|
79
|
+
params?: Array<
|
|
80
|
+
| {
|
|
81
|
+
input: 'deviceId'
|
|
82
|
+
value?: string | DataLink | EventProperty
|
|
83
|
+
mapping?: string
|
|
84
|
+
}
|
|
85
|
+
| {
|
|
86
|
+
input: 'serviceId'
|
|
87
|
+
value?: string | DataLink | EventProperty
|
|
88
|
+
mapping?: string
|
|
89
|
+
}
|
|
90
|
+
| {
|
|
91
|
+
input: 'characteristicId'
|
|
92
|
+
value?: string | DataLink | EventProperty
|
|
93
|
+
mapping?: string
|
|
94
|
+
}
|
|
95
|
+
>
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Write data to a characteristic */
|
|
99
|
+
export type GeneratorBleCentralActionWriteCharacteristic = ActionWithParams & {
|
|
100
|
+
__actionName: 'GENERATOR_BLE_CENTRAL_WRITE_CHARACTERISTIC'
|
|
101
|
+
params?: Array<
|
|
102
|
+
| {
|
|
103
|
+
input: 'deviceId'
|
|
104
|
+
value?: string | DataLink | EventProperty
|
|
105
|
+
mapping?: string
|
|
106
|
+
}
|
|
107
|
+
| {
|
|
108
|
+
input: 'serviceId'
|
|
109
|
+
value?: string | DataLink | EventProperty
|
|
110
|
+
mapping?: string
|
|
111
|
+
}
|
|
112
|
+
| {
|
|
113
|
+
input: 'characteristicId'
|
|
114
|
+
value?: string | DataLink | EventProperty
|
|
115
|
+
mapping?: string
|
|
116
|
+
}
|
|
117
|
+
| {
|
|
118
|
+
input: 'dataHex'
|
|
119
|
+
value?: string | DataLink | EventProperty
|
|
120
|
+
mapping?: string
|
|
121
|
+
}
|
|
122
|
+
| {
|
|
123
|
+
input: 'writeWithoutResponse'
|
|
124
|
+
value?: boolean | DataLink | EventProperty
|
|
125
|
+
mapping?: string
|
|
126
|
+
}
|
|
127
|
+
>
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Disconnect device */
|
|
131
|
+
export type GeneratorBleCentralActionDisconnect = ActionWithParams & {
|
|
132
|
+
__actionName: 'GENERATOR_BLE_CENTRAL_DISCONNECT'
|
|
133
|
+
params?: Array<{
|
|
134
|
+
input: 'deviceId'
|
|
135
|
+
value?: string | DataLink | EventProperty
|
|
136
|
+
mapping?: string
|
|
137
|
+
}>
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
interface GeneratorBleCentralDef {
|
|
141
|
+
/*
|
|
142
|
+
Default property:
|
|
143
|
+
{
|
|
144
|
+
"init": false,
|
|
145
|
+
"scanTime": 10,
|
|
146
|
+
"updateInterval": 1000,
|
|
147
|
+
"retainTime": 120,
|
|
148
|
+
"maximumDiscoveredDevice": 256,
|
|
149
|
+
"allowDuplicates": false,
|
|
150
|
+
"scanMode": "LowPower"
|
|
151
|
+
}
|
|
152
|
+
*/
|
|
153
|
+
property?: {
|
|
154
|
+
/* Start scan on generator initialized */
|
|
155
|
+
init?: boolean | DataLink
|
|
156
|
+
/* Regex match name to filter device */
|
|
157
|
+
deviceNameFilter?: string | DataLink
|
|
158
|
+
/* Service UUIDs to filter device */
|
|
159
|
+
serviceFilter?: Array<string | DataLink> | DataLink
|
|
160
|
+
/* RSSI threshold */
|
|
161
|
+
rssiThreshold?: number | DataLink
|
|
162
|
+
/* Scan time */
|
|
163
|
+
scanTime?: number | DataLink
|
|
164
|
+
/* Discovered device list update interval */
|
|
165
|
+
updateInterval?: number | DataLink
|
|
166
|
+
/* Discovered device retain time */
|
|
167
|
+
retainTime?: number | DataLink
|
|
168
|
+
/* Maximum device list number */
|
|
169
|
+
maximumDiscoveredDevice?: number | DataLink
|
|
170
|
+
/* Allow duplicates scanning records (iOS only) */
|
|
171
|
+
allowDuplicates?: boolean | DataLink
|
|
172
|
+
/* BLE scan mode (Android only) */
|
|
173
|
+
scanMode?: 'Opportunistic' | 'LowPower' | 'Balanced' | 'LowLatency' | DataLink
|
|
174
|
+
}
|
|
175
|
+
events?: {
|
|
176
|
+
/* Event for state change */
|
|
177
|
+
onStateChange?: Array<EventAction>
|
|
178
|
+
/* Event for error occurred */
|
|
179
|
+
onError?: Array<EventAction>
|
|
180
|
+
/* Event for start scan */
|
|
181
|
+
onStartScan?: Array<EventAction>
|
|
182
|
+
/* Event for stop scan */
|
|
183
|
+
onStopScan?: Array<EventAction>
|
|
184
|
+
/* Event for discover device */
|
|
185
|
+
onDiscoverDevice?: Array<EventAction>
|
|
186
|
+
/* Event for device connected */
|
|
187
|
+
onConnectDevice?: Array<EventAction>
|
|
188
|
+
/* Event for device disconnected */
|
|
189
|
+
onDisconnectDevice?: Array<EventAction>
|
|
190
|
+
/* Event for receive on read */
|
|
191
|
+
onReadReceive?: Array<EventAction>
|
|
192
|
+
/* Event for receive on monitor */
|
|
193
|
+
onMonitorReceive?: Array<EventAction>
|
|
194
|
+
}
|
|
195
|
+
outlets?: {
|
|
196
|
+
/* Is scaning */
|
|
197
|
+
isScaning?: () => Data
|
|
198
|
+
/* Discovered device list */
|
|
199
|
+
discoveredDeviceList?: () => Data
|
|
200
|
+
/* Error message */
|
|
201
|
+
errorMessage?: () => Data
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/* BLE Central Mode Generator */
|
|
206
|
+
export type GeneratorBleCentral = Generator &
|
|
207
|
+
GeneratorBleCentralDef & {
|
|
208
|
+
templateKey: 'GENERATOR_BLE_CENTRAL'
|
|
209
|
+
switches: Array<
|
|
210
|
+
SwitchDef &
|
|
211
|
+
GeneratorBleCentralDef & {
|
|
212
|
+
conds?: Array<{
|
|
213
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
214
|
+
cond:
|
|
215
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
216
|
+
| SwitchCondData
|
|
217
|
+
| {
|
|
218
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
219
|
+
outlet: 'isScaning' | 'discoveredDeviceList' | 'errorMessage'
|
|
220
|
+
value: any
|
|
221
|
+
}
|
|
222
|
+
}>
|
|
223
|
+
}
|
|
224
|
+
>
|
|
225
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
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
|
+
/* Start advertise */
|
|
13
|
+
export type GeneratorBlePeripheralActionStart = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_BLE_PERIPHERAL_START'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* undefined */
|
|
18
|
+
export type GeneratorBlePeripheralActionNotify = ActionWithParams & {
|
|
19
|
+
__actionName: 'GENERATOR_BLE_PERIPHERAL_NOTIFY'
|
|
20
|
+
params?: Array<
|
|
21
|
+
| {
|
|
22
|
+
input: 'serviceId'
|
|
23
|
+
value?: string | DataLink | EventProperty
|
|
24
|
+
mapping?: string
|
|
25
|
+
}
|
|
26
|
+
| {
|
|
27
|
+
input: 'charId'
|
|
28
|
+
value?: string | DataLink | EventProperty
|
|
29
|
+
mapping?: string
|
|
30
|
+
}
|
|
31
|
+
| {
|
|
32
|
+
input: 'value'
|
|
33
|
+
value?: string | DataLink | EventProperty
|
|
34
|
+
mapping?: string
|
|
35
|
+
}
|
|
36
|
+
| {
|
|
37
|
+
input: 'encoding'
|
|
38
|
+
value?: 'utf8' | 'hex' | 'base64' | DataLink | EventProperty
|
|
39
|
+
mapping?: string
|
|
40
|
+
}
|
|
41
|
+
>
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Stop advertise */
|
|
45
|
+
export type GeneratorBlePeripheralActionStop = Action & {
|
|
46
|
+
__actionName: 'GENERATOR_BLE_PERIPHERAL_STOP'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface GeneratorBlePeripheralDef {
|
|
50
|
+
/*
|
|
51
|
+
Default property:
|
|
52
|
+
{
|
|
53
|
+
"init": false,
|
|
54
|
+
"connectable": true,
|
|
55
|
+
"advertiseMode": "LOW_POWER",
|
|
56
|
+
"txPower": "MEDIUM",
|
|
57
|
+
"includeDeviceName": true,
|
|
58
|
+
"includeTxPower": true
|
|
59
|
+
}
|
|
60
|
+
*/
|
|
61
|
+
property?: {
|
|
62
|
+
/* Start advertise on generator initialized */
|
|
63
|
+
init?: boolean | DataLink
|
|
64
|
+
/* Advertise device name */
|
|
65
|
+
name?: string | DataLink
|
|
66
|
+
/* BLE is connectable (Android only) */
|
|
67
|
+
connectable?: boolean | DataLink
|
|
68
|
+
/* Advertise mode (Android only) */
|
|
69
|
+
advertiseMode?: 'LOW_POWER' | 'BALANCED' | 'LOW_LATENCY' | DataLink
|
|
70
|
+
/* Bluetooth transmit power (Android only) */
|
|
71
|
+
txPower?: 'ULTRA_LOW' | 'LOW' | 'MEDIUM' | 'HIGH' | DataLink
|
|
72
|
+
/* Include device name in advertise (Android only) */
|
|
73
|
+
includeDeviceName?: boolean | DataLink
|
|
74
|
+
/* Include transmit power in advertise (Android only) */
|
|
75
|
+
includeTxPower?: boolean | DataLink
|
|
76
|
+
/* Advertise manufacturer ID (Android only) */
|
|
77
|
+
manufacturerId?: number | DataLink
|
|
78
|
+
/* Advertise manufacturer data (Android only) */
|
|
79
|
+
manufacturerData?:
|
|
80
|
+
| DataLink
|
|
81
|
+
| {
|
|
82
|
+
data?: string | DataLink
|
|
83
|
+
encode?: 'utf8' | 'hex' | 'base64' | DataLink
|
|
84
|
+
}
|
|
85
|
+
/* Advertise service data list (Android only) */
|
|
86
|
+
serviceDataMap?:
|
|
87
|
+
| Array<
|
|
88
|
+
| DataLink
|
|
89
|
+
| {
|
|
90
|
+
serviceId?: string | DataLink
|
|
91
|
+
data?: string | DataLink
|
|
92
|
+
encode?: 'utf8' | 'hex' | 'base64' | DataLink
|
|
93
|
+
}
|
|
94
|
+
>
|
|
95
|
+
| DataLink
|
|
96
|
+
/* GATT service list */
|
|
97
|
+
gattServiceMap?:
|
|
98
|
+
| Array<
|
|
99
|
+
| DataLink
|
|
100
|
+
| {
|
|
101
|
+
serviceId?: string | DataLink
|
|
102
|
+
primary?: boolean | DataLink
|
|
103
|
+
characteristics?:
|
|
104
|
+
| Array<
|
|
105
|
+
| DataLink
|
|
106
|
+
| {
|
|
107
|
+
id?: string | DataLink
|
|
108
|
+
permission?:
|
|
109
|
+
| DataLink
|
|
110
|
+
| {
|
|
111
|
+
readable?: boolean | DataLink
|
|
112
|
+
readEncrypted?: boolean | DataLink
|
|
113
|
+
writeable?: boolean | DataLink
|
|
114
|
+
writeEncrypted?: boolean | DataLink
|
|
115
|
+
}
|
|
116
|
+
properties?:
|
|
117
|
+
| DataLink
|
|
118
|
+
| {
|
|
119
|
+
broadcast?: boolean | DataLink
|
|
120
|
+
read?: boolean | DataLink
|
|
121
|
+
writeNoResponse?: boolean | DataLink
|
|
122
|
+
write?: boolean | DataLink
|
|
123
|
+
notify?: boolean | DataLink
|
|
124
|
+
indicate?: boolean | DataLink
|
|
125
|
+
signedWrite?: boolean | DataLink
|
|
126
|
+
extendedProps?: boolean | DataLink
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
>
|
|
130
|
+
| DataLink
|
|
131
|
+
}
|
|
132
|
+
>
|
|
133
|
+
| DataLink
|
|
134
|
+
/* Response value of characteristics */
|
|
135
|
+
resData?:
|
|
136
|
+
| Array<
|
|
137
|
+
| DataLink
|
|
138
|
+
| {
|
|
139
|
+
serviceId?: string | DataLink
|
|
140
|
+
charId?: string | DataLink
|
|
141
|
+
value?: string | DataLink
|
|
142
|
+
encoding?: 'utf8' | 'hex' | 'base64' | DataLink
|
|
143
|
+
}
|
|
144
|
+
>
|
|
145
|
+
| DataLink
|
|
146
|
+
/* Beacon mode */
|
|
147
|
+
beaconsEnable?: boolean | DataLink
|
|
148
|
+
/* Measured RSSI @ 1m, used for calculate distance */
|
|
149
|
+
beaconsTxPower?: number | DataLink
|
|
150
|
+
/* Beacon configs
|
|
151
|
+
presets has pre-defined layout and manufacturerId
|
|
152
|
+
layout string is like AltBeacon's Beacon Layout, but replace "x" as extra data
|
|
153
|
+
id and data could be 0x prefixed hex, hex string, decimal or UUID
|
|
154
|
+
extra should be hex string */
|
|
155
|
+
beaconsConfig?:
|
|
156
|
+
| Array<
|
|
157
|
+
| DataLink
|
|
158
|
+
| {
|
|
159
|
+
preset?: 'LINE_SIMPLE_BEACON' | 'iBeacon' | 'EddystoneUID' | 'AltBeacon' | DataLink
|
|
160
|
+
manufacturerId?: number | DataLink
|
|
161
|
+
layout?: string | DataLink
|
|
162
|
+
id1?: string | DataLink
|
|
163
|
+
id2?: string | DataLink
|
|
164
|
+
id3?: string | DataLink
|
|
165
|
+
datas?: Array<string | DataLink> | DataLink
|
|
166
|
+
extra?: string | DataLink
|
|
167
|
+
}
|
|
168
|
+
>
|
|
169
|
+
| DataLink
|
|
170
|
+
}
|
|
171
|
+
events?: {}
|
|
172
|
+
outlets?: {
|
|
173
|
+
/* Is advertising */
|
|
174
|
+
isAdvertising?: () => Data
|
|
175
|
+
/* Last receive written */
|
|
176
|
+
lastWrite?: () => Data
|
|
177
|
+
/* Error message */
|
|
178
|
+
errorMessage?: () => Data
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* BLE Peripheral Mode Generator */
|
|
183
|
+
export type GeneratorBlePeripheral = Generator &
|
|
184
|
+
GeneratorBlePeripheralDef & {
|
|
185
|
+
templateKey: 'GENERATOR_BLE_PERIPHERAL'
|
|
186
|
+
switches: Array<
|
|
187
|
+
SwitchDef &
|
|
188
|
+
GeneratorBlePeripheralDef & {
|
|
189
|
+
conds?: Array<{
|
|
190
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
191
|
+
cond:
|
|
192
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
193
|
+
| SwitchCondData
|
|
194
|
+
| {
|
|
195
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
196
|
+
outlet: 'isAdvertising' | 'lastWrite' | 'errorMessage'
|
|
197
|
+
value: any
|
|
198
|
+
}
|
|
199
|
+
}>
|
|
200
|
+
}
|
|
201
|
+
>
|
|
202
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
interface GeneratorCanvasMapDef {
|
|
13
|
+
/*
|
|
14
|
+
Default property:
|
|
15
|
+
{
|
|
16
|
+
"triggerList": []
|
|
17
|
+
}
|
|
18
|
+
*/
|
|
19
|
+
property?: {
|
|
20
|
+
/* Trigger rule list */
|
|
21
|
+
triggerList?:
|
|
22
|
+
| Array<
|
|
23
|
+
| DataLink
|
|
24
|
+
| {
|
|
25
|
+
operation?: '<' | '<=' | '==' | '!=' | '>' | '>=' | DataLink
|
|
26
|
+
property?: any
|
|
27
|
+
value?: string | DataLink
|
|
28
|
+
canvasId?: string | DataLink
|
|
29
|
+
canvasTitleLike?: string | DataLink
|
|
30
|
+
}
|
|
31
|
+
>
|
|
32
|
+
| DataLink
|
|
33
|
+
}
|
|
34
|
+
outlets?: {}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Trigger change canvas by setup rules */
|
|
38
|
+
export type GeneratorCanvasMap = Generator &
|
|
39
|
+
GeneratorCanvasMapDef & {
|
|
40
|
+
templateKey: 'GENERATOR_CANVAS_MAP'
|
|
41
|
+
switches: Array<
|
|
42
|
+
SwitchDef &
|
|
43
|
+
GeneratorCanvasMapDef & {
|
|
44
|
+
conds?: Array<{
|
|
45
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
46
|
+
cond:
|
|
47
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
48
|
+
| SwitchCondData
|
|
49
|
+
| {
|
|
50
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
51
|
+
outlet: ''
|
|
52
|
+
value: any
|
|
53
|
+
}
|
|
54
|
+
}>
|
|
55
|
+
}
|
|
56
|
+
>
|
|
57
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
/* Sale */
|
|
13
|
+
export type GeneratorCastlesPayActionSale = ActionWithParams & {
|
|
14
|
+
__actionName: 'GENERATOR_CASTLES_PAY_SALE'
|
|
15
|
+
params?: Array<{
|
|
16
|
+
input: 'amount'
|
|
17
|
+
value?: number | DataLink | EventProperty
|
|
18
|
+
mapping?: string
|
|
19
|
+
}>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Cancel Transaction */
|
|
23
|
+
export type GeneratorCastlesPayActionCancelTransaction = ActionWithParams & {
|
|
24
|
+
__actionName: 'GENERATOR_CASTLES_PAY_CANCEL_TRANSACTION'
|
|
25
|
+
params?: Array<{
|
|
26
|
+
input: 'transactionId'
|
|
27
|
+
value?: string | DataLink | EventProperty
|
|
28
|
+
mapping?: string
|
|
29
|
+
}>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Open Search */
|
|
33
|
+
export type GeneratorCastlesPayActionOpenSearch = Action & {
|
|
34
|
+
__actionName: 'GENERATOR_CASTLES_PAY_OPEN_SEARCH'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface GeneratorCastlesPayDef {
|
|
38
|
+
/*
|
|
39
|
+
Default property:
|
|
40
|
+
{}
|
|
41
|
+
*/
|
|
42
|
+
property?: {}
|
|
43
|
+
events?: {
|
|
44
|
+
/* Action Success */
|
|
45
|
+
onActionSuccess?: Array<EventAction>
|
|
46
|
+
/* Action Error */
|
|
47
|
+
onActionError?: Array<EventAction>
|
|
48
|
+
}
|
|
49
|
+
outlets?: {
|
|
50
|
+
/* Last Transaction Result */
|
|
51
|
+
lastTransactionResult?: () => Data
|
|
52
|
+
/* Last Error */
|
|
53
|
+
lastError?: () => Data
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Castles Pay */
|
|
58
|
+
export type GeneratorCastlesPay = Generator &
|
|
59
|
+
GeneratorCastlesPayDef & {
|
|
60
|
+
templateKey: 'GENERATOR_CASTLES_PAY'
|
|
61
|
+
switches: Array<
|
|
62
|
+
SwitchDef &
|
|
63
|
+
GeneratorCastlesPayDef & {
|
|
64
|
+
conds?: Array<{
|
|
65
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
66
|
+
cond:
|
|
67
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
68
|
+
| SwitchCondData
|
|
69
|
+
| {
|
|
70
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
71
|
+
outlet: 'lastTransactionResult' | 'lastError'
|
|
72
|
+
value: any
|
|
73
|
+
}
|
|
74
|
+
}>
|
|
75
|
+
}
|
|
76
|
+
>
|
|
77
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
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 Data Bank fetch */
|
|
13
|
+
export type GeneratorDataBankActionFetch = Action & {
|
|
14
|
+
__actionName: 'GENERATOR_DATA_BANK_FETCH'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Run Data Bank update */
|
|
18
|
+
export type GeneratorDataBankActionUpdateProperty = ActionWithParams & {
|
|
19
|
+
__actionName: 'GENERATOR_DATA_BANK_UPDATE_PROPERTY'
|
|
20
|
+
params?: Array<
|
|
21
|
+
| {
|
|
22
|
+
input: 'propertyId'
|
|
23
|
+
value?: string | DataLink | EventProperty
|
|
24
|
+
mapping?: string
|
|
25
|
+
}
|
|
26
|
+
| {
|
|
27
|
+
input: 'propertyValue'
|
|
28
|
+
value?: any | EventProperty
|
|
29
|
+
mapping?: string
|
|
30
|
+
}
|
|
31
|
+
>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Run Data Bank remove */
|
|
35
|
+
export type GeneratorDataBankActionRemoveProperty = ActionWithParams & {
|
|
36
|
+
__actionName: 'GENERATOR_DATA_BANK_REMOVE_PROPERTY'
|
|
37
|
+
params?: Array<{
|
|
38
|
+
input: 'propertyId'
|
|
39
|
+
value?: string | DataLink | EventProperty
|
|
40
|
+
mapping?: string
|
|
41
|
+
}>
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Reset cache of Data Bank */
|
|
45
|
+
export type GeneratorDataBankActionResetCache = Action & {
|
|
46
|
+
__actionName: 'GENERATOR_DATA_BANK_RESET_CACHE'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* Cancel current running subscription */
|
|
50
|
+
export type GeneratorDataBankActionCancelSubscription = Action & {
|
|
51
|
+
__actionName: 'GENERATOR_DATA_BANK_CANCEL_SUBSCRIPTION'
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface GeneratorDataBankDef {
|
|
55
|
+
/*
|
|
56
|
+
Default property:
|
|
57
|
+
{
|
|
58
|
+
"init": false,
|
|
59
|
+
"fetchPolicy": "cache-first",
|
|
60
|
+
"subscribeDataChange": false
|
|
61
|
+
}
|
|
62
|
+
*/
|
|
63
|
+
property?: {
|
|
64
|
+
/* Start generator initialization execution immediately */
|
|
65
|
+
init?: boolean | DataLink
|
|
66
|
+
/* Data Bank Space ID */
|
|
67
|
+
spacename?: string | DataLink
|
|
68
|
+
/* Data Bank Space secret key */
|
|
69
|
+
spacekey?: string | DataLink
|
|
70
|
+
/* Data need to be fetched */
|
|
71
|
+
properties?: Array<string | DataLink> | DataLink
|
|
72
|
+
/* Determine the cache behavior
|
|
73
|
+
|
|
74
|
+
cache-first: Cache first if existing, then fetch from network
|
|
75
|
+
network-and-cache: Fetch from network, then save cache
|
|
76
|
+
network-only: Fetch from network only */
|
|
77
|
+
fetchPolicy?: 'cache-first' | 'network-and-cache' | 'network-only' | DataLink
|
|
78
|
+
/* Subscribe Data change */
|
|
79
|
+
subscribeDataChange?: boolean | DataLink
|
|
80
|
+
}
|
|
81
|
+
events?: {
|
|
82
|
+
/* Event of Data Bank fetch response */
|
|
83
|
+
onFetchResponse?: Array<EventAction>
|
|
84
|
+
/* Event of Data Bank change from subscription */
|
|
85
|
+
onChange?: Array<EventAction>
|
|
86
|
+
/* Event of Data Bank fetch error */
|
|
87
|
+
onFetchError?: Array<EventAction>
|
|
88
|
+
/* Event of error */
|
|
89
|
+
onError?: Array<EventAction>
|
|
90
|
+
/* Event of subscription on connection */
|
|
91
|
+
subscribeDataOnConnect?: Array<EventAction>
|
|
92
|
+
/* Server connections error of subscription */
|
|
93
|
+
subscribeDataOnConnectError?: Array<EventAction>
|
|
94
|
+
}
|
|
95
|
+
outlets?: {
|
|
96
|
+
/* Response for Data Bank fetch request, it will save to Data */
|
|
97
|
+
response?: () => Data
|
|
98
|
+
/* Server response error of Data Bank fetch request, it will save to Data */
|
|
99
|
+
error?: () => Data
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Get Data or subscribe to Data changes from Data Bank */
|
|
104
|
+
export type GeneratorDataBank = Generator &
|
|
105
|
+
GeneratorDataBankDef & {
|
|
106
|
+
templateKey: 'GENERATOR_DATA_BANK'
|
|
107
|
+
switches: Array<
|
|
108
|
+
SwitchDef &
|
|
109
|
+
GeneratorDataBankDef & {
|
|
110
|
+
conds?: Array<{
|
|
111
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
112
|
+
cond:
|
|
113
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
114
|
+
| SwitchCondData
|
|
115
|
+
| {
|
|
116
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
117
|
+
outlet: 'response' | 'error'
|
|
118
|
+
value: any
|
|
119
|
+
}
|
|
120
|
+
}>
|
|
121
|
+
}
|
|
122
|
+
>
|
|
123
|
+
}
|