@hcmai/sdk 0.3.1 → 0.3.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.
package/dist/index.d.ts CHANGED
@@ -48,6 +48,13 @@ interface ActionMeta {
48
48
  required?: boolean;
49
49
  description?: string;
50
50
  }>;
51
+ scope?: string;
52
+ httpMethod?: string;
53
+ readOnly?: boolean;
54
+ paramTypes?: string[];
55
+ paramNames?: string[];
56
+ returnType?: string;
57
+ source?: string;
51
58
  }
52
59
  interface RelationMeta {
53
60
  key: string;
@@ -690,6 +697,7 @@ declare function resolveActiveProfile(args: {
690
697
 
691
698
  interface EnvConfig {
692
699
  endpoint: string;
700
+ frontend?: string;
693
701
  tenantId?: string;
694
702
  defaultIdentity?: string;
695
703
  defaultAgent?: string;
package/dist/index.js CHANGED
@@ -1061,6 +1061,16 @@ async function action(http, model, actionName, input) {
1061
1061
  }
1062
1062
 
1063
1063
  // src/meta/describe.ts
1064
+ function normalizeActionParams(action2) {
1065
+ if (action2.parameters) return action2.parameters;
1066
+ if (action2.params) return action2.params;
1067
+ if (!action2.paramNames?.length && !action2.paramTypes?.length) return void 0;
1068
+ const size = Math.max(action2.paramNames?.length ?? 0, action2.paramTypes?.length ?? 0);
1069
+ return Array.from({ length: size }, (_, index) => ({
1070
+ name: action2.paramNames?.[index] ?? `arg${index}`,
1071
+ type: action2.paramTypes?.[index] ?? "unknown"
1072
+ }));
1073
+ }
1064
1074
  async function describe(http, model, _opts = {}) {
1065
1075
  const metaResp = await http.get(`/api/models/${model}/meta`);
1066
1076
  const meta = metaResp.data;
@@ -1077,7 +1087,14 @@ async function describe(http, model, _opts = {}) {
1077
1087
  name: a.key ?? a.name ?? "",
1078
1088
  label: a.label,
1079
1089
  description: a.description,
1080
- params: a.params
1090
+ params: normalizeActionParams(a),
1091
+ scope: a.scope,
1092
+ httpMethod: a.httpMethod,
1093
+ readOnly: a.readOnly,
1094
+ paramTypes: a.paramTypes,
1095
+ paramNames: a.paramNames,
1096
+ returnType: a.returnType,
1097
+ source: a.source
1081
1098
  }));
1082
1099
  return {
1083
1100
  model: meta.name ?? model,