@fugood/bricks-project 2.22.8 → 2.22.10
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.
- package/api/instance.ts +37 -5
- package/compile/action-name-map.ts +1 -0
- package/compile/index.ts +2 -0
- package/package.json +1 -1
- package/tools/deploy.ts +33 -2
- package/tools/postinstall.ts +0 -6
- package/tools/pull.ts +1 -1
- package/types/bricks/Image.ts +5 -0
- package/types/bricks/WebView.ts +7 -1
- package/types/data-calc-command.ts +7003 -0
- package/types/data-calc-script.ts +21 -0
- package/types/data-calc.ts +0 -7021
- package/types/data.ts +2 -0
- package/types/generators/AlarmClock.ts +1 -0
- package/types/generators/Assistant.ts +13 -5
- package/types/generators/BleCentral.ts +1 -0
- package/types/generators/BlePeripheral.ts +1 -0
- package/types/generators/CanvasMap.ts +1 -0
- package/types/generators/CastlesPay.ts +1 -0
- package/types/generators/DataBank.ts +1 -0
- package/types/generators/File.ts +1 -0
- package/types/generators/GraphQl.ts +1 -0
- package/types/generators/Http.ts +10 -2
- package/types/generators/HttpServer.ts +4 -1
- package/types/generators/Information.ts +1 -0
- package/types/generators/Intent.ts +1 -0
- package/types/generators/Iterator.ts +1 -0
- package/types/generators/Keyboard.ts +1 -0
- package/types/generators/LlmAnthropicCompat.ts +1 -0
- package/types/generators/LlmGgml.ts +1 -0
- package/types/generators/LlmOnnx.ts +1 -0
- package/types/generators/LlmOpenAiCompat.ts +1 -0
- package/types/generators/LlmQualcommAiEngine.ts +1 -0
- package/types/generators/Mcp.ts +5 -4
- package/types/generators/McpServer.ts +7 -6
- package/types/generators/MediaFlow.ts +1 -0
- package/types/generators/MqttBroker.ts +1 -0
- package/types/generators/MqttClient.ts +1 -0
- package/types/generators/Question.ts +1 -0
- package/types/generators/RealtimeTranscription.ts +3 -2
- package/types/generators/RerankerGgml.ts +1 -0
- package/types/generators/SerialPort.ts +1 -0
- package/types/generators/SoundPlayer.ts +1 -0
- package/types/generators/SoundRecorder.ts +1 -0
- package/types/generators/SpeechToTextGgml.ts +1 -0
- package/types/generators/SpeechToTextOnnx.ts +1 -0
- package/types/generators/SpeechToTextPlatform.ts +1 -0
- package/types/generators/SqLite.ts +1 -0
- package/types/generators/Step.ts +1 -0
- package/types/generators/Tcp.ts +1 -0
- package/types/generators/TcpServer.ts +4 -1
- package/types/generators/TextToSpeechGgml.ts +1 -0
- package/types/generators/TextToSpeechOnnx.ts +1 -0
- package/types/generators/TextToSpeechOpenAiLike.ts +1 -0
- package/types/generators/ThermalPrinter.ts +1 -0
- package/types/generators/Tick.ts +1 -0
- package/types/generators/Udp.ts +1 -0
- package/types/generators/VadGgml.ts +1 -0
- package/types/generators/VectorStore.ts +1 -0
- package/types/generators/Watchdog.ts +1 -0
- package/types/generators/WebCrawler.ts +1 -0
- package/types/generators/WebRtc.ts +3 -2
- package/types/generators/WebSocket.ts +1 -0
- package/types/index.ts +2 -0
- package/types/system.ts +42 -6
- package/utils/event-props.ts +1 -0
package/api/instance.ts
CHANGED
|
@@ -66,17 +66,31 @@ export const deployApp = async (
|
|
|
66
66
|
appId: string,
|
|
67
67
|
config: Config,
|
|
68
68
|
lastCommitId?: string,
|
|
69
|
+
changelogs?: string,
|
|
70
|
+
version?: string,
|
|
69
71
|
) => {
|
|
70
72
|
const app = await pullApp(stage, appId)
|
|
71
73
|
if (app.config?.bricks_project_last_commit_id === lastCommitId)
|
|
72
74
|
throw new Error('No changes to deploy')
|
|
73
75
|
|
|
76
|
+
const versionName = version || app.name || 'Untitled'
|
|
77
|
+
const releaseNote = changelogs
|
|
78
|
+
? `${changelogs}\n\nRelease by BRICKS Project`
|
|
79
|
+
: 'Release by BRICKS Project'
|
|
80
|
+
|
|
74
81
|
const { errors } = await doGQL(
|
|
75
82
|
stage,
|
|
76
|
-
`mutation
|
|
83
|
+
`mutation BRICKS_PROJECT_releaseApplication(
|
|
84
|
+
$id: ID!,
|
|
85
|
+
$config: String,
|
|
86
|
+
$releaseCurrentVersion: String,
|
|
87
|
+
$releaseCurrentVersionNote: String
|
|
88
|
+
) {
|
|
77
89
|
updateApplication(
|
|
78
90
|
id: $id,
|
|
79
|
-
config: $config
|
|
91
|
+
config: $config,
|
|
92
|
+
releaseCurrentVersion: $releaseCurrentVersion,
|
|
93
|
+
releaseCurrentVersionNote: $releaseCurrentVersionNote
|
|
80
94
|
) {
|
|
81
95
|
_id
|
|
82
96
|
name
|
|
@@ -86,9 +100,11 @@ export const deployApp = async (
|
|
|
86
100
|
id: appId,
|
|
87
101
|
config: JSON.stringify({
|
|
88
102
|
...config,
|
|
89
|
-
title:
|
|
103
|
+
title: versionName,
|
|
90
104
|
bricks_project_last_commit_id: lastCommitId,
|
|
91
105
|
}),
|
|
106
|
+
releaseCurrentVersion: versionName,
|
|
107
|
+
releaseCurrentVersionNote: releaseNote,
|
|
92
108
|
},
|
|
93
109
|
)
|
|
94
110
|
if (errors) throw new Error(errors[0].message)
|
|
@@ -137,18 +153,32 @@ export const deployModule = async (
|
|
|
137
153
|
modId: string,
|
|
138
154
|
config: Config,
|
|
139
155
|
lastCommitId?: string,
|
|
156
|
+
changelogs?: string,
|
|
157
|
+
version?: string,
|
|
140
158
|
) => {
|
|
141
159
|
const mod = await pullModule(stage, modId)
|
|
142
160
|
if (mod.config?.bricks_project_last_commit_id === lastCommitId)
|
|
143
161
|
throw new Error('No changes to deploy')
|
|
144
162
|
|
|
163
|
+
const versionName = version || mod.name || 'Untitled'
|
|
164
|
+
const releaseNote = changelogs
|
|
165
|
+
? `${changelogs}\n\nRelease by BRICKS Project`
|
|
166
|
+
: 'Release by BRICKS Project'
|
|
167
|
+
|
|
145
168
|
const { errors } = await doGQL(
|
|
146
169
|
stage,
|
|
147
|
-
`mutation
|
|
170
|
+
`mutation BRICKS_PROJECT_releaseModule(
|
|
171
|
+
$id: ID!,
|
|
172
|
+
$config: String,
|
|
173
|
+
$releaseCurrentVersion: String,
|
|
174
|
+
$releaseCurrentVersionNote: String
|
|
175
|
+
) {
|
|
148
176
|
updateModule(
|
|
149
177
|
id: $id
|
|
150
178
|
config: $config
|
|
151
179
|
validateConfig: true
|
|
180
|
+
releaseCurrentVersion: $releaseCurrentVersion
|
|
181
|
+
releaseCurrentVersionNote: $releaseCurrentVersionNote
|
|
152
182
|
) {
|
|
153
183
|
_id
|
|
154
184
|
name
|
|
@@ -158,9 +188,11 @@ export const deployModule = async (
|
|
|
158
188
|
id: modId,
|
|
159
189
|
config: JSON.stringify({
|
|
160
190
|
...config,
|
|
161
|
-
title:
|
|
191
|
+
title: versionName,
|
|
162
192
|
bricks_project_last_commit_id: lastCommitId,
|
|
163
193
|
}),
|
|
194
|
+
releaseCurrentVersion: versionName,
|
|
195
|
+
releaseCurrentVersionNote: releaseNote,
|
|
164
196
|
},
|
|
165
197
|
)
|
|
166
198
|
if (errors) throw new Error(errors[0].message)
|
|
@@ -384,6 +384,7 @@ export const templateActionNameMap = {
|
|
|
384
384
|
redirect: 'GENERATOR_HTTP_REDIRECT',
|
|
385
385
|
referrer: 'GENERATOR_HTTP_REFERRER',
|
|
386
386
|
resType: 'GENERATOR_HTTP_RES_TYPE',
|
|
387
|
+
resSelector: 'GENERATOR_HTTP_RES_SELECTOR',
|
|
387
388
|
eventStream: 'GENERATOR_HTTP_EVENT_STREAM',
|
|
388
389
|
eventName: 'GENERATOR_HTTP_EVENT_NAME',
|
|
389
390
|
},
|
package/compile/index.ts
CHANGED
package/package.json
CHANGED
package/tools/deploy.ts
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { $ } from 'bun'
|
|
2
|
+
import { parseArgs } from 'util'
|
|
2
3
|
import { deployApp, deployModule } from '../api'
|
|
3
4
|
|
|
4
5
|
const cwd = process.cwd()
|
|
5
6
|
|
|
7
|
+
// Parse command-line arguments
|
|
8
|
+
const {
|
|
9
|
+
values: { changelogs: changelogsArg, 'changelogs-file': changelogsFile },
|
|
10
|
+
} = parseArgs({
|
|
11
|
+
args: Bun.argv.slice(2),
|
|
12
|
+
options: {
|
|
13
|
+
changelogs: { type: 'string' },
|
|
14
|
+
'changelogs-file': { type: 'string' },
|
|
15
|
+
},
|
|
16
|
+
allowPositionals: true,
|
|
17
|
+
})
|
|
18
|
+
|
|
6
19
|
const { exitCode } = await $`cd ${cwd} && git status`.nothrow()
|
|
7
20
|
const isGitRepo = exitCode === 0
|
|
8
21
|
|
|
@@ -22,14 +35,32 @@ const app = await Bun.file(`${cwd}/application.json`).json()
|
|
|
22
35
|
const stage = app.stage || 'production'
|
|
23
36
|
const config = await Bun.file(`${cwd}/.bricks/build/application-config.json`).json()
|
|
24
37
|
|
|
38
|
+
// Get version from project's package.json
|
|
39
|
+
const pkgFile = Bun.file(`${cwd}/package.json`)
|
|
40
|
+
const version = (await pkgFile.exists()) ? (await pkgFile.json()).version : undefined
|
|
41
|
+
|
|
42
|
+
// Get changelog from flag, file, or prompt
|
|
43
|
+
let changelogs = ''
|
|
44
|
+
if (changelogsArg) {
|
|
45
|
+
changelogs = changelogsArg
|
|
46
|
+
} else if (changelogsFile) {
|
|
47
|
+
const file = Bun.file(changelogsFile)
|
|
48
|
+
if (!(await file.exists())) {
|
|
49
|
+
throw new Error(`Changelogs file not found: ${changelogsFile}`)
|
|
50
|
+
}
|
|
51
|
+
changelogs = await file.text()
|
|
52
|
+
} else {
|
|
53
|
+
changelogs = prompt('Enter changelogs (optional, press Enter to skip):') || ''
|
|
54
|
+
}
|
|
55
|
+
|
|
25
56
|
// ask for confirmation
|
|
26
57
|
const confirm = prompt('Are you sure you want to deploy? (y/n)')
|
|
27
58
|
if (confirm !== 'y') throw new Error('Deployment cancelled')
|
|
28
59
|
|
|
29
60
|
if (!app.type || app.type === 'application') {
|
|
30
|
-
await deployApp(stage, app.id, config, commitId)
|
|
61
|
+
await deployApp(stage, app.id, config, commitId, changelogs, version)
|
|
31
62
|
console.log('App deployed')
|
|
32
63
|
} else if (app.type === 'module') {
|
|
33
|
-
await deployModule(stage, app.id, config, commitId)
|
|
64
|
+
await deployModule(stage, app.id, config, commitId, changelogs, version)
|
|
34
65
|
console.log('Module deployed')
|
|
35
66
|
}
|
package/tools/postinstall.ts
CHANGED
|
@@ -58,13 +58,7 @@ const handleMcpConfigOverride = async (mcpConfigPath: string) => {
|
|
|
58
58
|
console.log(`Updated ${mcpConfigPath}`)
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
if (await exists(`${cwd}/.cursor/rules/instructions.mdc`)) {
|
|
62
|
-
const cursorMcpConfigPath = `${cwd}/.cursor/mcp.json`
|
|
63
|
-
await handleMcpConfigOverride(cursorMcpConfigPath)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
61
|
if (await exists(`${cwd}/CLAUDE.md`)) {
|
|
67
|
-
await $`mkdir -p ${cwd}/.cursor`
|
|
68
62
|
const claudeCodeMcpConfigPath = `${cwd}/.mcp.json`
|
|
69
63
|
await handleMcpConfigOverride(claudeCodeMcpConfigPath)
|
|
70
64
|
}
|
package/tools/pull.ts
CHANGED
|
@@ -70,7 +70,7 @@ await Promise.all(
|
|
|
70
70
|
|
|
71
71
|
if (isGitRepo) {
|
|
72
72
|
await $`cd ${cwd} && git add .`
|
|
73
|
-
await $`cd ${cwd} && git commit -m '
|
|
73
|
+
await $`cd ${cwd} && git commit -m 'chore(project): apply file changes from BRICKS application'`
|
|
74
74
|
if (!useMain) {
|
|
75
75
|
await $`cd ${cwd} && git merge main`
|
|
76
76
|
}
|
package/types/bricks/Image.ts
CHANGED
|
@@ -18,6 +18,7 @@ interface BrickImageDef {
|
|
|
18
18
|
Default property:
|
|
19
19
|
{
|
|
20
20
|
"path": "",
|
|
21
|
+
"templateType": "${}",
|
|
21
22
|
"fadeDuration": 0,
|
|
22
23
|
"blurBackgroundRadius": 8,
|
|
23
24
|
"loadSystemIos": "auto",
|
|
@@ -29,6 +30,10 @@ Default property:
|
|
|
29
30
|
resizeMode?: 'contain' | 'cover' | 'stretch' | 'center' | 'repeat' | DataLink
|
|
30
31
|
/* The image file path (File, URL) */
|
|
31
32
|
path?: string | DataLink
|
|
33
|
+
/* Data to be used in the path template (e.g. `https://example.com/${id}.png`). Supports nested data, such as `${user.avatar}`. */
|
|
34
|
+
templateData?: {} | DataLink
|
|
35
|
+
/* The path template type */
|
|
36
|
+
templateType?: '${}' | '{{}}' | DataLink
|
|
32
37
|
/* The checksum of file */
|
|
33
38
|
md5?: string | DataLink
|
|
34
39
|
/* The image fade duration */
|
package/types/bricks/WebView.ts
CHANGED
|
@@ -69,7 +69,9 @@ Default property:
|
|
|
69
69
|
"cacheEnabled": true,
|
|
70
70
|
"geolocationEnabled": true,
|
|
71
71
|
"thirdPartyCookiesEnabled": true,
|
|
72
|
-
"javaScriptEnabled": true
|
|
72
|
+
"javaScriptEnabled": true,
|
|
73
|
+
"scrollEnabled": true,
|
|
74
|
+
"nestedScrollEnabled": true
|
|
73
75
|
}
|
|
74
76
|
*/
|
|
75
77
|
property?: BrickBasicProperty & {
|
|
@@ -113,6 +115,10 @@ Default property:
|
|
|
113
115
|
forMainFrameOnly?: boolean | DataLink
|
|
114
116
|
/* Inject JavaScript code before content loaded for main frame only (only `YES` supported for Android) */
|
|
115
117
|
beforeContentLoadedForMainFrameOnly?: boolean | DataLink
|
|
118
|
+
/* Enable scroll in WebView */
|
|
119
|
+
scrollEnabled?: boolean | DataLink
|
|
120
|
+
/* Enable nested scroll in WebView (Android only) */
|
|
121
|
+
nestedScrollEnabled?: boolean | DataLink
|
|
116
122
|
}
|
|
117
123
|
events?: BrickBasicEvents & {
|
|
118
124
|
/* Event of the WebView on load */
|