@fugood/bricks-project 2.24.0-beta.9 → 2.24.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.
Files changed (123) hide show
  1. package/compile/action-name-map.ts +38 -0
  2. package/compile/index.ts +460 -158
  3. package/compile/util.ts +2 -0
  4. package/package.json +7 -3
  5. package/package.json.bak +27 -0
  6. package/skills/{bricks-project → bricks-ctor}/SKILL.md +2 -2
  7. package/skills/{bricks-project → bricks-ctor}/rules/animation.md +1 -1
  8. package/skills/{bricks-project → bricks-ctor}/rules/architecture-patterns.md +7 -0
  9. package/skills/{bricks-project → bricks-ctor}/rules/buttress.md +10 -7
  10. package/skills/{bricks-project → bricks-ctor}/rules/data-calculation.md +1 -1
  11. package/skills/{bricks-project → bricks-ctor}/rules/local-sync.md +2 -2
  12. package/skills/{bricks-project → bricks-ctor}/rules/media-flow.md +3 -3
  13. package/skills/{bricks-project → bricks-ctor}/rules/remote-data-bank.md +6 -6
  14. package/skills/{bricks-project → bricks-ctor}/rules/standby-transition.md +1 -1
  15. package/skills/bricks-design/LICENSE.txt +180 -0
  16. package/skills/bricks-design/SKILL.md +66 -0
  17. package/tools/deploy.ts +66 -12
  18. package/tools/icons/fa6pro-meta.json +3669 -26125
  19. package/tools/mcp-server.ts +11 -878
  20. package/tools/mcp-tools/compile.ts +91 -0
  21. package/tools/mcp-tools/huggingface.ts +762 -0
  22. package/tools/mcp-tools/icons.ts +70 -0
  23. package/tools/mcp-tools/lottie.ts +102 -0
  24. package/tools/mcp-tools/media.ts +110 -0
  25. package/tools/postinstall.ts +137 -40
  26. package/tools/preview-main.mjs +135 -2
  27. package/tools/preview.ts +41 -2
  28. package/tools/pull.ts +37 -19
  29. package/tsconfig.json +16 -0
  30. package/types/animation.ts +4 -0
  31. package/types/automation.ts +4 -1
  32. package/types/brick-base.ts +1 -1
  33. package/types/bricks/Camera.ts +47 -12
  34. package/types/bricks/Chart.ts +9 -3
  35. package/types/bricks/GenerativeMedia.ts +29 -13
  36. package/types/bricks/Icon.ts +8 -4
  37. package/types/bricks/Image.ts +9 -5
  38. package/types/bricks/Items.ts +28 -14
  39. package/types/bricks/Lottie.ts +14 -6
  40. package/types/bricks/Maps.ts +15 -7
  41. package/types/bricks/QrCode.ts +8 -4
  42. package/types/bricks/Rect.ts +44 -5
  43. package/types/bricks/RichText.ts +8 -4
  44. package/types/bricks/Rive.ts +20 -10
  45. package/types/bricks/Slideshow.ts +19 -9
  46. package/types/bricks/Svg.ts +7 -3
  47. package/types/bricks/Text.ts +8 -4
  48. package/types/bricks/TextInput.ts +22 -12
  49. package/types/bricks/Video.ts +10 -6
  50. package/types/bricks/VideoStreaming.ts +7 -3
  51. package/types/bricks/WebRtcStream.ts +6 -2
  52. package/types/bricks/WebView.ts +11 -7
  53. package/types/canvas.ts +2 -0
  54. package/types/common.ts +15 -8
  55. package/types/data-calc-command.ts +2 -0
  56. package/types/data-calc.ts +1 -0
  57. package/types/data.ts +2 -0
  58. package/types/generators/AlarmClock.ts +16 -10
  59. package/types/generators/Assistant.ts +68 -17
  60. package/types/generators/BleCentral.ts +30 -10
  61. package/types/generators/BlePeripheral.ts +10 -6
  62. package/types/generators/CanvasMap.ts +9 -5
  63. package/types/generators/CastlesPay.ts +14 -6
  64. package/types/generators/DataBank.ts +43 -8
  65. package/types/generators/File.ts +108 -29
  66. package/types/generators/GraphQl.ts +11 -5
  67. package/types/generators/Http.ts +32 -9
  68. package/types/generators/HttpServer.ts +22 -14
  69. package/types/generators/Information.ts +8 -4
  70. package/types/generators/Intent.ts +14 -4
  71. package/types/generators/Iterator.ts +14 -10
  72. package/types/generators/Keyboard.ts +26 -12
  73. package/types/generators/LlmAnthropicCompat.ts +32 -10
  74. package/types/generators/LlmAppleBuiltin.ts +24 -9
  75. package/types/generators/LlmGgml.ts +139 -30
  76. package/types/generators/LlmMediaTekNeuroPilot.ts +235 -0
  77. package/types/generators/LlmMlx.ts +227 -0
  78. package/types/generators/LlmOnnx.ts +33 -13
  79. package/types/generators/LlmOpenAiCompat.ts +46 -10
  80. package/types/generators/LlmQualcommAiEngine.ts +44 -12
  81. package/types/generators/Mcp.ts +374 -33
  82. package/types/generators/McpServer.ts +57 -18
  83. package/types/generators/MediaFlow.ts +37 -11
  84. package/types/generators/MqttBroker.ts +28 -10
  85. package/types/generators/MqttClient.ts +18 -8
  86. package/types/generators/Question.ts +12 -8
  87. package/types/generators/RealtimeTranscription.ts +107 -18
  88. package/types/generators/RerankerGgml.ts +42 -11
  89. package/types/generators/SerialPort.ts +17 -9
  90. package/types/generators/SoundPlayer.ts +9 -3
  91. package/types/generators/SoundRecorder.ts +23 -8
  92. package/types/generators/SpeechToTextGgml.ts +51 -17
  93. package/types/generators/SpeechToTextOnnx.ts +17 -10
  94. package/types/generators/SpeechToTextPlatform.ts +14 -6
  95. package/types/generators/SqLite.ts +19 -9
  96. package/types/generators/Step.ts +8 -4
  97. package/types/generators/SttAppleBuiltin.ts +21 -8
  98. package/types/generators/Tcp.ts +12 -8
  99. package/types/generators/TcpServer.ts +19 -13
  100. package/types/generators/TextToSpeechAppleBuiltin.ts +20 -7
  101. package/types/generators/TextToSpeechGgml.ts +28 -10
  102. package/types/generators/TextToSpeechOnnx.ts +18 -11
  103. package/types/generators/TextToSpeechOpenAiLike.ts +13 -7
  104. package/types/generators/ThermalPrinter.ts +12 -8
  105. package/types/generators/Tick.ts +10 -6
  106. package/types/generators/Udp.ts +16 -7
  107. package/types/generators/VadGgml.ts +50 -13
  108. package/types/generators/VadOnnx.ts +41 -11
  109. package/types/generators/VadTraditional.ts +27 -12
  110. package/types/generators/VectorStore.ts +32 -11
  111. package/types/generators/Watchdog.ts +18 -9
  112. package/types/generators/WebCrawler.ts +10 -6
  113. package/types/generators/WebRtc.ts +29 -15
  114. package/types/generators/WebSocket.ts +10 -6
  115. package/types/generators/index.ts +2 -0
  116. package/types/subspace.ts +4 -0
  117. package/types/system.ts +1 -1
  118. package/utils/event-props.ts +833 -1022
  119. package/api/index.ts +0 -1
  120. package/api/instance.ts +0 -213
  121. package/types/generators/TextToSpeechApple.ts +0 -113
  122. package/types/generators/TtsAppleBuiltin.ts +0 -105
  123. /package/skills/{bricks-project → bricks-ctor}/rules/automations.md +0 -0
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Payment processing integration for Castles payment terminals
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Sale */
15
19
  export type GeneratorCastlesPayActionSale = ActionWithParams & {
@@ -44,19 +48,23 @@ Default property:
44
48
  property?: {}
45
49
  events?: {
46
50
  /* Action Success */
47
- onActionSuccess?: Array<EventAction>
51
+ onActionSuccess?: Array<
52
+ EventAction<string & keyof TemplateEventPropsMap['CastlesPay']['onActionSuccess']>
53
+ >
48
54
  /* Action Error */
49
- onActionError?: Array<EventAction>
55
+ onActionError?: Array<
56
+ EventAction<string & keyof TemplateEventPropsMap['CastlesPay']['onActionError']>
57
+ >
50
58
  }
51
59
  outlets?: {
52
60
  /* Last Transaction Result */
53
- lastTransactionResult?: () => Data
61
+ lastTransactionResult?: () => Data<{ [key: string]: any }>
54
62
  /* Last Error */
55
- lastError?: () => Data
63
+ lastError?: () => Data<string>
56
64
  }
57
65
  }
