@cloudbase/manager-node 4.10.3-beta.0 → 4.10.3

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.
@@ -72,15 +72,29 @@ function toBooleanString(value) {
72
72
  return value ? 'TRUE' : 'FALSE';
73
73
  }
74
74
  /**
75
- * 大小写不敏感获取对象字段值
75
+ * 大小写不敏感获取对象字段值(优先 camelCase)
76
76
  * @param obj 目标对象
77
77
  * @param fieldName 字段名(任意大小写)
78
78
  * @returns 字段值,找不到返回 undefined
79
+ * @example
80
+ * getFieldIgnoreCase({ type: 'A', Type: 'B' }, 'type') // → 'A' (camelCase 优先)
81
+ * getFieldIgnoreCase({ Type: 'B' }, 'type') // → 'B'
79
82
  */
80
83
  function getFieldIgnoreCase(obj, fieldName) {
81
84
  if (!obj || typeof obj !== 'object')
82
85
  return undefined;
83
86
  const lowerFieldName = fieldName.toLowerCase();
87
+ // 优先查找 camelCase(首字母小写)
88
+ const camelCaseKey = lowerFieldName.charAt(0).toLowerCase() + fieldName.slice(1);
89
+ if (obj[camelCaseKey] !== undefined) {
90
+ return obj[camelCaseKey];
91
+ }
92
+ // 其次查找 PascalCase(首字母大写)
93
+ const pascalCaseKey = lowerFieldName.charAt(0).toUpperCase() + fieldName.slice(1);
94
+ if (obj[pascalCaseKey] !== undefined) {
95
+ return obj[pascalCaseKey];
96
+ }
97
+ // 最后遍历查找任意大小写匹配
84
98
  for (const key of Object.keys(obj)) {
85
99
  if (key.toLowerCase() === lowerFieldName) {
86
100
  return obj[key];
@@ -276,13 +290,16 @@ class FunctionService {
276
290
  const { namespace } = this.getFunctionConfig();
277
291
  const { func, functionRootPath, force = false, base64Code, codeSecret, functionPath, deployMode } = funcParam;
278
292
  const funcName = func.name;
293
+ const { TopicId, LogsetId } = this.getClsServiceConfig();
279
294
  const params = configToParams({
280
295
  func,
281
296
  codeSecret,
282
297
  baseParams: {
283
298
  Namespace: namespace,
284
299
  Role: 'TCB_QcsRole',
285
- Stamp: 'MINI_QCBASE'
300
+ Stamp: 'MINI_QCBASE',
301
+ ClsTopicId: TopicId,
302
+ ClsLogsetId: LogsetId
286
303
  }
287
304
  });
288
305
  // 根据部署方式处理 Code 参数
@@ -309,9 +326,6 @@ class FunctionService {
309
326
  deployMode
310
327
  }, params.InstallDependency);
311
328
  }
312
- const { TopicId, LogsetId } = this.getClsServiceConfig();
313
- params.ClsTopicId = TopicId;
314
- params.ClsLogsetId = LogsetId;
315
329
  try {
316
330
  // 创建云函数
317
331
  const res = await this.scfService.request('CreateFunction', params);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/manager-node",
3
- "version": "4.10.3-beta.0",
3
+ "version": "4.10.3",
4
4
  "description": "The node manage service api for cloudbase.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {