@lark-apaas/nestjs-capability 0.1.12 → 0.1.13-alpha.1

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.cjs CHANGED
@@ -972,11 +972,16 @@ var CapabilityService = class _CapabilityService {
972
972
  * 注意:校验发生在模板替换之前。paramsSchema.required 声明的是调用方需要传哪些变量
973
973
  * (它们会被 formValue 中的 {{input.xxx}} 引用),不是 resolve 后的 formValue key。
974
974
  *
975
+ * Debug 调用(isDebug=true)跳过校验:开发者可能在 paramSchema 里声明了字段但表单
976
+ * 里并未通过 {{input.xxx}} 实际引用,此时 required 校验会误报;debug 阶段交由
977
+ * 插件自身的 zod schema 兜底即可。
978
+ *
975
979
  * 诊断原因:
976
980
  * not_provided — input 中完全没有该字段(key 不存在 / undefined / null),调用方未传
977
981
  * empty_value — 调用方传了值但为空(空串/空数组),需要检查数据来源
978
982
  */
979
- validateRequiredParams(input, paramsSchema, capabilityName) {
983
+ validateRequiredParams(input, paramsSchema, capabilityName, isDebug) {
984
+ if (isDebug) return;
980
985
  if (!paramsSchema?.required?.length || !paramsSchema.properties) {
981
986
  return;
982
987
  }
@@ -1043,7 +1048,7 @@ var CapabilityService = class _CapabilityService {
1043
1048
  };
1044
1049
  let isStream = false;
1045
1050
  try {
1046
- this.validateRequiredParams(input, config.paramsSchema, config.name);
1051
+ this.validateRequiredParams(input, config.paramsSchema, config.name, contextOverride?.isDebug ?? false);
1047
1052
  const { pluginInstance, resolvedParams } = await this.loadPluginAndResolveParams(config, input);
1048
1053
  if (!pluginInstance.hasAction(actionName)) {
1049
1054
  throw new ActionNotFoundError(config.pluginKey, actionName);
@@ -1104,7 +1109,7 @@ var CapabilityService = class _CapabilityService {
1104
1109
  };
1105
1110
  const chunks = [];
1106
1111
  try {
1107
- this.validateRequiredParams(input, config.paramsSchema, config.name);
1112
+ this.validateRequiredParams(input, config.paramsSchema, config.name, contextOverride?.isDebug ?? false);
1108
1113
  const { pluginInstance, resolvedParams } = await this.loadPluginAndResolveParams(config, input);
1109
1114
  if (!pluginInstance.hasAction(actionName)) {
1110
1115
  throw new ActionNotFoundError(config.pluginKey, actionName);
@@ -1165,7 +1170,7 @@ var CapabilityService = class _CapabilityService {
1165
1170
  };
1166
1171
  const chunks = [];
1167
1172
  try {
1168
- this.validateRequiredParams(input, config.paramsSchema, config.name);
1173
+ this.validateRequiredParams(input, config.paramsSchema, config.name, contextOverride?.isDebug ?? false);
1169
1174
  const { pluginInstance, resolvedParams } = await this.loadPluginAndResolveParams(config, input);
1170
1175
  if (!pluginInstance.hasAction(actionName)) {
1171
1176
  throw new ActionNotFoundError(config.pluginKey, actionName);