58
66
 
59
- /* Castles Pay */
67
+ /* Payment processing integration for Castles payment terminals */
60
68
  export type GeneratorCastlesPay = Generator &
61
69
  GeneratorCastlesPayDef & {
62
70
  templateKey: 'GENERATOR_CASTLES_PAY'
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Access and subscribe to shared Data properties from the project Data Bank
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Run Data Bank fetch */
15
19
  export type GeneratorDataBankActionFetch = Action & {
@@ -71,7 +75,7 @@ Default property:
71
75
  spacekey?: string | DataLink
72
76
  /* Data need to be fetched */
73
77
  properties?: Array<string | DataLink> | DataLink
74
- /* Determine the cache behavior
78
+ /* Determine the cache behavior
75
79
 
76
80
  cache-first: Cache first if existing, then fetch from network
77
81
  network-and-cache: Fetch from network, then save cache
@@ -82,27 +86,58 @@ Default property:
82
86
  }
83
87
  events?: {
84
88
  /* Event of Data Bank fetch response */
85
- onFetchResponse?: Array<EventAction>
89
+ onFetchResponse?: Array<
90
+ EventAction<string & keyof TemplateEventPropsMap['DataBank']['onFetchResponse']>
91
+ >
86
92
  /* Event of Data Bank change from subscription */
87
93
  onChange?: Array<EventAction>
88
94
  /* Event of Data Bank fetch error */
89
95
  onFetchError?: Array<EventAction>
90
96
  /* Event of error */
91
- onError?: Array<EventAction>
97
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['DataBank']['onError']>>
92
98
  /* Event of subscription on connection */
93
99
  subscribeDataOnConnect?: Array<EventAction>
94
100
  /* Server connections error of subscription */
95
- subscribeDataOnConnectError?: Array<EventAction>
101
+ subscribeDataOnConnectError?: Array<
102
+ EventAction<string & keyof TemplateEventPropsMap['DataBank']['subscribeDataOnConnectError']>
103
+ >
96
104
  }
97
105
  outlets?: {
98
106
  /* Response for Data Bank fetch request, it will save to Data */
99
- response?: () => Data
107
+ response?: () => Data<
108
+ Array<{
109
+ __typename?: string
110
+ id?: string
111
+ createAt?: string
112
+ updateAt?: string
113
+ spaceId?: string
114
+ propertyId?: string
115
+ definition?: {
116
+ type?: string
117
+ title?: string
118
+ schema?: { [key: string]: any }
119
+ [key: string]: any
120
+ }
121
+ meta?: string
122
+ value?: any
123
+ lastUpdateHash?: string
124
+ lastUpdateNote?: string
125
+ lastUpdateKey?: {
126
+ name?: string
127
+ enable_expired?: boolean
128
+ expired_at?: any
129
+ jwt?: boolean
130
+ [key: string]: any
131
+ }
132
+ [key: string]: any
133
+ }>
134
+ >
100
135
  /* Server response error of Data Bank fetch request, it will save to Data */
101
- error?: () => Data
136
+ error?: () => Data<string>
102
137
  }
103
138
  }
