@dofe/infra-contracts-base 0.1.42
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/dist/base.d.ts +243 -0
- package/dist/base.d.ts.map +1 -0
- package/dist/base.js +209 -0
- package/dist/base.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/package.json +39 -0
package/dist/base.d.ts
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AppRouter } from '@ts-rest/core';
|
|
3
|
+
/**
|
|
4
|
+
* Base API Response Schema
|
|
5
|
+
* Matches the existing { code, msg, data } format used in the backend
|
|
6
|
+
*/
|
|
7
|
+
export declare const HTTP_CODE: {
|
|
8
|
+
readonly SUCCESS: 0;
|
|
9
|
+
readonly ERROR: -1;
|
|
10
|
+
readonly UNAUTHORIZED: 401;
|
|
11
|
+
readonly FORBIDDEN: 403;
|
|
12
|
+
readonly NOT_FOUND: 404;
|
|
13
|
+
readonly VALIDATION_ERROR: 422;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Empty query schema for GET endpoints without query parameters
|
|
17
|
+
* Used by ts-rest to validate that no unexpected query params are passed
|
|
18
|
+
*/
|
|
19
|
+
export declare const EmptyQuerySchema: z.ZodObject<{}, z.core.$strip>;
|
|
20
|
+
/**
|
|
21
|
+
* API 版本号常量(从 @repo/constants 复制,避免循环依赖)
|
|
22
|
+
*/
|
|
23
|
+
export declare const API_VERSION: {
|
|
24
|
+
readonly V1: "1";
|
|
25
|
+
readonly V2: "2";
|
|
26
|
+
};
|
|
27
|
+
export type ApiVersion = (typeof API_VERSION)[keyof typeof API_VERSION];
|
|
28
|
+
export declare const API_VERSION_HEADER: "x-api-version";
|
|
29
|
+
export declare const API_VERSION_DEFAULT: "1";
|
|
30
|
+
/**
|
|
31
|
+
* Contract 元数据 Symbol
|
|
32
|
+
* 用于在 contract 上附加版本信息
|
|
33
|
+
*/
|
|
34
|
+
export declare const CONTRACT_METADATA: unique symbol;
|
|
35
|
+
/**
|
|
36
|
+
* Contract 元数据接口
|
|
37
|
+
*/
|
|
38
|
+
export interface ContractMetadata {
|
|
39
|
+
/** API 版本号 */
|
|
40
|
+
version: ApiVersion;
|
|
41
|
+
/** 路由前缀 */
|
|
42
|
+
pathPrefix: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 带版本元数据的 Contract 类型
|
|
46
|
+
*/
|
|
47
|
+
export type VersionedContract<T extends AppRouter> = T & {
|
|
48
|
+
[CONTRACT_METADATA]: ContractMetadata;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* 创建带版本的 Contract
|
|
52
|
+
*
|
|
53
|
+
* @param contract - ts-rest contract router
|
|
54
|
+
* @param metadata - 版本和路径元数据
|
|
55
|
+
* @returns 带元数据的 contract
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const c = initContract();
|
|
60
|
+
* export const signContract = withVersion(
|
|
61
|
+
* c.router({ ... }, { pathPrefix: '/sign' }),
|
|
62
|
+
* { version: API_VERSION.V1, pathPrefix: '/sign' }
|
|
63
|
+
* );
|
|
64
|
+
*
|
|
65
|
+
* // 读取版本
|
|
66
|
+
* const version = getContractVersion(signContract); // '1'
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare function withVersion<T extends AppRouter>(contract: T, metadata: ContractMetadata): VersionedContract<T>;
|
|
70
|
+
/**
|
|
71
|
+
* 从 Contract 获取版本号
|
|
72
|
+
*
|
|
73
|
+
* @param contract - ts-rest contract
|
|
74
|
+
* @returns 版本号,如果未设置则返回默认版本
|
|
75
|
+
*/
|
|
76
|
+
export declare function getContractVersion(contract: unknown): ApiVersion;
|
|
77
|
+
/**
|
|
78
|
+
* 从 Contract 获取完整元数据
|
|
79
|
+
*
|
|
80
|
+
* @param contract - ts-rest contract
|
|
81
|
+
* @returns 元数据对象,如果未设置则返回 undefined
|
|
82
|
+
*/
|
|
83
|
+
export declare function getContractMetadata(contract: unknown): ContractMetadata | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* 检查 Contract 是否有版本元数据
|
|
86
|
+
*/
|
|
87
|
+
export declare function hasContractVersion(contract: unknown): boolean;
|
|
88
|
+
export declare const ApiResponseSchema: <T extends z.ZodTypeAny>(dataSchema: T) => z.ZodObject<{
|
|
89
|
+
code: z.ZodNumber;
|
|
90
|
+
msg: z.ZodString;
|
|
91
|
+
data: T;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
export declare const RestResponseSchema: <T extends z.ZodTypeAny>(dataSchema: T) => z.ZodObject<{
|
|
94
|
+
rest: z.ZodBoolean;
|
|
95
|
+
data: T;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
|
+
/**
|
|
98
|
+
* Helper function to create API response schema
|
|
99
|
+
* Wraps any data schema in the standard { code, msg, data } format
|
|
100
|
+
* Alias for ApiResponseSchema for more intuitive usage in contracts
|
|
101
|
+
*
|
|
102
|
+
* 配合 response.helper.ts 中的 success(), created(), deleted() 等函数使用
|
|
103
|
+
*/
|
|
104
|
+
export declare const createApiResponse: <T extends z.ZodTypeAny>(dataSchema: T) => z.ZodObject<{
|
|
105
|
+
code: z.ZodNumber;
|
|
106
|
+
msg: z.ZodString;
|
|
107
|
+
data: T;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
export type ApiResponse<T> = {
|
|
110
|
+
code: number;
|
|
111
|
+
msg: string;
|
|
112
|
+
data: T;
|
|
113
|
+
};
|
|
114
|
+
export declare const PaginationQuerySchema: z.ZodObject<{
|
|
115
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
116
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
117
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
118
|
+
asc: z.ZodOptional<z.ZodEnum<{
|
|
119
|
+
asc: "asc";
|
|
120
|
+
desc: "desc";
|
|
121
|
+
}>>;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
export type PaginationQuery = z.infer<typeof PaginationQuerySchema>;
|
|
124
|
+
/**
|
|
125
|
+
* Base paginated response schema with generic item type
|
|
126
|
+
* Returns { list, total, page, limit } for all list endpoints
|
|
127
|
+
*
|
|
128
|
+
* @template T - The Zod schema for list items
|
|
129
|
+
* @example
|
|
130
|
+
* const UserListResponseSchema = PaginatedResponseSchema(UserSchema);
|
|
131
|
+
* // Results in: { list: User[], total: number, page: number, limit: number }
|
|
132
|
+
*/
|
|
133
|
+
export declare const PaginatedResponseSchema: <T extends z.ZodTypeAny>(itemSchema: T) => z.ZodObject<{
|
|
134
|
+
list: z.ZodArray<T>;
|
|
135
|
+
total: z.ZodNumber;
|
|
136
|
+
page: z.ZodNumber;
|
|
137
|
+
limit: z.ZodNumber;
|
|
138
|
+
}, z.core.$strip>;
|
|
139
|
+
/**
|
|
140
|
+
* Extended paginated response schema with optional metadata fields
|
|
141
|
+
* Includes additional fields like totalSize, permission, role, nowTime
|
|
142
|
+
* 用于替代 DoFeApp.PageResponseData,保持 zod-first 的设计
|
|
143
|
+
*
|
|
144
|
+
* @template T - The Zod schema for list items
|
|
145
|
+
* @example
|
|
146
|
+
* const SpaceListResponseSchema = ExtendedPaginatedResponseSchema(SpaceSchema);
|
|
147
|
+
* // Results in: { list: Space[], total: number, page: number, limit: number, totalSize?: number, ... }
|
|
148
|
+
*/
|
|
149
|
+
export declare const ExtendedPaginatedResponseSchema: <T extends z.ZodTypeAny>(itemSchema: T) => z.ZodObject<{
|
|
150
|
+
list: z.ZodArray<T>;
|
|
151
|
+
total: z.ZodNumber;
|
|
152
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
153
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
154
|
+
totalSize: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
permission: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
156
|
+
role: z.ZodOptional<z.ZodString>;
|
|
157
|
+
nowTime: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
158
|
+
}, z.core.$strip>;
|
|
159
|
+
/**
|
|
160
|
+
* Generic paginated response type
|
|
161
|
+
* Use this for type-safe paginated API responses
|
|
162
|
+
*
|
|
163
|
+
* @template T - The type of items in the list
|
|
164
|
+
*/
|
|
165
|
+
export type PaginatedResponse<T> = {
|
|
166
|
+
list: T[];
|
|
167
|
+
total: number;
|
|
168
|
+
page: number;
|
|
169
|
+
limit: number;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Extended paginated response type with optional metadata
|
|
173
|
+
* 用于替代 DoFeApp.PageResponseData,提供更丰富的分页信息
|
|
174
|
+
*
|
|
175
|
+
* @template T - The type of items in the list
|
|
176
|
+
*/
|
|
177
|
+
export type ExtendedPaginatedResponse<T> = {
|
|
178
|
+
list: T[];
|
|
179
|
+
total: number;
|
|
180
|
+
page?: number;
|
|
181
|
+
limit?: number;
|
|
182
|
+
/** 总大小(字节),用于文件列表 */
|
|
183
|
+
totalSize?: number;
|
|
184
|
+
/** 权限列表 */
|
|
185
|
+
permission?: string[];
|
|
186
|
+
/** 角色标识 */
|
|
187
|
+
role?: string;
|
|
188
|
+
/** 服务器当前时间 */
|
|
189
|
+
nowTime?: Date;
|
|
190
|
+
};
|
|
191
|
+
export declare const IdSchema: z.ZodString;
|
|
192
|
+
export declare const SuccessResponseSchema: z.ZodObject<{
|
|
193
|
+
success: z.ZodBoolean;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
export type SuccessResponse = z.infer<typeof SuccessResponseSchema>;
|
|
196
|
+
export declare const ErrorResponseSchema: z.ZodObject<{
|
|
197
|
+
code: z.ZodNumber;
|
|
198
|
+
msg: z.ZodString;
|
|
199
|
+
data: z.ZodOptional<z.ZodNull>;
|
|
200
|
+
}, z.core.$strip>;
|
|
201
|
+
export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
|
|
202
|
+
export declare const EnhancedErrorResponseSchema: z.ZodObject<{
|
|
203
|
+
code: z.ZodNumber;
|
|
204
|
+
msg: z.ZodString;
|
|
205
|
+
data: z.ZodNull;
|
|
206
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
207
|
+
errorCode: z.ZodNumber;
|
|
208
|
+
errorType: z.ZodString;
|
|
209
|
+
errorData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
210
|
+
}, z.core.$strip>>;
|
|
211
|
+
}, z.core.$strip>;
|
|
212
|
+
export type EnhancedErrorResponse = z.infer<typeof EnhancedErrorResponseSchema>;
|
|
213
|
+
export declare function createApiContract<TBody extends z.ZodTypeAny | undefined, TQuery extends z.ZodTypeAny | undefined, TParams extends z.ZodTypeAny | undefined, TResponse extends z.ZodTypeAny>(config: {
|
|
214
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
215
|
+
path: string;
|
|
216
|
+
summary?: string;
|
|
217
|
+
body?: TBody;
|
|
218
|
+
query?: TQuery;
|
|
219
|
+
pathParams?: TParams;
|
|
220
|
+
responses: {
|
|
221
|
+
200: TResponse;
|
|
222
|
+
401?: z.ZodTypeAny;
|
|
223
|
+
403?: z.ZodTypeAny;
|
|
224
|
+
404?: z.ZodTypeAny;
|
|
225
|
+
422?: z.ZodTypeAny;
|
|
226
|
+
};
|
|
227
|
+
}): {
|
|
228
|
+
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
229
|
+
path: string;
|
|
230
|
+
summary?: string;
|
|
231
|
+
body?: TBody;
|
|
232
|
+
query?: TQuery;
|
|
233
|
+
pathParams?: TParams;
|
|
234
|
+
responses: {
|
|
235
|
+
200: TResponse;
|
|
236
|
+
401?: z.ZodTypeAny;
|
|
237
|
+
403?: z.ZodTypeAny;
|
|
238
|
+
404?: z.ZodTypeAny;
|
|
239
|
+
422?: z.ZodTypeAny;
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
export { z };
|
|
243
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../packages/contracts-base/src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;;GAGG;AAGH,eAAO,MAAM,SAAS;;;;;;;CAOZ,CAAC;AAMX;;;GAGG;AACH,eAAO,MAAM,gBAAgB,gCAAe,CAAC;AAM7C;;GAEG;AACH,eAAO,MAAM,WAAW;;;CAGd,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAExE,eAAO,MAAM,kBAAkB,EAAG,eAAwB,CAAC;AAC3D,eAAO,MAAM,mBAAmB,KAAiB,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,eAA8B,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,cAAc;IACd,OAAO,EAAE,UAAU,CAAC;IACpB,WAAW;IACX,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,SAAS,IAAI,CAAC,GAAG;IACvD,CAAC,iBAAiB,CAAC,EAAE,gBAAgB,CAAC;CACvC,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,SAAS,EAC7C,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,gBAAgB,GACzB,iBAAiB,CAAC,CAAC,CAAC,CAItB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG,UAAU,CAUhE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC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AE;QACT,GAAG,EAAE,SAAS,CAAC;QACf,GAAG,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC;QACnB,GAAG,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC;QACnB,GAAG,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC;QACnB,GAAG,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC;KACpB,CAAC;CACH;YAbS,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO;UAC7C,MAAM;cACF,MAAM;WACT,KAAK;YACJ,MAAM;iBACD,OAAO;eACT;QACT,GAAG,EAAE,SAAS,CAAC;QACf,GAAG,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC;QACnB,GAAG,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC;QACnB,GAAG,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC;QACnB,GAAG,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC;KACpB;EAGF;AAGD,OAAO,EAAE,CAAC,EAAE,CAAC"}
|
package/dist/base.js
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.z = exports.EnhancedErrorResponseSchema = exports.ErrorResponseSchema = exports.SuccessResponseSchema = exports.IdSchema = exports.ExtendedPaginatedResponseSchema = exports.PaginatedResponseSchema = exports.PaginationQuerySchema = exports.createApiResponse = exports.RestResponseSchema = exports.ApiResponseSchema = exports.CONTRACT_METADATA = exports.API_VERSION_DEFAULT = exports.API_VERSION_HEADER = exports.API_VERSION = exports.EmptyQuerySchema = exports.HTTP_CODE = void 0;
|
|
4
|
+
exports.withVersion = withVersion;
|
|
5
|
+
exports.getContractVersion = getContractVersion;
|
|
6
|
+
exports.getContractMetadata = getContractMetadata;
|
|
7
|
+
exports.hasContractVersion = hasContractVersion;
|
|
8
|
+
exports.createApiContract = createApiContract;
|
|
9
|
+
const zod_1 = require("zod");
|
|
10
|
+
Object.defineProperty(exports, "z", { enumerable: true, get: function () { return zod_1.z; } });
|
|
11
|
+
/**
|
|
12
|
+
* Base API Response Schema
|
|
13
|
+
* Matches the existing { code, msg, data } format used in the backend
|
|
14
|
+
*/
|
|
15
|
+
// HTTP status codes used in the API
|
|
16
|
+
exports.HTTP_CODE = {
|
|
17
|
+
SUCCESS: 0,
|
|
18
|
+
ERROR: -1,
|
|
19
|
+
UNAUTHORIZED: 401,
|
|
20
|
+
FORBIDDEN: 403,
|
|
21
|
+
NOT_FOUND: 404,
|
|
22
|
+
VALIDATION_ERROR: 422,
|
|
23
|
+
};
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// Empty Query Schema - Shared Schema for Endpoints Without Query Parameters
|
|
26
|
+
// ============================================================================
|
|
27
|
+
/**
|
|
28
|
+
* Empty query schema for GET endpoints without query parameters
|
|
29
|
+
* Used by ts-rest to validate that no unexpected query params are passed
|
|
30
|
+
*/
|
|
31
|
+
exports.EmptyQuerySchema = zod_1.z.object({});
|
|
32
|
+
// ============================================================================
|
|
33
|
+
// API Versioning - Contract Metadata
|
|
34
|
+
// ============================================================================
|
|
35
|
+
/**
|
|
36
|
+
* API 版本号常量(从 @repo/constants 复制,避免循环依赖)
|
|
37
|
+
*/
|
|
38
|
+
exports.API_VERSION = {
|
|
39
|
+
V1: '1',
|
|
40
|
+
V2: '2',
|
|
41
|
+
};
|
|
42
|
+
exports.API_VERSION_HEADER = 'x-api-version';
|
|
43
|
+
exports.API_VERSION_DEFAULT = exports.API_VERSION.V1;
|
|
44
|
+
/**
|
|
45
|
+
* Contract 元数据 Symbol
|
|
46
|
+
* 用于在 contract 上附加版本信息
|
|
47
|
+
*/
|
|
48
|
+
exports.CONTRACT_METADATA = Symbol('CONTRACT_METADATA');
|
|
49
|
+
/**
|
|
50
|
+
* 创建带版本的 Contract
|
|
51
|
+
*
|
|
52
|
+
* @param contract - ts-rest contract router
|
|
53
|
+
* @param metadata - 版本和路径元数据
|
|
54
|
+
* @returns 带元数据的 contract
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* const c = initContract();
|
|
59
|
+
* export const signContract = withVersion(
|
|
60
|
+
* c.router({ ... }, { pathPrefix: '/sign' }),
|
|
61
|
+
* { version: API_VERSION.V1, pathPrefix: '/sign' }
|
|
62
|
+
* );
|
|
63
|
+
*
|
|
64
|
+
* // 读取版本
|
|
65
|
+
* const version = getContractVersion(signContract); // '1'
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
function withVersion(contract, metadata) {
|
|
69
|
+
const versionedContract = contract;
|
|
70
|
+
versionedContract[exports.CONTRACT_METADATA] = metadata;
|
|
71
|
+
return versionedContract;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 从 Contract 获取版本号
|
|
75
|
+
*
|
|
76
|
+
* @param contract - ts-rest contract
|
|
77
|
+
* @returns 版本号,如果未设置则返回默认版本
|
|
78
|
+
*/
|
|
79
|
+
function getContractVersion(contract) {
|
|
80
|
+
if (contract &&
|
|
81
|
+
typeof contract === 'object' &&
|
|
82
|
+
exports.CONTRACT_METADATA in contract) {
|
|
83
|
+
return contract[exports.CONTRACT_METADATA]
|
|
84
|
+
.version;
|
|
85
|
+
}
|
|
86
|
+
return exports.API_VERSION_DEFAULT;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* 从 Contract 获取完整元数据
|
|
90
|
+
*
|
|
91
|
+
* @param contract - ts-rest contract
|
|
92
|
+
* @returns 元数据对象,如果未设置则返回 undefined
|
|
93
|
+
*/
|
|
94
|
+
function getContractMetadata(contract) {
|
|
95
|
+
if (contract &&
|
|
96
|
+
typeof contract === 'object' &&
|
|
97
|
+
exports.CONTRACT_METADATA in contract) {
|
|
98
|
+
return contract[exports.CONTRACT_METADATA];
|
|
99
|
+
}
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* 检查 Contract 是否有版本元数据
|
|
104
|
+
*/
|
|
105
|
+
function hasContractVersion(contract) {
|
|
106
|
+
return (contract !== null &&
|
|
107
|
+
typeof contract === 'object' &&
|
|
108
|
+
exports.CONTRACT_METADATA in contract);
|
|
109
|
+
}
|
|
110
|
+
// Base response wrapper schema
|
|
111
|
+
const ApiResponseSchema = (dataSchema) => zod_1.z.object({
|
|
112
|
+
code: zod_1.z.number(),
|
|
113
|
+
msg: zod_1.z.string(),
|
|
114
|
+
data: dataSchema,
|
|
115
|
+
});
|
|
116
|
+
exports.ApiResponseSchema = ApiResponseSchema;
|
|
117
|
+
// Alternative response wrapper schema with rest: true format (used in rbac-api)
|
|
118
|
+
const RestResponseSchema = (dataSchema) => zod_1.z.object({
|
|
119
|
+
rest: zod_1.z.boolean(),
|
|
120
|
+
data: dataSchema,
|
|
121
|
+
});
|
|
122
|
+
exports.RestResponseSchema = RestResponseSchema;
|
|
123
|
+
/**
|
|
124
|
+
* Helper function to create API response schema
|
|
125
|
+
* Wraps any data schema in the standard { code, msg, data } format
|
|
126
|
+
* Alias for ApiResponseSchema for more intuitive usage in contracts
|
|
127
|
+
*
|
|
128
|
+
* 配合 response.helper.ts 中的 success(), created(), deleted() 等函数使用
|
|
129
|
+
*/
|
|
130
|
+
exports.createApiResponse = exports.ApiResponseSchema;
|
|
131
|
+
// Pagination query schema (matches PaginationQueryDto)
|
|
132
|
+
// Note: 'sort' enum values are project-specific, extend in each project if needed
|
|
133
|
+
exports.PaginationQuerySchema = zod_1.z.object({
|
|
134
|
+
limit: zod_1.z.coerce.number().positive().optional().default(20),
|
|
135
|
+
page: zod_1.z.coerce.number().positive().min(1).optional().default(1),
|
|
136
|
+
sort: zod_1.z.string().optional(), // Generic string, projects can refine with .enum([...])
|
|
137
|
+
asc: zod_1.z.enum(['asc', 'desc']).optional(),
|
|
138
|
+
});
|
|
139
|
+
/**
|
|
140
|
+
* Base paginated response schema with generic item type
|
|
141
|
+
* Returns { list, total, page, limit } for all list endpoints
|
|
142
|
+
*
|
|
143
|
+
* @template T - The Zod schema for list items
|
|
144
|
+
* @example
|
|
145
|
+
* const UserListResponseSchema = PaginatedResponseSchema(UserSchema);
|
|
146
|
+
* // Results in: { list: User[], total: number, page: number, limit: number }
|
|
147
|
+
*/
|
|
148
|
+
const PaginatedResponseSchema = (itemSchema) => zod_1.z.object({
|
|
149
|
+
list: zod_1.z.array(itemSchema),
|
|
150
|
+
total: zod_1.z.number(),
|
|
151
|
+
page: zod_1.z.number(),
|
|
152
|
+
limit: zod_1.z.number(),
|
|
153
|
+
});
|
|
154
|
+
exports.PaginatedResponseSchema = PaginatedResponseSchema;
|
|
155
|
+
/**
|
|
156
|
+
* Extended paginated response schema with optional metadata fields
|
|
157
|
+
* Includes additional fields like totalSize, permission, role, nowTime
|
|
158
|
+
* 用于替代 DoFeApp.PageResponseData,保持 zod-first 的设计
|
|
159
|
+
*
|
|
160
|
+
* @template T - The Zod schema for list items
|
|
161
|
+
* @example
|
|
162
|
+
* const SpaceListResponseSchema = ExtendedPaginatedResponseSchema(SpaceSchema);
|
|
163
|
+
* // Results in: { list: Space[], total: number, page: number, limit: number, totalSize?: number, ... }
|
|
164
|
+
*/
|
|
165
|
+
const ExtendedPaginatedResponseSchema = (itemSchema) => zod_1.z.object({
|
|
166
|
+
list: zod_1.z.array(itemSchema),
|
|
167
|
+
total: zod_1.z.number(),
|
|
168
|
+
page: zod_1.z.number().optional(),
|
|
169
|
+
limit: zod_1.z.number().optional(),
|
|
170
|
+
/** 总大小(字节),用于文件列表 */
|
|
171
|
+
totalSize: zod_1.z.number().optional(),
|
|
172
|
+
/** 权限列表 */
|
|
173
|
+
permission: zod_1.z.array(zod_1.z.string()).optional(),
|
|
174
|
+
/** 角色标识 */
|
|
175
|
+
role: zod_1.z.string().optional(),
|
|
176
|
+
/** 服务器当前时间 */
|
|
177
|
+
nowTime: zod_1.z.coerce.date().optional(),
|
|
178
|
+
});
|
|
179
|
+
exports.ExtendedPaginatedResponseSchema = ExtendedPaginatedResponseSchema;
|
|
180
|
+
// Common ID schema (UUID string)
|
|
181
|
+
exports.IdSchema = zod_1.z.string().uuid();
|
|
182
|
+
// Common success response
|
|
183
|
+
exports.SuccessResponseSchema = zod_1.z.object({
|
|
184
|
+
success: zod_1.z.boolean(),
|
|
185
|
+
});
|
|
186
|
+
// Error response schema (basic)
|
|
187
|
+
exports.ErrorResponseSchema = zod_1.z.object({
|
|
188
|
+
code: zod_1.z.number(),
|
|
189
|
+
msg: zod_1.z.string(),
|
|
190
|
+
data: zod_1.z.null().optional(),
|
|
191
|
+
});
|
|
192
|
+
// Enhanced error response with error details
|
|
193
|
+
exports.EnhancedErrorResponseSchema = zod_1.z.object({
|
|
194
|
+
code: zod_1.z.number(),
|
|
195
|
+
msg: zod_1.z.string(),
|
|
196
|
+
data: zod_1.z.null(),
|
|
197
|
+
error: zod_1.z
|
|
198
|
+
.object({
|
|
199
|
+
errorCode: zod_1.z.number(),
|
|
200
|
+
errorType: zod_1.z.string(),
|
|
201
|
+
errorData: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
202
|
+
})
|
|
203
|
+
.optional(),
|
|
204
|
+
});
|
|
205
|
+
// Helper function to create API response schema with common responses
|
|
206
|
+
function createApiContract(config) {
|
|
207
|
+
return config;
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=base.js.map
|
package/dist/base.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../packages/contracts-base/src/base.ts"],"names":[],"mappings":";;;AAuFA,kCAOC;AAQD,gDAUC;AAQD,kDAWC;AAKD,gDAMC;AAiKD,8CAqBC;AApUD,6BAAwB;AAuUf,kFAvUA,OAAC,OAuUA;AApUV;;;GAGG;AAEH,oCAAoC;AACvB,QAAA,SAAS,GAAG;IACvB,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC,CAAC;IACT,YAAY,EAAE,GAAG;IACjB,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAA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,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,OAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;CAC1B,CAAC,CAAC;AAIH,6CAA6C;AAChC,QAAA,2BAA2B,GAAG,OAAC,CAAC,MAAM,CAAC;IAClD,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,OAAC,CAAC,IAAI,EAAE;IACd,KAAK,EAAE,OAAC;SACL,MAAM,CAAC;QACN,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;QACrB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;QACrB,SAAS,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;KACxD,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC;AAIH,sEAAsE;AACtE,SAAgB,iBAAiB,CAK/B,MAcD;IACC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/contracts-base/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./base"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/contracts-base/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dofe/infra-contracts-base",
|
|
3
|
+
"version": "0.1.42",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"default": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./base": {
|
|
12
|
+
"types": "./dist/base.d.ts",
|
|
13
|
+
"default": "./dist/base.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@ts-rest/core": "3.53.0-rc.1",
|
|
18
|
+
"zod": "^4.0.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@ts-rest/core": "3.53.0-rc.1",
|
|
22
|
+
"rimraf": "^6.1.3",
|
|
23
|
+
"typescript": "^6.0.3",
|
|
24
|
+
"zod": "^4.4.3"
|
|
25
|
+
},
|
|
26
|
+
"type": "commonjs",
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"license": "UNLICENSED",
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc",
|
|
36
|
+
"typecheck": "tsc --noEmit",
|
|
37
|
+
"clean": "rimraf dist"
|
|
38
|
+
}
|
|
39
|
+
}
|