@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.
Files changed (129) hide show
  1. package/compile/action-name-map.ts +988 -0
  2. package/compile/index.ts +1245 -0
  3. package/compile/util.ts +358 -0
  4. package/index.ts +6 -0
  5. package/package.json +28 -0
  6. package/skills/bricks-design/LICENSE.txt +180 -0
  7. package/skills/bricks-design/SKILL.md +66 -0
  8. package/skills/bricks-project/SKILL.md +32 -0
  9. package/skills/bricks-project/rules/animation.md +159 -0
  10. package/skills/bricks-project/rules/architecture-patterns.md +69 -0
  11. package/skills/bricks-project/rules/automations.md +221 -0
  12. package/skills/bricks-project/rules/buttress.md +156 -0
  13. package/skills/bricks-project/rules/data-calculation.md +208 -0
  14. package/skills/bricks-project/rules/local-sync.md +129 -0
  15. package/skills/bricks-project/rules/media-flow.md +158 -0
  16. package/skills/bricks-project/rules/remote-data-bank.md +196 -0
  17. package/skills/bricks-project/rules/standby-transition.md +124 -0
  18. package/skills/rive-marketplace/SKILL.md +99 -0
  19. package/tools/deploy.ts +151 -0
  20. package/tools/icons/.gitattributes +1 -0
  21. package/tools/icons/fa6pro-glyphmap.json +4686 -0
  22. package/tools/icons/fa6pro-meta.json +3671 -0
  23. package/tools/mcp-server.ts +28 -0
  24. package/tools/mcp-tools/compile.ts +91 -0
  25. package/tools/mcp-tools/huggingface.ts +762 -0
  26. package/tools/mcp-tools/icons.ts +70 -0
  27. package/tools/mcp-tools/lottie.ts +102 -0
  28. package/tools/mcp-tools/media.ts +110 -0
  29. package/tools/postinstall.ts +229 -0
  30. package/tools/preview-main.mjs +293 -0
  31. package/tools/preview.ts +143 -0
  32. package/tools/pull.ts +116 -0
  33. package/tsconfig.json +16 -0
  34. package/types/animation.ts +100 -0
  35. package/types/automation.ts +235 -0
  36. package/types/brick-base.ts +80 -0
  37. package/types/bricks/Camera.ts +246 -0
  38. package/types/bricks/Chart.ts +372 -0
  39. package/types/bricks/GenerativeMedia.ts +276 -0
  40. package/types/bricks/Icon.ts +98 -0
  41. package/types/bricks/Image.ts +114 -0
  42. package/types/bricks/Items.ts +476 -0
  43. package/types/bricks/Lottie.ts +168 -0
  44. package/types/bricks/Maps.ts +262 -0
  45. package/types/bricks/QrCode.ts +117 -0
  46. package/types/bricks/Rect.ts +150 -0
  47. package/types/bricks/RichText.ts +128 -0
  48. package/types/bricks/Rive.ts +220 -0
  49. package/types/bricks/Slideshow.ts +201 -0
  50. package/types/bricks/Svg.ts +99 -0
  51. package/types/bricks/Text.ts +148 -0
  52. package/types/bricks/TextInput.ts +242 -0
  53. package/types/bricks/Video.ts +175 -0
  54. package/types/bricks/VideoStreaming.ts +112 -0
  55. package/types/bricks/WebRtcStream.ts +65 -0
  56. package/types/bricks/WebView.ts +168 -0
  57. package/types/bricks/index.ts +21 -0
  58. package/types/canvas.ts +82 -0
  59. package/types/common.ts +144 -0
  60. package/types/data-calc-command.ts +7005 -0
  61. package/types/data-calc-script.ts +21 -0
  62. package/types/data-calc.ts +11 -0
  63. package/types/data.ts +95 -0
  64. package/types/generators/AlarmClock.ts +110 -0
  65. package/types/generators/Assistant.ts +621 -0
  66. package/types/generators/BleCentral.ts +247 -0
  67. package/types/generators/BlePeripheral.ts +208 -0
  68. package/types/generators/CanvasMap.ts +74 -0
  69. package/types/generators/CastlesPay.ts +87 -0
  70. package/types/generators/DataBank.ts +160 -0
  71. package/types/generators/File.ts +432 -0
  72. package/types/generators/GraphQl.ts +132 -0
  73. package/types/generators/Http.ts +222 -0
  74. package/types/generators/HttpServer.ts +176 -0
  75. package/types/generators/Information.ts +103 -0
  76. package/types/generators/Intent.ts +168 -0
  77. package/types/generators/Iterator.ts +108 -0
  78. package/types/generators/Keyboard.ts +105 -0
  79. package/types/generators/LlmAnthropicCompat.ts +212 -0
  80. package/types/generators/LlmAppleBuiltin.ts +159 -0
  81. package/types/generators/LlmGgml.ts +861 -0
  82. package/types/generators/LlmMediaTekNeuroPilot.ts +235 -0
  83. package/types/generators/LlmMlx.ts +227 -0
  84. package/types/generators/LlmOnnx.ts +213 -0
  85. package/types/generators/LlmOpenAiCompat.ts +244 -0
  86. package/types/generators/LlmQualcommAiEngine.ts +247 -0
  87. package/types/generators/Mcp.ts +637 -0
  88. package/types/generators/McpServer.ts +289 -0
  89. package/types/generators/MediaFlow.ts +170 -0
  90. package/types/generators/MqttBroker.ts +141 -0
  91. package/types/generators/MqttClient.ts +141 -0
  92. package/types/generators/Question.ts +408 -0
  93. package/types/generators/RealtimeTranscription.ts +279 -0
  94. package/types/generators/RerankerGgml.ts +191 -0
  95. package/types/generators/SerialPort.ts +151 -0
  96. package/types/generators/SoundPlayer.ts +94 -0
  97. package/types/generators/SoundRecorder.ts +130 -0
  98. package/types/generators/SpeechToTextGgml.ts +415 -0
  99. package/types/generators/SpeechToTextOnnx.ts +236 -0
  100. package/types/generators/SpeechToTextPlatform.ts +85 -0
  101. package/types/generators/SqLite.ts +159 -0
  102. package/types/generators/Step.ts +107 -0
  103. package/types/generators/SttAppleBuiltin.ts +130 -0
  104. package/types/generators/Tcp.ts +126 -0
  105. package/types/generators/TcpServer.ts +147 -0
  106. package/types/generators/TextToSpeechAppleBuiltin.ts +127 -0
  107. package/types/generators/TextToSpeechGgml.ts +221 -0
  108. package/types/generators/TextToSpeechOnnx.ts +178 -0
  109. package/types/generators/TextToSpeechOpenAiLike.ts +121 -0
  110. package/types/generators/ThermalPrinter.ts +191 -0
  111. package/types/generators/Tick.ts +83 -0
  112. package/types/generators/Udp.ts +120 -0
  113. package/types/generators/VadGgml.ts +250 -0
  114. package/types/generators/VadOnnx.ts +231 -0
  115. package/types/generators/VadTraditional.ts +138 -0
  116. package/types/generators/VectorStore.ts +257 -0
  117. package/types/generators/Watchdog.ts +107 -0
  118. package/types/generators/WebCrawler.ts +103 -0
  119. package/types/generators/WebRtc.ts +181 -0
  120. package/types/generators/WebSocket.ts +148 -0
  121. package/types/generators/index.ts +57 -0
  122. package/types/index.ts +13 -0
  123. package/types/subspace.ts +59 -0
  124. package/types/switch.ts +51 -0
  125. package/types/system.ts +707 -0
  126. package/utils/calc.ts +126 -0
  127. package/utils/data.ts +497 -0
  128. package/utils/event-props.ts +836 -0
  129. package/utils/id.ts +80 -0
