wenay-common 1.0.229 → 1.0.231
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/lib/Common/WebHook2.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export declare const createWebhookServer: (params: params) => {
|
|
|
29
29
|
export declare const createWebhookClient: (options: WebhookClientOptions) => {
|
|
30
30
|
connect: (tag: string, handler: (payload: any) => void) => Promise<void>;
|
|
31
31
|
unsubscribe: (...tags: string[]) => Promise<void>;
|
|
32
|
-
status: (tag: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
32
|
+
status: (tag: string) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
33
33
|
tags: () => string[];
|
|
34
34
|
getMySubscriptions: () => Promise<Subscriber[]>;
|
|
35
35
|
getAvailableTags: () => Promise<string[]>;
|
|
@@ -200,6 +200,7 @@ export type IParamsExpandable = {
|
|
|
200
200
|
export type IParamsExpandableReadonly = ReadonlyFull<IParamsExpandable>;
|
|
201
201
|
export declare function isParamGroupOrArray<TParam extends IParamReadonly>(param: TParam): param is Extract<TParam, ReadonlyFull<IParamGroup | IParamArr<any>>>;
|
|
202
202
|
export declare function isParamGroup<TParam extends IParamReadonly>(param: TParam): param is Extract<TParam, ReadonlyFull<IParamGroup>>;
|
|
203
|
+
export declare function isSimpleParams2<TParams extends IParamsReadonly>(params: TParams | SimpleParams): boolean;
|
|
203
204
|
export declare function isSimpleParams<TParams extends IParamsReadonly>(params: TParams | SimpleParams): boolean;
|
|
204
205
|
type ObjectKeyPath<TObject extends object = object, TValue = unknown> = readonly string[];
|
|
205
206
|
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>]>;
|
package/lib/Exchange/CParams.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.CParamsReadonly = exports.CParams = void 0;
|
|
|
4
4
|
exports.isParamBase = isParamBase;
|
|
5
5
|
exports.isParamGroupOrArray = isParamGroupOrArray;
|
|
6
6
|
exports.isParamGroup = isParamGroup;
|
|
7
|
+
exports.isSimpleParams2 = isSimpleParams2;
|
|
7
8
|
exports.isSimpleParams = isSimpleParams;
|
|
8
9
|
exports.iterateParams = iterateParams;
|
|
9
10
|
exports.enableAllParams = enableAllParams;
|
|
@@ -32,7 +33,7 @@ function isParamGroupOrArray(param) {
|
|
|
32
33
|
function isParamGroup(param) {
|
|
33
34
|
return isParamGroupOrArray(param) && !Array.isArray(param.value);
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
+
function isSimpleParams2(params) {
|
|
36
37
|
let t = false;
|
|
37
38
|
for (let key in params) {
|
|
38
39
|
const tr = params[key]["value"];
|
|
@@ -48,6 +49,24 @@ function isSimpleParams(params) {
|
|
|
48
49
|
}
|
|
49
50
|
return false;
|
|
50
51
|
}
|
|
52
|
+
function isSimpleParams(params) {
|
|
53
|
+
for (let key in params) {
|
|
54
|
+
const param = params[key];
|
|
55
|
+
if (param == null || typeof param !== "object") {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
if (!("value" in param)) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
const val = param.value;
|
|
62
|
+
if (typeof val === "object" && val !== null && !(val instanceof Date) && !Array.isArray(val)) {
|
|
63
|
+
const r = isSimpleParams(val);
|
|
64
|
+
if (r)
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
51
70
|
function* iterateParams(obj, currentPath = []) {
|
|
52
71
|
for (let [key, param] of Object.entries(obj)) {
|
|
53
72
|
let keyPath = currentPath.concat(key);
|
|
@@ -164,6 +183,48 @@ let p0 = p.p1;
|
|
|
164
183
|
let p3 = p.p3;
|
|
165
184
|
let p4 = p.p4;
|
|
166
185
|
let p5 = p.p5?.p1;
|
|
186
|
+
function test22() {
|
|
187
|
+
const base = {
|
|
188
|
+
kBorrow: {
|
|
189
|
+
value: 1,
|
|
190
|
+
name: 'borrow step',
|
|
191
|
+
range: { max: 3, min: 1, step: 0.1 }
|
|
192
|
+
},
|
|
193
|
+
checkBorrow: { value: false, name: 'check borrow' },
|
|
194
|
+
checkBorrowFutures: { value: false, name: 'check borrow for futures' },
|
|
195
|
+
depoMulti: {
|
|
196
|
+
value: 1,
|
|
197
|
+
name: 'koef depoMulti',
|
|
198
|
+
range: { min: 0.01, max: 4, step: 0.01 }
|
|
199
|
+
},
|
|
200
|
+
depoMulti2: {
|
|
201
|
+
value: 2,
|
|
202
|
+
name: 'koef depoMulti',
|
|
203
|
+
range: { min: 0.01, max: 4, step: 0.01 }
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
const r2 = {
|
|
207
|
+
kBorrow: {
|
|
208
|
+
value: 1,
|
|
209
|
+
name: 'borrow step',
|
|
210
|
+
range: { max: 3, min: 1, step: 0.1 }
|
|
211
|
+
},
|
|
212
|
+
checkBorrow: { value: false, name: 'check borrow' },
|
|
213
|
+
checkBorrowFutures: { value: true, name: 'check borrow for futures' },
|
|
214
|
+
depoMulti: {
|
|
215
|
+
value: 1.32,
|
|
216
|
+
name: 'koef depoMulti',
|
|
217
|
+
range: { min: 0.01, max: 4, step: 0.01 }
|
|
218
|
+
},
|
|
219
|
+
depoMulti3: {
|
|
220
|
+
value: 1,
|
|
221
|
+
name: 'koef depoMulti',
|
|
222
|
+
range: { min: 0.01, max: 4, step: 0.01 }
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
const i = mergeParamValuesToInfos(base, r2);
|
|
226
|
+
console.log(i);
|
|
227
|
+
}
|
|
167
228
|
function convert_(valuesObj, srcObj) {
|
|
168
229
|
let resObj = {};
|
|
169
230
|
if (srcObj instanceof Array)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wenay-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.231",
|
|
4
4
|
"description": "Common library",
|
|
5
5
|
"strict": true,
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"url": "https://github.com/wenayr/math.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"axios": "^1.
|
|
22
|
+
"axios": "^1.12.2",
|
|
23
23
|
"create-hmac": "^1.1.7",
|
|
24
24
|
"express": "^4.21.2",
|
|
25
25
|
"socket.io": "^4.8.1",
|