@vyr/gateway 0.0.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/package.json +16 -0
- package/src/Operation.ts +112 -0
- package/src/UseRecord.ts +48 -0
- package/src/VirtualNode.ts +97 -0
- package/src/api/asset/add.ts +34 -0
- package/src/api/asset/close.ts +23 -0
- package/src/api/asset/copy.ts +22 -0
- package/src/api/asset/create.ts +31 -0
- package/src/api/asset/cut.ts +22 -0
- package/src/api/asset/delete.ts +21 -0
- package/src/api/asset/download.ts +14 -0
- package/src/api/asset/dragdrap.ts +32 -0
- package/src/api/asset/index.ts +14 -0
- package/src/api/asset/initialize.ts +16 -0
- package/src/api/asset/open.ts +23 -0
- package/src/api/asset/remove.ts +22 -0
- package/src/api/asset/rename.ts +22 -0
- package/src/api/asset/update.ts +26 -0
- package/src/api/asset/upload.ts +13 -0
- package/src/api/chat/create.ts +12 -0
- package/src/api/chat/delete.ts +12 -0
- package/src/api/chat/index.ts +5 -0
- package/src/api/chat/list.ts +14 -0
- package/src/api/chat/prefix.ts +3 -0
- package/src/api/chat/stop.ts +14 -0
- package/src/api/dataset/createDatasource.ts +18 -0
- package/src/api/dataset/createInterface.ts +18 -0
- package/src/api/dataset/deleteDatasource.ts +18 -0
- package/src/api/dataset/deleteInterface.ts +18 -0
- package/src/api/dataset/executeInterface.ts +20 -0
- package/src/api/dataset/index.ts +7 -0
- package/src/api/dataset/listDatasource.ts +19 -0
- package/src/api/dataset/listInterface.ts +19 -0
- package/src/api/dep/add.ts +10 -0
- package/src/api/dep/create.ts +10 -0
- package/src/api/dep/delete.ts +10 -0
- package/src/api/dep/index.ts +5 -0
- package/src/api/dep/remove.ts +10 -0
- package/src/api/dep/update.ts +10 -0
- package/src/api/index.ts +27 -0
- package/src/api/prefab/apply.ts +16 -0
- package/src/api/prefab/create.ts +17 -0
- package/src/api/prefab/delete.ts +14 -0
- package/src/api/prefab/download.ts +17 -0
- package/src/api/prefab/index.ts +7 -0
- package/src/api/prefab/initialize.ts +12 -0
- package/src/api/prefab/list.ts +17 -0
- package/src/api/prefab/upload.ts +13 -0
- package/src/api/system/config.ts +11 -0
- package/src/api/system/confirm.ts +29 -0
- package/src/api/system/connection.ts +13 -0
- package/src/api/system/disconnect.ts +12 -0
- package/src/api/system/index.ts +7 -0
- package/src/api/system/redo.ts +12 -0
- package/src/api/system/undo.ts +12 -0
- package/src/api/user/getUser.ts +12 -0
- package/src/api/user/index.ts +3 -0
- package/src/api/user/login.ts +17 -0
- package/src/api/user/logout.ts +11 -0
- package/src/domain/ChatWindow.ts +10 -0
- package/src/domain/Datasource.ts +24 -0
- package/src/domain/Interface.ts +22 -0
- package/src/domain/Prefab.ts +12 -0
- package/src/domain/User.ts +11 -0
- package/src/domain/index.ts +5 -0
- package/src/index.ts +6 -0
- package/src/locale/Language.ts +6 -0
- package/src/locale/LanguageProvider.ts +201 -0
- package/src/locale/index.ts +2 -0
- package/src/utils/index.ts +15 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import * as prefix from './prefix'
|
|
4
|
+
|
|
5
|
+
export const path = `${prefix.path}/stop`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({
|
|
9
|
+
runId: z.string().describe(language.get('api.chat.stop.runId')),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const responseSchema = z.object({
|
|
13
|
+
success: z.boolean()
|
|
14
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
3
|
+
import { DatasourceIdSchema, DatasourceSchema } from '../../domain'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/dataset.datasource.create`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const input = DatasourceSchema.omit({ id: true })
|
|
9
|
+
|
|
10
|
+
const resultSchema = z.object({ id: DatasourceIdSchema })
|
|
11
|
+
|
|
12
|
+
export const output = z.union([
|
|
13
|
+
outputErrortSchema,
|
|
14
|
+
resultSchema,
|
|
15
|
+
])
|
|
16
|
+
|
|
17
|
+
export const requestSchema = input
|
|
18
|
+
export const responseSchema = resultSchema
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
3
|
+
import { InterfaceIdSchema, InterfaceSchema } from '../../domain'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/dataset.interface.create`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const input = InterfaceSchema.omit({ id: true })
|
|
9
|
+
|
|
10
|
+
const resultSchema = z.object({ id: InterfaceIdSchema })
|
|
11
|
+
|
|
12
|
+
export const output = z.union([
|
|
13
|
+
outputErrortSchema,
|
|
14
|
+
resultSchema,
|
|
15
|
+
])
|
|
16
|
+
|
|
17
|
+
export const requestSchema = input
|
|
18
|
+
export const responseSchema = resultSchema
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { DatasourceIdSchema } from '../../domain'
|
|
3
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/dataset.datasource.delete`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const input = z.object({
|
|
9
|
+
id: DatasourceIdSchema,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const output = z.union([
|
|
13
|
+
outputErrortSchema,
|
|
14
|
+
z.object({}),
|
|
15
|
+
])
|
|
16
|
+
|
|
17
|
+
export const requestSchema = input
|
|
18
|
+
export const responseSchema = z.void()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { InterfaceIdSchema } from '../../domain'
|
|
3
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/dataset.interface.delete`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const input = z.object({
|
|
9
|
+
id: InterfaceIdSchema,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const output = z.union([
|
|
13
|
+
outputErrortSchema,
|
|
14
|
+
z.object({}),
|
|
15
|
+
])
|
|
16
|
+
|
|
17
|
+
export const requestSchema = input
|
|
18
|
+
export const responseSchema = z.void()
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
3
|
+
import { InterfaceIdSchema } from '../../domain'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/dataset.interface.execute`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const input = z.object({
|
|
9
|
+
id: InterfaceIdSchema
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
const result = z.object({ result: z.any() })
|
|
13
|
+
|
|
14
|
+
export const output = z.union([
|
|
15
|
+
outputErrortSchema,
|
|
16
|
+
result,
|
|
17
|
+
])
|
|
18
|
+
|
|
19
|
+
export const requestSchema = input
|
|
20
|
+
export const responseSchema = result
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * as createDatasource from './createDatasource'
|
|
2
|
+
export * as createInterface from './createInterface'
|
|
3
|
+
export * as listDatasource from './listDatasource'
|
|
4
|
+
export * as listInterface from './listInterface'
|
|
5
|
+
export * as deleteDatasource from './deleteDatasource'
|
|
6
|
+
export * as deleteInterface from './deleteInterface'
|
|
7
|
+
export * as executeInterface from './executeInterface'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
4
|
+
import { DatasourceSchema } from '../../domain'
|
|
5
|
+
|
|
6
|
+
export const path = `${baseApi}/dataset.datasource.list`
|
|
7
|
+
export const method = 'POST'
|
|
8
|
+
|
|
9
|
+
export const input = DatasourceSchema.clone().partial().describe(language.get('api.dataset.list.condition'))
|
|
10
|
+
|
|
11
|
+
const result = z.object({ list: z.array(DatasourceSchema) })
|
|
12
|
+
|
|
13
|
+
export const output = z.union([
|
|
14
|
+
outputErrortSchema,
|
|
15
|
+
result,
|
|
16
|
+
])
|
|
17
|
+
|
|
18
|
+
export const requestSchema = input
|
|
19
|
+
export const responseSchema = result
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
4
|
+
import { InterfaceSchema } from '../../domain'
|
|
5
|
+
|
|
6
|
+
export const path = `${baseApi}/dataset.interface.list`
|
|
7
|
+
export const method = 'POST'
|
|
8
|
+
|
|
9
|
+
export const input = InterfaceSchema.clone().partial().describe(language.get('api.dataset.list.condition'))
|
|
10
|
+
|
|
11
|
+
const result = z.object({ list: z.array(InterfaceSchema) })
|
|
12
|
+
|
|
13
|
+
export const output = z.union([
|
|
14
|
+
outputErrortSchema,
|
|
15
|
+
result,
|
|
16
|
+
])
|
|
17
|
+
|
|
18
|
+
export const requestSchema = input
|
|
19
|
+
export const responseSchema = result
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/dep.add`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({
|
|
9
|
+
url: z.string().describe(language.get('api.dep.add.url')),
|
|
10
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/dep.create`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({
|
|
9
|
+
url: z.string().describe(language.get('api.dep.create.url')),
|
|
10
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/dep.delete`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({
|
|
9
|
+
url: z.string().describe(language.get('api.dep.delete.url')),
|
|
10
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/dep.remove`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({
|
|
9
|
+
url: z.string().describe(language.get('api.dep.remove.url')),
|
|
10
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/dep.update`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({
|
|
9
|
+
url: z.string().describe(language.get('api.dep.update.url')),
|
|
10
|
+
})
|
package/src/api/index.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as system from './system'
|
|
2
|
+
import * as dataset from './dataset'
|
|
3
|
+
import * as user from './user'
|
|
4
|
+
import * as asset from './asset'
|
|
5
|
+
import * as prefab from './prefab'
|
|
6
|
+
import * as chat from './chat'
|
|
7
|
+
import * as dep from './dep'
|
|
8
|
+
|
|
9
|
+
export interface Confirm {
|
|
10
|
+
type?: string
|
|
11
|
+
title?: string
|
|
12
|
+
message?: string
|
|
13
|
+
value: any
|
|
14
|
+
options: { label?: string, value?: string }[]
|
|
15
|
+
mode?: string
|
|
16
|
+
success: boolean
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const api = {
|
|
20
|
+
system,
|
|
21
|
+
dataset,
|
|
22
|
+
user,
|
|
23
|
+
asset,
|
|
24
|
+
prefab,
|
|
25
|
+
chat,
|
|
26
|
+
dep,
|
|
27
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/prefab.apply`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({
|
|
9
|
+
id: z.string().describe(language.get('api.prefab.apply.id')),
|
|
10
|
+
url: z.string().describe(language.get('api.prefab.apply.url')),
|
|
11
|
+
node: z.string().describe(language.get('api.prefab.apply.node')),
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const responseSchema = z.void()
|
|
15
|
+
|
|
16
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi } from '../../utils'
|
|
4
|
+
import { PrefabSchema } from '../../domain'
|
|
5
|
+
|
|
6
|
+
export const path = `${baseApi}/prefab.create`
|
|
7
|
+
export const method = 'POST'
|
|
8
|
+
|
|
9
|
+
export const requestSchema = PrefabSchema.omit({ id: true }).extend({
|
|
10
|
+
node: z.string().describe(language.get('api.prefab.create.node')),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export const responseSchema = z.object({
|
|
14
|
+
id: z.string().describe(language.get('api.prefab.create.id')),
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/prefab.delete`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({
|
|
9
|
+
id: z.string().describe(language.get('api.prefab.delete.id')),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const responseSchema = z.void()
|
|
13
|
+
|
|
14
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi, fileIdSchema } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/prefab.download`
|
|
6
|
+
export const method = 'GET'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({
|
|
9
|
+
id: z.string().describe(language.get('api.prefab.download.id')),
|
|
10
|
+
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export const responseSchema = z.object({
|
|
14
|
+
id: fileIdSchema
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export const noticeSchema = z.any()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { baseApi } from '../../utils'
|
|
3
|
+
|
|
4
|
+
export const path = `${baseApi}/prefab.initialize`
|
|
5
|
+
export const method = 'POST'
|
|
6
|
+
|
|
7
|
+
export const requestSchema = z.object({
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export const responseSchema = z.void()
|
|
11
|
+
|
|
12
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi } from '../../utils'
|
|
4
|
+
import { PrefabSchema } from '../../domain'
|
|
5
|
+
|
|
6
|
+
export const path = `${baseApi}/prefab.list`
|
|
7
|
+
export const method = 'POST'
|
|
8
|
+
|
|
9
|
+
export const requestSchema = z.object({
|
|
10
|
+
name: z.string().describe(language.get('api.prefab.list.name')),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export const responseSchema = z.object({
|
|
14
|
+
list: z.array(PrefabSchema).describe(language.get('api.prefab.list.list')),
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { baseApi, fileIdSchema } from '../../utils'
|
|
3
|
+
|
|
4
|
+
export const path = `${baseApi}/prefab.upload`
|
|
5
|
+
export const method = 'POST'
|
|
6
|
+
|
|
7
|
+
export const requestSchema = z.object({
|
|
8
|
+
id: fileIdSchema
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const responseSchema = z.void()
|
|
12
|
+
|
|
13
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { baseApi } from '../../utils'
|
|
3
|
+
|
|
4
|
+
export const path = `${baseApi}/system.config`
|
|
5
|
+
export const method = 'GET'
|
|
6
|
+
|
|
7
|
+
export const requestSchema = z.object({})
|
|
8
|
+
|
|
9
|
+
export const responseSchema = z.record(z.string(), z.any())
|
|
10
|
+
|
|
11
|
+
export const noticeSchema = z.object({})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/system.confirm`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const confirmDataSchema = z.object({
|
|
9
|
+
uuid: z.string().describe(language.get('api.system.confirm.uuid')),
|
|
10
|
+
type: z.string().optional().describe(language.get('api.system.confirm.type')),
|
|
11
|
+
title: z.string().optional().describe(language.get('api.system.confirm.title')),
|
|
12
|
+
message: z.string().optional().describe(language.get('api.system.confirm.message')),
|
|
13
|
+
value: z.any().describe(language.get('api.system.confirm.value')),
|
|
14
|
+
options: z.array(z.object({
|
|
15
|
+
label: z.string().optional().describe(language.get('api.system.confirm.options.label')),
|
|
16
|
+
value: z.string().optional().describe(language.get('api.system.confirm.options.value'))
|
|
17
|
+
})).describe(language.get('api.system.confirm.options')),
|
|
18
|
+
mode: z.string().optional().describe(language.get('api.system.confirm.mode')),
|
|
19
|
+
timeout: z.number().describe(language.get('api.system.confirm.timeout')),
|
|
20
|
+
success: z.boolean().describe(language.get('api.system.confirm.success'))
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export const requestSchema = z.object({
|
|
24
|
+
data: confirmDataSchema.describe(language.get('api.system.confirm.data')),
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export const responseSchema = z.void()
|
|
28
|
+
|
|
29
|
+
export const noticeSchema = requestSchema
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { baseApi, clientSchema } from '../../utils'
|
|
3
|
+
|
|
4
|
+
export const path = `${baseApi}/system.connection`
|
|
5
|
+
export const method = 'POST'
|
|
6
|
+
|
|
7
|
+
export const requestSchema = z.object({})
|
|
8
|
+
|
|
9
|
+
export const responseSchema = z.void()
|
|
10
|
+
|
|
11
|
+
export const noticeSchema = z.object({
|
|
12
|
+
client: clientSchema
|
|
13
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { baseApi } from '../../utils'
|
|
3
|
+
|
|
4
|
+
export const path = `${baseApi}/system.disconnect`
|
|
5
|
+
export const method = 'POST'
|
|
6
|
+
|
|
7
|
+
export const requestSchema = z.object({
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export const responseSchema = z.void()
|
|
11
|
+
|
|
12
|
+
export const noticeSchema = requestSchema
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { baseApi } from '../../utils'
|
|
3
|
+
|
|
4
|
+
export const path = `${baseApi}/system.redo`
|
|
5
|
+
export const method = 'POST'
|
|
6
|
+
|
|
7
|
+
export const requestSchema = z.object({
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export const responseSchema = z.void()
|
|
11
|
+
|
|
12
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { baseApi } from '../../utils'
|
|
3
|
+
|
|
4
|
+
export const path = `${baseApi}/system.undo`
|
|
5
|
+
export const method = 'POST'
|
|
6
|
+
|
|
7
|
+
export const requestSchema = z.object({
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export const responseSchema = z.void()
|
|
11
|
+
|
|
12
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { baseApi } from '../../utils'
|
|
3
|
+
import { userSchema } from '../../domain'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/user.getUser`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({})
|
|
9
|
+
|
|
10
|
+
export const responseSchema = z.union([userSchema, z.null()])
|
|
11
|
+
|
|
12
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/user.login`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({
|
|
9
|
+
username: z.string().describe(language.get('api.user.login.username')),
|
|
10
|
+
password: z.string().describe(language.get('api.user.login.password')),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export const responseSchema = z.object({
|
|
14
|
+
token: z.string().describe(language.get('api.user.login.token'))
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { baseApi } from '../../utils'
|
|
3
|
+
|
|
4
|
+
export const path = `${baseApi}/user.logout`
|
|
5
|
+
export const method = 'POST'
|
|
6
|
+
|
|
7
|
+
export const requestSchema = z.object({})
|
|
8
|
+
|
|
9
|
+
export const responseSchema = z.void()
|
|
10
|
+
|
|
11
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../locale'
|
|
3
|
+
|
|
4
|
+
export const chatWindowSchema = z.object({
|
|
5
|
+
id: z.string().describe(language.get('domain.chatWindow.id')),
|
|
6
|
+
title: z.string().describe(language.get('domain.chatWindow.title')),
|
|
7
|
+
agentId: z.string().describe(language.get('domain.chatWindow.agentId')),
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export type ChatWindow = z.infer<typeof chatWindowSchema>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../locale'
|
|
3
|
+
|
|
4
|
+
export const DatasourceIdSchema = z.string().describe(language.get('domain.datasource.id'))
|
|
5
|
+
|
|
6
|
+
export const PostgresDatasourceConfigSchema = z.object({
|
|
7
|
+
type: z.enum(['postgres', 'mysql']).default('postgres').describe(language.get('domain.datasource.type')),
|
|
8
|
+
host: z.string().describe(language.get('domain.datasource.config.host')),
|
|
9
|
+
port: z.number().describe(language.get('domain.datasource.config.port')),
|
|
10
|
+
username: z.string().describe(language.get('domain.datasource.config.username')),
|
|
11
|
+
password: z.string().describe(language.get('domain.datasource.config.password')),
|
|
12
|
+
database: z.string().describe(language.get('domain.datasource.config.database')),
|
|
13
|
+
}).describe(language.get('domain.datasource.config'))
|
|
14
|
+
|
|
15
|
+
export type PostgresDatasourceConfig = z.infer<typeof PostgresDatasourceConfigSchema>
|
|
16
|
+
|
|
17
|
+
export const DatasourceSchema = z.object({
|
|
18
|
+
id: DatasourceIdSchema,
|
|
19
|
+
name: z.string().describe(language.get('domain.datasource.name')),
|
|
20
|
+
description: z.string().describe(language.get('domain.datasource.description')),
|
|
21
|
+
config: PostgresDatasourceConfigSchema,
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
export type Datasource = z.infer<typeof DatasourceSchema>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../locale'
|
|
3
|
+
import { DatasourceIdSchema } from './Datasource'
|
|
4
|
+
|
|
5
|
+
export const InterfaceIdSchema = z.string().describe(language.get('domain.interface.id'))
|
|
6
|
+
|
|
7
|
+
export const SqlInterfaceConfigSchema = z.object({
|
|
8
|
+
sql: z.string().describe(language.get('domain.interface.config.sql')),
|
|
9
|
+
datasourceId: DatasourceIdSchema
|
|
10
|
+
}).describe(language.get('domain.interface.config'))
|
|
11
|
+
|
|
12
|
+
export type SqlInterfaceConfig = z.infer<typeof SqlInterfaceConfigSchema>
|
|
13
|
+
|
|
14
|
+
export const InterfaceSchema = z.object({
|
|
15
|
+
id: InterfaceIdSchema,
|
|
16
|
+
name: z.string().describe(language.get('domain.interface.name')),
|
|
17
|
+
description: z.string().describe(language.get('domain.interface.description')),
|
|
18
|
+
type: z.enum(['sql']).describe(language.get('domain.interface.type')),
|
|
19
|
+
config: SqlInterfaceConfigSchema,
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export type Interface = z.infer<typeof InterfaceSchema>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../locale'
|
|
3
|
+
|
|
4
|
+
export const PrefabSchema = z.object({
|
|
5
|
+
id: z.string().describe(language.get('domain.prefab.id')),
|
|
6
|
+
name: z.string().describe(language.get('domain.prefab.name')),
|
|
7
|
+
image: z.string().describe(language.get('domain.prefab.image')),
|
|
8
|
+
tags: z.string().describe(language.get('domain.prefab.tags')),
|
|
9
|
+
description: z.string().describe(language.get('domain.prefab.description')),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export type Prefab = z.infer<typeof PrefabSchema>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../locale'
|
|
3
|
+
|
|
4
|
+
export const userSchema = z.object({
|
|
5
|
+
id: z.string().describe(language.get('domain.user.id')),
|
|
6
|
+
username: z.string().describe(language.get('domain.user.username')),
|
|
7
|
+
password: z.string().describe(language.get('domain.user.password')),
|
|
8
|
+
role: z.string().describe(language.get('domain.user.role')),
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export type User = z.infer<typeof userSchema>
|
package/src/index.ts
ADDED