@choiceopen/atomemo-plugin-schema 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +257 -14
- package/README.zh-CN.md +280 -0
- package/dist/schemas.d.ts +8 -8
- package/dist/schemas.js +2 -2
- package/dist/schemas.js.map +1 -1
- package/dist/{types-CpQliD1G.d.ts → types-CVN_Se4O.d.ts} +3 -3
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Choiceform
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,37 +1,280 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @choiceopen/atomemo-plugin-schema
|
|
2
|
+
|
|
3
|
+
[English](./README.md) | [中文](./README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
A comprehensive TypeScript type definitions and Zod schema validation library for developing Choiceform Atomemo plugins. This library ensures type safety at compile time and runtime validation for plugin definitions.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 🎯 **Type Safety**: Complete TypeScript type definitions for plugin development
|
|
10
|
+
- ✅ **Runtime Validation**: Zod schema validation for plugin definitions
|
|
11
|
+
- 🌍 **i18n Support**: Built-in internationalization text types and validation
|
|
12
|
+
- 🎨 **Flexible Property System**: Support for various data types and UI components
|
|
13
|
+
- 🔧 **Conditional Display**: Conditional display logic based on other property values
|
|
14
|
+
- 📦 **Tree-shakeable**: Optimized exports for minimal bundle size
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Using npm
|
|
20
|
+
npm install @choiceopen/atomemo-plugin-schema zod
|
|
21
|
+
|
|
22
|
+
# Using yarn
|
|
23
|
+
yarn add @choiceopen/atomemo-plugin-schema zod
|
|
24
|
+
|
|
25
|
+
# Using pnpm
|
|
26
|
+
pnpm add @choiceopen/atomemo-plugin-schema zod
|
|
27
|
+
|
|
28
|
+
# Using bun
|
|
29
|
+
bun add @choiceopen/atomemo-plugin-schema zod
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
> **Note**: `zod` is a peer dependency and must be installed separately.
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
### Import Types
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import type {
|
|
40
|
+
PluginDefinition,
|
|
41
|
+
CredentialDefinition,
|
|
42
|
+
DataSourceDefinition,
|
|
43
|
+
ModelDefinition,
|
|
44
|
+
ToolDefinition,
|
|
45
|
+
Property,
|
|
46
|
+
} from '@choiceopen/atomemo-plugin-schema/types';
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Import Schemas
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import {
|
|
53
|
+
PluginDefinitionSchema,
|
|
54
|
+
CredentialDefinitionSchema,
|
|
55
|
+
DataSourceDefinitionSchema,
|
|
56
|
+
ModelDefinitionSchema,
|
|
57
|
+
ToolDefinitionSchema,
|
|
58
|
+
PropertySchema,
|
|
59
|
+
} from '@choiceopen/atomemo-plugin-schema/schemas';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Example: Define a Plugin
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { PluginDefinitionSchema } from '@choiceopen/atomemo-plugin-schema/schemas';
|
|
66
|
+
import type { PluginDefinition } from '@choiceopen/atomemo-plugin-schema/types';
|
|
67
|
+
|
|
68
|
+
const pluginDefinition: PluginDefinition = {
|
|
69
|
+
name: 'my-plugin',
|
|
70
|
+
display_name: {
|
|
71
|
+
en_US: 'My Plugin',
|
|
72
|
+
zh_CN: '我的插件',
|
|
73
|
+
},
|
|
74
|
+
description: {
|
|
75
|
+
en_US: 'A sample plugin for Atomemo',
|
|
76
|
+
zh_CN: '一个示例插件',
|
|
77
|
+
},
|
|
78
|
+
icon: 'https://example.com/icon.png',
|
|
79
|
+
version: '1.0.0',
|
|
80
|
+
locales: ['en', 'zh_CN'],
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// Validate at runtime
|
|
84
|
+
const result = PluginDefinitionSchema.safeParse(pluginDefinition);
|
|
85
|
+
if (!result.success) {
|
|
86
|
+
console.error('Validation failed:', result.error);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Core Concepts
|
|
91
|
+
|
|
92
|
+
### Plugin Definition
|
|
93
|
+
|
|
94
|
+
A plugin definition contains metadata about your plugin:
|
|
95
|
+
|
|
96
|
+
- Basic information: name, display name, description, icon
|
|
97
|
+
- Author information: name, email, repository URL, version
|
|
98
|
+
- Supported languages list
|
|
99
|
+
|
|
100
|
+
### Feature Definitions
|
|
101
|
+
|
|
102
|
+
Feature definitions include:
|
|
103
|
+
|
|
104
|
+
- **Credential**: For storing and managing authentication information
|
|
105
|
+
- **DataSource**: For connecting to external data sources
|
|
106
|
+
- **Model**: For defining LLM models
|
|
107
|
+
- **Tool**: For executing specific functions
|
|
108
|
+
|
|
109
|
+
### Property System
|
|
110
|
+
|
|
111
|
+
The property system is the core of defining plugin parameters and settings:
|
|
112
|
+
|
|
113
|
+
**Property Types:**
|
|
114
|
+
- `string`: String type
|
|
115
|
+
- `number` / `integer`: Number type
|
|
116
|
+
- `boolean`: Boolean type
|
|
117
|
+
- `array`: Array type
|
|
118
|
+
- `object`: Object type
|
|
119
|
+
- `discriminated_union`: Discriminated union type
|
|
120
|
+
- `credential_id`: Credential ID type
|
|
121
|
+
- `encrypted_string`: Encrypted string type
|
|
122
|
+
|
|
123
|
+
**Property Features:**
|
|
124
|
+
- Constant values (`constant`)
|
|
125
|
+
- Default values (`default`)
|
|
126
|
+
- Enum values (`enum`)
|
|
127
|
+
- Range constraints (`min_length`, `max_length`, `minimum`, `maximum`, `min_items`, `max_items`)
|
|
128
|
+
- Conditional display (`display.hide/show`)
|
|
129
|
+
- AI configuration (`ai.llm_description`)
|
|
130
|
+
|
|
131
|
+
### UI Component System
|
|
132
|
+
|
|
133
|
+
Each property type can be configured with different UI components:
|
|
134
|
+
|
|
135
|
+
**String type components:**
|
|
136
|
+
- `input`, `textarea`, `expression-input`, `expression-textarea`
|
|
137
|
+
- `code-editor`, `select`, `radio-group`
|
|
138
|
+
- `emoji-picker`, `color-picker`, `credential-select`
|
|
139
|
+
|
|
140
|
+
**Number type components:**
|
|
141
|
+
- `number-input`, `slider`
|
|
142
|
+
|
|
143
|
+
**Boolean type components:**
|
|
144
|
+
- `switch`, `checkbox`
|
|
145
|
+
|
|
146
|
+
**Array type components:**
|
|
147
|
+
- `multi-select`, `tag-input`, `key-value-editor`, `slider`, `array-section`
|
|
148
|
+
|
|
149
|
+
**Object type components:**
|
|
150
|
+
- `collapsible-panel`, `json-schema-editor`, `conditions-editor`, `code-editor`
|
|
151
|
+
|
|
152
|
+
### Conditional Display System
|
|
153
|
+
|
|
154
|
+
Supports conditional display logic based on other property values:
|
|
155
|
+
|
|
156
|
+
**Operators:**
|
|
157
|
+
- Comparison: `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`
|
|
158
|
+
- Existence check: `$exists`
|
|
159
|
+
- Set operations: `$in`, `$nin`
|
|
160
|
+
- Regex matching: `$regex`, `$options`
|
|
161
|
+
- Array operations: `$size`, `$mod`
|
|
162
|
+
- Logical combination: `$and`, `$or`, `$nor`
|
|
163
|
+
|
|
164
|
+
## API Reference
|
|
165
|
+
|
|
166
|
+
### Exports
|
|
167
|
+
|
|
168
|
+
The package exports two main entry points:
|
|
169
|
+
|
|
170
|
+
- `@choiceopen/atomemo-plugin-schema/types` - TypeScript type definitions
|
|
171
|
+
- `@choiceopen/atomemo-plugin-schema/schemas` - Zod schema validators
|
|
172
|
+
|
|
173
|
+
### Development Exports
|
|
174
|
+
|
|
175
|
+
In development environments, the package exports source files directly for better debugging and hot reload support:
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"./schemas": {
|
|
180
|
+
"development": "./src/schemas.ts",
|
|
181
|
+
"default": "./dist/schemas.js"
|
|
182
|
+
},
|
|
183
|
+
"./types": {
|
|
184
|
+
"development": "./src/types.ts",
|
|
185
|
+
"default": "./dist/types.js"
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
2
189
|
|
|
3
190
|
## Development
|
|
4
191
|
|
|
5
|
-
|
|
192
|
+
### Prerequisites
|
|
193
|
+
|
|
194
|
+
- [Bun](https://bun.sh) >= 1.0.0
|
|
195
|
+
- Node.js >= 18.0.0 (if not using Bun)
|
|
196
|
+
|
|
197
|
+
### Setup
|
|
6
198
|
|
|
7
199
|
```bash
|
|
200
|
+
# Install dependencies
|
|
8
201
|
bun install
|
|
9
202
|
```
|
|
10
203
|
|
|
11
|
-
|
|
204
|
+
### Available Scripts
|
|
12
205
|
|
|
13
206
|
```bash
|
|
207
|
+
# Watch and rebuild in development
|
|
14
208
|
bun run dev
|
|
15
|
-
```
|
|
16
209
|
|
|
17
|
-
|
|
210
|
+
# Build the library
|
|
211
|
+
bun run build
|
|
18
212
|
|
|
19
|
-
|
|
213
|
+
# Run linting and formatting
|
|
20
214
|
bun run check
|
|
21
|
-
```
|
|
22
215
|
|
|
23
|
-
|
|
216
|
+
# Run type checking
|
|
217
|
+
bun run typecheck
|
|
24
218
|
|
|
25
|
-
|
|
219
|
+
# Run unit tests
|
|
26
220
|
bun run test
|
|
27
221
|
```
|
|
28
222
|
|
|
29
|
-
|
|
223
|
+
### Code Quality
|
|
30
224
|
|
|
31
|
-
|
|
32
|
-
|
|
225
|
+
This project uses [Biome](https://biomejs.dev) for unified linting and formatting. For the best development experience, install the [Biome VS Code extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome).
|
|
226
|
+
|
|
227
|
+
## Project Structure
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
atomemo-plugin-schema/
|
|
231
|
+
├── src/ # Source code
|
|
232
|
+
│ ├── schemas/ # Zod schema validation modules
|
|
233
|
+
│ ├── types/ # TypeScript type definitions
|
|
234
|
+
│ ├── utils/ # Utility functions
|
|
235
|
+
│ ├── schemas.ts # Schema exports
|
|
236
|
+
│ └── types.ts # Type exports
|
|
237
|
+
├── tests/ # Test files
|
|
238
|
+
├── dist/ # Build output
|
|
239
|
+
└── [config files] # package.json, tsconfig.json, etc.
|
|
33
240
|
```
|
|
34
241
|
|
|
35
|
-
##
|
|
242
|
+
## Contributing
|
|
243
|
+
|
|
244
|
+
Contributions are welcome! Please follow these guidelines:
|
|
245
|
+
|
|
246
|
+
1. Follow the project's code style (use Biome for formatting)
|
|
247
|
+
2. Ensure all tests pass
|
|
248
|
+
3. Ensure type safety (use `IsEqual` for validation)
|
|
249
|
+
4. Update relevant documentation
|
|
250
|
+
5. Run `bun run check` and `bun run test` before submitting
|
|
251
|
+
|
|
252
|
+
### Development Workflow
|
|
253
|
+
|
|
254
|
+
1. Fork the repository
|
|
255
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
256
|
+
3. Make your changes
|
|
257
|
+
4. Run tests and linting (`bun run check && bun run test`)
|
|
258
|
+
5. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
259
|
+
6. Push to the branch (`git push origin feature/amazing-feature`)
|
|
260
|
+
7. Open a Pull Request
|
|
261
|
+
|
|
262
|
+
## Changelog
|
|
263
|
+
|
|
264
|
+
See [CHANGELOG.md](./CHANGELOG.md) for a list of changes and version history.
|
|
265
|
+
|
|
266
|
+
## License
|
|
267
|
+
|
|
268
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
269
|
+
|
|
270
|
+
## Support
|
|
271
|
+
|
|
272
|
+
- 📖 [Documentation](https://github.com/choice-open/atomemo-plugin-schema#readme)
|
|
273
|
+
- 🐛 [Issue Tracker](https://github.com/choice-open/atomemo-plugin-schema/issues)
|
|
274
|
+
- 💬 [Discussions](https://github.com/choice-open/atomemo-plugin-schema/discussions)
|
|
275
|
+
|
|
276
|
+
## Acknowledgments
|
|
36
277
|
|
|
37
|
-
|
|
278
|
+
- Built with [TypeScript](https://www.typescriptlang.org/)
|
|
279
|
+
- Schema validation powered by [Zod](https://zod.dev/)
|
|
280
|
+
- Tool types from [type-fest](https://github.com/sindresorhus/type-fest)
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# @choiceopen/atomemo-plugin-schema
|
|
2
|
+
|
|
3
|
+
[English](./README.md) | [中文](./README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
一个全面的 TypeScript 类型定义和 Zod Schema 验证库,用于开发 Choiceform Atomemo 插件。该库确保插件定义在编译时和运行时的类型安全与验证。
|
|
6
|
+
|
|
7
|
+
## 特性
|
|
8
|
+
|
|
9
|
+
- 🎯 **类型安全**: 完整的 TypeScript 类型定义,支持插件开发
|
|
10
|
+
- ✅ **运行时验证**: 使用 Zod Schema 进行运行时验证
|
|
11
|
+
- 🌍 **国际化支持**: 内置国际化文本类型和验证
|
|
12
|
+
- 🎨 **灵活的属性系统**: 支持多种数据类型和 UI 组件
|
|
13
|
+
- 🔧 **条件显示**: 基于其他属性值的条件显示逻辑
|
|
14
|
+
- 📦 **Tree-shakeable**: 优化的导出,最小化打包体积
|
|
15
|
+
|
|
16
|
+
## 安装
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# 使用 npm
|
|
20
|
+
npm install @choiceopen/atomemo-plugin-schema zod
|
|
21
|
+
|
|
22
|
+
# 使用 yarn
|
|
23
|
+
yarn add @choiceopen/atomemo-plugin-schema zod
|
|
24
|
+
|
|
25
|
+
# 使用 pnpm
|
|
26
|
+
pnpm add @choiceopen/atomemo-plugin-schema zod
|
|
27
|
+
|
|
28
|
+
# 使用 bun
|
|
29
|
+
bun add @choiceopen/atomemo-plugin-schema zod
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
> **注意**: `zod` 是 peer dependency,需要单独安装。
|
|
33
|
+
|
|
34
|
+
## 快速开始
|
|
35
|
+
|
|
36
|
+
### 导入类型
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import type {
|
|
40
|
+
PluginDefinition,
|
|
41
|
+
CredentialDefinition,
|
|
42
|
+
DataSourceDefinition,
|
|
43
|
+
ModelDefinition,
|
|
44
|
+
ToolDefinition,
|
|
45
|
+
Property,
|
|
46
|
+
} from '@choiceopen/atomemo-plugin-schema/types';
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 导入 Schema
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import {
|
|
53
|
+
PluginDefinitionSchema,
|
|
54
|
+
CredentialDefinitionSchema,
|
|
55
|
+
DataSourceDefinitionSchema,
|
|
56
|
+
ModelDefinitionSchema,
|
|
57
|
+
ToolDefinitionSchema,
|
|
58
|
+
PropertySchema,
|
|
59
|
+
} from '@choiceopen/atomemo-plugin-schema/schemas';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 示例:定义一个插件
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { PluginDefinitionSchema } from '@choiceopen/atomemo-plugin-schema/schemas';
|
|
66
|
+
import type { PluginDefinition } from '@choiceopen/atomemo-plugin-schema/types';
|
|
67
|
+
|
|
68
|
+
const pluginDefinition: PluginDefinition = {
|
|
69
|
+
name: 'my-plugin',
|
|
70
|
+
display_name: {
|
|
71
|
+
en_US: 'My Plugin',
|
|
72
|
+
zh_CN: '我的插件',
|
|
73
|
+
},
|
|
74
|
+
description: {
|
|
75
|
+
en_US: 'A sample plugin for Atomemo',
|
|
76
|
+
zh_CN: '一个示例插件',
|
|
77
|
+
},
|
|
78
|
+
icon: 'https://example.com/icon.png',
|
|
79
|
+
version: '1.0.0',
|
|
80
|
+
locales: ['en', 'zh_CN'],
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// 运行时验证
|
|
84
|
+
const result = PluginDefinitionSchema.safeParse(pluginDefinition);
|
|
85
|
+
if (!result.success) {
|
|
86
|
+
console.error('验证失败:', result.error);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## 核心概念
|
|
91
|
+
|
|
92
|
+
### 插件定义
|
|
93
|
+
|
|
94
|
+
插件定义包含插件的元数据:
|
|
95
|
+
|
|
96
|
+
- 基本信息:名称、显示名称、描述、图标
|
|
97
|
+
- 作者信息:名称、邮箱、仓库 URL、版本
|
|
98
|
+
- 支持的语言列表
|
|
99
|
+
|
|
100
|
+
### 功能定义
|
|
101
|
+
|
|
102
|
+
功能定义包括:
|
|
103
|
+
|
|
104
|
+
- **Credential(凭证)**: 用于存储和管理认证信息
|
|
105
|
+
- **DataSource(数据源)**: 用于连接外部数据源
|
|
106
|
+
- **Model(模型)**: 用于定义 LLM 模型
|
|
107
|
+
- **Tool(工具)**: 用于执行特定功能
|
|
108
|
+
|
|
109
|
+
### 属性系统
|
|
110
|
+
|
|
111
|
+
属性系统是定义插件参数和设置的核心:
|
|
112
|
+
|
|
113
|
+
**属性类型:**
|
|
114
|
+
- `string`: 字符串类型
|
|
115
|
+
- `number` / `integer`: 数字类型
|
|
116
|
+
- `boolean`: 布尔类型
|
|
117
|
+
- `array`: 数组类型
|
|
118
|
+
- `object`: 对象类型
|
|
119
|
+
- `discriminated_union`: 区分联合类型
|
|
120
|
+
- `credential_id`: 凭证 ID 类型
|
|
121
|
+
- `encrypted_string`: 加密字符串类型
|
|
122
|
+
|
|
123
|
+
**属性特性:**
|
|
124
|
+
- 常量值(`constant`)
|
|
125
|
+
- 默认值(`default`)
|
|
126
|
+
- 枚举值(`enum`)
|
|
127
|
+
- 范围限制(`min_length`、`max_length`、`minimum`、`maximum`、`min_items`、`max_items`)
|
|
128
|
+
- 条件显示(`display.hide/show`)
|
|
129
|
+
- AI 配置(`ai.llm_description`)
|
|
130
|
+
|
|
131
|
+
### UI 组件系统
|
|
132
|
+
|
|
133
|
+
每个属性类型可以配置不同的 UI 组件:
|
|
134
|
+
|
|
135
|
+
**字符串类型可用组件:**
|
|
136
|
+
- `input`、`textarea`、`expression-input`、`expression-textarea`
|
|
137
|
+
- `code-editor`、`select`、`radio-group`
|
|
138
|
+
- `emoji-picker`、`color-picker`、`credential-select`
|
|
139
|
+
|
|
140
|
+
**数字类型可用组件:**
|
|
141
|
+
- `number-input`、`slider`
|
|
142
|
+
|
|
143
|
+
**布尔类型可用组件:**
|
|
144
|
+
- `switch`、`checkbox`
|
|
145
|
+
|
|
146
|
+
**数组类型可用组件:**
|
|
147
|
+
- `multi-select`、`tag-input`、`key-value-editor`、`slider`、`array-section`
|
|
148
|
+
|
|
149
|
+
**对象类型可用组件:**
|
|
150
|
+
- `collapsible-panel`、`json-schema-editor`、`conditions-editor`、`code-editor`
|
|
151
|
+
|
|
152
|
+
### 条件显示系统
|
|
153
|
+
|
|
154
|
+
支持基于其他属性值的条件显示逻辑:
|
|
155
|
+
|
|
156
|
+
**操作符:**
|
|
157
|
+
- 比较操作符:`$eq`、`$ne`、`$gt`、`$gte`、`$lt`、`$lte`
|
|
158
|
+
- 存在性检查:`$exists`
|
|
159
|
+
- 集合操作:`$in`、`$nin`
|
|
160
|
+
- 正则匹配:`$regex`、`$options`
|
|
161
|
+
- 数组操作:`$size`、`$mod`
|
|
162
|
+
- 逻辑组合:`$and`、`$or`、`$nor`
|
|
163
|
+
|
|
164
|
+
## API 参考
|
|
165
|
+
|
|
166
|
+
### 导出
|
|
167
|
+
|
|
168
|
+
包导出两个主要入口点:
|
|
169
|
+
|
|
170
|
+
- `@choiceopen/atomemo-plugin-schema/types` - TypeScript 类型定义
|
|
171
|
+
- `@choiceopen/atomemo-plugin-schema/schemas` - Zod Schema 验证器
|
|
172
|
+
|
|
173
|
+
### 开发环境导出
|
|
174
|
+
|
|
175
|
+
在开发环境中,包直接导出源文件,以便更好地调试和支持热重载:
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"./schemas": {
|
|
180
|
+
"development": "./src/schemas.ts",
|
|
181
|
+
"default": "./dist/schemas.js"
|
|
182
|
+
},
|
|
183
|
+
"./types": {
|
|
184
|
+
"development": "./src/types.ts",
|
|
185
|
+
"default": "./dist/types.js"
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## 开发
|
|
191
|
+
|
|
192
|
+
### 前置要求
|
|
193
|
+
|
|
194
|
+
- [Bun](https://bun.sh) >= 1.0.0
|
|
195
|
+
- Node.js >= 18.0.0(如果不使用 Bun)
|
|
196
|
+
|
|
197
|
+
### 设置
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# 安装依赖
|
|
201
|
+
bun install
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### 可用脚本
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# 开发模式监听并重新构建
|
|
208
|
+
bun run dev
|
|
209
|
+
|
|
210
|
+
# 构建库
|
|
211
|
+
bun run build
|
|
212
|
+
|
|
213
|
+
# 运行代码检查和格式化
|
|
214
|
+
bun run check
|
|
215
|
+
|
|
216
|
+
# 运行类型检查
|
|
217
|
+
bun run typecheck
|
|
218
|
+
|
|
219
|
+
# 运行单元测试
|
|
220
|
+
bun run test
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### 代码质量
|
|
224
|
+
|
|
225
|
+
本项目使用 [Biome](https://biomejs.dev) 进行统一的代码检查和格式化。为了获得最佳的开发体验,请安装 [Biome VS Code 扩展](https://marketplace.visualstudio.com/items?itemName=biomejs.biome)。
|
|
226
|
+
|
|
227
|
+
## 项目结构
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
atomemo-plugin-schema/
|
|
231
|
+
├── src/ # 源代码
|
|
232
|
+
│ ├── schemas/ # Zod Schema 验证模块
|
|
233
|
+
│ ├── types/ # TypeScript 类型定义
|
|
234
|
+
│ ├── utils/ # 工具函数
|
|
235
|
+
│ ├── schemas.ts # Schema 导出
|
|
236
|
+
│ └── types.ts # 类型导出
|
|
237
|
+
├── tests/ # 测试文件
|
|
238
|
+
├── dist/ # 构建输出
|
|
239
|
+
└── [配置文件] # package.json, tsconfig.json 等
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## 贡献
|
|
243
|
+
|
|
244
|
+
欢迎贡献!请遵循以下指南:
|
|
245
|
+
|
|
246
|
+
1. 遵循项目的代码风格(使用 Biome 进行格式化)
|
|
247
|
+
2. 确保所有测试通过
|
|
248
|
+
3. 确保类型安全(使用 `IsEqual` 进行验证)
|
|
249
|
+
4. 更新相关文档
|
|
250
|
+
5. 提交前运行 `bun run check` 和 `bun run test`
|
|
251
|
+
|
|
252
|
+
### 开发工作流
|
|
253
|
+
|
|
254
|
+
1. Fork 仓库
|
|
255
|
+
2. 创建功能分支(`git checkout -b feature/amazing-feature`)
|
|
256
|
+
3. 进行更改
|
|
257
|
+
4. 运行测试和代码检查(`bun run check && bun run test`)
|
|
258
|
+
5. 提交更改(`git commit -m '添加一些很棒的功能'`)
|
|
259
|
+
6. 推送到分支(`git push origin feature/amazing-feature`)
|
|
260
|
+
7. 打开 Pull Request
|
|
261
|
+
|
|
262
|
+
## 变更日志
|
|
263
|
+
|
|
264
|
+
查看 [CHANGELOG.md](./CHANGELOG.md) 了解变更列表和版本历史。
|
|
265
|
+
|
|
266
|
+
## 许可证
|
|
267
|
+
|
|
268
|
+
本项目采用 MIT 许可证 - 查看 [LICENSE](LICENSE) 文件了解详情。
|
|
269
|
+
|
|
270
|
+
## 支持
|
|
271
|
+
|
|
272
|
+
- 📖 [文档](https://github.com/choice-open/atomemo-plugin-schema#readme)
|
|
273
|
+
- 🐛 [问题追踪](https://github.com/choice-open/atomemo-plugin-schema/issues)
|
|
274
|
+
- 💬 [讨论](https://github.com/choice-open/atomemo-plugin-schema/discussions)
|
|
275
|
+
|
|
276
|
+
## 致谢
|
|
277
|
+
|
|
278
|
+
- 使用 [TypeScript](https://www.typescriptlang.org/) 构建
|
|
279
|
+
- Schema 验证由 [Zod](https://zod.dev/) 提供支持
|
|
280
|
+
- 工具类型来自 [type-fest](https://github.com/sindresorhus/type-fest)
|
package/dist/schemas.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as I18nText, W as JsonValueSchema, c as DisplayCondition, u as Property } from "./types-
|
|
1
|
+
import { G as I18nText, W as JsonValueSchema, c as DisplayCondition, u as Property } from "./types-CVN_Se4O.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import * as type_fest0 from "type-fest";
|
|
4
4
|
import { JsonValue } from "type-fest";
|
|
@@ -2763,18 +2763,20 @@ declare const BaseDefinitionSchema: z.ZodObject<{
|
|
|
2763
2763
|
}, z.core.$strip>]>>>;
|
|
2764
2764
|
}, z.core.$strip>;
|
|
2765
2765
|
declare const PluginDefinitionSchema: z.ZodObject<{
|
|
2766
|
-
author: z.ZodString
|
|
2767
|
-
email: z.ZodEmail
|
|
2766
|
+
author: z.ZodOptional<z.ZodString>;
|
|
2767
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
2768
2768
|
repo: z.ZodOptional<z.ZodURL>;
|
|
2769
2769
|
version: z.ZodOptional<z.ZodString>;
|
|
2770
2770
|
locales: z.ZodArray<z.ZodString>;
|
|
2771
|
-
display_name: z.ZodCustom<I18nText, I18nText>;
|
|
2772
|
-
description: z.ZodCustom<I18nText, I18nText>;
|
|
2773
2771
|
name: z.ZodString;
|
|
2772
|
+
display_name: z.ZodCustom<I18nText, I18nText>;
|
|
2774
2773
|
icon: z.ZodString;
|
|
2774
|
+
description: z.ZodCustom<I18nText, I18nText>;
|
|
2775
2775
|
}, z.core.$strip>;
|
|
2776
2776
|
declare const CredentialDefinitionSchema: z.ZodObject<{
|
|
2777
|
+
name: z.ZodString;
|
|
2777
2778
|
display_name: z.ZodCustom<I18nText, I18nText>;
|
|
2779
|
+
icon: z.ZodString;
|
|
2778
2780
|
description: z.ZodCustom<I18nText, I18nText>;
|
|
2779
2781
|
parameters: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
2780
2782
|
name: z.ZodString;
|
|
@@ -4145,8 +4147,6 @@ declare const CredentialDefinitionSchema: z.ZodObject<{
|
|
|
4145
4147
|
sortable: z.ZodOptional<z.ZodBoolean>;
|
|
4146
4148
|
}, z.core.$strip>], "component">>;
|
|
4147
4149
|
}, z.core.$strip>]>>;
|
|
4148
|
-
name: z.ZodString;
|
|
4149
|
-
icon: z.ZodString;
|
|
4150
4150
|
}, z.core.$strip>;
|
|
4151
4151
|
declare const DataSourceDefinitionSchema: z.ZodObject<{
|
|
4152
4152
|
name: z.ZodString;
|
|
@@ -6950,8 +6950,8 @@ declare const ModelDefinitionSchema: z.ZodObject<{
|
|
|
6950
6950
|
parallel_tool_calls: "parallel_tool_calls";
|
|
6951
6951
|
}>>;
|
|
6952
6952
|
display_name: z.ZodCustom<I18nText, I18nText>;
|
|
6953
|
-
description: z.ZodCustom<I18nText, I18nText>;
|
|
6954
6953
|
icon: z.ZodString;
|
|
6954
|
+
description: z.ZodCustom<I18nText, I18nText>;
|
|
6955
6955
|
}, z.core.$strip>;
|
|
6956
6956
|
declare const ToolDefinitionSchema: z.ZodObject<{
|
|
6957
6957
|
invoke: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
package/dist/schemas.js
CHANGED
|
@@ -454,8 +454,8 @@ const PluginDefinitionSchema = z.object({
|
|
|
454
454
|
parameters: true,
|
|
455
455
|
settings: true
|
|
456
456
|
}).shape,
|
|
457
|
-
author: z.string(),
|
|
458
|
-
email: z.email(),
|
|
457
|
+
author: z.string().optional(),
|
|
458
|
+
email: z.email().optional(),
|
|
459
459
|
repo: z.httpUrl().optional(),
|
|
460
460
|
version: z.string().optional(),
|
|
461
461
|
locales: z.array(z.string())
|
package/dist/schemas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","names":["JsonValueSchema"],"sources":["../src/utils/toolkit.ts","../src/schemas/common.ts","../src/utils/custom-json-value.ts","../src/schemas/property-ui.ts","../src/schemas/property.ts","../src/schemas/definition.ts"],"sourcesContent":["export function isPlainObject(value: unknown): value is Record<string, unknown> {\n if (value === null || typeof value !== \"object\") return false\n if (Object.prototype.toString.call(value) !== \"[object Object]\") return false\n\n const proto = Object.getPrototypeOf(value)\n return proto === Object.prototype || proto === null\n}\n\nexport function compact<T>(\n values: Array<T | null | undefined | false | 0 | \"\" | typeof Number.NaN>,\n): T[] {\n // Match common \"compact\" behavior: drop falsy values.\n // Note: `NaN` is truthy? Actually `Boolean(NaN) === false`, so it will be removed too.\n return values.filter(Boolean) as T[]\n}\n","import type { IsEqual } from \"type-fest\"\nimport { z } from \"zod\"\nimport type { I18nText } from \"../types\"\nimport { isPlainObject } from \"../utils/toolkit\"\n\n/**\n * I18n 词条模式\n *\n * NOTE: Zod 无法定义复杂的字面量模版,此处使用 `z.custom` 实现自定义验证\n */\nexport const I18nEntrySchema = z.custom<I18nText>((value) => {\n // 必须是对象字面量\n if (!isPlainObject(value)) return false\n // 必须包含 en_US 键\n if (!(\"en_US\" in value)) return false\n\n for (const [locale, text] of Object.entries(value)) {\n // 值必须是字符串\n if (typeof text !== \"string\") return false\n\n // NOTE: 支持的语言码并不严格符合标准,因为 TS 字面量模版无法描述所有可能的情况\n // 故以下仅对满足需求的子集做简单检查而不是严格的 RFC 5646 标准检查\n const parts = locale.split(\"_\")\n // 其它语言代码必须符合格式:<语言代码>_<国家或脚本代码>,且第二部份首字母必须大写\n if (parts.length !== 2 || parts[1][0] !== parts[1][0].toUpperCase()) {\n return false\n }\n }\n return true\n}, \"Invalid I18n entry\")\n{\n const _: IsEqual<z.infer<typeof I18nEntrySchema>, I18nText> = true\n}\n","/**\n * Custom JSON Value Schema and Type\n *\n * Why? Because `z.json()` is not compatible with `JSONValue` from type-fest\n */\n\nimport { z } from \"zod\"\n\n/**\n * Custom JSON Value Schema\n * @description Custom JSON Value Schema is a schema that allows any JSON value\n */\nexport const JsonValueSchema = z.json()\n\n/**\n * Custom JSON Value Type\n * @description Custom JSON Value Type is the type of the JSON value\n */\nexport type JsonValue = z.infer<typeof JsonValueSchema>\n","import type { IntRange, IsEqual } from \"type-fest\"\nimport { z } from \"zod\"\nimport type {\n PropertyUIArray,\n PropertyUIArraySectionProps,\n PropertyUIBoolean,\n PropertyUICollapsiblePanelProps,\n PropertyUIColorPickerProps,\n PropertyUICredentialId,\n PropertyUIEmojiPickerProps,\n PropertyUIEncryptedInputProps,\n PropertyUIInputProps,\n PropertyUIKeyValueEditorProps,\n PropertyUINumber,\n PropertyUIObject,\n PropertyUIOption,\n PropertyUIProps,\n PropertyUIRadioGroupProps,\n PropertyUISingleSelectProps,\n PropertyUIString,\n PropertyUISwitchProps,\n} from \"../types\"\nimport { I18nEntrySchema } from \"./common\"\n\nconst indentationSchema = z.union([\n z.literal(2),\n z.literal(4),\n z.literal(6),\n z.literal(8),\n z.literal(10),\n z.literal(12),\n z.literal(14),\n z.literal(16),\n z.literal(18),\n z.literal(20),\n z.literal(22),\n z.literal(24),\n z.literal(26),\n z.literal(28),\n z.literal(30),\n z.literal(32),\n z.literal(34),\n z.literal(36),\n z.literal(38),\n z.literal(40),\n z.literal(42),\n z.literal(44),\n z.literal(46),\n z.literal(48),\n z.literal(50),\n z.literal(52),\n z.literal(54),\n z.literal(56),\n z.literal(58),\n z.literal(60),\n z.literal(62),\n z.literal(64),\n z.literal(66),\n z.literal(68),\n z.literal(70),\n z.literal(72),\n z.literal(74),\n z.literal(76),\n z.literal(78),\n z.literal(80),\n])\n{\n const _: IsEqual<z.infer<typeof indentationSchema>, IntRange<2, 81, 2>> = true\n}\n\n// Common UI properties schema\nexport const PropertyUICommonPropsSchema = z.object({\n disabled: z.boolean().optional(),\n hint: I18nEntrySchema.optional(),\n placeholder: I18nEntrySchema.optional(),\n readonly: z.boolean().optional(),\n sensitive: z.boolean().optional(),\n support_expression: z.boolean().optional(),\n width: z.enum([\"small\", \"medium\", \"full\"]).optional(),\n indentation: indentationSchema.optional(),\n display_none: z.boolean().optional(),\n})\n\n// Option schema for select components\nexport const PropertyUIOptionSchema = z.object({\n icon: z.string().optional(),\n label: I18nEntrySchema,\n value: z.union([z.string(), z.number(), z.boolean()]),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyUIOptionSchema>, PropertyUIOption> = true\n}\n\nconst PropertyUIInputPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"input\"),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyUIInputPropsSchema>, PropertyUIInputProps> = true\n}\n\nexport const PropertyUIEncryptedInputPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"encrypted-input\"),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUIEncryptedInputPropsSchema>,\n PropertyUIEncryptedInputProps\n > = true\n}\n\n// Textarea component schema\nconst PropertyUITextareaPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"textarea\"),\n max_height: z.number().optional(),\n min_height: z.number().optional(),\n})\n\n// Expression input component schema\nconst PropertyUIExpressionInputPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.enum([\"expression-input\", \"expression-textarea\"]),\n max_height: z.number().optional(),\n min_height: z.number().optional(),\n})\n\n// Number input component schema\nconst PropertyUINumberInputPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"number-input\"),\n step: z.number().optional(),\n suffix: z.string().optional(),\n})\n\n// Code editor component schema\nconst PropertyUICodeEditorPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"code-editor\"),\n language: z.enum([\"json\", \"javascript\", \"python3\", \"html\"]).optional(),\n line_numbers: z.boolean().optional(),\n max_height: z.number().optional(),\n min_height: z.number().optional(),\n})\n\n// Select base schema\nconst PropertyUISelectPropsBaseSchema = z.object({\n clearable: z.boolean().optional(),\n options: z.array(PropertyUIOptionSchema).optional(),\n searchable: z.boolean().optional(),\n})\n\n// Single select component schema\nconst PropertyUISingleSelectPropsSchema = PropertyUICommonPropsSchema.merge(\n PropertyUISelectPropsBaseSchema,\n).extend({\n component: z.literal(\"select\"),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUISingleSelectPropsSchema>,\n PropertyUISingleSelectProps\n > = true\n}\n\n// Radio group component schema\nconst PropertyUIRadioGroupPropsSchema = PropertyUICommonPropsSchema.merge(\n PropertyUISelectPropsBaseSchema,\n).extend({\n component: z.literal(\"radio-group\"),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUIRadioGroupPropsSchema>,\n PropertyUIRadioGroupProps\n > = true\n}\n\n// Multi select component schema\nconst PropertyUIMultiSelectPropsSchema = PropertyUICommonPropsSchema.merge(\n PropertyUISelectPropsBaseSchema,\n).extend({\n component: z.literal(\"multi-select\"),\n})\n\n// Switch component schema\nconst PropertyUISwitchPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"switch\"),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyUISwitchPropsSchema>, PropertyUISwitchProps> = true\n}\n\n// Checkbox component schema\nconst PropertyUICheckboxPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"checkbox\"),\n})\n\n// Slider component schema\nconst PropertyUISliderPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"slider\"),\n marks: z.record(z.number(), z.string()).optional(),\n show_value: z.boolean().optional(),\n step: z.number().optional(),\n})\n\n// Key-value editor component schema\nconst PropertyUIKeyValueEditorPropsSchema = PropertyUICommonPropsSchema.extend({\n add_button_label: I18nEntrySchema.optional(),\n component: z.literal(\"key-value-editor\"),\n empty_description: I18nEntrySchema.optional(),\n section_header: I18nEntrySchema.optional(),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUIKeyValueEditorPropsSchema>,\n PropertyUIKeyValueEditorProps\n > = true\n}\n\n// Tag input component schema\nconst PropertyUITagInputPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"tag-input\"),\n})\n\n// Emoji picker component schema\nconst PropertyUIEmojiPickerPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"emoji-picker\"),\n size: z.enum([\"extra-small\", \"small\", \"medium\", \"large\"]).optional(),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUIEmojiPickerPropsSchema>,\n PropertyUIEmojiPickerProps\n > = true\n}\n\n// Color picker component schema\nconst PropertyUIColorPickerPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"color-picker\"),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUIColorPickerPropsSchema>,\n PropertyUIColorPickerProps\n > = true\n}\n\n// Credential select component schema\nconst PropertyUICredentialSelectPropsSchema = PropertyUICommonPropsSchema.extend({\n clearable: z.boolean().optional(),\n component: z.literal(\"credential-select\"),\n searchable: z.boolean().optional(),\n})\n\n// JSON Schema editor component schema\nconst PropertyUIJsonSchemaEditorPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"json-schema-editor\"),\n})\n\n// Conditions editor component schema\nconst PropertyUIConditionsEditorPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"conditions-editor\"),\n})\n\n// Array section component schema\nconst PropertyUIArraySectionPropsSchema = PropertyUICommonPropsSchema.extend({\n add_label: I18nEntrySchema.optional(),\n collapsible: z.boolean().optional(),\n component: z.literal(\"array-section\"),\n empty_message: I18nEntrySchema.optional(),\n remove_tooltip: I18nEntrySchema.optional(),\n sortable: z.boolean().optional(),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUIArraySectionPropsSchema>,\n PropertyUIArraySectionProps\n > = true\n}\n\n// Collapsible panel component schema\nconst PropertyUICollapsiblePanelPropsSchema = PropertyUICommonPropsSchema.extend({\n collapsible: z.boolean().optional(),\n component: z.literal(\"collapsible-panel\"),\n default_collapsed: z.boolean().optional(),\n panel_title: I18nEntrySchema.optional(),\n remove_tooltip: I18nEntrySchema.optional(),\n sortable: z.boolean().optional(),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUICollapsiblePanelPropsSchema>,\n PropertyUICollapsiblePanelProps\n > = true\n}\n\nexport const PropertyUIPropsSchema = z.discriminatedUnion(\"component\", [\n PropertyUIInputPropsSchema,\n PropertyUITextareaPropsSchema,\n PropertyUIExpressionInputPropsSchema,\n PropertyUINumberInputPropsSchema,\n PropertyUICodeEditorPropsSchema,\n PropertyUISingleSelectPropsSchema,\n PropertyUIRadioGroupPropsSchema,\n PropertyUIEmojiPickerPropsSchema,\n PropertyUIColorPickerPropsSchema,\n PropertyUIMultiSelectPropsSchema,\n PropertyUISwitchPropsSchema,\n PropertyUICheckboxPropsSchema,\n PropertyUISliderPropsSchema,\n PropertyUIKeyValueEditorPropsSchema,\n PropertyUITagInputPropsSchema,\n PropertyUICredentialSelectPropsSchema,\n PropertyUIJsonSchemaEditorPropsSchema,\n PropertyUIConditionsEditorPropsSchema,\n PropertyUIArraySectionPropsSchema,\n PropertyUICollapsiblePanelPropsSchema,\n PropertyUIEncryptedInputPropsSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertyUIPropsSchema>, PropertyUIProps> = true\n}\n\nexport const PropertyUIBooleanSchema = z.discriminatedUnion(\"component\", [\n PropertyUISwitchPropsSchema,\n PropertyUICheckboxPropsSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertyUIBooleanSchema>, PropertyUIBoolean> = true\n}\n\nexport const PropertyUINumberSchema = z.discriminatedUnion(\"component\", [\n PropertyUINumberInputPropsSchema,\n PropertyUISliderPropsSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertyUINumberSchema>, PropertyUINumber> = true\n}\n\nexport const PropertyUIStringSchema = z.discriminatedUnion(\"component\", [\n PropertyUIInputPropsSchema,\n PropertyUITextareaPropsSchema,\n PropertyUIExpressionInputPropsSchema,\n PropertyUICodeEditorPropsSchema,\n PropertyUISingleSelectPropsSchema,\n PropertyUICredentialSelectPropsSchema,\n PropertyUIRadioGroupPropsSchema,\n PropertyUIEmojiPickerPropsSchema,\n PropertyUIColorPickerPropsSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertyUIStringSchema>, PropertyUIString> = true\n}\n\nexport const PropertyUIArraySchema = z.discriminatedUnion(\"component\", [\n PropertyUIMultiSelectPropsSchema,\n PropertyUITagInputPropsSchema,\n PropertyUIKeyValueEditorPropsSchema,\n PropertyUISliderPropsSchema,\n PropertyUIArraySectionPropsSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertyUIArraySchema>, PropertyUIArray> = true\n}\n\nexport const PropertyUIObjectSchema = z.discriminatedUnion(\"component\", [\n PropertyUICollapsiblePanelPropsSchema,\n PropertyUIJsonSchemaEditorPropsSchema,\n PropertyUIConditionsEditorPropsSchema,\n PropertyUICodeEditorPropsSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertyUIObjectSchema>, PropertyUIObject> = true\n}\n\nexport const PropertyUICredentialIdSchema = z.discriminatedUnion(\"component\", [\n PropertyUICredentialSelectPropsSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertyUICredentialIdSchema>, PropertyUICredentialId> = true\n}\n\nexport const PropertyUIDiscriminatorUISchema = z.discriminatedUnion(\"component\", [\n PropertyUISwitchPropsSchema,\n PropertyUISingleSelectPropsSchema,\n PropertyUIRadioGroupPropsSchema,\n])\n\nexport const PropertyUIDiscriminatorUnionUISchema = z.discriminatedUnion(\"component\", [\n PropertyUICollapsiblePanelPropsSchema,\n])\n\nexport const PropertyUIEncryptedStringSchema = z.discriminatedUnion(\"component\", [\n PropertyUIEncryptedInputPropsSchema,\n])\n","import type { IsEqual, JsonValue } from \"type-fest\"\nimport { z } from \"zod\"\nimport type {\n DisplayCondition,\n FilterOperators,\n Property,\n PropertyArray,\n PropertyBase,\n PropertyBoolean,\n PropertyCredentialId,\n PropertyDiscriminatedUnion,\n PropertyEncryptedString,\n PropertyNumber,\n PropertyObject,\n PropertyString,\n} from \"../types\"\nimport { compact } from \"../utils/toolkit\"\nimport { I18nEntrySchema } from \"./common\"\nimport {\n PropertyUIArraySchema,\n PropertyUIBooleanSchema,\n PropertyUICommonPropsSchema,\n PropertyUICredentialIdSchema,\n PropertyUIDiscriminatorUISchema,\n PropertyUIDiscriminatorUnionUISchema,\n PropertyUIEncryptedStringSchema,\n PropertyUINumberSchema,\n PropertyUIObjectSchema,\n PropertyUIStringSchema,\n} from \"./property-ui\"\n\nconst JsonPrimitiveSchema = z.union([z.string(), z.number(), z.boolean(), z.null()])\nconst JsonValueSchema: z.ZodType<JsonValue> = z.lazy(() =>\n z.union([JsonPrimitiveSchema, z.array(JsonValueSchema), z.record(z.string(), JsonValueSchema)]),\n)\n\nconst FilterOperatorsSchema = z.object({\n $eq: JsonValueSchema.optional(),\n $exists: z.boolean().optional(),\n $gt: JsonValueSchema.optional(),\n $gte: JsonValueSchema.optional(),\n $in: z.array(JsonValueSchema).optional(),\n $lt: JsonValueSchema.optional(),\n $lte: JsonValueSchema.optional(),\n $mod: z.tuple([z.number(), z.number()]).optional(),\n $ne: JsonValueSchema.optional(),\n $nin: z.array(JsonValueSchema).optional(),\n $options: z.string().optional(),\n $regex: z.union([z.string(), z.instanceof(RegExp)]).optional(),\n $size: z.number().optional(),\n})\n\nconst ConditionSchema = z.union([JsonValueSchema, FilterOperatorsSchema])\n\nconst RootFilterSchema = z.object({\n get $and() {\n return z.array(FilterSchema).optional()\n },\n get $nor() {\n return z.array(FilterSchema).optional()\n },\n get $or() {\n return z.array(FilterSchema).optional()\n },\n})\n{\n const _: IsEqual<z.infer<typeof FilterOperatorsSchema>, FilterOperators> = true\n}\n\n// skip infer because of recursive structure\nconst FilterSchema: z.ZodType<DisplayCondition> = z.union([\n z.record(z.string(), ConditionSchema),\n RootFilterSchema,\n])\n\nconst PropertyBaseSchema = z.object({\n name: z\n .string()\n .min(1, \"name cannot be empty\")\n .refine(\n (val) => {\n const regexStartsWithDollarOrWhitespace = /^[\\s$]/\n return !regexStartsWithDollarOrWhitespace.test(val)\n },\n {\n error: \"name cannot start with $ or whitespace\",\n abort: true,\n },\n )\n .refine(\n (val) => {\n const forbiddenCharacters = [\".\", \"[\", \"]\"]\n return !forbiddenCharacters.some((char) => val.includes(char))\n },\n {\n error: 'name cannot contain \".\", \"[\", or \"]\" characters',\n abort: true,\n },\n ),\n\n display_name: I18nEntrySchema.optional(),\n required: z.boolean().optional(),\n display: z\n .object({\n hide: FilterSchema.optional(),\n show: FilterSchema.optional(),\n })\n .optional(),\n ai: z\n .object({\n llm_description: I18nEntrySchema.optional(),\n })\n .optional(),\n ui: PropertyUICommonPropsSchema.optional(),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyBaseSchema>, PropertyBase<string>> = true\n}\n\nconst PropertyStringSchema = PropertyBaseSchema.extend({\n type: z.literal(\"string\"),\n constant: z.string().optional(),\n default: z.string().optional(),\n enum: z.array(z.string()).optional(),\n max_length: z.number().optional(),\n min_length: z.number().optional(),\n ui: PropertyUIStringSchema.optional(),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyStringSchema>, PropertyString<string>> = true\n}\n\nconst PropertyNumberSchema = PropertyBaseSchema.extend({\n type: z.union([z.literal(\"number\"), z.literal(\"integer\")]),\n constant: z.number().optional(),\n default: z.number().optional(),\n enum: z.array(z.number()).optional(),\n maximum: z.number().optional(),\n minimum: z.number().optional(),\n ui: PropertyUINumberSchema.optional(),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyNumberSchema>, PropertyNumber<string>> = true\n}\n\nconst PropertyBooleanSchema = PropertyBaseSchema.extend({\n type: z.literal(\"boolean\"),\n constant: z.boolean().optional(),\n default: z.boolean().optional(),\n enum: z.array(z.boolean()).optional(),\n ui: PropertyUIBooleanSchema.optional(),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyBooleanSchema>, PropertyBoolean<string>> = true\n}\n\nfunction setDuplicatePropertyNamesCheck<T extends z.ZodType<Array<Property>>>(schema: T) {\n return schema.refine(\n (properties) => {\n const names = new Set<string>()\n for (const prop of properties) {\n if (names.has(prop.name)) return false\n names.add(prop.name)\n }\n return true\n },\n {\n error: \"duplicate property names are not allowed\",\n },\n )\n}\n\n// use type assertion and lazy to avoid circular reference error\nconst ArrayPropertiesSchema: z.ZodType<PropertyObject[\"properties\"]> = z.lazy(() =>\n z.array(PropertySchema).apply(setDuplicatePropertyNamesCheck),\n)\n\nconst additionalPropertiesSchema: z.ZodType<Property> = z.lazy(() => PropertySchema)\n\nconst PropertyObjectSchema = PropertyBaseSchema.extend({\n type: z.literal(\"object\"),\n properties: ArrayPropertiesSchema,\n additional_properties: additionalPropertiesSchema.optional(),\n constant: z.record(z.string(), JsonValueSchema).optional(),\n default: z.record(z.string(), JsonValueSchema).optional(),\n enum: z.array(z.record(z.string(), JsonValueSchema)).optional(),\n ui: PropertyUIObjectSchema.optional(),\n}).refine(\n (v) => {\n if (v.constant) return v.properties.length === 0\n return true\n },\n {\n error: \"properties must be empty when constant is defined\",\n abort: true,\n },\n)\n{\n type PropertyObjectInferred = z.infer<typeof PropertyObjectSchema>\n const _: IsEqual<PropertyObjectInferred, PropertyObject> = true\n}\n\nconst PropertyDiscriminatedUnionSchema = PropertyBaseSchema.extend({\n type: z.literal(\"discriminated_union\"),\n get any_of() {\n return z.array(PropertyObjectSchema).min(2, \"anyOf must have at least two items\")\n },\n discriminator: z.string().min(1, \"discriminator cannot be empty\"),\n discriminator_ui: PropertyUIDiscriminatorUISchema.optional(),\n ui: PropertyUIDiscriminatorUnionUISchema.optional(),\n})\n .refine(\n (v) => {\n const { any_of, discriminator } = v\n return any_of.every((i) => {\n const discriminatorProperty = i.properties?.find((p) => p.name === discriminator)\n if (!discriminatorProperty) return false\n if (!(\"constant\" in discriminatorProperty)) return false\n if (\n typeof discriminatorProperty.constant !== \"string\" &&\n typeof discriminatorProperty.constant !== \"number\" &&\n typeof discriminatorProperty.constant !== \"boolean\"\n ) {\n return false\n }\n return true\n })\n },\n {\n error:\n \"Each item in anyOf must contain the discriminator field with constant string/number/boolean value\",\n abort: true,\n },\n )\n .refine(\n (v) => {\n const { any_of } = v\n const allDiscriminatorProperty = compact(\n any_of.map((i) => {\n const discriminatorProperty = i.properties?.find((p) => p.name === v.discriminator)\n if (!discriminatorProperty) return null\n if (!(\"constant\" in discriminatorProperty)) return null\n return discriminatorProperty.constant\n }),\n )\n const uniqueValues = new Set(allDiscriminatorProperty)\n return uniqueValues.size === allDiscriminatorProperty.length\n },\n {\n error: \"Discriminator values must be unique across all anyOf items\",\n },\n )\n{\n const _: IsEqual<\n z.infer<typeof PropertyDiscriminatedUnionSchema>,\n PropertyDiscriminatedUnion\n > = true\n}\n\nconst PropertyArraySchema = PropertyBaseSchema.extend({\n type: z.literal(\"array\"),\n constant: z.array(JsonValueSchema).optional(),\n default: z.array(JsonValueSchema).optional(),\n enum: z.array(z.array(JsonValueSchema)).optional(),\n get items() {\n return PropertySchema\n },\n max_items: z.number().optional(),\n min_items: z.number().optional(),\n ui: PropertyUIArraySchema.optional(),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyArraySchema>, PropertyArray> = true\n}\n\nconst PropertyCredentialIdSchema = PropertyBaseSchema.extend({\n type: z.literal(\"credential_id\"),\n credential_name: z.string().min(1, \"credential_name cannot be empty\"),\n ui: PropertyUICredentialIdSchema.optional(),\n})\n\n{\n const _: IsEqual<z.infer<typeof PropertyCredentialIdSchema>, PropertyCredentialId<string>> = true\n}\nconst PropertyEncryptedStringSchema = PropertyBaseSchema.extend({\n type: z.literal(\"encrypted_string\"),\n ui: PropertyUIEncryptedStringSchema.optional(),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyEncryptedStringSchema>, PropertyEncryptedString> = true\n}\n\nconst PropertySchema = z.union([\n PropertyStringSchema,\n PropertyBooleanSchema,\n PropertyNumberSchema,\n PropertyArraySchema,\n PropertyObjectSchema,\n PropertyCredentialIdSchema,\n PropertyEncryptedStringSchema,\n PropertyDiscriminatedUnionSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertySchema>, Property> = true\n}\n\nexport const PropertiesSchema = z.array(PropertySchema).apply(setDuplicatePropertyNamesCheck)\n","import type { IsEqual } from \"type-fest\"\nimport { z } from \"zod\"\nimport type {\n BaseDefinition,\n CredentialDefinition,\n ModelDefinition,\n PluginDefinition,\n ToolDefinition,\n} from \"../types\"\nimport { JsonValueSchema } from \"../utils/custom-json-value\"\nimport { I18nEntrySchema } from \"./common\"\nimport { PropertiesSchema } from \"./property\"\n\n/**\n * 基础定义模式\n *\n * 此为所有功能定义模式的基类,定义了通用的属性,不单独使用\n */\nexport const BaseDefinitionSchema = z.object({\n // 1. 只能出现英文字母(大小写不敏感)和数字以及_和-\n // 2. 开头只能是英文字母,结尾不能是_和-\n // 3. _和-不能连续出现多次\n // 4. 最小长度 4,最大长度 64\n name: z.string().regex(/^[a-zA-Z](?:(?![_-]{2,})[a-zA-Z0-9_-]){3,63}[a-zA-Z0-9]$/, {\n error:\n \"Invalid name, should match the following rules: 1. only English letters, numbers, _ and - 2. start with English letter, end with English letter or number 3. _ and - cannot appear consecutively more than twice 4. minimum length 4, maximum length 64\",\n }),\n display_name: I18nEntrySchema,\n description: I18nEntrySchema,\n icon: z.string(),\n parameters: PropertiesSchema,\n settings: PropertiesSchema.optional(),\n})\n{\n const _: IsEqual<z.infer<typeof BaseDefinitionSchema>, BaseDefinition> = true\n}\n\nexport const PluginDefinitionSchema = z.object({\n ...BaseDefinitionSchema.omit({ parameters: true, settings: true }).shape,\n author: z.string(),\n email: z.email(),\n repo: z.httpUrl().optional(),\n version: z.string().optional(),\n locales: z.array(z.string()),\n})\n{\n const _: IsEqual<\n z.infer<typeof PluginDefinitionSchema>,\n Omit<PluginDefinition<string[], unknown>, \"transporterOptions\"> // not necessary to verify transpoterOptions\n > = true\n}\n\nexport const CredentialDefinitionSchema = z.object({\n ...BaseDefinitionSchema.omit({ settings: true }).shape,\n})\n{\n const _: IsEqual<z.infer<typeof CredentialDefinitionSchema>, CredentialDefinition> = true\n}\n\nexport const DataSourceDefinitionSchema = z.object({\n ...BaseDefinitionSchema.shape,\n})\n\nexport type DataSourceDefinition = z.infer<typeof DataSourceDefinitionSchema>\n\nexport const ModelDefinitionSchema = z.object({\n ...BaseDefinitionSchema.omit({ parameters: true, settings: true }).shape,\n name: z.string().regex(/^[a-zA-Z](?:(?![_-]{2,})[a-zA-Z0-9_/-]){3,63}[a-zA-Z0-9]$/, {\n error:\n \"Invalid model name, should match the following rules: 1. only English letters, numbers, _ and - 2. start with English letter, end with English letter or number 3. _ and - cannot appear consecutively more than twice 4. minimum length 4, maximum length 64 5. allow '/' in the middle\",\n }),\n model_type: z.literal(\"llm\"),\n default_endpoint: z.httpUrl().optional(),\n input_modalities: z.array(z.enum([\"file\", \"image\", \"text\"])),\n output_modalities: z.array(z.enum([\"text\"])),\n pricing: z\n .object({\n currency: z.string().optional(),\n input: z.number().optional(),\n input_cache_read: z.number().optional(),\n input_cache_write: z.number().optional(),\n output: z.number().optional(),\n request: z.number().optional(),\n })\n .optional(),\n override_parameters: z\n .object({\n temperature: z\n .object({\n default: z.number().optional(),\n maximum: z.number().optional(),\n minimum: z.number().optional(),\n })\n .optional(),\n frequency_penalty: z\n .object({\n default: z.number().optional(),\n maximum: z.number().optional(),\n minimum: z.number().optional(),\n })\n .optional(),\n max_tokens: z\n .object({\n default: z.number().optional(),\n maximum: z.number().optional(),\n })\n .optional(),\n verbosity: z\n .object({\n default: z.enum([\"low\", \"medium\", \"high\"]).optional(),\n })\n .optional(),\n })\n .optional(),\n unsupported_parameters: z.array(\n z.enum([\n \"endpoint\",\n \"temperature\",\n // \"top_p\",\n // \"top_k\",\n \"frequency_penalty\",\n // \"presence_penalty\",\n // \"repetition_penalty\",\n // \"min_p\",\n // \"top_a\",\n \"seed\",\n \"max_tokens\",\n // \"logit_bias\",\n // \"logprobs\",\n // \"top_logprobs\",\n // \"response_format\",\n // \"json_response\",\n \"json_schema\",\n \"stream\",\n \"stream_options\",\n \"structured_outputs\",\n // \"stop\",\n // \"tools\",\n // \"tool_choice\",\n \"parallel_tool_calls\",\n \"verbosity\",\n ]),\n ),\n})\n{\n const _: IsEqual<z.infer<typeof ModelDefinitionSchema>, ModelDefinition> = true\n}\n\nexport const ToolDefinitionSchema = z.object({\n ...BaseDefinitionSchema.shape,\n invoke: z.function({\n input: z.tuple([z.object({ args: z.any() })]),\n output: z.promise(JsonValueSchema),\n }),\n})\n{\n const _: IsEqual<z.infer<typeof ToolDefinitionSchema>, ToolDefinition> = true\n}\n"],"mappings":";;;AAAA,SAAgB,cAAc,OAAkD;AAC9E,KAAI,UAAU,QAAQ,OAAO,UAAU,SAAU,QAAO;AACxD,KAAI,OAAO,UAAU,SAAS,KAAK,MAAM,KAAK,kBAAmB,QAAO;CAExE,MAAM,QAAQ,OAAO,eAAe,MAAM;AAC1C,QAAO,UAAU,OAAO,aAAa,UAAU;;AAGjD,SAAgB,QACd,QACK;AAGL,QAAO,OAAO,OAAO,QAAQ;;;;;;;;;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U;EACvC,mBAAmB,EAAE,QAAQ,CAAC,UAAU;EACxC,QAAQ,EAAE,QAAQ,CAAC,UAAU;EAC7B,SAAS,EAAE,QAAQ,CAAC,UAAU;EAC/B,CAAC,CACD,UAAU;CACb,qBAAqB,EAClB,OAAO;EACN,aAAa,EACV,OAAO;GACN,SAAS,EAAE,QAAQ,CAAC,UAAU;GAC9B,SAAS,EAAE,QAAQ,CAAC,UAAU;GAC9B,SAAS,EAAE,QAAQ,CAAC,UAAU;GAC/B,CAAC,CACD,UAAU;EACb,mBAAmB,EAChB,OAAO;GACN,SAAS,EAAE,QAAQ,CAAC,UAAU;GAC9B,SAAS,EAAE,QAAQ,CAAC,UAAU;GAC9B,SAAS,EAAE,QAAQ,CAAC,UAAU;GAC/B,CAAC,CACD,UAAU;EACb,YAAY,EACT,OAAO;GACN,SAAS,EAAE,QAAQ,CAAC,UAAU;GAC9B,SAAS,EAAE,QAAQ,CAAC,UAAU;GAC/B,CAAC,CACD,UAAU;EACb,WAAW,EACR,OAAO,EACN,SAAS,EAAE,KAAK;GAAC;GAAO;GAAU;GAAO,CAAC,CAAC,UAAU,EACtD,CAAC,CACD,UAAU;EACd,CAAC,CACD,UAAU;CACb,wBAAwB,EAAE,MACxB,EAAE,KAAK;EACL;EACA;EAGA;EAKA;EACA;EAMA;EACA;EACA;EACA;EAIA;EACA;EACD,CAAC,CACH;CACF,CAAC;AAKF,MAAa,uBAAuB,EAAE,OAAO;CAC3C,GAAG,qBAAqB;CACxB,QAAQ,EAAE,SAAS;EACjB,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;EAC7C,QAAQ,EAAE,QAAQ,gBAAgB;EACnC,CAAC;CACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"schemas.js","names":["JsonValueSchema"],"sources":["../src/utils/toolkit.ts","../src/schemas/common.ts","../src/utils/custom-json-value.ts","../src/schemas/property-ui.ts","../src/schemas/property.ts","../src/schemas/definition.ts"],"sourcesContent":["export function isPlainObject(value: unknown): value is Record<string, unknown> {\n if (value === null || typeof value !== \"object\") return false\n if (Object.prototype.toString.call(value) !== \"[object Object]\") return false\n\n const proto = Object.getPrototypeOf(value)\n return proto === Object.prototype || proto === null\n}\n\nexport function compact<T>(\n values: Array<T | null | undefined | false | 0 | \"\" | typeof Number.NaN>,\n): T[] {\n // Match common \"compact\" behavior: drop falsy values.\n // Note: `NaN` is truthy? Actually `Boolean(NaN) === false`, so it will be removed too.\n return values.filter(Boolean) as T[]\n}\n","import type { IsEqual } from \"type-fest\"\nimport { z } from \"zod\"\nimport type { I18nText } from \"../types\"\nimport { isPlainObject } from \"../utils/toolkit\"\n\n/**\n * I18n 词条模式\n *\n * NOTE: Zod 无法定义复杂的字面量模版,此处使用 `z.custom` 实现自定义验证\n */\nexport const I18nEntrySchema = z.custom<I18nText>((value) => {\n // 必须是对象字面量\n if (!isPlainObject(value)) return false\n // 必须包含 en_US 键\n if (!(\"en_US\" in value)) return false\n\n for (const [locale, text] of Object.entries(value)) {\n // 值必须是字符串\n if (typeof text !== \"string\") return false\n\n // NOTE: 支持的语言码并不严格符合标准,因为 TS 字面量模版无法描述所有可能的情况\n // 故以下仅对满足需求的子集做简单检查而不是严格的 RFC 5646 标准检查\n const parts = locale.split(\"_\")\n // 其它语言代码必须符合格式:<语言代码>_<国家或脚本代码>,且第二部份首字母必须大写\n if (parts.length !== 2 || parts[1][0] !== parts[1][0].toUpperCase()) {\n return false\n }\n }\n return true\n}, \"Invalid I18n entry\")\n{\n const _: IsEqual<z.infer<typeof I18nEntrySchema>, I18nText> = true\n}\n","/**\n * Custom JSON Value Schema and Type\n *\n * Why? Because `z.json()` is not compatible with `JSONValue` from type-fest\n */\n\nimport { z } from \"zod\"\n\n/**\n * Custom JSON Value Schema\n * @description Custom JSON Value Schema is a schema that allows any JSON value\n */\nexport const JsonValueSchema = z.json()\n\n/**\n * Custom JSON Value Type\n * @description Custom JSON Value Type is the type of the JSON value\n */\nexport type JsonValue = z.infer<typeof JsonValueSchema>\n","import type { IntRange, IsEqual } from \"type-fest\"\nimport { z } from \"zod\"\nimport type {\n PropertyUIArray,\n PropertyUIArraySectionProps,\n PropertyUIBoolean,\n PropertyUICollapsiblePanelProps,\n PropertyUIColorPickerProps,\n PropertyUICredentialId,\n PropertyUIEmojiPickerProps,\n PropertyUIEncryptedInputProps,\n PropertyUIInputProps,\n PropertyUIKeyValueEditorProps,\n PropertyUINumber,\n PropertyUIObject,\n PropertyUIOption,\n PropertyUIProps,\n PropertyUIRadioGroupProps,\n PropertyUISingleSelectProps,\n PropertyUIString,\n PropertyUISwitchProps,\n} from \"../types\"\nimport { I18nEntrySchema } from \"./common\"\n\nconst indentationSchema = z.union([\n z.literal(2),\n z.literal(4),\n z.literal(6),\n z.literal(8),\n z.literal(10),\n z.literal(12),\n z.literal(14),\n z.literal(16),\n z.literal(18),\n z.literal(20),\n z.literal(22),\n z.literal(24),\n z.literal(26),\n z.literal(28),\n z.literal(30),\n z.literal(32),\n z.literal(34),\n z.literal(36),\n z.literal(38),\n z.literal(40),\n z.literal(42),\n z.literal(44),\n z.literal(46),\n z.literal(48),\n z.literal(50),\n z.literal(52),\n z.literal(54),\n z.literal(56),\n z.literal(58),\n z.literal(60),\n z.literal(62),\n z.literal(64),\n z.literal(66),\n z.literal(68),\n z.literal(70),\n z.literal(72),\n z.literal(74),\n z.literal(76),\n z.literal(78),\n z.literal(80),\n])\n{\n const _: IsEqual<z.infer<typeof indentationSchema>, IntRange<2, 81, 2>> = true\n}\n\n// Common UI properties schema\nexport const PropertyUICommonPropsSchema = z.object({\n disabled: z.boolean().optional(),\n hint: I18nEntrySchema.optional(),\n placeholder: I18nEntrySchema.optional(),\n readonly: z.boolean().optional(),\n sensitive: z.boolean().optional(),\n support_expression: z.boolean().optional(),\n width: z.enum([\"small\", \"medium\", \"full\"]).optional(),\n indentation: indentationSchema.optional(),\n display_none: z.boolean().optional(),\n})\n\n// Option schema for select components\nexport const PropertyUIOptionSchema = z.object({\n icon: z.string().optional(),\n label: I18nEntrySchema,\n value: z.union([z.string(), z.number(), z.boolean()]),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyUIOptionSchema>, PropertyUIOption> = true\n}\n\nconst PropertyUIInputPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"input\"),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyUIInputPropsSchema>, PropertyUIInputProps> = true\n}\n\nexport const PropertyUIEncryptedInputPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"encrypted-input\"),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUIEncryptedInputPropsSchema>,\n PropertyUIEncryptedInputProps\n > = true\n}\n\n// Textarea component schema\nconst PropertyUITextareaPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"textarea\"),\n max_height: z.number().optional(),\n min_height: z.number().optional(),\n})\n\n// Expression input component schema\nconst PropertyUIExpressionInputPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.enum([\"expression-input\", \"expression-textarea\"]),\n max_height: z.number().optional(),\n min_height: z.number().optional(),\n})\n\n// Number input component schema\nconst PropertyUINumberInputPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"number-input\"),\n step: z.number().optional(),\n suffix: z.string().optional(),\n})\n\n// Code editor component schema\nconst PropertyUICodeEditorPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"code-editor\"),\n language: z.enum([\"json\", \"javascript\", \"python3\", \"html\"]).optional(),\n line_numbers: z.boolean().optional(),\n max_height: z.number().optional(),\n min_height: z.number().optional(),\n})\n\n// Select base schema\nconst PropertyUISelectPropsBaseSchema = z.object({\n clearable: z.boolean().optional(),\n options: z.array(PropertyUIOptionSchema).optional(),\n searchable: z.boolean().optional(),\n})\n\n// Single select component schema\nconst PropertyUISingleSelectPropsSchema = PropertyUICommonPropsSchema.merge(\n PropertyUISelectPropsBaseSchema,\n).extend({\n component: z.literal(\"select\"),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUISingleSelectPropsSchema>,\n PropertyUISingleSelectProps\n > = true\n}\n\n// Radio group component schema\nconst PropertyUIRadioGroupPropsSchema = PropertyUICommonPropsSchema.merge(\n PropertyUISelectPropsBaseSchema,\n).extend({\n component: z.literal(\"radio-group\"),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUIRadioGroupPropsSchema>,\n PropertyUIRadioGroupProps\n > = true\n}\n\n// Multi select component schema\nconst PropertyUIMultiSelectPropsSchema = PropertyUICommonPropsSchema.merge(\n PropertyUISelectPropsBaseSchema,\n).extend({\n component: z.literal(\"multi-select\"),\n})\n\n// Switch component schema\nconst PropertyUISwitchPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"switch\"),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyUISwitchPropsSchema>, PropertyUISwitchProps> = true\n}\n\n// Checkbox component schema\nconst PropertyUICheckboxPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"checkbox\"),\n})\n\n// Slider component schema\nconst PropertyUISliderPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"slider\"),\n marks: z.record(z.number(), z.string()).optional(),\n show_value: z.boolean().optional(),\n step: z.number().optional(),\n})\n\n// Key-value editor component schema\nconst PropertyUIKeyValueEditorPropsSchema = PropertyUICommonPropsSchema.extend({\n add_button_label: I18nEntrySchema.optional(),\n component: z.literal(\"key-value-editor\"),\n empty_description: I18nEntrySchema.optional(),\n section_header: I18nEntrySchema.optional(),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUIKeyValueEditorPropsSchema>,\n PropertyUIKeyValueEditorProps\n > = true\n}\n\n// Tag input component schema\nconst PropertyUITagInputPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"tag-input\"),\n})\n\n// Emoji picker component schema\nconst PropertyUIEmojiPickerPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"emoji-picker\"),\n size: z.enum([\"extra-small\", \"small\", \"medium\", \"large\"]).optional(),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUIEmojiPickerPropsSchema>,\n PropertyUIEmojiPickerProps\n > = true\n}\n\n// Color picker component schema\nconst PropertyUIColorPickerPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"color-picker\"),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUIColorPickerPropsSchema>,\n PropertyUIColorPickerProps\n > = true\n}\n\n// Credential select component schema\nconst PropertyUICredentialSelectPropsSchema = PropertyUICommonPropsSchema.extend({\n clearable: z.boolean().optional(),\n component: z.literal(\"credential-select\"),\n searchable: z.boolean().optional(),\n})\n\n// JSON Schema editor component schema\nconst PropertyUIJsonSchemaEditorPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"json-schema-editor\"),\n})\n\n// Conditions editor component schema\nconst PropertyUIConditionsEditorPropsSchema = PropertyUICommonPropsSchema.extend({\n component: z.literal(\"conditions-editor\"),\n})\n\n// Array section component schema\nconst PropertyUIArraySectionPropsSchema = PropertyUICommonPropsSchema.extend({\n add_label: I18nEntrySchema.optional(),\n collapsible: z.boolean().optional(),\n component: z.literal(\"array-section\"),\n empty_message: I18nEntrySchema.optional(),\n remove_tooltip: I18nEntrySchema.optional(),\n sortable: z.boolean().optional(),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUIArraySectionPropsSchema>,\n PropertyUIArraySectionProps\n > = true\n}\n\n// Collapsible panel component schema\nconst PropertyUICollapsiblePanelPropsSchema = PropertyUICommonPropsSchema.extend({\n collapsible: z.boolean().optional(),\n component: z.literal(\"collapsible-panel\"),\n default_collapsed: z.boolean().optional(),\n panel_title: I18nEntrySchema.optional(),\n remove_tooltip: I18nEntrySchema.optional(),\n sortable: z.boolean().optional(),\n})\n{\n const _: IsEqual<\n z.infer<typeof PropertyUICollapsiblePanelPropsSchema>,\n PropertyUICollapsiblePanelProps\n > = true\n}\n\nexport const PropertyUIPropsSchema = z.discriminatedUnion(\"component\", [\n PropertyUIInputPropsSchema,\n PropertyUITextareaPropsSchema,\n PropertyUIExpressionInputPropsSchema,\n PropertyUINumberInputPropsSchema,\n PropertyUICodeEditorPropsSchema,\n PropertyUISingleSelectPropsSchema,\n PropertyUIRadioGroupPropsSchema,\n PropertyUIEmojiPickerPropsSchema,\n PropertyUIColorPickerPropsSchema,\n PropertyUIMultiSelectPropsSchema,\n PropertyUISwitchPropsSchema,\n PropertyUICheckboxPropsSchema,\n PropertyUISliderPropsSchema,\n PropertyUIKeyValueEditorPropsSchema,\n PropertyUITagInputPropsSchema,\n PropertyUICredentialSelectPropsSchema,\n PropertyUIJsonSchemaEditorPropsSchema,\n PropertyUIConditionsEditorPropsSchema,\n PropertyUIArraySectionPropsSchema,\n PropertyUICollapsiblePanelPropsSchema,\n PropertyUIEncryptedInputPropsSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertyUIPropsSchema>, PropertyUIProps> = true\n}\n\nexport const PropertyUIBooleanSchema = z.discriminatedUnion(\"component\", [\n PropertyUISwitchPropsSchema,\n PropertyUICheckboxPropsSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertyUIBooleanSchema>, PropertyUIBoolean> = true\n}\n\nexport const PropertyUINumberSchema = z.discriminatedUnion(\"component\", [\n PropertyUINumberInputPropsSchema,\n PropertyUISliderPropsSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertyUINumberSchema>, PropertyUINumber> = true\n}\n\nexport const PropertyUIStringSchema = z.discriminatedUnion(\"component\", [\n PropertyUIInputPropsSchema,\n PropertyUITextareaPropsSchema,\n PropertyUIExpressionInputPropsSchema,\n PropertyUICodeEditorPropsSchema,\n PropertyUISingleSelectPropsSchema,\n PropertyUICredentialSelectPropsSchema,\n PropertyUIRadioGroupPropsSchema,\n PropertyUIEmojiPickerPropsSchema,\n PropertyUIColorPickerPropsSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertyUIStringSchema>, PropertyUIString> = true\n}\n\nexport const PropertyUIArraySchema = z.discriminatedUnion(\"component\", [\n PropertyUIMultiSelectPropsSchema,\n PropertyUITagInputPropsSchema,\n PropertyUIKeyValueEditorPropsSchema,\n PropertyUISliderPropsSchema,\n PropertyUIArraySectionPropsSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertyUIArraySchema>, PropertyUIArray> = true\n}\n\nexport const PropertyUIObjectSchema = z.discriminatedUnion(\"component\", [\n PropertyUICollapsiblePanelPropsSchema,\n PropertyUIJsonSchemaEditorPropsSchema,\n PropertyUIConditionsEditorPropsSchema,\n PropertyUICodeEditorPropsSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertyUIObjectSchema>, PropertyUIObject> = true\n}\n\nexport const PropertyUICredentialIdSchema = z.discriminatedUnion(\"component\", [\n PropertyUICredentialSelectPropsSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertyUICredentialIdSchema>, PropertyUICredentialId> = true\n}\n\nexport const PropertyUIDiscriminatorUISchema = z.discriminatedUnion(\"component\", [\n PropertyUISwitchPropsSchema,\n PropertyUISingleSelectPropsSchema,\n PropertyUIRadioGroupPropsSchema,\n])\n\nexport const PropertyUIDiscriminatorUnionUISchema = z.discriminatedUnion(\"component\", [\n PropertyUICollapsiblePanelPropsSchema,\n])\n\nexport const PropertyUIEncryptedStringSchema = z.discriminatedUnion(\"component\", [\n PropertyUIEncryptedInputPropsSchema,\n])\n","import type { IsEqual, JsonValue } from \"type-fest\"\nimport { z } from \"zod\"\nimport type {\n DisplayCondition,\n FilterOperators,\n Property,\n PropertyArray,\n PropertyBase,\n PropertyBoolean,\n PropertyCredentialId,\n PropertyDiscriminatedUnion,\n PropertyEncryptedString,\n PropertyNumber,\n PropertyObject,\n PropertyString,\n} from \"../types\"\nimport { compact } from \"../utils/toolkit\"\nimport { I18nEntrySchema } from \"./common\"\nimport {\n PropertyUIArraySchema,\n PropertyUIBooleanSchema,\n PropertyUICommonPropsSchema,\n PropertyUICredentialIdSchema,\n PropertyUIDiscriminatorUISchema,\n PropertyUIDiscriminatorUnionUISchema,\n PropertyUIEncryptedStringSchema,\n PropertyUINumberSchema,\n PropertyUIObjectSchema,\n PropertyUIStringSchema,\n} from \"./property-ui\"\n\nconst JsonPrimitiveSchema = z.union([z.string(), z.number(), z.boolean(), z.null()])\nconst JsonValueSchema: z.ZodType<JsonValue> = z.lazy(() =>\n z.union([JsonPrimitiveSchema, z.array(JsonValueSchema), z.record(z.string(), JsonValueSchema)]),\n)\n\nconst FilterOperatorsSchema = z.object({\n $eq: JsonValueSchema.optional(),\n $exists: z.boolean().optional(),\n $gt: JsonValueSchema.optional(),\n $gte: JsonValueSchema.optional(),\n $in: z.array(JsonValueSchema).optional(),\n $lt: JsonValueSchema.optional(),\n $lte: JsonValueSchema.optional(),\n $mod: z.tuple([z.number(), z.number()]).optional(),\n $ne: JsonValueSchema.optional(),\n $nin: z.array(JsonValueSchema).optional(),\n $options: z.string().optional(),\n $regex: z.union([z.string(), z.instanceof(RegExp)]).optional(),\n $size: z.number().optional(),\n})\n\nconst ConditionSchema = z.union([JsonValueSchema, FilterOperatorsSchema])\n\nconst RootFilterSchema = z.object({\n get $and() {\n return z.array(FilterSchema).optional()\n },\n get $nor() {\n return z.array(FilterSchema).optional()\n },\n get $or() {\n return z.array(FilterSchema).optional()\n },\n})\n{\n const _: IsEqual<z.infer<typeof FilterOperatorsSchema>, FilterOperators> = true\n}\n\n// skip infer because of recursive structure\nconst FilterSchema: z.ZodType<DisplayCondition> = z.union([\n z.record(z.string(), ConditionSchema),\n RootFilterSchema,\n])\n\nconst PropertyBaseSchema = z.object({\n name: z\n .string()\n .min(1, \"name cannot be empty\")\n .refine(\n (val) => {\n const regexStartsWithDollarOrWhitespace = /^[\\s$]/\n return !regexStartsWithDollarOrWhitespace.test(val)\n },\n {\n error: \"name cannot start with $ or whitespace\",\n abort: true,\n },\n )\n .refine(\n (val) => {\n const forbiddenCharacters = [\".\", \"[\", \"]\"]\n return !forbiddenCharacters.some((char) => val.includes(char))\n },\n {\n error: 'name cannot contain \".\", \"[\", or \"]\" characters',\n abort: true,\n },\n ),\n\n display_name: I18nEntrySchema.optional(),\n required: z.boolean().optional(),\n display: z\n .object({\n hide: FilterSchema.optional(),\n show: FilterSchema.optional(),\n })\n .optional(),\n ai: z\n .object({\n llm_description: I18nEntrySchema.optional(),\n })\n .optional(),\n ui: PropertyUICommonPropsSchema.optional(),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyBaseSchema>, PropertyBase<string>> = true\n}\n\nconst PropertyStringSchema = PropertyBaseSchema.extend({\n type: z.literal(\"string\"),\n constant: z.string().optional(),\n default: z.string().optional(),\n enum: z.array(z.string()).optional(),\n max_length: z.number().optional(),\n min_length: z.number().optional(),\n ui: PropertyUIStringSchema.optional(),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyStringSchema>, PropertyString<string>> = true\n}\n\nconst PropertyNumberSchema = PropertyBaseSchema.extend({\n type: z.union([z.literal(\"number\"), z.literal(\"integer\")]),\n constant: z.number().optional(),\n default: z.number().optional(),\n enum: z.array(z.number()).optional(),\n maximum: z.number().optional(),\n minimum: z.number().optional(),\n ui: PropertyUINumberSchema.optional(),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyNumberSchema>, PropertyNumber<string>> = true\n}\n\nconst PropertyBooleanSchema = PropertyBaseSchema.extend({\n type: z.literal(\"boolean\"),\n constant: z.boolean().optional(),\n default: z.boolean().optional(),\n enum: z.array(z.boolean()).optional(),\n ui: PropertyUIBooleanSchema.optional(),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyBooleanSchema>, PropertyBoolean<string>> = true\n}\n\nfunction setDuplicatePropertyNamesCheck<T extends z.ZodType<Array<Property>>>(schema: T) {\n return schema.refine(\n (properties) => {\n const names = new Set<string>()\n for (const prop of properties) {\n if (names.has(prop.name)) return false\n names.add(prop.name)\n }\n return true\n },\n {\n error: \"duplicate property names are not allowed\",\n },\n )\n}\n\n// use type assertion and lazy to avoid circular reference error\nconst ArrayPropertiesSchema: z.ZodType<PropertyObject[\"properties\"]> = z.lazy(() =>\n z.array(PropertySchema).apply(setDuplicatePropertyNamesCheck),\n)\n\nconst additionalPropertiesSchema: z.ZodType<Property> = z.lazy(() => PropertySchema)\n\nconst PropertyObjectSchema = PropertyBaseSchema.extend({\n type: z.literal(\"object\"),\n properties: ArrayPropertiesSchema,\n additional_properties: additionalPropertiesSchema.optional(),\n constant: z.record(z.string(), JsonValueSchema).optional(),\n default: z.record(z.string(), JsonValueSchema).optional(),\n enum: z.array(z.record(z.string(), JsonValueSchema)).optional(),\n ui: PropertyUIObjectSchema.optional(),\n}).refine(\n (v) => {\n if (v.constant) return v.properties.length === 0\n return true\n },\n {\n error: \"properties must be empty when constant is defined\",\n abort: true,\n },\n)\n{\n type PropertyObjectInferred = z.infer<typeof PropertyObjectSchema>\n const _: IsEqual<PropertyObjectInferred, PropertyObject> = true\n}\n\nconst PropertyDiscriminatedUnionSchema = PropertyBaseSchema.extend({\n type: z.literal(\"discriminated_union\"),\n get any_of() {\n return z.array(PropertyObjectSchema).min(2, \"anyOf must have at least two items\")\n },\n discriminator: z.string().min(1, \"discriminator cannot be empty\"),\n discriminator_ui: PropertyUIDiscriminatorUISchema.optional(),\n ui: PropertyUIDiscriminatorUnionUISchema.optional(),\n})\n .refine(\n (v) => {\n const { any_of, discriminator } = v\n return any_of.every((i) => {\n const discriminatorProperty = i.properties?.find((p) => p.name === discriminator)\n if (!discriminatorProperty) return false\n if (!(\"constant\" in discriminatorProperty)) return false\n if (\n typeof discriminatorProperty.constant !== \"string\" &&\n typeof discriminatorProperty.constant !== \"number\" &&\n typeof discriminatorProperty.constant !== \"boolean\"\n ) {\n return false\n }\n return true\n })\n },\n {\n error:\n \"Each item in anyOf must contain the discriminator field with constant string/number/boolean value\",\n abort: true,\n },\n )\n .refine(\n (v) => {\n const { any_of } = v\n const allDiscriminatorProperty = compact(\n any_of.map((i) => {\n const discriminatorProperty = i.properties?.find((p) => p.name === v.discriminator)\n if (!discriminatorProperty) return null\n if (!(\"constant\" in discriminatorProperty)) return null\n return discriminatorProperty.constant\n }),\n )\n const uniqueValues = new Set(allDiscriminatorProperty)\n return uniqueValues.size === allDiscriminatorProperty.length\n },\n {\n error: \"Discriminator values must be unique across all anyOf items\",\n },\n )\n{\n const _: IsEqual<\n z.infer<typeof PropertyDiscriminatedUnionSchema>,\n PropertyDiscriminatedUnion\n > = true\n}\n\nconst PropertyArraySchema = PropertyBaseSchema.extend({\n type: z.literal(\"array\"),\n constant: z.array(JsonValueSchema).optional(),\n default: z.array(JsonValueSchema).optional(),\n enum: z.array(z.array(JsonValueSchema)).optional(),\n get items() {\n return PropertySchema\n },\n max_items: z.number().optional(),\n min_items: z.number().optional(),\n ui: PropertyUIArraySchema.optional(),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyArraySchema>, PropertyArray> = true\n}\n\nconst PropertyCredentialIdSchema = PropertyBaseSchema.extend({\n type: z.literal(\"credential_id\"),\n credential_name: z.string().min(1, \"credential_name cannot be empty\"),\n ui: PropertyUICredentialIdSchema.optional(),\n})\n\n{\n const _: IsEqual<z.infer<typeof PropertyCredentialIdSchema>, PropertyCredentialId<string>> = true\n}\nconst PropertyEncryptedStringSchema = PropertyBaseSchema.extend({\n type: z.literal(\"encrypted_string\"),\n ui: PropertyUIEncryptedStringSchema.optional(),\n})\n{\n const _: IsEqual<z.infer<typeof PropertyEncryptedStringSchema>, PropertyEncryptedString> = true\n}\n\nconst PropertySchema = z.union([\n PropertyStringSchema,\n PropertyBooleanSchema,\n PropertyNumberSchema,\n PropertyArraySchema,\n PropertyObjectSchema,\n PropertyCredentialIdSchema,\n PropertyEncryptedStringSchema,\n PropertyDiscriminatedUnionSchema,\n])\n{\n const _: IsEqual<z.infer<typeof PropertySchema>, Property> = true\n}\n\nexport const PropertiesSchema = z.array(PropertySchema).apply(setDuplicatePropertyNamesCheck)\n","import type { IsEqual } from \"type-fest\"\nimport { z } from \"zod\"\nimport type {\n BaseDefinition,\n CredentialDefinition,\n ModelDefinition,\n PluginDefinition,\n ToolDefinition,\n} from \"../types\"\nimport { JsonValueSchema } from \"../utils/custom-json-value\"\nimport { I18nEntrySchema } from \"./common\"\nimport { PropertiesSchema } from \"./property\"\n\n/**\n * 基础定义模式\n *\n * 此为所有功能定义模式的基类,定义了通用的属性,不单独使用\n */\nexport const BaseDefinitionSchema = z.object({\n // 1. 只能出现英文字母(大小写不敏感)和数字以及_和-\n // 2. 开头只能是英文字母,结尾不能是_和-\n // 3. _和-不能连续出现多次\n // 4. 最小长度 4,最大长度 64\n name: z.string().regex(/^[a-zA-Z](?:(?![_-]{2,})[a-zA-Z0-9_-]){3,63}[a-zA-Z0-9]$/, {\n error:\n \"Invalid name, should match the following rules: 1. only English letters, numbers, _ and - 2. start with English letter, end with English letter or number 3. _ and - cannot appear consecutively more than twice 4. minimum length 4, maximum length 64\",\n }),\n display_name: I18nEntrySchema,\n description: I18nEntrySchema,\n icon: z.string(),\n parameters: PropertiesSchema,\n settings: PropertiesSchema.optional(),\n})\n{\n const _: IsEqual<z.infer<typeof BaseDefinitionSchema>, BaseDefinition> = true\n}\n\nexport const PluginDefinitionSchema = z.object({\n ...BaseDefinitionSchema.omit({ parameters: true, settings: true }).shape,\n author: z.string().optional(),\n email: z.email().optional(),\n repo: z.httpUrl().optional(),\n version: z.string().optional(),\n locales: z.array(z.string()),\n})\n{\n const _: IsEqual<\n z.infer<typeof PluginDefinitionSchema>,\n Omit<PluginDefinition<string[], unknown>, \"transporterOptions\"> // not necessary to verify transpoterOptions\n > = true\n}\n\nexport const CredentialDefinitionSchema = z.object({\n ...BaseDefinitionSchema.omit({ settings: true }).shape,\n})\n{\n const _: IsEqual<z.infer<typeof CredentialDefinitionSchema>, CredentialDefinition> = true\n}\n\nexport const DataSourceDefinitionSchema = z.object({\n ...BaseDefinitionSchema.shape,\n})\n\nexport type DataSourceDefinition = z.infer<typeof DataSourceDefinitionSchema>\n\nexport const ModelDefinitionSchema = z.object({\n ...BaseDefinitionSchema.omit({ parameters: true, settings: true }).shape,\n name: z.string().regex(/^[a-zA-Z](?:(?![_-]{2,})[a-zA-Z0-9_/-]){3,63}[a-zA-Z0-9]$/, {\n error:\n \"Invalid model name, should match the following rules: 1. only English letters, numbers, _ and - 2. start with English letter, end with English letter or number 3. _ and - cannot appear consecutively more than twice 4. minimum length 4, maximum length 64 5. allow '/' in the middle\",\n }),\n model_type: z.literal(\"llm\"),\n default_endpoint: z.httpUrl().optional(),\n input_modalities: z.array(z.enum([\"file\", \"image\", \"text\"])),\n output_modalities: z.array(z.enum([\"text\"])),\n pricing: z\n .object({\n currency: z.string().optional(),\n input: z.number().optional(),\n input_cache_read: z.number().optional(),\n input_cache_write: z.number().optional(),\n output: z.number().optional(),\n request: z.number().optional(),\n })\n .optional(),\n override_parameters: z\n .object({\n temperature: z\n .object({\n default: z.number().optional(),\n maximum: z.number().optional(),\n minimum: z.number().optional(),\n })\n .optional(),\n frequency_penalty: z\n .object({\n default: z.number().optional(),\n maximum: z.number().optional(),\n minimum: z.number().optional(),\n })\n .optional(),\n max_tokens: z\n .object({\n default: z.number().optional(),\n maximum: z.number().optional(),\n })\n .optional(),\n verbosity: z\n .object({\n default: z.enum([\"low\", \"medium\", \"high\"]).optional(),\n })\n .optional(),\n })\n .optional(),\n unsupported_parameters: z.array(\n z.enum([\n \"endpoint\",\n \"temperature\",\n // \"top_p\",\n // \"top_k\",\n \"frequency_penalty\",\n // \"presence_penalty\",\n // \"repetition_penalty\",\n // \"min_p\",\n // \"top_a\",\n \"seed\",\n \"max_tokens\",\n // \"logit_bias\",\n // \"logprobs\",\n // \"top_logprobs\",\n // \"response_format\",\n // \"json_response\",\n \"json_schema\",\n \"stream\",\n \"stream_options\",\n \"structured_outputs\",\n // \"stop\",\n // \"tools\",\n // \"tool_choice\",\n \"parallel_tool_calls\",\n \"verbosity\",\n ]),\n ),\n})\n{\n const _: IsEqual<z.infer<typeof ModelDefinitionSchema>, ModelDefinition> = true\n}\n\nexport const ToolDefinitionSchema = z.object({\n ...BaseDefinitionSchema.shape,\n invoke: z.function({\n input: z.tuple([z.object({ args: z.any() })]),\n output: z.promise(JsonValueSchema),\n }),\n})\n{\n const _: IsEqual<z.infer<typeof ToolDefinitionSchema>, ToolDefinition> = true\n}\n"],"mappings":";;;AAAA,SAAgB,cAAc,OAAkD;AAC9E,KAAI,UAAU,QAAQ,OAAO,UAAU,SAAU,QAAO;AACxD,KAAI,OAAO,UAAU,SAAS,KAAK,MAAM,KAAK,kBAAmB,QAAO;CAExE,MAAM,QAAQ,OAAO,eAAe,MAAM;AAC1C,QAAO,UAAU,OAAO,aAAa,UAAU;;AAGjD,SAAgB,QACd,QACK;AAGL,QAAO,OAAO,OAAO,QAAQ;;;;;;;;;;ACH/B,MAAa,kBAAkB,EAAE,QAAkB,UAAU;AAE3D,KAAI,CAAC,cAAc,MAAM,CAAE,QAAO;AAElC,KAAI,EAAE,WAAW,OAAQ,QAAO;AAEhC,MAAK,MAAM,CAAC,QAAQ,SAAS,OAAO,QAAQ,MAAM,EAAE;AAElD,MAAI,OAAO,SAAS,SAAU,QAAO;EAIrC,MAAM,QAAQ,OAAO,MAAM,IAAI;AAE/B,MAAI,MAAM,WAAW,KAAK,MAAM,GAAG,OAAO,MAAM,GAAG,GAAG,aAAa,CACjE,QAAO;;AAGX,QAAO;GACN,qBAAqB;;;;;;;;;;;;;ACjBxB,MAAa,kBAAkB,EAAE,MAAM;;;;ACYvC,MAAM,oBAAoB,EAAE,MAAM;CAChC,EAAE,QAAQ,EAAE;CACZ,EAAE,QAAQ,EAAE;CACZ,EAAE,QAAQ,EAAE;CACZ,EAAE,QAAQ,EAAE;CACZ,EAAE,QAAQ,GAAG;CACb,EAAE,QAAQ,GAAG;CACb,EAAE,QAAQ,GAAG;CACb,EAAE,QAAQ,GAAG;CACb,EAAE,QAAQ,GAAG;CACb,EAAE,QAAQ,GAAG;CACb,EAAE,QAAQ,GAAG;CACb,EAAE,QAAQ,GAAG;CACb,EAAE,QAAQ,GAAG;CACb,EAAE,QAAQ,GAA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AAK;EACL;EACA;EAGA;EAKA;EACA;EAMA;EACA;EACA;EACA;EAIA;EACA;EACD,CAAC,CACH;CACF,CAAC;AAKF,MAAa,uBAAuB,EAAE,OAAO;CAC3C,GAAG,qBAAqB;CACxB,QAAQ,EAAE,SAAS;EACjB,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;EAC7C,QAAQ,EAAE,QAAQ,gBAAgB;EACnC,CAAC;CACH,CAAC"}
|
|
@@ -513,11 +513,11 @@ interface PluginDefinition<Locales extends string[], TransporterOptions> extends
|
|
|
513
513
|
/**
|
|
514
514
|
* The author's name of the plugin.
|
|
515
515
|
*/
|
|
516
|
-
author
|
|
516
|
+
author?: string;
|
|
517
517
|
/**
|
|
518
518
|
* The author's email address.
|
|
519
519
|
*/
|
|
520
|
-
email
|
|
520
|
+
email?: string;
|
|
521
521
|
/**
|
|
522
522
|
* The source URL of the plugin.
|
|
523
523
|
*/
|
|
@@ -699,4 +699,4 @@ interface ToolDefinition extends BaseDefinition {
|
|
|
699
699
|
}
|
|
700
700
|
//#endregion
|
|
701
701
|
export { PropertyUIEncryptedInputProps as A, PropertyUISingleSelectProps as B, PropertyUICollapsiblePanelProps as C, PropertyUIContainer as D, PropertyUIComponentType as E, PropertyUINumber as F, I18nText as G, PropertyUISwitchProps as H, PropertyUIObject as I, PropertyUIOption as L, PropertyUIInputProps as M, PropertyUIKeyValueEditorProps as N, PropertyUICredentialId as O, PropertyUIMisc as P, PropertyUIProps as R, PropertyUIBoolean as S, PropertyUICommonProps as T, JsonValue$1 as U, PropertyUIString as V, JsonValueSchema as W, PropertyNumber as _, ModelDefinition as a, PropertyUIArray as b, DisplayCondition as c, PropertyArray as d, PropertyBase as f, PropertyEncryptedString as g, PropertyDiscriminatedUnion as h, Feature as i, PropertyUIEncryptedString as j, PropertyUIEmojiPickerProps as k, FilterOperators as l, PropertyCredentialId as m, CredentialDefinition as n, PluginDefinition as o, PropertyBoolean as p, DataSourceDefinition as r, ToolDefinition as s, BaseDefinition as t, Property as u, PropertyObject as v, PropertyUIColorPickerProps as w, PropertyUIArraySectionProps as x, PropertyString as y, PropertyUIRadioGroupProps as z };
|
|
702
|
-
//# sourceMappingURL=types-
|
|
702
|
+
//# sourceMappingURL=types-CVN_Se4O.d.ts.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as PropertyUIEncryptedInputProps, B as PropertyUISingleSelectProps, C as PropertyUICollapsiblePanelProps, D as PropertyUIContainer, E as PropertyUIComponentType, F as PropertyUINumber, G as I18nText, H as PropertyUISwitchProps, I as PropertyUIObject, L as PropertyUIOption, M as PropertyUIInputProps, N as PropertyUIKeyValueEditorProps, O as PropertyUICredentialId, P as PropertyUIMisc, R as PropertyUIProps, S as PropertyUIBoolean, T as PropertyUICommonProps, U as JsonValue, V as PropertyUIString, W as JsonValueSchema, _ as PropertyNumber, a as ModelDefinition, b as PropertyUIArray, c as DisplayCondition, d as PropertyArray, f as PropertyBase, g as PropertyEncryptedString, h as PropertyDiscriminatedUnion, i as Feature, j as PropertyUIEncryptedString, k as PropertyUIEmojiPickerProps, l as FilterOperators, m as PropertyCredentialId, n as CredentialDefinition, o as PluginDefinition, p as PropertyBoolean, r as DataSourceDefinition, s as ToolDefinition, t as BaseDefinition, u as Property, v as PropertyObject, w as PropertyUIColorPickerProps, x as PropertyUIArraySectionProps, y as PropertyString, z as PropertyUIRadioGroupProps } from "./types-
|
|
1
|
+
import { A as PropertyUIEncryptedInputProps, B as PropertyUISingleSelectProps, C as PropertyUICollapsiblePanelProps, D as PropertyUIContainer, E as PropertyUIComponentType, F as PropertyUINumber, G as I18nText, H as PropertyUISwitchProps, I as PropertyUIObject, L as PropertyUIOption, M as PropertyUIInputProps, N as PropertyUIKeyValueEditorProps, O as PropertyUICredentialId, P as PropertyUIMisc, R as PropertyUIProps, S as PropertyUIBoolean, T as PropertyUICommonProps, U as JsonValue, V as PropertyUIString, W as JsonValueSchema, _ as PropertyNumber, a as ModelDefinition, b as PropertyUIArray, c as DisplayCondition, d as PropertyArray, f as PropertyBase, g as PropertyEncryptedString, h as PropertyDiscriminatedUnion, i as Feature, j as PropertyUIEncryptedString, k as PropertyUIEmojiPickerProps, l as FilterOperators, m as PropertyCredentialId, n as CredentialDefinition, o as PluginDefinition, p as PropertyBoolean, r as DataSourceDefinition, s as ToolDefinition, t as BaseDefinition, u as Property, v as PropertyObject, w as PropertyUIColorPickerProps, x as PropertyUIArraySectionProps, y as PropertyString, z as PropertyUIRadioGroupProps } from "./types-CVN_Se4O.js";
|
|
2
2
|
export { BaseDefinition, CredentialDefinition, DataSourceDefinition, DisplayCondition, Feature, FilterOperators, I18nText, JsonValue, JsonValueSchema, ModelDefinition, PluginDefinition, Property, PropertyArray, PropertyBase, PropertyBoolean, PropertyCredentialId, PropertyDiscriminatedUnion, PropertyEncryptedString, PropertyNumber, PropertyObject, PropertyString, PropertyUIArray, PropertyUIArraySectionProps, PropertyUIBoolean, PropertyUICollapsiblePanelProps, PropertyUIColorPickerProps, PropertyUICommonProps, PropertyUIComponentType, PropertyUIContainer, PropertyUICredentialId, PropertyUIEmojiPickerProps, PropertyUIEncryptedInputProps, PropertyUIEncryptedString, PropertyUIInputProps, PropertyUIKeyValueEditorProps, PropertyUIMisc, PropertyUINumber, PropertyUIObject, PropertyUIOption, PropertyUIProps, PropertyUIRadioGroupProps, PropertyUISingleSelectProps, PropertyUIString, PropertyUISwitchProps, ToolDefinition };
|
package/package.json
CHANGED