vimcord 1.0.47 → 1.0.48
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/index.cjs +22 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +26 -26
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2468,15 +2468,20 @@ declare class MongoSchemaBuilder<Definition extends object = any> {
|
|
|
2468
2468
|
} ? T : T & {
|
|
2469
2469
|
__v: number;
|
|
2470
2470
|
} : never : never))[]>;
|
|
2471
|
-
upsert(filter: RootFilterQuery<Definition>, query: Partial<Require_id<Definition>>, options?: QueryOptions<Definition>): Promise<Document<unknown, {}, Definition, {}, {}> & (Require_id<Definition> extends infer T ? T extends Require_id<Definition> ? T extends {
|
|
2471
|
+
upsert(filter: RootFilterQuery<Definition>, query: Partial<Require_id<Definition>>, options?: Exclude<QueryOptions<Definition>, "upsert">): Promise<(Document<unknown, {}, Definition, {}, {}> & (Require_id<Definition> extends infer T ? T extends Require_id<Definition> ? T extends {
|
|
2472
2472
|
__v?: infer U;
|
|
2473
2473
|
} ? T : T & {
|
|
2474
2474
|
__v: number;
|
|
2475
|
-
} : never : never)>;
|
|
2475
|
+
} : never : never)) | null>;
|
|
2476
2476
|
delete(filter: RootFilterQuery<Definition>, options?: mongo.DeleteOptions & MongooseBaseQueryOptions<Definition>): Promise<mongo.DeleteResult>;
|
|
2477
2477
|
deleteAll(filter: RootFilterQuery<Definition>, options?: mongo.DeleteOptions & MongooseBaseQueryOptions<Definition>): Promise<mongo.DeleteResult>;
|
|
2478
2478
|
distinct<K extends keyof Require_id<Definition> & string>(key: K, filter?: RootFilterQuery<Definition>, options?: QueryOptions<Definition>): Promise<(K extends keyof Definition | mongoose.NestedPaths<Required<Definition>, keyof Definition> ? mongoose.WithoutUndefined<mongoose.Unpacked<mongoose.WithLevel1NestedPaths<Definition, keyof Definition>[K]>> : unknown)[]>;
|
|
2479
|
-
fetch<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options
|
|
2479
|
+
fetch<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options & {
|
|
2480
|
+
required?: boolean;
|
|
2481
|
+
}): Promise<LeanOrHydratedDocument<Definition, Options> | null | undefined>;
|
|
2482
|
+
fetch<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options & {
|
|
2483
|
+
required: true;
|
|
2484
|
+
}): Promise<LeanOrHydratedDocument<Definition, Options>>;
|
|
2480
2485
|
fetchAll<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options>[]>;
|
|
2481
2486
|
update<Options extends QueryOptions<Definition>>(filter: RootFilterQuery<Definition>, update: UpdateQuery<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options> | null | undefined>;
|
|
2482
2487
|
updateAll(filter: RootFilterQuery<Definition>, update: UpdateQuery<Definition>, options?: mongo.UpdateOptions & MongooseUpdateQueryOptions<Definition>): Promise<mongoose.UpdateWriteOpResult>;
|
package/dist/index.d.ts
CHANGED
|
@@ -2468,15 +2468,20 @@ declare class MongoSchemaBuilder<Definition extends object = any> {
|
|
|
2468
2468
|
} ? T : T & {
|
|
2469
2469
|
__v: number;
|
|
2470
2470
|
} : never : never))[]>;
|
|
2471
|
-
upsert(filter: RootFilterQuery<Definition>, query: Partial<Require_id<Definition>>, options?: QueryOptions<Definition>): Promise<Document<unknown, {}, Definition, {}, {}> & (Require_id<Definition> extends infer T ? T extends Require_id<Definition> ? T extends {
|
|
2471
|
+
upsert(filter: RootFilterQuery<Definition>, query: Partial<Require_id<Definition>>, options?: Exclude<QueryOptions<Definition>, "upsert">): Promise<(Document<unknown, {}, Definition, {}, {}> & (Require_id<Definition> extends infer T ? T extends Require_id<Definition> ? T extends {
|
|
2472
2472
|
__v?: infer U;
|
|
2473
2473
|
} ? T : T & {
|
|
2474
2474
|
__v: number;
|
|
2475
|
-
} : never : never)>;
|
|
2475
|
+
} : never : never)) | null>;
|
|
2476
2476
|
delete(filter: RootFilterQuery<Definition>, options?: mongo.DeleteOptions & MongooseBaseQueryOptions<Definition>): Promise<mongo.DeleteResult>;
|
|
2477
2477
|
deleteAll(filter: RootFilterQuery<Definition>, options?: mongo.DeleteOptions & MongooseBaseQueryOptions<Definition>): Promise<mongo.DeleteResult>;
|
|
2478
2478
|
distinct<K extends keyof Require_id<Definition> & string>(key: K, filter?: RootFilterQuery<Definition>, options?: QueryOptions<Definition>): Promise<(K extends keyof Definition | mongoose.NestedPaths<Required<Definition>, keyof Definition> ? mongoose.WithoutUndefined<mongoose.Unpacked<mongoose.WithLevel1NestedPaths<Definition, keyof Definition>[K]>> : unknown)[]>;
|
|
2479
|
-
fetch<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options
|
|
2479
|
+
fetch<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options & {
|
|
2480
|
+
required?: boolean;
|
|
2481
|
+
}): Promise<LeanOrHydratedDocument<Definition, Options> | null | undefined>;
|
|
2482
|
+
fetch<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options & {
|
|
2483
|
+
required: true;
|
|
2484
|
+
}): Promise<LeanOrHydratedDocument<Definition, Options>>;
|
|
2480
2485
|
fetchAll<Options extends QueryOptions<Definition>>(filter?: RootFilterQuery<Definition>, projection?: ProjectionType<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options>[]>;
|
|
2481
2486
|
update<Options extends QueryOptions<Definition>>(filter: RootFilterQuery<Definition>, update: UpdateQuery<Definition>, options?: Options): Promise<LeanOrHydratedDocument<Definition, Options> | null | undefined>;
|
|
2482
2487
|
updateAll(filter: RootFilterQuery<Definition>, update: UpdateQuery<Definition>, options?: mongo.UpdateOptions & MongooseUpdateQueryOptions<Definition>): Promise<mongoose.UpdateWriteOpResult>;
|
package/dist/index.js
CHANGED
|
@@ -1693,7 +1693,7 @@ var VimcordErrorHandler = class {
|
|
|
1693
1693
|
import chalk2 from "chalk";
|
|
1694
1694
|
|
|
1695
1695
|
// package.json
|
|
1696
|
-
var version = "1.0.
|
|
1696
|
+
var version = "1.0.48";
|
|
1697
1697
|
|
|
1698
1698
|
// src/client/vimcord.logger.ts
|
|
1699
1699
|
var clientLoggerFactory = (client) => new Logger({ prefixEmoji: "\u26A1", prefix: `vimcord (i${client.clientId})` }).extend({
|
|
@@ -2981,7 +2981,7 @@ import {
|
|
|
2981
2981
|
Schema
|
|
2982
2982
|
} from "mongoose";
|
|
2983
2983
|
import { randomBytes } from "crypto";
|
|
2984
|
-
import {
|
|
2984
|
+
import { retry } from "qznt";
|
|
2985
2985
|
try {
|
|
2986
2986
|
import("mongoose");
|
|
2987
2987
|
} catch {
|
|
@@ -3067,7 +3067,7 @@ var MongoSchemaBuilder = class _MongoSchemaBuilder {
|
|
|
3067
3067
|
* @param maxRetries [default: 3]
|
|
3068
3068
|
*/
|
|
3069
3069
|
async execute(fn, maxRetries = 3) {
|
|
3070
|
-
return
|
|
3070
|
+
return retry(
|
|
3071
3071
|
async () => {
|
|
3072
3072
|
const model = await this.getModel();
|
|
3073
3073
|
return await fn(model);
|
|
@@ -3076,19 +3076,19 @@ var MongoSchemaBuilder = class _MongoSchemaBuilder {
|
|
|
3076
3076
|
);
|
|
3077
3077
|
}
|
|
3078
3078
|
async startSession(options) {
|
|
3079
|
-
return
|
|
3079
|
+
return this.execute(async () => {
|
|
3080
3080
|
if (!this.db) throw new Error("No database instance found");
|
|
3081
3081
|
return await this.db.startSession(options);
|
|
3082
3082
|
});
|
|
3083
3083
|
}
|
|
3084
3084
|
async useTransaction(fn) {
|
|
3085
|
-
return
|
|
3085
|
+
return this.execute(async (model) => {
|
|
3086
3086
|
if (!this.db) throw new Error("No database instance found");
|
|
3087
3087
|
return await this.db.useTransaction((session) => fn(session, model));
|
|
3088
3088
|
});
|
|
3089
3089
|
}
|
|
3090
3090
|
async createHexId(bytes, path2, maxRetries = 10) {
|
|
3091
|
-
return
|
|
3091
|
+
return this.execute(async (model) => {
|
|
3092
3092
|
const createHex = () => randomBytes(bytes).toString("hex");
|
|
3093
3093
|
let id = createHex();
|
|
3094
3094
|
let tries = 0;
|
|
@@ -3101,57 +3101,57 @@ var MongoSchemaBuilder = class _MongoSchemaBuilder {
|
|
|
3101
3101
|
});
|
|
3102
3102
|
}
|
|
3103
3103
|
async count(filter, options) {
|
|
3104
|
-
return
|
|
3104
|
+
return this.execute(async (model) => model.countDocuments(filter, options));
|
|
3105
3105
|
}
|
|
3106
3106
|
async exists(filter) {
|
|
3107
|
-
return
|
|
3107
|
+
return this.execute(async (model) => !!await model.exists(filter));
|
|
3108
3108
|
}
|
|
3109
3109
|
async create(query, options) {
|
|
3110
|
-
return
|
|
3110
|
+
return this.execute(async (model) => model.create(query, options));
|
|
3111
3111
|
}
|
|
3112
3112
|
async upsert(filter, query, options) {
|
|
3113
|
-
return
|
|
3114
|
-
async (model) => model.findOneAndUpdate(filter, query, { ...options, upsert: true
|
|
3113
|
+
return this.execute(
|
|
3114
|
+
async (model) => model.findOneAndUpdate(filter, query, { returnDocument: "after", ...options, upsert: true })
|
|
3115
3115
|
);
|
|
3116
3116
|
}
|
|
3117
3117
|
async delete(filter, options) {
|
|
3118
|
-
return
|
|
3118
|
+
return this.execute(async (model) => model.deleteOne(filter, options));
|
|
3119
3119
|
}
|
|
3120
3120
|
async deleteAll(filter, options) {
|
|
3121
|
-
return
|
|
3121
|
+
return this.execute(async (model) => model.deleteMany(filter, options));
|
|
3122
3122
|
}
|
|
3123
3123
|
async distinct(key, filter, options) {
|
|
3124
|
-
return
|
|
3124
|
+
return this.execute(async (model) => model.distinct(key, filter, options));
|
|
3125
3125
|
}
|
|
3126
3126
|
async fetch(filter, projection, options) {
|
|
3127
|
-
|
|
3127
|
+
const result = await this.execute(
|
|
3128
3128
|
async (model) => model.findOne(filter, projection, { ...options, lean: options?.lean ?? true })
|
|
3129
3129
|
);
|
|
3130
|
+
if (options?.required && !result) throw new Error("Document not found");
|
|
3131
|
+
return result;
|
|
3130
3132
|
}
|
|
3131
3133
|
async fetchAll(filter = {}, projection, options) {
|
|
3132
|
-
return
|
|
3133
|
-
async (model) => model.find(filter, projection, { ...options, lean: options?.lean ?? true })
|
|
3134
|
-
);
|
|
3134
|
+
return this.execute(async (model) => model.find(filter, projection, { ...options, lean: options?.lean ?? true }));
|
|
3135
3135
|
}
|
|
3136
3136
|
async update(filter, update, options) {
|
|
3137
|
-
return
|
|
3137
|
+
return this.execute(
|
|
3138
3138
|
async (model) => model.findOneAndUpdate(filter, update, { ...options, lean: options?.lean ?? true })
|
|
3139
3139
|
);
|
|
3140
3140
|
}
|
|
3141
3141
|
async updateAll(filter, update, options) {
|
|
3142
|
-
return
|
|
3142
|
+
return this.execute(async (model) => model.updateMany(filter, update, options));
|
|
3143
3143
|
}
|
|
3144
3144
|
async aggregate(pipeline, options) {
|
|
3145
|
-
return
|
|
3145
|
+
return this.execute(async (model) => {
|
|
3146
3146
|
const result = await model.aggregate(pipeline, options);
|
|
3147
3147
|
return result?.length ? result : [];
|
|
3148
3148
|
});
|
|
3149
3149
|
}
|
|
3150
3150
|
async bulkWrite(ops, options) {
|
|
3151
|
-
return
|
|
3151
|
+
return this.execute(async (model) => model.bulkWrite(ops, options));
|
|
3152
3152
|
}
|
|
3153
3153
|
async bulkSave(docs, options) {
|
|
3154
|
-
return
|
|
3154
|
+
return this.execute(async (model) => model.bulkSave(docs, options));
|
|
3155
3155
|
}
|
|
3156
3156
|
};
|
|
3157
3157
|
|
|
@@ -3484,7 +3484,7 @@ import {
|
|
|
3484
3484
|
TextInputStyle,
|
|
3485
3485
|
UserSelectMenuBuilder
|
|
3486
3486
|
} from "discord.js";
|
|
3487
|
-
import { $ as $
|
|
3487
|
+
import { $ as $6 } from "qznt";
|
|
3488
3488
|
var BetterModal = class {
|
|
3489
3489
|
id;
|
|
3490
3490
|
options;
|
|
@@ -3504,10 +3504,10 @@ var BetterModal = class {
|
|
|
3504
3504
|
}
|
|
3505
3505
|
}
|
|
3506
3506
|
createModalId() {
|
|
3507
|
-
return `modal:${$
|
|
3507
|
+
return `modal:${$6.rnd.str(10, "alpha", { casing: "mixed" })}-${Date.now()}`;
|
|
3508
3508
|
}
|
|
3509
3509
|
createComponentId() {
|
|
3510
|
-
return `modal-component:${this.id}-${$
|
|
3510
|
+
return `modal-component:${this.id}-${$6.rnd.str(4, "alpha", { casing: "mixed" })}-${Date.now().toString().slice(-4)}`;
|
|
3511
3511
|
}
|
|
3512
3512
|
validateComponentLength() {
|
|
3513
3513
|
if (this.components.size >= 5) throw new Error("Modal can only have 5 components");
|