@lyxa.ai/core 1.4.209 → 1.4.210
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/libraries/redis/cached.decorator.d.ts +1 -0
- package/dist/libraries/redis/cached.decorator.js +23 -0
- package/dist/libraries/redis/cached.decorator.js.map +1 -0
- package/dist/libraries/trpc/middlewares/auth.d.ts +1 -1
- package/dist/libraries/trpc/middlewares/createRoleProtectedProcedure.d.ts +1 -1
- package/dist/libraries/trpc/middlewares/phone-verified.d.ts +1 -1
- package/dist/libraries/trpc/middlewares/publicUserDecoder.d.ts +1 -1
- package/dist/types/README.md +1 -1
- package/dist/types/package.json +1 -1
- package/dist/types/utilities/validation/common-validation.d.ts +12 -12
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Cached(key: string | ((...args: any[]) => string), ttl?: number): (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Cached = Cached;
|
|
4
|
+
const typedi_1 = require("typedi");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
function Cached(key, ttl = 300) {
|
|
7
|
+
return function (_target, _propertyKey, descriptor) {
|
|
8
|
+
const original = descriptor.value;
|
|
9
|
+
descriptor.value = async function (...args) {
|
|
10
|
+
const redisService = typedi_1.Container.get(_1.RedisService);
|
|
11
|
+
const cacheKey = typeof key === 'function' ? key(...args) : key;
|
|
12
|
+
const cached = await redisService.getCachedObject(cacheKey);
|
|
13
|
+
if (cached !== undefined)
|
|
14
|
+
return cached;
|
|
15
|
+
const result = await original.apply(this, args);
|
|
16
|
+
if (result != null)
|
|
17
|
+
await redisService.cacheObject(cacheKey, result, ttl);
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
20
|
+
return descriptor;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=cached.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cached.decorator.js","sourceRoot":"/","sources":["libraries/redis/cached.decorator.ts"],"names":[],"mappings":";;AAGA,wBAkBC;AArBD,mCAAmC;AACnC,wBAAiC;AAEjC,SAAgB,MAAM,CAAC,GAA0C,EAAE,GAAG,GAAG,GAAG;IAC3E,OAAO,UAAU,OAAY,EAAE,YAAoB,EAAE,UAA8B;QAClF,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;QAElC,UAAU,CAAC,KAAK,GAAG,KAAK,WAAW,GAAG,IAAW;YAChD,MAAM,YAAY,GAAG,kBAAS,CAAC,GAAG,CAAC,eAAY,CAAC,CAAC;YACjD,MAAM,QAAQ,GAAG,OAAO,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;YAEhE,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;YAC5D,IAAI,MAAM,KAAK,SAAS;gBAAE,OAAO,MAAM,CAAC;YAExC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAChD,IAAI,MAAM,IAAI,IAAI;gBAAE,MAAM,YAAY,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;YAC1E,OAAO,MAAM,CAAC;QACf,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACnB,CAAC,CAAC;AACH,CAAC","sourcesContent":["import { Container } from 'typedi';\nimport { RedisService } from '.';\n\nexport function Cached(key: string | ((...args: any[]) => string), ttl = 300) {\n\treturn function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) {\n\t\tconst original = descriptor.value;\n\n\t\tdescriptor.value = async function (...args: any[]) {\n\t\t\tconst redisService = Container.get(RedisService);\n\t\t\tconst cacheKey = typeof key === 'function' ? key(...args) : key;\n\n\t\t\tconst cached = await redisService.getCachedObject(cacheKey);\n\t\t\tif (cached !== undefined) return cached;\n\n\t\t\tconst result = await original.apply(this, args);\n\t\t\tif (result != null) await redisService.cacheObject(cacheKey, result, ttl);\n\t\t\treturn result;\n\t\t};\n\n\t\treturn descriptor;\n\t};\n}\n"]}
|
|
@@ -5,9 +5,9 @@ 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;
|
|
9
8
|
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
10
9
|
tokenType: TokenType | undefined;
|
|
10
|
+
req: import("http").IncomingMessage;
|
|
11
11
|
requestId: string | undefined;
|
|
12
12
|
entity: import("../context").EntityContext | undefined;
|
|
13
13
|
usedRefreshToken: boolean | undefined;
|
|
@@ -4,9 +4,9 @@ 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;
|
|
8
7
|
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
9
8
|
tokenType: import("../../auth").TokenType | undefined;
|
|
9
|
+
req: import("http").IncomingMessage;
|
|
10
10
|
requestId: string | undefined;
|
|
11
11
|
entity: import("../context").EntityContext | undefined;
|
|
12
12
|
usedRefreshToken: boolean | undefined;
|
|
@@ -3,9 +3,9 @@ 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;
|
|
7
6
|
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
8
7
|
tokenType: import("../../auth").TokenType | undefined;
|
|
8
|
+
req: import("http").IncomingMessage;
|
|
9
9
|
requestId: string | undefined;
|
|
10
10
|
entity: import("../context").EntityContext | undefined;
|
|
11
11
|
usedRefreshToken: boolean | undefined;
|
|
@@ -5,9 +5,9 @@ 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;
|
|
9
8
|
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
10
9
|
tokenType: TokenType | undefined;
|
|
10
|
+
req: import("http").IncomingMessage;
|
|
11
11
|
requestId: string | undefined;
|
|
12
12
|
entity: import("../context").EntityContext | undefined;
|
|
13
13
|
usedRefreshToken: boolean | undefined;
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED
|
@@ -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
|
-
populate?: any;
|
|
30
29
|
select?: Record<string, 0 | 1> | undefined;
|
|
30
|
+
populate?: any;
|
|
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
|
-
populate?: any;
|
|
40
39
|
select?: Record<string, 0 | 1> | undefined;
|
|
40
|
+
populate?: any;
|
|
41
41
|
query?: Record<string, any> | undefined;
|
|
42
42
|
page?: number | undefined;
|
|
43
43
|
}>>;
|
|
@@ -735,12 +735,12 @@ export declare const GetByIdInputSchema: z.ZodObject<{
|
|
|
735
735
|
populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
|
|
736
736
|
}, "strip", z.ZodTypeAny, {
|
|
737
737
|
_id: import("mongoose").Types.ObjectId;
|
|
738
|
-
populate?: any;
|
|
739
738
|
select?: Record<string, 0 | 1> | undefined;
|
|
739
|
+
populate?: any;
|
|
740
740
|
}, {
|
|
741
741
|
_id: string | import("mongoose").Types.ObjectId;
|
|
742
|
-
populate?: any;
|
|
743
742
|
select?: Record<string, 0 | 1> | undefined;
|
|
743
|
+
populate?: any;
|
|
744
744
|
}>;
|
|
745
745
|
export type GetByIdInputDTO = DTO<typeof GetByIdInputSchema>;
|
|
746
746
|
export declare const GetProductByIdInputSchema: z.ZodObject<{
|
|
@@ -753,12 +753,12 @@ export declare const GetProductByIdInputSchema: z.ZodObject<{
|
|
|
753
753
|
_id: import("mongoose").Types.ObjectId;
|
|
754
754
|
withAttributeHiddenItems: boolean;
|
|
755
755
|
withAddonsHiddenItems: boolean;
|
|
756
|
-
populate?: any;
|
|
757
756
|
select?: Record<string, 0 | 1> | undefined;
|
|
757
|
+
populate?: any;
|
|
758
758
|
}, {
|
|
759
759
|
_id: string | import("mongoose").Types.ObjectId;
|
|
760
|
-
populate?: any;
|
|
761
760
|
select?: Record<string, 0 | 1> | undefined;
|
|
761
|
+
populate?: any;
|
|
762
762
|
withAttributeHiddenItems?: boolean | undefined;
|
|
763
763
|
withAddonsHiddenItems?: boolean | undefined;
|
|
764
764
|
}>;
|
|
@@ -772,15 +772,15 @@ 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
|
-
populate?: any;
|
|
776
775
|
select?: Record<string, 0 | 1> | undefined;
|
|
776
|
+
populate?: any;
|
|
777
777
|
groupByCategories?: boolean | undefined;
|
|
778
778
|
getParentCategory?: boolean | undefined;
|
|
779
779
|
userOrderCompletionScope?: UserOrderCompletionScope | undefined;
|
|
780
780
|
}, {
|
|
781
781
|
_id: string | import("mongoose").Types.ObjectId;
|
|
782
|
-
populate?: any;
|
|
783
782
|
select?: Record<string, 0 | 1> | undefined;
|
|
783
|
+
populate?: any;
|
|
784
784
|
groupByCategories?: boolean | undefined;
|
|
785
785
|
getParentCategory?: boolean | undefined;
|
|
786
786
|
userOrderCompletionScope?: UserOrderCompletionScope | undefined;
|
|
@@ -790,11 +790,11 @@ export declare const GetByTokenInputSchema: z.ZodOptional<z.ZodObject<{
|
|
|
790
790
|
select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
|
|
791
791
|
populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
|
|
792
792
|
}, "strip", z.ZodTypeAny, {
|
|
793
|
-
populate?: any;
|
|
794
793
|
select?: Record<string, 0 | 1> | undefined;
|
|
795
|
-
}, {
|
|
796
794
|
populate?: any;
|
|
795
|
+
}, {
|
|
797
796
|
select?: Record<string, 0 | 1> | undefined;
|
|
797
|
+
populate?: any;
|
|
798
798
|
}>>;
|
|
799
799
|
export type GetByTokenInputDTO = DTO<typeof GetByTokenInputSchema>;
|
|
800
800
|
export declare const GetOneQuerySchema: z.ZodObject<{
|
|
@@ -802,12 +802,12 @@ export declare const GetOneQuerySchema: z.ZodObject<{
|
|
|
802
802
|
select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
|
|
803
803
|
populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
|
|
804
804
|
}, "strip", z.ZodTypeAny, {
|
|
805
|
-
populate?: any;
|
|
806
805
|
select?: Record<string, 0 | 1> | undefined;
|
|
806
|
+
populate?: any;
|
|
807
807
|
query?: Record<string, any> | undefined;
|
|
808
808
|
}, {
|
|
809
|
-
populate?: any;
|
|
810
809
|
select?: Record<string, 0 | 1> | undefined;
|
|
810
|
+
populate?: any;
|
|
811
811
|
query?: Record<string, any> | undefined;
|
|
812
812
|
}>;
|
|
813
813
|
export type GetOneQueryDTO = DTO<typeof GetOneQuerySchema>;
|