@h-ai/api-contract 0.1.0-alpha.70 → 0.1.0-alpha.72

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.
@@ -1,4 +1,4 @@
1
- export { PaymentCreateOrderDataSchema, PaymentCreateOrderInputSchema, PaymentNotifyMessageSchema, PaymentOrderSchema, PaymentProviderSchema, PaymentQueryOrderInputSchema, PaymentRefundDataSchema, PaymentRefundInputSchema, PaymentStripeNotifyDataSchema, PaymentTradeTypeSchema, paymentContract } from '../chunk-R5GDWFYC.js';
2
- import '../chunk-JKPLID6E.js';
1
+ export { PaymentCreateOrderDataSchema, PaymentCreateOrderInputSchema, PaymentNotifyMessageSchema, PaymentOrderSchema, PaymentProviderSchema, PaymentQueryOrderInputSchema, PaymentRefundDataSchema, PaymentRefundInputSchema, PaymentStripeNotifyDataSchema, PaymentTradeTypeSchema, paymentContract } from '../chunk-M4DEKGOP.js';
2
+ import '../chunk-5UEDYQLG.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -29,6 +29,7 @@ declare const storageContract: {
29
29
  error: z.ZodObject<{
30
30
  code: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
31
31
  message: z.ZodString;
32
+ traceId: z.ZodOptional<z.ZodString>;
32
33
  httpStatus: z.ZodOptional<z.ZodNumber>;
33
34
  system: z.ZodOptional<z.ZodString>;
34
35
  module: z.ZodOptional<z.ZodString>;
@@ -53,6 +54,7 @@ declare const storageContract: {
53
54
  error: z.ZodObject<{
54
55
  code: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
55
56
  message: z.ZodString;
57
+ traceId: z.ZodOptional<z.ZodString>;
56
58
  httpStatus: z.ZodOptional<z.ZodNumber>;
57
59
  system: z.ZodOptional<z.ZodString>;
58
60
  module: z.ZodOptional<z.ZodString>;
@@ -88,6 +90,7 @@ declare const storageContract: {
88
90
  error: z.ZodObject<{
89
91
  code: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
90
92
  message: z.ZodString;
93
+ traceId: z.ZodOptional<z.ZodString>;
91
94
  httpStatus: z.ZodOptional<z.ZodNumber>;
92
95
  system: z.ZodOptional<z.ZodString>;
93
96
  module: z.ZodOptional<z.ZodString>;
@@ -113,6 +116,7 @@ declare const storageContract: {
113
116
  error: z.ZodObject<{
114
117
  code: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
115
118
  message: z.ZodString;
119
+ traceId: z.ZodOptional<z.ZodString>;
116
120
  httpStatus: z.ZodOptional<z.ZodNumber>;
117
121
  system: z.ZodOptional<z.ZodString>;
118
122
  module: z.ZodOptional<z.ZodString>;
@@ -131,6 +135,7 @@ declare const storageContract: {
131
135
  error: z.ZodObject<{
132
136
  code: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
133
137
  message: z.ZodString;
138
+ traceId: z.ZodOptional<z.ZodString>;
134
139
  httpStatus: z.ZodOptional<z.ZodNumber>;
135
140
  system: z.ZodOptional<z.ZodString>;
136
141
  module: z.ZodOptional<z.ZodString>;
@@ -161,6 +166,7 @@ declare const storageContract: {
161
166
  error: z.ZodObject<{
162
167
  code: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
163
168
  message: z.ZodString;
169
+ traceId: z.ZodOptional<z.ZodString>;
164
170
  httpStatus: z.ZodOptional<z.ZodNumber>;
165
171
  system: z.ZodOptional<z.ZodString>;
166
172
  module: z.ZodOptional<z.ZodString>;
@@ -1,4 +1,4 @@
1
- export { StorageDeleteFilesInputSchema, StorageDeleteSummarySchema, StorageFileKeyInputSchema, StorageFileMetadataSchema, StorageListFilesDataSchema, StorageListFilesInputSchema, StoragePresignDownloadInputSchema, StoragePresignUploadInputSchema, StoragePresignedUrlSchema, storageContract } from '../chunk-IVZVAWEF.js';
2
- import '../chunk-JKPLID6E.js';
1
+ export { StorageDeleteFilesInputSchema, StorageDeleteSummarySchema, StorageFileKeyInputSchema, StorageFileMetadataSchema, StorageListFilesDataSchema, StorageListFilesInputSchema, StoragePresignDownloadInputSchema, StoragePresignUploadInputSchema, StoragePresignedUrlSchema, storageContract } from '../chunk-ZM7KM6V3.js';
2
+ import '../chunk-5UEDYQLG.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@h-ai/api-contract",
3
3
  "type": "module",
4
- "version": "0.1.0-alpha.70",
4
+ "version": "0.1.0-alpha.72",
5
5
  "description": "Hai Framework public API contracts powered by oRPC and Zod.",
6
6
  "license": "Apache-2.0",
7
7
  "exports": {
@@ -43,8 +43,8 @@
43
43
  "node": "^22.23.4 || ^24.22.1 || ^26.12.1"
44
44
  },
45
45
  "dependencies": {
46
- "@h-ai/core": "0.1.0-alpha.70",
47
- "@h-ai/storage": "0.1.0-alpha.70",
46
+ "@h-ai/core": "0.1.0-alpha.72",
47
+ "@h-ai/storage": "0.1.0-alpha.72",
48
48
  "@orpc/contract": "^1.15.5",
49
49
  "zod": "^4.6.5"
50
50
  },
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/common/result-schemas.ts","../src/common/route.ts"],"names":[],"mappings":";;;;AA0BO,IAAM,cAAA,GAAiB,EAAE,MAAA,CAAO;AAAA,EACrC,IAAA,EAAM,CAAA,CAAE,KAAA,CAAM,CAAC,CAAA,CAAE,QAAO,EAAG,CAAA,CAAE,MAAA,EAAQ,CAAC,CAAA;AAAA,EACtC,OAAA,EAAS,EAAE,MAAA,EAAO;AAAA,EAClB,UAAA,EAAY,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAChC,MAAA,EAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC5B,MAAA,EAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC5B,KAAA,EAAO,CAAA,CAAE,OAAA,EAAQ,CAAE,QAAA,EAAS;AAAA,EAC5B,UAAA,EAAY,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAChC,GAAA,EAAK,CAAA,CAAE,MAAA,CAAO,CAAA,CAAE,MAAA,IAAU,CAAA,CAAE,OAAA,EAAS,CAAA,CAAE,QAAA;AACzC,CAAC;AAiBM,SAAS,gBAAqC,UAAA,EAAe;AAClE,EAAA,OAAO,CAAA,CAAE,mBAAmB,SAAA,EAAW;AAAA,IACrC,EAAE,MAAA,CAAO;AAAA,MACP,OAAA,EAAS,CAAA,CAAE,OAAA,CAAQ,IAAI,CAAA;AAAA,MACvB,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,IACD,EAAE,MAAA,CAAO;AAAA,MACP,OAAA,EAAS,CAAA,CAAE,OAAA,CAAQ,KAAK,CAAA;AAAA,MACxB,KAAA,EAAO;AAAA,KACR;AAAA,GACF,CAAA;AACH;AAYO,IAAM,mBAAA,GAAsB,eAAA,CAAgB,CAAA,CAAE,IAAA,EAAM;ACrDpD,IAAM,QAAyB,CAAA,GAAI,IAAA,KAAS,EAAA,CAAG,KAAA,CAAM,GAAG,IAAI;AAkB5D,SAAS,OAAO,SAAA,EAA+C;AACpE,EAAA,MAAM,IAAA,GAAO,SAAA,CAAU,OAAO,CAAA,CAAE,KAAA,CAAM,IAAA;AACtC,EAAA,IAAI,CAAC,IAAA;AACH,IAAA,MAAM,IAAI,MAAM,6CAA6C,CAAA;AAC/D,EAAA,OAAO,IAAA;AACT","file":"chunk-JKPLID6E.js","sourcesContent":["/**\n * @h-ai/api-contract — HaiResult Schema\n *\n * 提供与 `@h-ai/core` HaiResult<T> 结构一致的 Zod Schema 工厂,\n * 用于 oRPC contract 的 output 定义和客户端响应校验。\n * @module result-schemas\n */\n\nimport { z } from 'zod'\n\n/**\n * HaiError 的跨端 JSON Schema。\n *\n * 仅描述公共错误字段,不暴露内部异常对象结构。\n * @example\n * ```ts\n * import { HaiErrorSchema } from '@h-ai/api-contract'\n *\n * const value = HaiErrorSchema.parse({\n * code: 'app:orders:001',\n * message: 'Order not found',\n * httpStatus: 404\n * })\n * void value\n * ```\n */\nexport const HaiErrorSchema = z.object({\n code: z.union([z.string(), z.number()]),\n message: z.string(),\n httpStatus: z.number().optional(),\n system: z.string().optional(),\n module: z.string().optional(),\n cause: z.unknown().optional(),\n suggestion: z.string().optional(),\n ext: z.record(z.string(), z.unknown()).optional(),\n})\n\n/**\n * 创建与 @h-ai/core HaiResult<T> 一致的响应 Schema。\n *\n * @param dataSchema - 成功分支 data 字段 Schema\n * @returns HaiResult<T> 的 Zod Schema\n * @example\n * ```ts\n * import { apiContract } from '@h-ai/api-contract'\n * import { z } from 'zod'\n *\n * const result = apiContract.haiResultSchema(z.object({ id: z.string() }))\n * .parse({ success: true, data: { id: 'order_1' } })\n * if (result.success) void result.data.id\n * ```\n */\nexport function haiResultSchema<T extends z.ZodType>(dataSchema: T) {\n return z.discriminatedUnion('success', [\n z.object({\n success: z.literal(true),\n data: dataSchema,\n }),\n z.object({\n success: z.literal(false),\n error: HaiErrorSchema,\n }),\n ])\n}\n\n/**\n * 无内容成功响应 Schema。\n * @example\n * ```ts\n * import { apiContract } from '@h-ai/api-contract'\n *\n * const result = apiContract.voidResultSchema.parse({ success: true, data: undefined })\n * if (!result.success) throw new Error(result.error.message)\n * ```\n */\nexport const HaiVoidResultSchema = haiResultSchema(z.void())\n","/**\n * @h-ai/api-contract — route builder\n *\n * 统一封装 oRPC 的 route builder。应用与契约包通过 `apiContract.route(...)`\n * 定义 HTTP 路由元数据,不需要直接依赖 `@orpc/contract` 或 `@h-ai/serv`。\n */\n\nimport type { AnyContractProcedure } from '@orpc/contract'\nimport { oc } from '@orpc/contract'\n\n/**\n * 创建 oRPC contract 路由节点。\n * @example\n * ```ts\n * import { apiContract } from '@h-ai/api-contract'\n * import { z } from 'zod'\n *\n * const health = apiContract.route({ method: 'GET', path: '/health' })\n * .output(z.object({ healthy: z.boolean() }))\n * void health\n * ```\n */\nexport const route: typeof oc.route = (...args) => oc.route(...args)\n\n/**\n * 读取 contract procedure 中声明的业务路径。\n *\n * 路径只在对应 `*-contract.ts` 的 route 定义中维护;transport、client 与\n * middleware 通过本函数读取,避免再维护一份路由常量。\n *\n * @param procedure - 已声明 HTTP route 的 oRPC contract procedure\n * @returns contract 中的绝对业务路径\n * @example\n * ```ts\n * import { apiContract } from '@h-ai/api-contract'\n *\n * const path = apiContract.pathOf(apiContract.iam.auth.login)\n * void path\n * ```\n */\nexport function pathOf(procedure: AnyContractProcedure): `/${string}` {\n const path = procedure['~orpc'].route.path\n if (!path)\n throw new Error('Contract procedure must define an HTTP path')\n return path\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/feedback/feedback-schemas.ts","../src/feedback/feedback-contract.ts"],"names":[],"mappings":";;;;AAOA,IAAM,EAAA,GAAK,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAG,CAAA;AAEpC,IAAM,YAAA,GAAe,EAAA,CAAG,KAAA,CAAM,sBAAsB,CAAA;AACpD,IAAM,SAAA,GAAY,EAAE,MAAA,EAAO,CAAE,KAAI,CAAE,WAAA,GAAc,IAAA,EAAK;AACtD,IAAM,UAAA,GAAa,EAAE,MAAA,CAAO,CAAA,CAAE,QAAO,EAAG,CAAA,CAAE,MAAM,CAAA;AAUzC,IAAM,uBAAuB,CAAA,CAAE,IAAA,CAAK,CAAC,SAAA,EAAW,SAAS,CAAC;AAS1D,IAAM,8BAAA,GAAiC,EAAE,IAAA,CAAK,CAAC,cAAc,UAAA,EAAY,SAAA,EAAW,QAAQ,CAAC;AAS7F,IAAM,gCAAA,GAAmC,EAAE,IAAA,CAAK,CAAC,WAAW,SAAA,EAAW,MAAA,EAAQ,UAAA,EAAY,QAAQ,CAAC;AAUpG,IAAM,2BAAA,GAA8B,EAAE,YAAA,CAAa;AAAA,EACxD,EAAA;AAAA,EACA,MAAA,EAAQ,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAG,CA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MAAM,EAAE,MAAA,EAAQ,OAAO,IAAA,EAAM,wCAAA,EAA0C,WAAA,EAAa,4BAAA,EAA8B,OAAA,EAAS,0BAAA,EAA4B,MAAM,CAAC,UAAU,CAAA,EAAG,CAAA,CACnL,KAAA,CAAM,yBAAyB,CAAA,CAC/B,MAAA,CAAO,eAAA,CAAgB,4BAA4B,CAAC,CAAA;AAAA,IACvD,kBAAA,EAAoB,MAAM,EAAE,MAAA,EAAQ,QAAQ,IAAA,EAAM,iCAAA,EAAmC,WAAA,EAAa,qCAAA,EAAuC,OAAA,EAAS,6BAAA,EAA+B,MAAM,CAAC,UAAU,CAAA,EAAG,CAAA,CAClM,KAAA,CAAM,2BAA2B,CAAA,CACjC,MAAA,CAAO,eAAA,CAAgB,oBAAoB,CAAC;AAAA,GACjD;AAAA,EACA,WAAA,EAAa;AAAA,IACX,MAAA,EAAQ,MAAM,EAAE,MAAA,EAAQ,QAAQ,IAAA,EAAM,mDAAA,EAAqD,WAAA,EAAa,6BAAA,EAA+B,OAAA,EAAS,4BAAA,EAA8B,MAAM,CAAC,UAAU,CAAA,EAAG,CAAA,CAC/L,KAAA,CAAM,yBAAyB,CAAA,CAC/B,MAAA,CAAO,eAAA,CAAgB,wBAAwB,CAAC,CAAA;AAAA,IACnD,GAAA,EAAK,MAAM,EAAE,MAAA,EAAQ,OAAO,IAAA,EAAM,mDAAA,EAAqD,WAAA,EAAa,0BAAA,EAA4B,OAAA,EAAS,0BAAA,EAA4B,MAAM,CAAC,UAAU,CAAA,EAAG,CAAA,CACtL,KAAA,CAAM,6BAA6B,CAAA,CACnC,MAAA,CAAO,eAAA,CAAgB,4BAA4B,CAAC;AAAA;AAE3D","file":"chunk-OQG36ECJ.js","sourcesContent":["/**\n * @h-ai/api-contract — 反馈的跨端数据契约。\n * 身份、租户、存储 key 和通知收件人只由可信服务端确定,不接受客户端覆盖。\n */\nimport { z } from 'zod'\nimport { PaginationQuerySchema } from '../common/pagination-schemas.js'\n\nconst id = z.string().min(1).max(128)\n// 附件标识须可无损编码为 Unicode;正常代理对(如 emoji)不受限。\nconst attachmentId = id.regex(/^[^\\uD800-\\uDFFF]*$/u)\nconst timestamp = z.number().int().nonnegative().safe()\nconst jsonObject = z.record(z.string(), z.json())\n\n/**\n * 反馈处理状态。\n * @example\n * ```ts\n * import { FeedbackStatusSchema } from '@h-ai/api-contract'\n * FeedbackStatusSchema.parse('pending')\n * ```\n */\nexport const FeedbackStatusSchema = z.enum(['pending', 'handled'])\n/**\n * 材料状态。\n * @example\n * ```ts\n * import { FeedbackCollectionStatusSchema } from '@h-ai/api-contract'\n * FeedbackCollectionStatusSchema.parse('collecting')\n * ```\n */\nexport const FeedbackCollectionStatusSchema = z.enum(['collecting', 'complete', 'partial', 'failed'])\n/**\n * 通知状态,sent 仅表示邮件服务受理。\n * @example\n * ```ts\n * import { FeedbackNotificationStatusSchema } from '@h-ai/api-contract'\n * FeedbackNotificationStatusSchema.parse('pending')\n * ```\n */\nexport const FeedbackNotificationStatusSchema = z.enum(['pending', 'sending', 'sent', 'deferred', 'failed'])\n\n/**\n * 单条有界、JSON 可序列化的诊断证据。\n * @example\n * ```ts\n * import { FeedbackEvidenceInputSchema } from '@h-ai/api-contract'\n * FeedbackEvidenceInputSchema.parse({ id: 'event-1', source: 'browser', sequence: 1, kind: 'log', timestamp: 1, data: { message: 'Failed' } })\n * ```\n */\nexport const FeedbackEvidenceInputSchema = z.strictObject({\n id,\n source: z.string().min(1).max(128),\n sequence: z.number().int().nonnegative().safe(),\n kind: z.enum(['log', 'error', 'request', 'interaction', 'environment', 'snapshot', 'replay', 'business', 'missing']),\n timestamp,\n requestId: id.optional(),\n errorId: id.optional(),\n data: jsonObject,\n missingReason: z.string().max(2000).optional(),\n})\n/**\n * 已保存证据及所属修订。\n * @example\n * ```ts\n * import { FeedbackEvidenceSchema } from '@h-ai/api-contract'\n * FeedbackEvidenceSchema.parse({ id: 'event-1', feedbackId: 'report-1', revision: 1, source: 'browser', sequence: 1, kind: 'log', timestamp: 1, data: {} })\n * ```\n */\nexport const FeedbackEvidenceSchema = FeedbackEvidenceInputSchema.extend({ feedbackId: id, revision: z.number().int().min(1) })\n\n/**\n * 附件声明,不含可指定的 S3 key。\n * @example\n * ```ts\n * import { FeedbackAttachmentInputSchema } from '@h-ai/api-contract'\n * FeedbackAttachmentInputSchema.parse({ id: 'image-1', name: 'screen.png', contentType: 'image/png', size: 4, checksum: '0'.repeat(64) })\n * ```\n */\nexport const FeedbackAttachmentInputSchema = z.strictObject({\n id: attachmentId,\n name: z.string().min(1).max(255),\n contentType: z.string().min(1).max(128),\n size: z.number().int().min(0).max(5 * 1024 * 1024),\n checksum: z.string().regex(/^[a-f0-9]{64}$/),\n})\n/**\n * 附件的受权元数据。\n * @example\n * ```ts\n * import { FeedbackAttachmentSchema } from '@h-ai/api-contract'\n * FeedbackAttachmentSchema.parse({ id: 'image-1', feedbackId: 'report-1', name: 'screen.png', contentType: 'image/png', size: 4, checksum: '0'.repeat(64), status: 'pending' })\n * ```\n */\nexport const FeedbackAttachmentSchema = FeedbackAttachmentInputSchema.extend({\n feedbackId: id,\n status: z.enum(['pending', 'available', 'failed']),\n missingReason: z.string().max(2000).optional(),\n})\n\n/**\n * 幂等反馈提交;所有补充输入均可选。\n * @example\n * ```ts\n * import { FeedbackSubmitInputSchema } from '@h-ai/api-contract'\n * FeedbackSubmitInputSchema.parse({ submissionId: 'submit-1', appId: 'orders' })\n * ```\n */\nexport const FeedbackSubmitInputSchema = z.strictObject({\n submissionId: id,\n appId: id,\n description: z.string().max(10000).optional(),\n category: z.string().max(64).optional(),\n contact: z.string().max(320).optional(),\n url: z.string().max(2048).optional(),\n appVersion: z.string().max(128).optional(),\n buildId: z.string().max(128).optional(),\n commit: z.string().max(128).optional(),\n anchor: z.strictObject({ kind: z.enum(['error', 'feedback']), timestamp, errorId: id.optional() }).optional(),\n evidence: z.array(FeedbackEvidenceInputSchema).max(1000).optional(),\n attachments: z.array(FeedbackAttachmentInputSchema).max(20).optional(),\n})\n\n/**\n * 反馈摘要,应用版本与乐观锁 version 分开。\n * @example\n * ```ts\n * import { FeedbackReportSchema } from '@h-ai/api-contract'\n * FeedbackReportSchema.parse({ id: 'report-1', number: 'FB-1', appId: 'orders', scopeId: 'tenant-1', userId: 'user-1', status: 'pending', collectionStatus: 'collecting', notificationStatus: 'pending', createdAt: 1, updatedAt: 1, version: 1, evidenceRevision: 1 })\n * ```\n */\nexport const FeedbackReportSchema = z.object({\n id,\n number: z.string(),\n appId: id,\n scopeId: id,\n userId: id,\n status: FeedbackStatusSchema,\n collectionStatus: FeedbackCollectionStatusSchema,\n notificationStatus: FeedbackNotificationStatusSchema,\n description: z.string().optional(),\n summary: z.string().optional(),\n category: z.string().optional(),\n contact: z.string().optional(),\n url: z.string().optional(),\n appVersion: z.string().optional(),\n buildId: z.string().optional(),\n commit: z.string().optional(),\n createdAt: timestamp,\n updatedAt: timestamp,\n version: z.number().int().min(1),\n evidenceRevision: z.number().int().min(1),\n})\n\n/**\n * 列表筛选和受限分页。\n * @example\n * ```ts\n * import { FeedbackListInputSchema } from '@h-ai/api-contract'\n * FeedbackListInputSchema.parse({ page: 1, pageSize: 20 })\n * ```\n */\nexport const FeedbackListInputSchema = PaginationQuerySchema.extend({\n sortDirection: z.enum(['asc', 'desc']).optional(),\n status: FeedbackStatusSchema.optional(),\n collectionStatus: FeedbackCollectionStatusSchema.optional(),\n notificationStatus: FeedbackNotificationStatusSchema.optional(),\n appId: id.optional(),\n appVersion: z.string().max(128).optional(),\n search: z.string().max(200).optional(),\n from: z.coerce.number().int().nonnegative().safe().optional(),\n to: z.coerce.number().int().nonnegative().safe().optional(),\n}).strict()\n/**\n * 受权记录定位。\n * @example\n * ```ts\n * import { FeedbackIdInputSchema } from '@h-ai/api-contract'\n * FeedbackIdInputSchema.parse({ id: 'report-1' })\n * ```\n */\nexport const FeedbackIdInputSchema = z.strictObject({ id })\n/**\n * 证据索引查询。\n * @example\n * ```ts\n * import { FeedbackEvidenceQuerySchema } from '@h-ai/api-contract'\n * FeedbackEvidenceQuerySchema.parse({ id: 'report-1', pageSize: 20 })\n * ```\n */\nexport const FeedbackEvidenceQuerySchema = PaginationQuerySchema.extend({\n id,\n source: z.string().max(128).optional(),\n kind: FeedbackEvidenceInputSchema.shape.kind.optional(),\n requestId: id.optional(),\n errorId: id.optional(),\n from: z.coerce.number().int().nonnegative().safe().optional(),\n to: z.coerce.number().int().nonnegative().safe().optional(),\n}).strict()\n/**\n * 状态更新必须携带已读版本。\n * @example\n * ```ts\n * import { FeedbackSetStatusInputSchema } from '@h-ai/api-contract'\n * FeedbackSetStatusInputSchema.parse({ id: 'report-1', status: 'handled', expectedVersion: 1 })\n * ```\n */\nexport const FeedbackSetStatusInputSchema = z.strictObject({ id, status: FeedbackStatusSchema, expectedVersion: z.number().int().min(1), note: z.string().max(10000).optional() })\n/**\n * 提交后补采分块,服务端按来源序号幂等确认。\n * @example\n * ```ts\n * import { FeedbackAppendEvidenceInputSchema } from '@h-ai/api-contract'\n * FeedbackAppendEvidenceInputSchema.parse({ id: 'report-1', evidence: [] })\n * ```\n */\nexport const FeedbackAppendEvidenceInputSchema = z.strictObject({ id, evidence: z.array(FeedbackEvidenceInputSchema).max(1000) })\n/**\n * 已可靠入库的证据确认。\n * @example\n * ```ts\n * import { FeedbackEvidenceAckSchema } from '@h-ai/api-contract'\n * FeedbackEvidenceAckSchema.parse({ acknowledged: ['event-1'], evidenceRevision: 1 })\n * ```\n */\nexport const FeedbackEvidenceAckSchema = z.object({ acknowledged: z.array(id), evidenceRevision: z.number().int().min(1) })\n/**\n * 采集结束或部分缺失。\n * @example\n * ```ts\n * import { FeedbackCompleteInputSchema } from '@h-ai/api-contract'\n * FeedbackCompleteInputSchema.parse({ id: 'report-1', missing: [] })\n * ```\n */\nexport const FeedbackCompleteInputSchema = z.strictObject({ id, missing: z.array(z.string().max(2000)).max(100).optional() })\n/**\n * 按任务类别重试。\n * @example\n * ```ts\n * import { FeedbackRetryInputSchema } from '@h-ai/api-contract'\n * FeedbackRetryInputSchema.parse({ id: 'report-1', target: 'notify' })\n * ```\n */\nexport const FeedbackRetryInputSchema = z.strictObject({ id, target: z.enum(['collect', 'notify', 'export', 'attachment']), targetId: z.string().max(128).optional() })\n/**\n * 固定证据修订的导出请求。\n * @example\n * ```ts\n * import { FeedbackExportInputSchema } from '@h-ai/api-contract'\n * FeedbackExportInputSchema.parse({ id: 'report-1' })\n * ```\n */\nexport const FeedbackExportInputSchema = z.strictObject({ id, evidenceRevision: z.number().int().min(1).optional() })\n/**\n * 已生成问题包的受权下载定位。\n * @example\n * ```ts\n * import { FeedbackExportQuerySchema } from '@h-ai/api-contract'\n * FeedbackExportQuerySchema.parse({ id: 'report-1', jobId: 'job-1' })\n * ```\n */\nexport const FeedbackExportQuerySchema = z.strictObject({ id, jobId: id })\n\n/**\n * 后台任务的安全状态,不暴露邮件正文、租约和存储 key。\n * @example\n * ```ts\n * import { FeedbackJobSchema } from '@h-ai/api-contract'\n * FeedbackJobSchema.parse({ id: 'job-1', feedbackId: 'report-1', type: 'export', status: 'pending', attempts: 0, createdAt: 1, updatedAt: 1 })\n * ```\n */\nexport const FeedbackJobSchema = z.object({\n id,\n feedbackId: id,\n type: z.enum(['collect', 'notify', 'export', 'cleanup']),\n status: z.enum(['pending', 'running', 'succeeded', 'failed']),\n attempts: z.number().int().nonnegative(),\n createdAt: timestamp,\n updatedAt: timestamp,\n nextRunAt: timestamp.optional(),\n lastError: z.string().optional(),\n result: jsonObject.optional(),\n})\n/**\n * 处理变更历史。\n * @example\n * ```ts\n * import { FeedbackHistorySchema } from '@h-ai/api-contract'\n * FeedbackHistorySchema.parse({ id: 'history-1', feedbackId: 'report-1', userId: 'user-1', from: 'pending', to: 'handled', timestamp: 1 })\n * ```\n */\nexport const FeedbackHistorySchema = z.object({ id, feedbackId: id, userId: id, from: FeedbackStatusSchema, to: FeedbackStatusSchema, timestamp, note: z.string().optional() })\n/**\n * 详情按需加载,完整日志通过单独分页接口查询。\n * @example\n * ```ts\n * import type { FeedbackDetail } from '@h-ai/api-contract'\n * function numberOfAttachments(detail: FeedbackDetail) { return detail.attachments.length }\n * ```\n */\nexport const FeedbackDetailSchema = z.object({ report: FeedbackReportSchema, attachments: z.array(FeedbackAttachmentSchema), history: z.array(FeedbackHistorySchema), jobs: z.array(FeedbackJobSchema) })\n/**\n * 有界附件上传,解码前后均须检查长度和 checksum。\n * @example\n * ```ts\n * import { FeedbackUploadInputSchema } from '@h-ai/api-contract'\n * FeedbackUploadInputSchema.parse({ id: 'report-1', attachmentId: 'image-1', dataBase64: 'iVBORw==' })\n * ```\n */\nexport const FeedbackUploadInputSchema = z.strictObject({ id, attachmentId, dataBase64: z.string().max(4 * Math.ceil(5 * 1024 * 1024 / 3)).refine(value => value.length % 4 === 0 && /^[A-Z0-9+/]*={0,2}$/i.test(value)) })\n/**\n * 附件受权读取定位。\n * @example\n * ```ts\n * import { FeedbackAttachmentQuerySchema } from '@h-ai/api-contract'\n * FeedbackAttachmentQuerySchema.parse({ id: 'report-1', attachmentId: 'image-1' })\n * ```\n */\nexport const FeedbackAttachmentQuerySchema = z.strictObject({ id, attachmentId })\n/**\n * 受权附件内容,不暴露 S3 凭据或公网链接。\n * @example\n * ```ts\n * import { FeedbackAttachmentDataSchema } from '@h-ai/api-contract'\n * FeedbackAttachmentDataSchema.parse({ name: 'screen.png', contentType: 'image/png', dataBase64: 'iVBORw==' })\n * ```\n */\nexport const FeedbackAttachmentDataSchema = z.object({ name: z.string(), contentType: z.string(), dataBase64: z.string() })\n\n/**\n * FeedbackStatus 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackStatus } from '@h-ai/api-contract'\n * const value: FeedbackStatus = 'pending'\n * ```\n */\nexport type FeedbackStatus = z.infer<typeof FeedbackStatusSchema>\n/**\n * FeedbackCollectionStatus 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackCollectionStatus } from '@h-ai/api-contract'\n * const value: FeedbackCollectionStatus = 'collecting'\n * ```\n */\nexport type FeedbackCollectionStatus = z.infer<typeof FeedbackCollectionStatusSchema>\n/**\n * FeedbackNotificationStatus 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackNotificationStatus } from '@h-ai/api-contract'\n * const value: FeedbackNotificationStatus = 'pending'\n * ```\n */\nexport type FeedbackNotificationStatus = z.infer<typeof FeedbackNotificationStatusSchema>\n/**\n * FeedbackEvidenceInput 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackEvidenceInput } from '@h-ai/api-contract'\n * function inspect(value: FeedbackEvidenceInput) { return value.id }\n * ```\n */\nexport type FeedbackEvidenceInput = z.infer<typeof FeedbackEvidenceInputSchema>\n/**\n * FeedbackEvidence 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackEvidence } from '@h-ai/api-contract'\n * function inspect(value: FeedbackEvidence) { return value.id }\n * ```\n */\nexport type FeedbackEvidence = z.infer<typeof FeedbackEvidenceSchema>\n/**\n * FeedbackAttachmentInput 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackAttachmentInput } from '@h-ai/api-contract'\n * function inspect(value: FeedbackAttachmentInput) { return value.id }\n * ```\n */\nexport type FeedbackAttachmentInput = z.infer<typeof FeedbackAttachmentInputSchema>\n/**\n * FeedbackAttachment 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackAttachment } from '@h-ai/api-contract'\n * function inspect(value: FeedbackAttachment) { return value.id }\n * ```\n */\nexport type FeedbackAttachment = z.infer<typeof FeedbackAttachmentSchema>\n/**\n * FeedbackSubmitInput 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackSubmitInput } from '@h-ai/api-contract'\n * function inspect(value: FeedbackSubmitInput) { return value.submissionId }\n * ```\n */\nexport type FeedbackSubmitInput = z.infer<typeof FeedbackSubmitInputSchema>\n/**\n * FeedbackReport 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackReport } from '@h-ai/api-contract'\n * function inspect(value: FeedbackReport) { return value.id }\n * ```\n */\nexport type FeedbackReport = z.infer<typeof FeedbackReportSchema>\n/**\n * FeedbackListInput 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackListInput } from '@h-ai/api-contract'\n * function inspect(value: FeedbackListInput) { return value.pageSize }\n * ```\n */\nexport type FeedbackListInput = z.infer<typeof FeedbackListInputSchema>\n/**\n * FeedbackEvidenceQuery 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackEvidenceQuery } from '@h-ai/api-contract'\n * function inspect(value: FeedbackEvidenceQuery) { return value.id }\n * ```\n */\nexport type FeedbackEvidenceQuery = z.infer<typeof FeedbackEvidenceQuerySchema>\n/**\n * FeedbackSetStatusInput 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackSetStatusInput } from '@h-ai/api-contract'\n * function inspect(value: FeedbackSetStatusInput) { return value.id }\n * ```\n */\nexport type FeedbackSetStatusInput = z.infer<typeof FeedbackSetStatusInputSchema>\n/**\n * FeedbackAppendEvidenceInput 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackAppendEvidenceInput } from '@h-ai/api-contract'\n * function inspect(value: FeedbackAppendEvidenceInput) { return value.id }\n * ```\n */\nexport type FeedbackAppendEvidenceInput = z.infer<typeof FeedbackAppendEvidenceInputSchema>\n/**\n * FeedbackEvidenceAck 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackEvidenceAck } from '@h-ai/api-contract'\n * function inspect(value: FeedbackEvidenceAck) { return value.acknowledged.length }\n * ```\n */\nexport type FeedbackEvidenceAck = z.infer<typeof FeedbackEvidenceAckSchema>\n/**\n * FeedbackCompleteInput 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackCompleteInput } from '@h-ai/api-contract'\n * function inspect(value: FeedbackCompleteInput) { return value.id }\n * ```\n */\nexport type FeedbackCompleteInput = z.infer<typeof FeedbackCompleteInputSchema>\n/**\n * FeedbackRetryInput 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackRetryInput } from '@h-ai/api-contract'\n * function inspect(value: FeedbackRetryInput) { return value.id }\n * ```\n */\nexport type FeedbackRetryInput = z.infer<typeof FeedbackRetryInputSchema>\n/**\n * FeedbackExportInput 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackExportInput } from '@h-ai/api-contract'\n * function inspect(value: FeedbackExportInput) { return value.id }\n * ```\n */\nexport type FeedbackExportInput = z.infer<typeof FeedbackExportInputSchema>\n/**\n * FeedbackJob 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackJob } from '@h-ai/api-contract'\n * function inspect(value: FeedbackJob) { return value.id }\n * ```\n */\nexport type FeedbackJob = z.infer<typeof FeedbackJobSchema>\n/**\n * FeedbackHistory 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackHistory } from '@h-ai/api-contract'\n * function inspect(value: FeedbackHistory) { return value.id }\n * ```\n */\nexport type FeedbackHistory = z.infer<typeof FeedbackHistorySchema>\n/**\n * FeedbackDetail 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackDetail } from '@h-ai/api-contract'\n * function inspect(value: FeedbackDetail) { return value.report.number }\n * ```\n */\nexport type FeedbackDetail = z.infer<typeof FeedbackDetailSchema>\n/**\n * FeedbackUploadInput 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackUploadInput } from '@h-ai/api-contract'\n * function inspect(value: FeedbackUploadInput) { return value.id }\n * ```\n */\nexport type FeedbackUploadInput = z.infer<typeof FeedbackUploadInputSchema>\n/**\n * FeedbackAttachmentData 的共享类型,由对应 schema 推导。\n * @example\n * ```ts\n * import type { FeedbackAttachmentData } from '@h-ai/api-contract'\n * function inspect(value: FeedbackAttachmentData) { return value.contentType }\n * ```\n */\nexport type FeedbackAttachmentData = z.infer<typeof FeedbackAttachmentDataSchema>\n","/** @h-ai/api-contract — 反馈的受权 HTTP 契约。 */\nimport { paginatedSchema } from '../common/pagination-schemas.js'\nimport { haiResultSchema, HaiVoidResultSchema } from '../common/result-schemas.js'\nimport { route } from '../common/route.js'\nimport {\n FeedbackAppendEvidenceInputSchema,\n FeedbackAttachmentDataSchema,\n FeedbackAttachmentQuerySchema,\n FeedbackAttachmentSchema,\n FeedbackCompleteInputSchema,\n FeedbackDetailSchema,\n FeedbackEvidenceAckSchema,\n FeedbackEvidenceQuerySchema,\n FeedbackEvidenceSchema,\n FeedbackExportInputSchema,\n FeedbackExportQuerySchema,\n FeedbackIdInputSchema,\n FeedbackJobSchema,\n FeedbackListInputSchema,\n FeedbackReportSchema,\n FeedbackRetryInputSchema,\n FeedbackSetStatusInputSchema,\n FeedbackSubmitInputSchema,\n FeedbackUploadInputSchema,\n} from './feedback-schemas.js'\n\n/**\n * 反馈契约,宿主自行决定是否挂载。\n * @example\n * ```ts\n * import { apiContract } from '@h-ai/api-contract'\n * const contract = apiContract.create({ feedback: apiContract.feedback })\n * const path = apiContract.pathOf(contract.feedback.reports.submit)\n * ```\n */\nexport const feedbackContract = {\n reports: {\n submit: route({ method: 'POST', path: '/feedback/reports', operationId: 'feedback.reports.submit', summary: 'submit feedback', tags: ['feedback'] })\n .input(FeedbackSubmitInputSchema)\n .output(haiResultSchema(FeedbackReportSchema)),\n list: route({ method: 'GET', path: '/feedback/reports', operationId: 'feedback.reports.list', summary: 'list feedback', tags: ['feedback'] })\n .input(FeedbackListInputSchema)\n .output(haiResultSchema(paginatedSchema(FeedbackReportSchema))),\n get: route({ method: 'GET', path: '/feedback/reports/{id}', operationId: 'feedback.reports.get', summary: 'get feedback', tags: ['feedback'] })\n .input(FeedbackIdInputSchema)\n .output(haiResultSchema(FeedbackDetailSchema)),\n getEvidence: route({ method: 'GET', path: '/feedback/reports/{id}/evidence', operationId: 'feedback.reports.getEvidence', summary: 'getEvidence feedback', tags: ['feedback'] })\n .input(FeedbackEvidenceQuerySchema)\n .output(haiResultSchema(paginatedSchema(FeedbackEvidenceSchema))),\n setStatus: route({ method: 'PATCH', path: '/feedback/reports/{id}/status', operationId: 'feedback.reports.setStatus', summary: 'setStatus feedback', tags: ['feedback'] })\n .input(FeedbackSetStatusInputSchema)\n .output(haiResultSchema(FeedbackReportSchema)),\n retry: route({ method: 'POST', path: '/feedback/reports/{id}/retry', operationId: 'feedback.reports.retry', summary: 'retry feedback', tags: ['feedback'] })\n .input(FeedbackRetryInputSchema)\n .output(HaiVoidResultSchema),\n export: route({ method: 'POST', path: '/feedback/reports/{id}/exports', operationId: 'feedback.reports.export', summary: 'export feedback', tags: ['feedback'] })\n .input(FeedbackExportInputSchema)\n .output(haiResultSchema(FeedbackJobSchema)),\n appendEvidence: route({ method: 'POST', path: '/feedback/reports/{id}/evidence', operationId: 'feedback.reports.appendEvidence', summary: 'appendEvidence feedback', tags: ['feedback'] })\n .input(FeedbackAppendEvidenceInputSchema)\n .output(haiResultSchema(FeedbackEvidenceAckSchema)),\n getExport: route({ method: 'GET', path: '/feedback/reports/{id}/exports/{jobId}', operationId: 'feedback.reports.getExport', summary: 'Download feedback export', tags: ['feedback'] })\n .input(FeedbackExportQuerySchema)\n .output(haiResultSchema(FeedbackAttachmentDataSchema)),\n completeCollection: route({ method: 'POST', path: '/feedback/reports/{id}/complete', operationId: 'feedback.reports.completeCollection', summary: 'completeCollection feedback', tags: ['feedback'] })\n .input(FeedbackCompleteInputSchema)\n .output(haiResultSchema(FeedbackReportSchema)),\n },\n attachments: {\n upload: route({ method: 'POST', path: '/feedback/reports/{id}/attachments/{attachmentId}', operationId: 'feedback.attachments.upload', summary: 'Upload feedback attachment', tags: ['feedback'] })\n .input(FeedbackUploadInputSchema)\n .output(haiResultSchema(FeedbackAttachmentSchema)),\n get: route({ method: 'GET', path: '/feedback/reports/{id}/attachments/{attachmentId}', operationId: 'feedback.attachments.get', summary: 'Read feedback attachment', tags: ['feedback'] })\n .input(FeedbackAttachmentQuerySchema)\n .output(haiResultSchema(FeedbackAttachmentDataSchema)),\n },\n}\n\n/**\n * 反馈 typed client 的契约类型。\n * @example\n * ```ts\n * import type { FeedbackContract } from '@h-ai/api-contract'\n * import { apiContract } from '@h-ai/api-contract'\n * const contract: FeedbackContract = apiContract.feedback\n * ```\n */\nexport type FeedbackContract = typeof feedbackContract\n"]}