zentao-api 0.2.0-beta.1 → 0.2.0-beta.2

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,3 +1,15 @@
1
+ import { ZentaoError } from '../misc/errors.js';
2
+ /** 判断值是否为普通对象(非数组、非 null)。 */
3
+ export function isRecord(value) {
4
+ return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
5
+ }
6
+ /** 将用户传入的站点根地址规范化,兼容误传入 `/api.php/v2` 的场景。 */
7
+ export function normalizeSiteUrl(baseUrl) {
8
+ const trimmed = baseUrl.trim().replace(/\/+$/, '');
9
+ if (!trimmed)
10
+ throw new ZentaoError('E_INVALID_BASE_URL');
11
+ return trimmed.replace(/\/api\.php\/v2$/i, '');
12
+ }
1
13
  export function getNestedValue(obj, path) {
2
14
  const keys = path.split('.');
3
15
  let current = obj;
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const fallbackBuild = "2026-05-10T12:45:54.888Z";
2
- const fallbackVersion = "0.2.0-beta.1";
1
+ const fallbackBuild = "2026-05-11T13:46:14.715Z";
2
+ const fallbackVersion = "0.2.0-beta.2";
3
3
  export const BUILD = typeof __ZENTAO_API_BUILD__ === 'string' ? __ZENTAO_API_BUILD__ : fallbackBuild;
4
4
  export const VERSION = typeof __ZENTAO_API_VERSION__ === 'string' ? __ZENTAO_API_VERSION__ : fallbackVersion;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "zentao-api",
3
- "version": "0.2.0-beta.1",
3
+ "version": "0.2.0-beta.2",
4
4
  "type": "module",
5
5
  "description": "Browser and Node.js SDK for ZenTao API",
6
6
  "license": "MIT",
7
7
  "author": "Sun Hao <sunhao@chandao.com>",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/catouse/zentao-api.git"
10
+ "url": "https://github.com/catouse/zentao-api"
11
11
  },
12
12
  "keywords": [
13
13
  "zentao",
@@ -41,6 +41,12 @@
41
41
  "build": "rm -rf dist && tsc -p tsconfig.json && bun run scripts/build-browser.ts",
42
42
  "smoke:node": "node scripts/smoke-node.mjs",
43
43
  "smoke:package": "bun run scripts/smoke-package.ts",
44
+ "docs:reference": "typedoc",
45
+ "docs:zentao-api": "bun run scripts/generate-zentao-api-docs.ts",
46
+ "docs:generate": "bun run docs:reference && bun run docs:zentao-api",
47
+ "docs:dev": "bun run docs:generate && vitepress dev docs",
48
+ "docs:build": "bun run docs:generate && vitepress build docs",
49
+ "docs:preview": "bun run docs:build && vitepress preview docs",
44
50
  "check": "bun run test:coverage && bun run typecheck && bun run typecheck:tests && bun run registry:check && bun run build && bun run smoke:node && bun run smoke:package",
45
51
  "prepublishOnly": "bun run check"
46
52
  },
@@ -51,9 +57,13 @@
51
57
  "@types/bun": "^1.3.13",
52
58
  "@types/node": "^24.10.0",
53
59
  "@types/turndown": "^5.0.5",
54
- "typescript": "^5.7.0"
60
+ "typedoc": "^0.28.19",
61
+ "typedoc-plugin-markdown": "^4.11.0",
62
+ "typedoc-vitepress-theme": "^1.1.2",
63
+ "typescript": "^5.7.0",
64
+ "vitepress": "^1.6.4"
55
65
  },
56
66
  "engines": {
57
67
  "node": ">=18"
58
68
  }
59
- }
69
+ }