@fugood/bricks-project 2.24.0-beta.2 → 2.24.0-beta.21

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 (110) hide show
  1. package/compile/action-name-map.ts +14 -0
  2. package/compile/index.ts +377 -129
  3. package/package.json +8 -3
  4. package/skills/bricks-project/rules/architecture-patterns.md +7 -0
  5. package/skills/bricks-project/rules/automations.md +74 -28
  6. package/skills/bricks-project/rules/buttress.md +9 -6
  7. package/tools/deploy.ts +39 -10
  8. package/tools/mcp-server.ts +10 -877
  9. package/tools/mcp-tools/compile.ts +91 -0
  10. package/tools/mcp-tools/huggingface.ts +762 -0
  11. package/tools/mcp-tools/icons.ts +60 -0
  12. package/tools/mcp-tools/lottie.ts +102 -0
  13. package/tools/mcp-tools/media.ts +110 -0
  14. package/tools/postinstall.ts +121 -33
  15. package/tools/preview-main.mjs +12 -8
  16. package/tools/pull.ts +37 -19
  17. package/tsconfig.json +16 -0
  18. package/types/animation.ts +4 -0
  19. package/types/automation.ts +3 -0
  20. package/types/brick-base.ts +1 -1
  21. package/types/bricks/Camera.ts +34 -7
  22. package/types/bricks/Chart.ts +1 -1
  23. package/types/bricks/GenerativeMedia.ts +6 -6
  24. package/types/bricks/Icon.ts +3 -3
  25. package/types/bricks/Image.ts +4 -4
  26. package/types/bricks/Items.ts +7 -7
  27. package/types/bricks/Lottie.ts +4 -4
  28. package/types/bricks/Maps.ts +4 -4
  29. package/types/bricks/QrCode.ts +4 -4
  30. package/types/bricks/Rect.ts +4 -4
  31. package/types/bricks/RichText.ts +3 -3
  32. package/types/bricks/Rive.ts +1 -1
  33. package/types/bricks/Slideshow.ts +4 -4
  34. package/types/bricks/Svg.ts +3 -3
  35. package/types/bricks/Text.ts +4 -4
  36. package/types/bricks/TextInput.ts +11 -7
  37. package/types/bricks/Video.ts +4 -4
  38. package/types/bricks/VideoStreaming.ts +3 -3
  39. package/types/bricks/WebRtcStream.ts +1 -1
  40. package/types/bricks/WebView.ts +4 -4
  41. package/types/canvas.ts +4 -2
  42. package/types/common.ts +9 -4
  43. package/types/data-calc-command.ts +2 -0
  44. package/types/data-calc.ts +1 -0
  45. package/types/data.ts +2 -0
  46. package/types/generators/AlarmClock.ts +5 -5
  47. package/types/generators/Assistant.ts +57 -12
  48. package/types/generators/BleCentral.ts +12 -4
  49. package/types/generators/BlePeripheral.ts +5 -5
  50. package/types/generators/CanvasMap.ts +4 -4
  51. package/types/generators/CastlesPay.ts +3 -3
  52. package/types/generators/DataBank.ts +31 -4
  53. package/types/generators/File.ts +63 -14
  54. package/types/generators/GraphQl.ts +3 -3
  55. package/types/generators/Http.ts +27 -8
  56. package/types/generators/HttpServer.ts +9 -9
  57. package/types/generators/Information.ts +2 -2
  58. package/types/generators/Intent.ts +8 -2
  59. package/types/generators/Iterator.ts +6 -6
  60. package/types/generators/Keyboard.ts +18 -8
  61. package/types/generators/LlmAnthropicCompat.ts +12 -6
  62. package/types/generators/LlmAppleBuiltin.ts +6 -6
  63. package/types/generators/LlmGgml.ts +75 -25
  64. package/types/generators/LlmMlx.ts +210 -0
  65. package/types/generators/LlmOnnx.ts +18 -9
  66. package/types/generators/LlmOpenAiCompat.ts +22 -6
  67. package/types/generators/LlmQualcommAiEngine.ts +32 -8
  68. package/types/generators/Mcp.ts +332 -17
  69. package/types/generators/McpServer.ts +38 -11
  70. package/types/generators/MediaFlow.ts +26 -8
  71. package/types/generators/MqttBroker.ts +10 -4
  72. package/types/generators/MqttClient.ts +11 -5
  73. package/types/generators/Question.ts +6 -6
  74. package/types/generators/RealtimeTranscription.ts +70 -11
  75. package/types/generators/RerankerGgml.ts +23 -9
  76. package/types/generators/SerialPort.ts +6 -6
  77. package/types/generators/SoundPlayer.ts +2 -2
  78. package/types/generators/SoundRecorder.ts +5 -5
  79. package/types/generators/SpeechToTextGgml.ts +34 -14
  80. package/types/generators/SpeechToTextOnnx.ts +8 -8
  81. package/types/generators/SpeechToTextPlatform.ts +4 -4
  82. package/types/generators/SqLite.ts +10 -6
  83. package/types/generators/Step.ts +3 -3
  84. package/types/generators/SttAppleBuiltin.ts +6 -6
  85. package/types/generators/Tcp.ts +5 -5
  86. package/types/generators/TcpServer.ts +7 -7
  87. package/types/generators/TextToSpeechApple.ts +1 -1
  88. package/types/generators/TextToSpeechAppleBuiltin.ts +5 -5
  89. package/types/generators/TextToSpeechGgml.ts +8 -8
  90. package/types/generators/TextToSpeechOnnx.ts +9 -9
  91. package/types/generators/TextToSpeechOpenAiLike.ts +5 -5
  92. package/types/generators/ThermalPrinter.ts +6 -6
  93. package/types/generators/Tick.ts +3 -3
  94. package/types/generators/Udp.ts +9 -4
  95. package/types/generators/VadGgml.ts +39 -10
  96. package/types/generators/VadOnnx.ts +31 -8
  97. package/types/generators/VadTraditional.ts +15 -9
  98. package/types/generators/VectorStore.ts +26 -9
  99. package/types/generators/Watchdog.ts +11 -6
  100. package/types/generators/WebCrawler.ts +5 -5
  101. package/types/generators/WebRtc.ts +17 -11
  102. package/types/generators/WebSocket.ts +5 -5
  103. package/types/generators/index.ts +1 -0
  104. package/types/subspace.ts +1 -0
  105. package/types/system.ts +1 -1
  106. package/utils/calc.ts +12 -8
  107. package/utils/event-props.ts +104 -87
  108. package/utils/id.ts +4 -0
  109. package/api/index.ts +0 -1
  110. package/api/instance.ts +0 -213
