@wenex/sdk 1.0.30 → 1.0.32

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.
@@ -15,7 +15,7 @@ export type Pagination<T = Core> = {
15
15
  limit?: number;
16
16
  skip?: number;
17
17
  sort?: {
18
- [key in keyof T]: SortOrder | {
18
+ [key in keyof T]?: SortOrder | {
19
19
  $meta: 'textScore';
20
20
  };
21
21
  };
@@ -1 +1,2 @@
1
1
  export * from './response-type.enum';
2
+ export * from './sso-source.enum';
@@ -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,3 @@
1
+ export declare enum SsoSource {
2
+ google = "google"
3
+ }
@@ -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(0);
7
- expect((0, financial_util_1.totalPays)([], 100)).toBe(100);
8
- expect((0, financial_util_1.totalPays)([{ amount: 100 }])).toBe(100);
9
- expect((0, financial_util_1.totalPays)([{ fraction: 0.2 }], 500)).toBe(100);
10
- expect((0, financial_util_1.totalPays)([{ amount: 100, fraction: 0.2 }], 500)).toBe(100);
11
- expect((0, financial_util_1.totalPays)([{ amount: 100 }, { amount: 100, fraction: 0.2 }], 500)).toBe(200);
12
- expect((0, financial_util_1.totalPays)([{ amount: 100 }, { amount: 100, fraction: 0.2 }, { fraction: 0.2 }], 500)).toBe(300);
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,GAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5B,MAAM,CAAC,IAAA,0BAAS,EAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,CAAC,IAAA,0BAAS,EAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,MAAM,CAAC,IAAA,0BAAS,EAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtD,MAAM,CAAC,IAAA,0BAAS,EAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnE,MAAM,CAAC,IAAA,0BAAS,EAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpF,MAAM,CAAC,IAAA,0BAAS,EAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,QA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AS,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">[], amount?: number) => number;
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 totalPays = (pairs, amount = 0) => {
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 { amount: a, fraction: f } of pairs) {
9
- if (!(typeof a === 'number' || typeof f === 'number'))
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":";;;AAEO,MAAM,SAAS,GAAG,CAAC,KAA0C,EAAE,MAAM,GAAG,CAAC,EAAU,EAAE;IAC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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: number) => number;
3
- export declare const payCalc: (pay: Pick<Pay, "amount" | "fraction">, amount: number, precision: number) => number;
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,SAAiB,EAAU,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAA7F,QAAA,KAAK,SAAwF;AAEnG,MAAM,OAAO,GAAG,CAAC,GAAqC,EAAE,MAAc,EAAE,SAAiB,EAAU,EAAE,CAC1G,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"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wenex/sdk",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "Wenex SDK",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",