wenay-common 1.0.141 → 1.0.142

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.
@@ -193,6 +193,7 @@ export type IParamsExpandable = {
193
193
  export type IParamsExpandableReadonly = ReadonlyFull<IParamsExpandable>;
194
194
  export declare function isParamGroupOrArray<TParam extends IParamReadonly>(param: TParam): param is Extract<TParam, ReadonlyFull<IParamGroup | IParamArr<any>>>;
195
195
  export declare function isParamGroup<TParam extends IParamReadonly>(param: TParam): param is Extract<TParam, ReadonlyFull<IParamGroup>>;
196
+ export declare function isSimpleParams(params: IParams | SimpleParams): boolean;
196
197
  type ObjectKeyPath<TObject extends object = object, TValue = unknown> = readonly string[];
197
198
  export declare function iterateParams<TObj extends IParamsReadonly, TVal extends IParamReadonly = TObj[string]>(obj: TObj, currentPath?: ObjectKeyPath<TObj, TVal>): Generator<[key: string, value: TVal, path: ObjectKeyPath<TObj, TVal>]>;
198
199
  export declare function enableAllParams<T extends IParamsReadonly>(params: T, enabled?: boolean): T;
@@ -212,5 +213,5 @@ export type SimpleParamsMutable<T> = T extends const_Date ? const_Date : Mutable
212
213
  };
213
214
  export type SimpleParams<T = IParams> = ReadonlyFull<SimpleParamsMutable<T>>;
214
215
  export declare function GetSimpleParams<T extends ReadonlyFull<IParams>>(params: T): SimpleParamsMutable<T>;
215
- export declare function mergeParamValuesToInfos<TParams extends IParamsReadonly>(srcObj: TParams, valuesObj: SimpleParams): TParams;
216
+ export declare function mergeParamValuesToInfos<TParams extends IParamsReadonly>(srcObj: IParams, valuesObj: SimpleParams | IParams): TParams;
216
217
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeParamValuesToInfos = exports.GetSimpleParams = exports.enableAllParams = exports.iterateParams = exports.isParamGroup = exports.isParamGroupOrArray = exports.CParamsReadonly = exports.CParams = exports.isParamBase = void 0;
3
+ exports.mergeParamValuesToInfos = exports.GetSimpleParams = exports.enableAllParams = exports.iterateParams = exports.isSimpleParams = exports.isParamGroup = exports.isParamGroupOrArray = exports.CParamsReadonly = exports.CParams = exports.isParamBase = void 0;
4
4
  const common_1 = require("../Common/common");
5
5
  {
6
6
  let ts = "2025-06-01 16:25:25";
@@ -27,6 +27,23 @@ function isParamGroup(param) {
27
27
  return isParamGroupOrArray(param) && !Array.isArray(param.value);
28
28
  }
29
29
  exports.isParamGroup = isParamGroup;
30
+ function isSimpleParams(params) {
31
+ let t = false;
32
+ for (let key in params) {
33
+ const tr = params[key]["volume"];
34
+ if (!tr)
35
+ return true;
36
+ else {
37
+ if (typeof tr == "object") {
38
+ const r = isSimpleParams(tr);
39
+ if (r)
40
+ return true;
41
+ }
42
+ }
43
+ }
44
+ return false;
45
+ }
46
+ exports.isSimpleParams = isSimpleParams;
30
47
  function* iterateParams(obj, currentPath = []) {
31
48
  for (let [key, param] of Object.entries(obj)) {
32
49
  let keyPath = currentPath.concat(key);
@@ -174,6 +191,6 @@ function convert_(valuesObj, srcObj) {
174
191
  return resObj;
175
192
  }
176
193
  function mergeParamValuesToInfos(srcObj, valuesObj) {
177
- return convert_(valuesObj, srcObj);
194
+ return convert_(isSimpleParams(valuesObj) ? valuesObj : GetSimpleParams(valuesObj), srcObj);
178
195
  }
179
196
  exports.mergeParamValuesToInfos = mergeParamValuesToInfos;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wenay-common",
3
- "version": "1.0.141",
3
+ "version": "1.0.142",
4
4
  "description": "Common library",
5
5
  "strict": true,
6
6
  "main": "lib/index.js",