@lyxa.ai/core 1.0.239 → 1.0.240
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/dist/types/README.md +1 -1
- package/dist/types/package.json +1 -1
- package/dist/utilities/pipelines/common-pipeline-functions.d.ts +5 -0
- package/dist/utilities/pipelines/common-pipeline-functions.js +29 -0
- package/dist/utilities/pipelines/common-pipeline-functions.js.map +1 -0
- package/package.json +1 -1
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSecondaryCurrencyStage = void 0;
|
|
4
|
+
const getSecondaryCurrencyStage = ({ valuePath, exchangeRate, roundTo, }) => {
|
|
5
|
+
return {
|
|
6
|
+
$cond: [
|
|
7
|
+
{ $ifNull: [valuePath, false] },
|
|
8
|
+
{
|
|
9
|
+
$function: {
|
|
10
|
+
body: function (price, exchangeRate, roundTo) {
|
|
11
|
+
if (price == null)
|
|
12
|
+
return null;
|
|
13
|
+
const amount = price * exchangeRate;
|
|
14
|
+
if (!roundTo)
|
|
15
|
+
return amount;
|
|
16
|
+
const rounded = Math.ceil(amount / roundTo) * roundTo;
|
|
17
|
+
const decimals = (roundTo.toString().split('.')[1] || '').length;
|
|
18
|
+
return Number(rounded.toFixed(decimals));
|
|
19
|
+
}.toString(),
|
|
20
|
+
args: [valuePath, exchangeRate, roundTo],
|
|
21
|
+
lang: 'js',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
null,
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
exports.getSecondaryCurrencyStage = getSecondaryCurrencyStage;
|
|
29
|
+
//# sourceMappingURL=common-pipeline-functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-pipeline-functions.js","sourceRoot":"/","sources":["utilities/pipelines/common-pipeline-functions.ts"],"names":[],"mappings":";;;AAAO,MAAM,yBAAyB,GAAG,CAAC,EACzC,SAAS,EACT,YAAY,EACZ,OAAO,GAKP,EAAO,EAAE;IACT,OAAO;QACN,KAAK,EAAE;YACN,EAAE,OAAO,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE;YAC/B;gBACC,SAAS,EAAE;oBACV,IAAI,EAAE,UAAU,KAAa,EAAE,YAAoB,EAAE,OAAe;wBACnE,IAAI,KAAK,IAAI,IAAI;4BAAE,OAAO,IAAI,CAAC;wBAC/B,MAAM,MAAM,GAAG,KAAK,GAAG,YAAY,CAAC;wBACpC,IAAI,CAAC,OAAO;4BAAE,OAAO,MAAM,CAAC;wBAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC;wBACtD,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;wBACjE,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAC1C,CAAC,CAAC,QAAQ,EAAE;oBACZ,IAAI,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,OAAO,CAAC;oBACxC,IAAI,EAAE,IAAI;iBACV;aACD;YACD,IAAI;SACJ;KACD,CAAC;AACH,CAAC,CAAC;AA7BW,QAAA,yBAAyB,6BA6BpC","sourcesContent":["export const getSecondaryCurrencyStage = ({\n\tvaluePath,\n\texchangeRate,\n\troundTo,\n}: {\n\tvaluePath: string;\n\texchangeRate: number;\n\troundTo: number;\n}): any => {\n\treturn {\n\t\t$cond: [\n\t\t\t{ $ifNull: [valuePath, false] },\n\t\t\t{\n\t\t\t\t$function: {\n\t\t\t\t\tbody: function (price: number, exchangeRate: number, roundTo: number) {\n\t\t\t\t\t\tif (price == null) return null;\n\t\t\t\t\t\tconst amount = price * exchangeRate;\n\t\t\t\t\t\tif (!roundTo) return amount;\n\t\t\t\t\t\tconst rounded = Math.ceil(amount / roundTo) * roundTo;\n\t\t\t\t\t\tconst decimals = (roundTo.toString().split('.')[1] || '').length;\n\t\t\t\t\t\treturn Number(rounded.toFixed(decimals));\n\t\t\t\t\t}.toString(),\n\t\t\t\t\targs: [valuePath, exchangeRate, roundTo],\n\t\t\t\t\tlang: 'js',\n\t\t\t\t},\n\t\t\t},\n\t\t\tnull,\n\t\t],\n\t};\n};\n"]}
|