@fugood/bricks-project 2.22.0-beta.9 → 2.22.1

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 (85) hide show
  1. package/compile/action-name-map.ts +108 -17
  2. package/compile/index.ts +10 -1
  3. package/package.json +3 -4
  4. package/tools/postinstall.ts +16 -9
  5. package/types/animation.ts +2 -1
  6. package/types/brick-base.ts +79 -0
  7. package/types/bricks/3DViewer.ts +200 -0
  8. package/types/bricks/Camera.ts +195 -0
  9. package/types/bricks/Chart.ts +362 -0
  10. package/types/bricks/GenerativeMedia.ts +240 -0
  11. package/types/bricks/Icon.ts +93 -0
  12. package/types/bricks/Image.ts +104 -0
  13. package/types/bricks/Items.ts +461 -0
  14. package/types/bricks/Lottie.ts +159 -0
  15. package/types/bricks/QrCode.ts +112 -0
  16. package/types/bricks/Rect.ts +110 -0
  17. package/types/bricks/RichText.ts +123 -0
  18. package/types/bricks/Rive.ts +209 -0
  19. package/types/bricks/Slideshow.ts +155 -0
  20. package/types/bricks/Svg.ts +94 -0
  21. package/types/bricks/Text.ts +143 -0
  22. package/types/bricks/TextInput.ts +231 -0
  23. package/types/bricks/Video.ts +170 -0
  24. package/types/bricks/VideoStreaming.ts +107 -0
  25. package/types/bricks/WebRtcStream.ts +60 -0
  26. package/types/bricks/WebView.ts +157 -0
  27. package/types/bricks/index.ts +19 -0
  28. package/types/common.ts +8 -3
  29. package/types/data.ts +6 -0
  30. package/types/generators/AlarmClock.ts +102 -0
  31. package/types/generators/Assistant.ts +546 -0
  32. package/types/generators/BleCentral.ts +225 -0
  33. package/types/generators/BlePeripheral.ts +202 -0
  34. package/types/generators/CanvasMap.ts +57 -0
  35. package/types/generators/CastlesPay.ts +77 -0
  36. package/types/generators/DataBank.ts +123 -0
  37. package/types/generators/File.ts +351 -0
  38. package/types/generators/GraphQl.ts +124 -0
  39. package/types/generators/Http.ts +117 -0
  40. package/types/generators/HttpServer.ts +164 -0
  41. package/types/generators/Information.ts +97 -0
  42. package/types/generators/Intent.ts +107 -0
  43. package/types/generators/Iterator.ts +95 -0
  44. package/types/generators/Keyboard.ts +85 -0
  45. package/types/generators/LlmAnthropicCompat.ts +188 -0
  46. package/types/generators/LlmGgml.ts +719 -0
  47. package/types/generators/LlmOnnx.ts +184 -0
  48. package/types/generators/LlmOpenAiCompat.ts +206 -0
  49. package/types/generators/LlmQualcommAiEngine.ts +213 -0
  50. package/types/generators/Mcp.ts +294 -0
  51. package/types/generators/McpServer.ts +248 -0
  52. package/types/generators/MediaFlow.ts +142 -0
  53. package/types/generators/MqttBroker.ts +121 -0
  54. package/types/generators/MqttClient.ts +129 -0
  55. package/types/generators/Question.ts +395 -0
  56. package/types/generators/RealtimeTranscription.ts +180 -0
  57. package/types/generators/RerankerGgml.ts +153 -0
  58. package/types/generators/SerialPort.ts +141 -0
  59. package/types/generators/SoundPlayer.ts +86 -0
  60. package/types/generators/SoundRecorder.ts +113 -0
  61. package/types/generators/SpeechToTextGgml.ts +462 -0
  62. package/types/generators/SpeechToTextOnnx.ts +227 -0
  63. package/types/generators/SpeechToTextPlatform.ts +75 -0
  64. package/types/generators/SqLite.ts +118 -0
  65. package/types/generators/Step.ts +101 -0
  66. package/types/generators/Tcp.ts +120 -0
  67. package/types/generators/TcpServer.ts +137 -0
  68. package/types/generators/TextToSpeechGgml.ts +182 -0
  69. package/types/generators/TextToSpeechOnnx.ts +169 -0
  70. package/types/generators/TextToSpeechOpenAiLike.ts +113 -0
  71. package/types/generators/ThermalPrinter.ts +185 -0
  72. package/types/generators/Tick.ts +75 -0
  73. package/types/generators/Udp.ts +109 -0
  74. package/types/generators/VadGgml.ts +211 -0
  75. package/types/generators/VectorStore.ts +223 -0
  76. package/types/generators/Watchdog.ts +96 -0
  77. package/types/generators/WebCrawler.ts +97 -0
  78. package/types/generators/WebRtc.ts +165 -0
  79. package/types/generators/WebSocket.ts +142 -0
  80. package/types/generators/index.ts +50 -0
  81. package/types/system.ts +64 -0
  82. package/utils/data.ts +45 -0
  83. package/utils/event-props.ts +89 -13
  84. package/types/bricks.ts +0 -3168
  85. package/types/generators.ts +0 -7633