104
139
 
105
- /* Get Data or subscribe to Data changes from Data Bank */
140
+ /* Access and subscribe to shared Data properties from the project Data Bank */
106
141
  export type GeneratorDataBank = Generator &
107
142
  GeneratorDataBankDef & {
108
143
  templateKey: 'GENERATOR_DATA_BANK'
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * File system operations: read, write, copy, delete, and list files
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Read stats */
15
19
  export type GeneratorFileActionReadStats = Action & {
@@ -259,65 +263,140 @@ Default property:
259
263
  }
260
264
  events?: {
261
265
  /* On file handler init error */
262
- initError?: Array<EventAction>
266
+ initError?: Array<EventAction<string & keyof TemplateEventPropsMap['File']['initError']>>
263
267
  /* On file status change */
264
- onFileStatusChange?: Array<EventAction>
268
+ onFileStatusChange?: Array<
269
+ EventAction<string & keyof TemplateEventPropsMap['File']['onFileStatusChange']>
270
+ >
265
271
  /* On read stats error */
266
- onReadStatsError?: Array<EventAction>
272
+ onReadStatsError?: Array<
273
+ EventAction<string & keyof TemplateEventPropsMap['File']['onReadStatsError']>
274
+ >
267
275
  /* On read content error */
268
- onReadContentError?: Array<EventAction>
276
+ onReadContentError?: Array<
277
+ EventAction<string & keyof TemplateEventPropsMap['File']['onReadContentError']>
278
+ >
269
279
  /* On read content error */
270
- onAppendContentError?: Array<EventAction>
280
+ onAppendContentError?: Array<
281
+ EventAction<string & keyof TemplateEventPropsMap['File']['onAppendContentError']>
282
+ >
271
283
  /* On write content error */
272
- onWriteContentError?: Array<EventAction>
284
+ onWriteContentError?: Array<
285
+ EventAction<string & keyof TemplateEventPropsMap['File']['onWriteContentError']>
286
+ >
273
287
  /* On upload progress */
274
- onUploadProgress?: Array<EventAction>
288
+ onUploadProgress?: Array<
289
+ EventAction<string & keyof TemplateEventPropsMap['File']['onUploadProgress']>
290
+ >
275
291
  /* On upload error */
276
- onUploadError?: Array<EventAction>
292
+ onUploadError?: Array<
293
+ EventAction<string & keyof TemplateEventPropsMap['File']['onUploadError']>
294
+ >
277
295
  /* On upload complete */
278
- onUploadComplete?: Array<EventAction>
296
+ onUploadComplete?: Array<
297
+ EventAction<string & keyof TemplateEventPropsMap['File']['onUploadComplete']>
298
+ >
279
299
  /* On upload all done */
280
- onUploadAllComplete?: Array<EventAction>
300
+ onUploadAllComplete?: Array<
301
+ EventAction<string & keyof TemplateEventPropsMap['File']['onUploadAllComplete']>
302
+ >
281
303
  /* On download progress */
282
- onDownloadProgress?: Array<EventAction>
304
+ onDownloadProgress?: Array<
305
+ EventAction<string & keyof TemplateEventPropsMap['File']['onDownloadProgress']>
306
+ >
283
307
  /* On download error */
284
- onDownloadError?: Array<EventAction>
308
+ onDownloadError?: Array<
309
+ EventAction<string & keyof TemplateEventPropsMap['File']['onDownloadError']>
310
+ >
285
311
  /* On download complete */
286
- onDownloadComplete?: Array<EventAction>
312
+ onDownloadComplete?: Array<
313
+ EventAction<string & keyof TemplateEventPropsMap['File']['onDownloadComplete']>
314
+ >
287
315
  /* On download all done */
288
- onDownloadAllComplete?: Array<EventAction>
316
+ onDownloadAllComplete?: Array<
317
+ EventAction<string & keyof TemplateEventPropsMap['File']['onDownloadAllComplete']>
318
+ >
289
319
  }
290
320
  outlets?: {
291
321
  /* File init error result will be stored in Data */
292
- initError?: () => Data
322
+ initError?: () => Data<string>
293
323
  /* File read stats result will be stored in Data */
294
- readStats?: () => Data
324
+ readStats?: () => Data<{
325
+ path?: string
326
+ size?: number
327
+ isDirectory?: boolean
328
+ mtime?: string
329
+ ctime?: string
330
+ mode?: number
331
+ originalFilepath?: string
332
+ [key: string]: any
333
+ }>
295
334
  /* File read content result will be stored in Data */
296
- readContent?: () => Data
335
+ readContent?: () => Data<any>
297
336
  /* File read details result will be stored in Data */
298
- readDetails?: () => Data
337
+ readDetails?: () => Data<{
338
+ path?: string
339
+ content?: any
340
+ size?: number
341
+ exists?: boolean
342
+ [key: string]: any
343
+ }>
299
344
  /* File read error result will be stored in Data */
300
- readError?: () => Data
345
+ readError?: () => Data<string>
301
346
  /* File append content result will be stored in Data */
302
- appendDetails?: () => Data
347
+ appendDetails?: () => Data<{
348
+ path?: string
349
+ appended?: boolean
350
+ contentLength?: number
351
+ [key: string]: any
352
+ }>
303
353
  /* File append error result will be stored in Data */
304
- appendError?: () => Data
354
+ appendError?: () => Data<string>
305
355
  /* File write details result will be stored in Data */
306
- writeDetails?: () => Data
356
+ writeDetails?: () => Data<{
357
+ path?: string
358
+ written?: boolean
359
+ contentLength?: number
360
+ [key: string]: any
361
+ }>
307
362
  /* File write error result will be stored in Data */
308
- writeError?: () => Data
363
+ writeError?: () => Data<string>
309
364
  /* File upload progress result will be stored in Data */
310
- uploadProgress?: () => Data
365
+ uploadProgress?: () => Data<{
366
+ id?: string
367
+ path?: string
368
+ uri?: string
369
+ hash?: string
370
+ hashType?: string
371
+ headers?: { [key: string]: any }
372
+ fields?: { [key: string]: any }
373
+ method?: string
374
+ progress?: number
375
+ isLastUpdated?: boolean
376
+ [key: string]: any
377
+ }>
311
378
  /* File upload complete result will be stored in Data */
312
- uploadResult?: () => Data
379
+ uploadResult?: () => Data<any>
313
380
  /* File download progress result will be stored in Data */
314
- downloadProgress?: () => Data
381
+ downloadProgress?: () => Data<{
382
+ id?: string
383
+ path?: string
384
+ uri?: string
385
+ hash?: string
386
+ hashType?: string
387
+ headers?: { [key: string]: any }
388
+ fields?: { [key: string]: any }
389
+ method?: string
390
+ progress?: number
391
+ isLastUpdated?: boolean
392
+ [key: string]: any
393
+ }>
315
394
  /* File download complete result will be stored in Data */
316
- downloadResult?: () => Data
395
+ downloadResult?: () => Data<any>
317
396
  }
318
397
  }
