@lyxa.ai/core 1.4.50 → 1.4.51
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/mongo/plugins/soft-delete-plugin.js +8 -2
- package/dist/libraries/mongo/plugins/soft-delete-plugin.js.map +1 -1
- 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
|
@@ -30,6 +30,9 @@ class SoftDelete {
|
|
|
30
30
|
}
|
|
31
31
|
static addQueryMiddleware(schema) {
|
|
32
32
|
const queryMiddleware = function () {
|
|
33
|
+
const options = this.getOptions();
|
|
34
|
+
if (options?.withDeleted)
|
|
35
|
+
return;
|
|
33
36
|
if (!this.getQuery().deletedAt) {
|
|
34
37
|
this.where({ deletedAt: null });
|
|
35
38
|
}
|
|
@@ -100,10 +103,13 @@ class SoftDelete {
|
|
|
100
103
|
return this.updateMany(filter, { deletedAt: null });
|
|
101
104
|
};
|
|
102
105
|
schema.statics.findWithDeleted = function (filter = {}) {
|
|
103
|
-
return this.find(filter);
|
|
106
|
+
return this.find(filter).setOptions({ withDeleted: true });
|
|
104
107
|
};
|
|
105
108
|
schema.statics.findDeleted = function (filter = {}) {
|
|
106
|
-
return this.find({
|
|
109
|
+
return this.find({
|
|
110
|
+
...filter,
|
|
111
|
+
deletedAt: { $ne: null },
|
|
112
|
+
}).setOptions({ withDeleted: true });
|
|
107
113
|
};
|
|
108
114
|
schema.statics.findRecordById = async function (data) {
|
|
109
115
|
const { _id, select, populate } = data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soft-delete-plugin.js","sourceRoot":"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ACrE,MAAM,qBAAqB,GAAG,CACpC,UAAkC,EAC6B,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAFzF,QAAA,qBAAqB,yBAEoE","sourcesContent":["import { Schema, Query, Model } from 'mongoose';\nimport { getModelForClass, ReturnModelType, mongoose } from '@typegoose/typegoose';\nimport { AnyParamConstructor } from '@typegoose/typegoose/lib/types';\nimport { GetByIdInputDTO, GetOneQueryDTO } from '../../../utilities/validation';\n\n/**\n * Interface for models with soft delete capabilities\n */\nexport interface SoftDeleteModel<T> extends Model<T> {\n\tsoftDelete(_id: mongoose.Types.ObjectId): Promise<any>;\n\tsoftDeleteOne(filter: object): Promise<any>;\n\tsoftDeleteMany(filter?: object): Promise<any>;\n\tdeleteRecord(filter: object, softDelete: boolean): Promise<any>;\n\tdeleteRecords(filter: object, softDelete: boolean): Promise<any>;\n\trestore(_id: mongoose.Types.ObjectId): Promise<any>;\n\trestoreOne(filter: object): Promise<any>;\n\trestoreMany(filter?: object): Promise<any>;\n\tfindWithDeleted(filter?: object): any;\n\tfindDeleted(filter?: object): any;\n\tfindRecordById(data: GetByIdInputDTO): Promise<any>;\n\tfindOneRecord(data: GetOneQueryDTO): Promise<any>;\n}\n\n/**\n * Base class for models with soft delete functionality\n */\nexport class SoftDeleteBase {\n\tdeletedAt?: Date | null;\n}\n\n/**\n * SoftDelete class providing soft deletion functionality for mongoose models\n */\nexport class SoftDelete {\n\t/**\n\t * Apply soft delete plugin to a specific schema\n\t * @param schema Mongoose schema to enhance with soft delete functionality\n\t */\n\tpublic static applyToSchema(schema: Schema): void {\n\t\t// Add deletedAt field if it doesn't exist\n\t\tif (!schema.path('deletedAt')) {\n\t\t\tschema.add({\n\t\t\t\tdeletedAt: {\n\t\t\t\t\ttype: Date,\n\t\t\t\t\tdefault: null,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// Add schema middleware\n\t\tthis.addQueryMiddleware(schema);\n\n\t\t// Add instance methods\n\t\tthis.addInstanceMethods(schema);\n\n\t\t// Add static methods\n\t\tthis.addStaticMethods(schema);\n\t}\n\n\t/**\n\t * Apply soft delete plugin globally to all mongoose schemas\n\t */\n\tpublic static applyGlobally(): void {\n\t\tconst mongoose = require('mongoose');\n\t\tmongoose.plugin((schema: Schema) => this.applyToSchema(schema));\n\t}\n\n\t/**\n\t * Create a model with soft delete capabilities and proper TypeScript types\n\t * @param modelClass The class to create a model from\n\t * @returns A model with soft delete functionality\n\t */\n\tpublic static createModel<T extends SoftDeleteBase>(\n\t\tmodelClass: AnyParamConstructor<T>\n\t): SoftDeleteModel<T> & ReturnModelType<AnyParamConstructor<T>> {\n\t\tconst model = getModelForClass(modelClass);\n\t\treturn model as any; // The plugin adds the methods, we just need to tell TypeScript they exist\n\t}\n\n\t/**\n\t * Add query middleware to filter out soft-deleted documents\n\t * @param schema Schema to add middleware to\n\t */\n\tprivate static addQueryMiddleware(schema: Schema): void {\n\t\tconst queryMiddleware = function (this: Query<any, any>) {\n\t\t\tif (!this.getQuery().deletedAt) {\n\t\t\t\tthis.where({ deletedAt: null });\n\t\t\t}\n\t\t};\n\n\t\t// Apply middleware to relevant query methods\n\t\tschema.pre('find', queryMiddleware);\n\t\tschema.pre('findOne', queryMiddleware);\n\t\tschema.pre('findOneAndUpdate', queryMiddleware);\n\t\tschema.pre('findOneAndDelete', queryMiddleware);\n\t\tschema.pre('findOneAndReplace', queryMiddleware);\n\t\tschema.pre('updateOne', queryMiddleware);\n\t\tschema.pre('updateMany', queryMiddleware);\n\t\t// TypeScript workaround for count hook\n\t\t(schema as any).pre('count', queryMiddleware);\n\t\tschema.pre('countDocuments', queryMiddleware);\n\t\t(schema as any).pre('exists', queryMiddleware);\n\n\t\t// Override findById to respect soft delete\n\t\tschema.statics.findById = function (_id: mongoose.Types.ObjectId, projection?: any, options?: any) {\n\t\t\treturn this.findOne({ _id, deletedAt: null }, projection, options);\n\t\t};\n\t}\n\n\t/**\n\t * Add instance methods for soft delete operations\n\t * @param schema Schema to add methods to\n\t */\n\tprivate static addInstanceMethods(schema: Schema): void {\n\t\tschema.methods.softDelete = function () {\n\t\t\tthis.deletedAt = new Date();\n\t\t\treturn this.save();\n\t\t};\n\n\t\tschema.methods.restore = function () {\n\t\t\tthis.deletedAt = null;\n\t\t\treturn this.save();\n\t\t};\n\t}\n\n\t/**\n\t * Add static methods for soft delete operations\n\t * @param schema Schema to add methods to\n\t */\n\tprivate static addStaticMethods(schema: Schema): void {\n\t\tschema.statics.softDelete = async function (_id: mongoose.Types.ObjectId) {\n\t\t\tconst result = await this.updateOne({ _id }, { deletedAt: new Date() });\n\t\t\treturn result.modifiedCount > 0;\n\t\t};\n\n\t\tschema.statics.softDeleteOne = async function (filter: object) {\n\t\t\tconst result = await this.updateOne(filter, { deletedAt: new Date() });\n\t\t\treturn result.modifiedCount > 0;\n\t\t};\n\n\t\tschema.statics.softDeleteMany = function (filter = {}) {\n\t\t\treturn this.updateMany(filter, { deletedAt: new Date() });\n\t\t};\n\n\t\tschema.statics.deleteRecord = async function (filter: object, softDelete: boolean) {\n\t\t\tif (softDelete) {\n\t\t\t\tconst result = await this.updateOne({ ...filter, deletedAt: null }, { deletedAt: new Date() });\n\t\t\t\treturn Boolean(result.modifiedCount);\n\t\t\t} else {\n\t\t\t\tconst result = await this.deleteOne(filter);\n\t\t\t\treturn Boolean(result.deletedCount);\n\t\t\t}\n\t\t};\n\n\t\tschema.statics.deleteRecords = async function (filter: object, softDelete: boolean) {\n\t\t\tif (softDelete) {\n\t\t\t\tconst result = await this.updateMany({ ...filter, deletedAt: null }, { deletedAt: new Date() });\n\t\t\t\treturn Boolean(result.modifiedCount);\n\t\t\t} else {\n\t\t\t\tconst result = await this.deleteMany(filter);\n\t\t\t\treturn Boolean(result.deletedCount);\n\t\t\t}\n\t\t};\n\n\t\tschema.statics.restore = function (_id: mongoose.Types.ObjectId) {\n\t\t\treturn this.updateOne({ _id }, { deletedAt: null });\n\t\t};\n\n\t\tschema.statics.restoreOne = function (filter: object) {\n\t\t\treturn this.updateOne(filter, { deletedAt: null });\n\t\t};\n\n\t\tschema.statics.restoreMany = function (filter = {}) {\n\t\t\treturn this.updateMany(filter, { deletedAt: null });\n\t\t};\n\n\t\tschema.statics.findWithDeleted = function (filter = {}) {\n\t\t\treturn this.find(filter);\n\t\t};\n\n\t\tschema.statics.findDeleted = function (filter = {}) {\n\t\t\treturn this.find({ ...filter, deletedAt: { $ne: null } });\n\t\t};\n\n\t\tschema.statics.findRecordById = async function (data: GetByIdInputDTO) {\n\t\t\tconst { _id, select, populate } = data;\n\n\t\t\tlet result = this.findById(_id);\n\n\t\t\tif (select) {\n\t\t\t\tresult = result.select(select) as any;\n\t\t\t}\n\n\t\t\tif (populate) {\n\t\t\t\tresult = result.populate(populate);\n\t\t\t}\n\n\t\t\treturn await result.exec();\n\t\t};\n\n\t\tschema.statics.findOneRecord = async function (data: GetOneQueryDTO) {\n\t\t\tconst { query, select, populate } = data;\n\n\t\t\tlet result = this.findOne(query || {});\n\n\t\t\tif (select) {\n\t\t\t\tresult = result.select(select) as any;\n\t\t\t}\n\n\t\t\tif (populate) {\n\t\t\t\tresult = result.populate(populate);\n\t\t\t}\n\n\t\t\treturn await result.exec();\n\t\t};\n\t}\n}\n\n// Export convenience functions with the same names as before for backward compatibility\nexport const softDeletePlugin = (schema: Schema): void => SoftDelete.applyToSchema(schema);\nexport const applySoftDeletePlugin = (): void => SoftDelete.applyGlobally();\nexport const createSoftDeleteModel = <T extends SoftDeleteBase>(\n\tmodelClass: AnyParamConstructor<T>\n): SoftDeleteModel<T> & ReturnModelType<AnyParamConstructor<T>> => SoftDelete.createModel(modelClass);\n"]}
|
|
1
|
+
{"version":3,"file":"soft-delete-plugin.js","sourceRoot":"/","sources":["libraries/mongo/plugins/soft-delete-plugin.ts"],"names":[],"mappings":";;;AACA,oDAAmF;AAyBnF,MAAa,cAAc;IAC1B,SAAS,CAAe;CACxB;AAFD,wCAEC;AAKD,MAAa,UAAU;IAKf,MAAM,CAAC,a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EAAE,CAAC;AAA/D,QAAA,qBAAqB,yBAA0C;AACrE,MAAM,qBAAqB,GAAG,CACpC,UAAkC,EAC6B,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAFzF,QAAA,qBAAqB,yBAEoE","sourcesContent":["import { Schema, Query, Model } from 'mongoose';\nimport { getModelForClass, ReturnModelType, mongoose } from '@typegoose/typegoose';\nimport { AnyParamConstructor } from '@typegoose/typegoose/lib/types';\nimport { GetByIdInputDTO, GetOneQueryDTO } from '../../../utilities/validation';\n\n/**\n * Interface for models with soft delete capabilities\n */\nexport interface SoftDeleteModel<T> extends Model<T> {\n\tsoftDelete(_id: mongoose.Types.ObjectId): Promise<any>;\n\tsoftDeleteOne(filter: object): Promise<any>;\n\tsoftDeleteMany(filter?: object): Promise<any>;\n\tdeleteRecord(filter: object, softDelete: boolean): Promise<any>;\n\tdeleteRecords(filter: object, softDelete: boolean): Promise<any>;\n\trestore(_id: mongoose.Types.ObjectId): Promise<any>;\n\trestoreOne(filter: object): Promise<any>;\n\trestoreMany(filter?: object): Promise<any>;\n\tfindWithDeleted(filter?: object): any;\n\tfindDeleted(filter?: object): any;\n\tfindRecordById(data: GetByIdInputDTO): Promise<any>;\n\tfindOneRecord(data: GetOneQueryDTO): Promise<any>;\n}\n\n/**\n * Base class for models with soft delete functionality\n */\nexport class SoftDeleteBase {\n\tdeletedAt?: Date | null;\n}\n\n/**\n * SoftDelete class providing soft deletion functionality for mongoose models\n */\nexport class SoftDelete {\n\t/**\n\t * Apply soft delete plugin to a specific schema\n\t * @param schema Mongoose schema to enhance with soft delete functionality\n\t */\n\tpublic static applyToSchema(schema: Schema): void {\n\t\t// Add deletedAt field if it doesn't exist\n\t\tif (!schema.path('deletedAt')) {\n\t\t\tschema.add({\n\t\t\t\tdeletedAt: {\n\t\t\t\t\ttype: Date,\n\t\t\t\t\tdefault: null,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// Add schema middleware\n\t\tthis.addQueryMiddleware(schema);\n\n\t\t// Add instance methods\n\t\tthis.addInstanceMethods(schema);\n\n\t\t// Add static methods\n\t\tthis.addStaticMethods(schema);\n\t}\n\n\t/**\n\t * Apply soft delete plugin globally to all mongoose schemas\n\t */\n\tpublic static applyGlobally(): void {\n\t\tconst mongoose = require('mongoose');\n\t\tmongoose.plugin((schema: Schema) => this.applyToSchema(schema));\n\t}\n\n\t/**\n\t * Create a model with soft delete capabilities and proper TypeScript types\n\t * @param modelClass The class to create a model from\n\t * @returns A model with soft delete functionality\n\t */\n\tpublic static createModel<T extends SoftDeleteBase>(\n\t\tmodelClass: AnyParamConstructor<T>\n\t): SoftDeleteModel<T> & ReturnModelType<AnyParamConstructor<T>> {\n\t\tconst model = getModelForClass(modelClass);\n\t\treturn model as any; // The plugin adds the methods, we just need to tell TypeScript they exist\n\t}\n\n\t/**\n\t * Add query middleware to filter out soft-deleted documents\n\t * @param schema Schema to add middleware to\n\t */\n\tprivate static addQueryMiddleware(schema: Schema): void {\n\t\tconst queryMiddleware = function (this: Query<any, any>) {\n\t\t\tconst options = this.getOptions();\n\n\t\t\tif (options?.withDeleted) return;\n\n\t\t\tif (!this.getQuery().deletedAt) {\n\t\t\t\tthis.where({ deletedAt: null });\n\t\t\t}\n\t\t};\n\n\t\t// Apply middleware to relevant query methods\n\t\tschema.pre('find', queryMiddleware);\n\t\tschema.pre('findOne', queryMiddleware);\n\t\tschema.pre('findOneAndUpdate', queryMiddleware);\n\t\tschema.pre('findOneAndDelete', queryMiddleware);\n\t\tschema.pre('findOneAndReplace', queryMiddleware);\n\t\tschema.pre('updateOne', queryMiddleware);\n\t\tschema.pre('updateMany', queryMiddleware);\n\t\t// TypeScript workaround for count hook\n\t\t(schema as any).pre('count', queryMiddleware);\n\t\tschema.pre('countDocuments', queryMiddleware);\n\t\t(schema as any).pre('exists', queryMiddleware);\n\n\t\t// Override findById to respect soft delete\n\t\tschema.statics.findById = function (_id: mongoose.Types.ObjectId, projection?: any, options?: any) {\n\t\t\treturn this.findOne({ _id, deletedAt: null }, projection, options);\n\t\t};\n\t}\n\n\t/**\n\t * Add instance methods for soft delete operations\n\t * @param schema Schema to add methods to\n\t */\n\tprivate static addInstanceMethods(schema: Schema): void {\n\t\tschema.methods.softDelete = function () {\n\t\t\tthis.deletedAt = new Date();\n\t\t\treturn this.save();\n\t\t};\n\n\t\tschema.methods.restore = function () {\n\t\t\tthis.deletedAt = null;\n\t\t\treturn this.save();\n\t\t};\n\t}\n\n\t/**\n\t * Add static methods for soft delete operations\n\t * @param schema Schema to add methods to\n\t */\n\tprivate static addStaticMethods(schema: Schema): void {\n\t\tschema.statics.softDelete = async function (_id: mongoose.Types.ObjectId) {\n\t\t\tconst result = await this.updateOne({ _id }, { deletedAt: new Date() });\n\t\t\treturn result.modifiedCount > 0;\n\t\t};\n\n\t\tschema.statics.softDeleteOne = async function (filter: object) {\n\t\t\tconst result = await this.updateOne(filter, { deletedAt: new Date() });\n\t\t\treturn result.modifiedCount > 0;\n\t\t};\n\n\t\tschema.statics.softDeleteMany = function (filter = {}) {\n\t\t\treturn this.updateMany(filter, { deletedAt: new Date() });\n\t\t};\n\n\t\tschema.statics.deleteRecord = async function (filter: object, softDelete: boolean) {\n\t\t\tif (softDelete) {\n\t\t\t\tconst result = await this.updateOne({ ...filter, deletedAt: null }, { deletedAt: new Date() });\n\t\t\t\treturn Boolean(result.modifiedCount);\n\t\t\t} else {\n\t\t\t\tconst result = await this.deleteOne(filter);\n\t\t\t\treturn Boolean(result.deletedCount);\n\t\t\t}\n\t\t};\n\n\t\tschema.statics.deleteRecords = async function (filter: object, softDelete: boolean) {\n\t\t\tif (softDelete) {\n\t\t\t\tconst result = await this.updateMany({ ...filter, deletedAt: null }, { deletedAt: new Date() });\n\t\t\t\treturn Boolean(result.modifiedCount);\n\t\t\t} else {\n\t\t\t\tconst result = await this.deleteMany(filter);\n\t\t\t\treturn Boolean(result.deletedCount);\n\t\t\t}\n\t\t};\n\n\t\tschema.statics.restore = function (_id: mongoose.Types.ObjectId) {\n\t\t\treturn this.updateOne({ _id }, { deletedAt: null });\n\t\t};\n\n\t\tschema.statics.restoreOne = function (filter: object) {\n\t\t\treturn this.updateOne(filter, { deletedAt: null });\n\t\t};\n\n\t\tschema.statics.restoreMany = function (filter = {}) {\n\t\t\treturn this.updateMany(filter, { deletedAt: null });\n\t\t};\n\n\t\tschema.statics.findWithDeleted = function (filter = {}) {\n\t\t\treturn this.find(filter).setOptions({ withDeleted: true });\n\t\t};\n\n\t\tschema.statics.findDeleted = function (filter = {}) {\n\t\t\treturn this.find({\n\t\t\t\t...filter,\n\t\t\t\tdeletedAt: { $ne: null },\n\t\t\t}).setOptions({ withDeleted: true });\n\t\t};\n\n\t\tschema.statics.findRecordById = async function (data: GetByIdInputDTO) {\n\t\t\tconst { _id, select, populate } = data;\n\n\t\t\tlet result = this.findById(_id);\n\n\t\t\tif (select) {\n\t\t\t\tresult = result.select(select) as any;\n\t\t\t}\n\n\t\t\tif (populate) {\n\t\t\t\tresult = result.populate(populate);\n\t\t\t}\n\n\t\t\treturn await result.exec();\n\t\t};\n\n\t\tschema.statics.findOneRecord = async function (data: GetOneQueryDTO) {\n\t\t\tconst { query, select, populate } = data;\n\n\t\t\tlet result = this.findOne(query || {});\n\n\t\t\tif (select) {\n\t\t\t\tresult = result.select(select) as any;\n\t\t\t}\n\n\t\t\tif (populate) {\n\t\t\t\tresult = result.populate(populate);\n\t\t\t}\n\n\t\t\treturn await result.exec();\n\t\t};\n\t}\n}\n\n// Export convenience functions with the same names as before for backward compatibility\nexport const softDeletePlugin = (schema: Schema): void => SoftDelete.applyToSchema(schema);\nexport const applySoftDeletePlugin = (): void => SoftDelete.applyGlobally();\nexport const createSoftDeleteModel = <T extends SoftDeleteBase>(\n\tmodelClass: AnyParamConstructor<T>\n): SoftDeleteModel<T> & ReturnModelType<AnyParamConstructor<T>> => SoftDelete.createModel(modelClass);\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;
|
|
8
9
|
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
9
10
|
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;
|
|
7
8
|
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
8
9
|
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;
|
|
6
7
|
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
7
8
|
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;
|
|
8
9
|
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
9
10
|
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
|
-
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
|
}>;
|
|
@@ -773,15 +773,15 @@ export declare const GetOrderByIdInputSchema: z.ZodObject<{
|
|
|
773
773
|
userOrderCompletionScope: z.ZodOptional<z.ZodNativeEnum<typeof UserOrderCompletionScope>>;
|
|
774
774
|
}, "strip", z.ZodTypeAny, {
|
|
775
775
|
_id: import("mongoose").Types.ObjectId;
|
|
776
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
777
776
|
populate?: any;
|
|
777
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
778
778
|
groupByCategories?: boolean | undefined;
|
|
779
779
|
getParentCategory?: boolean | undefined;
|
|
780
780
|
userOrderCompletionScope?: UserOrderCompletionScope | undefined;
|
|
781
781
|
}, {
|
|
782
782
|
_id: string | import("mongoose").Types.ObjectId;
|
|
783
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
784
783
|
populate?: any;
|
|
784
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
785
785
|
groupByCategories?: boolean | undefined;
|
|
786
786
|
getParentCategory?: boolean | undefined;
|
|
787
787
|
userOrderCompletionScope?: UserOrderCompletionScope | undefined;
|
|
@@ -791,11 +791,11 @@ export declare const GetByTokenInputSchema: z.ZodOptional<z.ZodObject<{
|
|
|
791
791
|
select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
|
|
792
792
|
populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
|
|
793
793
|
}, "strip", z.ZodTypeAny, {
|
|
794
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
795
794
|
populate?: any;
|
|
796
|
-
}, {
|
|
797
795
|
select?: Record<string, 0 | 1> | undefined;
|
|
796
|
+
}, {
|
|
798
797
|
populate?: any;
|
|
798
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
799
799
|
}>>;
|
|
800
800
|
export type GetByTokenInputDTO = DTO<typeof GetByTokenInputSchema>;
|
|
801
801
|
export declare const GetOneQuerySchema: z.ZodObject<{
|
|
@@ -803,12 +803,12 @@ export declare const GetOneQuerySchema: z.ZodObject<{
|
|
|
803
803
|
select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
|
|
804
804
|
populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
|
|
805
805
|
}, "strip", z.ZodTypeAny, {
|
|
806
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
807
806
|
populate?: any;
|
|
807
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
808
808
|
query?: Record<string, any> | undefined;
|
|
809
809
|
}, {
|
|
810
|
-
select?: Record<string, 0 | 1> | undefined;
|
|
811
810
|
populate?: any;
|
|
811
|
+
select?: Record<string, 0 | 1> | undefined;
|
|
812
812
|
query?: Record<string, any> | undefined;
|
|
813
813
|
}>;
|
|
814
814
|
export type GetOneQueryDTO = DTO<typeof GetOneQuerySchema>;
|