@h-ai/api-contract 0.1.0-alpha.66 → 0.1.0-alpha.68
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 +29 -9
- package/README.ja.md +30 -10
- package/README.md +30 -10
- package/dist/ai/index.d.ts +981 -200
- package/dist/ai/index.js +2 -2
- package/dist/{chunk-RVSGP2GF.js → chunk-G3SME6V5.js} +4 -5
- package/dist/chunk-G3SME6V5.js.map +1 -0
- package/dist/{chunk-VSPYX4DD.js → chunk-G55ATYDA.js} +64 -39
- package/dist/chunk-G55ATYDA.js.map +1 -0
- package/dist/{chunk-3QSKWVLP.js → chunk-IVZVAWEF.js} +30 -17
- package/dist/chunk-IVZVAWEF.js.map +1 -0
- package/dist/{chunk-CUU2F6YD.js → chunk-JKPLID6E.js} +2 -2
- package/dist/chunk-JKPLID6E.js.map +1 -0
- package/dist/{chunk-JIQINMLG.js → chunk-R5GDWFYC.js} +7 -7
- package/dist/chunk-R5GDWFYC.js.map +1 -0
- package/dist/iam/index.d.ts +845 -32
- package/dist/iam/index.js +2 -2
- package/dist/index.d.ts +196 -89
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/payment/index.d.ts +218 -28
- package/dist/payment/index.js +2 -2
- package/dist/storage/index.d.ts +414 -161
- package/dist/storage/index.js +2 -2
- package/package.json +3 -2
- package/dist/chunk-3QSKWVLP.js.map +0 -1
- package/dist/chunk-CUU2F6YD.js.map +0 -1
- package/dist/chunk-JIQINMLG.js.map +0 -1
- package/dist/chunk-RVSGP2GF.js.map +0 -1
- package/dist/chunk-VSPYX4DD.js.map +0 -1
package/dist/iam/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { IamAdminCreateUserInputSchema, IamAdminResetPasswordInputSchema, IamAdminUpdateUserInputSchema, IamAgreementDisplaySchema, IamAuthResultSchema, IamChangePasswordInputSchema, IamConfirmPasswordResetInputSchema, IamCreatePermissionInputSchema, IamCreateRoleInputSchema, IamCurrentUserSchema, IamLdapLoginInputSchema, IamListPermissionsInputSchema, IamListUsersInputSchema, IamLoginInputSchema, IamLogoutInputSchema, IamOtpLoginInputSchema, IamPermissionSchema, IamPermissionTypeSchema, IamPublicConfigSchema, IamRefreshTokenDataSchema, IamRefreshTokenInputSchema, IamRegisterInputSchema, IamRequestPasswordResetInputSchema, IamRoleSchema, IamSendOtpDataSchema, IamSendOtpInputSchema, IamTokenPairSchema, IamUpdateCurrentUserInputSchema, IamUpdateRoleInputSchema, IamUserIdInputSchema, IamUserSchema, iamContract } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { IamAdminCreateUserInputSchema, IamAdminResetPasswordInputSchema, IamAdminUpdateUserInputSchema, IamAgreementDisplaySchema, IamAuthResultSchema, IamChangePasswordInputSchema, IamConfirmPasswordResetInputSchema, IamCreatePermissionInputSchema, IamCreateRoleInputSchema, IamCurrentUserSchema, IamLdapLoginInputSchema, IamListPermissionsInputSchema, IamListUsersInputSchema, IamLoginInputSchema, IamLogoutInputSchema, IamOtpLoginInputSchema, IamPermissionSchema, IamPermissionTypeSchema, IamPublicConfigSchema, IamRefreshTokenDataSchema, IamRefreshTokenInputSchema, IamRegisterInputSchema, IamRequestPasswordResetInputSchema, IamRoleSchema, IamSendOtpDataSchema, IamSendOtpInputSchema, IamTokenPairSchema, IamUpdateCurrentUserInputSchema, IamUpdateRoleInputSchema, IamUserIdInputSchema, IamUserSchema, iamContract } from '../chunk-G3SME6V5.js';
|
|
2
|
+
import '../chunk-JKPLID6E.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export { AUDIO_WS_PATH, AiAssistantMessageSchema, AiChatCompletionChoiceSchema, AiChatCompletionData, AiChatCompletionDataSchema, AiChatCompletionInput, AiChatCompletionInputSchema, AiChatCompletionOutput, AiChatHistoryDataSchema, AiChatHistoryInput, AiChatHistoryInputSchema, AiChatMessageSchema, AiChatRecord, AiChatRecordSchema, AiContract, AiImageContentSchema, AiMemoryEntrySchema, AiMemoryListDataSchema, AiMemoryListInput, AiMemoryListInputSchema, AiMemoryRecallDataSchema, AiMemoryRecallInput, AiMemoryRecallInputSchema, AiMemoryTypeSchema, AiMessageContentSchema, AiMessageRoleSchema, AiSendMessageData, AiSendMessageDataSchema, AiSendMessageInput, AiSendMessageInputSchema, AiSendMessageOutput, AiSessionInfoSchema, AiSessionListDataSchema, AiSessionListInput, AiSessionListInputSchema, AiTextContentSchema, AiTokenUsageSchema, AiToolCallSchema, AiToolDefinitionSchema,
|
|
1
|
+
export { AUDIO_WS_PATH, AiAssistantMessageSchema, AiChatCompletionChoiceSchema, AiChatCompletionData, AiChatCompletionDataSchema, AiChatCompletionInput, AiChatCompletionInputSchema, AiChatCompletionOutput, AiChatHistoryDataSchema, AiChatHistoryInput, AiChatHistoryInputSchema, AiChatMessageSchema, AiChatRecord, AiChatRecordSchema, AiContract, AiImageContentSchema, AiMemoryEntrySchema, AiMemoryListDataSchema, AiMemoryListInput, AiMemoryListInputSchema, AiMemoryRecallDataSchema, AiMemoryRecallInput, AiMemoryRecallInputSchema, AiMemoryTypeSchema, AiMessageContentSchema, AiMessageRoleSchema, AiSendMessageData, AiSendMessageDataSchema, AiSendMessageInput, AiSendMessageInputSchema, AiSendMessageOutput, AiSessionInfoSchema, AiSessionListDataSchema, AiSessionListInput, AiSessionListInputSchema, AiTextContentSchema, AiTokenUsageSchema, AiToolCallSchema, AiToolDefinitionSchema, AudioFormatSchema, AudioWsClientMessageSchema, AudioWsDoneMessageSchema, AudioWsStartMessageSchema, AudioWsTextMessageSchema } from './ai/index.js';
|
|
2
2
|
import * as _orpc_contract from '@orpc/contract';
|
|
3
3
|
import { AnyContractProcedure, AnyContractRouter } from '@orpc/contract';
|
|
4
|
+
export { ContractProcedureBuilderWithInputOutput, ContractProcedureBuilderWithOutput, Schema } from '@orpc/contract';
|
|
4
5
|
import * as zod_v4_core from 'zod/v4/core';
|
|
5
6
|
import * as zod from 'zod';
|
|
6
7
|
import { z } from 'zod';
|
|
7
8
|
export { IamAdminCreateUserInput, IamAdminCreateUserInputSchema, IamAdminResetPasswordInput, IamAdminResetPasswordInputSchema, IamAdminUpdateUserInput, IamAdminUpdateUserInputSchema, IamAgreementDisplaySchema, IamAuthResultOutput, IamAuthResultSchema, IamChangePasswordInput, IamChangePasswordInputSchema, IamConfirmPasswordResetInputSchema, IamContract, IamCreatePermissionInput, IamCreatePermissionInputSchema, IamCreateRoleInput, IamCreateRoleInputSchema, IamCurrentUser, IamCurrentUserOutput, IamCurrentUserSchema, IamLdapLoginInput, IamLdapLoginInputSchema, IamListPermissionsInput, IamListPermissionsInputSchema, IamListUsersInput, IamListUsersInputSchema, IamLoginInput, IamLoginInputSchema, IamLogoutInput, IamLogoutInputSchema, IamOtpLoginInput, IamOtpLoginInputSchema, IamPermissionSchema, IamPermissionTypeSchema, IamPublicConfig, IamPublicConfigSchema, IamRefreshTokenDataSchema, IamRefreshTokenInput, IamRefreshTokenInputSchema, IamRefreshTokenOutput, IamRegisterInput, IamRegisterInputSchema, IamRequestPasswordResetInputSchema, IamRoleSchema, IamSendOtpDataSchema, IamSendOtpInput, IamSendOtpInputSchema, IamTokenPairSchema, IamUpdateCurrentUserInput, IamUpdateCurrentUserInputSchema, IamUpdateRoleInput, IamUpdateRoleInputSchema, IamUserIdInput, IamUserIdInputSchema, IamUserSchema } from './iam/index.js';
|
|
8
9
|
export { PaymentContract, PaymentCreateOrderDataSchema, PaymentCreateOrderInput, PaymentCreateOrderInputSchema, PaymentCreateOrderOutput, PaymentNotifyMessageSchema, PaymentOrderSchema, PaymentProviderSchema, PaymentQueryOrderInputSchema, PaymentRefundDataSchema, PaymentRefundInput, PaymentRefundInputSchema, PaymentStripeNotifyDataSchema, PaymentTradeTypeSchema } from './payment/index.js';
|
|
9
|
-
export { StorageContract, StorageDeleteFilesInput, StorageDeleteFilesInputSchema, StorageFileKeyInput, StorageFileKeyInputSchema, StorageFileMetadataSchema, StorageListFilesDataSchema, StorageListFilesInput, StorageListFilesInputSchema, StoragePresignDownloadInput, StoragePresignDownloadInputSchema, StoragePresignUploadInput, StoragePresignUploadInputSchema, StoragePresignedUrlOutput, StoragePresignedUrlSchema } from './storage/index.js';
|
|
10
|
+
export { StorageContract, StorageDeleteFilesInput, StorageDeleteFilesInputSchema, StorageDeleteSummarySchema, StorageFileKeyInput, StorageFileKeyInputSchema, StorageFileMetadataSchema, StorageListFilesDataSchema, StorageListFilesInput, StorageListFilesInputSchema, StoragePresignDownloadInput, StoragePresignDownloadInputSchema, StoragePresignUploadInput, StoragePresignUploadInputSchema, StoragePresignedUrlOutput, StoragePresignedUrlSchema } from './storage/index.js';
|
|
10
11
|
import '@h-ai/core';
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -21,13 +22,12 @@ import '@h-ai/core';
|
|
|
21
22
|
*
|
|
22
23
|
* 页码和页大小均为可选,由服务端提供合理默认值(page=1, pageSize=20)。
|
|
23
24
|
* 支持字符串 coerce,适配 GET 请求 query string 场景。
|
|
24
|
-
*
|
|
25
25
|
* @example
|
|
26
26
|
* ```ts
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* import { PaginationQuerySchema } from '@h-ai/api-contract'
|
|
28
|
+
*
|
|
29
|
+
* const value = PaginationQuerySchema.parse({})
|
|
30
|
+
* void value
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
declare const PaginationQuerySchema: z.ZodObject<{
|
|
@@ -42,13 +42,14 @@ declare const PaginationQuerySchema: z.ZodObject<{
|
|
|
42
42
|
*
|
|
43
43
|
* @param itemSchema - 分页项的 Zod Schema
|
|
44
44
|
* @returns 包含 items/total/page/pageSize 的对象 Schema
|
|
45
|
-
*
|
|
46
45
|
* @example
|
|
47
46
|
* ```ts
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
47
|
+
* import { apiContract } from '@h-ai/api-contract'
|
|
48
|
+
* import { z } from 'zod'
|
|
49
|
+
*
|
|
50
|
+
* const page = apiContract.paginatedSchema(z.object({ id: z.string() }))
|
|
51
|
+
* .parse({ items: [{ id: 'order_1' }], total: 1, page: 1, pageSize: 20 })
|
|
52
|
+
* void page
|
|
52
53
|
* ```
|
|
53
54
|
*/
|
|
54
55
|
declare function paginatedSchema<T extends z.ZodType>(itemSchema: T): z.ZodObject<{
|
|
@@ -70,6 +71,17 @@ declare function paginatedSchema<T extends z.ZodType>(itemSchema: T): z.ZodObjec
|
|
|
70
71
|
* HaiError 的跨端 JSON Schema。
|
|
71
72
|
*
|
|
72
73
|
* 仅描述公共错误字段,不暴露内部异常对象结构。
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* import { HaiErrorSchema } from '@h-ai/api-contract'
|
|
77
|
+
*
|
|
78
|
+
* const value = HaiErrorSchema.parse({
|
|
79
|
+
* code: 'app:orders:001',
|
|
80
|
+
* message: 'Order not found',
|
|
81
|
+
* httpStatus: 404
|
|
82
|
+
* })
|
|
83
|
+
* void value
|
|
84
|
+
* ```
|
|
73
85
|
*/
|
|
74
86
|
declare const HaiErrorSchema: z.ZodObject<{
|
|
75
87
|
code: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
@@ -86,10 +98,14 @@ declare const HaiErrorSchema: z.ZodObject<{
|
|
|
86
98
|
*
|
|
87
99
|
* @param dataSchema - 成功分支 data 字段 Schema
|
|
88
100
|
* @returns HaiResult<T> 的 Zod Schema
|
|
89
|
-
*
|
|
90
101
|
* @example
|
|
91
102
|
* ```ts
|
|
92
|
-
*
|
|
103
|
+
* import { apiContract } from '@h-ai/api-contract'
|
|
104
|
+
* import { z } from 'zod'
|
|
105
|
+
*
|
|
106
|
+
* const result = apiContract.haiResultSchema(z.object({ id: z.string() }))
|
|
107
|
+
* .parse({ success: true, data: { id: 'order_1' } })
|
|
108
|
+
* if (result.success) void result.data.id
|
|
93
109
|
* ```
|
|
94
110
|
*/
|
|
95
111
|
declare function haiResultSchema<T extends z.ZodType>(dataSchema: T): z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -124,6 +140,13 @@ declare function haiResultSchema<T extends z.ZodType>(dataSchema: T): z.ZodDiscr
|
|
|
124
140
|
*
|
|
125
141
|
* @param procedure - 已声明 HTTP route 的 oRPC contract procedure
|
|
126
142
|
* @returns contract 中的绝对业务路径
|
|
143
|
+
* @example
|
|
144
|
+
* ```ts
|
|
145
|
+
* import { apiContract } from '@h-ai/api-contract'
|
|
146
|
+
*
|
|
147
|
+
* const path = apiContract.pathOf(apiContract.iam.auth.login)
|
|
148
|
+
* void path
|
|
149
|
+
* ```
|
|
127
150
|
*/
|
|
128
151
|
declare function pathOf(procedure: AnyContractProcedure): `/${string}`;
|
|
129
152
|
|
|
@@ -135,9 +158,31 @@ declare function pathOf(procedure: AnyContractProcedure): `/${string}`;
|
|
|
135
158
|
* @module create-api-contract
|
|
136
159
|
*/
|
|
137
160
|
|
|
138
|
-
/**
|
|
161
|
+
/**
|
|
162
|
+
* API contract 组合输入。key 为领域名称,value 为领域 contract 或 false/undefined(跳过该领域)。
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* import type { CreateApiContractOptions } from '@h-ai/api-contract'
|
|
166
|
+
* import { apiContract } from '@h-ai/api-contract'
|
|
167
|
+
*
|
|
168
|
+
* const parts = { iam: apiContract.iam, payment: false } satisfies CreateApiContractOptions
|
|
169
|
+
* const contract = apiContract.create(parts)
|
|
170
|
+
* void contract.iam.auth.login
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
139
173
|
type CreateApiContractOptions = Record<string, AnyContractRouter | false | undefined>;
|
|
140
|
-
/**
|
|
174
|
+
/**
|
|
175
|
+
* 根据输入过滤 false/undefined 后得到的应用级 contract 类型。
|
|
176
|
+
* @example
|
|
177
|
+
* ```ts
|
|
178
|
+
* import type { CreatedApiContract } from '@h-ai/api-contract'
|
|
179
|
+
* import { apiContract } from '@h-ai/api-contract'
|
|
180
|
+
*
|
|
181
|
+
* const parts = { iam: apiContract.iam, payment: false } as const
|
|
182
|
+
* const contract: CreatedApiContract<typeof parts> = apiContract.create(parts)
|
|
183
|
+
* void contract.iam.auth.login
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
141
186
|
type CreatedApiContract<T extends CreateApiContractOptions> = {
|
|
142
187
|
readonly [K in keyof T as T[K] extends false | undefined ? never : K]: Exclude<T[K], false | undefined>;
|
|
143
188
|
};
|
|
@@ -149,21 +194,28 @@ type CreatedApiContract<T extends CreateApiContractOptions> = {
|
|
|
149
194
|
*
|
|
150
195
|
* @param options - 各领域 contract(传 false/undefined 表示禁用该领域)
|
|
151
196
|
* @returns 过滤后的应用级 oRPC contract router
|
|
152
|
-
*
|
|
153
197
|
* @example
|
|
154
198
|
* ```ts
|
|
155
199
|
* import { apiContract } from '@h-ai/api-contract'
|
|
156
200
|
*
|
|
157
|
-
* const
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* payment: false, // 未启用,不会出现在 contract 或 OpenAPI spec 中
|
|
161
|
-
* })
|
|
201
|
+
* const contract = apiContract.create({ iam: apiContract.iam, payment: false })
|
|
202
|
+
* const loginPath = apiContract.pathOf(contract.iam.auth.login)
|
|
203
|
+
* void loginPath
|
|
162
204
|
* ```
|
|
163
205
|
*/
|
|
164
206
|
declare function createApiContract<const T extends CreateApiContractOptions>(options: T): CreatedApiContract<T>;
|
|
165
207
|
|
|
166
|
-
/**
|
|
208
|
+
/**
|
|
209
|
+
* hai-framework API contract 统一入口(扁平命名空间)。
|
|
210
|
+
* @example
|
|
211
|
+
* ```ts
|
|
212
|
+
* import { apiContract } from '@h-ai/api-contract'
|
|
213
|
+
*
|
|
214
|
+
* const contract = apiContract.create({ iam: apiContract.iam, payment: false })
|
|
215
|
+
* const loginPath = apiContract.pathOf(contract.iam.auth.login)
|
|
216
|
+
* void loginPath
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
167
219
|
declare const apiContract: {
|
|
168
220
|
/** 组合任意领域 contract,过滤掉 `false` / `undefined`,输出可被 serv 挂载的 router。 */
|
|
169
221
|
create: typeof createApiContract;
|
|
@@ -355,7 +407,6 @@ declare const apiContract: {
|
|
|
355
407
|
login: _orpc_contract.ContractProcedureBuilderWithInputOutput<zod.ZodObject<{
|
|
356
408
|
identifier: zod.ZodString;
|
|
357
409
|
password: zod.ZodString;
|
|
358
|
-
rememberMe: zod.ZodOptional<zod.ZodBoolean>;
|
|
359
410
|
}, zod_v4_core.$strip>, zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
360
411
|
success: zod.ZodLiteral<true>;
|
|
361
412
|
data: zod.ZodObject<{
|
|
@@ -1123,7 +1174,7 @@ declare const apiContract: {
|
|
|
1123
1174
|
createDownload: _orpc_contract.ContractProcedureBuilderWithInputOutput<zod.ZodObject<{
|
|
1124
1175
|
key: zod.ZodString;
|
|
1125
1176
|
expiresIn: zod.ZodOptional<zod.ZodNumber>;
|
|
1126
|
-
}, zod_v4_core.$
|
|
1177
|
+
}, zod_v4_core.$strict>, zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
1127
1178
|
success: zod.ZodLiteral<true>;
|
|
1128
1179
|
data: zod.ZodObject<{
|
|
1129
1180
|
url: zod.ZodString;
|
|
@@ -1146,9 +1197,8 @@ declare const apiContract: {
|
|
|
1146
1197
|
createUpload: _orpc_contract.ContractProcedureBuilderWithInputOutput<zod.ZodObject<{
|
|
1147
1198
|
key: zod.ZodString;
|
|
1148
1199
|
contentType: zod.ZodOptional<zod.ZodString>;
|
|
1149
|
-
contentLength: zod.ZodOptional<zod.ZodNumber>;
|
|
1150
1200
|
expiresIn: zod.ZodOptional<zod.ZodNumber>;
|
|
1151
|
-
}, zod_v4_core.$
|
|
1201
|
+
}, zod_v4_core.$strict>, zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
1152
1202
|
success: zod.ZodLiteral<true>;
|
|
1153
1203
|
data: zod.ZodObject<{
|
|
1154
1204
|
url: zod.ZodString;
|
|
@@ -1250,7 +1300,19 @@ declare const apiContract: {
|
|
|
1250
1300
|
keys: zod.ZodArray<zod.ZodString>;
|
|
1251
1301
|
}, zod_v4_core.$strip>, zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
1252
1302
|
success: zod.ZodLiteral<true>;
|
|
1253
|
-
data: zod.
|
|
1303
|
+
data: zod.ZodObject<{
|
|
1304
|
+
deletedKeys: zod.ZodArray<zod.ZodString>;
|
|
1305
|
+
failures: zod.ZodArray<zod.ZodObject<{
|
|
1306
|
+
key: zod.ZodString;
|
|
1307
|
+
code: zod.ZodString;
|
|
1308
|
+
retryable: zod.ZodBoolean;
|
|
1309
|
+
outcome: zod.ZodEnum<{
|
|
1310
|
+
unknown: "unknown";
|
|
1311
|
+
failed: "failed";
|
|
1312
|
+
notAttempted: "notAttempted";
|
|
1313
|
+
}>;
|
|
1314
|
+
}, zod_v4_core.$strip>>;
|
|
1315
|
+
}, zod_v4_core.$strip>;
|
|
1254
1316
|
}, zod_v4_core.$strip>, zod.ZodObject<{
|
|
1255
1317
|
success: zod.ZodLiteral<false>;
|
|
1256
1318
|
error: zod.ZodObject<{
|
|
@@ -1261,7 +1323,21 @@ declare const apiContract: {
|
|
|
1261
1323
|
module: zod.ZodOptional<zod.ZodString>;
|
|
1262
1324
|
cause: zod.ZodOptional<zod.ZodUnknown>;
|
|
1263
1325
|
suggestion: zod.ZodOptional<zod.ZodString>;
|
|
1264
|
-
ext: zod.ZodOptional<zod.
|
|
1326
|
+
ext: zod.ZodOptional<zod.ZodObject<{
|
|
1327
|
+
deleteMany: zod.ZodOptional<zod.ZodObject<{
|
|
1328
|
+
deletedKeys: zod.ZodArray<zod.ZodString>;
|
|
1329
|
+
failures: zod.ZodArray<zod.ZodObject<{
|
|
1330
|
+
key: zod.ZodString;
|
|
1331
|
+
code: zod.ZodString;
|
|
1332
|
+
retryable: zod.ZodBoolean;
|
|
1333
|
+
outcome: zod.ZodEnum<{
|
|
1334
|
+
unknown: "unknown";
|
|
1335
|
+
failed: "failed";
|
|
1336
|
+
notAttempted: "notAttempted";
|
|
1337
|
+
}>;
|
|
1338
|
+
}, zod_v4_core.$strip>>;
|
|
1339
|
+
}, zod_v4_core.$strip>>;
|
|
1340
|
+
}, zod_v4_core.$catchall<zod.ZodUnknown>>>;
|
|
1265
1341
|
}, zod_v4_core.$strip>;
|
|
1266
1342
|
}, zod_v4_core.$strip>], "success">, Record<never, never>, Record<never, never>>;
|
|
1267
1343
|
};
|
|
@@ -1270,18 +1346,22 @@ declare const apiContract: {
|
|
|
1270
1346
|
ai: {
|
|
1271
1347
|
chats: {
|
|
1272
1348
|
createCompletion: _orpc_contract.ContractProcedureBuilderWithInputOutput<zod.ZodObject<{
|
|
1349
|
+
objectId: zod.ZodOptional<zod.ZodString>;
|
|
1350
|
+
sessionId: zod.ZodOptional<zod.ZodString>;
|
|
1273
1351
|
model: zod.ZodOptional<zod.ZodString>;
|
|
1274
|
-
messages: zod.ZodArray<zod.ZodObject<{
|
|
1275
|
-
role: zod.
|
|
1276
|
-
|
|
1277
|
-
user: "user";
|
|
1278
|
-
assistant: "assistant";
|
|
1279
|
-
tool: "tool";
|
|
1280
|
-
}>;
|
|
1281
|
-
content: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
1352
|
+
messages: zod.ZodArray<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
1353
|
+
role: zod.ZodLiteral<"system">;
|
|
1354
|
+
content: zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodObject<{
|
|
1282
1355
|
type: zod.ZodLiteral<"text">;
|
|
1283
1356
|
text: zod.ZodString;
|
|
1284
|
-
}, zod_v4_core.$
|
|
1357
|
+
}, zod_v4_core.$strict>>]>;
|
|
1358
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
1359
|
+
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
1360
|
+
role: zod.ZodLiteral<"user">;
|
|
1361
|
+
content: zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
1362
|
+
type: zod.ZodLiteral<"text">;
|
|
1363
|
+
text: zod.ZodString;
|
|
1364
|
+
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
1285
1365
|
type: zod.ZodLiteral<"image_url">;
|
|
1286
1366
|
image_url: zod.ZodObject<{
|
|
1287
1367
|
url: zod.ZodString;
|
|
@@ -1290,8 +1370,15 @@ declare const apiContract: {
|
|
|
1290
1370
|
low: "low";
|
|
1291
1371
|
high: "high";
|
|
1292
1372
|
}>>;
|
|
1293
|
-
}, zod_v4_core.$
|
|
1294
|
-
}, zod_v4_core.$
|
|
1373
|
+
}, zod_v4_core.$strict>;
|
|
1374
|
+
}, zod_v4_core.$strict>]>>]>;
|
|
1375
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
1376
|
+
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
1377
|
+
role: zod.ZodLiteral<"assistant">;
|
|
1378
|
+
content: zod.ZodOptional<zod.ZodNullable<zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodObject<{
|
|
1379
|
+
type: zod.ZodLiteral<"text">;
|
|
1380
|
+
text: zod.ZodString;
|
|
1381
|
+
}, zod_v4_core.$strict>>]>>>;
|
|
1295
1382
|
name: zod.ZodOptional<zod.ZodString>;
|
|
1296
1383
|
tool_calls: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
1297
1384
|
id: zod.ZodString;
|
|
@@ -1299,37 +1386,35 @@ declare const apiContract: {
|
|
|
1299
1386
|
function: zod.ZodObject<{
|
|
1300
1387
|
name: zod.ZodString;
|
|
1301
1388
|
arguments: zod.ZodString;
|
|
1302
|
-
}, zod_v4_core.$
|
|
1303
|
-
}, zod_v4_core.$
|
|
1304
|
-
|
|
1305
|
-
|
|
1389
|
+
}, zod_v4_core.$strict>;
|
|
1390
|
+
}, zod_v4_core.$strict>>>;
|
|
1391
|
+
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
1392
|
+
role: zod.ZodLiteral<"tool">;
|
|
1393
|
+
content: zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodObject<{
|
|
1394
|
+
type: zod.ZodLiteral<"text">;
|
|
1395
|
+
text: zod.ZodString;
|
|
1396
|
+
}, zod_v4_core.$strict>>]>;
|
|
1397
|
+
tool_call_id: zod.ZodString;
|
|
1398
|
+
}, zod_v4_core.$strict>], "role">>;
|
|
1306
1399
|
temperature: zod.ZodOptional<zod.ZodNumber>;
|
|
1307
1400
|
top_p: zod.ZodOptional<zod.ZodNumber>;
|
|
1308
1401
|
max_tokens: zod.ZodOptional<zod.ZodNumber>;
|
|
1309
|
-
stream: zod.ZodOptional<zod.ZodBoolean>;
|
|
1310
1402
|
tools: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
1311
1403
|
type: zod.ZodLiteral<"function">;
|
|
1312
1404
|
function: zod.ZodObject<{
|
|
1313
1405
|
name: zod.ZodString;
|
|
1314
1406
|
description: zod.ZodOptional<zod.ZodString>;
|
|
1315
|
-
parameters: zod.ZodOptional<zod.
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
enum: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
1321
|
-
}, zod_v4_core.$strip>>>;
|
|
1322
|
-
required: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
1323
|
-
}, zod_v4_core.$strip>>;
|
|
1324
|
-
}, zod_v4_core.$strip>;
|
|
1325
|
-
}, zod_v4_core.$strip>>>;
|
|
1326
|
-
tool_choice: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodLiteral<"auto">, zod.ZodLiteral<"none">, zod.ZodObject<{
|
|
1407
|
+
parameters: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodJSONSchema>>;
|
|
1408
|
+
strict: zod.ZodOptional<zod.ZodNullable<zod.ZodBoolean>>;
|
|
1409
|
+
}, zod_v4_core.$strict>;
|
|
1410
|
+
}, zod_v4_core.$strict>>>;
|
|
1411
|
+
tool_choice: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodLiteral<"auto">, zod.ZodLiteral<"none">, zod.ZodLiteral<"required">, zod.ZodObject<{
|
|
1327
1412
|
type: zod.ZodLiteral<"function">;
|
|
1328
1413
|
function: zod.ZodObject<{
|
|
1329
1414
|
name: zod.ZodString;
|
|
1330
|
-
}, zod_v4_core.$
|
|
1331
|
-
}, zod_v4_core.$
|
|
1332
|
-
}, zod_v4_core.$
|
|
1415
|
+
}, zod_v4_core.$strict>;
|
|
1416
|
+
}, zod_v4_core.$strict>]>>;
|
|
1417
|
+
}, zod_v4_core.$strict>, zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
1333
1418
|
success: zod.ZodLiteral<true>;
|
|
1334
1419
|
data: zod.ZodObject<{
|
|
1335
1420
|
id: zod.ZodString;
|
|
@@ -1347,8 +1432,8 @@ declare const apiContract: {
|
|
|
1347
1432
|
function: zod.ZodObject<{
|
|
1348
1433
|
name: zod.ZodString;
|
|
1349
1434
|
arguments: zod.ZodString;
|
|
1350
|
-
}, zod_v4_core.$
|
|
1351
|
-
}, zod_v4_core.$
|
|
1435
|
+
}, zod_v4_core.$strict>;
|
|
1436
|
+
}, zod_v4_core.$strict>>>;
|
|
1352
1437
|
}, zod_v4_core.$strip>;
|
|
1353
1438
|
finish_reason: zod.ZodEnum<{
|
|
1354
1439
|
length: "length";
|
|
@@ -1377,6 +1462,8 @@ declare const apiContract: {
|
|
|
1377
1462
|
}, zod_v4_core.$strip>;
|
|
1378
1463
|
}, zod_v4_core.$strip>], "success">, Record<never, never>, Record<never, never>>;
|
|
1379
1464
|
sendMessage: _orpc_contract.ContractProcedureBuilderWithInputOutput<zod.ZodObject<{
|
|
1465
|
+
objectId: zod.ZodOptional<zod.ZodString>;
|
|
1466
|
+
sessionId: zod.ZodOptional<zod.ZodString>;
|
|
1380
1467
|
message: zod.ZodString;
|
|
1381
1468
|
systemPrompt: zod.ZodOptional<zod.ZodString>;
|
|
1382
1469
|
model: zod.ZodOptional<zod.ZodString>;
|
|
@@ -1406,7 +1493,7 @@ declare const apiContract: {
|
|
|
1406
1493
|
}, zod_v4_core.$strip>;
|
|
1407
1494
|
}, zod_v4_core.$strip>], "success">, Record<never, never>, Record<never, never>>;
|
|
1408
1495
|
listHistory: _orpc_contract.ContractProcedureBuilderWithInputOutput<zod.ZodObject<{
|
|
1409
|
-
objectId: zod.ZodString
|
|
1496
|
+
objectId: zod.ZodOptional<zod.ZodString>;
|
|
1410
1497
|
sessionId: zod.ZodString;
|
|
1411
1498
|
limit: zod.ZodOptional<zod.ZodNumber>;
|
|
1412
1499
|
order: zod.ZodOptional<zod.ZodEnum<{
|
|
@@ -1422,17 +1509,19 @@ declare const apiContract: {
|
|
|
1422
1509
|
sessionId: zod.ZodString;
|
|
1423
1510
|
request: zod.ZodObject<{
|
|
1424
1511
|
model: zod.ZodString;
|
|
1425
|
-
messages: zod.ZodArray<zod.ZodObject<{
|
|
1426
|
-
role: zod.
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1512
|
+
messages: zod.ZodArray<zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
1513
|
+
role: zod.ZodLiteral<"system">;
|
|
1514
|
+
content: zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodObject<{
|
|
1515
|
+
type: zod.ZodLiteral<"text">;
|
|
1516
|
+
text: zod.ZodString;
|
|
1517
|
+
}, zod_v4_core.$strict>>]>;
|
|
1518
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
1519
|
+
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
1520
|
+
role: zod.ZodLiteral<"user">;
|
|
1521
|
+
content: zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
1433
1522
|
type: zod.ZodLiteral<"text">;
|
|
1434
1523
|
text: zod.ZodString;
|
|
1435
|
-
}, zod_v4_core.$
|
|
1524
|
+
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
1436
1525
|
type: zod.ZodLiteral<"image_url">;
|
|
1437
1526
|
image_url: zod.ZodObject<{
|
|
1438
1527
|
url: zod.ZodString;
|
|
@@ -1441,8 +1530,15 @@ declare const apiContract: {
|
|
|
1441
1530
|
low: "low";
|
|
1442
1531
|
high: "high";
|
|
1443
1532
|
}>>;
|
|
1444
|
-
}, zod_v4_core.$
|
|
1445
|
-
}, zod_v4_core.$
|
|
1533
|
+
}, zod_v4_core.$strict>;
|
|
1534
|
+
}, zod_v4_core.$strict>]>>]>;
|
|
1535
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
1536
|
+
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
1537
|
+
role: zod.ZodLiteral<"assistant">;
|
|
1538
|
+
content: zod.ZodOptional<zod.ZodNullable<zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodObject<{
|
|
1539
|
+
type: zod.ZodLiteral<"text">;
|
|
1540
|
+
text: zod.ZodString;
|
|
1541
|
+
}, zod_v4_core.$strict>>]>>>;
|
|
1446
1542
|
name: zod.ZodOptional<zod.ZodString>;
|
|
1447
1543
|
tool_calls: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
1448
1544
|
id: zod.ZodString;
|
|
@@ -1450,10 +1546,16 @@ declare const apiContract: {
|
|
|
1450
1546
|
function: zod.ZodObject<{
|
|
1451
1547
|
name: zod.ZodString;
|
|
1452
1548
|
arguments: zod.ZodString;
|
|
1453
|
-
}, zod_v4_core.$
|
|
1454
|
-
}, zod_v4_core.$
|
|
1455
|
-
|
|
1456
|
-
|
|
1549
|
+
}, zod_v4_core.$strict>;
|
|
1550
|
+
}, zod_v4_core.$strict>>>;
|
|
1551
|
+
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
1552
|
+
role: zod.ZodLiteral<"tool">;
|
|
1553
|
+
content: zod.ZodUnion<readonly [zod.ZodString, zod.ZodArray<zod.ZodObject<{
|
|
1554
|
+
type: zod.ZodLiteral<"text">;
|
|
1555
|
+
text: zod.ZodString;
|
|
1556
|
+
}, zod_v4_core.$strict>>]>;
|
|
1557
|
+
tool_call_id: zod.ZodString;
|
|
1558
|
+
}, zod_v4_core.$strict>], "role">>;
|
|
1457
1559
|
}, zod_v4_core.$strip>;
|
|
1458
1560
|
response: zod.ZodObject<{
|
|
1459
1561
|
content: zod.ZodString;
|
|
@@ -1463,8 +1565,8 @@ declare const apiContract: {
|
|
|
1463
1565
|
function: zod.ZodObject<{
|
|
1464
1566
|
name: zod.ZodString;
|
|
1465
1567
|
arguments: zod.ZodString;
|
|
1466
|
-
}, zod_v4_core.$
|
|
1467
|
-
}, zod_v4_core.$
|
|
1568
|
+
}, zod_v4_core.$strict>;
|
|
1569
|
+
}, zod_v4_core.$strict>>>;
|
|
1468
1570
|
finishReason: zod.ZodString;
|
|
1469
1571
|
usage: zod.ZodObject<{
|
|
1470
1572
|
prompt_tokens: zod.ZodNumber;
|
|
@@ -1586,7 +1688,7 @@ declare const apiContract: {
|
|
|
1586
1688
|
};
|
|
1587
1689
|
sessions: {
|
|
1588
1690
|
list: _orpc_contract.ContractProcedureBuilderWithInputOutput<zod.ZodObject<{
|
|
1589
|
-
objectId: zod.ZodString
|
|
1691
|
+
objectId: zod.ZodOptional<zod.ZodString>;
|
|
1590
1692
|
}, zod_v4_core.$strip>, zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
1591
1693
|
success: zod.ZodLiteral<true>;
|
|
1592
1694
|
data: zod.ZodObject<{
|
|
@@ -1627,13 +1729,10 @@ declare const apiContract: {
|
|
|
1627
1729
|
tradeType: zod.ZodEnum<{
|
|
1628
1730
|
jsapi: "jsapi";
|
|
1629
1731
|
h5: "h5";
|
|
1630
|
-
app: "app";
|
|
1631
|
-
native: "native";
|
|
1632
|
-
mini_program: "mini_program";
|
|
1633
1732
|
}>;
|
|
1634
1733
|
userId: zod.ZodOptional<zod.ZodString>;
|
|
1635
1734
|
metadata: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodString>>;
|
|
1636
|
-
}, zod_v4_core.$
|
|
1735
|
+
}, zod_v4_core.$strict>, zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
1637
1736
|
success: zod.ZodLiteral<true>;
|
|
1638
1737
|
data: zod.ZodObject<{
|
|
1639
1738
|
provider: zod.ZodEnum<{
|
|
@@ -1644,9 +1743,6 @@ declare const apiContract: {
|
|
|
1644
1743
|
tradeType: zod.ZodEnum<{
|
|
1645
1744
|
jsapi: "jsapi";
|
|
1646
1745
|
h5: "h5";
|
|
1647
|
-
app: "app";
|
|
1648
|
-
native: "native";
|
|
1649
|
-
mini_program: "mini_program";
|
|
1650
1746
|
}>;
|
|
1651
1747
|
clientParams: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
|
|
1652
1748
|
prepayId: zod.ZodOptional<zod.ZodString>;
|
|
@@ -1797,7 +1893,18 @@ declare const apiContract: {
|
|
|
1797
1893
|
* @module response-schemas
|
|
1798
1894
|
*/
|
|
1799
1895
|
|
|
1800
|
-
/**
|
|
1896
|
+
/**
|
|
1897
|
+
* 通用 ID 路径参数 Schema。用于 `GET /resource/{id}` 等 RESTful 路由的输入校验。
|
|
1898
|
+
* @example
|
|
1899
|
+
* ```ts
|
|
1900
|
+
* import { IdParamSchema } from '@h-ai/api-contract'
|
|
1901
|
+
*
|
|
1902
|
+
* const value = IdParamSchema.parse({
|
|
1903
|
+
* id: 'example-1'
|
|
1904
|
+
* })
|
|
1905
|
+
* void value
|
|
1906
|
+
* ```
|
|
1907
|
+
*/
|
|
1801
1908
|
declare const IdParamSchema: z.ZodObject<{
|
|
1802
1909
|
id: z.ZodString;
|
|
1803
1910
|
}, z.core.$strip>;
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { iamContract, paginatedSchema } from './chunk-
|
|
2
|
-
export { IamAdminCreateUserInputSchema, IamAdminResetPasswordInputSchema, IamAdminUpdateUserInputSchema, IamAgreementDisplaySchema, IamAuthResultSchema, IamChangePasswordInputSchema, IamConfirmPasswordResetInputSchema, IamCreatePermissionInputSchema, IamCreateRoleInputSchema, IamCurrentUserSchema, IamLdapLoginInputSchema, IamListPermissionsInputSchema, IamListUsersInputSchema, IamLoginInputSchema, IamLogoutInputSchema, IamOtpLoginInputSchema, IamPermissionSchema, IamPermissionTypeSchema, IamPublicConfigSchema, IamRefreshTokenDataSchema, IamRefreshTokenInputSchema, IamRegisterInputSchema, IamRequestPasswordResetInputSchema, IamRoleSchema, IamSendOtpDataSchema, IamSendOtpInputSchema, IamTokenPairSchema, IamUpdateCurrentUserInputSchema, IamUpdateRoleInputSchema, IamUserIdInputSchema, IamUserSchema, PaginationQuerySchema, paginatedSchema } from './chunk-
|
|
3
|
-
import { storageContract } from './chunk-
|
|
4
|
-
export { StorageDeleteFilesInputSchema, StorageFileKeyInputSchema, StorageFileMetadataSchema, StorageListFilesDataSchema, StorageListFilesInputSchema, StoragePresignDownloadInputSchema, StoragePresignUploadInputSchema, StoragePresignedUrlSchema } from './chunk-
|
|
5
|
-
import { aiContract } from './chunk-
|
|
6
|
-
export { AUDIO_WS_PATH, AiAssistantMessageSchema, AiChatCompletionChoiceSchema, AiChatCompletionDataSchema, AiChatCompletionInputSchema, AiChatHistoryDataSchema, AiChatHistoryInputSchema, AiChatMessageSchema, AiChatRecordSchema, AiImageContentSchema, AiMemoryEntrySchema, AiMemoryListDataSchema, AiMemoryListInputSchema, AiMemoryRecallDataSchema, AiMemoryRecallInputSchema, AiMemoryTypeSchema, AiMessageContentSchema, AiMessageRoleSchema, AiSendMessageDataSchema, AiSendMessageInputSchema, AiSessionInfoSchema, AiSessionListDataSchema, AiSessionListInputSchema, AiTextContentSchema, AiTokenUsageSchema, AiToolCallSchema, AiToolDefinitionSchema,
|
|
7
|
-
import { paymentContract } from './chunk-
|
|
8
|
-
export { PaymentCreateOrderDataSchema, PaymentCreateOrderInputSchema, PaymentNotifyMessageSchema, PaymentOrderSchema, PaymentProviderSchema, PaymentQueryOrderInputSchema, PaymentRefundDataSchema, PaymentRefundInputSchema, PaymentStripeNotifyDataSchema, PaymentTradeTypeSchema } from './chunk-
|
|
9
|
-
import { pathOf, route, HaiVoidResultSchema, haiResultSchema } from './chunk-
|
|
10
|
-
export { HaiErrorSchema } from './chunk-
|
|
1
|
+
import { iamContract, paginatedSchema } from './chunk-G3SME6V5.js';
|
|
2
|
+
export { IamAdminCreateUserInputSchema, IamAdminResetPasswordInputSchema, IamAdminUpdateUserInputSchema, IamAgreementDisplaySchema, IamAuthResultSchema, IamChangePasswordInputSchema, IamConfirmPasswordResetInputSchema, IamCreatePermissionInputSchema, IamCreateRoleInputSchema, IamCurrentUserSchema, IamLdapLoginInputSchema, IamListPermissionsInputSchema, IamListUsersInputSchema, IamLoginInputSchema, IamLogoutInputSchema, IamOtpLoginInputSchema, IamPermissionSchema, IamPermissionTypeSchema, IamPublicConfigSchema, IamRefreshTokenDataSchema, IamRefreshTokenInputSchema, IamRegisterInputSchema, IamRequestPasswordResetInputSchema, IamRoleSchema, IamSendOtpDataSchema, IamSendOtpInputSchema, IamTokenPairSchema, IamUpdateCurrentUserInputSchema, IamUpdateRoleInputSchema, IamUserIdInputSchema, IamUserSchema, PaginationQuerySchema, paginatedSchema } from './chunk-G3SME6V5.js';
|
|
3
|
+
import { storageContract } from './chunk-IVZVAWEF.js';
|
|
4
|
+
export { StorageDeleteFilesInputSchema, StorageDeleteSummarySchema, StorageFileKeyInputSchema, StorageFileMetadataSchema, StorageListFilesDataSchema, StorageListFilesInputSchema, StoragePresignDownloadInputSchema, StoragePresignUploadInputSchema, StoragePresignedUrlSchema } from './chunk-IVZVAWEF.js';
|
|
5
|
+
import { aiContract } from './chunk-G55ATYDA.js';
|
|
6
|
+
export { AUDIO_WS_PATH, AiAssistantMessageSchema, AiChatCompletionChoiceSchema, AiChatCompletionDataSchema, AiChatCompletionInputSchema, AiChatHistoryDataSchema, AiChatHistoryInputSchema, AiChatMessageSchema, AiChatRecordSchema, AiImageContentSchema, AiMemoryEntrySchema, AiMemoryListDataSchema, AiMemoryListInputSchema, AiMemoryRecallDataSchema, AiMemoryRecallInputSchema, AiMemoryTypeSchema, AiMessageContentSchema, AiMessageRoleSchema, AiSendMessageDataSchema, AiSendMessageInputSchema, AiSessionInfoSchema, AiSessionListDataSchema, AiSessionListInputSchema, AiTextContentSchema, AiTokenUsageSchema, AiToolCallSchema, AiToolDefinitionSchema, AudioFormatSchema, AudioWsClientMessageSchema, AudioWsDoneMessageSchema, AudioWsStartMessageSchema, AudioWsTextMessageSchema } from './chunk-G55ATYDA.js';
|
|
7
|
+
import { paymentContract } from './chunk-R5GDWFYC.js';
|
|
8
|
+
export { PaymentCreateOrderDataSchema, PaymentCreateOrderInputSchema, PaymentNotifyMessageSchema, PaymentOrderSchema, PaymentProviderSchema, PaymentQueryOrderInputSchema, PaymentRefundDataSchema, PaymentRefundInputSchema, PaymentStripeNotifyDataSchema, PaymentTradeTypeSchema } from './chunk-R5GDWFYC.js';
|
|
9
|
+
import { pathOf, route, HaiVoidResultSchema, haiResultSchema } from './chunk-JKPLID6E.js';
|
|
10
|
+
export { HaiErrorSchema } from './chunk-JKPLID6E.js';
|
|
11
11
|
import { z } from 'zod';
|
|
12
12
|
|
|
13
13
|
// src/composition/create-api-contract.ts
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/composition/create-api-contract.ts","../src/api-contract-main.ts","../src/common/response-schemas.ts"],"names":[],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/composition/create-api-contract.ts","../src/api-contract-main.ts","../src/common/response-schemas.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAyDO,SAAS,kBAA4D,OAAA,EAAmC;AAC7G,EAAA,MAAM,WAA8C,EAAC;AAErD,EAAA,KAAA,MAAW,CAAC,MAAA,EAAQ,cAAc,KAAK,MAAA,CAAO,OAAA,CAAQ,OAAO,CAAA,EAAG;AAC9D,IAAA,IAAI,cAAA,EAAgB;AAClB,MAAA,QAAA,CAAS,MAAM,CAAA,GAAI,cAAA;AAAA,IACrB;AAAA,EACF;AAEA,EAAA,OAAO,QAAA;AACT;;;AC1BO,IAAM,WAAA,GAAc;AAAA;AAAA,EAEzB,MAAA,EAAQ,iBAAA;AAAA;AAAA,EAGR,eAAA;AAAA;AAAA,EAEA,gBAAA,EAAkB,mBAAA;AAAA;AAAA,EAElB,eAAA;AAAA;AAAA,EAEA,KAAA;AAAA;AAAA,EAEA,MAAA;AAAA;AAAA;AAAA,EAIA,GAAA,EAAK,WAAA;AAAA;AAAA,EAEL,OAAA,EAAS,eAAA;AAAA;AAAA,EAET,EAAA,EAAI,UAAA;AAAA;AAAA,EAEJ,OAAA,EAAS;AACX;AC5CO,IAAM,aAAA,GAAgB,EAAE,MAAA,CAAO;AAAA,EACpC,EAAA,EAAI,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC;AACtB,CAAC","file":"index.js","sourcesContent":["/**\n * @h-ai/api-contract — Contract 组合工具\n *\n * 提供将多个领域 contract 组合为应用级 contract 的工厂函数。\n * 仅描述接口边界,不包含任何 procedure 实现。\n * @module create-api-contract\n */\n\nimport type { AnyContractRouter } from '@orpc/contract'\n\n/**\n * API contract 组合输入。key 为领域名称,value 为领域 contract 或 false/undefined(跳过该领域)。\n * @example\n * ```ts\n * import type { CreateApiContractOptions } from '@h-ai/api-contract'\n * import { apiContract } from '@h-ai/api-contract'\n *\n * const parts = { iam: apiContract.iam, payment: false } satisfies CreateApiContractOptions\n * const contract = apiContract.create(parts)\n * void contract.iam.auth.login\n * ```\n */\nexport type CreateApiContractOptions = Record<string, AnyContractRouter | false | undefined>\n\n/**\n * 根据输入过滤 false/undefined 后得到的应用级 contract 类型。\n * @example\n * ```ts\n * import type { CreatedApiContract } from '@h-ai/api-contract'\n * import { apiContract } from '@h-ai/api-contract'\n *\n * const parts = { iam: apiContract.iam, payment: false } as const\n * const contract: CreatedApiContract<typeof parts> = apiContract.create(parts)\n * void contract.iam.auth.login\n * ```\n */\nexport type CreatedApiContract<T extends CreateApiContractOptions> = {\n readonly [K in keyof T as T[K] extends false | undefined ? never : K]: Exclude<T[K], false | undefined>\n}\n\n/**\n * 按领域组合应用级 API contract。\n *\n * contract 只描述接口边界;具体的 procedure 实现由 `@h-ai/serv` 的 feature 模块或应用层提供。\n * 传入 `false` 或 `undefined` 的领域将从最终 contract 中移除,类型也会同步收窄。\n *\n * @param options - 各领域 contract(传 false/undefined 表示禁用该领域)\n * @returns 过滤后的应用级 oRPC contract router\n * @example\n * ```ts\n * import { apiContract } from '@h-ai/api-contract'\n *\n * const contract = apiContract.create({ iam: apiContract.iam, payment: false })\n * const loginPath = apiContract.pathOf(contract.iam.auth.login)\n * void loginPath\n * ```\n */\nexport function createApiContract<const T extends CreateApiContractOptions>(options: T): CreatedApiContract<T> {\n const contract: Record<string, AnyContractRouter> = {}\n\n for (const [domain, domainContract] of Object.entries(options)) {\n if (domainContract) {\n contract[domain] = domainContract\n }\n }\n\n return contract as CreatedApiContract<T>\n}\n","/**\n * @h-ai/api-contract — 统一命名空间入口\n *\n * 将 contract 组合工厂、HaiResult schema 工具与各领域 contract 集中暴露在\n * `apiContract.*` 之下。应用层只需 `import { apiContract } from '@h-ai/api-contract'`\n * 即可完成所有 contract 装配,无需感知子模块路径或 `@orpc/contract` 实现细节。\n *\n * @module api-contract-main\n *\n * @example\n * ```ts\n * import { apiContract } from '@h-ai/api-contract'\n *\n * const contract = apiContract.create({\n * iam: apiContract.iam,\n * storage: apiContract.storage,\n * ai: apiContract.ai,\n * })\n * ```\n */\n\nimport { aiContract } from './ai/ai-contract.js'\nimport { paginatedSchema } from './common/pagination-schemas.js'\nimport { haiResultSchema, HaiVoidResultSchema } from './common/result-schemas.js'\nimport { pathOf, route } from './common/route.js'\nimport { createApiContract } from './composition/create-api-contract.js'\nimport { iamContract } from './iam/iam-contract.js'\nimport { paymentContract } from './payment/payment-contract.js'\nimport { storageContract } from './storage/storage-contract.js'\n\n/**\n * hai-framework API contract 统一入口(扁平命名空间)。\n * @example\n * ```ts\n * import { apiContract } from '@h-ai/api-contract'\n *\n * const contract = apiContract.create({ iam: apiContract.iam, payment: false })\n * const loginPath = apiContract.pathOf(contract.iam.auth.login)\n * void loginPath\n * ```\n */\nexport const apiContract = {\n /** 组合任意领域 contract,过滤掉 `false` / `undefined`,输出可被 serv 挂载的 router。 */\n create: createApiContract,\n\n /** 把 data schema 包成 `HaiResult<T>` 区分联合,供 procedure `.output(...)` 使用。 */\n haiResultSchema,\n /** `HaiResult<void>` 常量 schema。 */\n voidResultSchema: HaiVoidResultSchema,\n /** 分页响应 schema 工厂。 */\n paginatedSchema,\n /** 创建 oRPC contract 路由节点,供自定义 contract 定义 HTTP 元数据。 */\n route,\n /** 从 contract procedure 读取其唯一业务路径。 */\n pathOf,\n\n // 领域 contract(框架内置)\n /** IAM 领域 contract(认证 / 用户 / 角色 / 权限)。 */\n iam: iamContract,\n /** Storage 领域 contract(预签名 URL / 文件管理)。 */\n storage: storageContract,\n /** AI 领域 contract(聊天 / 记忆 / 会话)。 */\n ai: aiContract,\n /** Payment 领域 contract。 */\n payment: paymentContract,\n}\n","/**\n * @h-ai/api-contract — 通用响应 Schema\n *\n * 跨领域共用的基础请求 / 响应结构,如 ID 路径参数。\n * @module response-schemas\n */\n\nimport { z } from 'zod'\n\n/**\n * 通用 ID 路径参数 Schema。用于 `GET /resource/{id}` 等 RESTful 路由的输入校验。\n * @example\n * ```ts\n * import { IdParamSchema } from '@h-ai/api-contract'\n *\n * const value = IdParamSchema.parse({\n * id: 'example-1'\n * })\n * void value\n * ```\n */\nexport const IdParamSchema = z.object({\n id: z.string().min(1),\n})\n"]}
|