@lyxa.ai/core 1.2.92 → 1.2.93-beta.1

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.
@@ -4,8 +4,6 @@ import { Order } from '../order.model';
4
4
  export declare class ReplacementOrder {
5
5
  originalOrder: Ref<Order>;
6
6
  replacementType: ReplacementType;
7
- deliveryFee?: number;
8
- secondaryDeliveryFee?: number;
9
7
  replacementByShopForItems?: number;
10
8
  secondaryReplacementByShopForItems?: number;
11
9
  replacementByShopForDelivery?: number;
@@ -14,7 +12,5 @@ export declare class ReplacementOrder {
14
12
  secondaryReplacementByCompanyForItems?: number;
15
13
  replacementByCompanyForDelivery?: number;
16
14
  secondaryReplacementByCompanyForDelivery?: number;
17
- totalAmount?: number;
18
- secondaryTotalAmount?: number;
19
15
  bringItem?: string;
20
16
  }
@@ -16,8 +16,6 @@ const order_model_1 = require("../order.model");
16
16
  class ReplacementOrder {
17
17
  originalOrder;
18
18
  replacementType;
19
- deliveryFee;
20
- secondaryDeliveryFee;
21
19
  replacementByShopForItems;
22
20
  secondaryReplacementByShopForItems;
23
21
  replacementByShopForDelivery;
@@ -26,8 +24,6 @@ class ReplacementOrder {
26
24
  secondaryReplacementByCompanyForItems;
27
25
  replacementByCompanyForDelivery;
28
26
  secondaryReplacementByCompanyForDelivery;
29
- totalAmount;
30
- secondaryTotalAmount;
31
27
  bringItem;
32
28
  }
33
29
  exports.ReplacementOrder = ReplacementOrder;
@@ -39,14 +35,6 @@ __decorate([
39
35
  (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ReplacementType }),
40
36
  __metadata("design:type", String)
41
37
  ], ReplacementOrder.prototype, "replacementType", void 0);
42
- __decorate([
43
- (0, typegoose_1.prop)({ type: Number, default: 0 }),
44
- __metadata("design:type", Number)
45
- ], ReplacementOrder.prototype, "deliveryFee", void 0);
46
- __decorate([
47
- (0, typegoose_1.prop)({ type: Number, default: 0 }),
48
- __metadata("design:type", Number)
49
- ], ReplacementOrder.prototype, "secondaryDeliveryFee", void 0);
50
38
  __decorate([
51
39
  (0, typegoose_1.prop)({ type: Number, default: 0 }),
52
40
  __metadata("design:type", Number)
@@ -79,14 +67,6 @@ __decorate([
79
67
  (0, typegoose_1.prop)({ type: Number, default: 0 }),
80
68
  __metadata("design:type", Number)
81
69
  ], ReplacementOrder.prototype, "secondaryReplacementByCompanyForDelivery", void 0);
82
- __decorate([
83
- (0, typegoose_1.prop)({ type: Number, default: 0 }),
84
- __metadata("design:type", Number)
85
- ], ReplacementOrder.prototype, "totalAmount", void 0);
86
- __decorate([
87
- (0, typegoose_1.prop)({ type: Number, default: 0 }),
88
- __metadata("design:type", Number)
89
- ], ReplacementOrder.prototype, "secondaryTotalAmount", void 0);
90
70
  __decorate([
91
71
  (0, typegoose_1.prop)({ type: String }),
92
72
  __metadata("design:type", String)
@@ -1 +1 @@
1
- {"version":3,"file":"replacement-order.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/replacement-order.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAA6D;AAC7D,gDAAuC;AAEvC,MAAa,gBAAgB;IAErB,aAAa,CAAc;IAG3B,eAAe,CAAkB;IAGjC,WAAW,CAAU;IAGrB,oBAAoB,CAAU;IAG9B,yBAAyB,CAAU;IAGnC,kCAAkC,CAAU;IAG5C,4BAA4B,CAAU;IAGtC,qCAAqC,CAAU;IAG/C,4BAA4B,CAAU;IAGtC,qCAAqC,CAAU;IAG/C,+BAA+B,CAAU;IAGzC,wCAAwC,CAAU;IAGlD,WAAW,CAAU;IAGrB,oBAAoB,CAAU;IAG9B,SAAS,CAAU;CAC1B;AA7CD,4CA6CC;AA3CO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;uDACT;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IA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AAE,CAAC;;8DACE;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACG","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { ReplacementType } from '../../../../utilities/enum';\nimport { Order } from '../order.model';\n\nexport class ReplacementOrder {\n\t@prop({ required: true, ref: () => Order })\n\tpublic originalOrder!: Ref<Order>;\n\n\t@prop({ required: true, type: String, enum: ReplacementType })\n\tpublic replacementType: ReplacementType;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic deliveryFee?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryDeliveryFee?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByShopForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByShopForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByShopForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByShopForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByCompanyForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByCompanyForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByCompanyForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByCompanyForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic totalAmount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryTotalAmount?: number;\n\n\t@prop({ type: String })\n\tpublic bringItem?: string;\n}\n"]}
1
+ {"version":3,"file":"replacement-order.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/replacement-order.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAA6D;AAC7D,gDAAuC;AAEvC,MAAa,gBAAgB;IAErB,aAAa,CAAc;IAG3B,eAAe,CAAkB;IAGjC,yBAAyB,CAAU;IAGn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lD;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACG","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { ReplacementType } from '../../../../utilities/enum';\nimport { Order } from '../order.model';\n\nexport class ReplacementOrder {\n\t@prop({ required: true, ref: () => Order })\n\tpublic originalOrder!: Ref<Order>;\n\n\t@prop({ required: true, type: String, enum: ReplacementType })\n\tpublic replacementType: ReplacementType;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByShopForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByShopForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByShopForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByShopForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByCompanyForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByCompanyForItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic replacementByCompanyForDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReplacementByCompanyForDelivery?: number;\n\n\t@prop({ type: String })\n\tpublic bringItem?: string;\n}\n"]}
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.2.92
25
+ Version: 1.2.93-beta.1
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.2.92",
3
+ "version": "1.2.93-beta.1",
4
4
  "description": "Lyxa type definitions and validation schemas for both frontend and backend",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -0,0 +1,3 @@
1
+ import dayjs from 'dayjs';
2
+ declare const dayjsWithTimezone: (date?: any, format?: any, tz?: string) => dayjs.Dayjs;
3
+ export default dayjsWithTimezone;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const dayjs_1 = __importDefault(require("dayjs"));
7
+ const utc_1 = __importDefault(require("dayjs/plugin/utc"));
8
+ const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
9
+ dayjs_1.default.extend(utc_1.default);
10
+ dayjs_1.default.extend(timezone_1.default);
11
+ let DEFAULT_TIMEZONE = process.env.TIMEZONE || 'UTC';
12
+ const dayjsWithTimezone = (date, format, tz) => {
13
+ const targetTimezone = tz || DEFAULT_TIMEZONE;
14
+ if (format) {
15
+ return (0, dayjs_1.default)(date, format).tz(targetTimezone);
16
+ }
17
+ return (0, dayjs_1.default)(date).tz(targetTimezone);
18
+ };
19
+ Object.keys(dayjs_1.default).forEach(key => {
20
+ dayjsWithTimezone[key] = dayjs_1.default[key];
21
+ });
22
+ dayjsWithTimezone.setDefaultTimezone = (timezone) => {
23
+ DEFAULT_TIMEZONE = timezone;
24
+ };
25
+ dayjsWithTimezone.getDefaultTimezone = () => {
26
+ return DEFAULT_TIMEZONE;
27
+ };
28
+ exports.default = dayjsWithTimezone;
29
+ //# sourceMappingURL=dayjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dayjs.js","sourceRoot":"/","sources":["utilities/dayjs/dayjs.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAC1B,2DAAmC;AACnC,qEAA6C;AAG7C,eAAK,CAAC,MAAM,CAAC,aAAG,CAAC,CAAC;AAClB,eAAK,CAAC,MAAM,CAAC,kBAAQ,CAAC,CAAC;AAGvB,IAAI,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,KAAK,CAAC;AAGrD,MAAM,iBAAiB,GAAG,CAAC,IAAU,EAAE,MAAY,EAAE,EAAW,EAAE,EAAE;IAClE,MAAM,cAAc,GAAG,EAAE,IAAI,gBAAgB,CAAC;IAE9C,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,IAAA,eAAK,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC;AACxC,CAAC,CAAC;AAGF,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;IAC9B,iBAAyB,CAAC,GAAG,CAAC,GAAI,eAAa,CAAC,GAAG,CAAC,CAAC;AACxD,CAAC,CAAC,CAAC;AAGF,iBAAyB,CAAC,kBAAkB,GAAG,CAAC,QAAgB,EAAE,EAAE;IACnE,gBAAgB,GAAG,QAAQ,CAAC;AAC9B,CAAC,CAAC;AAGD,iBAAyB,CAAC,kBAAkB,GAAG,GAAG,EAAE;IACnD,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF,kBAAe,iBAAiB,CAAC","sourcesContent":["import dayjs from 'dayjs';\nimport utc from 'dayjs/plugin/utc';\nimport timezone from 'dayjs/plugin/timezone';\n\n// Extend dayjs with timezone support\ndayjs.extend(utc);\ndayjs.extend(timezone);\n\n// Set default timezone (change as needed)\nlet DEFAULT_TIMEZONE = process.env.TIMEZONE || 'UTC';\n\n// Override the default dayjs to support optional timezone parameter\nconst dayjsWithTimezone = (date?: any, format?: any, tz?: string) => {\n const targetTimezone = tz || DEFAULT_TIMEZONE;\n \n if (format) {\n return dayjs(date, format).tz(targetTimezone);\n }\n return dayjs(date).tz(targetTimezone);\n};\n\n// Copy all static methods from dayjs\nObject.keys(dayjs).forEach(key => {\n (dayjsWithTimezone as any)[key] = (dayjs as any)[key];\n});\n\n// Add method to set default timezone\n(dayjsWithTimezone as any).setDefaultTimezone = (timezone: string) => {\n DEFAULT_TIMEZONE = timezone;\n};\n\n// Add method to get default timezone\n(dayjsWithTimezone as any).getDefaultTimezone = () => {\n return DEFAULT_TIMEZONE;\n};\n\nexport default dayjsWithTimezone;"]}
@@ -0,0 +1 @@
1
+ export { default as dayjs } from './dayjs';
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.dayjs = void 0;
7
+ var dayjs_1 = require("./dayjs");
8
+ Object.defineProperty(exports, "dayjs", { enumerable: true, get: function () { return __importDefault(dayjs_1).default; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["utilities/dayjs/index.ts"],"names":[],"mappings":";;;;;;AAAA,iCAA2C;AAAlC,+GAAA,OAAO,OAAS","sourcesContent":["export { default as dayjs } from './dayjs';\n"]}
@@ -6,7 +6,24 @@ const getRoundBaseCurrencyStage = (value) => {
6
6
  $cond: [
7
7
  { $ne: [value, null] },
8
8
  {
9
- $round: [value, 2],
9
+ $divide: [
10
+ {
11
+ $floor: {
12
+ $add: [
13
+ {
14
+ $multiply: [
15
+ {
16
+ $round: [value, 10],
17
+ },
18
+ 100,
19
+ ],
20
+ },
21
+ 0.5,
22
+ ],
23
+ },
24
+ },
25
+ 100,
26
+ ],
10
27
  },
11
28
  0,
12
29
  ],
@@ -20,7 +37,19 @@ const getRoundSecondaryCurrencyStage = (value) => {
20
37
  {
21
38
  $multiply: [
22
39
  {
23
- $round: [{ $divide: [value, 1000] }, 0],
40
+ $floor: {
41
+ $add: [
42
+ {
43
+ $divide: [
44
+ {
45
+ $round: [value, 5],
46
+ },
47
+ 1000,
48
+ ],
49
+ },
50
+ 0.5,
51
+ ],
52
+ },
24
53
  },
25
54
  1000,
26
55
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"common-pipeline-functions.js","sourceRoot":"/","sources":["utilities/pipelines/common-pipeline-functions.ts"],"names":[],"mappings":";;;AAQO,MAAM,yBAAyB,GAAG,CAAC,KAAU,EAAuB,EAAE;IAC5E,OAAO;QACN,KAAK,EAAE;YACN,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;YACtB;gBACC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;aAClB;YACD,CAAC;SACD;KACD,CAAC;AACH,CAAC,CAAC;AAVW,QAAA,yBAAyB,6BAUpC;AAcK,MAAM,8BAA8B,GAAG,CAAC,KAAU,EAAuB,EAAE;IACjF,OAAO;QACN,KAAK,EAAE;YACN,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;YACtB;gBACC,SAAS,EAAE;oBACV;wBACC,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;qBACvC;oBACD,IAAI;iBACJ;aACD;YACD,CAAC;SACD;KACD,CAAC;AACH,CAAC,CAAC;AAfW,QAAA,8BAA8B,kCAezC","sourcesContent":["/**\n * Rounds a base currency value to 2 decimal places inside an aggregation pipeline.\n *\n * ✅ Use when:\n * - You want to round a monetary value like USD, BDT, etc. to 2 decimals.\n *\n * Example: 123.456 → 123.46\n */\nexport const getRoundBaseCurrencyStage = (value: any): Record<string, any> => {\n\treturn {\n\t\t$cond: [\n\t\t\t{ $ne: [value, null] },\n\t\t\t{\n\t\t\t\t$round: [value, 2],\n\t\t\t},\n\t\t\t0,\n\t\t],\n\t};\n};\n\n/**\n * Rounds a numeric value to the nearest thousand (secondary currency rounding).\n *\n * ✅ Use when:\n * - You’re working with a secondary currency (e.g., large denomination or summary view)\n * - You want rounding like: 123456 → 123000\n *\n * 🧠 Logic:\n * - Divide by 1000\n * - Round to nearest integer\n * - Multiply back by 1000\n */\nexport const getRoundSecondaryCurrencyStage = (value: any): Record<string, any> => {\n\treturn {\n\t\t$cond: [\n\t\t\t{ $ne: [value, null] },\n\t\t\t{\n\t\t\t\t$multiply: [\n\t\t\t\t\t{\n\t\t\t\t\t\t$round: [{ $divide: [value, 1000] }, 0],\n\t\t\t\t\t},\n\t\t\t\t\t1000,\n\t\t\t\t],\n\t\t\t},\n\t\t\t0,\n\t\t],\n\t};\n};\n"]}
1
+ {"version":3,"file":"common-pipeline-functions.js","sourceRoot":"/","sources":["utilities/pipelines/common-pipeline-functions.ts"],"names":[],"mappings":";;;AAQO,MAAM,yBAAyB,GAAG,CAAC,KAAU,EAAuB,EAAE;IAC5E,OAAO;QACN,KAAK,EAAE;YACN,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;YACtB;gBACC,OAAO,EAAE;oBACR;wBACC,MAAM,EAAE;4BACP,IAAI,EAAE;gCACL;oCACC,SAAS,EAAE;wCACV;4CACC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC;yCACnB;wCACD,GAAG;qCACH;iCACD;gCACD,GAAG;6BACH;yBACD;qBACD;oBACD,GAAG;iBACH;aACD;YACD,CAAC;SACD;KACD,CAAC;AACH,CAAC,CAAC;AA3BW,QAAA,yBAAyB,6BA2BpC;AAgBK,MAAM,8BAA8B,GAAG,CAAC,KAAU,EAAuB,EAAE;IACjF,OAAO;QACN,KAAK,EAAE;YACN,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;YACtB;gBACC,SAAS,EAAE;oBACV;wBACC,MAAM,EAAE;4BACP,IAAI,EAAE;gCACL;oCACC,OAAO,EAAE;wCACR;4CACC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;yCAClB;wCACD,IAAI;qCACJ;iCACD;gCACD,GAAG;6BACH;yBACD;qBACD;oBACD,IAAI;iBACJ;aACD;YACD,CAAC;SACD;KACD,CAAC;AACH,CAAC,CAAC;AA3BW,QAAA,8BAA8B,kCA2BzC","sourcesContent":["/**\n * Rounds a base currency value to 2 decimal places inside an aggregation pipeline.\n *\n * ✅ Use when:\n * - You want to round a monetary value like USD, BDT, etc. to 2 decimals.\n *\n * Example: 123.456 → 123.46\n */\nexport const getRoundBaseCurrencyStage = (value: any): Record<string, any> => {\n\treturn {\n\t\t$cond: [\n\t\t\t{ $ne: [value, null] },\n\t\t\t{\n\t\t\t\t$divide: [\n\t\t\t\t\t{\n\t\t\t\t\t\t$floor: {\n\t\t\t\t\t\t\t$add: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$multiply: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t$round: [value, 10],\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t100,\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t0.5,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t100,\n\t\t\t\t],\n\t\t\t},\n\t\t\t0,\n\t\t],\n\t};\n};\n\n/**\n * Rounds a numeric value to the nearest thousand (secondary currency rounding).\n *\n * ✅ Use when:\n * - You’re working with a secondary currency (e.g., large denomination or summary view)\n * - You want rounding like: 123456 → 123000\n *\n * 🧠 Logic:\n * - Round -> Clean Up Epsilon\n * - Divide by 1000\n * - Add 0.5\n * - Take Floor\n * - Multiply back by 1000\n */\nexport const getRoundSecondaryCurrencyStage = (value: any): Record<string, any> => {\n\treturn {\n\t\t$cond: [\n\t\t\t{ $ne: [value, null] },\n\t\t\t{\n\t\t\t\t$multiply: [\n\t\t\t\t\t{\n\t\t\t\t\t\t$floor: {\n\t\t\t\t\t\t\t$add: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$divide: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t$round: [value, 5],\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t1000,\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t0.5,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t1000,\n\t\t\t\t],\n\t\t\t},\n\t\t\t0,\n\t\t],\n\t};\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/core",
3
- "version": "1.2.92",
3
+ "version": "1.2.93-beta.1",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",