@lyxa.ai/core 1.4.22 → 1.4.23

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.
@@ -5,10 +5,10 @@ interface AuthOptions {
5
5
  autoRefresh?: boolean;
6
6
  }
7
7
  export declare function createAuthenticatedProcedure(options: AuthOptions): import("@trpc/server").TRPCProcedureBuilder<import("../context").LyxaHTTPContext, object, {
8
+ req: import("http").IncomingMessage;
8
9
  res: import("http").ServerResponse<import("http").IncomingMessage>;
9
10
  tokenType: TokenType | undefined;
10
11
  entity: import("../context").EntityContext | undefined;
11
- req: import("http").IncomingMessage;
12
12
  requestId: string | undefined;
13
13
  usedRefreshToken: boolean | undefined;
14
14
  tokenRenewed: boolean | undefined;
@@ -4,10 +4,10 @@ interface RoleProtectedOptions {
4
4
  allowedRoles: string[];
5
5
  }
6
6
  export declare function createRoleProtectedProcedure(options: RoleProtectedOptions): import("@trpc/server").TRPCProcedureBuilder<import("../context").LyxaHTTPContext, object, {
7
+ req: import("http").IncomingMessage;
7
8
  res: import("http").ServerResponse<import("http").IncomingMessage>;
8
9
  tokenType: import("../../auth").TokenType | undefined;
9
10
  entity: import("../context").EntityContext | undefined;
10
- req: import("http").IncomingMessage;
11
11
  requestId: string | undefined;
12
12
  usedRefreshToken: boolean | undefined;
13
13
  tokenRenewed: boolean | undefined;
@@ -3,10 +3,10 @@ interface PhoneVerifiedOptions {
3
3
  entityTypes: AuthEntityType[];
4
4
  }
5
5
  export declare function createPhoneVerifiedProcedure(options: PhoneVerifiedOptions): import("@trpc/server").TRPCProcedureBuilder<import("../context").LyxaHTTPContext, object, {
6
+ req: import("http").IncomingMessage;
6
7
  res: import("http").ServerResponse<import("http").IncomingMessage>;
7
8
  tokenType: import("../../auth").TokenType | undefined;
8
9
  entity: import("../context").EntityContext | undefined;
9
- req: import("http").IncomingMessage;
10
10
  requestId: string | undefined;
11
11
  usedRefreshToken: boolean | undefined;
12
12
  tokenRenewed: boolean | undefined;
@@ -5,10 +5,10 @@ interface AuthOptions {
5
5
  autoRefresh?: boolean;
6
6
  }
7
7
  export declare function publicUserDecoder(options: AuthOptions): import("@trpc/server").TRPCProcedureBuilder<import("../context").LyxaHTTPContext, object, {
8
+ req: import("http").IncomingMessage;
8
9
  res: import("http").ServerResponse<import("http").IncomingMessage>;
9
10
  tokenType: TokenType | undefined;
10
11
  entity: import("../context").EntityContext | undefined;
11
- req: import("http").IncomingMessage;
12
12
  requestId: string | undefined;
13
13
  usedRefreshToken: boolean | undefined;
14
14
  tokenRenewed: boolean | undefined;
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.4.22
25
+ Version: 1.4.23
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.4.22",
3
+ "version": "1.4.23",
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",
@@ -26,8 +26,8 @@ export declare const FilterSchema: z.ZodOptional<z.ZodObject<{
26
26
  searchFields?: string[] | undefined;
27
27
  } | undefined;
28
28
  sort?: Record<string, 1 | -1> | undefined;
29
- select?: Record<string, 0 | 1> | undefined;
30
29
  populate?: any;
30
+ select?: Record<string, 0 | 1> | undefined;
31
31
  query?: Record<string, any> | undefined;
32
32
  }, {
33
33
  search?: {
@@ -36,8 +36,8 @@ export declare const FilterSchema: z.ZodOptional<z.ZodObject<{
36
36
  } | undefined;
37
37
  sort?: Record<string, 1 | -1> | undefined;
38
38
  size?: number | undefined;
39
- select?: Record<string, 0 | 1> | undefined;
40
39
  populate?: any;
40
+ select?: Record<string, 0 | 1> | undefined;
41
41
  query?: Record<string, any> | undefined;
42
42
  page?: number | undefined;
43
43
  }>>;
@@ -736,12 +736,12 @@ export declare const GetByIdInputSchema: z.ZodObject<{
736
736
  populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
737
737
  }, "strip", z.ZodTypeAny, {
738
738
  _id: import("mongoose").Types.ObjectId;
739
- select?: Record<string, 0 | 1> | undefined;
740
739
  populate?: any;
740
+ select?: Record<string, 0 | 1> | undefined;
741
741
  }, {
742
742
  _id: string | import("mongoose").Types.ObjectId;
743
- select?: Record<string, 0 | 1> | undefined;
744
743
  populate?: any;
744
+ select?: Record<string, 0 | 1> | undefined;
745
745
  }>;
746
746
  export type GetByIdInputDTO = DTO<typeof GetByIdInputSchema>;
747
747
  export declare const GetProductByIdInputSchema: z.ZodObject<{
@@ -754,12 +754,12 @@ export declare const GetProductByIdInputSchema: z.ZodObject<{
754
754
  _id: import("mongoose").Types.ObjectId;
755
755
  withAttributeHiddenItems: boolean;
756
756
  withAddonsHiddenItems: boolean;
757
- select?: Record<string, 0 | 1> | undefined;
758
757
  populate?: any;
758
+ select?: Record<string, 0 | 1> | undefined;
759
759
  }, {
760
760
  _id: string | import("mongoose").Types.ObjectId;
761
- select?: Record<string, 0 | 1> | undefined;
762
761
  populate?: any;
762
+ select?: Record<string, 0 | 1> | undefined;
763
763
  withAttributeHiddenItems?: boolean | undefined;
764
764
  withAddonsHiddenItems?: boolean | undefined;
765
765
  }>;
@@ -772,14 +772,14 @@ export declare const GetOrderByIdInputSchema: z.ZodObject<{
772
772
  userOrderCompletionScope: z.ZodOptional<z.ZodNativeEnum<typeof UserOrderCompletionScope>>;
773
773
  }, "strip", z.ZodTypeAny, {
774
774
  _id: import("mongoose").Types.ObjectId;
775
- select?: Record<string, 0 | 1> | undefined;
776
775
  populate?: any;
776
+ select?: Record<string, 0 | 1> | undefined;
777
777
  groupByCategories?: boolean | undefined;
778
778
  userOrderCompletionScope?: UserOrderCompletionScope | undefined;
779
779
  }, {
780
780
  _id: string | import("mongoose").Types.ObjectId;
781
- select?: Record<string, 0 | 1> | undefined;
782
781
  populate?: any;
782
+ select?: Record<string, 0 | 1> | undefined;
783
783
  groupByCategories?: boolean | undefined;
784
784
  userOrderCompletionScope?: UserOrderCompletionScope | undefined;
785
785
  }>;
@@ -788,11 +788,11 @@ export declare const GetByTokenInputSchema: z.ZodOptional<z.ZodObject<{
788
788
  select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
789
789
  populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
790
790
  }, "strip", z.ZodTypeAny, {
791
- select?: Record<string, 0 | 1> | undefined;
792
791
  populate?: any;
793
- }, {
794
792
  select?: Record<string, 0 | 1> | undefined;
793
+ }, {
795
794
  populate?: any;
795
+ select?: Record<string, 0 | 1> | undefined;
796
796
  }>>;
797
797
  export type GetByTokenInputDTO = DTO<typeof GetByTokenInputSchema>;
798
798
  export declare const GetOneQuerySchema: z.ZodObject<{
@@ -800,12 +800,12 @@ export declare const GetOneQuerySchema: z.ZodObject<{
800
800
  select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
801
801
  populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
802
802
  }, "strip", z.ZodTypeAny, {
803
- select?: Record<string, 0 | 1> | undefined;
804
803
  populate?: any;
804
+ select?: Record<string, 0 | 1> | undefined;
805
805
  query?: Record<string, any> | undefined;
806
806
  }, {
807
- select?: Record<string, 0 | 1> | undefined;
808
807
  populate?: any;
808
+ select?: Record<string, 0 | 1> | undefined;
809
809
  query?: Record<string, any> | undefined;
810
810
  }>;
811
811
  export type GetOneQueryDTO = DTO<typeof GetOneQuerySchema>;
@@ -9,5 +9,6 @@ type DayjsWithTimezone = {
9
9
  } & typeof dayjs;
10
10
  declare const dayjsWithTimezone: DayjsWithTimezone;
11
11
  export declare const _setTimezone: (timezone: string) => void;
12
+ export declare function isSameDay(date1: Date, date2: Date): boolean;
12
13
  export type { Dayjs };
13
14
  export default dayjsWithTimezone;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports._setTimezone = void 0;
7
+ exports.isSameDay = isSameDay;
7
8
  const dayjs_1 = __importDefault(require("dayjs"));
8
9
  const utc_1 = __importDefault(require("dayjs/plugin/utc"));
9
10
  const minMax_1 = __importDefault(require("dayjs/plugin/minMax"));
@@ -37,5 +38,8 @@ const _setTimezone = (timezone) => {
37
38
  DEFAULT_TIMEZONE = timezone;
38
39
  };
39
40
  exports._setTimezone = _setTimezone;
41
+ function isSameDay(date1, date2) {
42
+ return dayjs_1.default.utc(date1).isSame(dayjs_1.default.utc(date2), 'day');
43
+ }
40
44
  exports.default = dayjsWithTimezone;
41
45
  //# sourceMappingURL=dayjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dayjs.js","sourceRoot":"/","sources":["utilities/dayjs/dayjs.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAqC;AACrC,2DAAmC;AACnC,iEAAyC;AACzC,qEAA6C;AAC7C,qEAA6C;AAC7C,kCAAmD;AAEnD,eAAK,CAAC,MAAM,CAAC,aAAG,CAAC,CAAC;AAClB,eAAK,CAAC,MAAM,CAAC,kBAAQ,CAAC,CAAC;AACvB,eAAK,CAAC,MAAM,CAAC,gBAAM,CAAC,CAAC;AACrB,eAAK,CAAC,MAAM,CAAC,kBAAQ,CAAC,CAAC;AAEvB,IAAI,gBAAgB,GAAG,aAAa,CAAC;AAWrC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAU,EAAE,MAAY,EAAE,EAAW,EAAE,EAAE;IACpE,MAAM,cAAc,GAAG,EAAE,IAAI,gBAAgB,CAAC;IAE9C,IAAA,+BAAwB,EAAC,cAAc,CAAC,CAAC;IAEzC,IAAI,MAAM,EAAE,CAAC;QACZ,OAAO,IAAA,eAAK,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,IAAA,eAAK,EAAC,IAAI,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC;AACvC,CAAC,CAAsB,CAAC;AAExB,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;IAC/B,iBAAyB,CAAC,GAAG,CAAC,GAAI,eAAa,CAAC,GAAG,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,WAAW,GAAG,CAAC,QAAgB,EAAE,EAAE;IACpD,gBAAgB,GAAG,QAAQ,CAAC;AAC7B,CAAC,CAAC;AAEF,iBAAiB,CAAC,WAAW,GAAG,GAAG,EAAE,CAAC,gBAAgB,CAAC;AAEvD,iBAAiB,CAAC,GAAG,GAAG,eAAK,CAAC,GAAG,CAAC;AAClC,iBAAiB,CAAC,GAAG,GAAG,eAAK,CAAC,GAAG,CAAC;AAClC,iBAAiB,CAAC,QAAQ,GAAG,eAAK,CAAC,QAAQ,CAAC;AAErC,MAAM,YAAY,GAAG,CAAC,QAAgB,EAAE,EAAE;IAChD,gBAAgB,GAAG,QAAQ,CAAC;AAC7B,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAGF,kBAAe,iBAAiB,CAAC","sourcesContent":["import dayjs, { Dayjs } from 'dayjs';\nimport utc from 'dayjs/plugin/utc';\nimport minMax from 'dayjs/plugin/minMax';\nimport timezone from 'dayjs/plugin/timezone';\nimport duration from 'dayjs/plugin/duration';\nimport { _setLyxaTimezoneVariable } from '../time';\n\ndayjs.extend(utc);\ndayjs.extend(timezone);\ndayjs.extend(minMax);\ndayjs.extend(duration);\n\nlet DEFAULT_TIMEZONE = 'Asia/Beirut';\n\ntype DayjsWithTimezone = {\n\t(date?: any, format?: any, tz?: string): Dayjs;\n\tsetTimezone(timezone: string): void;\n\tgetTimezone(): string;\n\tmax(...dates: (Dayjs | undefined)[]): Dayjs;\n\tmin(...dates: (Dayjs | undefined)[]): Dayjs;\n\tduration: typeof dayjs.duration;\n} & typeof dayjs;\n\nconst dayjsWithTimezone = ((date?: any, format?: any, tz?: string) => {\n\tconst targetTimezone = tz || DEFAULT_TIMEZONE;\n\n\t_setLyxaTimezoneVariable(targetTimezone);\n\n\tif (format) {\n\t\treturn dayjs(date, format).tz(targetTimezone);\n\t}\n\treturn dayjs(date).tz(targetTimezone);\n}) as DayjsWithTimezone;\n\nObject.keys(dayjs).forEach(key => {\n\t(dayjsWithTimezone as any)[key] = (dayjs as any)[key];\n});\n\ndayjsWithTimezone.setTimezone = (timezone: string) => {\n\tDEFAULT_TIMEZONE = timezone;\n};\n\ndayjsWithTimezone.getTimezone = () => DEFAULT_TIMEZONE;\n\ndayjsWithTimezone.max = dayjs.max;\ndayjsWithTimezone.min = dayjs.min;\ndayjsWithTimezone.duration = dayjs.duration;\n\nexport const _setTimezone = (timezone: string) => {\n\tDEFAULT_TIMEZONE = timezone;\n};\n\nexport type { Dayjs };\nexport default dayjsWithTimezone;\n"]}
1
+ {"version":3,"file":"dayjs.js","sourceRoot":"/","sources":["utilities/dayjs/dayjs.ts"],"names":[],"mappings":";;;;;;AAoDA,8BAEC;AAtDD,kDAAqC;AACrC,2DAAmC;AACnC,iEAAyC;AACzC,qEAA6C;AAC7C,qEAA6C;AAC7C,kCAAmD;AAEnD,eAAK,CAAC,MAAM,CAAC,aAAG,CAAC,CAAC;AAClB,eAAK,CAAC,MAAM,CAAC,kBAAQ,CAAC,CAAC;AACvB,eAAK,CAAC,MAAM,CAAC,gBAAM,CAAC,CAAC;AACrB,eAAK,CAAC,MAAM,CAAC,kBAAQ,CAAC,CAAC;AAEvB,IAAI,gBAAgB,GAAG,aAAa,CAAC;AAWrC,MAAM,iBAAiB,GAAG,CAAC,C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,CAAC","sourcesContent":["import dayjs, { Dayjs } from 'dayjs';\nimport utc from 'dayjs/plugin/utc';\nimport minMax from 'dayjs/plugin/minMax';\nimport timezone from 'dayjs/plugin/timezone';\nimport duration from 'dayjs/plugin/duration';\nimport { _setLyxaTimezoneVariable } from '../time';\n\ndayjs.extend(utc);\ndayjs.extend(timezone);\ndayjs.extend(minMax);\ndayjs.extend(duration);\n\nlet DEFAULT_TIMEZONE = 'Asia/Beirut';\n\ntype DayjsWithTimezone = {\n\t(date?: any, format?: any, tz?: string): Dayjs;\n\tsetTimezone(timezone: string): void;\n\tgetTimezone(): string;\n\tmax(...dates: (Dayjs | undefined)[]): Dayjs;\n\tmin(...dates: (Dayjs | undefined)[]): Dayjs;\n\tduration: typeof dayjs.duration;\n} & typeof dayjs;\n\nconst dayjsWithTimezone = ((date?: any, format?: any, tz?: string) => {\n\tconst targetTimezone = tz || DEFAULT_TIMEZONE;\n\n\t_setLyxaTimezoneVariable(targetTimezone);\n\n\tif (format) {\n\t\treturn dayjs(date, format).tz(targetTimezone);\n\t}\n\treturn dayjs(date).tz(targetTimezone);\n}) as DayjsWithTimezone;\n\nObject.keys(dayjs).forEach(key => {\n\t(dayjsWithTimezone as any)[key] = (dayjs as any)[key];\n});\n\ndayjsWithTimezone.setTimezone = (timezone: string) => {\n\tDEFAULT_TIMEZONE = timezone;\n};\n\ndayjsWithTimezone.getTimezone = () => DEFAULT_TIMEZONE;\n\ndayjsWithTimezone.max = dayjs.max;\ndayjsWithTimezone.min = dayjs.min;\ndayjsWithTimezone.duration = dayjs.duration;\n\nexport const _setTimezone = (timezone: string) => {\n\tDEFAULT_TIMEZONE = timezone;\n};\n\nexport function isSameDay(date1: Date, date2: Date): boolean {\n\treturn dayjs.utc(date1).isSame(dayjs.utc(date2), 'day');\n}\n\nexport type { Dayjs };\nexport default dayjsWithTimezone;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/core",
3
- "version": "1.4.22",
3
+ "version": "1.4.23",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -68,4 +68,4 @@
68
68
  "@types/ws": "^8.18.1",
69
69
  "prettier": "3.5.3"
70
70
  }
71
- }
71
+ }