@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,132 @@
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
+ */
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
+ /* Execute GraphQL request with defined properties */
19
+ export type GeneratorGraphQLActionRunQuery = ActionWithParams & {
20
+ __actionName: 'GENERATOR_GRAPHQL_RUN_QUERY'
21
+ params?: Array<
22
+ | {
23
+ input: 'type'
24
+ value?: 'query' | 'mutation' | 'subscription' | DataLink | EventProperty
25
+ mapping?: string
26
+ }
27
+ | {
28
+ input: 'query'
29
+ value?: string | DataLink | EventProperty
30
+ mapping?: string
31
+ }
32
+ | {
33
+ input: 'variables'
34
+ value?: {} | DataLink | EventProperty
35
+ mapping?: string
36
+ }
37
+ >
38
+ }
39
+
40
+ /* Reset cache of GraphQL client */
41
+ export type GeneratorGraphQLActionResetCache = Action & {
42
+ __actionName: 'GENERATOR_GRAPHQL_RESET_CACHE'
43
+ }
44
+
45
+ /* Cancel current running subscription */
46
+ export type GeneratorGraphQLActionCancelSubscription = Action & {
47
+ __actionName: 'GENERATOR_GRAPHQL_CANCEL_SUBSCRIPTION'
48
+ }
49
+
50
+ interface GeneratorGraphQLDef {
51
+ /*
52
+ Default property:
53
+ {
54
+ "init": false,
55
+ "type": "query",
56
+ "headers": {},
57
+ "query": "",
58
+ "variables": {},
59
+ "firebaseEnabled": false
60
+ }
61
+ */
62
+ property?: {
63
+ /* Start GraphQL request immediately after generator initialization */
64
+ init?: boolean | DataLink
65
+ /* GraphQL request type */
66
+ type?: 'query' | 'mutation' | 'subscription' | DataLink
67
+ /* HTTP request headers */
68
+ headers?: {} | DataLink
69
+ /* HTTP request URL endpoint */
70
+ endpoint?: string | DataLink
71
+ /* Subscription endpoint */
72
+ endpointForSubscription?: string | DataLink
73
+ /* Subscription connection params */
74
+ connectionParams?: {} | DataLink
75
+ /* Query content */
76
+ query?: string | DataLink
77
+ /* Query variables */
78
+ variables?: {} | DataLink
79
+ /* Data id from response, it is useful for caching data */
80
+ dataIdFromObject?: string | DataLink
81
+ /* Enable Firebase link */
82
+ firebaseEnabled?: boolean | DataLink
83
+ /* Firebase API Key */
84
+ firebaseAPIKey?: string | DataLink
85
+ /* Firebase Realtime Database `authDomain` field */
86
+ firebaseAuthDomain?: string | DataLink
87
+ /* Firebase Realtime Database `databaseURL` field */
88
+ firebaseDatabaseURL?: string | DataLink
89
+ /* Firebase Realtime Database `projectId` field */
90
+ firebaseProjectId?: string | DataLink
91
+ /* Firebase Realtime Database `storageBucket` field */
92
+ firebaseStorageBucket?: string | DataLink
93
+ /* Firebase Realtime Database `messagingSenderId` field */
94
+ firebaseMessagingSenderId?: string | DataLink
95
+ }
96
+ events?: {
97
+ /* Event triggered when subscription connection is successful */
98
+ subscriptionOnConnection?: Array<EventAction>
99
+ /* Event triggered when subscription connection error occurs */
100
+ subscriptionOnConnectionError?: Array<
101
+ EventAction<string & keyof TemplateEventPropsMap['Graphql']['subscriptionOnConnectionError']>
102
+ >
103
+ }
104
+ outlets?: {
105
+ /* Response for GraphQL request, it will save to Data */
106
+ response?: () => Data<{ [key: string]: any }>
107
+ /* Server response error of GraphQL request, it will save to Data */
108
+ error?: () => Data<string>
109
+ }
110
+ }
111
+
112
+ /* GraphQL client for Query, Mutation, and Subscription (WebSocket) with response caching and optional Firebase Realtime Database link */
113
+ export type GeneratorGraphQL = Generator &
114
+ GeneratorGraphQLDef & {
115
+ templateKey: 'GENERATOR_GRAPHQL'
116
+ switches?: Array<
117
+ SwitchDef &
118
+ GeneratorGraphQLDef & {
119
+ conds?: Array<{
120
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
121
+ cond:
122
+ | SwitchCondInnerStateCurrentCanvas
123
+ | SwitchCondData
124
+ | {
125
+ __typename: 'SwitchCondInnerStateOutlet'
126
+ outlet: 'response' | 'error'
127
+ value: any
128
+ }
129
+ }>
130
+ }
131
+ >
132
+ }
@@ -0,0 +1,222 @@
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
+ */
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
+ /* Run HTTP request with defined properties */
19
+ export type GeneratorHTTPActionRunRequest = ActionWithParams & {
20
+ __actionName: 'GENERATOR_HTTP_RUN_REQUEST'
21
+ params?: Array<
22
+ | {
23
+ input: 'url'
24
+ value?: string | DataLink | EventProperty
25
+ mapping?: string
26
+ }
27
+ | {
28
+ input: 'method'
29
+ value?:
30
+ | 'GET'
31
+ | 'POST'
32
+ | 'PUT'
33
+ | 'DELETE'
34
+ | 'HEAD'
35
+ | 'PATCH'
36
+ | 'OPTIONS'
37
+ | 'CONNECT'
38
+ | 'TRACE'
39
+ | DataLink
40
+ | EventProperty
41
+ mapping?: string
42
+ }
43
+ | {
44
+ input: 'headers'
45
+ value?: {} | DataLink | EventProperty
46
+ mapping?: string
47
+ }
48
+ | {
49
+ input: 'body'
50
+ value?: {} | DataLink | EventProperty
51
+ mapping?: string
52
+ }
53
+ | {
54
+ input: 'timeout'
55
+ value?: number | DataLink | EventProperty
56
+ mapping?: string
57
+ }
58
+ | {
59
+ input: 'mode'
60
+ value?: 'same-origin' | 'no-cors' | 'cors' | DataLink | EventProperty
61
+ mapping?: string
62
+ }
63
+ | {
64
+ input: 'credentials'
65
+ value?: 'include' | 'same-origin' | 'omit' | DataLink | EventProperty
66
+ mapping?: string
67
+ }
68
+ | {
69
+ input: 'redirect'
70
+ value?: 'manual' | 'follow' | 'error' | DataLink | EventProperty
71
+ mapping?: string
72
+ }
73
+ | {
74
+ input: 'referrer'
75
+ value?: 'no-referrer' | 'client' | DataLink | EventProperty
76
+ mapping?: string
77
+ }
78
+ | {
79
+ input: 'resType'
80
+ value?: 'json' | 'text' | 'xml' | 'csv' | DataLink | EventProperty
81
+ mapping?: string
82
+ }
83
+ | {
84
+ input: 'resSelector'
85
+ value?: string | DataLink | EventProperty
86
+ mapping?: string
87
+ }
88
+ | {
89
+ input: 'eventStream'
90
+ value?: boolean | DataLink | EventProperty
91
+ mapping?: string
92
+ }
93
+ | {
94
+ input: 'eventName'
95
+ value?: string | DataLink | EventProperty
96
+ mapping?: string
97
+ }
98
+ >
99
+ }
100
+
101
+ /* Abort HTTP request or SSE */
102
+ export type GeneratorHTTPActionAbort = Action & {
103
+ __actionName: 'GENERATOR_HTTP_ABORT'
104
+ }
105
+
106
+ interface GeneratorHTTPDef {
107
+ /*
108
+ Default property:
109
+ {
110
+ "init": false,
111
+ "method": "GET",
112
+ "headers": {},
113
+ "body": {},
114
+ "resType": "json",
115
+ "eventStream": false,
116
+ "eventName": "message"
117
+ }
118
+ */
119
+ property?: {
120
+ /* Start HTTP request on generator initialized */
121
+ init?: boolean | DataLink
122
+ /* URL of HTTP request */
123
+ url?: string | DataLink
124
+ /* Method of HTTP request */
125
+ method?:
126
+ | 'GET'
127
+ | 'POST'
128
+ | 'PUT'
129
+ | 'DELETE'
130
+ | 'HEAD'
131
+ | 'PATCH'
132
+ | 'OPTIONS'
133
+ | 'CONNECT'
134
+ | 'TRACE'
135
+ | DataLink
136
+ /* HTTP request headers */
137
+ headers?: {} | DataLink
138
+ /* Timeout of HTTP request */
139
+ timeout?: number | DataLink
140
+ /* Mode of HTTP request */
141
+ mode?: 'same-origin' | 'no-cors' | 'cors' | DataLink
142
+ /* Credentials of HTTP request */
143
+ credentials?: 'include' | 'same-origin' | 'omit' | DataLink
144
+ /* Redirect of HTTP request */
145
+ redirect?: 'manual' | 'follow' | 'error' | DataLink
146
+ /* Referrer of HTTP request */
147
+ referrer?: 'no-referrer' | 'client' | DataLink
148
+ /* HTTP request body, it will transform depends on `headers.Content-Type` (`application/json`, `application/x-www-form-urlencoded` or `multipart/form-data`)
149
+ The multipart schema like `{ file: { uri: File, type: File MIME, name: File Name }, field: "value" }` */
150
+ body?: {} | DataLink
151
+ /* HTTP response type */
152
+ resType?: 'json' | 'text' | 'xml' | 'csv' | DataLink
153
+ /* Response selector path to extract specific data from parsed response (e.g., "data.items" for JSON, "root.element" for XML) */
154
+ resSelector?: string | DataLink
155
+ /* Receive event stream (SSE) */
156
+ eventStream?: boolean | DataLink
157
+ /* Event name to listen on SSE */
158
+ eventName?: string | DataLink | Array<string | DataLink> | DataLink | DataLink
159
+ }
160
+ events?: {}
161
+ outlets?: {
162
+ /* Response for HTTP request */
163
+ response?: () => Data<string | { [key: string]: any }>
164
+ /* Response details for HTTP request */
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
+ }>
178
+ /* All received data from event stream */
179
+ eventLog?: () => Data<Array<any>>
180
+ /* All received event details from event stream */
181
+ eventLogDetails?: () => Data<
182
+ Array<{
183
+ event?: string
184
+ id?: string
185
+ data?: any
186
+ [key: string]: any
187
+ }>
188
+ >
189
+ /* EventSource state */
190
+ sseState?: () => Data<string>
191
+ /* Server response error of HTTP request */
192
+ error?: () => Data<string>
193
+ }
194
+ }
195
+
196
+ /* HTTP client supporting all methods (GET/POST/PUT/DELETE/PATCH/...), response parsing (JSON/text/XML/CSV), SSE event streams, and multipart file uploads */
197
+ export type GeneratorHTTP = Generator &
198
+ GeneratorHTTPDef & {
199
+ templateKey: 'GENERATOR_HTTP'
200
+ switches?: Array<
201
+ SwitchDef &
202
+ GeneratorHTTPDef & {
203
+ conds?: Array<{
204
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
205
+ cond:
206
+ | SwitchCondInnerStateCurrentCanvas
207
+ | SwitchCondData
208
+ | {
209
+ __typename: 'SwitchCondInnerStateOutlet'
210
+ outlet:
211
+ | 'response'
212
+ | 'responseDetails'
213
+ | 'eventLog'
214
+ | 'eventLogDetails'
215
+ | 'sseState'
216
+ | 'error'
217
+ value: any
218
+ }
219
+ }>
220
+ }
221
+ >
222
+ }
@@ -0,0 +1,176 @@
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
+ */
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 HTTP server */
19
+ export type GeneratorHTTPServerActionStart = Action & {
20
+ __actionName: 'GENERATOR_HTTP_SERVER_START'
21
+ }
22
+
23
+ /* Stop HTTP server */
24
+ export type GeneratorHTTPServerActionStop = Action & {
25
+ __actionName: 'GENERATOR_HTTP_SERVER_STOP'
26
+ }
27
+
28
+ /* Clear upload temp files */
29
+ export type GeneratorHTTPServerActionClearTempFiles = Action & {
30
+ __actionName: 'GENERATOR_HTTP_SERVER_CLEAR_TEMP_FILES'
31
+ }
32
+
33
+ /* End stream */
34
+ export type GeneratorHTTPServerActionEndStream = Action & {
35
+ __actionName: 'GENERATOR_HTTP_SERVER_END_STREAM'
36
+ }
37
+
38
+ interface GeneratorHTTPServerDef {
39
+ /*
40
+ Default property:
41
+ {
42
+ "init": false,
43
+ "method": "GET",
44
+ "path": "/",
45
+ "idleTimeout": 10000,
46
+ "authType": "none",
47
+ "asyncMode": false,
48
+ "resStatusCode": 200,
49
+ "resContentType": "text/plain",
50
+ "tls": false,
51
+ "tlsKeyPairPassword": ""
52
+ }
53
+ */
54
+ property?: {
55
+ /* Start HTTP server on generator initialized */
56
+ init?: boolean | DataLink
57
+ /* Bind port of HTTP server */
58
+ port?: number | DataLink
59
+ /* Method of HTTP request */
60
+ method?:
61
+ | 'GET'
62
+ | 'POST'
63
+ | 'PUT'
64
+ | 'DELETE'
65
+ | 'HEAD'
66
+ | 'PATCH'
67
+ | 'OPTIONS'
68
+ | 'CONNECT'
69
+ | 'TRACE'
70
+ | DataLink
71
+ /* Path of HTTP request */
72
+ path?: string | DataLink
73
+ /* Max connection idle time, 0 is disable */
74
+ idleTimeout?: number | DataLink
75
+ /* HTTP request body limit, 0 is unlimited */
76
+ bodyLimit?: number | DataLink
77
+ /* CORS allowed origins
78
+ You can use wildcard like `*`, `*.example.com`, `http://*.example.com` */
79
+ corsOrigins?: Array<string | DataLink> | DataLink
80
+ /* Authorization type of HTTP request */
81
+ authType?: 'none' | 'basic' | 'bearer' | DataLink
82
+ /* Username of basic auth */
83
+ basicAuthUser?: string | DataLink
84
+ /* Password of basic auth */
85
+ basicAuthPassword?: string | DataLink
86
+ /* Token of bearer auth */
87
+ bearerToken?: string | DataLink
88
+ /* Asynchronous response mode
89
+ Will block connection until Response Body update. */
90
+ asyncMode?: boolean | DataLink
91
+ /* Save request body as file
92
+ Only work on `application/octet-stream` or `multipart/form-data`. */
93
+ saveBodyAsFile?: boolean | DataLink
94
+ /* Response status code */
95
+ resStatusCode?: number | DataLink
96
+ /* Response Content-Type
97
+ `text/*` will not convert body.
98
+ `application/xml` convert object to XML, [example object struct](https://github.com/davidcalhoun/jstoxml#example-10-podcast-rss-feed)
99
+ `application/octet-stream` body should be Base64 string or file path. */
100
+ resContentType?:
101
+ | 'text/plain'
102
+ | 'text/html'
103
+ | 'text/javascript'
104
+ | 'text/css'
105
+ | 'text/xml'
106
+ | 'application/xml'
107
+ | 'application/json'
108
+ | 'application/octet-stream'
109
+ | 'text/event-stream'
110
+ | DataLink
111
+ /* Response Body */
112
+ resBody?: any
113
+ /* Custom response headers */
114
+ resHeader?: {} | DataLink
115
+ /* Event name of SSE */
116
+ sseEvent?: string | DataLink
117
+ /* SSE single request mode, block new request until the previous request is processed */
118
+ sseSingleRequest?: boolean | DataLink
119
+ /* Enable TLS (HTTPS) */
120
+ tls?: boolean | DataLink
121
+ /* Server side key pair (Base64 encoded PKCS #12) */
122
+ tlsKeyPair?: string | DataLink
123
+ /* Password of key pair, leave empty if no password */
124
+ tlsKeyPairPassword?: string | DataLink
125
+ }
126
+ events?: {
127
+ /* Event of HTTP server is ready */
128
+ onReady?: Array<EventAction>
129
+ /* Event of HTTP server accept the request */
130
+ onRequest?: Array<EventAction<string & keyof TemplateEventPropsMap['HttpServer']['onRequest']>>
131
+ /* Event of client close connection */
132
+ onClientClose?: Array<
133
+ EventAction<string & keyof TemplateEventPropsMap['HttpServer']['onClientClose']>
134
+ >
135
+ /* Event of client error */
136
+ onClientError?: Array<
137
+ EventAction<string & keyof TemplateEventPropsMap['HttpServer']['onClientError']>
138
+ >
139
+ /* Event of server close */
140
+ onClose?: Array<EventAction>
141
+ /* Event of server error */
142
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['HttpServer']['onError']>>
143
+ }
144
+ outlets?: {
145
+ /* Server is listening */
146
+ isListening?: () => Data<boolean>
147
+ /* Query of request */
148
+ requestQuery?: () => Data<{ [key: string]: any }>
149
+ /* Body of request */
150
+ requestBody?: () => Data<any>
151
+ /* Remote address of request */
152
+ clientAddress?: () => Data<string>
153
+ }
154
+ }
155
+
156
+ /* Embedded HTTP/HTTPS server with route matching, CORS, auth (Basic/Bearer), SSE streaming, file upload, and async response mode */
157
+ export type GeneratorHTTPServer = Generator &
158
+ GeneratorHTTPServerDef & {
159
+ templateKey: 'GENERATOR_HTTP_SERVER'
160
+ switches?: Array<
161
+ SwitchDef &
162
+ GeneratorHTTPServerDef & {
163
+ conds?: Array<{
164
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
165
+ cond:
166
+ | SwitchCondInnerStateCurrentCanvas
167
+ | SwitchCondData
168
+ | {
169
+ __typename: 'SwitchCondInnerStateOutlet'
170
+ outlet: 'isListening' | 'requestQuery' | 'requestBody' | 'clientAddress'
171
+ value: any
172
+ }
173
+ }>
174
+ }
175
+ >
176
+ }
@@ -0,0 +1,103 @@
1
+ /* Auto generated by build script
2
+ *
3
+ * Display informational dialog or toast messages to the user
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
+ /* Show information */
19
+ export type GeneratorInformationActionShow = ActionWithParams & {
20
+ __actionName: 'GENERATOR_INFORMATION_SHOW'
21
+ params?: Array<
22
+ | {
23
+ input: 'displayLanguage'
24
+ value?: string | DataLink | EventProperty
25
+ mapping?: string
26
+ }
27
+ | {
28
+ input: 'content'
29
+ value?: {} | DataLink | EventProperty
30
+ mapping?: string
31
+ }
32
+ >
33
+ }
34
+
35
+ /* Close information */
36
+ export type GeneratorInformationActionClose = Action & {
37
+ __actionName: 'GENERATOR_INFORMATION_CLOSE'
38
+ }
39
+
40
+ interface GeneratorInformationDef {
41
+ /*
42
+ Default property:
43
+ {
44
+ "modalMode": "root",
45
+ "backgroundColor": "#161616"
46
+ }
47
+ */
48
+ property?: {
49
+ /* Modal mode */
50
+ modalMode?: 'root' | 'in-subspace' | DataLink
51
+ /* Information contents */
52
+ content?:
53
+ | DataLink
54
+ | {
55
+ type?: 'loading' | 'info' | 'warning' | 'success' | 'queue-number' | DataLink
56
+ title?: string | DataLink
57
+ description?: string | DataLink
58
+ queueNumberLabel?:
59
+ | DataLink
60
+ | {
61
+ number?: string | DataLink
62
+ labelTitle?: string | DataLink
63
+ note?: string | DataLink
64
+ }
65
+ }
66
+ /* Display language */
67
+ displayLanguage?: string | DataLink
68
+ /* Background color */
69
+ backgroundColor?: string | DataLink
70
+ }
71
+ events?: {
72
+ /* Trigger when user confirms the information */
73
+ onConfirm?: Array<EventAction>
74
+ /* Trigger when error occurs */
75
+ onError?: Array<EventAction<string & keyof TemplateEventPropsMap['Information']['onError']>>
76
+ }
77
+ outlets?: {
78
+ /* Error message */
79
+ errorMessage?: () => Data<string>
80
+ }
81
+ }
82
+
83
+ /* Display informational dialog or toast messages to the user */
84
+ export type GeneratorInformation = Generator &
85
+ GeneratorInformationDef & {
86
+ templateKey: 'GENERATOR_INFORMATION'
87
+ switches?: Array<
88
+ SwitchDef &
89
+ GeneratorInformationDef & {
90
+ conds?: Array<{
91
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
92
+ cond:
93
+ | SwitchCondInnerStateCurrentCanvas
94
+ | SwitchCondData
95
+ | {
96
+ __typename: 'SwitchCondInnerStateOutlet'
97
+ outlet: 'errorMessage'
98
+ value: any
99
+ }
100
+ }>
101
+ }
102
+ >
103
+ }