@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
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vyr/gateway",
|
|
3
|
+
"version": "0.0.34",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./src/index.ts",
|
|
6
|
+
"author": "",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@vyr/engine": "0.0.34",
|
|
10
|
+
"moment": "^2.30.1"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"package.json",
|
|
14
|
+
"src/"
|
|
15
|
+
]
|
|
16
|
+
}
|
package/src/Operation.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Generate } from "@vyr/engine"
|
|
2
|
+
|
|
3
|
+
const privateState = {
|
|
4
|
+
assetHistroryCollection: new Map<string, { undo: string[], redo: string[] }>(),
|
|
5
|
+
executeCollection: new Map<string, Operation[]>(),
|
|
6
|
+
inverse: (operation: Operation) => {
|
|
7
|
+
const Constructor = operation.constructor as typeof Operation
|
|
8
|
+
//@ts-ignore
|
|
9
|
+
const inverseOperation = new Constructor({ ...operation, inverse: !operation.inverse })
|
|
10
|
+
return inverseOperation
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export abstract class Operation {
|
|
15
|
+
/**撤销上一次的操作 */
|
|
16
|
+
static undo(trigger: string) {
|
|
17
|
+
const executeCollection = privateState.executeCollection.get(trigger)
|
|
18
|
+
if (executeCollection === undefined || executeCollection.length === 0) return
|
|
19
|
+
const operation = executeCollection[executeCollection.length - 1]
|
|
20
|
+
const current = operation.inverse ? operation.undo : operation;
|
|
21
|
+
if (current === null) return;
|
|
22
|
+
for (const asset of current.assets) {
|
|
23
|
+
const assetHistrory = privateState.assetHistroryCollection.get(asset)
|
|
24
|
+
if (assetHistrory === undefined || assetHistrory.undo.length === 0) return
|
|
25
|
+
const endTrigger = assetHistrory.undo[assetHistrory.undo.length - 1]
|
|
26
|
+
if (endTrigger !== trigger) return
|
|
27
|
+
}
|
|
28
|
+
const inverseOperation = privateState.inverse(current)
|
|
29
|
+
this.execute(inverseOperation)
|
|
30
|
+
}
|
|
31
|
+
/**重做上一次的操作 */
|
|
32
|
+
static redo(trigger: string) {
|
|
33
|
+
const executeCollection = privateState.executeCollection.get(trigger)
|
|
34
|
+
if (executeCollection === undefined || executeCollection.length === 0) return
|
|
35
|
+
const operation = executeCollection[executeCollection.length - 1]
|
|
36
|
+
const current = operation.inverse ? operation : operation.redo;
|
|
37
|
+
if (current === null) return;
|
|
38
|
+
for (const asset of current.assets) {
|
|
39
|
+
const assetHistrory = privateState.assetHistroryCollection.get(asset)
|
|
40
|
+
if (assetHistrory === undefined || assetHistrory.redo.length === 0) return
|
|
41
|
+
const endTrigger = assetHistrory.redo[assetHistrory.redo.length - 1]
|
|
42
|
+
if (endTrigger !== trigger) return
|
|
43
|
+
}
|
|
44
|
+
const inverseOperation = privateState.inverse(current)
|
|
45
|
+
this.execute(inverseOperation)
|
|
46
|
+
}
|
|
47
|
+
/**执行一次操作 */
|
|
48
|
+
static execute(operation: Operation) {
|
|
49
|
+
//将操作添加到对应的执行集合中
|
|
50
|
+
let executeCollection = privateState.executeCollection.get(operation.trigger)
|
|
51
|
+
if (executeCollection === undefined) {
|
|
52
|
+
executeCollection = []
|
|
53
|
+
privateState.executeCollection.set(operation.trigger, executeCollection)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//为操作绑定撤销、重做链接
|
|
57
|
+
const bind = executeCollection[executeCollection.length - 1]
|
|
58
|
+
if (bind !== undefined) {
|
|
59
|
+
if (operation.inverse) {
|
|
60
|
+
operation.redo = bind.inverse ? bind : bind.redo
|
|
61
|
+
} else {
|
|
62
|
+
operation.undo = bind.inverse ? bind.undo : bind
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
operation.throwIfOperationUnavailable()
|
|
67
|
+
operation.execute()
|
|
68
|
+
|
|
69
|
+
//将操作添加到对应的目标集合中
|
|
70
|
+
for (const asset of operation.assets) {
|
|
71
|
+
let assetHistrory = privateState.assetHistroryCollection.get(asset)
|
|
72
|
+
if (assetHistrory === undefined) {
|
|
73
|
+
assetHistrory = { undo: [], redo: [] }
|
|
74
|
+
privateState.assetHistroryCollection.set(asset, assetHistrory)
|
|
75
|
+
}
|
|
76
|
+
if (operation.inverse) {
|
|
77
|
+
assetHistrory.redo.push(operation.trigger)
|
|
78
|
+
if (assetHistrory.undo[assetHistrory.undo.length - 1] === operation.trigger) assetHistrory.undo.pop()
|
|
79
|
+
} else {
|
|
80
|
+
assetHistrory.undo.push(operation.trigger)
|
|
81
|
+
if (assetHistrory.redo[assetHistrory.redo.length - 1] === operation.trigger) assetHistrory.redo.pop()
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
executeCollection.push(operation)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
readonly mark: string
|
|
89
|
+
/**操作涉及的资产 */
|
|
90
|
+
readonly assets: string[]
|
|
91
|
+
/**操作的触发者 */
|
|
92
|
+
readonly trigger: string
|
|
93
|
+
/**是否为逆操作 */
|
|
94
|
+
inverse: boolean
|
|
95
|
+
undo: Operation | null
|
|
96
|
+
redo: Operation | null
|
|
97
|
+
|
|
98
|
+
constructor(operation: Partial<Operation> = {}) {
|
|
99
|
+
this.mark = operation.mark ?? Generate.uuid()
|
|
100
|
+
this.assets = operation.assets ?? []
|
|
101
|
+
this.trigger = operation.trigger ?? ''
|
|
102
|
+
this.inverse = operation.inverse ?? false
|
|
103
|
+
this.undo = operation.undo ?? null
|
|
104
|
+
this.redo = operation.redo ?? null
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
abstract execute(): void
|
|
108
|
+
|
|
109
|
+
/**若操作不可用则抛出错误 */
|
|
110
|
+
abstract throwIfOperationUnavailable(): void
|
|
111
|
+
}
|
|
112
|
+
|
package/src/UseRecord.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ArrayUtils, DeserializationObject } from "@vyr/engine"
|
|
2
|
+
|
|
3
|
+
export class UseRecord {
|
|
4
|
+
record: { [uuid: string]: string[] } = {}
|
|
5
|
+
|
|
6
|
+
addUser(url: string, client: string) {
|
|
7
|
+
if (this.record[url] === undefined) this.record[url] = []
|
|
8
|
+
ArrayUtils.insert(this.record[url], client)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
removeUser(url: string, client: string) {
|
|
12
|
+
const record = this.record[url]
|
|
13
|
+
if (Array.isArray(record) === false) return
|
|
14
|
+
ArrayUtils.remove(record, client)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
hasUser(url: string, client: string) {
|
|
18
|
+
if (this.record[url] === undefined) return false
|
|
19
|
+
return this.record[url].indexOf(client) > -1 ? true : false
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
clearUser(client: string) {
|
|
23
|
+
const urls = Object.keys(this.record)
|
|
24
|
+
for (const url of urls) {
|
|
25
|
+
this.removeUser(url, client)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
clear(url: string) {
|
|
30
|
+
delete this.record[url]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
copy(useRecord: DeserializationObject<UseRecord>) {
|
|
34
|
+
this.record = useRecord.record
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
isOperable(url: string, client: string) {
|
|
38
|
+
const record = this.record[url]
|
|
39
|
+
if (Array.isArray(record) === false || record.length === 0) return true
|
|
40
|
+
return record.indexOf(client) === 0 ? true : false
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
isDelete(url: string, client: string) {
|
|
44
|
+
const record = this.record[url]
|
|
45
|
+
if (Array.isArray(record) === false || record.length === 0) return true
|
|
46
|
+
return record.length === 1 && record.indexOf(client) === 0 ? true : false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { ArrayUtils, Descriptor, DeserializationObject } from "@vyr/engine"
|
|
2
|
+
|
|
3
|
+
/**虚拟资产,包含目录或文件的基本信息 */
|
|
4
|
+
export class VirtualNode extends Descriptor {
|
|
5
|
+
static scheme = '/static'
|
|
6
|
+
static type = 'VirtualNode'
|
|
7
|
+
/**虚拟资产的类型是否为文件 */
|
|
8
|
+
readonly fileType: boolean
|
|
9
|
+
/**虚拟资产是否可见 */
|
|
10
|
+
readonly visible: boolean
|
|
11
|
+
/**虚拟资产的请求地址 */
|
|
12
|
+
readonly url: string
|
|
13
|
+
/**虚拟资产的父节点 */
|
|
14
|
+
readonly parent: string
|
|
15
|
+
/**虚拟资产的用户队列,按顺序存储用户的表示 */
|
|
16
|
+
readonly userQueue: string[]
|
|
17
|
+
/**虚拟资产的所有子路径 */
|
|
18
|
+
declare children: VirtualNode[]
|
|
19
|
+
/**虚拟资产的后缀 */
|
|
20
|
+
readonly suffix: string
|
|
21
|
+
/**虚拟资产的类别
|
|
22
|
+
* - ts 脚本
|
|
23
|
+
* - material 材质
|
|
24
|
+
* - geometry 几何体
|
|
25
|
+
* - texture 纹理
|
|
26
|
+
* - image 图片
|
|
27
|
+
* - video 视频
|
|
28
|
+
* - audio 音频
|
|
29
|
+
* - other 其他(未被识别的文件)
|
|
30
|
+
*/
|
|
31
|
+
readonly category: string
|
|
32
|
+
/**虚拟资产的名称 */
|
|
33
|
+
declare name: string
|
|
34
|
+
|
|
35
|
+
constructor(meta: Partial<DeserializationObject<VirtualNode>>) {
|
|
36
|
+
super({ ...meta, children: meta.children })
|
|
37
|
+
this.fileType = meta.fileType ?? false
|
|
38
|
+
this.visible = meta.visible ?? true
|
|
39
|
+
this.url = meta.url ?? this.uuid
|
|
40
|
+
this.parent = meta.parent ?? ''
|
|
41
|
+
this.userQueue = meta.userQueue ?? []
|
|
42
|
+
this.suffix = meta.suffix ?? ''
|
|
43
|
+
this.category = meta.category ?? ''
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
sort() {
|
|
47
|
+
const dirs = []
|
|
48
|
+
const files = []
|
|
49
|
+
for (const sub of this.children) sub.fileType ? files.push(sub) : dirs.push(sub)
|
|
50
|
+
dirs.sort((a, b) => a.url.localeCompare(b.url))
|
|
51
|
+
files.sort((a, b) => a.url.localeCompare(b.url))
|
|
52
|
+
this.clear()
|
|
53
|
+
this.add(...dirs, ...files)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
addUser(user: string) {
|
|
57
|
+
ArrayUtils.insert(this.userQueue, user)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
removeUser(user: string) {
|
|
61
|
+
ArrayUtils.remove(this.userQueue, user)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
hasUser(user: string) {
|
|
65
|
+
return this.userQueue.indexOf(user) > -1 ? true : false
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
clearUser(user: string) {
|
|
69
|
+
this.traverse<VirtualNode>((sub) => sub.removeUser(user))
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
getUniqueName(name: string, suffix: string) {
|
|
73
|
+
let count = 0
|
|
74
|
+
let curName = name
|
|
75
|
+
|
|
76
|
+
const subs: VirtualNode[] = [...this.children]
|
|
77
|
+
while (subs.length) {
|
|
78
|
+
const sub = subs.pop() as VirtualNode
|
|
79
|
+
if (sub.suffix !== suffix) continue
|
|
80
|
+
const i = sub.name.indexOf(curName)
|
|
81
|
+
if (i === 0) {
|
|
82
|
+
count++
|
|
83
|
+
curName = name + count
|
|
84
|
+
subs.length = 0
|
|
85
|
+
subs.push(...this.children)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return curName
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
isEditable(user: string) {
|
|
93
|
+
if (this.userQueue.length === 0) return true
|
|
94
|
+
return this.userQueue.indexOf(user) === 0 ? true : false
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
Descriptor.register(VirtualNode)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/asset.node.add`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const nodeSchema = z.object({
|
|
9
|
+
type: z.string(),
|
|
10
|
+
uuid: z.string()
|
|
11
|
+
}).catchall(z.any()).describe(language.get('api.asset.add.node'))
|
|
12
|
+
|
|
13
|
+
export const baseRequestSchema = z.object({
|
|
14
|
+
url: z.string().describe(language.get('api.asset.add.url')),
|
|
15
|
+
parent: z.string().describe(language.get('api.asset.add.parent')),
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export const input = baseRequestSchema.extend({
|
|
19
|
+
node: nodeSchema,
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export const output = z.union([
|
|
23
|
+
outputErrortSchema,
|
|
24
|
+
z.object(),
|
|
25
|
+
])
|
|
26
|
+
|
|
27
|
+
export const requestSchema = baseRequestSchema.extend({
|
|
28
|
+
node: z.array(nodeSchema).describe(language.get('api.asset.add.nodeArray')),
|
|
29
|
+
next: z.string().optional().default("").describe(language.get('api.asset.add.next')),
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
export const responseSchema = z.void()
|
|
33
|
+
|
|
34
|
+
export const noticeSchema = requestSchema
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi, clientSchema, outputErrortSchema } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/asset.close`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const input = z.object({
|
|
9
|
+
url: z.string().describe(language.get('api.asset.close.url')),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const output = z.union([
|
|
13
|
+
outputErrortSchema,
|
|
14
|
+
z.object(),
|
|
15
|
+
])
|
|
16
|
+
|
|
17
|
+
export const requestSchema = input
|
|
18
|
+
|
|
19
|
+
export const responseSchema = z.void()
|
|
20
|
+
|
|
21
|
+
export const noticeSchema = input.extend({
|
|
22
|
+
client: clientSchema
|
|
23
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/asset.copy`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const input = z.object({
|
|
9
|
+
urls: z.array(z.string()).describe(language.get('api.asset.copy.urls')),
|
|
10
|
+
target: z.string().describe(language.get('api.asset.copy.target')),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export const output = z.union([
|
|
14
|
+
outputErrortSchema,
|
|
15
|
+
z.object(),
|
|
16
|
+
])
|
|
17
|
+
|
|
18
|
+
export const requestSchema = input
|
|
19
|
+
|
|
20
|
+
export const responseSchema = z.void()
|
|
21
|
+
|
|
22
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/asset.create`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const input = z.object({
|
|
9
|
+
name: z.string().regex(/^[a-zA-Z0-9_-]+$/, { message: language.get('api.asset.create.name.invalid') }).describe(language.get('api.asset.create.name')),
|
|
10
|
+
parent: z.string().optional().default('/static:/').describe(language.get('api.asset.create.parent')),
|
|
11
|
+
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const output = z.union([
|
|
15
|
+
outputErrortSchema,
|
|
16
|
+
z.object(),
|
|
17
|
+
])
|
|
18
|
+
|
|
19
|
+
export const requestSchema = input.extend({
|
|
20
|
+
fileType: z.boolean().describe(language.get('api.asset.create.fileType')),
|
|
21
|
+
content: z.string().describe(language.get('api.asset.create.content')),
|
|
22
|
+
suffix: z.string().describe(language.get('api.asset.create.suffix')),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const responseSchema = z.void()
|
|
26
|
+
|
|
27
|
+
export const noticeSchema = z.object({
|
|
28
|
+
asset: z.string().describe(language.get('api.asset.create.asset')),
|
|
29
|
+
parent: z.string().describe(language.get('api.asset.create.parent')),
|
|
30
|
+
|
|
31
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/asset.cut`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const input = z.object({
|
|
9
|
+
urls: z.array(z.string()).describe(language.get('api.asset.cut.urls')),
|
|
10
|
+
target: z.string().describe(language.get('api.asset.cut.target')),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export const output = z.union([
|
|
14
|
+
outputErrortSchema,
|
|
15
|
+
z.object(),
|
|
16
|
+
])
|
|
17
|
+
|
|
18
|
+
export const requestSchema = input
|
|
19
|
+
|
|
20
|
+
export const responseSchema = z.void()
|
|
21
|
+
|
|
22
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/asset.delete`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const input = z.object({
|
|
9
|
+
urls: z.array(z.string()).describe(language.get('api.asset.delete.urls')),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const output = z.union([
|
|
13
|
+
outputErrortSchema,
|
|
14
|
+
z.object(),
|
|
15
|
+
])
|
|
16
|
+
|
|
17
|
+
export const requestSchema = input
|
|
18
|
+
|
|
19
|
+
export const responseSchema = z.void()
|
|
20
|
+
|
|
21
|
+
export const noticeSchema = input
|
|
@@ -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}/asset.download`
|
|
6
|
+
export const method = 'GET'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({
|
|
9
|
+
id: z.string().describe(language.get('api.asset.download.id')),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const responseSchema = z.void()
|
|
13
|
+
|
|
14
|
+
export const noticeSchema = z.any()
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/asset.node.dragdrap`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const input = z.object({
|
|
9
|
+
url: z.string().describe(language.get('api.asset.dragdrap.url')),
|
|
10
|
+
type: z.string().describe(language.get('api.asset.dragdrap.type')),
|
|
11
|
+
dragData: z.any().describe(language.get('api.asset.dragdrap.dragData')),
|
|
12
|
+
targetData: z.any().describe(language.get('api.asset.dragdrap.targetData')),
|
|
13
|
+
next: z.string().default("").describe(language.get('api.asset.dragdrap.next')),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const output = z.union([
|
|
17
|
+
outputErrortSchema,
|
|
18
|
+
z.object(),
|
|
19
|
+
])
|
|
20
|
+
|
|
21
|
+
export const requestSchema = z.object({
|
|
22
|
+
url: z.string().describe(language.get('api.asset.dragdrap.url')),
|
|
23
|
+
type: z.string().describe(language.get('api.asset.dragdrap.type')),
|
|
24
|
+
dragData: z.any().describe(language.get('api.asset.dragdrap.dragData')),
|
|
25
|
+
targetData: z.any().describe(language.get('api.asset.dragdrap.targetData')),
|
|
26
|
+
|
|
27
|
+
next: z.string().default("").describe(language.get('api.asset.dragdrap.next')),
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
export const responseSchema = z.void()
|
|
31
|
+
|
|
32
|
+
export const noticeSchema = input
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * as initialize from './initialize'
|
|
2
|
+
export * as add from './add'
|
|
3
|
+
export * as remove from './remove'
|
|
4
|
+
export * as update from './update'
|
|
5
|
+
export * as dragdrap from './dragdrap'
|
|
6
|
+
export * as create from './create'
|
|
7
|
+
export * as delete from './delete'
|
|
8
|
+
export * as open from './open'
|
|
9
|
+
export * as close from './close'
|
|
10
|
+
export * as rename from './rename'
|
|
11
|
+
export * as copy from './copy'
|
|
12
|
+
export * as cut from './cut'
|
|
13
|
+
export * as download from './download'
|
|
14
|
+
export * as upload from './upload'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi, clientSchema } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/asset.initialize`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const responseSchema = z.object({
|
|
12
|
+
root: z.any().describe(language.get('api.asset.initialize.root')),
|
|
13
|
+
client: clientSchema,
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi, clientSchema, outputErrortSchema } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/asset.open`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const input = z.object({
|
|
9
|
+
url: z.string().describe(language.get('api.asset.open.url')),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const output = z.union([
|
|
13
|
+
outputErrortSchema,
|
|
14
|
+
z.object(),
|
|
15
|
+
])
|
|
16
|
+
|
|
17
|
+
export const requestSchema = input
|
|
18
|
+
|
|
19
|
+
export const responseSchema = z.void()
|
|
20
|
+
|
|
21
|
+
export const noticeSchema = input.extend({
|
|
22
|
+
client: clientSchema
|
|
23
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/asset.node.remove`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const input = z.object({
|
|
9
|
+
url: z.string().describe(language.get('api.asset.remove.url')),
|
|
10
|
+
uuids: z.array(z.string()).describe(language.get('api.asset.remove.uuids')),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export const output = z.union([
|
|
14
|
+
outputErrortSchema,
|
|
15
|
+
z.object(),
|
|
16
|
+
])
|
|
17
|
+
|
|
18
|
+
export const requestSchema = input
|
|
19
|
+
|
|
20
|
+
export const responseSchema = z.void()
|
|
21
|
+
|
|
22
|
+
export const noticeSchema = input
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/asset.rename`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const input = z.object({
|
|
9
|
+
url: z.string().describe(language.get('api.asset.rename.url')),
|
|
10
|
+
newName: z.string().describe(language.get('api.asset.rename.newName')),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export const output = z.union([
|
|
14
|
+
outputErrortSchema,
|
|
15
|
+
z.object(),
|
|
16
|
+
])
|
|
17
|
+
|
|
18
|
+
export const requestSchema = input
|
|
19
|
+
|
|
20
|
+
export const responseSchema = z.void()
|
|
21
|
+
|
|
22
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import { baseApi, outputErrortSchema } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const path = `${baseApi}/asset.node.update`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const node = z.object({ uuid: z.string().describe(language.get('api.asset.update.node.uuid')) })
|
|
9
|
+
.loose()
|
|
10
|
+
.describe(language.get('api.asset.update.node.description'))
|
|
11
|
+
|
|
12
|
+
export const input = z.object({
|
|
13
|
+
url: z.string().describe(language.get('api.asset.update.url')),
|
|
14
|
+
node,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export const output = z.union([
|
|
18
|
+
outputErrortSchema,
|
|
19
|
+
z.object(),
|
|
20
|
+
])
|
|
21
|
+
|
|
22
|
+
export const requestSchema = input
|
|
23
|
+
|
|
24
|
+
export const responseSchema = z.void()
|
|
25
|
+
|
|
26
|
+
export const noticeSchema = requestSchema
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { baseApi, fileIdSchema } from '../../utils'
|
|
3
|
+
|
|
4
|
+
export const path = `${baseApi}/asset.upload`
|
|
5
|
+
export const method = 'POST'
|
|
6
|
+
|
|
7
|
+
export const requestSchema = z.any()
|
|
8
|
+
|
|
9
|
+
export const responseSchema = z.object({
|
|
10
|
+
id: fileIdSchema
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export const noticeSchema = z.object()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import * as prefix from './prefix'
|
|
3
|
+
import { chatWindowSchema } from '../../domain'
|
|
4
|
+
|
|
5
|
+
export const path = `${prefix.path}/window/create`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({
|
|
9
|
+
window: chatWindowSchema,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const responseSchema = z.void()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import { language } from '../../locale'
|
|
3
|
+
import * as prefix from './prefix'
|
|
4
|
+
|
|
5
|
+
export const path = `${prefix.path}/window/delete`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({
|
|
9
|
+
id: z.string().describe(language.get('api.chat.delete.id')),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const responseSchema = z.void()
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import z from 'zod'
|
|
2
|
+
import * as prefix from './prefix'
|
|
3
|
+
import { chatWindowSchema } from '../../domain'
|
|
4
|
+
|
|
5
|
+
export const path = `${prefix.path}/window/list`
|
|
6
|
+
export const method = 'POST'
|
|
7
|
+
|
|
8
|
+
export const requestSchema = z.object({
|
|
9
|
+
id: z.string().optional(),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const responseSchema = z.object({
|
|
13
|
+
list: z.array(chatWindowSchema)
|
|
14
|
+
})
|