@h-ai/kit 1.0.0-beta.18 → 1.0.0-beta.19
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/README.en.md +53 -33
- package/README.ja.md +53 -33
- package/README.md +54 -33
- package/dist/adapter/index.d.ts +8 -7
- package/dist/adapter/index.js.map +1 -1
- package/dist/browser.d.ts +9 -26
- package/dist/browser.js +4 -4
- package/dist/browser.js.map +1 -1
- package/dist/{chunk-JRQPMPQC.js → chunk-BCEBXG4X.js} +2 -2
- package/dist/chunk-BCEBXG4X.js.map +1 -0
- package/dist/{chunk-7EH47MTW.js → chunk-BVGXHIXR.js} +30 -9
- package/dist/chunk-BVGXHIXR.js.map +1 -0
- package/dist/{chunk-WCMEGLBL.js → chunk-GQZCU6PC.js} +11 -5
- package/dist/chunk-GQZCU6PC.js.map +1 -0
- package/dist/{chunk-5JW3VW4Q.js → chunk-JL2C5ZGQ.js} +38 -11
- package/dist/chunk-JL2C5ZGQ.js.map +1 -0
- package/dist/{chunk-6KS67QUS.js → chunk-WYGIKXHE.js} +20 -7
- package/dist/chunk-WYGIKXHE.js.map +1 -0
- package/dist/client/index.d.ts +6 -5
- package/dist/client/index.js +5 -5
- package/dist/client/index.js.map +1 -1
- package/dist/index.d.ts +18 -711
- package/dist/index.js +264 -149
- package/dist/index.js.map +1 -1
- package/dist/{kit-a2a-types-ikgvWS3T.d.ts → kit-a2a-types-CeDikRAX.d.ts} +3 -2
- package/dist/kit-config-CCksTmi5.d.ts +182 -0
- package/dist/kit-crypto-types-CqFENBqm.d.ts +47 -0
- package/dist/kit-types-BUDaKGB0.d.ts +2057 -0
- package/dist/modules/a2a/index.d.ts +9 -5
- package/dist/modules/a2a/index.js +1 -1
- package/dist/modules/crypto/index.d.ts +8 -105
- package/dist/modules/crypto/index.js +3 -149
- package/dist/modules/crypto/index.js.map +1 -1
- package/package.json +22 -22
- package/dist/chunk-5JW3VW4Q.js.map +0 -1
- package/dist/chunk-6KS67QUS.js.map +0 -1
- package/dist/chunk-7EH47MTW.js.map +0 -1
- package/dist/chunk-JRQPMPQC.js.map +0 -1
- package/dist/chunk-WCMEGLBL.js.map +0 -1
- package/dist/kit-client-auth-DeWmc-1u.d.ts +0 -406
- package/dist/kit-crypto-types-Brd0l8Hv.d.ts +0 -204
- package/dist/kit-i18n-CjwdGeKY.d.ts +0 -506
- package/dist/kit-types-CnfBC89D.d.ts +0 -832
|
@@ -1,506 +0,0 @@
|
|
|
1
|
-
import { l as KitServerConfig, n as KitTransportConfig, j as KitConfigInput, K as KitConfig, o as KitTransportConfigInput } from './kit-types-CnfBC89D.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @h-ai/kit — CRUD 类型定义
|
|
6
|
-
*
|
|
7
|
-
* 声明式 CRUD 资源定义所需的全部类型。
|
|
8
|
-
* @module kit-crud-types
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* 支持的字段类型
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* import type { CrudFieldType } from '@h-ai/kit'
|
|
15
|
-
*
|
|
16
|
-
* const value: CrudFieldType = 'date-range'
|
|
17
|
-
* void value
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
type CrudFieldType = 'string' | 'number' | 'boolean' | 'date' | 'date-range' | 'datetime' | 'email' | 'url' | 'tel' | 'password' | 'textarea' | 'select' | 'multi-select' | 'radio' | 'checkbox' | 'custom';
|
|
21
|
-
/**
|
|
22
|
-
* 字段校验规则
|
|
23
|
-
* @example
|
|
24
|
-
* ```ts
|
|
25
|
-
* import type { CrudFieldValidation } from '@h-ai/kit'
|
|
26
|
-
*
|
|
27
|
-
* const value: CrudFieldValidation = { required: true, max: 120 }
|
|
28
|
-
* void value
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
interface CrudFieldValidation {
|
|
32
|
-
/** 是否必填 */
|
|
33
|
-
required?: boolean;
|
|
34
|
-
/** 最小值(number)或 最小长度(string) */
|
|
35
|
-
min?: number;
|
|
36
|
-
/** 最大值(number)或 最大长度(string) */
|
|
37
|
-
max?: number;
|
|
38
|
-
/** 正则表达式 */
|
|
39
|
-
pattern?: string;
|
|
40
|
-
/** 自定义错误提示 */
|
|
41
|
-
message?: CrudText;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* 选项项(用于 select/radio 等)
|
|
45
|
-
* @example
|
|
46
|
-
* ```ts
|
|
47
|
-
* import type { CrudFieldOption } from '@h-ai/kit'
|
|
48
|
-
*
|
|
49
|
-
* const value: CrudFieldOption = { label: 'Published', value: 'published' }
|
|
50
|
-
* void value
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
interface CrudFieldOption {
|
|
54
|
-
label: string;
|
|
55
|
-
value: string | number | boolean;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* 选项来源:静态数组或动态工厂函数
|
|
59
|
-
* @example
|
|
60
|
-
* ```ts
|
|
61
|
-
* import type { CrudFieldOptions } from '@h-ai/kit'
|
|
62
|
-
*
|
|
63
|
-
* const value: CrudFieldOptions = [{ label: 'Published', value: 'published' }]
|
|
64
|
-
* void value
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
type CrudFieldOptions = CrudFieldOption[] | (() => CrudFieldOption[]);
|
|
68
|
-
/**
|
|
69
|
-
* 可解析为字符串的文本值(支持 i18n)
|
|
70
|
-
* @example
|
|
71
|
-
* ```ts
|
|
72
|
-
* import type { CrudText } from '@h-ai/kit'
|
|
73
|
-
*
|
|
74
|
-
* const value: CrudText = () => 'Articles'
|
|
75
|
-
* void value
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
type CrudText = string | (() => string);
|
|
79
|
-
/**
|
|
80
|
-
* 字段定义
|
|
81
|
-
* @example
|
|
82
|
-
* ```ts
|
|
83
|
-
* import type { CrudFieldDef } from '@h-ai/kit'
|
|
84
|
-
*
|
|
85
|
-
* const value: CrudFieldDef = { id: 'title', label: 'Title', type: 'string', validation: { required: true } }
|
|
86
|
-
* void value
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
interface CrudFieldDef {
|
|
90
|
-
/** 字段 ID(对应数据对象的 key) */
|
|
91
|
-
id: string;
|
|
92
|
-
/** 显示名称(支持 i18n 函数) */
|
|
93
|
-
label: CrudText;
|
|
94
|
-
/** 字段类型 */
|
|
95
|
-
type: CrudFieldType;
|
|
96
|
-
/** 是否在列表中显示(默认 true) */
|
|
97
|
-
inList?: boolean;
|
|
98
|
-
/** 是否是过滤项(默认 false) */
|
|
99
|
-
filterable?: boolean;
|
|
100
|
-
/** 是否只读(编辑时不可修改,默认 false) */
|
|
101
|
-
readonly?: boolean;
|
|
102
|
-
/** 是否在新建表单中显示(默认 true) */
|
|
103
|
-
inCreate?: boolean;
|
|
104
|
-
/** 是否在编辑表单中显示(默认 true) */
|
|
105
|
-
inEdit?: boolean;
|
|
106
|
-
/** 是否在详情中显示(默认 true) */
|
|
107
|
-
inDetail?: boolean;
|
|
108
|
-
/** 选项列表(select/radio/checkbox/multi-select) */
|
|
109
|
-
options?: CrudFieldOptions;
|
|
110
|
-
/** 校验规则 */
|
|
111
|
-
validation?: CrudFieldValidation;
|
|
112
|
-
/** 双列表单中的占用列数;auto 按控件类型判断,默认 auto。 */
|
|
113
|
-
colSpan?: 'auto' | 1 | 2;
|
|
114
|
-
/** 列宽(列表模式) */
|
|
115
|
-
width?: string;
|
|
116
|
-
/** 列对齐方式 */
|
|
117
|
-
align?: 'left' | 'center' | 'right';
|
|
118
|
-
/** 自定义列表渲染 */
|
|
119
|
-
render?: (value: unknown, item: Record<string, unknown>) => string;
|
|
120
|
-
/** 占位符 */
|
|
121
|
-
placeholder?: CrudText;
|
|
122
|
-
/** 日期范围起始值的查询参数名;仅 date-range 字段使用,默认 `${id}Start` */
|
|
123
|
-
startKey?: string;
|
|
124
|
-
/** 日期范围结束值的查询参数名;仅 date-range 字段使用,默认 `${id}End` */
|
|
125
|
-
endKey?: string;
|
|
126
|
-
/** 默认值(新建时) */
|
|
127
|
-
defaultValue?: unknown;
|
|
128
|
-
/** 排列权重(数值越小越靠前) */
|
|
129
|
-
order?: number;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* 分页参数
|
|
133
|
-
* @example
|
|
134
|
-
* ```ts
|
|
135
|
-
* import type { CrudPaginationParams } from '@h-ai/kit'
|
|
136
|
-
*
|
|
137
|
-
* const value: CrudPaginationParams = { page: 1, pageSize: 20 }
|
|
138
|
-
* void value
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
141
|
-
interface CrudPaginationParams {
|
|
142
|
-
page: number;
|
|
143
|
-
pageSize: number;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* 过滤参数(搜索 + 自定义过滤字段)
|
|
147
|
-
* @example
|
|
148
|
-
* ```ts
|
|
149
|
-
* import type { CrudFilterParams } from '@h-ai/kit'
|
|
150
|
-
*
|
|
151
|
-
* const value: CrudFilterParams = { search: 'example', status: 'published' }
|
|
152
|
-
* void value
|
|
153
|
-
* ```
|
|
154
|
-
*/
|
|
155
|
-
interface CrudFilterParams {
|
|
156
|
-
search?: string;
|
|
157
|
-
[key: string]: unknown;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* 分页结果
|
|
161
|
-
* @example
|
|
162
|
-
* ```ts
|
|
163
|
-
* import type { CrudPaginatedResult } from '@h-ai/kit'
|
|
164
|
-
*
|
|
165
|
-
* const value: CrudPaginatedResult<{ id: string }> = { items: [], total: 0, page: 1, pageSize: 20 }
|
|
166
|
-
* void value
|
|
167
|
-
* ```
|
|
168
|
-
*/
|
|
169
|
-
interface CrudPaginatedResult<T> {
|
|
170
|
-
items: T[];
|
|
171
|
-
total: number;
|
|
172
|
-
page: number;
|
|
173
|
-
pageSize: number;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* CRUD API 接口定义
|
|
177
|
-
* @example
|
|
178
|
-
* ```ts
|
|
179
|
-
* import type { CrudApiDef } from '@h-ai/kit'
|
|
180
|
-
*
|
|
181
|
-
* // 应用适配层把持久化查询结果转为此结构,失败应拒绝 Promise。
|
|
182
|
-
* function listAdapter(list: CrudApiDef<{ id: string }>['list']): CrudApiDef<{ id: string }> { return { list } }
|
|
183
|
-
* ```
|
|
184
|
-
*/
|
|
185
|
-
interface CrudApiDef<T = Record<string, unknown>> {
|
|
186
|
-
/** 获取分页列表 */
|
|
187
|
-
list: (params: CrudPaginationParams & CrudFilterParams) => Promise<CrudPaginatedResult<T>>;
|
|
188
|
-
/** 获取单条记录 */
|
|
189
|
-
get?: (id: string) => Promise<T | null>;
|
|
190
|
-
/** 新建记录 */
|
|
191
|
-
create?: (data: Partial<T>) => Promise<T>;
|
|
192
|
-
/** 更新记录(patch) */
|
|
193
|
-
update?: (id: string, data: Partial<T>) => Promise<T>;
|
|
194
|
-
/** 删除记录 */
|
|
195
|
-
remove?: (id: string) => Promise<void>;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* CRUD 资源定义
|
|
199
|
-
* @example
|
|
200
|
-
* ```ts
|
|
201
|
-
* import type { CrudApiDef, CrudResourceDef } from '@h-ai/kit'
|
|
202
|
-
*
|
|
203
|
-
* function articles(api: CrudApiDef<{ id: string, title: string }>): CrudResourceDef<{ id: string, title: string }> {
|
|
204
|
-
* return { name: 'article', label: 'Articles', fields: [{ id: 'title', label: 'Title', type: 'string' }], api }
|
|
205
|
-
* }
|
|
206
|
-
* ```
|
|
207
|
-
*/
|
|
208
|
-
interface CrudResourceDef<T = Record<string, unknown>> {
|
|
209
|
-
/** 资源名称(如 'user', 'role'),用于 URL 路由 */
|
|
210
|
-
name: string;
|
|
211
|
-
/** 显示名称(面包屑、标题用,支持 i18n) */
|
|
212
|
-
label: CrudText;
|
|
213
|
-
/** 主键字段名(默认 'id') */
|
|
214
|
-
keyField?: string;
|
|
215
|
-
/** 字段列表 */
|
|
216
|
-
fields: CrudFieldDef[];
|
|
217
|
-
/** API 接口 */
|
|
218
|
-
api: CrudApiDef<T>;
|
|
219
|
-
/** 默认分页大小(默认 20) */
|
|
220
|
-
defaultPageSize?: number;
|
|
221
|
-
/** 是否支持搜索(默认 true) */
|
|
222
|
-
searchable?: boolean;
|
|
223
|
-
/** 搜索占位符 */
|
|
224
|
-
searchPlaceholder?: CrudText;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* DataTable 列配置(适配 @h-ai/ui DataTable)
|
|
228
|
-
* @example
|
|
229
|
-
* ```ts
|
|
230
|
-
* import type { CrudTableColumn } from '@h-ai/kit'
|
|
231
|
-
*
|
|
232
|
-
* const value: CrudTableColumn = { key: 'title', label: 'Title' }
|
|
233
|
-
* void value
|
|
234
|
-
* ```
|
|
235
|
-
*/
|
|
236
|
-
interface CrudTableColumn {
|
|
237
|
-
key: string;
|
|
238
|
-
label: string;
|
|
239
|
-
width?: string;
|
|
240
|
-
align?: 'left' | 'center' | 'right';
|
|
241
|
-
render?: (item: Record<string, unknown>) => string;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* CRUD 操作对象(由 defineCrud 返回)
|
|
245
|
-
* @example
|
|
246
|
-
* ```ts
|
|
247
|
-
* import type { CrudOperations } from '@h-ai/kit'
|
|
248
|
-
*
|
|
249
|
-
* function columns(resource: CrudOperations<{ id: string }>) { return resource.toTableColumns() }
|
|
250
|
-
* ```
|
|
251
|
-
*/
|
|
252
|
-
interface CrudOperations<T = Record<string, unknown>> {
|
|
253
|
-
/** 资源元信息 */
|
|
254
|
-
resource: CrudResourceDef<T>;
|
|
255
|
-
/** 获取列表列字段(inList=true) */
|
|
256
|
-
getListFields: () => CrudFieldDef[];
|
|
257
|
-
/** 获取过滤字段(filterable=true) */
|
|
258
|
-
getFilterFields: () => CrudFieldDef[];
|
|
259
|
-
/** 获取新建表单字段(inCreate=true) */
|
|
260
|
-
getCreateFields: () => CrudFieldDef[];
|
|
261
|
-
/** 获取编辑表单字段(inEdit=true) */
|
|
262
|
-
getEditFields: () => CrudFieldDef[];
|
|
263
|
-
/** 获取详情字段(inDetail=true) */
|
|
264
|
-
getDetailFields: () => CrudFieldDef[];
|
|
265
|
-
/** 构建 DataTable 列配置 */
|
|
266
|
-
toTableColumns: () => CrudTableColumn[];
|
|
267
|
-
/** 构建新建时的默认值 */
|
|
268
|
-
getDefaultValues: () => Record<string, unknown>;
|
|
269
|
-
/** API 操作代理 */
|
|
270
|
-
api: CrudApiDef<T>;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* @h-ai/kit — CRUD 操作定义
|
|
275
|
-
*
|
|
276
|
-
* 声明式 CRUD 资源定义工厂函数。
|
|
277
|
-
* @module kit-crud
|
|
278
|
-
*/
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* 解析 CrudText 为字符串
|
|
282
|
-
*/
|
|
283
|
-
declare function resolveText(text: CrudText): string;
|
|
284
|
-
/**
|
|
285
|
-
* 解析选项列表
|
|
286
|
-
*/
|
|
287
|
-
declare function resolveOptions(options: CrudFieldOptions | undefined): Array<{
|
|
288
|
-
label: string;
|
|
289
|
-
value: string | number | boolean;
|
|
290
|
-
}>;
|
|
291
|
-
/**
|
|
292
|
-
* 定义 CRUD 资源
|
|
293
|
-
*
|
|
294
|
-
* 返回 CrudOperations 对象,包含字段过滤、列构建和 API 代理等能力。
|
|
295
|
-
* 与 @h-ai/ui 的 CrudPage 组件配合使用。
|
|
296
|
-
*
|
|
297
|
-
* @param resource - 资源定义
|
|
298
|
-
* @returns CRUD 操作对象
|
|
299
|
-
* @example
|
|
300
|
-
* ```ts
|
|
301
|
-
* import { kit } from '@h-ai/kit'
|
|
302
|
-
*
|
|
303
|
-
* import type { CrudApiDef } from '@h-ai/kit'
|
|
304
|
-
*
|
|
305
|
-
* function articleResource(api: CrudApiDef<{ id: string, title: string }>) {
|
|
306
|
-
* return kit.crud.define({ name: 'article', label: 'Articles', fields: [{ id: 'title', label: 'Title', type: 'string' }], api })
|
|
307
|
-
* }
|
|
308
|
-
* ```
|
|
309
|
-
*/
|
|
310
|
-
declare function defineCrud<T = Record<string, unknown>>(resource: CrudResourceDef<T>): CrudOperations<T>;
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* @h-ai/kit — 宿主配置
|
|
314
|
-
*
|
|
315
|
-
* 为 `config/_kit.yml` 提供监听、传输与请求策略的默认值和校验。
|
|
316
|
-
* 服务端消费完整配置;浏览器仅接收显式投影的 transport 公共字段。
|
|
317
|
-
* @module kit-config
|
|
318
|
-
*/
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* `config/_kit.yml` 对应的配置 Schema。
|
|
322
|
-
* @example
|
|
323
|
-
* ```ts
|
|
324
|
-
* import { KitConfigSchema } from '@h-ai/kit'
|
|
325
|
-
*
|
|
326
|
-
* const config = KitConfigSchema.parse({ server: { port: 3000 }, transport: false })
|
|
327
|
-
* void config
|
|
328
|
-
* ```
|
|
329
|
-
*/
|
|
330
|
-
declare const KitConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
331
|
-
server: z.ZodOptional<z.ZodObject<{
|
|
332
|
-
host: z.ZodDefault<z.ZodString>;
|
|
333
|
-
port: z.ZodDefault<z.ZodNumber>;
|
|
334
|
-
}, z.core.$strip>>;
|
|
335
|
-
transport: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
336
|
-
maxPlaintextBytes: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"auto">]>, z.ZodTransform<number | undefined, number | "auto">>>;
|
|
337
|
-
maxFutureSkewSeconds: z.ZodOptional<z.ZodNumber>;
|
|
338
|
-
maxRequestAgeSeconds: z.ZodOptional<z.ZodNumber>;
|
|
339
|
-
routePlaintextBytes: z.ZodOptional<z.ZodRecord<z.ZodCustom<`/${string}`, `/${string}`>, z.ZodNumber>>;
|
|
340
|
-
keyExchangePath: z.ZodDefault<z.ZodCustom<`/${string}`, `/${string}`>>;
|
|
341
|
-
excludePaths: z.ZodDefault<z.ZodArray<z.ZodCustom<`/${string}`, `/${string}`>>>;
|
|
342
|
-
}, z.core.$strip>]>>;
|
|
343
|
-
trustedProxies: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodArray<z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6, z.ZodCIDRv4, z.ZodCIDRv6]>>]>>;
|
|
344
|
-
access: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodObject<{
|
|
345
|
-
file: z.ZodString;
|
|
346
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
347
|
-
global: z.ZodOptional<z.ZodObject<{
|
|
348
|
-
allowIps: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6, z.ZodCIDRv4, z.ZodCIDRv6]>>>;
|
|
349
|
-
denyIps: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6, z.ZodCIDRv4, z.ZodCIDRv6]>>>;
|
|
350
|
-
timezone: z.ZodDefault<z.ZodString>;
|
|
351
|
-
windows: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
352
|
-
days: z.ZodArray<z.ZodNumber>;
|
|
353
|
-
start: z.ZodString;
|
|
354
|
-
end: z.ZodString;
|
|
355
|
-
}, z.core.$strict>>>;
|
|
356
|
-
}, z.core.$strict>>;
|
|
357
|
-
rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
358
|
-
allowIps: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6, z.ZodCIDRv4, z.ZodCIDRv6]>>>;
|
|
359
|
-
denyIps: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6, z.ZodCIDRv4, z.ZodCIDRv6]>>>;
|
|
360
|
-
timezone: z.ZodDefault<z.ZodString>;
|
|
361
|
-
windows: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
362
|
-
days: z.ZodArray<z.ZodNumber>;
|
|
363
|
-
start: z.ZodString;
|
|
364
|
-
end: z.ZodString;
|
|
365
|
-
}, z.core.$strict>>>;
|
|
366
|
-
id: z.ZodString;
|
|
367
|
-
paths: z.ZodArray<z.ZodString>;
|
|
368
|
-
methods: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
369
|
-
GET: "GET";
|
|
370
|
-
HEAD: "HEAD";
|
|
371
|
-
POST: "POST";
|
|
372
|
-
PUT: "PUT";
|
|
373
|
-
PATCH: "PATCH";
|
|
374
|
-
DELETE: "DELETE";
|
|
375
|
-
OPTIONS: "OPTIONS";
|
|
376
|
-
CONNECT: "CONNECT";
|
|
377
|
-
TRACE: "TRACE";
|
|
378
|
-
}>>>;
|
|
379
|
-
encryption: z.ZodOptional<z.ZodEnum<{
|
|
380
|
-
required: "required";
|
|
381
|
-
disabled: "disabled";
|
|
382
|
-
}>>;
|
|
383
|
-
}, z.core.$strict>>>;
|
|
384
|
-
}, z.core.$strict>]>>;
|
|
385
|
-
}, z.core.$strip>, z.ZodTransform<{
|
|
386
|
-
server: KitServerConfig;
|
|
387
|
-
transport: false | KitTransportConfig;
|
|
388
|
-
trustedProxies: string[] | "auto";
|
|
389
|
-
access: false | {
|
|
390
|
-
file: string;
|
|
391
|
-
} | {
|
|
392
|
-
rules: {
|
|
393
|
-
allowIps: string[];
|
|
394
|
-
denyIps: string[];
|
|
395
|
-
timezone: string;
|
|
396
|
-
windows: {
|
|
397
|
-
days: number[];
|
|
398
|
-
start: string;
|
|
399
|
-
end: string;
|
|
400
|
-
}[];
|
|
401
|
-
id: string;
|
|
402
|
-
paths: string[];
|
|
403
|
-
methods: ("GET" | "HEAD" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "CONNECT" | "TRACE")[];
|
|
404
|
-
encryption?: "required" | "disabled" | undefined;
|
|
405
|
-
}[];
|
|
406
|
-
global?: {
|
|
407
|
-
allowIps: string[];
|
|
408
|
-
denyIps: string[];
|
|
409
|
-
timezone: string;
|
|
410
|
-
windows: {
|
|
411
|
-
days: number[];
|
|
412
|
-
start: string;
|
|
413
|
-
end: string;
|
|
414
|
-
}[];
|
|
415
|
-
} | undefined;
|
|
416
|
-
};
|
|
417
|
-
}, {
|
|
418
|
-
trustedProxies: string[] | "auto";
|
|
419
|
-
access: false | {
|
|
420
|
-
file: string;
|
|
421
|
-
} | {
|
|
422
|
-
rules: {
|
|
423
|
-
allowIps: string[];
|
|
424
|
-
denyIps: string[];
|
|
425
|
-
timezone: string;
|
|
426
|
-
windows: {
|
|
427
|
-
days: number[];
|
|
428
|
-
start: string;
|
|
429
|
-
end: string;
|
|
430
|
-
}[];
|
|
431
|
-
id: string;
|
|
432
|
-
paths: string[];
|
|
433
|
-
methods: ("GET" | "HEAD" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "CONNECT" | "TRACE")[];
|
|
434
|
-
encryption?: "required" | "disabled" | undefined;
|
|
435
|
-
}[];
|
|
436
|
-
global?: {
|
|
437
|
-
allowIps: string[];
|
|
438
|
-
denyIps: string[];
|
|
439
|
-
timezone: string;
|
|
440
|
-
windows: {
|
|
441
|
-
days: number[];
|
|
442
|
-
start: string;
|
|
443
|
-
end: string;
|
|
444
|
-
}[];
|
|
445
|
-
} | undefined;
|
|
446
|
-
};
|
|
447
|
-
server?: {
|
|
448
|
-
host: string;
|
|
449
|
-
port: number;
|
|
450
|
-
} | undefined;
|
|
451
|
-
transport?: false | {
|
|
452
|
-
keyExchangePath: `/${string}`;
|
|
453
|
-
excludePaths: `/${string}`[];
|
|
454
|
-
maxPlaintextBytes?: number | undefined;
|
|
455
|
-
maxFutureSkewSeconds?: number | undefined;
|
|
456
|
-
maxRequestAgeSeconds?: number | undefined;
|
|
457
|
-
routePlaintextBytes?: Record<`/${string}`, number> | undefined;
|
|
458
|
-
} | undefined;
|
|
459
|
-
}>>;
|
|
460
|
-
/**
|
|
461
|
-
* 解析 transport 配置并补齐默认值。
|
|
462
|
-
*
|
|
463
|
-
* @param input - `config/_kit.yml` 中的 transport 配置
|
|
464
|
-
* @returns 完整 transport 配置;`false` 表示关闭
|
|
465
|
-
* @example
|
|
466
|
-
* ```ts
|
|
467
|
-
* import { resolveKitTransportConfig } from '@h-ai/kit'
|
|
468
|
-
*
|
|
469
|
-
* const transport = resolveKitTransportConfig({ excludePaths: ['/api/health'] })
|
|
470
|
-
* if (transport) void transport.keyExchangePath
|
|
471
|
-
* ```
|
|
472
|
-
*/
|
|
473
|
-
declare function resolveKitTransportConfig(input?: false | KitTransportConfigInput): false | KitTransportConfig;
|
|
474
|
-
/**
|
|
475
|
-
* 解析 `config/_kit.yml` 顶层配置并补齐默认值。
|
|
476
|
-
*
|
|
477
|
-
* 适合同一份配置同时供 SvelteKit 服务端 hook 与浏览器端 client 读取。
|
|
478
|
-
* @param input - Kit 监听和公开 transport 输入;省略字段按 Schema 补默认值。
|
|
479
|
-
* @returns 已补齐默认值的配置;不合法输入抛出 ZodError。
|
|
480
|
-
* @example
|
|
481
|
-
* ```ts
|
|
482
|
-
* import { resolveKitConfig } from '@h-ai/kit'
|
|
483
|
-
*
|
|
484
|
-
* const config = resolveKitConfig({ transport: false })
|
|
485
|
-
* void config.server.port
|
|
486
|
-
* ```
|
|
487
|
-
*/
|
|
488
|
-
declare function resolveKitConfig(input?: KitConfigInput): KitConfig;
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* 设置浏览器应用语言或 Node 启动默认语言;请求中只更新当前 runWithLocale 上下文。
|
|
492
|
-
*
|
|
493
|
-
* 通过 @h-ai/core 的集中式 locale 管理器,一次调用即可同步所有模块。
|
|
494
|
-
* 各模块的 createMessageGetter 优先读取当前 Node 请求上下文;SSR 必须包裹实际 resolve。
|
|
495
|
-
* @param locale - 支持的应用默认语言;请求中应使用上下文隔离。
|
|
496
|
-
* @example
|
|
497
|
-
* ```ts
|
|
498
|
-
* import { kit } from '@h-ai/kit'
|
|
499
|
-
*
|
|
500
|
-
* // 应用启动时设置默认语言;请求内使用 runWithLocale。
|
|
501
|
-
* kit.i18n.setLocale('en-US')
|
|
502
|
-
* ```
|
|
503
|
-
*/
|
|
504
|
-
declare function setAllModulesLocale(locale: string): void;
|
|
505
|
-
|
|
506
|
-
export { type CrudApiDef as C, KitConfigSchema as K, resolveKitTransportConfig as a, type CrudFieldDef as b, type CrudFieldOption as c, defineCrud as d, type CrudFieldOptions as e, type CrudFieldType as f, type CrudFieldValidation as g, type CrudFilterParams as h, type CrudOperations as i, type CrudPaginatedResult as j, type CrudPaginationParams as k, type CrudResourceDef as l, type CrudTableColumn as m, type CrudText as n, resolveOptions as o, resolveText as p, resolveKitConfig as r, setAllModulesLocale as s };
|