@lyxa.ai/core 1.0.190 → 1.0.192
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/dispatcher/index.d.ts +2 -1
- package/dist/libraries/dispatcher/index.js +2 -1
- package/dist/libraries/dispatcher/index.js.map +1 -1
- package/dist/libraries/mongo/models/banner.model.d.ts +1 -1
- package/dist/libraries/mongo/models/banner.model.js +2 -1
- package/dist/libraries/mongo/models/banner.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/trip-leg.mode.d.ts +1 -0
- package/dist/libraries/mongo/models/embedded/trip-leg.mode.js +5 -0
- package/dist/libraries/mongo/models/embedded/trip-leg.mode.js.map +1 -1
- package/dist/libraries/mongo/models/notification.model.d.ts +2 -0
- package/dist/libraries/mongo/models/notification.model.js +6 -0
- package/dist/libraries/mongo/models/notification.model.js.map +1 -1
- package/dist/libraries/mongo/models/service-category.model.d.ts +2 -1
- package/dist/libraries/mongo/models/service-category.model.js +3 -2
- package/dist/libraries/mongo/models/service-category.model.js.map +1 -1
- package/dist/libraries/mongo/models/ticket.model.js +1 -1
- package/dist/libraries/mongo/models/ticket.model.js.map +1 -1
- package/dist/libraries/trpc/context.d.ts +13 -12
- package/dist/libraries/trpc/context.js +4 -2
- package/dist/libraries/trpc/context.js.map +1 -1
- package/dist/libraries/trpc/index.d.ts +49 -153
- package/dist/libraries/trpc/index.js +7 -1
- package/dist/libraries/trpc/index.js.map +1 -1
- package/dist/libraries/trpc/middlewares/auth.d.ts +9 -32
- package/dist/libraries/trpc/middlewares/createRoleProtectedProcedure.d.ts +15 -0
- package/dist/libraries/trpc/middlewares/createRoleProtectedProcedure.js +21 -0
- package/dist/libraries/trpc/middlewares/createRoleProtectedProcedure.js.map +1 -0
- package/dist/libraries/trpc/middlewares/phone-verified.d.ts +9 -32
- package/dist/libraries/trpc/middlewares/publicUserDecoder.d.ts +9 -32
- package/dist/types/README.md +1 -1
- package/dist/types/package.json +1 -1
- package/package.json +1 -1
|
@@ -5,5 +5,6 @@ export declare class MicroServiceDispatcher {
|
|
|
5
5
|
constructor(secretService: SecretManagerService);
|
|
6
6
|
getMicroService<T extends AnyRouter>(serviceName: string, customURL?: string, options?: {
|
|
7
7
|
headers?: Record<string, string>;
|
|
8
|
-
|
|
8
|
+
transformer?: any;
|
|
9
|
+
}): Promise<import("@trpc/client").TRPCClient<T>>;
|
|
9
10
|
}
|
|
@@ -25,11 +25,12 @@ let MicroServiceDispatcher = class MicroServiceDispatcher {
|
|
|
25
25
|
if (!deploymentURL) {
|
|
26
26
|
throw new Error('The requested service does not have a configured secret URL');
|
|
27
27
|
}
|
|
28
|
-
return (0, client_1.
|
|
28
|
+
return (0, client_1.createTRPCClient)({
|
|
29
29
|
links: [
|
|
30
30
|
(0, client_1.httpBatchLink)({
|
|
31
31
|
url: deploymentURL,
|
|
32
32
|
headers: async () => options?.headers ?? {},
|
|
33
|
+
transformer: options?.transformer,
|
|
33
34
|
}),
|
|
34
35
|
],
|
|
35
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/dispatcher/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAiC;AACjC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/dispatcher/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAiC;AACjC,yCAA+D;AAE/D,wCAAkD;AAG3C,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAC1B,cAAc,CAAuB;IAE7C,YAAY,aAAmC;QAC9C,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACrC,CAAC;IAEM,KAAK,CAAC,eAAe,CAC3B,WAAmB,EACnB,SAAkB,EAClB,OAGC;QAED,MAAM,aAAa,GAClB,SAAS;YACT,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAChC,2BAA2B,GAAG,WAAW,CAAC,WAAW,EAAE,GAAG,WAAW,CACrE,CAAC,CAAC;QAEJ,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;QAE9C,IAAI,CAAC,aAAa,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;QAChF,CAAC;QAED,OAAO,IAAA,yBAAgB,EAAI;YAC1B,KAAK,EAAE;gBACN,IAAA,sBAAa,EAAC;oBACb,GAAG,EAAE,aAAa;oBAClB,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE;oBAC3C,WAAW,EAAE,OAAO,EAAE,WAAW;iBACjC,CAAC;aACF;SAED,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AAtCY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,gBAAO,GAAE;qCAIkB,8BAAoB;GAHnC,sBAAsB,CAsClC","sourcesContent":["import { Service } from 'typedi';\nimport { createTRPCClient, httpBatchLink } from '@trpc/client';\nimport { AnyRouter } from '@trpc/server';\nimport { SecretManagerService } from '../secrets';\n\n@Service()\nexport class MicroServiceDispatcher {\n\tprivate _secretService: SecretManagerService;\n\n\tconstructor(secretService: SecretManagerService) {\n\t\tthis._secretService = secretService;\n\t}\n\n\tpublic async getMicroService<T extends AnyRouter>(\n\t\tserviceName: string,\n\t\tcustomURL?: string,\n\t\toptions?: {\n\t\t\theaders?: Record<string, string>;\n\t\t\ttransformer?: any;\n\t\t}\n\t) {\n\t\tconst deploymentURL =\n\t\t\tcustomURL ??\n\t\t\t(await this._secretService.getKey(\n\t\t\t\t'DEPLOYMENTS_MICROSERVICE_' + serviceName.toUpperCase() + '_ENDPOINT'\n\t\t\t));\n\n\t\tconsole.log(deploymentURL, 'deploymentURL--');\n\n\t\tif (!deploymentURL) {\n\t\t\tthrow new Error('The requested service does not have a configured secret URL');\n\t\t}\n\n\t\treturn createTRPCClient<T>({\n\t\t\tlinks: [\n\t\t\t\thttpBatchLink({\n\t\t\t\t\turl: deploymentURL,\n\t\t\t\t\theaders: async () => options?.headers ?? {},\n\t\t\t\t\ttransformer: options?.transformer,\n\t\t\t\t}),\n\t\t\t],\n\t\t\t//special http request header that has a token\n\t\t});\n\t}\n}\n"]}
|
|
@@ -3,8 +3,8 @@ import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
|
3
3
|
import { BannerClickType, BannerLinkType, BannerUserType, Status, UserAppSectionItemType } from '../../../utilities/enum';
|
|
4
4
|
import { Shop } from './shop.model';
|
|
5
5
|
import { Product } from './product.model';
|
|
6
|
+
import { Zone } from './zone.model';
|
|
6
7
|
import { ListContainer } from './list-container.model';
|
|
7
|
-
import { Zone } from '.';
|
|
8
8
|
export declare class Banner extends TimeStamps {
|
|
9
9
|
title: string;
|
|
10
10
|
image: string;
|
|
@@ -15,6 +15,7 @@ const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
|
|
|
15
15
|
const enum_1 = require("../../../utilities/enum");
|
|
16
16
|
const shop_model_1 = require("./shop.model");
|
|
17
17
|
const product_model_1 = require("./product.model");
|
|
18
|
+
const zone_model_1 = require("./zone.model");
|
|
18
19
|
const list_container_model_1 = require("./list-container.model");
|
|
19
20
|
const _1 = require(".");
|
|
20
21
|
let Banner = class Banner extends defaultClasses_1.TimeStamps {
|
|
@@ -75,7 +76,7 @@ __decorate([
|
|
|
75
76
|
__metadata("design:type", Object)
|
|
76
77
|
], Banner.prototype, "shop", void 0);
|
|
77
78
|
__decorate([
|
|
78
|
-
(0, typegoose_1.prop)({ required: true, ref: () =>
|
|
79
|
+
(0, typegoose_1.prop)({ required: true, ref: () => zone_model_1.Zone }),
|
|
79
80
|
__metadata("design:type", Array)
|
|
80
81
|
], Banner.prototype, "zones", void 0);
|
|
81
82
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner.model.js","sourceRoot":"/","sources":["libraries/mongo/models/banner.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAA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,SAAS,CAA8B;oBAChF;wBACC,MAAM,EAAE;4BACP,SAAS,EAAE,IAAI;yBACf;qBACD;oBACD;wBACC,MAAM,EAAE;4BACP,GAAG,EAAE,IAAI;4BACT,eAAe,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;yBAC1C;qBACD;iBACD,CAAC,CAAC,IAAI,EAAE,CAAC;gBAGV,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,MAAM,CA0ClB","sourcesContent":["import { modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { BannerClickType, BannerLinkType, BannerUserType, ItemType, Status, UserAppSectionItemType } from '../../../utilities/enum';\nimport { Shop } from './shop.model';\nimport { Product } from './product.model';\nimport { Zone } from './zone.model';\nimport { ListContainer } from './list-container.model';\nimport { BannerModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'banners' } })\n@pre<Banner>('save', async function (next) {\n\t// Only set sortingOrder if it's a new document or sortingOrder is not set\n\tif (this.isNew || typeof this.sortingOrder === 'undefined') {\n\t\ttry {\n\t\t\t// Find the maximum sortingOrder that aren't deleted\n\t\t\tconst maxSortingOrder = await BannerModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\tdeletedAt: null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: null,\n\t\t\t\t\t\tmaxSortingOrder: { $max: '$sortingOrder' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]).exec();\n\n\t\t\t// Set the new sortingOrder to max + 1 (or 0 if no items found)\n\t\t\tthis.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\nexport class Banner extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic title!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic image!: string;\n\n\t@prop({ required: true, type: String, enum: ItemType })\n\tpublic itemType!: UserAppSectionItemType;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: String, enum: BannerUserType, default: BannerUserType.ALL })\n\tpublic visibility?: BannerUserType;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isClickable?: boolean;\n\n\t@prop({ type: String, enum: BannerClickType })\n\tpublic clickType?: BannerClickType;\n\n\t@prop({ type: String, enum: BannerLinkType })\n\tpublic linkType?: BannerLinkType;\n\n\t@prop({ type: String, trim: true })\n\tpublic link?: string;\n\n\t@prop({ ref: () => Shop })\n\tpublic shop?: Ref<Shop>;\n\n\t@prop({ required: true, ref: () => Zone })\n\tpublic zones!: Ref<Zone>[];\n\n\t@prop({ ref: () => Product })\n\tpublic product?: Ref<Product>;\n\n\t@prop({ ref: () => ListContainer })\n\tpublic listContainer?: Ref<ListContainer>;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic sortingOrder?: number;\n}\n"]}
|
|
@@ -19,6 +19,7 @@ const shop_model_1 = require("../shop.model");
|
|
|
19
19
|
class TripLeg {
|
|
20
20
|
name;
|
|
21
21
|
address;
|
|
22
|
+
addressDescription;
|
|
22
23
|
latitude;
|
|
23
24
|
longitude;
|
|
24
25
|
type;
|
|
@@ -44,6 +45,10 @@ __decorate([
|
|
|
44
45
|
(0, typegoose_1.prop)({ type: String }),
|
|
45
46
|
__metadata("design:type", String)
|
|
46
47
|
], TripLeg.prototype, "address", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], TripLeg.prototype, "addressDescription", void 0);
|
|
47
52
|
__decorate([
|
|
48
53
|
(0, typegoose_1.prop)({ required: true, type: Number }),
|
|
49
54
|
__metadata("design:type", Number)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trip-leg.mode.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/trip-leg.mode.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2D;AAC3D,gDAAuC;AACvC,gDAAuC;AACvC,qDAAsF;AACtF,8CAAqC;AACrC,8CAAqC;AAGrC,MAAa,OAAO;IAEnB,IAAI,CAAU;IAGd,OAAO,CAAU;IAGjB,QAAQ,CAAU;IAGlB,SAAS,CAAU;IAOnB,IAAI,CAAkB;IAGtB,KAAK,CAAc;IAGnB,MAAM,CAA6B;IAGnC,IAAI,CAAa;IAGjB,IAAI,CAAa;IAMjB,QAAQ,CAAY;IAQpB,MAAM,CAAkB;IAGxB,aAAa,CAAa;IAG1B,aAAa,CAAa;IAG1B,qBAAqB,CAAc;IAGnC,QAAQ,CAAa;IAGrB,QAAQ,CAAa;IAKrB,gBAAgB,CAAc;CAC9B;
|
|
1
|
+
{"version":3,"file":"trip-leg.mode.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/trip-leg.mode.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2D;AAC3D,gDAAuC;AACvC,gDAAuC;AACvC,qDAAsF;AACtF,8CAAqC;AACrC,8CAAqC;AAGrC,MAAa,OAAO;IAEnB,IAAI,CAAU;IAGd,OAAO,CAAU;IAGjB,kBAAkB,CAAU;IAG5B,QAAQ,CAAU;IAGlB,SAAS,CAAU;IAOnB,IAAI,CAAkB;IAGtB,KAAK,CAAc;IAGnB,MAAM,CAA6B;IAGnC,IAAI,CAAa;IAGjB,IAAI,CAAa;IAMjB,QAAQ,CAAY;IAQpB,MAAM,CAAkB;IAG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;QACZ,IAAI,EAAE,qBAAc;QACpB,OAAO,EAAE,qBAAc,CAAC,OAAO;QAC/B,QAAQ,EAAE,IAAI;KACd,CAAC;;uCACsB;AAGxB;IADC,IAAA,gBAAI,GAAE;;8CACmB;AAG1B;IADC,IAAA,gBAAI,GAAE;;8CACmB;AAG1B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;;sDACQ;AAGnC;IADC,IAAA,gBAAI,GAAE;;yCACc;AAGrB;IADC,IAAA,gBAAI,GAAE;;yCACc;AAKrB;IAHC,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;KAChB,CAAC;;iDAC4B","sourcesContent":["import { Ref, prop, mongoose } from '@typegoose/typegoose';\nimport { Order } from '../order.model';\nimport { Rider } from '../rider.model';\nimport { FaqAccountType, DeliveryStatus, ItemType } from '../../../../utilities/enum';\nimport { User } from '../user.model';\nimport { Shop } from '../shop.model';\nimport { IDistance, IDuration } from '../../../map/interfaces/IMapService';\n\nexport class TripLeg {\n\t@prop({ type: String })\n\tname?: string;\n\n\t@prop({ type: String })\n\taddress?: string;\n\n\t@prop({ type: String })\n\taddressDescription?: string;\n\n\t@prop({ required: true, type: Number })\n\tlatitude?: number;\n\n\t@prop({ required: true, type: Number })\n\tlongitude?: number;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: FaqAccountType,\n\t\tdefault: FaqAccountType.RIDER,\n\t})\n\ttype?: FaqAccountType;\n\n\t@prop({ ref: () => Rider })\n\trider?: Ref<Rider>;\n\n\t@prop({ ref: () => Order })\n\torders?: mongoose.Types.ObjectId[];\n\n\t@prop({ ref: () => User })\n\tuser?: Ref<User>;\n\n\t@prop({ ref: () => Shop })\n\tshop?: Ref<Shop>;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: ItemType,\n\t})\n\tshopType?: ItemType;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: DeliveryStatus,\n\t\tdefault: DeliveryStatus.PENDING,\n\t\trequired: true,\n\t})\n\tstatus?: DeliveryStatus;\n\n\t@prop()\n\ttotalDistance?: IDistance;\n\n\t@prop()\n\ttotalDuration?: IDuration;\n\n\t@prop({ type: [[Number]] })\n\ttotalOverviewPolyline?: number[][];\n\n\t@prop()\n\tdistance?: IDistance;\n\n\t@prop()\n\tduration?: IDuration;\n\n\t@prop({\n\t\ttype: [[Number]],\n\t})\n\toverviewPolyline?: number[][];\n}\n"]}
|
|
@@ -12,11 +12,13 @@ import { RequestArea } from './request-area.model';
|
|
|
12
12
|
import { Rider } from './rider.model';
|
|
13
13
|
import { Shop } from './shop.model';
|
|
14
14
|
import { User } from './user.model';
|
|
15
|
+
import { Zone } from './zone.model';
|
|
15
16
|
export declare class Notification extends TimeStamps {
|
|
16
17
|
title: string;
|
|
17
18
|
body: string;
|
|
18
19
|
image?: string;
|
|
19
20
|
sound?: string;
|
|
21
|
+
zones?: Ref<Zone>[];
|
|
20
22
|
accountType: NotificationAccountType;
|
|
21
23
|
isGlobal: boolean;
|
|
22
24
|
users?: Ref<User>[];
|
|
@@ -24,11 +24,13 @@ const request_area_model_1 = require("./request-area.model");
|
|
|
24
24
|
const rider_model_1 = require("./rider.model");
|
|
25
25
|
const shop_model_1 = require("./shop.model");
|
|
26
26
|
const user_model_1 = require("./user.model");
|
|
27
|
+
const zone_model_1 = require("./zone.model");
|
|
27
28
|
let Notification = class Notification extends defaultClasses_1.TimeStamps {
|
|
28
29
|
title;
|
|
29
30
|
body;
|
|
30
31
|
image;
|
|
31
32
|
sound;
|
|
33
|
+
zones;
|
|
32
34
|
accountType;
|
|
33
35
|
isGlobal;
|
|
34
36
|
users;
|
|
@@ -67,6 +69,10 @@ __decorate([
|
|
|
67
69
|
(0, typegoose_1.prop)({ type: String }),
|
|
68
70
|
__metadata("design:type", String)
|
|
69
71
|
], Notification.prototype, "sound", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, typegoose_1.prop)({ ref: () => zone_model_1.Zone, default: [] }),
|
|
74
|
+
__metadata("design:type", Array)
|
|
75
|
+
], Notification.prototype, "zones", void 0);
|
|
70
76
|
__decorate([
|
|
71
77
|
(0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.NotificationAccountType }),
|
|
72
78
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.model.js","sourceRoot":"/","sources":["libraries/mongo/models/notification.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,kDAA6E;AAC7E,+CAAsC;AACtC,2DAAiD;AACjD,iEAAuD;AACvD,+CAAsC;AACtC,iDAAwC;AACxC,iDAAwC;AACxC,mDAA0C;AAC1C,6DAAmD;AACnD,+CAAsC;AACtC,6CAAoC;AACpC,6CAAoC;AAuB7B,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,2BAAU;IAEpC,KAAK,CAAU;IAGf,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,KAAK,CAAU;IAGf,WAAW,CAA2B;IAGtC,QAAQ,CAAW;IAGnB,KAAK,CAAe;IAGpB,OAAO,CAAiB;IAGxB,KAAK,CAAe;IAGpB,MAAM,CAAgB;IAGtB,MAAM,CAAgB;IAGtB,WAAW,CAAW;IAGtB,SAAS,CAAa;IAGtB,YAAY,CAAU;IAGtB,cAAc,CAAc;IAG5B,aAAa,CAAa;IAG1B,gBAAgB,CAAgB;IAGhC,sBAAsB,CAAsB;IAG5C,eAAe,CAAe;IAG9B,mBAAmB,CAAmB;IAGtC,oBAAoB,CAAoB;IAGxC,aAAa,CAAW;IAGxB,SAAS,CAAc;IAGvB,MAAM,CAA6B;CAC1C,CAAA;
|
|
1
|
+
{"version":3,"file":"notification.model.js","sourceRoot":"/","sources":["libraries/mongo/models/notification.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,kDAA6E;AAC7E,+CAAs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AC3F;IACA,IAAA,iBAAK,EACL,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EACxC,EAAE,uBAAuB,EAAE,EAAE,WAAW,EAAE,8BAAuB,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAC3F;IACA,IAAA,iBAAK,EACL,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EACzC,EAAE,uBAAuB,EAAE,EAAE,WAAW,EAAE,8BAAuB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAC5F;IACA,IAAA,iBAAK,EACL,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EACzC,EAAE,uBAAuB,EAAE,EAAE,WAAW,EAAE,8BAAuB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAC5F;IACA,IAAA,iBAAK,EACL,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAC1C,EAAE,uBAAuB,EAAE,EAAE,WAAW,EAAE,8BAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAC7F;GACY,YAAY,CA2ExB","sourcesContent":["import { index, modelOptions, mongoose, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ClickType, NotificationAccountType } from '../../../utilities/enum';\nimport { Admin } from './admin.model';\nimport { BOBFinance } from './bob-finance.model';\nimport { ListContainer } from './list-container.model';\nimport { Order } from './order.model';\nimport { Parent } from './parent.model';\nimport { Payout } from './payout.model';\nimport { Product } from './product.model';\nimport { RequestArea } from './request-area.model';\nimport { Rider } from './rider.model';\nimport { Shop } from './shop.model';\nimport { User } from './user.model';\nimport { Zone } from './zone.model';\n\n@modelOptions({ schemaOptions: { collection: 'notifications' } })\n@index(\n\t{ isGlobal: 1, users: 1, createdAt: -1 },\n\t{ partialFilterExpression: { accountType: NotificationAccountType.USER, deletedAt: null } }\n)\n@index(\n\t{ isGlobal: 1, shops: 1, createdAt: -1 },\n\t{ partialFilterExpression: { accountType: NotificationAccountType.SHOP, deletedAt: null } }\n)\n@index(\n\t{ isGlobal: 1, riders: 1, createdAt: -1 },\n\t{ partialFilterExpression: { accountType: NotificationAccountType.RIDER, deletedAt: null } }\n)\n@index(\n\t{ isGlobal: 1, admins: 1, createdAt: -1 },\n\t{ partialFilterExpression: { accountType: NotificationAccountType.ADMIN, deletedAt: null } }\n)\n@index(\n\t{ isGlobal: 1, parents: 1, createdAt: -1 },\n\t{ partialFilterExpression: { accountType: NotificationAccountType.PARENT, deletedAt: null } }\n)\nexport class Notification extends TimeStamps {\n\t@prop({ required: true, type: String, maxlength: 50 })\n\tpublic title!: string;\n\n\t@prop({ required: true, type: String, maxlength: 250 })\n\tpublic body!: string;\n\n\t@prop({ type: String })\n\tpublic image?: string;\n\n\t@prop({ type: String })\n\tpublic sound?: string;\n\n\t@prop({ ref: () => Zone, default: [] })\n\tpublic zones?: Ref<Zone>[];\n\n\t@prop({ required: true, type: String, enum: NotificationAccountType })\n\tpublic accountType!: NotificationAccountType;\n\n\t@prop({ required: true, type: Boolean })\n\tpublic isGlobal!: boolean;\n\n\t@prop({ ref: () => User, default: [] })\n\tpublic users?: Ref<User>[];\n\n\t@prop({ ref: () => Parent, default: [] })\n\tpublic parents?: Ref<Parent>[];\n\n\t@prop({ ref: () => Shop, default: [] })\n\tpublic shops?: Ref<Shop>[];\n\n\t@prop({ ref: () => Rider, default: [] })\n\tpublic riders?: Ref<Rider>[];\n\n\t@prop({ ref: () => Admin, default: [] })\n\tpublic admins?: Ref<Admin>[];\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isClickable?: boolean;\n\n\t@prop({ type: String, enum: ClickType })\n\tpublic clickType?: ClickType;\n\n\t@prop({ type: String, trim: true })\n\tpublic clickableUrl?: string;\n\n\t@prop({ ref: () => Order })\n\tpublic clickableOrder?: Ref<Order>;\n\n\t@prop({ ref: () => Shop })\n\tpublic clickableShop?: Ref<Shop>;\n\n\t@prop({ ref: () => Product })\n\tpublic clickableProduct?: Ref<Product>;\n\n\t@prop({ ref: () => ListContainer })\n\tpublic clickableListContainer?: Ref<ListContainer>;\n\n\t@prop({ ref: () => Payout })\n\tpublic clickablePayout?: Ref<Payout>;\n\n\t@prop({ ref: () => BOBFinance })\n\tpublic clickableBobFinance?: Ref<BOBFinance>;\n\n\t@prop({ ref: () => RequestArea })\n\tpublic clickableRequestArea?: Ref<RequestArea>;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isSendByAdmin?: boolean;\n\n\t@prop({ ref: () => Admin })\n\tpublic createdBy?: Ref<Admin>;\n\n\t@prop({ type: () => [mongoose.Types.ObjectId], default: [] })\n\tpublic seenBy?: mongoose.Types.ObjectId[];\n}\n"]}
|
|
@@ -2,9 +2,10 @@ import { Ref } from '@typegoose/typegoose';
|
|
|
2
2
|
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
3
3
|
import { Status } from '../../../utilities/enum';
|
|
4
4
|
import { Vendor } from './vendor.model';
|
|
5
|
+
import { Service } from './service.model';
|
|
5
6
|
export declare class ServiceCategory extends TimeStamps {
|
|
6
7
|
name: string;
|
|
7
|
-
service:
|
|
8
|
+
service: Ref<Service>;
|
|
8
9
|
vendor: Ref<Vendor>;
|
|
9
10
|
image?: string;
|
|
10
11
|
status?: Status;
|
|
@@ -14,6 +14,7 @@ const typegoose_1 = require("@typegoose/typegoose");
|
|
|
14
14
|
const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
|
|
15
15
|
const enum_1 = require("../../../utilities/enum");
|
|
16
16
|
const vendor_model_1 = require("./vendor.model");
|
|
17
|
+
const service_model_1 = require("./service.model");
|
|
17
18
|
let ServiceCategory = class ServiceCategory extends defaultClasses_1.TimeStamps {
|
|
18
19
|
name;
|
|
19
20
|
service;
|
|
@@ -27,8 +28,8 @@ __decorate([
|
|
|
27
28
|
__metadata("design:type", String)
|
|
28
29
|
], ServiceCategory.prototype, "name", void 0);
|
|
29
30
|
__decorate([
|
|
30
|
-
(0, typegoose_1.prop)({ required: true, type:
|
|
31
|
-
__metadata("design:type",
|
|
31
|
+
(0, typegoose_1.prop)({ required: true, type: () => service_model_1.Service }),
|
|
32
|
+
__metadata("design:type", Object)
|
|
32
33
|
], ServiceCategory.prototype, "service", void 0);
|
|
33
34
|
__decorate([
|
|
34
35
|
(0, typegoose_1.prop)({ required: true, ref: () => vendor_model_1.Vendor }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-category.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-category.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,
|
|
1
|
+
{"version":3,"file":"service-category.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-category.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,kDAAiD;AACjD,iDAAwC;AACxC,mDAA0C;AAOnC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,2BAAU;IAEvC,IAAI,CAAU;IAGd,OAAO,CAAe;IAGnB,MAAM,CAAe;IAGxB,KAAK,CAAU;IAGf,MAAM,CAAU;CACvB,CAAA;AAfY,0CAAe;AAEpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;;6CAC7C;AAGd;IADH,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAC,GAAE,EAAE,CAAC,uBAAO,EAAE,CAAC;;gDAClB;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,CAAC;;+CAChB;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CACD;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;+CACtC;0BAdX,eAAe;IAL3B,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,mBAAmB,EAAE,EAAE,CAAC;IACpE,IAAA,iBAAK,EACL,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EACtB,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAC9D;GACY,eAAe,CAe3B","sourcesContent":["import { Index, modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Status } from '../../../utilities/enum';\nimport { Vendor } from './vendor.model';\nimport { Service } from './service.model';\n\n@modelOptions({ schemaOptions: { collection: 'serviceCategories' } })\n@Index(\n\t{ name: 1, vendor: 1 },\n\t{ unique: true, partialFilterExpression: { deletedAt: null } }\n)\nexport class ServiceCategory extends TimeStamps {\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tpublic name!: string;\n\n @prop({ required: true, type:()=> Service })\n\tpublic service!: Ref<Service>\n\n @prop({ required: true, ref: () => Vendor })\n public vendor!: Ref<Vendor>;\n\n\t@prop({ type: String })\n\tpublic image?: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n}\n"]}
|
|
@@ -103,7 +103,7 @@ __decorate([
|
|
|
103
103
|
__metadata("design:type", Number)
|
|
104
104
|
], Ticket.prototype, "agentScore", void 0);
|
|
105
105
|
__decorate([
|
|
106
|
-
(0, typegoose_1.prop)({ ref: () => ticket_action_model_1.TicketAction, required:
|
|
106
|
+
(0, typegoose_1.prop)({ ref: () => ticket_action_model_1.TicketAction, required: false }),
|
|
107
107
|
__metadata("design:type", Object)
|
|
108
108
|
], Ticket.prototype, "action", void 0);
|
|
109
109
|
exports.Ticket = Ticket = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ticket.model.js","sourceRoot":"/","sources":["libraries/mongo/models/ticket.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AAGrE,+CAAsC;AACtC,+CAAsC;AACtC,kDAA4E;AAC5E,uDAA6C;AAC7C,6DAAmD;AACnD,+DAAqD;AAa9C,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,2BAAU;IAE9B,QAAQ,CAAU;IAGlB,IAAI,CAAc;IAGlB,MAAM,CAAgB;IAGtB,cAAc,CAAoB;IAGlC,MAAM,CAAoB;IAG1B,UAAU,CAAW;IAGrB,KAAK,CAAc;IAGnB,aAAa,CAAc;IAG3B,UAAU,CAAQ;IAGlB,kBAAkB,CAAU;IAG5B,QAAQ,CAAiB;IAGzB,UAAU,CAAQ;IAGlB,QAAQ,CAAQ;IAGhB,qBAAqB,CAAU;IAG/B,cAAc,CAAU;IAGxB,UAAU,CAAU;IAGpB,MAAM,CAAqB;CAClC,CAAA;AAnDY,wBAAM;AAEX;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;wCAC5B;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAU,EAAE,CAAC;;oCAChC;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAA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G,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;8CACR;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACI;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;sCACjB;iBAlDtB,MAAM;IAXlB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,SAAS;YACrB,UAAU,EAAE,IAAI;SAChB;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,aAAa,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACtC,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IAC1C,IAAA,iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAC9C,IAAA,iBAAK,EAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;IACxB,IAAA,iBAAK,EAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;GACV,MAAM,CAmDlB","sourcesContent":["import { prop, Ref, index, modelOptions } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { User } from './user.model';\nimport { Shop } from './shop.model';\nimport { Order } from './order.model';\nimport { Admin } from './admin.model';\nimport { TicketType, TicketStatus, UserRef } from '../../../utilities/enum';\nimport { Chatroom } from './chat-room.model';\nimport { DefaultChat } from './default-chat.model';\nimport { TicketAction } from './ticket-action.model';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'tickets',\n\t\ttimestamps: true,\n\t},\n})\n@index({ assignedAgent: 1, status: 1 })\n@index({ type: 1, status: 1, priority: 1 })\n@index({ client: 1, clientType: 1, status: 1 })\n@index({ createdAt: -1 })\n@index({ chatroom: 1 })\nexport class Ticket extends TimeStamps {\n\t@prop({ required: true, type: String, unique: true })\n\tpublic ticketId!: string;\n\n\t@prop({ required: true, type: String, enum: TicketType })\n\tpublic type!: TicketType;\n\n\t@prop({ required: true, type: String, enum: TicketStatus, default: TicketStatus.PENDING })\n\tpublic status!: TicketStatus;\n\n\t@prop({ ref: () => DefaultChat, required: false })\n\tpublic defaultMessage?: Ref<DefaultChat>;\n\n\t@prop({ refPath: 'clientType', required: true })\n\tpublic client!: Ref<User | Shop>;\n\n\t@prop({ required: true, type: String, enum: UserRef })\n\tpublic clientType!: UserRef;\n\n\t@prop({ ref: () => Order })\n\tpublic order?: Ref<Order>;\n\n\t@prop({ ref: () => Admin })\n\tpublic assignedAgent?: Ref<Admin>;\n\n\t@prop({ type: Date })\n\tpublic assignedAt?: Date;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic assignmentAttempts?: number;\n\n\t@prop({ ref: () => Chatroom, required: true })\n\tpublic chatroom!: Ref<Chatroom>;\n\n\t@prop({ type: Date })\n\tpublic resolvedAt?: Date;\n\n\t@prop({ type: Date })\n\tpublic closedAt?: Date;\n\n\t@prop({ type: Number })\n\tpublic resolutionTimeMinutes?: number;\n\n\t@prop({ type: Number, min: 1, max: 5 })\n\tpublic customerRating?: number;\n\n\t@prop({ type: Number })\n\tpublic agentScore?: number;\n\n\t@prop({ ref: () => TicketAction, required: false })\n\tpublic action?: Ref<TicketAction>;\n}\n"]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { CreateHTTPContextOptions } from '@trpc/server/
|
|
1
|
+
import { CreateHTTPContextOptions } from '@trpc/server/adapters/standalone';
|
|
2
|
+
import type { NodeHTTPCreateContextFnOptions } from '@trpc/server/adapters/node-http';
|
|
2
3
|
import type { CreateWSSContextFnOptions } from '@trpc/server/adapters/ws';
|
|
3
4
|
import { AuthEntityType } from '../auth';
|
|
4
5
|
import jwt from 'jsonwebtoken';
|
|
5
6
|
import { TokenType } from '../auth';
|
|
7
|
+
import type { IncomingMessage, ServerResponse } from 'http';
|
|
6
8
|
export interface EntityContext extends jwt.JwtPayload {
|
|
7
9
|
id: string;
|
|
8
10
|
type: AuthEntityType;
|
|
@@ -15,15 +17,14 @@ export interface LyxaContextParams {
|
|
|
15
17
|
usedRefreshToken?: boolean;
|
|
16
18
|
tokenRenewed?: boolean;
|
|
17
19
|
}
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
export interface LyxaHTTPContext extends LyxaContextParams {
|
|
21
|
+
req: IncomingMessage;
|
|
22
|
+
res: ServerResponse;
|
|
23
|
+
}
|
|
24
|
+
export interface LyxaWSContext extends LyxaContextParams {
|
|
25
|
+
req: any;
|
|
26
|
+
res: any;
|
|
27
|
+
}
|
|
28
|
+
export declare const createLyxaContext: (opts: CreateHTTPContextOptions | NodeHTTPCreateContextFnOptions<IncomingMessage, ServerResponse>) => Promise<LyxaHTTPContext>;
|
|
29
|
+
export declare const createLyxaWsContext: (opts: CreateWSSContextFnOptions) => Promise<LyxaWSContext>;
|
|
28
30
|
export type LyxaContext = Awaited<ReturnType<typeof createLyxaContext>>;
|
|
29
|
-
export type LyxaWSContext = Awaited<ReturnType<typeof createLyxaWsContext>>;
|
|
@@ -3,23 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createLyxaWsContext = exports.createLyxaContext = void 0;
|
|
4
4
|
const createLyxaContext = async (opts) => {
|
|
5
5
|
return {
|
|
6
|
-
...opts,
|
|
7
6
|
entity: undefined,
|
|
8
7
|
requestId: undefined,
|
|
9
8
|
tokenType: undefined,
|
|
10
9
|
usedRefreshToken: false,
|
|
11
10
|
tokenRenewed: false,
|
|
11
|
+
req: opts.req,
|
|
12
|
+
res: opts.res,
|
|
12
13
|
};
|
|
13
14
|
};
|
|
14
15
|
exports.createLyxaContext = createLyxaContext;
|
|
15
16
|
const createLyxaWsContext = async (opts) => {
|
|
16
17
|
return {
|
|
17
|
-
...opts,
|
|
18
18
|
entity: undefined,
|
|
19
19
|
requestId: undefined,
|
|
20
20
|
tokenType: undefined,
|
|
21
21
|
usedRefreshToken: false,
|
|
22
22
|
tokenRenewed: false,
|
|
23
|
+
req: opts.req,
|
|
24
|
+
res: opts.res,
|
|
23
25
|
};
|
|
24
26
|
};
|
|
25
27
|
exports.createLyxaWsContext = createLyxaWsContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"/","sources":["libraries/trpc/context.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"/","sources":["libraries/trpc/context.ts"],"names":[],"mappings":";;;AAgCO,MAAM,iBAAiB,GAAG,KAAK,EACrC,IAAgG,EACrE,EAAE;IAC7B,OAAO;QACN,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,SAAS;QACpB,gBAAgB,EAAE,KAAK;QACvB,YAAY,EAAE,KAAK;QACnB,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,GAAG,EAAE,IAAI,CAAC,GAAG;KACb,CAAC;AACH,CAAC,CAAC;AAZW,QAAA,iBAAiB,qBAY5B;AAEK,MAAM,mBAAmB,GAAG,KAAK,EACvC,IAA+B,EACN,EAAE;IAC3B,OAAO;QACN,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,SAAS;QACpB,gBAAgB,EAAE,KAAK;QACvB,YAAY,EAAE,KAAK;QACnB,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,GAAG,EAAE,IAAI,CAAC,GAAG;KACb,CAAC;AACH,CAAC,CAAC;AAZW,QAAA,mBAAmB,uBAY9B","sourcesContent":["import { CreateHTTPContextOptions } from '@trpc/server/adapters/standalone';\nimport type { NodeHTTPCreateContextFnOptions } from '@trpc/server/adapters/node-http';\nimport type { CreateWSSContextFnOptions } from '@trpc/server/adapters/ws';\nimport { AuthEntityType } from '../auth';\nimport jwt from 'jsonwebtoken';\nimport { TokenType } from '../auth';\nimport type { IncomingMessage, ServerResponse } from 'http';\n\nexport interface EntityContext extends jwt.JwtPayload {\n\tid: string;\n\ttype: AuthEntityType;\n\tparameters: Record<string, unknown>;\n}\n\nexport interface LyxaContextParams {\n\tentity?: EntityContext;\n\trequestId?: string;\n\ttokenType?: TokenType;\n\tusedRefreshToken?: boolean;\n\ttokenRenewed?: boolean;\n}\n\nexport interface LyxaHTTPContext extends LyxaContextParams {\n\treq: IncomingMessage;\n\tres: ServerResponse;\n}\n\nexport interface LyxaWSContext extends LyxaContextParams {\n\treq: any;\n\tres: any;\n}\n\nexport const createLyxaContext = async (\n\topts: CreateHTTPContextOptions | NodeHTTPCreateContextFnOptions<IncomingMessage, ServerResponse>\n): Promise<LyxaHTTPContext> => {\n\treturn {\n\t\tentity: undefined,\n\t\trequestId: undefined,\n\t\ttokenType: undefined,\n\t\tusedRefreshToken: false,\n\t\ttokenRenewed: false,\n\t\treq: opts.req,\n\t\tres: opts.res,\n\t};\n};\n\nexport const createLyxaWsContext = async (\n\topts: CreateWSSContextFnOptions\n): Promise<LyxaWSContext> => {\n\treturn {\n\t\tentity: undefined,\n\t\trequestId: undefined,\n\t\ttokenType: undefined,\n\t\tusedRefreshToken: false,\n\t\ttokenRenewed: false,\n\t\treq: opts.req,\n\t\tres: opts.res,\n\t};\n};\nexport type LyxaContext = Awaited<ReturnType<typeof createLyxaContext>>;"]}
|
|
@@ -1,178 +1,74 @@
|
|
|
1
|
-
export declare const t: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
stack: undefined;
|
|
14
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
15
|
-
};
|
|
16
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
17
|
-
}>;
|
|
18
|
-
procedure: import("@trpc/server").ProcedureBuilder<{
|
|
19
|
-
_config: import("@trpc/server").RootConfig<{
|
|
20
|
-
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
21
|
-
meta: object;
|
|
22
|
-
errorShape: {
|
|
23
|
-
message: string;
|
|
24
|
-
data: {
|
|
25
|
-
stack: undefined;
|
|
26
|
-
path: undefined;
|
|
27
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
28
|
-
httpStatus: number;
|
|
29
|
-
};
|
|
30
|
-
stack: undefined;
|
|
31
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
32
|
-
};
|
|
33
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
34
|
-
}>;
|
|
35
|
-
_ctx_out: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
36
|
-
_input_in: typeof import("@trpc/server").unsetMarker;
|
|
37
|
-
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
38
|
-
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
39
|
-
_output_out: typeof import("@trpc/server").unsetMarker;
|
|
40
|
-
_meta: object;
|
|
41
|
-
}>;
|
|
42
|
-
middleware: <TNewParams extends import("@trpc/server").ProcedureParams<import("@trpc/server").AnyRootConfig, unknown, unknown, unknown, unknown, unknown, unknown>>(fn: import("@trpc/server").MiddlewareFunction<{
|
|
43
|
-
_config: import("@trpc/server").RootConfig<{
|
|
44
|
-
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
45
|
-
meta: object;
|
|
46
|
-
errorShape: {
|
|
47
|
-
message: string;
|
|
48
|
-
data: {
|
|
49
|
-
stack: undefined;
|
|
50
|
-
path: undefined;
|
|
51
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
52
|
-
httpStatus: number;
|
|
53
|
-
};
|
|
54
|
-
stack: undefined;
|
|
55
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
56
|
-
};
|
|
57
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
58
|
-
}>;
|
|
59
|
-
_ctx_out: {};
|
|
60
|
-
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
61
|
-
_input_in: unknown;
|
|
62
|
-
_output_in: unknown;
|
|
63
|
-
_output_out: unknown;
|
|
64
|
-
_meta: object;
|
|
65
|
-
}, TNewParams>) => import("@trpc/server").MiddlewareBuilder<{
|
|
66
|
-
_config: import("@trpc/server").RootConfig<{
|
|
67
|
-
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
68
|
-
meta: object;
|
|
69
|
-
errorShape: {
|
|
70
|
-
message: string;
|
|
71
|
-
data: {
|
|
72
|
-
stack: undefined;
|
|
73
|
-
path: undefined;
|
|
74
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
75
|
-
httpStatus: number;
|
|
76
|
-
};
|
|
77
|
-
stack: undefined;
|
|
78
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
79
|
-
};
|
|
80
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
81
|
-
}>;
|
|
82
|
-
_ctx_out: {};
|
|
83
|
-
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
84
|
-
_input_in: unknown;
|
|
85
|
-
_output_in: unknown;
|
|
86
|
-
_output_out: unknown;
|
|
87
|
-
_meta: object;
|
|
88
|
-
}, TNewParams>;
|
|
89
|
-
router: <TProcRouterRecord extends import("@trpc/server").ProcedureRouterRecord>(procedures: TProcRouterRecord) => import("@trpc/server").CreateRouterInner<import("@trpc/server").RootConfig<{
|
|
90
|
-
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
91
|
-
meta: object;
|
|
92
|
-
errorShape: {
|
|
93
|
-
message: string;
|
|
94
|
-
data: {
|
|
95
|
-
stack: undefined;
|
|
96
|
-
path: undefined;
|
|
97
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
98
|
-
httpStatus: number;
|
|
99
|
-
};
|
|
100
|
-
stack: undefined;
|
|
101
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
102
|
-
};
|
|
103
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
104
|
-
}>, TProcRouterRecord>;
|
|
105
|
-
mergeRouters: typeof import("@trpc/server").mergeRouters;
|
|
106
|
-
createCallerFactory: <TRouter extends import("@trpc/server").Router<import("@trpc/server").AnyRouterDef<import("@trpc/server").RootConfig<{
|
|
107
|
-
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
108
|
-
meta: object;
|
|
109
|
-
errorShape: {
|
|
110
|
-
message: string;
|
|
111
|
-
data: {
|
|
112
|
-
stack: undefined;
|
|
113
|
-
path: undefined;
|
|
114
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
115
|
-
httpStatus: number;
|
|
116
|
-
};
|
|
1
|
+
export declare const t: import("@trpc/server").TRPCRootObject<import("./context").LyxaHTTPContext, object, {
|
|
2
|
+
errorFormatter({ shape, error }: {
|
|
3
|
+
error: import("@trpc/server").TRPCError;
|
|
4
|
+
type: import("@trpc/server").ProcedureType | "unknown";
|
|
5
|
+
path: string | undefined;
|
|
6
|
+
input: unknown;
|
|
7
|
+
ctx: import("./context").LyxaHTTPContext | undefined;
|
|
8
|
+
shape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
9
|
+
}): {
|
|
10
|
+
message: string;
|
|
11
|
+
data: {
|
|
117
12
|
stack: undefined;
|
|
118
|
-
|
|
13
|
+
path: undefined;
|
|
14
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
15
|
+
httpStatus: number;
|
|
119
16
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
data: {
|
|
130
|
-
stack: undefined;
|
|
131
|
-
path: undefined;
|
|
132
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
133
|
-
httpStatus: number;
|
|
134
|
-
};
|
|
17
|
+
stack: undefined;
|
|
18
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
19
|
+
};
|
|
20
|
+
}, {
|
|
21
|
+
ctx: import("./context").LyxaHTTPContext;
|
|
22
|
+
meta: object;
|
|
23
|
+
errorShape: {
|
|
24
|
+
message: string;
|
|
25
|
+
data: {
|
|
135
26
|
stack: undefined;
|
|
136
|
-
|
|
27
|
+
path: undefined;
|
|
28
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
29
|
+
httpStatus: number;
|
|
137
30
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
143
|
-
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
144
|
-
_output_out: typeof import("@trpc/server").unsetMarker;
|
|
145
|
-
_meta: object;
|
|
31
|
+
stack: undefined;
|
|
32
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
33
|
+
};
|
|
34
|
+
transformer: false;
|
|
146
35
|
}>;
|
|
147
|
-
export declare const
|
|
148
|
-
|
|
36
|
+
export declare const publicProcedure: import("@trpc/server").TRPCProcedureBuilder<import("./context").LyxaHTTPContext, object, object, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, false>;
|
|
37
|
+
export declare const createTRPCRouter: import("@trpc/server").TRPCRouterBuilder<{
|
|
38
|
+
ctx: import("./context").LyxaHTTPContext;
|
|
149
39
|
meta: object;
|
|
150
40
|
errorShape: {
|
|
151
41
|
message: string;
|
|
152
42
|
data: {
|
|
153
43
|
stack: undefined;
|
|
154
44
|
path: undefined;
|
|
155
|
-
code: import("@trpc/server
|
|
45
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
156
46
|
httpStatus: number;
|
|
157
47
|
};
|
|
158
48
|
stack: undefined;
|
|
159
|
-
code: import("@trpc/server
|
|
49
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
160
50
|
};
|
|
161
|
-
transformer:
|
|
162
|
-
}
|
|
163
|
-
export declare const createCallerFactory:
|
|
164
|
-
ctx: import("
|
|
51
|
+
transformer: false;
|
|
52
|
+
}>;
|
|
53
|
+
export declare const createCallerFactory: import("@trpc/server").TRPCRouterCallerFactory<{
|
|
54
|
+
ctx: import("./context").LyxaHTTPContext;
|
|
165
55
|
meta: object;
|
|
166
56
|
errorShape: {
|
|
167
57
|
message: string;
|
|
168
58
|
data: {
|
|
169
59
|
stack: undefined;
|
|
170
60
|
path: undefined;
|
|
171
|
-
code: import("@trpc/server
|
|
61
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
172
62
|
httpStatus: number;
|
|
173
63
|
};
|
|
174
64
|
stack: undefined;
|
|
175
|
-
code: import("@trpc/server
|
|
65
|
+
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
176
66
|
};
|
|
177
|
-
transformer:
|
|
178
|
-
}
|
|
67
|
+
transformer: false;
|
|
68
|
+
}>;
|
|
69
|
+
export type { inferRouterInputs, inferRouterOutputs } from '@trpc/server';
|
|
70
|
+
export type { AnyTRPCRouter } from '@trpc/server';
|
|
71
|
+
export { createHTTPHandler } from '@trpc/server/adapters/standalone';
|
|
72
|
+
export { observable } from '@trpc/server/observable';
|
|
73
|
+
export { TRPCError } from '@trpc/server';
|
|
74
|
+
export type LyxaRouter = ReturnType<typeof createTRPCRouter>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCallerFactory = exports.createTRPCRouter = exports.publicProcedure = exports.t = void 0;
|
|
3
|
+
exports.TRPCError = exports.observable = exports.createHTTPHandler = exports.createCallerFactory = exports.createTRPCRouter = exports.publicProcedure = exports.t = void 0;
|
|
4
4
|
const server_1 = require("@trpc/server");
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
exports.t = server_1.initTRPC.context().create({
|
|
@@ -28,4 +28,10 @@ exports.t = server_1.initTRPC.context().create({
|
|
|
28
28
|
exports.publicProcedure = exports.t.procedure;
|
|
29
29
|
exports.createTRPCRouter = exports.t.router;
|
|
30
30
|
exports.createCallerFactory = exports.t.createCallerFactory;
|
|
31
|
+
var standalone_1 = require("@trpc/server/adapters/standalone");
|
|
32
|
+
Object.defineProperty(exports, "createHTTPHandler", { enumerable: true, get: function () { return standalone_1.createHTTPHandler; } });
|
|
33
|
+
var observable_1 = require("@trpc/server/observable");
|
|
34
|
+
Object.defineProperty(exports, "observable", { enumerable: true, get: function () { return observable_1.observable; } });
|
|
35
|
+
var server_2 = require("@trpc/server");
|
|
36
|
+
Object.defineProperty(exports, "TRPCError", { enumerable: true, get: function () { return server_2.TRPCError; } });
|
|
31
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/trpc/index.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AACxC,6BAA+B;AAGlB,QAAA,CAAC,GAAG,iBAAQ,CAAC,OAAO,EAAe,CAAC,MAAM,CAAC;IACvD,cAAc,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE;QAC9B,IAAI,SAAS,GAAG,IAAI,CAAC;QAErB,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa,IAAI,KAAK,CAAC,KAAK,YAAY,cAAQ,EAAE,CAAC;YACrE,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACxC,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC;QACnC,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QAE5D,OAAO;YACN,GAAG,KAAK;YACR,OAAO,EACN,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ;gBACzC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO;gBACnD,CAAC,CAAC,KAAK,CAAC,OAAO;YACjB,IAAI,EAAE;gBACL,GAAG,KAAK,CAAC,IAAI;gBAEb,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,SAAS;aACf;YAED,KAAK,EAAE,SAAS;SAChB,CAAC;IACH,CAAC;CACD,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,SAAC,CAAC,SAAS,CAAC;AAC9B,QAAA,gBAAgB,GAAG,SAAC,CAAC,MAAM,CAAC;AAC5B,QAAA,mBAAmB,GAAG,SAAC,CAAC,mBAAmB,CAAC","sourcesContent":["import { initTRPC } from '@trpc/server';\nimport { ZodError } from 'zod';\nimport { LyxaContext } from './context';\n\nexport const t = initTRPC.context<LyxaContext>().create({\n\terrorFormatter({ shape, error }) {\n\t\tlet zodErrors = null;\n\n\t\tif (error.code === 'BAD_REQUEST' && error.cause instanceof ZodError) {\n\t\t\tconst flattened = error.cause.flatten();\n\t\t\tzodErrors = flattened.fieldErrors;\n\t\t}\n\n\t\tconsole.log('Error:', error, shape, 'error log', zodErrors);\n\n\t\treturn {\n\t\t\t...shape,\n\t\t\tmessage:\n\t\t\t\tzodErrors && typeof zodErrors === 'object'\n\t\t\t\t\t? Object.values(zodErrors)[0]?.[0] || shape.message\n\t\t\t\t\t: shape.message,\n\t\t\tdata: {\n\t\t\t\t...shape.data,\n\n\t\t\t\tstack: undefined,\n\t\t\t\tpath: undefined,\n\t\t\t},\n\t\t\t// Prevent stack trace from being returned in the response\n\t\t\tstack: undefined,\n\t\t};\n\t},\n});\n\nexport const publicProcedure = t.procedure;\nexport const createTRPCRouter = t.router;\nexport const createCallerFactory = t.createCallerFactory;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/trpc/index.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AACxC,6BAA+B;AAGlB,QAAA,CAAC,GAAG,iBAAQ,CAAC,OAAO,EAAe,CAAC,MAAM,CAAC;IACvD,cAAc,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE;QAC9B,IAAI,SAAS,GAAG,IAAI,CAAC;QAErB,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa,IAAI,KAAK,CAAC,KAAK,YAAY,cAAQ,EAAE,CAAC;YACrE,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACxC,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC;QACnC,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QAE5D,OAAO;YACN,GAAG,KAAK;YACR,OAAO,EACN,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ;gBACzC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO;gBACnD,CAAC,CAAC,KAAK,CAAC,OAAO;YACjB,IAAI,EAAE;gBACL,GAAG,KAAK,CAAC,IAAI;gBAEb,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,SAAS;aACf;YAED,KAAK,EAAE,SAAS;SAChB,CAAC;IACH,CAAC;CACD,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,SAAC,CAAC,SAAS,CAAC;AAC9B,QAAA,gBAAgB,GAAG,SAAC,CAAC,MAAM,CAAC;AAC5B,QAAA,mBAAmB,GAAG,SAAC,CAAC,mBAAmB,CAAC;AAIzD,+DAAqE;AAA5D,+GAAA,iBAAiB,OAAA;AAC1B,sDAAqD;AAA5C,wGAAA,UAAU,OAAA;AACnB,uCAAyC;AAAhC,mGAAA,SAAS,OAAA","sourcesContent":["import { initTRPC } from '@trpc/server';\nimport { ZodError } from 'zod';\nimport { LyxaContext } from './context';\n\nexport const t = initTRPC.context<LyxaContext>().create({\n\terrorFormatter({ shape, error }) {\n\t\tlet zodErrors = null;\n\n\t\tif (error.code === 'BAD_REQUEST' && error.cause instanceof ZodError) {\n\t\t\tconst flattened = error.cause.flatten();\n\t\t\tzodErrors = flattened.fieldErrors;\n\t\t}\n\n\t\tconsole.log('Error:', error, shape, 'error log', zodErrors);\n\n\t\treturn {\n\t\t\t...shape,\n\t\t\tmessage:\n\t\t\t\tzodErrors && typeof zodErrors === 'object'\n\t\t\t\t\t? Object.values(zodErrors)[0]?.[0] || shape.message\n\t\t\t\t\t: shape.message,\n\t\t\tdata: {\n\t\t\t\t...shape.data,\n\n\t\t\t\tstack: undefined,\n\t\t\t\tpath: undefined,\n\t\t\t},\n\t\t\t// Prevent stack trace from being returned in the response\n\t\t\tstack: undefined,\n\t\t};\n\t},\n});\n\nexport const publicProcedure = t.procedure;\nexport const createTRPCRouter = t.router;\nexport const createCallerFactory = t.createCallerFactory;\n\nexport type { inferRouterInputs, inferRouterOutputs } from '@trpc/server';\nexport type { AnyTRPCRouter } from '@trpc/server';\nexport { createHTTPHandler } from '@trpc/server/adapters/standalone';\nexport { observable } from '@trpc/server/observable';\nexport { TRPCError } from '@trpc/server';\n\nexport type LyxaRouter = ReturnType<typeof createTRPCRouter>;"]}
|
|
@@ -4,36 +4,13 @@ interface AuthOptions {
|
|
|
4
4
|
allowRefreshToken?: boolean;
|
|
5
5
|
autoRefresh?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare function createAuthenticatedProcedure(options: AuthOptions): import("@trpc/server").
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
17
|
-
httpStatus: number;
|
|
18
|
-
};
|
|
19
|
-
stack: undefined;
|
|
20
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
21
|
-
};
|
|
22
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
23
|
-
}>;
|
|
24
|
-
_meta: object;
|
|
25
|
-
_ctx_out: {
|
|
26
|
-
requestId: string | undefined;
|
|
27
|
-
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
28
|
-
tokenType: TokenType | undefined;
|
|
29
|
-
entity: import("../context").EntityContext | undefined;
|
|
30
|
-
req: import("http").IncomingMessage;
|
|
31
|
-
usedRefreshToken: boolean | undefined;
|
|
32
|
-
tokenRenewed: boolean | undefined;
|
|
33
|
-
};
|
|
34
|
-
_input_in: typeof import("@trpc/server").unsetMarker;
|
|
35
|
-
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
36
|
-
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
37
|
-
_output_out: typeof import("@trpc/server").unsetMarker;
|
|
38
|
-
}>;
|
|
7
|
+
export declare function createAuthenticatedProcedure(options: AuthOptions): import("@trpc/server").TRPCProcedureBuilder<import("../context").LyxaHTTPContext, object, {
|
|
8
|
+
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
9
|
+
tokenType: TokenType | undefined;
|
|
10
|
+
entity: import("../context").EntityContext | undefined;
|
|
11
|
+
req: import("http").IncomingMessage;
|
|
12
|
+
requestId: string | undefined;
|
|
13
|
+
usedRefreshToken: boolean | undefined;
|
|
14
|
+
tokenRenewed: boolean | undefined;
|
|
15
|
+
}, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, false>;
|
|
39
16
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AuthEntityType } from '../../auth';
|
|
2
|
+
interface RoleProtectedOptions {
|
|
3
|
+
entityTypes: AuthEntityType[];
|
|
4
|
+
allowedRoles: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare function createRoleProtectedProcedure(options: RoleProtectedOptions): import("@trpc/server").TRPCProcedureBuilder<import("../context").LyxaHTTPContext, object, {
|
|
7
|
+
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
8
|
+
tokenType: import("../../auth").TokenType | undefined;
|
|
9
|
+
entity: import("../context").EntityContext | undefined;
|
|
10
|
+
req: import("http").IncomingMessage;
|
|
11
|
+
requestId: string | undefined;
|
|
12
|
+
usedRefreshToken: boolean | undefined;
|
|
13
|
+
tokenRenewed: boolean | undefined;
|
|
14
|
+
}, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, false>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRoleProtectedProcedure = createRoleProtectedProcedure;
|
|
4
|
+
const server_1 = require("@trpc/server");
|
|
5
|
+
const auth_1 = require("./auth");
|
|
6
|
+
function createRoleProtectedProcedure(options) {
|
|
7
|
+
return (0, auth_1.createAuthenticatedProcedure)({ entityTypes: options.entityTypes }).use(async ({ ctx, next }) => {
|
|
8
|
+
if (!ctx.entity) {
|
|
9
|
+
throw new server_1.TRPCError({ code: 'UNAUTHORIZED', message: 'User not authorized' });
|
|
10
|
+
}
|
|
11
|
+
const role = ctx.entity.parameters?.role;
|
|
12
|
+
if (typeof role !== 'string' || !options.allowedRoles.includes(role)) {
|
|
13
|
+
throw new server_1.TRPCError({
|
|
14
|
+
code: 'FORBIDDEN',
|
|
15
|
+
message: 'You do not have the required role to access this resource',
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return next({ ctx });
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=createRoleProtectedProcedure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRoleProtectedProcedure.js","sourceRoot":"/","sources":["libraries/trpc/middlewares/createRoleProtectedProcedure.ts"],"names":[],"mappings":";;AAYA,oEAgBC;AA5BD,yCAAyC;AACzC,iCAAsD;AAWtD,SAAgB,4BAA4B,CAAC,OAA6B;IACzE,OAAO,IAAA,mCAA4B,EAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;QACrG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,kBAAS,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC,CAAC;QAC/E,CAAC;QAED,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;QACzC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACtE,MAAM,IAAI,kBAAS,CAAC;gBACnB,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,2DAA2D;aACpE,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { TRPCError } from '@trpc/server';\nimport { createAuthenticatedProcedure } from './auth';\nimport { AuthEntityType } from '../../auth';\n\ninterface RoleProtectedOptions {\n\tentityTypes: AuthEntityType[];\n\tallowedRoles: string[];\n}\n\n/**\n * Middleware that ensures the user has one of the allowed roles from ctx.entity.parameters.role\n */\nexport function createRoleProtectedProcedure(options: RoleProtectedOptions) {\n\treturn createAuthenticatedProcedure({ entityTypes: options.entityTypes }).use(async ({ ctx, next }) => {\n\t\tif (!ctx.entity) {\n\t\t\tthrow new TRPCError({ code: 'UNAUTHORIZED', message: 'User not authorized' });\n\t\t}\n\n\t\tconst role = ctx.entity.parameters?.role;\n\t\tif (typeof role !== 'string' || !options.allowedRoles.includes(role)) {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: 'FORBIDDEN',\n\t\t\t\tmessage: 'You do not have the required role to access this resource',\n\t\t\t});\n\t\t}\n\n\t\treturn next({ ctx });\n\t});\n}\n"]}
|
|
@@ -2,36 +2,13 @@ import { AuthEntityType } from '../../auth';
|
|
|
2
2
|
interface PhoneVerifiedOptions {
|
|
3
3
|
entityTypes: AuthEntityType[];
|
|
4
4
|
}
|
|
5
|
-
export declare function createPhoneVerifiedProcedure(options: PhoneVerifiedOptions): import("@trpc/server").
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
15
|
-
httpStatus: number;
|
|
16
|
-
};
|
|
17
|
-
stack: undefined;
|
|
18
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
19
|
-
};
|
|
20
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
21
|
-
}>;
|
|
22
|
-
_meta: object;
|
|
23
|
-
_ctx_out: {
|
|
24
|
-
requestId: string | undefined;
|
|
25
|
-
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
26
|
-
tokenType: import("../../auth").TokenType | undefined;
|
|
27
|
-
entity: import("../context").EntityContext | undefined;
|
|
28
|
-
req: import("http").IncomingMessage;
|
|
29
|
-
usedRefreshToken: boolean | undefined;
|
|
30
|
-
tokenRenewed: boolean | undefined;
|
|
31
|
-
};
|
|
32
|
-
_input_in: typeof import("@trpc/server").unsetMarker;
|
|
33
|
-
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
34
|
-
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
35
|
-
_output_out: typeof import("@trpc/server").unsetMarker;
|
|
36
|
-
}>;
|
|
5
|
+
export declare function createPhoneVerifiedProcedure(options: PhoneVerifiedOptions): import("@trpc/server").TRPCProcedureBuilder<import("../context").LyxaHTTPContext, object, {
|
|
6
|
+
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
7
|
+
tokenType: import("../../auth").TokenType | undefined;
|
|
8
|
+
entity: import("../context").EntityContext | undefined;
|
|
9
|
+
req: import("http").IncomingMessage;
|
|
10
|
+
requestId: string | undefined;
|
|
11
|
+
usedRefreshToken: boolean | undefined;
|
|
12
|
+
tokenRenewed: boolean | undefined;
|
|
13
|
+
}, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, false>;
|
|
37
14
|
export {};
|
|
@@ -4,36 +4,13 @@ interface AuthOptions {
|
|
|
4
4
|
allowRefreshToken?: boolean;
|
|
5
5
|
autoRefresh?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare function publicUserDecoder(options: AuthOptions): import("@trpc/server").
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
17
|
-
httpStatus: number;
|
|
18
|
-
};
|
|
19
|
-
stack: undefined;
|
|
20
|
-
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
21
|
-
};
|
|
22
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
23
|
-
}>;
|
|
24
|
-
_meta: object;
|
|
25
|
-
_ctx_out: {
|
|
26
|
-
requestId: string | undefined;
|
|
27
|
-
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
28
|
-
tokenType: TokenType | undefined;
|
|
29
|
-
entity: import("../context").EntityContext | undefined;
|
|
30
|
-
req: import("http").IncomingMessage;
|
|
31
|
-
usedRefreshToken: boolean | undefined;
|
|
32
|
-
tokenRenewed: boolean | undefined;
|
|
33
|
-
};
|
|
34
|
-
_input_in: typeof import("@trpc/server").unsetMarker;
|
|
35
|
-
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
36
|
-
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
37
|
-
_output_out: typeof import("@trpc/server").unsetMarker;
|
|
38
|
-
}>;
|
|
7
|
+
export declare function publicUserDecoder(options: AuthOptions): import("@trpc/server").TRPCProcedureBuilder<import("../context").LyxaHTTPContext, object, {
|
|
8
|
+
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
9
|
+
tokenType: TokenType | undefined;
|
|
10
|
+
entity: import("../context").EntityContext | undefined;
|
|
11
|
+
req: import("http").IncomingMessage;
|
|
12
|
+
requestId: string | undefined;
|
|
13
|
+
usedRefreshToken: boolean | undefined;
|
|
14
|
+
tokenRenewed: boolean | undefined;
|
|
15
|
+
}, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, import("@trpc/server").TRPCUnsetMarker, false>;
|
|
39
16
|
export {};
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED