@done-coding/schema-api 0.0.0-stage → 0.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 done-coding
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,34 @@
1
- # Temporary Holding Version
1
+ # @done-coding/schema-api
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ```
4
+ 跨前后端通用接口结构的类型、常量与定义文件
5
+ ```
6
+
7
+ 成功外壳、错误体、三种列表(一次性 / 页码式 / 游标式)、列表请求参数与业务码的 TypeScript 类型、字段路径常量与 JSON Schema 定义文件,由同一份定义生成;同版本的 Python 包为 PyPI 上的 `done-coding-schema-api`。
8
+
9
+ ## 使用
10
+
11
+ ```bash
12
+ npm install @done-coding/schema-api
13
+ ```
14
+
15
+ ```ts
16
+ import {
17
+ PAGED_LIST_REQUEST_PARAMS,
18
+ type PagedList,
19
+ type SuccessEnvelope,
20
+ } from "@done-coding/schema-api";
21
+
22
+ interface User {
23
+ id: string;
24
+ name: string;
25
+ }
26
+
27
+ declare const response: SuccessEnvelope<PagedList<User>>;
28
+ response.data.page.totalRecord; // number
29
+ PAGED_LIST_REQUEST_PARAMS.pageSize; // "page.pageSize"
30
+ ```
31
+
32
+ 定义文件以 `schemas` 导出,也可按路径取:`@done-coding/schema-api/schemas/<结构名>.schema.json`。
33
+
34
+ 各结构的说明、怎么选列表、业务码与版本规则见仓库 README:<https://github.com/done-coding/done-coding-schema#readme>