@wenex/sdk 1.0.30 → 1.0.31
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/common/enums/auth/auths/index.d.ts +1 -0
- package/common/enums/auth/auths/index.js +1 -0
- package/common/enums/auth/auths/index.js.map +1 -1
- package/common/enums/auth/auths/sso-source.enum.d.ts +3 -0
- package/common/enums/auth/auths/sso-source.enum.js +8 -0
- package/common/enums/auth/auths/sso-source.enum.js.map +1 -0
- package/common/interfaces/auth/auths/authentication/request.interface.d.ts +2 -1
- package/common/utils/financial/financial.spec.js +7 -7
- package/common/utils/financial/financial.spec.js.map +1 -1
- package/common/utils/financial/financial.util.d.ts +1 -1
- package/common/utils/financial/financial.util.js +4 -15
- package/common/utils/financial/financial.util.js.map +1 -1
- package/common/utils/financial/transfer.util.d.ts +2 -2
- package/common/utils/financial/transfer.util.js +1 -1
- package/common/utils/financial/transfer.util.js.map +1 -1
- package/package.json +1 -1
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./response-type.enum"), exports);
|
|
18
|
+
__exportStar(require("./sso-source.enum"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/common/enums/auth/auths/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/common/enums/auth/auths/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,oDAAkC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SsoSource = void 0;
|
|
4
|
+
var SsoSource;
|
|
5
|
+
(function (SsoSource) {
|
|
6
|
+
SsoSource["google"] = "google";
|
|
7
|
+
})(SsoSource || (exports.SsoSource = SsoSource = {}));
|
|
8
|
+
//# sourceMappingURL=sso-source.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sso-source.enum.js","sourceRoot":"","sources":["../../../../src/common/enums/auth/auths/sso-source.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,8BAAiB,CAAA;AACnB,CAAC,EAFW,SAAS,yBAAT,SAAS,QAEpB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Scope } from '../../../../core';
|
|
2
2
|
import { GrantType } from '../../../../core/enums';
|
|
3
|
-
import { ResponseType } from '../../../../enums/auth';
|
|
3
|
+
import { ResponseType, SsoSource } from '../../../../enums/auth';
|
|
4
4
|
export interface AuthenticationRequest {
|
|
5
5
|
strict?: boolean;
|
|
6
6
|
grant_type: GrantType;
|
|
@@ -16,5 +16,6 @@ export interface AuthenticationRequest {
|
|
|
16
16
|
coworkers?: string[];
|
|
17
17
|
username?: string;
|
|
18
18
|
password?: string;
|
|
19
|
+
source?: SsoSource;
|
|
19
20
|
state?: string;
|
|
20
21
|
}
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const financial_util_1 = require("./financial.util");
|
|
4
4
|
describe('libs/common/src/utils/financial/financial.util.ts', () => {
|
|
5
5
|
it('totalPays', () => {
|
|
6
|
-
expect((0, financial_util_1.totalPays)()).toBe(
|
|
7
|
-
expect((0, financial_util_1.totalPays)([]
|
|
8
|
-
expect((0, financial_util_1.totalPays)([{ amount: 100 }])).toBe(100);
|
|
9
|
-
expect((0, financial_util_1.totalPays)([{ fraction: 0.2 }]
|
|
10
|
-
expect((0, financial_util_1.totalPays)([{ amount: 100, fraction: 0.2 }]
|
|
11
|
-
expect((0, financial_util_1.totalPays)([{ amount: 100 }, { amount: 100, fraction: 0.2 }]
|
|
12
|
-
expect((0, financial_util_1.totalPays)([{ amount: 100 }, { amount: 100, fraction: 0.2 }, { fraction: 0.2 }]
|
|
6
|
+
expect((0, financial_util_1.totalPays)(100)).toBe(100);
|
|
7
|
+
expect((0, financial_util_1.totalPays)(100, [])).toBe(100);
|
|
8
|
+
expect((0, financial_util_1.totalPays)(100, [{ amount: 100 }])).toBe(100);
|
|
9
|
+
expect((0, financial_util_1.totalPays)(500, [{ fraction: 0.2 }])).toBe(100);
|
|
10
|
+
expect((0, financial_util_1.totalPays)(500, [{ amount: 100, fraction: 0.2 }])).toBe(100);
|
|
11
|
+
expect((0, financial_util_1.totalPays)(500, [{ amount: 100 }, { amount: 100, fraction: 0.2 }])).toBe(200);
|
|
12
|
+
expect((0, financial_util_1.totalPays)(500, [{ amount: 100 }, { amount: 100, fraction: 0.2 }, { fraction: 0.2 }])).toBe(300);
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
15
|
//# sourceMappingURL=financial.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"financial.spec.js","sourceRoot":"","sources":["../../../src/common/utils/financial/financial.spec.ts"],"names":[],"mappings":";;AAAA,qDAA6C;AAE7C,QAAQ,CAAC,mDAAmD,EAAE,GAAG,EAAE;IACjE,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;QACnB,MAAM,CAAC,IAAA,0BAAS,
|
|
1
|
+
{"version":3,"file":"financial.spec.js","sourceRoot":"","sources":["../../../src/common/utils/financial/financial.spec.ts"],"names":[],"mappings":";;AAAA,qDAA6C;AAE7C,QAAQ,CAAC,mDAAmD,EAAE,GAAG,EAAE;IACjE,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;QACnB,MAAM,CAAC,IAAA,0BAAS,EAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACjC,MAAM,CAAC,IAAA,0BAAS,EAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,CAAC,IAAA,0BAAS,EAAC,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpD,MAAM,CAAC,IAAA,0BAAS,EAAC,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtD,MAAM,CAAC,IAAA,0BAAS,EAAC,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnE,MAAM,CAAC,IAAA,0BAAS,EAAC,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpF,MAAM,CAAC,IAAA,0BAAS,EAAC,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzG,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Pay } from '../../interfaces/financial';
|
|
2
|
-
export declare const totalPays: (pairs?: Pick<Pay, "amount" | "fraction">[]
|
|
2
|
+
export declare const totalPays: (amount: number, pairs?: Pick<Pay, "amount" | "fraction">[]) => number;
|
|
@@ -1,24 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.totalPays = void 0;
|
|
4
|
-
const
|
|
4
|
+
const transfer_util_1 = require("./transfer.util");
|
|
5
|
+
const totalPays = (amount, pairs) => {
|
|
5
6
|
let total = 0;
|
|
6
7
|
if (!pairs?.length)
|
|
7
8
|
return amount;
|
|
8
|
-
for (const
|
|
9
|
-
|
|
10
|
-
throw new Error('amount or fraction must be defined');
|
|
11
|
-
if (typeof a === 'number')
|
|
12
|
-
if (!(a >= 0))
|
|
13
|
-
throw new Error('amount must be grater than or equal to zero');
|
|
14
|
-
if (typeof f === 'number')
|
|
15
|
-
if (!(f >= 0 && f <= 1))
|
|
16
|
-
throw new Error('fraction must be between zero and one');
|
|
17
|
-
if (typeof a === 'number' && typeof f === 'number')
|
|
18
|
-
if (!(a === f * amount))
|
|
19
|
-
throw new Error('amount and fraction are inconsistent');
|
|
20
|
-
total += a ?? f * amount;
|
|
21
|
-
}
|
|
9
|
+
for (const pair of pairs)
|
|
10
|
+
total += (0, transfer_util_1.payCalc)(pair, amount);
|
|
22
11
|
return total;
|
|
23
12
|
};
|
|
24
13
|
exports.totalPays = totalPays;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"financial.util.js","sourceRoot":"","sources":["../../../src/common/utils/financial/financial.util.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"financial.util.js","sourceRoot":"","sources":["../../../src/common/utils/financial/financial.util.ts"],"names":[],"mappings":";;;AACA,mDAA0C;AAEnC,MAAM,SAAS,GAAG,CAAC,MAAc,EAAE,KAA0C,EAAU,EAAE;IAC9F,IAAI,KAAK,GAAW,CAAC,CAAC;IACtB,IAAI,CAAC,KAAK,EAAE,MAAM;QAAE,OAAO,MAAM,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,KAAK,IAAI,IAAA,uBAAO,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AALW,QAAA,SAAS,aAKpB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Pay } from '../../interfaces/financial';
|
|
2
|
-
export declare const round: (val: number | string, precision
|
|
3
|
-
export declare const payCalc: (pay: Pick<Pay, "amount" | "fraction">, amount: number, precision
|
|
2
|
+
export declare const round: (val: number | string, precision?: number) => number;
|
|
3
|
+
export declare const payCalc: (pay: Pick<Pay, "amount" | "fraction">, amount: number, precision?: number) => number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.payCalc = exports.round = void 0;
|
|
4
|
-
const round = (val, precision) => +Number(val).toFixed(precision);
|
|
4
|
+
const round = (val, precision) => typeof precision === 'number' ? +Number(val).toFixed(precision) : Number(val);
|
|
5
5
|
exports.round = round;
|
|
6
6
|
const payCalc = (pay, amount, precision) => (0, exports.round)(pay.amount ?? (typeof pay.fraction === 'number' ? pay.fraction * amount : amount), precision);
|
|
7
7
|
exports.payCalc = payCalc;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer.util.js","sourceRoot":"","sources":["../../../src/common/utils/financial/transfer.util.ts"],"names":[],"mappings":";;;AAEO,MAAM,KAAK,GAAG,CAAC,GAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"transfer.util.js","sourceRoot":"","sources":["../../../src/common/utils/financial/transfer.util.ts"],"names":[],"mappings":";;;AAEO,MAAM,KAAK,GAAG,CAAC,GAAoB,EAAE,SAAkB,EAAU,EAAE,CACxE,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AADnE,QAAA,KAAK,SAC8D;AAEzE,MAAM,OAAO,GAAG,CAAC,GAAqC,EAAE,MAAc,EAAE,SAAkB,EAAU,EAAE,CAC3G,IAAA,aAAK,EAAC,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;AADzF,QAAA,OAAO,WACkF"}
|