@nocobase/plugin-ai 2.1.0-alpha.32 → 2.1.0-alpha.34
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/dist/ai/docs/nocobase/api/cli/api/dynamic.md +7 -0
- package/dist/ai/docs/nocobase/api/cli/api/resource/index.md +3 -0
- package/dist/ai/docs/nocobase/api/cli/app/down.md +7 -3
- package/dist/ai/docs/nocobase/api/cli/app/index.md +1 -1
- package/dist/ai/docs/nocobase/api/cli/app/logs.md +3 -0
- package/dist/ai/docs/nocobase/api/cli/app/restart.md +4 -0
- package/dist/ai/docs/nocobase/api/cli/app/start.md +4 -0
- package/dist/ai/docs/nocobase/api/cli/app/stop.md +3 -0
- package/dist/ai/docs/nocobase/api/cli/app/upgrade.md +5 -0
- package/dist/ai/docs/nocobase/api/cli/env/add.md +1 -1
- package/dist/ai/docs/nocobase/api/cli/env/auth.md +1 -1
- package/dist/ai/docs/nocobase/api/cli/env/info.md +1 -5
- package/dist/ai/docs/nocobase/api/cli/env/remove.md +1 -1
- package/dist/ai/docs/nocobase/api/cli/env/status.md +1 -1
- package/dist/ai/docs/nocobase/api/cli/env/update.md +1 -1
- package/dist/ai/docs/nocobase/api/cli/env/use.md +1 -1
- package/dist/ai/docs/nocobase/api/cli/license/activate.md +4 -1
- package/dist/ai/docs/nocobase/api/cli/license/id.md +4 -0
- package/dist/ai/docs/nocobase/api/cli/license/plugins/clean.md +5 -1
- package/dist/ai/docs/nocobase/api/cli/license/plugins/list.md +4 -0
- package/dist/ai/docs/nocobase/api/cli/license/plugins/sync.md +5 -1
- package/dist/ai/docs/nocobase/api/cli/license/status.md +4 -0
- package/dist/ai/docs/nocobase/api/cli/plugin/disable.md +4 -0
- package/dist/ai/docs/nocobase/api/cli/plugin/enable.md +4 -0
- package/dist/ai/docs/nocobase/api/cli/plugin/list.md +4 -0
- package/dist/client/119.c6bf8c6433167d81.js +10 -0
- package/dist/client/228.b4b709f93b86b6b9.js +10 -0
- package/dist/client/{486.afbed6b132b3c0dd.js → 486.dcac8f3fcec19c33.js} +1 -1
- package/dist/client/597.b0d64948d74cf6cb.js +10 -0
- package/dist/client/646.5860101cb28c8272.js +10 -0
- package/dist/client/711.92cd94681fde7e05.js +10 -0
- package/dist/client/768.5177bff46ae71a5b.js +10 -0
- package/dist/client/792.abb57765453bcbcc.js +10 -0
- package/dist/client/820.f72ef2462b61d812.js +10 -0
- package/dist/client/927.ac9ee9a8c1cb4f1d.js +10 -0
- package/dist/client/ai-employees/chatbox/conversations/ConversationsList.d.ts +1 -15
- package/dist/client/ai-employees/chatbox/conversations/WorkflowTasksList.d.ts +1 -21
- package/dist/client/ai-employees/chatbox/hooks/useChat.d.ts +125 -0
- package/dist/client/ai-employees/chatbox/hooks/useChatBoxActions.d.ts +1 -1
- package/dist/client/ai-employees/chatbox/hooks/useChatConversationActions.d.ts +13 -1
- package/dist/client/ai-employees/chatbox/hooks/useChatMessageActions.d.ts +8 -8
- package/dist/client/ai-employees/chatbox/stores/chat-conversations.d.ts +4 -0
- package/dist/client/ai-employees/chatbox/stores/chat-messages.d.ts +77 -50
- package/dist/client/ai-employees/chatbox/stores/chat-tool-call.d.ts +24 -16
- package/dist/client/ai-employees/types.d.ts +1 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +4 -4
- package/dist/externalVersion.js +16 -15
- package/dist/locale/en-US.json +1 -0
- package/dist/locale/zh-CN.json +1 -0
- package/dist/node_modules/@langchain/xai/package.json +1 -1
- package/dist/node_modules/fs-extra/package.json +1 -1
- package/dist/node_modules/jsonrepair/package.json +1 -1
- package/dist/node_modules/just-bash/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/node_modules/openai/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/ai-employees/ai-conversations.d.ts +3 -1
- package/dist/server/ai-employees/ai-conversations.js +40 -3
- package/dist/server/ai-employees/ai-employee.d.ts +16 -14
- package/dist/server/ai-employees/ai-employee.js +65 -43
- package/dist/server/ai-employees/middleware/conversation.js +11 -9
- package/dist/server/collections/ai-conversations.js +6 -0
- package/dist/server/manager/llm-stream-manager.d.ts +37 -0
- package/dist/server/manager/llm-stream-manager.js +142 -0
- package/dist/server/plugin.d.ts +2 -0
- package/dist/server/plugin.js +3 -0
- package/dist/server/resource/aiConversations.d.ts +8 -0
- package/dist/server/resource/aiConversations.js +129 -2
- package/package.json +2 -2
- package/dist/client/119.78774f3ad953af49.js +0 -10
- package/dist/client/228.a3df2921c8beb766.js +0 -10
- package/dist/client/597.aa363881a325b5c0.js +0 -10
- package/dist/client/646.217a40387efbd163.js +0 -10
- package/dist/client/711.266b8f1c520d467a.js +0 -10
- package/dist/client/768.973ce32e15099a48.js +0 -10
- package/dist/client/792.2e48eab4767d662a.js +0 -10
- package/dist/client/820.6a26239ea96c075a.js +0 -10
- package/dist/client/927.ff5cd05b14901ae6.js +0 -10
|
@@ -41,6 +41,13 @@ Dynamic commands with request bodies support:
|
|
|
41
41
|
|
|
42
42
|
`--body` and `--body-file` are mutually exclusive.
|
|
43
43
|
|
|
44
|
+
Dynamic API commands also support:
|
|
45
|
+
|
|
46
|
+
- `--env`, `-e`: CLI env name to send the request to; when omitted, the current env is used
|
|
47
|
+
- `--yes`, `-y`: When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt
|
|
48
|
+
|
|
49
|
+
If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
|
|
50
|
+
|
|
44
51
|
## Related Commands
|
|
45
52
|
|
|
46
53
|
- [`nb env update`](../env/update.md)
|
|
@@ -32,6 +32,7 @@ nb api resource <command>
|
|
|
32
32
|
| `--api-base-url` | string | NocoBase API URL, for example `http://localhost:13000/api` |
|
|
33
33
|
| `--verbose` | boolean | Show detailed progress |
|
|
34
34
|
| `--env`, `-e` | string | Env name |
|
|
35
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
35
36
|
| `--role` | string | Role override sent as the `X-Role` request header |
|
|
36
37
|
| `--token`, `-t` | string | API key override |
|
|
37
38
|
| `--json-output`, `-j` / `--no-json-output` | boolean | Whether to output raw JSON; enabled by default |
|
|
@@ -49,6 +50,8 @@ nb api resource create --resource users --values '{"nickname":"Ada"}'
|
|
|
49
50
|
nb api resource list --resource posts.comments --source-id 1 --fields id --fields content
|
|
50
51
|
```
|
|
51
52
|
|
|
53
|
+
If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
|
|
54
|
+
|
|
52
55
|
## Related Commands
|
|
53
56
|
|
|
54
57
|
- [`nb api`](../index.md)
|
|
@@ -6,7 +6,7 @@ keywords: "nb app down,NocoBase CLI,cleanup,remove containers,storage"
|
|
|
6
6
|
|
|
7
7
|
# nb app down
|
|
8
8
|
|
|
9
|
-
Stop and clean up local runtime resources for a selected env. Storage data and env configuration are kept by default; pass `--all --
|
|
9
|
+
Stop and clean up local runtime resources for a selected env. Storage data and env configuration are kept by default; pass `--all --force` explicitly to delete everything.
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
@@ -20,16 +20,20 @@ nb app down [flags]
|
|
|
20
20
|
| --- | --- | --- |
|
|
21
21
|
| `--env`, `-e` | string | CLI env name to clean up; uses the current env if omitted |
|
|
22
22
|
| `--all` | boolean | Delete all content for the env, including storage data and saved env configuration |
|
|
23
|
-
| `--yes`, `-y` | boolean |
|
|
23
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
24
|
+
| `--force`, `-f` | boolean | Force destructive cleanup, such as `--all` or other high-risk cleanup in non-interactive mode |
|
|
24
25
|
| `--verbose` | boolean | Show underlying stop and cleanup command output |
|
|
25
26
|
|
|
26
27
|
## Examples
|
|
27
28
|
|
|
28
29
|
```bash
|
|
29
30
|
nb app down --env app1
|
|
30
|
-
nb app down --env app1 --all --
|
|
31
|
+
nb app down --env app1 --all --force
|
|
32
|
+
nb app down --env app1 --force
|
|
31
33
|
```
|
|
32
34
|
|
|
35
|
+
`--yes` only skips the interactive confirmation when an explicitly passed `--env` targets a different env than the current env. `--force` is for actually forcing destructive cleanup, such as `--all` or other high-risk cleanup in non-interactive mode.
|
|
36
|
+
|
|
33
37
|
## Related Commands
|
|
34
38
|
|
|
35
39
|
- [`nb app stop`](./stop.md)
|
|
@@ -19,6 +19,7 @@ nb app logs [flags]
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
21
|
| `--env`, `-e` | string | CLI env name to view logs for; uses the current env if omitted |
|
|
22
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
22
23
|
| `--tail` | integer | Number of recent log lines to show before following, default `100` |
|
|
23
24
|
| `--follow`, `-f` / `--no-follow` | boolean | Whether to keep following new log output |
|
|
24
25
|
|
|
@@ -31,6 +32,8 @@ nb app logs --env app1 --tail 200
|
|
|
31
32
|
nb app logs --env app1 --no-follow
|
|
32
33
|
```
|
|
33
34
|
|
|
35
|
+
If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
|
|
36
|
+
|
|
34
37
|
## Related Commands
|
|
35
38
|
|
|
36
39
|
- [`nb app start`](./start.md)
|
|
@@ -19,6 +19,7 @@ nb app restart [flags]
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
21
|
| `--env`, `-e` | string | CLI env name to restart; uses the current env if omitted |
|
|
22
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
22
23
|
| `--quickstart` | boolean | Start the app in quickstart mode after stopping |
|
|
23
24
|
| `--port`, `-p` | string | Override the `appPort` saved in env config |
|
|
24
25
|
| `--daemon`, `-d` / `--no-daemon` | boolean | Whether to run in daemon mode after stopping; enabled by default |
|
|
@@ -36,9 +37,12 @@ nb app restart --env local --port 12000
|
|
|
36
37
|
nb app restart --env local --no-daemon
|
|
37
38
|
nb app restart --env local --instances 2
|
|
38
39
|
nb app restart --env local --launch-mode pm2
|
|
40
|
+
nb app restart --env local --verbose
|
|
39
41
|
nb app restart --env local-docker
|
|
40
42
|
```
|
|
41
43
|
|
|
44
|
+
If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
|
|
45
|
+
|
|
42
46
|
## Related Commands
|
|
43
47
|
|
|
44
48
|
- [`nb app start`](./start.md)
|
|
@@ -19,6 +19,7 @@ nb app start [flags]
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
21
|
| `--env`, `-e` | string | CLI env name to start; uses the current env if omitted |
|
|
22
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
22
23
|
| `--quickstart` | boolean | Start the app in quickstart mode |
|
|
23
24
|
| `--port`, `-p` | string | Override the `appPort` saved in env config |
|
|
24
25
|
| `--daemon`, `-d` / `--no-daemon` | boolean | Whether to run in daemon mode; enabled by default |
|
|
@@ -37,9 +38,12 @@ nb app start --env local --daemon
|
|
|
37
38
|
nb app start --env local --no-daemon
|
|
38
39
|
nb app start --env local --instances 2
|
|
39
40
|
nb app start --env local --launch-mode pm2
|
|
41
|
+
nb app start --env local --verbose
|
|
40
42
|
nb app start --env local-docker
|
|
41
43
|
```
|
|
42
44
|
|
|
45
|
+
If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
|
|
46
|
+
|
|
43
47
|
## Related Commands
|
|
44
48
|
|
|
45
49
|
- [`nb app stop`](./stop.md)
|
|
@@ -19,6 +19,7 @@ nb app stop [flags]
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
21
|
| `--env`, `-e` | string | CLI env name to stop; uses the current env if omitted |
|
|
22
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
22
23
|
| `--verbose` | boolean | Show underlying local or Docker command output |
|
|
23
24
|
|
|
24
25
|
## Examples
|
|
@@ -30,6 +31,8 @@ nb app stop --env local --verbose
|
|
|
30
31
|
nb app stop --env local-docker
|
|
31
32
|
```
|
|
32
33
|
|
|
34
|
+
If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
|
|
35
|
+
|
|
33
36
|
## Related Commands
|
|
34
37
|
|
|
35
38
|
- [`nb app start`](./start.md)
|
|
@@ -19,7 +19,9 @@ nb app upgrade [flags]
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
21
|
| `--env`, `-e` | string | CLI env name to upgrade; uses the current env if omitted |
|
|
22
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
22
23
|
| `--skip-code-update`, `-s` | boolean | Restart from the saved local source or Docker image without downloading updates |
|
|
24
|
+
| `--version` | string | Override the saved `downloadVersion`; when the upgrade succeeds, the new version is written back to the env config |
|
|
23
25
|
| `--verbose` | boolean | Show underlying update and restart command output |
|
|
24
26
|
|
|
25
27
|
## Examples
|
|
@@ -28,10 +30,13 @@ nb app upgrade [flags]
|
|
|
28
30
|
nb app upgrade
|
|
29
31
|
nb app upgrade --env local
|
|
30
32
|
nb app upgrade --env local -s
|
|
33
|
+
nb app upgrade --env local --version beta
|
|
31
34
|
nb app upgrade --env local --verbose
|
|
32
35
|
nb app upgrade --env local-docker -s
|
|
33
36
|
```
|
|
34
37
|
|
|
38
|
+
If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
|
|
39
|
+
|
|
35
40
|
## Related Commands
|
|
36
41
|
|
|
37
42
|
- [`nb source download`](../source/download.md)
|
|
@@ -25,7 +25,7 @@ nb env add [name] [flags]
|
|
|
25
25
|
|
|
26
26
|
| Parameter | Type | Description |
|
|
27
27
|
| --- | --- | --- |
|
|
28
|
-
| `[name]` | string |
|
|
28
|
+
| `[name]` | string | Environment name to save; prompted in TTY when omitted, required in non-TTY mode |
|
|
29
29
|
| `--verbose` | boolean | Show detailed progress when writing config |
|
|
30
30
|
| `--locale` | string | CLI prompt language: `en-US` or `zh-CN` |
|
|
31
31
|
| `--api-base-url`, `-u` | string | NocoBase API URL, including the `/api` prefix |
|
|
@@ -18,7 +18,7 @@ nb env auth [name]
|
|
|
18
18
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
|
-
| `[name]` | string |
|
|
21
|
+
| `[name]` | string | Configured environment name to sign in to; uses the current env if omitted |
|
|
22
22
|
|
|
23
23
|
## Notes
|
|
24
24
|
|
|
@@ -18,20 +18,16 @@ nb env info [name] [flags]
|
|
|
18
18
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
|
-
| `[name]` | string |
|
|
22
|
-
| `--env`, `-e` | string | CLI env name to inspect; alternative to the positional argument |
|
|
21
|
+
| `[name]` | string | Configured environment name to inspect; uses the current env if omitted |
|
|
23
22
|
| `--json` | boolean | Output JSON |
|
|
24
23
|
| `--show-secrets` | boolean | Show tokens, passwords, and other secrets in plain text |
|
|
25
24
|
|
|
26
|
-
If both `[name]` and `--env` are passed, they must match.
|
|
27
|
-
|
|
28
25
|
## Examples
|
|
29
26
|
|
|
30
27
|
```bash
|
|
31
28
|
nb env info app1
|
|
32
29
|
nb env info app1 --json
|
|
33
30
|
nb env info app1 --show-secrets
|
|
34
|
-
nb env info --env app1
|
|
35
31
|
```
|
|
36
32
|
|
|
37
33
|
## Related Commands
|
|
@@ -20,7 +20,7 @@ nb env remove <name> [flags]
|
|
|
20
20
|
|
|
21
21
|
| Parameter | Type | Description |
|
|
22
22
|
| --- | --- | --- |
|
|
23
|
-
| `<name>` | string |
|
|
23
|
+
| `<name>` | string | Configured environment name to remove |
|
|
24
24
|
| `--force`, `-f` | boolean | Skip confirmation and delete directly |
|
|
25
25
|
| `--verbose` | boolean | Show detailed progress |
|
|
26
26
|
|
|
@@ -20,7 +20,7 @@ nb env status [name] [flags]
|
|
|
20
20
|
|
|
21
21
|
| Parameter | Type | Description |
|
|
22
22
|
| --- | --- | --- |
|
|
23
|
-
| `[name]` | string |
|
|
23
|
+
| `[name]` | string | Configured environment name to inspect; uses the current env if omitted; cannot be used with `--all` |
|
|
24
24
|
| `--all` | boolean | Show status for all configured envs |
|
|
25
25
|
| `--json-output` | boolean | Output the result as JSON |
|
|
26
26
|
|
|
@@ -18,7 +18,7 @@ nb env update [name] [flags]
|
|
|
18
18
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
|
-
| `[name]` | string |
|
|
21
|
+
| `[name]` | string | Configured environment name to refresh; uses the current env if omitted |
|
|
22
22
|
| `--verbose` | boolean | Show detailed progress |
|
|
23
23
|
| `--api-base-url` | string | Override the NocoBase API URL and persist it to the target env |
|
|
24
24
|
| `--role` | string | Role override sent as the `X-Role` request header |
|
|
@@ -25,7 +25,7 @@ nb license activate [flags]
|
|
|
25
25
|
| `--account` | string | License service account for online activation |
|
|
26
26
|
| `--password` | string | License service password for online activation |
|
|
27
27
|
| `--desc` | string | Application name submitted for online activation |
|
|
28
|
-
| `--yes` | boolean |
|
|
28
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
29
29
|
| `--json` | boolean | Output JSON |
|
|
30
30
|
|
|
31
31
|
## Examples
|
|
@@ -34,6 +34,7 @@ nb license activate [flags]
|
|
|
34
34
|
nb license activate --env app1 --key <licenseKey>
|
|
35
35
|
nb license activate --env app1 --key-file ./license.txt
|
|
36
36
|
nb license activate --env app1 --online
|
|
37
|
+
nb license activate --env app1 --online --account aa --password bb --desc test24
|
|
37
38
|
nb license activate --env app1 --online --account aa --password bb --desc test24 --yes
|
|
38
39
|
nb license activate --env app1 --json --key-file ./license.txt
|
|
39
40
|
```
|
|
@@ -42,6 +43,8 @@ nb license activate --env app1 --json --key-file ./license.txt
|
|
|
42
43
|
|
|
43
44
|
When online activation is used, the CLI requests a license key from the license service with the current env's instance ID and app URL.
|
|
44
45
|
|
|
46
|
+
If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
|
|
47
|
+
|
|
45
48
|
## Related Commands
|
|
46
49
|
|
|
47
50
|
- [`nb license id`](./id.md)
|
|
@@ -19,6 +19,7 @@ nb license id [flags]
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
21
|
| `--env`, `-e` | string | CLI env name; when omitted, the current env is used |
|
|
22
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
22
23
|
| `--force` | boolean | Regenerate the instance ID even when one is already saved |
|
|
23
24
|
| `--json` | boolean | Output JSON |
|
|
24
25
|
|
|
@@ -27,10 +28,13 @@ nb license id [flags]
|
|
|
27
28
|
```bash
|
|
28
29
|
nb license id
|
|
29
30
|
nb license id --env app1
|
|
31
|
+
nb license id --env app1 --yes
|
|
30
32
|
nb license id --env app1 --force
|
|
31
33
|
nb license id --env app1 --json
|
|
32
34
|
```
|
|
33
35
|
|
|
36
|
+
`--force` only forces regeneration of the instance ID. It does not replace cross-env confirmation; if an explicitly passed `--env` targets a non-current env, you still need confirmation or `--yes`.
|
|
37
|
+
|
|
34
38
|
## Related Commands
|
|
35
39
|
|
|
36
40
|
- [`nb license activate`](./activate.md)
|
|
@@ -19,8 +19,9 @@ nb license plugins clean [flags]
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
21
|
| `--env`, `-e` | string | CLI env name; when omitted, the current env is used |
|
|
22
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
22
23
|
| `--dry-run` | boolean | Preview which plugins would be removed without deleting anything |
|
|
23
|
-
| `--verbose
|
|
24
|
+
| `--verbose` | boolean | Show detailed per-plugin clean logs |
|
|
24
25
|
| `--json` | boolean | Output JSON |
|
|
25
26
|
|
|
26
27
|
## Examples
|
|
@@ -28,11 +29,14 @@ nb license plugins clean [flags]
|
|
|
28
29
|
```bash
|
|
29
30
|
nb license plugins clean
|
|
30
31
|
nb license plugins clean --env app1
|
|
32
|
+
nb license plugins clean --env app1 --yes
|
|
31
33
|
nb license plugins clean --env app1 --dry-run
|
|
32
34
|
nb license plugins clean --env app1 --verbose
|
|
33
35
|
nb license plugins clean --env app1 --json
|
|
34
36
|
```
|
|
35
37
|
|
|
38
|
+
If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
|
|
39
|
+
|
|
36
40
|
## Related Commands
|
|
37
41
|
|
|
38
42
|
- [`nb license plugins sync`](./sync.md)
|
|
@@ -19,6 +19,7 @@ nb license plugins list [flags]
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
21
|
| `--env`, `-e` | string | CLI env name; when omitted, the current env is used |
|
|
22
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
22
23
|
| `--json` | boolean | Output JSON |
|
|
23
24
|
|
|
24
25
|
## Examples
|
|
@@ -26,9 +27,12 @@ nb license plugins list [flags]
|
|
|
26
27
|
```bash
|
|
27
28
|
nb license plugins list
|
|
28
29
|
nb license plugins list --env app1
|
|
30
|
+
nb license plugins list --env app1 --yes
|
|
29
31
|
nb license plugins list --env app1 --json
|
|
30
32
|
```
|
|
31
33
|
|
|
34
|
+
If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
|
|
35
|
+
|
|
32
36
|
## Related Commands
|
|
33
37
|
|
|
34
38
|
- [`nb license plugins sync`](./sync.md)
|
|
@@ -19,9 +19,10 @@ nb license plugins sync [flags]
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
21
|
| `--env`, `-e` | string | CLI env name; when omitted, the current env is used |
|
|
22
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
22
23
|
| `--dry-run` | boolean | Preview changes without installing, upgrading, or removing plugins |
|
|
23
24
|
| `--version` | string | Registry version or dist-tag to synchronize; defaults to the current workspace version |
|
|
24
|
-
| `--verbose
|
|
25
|
+
| `--verbose` | boolean | Show detailed per-plugin sync logs |
|
|
25
26
|
| `--json` | boolean | Output JSON |
|
|
26
27
|
|
|
27
28
|
## Examples
|
|
@@ -29,6 +30,7 @@ nb license plugins sync [flags]
|
|
|
29
30
|
```bash
|
|
30
31
|
nb license plugins sync
|
|
31
32
|
nb license plugins sync --env app1
|
|
33
|
+
nb license plugins sync --env app1 --yes
|
|
32
34
|
nb license plugins sync --env app1 --dry-run
|
|
33
35
|
nb license plugins sync --env app1 --json
|
|
34
36
|
```
|
|
@@ -37,6 +39,8 @@ nb license plugins sync --env app1 --json
|
|
|
37
39
|
|
|
38
40
|
When `--version` is omitted, the CLI detects the current app version automatically and uses that to decide which registry version of commercial plugins should be downloaded.
|
|
39
41
|
|
|
42
|
+
If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
|
|
43
|
+
|
|
40
44
|
## Related Commands
|
|
41
45
|
|
|
42
46
|
- [`nb license plugins list`](./list.md)
|
|
@@ -19,6 +19,7 @@ nb license status [flags]
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
21
|
| `--env`, `-e` | string | CLI env name; when omitted, the current env is used |
|
|
22
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
22
23
|
| `--doctor` | boolean | Run extra diagnostic checks and suggestions |
|
|
23
24
|
| `--json` | boolean | Output JSON |
|
|
24
25
|
|
|
@@ -27,6 +28,7 @@ nb license status [flags]
|
|
|
27
28
|
```bash
|
|
28
29
|
nb license status
|
|
29
30
|
nb license status --env app1
|
|
31
|
+
nb license status --env app1 --yes
|
|
30
32
|
nb license status --env app1 --doctor
|
|
31
33
|
nb license status --env app1 --json
|
|
32
34
|
```
|
|
@@ -35,6 +37,8 @@ nb license status --env app1 --json
|
|
|
35
37
|
|
|
36
38
|
The new CLI does not fully implement backend license status checks yet. The command can still return basic context and diagnostic placeholders, but not a complete license verdict.
|
|
37
39
|
|
|
40
|
+
If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
|
|
41
|
+
|
|
38
42
|
## Related Commands
|
|
39
43
|
|
|
40
44
|
- [`nb license activate`](./activate.md)
|
|
@@ -20,6 +20,7 @@ nb plugin disable <packages...> [flags]
|
|
|
20
20
|
| --- | --- | --- |
|
|
21
21
|
| `<packages...>` | string[] | Plugin package names, required; supports multiple values |
|
|
22
22
|
| `--env`, `-e` | string | CLI env name; uses the current env if omitted |
|
|
23
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
23
24
|
|
|
24
25
|
## Examples
|
|
25
26
|
|
|
@@ -27,8 +28,11 @@ nb plugin disable <packages...> [flags]
|
|
|
27
28
|
nb plugin disable @nocobase/plugin-sample
|
|
28
29
|
nb plugin disable @nocobase/plugin-a @nocobase/plugin-b
|
|
29
30
|
nb plugin disable -e local @nocobase/plugin-sample
|
|
31
|
+
nb plugin disable -e local --yes @nocobase/plugin-sample
|
|
30
32
|
```
|
|
31
33
|
|
|
34
|
+
If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
|
|
35
|
+
|
|
32
36
|
## Related Commands
|
|
33
37
|
|
|
34
38
|
- [`nb plugin list`](./list.md)
|
|
@@ -20,6 +20,7 @@ nb plugin enable <packages...> [flags]
|
|
|
20
20
|
| --- | --- | --- |
|
|
21
21
|
| `<packages...>` | string[] | Plugin package names, required; supports multiple values |
|
|
22
22
|
| `--env`, `-e` | string | CLI env name; uses the current env if omitted |
|
|
23
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
23
24
|
|
|
24
25
|
## Examples
|
|
25
26
|
|
|
@@ -27,8 +28,11 @@ nb plugin enable <packages...> [flags]
|
|
|
27
28
|
nb plugin enable @nocobase/plugin-sample
|
|
28
29
|
nb plugin enable @nocobase/plugin-a @nocobase/plugin-b
|
|
29
30
|
nb plugin enable -e local @nocobase/plugin-sample
|
|
31
|
+
nb plugin enable -e local --yes @nocobase/plugin-sample
|
|
30
32
|
```
|
|
31
33
|
|
|
34
|
+
If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
|
|
35
|
+
|
|
32
36
|
## Related Commands
|
|
33
37
|
|
|
34
38
|
- [`nb plugin list`](./list.md)
|
|
@@ -19,15 +19,19 @@ nb plugin list [flags]
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
21
|
| `--env`, `-e` | string | CLI env name; uses the current env if omitted |
|
|
22
|
+
| `--yes`, `-y` | boolean | When an explicitly passed `--env` targets a different env than the current env, skip the interactive confirmation prompt |
|
|
22
23
|
|
|
23
24
|
## Examples
|
|
24
25
|
|
|
25
26
|
```bash
|
|
26
27
|
nb plugin list
|
|
27
28
|
nb plugin list -e local
|
|
29
|
+
nb plugin list -e local --yes
|
|
28
30
|
nb plugin list -e local-docker
|
|
29
31
|
```
|
|
30
32
|
|
|
33
|
+
If you explicitly pass `--env` and it differs from the current env, the CLI asks for confirmation first. In non-interactive terminals or AI agent sessions, add `--yes` yourself or run `nb env use <name>` first and try again.
|
|
34
|
+
|
|
31
35
|
## Related Commands
|
|
32
36
|
|
|
33
37
|
- [`nb plugin enable`](./enable.md)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_ai=self.webpackChunk_nocobase_plugin_ai||[]).push([["119"],{4498:function(e,t,n){n.r(t),n.d(t,{CodeToolCard:function(){return y},buildToolCodeBlock:function(){return g},compactPatchForDisplay:function(){return f},shouldSkipCodeToolCardRender:function(){return p}});var r=n(9155),o=n.n(r),l=n(5475),a=n(4281);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return i(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){return"writeJSCode"===e?"string"==typeof t.code?t.code:void 0:"patchJSCode"===e&&"string"==typeof t.patch?t.patch:void 0}function s(e){var t=function(e){if("string"!=typeof e)return e;var t=e.trim();if(!t)return{};try{return JSON.parse((0,l.m)(t))}catch(e){return}}(e.args);return t&&(void 0===t?"undefined":t&&"u">typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)=="object"?t:null}function p(e,t){if(!g(e.toolCall))return!1;var n,r=s(t.toolCall);if(!r)return!0;var o=u(e.toolCall.name,null!=(n=s(e.toolCall))?n:{}),l=u(t.toolCall.name,r);return!!o&&(!l||l.length<.8*o.length)}function f(e){for(var t,n=e&&null!=(t=e.match(/[^\n]*\n|[^\n]+/g))?t:[],r=[],o=0;o<n.length;){var l=n[o];if(!l.startsWith("@@ ")){r.push(l),o++;continue}r.push(l),o++;for(var a=[];o<n.length&&!n[o].startsWith("@@ ");)a.push(n[o]),o++;r.push.apply(r,c(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,n=e.reduce(function(e,t,n){return(t.startsWith("+")||t.startsWith("-"))&&e.push(n),e},[]);if(!n.length||e.length<=80)return e;var r=new Set,o=!0,l=!1,a=void 0;try{for(var i,u=n[Symbol.iterator]();!(o=(i=u.next()).done);o=!0)for(var s=i.value,p=Math.max(0,s-t);p<=Math.min(e.length-1,s+t);p++)r.add(p)}catch(e){l=!0,a=e}finally{try{o||null==u.return||u.return()}finally{if(l)throw a}}var f=[],g=-1,y=!0,d=!1,m=void 0;try{for(var b,h=c(r).sort(function(e,t){return e-t})[Symbol.iterator]();!(y=(b=h.next()).done);y=!0){var v=b.value;-1!==g&&v>g+1&&f.push(" ...\n"),f.push(e[v]),g=v}}catch(e){d=!0,m=e}finally{try{y||null==h.return||h.return()}finally{if(d)throw m}}return f}(function(e){for(var t=[],n=0;n<e.length;){var r=e[n],o=e[n+1];if((null==r?void 0:r.startsWith("-"))&&(null==o?void 0:o.startsWith("+"))&&!r.startsWith("---")&&!o.startsWith("+++")&&r.slice(1)===o.slice(1)){t.push(" ".concat(r.slice(1))),n+=2;continue}t.push(r),n++}return t}(a))))}return r.join("")}function g(e){var t=s(e);return t?"writeJSCode"===e.name&&"string"==typeof t.code&&t.code?{language:"js",value:t.code}:"patchJSCode"===e.name&&"string"==typeof t.patch&&t.patch?{language:"diff",value:f(t.patch)}:null:null}var y=o().memo(function(e){var t=g(e.toolCall);return t?o().createElement("div",{style:{padding:"4px 12px"}},o().createElement(a.w,{className:"language-".concat(t.language)},t.value)):null},p)},4281:function(e,t,n){n.d(t,{w:function(){return S},Rs:function(){return C},Cy:function(){return P}});var r=n(9155),o=n.n(r),l=n(2059),a=n(7375),i=n(3342),c=n(3079),u=n(8680),s=n(7694),p=n(7546),f=n(7596);function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function y(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function d(e,t){if(null==e)return{};var n,r,o,l={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,n=Reflect.ownKeys(Object(e));o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}if(l=function(e,t){if(null==e)return{};var n,r,o={},l=Object.getOwnPropertyNames(e);for(r=0;r<l.length;r++)n=l[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}var m=(0,i.lazy)(function(){return Promise.all([n.e("428"),n.e("758")]).then(n.bind(n,2733))},"CodeHighlight").CodeHighlight,b=function(e){var t=e.language,n=e.value,r=e.height,l=e.scrollToBottom,a=d(e,["language","value","height","scrollToBottom"]);return o().createElement(m,y(g({},a),{language:t,value:n,height:r,scrollToBottom:l}))},h=function(e){var t=(0,s.useFlowContext)(),n=(0,c.kj)(),r=f.J.use.currentConversation(),i=(0,p.Y)(r),u=e.children,m=e.className,h=(e.node,e.message),O=d(e,["children","className","node","message"]),w=/language-(\w+)/.exec(m||""),E=w?w[1]:"",j=String(u).replace(/<!--[\s\S]*?-->/g,"").replace(/\n$/,""),C=l.App.useApp().message,S=!0;(null==h?void 0:h.type)==="text"&&(S=RegExp("```"+E+"[\\s\\S]*?```","s").test(h.content));var P=i.use.editorRef()[i.use.currentEditorRefUid()];return w?o().createElement(l.Card,{type:"inner",size:"small",title:o().createElement(l.Space,{style:{margin:"0 8px"},size:"middle"},o().createElement(a.CodeOutlined,null),o().createElement("span",null,E)),extra:o().createElement(o().Fragment,null,o().createElement(l.Tooltip,{title:n("Copy")},o().createElement(l.Button,{type:"text",icon:o().createElement(a.CopyOutlined,null),onClick:function(){navigator.clipboard.writeText(j),C.success(n("Copied"))}})),o().createElement(l.Divider,{type:"vertical"}),o().createElement(l.Tooltip,{title:n("Expand")},o().createElement(l.Button,{type:"text",icon:o().createElement(a.ExpandOutlined,null),onClick:function(){t.viewer.dialog({width:"80%",zIndex:6e3,content:o().createElement(v,y(g({},O),{language:E,value:j,height:"75vh"}))})}}))),styles:{header:{padding:0},body:{padding:0}},actions:P?[o().createElement(l.Button,{key:"accept",type:"link",onClick:function(e){e.stopPropagation(),null==P||P.write(j),t.message.info(n("Applied"))},disabled:!S},n("Apply to editor"))]:[]},o().createElement(b,y(g({},O),{language:E,value:j,scrollToBottom:!S}))):o().createElement(l.Typography.Text,y(g({code:!0},O),{className:m}),u)},v=function(e){var t=e.language,n=e.value,r=d(e,["language","value"]),i=(0,s.useFlowViewContext)(),c=i.view.Header,u=o().createElement(l.Button,{type:"text",icon:o().createElement(a.CloseOutlined,null),onClick:function(){i.view.close()}});return o().createElement("div",{style:{borderRadius:8}},o().createElement(c,{title:o().createElement(o().Fragment,null,o().createElement(l.Space,null,u,o().createElement("span",null,t)))}),o().createElement(b,y(g({},r),{language:t,value:n})))};function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function w(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function E(e,t){if(null==e)return{};var n,r,o,l={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,n=Reflect.ownKeys(Object(e));o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}if(l=function(e,t){if(null==e)return{};var n,r,o={},l=Object.getOwnPropertyNames(e);for(r=0;r<l.length;r++)n=l[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}var j=(0,i.lazy)(function(){return Promise.all([n.e("428"),n.e("758")]).then(n.bind(n,2733))},"CodeHighlight").CodeHighlight,C=function(e){var t=e.language,n=e.value,r=E(e,["language","value"]);return o().createElement(j,w(O({},r),{language:t,value:n}))},S=function(e){var t=e.children,n=e.className,r=(e.node,e.message,E(e,["children","className","node","message"])),u=/language-(\w+)/.exec(n||""),s=u?u[1]:"",p=(0,i.useToken)().token,f=(0,c.kj)(),g=String(t).replace(/\n$/,""),y=l.App.useApp().message;return u?o().createElement(l.Card,{size:"small",title:s,styles:{title:{fontSize:p.fontSize,fontWeight:400},body:{width:"100%",fontSize:p.fontSizeSM}},extra:o().createElement(l.Button,{variant:"link",color:"default",size:"small",onClick:function(){navigator.clipboard.writeText(g),y.success(f("Copied"))},icon:o().createElement(a.CopyOutlined,null)})},o().createElement(C,w(O({},r),{language:s,value:g}))):o().createElement(l.Typography.Text,w(O({code:!0},r),{className:n}),t)},P=function(e){var t=e.className,n=/language-(\w+)/.exec(t||""),r=n?n[1]:"",l=f.J.use.currentConversation(),a=(0,p.Y)(l);return a.use.editorRef()[a.use.currentEditorRefUid()]&&(0,u._t)(r)?o().createElement(h,e):o().createElement(S,e)}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_ai=self.webpackChunk_nocobase_plugin_ai||[]).push([["228"],{4281:function(e,t,n){n.d(t,{w:function(){return x},Rs:function(){return S},Cy:function(){return P}});var r=n(9155),o=n.n(r),l=n(2059),a=n(7375),i=n(3342),c=n(3079),u=n(8680),s=n(7694),f=n(7546),p=n(7596);function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function y(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function m(e,t){if(null==e)return{};var n,r,o,l={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,n=Reflect.ownKeys(Object(e));o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}if(l=function(e,t){if(null==e)return{};var n,r,o={},l=Object.getOwnPropertyNames(e);for(r=0;r<l.length;r++)n=l[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}var b=(0,i.lazy)(function(){return Promise.all([n.e("428"),n.e("758")]).then(n.bind(n,2733))},"CodeHighlight").CodeHighlight,g=function(e){var t=e.language,n=e.value,r=e.height,l=e.scrollToBottom,a=m(e,["language","value","height","scrollToBottom"]);return o().createElement(b,y(d({},a),{language:t,value:n,height:r,scrollToBottom:l}))},v=function(e){var t=(0,s.useFlowContext)(),n=(0,c.kj)(),r=p.J.use.currentConversation(),i=(0,f.Y)(r),u=e.children,b=e.className,v=(e.node,e.message),O=m(e,["children","className","node","message"]),w=/language-(\w+)/.exec(b||""),E=w?w[1]:"",j=String(u).replace(/<!--[\s\S]*?-->/g,"").replace(/\n$/,""),S=l.App.useApp().message,x=!0;(null==v?void 0:v.type)==="text"&&(x=RegExp("```"+E+"[\\s\\S]*?```","s").test(v.content));var P=i.use.editorRef()[i.use.currentEditorRefUid()];return w?o().createElement(l.Card,{type:"inner",size:"small",title:o().createElement(l.Space,{style:{margin:"0 8px"},size:"middle"},o().createElement(a.CodeOutlined,null),o().createElement("span",null,E)),extra:o().createElement(o().Fragment,null,o().createElement(l.Tooltip,{title:n("Copy")},o().createElement(l.Button,{type:"text",icon:o().createElement(a.CopyOutlined,null),onClick:function(){navigator.clipboard.writeText(j),S.success(n("Copied"))}})),o().createElement(l.Divider,{type:"vertical"}),o().createElement(l.Tooltip,{title:n("Expand")},o().createElement(l.Button,{type:"text",icon:o().createElement(a.ExpandOutlined,null),onClick:function(){t.viewer.dialog({width:"80%",zIndex:6e3,content:o().createElement(h,y(d({},O),{language:E,value:j,height:"75vh"}))})}}))),styles:{header:{padding:0},body:{padding:0}},actions:P?[o().createElement(l.Button,{key:"accept",type:"link",onClick:function(e){e.stopPropagation(),null==P||P.write(j),t.message.info(n("Applied"))},disabled:!x},n("Apply to editor"))]:[]},o().createElement(g,y(d({},O),{language:E,value:j,scrollToBottom:!x}))):o().createElement(l.Typography.Text,y(d({code:!0},O),{className:b}),u)},h=function(e){var t=e.language,n=e.value,r=m(e,["language","value"]),i=(0,s.useFlowViewContext)(),c=i.view.Header,u=o().createElement(l.Button,{type:"text",icon:o().createElement(a.CloseOutlined,null),onClick:function(){i.view.close()}});return o().createElement("div",{style:{borderRadius:8}},o().createElement(c,{title:o().createElement(o().Fragment,null,o().createElement(l.Space,null,u,o().createElement("span",null,t)))}),o().createElement(g,y(d({},r),{language:t,value:n})))};function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function w(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function E(e,t){if(null==e)return{};var n,r,o,l={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,n=Reflect.ownKeys(Object(e));o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}if(l=function(e,t){if(null==e)return{};var n,r,o={},l=Object.getOwnPropertyNames(e);for(r=0;r<l.length;r++)n=l[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}var j=(0,i.lazy)(function(){return Promise.all([n.e("428"),n.e("758")]).then(n.bind(n,2733))},"CodeHighlight").CodeHighlight,S=function(e){var t=e.language,n=e.value,r=E(e,["language","value"]);return o().createElement(j,w(O({},r),{language:t,value:n}))},x=function(e){var t=e.children,n=e.className,r=(e.node,e.message,E(e,["children","className","node","message"])),u=/language-(\w+)/.exec(n||""),s=u?u[1]:"",f=(0,i.useToken)().token,p=(0,c.kj)(),d=String(t).replace(/\n$/,""),y=l.App.useApp().message;return u?o().createElement(l.Card,{size:"small",title:s,styles:{title:{fontSize:f.fontSize,fontWeight:400},body:{width:"100%",fontSize:f.fontSizeSM}},extra:o().createElement(l.Button,{variant:"link",color:"default",size:"small",onClick:function(){navigator.clipboard.writeText(d),y.success(p("Copied"))},icon:o().createElement(a.CopyOutlined,null)})},o().createElement(S,w(O({},r),{language:s,value:d}))):o().createElement(l.Typography.Text,w(O({code:!0},r),{className:n}),t)},P=function(e){var t=e.className,n=/language-(\w+)/.exec(t||""),r=n?n[1]:"",l=p.J.use.currentConversation(),a=(0,f.Y)(l);return a.use.editorRef()[a.use.currentEditorRefUid()]&&(0,u._t)(r)?o().createElement(v,e):o().createElement(x,e)}},8007:function(e,t,n){n.r(t),n.d(t,{DataModelingModal:function(){return el}});var r=n(9155),o=n.n(r),l=n(2059),a=n(7375),i=n(3079),c=n(4281),u=n(3870),s=n(5407),f=n(9009),p=n(7757),d=n.n(p);n(7695);var y=n(3342),m=n(5230),b=n(5477);function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t,n,r,o,l,a){try{var i=e[l](a),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function O(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var l=[],a=!0,i=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(l.push(n.value),!t||l.length!==t);a=!0);}catch(e){i=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(i)throw r}}return l}}(e,t)||E(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){if(e){if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return g(e,t)}}function j(){var e,t,n=(e=["\n width: 100%;\n height: 100%;\n svg:not(:root) {\n overflow: unset;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return j=function(){return n},n}var S=new(d()),x={collection:function(e){var t=e.data,n=(0,y.useToken)().token,r=(0,y.useApp)(),c=(0,i.kj)(),s=r.dataSourceManager.collectionFieldInterfaceManager,f={top:"50%",transform:"translateY(-50%)",width:8,height:8,opacity:0,pointerEvents:"none"};return o().createElement(l.Card,{size:"small",title:o().createElement("div",{style:{position:"relative"}},o().createElement(u.h7,{type:"target",position:u.yX.Left,id:t.name,style:f}),t.title," ",o().createElement("span",{style:{fontSize:n.fontSizeSM,color:n.colorTextDescription}},t.name),o().createElement(u.h7,{type:"source",position:u.yX.Right,id:t.name,style:f})),styles:{body:{padding:0,minWidth:"200px"}}},o().createElement(l.List,{dataSource:t.fields,size:"small",renderItem:function(e){var r=s.getFieldInterface(e.interface);return o().createElement(l.List.Item,{style:{position:"relative"}},o().createElement(l.Flex,{justify:"space-between",gap:"large",style:{width:"100%"}},o().createElement(u.h7,{type:"source",position:u.yX.Right,id:"".concat(t.name,"-").concat(e.name),style:f}),o().createElement(l.Flex,{vertical:!0},o().createElement("div",null,e.title,e.primaryKey?o().createElement(a.KeyOutlined,{style:{marginLeft:"4px"}}):""),o().createElement("div",{style:{fontSize:n.fontSizeSM,color:n.colorTextDescription}},e.name)),o().createElement(l.Flex,{vertical:!0,align:"flex-end"},o().createElement("div",{style:{fontSize:n.fontSizeSM,color:n.colorTextSecondary}},(null==r?void 0:r.title)?m.Schema.compile(r.title,{t:c}):""),o().createElement("div",{style:{fontSize:n.fontSizeSM,color:n.colorTextDescription}},e.type))))}}))}},P=function(e,t){var n;return(n=function(){var n,r;return function(e,t){var n,r,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(a,"next",{value:c(0)}),i(a,"throw",{value:c(1)}),i(a,"return",{value:c(2)}),"function"==typeof Symbol&&i(a,Symbol.iterator,{value:function(){return this}}),a;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return l.label++,{value:u[1],done:!1};case 5:l.label++,r=u[1],u=[0];continue;case 7:u=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){l=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){l.label=u[1];break}if(6===u[0]&&l.label<o[1]){l.label=o[1],o=u;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(u);break}o[2]&&l.ops.pop(),l.trys.pop();continue}u=t.call(e,l)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(o){return n=!t.length,r={id:"root",layoutOptions:{"elk.algorithm":t.length?"org.eclipse.elk.layered":"org.eclipse.elk.box"},children:e.map(function(e){return O(h({},e),{targetPosition:n?"left":"top",sourcePosition:n?"right":"bottom",width:320,height:50*(e.data.fields.length+1)})}),edges:t},[2,S.layout(r).then(function(e){return{nodes:e.children.map(function(e){return O(h({},e),{position:{x:e.x,y:e.y}})}),edges:e.edges}}).catch(console.error)]})},function(){var e=this,t=arguments;return new Promise(function(r,o){var l=n.apply(e,t);function a(e){v(l,r,o,a,i,"next",e)}function i(e){v(l,r,o,a,i,"throw",e)}a(void 0)})})()},k=function(e){var t=new Map(e.map(function(e){return[e.name,e]})),n=new Set,r=!0,o=!1,l=void 0;try{for(var a,i=e[Symbol.iterator]();!(r=(a=i.next()).done);r=!0){var c=a.value;c.autoGenId&&c.fields.unshift({name:"id",interface:"id",type:"bigInt",title:"ID",primaryKey:!0,autoIncrement:!0})}}catch(e){o=!0,l=e}finally{try{r||null==i.return||i.return()}finally{if(o)throw l}}var u=e.map(function(e){var t;return{id:e.name,type:"collection",position:{x:0,y:0},data:{title:e.title,name:e.name,fields:function(e){if(Array.isArray(e))return g(e)}(t=e.fields)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||E(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}}}),s=[],f=function(e,t){var r="".concat(e,"-").concat(t),o="".concat(t,"-").concat(e);n.has(r)||n.has(o)||(s.push({id:r,source:e,sourceHandle:e,target:t,targetHandle:t,type:"smoothstep",animated:!0}),n.add(r))},p=!0,d=!1,y=void 0;try{for(var m,b=e[Symbol.iterator]();!(p=(m=b.next()).done);p=!0){var v=m.value,h=!0,O=!1,w=void 0;try{for(var j,S=v.fields[Symbol.iterator]();!(h=(j=S.next()).done);h=!0){var x=j.value,k=x.type,I=x.target,C=x.through;I!==v.name&&("belongsToMany"===k&&C&&t.has(C)?(f(v.name,C),f(C,I)):I&&f(v.name,I))}}catch(e){O=!0,w=e}finally{try{h||null==S.return||S.return()}finally{if(O)throw w}}}}catch(e){d=!0,y=e}finally{try{p||null==b.return||b.return()}finally{if(d)throw y}}return P(u,s)},I=function(e){var t=e.collections,n=(0,y.useGlobalTheme)().isDarkTheme,l=w((0,u.ck)([]),3),a=l[0],i=l[1],c=l[2],p=w((0,u.fM)([]),3),d=p[0],m=p[1];return p[2],(0,r.useEffect)(function(){k(t).then(function(e){var t=e.nodes,n=e.edges;i(t),m(n)}).catch(function(e){return console.error("Error laying out elements:",e)})},[t]),o().createElement("div",{className:(0,b.css)(j())},o().createElement(u.Gc,{nodes:a,edges:d,nodeTypes:x,fitView:!0,panOnDrag:!0,zoomOnScroll:!0,proOptions:{hideAttribution:!0},onNodesChange:c,colorMode:n?"dark":"light"},o().createElement(s.V,null),o().createElement(f.H,{position:"top-right"})))};function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function R(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var T=function(){var e=(0,y.useDataSourceManager)(),t=(0,i.kj)();return(0,r.useMemo)(function(){var n,r=e.collectionFieldInterfaceManager.getFieldInterfaces(),o=e.collectionFieldInterfaceManager.getFieldInterfaceGroups();return n=r.reduce(function(e,t){var n=t.group||"basic";return e[n]||(e[n]=[]),e[n].push(t),e},{}),Object.keys(o).map(function(e){var r=o[e];return R(C({},r),{label:m.Schema.compile(r.label,{t:t}),key:e,options:Object.keys(n[e]||{}).filter(function(t){return!n[e][t].hidden}).map(function(r){var o=n[e][r];return R(C({},n[e][r]),{key:"".concat(e,"-").concat(o.name),value:o.name,label:m.Schema.compile(o.title,{t:t})})}).sort(function(e,t){return e.order-t.order})})}).filter(function(e){return e.options.length>0}).sort(function(e,t){return e.order-t.order})},[e])};function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function D(e,t,n,r,o,l,a){try{var i=e[l](a),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function M(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){F(e,t,n[t])})}return e}function z(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function K(e,t){if(null==e)return{};var n,r,o,l={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,n=Reflect.ownKeys(Object(e));o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}if(l=function(e,t){if(null==e)return{};var n,r,o={},l=Object.getOwnPropertyNames(e);for(r=0;r<l.length;r++)n=l[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(l[r]=e[r]);return l}function N(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var l=[],a=!0,i=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(l.push(n.value),!t||l.length!==t);a=!0);}catch(e){i=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(i)throw r}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(){var e,t,n=(e=["\n .editable-cell {\n position: relative;\n }\n\n .editable-cell-value-wrap {\n padding: 5px 12px;\n cursor: pointer;\n }\n\n &:hover .editable-cell-value-wrap {\n border: 1px solid #d9d9d9;\n border-radius: 4px;\n padding: 4px 11px;\n }\n\n [data-theme='dark'] &:hover .editable-cell-value-wrap {\n border: 1px solid #434343;\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return B=function(){return n},n}var L=(0,b.cx)("editable-row",(0,b.css)(B())),G=o().createContext(null),_=function(e){e.index;var t=K(e,["index"]),n=N(l.Form.useForm(),1)[0];return o().createElement(l.Form,{form:n,component:!1},o().createElement(G.Provider,{value:n},o().createElement("tr",t)))},H=function(e){var t=e.title,n=e.editable,a=e.EditComponent,i=e.ReadComponent,c=e.children,u=e.dataIndex,s=e.record,f=(e.collectionIndex,e.handleSave),p=K(e,["title","editable","EditComponent","ReadComponent","children","dataIndex","record","collectionIndex","handleSave"]),d=N((0,r.useState)(!1),2),y=d[0],m=d[1],b=(0,r.useRef)(null),g=(0,r.useContext)(G);(0,r.useEffect)(function(){if(y){var e;null==(e=b.current)||e.focus()}},[y]);var v=function(){m(!y),g.setFieldsValue(F({},u,s[u]))},h=function(){var e;return(e=function(){var e;return function(e,t){var n,r,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(a,"next",{value:c(0)}),i(a,"throw",{value:c(1)}),i(a,"return",{value:c(2)}),"function"==typeof Symbol&&i(a,Symbol.iterator,{value:function(){return this}}),a;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return l.label++,{value:u[1],done:!1};case 5:l.label++,r=u[1],u=[0];continue;case 7:u=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){l=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){l.label=u[1];break}if(6===u[0]&&l.label<o[1]){l.label=o[1],o=u;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(u);break}o[2]&&l.ops.pop(),l.trys.pop();continue}u=t.call(e,l)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,g.validateFields()];case 1:return e=t.sent(),v(),f(M({},s,e)),[3,3];case 2:return console.log("Save failed:",t.sent()),[3,3];case 3:return[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var l=e.apply(t,n);function a(e){D(l,r,o,a,i,"next",e)}function i(e){D(l,r,o,a,i,"throw",e)}a(void 0)})})()},O=(null==i?void 0:i(s))||c;if(n){var w=(null==a?void 0:a(z(M({},s),{save:h,ref:b})))||o().createElement(l.Input,{ref:b,onPressEnter:h,onBlur:h});O=y?o().createElement(l.Form.Item,{style:{margin:0},name:u,rules:[{required:!0,message:"".concat(t," is required.")}]},w):o().createElement("div",{className:"editable-cell-value-wrap",style:{paddingInlineEnd:24},onClick:v},O)}return o().createElement("td",p,O)},U=function(e){var t=(0,i.kj)();return[{title:t("Collection display name"),dataIndex:"title",key:"title",width:200,editable:!0},{title:t("Collection name"),dataIndex:"name",key:"name",width:150,editable:!0},{title:t("Collection template"),dataIndex:"template",key:"template",width:150,render:function(e){if(!e)return null;var n=e.charAt(0).toUpperCase()+e.slice(1);return o().createElement(l.Tag,null,t("".concat(n," collection")))}},{title:t("Preset fields"),key:"preset",width:300,render:function(e,n){var r=[];return!1!==n.autoGenId&&r.push("id"),!1!==n.createdAt&&r.push("createdAt"),!1!==n.updatedAt&&r.push("updatedAt"),n.createdBy&&r.push("createdBy"),n.updatedBy&&r.push("updatedBy"),o().createElement(l.Checkbox.Group,{options:[{label:"ID",value:"id"},{label:t("Created at"),value:"createdAt"},{label:t("Last updated at"),value:"updatedAt"},{label:t("Created by"),value:"createdBy"},{label:t("Last updated by"),value:"updatedBy"}],defaultValue:r,disabled:!0})}},{title:t("Description"),dataIndex:"description",key:"description",width:350}].map(function(t){return t.editable?z(M({},t),{onCell:function(n,r){return{record:n,editable:t.editable,dataIndex:t.dataIndex,title:t.title,handleSave:function(t){return e(r,t)}}}}):t})},V=function(e,t,n){var r=(0,i.kj)(),a=(0,y.useApp)().dataSourceManager.collectionFieldInterfaceManager;return[l.Table.EXPAND_COLUMN,{title:r("Field display name"),dataIndex:"title",width:200,key:"title",editable:!0},{title:r("Field name"),dataIndex:"name",key:"name",width:150,editable:!0},{title:r("Field interface"),width:200,dataIndex:"interface",key:"interface",editable:!0,EditComponent:function(t){var n=t.interface,i=t.save,c=t.ref,u=(0,y.useRequest)({url:"app:getInfo"}),s=T(),f=a.getFieldInterface(n),p=((0,(0,y.useCollectionManager_deprecated)().getTemplate)(e.template)||{}).availableFieldInterfaces||{},d=p.exclude,b=p.include,g=[];return s.forEach(function(t){if("systemInfo"===t.key)g.push(z(M({},t),{options:t.options.filter(function(t){var n,r,o;return!t.hidden&&("tableoid"!==t.value?"boolean"!=typeof e[t.value]||e[t.value]:(null==b?void 0:b.length)?b.includes(t.value):(null==(o=u.data)||null==(r=o.data)||null==(n=r.database)?void 0:n.dialect)==="postgres")})}));else{var n,r=[];(null==b?void 0:b.length)?b.forEach(function(e){var n,o=null==t||null==(n=t.options)?void 0:n.find(function(t){return[e,e.interface].includes(t.name)});o&&r.push(z(M({},o),{targetScope:null==e?void 0:e.targetScope}))}):r=(null==d?void 0:d.length)?null==t||null==(n=t.options)?void 0:n.filter(function(e){return!d.includes(e.name)}):null==t?void 0:t.options,(null==r?void 0:r.length)&&g.push(z(M({},t),{options:r.filter(function(e){return!["o2o","subTable","linkTo"].includes(e.name)})}))}}),o().createElement(l.Select,{ref:c,options:g,defaultValue:f?m.Schema.compile(f.title,{t:r}):n,onBlur:i})},ReadComponent:function(e){var t=e.interface;if(!t)return null;var n=a.getFieldInterface(t);return o().createElement(l.Tag,null,n?m.Schema.compile(n.title,{t:r}):t)}},{title:r("Description"),dataIndex:"description",key:"description",width:350}].map(function(e){return e.editable?z(M({},e),{onCell:function(r,o){return{record:r,editable:e.editable,dataIndex:e.dataIndex,title:e.title,EditComponent:e.EditComponent,ReadComponent:e.ReadComponent,handleSave:function(e){return n(t,o,e)}}}}):e})},$=function(e){var t=e.record,n=l.theme.useToken().token;return o().createElement(o().Fragment,null,t.enum&&o().createElement("div",null,o().createElement("span",{style:{color:n.colorTextSecondary,marginRight:"8px",marginLeft:"48px"}},"Enumurations:"),t.enum.map(function(e){return o().createElement(l.Tag,{key:e.value},e.label," (",e.value,")")})),t.target&&o().createElement("div",null,o().createElement("span",{style:{color:"#999",marginRight:"8px",marginLeft:"48px"}},"Target:"),o().createElement("span",null,t.target)),t.targetKey&&o().createElement("div",null,o().createElement("span",{style:{color:"#999",marginRight:"8px",marginLeft:"48px"}},"TargetKey:"),o().createElement("span",null,t.targetKey)),t.sourceKey&&o().createElement("div",null,o().createElement("span",{style:{color:"#999",marginRight:"8px",marginLeft:"48px"}},"SourceKey:"),o().createElement("span",null,t.sourceKey)),t.foreignKey&&o().createElement("div",null,o().createElement("span",{style:{color:"#999",marginRight:"8px",marginLeft:"48px"}},"ForeignKey:"),o().createElement("span",null,t.foreignKey)),t.otherKey&&o().createElement("div",null,o().createElement("span",{style:{color:"#999",marginRight:"8px",marginLeft:"48px"}},"OtherKey:"),o().createElement("span",null,t.otherKey)))},J=function(e){var t=e.record,n=V(t,e.collectionIndex,e.updateFieldRecord);return o().createElement(l.Table,{rowKey:"name",rowClassName:L,columns:n,components:{body:{row:_,cell:H}},dataSource:t.fields,pagination:!1,expandable:{rowExpandable:function(e){var t;return(null==(t=e.enum)?void 0:t.length)>0||["m2m","m2o","o2m","o2o"].includes(e.interface)},expandedRowRender:function(e){return o().createElement($,{record:e})}}})},X=function(e){var t=e.collections,n=e.updateCollectionRecord,r=e.updateFieldRecord,a=U(n);return o().createElement(l.Table,{scroll:{y:"55vh"},style:{height:"65vh"},rowKey:"name",rowClassName:L,columns:a,dataSource:t,components:{body:{row:_,cell:H}},expandable:{expandedRowRender:function(e,t){return o().createElement(J,{record:e,collectionIndex:t,updateFieldRecord:r})},rowExpandable:function(e){return e.fields&&e.fields.length>0}}})},Y=n(107);function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function W(e,t,n,r,o,l,a){try{var i=e[l](a),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function Q(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var l=e.apply(t,n);function a(e){W(l,r,o,a,i,"next",e)}function i(e){W(l,r,o,a,i,"throw",e)}a(void 0)})}}function Z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function ee(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function et(e){return function(e){if(Array.isArray(e))return q(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return q(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return q(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function en(e,t){var n,r,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(a,"next",{value:c(0)}),i(a,"throw",{value:c(1)}),i(a,"return",{value:c(2)}),"function"==typeof Symbol&&i(a,Symbol.iterator,{value:function(){return this}}),a;function c(i){return function(c){var u=[i,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return l.label++,{value:u[1],done:!1};case 5:l.label++,r=u[1],u=[0];continue;case 7:u=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){l=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){l.label=u[1];break}if(6===u[0]&&l.label<o[1]){l.label=o[1],o=u;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(u);break}o[2]&&l.ops.pop(),l.trys.pop();continue}u=t.call(e,l)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var er=function(e){var t=(0,y.useApp)().dataSourceManager.collectionFieldInterfaceManager;return(0,r.useMemo)(function(){var n=[],r=!0,o=!1,l=void 0;try{for(var a,i=e[Symbol.iterator]();!(r=(a=i.next()).done);r=!0){var c,u=a.value,s=(null==(c=u.fields)?void 0:c.map(function(e){var n,r,o=t.getFieldInterface(e.interface);return o&&(e.type=e.type||(null==(n=o.default)?void 0:n.type),e.uiSchema=e.uiSchema||(null==(r=o.default)?void 0:r.uiSchema)),e.uiSchema=ee(Z({},e.uiSchema),{title:e.title}),e.enum&&(e.uiSchema=ee(Z({},e.uiSchema),{enum:e.enum})),e}))||[];n.push(ee(Z({},u),{hidden:!1,fields:s}))}}catch(e){o=!0,l=e}finally{try{r||null==i.return||i.return()}finally{if(o)throw l}}return n},[e])},eo=function(e){var t=e.children;return o().createElement("div",{style:{height:"70vh",overflowY:"auto"}},t)},el=function(e){var t,n=e.tool,u=e.saveToolArgs,s=(0,i.kj)(),f=er("string"==((t=n.args.collections)&&"u">typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)?JSON.parse(n.args.collections):n.args.collections),p=Y.y.use.setAdjustArgs(),d={updateCollectionRecord:(0,r.useCallback)(function(e,t){return Q(function(){var r;return en(this,function(o){return(r=et(n.args.collections))[e]&&(r[e]=Z({},r[e],t),u(ee(Z({},n.args),{collections:r}))),[2]})})()},[n,u]),updateFieldRecord:(0,r.useCallback)(function(e,t,r){return Q(function(){var o,l,a,i;return en(this,function(c){return(null==(l=(a=et(n.args.collections))[e])||null==(o=l.fields)?void 0:o[t])&&(i=a[e].fields[t],a[e].fields[t]=Z({},i,r),u(ee(Z({},n.args),{collections:a}))),[2]})})()},[n,u])},y=d.updateCollectionRecord,m=d.updateFieldRecord;(0,r.useEffect)(function(){p(ee(Z({},n.args),{collections:f}))},[n.args,n.args.collections,p]);var b=[{key:"collections",label:s("Collections"),icon:o().createElement(a.DatabaseOutlined,null),children:o().createElement(X,{collections:f,updateCollectionRecord:y,updateFieldRecord:m})},{key:"graph",icon:o().createElement(a.NodeIndexOutlined,null),label:s("Diagram"),children:o().createElement(eo,null,o().createElement(I,{collections:f}))},{key:"definition",icon:o().createElement(a.FileTextOutlined,null),label:"Definition",children:o().createElement(eo,null,o().createElement(c.Rs,{language:"json",value:JSON.stringify(f,null,2)}))}];return o().createElement(l.Tabs,{defaultActiveKey:"1",items:b})}}}]);
|