diff --git a/benchmarks/src/lib/constants/benchmark-tests.ts b/benchmarks/src/lib/constants/benchmark-tests.ts index 3bc44463..8d042a61 100644 --- a/benchmarks/src/lib/constants/benchmark-tests.ts +++ b/benchmarks/src/lib/constants/benchmark-tests.ts @@ -390,7 +390,7 @@ export const BENCHMARK_TESTS: Benchmark.Test[] = [ } }, { - name: `${Method.Random} (Duplicates)`, + name: `${Method.Random} (Unique)`, beforeAll: async ({ provider, entries }) => { await provider[Method.SetMany]({ @@ -402,7 +402,7 @@ export const BENCHMARK_TESTS: Benchmark.Test[] = [ }, run: async ({ provider }) => { - await provider[Method.Random]({ method: Method.Random, errors: [], count: 5, duplicates: true }); + await provider[Method.Random]({ method: Method.Random, errors: [], count: 5, unique: true }); } }, { @@ -418,11 +418,11 @@ export const BENCHMARK_TESTS: Benchmark.Test[] = [ }, run: async ({ provider }) => { - await provider[Method.Random]({ method: Method.Random, errors: [], count: 5, duplicates: false }); + await provider[Method.Random]({ method: Method.Random, errors: [], count: 5, unique: false }); } }, { - name: `${Method.RandomKey} (Duplicates)`, + name: `${Method.RandomKey} (Unique)`, beforeAll: async ({ provider, entries }) => { await provider[Method.SetMany]({ @@ -434,7 +434,7 @@ export const BENCHMARK_TESTS: Benchmark.Test[] = [ }, run: async ({ provider }) => { - await provider[Method.RandomKey]({ method: Method.RandomKey, errors: [], count: 5, duplicates: true }); + await provider[Method.RandomKey]({ method: Method.RandomKey, errors: [], count: 5, unique: true }); } }, { @@ -450,7 +450,7 @@ export const BENCHMARK_TESTS: Benchmark.Test[] = [ }, run: async ({ provider }) => { - await provider[Method.RandomKey]({ method: Method.RandomKey, errors: [], count: 5, duplicates: false }); + await provider[Method.RandomKey]({ method: Method.RandomKey, errors: [], count: 5, unique: false }); } }, { diff --git a/packages/json/package.json b/packages/json/package.json index 2e1efd53..db544bfc 100644 --- a/packages/json/package.json +++ b/packages/json/package.json @@ -27,7 +27,7 @@ "check-update": "cliff-jumper --dry-run" }, "dependencies": { - "@joshdb/provider": "2.0.0-next.a699598.0", + "@joshdb/provider": "2.0.0-next.095d141.0", "@sapphire/async-queue": "^1.5.0", "@sapphire/snowflake": "^3.5.1", "@sapphire/utilities": "^3.12.0", diff --git a/packages/json/src/lib/JSONProvider.ts b/packages/json/src/lib/JSONProvider.ts index 690a483c..fc290f05 100644 --- a/packages/json/src/lib/JSONProvider.ts +++ b/packages/json/src/lib/JSONProvider.ts @@ -550,60 +550,70 @@ export class JSONProvider extends JoshProvider): Promise> { - const { count, duplicates } = payload; + const { count, unique } = payload; const size = await this.handler.size(); - if (size === 0) return { ...payload, data: [] }; - if (size < count) { + if (unique && size < count) { payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.Random }, { size })); return payload; } + if (size === 0) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.MissingData, method: Method.Random }, { unique, count })); + + return payload; + } + payload.data = []; const keys = await this.handler.keys(); - if (duplicates) { - while (payload.data.length < count) { - const key = keys[Math.floor(Math.random() * size)]; - - payload.data.push((await this.handler.get(key))!); - } - } else { + if (unique) { const randomKeys = new Set(); while (randomKeys.size < count) randomKeys.add(keys[Math.floor(Math.random() * keys.length)]); for (const key of randomKeys) payload.data.push((await this.handler.get(key))!); + } else { + while (payload.data.length < count) { + const key = keys[Math.floor(Math.random() * size)]; + + payload.data.push((await this.handler.get(key))!); + } } return payload; } public async [Method.RandomKey](payload: Payload.RandomKey): Promise { - const { count, duplicates } = payload; + const { count, unique } = payload; const size = await this.handler.size(); - if (size === 0) return { ...payload, data: [] }; - if (size < count) { + if (unique && size < count) { payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.RandomKey }, { size })); return payload; } + if (size === 0) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.MissingData, method: Method.RandomKey }, { size })); + + return payload; + } + payload.data = []; const keys = await this.handler.keys(); - if (duplicates) { - while (payload.data.length < count) payload.data.push(keys[Math.floor(Math.random() * size)]); - } else { + if (unique) { const randomKeys = new Set(); while (randomKeys.size < count) randomKeys.add(keys[Math.floor(Math.random() * keys.length)]); for (const key of randomKeys) payload.data.push(key); + } else { + while (payload.data.length < count) payload.data.push(keys[Math.floor(Math.random() * size)]); } return payload; diff --git a/packages/map/package.json b/packages/map/package.json index 1eb1237a..f3caf8b6 100644 --- a/packages/map/package.json +++ b/packages/map/package.json @@ -26,7 +26,7 @@ "check-update": "cliff-jumper --dry-run" }, "dependencies": { - "@joshdb/provider": "2.0.0-next.a699598.0", + "@joshdb/provider": "2.0.0-next.095d141.0", "@sapphire/utilities": "^3.12.0", "better-serialize": "^1.0.0", "property-helpers": "^2.0.0" diff --git a/packages/map/src/lib/MapProvider.ts b/packages/map/src/lib/MapProvider.ts index 722a89a4..56fd215c 100644 --- a/packages/map/src/lib/MapProvider.ts +++ b/packages/map/src/lib/MapProvider.ts @@ -488,60 +488,68 @@ export class MapProvider extends JoshProvider): Payload.Random { - if (this.cache.size === 0) return { ...payload, data: [] }; + const { count, unique } = payload; - const { count, duplicates } = payload; - - if (this.cache.size < count) { + if (unique && this.cache.size < count) { payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.Random })); return payload; } + if (this.cache.size === 0) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.MissingData, method: Method.Random, context: { unique, count } })); + + return payload; + } + payload.data = []; const keys = Array.from(this.cache.keys()); - if (duplicates) { - while (payload.data.length < count) { - const key = keys[Math.floor(Math.random() * keys.length)]; - - payload.data.push(this.cache.get(key)!); - } - } else { + if (unique) { const randomKeys = new Set(); while (randomKeys.size < count) randomKeys.add(keys[Math.floor(Math.random() * keys.length)]); for (const key of randomKeys) payload.data.push(this.cache.get(key)!); + } else { + while (payload.data.length < count) { + const key = keys[Math.floor(Math.random() * keys.length)]; + + payload.data.push(this.cache.get(key)!); + } } return payload; } public [Method.RandomKey](payload: Payload.RandomKey): Payload.RandomKey { - if (this.cache.size === 0) return { ...payload, data: [] }; + const { count, unique } = payload; - const { count, duplicates } = payload; - - if (this.cache.size < count) { + if (unique && this.cache.size < count) { payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.RandomKey })); return payload; } + if (this.cache.size === 0) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.MissingData, method: Method.RandomKey })); + + return payload; + } + payload.data = []; const keys = Array.from(this.cache.keys()); - if (duplicates) { - while (payload.data.length < count) payload.data.push(keys[Math.floor(Math.random() * keys.length)]); - } else { + if (unique) { const randomKeys = new Set(); while (randomKeys.size < count) randomKeys.add(keys[Math.floor(Math.random() * keys.length)]); for (const key of randomKeys) payload.data.push(key); + } else { + while (payload.data.length < count) payload.data.push(keys[Math.floor(Math.random() * keys.length)]); } return payload; diff --git a/packages/maria/package.json b/packages/maria/package.json index 18584f07..84e8d226 100644 --- a/packages/maria/package.json +++ b/packages/maria/package.json @@ -26,7 +26,7 @@ "check-update": "cliff-jumper --dry-run" }, "dependencies": { - "@joshdb/provider": "2.0.0-next.a699598.0", + "@joshdb/provider": "2.0.0-next.095d141.0", "@sapphire/snowflake": "^3.5.1", "better-serialize": "^1.0.0", "mariadb": "^3.2.0" diff --git a/packages/maria/src/lib/MariaProvider.ts b/packages/maria/src/lib/MariaProvider.ts index 86ba1a1e..89c6a9a1 100644 --- a/packages/maria/src/lib/MariaProvider.ts +++ b/packages/maria/src/lib/MariaProvider.ts @@ -517,60 +517,70 @@ export class MariaProvider extends JoshProvider): Promise> { - const { count, duplicates } = payload; + const { count, unique } = payload; const size = await this.handler.size(); - if (size === 0) return { ...payload, data: [] }; - if (size < count) { + if (unique && size < count) { payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.Random })); return payload; } + if (size === 0) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.MissingData, method: Method.Random, context: { unique, count } })); + + return payload; + } + payload.data = []; const keys = await this.handler.keys(); - if (duplicates) { - while (payload.data.length < count) { - const key = keys[Math.floor(Math.random() * size)]; - - payload.data.push((await this.handler.get(key))!); - } - } else { + if (unique) { const randomKeys = new Set(); while (randomKeys.size < count) randomKeys.add(keys[Math.floor(Math.random() * keys.length)]); for (const key of randomKeys) payload.data.push((await this.handler.get(key))!); + } else { + while (payload.data.length < count) { + const key = keys[Math.floor(Math.random() * size)]; + + payload.data.push((await this.handler.get(key))!); + } } return payload; } public async [Method.RandomKey](payload: Payload.RandomKey): Promise { - const { count, duplicates } = payload; + const { count, unique } = payload; const size = await this.handler.size(); - if (size === 0) return { ...payload, data: [] }; - if (size < count) { + if (unique && size < count) { payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.RandomKey })); return payload; } + if (size === 0) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.MissingData, method: Method.RandomKey })); + + return payload; + } + payload.data = []; const keys = await this.handler.keys(); - if (duplicates) { - while (payload.data.length < count) payload.data.push(keys[Math.floor(Math.random() * size)]); - } else { + if (unique) { const randomKeys = new Set(); while (randomKeys.size < count) randomKeys.add(keys[Math.floor(Math.random() * keys.length)]); for (const key of randomKeys) payload.data.push(key); + } else { + while (payload.data.length < count) payload.data.push(keys[Math.floor(Math.random() * size)]); } return payload; diff --git a/packages/mongo/package.json b/packages/mongo/package.json index f28ef43f..f11bf299 100644 --- a/packages/mongo/package.json +++ b/packages/mongo/package.json @@ -27,7 +27,7 @@ "check-update": "cliff-jumper --dry-run" }, "dependencies": { - "@joshdb/provider": "2.0.0-next.a699598.0", + "@joshdb/provider": "2.0.0-next.095d141.0", "@sapphire/utilities": "^3.12.0", "better-serialize": "^1.0.0", "mongodb": "~5.6.0", diff --git a/packages/mongo/src/lib/MongoProvider.ts b/packages/mongo/src/lib/MongoProvider.ts index 147c3e9a..9136f5ae 100644 --- a/packages/mongo/src/lib/MongoProvider.ts +++ b/packages/mongo/src/lib/MongoProvider.ts @@ -597,39 +597,76 @@ export class MongoProvider extends JoshProvider): Promise> { - const docCount = await this.collection.countDocuments({}); + let { count, unique } = payload; + const size = await this.collection.countDocuments({}); - if (docCount === 0) return { ...payload, data: [] }; - if (docCount < payload.count) { - payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.Random })); + if (unique && size < count) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.Random }, { size })); return payload; } - const aggr: Document[] = [{ $sample: { size: payload.count } }]; - const docs = (await this.collection.aggregate(aggr).toArray()) || []; + if (size === 0) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.MissingData, method: Method.Random }, { unique, count })); - if (docs.length > 0) payload.data = docs.map((doc) => this.deserialize(doc.value)); + return payload; + } + + payload.data = []; + + if (unique) { + const aggr: Document[] = [{ $sample: { size: payload.count } }]; + const docs = (await this.collection.aggregate(aggr).toArray()) || []; + + payload.data = docs.map((doc) => this.deserialize(doc.value)); + } else { + while (count > 0) { + const aggr: Document[] = [{ $sample: { size: 1 } }]; + const docs = (await this.collection.aggregate(aggr).toArray()) || []; + + payload.data.push(this.deserialize(docs[0].value)); + + count--; + } + } return payload; } public async [Method.RandomKey](payload: Payload.RandomKey): Promise { - const docCount = await this.collection.countDocuments({}); + const size = await this.collection.countDocuments({}); + let { count, unique } = payload; - if (docCount === 0) return { ...payload, data: [] }; - if (docCount < payload.count) { - payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.RandomKey })); + if (unique && size < count) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.Random }, { size })); return payload; } - const aggr: Document[] = [{ $sample: { size: payload.count } }]; - const docs = (await this.collection.aggregate(aggr).toArray()) || []; + if (size === 0) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.MissingData, method: Method.Random }, { unique, count })); - if (docs.length > 0) payload.data = docs.map((doc) => doc.key); + return payload; + } + + payload.data = []; + + if (unique) { + const aggr: Document[] = [{ $sample: { size: payload.count } }]; + const docs = (await this.collection.aggregate(aggr).toArray()) || []; + + payload.data = docs.map((doc) => doc.key); + } else { + while (count > 0) { + const aggr: Document[] = [{ $sample: { size: 1 } }]; + const docs = (await this.collection.aggregate(aggr).toArray()) || []; + + payload.data.push(docs[0].key); + + count--; + } + } return payload; } diff --git a/packages/postgresql/package.json b/packages/postgresql/package.json index 2bc85228..f575b042 100644 --- a/packages/postgresql/package.json +++ b/packages/postgresql/package.json @@ -28,7 +28,7 @@ "check-update": "cliff-jumper --dry-run" }, "dependencies": { - "@joshdb/provider": "2.0.0-next.a699598.0", + "@joshdb/provider": "2.0.0-next.095d141.0", "@sapphire/snowflake": "^3.5.1", "@sapphire/utilities": "^3.12.0", "better-serialize": "^1.0.0", diff --git a/packages/postgresql/src/lib/PostgreSQLProvider.ts b/packages/postgresql/src/lib/PostgreSQLProvider.ts index 80aca79f..3c6c0785 100644 --- a/packages/postgresql/src/lib/PostgreSQLProvider.ts +++ b/packages/postgresql/src/lib/PostgreSQLProvider.ts @@ -506,60 +506,70 @@ export class PostgreSQLProvider extends JoshProvider): Promise> { - const { count, duplicates } = payload; + const { count, unique } = payload; const size = await this.handler.size(); - if (size === 0) return { ...payload, data: [] }; - if (size < count) { + if (unique && size < count) { payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.Random })); return payload; } + if (size === 0) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.MissingData, method: Method.Random })); + + return payload; + } + payload.data = []; const keys = await this.handler.keys(); - if (duplicates) { - while (payload.data.length < count) { - const key = keys[Math.floor(Math.random() * size)]; - - payload.data.push((await this.handler.get(key))!); - } - } else { + if (unique) { const randomKeys = new Set(); while (randomKeys.size < count) randomKeys.add(keys[Math.floor(Math.random() * keys.length)]); for (const key of randomKeys) payload.data.push((await this.handler.get(key))!); + } else { + while (payload.data.length < count) { + const key = keys[Math.floor(Math.random() * size)]; + + payload.data.push((await this.handler.get(key))!); + } } return payload; } public async [Method.RandomKey](payload: Payload.RandomKey): Promise { - const { count, duplicates } = payload; + const { count, unique } = payload; const size = await this.handler.size(); - if (size === 0) return { ...payload, data: [] }; - if (size < count) { + if (unique && size < count) { payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.RandomKey })); return payload; } + if (size === 0) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.MissingData, method: Method.RandomKey })); + + return payload; + } + payload.data = []; const keys = await this.handler.keys(); - if (duplicates) { - while (payload.data.length < count) payload.data.push(keys[Math.floor(Math.random() * size)]); - } else { + if (unique) { const randomKeys = new Set(); while (randomKeys.size < count) randomKeys.add(keys[Math.floor(Math.random() * keys.length)]); for (const key of randomKeys) payload.data.push(key); + } else { + while (payload.data.length < count) payload.data.push(keys[Math.floor(Math.random() * size)]); } return payload; diff --git a/packages/redis/package.json b/packages/redis/package.json index 5ef808b6..1c88ff00 100644 --- a/packages/redis/package.json +++ b/packages/redis/package.json @@ -24,7 +24,7 @@ "check-update": "cliff-jumper --dry-run" }, "dependencies": { - "@joshdb/provider": "2.0.0-next.a699598.0", + "@joshdb/provider": "2.0.0-next.095d141.0", "better-serialize": "^1.0.0", "redis": "^4.6.7", "uuid": "^9.0.0" diff --git a/packages/redis/src/lib/RedisProvider.ts b/packages/redis/src/lib/RedisProvider.ts index 86310847..69961c28 100644 --- a/packages/redis/src/lib/RedisProvider.ts +++ b/packages/redis/src/lib/RedisProvider.ts @@ -540,24 +540,42 @@ export class RedisProvider extends JoshProvider): Promise> { const docCount = (await this[Method.Size]({ method: Method.Size, errors: [] })).data || 0; + const { unique } = payload; - if (docCount === 0) return { ...payload, data: [] }; - if (docCount < payload.count) { + if (unique && docCount < payload.count) { payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.Random }, { count: payload.count, docCount })); return payload; } + if (docCount === 0) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.MissingData, method: Method.Random }, { count: payload.count, docCount })); + + return payload; + } + const keys = await this[Method.Keys]({ method: Method.Keys, errors: [] }); keys.data = keys.data || []; payload.data = []; - for (let i = 0; i < payload.count; i++) { - const key = keys.data[Math.floor(Math.random() * keys.data.length)]; - const getPayload = await this[Method.Get]({ method: Method.Get, errors: [], key, path: [] }); + if (unique) { + const randomKeys = new Set(); + + while (randomKeys.size < docCount) randomKeys.add(keys.data[Math.floor(Math.random() * keys.data.length)]); - payload.data.push(getPayload.data as StoredValue); + for (const key of randomKeys) { + const getPayload = await this[Method.Get]({ method: Method.Get, errors: [], key, path: [] }); + + payload.data.push(getPayload.data as StoredValue); + } + } else { + for (let i = 0; i < payload.count; i++) { + const key = keys.data[Math.floor(Math.random() * keys.data.length)]; + const getPayload = await this[Method.Get]({ method: Method.Get, errors: [], key, path: [] }); + + payload.data.push(getPayload.data as StoredValue); + } } return payload; @@ -565,22 +583,37 @@ export class RedisProvider extends JoshProvider { const docCount = (await this[Method.Size]({ method: Method.Size, errors: [] })).data || 0; + const { unique } = payload; - if (docCount === 0) return { ...payload, data: [] }; - if (docCount < payload.count) { + if (unique && docCount < payload.count) { payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.RandomKey }, { count: payload.count, docCount })); return payload; } + if (docCount === 0) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.MissingData, method: Method.Random }, { count: payload.count, docCount })); + + return payload; + } + const keys = await this[Method.Keys]({ method: Method.Keys, errors: [] }); keys.data = keys.data || []; payload.data = []; - for (let i = 0; i < payload.count; i++) { - const key = keys.data[Math.floor(Math.random() * keys.data.length)]; - payload.data.push(key); + if (unique) { + const randomKeys = new Set(); + + while (randomKeys.size < docCount) randomKeys.add(keys.data[Math.floor(Math.random() * keys.data.length)]); + + payload.data = Array.from(randomKeys); + } else { + for (let i = 0; i < payload.count; i++) { + const key = keys.data[Math.floor(Math.random() * keys.data.length)]; + + payload.data.push(key); + } } return payload; diff --git a/packages/sqlite/package.json b/packages/sqlite/package.json index 8a5a82f8..9d392906 100644 --- a/packages/sqlite/package.json +++ b/packages/sqlite/package.json @@ -26,7 +26,7 @@ "check-update": "cliff-jumper --dry-run" }, "dependencies": { - "@joshdb/provider": "2.0.0-next.a699598.0", + "@joshdb/provider": "2.0.0-next.095d141.0", "@sapphire/utilities": "^3.12.0", "better-serialize": "^1.0.0", "better-sqlite3": "^8.4.0", diff --git a/packages/sqlite/src/lib/SQLiteProvider.ts b/packages/sqlite/src/lib/SQLiteProvider.ts index 18fab048..eed917d3 100644 --- a/packages/sqlite/src/lib/SQLiteProvider.ts +++ b/packages/sqlite/src/lib/SQLiteProvider.ts @@ -569,60 +569,70 @@ export class SQLiteProvider extends JoshProvider): Payload.Random { - const { count, duplicates } = payload; + const { count, unique } = payload; const size = this.handler.size(); - if (size === 0) return { ...payload, data: [] }; - if (size < count) { + if (unique && size < count) { payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.Random }, { size })); return payload; } + if (size === 0) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.MissingData, method: Method.Random }, { unique, count })); + + return payload; + } + payload.data = []; const keys = this.handler.keys(); - if (duplicates) { - while (payload.data.length < count) { - const key = keys[Math.floor(Math.random() * size)]; - - payload.data.push(this.handler.get(key)!); - } - } else { + if (unique) { const randomKeys = new Set(); while (randomKeys.size < count) randomKeys.add(keys[Math.floor(Math.random() * keys.length)]); for (const key of randomKeys) payload.data.push(this.handler.get(key)!); + } else { + while (payload.data.length < count) { + const key = keys[Math.floor(Math.random() * size)]; + + payload.data.push(this.handler.get(key)!); + } } return payload; } public [Method.RandomKey](payload: Payload.RandomKey): Payload.RandomKey { - const { count, duplicates } = payload; + const { count, unique } = payload; const size = this.handler.size(); - if (size === 0) return { ...payload, data: [] }; - if (size < count) { + if (unique && size < count) { payload.errors.push(this.error({ identifier: CommonIdentifiers.InvalidCount, method: Method.RandomKey }, { size })); return payload; } + if (size === 0) { + payload.errors.push(this.error({ identifier: CommonIdentifiers.MissingData, method: Method.RandomKey }, { size })); + + return payload; + } + payload.data = []; const keys = this.handler.keys(); - if (duplicates) { - while (payload.data.length < count) payload.data.push(keys[Math.floor(Math.random() * size)]); - } else { + if (unique) { const randomKeys = new Set(); while (randomKeys.size < count) randomKeys.add(keys[Math.floor(Math.random() * keys.length)]); for (const key of randomKeys) payload.data.push(key); + } else { + while (payload.data.length < count) payload.data.push(keys[Math.floor(Math.random() * size)]); } return payload; diff --git a/yarn.lock b/yarn.lock index e5ae2f7b..cbc607cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -650,7 +650,7 @@ __metadata: dependencies: "@favware/cliff-jumper": ^2.1.1 "@favware/rollup-type-bundler": ^1.0.11 - "@joshdb/provider": 2.0.0-next.a699598.0 + "@joshdb/provider": 2.0.0-next.095d141.0 "@sapphire/async-queue": ^1.5.0 "@sapphire/snowflake": ^3.5.1 "@sapphire/utilities": ^3.12.0 @@ -669,7 +669,7 @@ __metadata: dependencies: "@favware/cliff-jumper": ^2.1.1 "@favware/rollup-type-bundler": ^1.0.11 - "@joshdb/provider": 2.0.0-next.a699598.0 + "@joshdb/provider": 2.0.0-next.095d141.0 "@sapphire/utilities": ^3.12.0 "@vitest/coverage-v8": ^0.32.2 better-serialize: ^1.0.0 @@ -686,7 +686,7 @@ __metadata: dependencies: "@favware/cliff-jumper": ^2.1.1 "@favware/rollup-type-bundler": ^1.0.11 - "@joshdb/provider": 2.0.0-next.a699598.0 + "@joshdb/provider": 2.0.0-next.095d141.0 "@sapphire/snowflake": ^3.5.1 "@vitest/coverage-v8": ^0.32.2 better-serialize: ^1.0.0 @@ -703,7 +703,7 @@ __metadata: dependencies: "@favware/cliff-jumper": ^2.1.1 "@favware/rollup-type-bundler": ^1.0.11 - "@joshdb/provider": 2.0.0-next.a699598.0 + "@joshdb/provider": 2.0.0-next.095d141.0 "@sapphire/utilities": ^3.12.0 "@vitest/coverage-v8": ^0.32.2 better-serialize: ^1.0.0 @@ -721,7 +721,7 @@ __metadata: dependencies: "@favware/cliff-jumper": ^2.1.1 "@favware/rollup-type-bundler": ^1.0.11 - "@joshdb/provider": 2.0.0-next.a699598.0 + "@joshdb/provider": 2.0.0-next.095d141.0 "@sapphire/snowflake": ^3.5.1 "@sapphire/utilities": ^3.12.0 "@vitest/coverage-v8": ^0.32.2 @@ -734,6 +734,16 @@ __metadata: languageName: unknown linkType: soft +"@joshdb/provider@npm:2.0.0-next.095d141.0": + version: 2.0.0-next.095d141.0 + resolution: "@joshdb/provider@npm:2.0.0-next.095d141.0" + dependencies: + "@sapphire/utilities": ^3.12.0 + reflect-metadata: ^0.1.13 + checksum: 6b052d5c9fff01c054484d340966a1350ab06358c8a6480bbd4b8220f61a08ba4899ac95684f6252471454b9a410bf4ef62d848bac391643206c6a39d2f32de7 + languageName: node + linkType: hard + "@joshdb/provider@npm:2.0.0-next.a699598.0": version: 2.0.0-next.a699598.0 resolution: "@joshdb/provider@npm:2.0.0-next.a699598.0" @@ -750,7 +760,7 @@ __metadata: dependencies: "@favware/cliff-jumper": ^2.1.1 "@favware/rollup-type-bundler": ^1.0.11 - "@joshdb/provider": 2.0.0-next.a699598.0 + "@joshdb/provider": 2.0.0-next.095d141.0 "@types/uuid": ^9.0.2 "@vitest/coverage-v8": ^0.32.2 better-serialize: ^1.0.0 @@ -768,7 +778,7 @@ __metadata: dependencies: "@favware/cliff-jumper": ^2.1.1 "@favware/rollup-type-bundler": ^1.0.11 - "@joshdb/provider": 2.0.0-next.a699598.0 + "@joshdb/provider": 2.0.0-next.095d141.0 "@sapphire/utilities": ^3.12.0 "@vitest/coverage-v8": ^0.32.2 better-serialize: ^1.0.0