319
398
 
320
- /* File handling */
399
+ /* File system operations: read, write, copy, delete, and list files */
321
400
  export type GeneratorFile = Generator &
322
401
  GeneratorFileDef & {
323
402
  templateKey: 'GENERATOR_FILE'
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * GraphQL client for Query, Mutation, and Subscription (WebSocket) with response caching and optional Firebase Realtime Database link
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Execute GraphQL request with defined properties */
15
19
  export type GeneratorGraphQLActionRunQuery = ActionWithParams & {
@@ -93,17 +97,19 @@ Default property:
93
97
  /* Event triggered when subscription connection is successful */
94
98
  subscriptionOnConnection?: Array<EventAction>
95
99
  /* Event triggered when subscription connection error occurs */
96
- subscriptionOnConnectionError?: Array<EventAction>
100
+ subscriptionOnConnectionError?: Array<
101
+ EventAction<string & keyof TemplateEventPropsMap['Graphql']['subscriptionOnConnectionError']>
102
+ >
97
103
  }
98
104
  outlets?: {
99
105
  /* Response for GraphQL request, it will save to Data */
100
- response?: () => Data
106
+ response?: () => Data<{ [key: string]: any }>
101
107
  /* Server response error of GraphQL request, it will save to Data */
102
- error?: () => Data
108
+ error?: () => Data<string>
103
109
  }
104
110
  }
