vimcord 1.0.48 → 1.0.49
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 +6 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -8
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +8 -3
package/dist/index.cjs
CHANGED
|
@@ -3072,7 +3072,6 @@ var MongoDatabase = class _MongoDatabase {
|
|
|
3072
3072
|
|
|
3073
3073
|
// src/db/mongo/mongoSchema.builder.ts
|
|
3074
3074
|
var import_mongoose2 = require("mongoose");
|
|
3075
|
-
var import_node_crypto4 = require("crypto");
|
|
3076
3075
|
var import_qznt6 = require("qznt");
|
|
3077
3076
|
try {
|
|
3078
3077
|
import("mongoose");
|
|
@@ -3179,16 +3178,15 @@ var MongoSchemaBuilder = class _MongoSchemaBuilder {
|
|
|
3179
3178
|
return await this.db.useTransaction((session) => fn(session, model));
|
|
3180
3179
|
});
|
|
3181
3180
|
}
|
|
3182
|
-
async
|
|
3181
|
+
async createUniqueId(collisionPath, fn, maxRetries = 10) {
|
|
3183
3182
|
return this.execute(async (model) => {
|
|
3184
|
-
|
|
3185
|
-
let id = createHex();
|
|
3183
|
+
let id;
|
|
3186
3184
|
let tries = 0;
|
|
3187
|
-
|
|
3188
|
-
if (tries >= maxRetries) throw Error(`Failed to generate a unique
|
|
3189
|
-
id =
|
|
3185
|
+
do {
|
|
3186
|
+
if (tries >= maxRetries) throw new Error(`Failed to generate a unique ID after ${tries} attempt(s)`);
|
|
3187
|
+
id = fn();
|
|
3190
3188
|
tries++;
|
|
3191
|
-
}
|
|
3189
|
+
} while (await model.exists({ [collisionPath]: id }));
|
|
3192
3190
|
return id;
|
|
3193
3191
|
});
|
|
3194
3192
|
}
|