@hcmai/sdk 0.21.8 → 0.21.10
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/index.d.ts +8 -2
- package/dist/index.js +139 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -994,6 +994,7 @@ interface AttachmentMeta {
|
|
|
994
994
|
fileName: string;
|
|
995
995
|
mimeType: string;
|
|
996
996
|
fileSize: number;
|
|
997
|
+
bindingStatus?: string;
|
|
997
998
|
}
|
|
998
999
|
declare function guessMimeType(filePath: string): string;
|
|
999
1000
|
/**
|
|
@@ -1010,7 +1011,12 @@ declare function guessMimeType(filePath: string): string;
|
|
|
1010
1011
|
* 「分类不存在」。2026-08-26 按交付技能跑弹性报表端到端时,Step 4「上传模板」
|
|
1011
1012
|
* 卡在这里;模板是报表的必需件,这条不通整条链就断了。
|
|
1012
1013
|
*/
|
|
1013
|
-
declare function uploadDocument(http: AxiosInstance, filePath: string, storageCategory?: string
|
|
1014
|
+
declare function uploadDocument(http: AxiosInstance, filePath: string, storageCategory?: string, owner?: {
|
|
1015
|
+
model: string;
|
|
1016
|
+
originId: string;
|
|
1017
|
+
field: string;
|
|
1018
|
+
state?: string;
|
|
1019
|
+
}): Promise<AttachmentMeta>;
|
|
1014
1020
|
/** 默认产物落盘目录(对标 Claude Code 工具产物本地直接访问)。 */
|
|
1015
1021
|
declare function defaultDownloadDir(): string;
|
|
1016
1022
|
/**
|
|
@@ -3078,7 +3084,7 @@ interface SaveMetaResult {
|
|
|
3078
3084
|
declare function saveTenantMeta(http: AxiosInstance, path: string, content: string): Promise<SaveMetaResult>;
|
|
3079
3085
|
declare function deleteTenantMeta(http: AxiosInstance, path: string): Promise<SaveMetaResult>;
|
|
3080
3086
|
|
|
3081
|
-
declare const META_SCHEMA_SOURCE_COMMIT = "
|
|
3087
|
+
declare const META_SCHEMA_SOURCE_COMMIT = "9c205ad33da978414b101ce79b3f091a60779a34";
|
|
3082
3088
|
|
|
3083
3089
|
type MetaIssueSeverity = 'error' | 'warn';
|
|
3084
3090
|
interface MetaIssue {
|
package/dist/index.js
CHANGED
|
@@ -2326,7 +2326,7 @@ function guessMimeType(filePath) {
|
|
|
2326
2326
|
return MIME_BY_EXT[path5.extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
2327
2327
|
}
|
|
2328
2328
|
var CHAT_ATTACHMENT_CATEGORY = "ai-conversation";
|
|
2329
|
-
async function uploadDocument(http, filePath, storageCategory = CHAT_ATTACHMENT_CATEGORY) {
|
|
2329
|
+
async function uploadDocument(http, filePath, storageCategory = CHAT_ATTACHMENT_CATEGORY, owner) {
|
|
2330
2330
|
const abs = expandHome(filePath);
|
|
2331
2331
|
const buf = await fsp.readFile(abs);
|
|
2332
2332
|
const fileName = path5.basename(abs);
|
|
@@ -2334,13 +2334,23 @@ async function uploadDocument(http, filePath, storageCategory = CHAT_ATTACHMENT_
|
|
|
2334
2334
|
form.append("file", new Blob([buf], { type: guessMimeType(abs) }), fileName);
|
|
2335
2335
|
form.append("storageCategory", storageCategory);
|
|
2336
2336
|
form.append("allowEmptyFormId", "true");
|
|
2337
|
+
if (owner) {
|
|
2338
|
+
if (!owner.model?.trim() || !owner.originId?.trim() || !owner.field?.trim()) {
|
|
2339
|
+
throw new Error("\u4E1A\u52A1\u9644\u4EF6\u5FC5\u987B\u540C\u65F6\u63D0\u4F9B model\u3001originId\u3001field");
|
|
2340
|
+
}
|
|
2341
|
+
form.append("model", owner.model.trim());
|
|
2342
|
+
form.append("originId", owner.originId.trim());
|
|
2343
|
+
form.append("field", owner.field.trim());
|
|
2344
|
+
if (owner.state?.trim()) form.append("state", owner.state.trim());
|
|
2345
|
+
}
|
|
2337
2346
|
const resp = await http.post("/api/documents/upload", form);
|
|
2338
2347
|
const meta = resp.data?.data ?? resp.data;
|
|
2339
2348
|
return {
|
|
2340
2349
|
documentId: String(meta.documentId ?? meta.id),
|
|
2341
2350
|
fileName: String(meta.fileName ?? fileName),
|
|
2342
2351
|
mimeType: String(meta.contentType ?? meta.mimeType ?? guessMimeType(abs)),
|
|
2343
|
-
fileSize: Number(meta.fileSize ?? meta.size ?? buf.length)
|
|
2352
|
+
fileSize: Number(meta.fileSize ?? meta.size ?? buf.length),
|
|
2353
|
+
...meta.bindingStatus ? { bindingStatus: String(meta.bindingStatus) } : owner ? { bindingStatus: "UNBOUND_BACKEND_CONTRACT_UNAVAILABLE" } : {}
|
|
2344
2354
|
};
|
|
2345
2355
|
}
|
|
2346
2356
|
function defaultDownloadDir() {
|
|
@@ -2352,7 +2362,17 @@ function absoluteDownloadUrl(apiBase, url) {
|
|
|
2352
2362
|
}
|
|
2353
2363
|
async function downloadDocument(http, ref, destPath) {
|
|
2354
2364
|
const url = ref.downloadUrl ?? `/api/documents/download/${ref.documentId}`;
|
|
2355
|
-
const resp = await http.get(url, { responseType: "arraybuffer" })
|
|
2365
|
+
const resp = await http.get(url, { responseType: "arraybuffer" }).catch((error) => {
|
|
2366
|
+
const data = error.response?.data;
|
|
2367
|
+
if (Buffer.isBuffer(data) || data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {
|
|
2368
|
+
const bytes2 = Buffer.isBuffer(data) ? data : data instanceof ArrayBuffer ? Buffer.from(data) : Buffer.from(data.buffer, data.byteOffset, data.byteLength);
|
|
2369
|
+
try {
|
|
2370
|
+
error.response.data = JSON.parse(bytes2.toString("utf8"));
|
|
2371
|
+
} catch {
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
throw error;
|
|
2375
|
+
});
|
|
2356
2376
|
const headerName = parseFilenameFromDisposition(resp.headers?.["content-disposition"]);
|
|
2357
2377
|
const rawName = ref.fileName ?? headerName ?? `${ref.documentId ?? "download"}.bin`;
|
|
2358
2378
|
let dir;
|
|
@@ -7124,7 +7144,7 @@ async function deleteTenantMeta(http, path24) {
|
|
|
7124
7144
|
import yaml9 from "js-yaml";
|
|
7125
7145
|
|
|
7126
7146
|
// src/meta/generated/meta-schemas.ts
|
|
7127
|
-
var META_SCHEMA_SOURCE_COMMIT = "
|
|
7147
|
+
var META_SCHEMA_SOURCE_COMMIT = "9c205ad33da978414b101ce79b3f091a60779a34";
|
|
7128
7148
|
var META_SCHEMAS = {
|
|
7129
7149
|
list: {
|
|
7130
7150
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
@@ -7916,7 +7936,7 @@ var META_SCHEMAS = {
|
|
|
7916
7936
|
},
|
|
7917
7937
|
"type": {
|
|
7918
7938
|
"type": "string",
|
|
7919
|
-
"enum": ["api", "navigate"]
|
|
7939
|
+
"enum": ["api", "navigate", "dialog"]
|
|
7920
7940
|
},
|
|
7921
7941
|
"targetModel": {
|
|
7922
7942
|
"type": "string"
|
|
@@ -7958,6 +7978,46 @@ var META_SCHEMAS = {
|
|
|
7958
7978
|
},
|
|
7959
7979
|
"path": {
|
|
7960
7980
|
"type": "string"
|
|
7981
|
+
},
|
|
7982
|
+
"dialog": {
|
|
7983
|
+
"type": "object",
|
|
7984
|
+
"description": "type=dialog \u7684\u901A\u7528\u52A8\u4F5C\u5F39\u7A97\u914D\u7F6E\uFF0C\u6CBF\u7528\u5217\u8868 dialog \u5757\u3002",
|
|
7985
|
+
"properties": {
|
|
7986
|
+
"dialogType": {
|
|
7987
|
+
"type": "string",
|
|
7988
|
+
"enum": ["action", "custom"]
|
|
7989
|
+
},
|
|
7990
|
+
"targetModel": {
|
|
7991
|
+
"type": "string"
|
|
7992
|
+
},
|
|
7993
|
+
"targetAction": {
|
|
7994
|
+
"type": "string"
|
|
7995
|
+
},
|
|
7996
|
+
"actionTarget": {
|
|
7997
|
+
"type": "string",
|
|
7998
|
+
"enum": ["class", "object"]
|
|
7999
|
+
},
|
|
8000
|
+
"targetMethod": {
|
|
8001
|
+
"type": "string",
|
|
8002
|
+
"enum": ["GET", "POST", "PUT", "DELETE"]
|
|
8003
|
+
},
|
|
8004
|
+
"component": {
|
|
8005
|
+
"type": "string"
|
|
8006
|
+
},
|
|
8007
|
+
"title": {
|
|
8008
|
+
"type": "string"
|
|
8009
|
+
},
|
|
8010
|
+
"width": {
|
|
8011
|
+
"type": "string"
|
|
8012
|
+
},
|
|
8013
|
+
"form": {
|
|
8014
|
+
"type": "object"
|
|
8015
|
+
},
|
|
8016
|
+
"result": {
|
|
8017
|
+
"type": "object"
|
|
8018
|
+
}
|
|
8019
|
+
},
|
|
8020
|
+
"required": ["dialogType"]
|
|
7961
8021
|
}
|
|
7962
8022
|
},
|
|
7963
8023
|
"required": ["key", "label", "type"]
|
|
@@ -8606,6 +8666,23 @@ var META_SCHEMAS = {
|
|
|
8606
8666
|
},
|
|
8607
8667
|
"description": "\u5217\u8868\u5DE5\u5177\u680F\u914D\u7F6E;\u58F0\u660E TopBar \u5404\u5143\u7D20\u663E\u9690\u4E0E\u641C\u7D22\u5F62\u6001\u3002\u6574\u5757\u53CA\u5404\u5B57\u6BB5\u5747\u53EF\u9009,\u7F3A\u7701\u5168\u5F00+\u5173\u952E\u8BCD\u641C\u7D22",
|
|
8608
8668
|
"additionalProperties": false
|
|
8669
|
+
},
|
|
8670
|
+
"tree": {
|
|
8671
|
+
"type": "object",
|
|
8672
|
+
"properties": {
|
|
8673
|
+
"defaultExpandAll": {
|
|
8674
|
+
"type": "boolean",
|
|
8675
|
+
"description": "\u9ED8\u8BA4\u5C55\u5F00\u5168\u90E8\u5C42\u7EA7;\u7F3A\u7701 false"
|
|
8676
|
+
},
|
|
8677
|
+
"parentField": {
|
|
8678
|
+
"type": "string",
|
|
8679
|
+
"description": "\u5C42\u7EA7\u7236\u5B57\u6BB5(\u5982 parentId);\u8BE5\u5B57\u6BB5\u4E3A\u7A7A\u7684\u884C\u4F5C\u6839,\u5176\u4F59\u6309\u540C\u96C6\u5408\u5185\u7684\u7236\u884C\u6302\u6210\u5B50\u7EA7",
|
|
8680
|
+
"minLength": 1
|
|
8681
|
+
}
|
|
8682
|
+
},
|
|
8683
|
+
"description": "\u5217\u8868\u6811\u5F62\u5C55\u793A;\u6309 parentField \u628A\u5F53\u524D\u9875\u6570\u636E\u6E32\u67D3\u6210\u53EF\u9010\u7EA7\u5C55\u5F00\u7684\u6811\u8868\u3002\u7236\u5B50\u5173\u7CFB\u53EA\u4F5C\u7528\u5728\u6E32\u67D3\u5C42,\u7B5B\u9009/\u6392\u5E8F/\u5206\u9875/\u6743\u9650\u53E3\u5F84\u4E0D\u53D8",
|
|
8684
|
+
"additionalProperties": false,
|
|
8685
|
+
"required": ["parentField"]
|
|
8609
8686
|
}
|
|
8610
8687
|
}
|
|
8611
8688
|
},
|
|
@@ -8959,6 +9036,7 @@ var META_SCHEMAS = {
|
|
|
8959
9036
|
}
|
|
8960
9037
|
}
|
|
8961
9038
|
},
|
|
9039
|
+
"disabled": {},
|
|
8962
9040
|
"execution": {
|
|
8963
9041
|
"type": "object",
|
|
8964
9042
|
"properties": {
|
|
@@ -9203,6 +9281,29 @@ var META_SCHEMAS = {
|
|
|
9203
9281
|
"type": "string"
|
|
9204
9282
|
},
|
|
9205
9283
|
"defaultValue": {},
|
|
9284
|
+
"derive": {
|
|
9285
|
+
"type": "object",
|
|
9286
|
+
"properties": {
|
|
9287
|
+
"clearOnSourceEmpty": {
|
|
9288
|
+
"type": "boolean"
|
|
9289
|
+
},
|
|
9290
|
+
"createOnly": {
|
|
9291
|
+
"type": "boolean"
|
|
9292
|
+
},
|
|
9293
|
+
"field": {
|
|
9294
|
+
"type": "string"
|
|
9295
|
+
},
|
|
9296
|
+
"from": {
|
|
9297
|
+
"type": "string"
|
|
9298
|
+
},
|
|
9299
|
+
"model": {
|
|
9300
|
+
"type": "string"
|
|
9301
|
+
},
|
|
9302
|
+
"preserveManual": {
|
|
9303
|
+
"type": "boolean"
|
|
9304
|
+
}
|
|
9305
|
+
}
|
|
9306
|
+
},
|
|
9206
9307
|
"hidden": {
|
|
9207
9308
|
"type": "boolean"
|
|
9208
9309
|
},
|
|
@@ -9996,6 +10097,29 @@ var META_SCHEMAS = {
|
|
|
9996
10097
|
"type": "string"
|
|
9997
10098
|
},
|
|
9998
10099
|
"defaultValue": {},
|
|
10100
|
+
"derive": {
|
|
10101
|
+
"type": "object",
|
|
10102
|
+
"properties": {
|
|
10103
|
+
"clearOnSourceEmpty": {
|
|
10104
|
+
"type": "boolean"
|
|
10105
|
+
},
|
|
10106
|
+
"createOnly": {
|
|
10107
|
+
"type": "boolean"
|
|
10108
|
+
},
|
|
10109
|
+
"field": {
|
|
10110
|
+
"type": "string"
|
|
10111
|
+
},
|
|
10112
|
+
"from": {
|
|
10113
|
+
"type": "string"
|
|
10114
|
+
},
|
|
10115
|
+
"model": {
|
|
10116
|
+
"type": "string"
|
|
10117
|
+
},
|
|
10118
|
+
"preserveManual": {
|
|
10119
|
+
"type": "boolean"
|
|
10120
|
+
}
|
|
10121
|
+
}
|
|
10122
|
+
},
|
|
9999
10123
|
"hidden": {
|
|
10000
10124
|
"type": "boolean"
|
|
10001
10125
|
},
|
|
@@ -10009,7 +10133,7 @@ var META_SCHEMAS = {
|
|
|
10009
10133
|
"type": "array",
|
|
10010
10134
|
"items": {
|
|
10011
10135
|
"type": "string",
|
|
10012
|
-
"enum": ["EQUAL", "NOT_EQUAL", "GREATER_THAN", "LESS_THAN", "GREATER_THAN_OR_EQUAL", "LESS_THAN_OR_EQUAL", "LIKE", "NOT_LIKE", "CONTAINS", "STARTSWITH", "ENDSWITH", "IN", "NOT_IN", "IS_NULL", "IS_NOT_NULL", "ARRAY_CONTAINS", "BETWEEN", "ANNUAL_WITHIN", "CHILD_OF", "PARENT_OF", "ORG_SUBTREE_OF", "MANAGED_ORG_SCOPE"]
|
|
10136
|
+
"enum": ["EQUAL", "NOT_EQUAL", "GREATER_THAN", "LESS_THAN", "GREATER_THAN_OR_EQUAL", "LESS_THAN_OR_EQUAL", "LIKE", "NOT_LIKE", "CONTAINS", "STARTSWITH", "ENDSWITH", "IN", "NOT_IN", "IS_NULL", "IS_NOT_NULL", "ARRAY_CONTAINS", "BETWEEN", "ANNUAL_WITHIN", "CHILD_OF", "PARENT_OF", "ORG_SUBTREE_OF", "WF_ROLE", "MANAGED_ORG_SCOPE"]
|
|
10013
10137
|
}
|
|
10014
10138
|
},
|
|
10015
10139
|
"options": {
|
|
@@ -10670,6 +10794,10 @@ var META_SCHEMAS = {
|
|
|
10670
10794
|
},
|
|
10671
10795
|
"uniqueItems": true
|
|
10672
10796
|
},
|
|
10797
|
+
"searchPinyin": {
|
|
10798
|
+
"type": "string",
|
|
10799
|
+
"enum": ["NONE", "PERSON_NAME", "PLAIN"]
|
|
10800
|
+
},
|
|
10673
10801
|
"security": {
|
|
10674
10802
|
"type": "object",
|
|
10675
10803
|
"properties": {
|
|
@@ -10715,7 +10843,8 @@ var META_SCHEMAS = {
|
|
|
10715
10843
|
},
|
|
10716
10844
|
"type": {
|
|
10717
10845
|
"type": "string",
|
|
10718
|
-
"enum": ["uuid", "string", "boolean", "integer", "float", "date", "datetime", "time"]
|
|
10846
|
+
"enum": ["uuid", "string", "boolean", "integer", "float", "number", "date", "datetime", "time"],
|
|
10847
|
+
"description": "\u5B57\u6BB5\u7C7B\u578B\uFF1Bnumber \u4E3A\u7CBE\u786E\u5341\u8FDB\u5236\uFF0C\u4F7F\u7528\u5B57\u7B26\u4E32\u4F20\u8F93\uFF0C\u6574\u6570\u6700\u591A28\u4F4D\u3001\u5C0F\u6570\u6700\u591A10\u4F4D\uFF1Bfloat \u4E3A\u8FD1\u4F3C\u6D6E\u70B9\u6570"
|
|
10719
10848
|
},
|
|
10720
10849
|
"typeFallback": {
|
|
10721
10850
|
"type": "boolean"
|
|
@@ -11118,6 +11247,9 @@ var META_SCHEMAS = {
|
|
|
11118
11247
|
"model": {
|
|
11119
11248
|
"type": "string"
|
|
11120
11249
|
},
|
|
11250
|
+
"plugin": {
|
|
11251
|
+
"type": "string"
|
|
11252
|
+
},
|
|
11121
11253
|
"relation": {
|
|
11122
11254
|
"$ref": "#/$defs/RelationConfig",
|
|
11123
11255
|
"type": "object",
|