105
111
 
106
- /* Execute GraphQL Query / Mutation / Subscriptions */
112
+ /* GraphQL client for Query, Mutation, and Subscription (WebSocket) with response caching and optional Firebase Realtime Database link */
107
113
  export type GeneratorGraphQL = Generator &
108
114
  GeneratorGraphQLDef & {
109
115
  templateKey: 'GENERATOR_GRAPHQL'
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * HTTP client supporting all methods (GET/POST/PUT/DELETE/PATCH/...), response parsing (JSON/text/XML/CSV), SSE event streams, and multipart file uploads
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Run HTTP request with defined properties */
15
19
  export type GeneratorHTTPActionRunRequest = ActionWithParams & {
@@ -141,7 +145,7 @@ Default property:
141
145
  redirect?: 'manual' | 'follow' | 'error' | DataLink
142
146
  /* Referrer of HTTP request */
143
147
  referrer?: 'no-referrer' | 'client' | DataLink
144
- /* HTTP request body, it will transform depends on `headers.Content-Type` (`application/json`, `application/x-www-form-urlencoded` or `multipart/form-data`)
148
+ /* HTTP request body, it will transform depends on `headers.Content-Type` (`application/json`, `application/x-www-form-urlencoded` or `multipart/form-data`)
145
149
  The multipart schema like `{ file: { uri: File, type: File MIME, name: File Name }, field: "value" }` */
146
150
  body?: {} | DataLink
147
151
  /* HTTP response type */
@@ -156,21 +160,40 @@ Default property:
156
160
  events?: {}
157
161
  outlets?: {
158
162
  /* Response for HTTP request */
159
- response?: () => Data
163
+ response?: () => Data<string | { [key: string]: any }>
160
164
  /* Response details for HTTP request */
161
- responseDetails?: () => Data
165
+ responseDetails?: () => Data<{
166
+ ok?: boolean
167
+ redirected?: boolean
168
+ type?: string
169
+ status?: number
170
+ statusText?: string
171
+ headers?: { [key: string]: any }
172
+ body?: any
173
+ event?: string
174
+ id?: string
175
+ data?: any
176
+ [key: string]: any
177
+ }>
162
178
  /* All received data from event stream */
163
- eventLog?: () => Data
179
+ eventLog?: () => Data<Array<any>>
164
180
  /* All received event details from event stream */
165
- eventLogDetails?: () => Data
181
+ eventLogDetails?: () => Data<
182
+ Array<{
183
+ event?: string
184
+ id?: string
185
+ data?: any
186
+ [key: string]: any
187
+ }>
188
+ >
166
189
  /* EventSource state */
167
- sseState?: () => Data
190
+ sseState?: () => Data<string>
168
191
  /* Server response error of HTTP request */
169
- error?: () => Data
192
+ error?: () => Data<string>
170
193
  }
171
194
  }
172
195
 
173
- /* Execute HTTP requests */
196
+ /* HTTP client supporting all methods (GET/POST/PUT/DELETE/PATCH/...), response parsing (JSON/text/XML/CSV), SSE event streams, and multipart file uploads */
174
197
  export type GeneratorHTTP = Generator &
175
198
  GeneratorHTTPDef & {
176
199
  templateKey: 'GENERATOR_HTTP'
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Embedded HTTP/HTTPS server with route matching, CORS, auth (Basic/Bearer), SSE streaming, file upload, and async response mode
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Start HTTP server */
15
19
  export type GeneratorHTTPServerActionStart = Action & {
@@ -70,7 +74,7 @@ Default property:
70
74
  idleTimeout?: number | DataLink
71
75
  /* HTTP request body limit, 0 is unlimited */
72
76
  bodyLimit?: number | DataLink
73
- /* CORS allowed origins
77
+ /* CORS allowed origins
74
78
  You can use wildcard like `*`, `*.example.com`, `http://*.example.com` */
75
79
  corsOrigins?: Array<string | DataLink> | DataLink
76
80
  /* Authorization type of HTTP request */
@@ -81,15 +85,15 @@ Default property:
81
85
  basicAuthPassword?: string | DataLink
82
86
  /* Token of bearer auth */
83
87
  bearerToken?: string | DataLink
84
- /* Asynchronous response mode
88
+ /* Asynchronous response mode
85
89
  Will block connection until Response Body update. */
86
90
  asyncMode?: boolean | DataLink
87
- /* Save request body as file
91
+ /* Save request body as file
88
92
  Only work on `application/octet-stream` or `multipart/form-data`. */
89
93
  saveBodyAsFile?: boolean | DataLink
90
94
  /* Response status code */
91
95
  resStatusCode?: number | DataLink
92
- /* Response Content-Type
96
+ /* Response Content-Type
93
97
  `text/*` will not convert body.
94
98
  `application/xml` convert object to XML, [example object struct](https://github.com/davidcalhoun/jstoxml#example-10-podcast-rss-feed)
95
99
  `application/octet-stream` body should be Base64 string or file path. */
@@ -123,29 +127,33 @@ Default property:
123
127
  /* Event of HTTP server is ready */
124
128
  onReady?: Array<EventAction>
125
129
  /* Event of HTTP server accept the request */
126
- onRequest?: Array<EventAction>
130
+ onRequest?: Array<EventAction<string & keyof TemplateEventPropsMap['HttpServer']['onRequest']>>
127
131
  /* Event of client close connection */
128
- onClientClose?: Array<EventAction>
132
+ onClientClose?: Array<
133
+ EventAction<string & keyof TemplateEventPropsMap['HttpServer']['onClientClose']>
134
+ >
129
135
  /* Event of client error */
130
- onClientError?: Array<EventAction>
136
+ onClientError?: Array<
137
+ EventAction<string & keyof TemplateEventPropsMap['HttpServer']['onClientError']>
138
+ >
131
139
  /* Event of server close */
132
140
  onClose?: Array<EventAction>
133
141
  /* Event of server error */
134
- onError?: Array<EventAction>
142
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['HttpServer']['onError']>>
135
143
  }
136
144
  outlets?: {
137
145
  /* Server is listening */
138
- isListening?: () => Data
146
+ isListening?: () => Data<boolean>
139
147
  /* Query of request */
140
- requestQuery?: () => Data
148
+ requestQuery?: () => Data<{ [key: string]: any }>
141
149
  /* Body of request */
142
- requestBody?: () => Data
150
+ requestBody?: () => Data<any>
143
151
  /* Remote address of request */
144
- clientAddress?: () => Data
152
+ clientAddress?: () => Data<string>
145
153
  }
146
154
  }
147
155
 
148
- /* HTTP Server */
156
+ /* Embedded HTTP/HTTPS server with route matching, CORS, auth (Basic/Bearer), SSE streaming, file upload, and async response mode */
149
157
  export type GeneratorHTTPServer = Generator &
150
158
  GeneratorHTTPServerDef & {
151
159
  templateKey: 'GENERATOR_HTTP_SERVER'
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Display informational dialog or toast messages to the user
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Show information */
15
19
  export type GeneratorInformationActionShow = ActionWithParams & {
@@ -68,15 +72,15 @@ Default property:
68
72
  /* Trigger when user confirms the information */
69
73
  onConfirm?: Array<EventAction>
70
74
  /* Trigger when error occurs */
71
- onError?: Array<EventAction>
75
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Information']['onError']>>
72
76
  }
73
77
  outlets?: {
74
78
  /* Error message */
75
- errorMessage?: () => Data
79
+ errorMessage?: () => Data<string>
76
80
  }
77
81
  }
78
82
 
79
- /* Show information */
83
+ /* Display informational dialog or toast messages to the user */
80
84
  export type GeneratorInformation = Generator &
81
85
  GeneratorInformationDef & {
82
86
  templateKey: 'GENERATOR_INFORMATION'
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Send intent to app and get result (Android only)
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Read stats */
15
19
  export type GeneratorIntentActionSendIntent = ActionWithParams & {
@@ -125,13 +129,19 @@ Default property:
125
129
  }
126
130
  events?: {
127
131
  /* On intent return a result trigger */
128
- onResult?: Array<EventAction>
132
+ onResult?: Array<EventAction<string & keyof TemplateEventPropsMap['Intent']['onResult']>>
129
133
  /* On intent error trigger */
130
- onError?: Array<EventAction>
134
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Intent']['onError']>>
131
135
  }
132
136
  outlets?: {
133
137
  /* Last intent result */
134
- result?: () => Data
138
+ result?: () => Data<{
139
+ action?: string
140
+ data?: string
141
+ type?: string
142
+ extras?: { [key: string]: any }
143
+ [key: string]: any
144
+ }>
135
145
  }
136
146
  }
137
147
 
@@ -1,4 +1,7 @@
1
- /* Auto generated by build script */
1
+ /* Auto generated by build script
2
+ *
3
+ * Iterate through values (Array, Object, Number, String)
4
+ */
2
5
  import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
3
6
  import type { Data, DataLink } from '../data'
4
7
  import type {
@@ -10,6 +13,7 @@ import type {
10
13
  Action,
11
14
  EventProperty,
12
15
  } from '../common'
16
+ import type { TemplateEventPropsMap } from '../../utils/event-props'
13
17
 
14
18
  /* Proceed to next iteration */
15
19
  export type GeneratorIteratorActionNext = Action & {
@@ -59,25 +63,25 @@ Default property:
59
63
  }
60
64
  events?: {
61
65
  /* Event triggered on each iteration */
62
- iterate?: Array<EventAction>
66
+ iterate?: Array<EventAction<string & keyof TemplateEventPropsMap['Iterator']['iterate']>>
63
67
  /* Event triggered on the first iteration of a round */
64
- first?: Array<EventAction>
68
+ first?: Array<EventAction<string & keyof TemplateEventPropsMap['Iterator']['first']>>
65
69
  /* Event triggered on the last iteration of a round */
66
- end?: Array<EventAction>
70
+ end?: Array<EventAction<string & keyof TemplateEventPropsMap['Iterator']['end']>>
67
71
  /* Event triggered when data type is invalid or unexpected */
68
- error?: Array<EventAction>
72
+ error?: Array<EventAction<string & keyof TemplateEventPropsMap['Iterator']['error']>>
69
73
  }
70
74
  outlets?: {
71
75
  /* Elements that have been iterated (including current one) */
72
- iteratedArray?: () => Data
76
+ iteratedArray?: () => Data<Array<any>>
73
77
  /* Elements that will be iterated but have not been iterated yet */
74
- upcomingArray?: () => Data
78
+ upcomingArray?: () => Data<Array<any>>
75
79
  /* Current iteration element */
76
- value?: () => Data
80
+ value?: () => Data<any>
77
81
  /* Key of the current iteration element (for number: same as value, for array/string: index, for object: string key) */
78
- key?: () => Data
82
+ key?: () => Data<any>
79
83
  /* Current iteration count (if data is 6 and step is 2, this will return: 1,2,3 in sequence) */
80
- index?: () => Data
84
+ index?: () => Data<number>
81
85
  }
82
86
  }
83
87