@@ -71,13 +71,13 @@ Default property:
71
71
  }
72
72
  outlets?: {
73
73
  /* Current time of each alarm clock trig */
74
- trigTime?: () => Data
74
+ trigTime?: () => Data<string>
75
75
  /* Current timestamp (unix time) of each alarm clock trig */
76
- trigTimestamp?: () => Data
76
+ trigTimestamp?: () => Data<string | number>
77
77
  /* Count of alarm clock trigs */
78
- trigCount?: () => Data
78
+ trigCount?: () => Data<string | number>
79
79
  /* Is alarm clock running? */
80
- running?: () => Data
80
+ running?: () => Data<boolean | string | number>
81
81
  }
82
82
  }
83
83
 
@@ -85,7 +85,7 @@ Default property:
85
85
  export type GeneratorAlarmClock = Generator &
86
86
  GeneratorAlarmClockDef & {
87
87
  templateKey: 'GENERATOR_ALARM_CLOCK'
88
- switches: Array<
88
+ switches?: Array<
89
89
  SwitchDef &
90
90
  GeneratorAlarmClockDef & {
91
91
  conds?: Array<{
@@ -364,7 +364,7 @@ export type GeneratorAssistantActionInsertMcpResource = ActionWithParams & {
364
364
  >
365
365
  }
366
366
 
367
- /* Summarize messages based on the conversation
367
+ /* Summarize messages based on the conversation
368
368
 
369
369
  Note: Summary uses the same LLM context size, so it is recommended only to use it when the system prompt (in Initial Messages) is long, otherwise it may still fail when the context is full (Ctx Shift is NO). */
370
370
  export type GeneratorAssistantActionSummaryMessages = ActionWithParams & {
@@ -434,15 +434,15 @@ Default property:
434
434
  | DataLink
435
435
  /* Whether to cache messages */
436
436
  cacheMessages?: boolean | DataLink
437
- /* LLM Generator (Supports `LLM (GGML)` and `OpenAI LLM` generators) */
437
+ /* LLM Generator (Supports `LLM (GGML)`, `LLM (MLX)`, and `OpenAI LLM` generators) */
438
438
  llmGeneratorId?: string | DataLink | (() => Generator)
439
- /* LLM Live Policy. If the policy is `only-in-use`, the LLM context will be released when the assistant is not in use.
439
+ /* LLM Live Policy. If the policy is `only-in-use`, the LLM context will be released when the assistant is not in use.
440
440
 
441
441
  Note: LLM (Qualcomm AI Engine) recommend use `manual` and loaded constantly. */
442
442
  llmLivePolicy?: 'only-in-use' | 'manual' | DataLink
443
443
  /* LLM main session key */
444
444
  llmSessionKey?: string | DataLink
445
- /* Auto Summary Messages (Automatically summarize messages when the LLM context is full or content gets truncated, currently only supported with LLM (GGML) generators)
445
+ /* Auto Summary Messages (Automatically summarize messages when the LLM context is full or content gets truncated, currently only supported with LLM (GGML) generators)
446
446
 
447
447
  Note: Summary uses the same LLM context size, so it is recommended only to use it when the system prompt (in Initial Messages) is long, otherwise it may still fail when the context is full (Ctx Shift is NO). */
448
448
  llmAutoSummaryMessages?: boolean | DataLink
@@ -524,19 +524,64 @@ Default property:
524
524
  }
525
525
  outlets?: {
526
526
  /* Whether the assistant is heating up */
527
- isHeatingUp?: () => Data
527
+ isHeatingUp?: () => Data<boolean>
528
528
  /* Whether the assistant is file processing */
529
- isFileProcessing?: () => Data
529
+ isFileProcessing?: () => Data<boolean>
530
530
  /* Whether the assistant is responding */
531
- isResponding?: () => Data
531
+ isResponding?: () => Data<boolean>
532
532
  /* Whether the assistant is busy */
533
- isBusy?: () => Data
533
+ isBusy?: () => Data<boolean>
534
534
  /* Embedding files of the assistant */
535
- files?: () => Data
535
+ files?: () => Data<Array<any>>
536
536
  /* Messages of the assistant */
537
- messages?: () => Data
537
+ messages?: () => Data<
538
+ Array<{
539
+ role?: string
540
+ name?: string
541
+ content?: any
542
+ tool_call_id?: string
543
+ tool_calls?: Array<{
544
+ id?: string
545
+ type?: string
546
+ function?: {
547
+ name?: string
548
+ arguments?: string
549
+ [key: string]: any
550
+ }
551
+ [key: string]: any
552
+ }>
553
+ reasoning_content?: string
554
+ audio?: {
555
+ generating?: boolean
556
+ [key: string]: any
557
+ }
558
+ last_generated_at?: number
559
+ responding?: boolean
560
+ is_summary?: boolean
561
+ summary_created_at?: number
562
+ [key: string]: any
563
+ }>
564
+ >
538
565
  /* MCP servers status and available tools */
539
- mcpServers?: () => Data
566
+ mcpServers?: () => Data<
567
+ Array<{
568
+ generatorId?: string
569
+ generatorKey?: string
570
+ name?: string
571
+ version?: string
572
+ connected?: boolean
573
+ error?: string
574
+ resources?: Array<{
575
+ name?: string
576
+ [key: string]: any
577
+ }>
578
+ tools?: Array<{
579
+ name?: string
580
+ [key: string]: any
581
+ }>
582
+ [key: string]: any
583
+ }>
584
+ >
540
585
  }
541
586
  }
542
587
 
@@ -544,7 +589,7 @@ Default property:
544
589
  export type GeneratorAssistant = Generator &
545
590
  GeneratorAssistantDef & {
546
591
  templateKey: 'GENERATOR_ASSISTANT'
547
- switches: Array<
592
+ switches?: Array<
548
593
  SwitchDef &
549
594
  GeneratorAssistantDef & {
550
595
  conds?: Array<{
@@ -196,11 +196,19 @@ Default property:
196
196
  }
197
197
  outlets?: {
198
198
  /* Is scaning */
199
- isScaning?: () => Data
199
+ isScaning?: () => Data<boolean>
200
200
  /* Discovered device list */
201
- discoveredDeviceList?: () => Data
201
+ discoveredDeviceList?: () => Data<
202
+ Array<{
203
+ id?: string
204
+ name?: string
205
+ rssi?: number
206
+ advertising?: { [key: string]: any }
207
+ [key: string]: any
208
+ }>
209
+ >
202
210
  /* Error message */
203
- errorMessage?: () => Data
211
+ errorMessage?: () => Data<string>
204
212
  }
205
213
  }
206
214
 
@@ -208,7 +216,7 @@ Default property:
208
216
  export type GeneratorBleCentral = Generator &
209
217
  GeneratorBleCentralDef & {
210
218
  templateKey: 'GENERATOR_BLE_CENTRAL'
211
- switches: Array<
219
+ switches?: Array<
212
220
  SwitchDef &
213
221
  GeneratorBleCentralDef & {
214
222
  conds?: Array<{
@@ -149,7 +149,7 @@ Default property:
149
149
  beaconsEnable?: boolean | DataLink
150
150
  /* Measured RSSI @ 1m, used for calculate distance */
151
151
  beaconsTxPower?: number | DataLink
152
- /* Beacon configs
152
+ /* Beacon configs
153
153
  presets has pre-defined layout and manufacturerId
154
154
  layout string is like AltBeacon's Beacon Layout, but replace "x" as extra data
155
155
  id and data could be 0x prefixed hex, hex string, decimal or UUID
@@ -173,11 +173,11 @@ Default property:
173
173
  events?: {}
174
174
  outlets?: {
175
175
  /* Is advertising */
176
- isAdvertising?: () => Data
176
+ isAdvertising?: () => Data<boolean>
177
177
  /* Last receive written */
178
- lastWrite?: () => Data
178
+ lastWrite?: () => Data<{ [key: string]: any }>
179
179
  /* Error message */
180
- errorMessage?: () => Data
180
+ errorMessage?: () => Data<string>
181
181
  }
182
182
  }
183
183
 
@@ -185,7 +185,7 @@ Default property:
185
185
  export type GeneratorBlePeripheral = Generator &
186
186
  GeneratorBlePeripheralDef & {
187
187
  templateKey: 'GENERATOR_BLE_PERIPHERAL'
188
- switches: Array<
188
+ switches?: Array<
189
189
  SwitchDef &
190
190
  GeneratorBlePeripheralDef & {
191
191
  conds?: Array<{
@@ -39,11 +39,11 @@ Default property:
39
39
  }
40
40
  outlets?: {
41
41
  /* Last matched trigger rule that caused canvas navigation */
42
- lastMatchedRule?: () => Data
42
+ lastMatchedRule?: () => Data<{ [key: string]: any }>
43
43
  /* Index of the last matched rule in triggerList */
44
- lastMatchedIndex?: () => Data
44
+ lastMatchedIndex?: () => Data<number>
45
45
  /* Total count of canvas navigations triggered by this generator */
46
- navigationCount?: () => Data
46
+ navigationCount?: () => Data<number>
47
47
  }
48
48
  }
49
49
 
@@ -51,7 +51,7 @@ Default property:
51
51
  export type GeneratorCanvasMap = Generator &
52
52
  GeneratorCanvasMapDef & {
53
53
  templateKey: 'GENERATOR_CANVAS_MAP'
54
- switches: Array<
54
+ switches?: Array<
55
55
  SwitchDef &
56
56
  GeneratorCanvasMapDef & {
57
57
  conds?: Array<{
@@ -50,9 +50,9 @@ Default property:
50
50
  }
51
51
  outlets?: {
52
52
  /* Last Transaction Result */
53
- lastTransactionResult?: () => Data
53
+ lastTransactionResult?: () => Data<{ [key: string]: any }>
54
54
  /* Last Error */
55
- lastError?: () => Data
55
+ lastError?: () => Data<string>
56
56
  }
57
57
  }
58
58
 
@@ -60,7 +60,7 @@ Default property:
60
60
  export type GeneratorCastlesPay = Generator &
61
61
  GeneratorCastlesPayDef & {
62
62
  templateKey: 'GENERATOR_CASTLES_PAY'
63
- switches: Array<
63
+ switches?: Array<
64
64
  SwitchDef &
65
65
  GeneratorCastlesPayDef & {
66
66
  conds?: Array<{
@@ -71,7 +71,7 @@ Default property:
71
71
  spacekey?: string | DataLink
72
72
  /* Data need to be fetched */
73
73
  properties?: Array<string | DataLink> | DataLink
74
- /* Determine the cache behavior
74
+ /* Determine the cache behavior
75
75
 
76
76
  cache-first: Cache first if existing, then fetch from network
77
77
  network-and-cache: Fetch from network, then save cache
@@ -96,9 +96,36 @@ Default property:
96
96
  }
97
97
  outlets?: {
98
98
  /* Response for Data Bank fetch request, it will save to Data */
99
- response?: () => Data
99
+ response?: () => Data<
100
+ Array<{
101
+ __typename?: string
102
+ id?: string
103
+ createAt?: string
104
+ updateAt?: string
105
+ spaceId?: string
106
+ propertyId?: string
107
+ definition?: {
108
+ type?: string
109
+ title?: string
110
+ schema?: { [key: string]: any }
111
+ [key: string]: any
112
+ }
113
+ meta?: string
114
+ value?: any
115
+ lastUpdateHash?: string
116
+ lastUpdateNote?: string
117
+ lastUpdateKey?: {
118
+ name?: string
119
+ enable_expired?: boolean
120
+ expired_at?: any
121
+ jwt?: boolean
122
+ [key: string]: any
123
+ }
124
+ [key: string]: any
125
+ }>
126
+ >
100
127
  /* Server response error of Data Bank fetch request, it will save to Data */
101
- error?: () => Data
128
+ error?: () => Data<string>
102
129
  }
103
130
  }
104
131
 
@@ -106,7 +133,7 @@ Default property:
106
133
  export type GeneratorDataBank = Generator &
107
134
  GeneratorDataBankDef & {
108
135
  templateKey: 'GENERATOR_DATA_BANK'
109
- switches: Array<
136
+ switches?: Array<
110
137
  SwitchDef &
111
138
  GeneratorDataBankDef & {
112
139
  conds?: Array<{
@@ -289,31 +289,80 @@ Default property:
289
289
  }
290
290
  outlets?: {
291
291
  /* File init error result will be stored in Data */
292
- initError?: () => Data
292
+ initError?: () => Data<string>
293
293
  /* File read stats result will be stored in Data */
294
- readStats?: () => Data
294
+ readStats?: () => Data<{
295
+ path?: string
296
+ size?: number
297
+ isDirectory?: boolean
298
+ mtime?: string
299
+ ctime?: string
300
+ mode?: number
301
+ originalFilepath?: string
302
+ [key: string]: any
303
+ }>
295
304
  /* File read content result will be stored in Data */
296
- readContent?: () => Data
305
+ readContent?: () => Data<any>
297
306
  /* File read details result will be stored in Data */
298
- readDetails?: () => Data
307
+ readDetails?: () => Data<{
308
+ path?: string
309
+ content?: any
310
+ size?: number
311
+ exists?: boolean
312
+ [key: string]: any
313
+ }>
299
314
  /* File read error result will be stored in Data */
300
- readError?: () => Data
315
+ readError?: () => Data<string>
301
316
  /* File append content result will be stored in Data */
302
- appendDetails?: () => Data
317
+ appendDetails?: () => Data<{
318
+ path?: string
319
+ appended?: boolean
320
+ contentLength?: number
321
+ [key: string]: any
322
+ }>
303
323
  /* File append error result will be stored in Data */
304
- appendError?: () => Data
324
+ appendError?: () => Data<string>
305
325
  /* File write details result will be stored in Data */
306
- writeDetails?: () => Data
326
+ writeDetails?: () => Data<{
327
+ path?: string
328
+ written?: boolean
329
+ contentLength?: number
330
+ [key: string]: any
331
+ }>
307
332
  /* File write error result will be stored in Data */
308
- writeError?: () => Data
333
+ writeError?: () => Data<string>
309
334
  /* File upload progress result will be stored in Data */
310
- uploadProgress?: () => Data
335
+ uploadProgress?: () => Data<{
336
+ id?: string
337
+ path?: string
338
+ uri?: string
339
+ hash?: string
340
+ hashType?: string
341
+ headers?: { [key: string]: any }
342
+ fields?: { [key: string]: any }
343
+ method?: string
344
+ progress?: number
345
+ isLastUpdated?: boolean
346
+ [key: string]: any
347
+ }>
311
348
  /* File upload complete result will be stored in Data */
312
- uploadResult?: () => Data
349
+ uploadResult?: () => Data<any>
313
350
  /* File download progress result will be stored in Data */
314
- downloadProgress?: () => Data
351
+ downloadProgress?: () => Data<{
352
+ id?: string
353
+ path?: string
354
+ uri?: string
355
+ hash?: string
356
+ hashType?: string
357
+ headers?: { [key: string]: any }
358
+ fields?: { [key: string]: any }
359
+ method?: string
360
+ progress?: number
361
+ isLastUpdated?: boolean
362
+ [key: string]: any
363
+ }>
315
364
  /* File download complete result will be stored in Data */
316
- downloadResult?: () => Data
365
+ downloadResult?: () => Data<any>
317
366
  }
318
367
  }
319
368
 
@@ -321,7 +370,7 @@ Default property:
321
370
  export type GeneratorFile = Generator &
322
371
  GeneratorFileDef & {
323
372
  templateKey: 'GENERATOR_FILE'
324
- switches: Array<
373
+ switches?: Array<
325
374
  SwitchDef &
326
375
  GeneratorFileDef & {
327
376
  conds?: Array<{
@@ -97,9 +97,9 @@ Default property:
97
97
  }
98
98
  outlets?: {
99
99
  /* Response for GraphQL request, it will save to Data */
100
- response?: () => Data
100
+ response?: () => Data<{ [key: string]: any }>
101
101
  /* Server response error of GraphQL request, it will save to Data */
102
- error?: () => Data
102
+ error?: () => Data<string>
103
103
  }
104
104
  }
105
105
 
@@ -107,7 +107,7 @@ Default property:
107
107
  export type GeneratorGraphQL = Generator &
108
108
  GeneratorGraphQLDef & {
109
109
  templateKey: 'GENERATOR_GRAPHQL'
110
- switches: Array<
110
+ switches?: Array<
111
111
  SwitchDef &
112
112
  GeneratorGraphQLDef & {
113
113
  conds?: Array<{
@@ -141,7 +141,7 @@ Default property:
141
141
  redirect?: 'manual' | 'follow' | 'error' | DataLink
142
142
  /* Referrer of HTTP request */
143
143
  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`)
144
+ /* HTTP request body, it will transform depends on `headers.Content-Type` (`application/json`, `application/x-www-form-urlencoded` or `multipart/form-data`)
145
145
  The multipart schema like `{ file: { uri: File, type: File MIME, name: File Name }, field: "value" }` */
146
146
  body?: {} | DataLink
147
147
  /* HTTP response type */
@@ -156,17 +156,36 @@ Default property:
156
156
  events?: {}
157
157
  outlets?: {
158
158
  /* Response for HTTP request */
159
- response?: () => Data
159
+ response?: () => Data<string | { [key: string]: any }>
160
160
  /* Response details for HTTP request */
161
- responseDetails?: () => Data
161
+ responseDetails?: () => Data<{
162
+ ok?: boolean
163
+ redirected?: boolean
164
+ type?: string
165
+ status?: number
166
+ statusText?: string
167
+ headers?: { [key: string]: any }
168
+ body?: any
169
+ event?: string
170
+ id?: string
171
+ data?: any
172
+ [key: string]: any
173
+ }>
162
174
  /* All received data from event stream */
163
- eventLog?: () => Data
175
+ eventLog?: () => Data<Array<any>>
164
176
  /* All received event details from event stream */
165
- eventLogDetails?: () => Data
177
+ eventLogDetails?: () => Data<
178
+ Array<{
179
+ event?: string
180
+ id?: string
181
+ data?: any
182
+ [key: string]: any
183
+ }>
184
+ >
166
185
  /* EventSource state */
167
- sseState?: () => Data
186
+ sseState?: () => Data<string>
168
187
  /* Server response error of HTTP request */
169
- error?: () => Data
188
+ error?: () => Data<string>
170
189
  }
171
190
  }
172
191
 
@@ -174,7 +193,7 @@ Default property:
174
193
  export type GeneratorHTTP = Generator &
175
194
  GeneratorHTTPDef & {
176
195
  templateKey: 'GENERATOR_HTTP'
177
- switches: Array<
196
+ switches?: Array<
178
197
  SwitchDef &
179
198
  GeneratorHTTPDef & {
180
199
  conds?: Array<{
@@ -70,7 +70,7 @@ Default property:
70
70
  idleTimeout?: number | DataLink
71
71
  /* HTTP request body limit, 0 is unlimited */
72
72
  bodyLimit?: number | DataLink
73
- /* CORS allowed origins
73
+ /* CORS allowed origins
74
74
  You can use wildcard like `*`, `*.example.com`, `http://*.example.com` */
75
75
  corsOrigins?: Array<string | DataLink> | DataLink
76
76
  /* Authorization type of HTTP request */
@@ -81,15 +81,15 @@ Default property:
81
81
  basicAuthPassword?: string | DataLink
82
82
  /* Token of bearer auth */
83
83
  bearerToken?: string | DataLink
84
- /* Asynchronous response mode
84
+ /* Asynchronous response mode
85
85
  Will block connection until Response Body update. */
86
86
  asyncMode?: boolean | DataLink
87
- /* Save request body as file
87
+ /* Save request body as file
88
88
  Only work on `application/octet-stream` or `multipart/form-data`. */
89
89
  saveBodyAsFile?: boolean | DataLink
90
90
  /* Response status code */
91
91
  resStatusCode?: number | DataLink
92
- /* Response Content-Type
92
+ /* Response Content-Type
93
93
  `text/*` will not convert body.
94
94
  `application/xml` convert object to XML, [example object struct](https://github.com/davidcalhoun/jstoxml#example-10-podcast-rss-feed)
95
95
  `application/octet-stream` body should be Base64 string or file path. */
@@ -135,13 +135,13 @@ Default property:
135
135
  }
136
136
  outlets?: {
137
137
  /* Server is listening */
138
- isListening?: () => Data
138
+ isListening?: () => Data<boolean>
139
139
  /* Query of request */
140
- requestQuery?: () => Data
140
+ requestQuery?: () => Data<{ [key: string]: any }>
141
141
  /* Body of request */
142
- requestBody?: () => Data
142
+ requestBody?: () => Data<any>
143
143
  /* Remote address of request */
144
- clientAddress?: () => Data
144
+ clientAddress?: () => Data<string>
145
145
  }
146
146
  }
147
147
 
@@ -149,7 +149,7 @@ Default property:
149
149
  export type GeneratorHTTPServer = Generator &
150
150
  GeneratorHTTPServerDef & {
151
151
  templateKey: 'GENERATOR_HTTP_SERVER'
152
- switches: Array<
152
+ switches?: Array<
153
153
  SwitchDef &
154
154
  GeneratorHTTPServerDef & {
155
155
  conds?: Array<{
@@ -72,7 +72,7 @@ Default property:
72
72
  }
73
73
  outlets?: {
74
74
  /* Error message */
75
- errorMessage?: () => Data
75
+ errorMessage?: () => Data<string>
76
76
  }
77
77
  }
78
78
 
@@ -80,7 +80,7 @@ Default property:
80
80
  export type GeneratorInformation = Generator &
81
81
  GeneratorInformationDef & {
82
82
  templateKey: 'GENERATOR_INFORMATION'
83
- switches: Array<
83
+ switches?: Array<
84
84
  SwitchDef &
85
85
  GeneratorInformationDef & {
86
86
  conds?: Array<{
@@ -131,7 +131,13 @@ Default property:
131
131
  }
132
132
  outlets?: {
133
133
  /* Last intent result */
134
- result?: () => Data
134
+ result?: () => Data<{
135
+ action?: string
136
+ data?: string
137
+ type?: string
138
+ extras?: { [key: string]: any }
139
+ [key: string]: any
140
+ }>
135
141
  }
136
142
  }
137
143
 
@@ -139,7 +145,7 @@ Default property:
139
145
  export type GeneratorIntent = Generator &
140
146
  GeneratorIntentDef & {
141
147
  templateKey: 'GENERATOR_INTENT'
142
- switches: Array<
148
+ switches?: Array<
143
149
  SwitchDef &
144
150
  GeneratorIntentDef & {
145
151
  conds?: Array<{
@@ -69,15 +69,15 @@ Default property:
69
69
  }
70
70
  outlets?: {
71
71
  /* Elements that have been iterated (including current one) */
72
- iteratedArray?: () => Data
72
+ iteratedArray?: () => Data<Array<any>>
73
73
  /* Elements that will be iterated but have not been iterated yet */
74
- upcomingArray?: () => Data
74
+ upcomingArray?: () => Data<Array<any>>
75
75
  /* Current iteration element */
76
- value?: () => Data
76
+ value?: () => Data<any>
77
77
  /* Key of the current iteration element (for number: same as value, for array/string: index, for object: string key) */
78
- key?: () => Data
78
+ key?: () => Data<any>
79
79
  /* Current iteration count (if data is 6 and step is 2, this will return: 1,2,3 in sequence) */
80
- index?: () => Data
80
+ index?: () => Data<number>
81
81
  }
82
82
  }
83
83
 
@@ -85,7 +85,7 @@ Default property:
85
85
  export type GeneratorIterator = Generator &
86
86
  GeneratorIteratorDef & {
87
87
  templateKey: 'GENERATOR_ITERATOR'
88
- switches: Array<
88
+ switches?: Array<
89
89
  SwitchDef &
90
90
  GeneratorIteratorDef & {
91
91
  conds?: Array<{
@@ -27,13 +27,13 @@ Default property:
27
27
  property?: {
28
28
  /* Enable listening for input */
29
29
  enabled?: boolean | DataLink
30
- /* Key map to transform key or key code to the designated content
30
+ /* Key map to transform key or key code to the designated content
31
31
  Example: { 37: 'left', 38: 'up', 39: 'right', 40: 'down', 'Enter': 'confirm' }
32
32
  Supports both key codes (numbers) and key names (strings) as keys */
33
33
  keyMap?: {} | DataLink
34
34
  /* Key outlet preference use key code or key. */
35
35
  keyOutletPrefer?: 'auto' | 'key-code' | 'key' | DataLink
36
- /* Key or code to finish batch input
36
+ /* Key or code to finish batch input
37
37
  Common values: 13 (Enter), 27 (Escape), 'Enter', 'Escape' */
38
38
  batchStopKeys?: Array<string | DataLink | number | DataLink | DataLink> | DataLink
39
39
  /* Debounce time (ms) to finish batch input */
@@ -51,15 +51,25 @@ Default property:
51
51
  }
52
52
  outlets?: {
53
53
  /* Last key code pressed */
54
- lastKeyDown?: () => Data
54
+ lastKeyDown?: () => Data<string | number>
55
55
  /* Modifier key information on last key press */
56
- lastKeyDownFlags?: () => Data
56
+ lastKeyDownFlags?: () => Data<{ [key: string]: any }>
57
57
  /* Last key code released */
58
- lastKeyUp?: () => Data
58
+ lastKeyUp?: () => Data<string | number>
59
59
  /* Modifier key information on last key release */
60
- lastKeyUpFlags?: () => Data
60
+ lastKeyUpFlags?: () => Data<{ [key: string]: any }>
61
61
  /* Last batch event */
62
- lastBatchEvents?: () => Data
62
+ lastBatchEvents?: () => Data<
63
+ Array<{
64
+ event?: string
65
+ key?: any
66
+ keyNoMapping?: any
67
+ keyCode?: any
68
+ keyCodeNoMapping?: any
69
+ flags?: { [key: string]: any }
70
+ [key: string]: any
71
+ }>
72
+ >
63
73
  }
64
74
  }
65
75
 
@@ -67,7 +77,7 @@ Default property:
67
77
  export type GeneratorKeyboard = Generator &
68
78
  GeneratorKeyboardDef & {
69
79
  templateKey: 'GENERATOR_KEYBOARD'
70
- switches: Array<
80
+ switches?: Array<
71
81
  SwitchDef &
72
82
  GeneratorKeyboardDef & {
73
83
  conds?: Array<{