@@ -0,0 +1,247 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Bluetooth Low Energy central: scan, connect, and communicate with BLE peripherals
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 scan */
19
+ export type GeneratorBleCentralActionStartScan = Action & {
20
+ __actionName: 'GENERATOR_BLE_CENTRAL_START_SCAN'
21
+ }
22
+
23
+ /* Stop scan */
24
+ export type GeneratorBleCentralActionStopScan = Action & {
25
+ __actionName: 'GENERATOR_BLE_CENTRAL_STOP_SCAN'
26
+ }
27
+
28
+ /* Connect device */
29
+ export type GeneratorBleCentralActionConnect = ActionWithParams & {
30
+ __actionName: 'GENERATOR_BLE_CENTRAL_CONNECT'
31
+ params?: Array<{
32
+ input: 'deviceId'
33
+ value?: string | DataLink | EventProperty
34
+ mapping?: string
35
+ }>
36
+ }
37
+
38
+ /* Read a characteristic */
39
+ export type GeneratorBleCentralActionReadCharacteristic = ActionWithParams & {
40
+ __actionName: 'GENERATOR_BLE_CENTRAL_READ_CHARACTERISTIC'
41
+ params?: Array<
42
+ | {
43
+ input: 'deviceId'
44
+ value?: string | DataLink | EventProperty
45
+ mapping?: string
46
+ }
47
+ | {
48
+ input: 'serviceId'
49
+ value?: string | DataLink | EventProperty
50
+ mapping?: string
51
+ }
52
+ | {
53
+ input: 'characteristicId'
54
+ value?: string | DataLink | EventProperty
55
+ mapping?: string
56
+ }
57
+ >
58
+ }
59
+
60
+ /* Monitor a characteristic */
61
+ export type GeneratorBleCentralActionMonitorCharacteristic = ActionWithParams & {
62
+ __actionName: 'GENERATOR_BLE_CENTRAL_MONITOR_CHARACTERISTIC'
63
+ params?: Array<
64
+ | {
65
+ input: 'deviceId'
66
+ value?: string | DataLink | EventProperty
67
+ mapping?: string
68
+ }
69
+ | {
70
+ input: 'serviceId'
71
+ value?: string | DataLink | EventProperty
72
+ mapping?: string
73
+ }
74
+ | {
75
+ input: 'characteristicId'
76
+ value?: string | DataLink | EventProperty
77
+ mapping?: string
78
+ }
79
+ >
80
+ }
81
+
82
+ /* Cancel monitor a characteristic */
83
+ export type GeneratorBleCentralActionCancelMonitorCharacteristic = ActionWithParams & {
84
+ __actionName: 'GENERATOR_BLE_CENTRAL_CANCEL_MONITOR_CHARACTERISTIC'
85
+ params?: Array<
86
+ | {
87
+ input: 'deviceId'
88
+ value?: string | DataLink | EventProperty
89
+ mapping?: string
90
+ }
91
+ | {
92
+ input: 'serviceId'
93
+ value?: string | DataLink | EventProperty
94
+ mapping?: string
95
+ }
96
+ | {
97
+ input: 'characteristicId'
98
+ value?: string | DataLink | EventProperty
99
+ mapping?: string
100
+ }
101
+ >
102
+ }
103
+
104
+ /* Write data to a characteristic */
105
+ export type GeneratorBleCentralActionWriteCharacteristic = ActionWithParams & {
106
+ __actionName: 'GENERATOR_BLE_CENTRAL_WRITE_CHARACTERISTIC'
107
+ params?: Array<
108
+ | {
109
+ input: 'deviceId'
110
+ value?: string | DataLink | EventProperty
111
+ mapping?: string
112
+ }
113
+ | {
114
+ input: 'serviceId'
115
+ value?: string | DataLink | EventProperty
116
+ mapping?: string
117
+ }
118
+ | {
119
+ input: 'characteristicId'
120
+ value?: string | DataLink | EventProperty
121
+ mapping?: string
122
+ }
123
+ | {
124
+ input: 'dataHex'
125
+ value?: string | DataLink | EventProperty
126
+ mapping?: string
127
+ }
128
+ | {
129
+ input: 'writeWithoutResponse'
130
+ value?: boolean | DataLink | EventProperty
131
+ mapping?: string
132
+ }
133
+ >
134
+ }
135
+
136
+ /* Disconnect device */
137
+ export type GeneratorBleCentralActionDisconnect = ActionWithParams & {
138
+ __actionName: 'GENERATOR_BLE_CENTRAL_DISCONNECT'
139
+ params?: Array<{
140
+ input: 'deviceId'
141
+ value?: string | DataLink | EventProperty
142
+ mapping?: string
143
+ }>
144
+ }
145
+
146
+ interface GeneratorBleCentralDef {
147
+ /*
148
+ Default property:
149
+ {
150
+ "init": false,
151
+ "scanTime": 10,
152
+ "updateInterval": 1000,
153
+ "retainTime": 120,
154
+ "maximumDiscoveredDevice": 256,
155
+ "allowDuplicates": false,
156
+ "scanMode": "LowPower"
157
+ }
158
+ */
159
+ property?: {
160
+ /* Start scan on generator initialized */
161
+ init?: boolean | DataLink
162
+ /* Regex match name to filter device */
163
+ deviceNameFilter?: string | DataLink
164
+ /* Service UUIDs to filter device */
165
+ serviceFilter?: Array<string | DataLink> | DataLink
166
+ /* RSSI threshold */
167
+ rssiThreshold?: number | DataLink
168
+ /* Scan time */
169
+ scanTime?: number | DataLink
170
+ /* Discovered device list update interval */
171
+ updateInterval?: number | DataLink
172
+ /* Discovered device retain time */
173
+ retainTime?: number | DataLink
174
+ /* Maximum device list number */
175
+ maximumDiscoveredDevice?: number | DataLink
176
+ /* Allow duplicates scanning records (iOS only) */
177
+ allowDuplicates?: boolean | DataLink
178
+ /* BLE scan mode (Android only) */
179
+ scanMode?: 'Opportunistic' | 'LowPower' | 'Balanced' | 'LowLatency' | DataLink
180
+ }
181
+ events?: {
182
+ /* Event for state change */
183
+ onStateChange?: Array<EventAction>
184
+ /* Event for error occurred */
185
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['BleCentral']['onError']>>
186
+ /* Event for start scan */
187
+ onStartScan?: Array<EventAction>
188
+ /* Event for stop scan */
189
+ onStopScan?: Array<EventAction>
190
+ /* Event for discover device */
191
+ onDiscoverDevice?: Array<
192
+ EventAction<string & keyof TemplateEventPropsMap['BleCentral']['onDiscoverDevice']>
193
+ >
194
+ /* Event for device connected */
195
+ onConnectDevice?: Array<
196
+ EventAction<string & keyof TemplateEventPropsMap['BleCentral']['onConnectDevice']>
197
+ >
198
+ /* Event for device disconnected */
199
+ onDisconnectDevice?: Array<EventAction>
200
+ /* Event for receive on read */
201
+ onReadReceive?: Array<
202
+ EventAction<string & keyof TemplateEventPropsMap['BleCentral']['onReadReceive']>
203
+ >
204
+ /* Event for receive on monitor */
205
+ onMonitorReceive?: Array<
206
+ EventAction<string & keyof TemplateEventPropsMap['BleCentral']['onMonitorReceive']>
207
+ >
208
+ }
209
+ outlets?: {
210
+ /* Is scaning */
211
+ isScaning?: () => Data<boolean>
212
+ /* Discovered device list */
213
+ discoveredDeviceList?: () => Data<
214
+ Array<{
215
+ id?: string
216
+ name?: string
217
+ rssi?: number
218
+ advertising?: { [key: string]: any }
219
+ [key: string]: any
220
+ }>
221
+ >
222
+ /* Error message */
223
+ errorMessage?: () => Data<string>
224
+ }
225
+ }
226
+
227
+ /* Bluetooth Low Energy central: scan, connect, and communicate with BLE peripherals */
228
+ export type GeneratorBleCentral = Generator &
229
+ GeneratorBleCentralDef & {
230
+ templateKey: 'GENERATOR_BLE_CENTRAL'
231
+ switches?: Array<
232
+ SwitchDef &
233
+ GeneratorBleCentralDef & {
234
+ conds?: Array<{
235
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
236
+ cond:
237
+ | SwitchCondInnerStateCurrentCanvas
238
+ | SwitchCondData
239
+ | {
240
+ __typename: 'SwitchCondInnerStateOutlet'
241
+ outlet: 'isScaning' | 'discoveredDeviceList' | 'errorMessage'
242
+ value: any
243
+ }
244
+ }>
245
+ }
246
+ >
247
+ }
@@ -0,0 +1,208 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Bluetooth Low Energy peripheral: advertise services and respond to central connections
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 advertise */
19
+ export type GeneratorBlePeripheralActionStart = Action & {
20
+ __actionName: 'GENERATOR_BLE_PERIPHERAL_START'
21
+ }
22
+
23
+ /* undefined */
24
+ export type GeneratorBlePeripheralActionNotify = ActionWithParams & {
25
+ __actionName: 'GENERATOR_BLE_PERIPHERAL_NOTIFY'
26
+ params?: Array<
27
+ | {
28
+ input: 'serviceId'
29
+ value?: string | DataLink | EventProperty
30
+ mapping?: string
31
+ }
32
+ | {
33
+ input: 'charId'
34
+ value?: string | DataLink | EventProperty
35
+ mapping?: string
36
+ }
37
+ | {
38
+ input: 'value'
39
+ value?: string | DataLink | EventProperty
40
+ mapping?: string
41
+ }
42
+ | {
43
+ input: 'encoding'
44
+ value?: 'utf8' | 'hex' | 'base64' | DataLink | EventProperty
45
+ mapping?: string
46
+ }
47
+ >
48
+ }
49
+
50
+ /* Stop advertise */
51
+ export type GeneratorBlePeripheralActionStop = Action & {
52
+ __actionName: 'GENERATOR_BLE_PERIPHERAL_STOP'
53
+ }
54
+
55
+ interface GeneratorBlePeripheralDef {
56
+ /*
57
+ Default property:
58
+ {
59
+ "init": false,
60
+ "connectable": true,
61
+ "advertiseMode": "LOW_POWER",
62
+ "txPower": "MEDIUM",
63
+ "includeDeviceName": true,
64
+ "includeTxPower": true
65
+ }
66
+ */
67
+ property?: {
68
+ /* Start advertise on generator initialized */
69
+ init?: boolean | DataLink
70
+ /* Advertise device name */
71
+ name?: string | DataLink
72
+ /* BLE is connectable (Android only) */
73
+ connectable?: boolean | DataLink
74
+ /* Advertise mode (Android only) */
75
+ advertiseMode?: 'LOW_POWER' | 'BALANCED' | 'LOW_LATENCY' | DataLink
76
+ /* Bluetooth transmit power (Android only) */
77
+ txPower?: 'ULTRA_LOW' | 'LOW' | 'MEDIUM' | 'HIGH' | DataLink
78
+ /* Include device name in advertise (Android only) */
79
+ includeDeviceName?: boolean | DataLink
80
+ /* Include transmit power in advertise (Android only) */
81
+ includeTxPower?: boolean | DataLink
82
+ /* Advertise manufacturer ID (Android only) */
83
+ manufacturerId?: number | DataLink
84
+ /* Advertise manufacturer data (Android only) */
85
+ manufacturerData?:
86
+ | DataLink
87
+ | {
88
+ data?: string | DataLink
89
+ encode?: 'utf8' | 'hex' | 'base64' | DataLink
90
+ }
91
+ /* Advertise service data list (Android only) */
92
+ serviceDataMap?:
93
+ | Array<
94
+ | DataLink
95
+ | {
96
+ serviceId?: string | DataLink
97
+ data?: string | DataLink
98
+ encode?: 'utf8' | 'hex' | 'base64' | DataLink
99
+ }
100
+ >
101
+ | DataLink
102
+ /* GATT service list */
103
+ gattServiceMap?:
104
+ | Array<
105
+ | DataLink
106
+ | {
107
+ serviceId?: string | DataLink
108
+ primary?: boolean | DataLink
109
+ characteristics?:
110
+ | Array<
111
+ | DataLink
112
+ | {
113
+ id?: string | DataLink
114
+ permission?:
115
+ | DataLink
116
+ | {
117
+ readable?: boolean | DataLink
118
+ readEncrypted?: boolean | DataLink
119
+ writeable?: boolean | DataLink
120
+ writeEncrypted?: boolean | DataLink
121
+ }
122
+ properties?:
123
+ | DataLink
124
+ | {
125
+ broadcast?: boolean | DataLink
126
+ read?: boolean | DataLink
127
+ writeNoResponse?: boolean | DataLink
128
+ write?: boolean | DataLink
129
+ notify?: boolean | DataLink
130
+ indicate?: boolean | DataLink
131
+ signedWrite?: boolean | DataLink
132
+ extendedProps?: boolean | DataLink
133
+ }
134
+ }
135
+ >
136
+ | DataLink
137
+ }
138
+ >
139
+ | DataLink
140
+ /* Response value of characteristics */
141
+ resData?:
142
+ | Array<
143
+ | DataLink
144
+ | {
145
+ serviceId?: string | DataLink
146
+ charId?: string | DataLink
147
+ value?: string | DataLink
148
+ encoding?: 'utf8' | 'hex' | 'base64' | DataLink
149
+ }
150
+ >
151
+ | DataLink
152
+ /* Beacon mode */
153
+ beaconsEnable?: boolean | DataLink
154
+ /* Measured RSSI @ 1m, used for calculate distance */
155
+ beaconsTxPower?: number | DataLink
156
+ /* Beacon configs
157
+ presets has pre-defined layout and manufacturerId
158
+ layout string is like AltBeacon's Beacon Layout, but replace "x" as extra data
159
+ id and data could be 0x prefixed hex, hex string, decimal or UUID
160
+ extra should be hex string */
161
+ beaconsConfig?:
162
+ | Array<
163
+ | DataLink
164
+ | {
165
+ preset?: 'LINE_SIMPLE_BEACON' | 'iBeacon' | 'EddystoneUID' | 'AltBeacon' | DataLink
166
+ manufacturerId?: number | DataLink
167
+ layout?: string | DataLink
168
+ id1?: string | DataLink
169
+ id2?: string | DataLink
170
+ id3?: string | DataLink
171
+ datas?: Array<string | DataLink> | DataLink
172
+ extra?: string | DataLink
173
+ }
174
+ >
175
+ | DataLink
176
+ }
177
+ events?: {}
178
+ outlets?: {
179
+ /* Is advertising */
180
+ isAdvertising?: () => Data<boolean>
181
+ /* Last receive written */
182
+ lastWrite?: () => Data<{ [key: string]: any }>
183
+ /* Error message */
184
+ errorMessage?: () => Data<string>
185
+ }
186
+ }
187
+
188
+ /* Bluetooth Low Energy peripheral: advertise services and respond to central connections */
189
+ export type GeneratorBlePeripheral = Generator &
190
+ GeneratorBlePeripheralDef & {
191
+ templateKey: 'GENERATOR_BLE_PERIPHERAL'
192
+ switches?: Array<
193
+ SwitchDef &
194
+ GeneratorBlePeripheralDef & {
195
+ conds?: Array<{
196
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
197
+ cond:
198
+ | SwitchCondInnerStateCurrentCanvas
199
+ | SwitchCondData
200
+ | {
201
+ __typename: 'SwitchCondInnerStateOutlet'
202
+ outlet: 'isAdvertising' | 'lastWrite' | 'errorMessage'
203
+ value: any
204
+ }
205
+ }>
206
+ }
207
+ >
208
+ }
@@ -0,0 +1,74 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Trigger canvas navigation 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
+ interface GeneratorCanvasMapDef {
19
+ /*
20
+ Default property:
21
+ {
22
+ "triggerList": []
23
+ }
24
+ */
25
+ property?: {
26
+ /* Trigger rule list */
27
+ triggerList?:
28
+ | Array<
29
+ | DataLink
30
+ | {
31
+ operation?: '<' | '<=' | '==' | '!=' | '>' | '>=' | DataLink
32
+ property?: any
33
+ value?: string | DataLink
34
+ canvasId?: string | DataLink
35
+ canvasTitleLike?: string | DataLink
36
+ }
37
+ >
38
+ | DataLink
39
+ }
40
+ events?: {
41
+ /* Event triggered when a rule matches and canvas navigation occurs */
42
+ onNavigate?: Array<EventAction<string & keyof TemplateEventPropsMap['CanvasMap']['onNavigate']>>
43
+ }
44
+ outlets?: {
45
+ /* Last matched trigger rule that caused canvas navigation */
46
+ lastMatchedRule?: () => Data<{ [key: string]: any }>
47
+ /* Index of the last matched rule in triggerList */
48
+ lastMatchedIndex?: () => Data<number>
49
+ /* Total count of canvas navigations triggered by this generator */
50
+ navigationCount?: () => Data<number>
51
+ }
52
+ }
53
+
54
+ /* Trigger canvas navigation by setup rules */
55
+ export type GeneratorCanvasMap = Generator &
56
+ GeneratorCanvasMapDef & {
57
+ templateKey: 'GENERATOR_CANVAS_MAP'
58
+ switches?: Array<
59
+ SwitchDef &
60
+ GeneratorCanvasMapDef & {
61
+ conds?: Array<{
62
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
63
+ cond:
64
+ | SwitchCondInnerStateCurrentCanvas
65
+ | SwitchCondData
66
+ | {
67
+ __typename: 'SwitchCondInnerStateOutlet'
68
+ outlet: 'lastMatchedRule' | 'lastMatchedIndex' | 'navigationCount'
69
+ value: any
70
+ }
71
+ }>
72
+ }
73
+ >
74
+ }
@@ -0,0 +1,87 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Payment processing integration for Castles payment terminals
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
+ /* Sale */
19
+ export type GeneratorCastlesPayActionSale = ActionWithParams & {
20
+ __actionName: 'GENERATOR_CASTLES_PAY_SALE'
21
+ params?: Array<{
22
+ input: 'amount'
23
+ value?: number | DataLink | EventProperty
24
+ mapping?: string
25
+ }>
26
+ }
27
+
28
+ /* Cancel Transaction */
29
+ export type GeneratorCastlesPayActionCancelTransaction = ActionWithParams & {
30
+ __actionName: 'GENERATOR_CASTLES_PAY_CANCEL_TRANSACTION'
31
+ params?: Array<{
32
+ input: 'transactionId'
33
+ value?: string | DataLink | EventProperty
34
+ mapping?: string
35
+ }>
36
+ }
37
+
38
+ /* Open Search */
39
+ export type GeneratorCastlesPayActionOpenSearch = Action & {
40
+ __actionName: 'GENERATOR_CASTLES_PAY_OPEN_SEARCH'
41
+ }
42
+
43
+ interface GeneratorCastlesPayDef {
44
+ /*
45
+ Default property:
46
+ {}
47
+ */
48
+ property?: {}
49
+ events?: {
50
+ /* Action Success */
51
+ onActionSuccess?: Array<
52
+ EventAction<string & keyof TemplateEventPropsMap['CastlesPay']['onActionSuccess']>
53
+ >
54
+ /* Action Error */
55
+ onActionError?: Array<
56
+ EventAction<string & keyof TemplateEventPropsMap['CastlesPay']['onActionError']>
57
+ >
58
+ }
59
+ outlets?: {
60
+ /* Last Transaction Result */
61
+ lastTransactionResult?: () => Data<{ [key: string]: any }>
62
+ /* Last Error */
63
+ lastError?: () => Data<string>
64
+ }
65
+ }
66
+
67
+ /* Payment processing integration for Castles payment terminals */
68
+ export type GeneratorCastlesPay = Generator &
69
+ GeneratorCastlesPayDef & {
70
+ templateKey: 'GENERATOR_CASTLES_PAY'
71
+ switches?: Array<
72
+ SwitchDef &
73
+ GeneratorCastlesPayDef & {
74
+ conds?: Array<{
75
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
76
+ cond:
77
+ | SwitchCondInnerStateCurrentCanvas
78
+ | SwitchCondData
79
+ | {
80
+ __typename: 'SwitchCondInnerStateOutlet'
81
+ outlet: 'lastTransactionResult' | 'lastError'
82
+ value: any
83
+ }
84
+ }>
85
+ }
86
+ >
87
+ }