@@ -0,0 +1,75 @@
1
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
+ import type { Data, DataLink } from '../data'
3
+ import type {
4
+ Generator,
5
+ EventAction,
6
+ ActionWithDataParams,
7
+ ActionWithParams,
8
+ Action,
9
+ EventProperty,
10
+ } from '../common'
11
+
12
+ /* Start speech recognition */
13
+ export type GeneratorPlatformSTTActionStart = Action & {
14
+ __actionName: 'GENERATOR_PLATFORM_STT_START'
15
+ }
16
+
17
+ /* Stop speech recognition */
18
+ export type GeneratorPlatformSTTActionStop = Action & {
19
+ __actionName: 'GENERATOR_PLATFORM_STT_STOP'
20
+ }
21
+
22
+ interface GeneratorPlatformSTTDef {
23
+ /*
24
+ Default property:
25
+ {
26
+ "locale": "en_US"
27
+ }
28
+ */
29
+ property?: {
30
+ /* Locale for speech recognition */
31
+ locale?: string | DataLink
32
+ /* [iOS] An array of phrases that should be recognized, even if they are not in the system vocabulary. */
33
+ iosContextualStrings?: Array<string | DataLink> | DataLink
34
+ }
35
+ events?: {
36
+ /* Event for speech recognition start */
37
+ onSpeechStart?: Array<EventAction>
38
+ /* Event for speech recognition end */
39
+ onSpeechEnd?: Array<EventAction>
40
+ /* Event for speech recognition results */
41
+ onSpeechResults?: Array<EventAction>
42
+ /* Event for speech recognition error */
43
+ onSpeechError?: Array<EventAction>
44
+ }
45
+ outlets?: {
46
+ /* Recognized speech text */
47
+ recognizedText?: () => Data
48
+ /* Error message */
49
+ errorMessage?: () => Data
50
+ /* Listening status */
51
+ listening?: () => Data
52
+ }
53
+ }
54
+
55
+ /* Speech-to-Text using platform's native capabilities */
56
+ export type GeneratorPlatformSTT = Generator &
57
+ GeneratorPlatformSTTDef & {
58
+ templateKey: 'GENERATOR_PLATFORM_STT'
59
+ switches: Array<
60
+ SwitchDef &
61
+ GeneratorPlatformSTTDef & {
62
+ conds?: Array<{
63
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
64
+ cond:
65
+ | SwitchCondInnerStateCurrentCanvas
66
+ | SwitchCondData
67
+ | {
68
+ __typename: 'SwitchCondInnerStateOutlet'
69
+ outlet: 'recognizedText' | 'errorMessage' | 'listening'
70
+ value: any
71
+ }
72
+ }>
73
+ }
74
+ >
75
+ }
@@ -0,0 +1,118 @@
1
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
+ import type { Data, DataLink } from '../data'
3
+ import type {
4
+ Generator,
5
+ EventAction,
6
+ ActionWithDataParams,
7
+ ActionWithParams,
8
+ Action,
9
+ EventProperty,
10
+ } from '../common'
11
+
12
+ /* Execute SQL statement */
13
+ export type GeneratorSqliteActionExecute = ActionWithParams & {
14
+ __actionName: 'GENERATOR_SQLITE_EXECUTE'
15
+ params?: Array<
16
+ | {
17
+ input: 'sql'
18
+ value?: string | DataLink | EventProperty
19
+ mapping?: string
20
+ }
21
+ | {
22
+ input: 'params'
23
+ value?: Array<any> | DataLink | EventProperty
24
+ mapping?: string
25
+ }
26
+ | {
27
+ input: 'paramsString'
28
+ value?: string | DataLink | EventProperty
29
+ mapping?: string
30
+ }
31
+ >
32
+ }
33
+
34
+ /* Query data from database */
35
+ export type GeneratorSqliteActionQuery = ActionWithParams & {
36
+ __actionName: 'GENERATOR_SQLITE_QUERY'
37
+ params?: Array<
38
+ | {
39
+ input: 'sql'
40
+ value?: string | DataLink | EventProperty
41
+ mapping?: string
42
+ }
43
+ | {
44
+ input: 'params'
45
+ value?: Array<any> | DataLink | EventProperty
46
+ mapping?: string
47
+ }
48
+ | {
49
+ input: 'paramsString'
50
+ value?: string | DataLink | EventProperty
51
+ mapping?: string
52
+ }
53
+ >
54
+ }
55
+
56
+ interface GeneratorSqliteDef {
57
+ /*
58
+ Default property:
59
+ {
60
+ "init": false,
61
+ "dbName": "default",
62
+ "storageType": "file",
63
+ "useFile": false
64
+ }
65
+ */
66
+ property?: {
67
+ /* Initialize database on subspace mounted */
68
+ init?: boolean | DataLink
69
+ /* Database name */
70
+ dbName?: string | DataLink
71
+ /* Storage type */
72
+ storageType?: 'file' | 'memory' | DataLink
73
+ /* Use specific file (memory type will be ignored) */
74
+ useFile?: boolean | DataLink
75
+ /* File URI for SQLite database */
76
+ fileUri?: string | DataLink
77
+ /* MD5 hash of file URI */
78
+ fileUriMd5?: string | DataLink
79
+ }
80
+ events?: {
81
+ /* Event triggered when error occurs */
82
+ onError?: Array<EventAction>
83
+ /* Event triggered when query result is ready */
84
+ onQueryResult?: Array<EventAction>
85
+ }
86
+ outlets?: {
87
+ /* Whether the database is ready */
88
+ isReady?: () => Data
89
+ /* Database path */
90
+ dbPath?: () => Data
91
+ /* Error message */
92
+ error?: () => Data
93
+ /* Last query result */
94
+ lastResult?: () => Data
95
+ }
96
+ }
97
+
98
+ /* SQLite - General database operations */
99
+ export type GeneratorSqlite = Generator &
100
+ GeneratorSqliteDef & {
101
+ templateKey: 'GENERATOR_SQLITE'
102
+ switches: Array<
103
+ SwitchDef &
104
+ GeneratorSqliteDef & {
105
+ conds?: Array<{
106
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
107
+ cond:
108
+ | SwitchCondInnerStateCurrentCanvas
109
+ | SwitchCondData
110
+ | {
111
+ __typename: 'SwitchCondInnerStateOutlet'
112
+ outlet: 'isReady' | 'dbPath' | 'error' | 'lastResult'
113
+ value: any
114
+ }
115
+ }>
116
+ }
117
+ >
118
+ }
@@ -0,0 +1,101 @@
1
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
+ import type { Data, DataLink } from '../data'
3
+ import type {
4
+ Generator,
5
+ EventAction,
6
+ ActionWithDataParams,
7
+ ActionWithParams,
8
+ Action,
9
+ EventProperty,
10
+ } from '../common'
11
+
12
+ /* Start execute the step */
13
+ export type GeneratorStepActionStart = Action & {
14
+ __actionName: 'GENERATOR_STEP_START'
15
+ }
16
+
17
+ /* Pause steps */
18
+ export type GeneratorStepActionPause = Action & {
19
+ __actionName: 'GENERATOR_STEP_PAUSE'
20
+ }
21
+
22
+ /* Resume from pause step */
23
+ export type GeneratorStepActionResume = Action & {
24
+ __actionName: 'GENERATOR_STEP_RESUME'
25
+ }
26
+
27
+ /* Skip to the previous step and execute directly */
28
+ export type GeneratorStepActionPerviousStep = Action & {
29
+ __actionName: 'GENERATOR_STEP_PERVIOUS_STEP'
30
+ }
31
+
32
+ /* Skip to the next step and execute directly */
33
+ export type GeneratorStepActionNextStep = Action & {
34
+ __actionName: 'GENERATOR_STEP_NEXT_STEP'
35
+ }
36
+
37
+ /* Skip to the first step and execute directly */
38
+ export type GeneratorStepActionFirstStep = Action & {
39
+ __actionName: 'GENERATOR_STEP_FIRST_STEP'
40
+ }
41
+
42
+ /* Skip to the last step and execute directly */
43
+ export type GeneratorStepActionLastStep = Action & {
44
+ __actionName: 'GENERATOR_STEP_LAST_STEP'
45
+ }
46
+
47
+ interface GeneratorStepDef {
48
+ /*
49
+ Default property:
50
+ {
51
+ "init": false,
52
+ "steps": []
53
+ }
54
+ */
55
+ property?: {
56
+ init?: boolean | DataLink
57
+ /* Step definition list */
58
+ steps?:
59
+ | Array<
60
+ | DataLink
61
+ | {
62
+ duration?: number | DataLink
63
+ action?: 'change-canvas' | 'outlet' | 'event' | DataLink
64
+ payload?: string | DataLink
65
+ }
66
+ >
67
+ | DataLink
68
+ }
69
+ events?: {
70
+ /* Event on step (If action is `event`) */
71
+ onStep?: Array<EventAction>
72
+ }
73
+ outlets?: {
74
+ /* Result of step payload (If action is `outlet`) */
75
+ payload?: () => Data
76
+ /* Result of step index (If action is `outlet`) */
77
+ index?: () => Data
78
+ }
79
+ }
80
+
81
+ /* Trigger change canvas / outlet / event by setup rules */
82
+ export type GeneratorStep = Generator &
83
+ GeneratorStepDef & {
84
+ templateKey: 'GENERATOR_STEP'
85
+ switches: Array<
86
+ SwitchDef &
87
+ GeneratorStepDef & {
88
+ conds?: Array<{
89
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
90
+ cond:
91
+ | SwitchCondInnerStateCurrentCanvas
92
+ | SwitchCondData
93
+ | {
94
+ __typename: 'SwitchCondInnerStateOutlet'
95
+ outlet: 'payload' | 'index'
96
+ value: any
97
+ }
98
+ }>
99
+ }
100
+ >
101
+ }
@@ -0,0 +1,120 @@
1
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
+ import type { Data, DataLink } from '../data'
3
+ import type {
4
+ Generator,
5
+ EventAction,
6
+ ActionWithDataParams,
7
+ ActionWithParams,
8
+ Action,
9
+ EventProperty,
10
+ } from '../common'
11
+
12
+ /* Start connect */
13
+ export type GeneratorTCPActionConnect = Action & {
14
+ __actionName: 'GENERATOR_TCP_CONNECT'
15
+ }
16
+
17
+ /* Send data */
18
+ export type GeneratorTCPActionSend = ActionWithParams & {
19
+ __actionName: 'GENERATOR_TCP_SEND'
20
+ params?: Array<{
21
+ input: 'sendData'
22
+ value?: string | DataLink | EventProperty
23
+ mapping?: string
24
+ }>
25
+ }
26
+
27
+ /* End connection */
28
+ export type GeneratorTCPActionEnd = ActionWithParams & {
29
+ __actionName: 'GENERATOR_TCP_END'
30
+ params?: Array<{
31
+ input: 'endWithData'
32
+ value?: string | DataLink | EventProperty
33
+ mapping?: string
34
+ }>
35
+ }
36
+
37
+ interface GeneratorTCPDef {
38
+ /*
39
+ Default property:
40
+ {
41
+ "init": false,
42
+ "dataMode": "raw",
43
+ "encoding": "utf8",
44
+ "idleTimeout": 0,
45
+ "bufferSize": 1024,
46
+ "tls": false,
47
+ "tlsCheckValidity": false,
48
+ "tlsCert": ""
49
+ }
50
+ */
51
+ property?: {
52
+ /* Start connect on generator initialized */
53
+ init?: boolean | DataLink
54
+ /* Connection target host or IP assress */
55
+ host?: string | DataLink
56
+ /* Connection target port */
57
+ port?: number | DataLink
58
+ /* Data mode
59
+ CRLF: Receive until CRLF
60
+ LF: Receive until LF
61
+ raw: Raw packet */
62
+ dataMode?: 'CRLF' | 'LF' | 'raw' | DataLink
63
+ /* Encoding of data */
64
+ encoding?: 'base64' | 'utf8' | 'ascii' | DataLink
65
+ /* Max connection idle time, 0 is disable */
66
+ idleTimeout?: number | DataLink
67
+ /* Enable keepalive */
68
+ keepAlive?: boolean | DataLink
69
+ /* Buffer size limit of receive plaintext line */
70
+ bufferSize?: number | DataLink
71
+ /* Enable TLS */
72
+ tls?: boolean | DataLink
73
+ /* Enable TLS certificate verify */
74
+ tlsCheckValidity?: boolean | DataLink
75
+ /* Trust certificate list (PEM format) */
76
+ tlsCert?: string | DataLink
77
+ }
78
+ events?: {
79
+ /* Event of connect successful */
80
+ onConnected?: Array<EventAction>
81
+ /* Event of receive data */
82
+ onData?: Array<EventAction>
83
+ /* Event of connection idle timeout */
84
+ onTimeout?: Array<EventAction>
85
+ /* Event of connection close */
86
+ onClose?: Array<EventAction>
87
+ /* Event of connection error */
88
+ onError?: Array<EventAction>
89
+ }
90
+ outlets?: {
91
+ /* Connection status */
92
+ status?: () => Data
93
+ /* Last received data */
94
+ lastData?: () => Data
95
+ /* Error message */
96
+ errorMessage?: () => Data
97
+ }
98
+ }
99
+
100
+ /* TCP */
101
+ export type GeneratorTCP = Generator &
102
+ GeneratorTCPDef & {
103
+ templateKey: 'GENERATOR_TCP'
104
+ switches: Array<
105
+ SwitchDef &
106
+ GeneratorTCPDef & {
107
+ conds?: Array<{
108
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
109
+ cond:
110
+ | SwitchCondInnerStateCurrentCanvas
111
+ | SwitchCondData
112
+ | {
113
+ __typename: 'SwitchCondInnerStateOutlet'
114
+ outlet: 'status' | 'lastData' | 'errorMessage'
115
+ value: any
116
+ }
117
+ }>
118
+ }
119
+ >
120
+ }
@@ -0,0 +1,137 @@
1
+ import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
2
+ import type { Data, DataLink } from '../data'
3
+ import type {
4
+ Generator,
5
+ EventAction,
6
+ ActionWithDataParams,
7
+ ActionWithParams,
8
+ Action,
9
+ EventProperty,
10
+ } from '../common'
11
+
12
+ /* Start TCP server */
13
+ export type GeneratorTCPServerActionStart = Action & {
14
+ __actionName: 'GENERATOR_TCP_SERVER_START'
15
+ }
16
+
17
+ /* Send data to specify connection */
18
+ export type GeneratorTCPServerActionSend = ActionWithParams & {
19
+ __actionName: 'GENERATOR_TCP_SERVER_SEND'
20
+ params?: Array<
21
+ | {
22
+ input: 'remote'
23
+ value?: string | DataLink | EventProperty
24
+ mapping?: string
25
+ }
26
+ | {
27
+ input: 'sendData'
28
+ value?: string | DataLink | EventProperty
29
+ mapping?: string
30
+ }
31
+ >
32
+ }
33
+
34
+ /* End specify connection */
35
+ export type GeneratorTCPServerActionEnd = ActionWithParams & {
36
+ __actionName: 'GENERATOR_TCP_SERVER_END'
37
+ params?: Array<
38
+ | {
39
+ input: 'remote'
40
+ value?: string | DataLink | EventProperty
41
+ mapping?: string
42
+ }
43
+ | {
44
+ input: 'generatorTcpClientEndWithData'
45
+ value?: string | DataLink | EventProperty
46
+ mapping?: string
47
+ }
48
+ >
49
+ }
50
+
51
+ /* Stop TCP server */
52
+ export type GeneratorTCPServerActionStop = Action & {
53
+ __actionName: 'GENERATOR_TCP_SERVER_STOP'
54
+ }
55
+
56
+ interface GeneratorTCPServerDef {
57
+ /*
58
+ Default property:
59
+ {
60
+ "init": false,
61
+ "dataMode": "raw",
62
+ "encoding": "utf8",
63
+ "bufferSize": 1024,
64
+ "concurrent": 5,
65
+ "idleTimeout": 0
66
+ }
67
+ */
68
+ property?: {
69
+ /* Start TCP server on generator initialized */
70
+ init?: boolean | DataLink
71
+ /* Bind port of TCP server */
72
+ port?: number | DataLink
73
+ /* Data mode
74
+ CRLF: Receive until CRLF
75
+ LF: Receive until LF
76
+ raw: Raw packet */
77
+ dataMode?: 'CRLF' | 'LF' | 'raw' | DataLink
78
+ /* Encoding of data */
79
+ encoding?: 'base64' | 'utf8' | 'ascii' | DataLink
80
+ /* Buffer size limit of receive plaintext line */
81
+ bufferSize?: number | DataLink
82
+ /* Max concurrent connection count */
83
+ concurrent?: number | DataLink
84
+ /* Max connection idle time, 0 is disable */
85
+ idleTimeout?: number | DataLink
86
+ /* Enable TLS */
87
+ tls?: boolean | DataLink
88
+ /* TLS key pair (Base64 encoded no password PKCS #12) */
89
+ tlsKeyPair?: string | DataLink
90
+ }
91
+ events?: {
92
+ /* Event of TCP server is ready */
93
+ onReady?: Array<EventAction>
94
+ /* Event of TCP server accept the connection */
95
+ onAcceptConnection?: Array<EventAction>
96
+ /* Event of receive data */
97
+ onData?: Array<EventAction>
98
+ /* Event of connection idle timeout */
99
+ onTimeout?: Array<EventAction>
100
+ /* Event of connection close */
101
+ onClose?: Array<EventAction>
102
+ /* Event of server or connection error */
103
+ onError?: Array<EventAction>
104
+ }
105
+ outlets?: {
106
+ /* Is server started */
107
+ started?: () => Data
108
+ /* Accepted connections */
109
+ connections?: () => Data
110
+ /* Last received data */
111
+ lastData?: () => Data
112
+ /* Error message */
113
+ errorMessage?: () => Data
114
+ }
115
+ }
116
+
117
+ /* TCP Server */
118
+ export type GeneratorTCPServer = Generator &
119
+ GeneratorTCPServerDef & {
120
+ templateKey: 'GENERATOR_TCP_SERVER'
121
+ switches: Array<
122
+ SwitchDef &
123
+ GeneratorTCPServerDef & {
124
+ conds?: Array<{
125
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
126
+ cond:
127
+ | SwitchCondInnerStateCurrentCanvas
128
+ | SwitchCondData
129
+ | {
130
+ __typename: 'SwitchCondInnerStateOutlet'
131
+ outlet: 'started' | 'connections' | 'lastData' | 'errorMessage'
132
+ value: any
133
+ }
134
+ }>
135
+ }
136
+ >
137
+ }