drizzle-seed 0.4.0-c4ae133 → 0.4.0-e6bdce6
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/SeedService.d.cts +1 -0
- package/SeedService.d.mts +1 -0
- package/SeedService.d.ts +1 -0
- package/cockroach-core/index.d.cts +3 -5
- package/cockroach-core/index.d.mts +3 -5
- package/cockroach-core/index.d.ts +3 -5
- package/common.d.cts +3 -5
- package/common.d.mts +3 -5
- package/common.d.ts +3 -5
- package/generators/GeneratorFuncs.d.cts +888 -28
- package/generators/GeneratorFuncs.d.mts +888 -28
- package/generators/GeneratorFuncs.d.ts +888 -28
- package/generators/Generators.d.cts +147 -42
- package/generators/Generators.d.mts +147 -42
- package/generators/Generators.d.ts +147 -42
- package/generators/apiVersion.d.cts +1 -1
- package/generators/apiVersion.d.mts +1 -1
- package/generators/apiVersion.d.ts +1 -1
- package/generators/versioning/v2.d.cts +11 -4
- package/generators/versioning/v2.d.mts +11 -4
- package/generators/versioning/v2.d.ts +11 -4
- package/generators/versioning/v3.d.cts +10 -0
- package/generators/versioning/v3.d.mts +10 -0
- package/generators/versioning/v3.d.ts +10 -0
- package/index.cjs +764 -282
- package/index.cjs.map +1 -1
- package/index.d.cts +8 -20
- package/index.d.mts +8 -20
- package/index.d.ts +8 -20
- package/index.mjs +764 -282
- package/index.mjs.map +1 -1
- package/mysql-core/index.d.cts +3 -5
- package/mysql-core/index.d.mts +3 -5
- package/mysql-core/index.d.ts +3 -5
- package/package.json +108 -107
- package/pg-core/index.d.cts +3 -5
- package/pg-core/index.d.mts +3 -5
- package/pg-core/index.d.ts +3 -5
- package/singlestore-core/index.d.cts +3 -5
- package/singlestore-core/index.d.mts +3 -5
- package/singlestore-core/index.d.ts +3 -5
- package/sqlite-core/index.d.cts +3 -5
- package/sqlite-core/index.d.mts +3 -5
- package/sqlite-core/index.d.ts +3 -5
- package/types/seedService.d.cts +1 -1
- package/types/seedService.d.mts +1 -1
- package/types/seedService.d.ts +1 -1
- package/types/tables.d.cts +9 -6
- package/types/tables.d.mts +9 -6
- package/types/tables.d.ts +9 -6
- package/utils.d.cts +0 -1
- package/utils.d.mts +0 -1
- package/utils.d.ts +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AbstractGenerator } from './Generators.js';
|
|
2
|
-
import { GenerateArray, GenerateBitString, GenerateBoolean, GenerateCity, GenerateCompanyName, GenerateCountry, GenerateDate, GenerateDatetime, GenerateDefault, GenerateEmail, GenerateEnum, GenerateFirstName, GenerateFullName, GenerateGeometry, GenerateInet, GenerateInt, GenerateInterval, GenerateIntPrimaryKey, GenerateJobTitle, GenerateJson, GenerateLastName, GenerateLine, GenerateLoremIpsum, GenerateNumber, GeneratePhoneNumber, GeneratePoint, GeneratePostcode, GenerateSelfRelationsValuesFromArray, GenerateState, GenerateStreetAddress, GenerateString, GenerateTime, GenerateTimestamp, GenerateUniqueBitString, GenerateUniqueCity, GenerateUniqueCompanyName, GenerateUniqueCountry, GenerateUniqueFirstName, GenerateUniqueFullName, GenerateUniqueGeometry, GenerateUniqueInet, GenerateUniqueInt, GenerateUniqueInterval, GenerateUniqueLastName, GenerateUniqueLine, GenerateUniqueNumber, GenerateUniquePoint, GenerateUniquePostcode, GenerateUniqueStreetAddress, GenerateUniqueString, GenerateUniqueVector, GenerateUUID, GenerateValuesFromArray, GenerateVector, GenerateWeightedCount, GenerateYear, HollowGenerator, WeightedRandomGenerator } from './Generators.js';
|
|
2
|
+
import { GenerateArray, GenerateBitString, GenerateBoolean, GenerateCity, GenerateCompanyName, GenerateCompositeUniqueKey, GenerateCountry, GenerateDate, GenerateDatetime, GenerateDefault, GenerateEmail, GenerateEnum, GenerateFirstName, GenerateFullName, GenerateGeometry, GenerateHashFromString, GenerateInet, GenerateInt, GenerateInterval, GenerateIntPrimaryKey, GenerateJobTitle, GenerateJson, GenerateLastName, GenerateLine, GenerateLoremIpsum, GenerateNumber, GeneratePhoneNumber, GeneratePoint, GeneratePostcode, GenerateSelfRelationsValuesFromArray, GenerateState, GenerateStreetAddress, GenerateString, GenerateTime, GenerateTimestamp, GenerateUniqueBitString, GenerateUniqueCity, GenerateUniqueCompanyName, GenerateUniqueCountry, GenerateUniqueFirstName, GenerateUniqueFullName, GenerateUniqueGeometry, GenerateUniqueInet, GenerateUniqueInt, GenerateUniqueInterval, GenerateUniqueLastName, GenerateUniqueLine, GenerateUniqueNumber, GenerateUniquePoint, GenerateUniquePostcode, GenerateUniqueStreetAddress, GenerateUniqueString, GenerateUniqueVector, GenerateUUID, GenerateValuesFromArray, GenerateVector, GenerateWeightedCount, GenerateYear, HollowGenerator, WeightedRandomGenerator } from './Generators.js';
|
|
3
3
|
import { GenerateStringV2, GenerateUniqueIntervalV2, GenerateUniqueStringV2 } from './versioning/v2.js';
|
|
4
|
+
import { GenerateHashFromStringV3 } from './versioning/v3.js';
|
|
4
5
|
export declare const generatorsFuncs: {
|
|
5
6
|
/**
|
|
6
7
|
* generates same given value each time the generator is called.
|
|
@@ -62,14 +63,888 @@ export declare const generatorsFuncs: {
|
|
|
62
63
|
*
|
|
63
64
|
* ```
|
|
64
65
|
*/
|
|
65
|
-
valuesFromArray: (args_0:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
valuesFromArray: (args_0: import("./Generators.js").GenerateValuesFromArrayT) => GenerateValuesFromArray;
|
|
67
|
+
/**
|
|
68
|
+
* generates sequential integers starting with 1.
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
72
|
+
* posts: {
|
|
73
|
+
* columns: {
|
|
74
|
+
* id: funcs.intPrimaryKey(),
|
|
75
|
+
* },
|
|
76
|
+
* },
|
|
77
|
+
* }));
|
|
78
|
+
*
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
intPrimaryKey: (...args: [] | [{}]) => GenerateIntPrimaryKey;
|
|
82
|
+
/**
|
|
83
|
+
* generates numbers with floating point in given range.
|
|
84
|
+
* @param minValue - lower border of range.
|
|
85
|
+
* @param maxValue - upper border of range.
|
|
86
|
+
* @param precision - precision of generated number:
|
|
87
|
+
* precision equals 10 means that values will be accurate to one tenth (1.2, 34.6);
|
|
88
|
+
* precision equals 100 means that values will be accurate to one hundredth (1.23, 34.67).
|
|
89
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
90
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
95
|
+
* products: {
|
|
96
|
+
* columns: {
|
|
97
|
+
* unitPrice: funcs.number({ minValue: 10, maxValue: 120, precision: 100, isUnique: false }),
|
|
98
|
+
* },
|
|
99
|
+
* },
|
|
100
|
+
* }));
|
|
101
|
+
*
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
number: (...args: [] | [{
|
|
105
|
+
minValue?: number;
|
|
106
|
+
maxValue?: number;
|
|
107
|
+
precision?: number;
|
|
108
|
+
isUnique?: boolean;
|
|
109
|
+
arraySize?: number;
|
|
110
|
+
}]) => GenerateNumber;
|
|
111
|
+
/**
|
|
112
|
+
* generates integers within given range.
|
|
113
|
+
* @param minValue - lower border of range.
|
|
114
|
+
* @param maxValue - upper border of range.
|
|
115
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
116
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
121
|
+
* products: {
|
|
122
|
+
* columns: {
|
|
123
|
+
* unitsInStock: funcs.number({ minValue: 0, maxValue: 100, isUnique: false }),
|
|
124
|
+
* },
|
|
125
|
+
* },
|
|
126
|
+
* }));
|
|
127
|
+
*
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
int: (...args: [] | [{
|
|
131
|
+
minValue?: number | bigint;
|
|
132
|
+
maxValue?: number | bigint;
|
|
133
|
+
isUnique?: boolean;
|
|
134
|
+
arraySize?: number;
|
|
135
|
+
}]) => GenerateInt;
|
|
136
|
+
/**
|
|
137
|
+
* generates boolean values(true or false)
|
|
138
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```ts
|
|
142
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
143
|
+
* users: {
|
|
144
|
+
* columns: {
|
|
145
|
+
* isAvailable: funcs.boolean()
|
|
146
|
+
* },
|
|
147
|
+
* },
|
|
148
|
+
* }));
|
|
149
|
+
*
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
boolean: (...args: [] | [{
|
|
153
|
+
arraySize?: number;
|
|
154
|
+
}]) => GenerateBoolean;
|
|
155
|
+
/**
|
|
156
|
+
* generates date within given range.
|
|
157
|
+
* @param minDate - lower border of range.
|
|
158
|
+
* @param maxDate - upper border of range.
|
|
159
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
164
|
+
* users: {
|
|
165
|
+
* columns: {
|
|
166
|
+
* birthDate: funcs.date({ minDate: "1990-01-01", maxDate: "2010-12-31" })
|
|
167
|
+
* },
|
|
168
|
+
* },
|
|
169
|
+
* }));
|
|
170
|
+
*
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
date: (...args: [] | [{
|
|
174
|
+
minDate?: string | Date;
|
|
175
|
+
maxDate?: string | Date;
|
|
176
|
+
arraySize?: number;
|
|
177
|
+
}]) => GenerateDate;
|
|
178
|
+
/**
|
|
179
|
+
* generates time in 24 hours style.
|
|
180
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```ts
|
|
184
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
185
|
+
* users: {
|
|
186
|
+
* columns: {
|
|
187
|
+
* birthTime: funcs.time()
|
|
188
|
+
* },
|
|
189
|
+
* },
|
|
190
|
+
* }));
|
|
191
|
+
*
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
time: (...args: [] | [{
|
|
195
|
+
arraySize?: number;
|
|
196
|
+
}]) => GenerateTime;
|
|
197
|
+
/**
|
|
198
|
+
* generates timestamps.
|
|
199
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```ts
|
|
203
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
204
|
+
* orders: {
|
|
205
|
+
* columns: {
|
|
206
|
+
* shippedDate: funcs.timestamp()
|
|
207
|
+
* },
|
|
208
|
+
* },
|
|
209
|
+
* }));
|
|
210
|
+
*
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
timestamp: (...args: [] | [{
|
|
214
|
+
arraySize?: number;
|
|
215
|
+
}]) => GenerateTimestamp;
|
|
216
|
+
/**
|
|
217
|
+
* generates datetime objects.
|
|
218
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```ts
|
|
222
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
223
|
+
* orders: {
|
|
224
|
+
* columns: {
|
|
225
|
+
* shippedDate: funcs.datetime()
|
|
226
|
+
* },
|
|
227
|
+
* },
|
|
228
|
+
* }));
|
|
229
|
+
*
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
datetime: (...args: [] | [{
|
|
233
|
+
arraySize?: number;
|
|
234
|
+
}]) => GenerateDatetime;
|
|
235
|
+
/**
|
|
236
|
+
* generates years.
|
|
237
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```ts
|
|
241
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
242
|
+
* users: {
|
|
243
|
+
* columns: {
|
|
244
|
+
* birthYear: funcs.year()
|
|
245
|
+
* },
|
|
246
|
+
* },
|
|
247
|
+
* }));
|
|
248
|
+
*
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
year: (...args: [] | [{
|
|
252
|
+
arraySize?: number;
|
|
253
|
+
}]) => GenerateYear;
|
|
254
|
+
/**
|
|
255
|
+
* generates json objects with fixed structure.
|
|
256
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
257
|
+
*
|
|
258
|
+
* json structure can equal this:
|
|
259
|
+
* ```
|
|
260
|
+
* {
|
|
261
|
+
* email,
|
|
262
|
+
* name,
|
|
263
|
+
* isGraduated,
|
|
264
|
+
* hasJob,
|
|
265
|
+
* salary,
|
|
266
|
+
* startedWorking,
|
|
267
|
+
* visitedCountries,
|
|
268
|
+
* }
|
|
269
|
+
* ```
|
|
270
|
+
* or this
|
|
271
|
+
* ```
|
|
272
|
+
* {
|
|
273
|
+
* email,
|
|
274
|
+
* name,
|
|
275
|
+
* isGraduated,
|
|
276
|
+
* hasJob,
|
|
277
|
+
* visitedCountries,
|
|
278
|
+
* }
|
|
279
|
+
* ```
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* ```ts
|
|
283
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
284
|
+
* users: {
|
|
285
|
+
* columns: {
|
|
286
|
+
* metadata: funcs.json()
|
|
287
|
+
* },
|
|
288
|
+
* },
|
|
289
|
+
* }));
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
json: (...args: [] | [{
|
|
293
|
+
arraySize?: number;
|
|
294
|
+
}]) => GenerateJson;
|
|
295
|
+
/**
|
|
296
|
+
* generates time intervals.
|
|
297
|
+
*
|
|
298
|
+
* interval example: "1 years 12 days 5 minutes"
|
|
299
|
+
*
|
|
300
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
301
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
302
|
+
* @param fields - range of values you want to see in your intervals.
|
|
303
|
+
* @example
|
|
304
|
+
* ```ts
|
|
305
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
306
|
+
* users: {
|
|
307
|
+
* columns: {
|
|
308
|
+
* timeSpentOnWebsite: funcs.interval()
|
|
309
|
+
* },
|
|
310
|
+
* },
|
|
311
|
+
* }));
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
interval: (...args: [] | [{
|
|
315
|
+
fields?: "year" | "month" | "day" | "hour" | "minute" | "second" | "year to month" | "day to hour" | "day to minute" | "day to second" | "hour to minute" | "hour to second" | "minute to second";
|
|
316
|
+
isUnique?: boolean;
|
|
317
|
+
arraySize?: number;
|
|
318
|
+
}]) => GenerateInterval;
|
|
319
|
+
/**
|
|
320
|
+
* generates random strings.
|
|
321
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
322
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```ts
|
|
326
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
327
|
+
* users: {
|
|
328
|
+
* columns: {
|
|
329
|
+
* hashedPassword: funcs.string({isUnique: false})
|
|
330
|
+
* },
|
|
331
|
+
* },
|
|
332
|
+
* }));
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
335
|
+
string: (...args: [] | [{
|
|
336
|
+
isUnique?: boolean;
|
|
337
|
+
arraySize?: number;
|
|
338
|
+
}]) => GenerateString;
|
|
339
|
+
/**
|
|
340
|
+
* generates v4 UUID strings if arraySize is not specified, or v4 UUID 1D arrays if it is.
|
|
341
|
+
*
|
|
342
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* ```ts
|
|
346
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
347
|
+
* users: {
|
|
348
|
+
* columns: {
|
|
349
|
+
* uuid: funcs.uuid({
|
|
350
|
+
* arraySize: 4
|
|
351
|
+
* })
|
|
352
|
+
* },
|
|
353
|
+
* },
|
|
354
|
+
* }));
|
|
355
|
+
* ```
|
|
356
|
+
*/
|
|
357
|
+
uuid: (...args: [] | [{
|
|
358
|
+
arraySize?: number;
|
|
359
|
+
}]) => GenerateUUID;
|
|
360
|
+
/**
|
|
361
|
+
* generates person's first names.
|
|
362
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
363
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
* ```ts
|
|
367
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
368
|
+
* users: {
|
|
369
|
+
* columns: {
|
|
370
|
+
* firstName: funcs.firstName({isUnique: true})
|
|
371
|
+
* },
|
|
372
|
+
* },
|
|
373
|
+
* }));
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
firstName: (...args: [] | [{
|
|
377
|
+
isUnique?: boolean;
|
|
378
|
+
arraySize?: number;
|
|
379
|
+
}]) => GenerateFirstName;
|
|
380
|
+
/**
|
|
381
|
+
* generates person's last names.
|
|
382
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
383
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* ```ts
|
|
387
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
388
|
+
* users: {
|
|
389
|
+
* columns: {
|
|
390
|
+
* lastName: funcs.lastName({isUnique: false})
|
|
391
|
+
* },
|
|
392
|
+
* },
|
|
393
|
+
* }));
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
396
|
+
lastName: (...args: [] | [{
|
|
397
|
+
isUnique?: boolean;
|
|
398
|
+
arraySize?: number;
|
|
399
|
+
}]) => GenerateLastName;
|
|
400
|
+
/**
|
|
401
|
+
* generates person's full names.
|
|
402
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
403
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
404
|
+
*
|
|
405
|
+
* @example
|
|
406
|
+
* ```ts
|
|
407
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
408
|
+
* users: {
|
|
409
|
+
* columns: {
|
|
410
|
+
* fullName: funcs.fullName({isUnique: true})
|
|
411
|
+
* },
|
|
412
|
+
* },
|
|
413
|
+
* }));
|
|
414
|
+
* ```
|
|
415
|
+
*/
|
|
416
|
+
fullName: (...args: [] | [{
|
|
417
|
+
isUnique?: boolean;
|
|
418
|
+
arraySize?: number;
|
|
419
|
+
}]) => GenerateFullName;
|
|
420
|
+
/**
|
|
421
|
+
* generates unique emails.
|
|
422
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
423
|
+
*
|
|
424
|
+
* @example
|
|
425
|
+
* ```ts
|
|
426
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
427
|
+
* users: {
|
|
428
|
+
* columns: {
|
|
429
|
+
* email: funcs.email()
|
|
430
|
+
* },
|
|
431
|
+
* },
|
|
432
|
+
* }));
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
435
|
+
email: (...args: [] | [{
|
|
436
|
+
arraySize?: number;
|
|
437
|
+
}]) => GenerateEmail;
|
|
438
|
+
/**
|
|
439
|
+
* generates unique phone numbers.
|
|
440
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
441
|
+
*
|
|
442
|
+
* @param template - phone number template, where all '#' symbols will be substituted with generated digits.
|
|
443
|
+
* @param prefixes - array of any string you want to be your phone number prefixes.(not compatible with template property)
|
|
444
|
+
* @param generatedDigitsNumbers - number of digits that will be added at the end of prefixes.(not compatible with template property)
|
|
445
|
+
* @example
|
|
446
|
+
* ```ts
|
|
447
|
+
* //generate phone number using template property
|
|
448
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
449
|
+
* users: {
|
|
450
|
+
* columns: {
|
|
451
|
+
* phoneNumber: funcs.phoneNumber({template: "+(380) ###-####"})
|
|
452
|
+
* },
|
|
453
|
+
* },
|
|
454
|
+
* }));
|
|
455
|
+
*
|
|
456
|
+
* //generate phone number using prefixes and generatedDigitsNumbers properties
|
|
457
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
458
|
+
* users: {
|
|
459
|
+
* columns: {
|
|
460
|
+
* phoneNumber: funcs.phoneNumber({prefixes: [ "+380 99", "+380 67" ], generatedDigitsNumbers: 7})
|
|
461
|
+
* },
|
|
462
|
+
* },
|
|
463
|
+
* }));
|
|
464
|
+
*
|
|
465
|
+
* //generate phone number using prefixes and generatedDigitsNumbers properties but with different generatedDigitsNumbers for prefixes
|
|
466
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
467
|
+
* users: {
|
|
468
|
+
* columns: {
|
|
469
|
+
* phoneNumber: funcs.phoneNumber({prefixes: [ "+380 99", "+380 67", "+1" ], generatedDigitsNumbers: [7, 7, 10]})
|
|
470
|
+
* },
|
|
471
|
+
* },
|
|
472
|
+
* }));
|
|
473
|
+
*
|
|
474
|
+
* ```
|
|
475
|
+
*/
|
|
476
|
+
phoneNumber: (...args: [] | [import("./Generators.js").GeneratePhoneNumberT]) => GeneratePhoneNumber;
|
|
477
|
+
/**
|
|
478
|
+
* generates country's names.
|
|
479
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
480
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
481
|
+
*
|
|
482
|
+
* @example
|
|
483
|
+
* ```ts
|
|
484
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
485
|
+
* users: {
|
|
486
|
+
* columns: {
|
|
487
|
+
* country: funcs.country({isUnique: false})
|
|
488
|
+
* },
|
|
489
|
+
* },
|
|
490
|
+
* }));
|
|
491
|
+
* ```
|
|
492
|
+
*/
|
|
493
|
+
country: (...args: [] | [{
|
|
494
|
+
isUnique?: boolean;
|
|
495
|
+
arraySize?: number;
|
|
496
|
+
}]) => GenerateCountry;
|
|
497
|
+
/**
|
|
498
|
+
* generates city's names.
|
|
499
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
500
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
501
|
+
*
|
|
502
|
+
* @example
|
|
503
|
+
* ```ts
|
|
504
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
505
|
+
* users: {
|
|
506
|
+
* columns: {
|
|
507
|
+
* city: funcs.city({isUnique: false})
|
|
508
|
+
* },
|
|
509
|
+
* },
|
|
510
|
+
* }));
|
|
511
|
+
* ```
|
|
512
|
+
*/
|
|
513
|
+
city: (...args: [] | [{
|
|
514
|
+
isUnique?: boolean;
|
|
515
|
+
arraySize?: number;
|
|
516
|
+
}]) => GenerateCity;
|
|
517
|
+
/**
|
|
518
|
+
* generates street address.
|
|
519
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
520
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
521
|
+
*
|
|
522
|
+
* @example
|
|
523
|
+
* ```ts
|
|
524
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
525
|
+
* users: {
|
|
526
|
+
* columns: {
|
|
527
|
+
* streetAddress: funcs.streetAddress({isUnique: true})
|
|
528
|
+
* },
|
|
529
|
+
* },
|
|
530
|
+
* }));
|
|
531
|
+
* ```
|
|
532
|
+
*/
|
|
533
|
+
streetAddress: (...args: [] | [{
|
|
534
|
+
isUnique?: boolean;
|
|
535
|
+
arraySize?: number;
|
|
536
|
+
}]) => GenerateStreetAddress;
|
|
537
|
+
/**
|
|
538
|
+
* generates job titles.
|
|
539
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
540
|
+
*
|
|
541
|
+
* @example
|
|
542
|
+
* ```ts
|
|
543
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
544
|
+
* users: {
|
|
545
|
+
* columns: {
|
|
546
|
+
* jobTitle: funcs.jobTitle()
|
|
547
|
+
* },
|
|
548
|
+
* },
|
|
549
|
+
* }));
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
jobTitle: (...args: [] | [{
|
|
553
|
+
arraySize?: number;
|
|
554
|
+
}]) => GenerateJobTitle;
|
|
555
|
+
/**
|
|
556
|
+
* generates postal codes.
|
|
557
|
+
*
|
|
558
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
559
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
560
|
+
*
|
|
561
|
+
* @example
|
|
562
|
+
* ```ts
|
|
563
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
564
|
+
* users: {
|
|
565
|
+
* columns: {
|
|
566
|
+
* postcode: funcs.postcode({isUnique: true})
|
|
567
|
+
* },
|
|
568
|
+
* },
|
|
569
|
+
* }));
|
|
570
|
+
* ```
|
|
571
|
+
*/
|
|
572
|
+
postcode: (...args: [] | [{
|
|
573
|
+
isUnique?: boolean;
|
|
574
|
+
arraySize?: number;
|
|
575
|
+
}]) => GeneratePostcode;
|
|
576
|
+
/**
|
|
577
|
+
* generates states of America.
|
|
578
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
579
|
+
*
|
|
580
|
+
* @example
|
|
581
|
+
* ```ts
|
|
582
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
583
|
+
* users: {
|
|
584
|
+
* columns: {
|
|
585
|
+
* state: funcs.state()
|
|
586
|
+
* },
|
|
587
|
+
* },
|
|
588
|
+
* }));
|
|
589
|
+
* ```
|
|
590
|
+
*/
|
|
591
|
+
state: (...args: [] | [{
|
|
592
|
+
arraySize?: number;
|
|
593
|
+
}]) => GenerateState;
|
|
594
|
+
/**
|
|
595
|
+
* generates company's names.
|
|
596
|
+
*
|
|
597
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
598
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
599
|
+
*
|
|
600
|
+
* @example
|
|
601
|
+
* ```ts
|
|
602
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
603
|
+
* users: {
|
|
604
|
+
* columns: {
|
|
605
|
+
* company: funcs.companyName({isUnique: true})
|
|
606
|
+
* },
|
|
607
|
+
* },
|
|
608
|
+
* }));
|
|
609
|
+
* ```
|
|
610
|
+
*/
|
|
611
|
+
companyName: (...args: [] | [{
|
|
612
|
+
isUnique?: boolean;
|
|
613
|
+
arraySize?: number;
|
|
614
|
+
}]) => GenerateCompanyName;
|
|
615
|
+
/**
|
|
616
|
+
* generates 'lorem ipsum' text sentences.
|
|
617
|
+
*
|
|
618
|
+
* @param sentencesCount - number of sentences you want to generate as one generated value(string).
|
|
619
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
620
|
+
*
|
|
621
|
+
* @example
|
|
622
|
+
* ```ts
|
|
623
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
624
|
+
* posts: {
|
|
625
|
+
* columns: {
|
|
626
|
+
* content: funcs.loremIpsum({sentencesCount: 2})
|
|
627
|
+
* },
|
|
628
|
+
* },
|
|
629
|
+
* }));
|
|
630
|
+
* ```
|
|
631
|
+
*/
|
|
632
|
+
loremIpsum: (...args: [] | [{
|
|
633
|
+
sentencesCount?: number;
|
|
634
|
+
arraySize?: number;
|
|
635
|
+
}]) => GenerateLoremIpsum;
|
|
636
|
+
/**
|
|
637
|
+
* generates 2D points within specified ranges for x and y coordinates.
|
|
638
|
+
*
|
|
639
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
640
|
+
* @param minXValue - lower bound of range for x coordinate.
|
|
641
|
+
* @param maxXValue - upper bound of range for x coordinate.
|
|
642
|
+
* @param minYValue - lower bound of range for y coordinate.
|
|
643
|
+
* @param maxYValue - upper bound of range for y coordinate.
|
|
644
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
645
|
+
*
|
|
646
|
+
* @example
|
|
647
|
+
* ```ts
|
|
648
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
649
|
+
* triangles: {
|
|
650
|
+
* columns: {
|
|
651
|
+
* pointCoords: funcs.point({
|
|
652
|
+
* isUnique: true,
|
|
653
|
+
* minXValue: -5, maxXValue:20,
|
|
654
|
+
* minYValue: 0, maxYValue: 30
|
|
655
|
+
* })
|
|
656
|
+
* },
|
|
657
|
+
* },
|
|
658
|
+
* }));
|
|
659
|
+
* ```
|
|
660
|
+
*/
|
|
661
|
+
point: (...args: [] | [{
|
|
662
|
+
isUnique?: boolean;
|
|
663
|
+
minXValue?: number;
|
|
664
|
+
maxXValue?: number;
|
|
665
|
+
minYValue?: number;
|
|
666
|
+
maxYValue?: number;
|
|
667
|
+
arraySize?: number;
|
|
668
|
+
}]) => GeneratePoint;
|
|
669
|
+
/**
|
|
670
|
+
* generates 2D lines within specified ranges for a, b and c parameters of line.
|
|
671
|
+
*
|
|
672
|
+
* ```
|
|
673
|
+
* line equation: a*x + b*y + c = 0
|
|
674
|
+
* ```
|
|
675
|
+
*
|
|
676
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
677
|
+
* @param minAValue - lower bound of range for a parameter.
|
|
678
|
+
* @param maxAValue - upper bound of range for x parameter.
|
|
679
|
+
* @param minBValue - lower bound of range for y parameter.
|
|
680
|
+
* @param maxBValue - upper bound of range for y parameter.
|
|
681
|
+
* @param minCValue - lower bound of range for y parameter.
|
|
682
|
+
* @param maxCValue - upper bound of range for y parameter.
|
|
683
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
684
|
+
*
|
|
685
|
+
* @example
|
|
686
|
+
* ```ts
|
|
687
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
688
|
+
* lines: {
|
|
689
|
+
* columns: {
|
|
690
|
+
* lineParams: funcs.point({
|
|
691
|
+
* isUnique: true,
|
|
692
|
+
* minAValue: -5, maxAValue:20,
|
|
693
|
+
* minBValue: 0, maxBValue: 30,
|
|
694
|
+
* minCValue: 0, maxCValue: 10
|
|
695
|
+
* })
|
|
696
|
+
* },
|
|
697
|
+
* },
|
|
698
|
+
* }));
|
|
699
|
+
* ```
|
|
700
|
+
*/
|
|
701
|
+
line: (...args: [] | [{
|
|
702
|
+
isUnique?: boolean;
|
|
703
|
+
minAValue?: number;
|
|
704
|
+
maxAValue?: number;
|
|
705
|
+
minBValue?: number;
|
|
706
|
+
maxBValue?: number;
|
|
707
|
+
minCValue?: number;
|
|
708
|
+
maxCValue?: number;
|
|
709
|
+
arraySize?: number;
|
|
710
|
+
}]) => GenerateLine;
|
|
711
|
+
/**
|
|
712
|
+
* gives you the opportunity to call different generators with different probabilities to generate values for one column.
|
|
713
|
+
* @param params - array of generators with probabilities you would like to call them to generate values.
|
|
714
|
+
*
|
|
715
|
+
* @example
|
|
716
|
+
* ```ts
|
|
717
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
718
|
+
* posts: {
|
|
719
|
+
* columns: {
|
|
720
|
+
* content: funcs.weightedRandom([
|
|
721
|
+
* {
|
|
722
|
+
* weight: 0.6,
|
|
723
|
+
* value: funcs.loremIpsum({ sentencesCount: 3 }),
|
|
724
|
+
* },
|
|
725
|
+
* {
|
|
726
|
+
* weight: 0.4,
|
|
727
|
+
* value: funcs.default({ defaultValue: "TODO" }),
|
|
728
|
+
* },
|
|
729
|
+
* ]),
|
|
730
|
+
* },
|
|
731
|
+
* },
|
|
732
|
+
* }));
|
|
733
|
+
* ```
|
|
734
|
+
*/
|
|
735
|
+
weightedRandom: (args_0: {
|
|
736
|
+
weight: number;
|
|
737
|
+
value: AbstractGenerator<any>;
|
|
738
|
+
}[]) => WeightedRandomGenerator;
|
|
739
|
+
/**
|
|
740
|
+
* generates bit strings based on specified parameters
|
|
741
|
+
*
|
|
742
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
743
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
744
|
+
* @param dimensions - desired length of each bit string (e.g., `dimensions = 3` produces values like `'010'`).
|
|
745
|
+
*
|
|
746
|
+
* Defaults to the value of the database column bit-length.
|
|
747
|
+
*
|
|
748
|
+
* @example
|
|
749
|
+
* ```ts
|
|
750
|
+
* await seed(db, { bitStringTable: schema.bitStringTable }).refine((funcs) => ({
|
|
751
|
+
* bitStringTable: {
|
|
752
|
+
* count,
|
|
753
|
+
* columns: {
|
|
754
|
+
* bit: funcs.bitString({
|
|
755
|
+
* dimensions: 12,
|
|
756
|
+
* isUnique: true
|
|
757
|
+
* }),
|
|
758
|
+
* },
|
|
759
|
+
* },
|
|
760
|
+
* }));
|
|
761
|
+
* ```
|
|
762
|
+
*/
|
|
763
|
+
bitString: (...args: [] | [{
|
|
764
|
+
dimensions?: number;
|
|
765
|
+
isUnique?: boolean;
|
|
766
|
+
arraySize?: number;
|
|
767
|
+
}]) => GenerateBitString;
|
|
768
|
+
/**
|
|
769
|
+
* generates ip addresses based on specified parameters
|
|
770
|
+
*
|
|
771
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
772
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
773
|
+
* @param ipAddress - type of IP address to generate — either "ipv4" or "ipv6".
|
|
774
|
+
*
|
|
775
|
+
* Defaults to `'ipv4'`.
|
|
776
|
+
* @param includeCidr - determines whether generated IPs include a CIDR suffix.
|
|
777
|
+
*
|
|
778
|
+
* Defaults to `true`.
|
|
779
|
+
*
|
|
780
|
+
* @example
|
|
781
|
+
* ```ts
|
|
782
|
+
* await seed(db, { inetTable: schema.inetTable }).refine((funcs) => ({
|
|
783
|
+
* inetTable: {
|
|
784
|
+
* count,
|
|
785
|
+
* columns: {
|
|
786
|
+
* inet: funcs.inet({
|
|
787
|
+
* ipAddress: 'ipv4',
|
|
788
|
+
* includeCidr: true,
|
|
789
|
+
* isUnique: true
|
|
790
|
+
* }),
|
|
791
|
+
* },
|
|
792
|
+
* },
|
|
793
|
+
* }));
|
|
794
|
+
* ```
|
|
795
|
+
*/
|
|
796
|
+
inet: (...args: [] | [{
|
|
797
|
+
ipAddress?: "ipv4" | "ipv6";
|
|
798
|
+
includeCidr?: boolean;
|
|
799
|
+
isUnique?: boolean;
|
|
800
|
+
arraySize?: number;
|
|
801
|
+
}]) => GenerateInet;
|
|
802
|
+
/**
|
|
803
|
+
* generates PostGIS geometry objects based on the given parameters.
|
|
804
|
+
*
|
|
805
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
806
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
807
|
+
* @param type - geometry type to generate; currently only `'point'` is supported.
|
|
808
|
+
*
|
|
809
|
+
* Defaults to `'point'`.
|
|
810
|
+
* @param srid - Spatial Reference System Identifier: determines what type of point will be generated - either `4326` or `3857`.
|
|
811
|
+
*
|
|
812
|
+
* Defaults to `4326`.
|
|
813
|
+
* @param decimalPlaces - number of decimal places for points when `srid` is `4326` (e.g., `decimalPlaces = 3` produces values like `'point(30.723 46.482)'`).
|
|
814
|
+
*
|
|
815
|
+
* Defaults to `6`.
|
|
816
|
+
*
|
|
817
|
+
* @example
|
|
818
|
+
* ```ts
|
|
819
|
+
* await seed(db, { geometryTable: schema.geometryTable }).refine((funcs) => ({
|
|
820
|
+
* geometryTable: {
|
|
821
|
+
* count,
|
|
822
|
+
* columns: {
|
|
823
|
+
* geometryPointTuple: funcs.geometry({
|
|
824
|
+
* type: 'point',
|
|
825
|
+
* srid: 4326,
|
|
826
|
+
* decimalPlaces: 5,
|
|
827
|
+
* isUnique: true
|
|
828
|
+
* })
|
|
829
|
+
* },
|
|
830
|
+
* },
|
|
831
|
+
* }));
|
|
832
|
+
* ```
|
|
833
|
+
*/
|
|
834
|
+
geometry: (...args: [] | [{
|
|
835
|
+
type?: "point";
|
|
836
|
+
srid?: 4326 | 3857;
|
|
837
|
+
decimalPlaces?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
838
|
+
isUnique?: boolean;
|
|
839
|
+
arraySize?: number;
|
|
840
|
+
}]) => GenerateGeometry;
|
|
841
|
+
/**
|
|
842
|
+
* generates vectors based on the provided parameters.
|
|
843
|
+
*
|
|
844
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
845
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
846
|
+
* @param decimalPlaces - number of decimal places for each vector element (e.g., `decimalPlaces = 3` produces values like `1.123`).
|
|
847
|
+
*
|
|
848
|
+
* Defaults to `2`.
|
|
849
|
+
* @param dimensions - number of elements in each generated vector (e.g., `dimensions = 3` produces values like `[1,2,3]`).
|
|
850
|
+
*
|
|
851
|
+
* Defaults to the value of the database column’s dimensions.
|
|
852
|
+
* @param minValue - minimum allowed value for each vector element.
|
|
853
|
+
*
|
|
854
|
+
* Defaults to `-1000`.
|
|
855
|
+
* @param maxValue - maximum allowed value for each vector element.
|
|
856
|
+
*
|
|
857
|
+
* Defaults to `1000`.
|
|
858
|
+
*
|
|
859
|
+
* @example
|
|
860
|
+
* ```ts
|
|
861
|
+
* await seed(db, { vectorTable: schema.vectorTable }).refine((funcs) => ({
|
|
862
|
+
* vectorTable: {
|
|
863
|
+
* count,
|
|
864
|
+
* columns: {
|
|
865
|
+
* vector: funcs.vector({
|
|
866
|
+
* decimalPlaces: 5,
|
|
867
|
+
* dimensions: 12,
|
|
868
|
+
* minValue: -100,
|
|
869
|
+
* maxValue: 100,
|
|
870
|
+
* isUnique: true
|
|
871
|
+
* }),
|
|
872
|
+
* },
|
|
873
|
+
* },
|
|
874
|
+
* }));
|
|
875
|
+
* ```
|
|
876
|
+
*/
|
|
877
|
+
vector: (...args: [] | [{
|
|
878
|
+
dimensions?: number;
|
|
879
|
+
minValue?: number;
|
|
880
|
+
maxValue?: number;
|
|
881
|
+
decimalPlaces?: number;
|
|
70
882
|
isUnique?: boolean;
|
|
71
883
|
arraySize?: number;
|
|
72
|
-
}) =>
|
|
884
|
+
}]) => GenerateVector;
|
|
885
|
+
};
|
|
886
|
+
export declare const generatorsFuncsV2: {
|
|
887
|
+
/**
|
|
888
|
+
* generates same given value each time the generator is called.
|
|
889
|
+
* @param defaultValue - value you want to generate
|
|
890
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
891
|
+
*
|
|
892
|
+
* @example
|
|
893
|
+
* ```ts
|
|
894
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
895
|
+
* posts: {
|
|
896
|
+
* columns: {
|
|
897
|
+
* content: funcs.default({ defaultValue: "post content" }),
|
|
898
|
+
* },
|
|
899
|
+
* },
|
|
900
|
+
* }));
|
|
901
|
+
* ```
|
|
902
|
+
*/
|
|
903
|
+
default: (args_0: {
|
|
904
|
+
defaultValue: unknown;
|
|
905
|
+
arraySize?: number;
|
|
906
|
+
}) => GenerateDefault;
|
|
907
|
+
/**
|
|
908
|
+
* generates values from given array
|
|
909
|
+
* @param values - array of values you want to generate. can be array of weighted values.
|
|
910
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
911
|
+
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
912
|
+
*
|
|
913
|
+
* @example
|
|
914
|
+
* ```ts
|
|
915
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
916
|
+
* posts: {
|
|
917
|
+
* columns: {
|
|
918
|
+
* title: funcs.valuesFromArray({
|
|
919
|
+
* values: ["Title1", "Title2", "Title3", "Title4", "Title5"],
|
|
920
|
+
* isUnique: true
|
|
921
|
+
* }),
|
|
922
|
+
* },
|
|
923
|
+
* },
|
|
924
|
+
* }));
|
|
925
|
+
*
|
|
926
|
+
* ```
|
|
927
|
+
* weighted values example
|
|
928
|
+
* @example
|
|
929
|
+
* ```ts
|
|
930
|
+
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
931
|
+
* posts: {
|
|
932
|
+
* columns: {
|
|
933
|
+
* title: funcs.valuesFromArray({
|
|
934
|
+
* values: [
|
|
935
|
+
* { weight: 0.35, values: ["Title1", "Title2"] },
|
|
936
|
+
* { weight: 0.5, values: ["Title3", "Title4"] },
|
|
937
|
+
* { weight: 0.15, values: ["Title5"] },
|
|
938
|
+
* ],
|
|
939
|
+
* isUnique: false
|
|
940
|
+
* }),
|
|
941
|
+
* },
|
|
942
|
+
* },
|
|
943
|
+
* }));
|
|
944
|
+
*
|
|
945
|
+
* ```
|
|
946
|
+
*/
|
|
947
|
+
valuesFromArray: (args_0: import("./Generators.js").GenerateValuesFromArrayT) => GenerateValuesFromArray;
|
|
73
948
|
/**
|
|
74
949
|
* generates sequential integers starting with 1.
|
|
75
950
|
* @example
|
|
@@ -479,12 +1354,7 @@ export declare const generatorsFuncs: {
|
|
|
479
1354
|
*
|
|
480
1355
|
* ```
|
|
481
1356
|
*/
|
|
482
|
-
phoneNumber: (...args: [] | [
|
|
483
|
-
template?: string;
|
|
484
|
-
prefixes?: string[];
|
|
485
|
-
generatedDigitsNumbers?: number | number[];
|
|
486
|
-
arraySize?: number;
|
|
487
|
-
}]) => GeneratePhoneNumber;
|
|
1357
|
+
phoneNumber: (...args: [] | [import("./Generators.js").GeneratePhoneNumberT]) => GeneratePhoneNumber;
|
|
488
1358
|
/**
|
|
489
1359
|
* generates country's names.
|
|
490
1360
|
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
@@ -894,7 +1764,7 @@ export declare const generatorsFuncs: {
|
|
|
894
1764
|
arraySize?: number;
|
|
895
1765
|
}]) => GenerateVector;
|
|
896
1766
|
};
|
|
897
|
-
export declare const
|
|
1767
|
+
export declare const generatorsFuncsV3: {
|
|
898
1768
|
/**
|
|
899
1769
|
* generates same given value each time the generator is called.
|
|
900
1770
|
* @param defaultValue - value you want to generate
|
|
@@ -955,14 +1825,7 @@ export declare const generatorsFuncsV2: {
|
|
|
955
1825
|
*
|
|
956
1826
|
* ```
|
|
957
1827
|
*/
|
|
958
|
-
valuesFromArray: (args_0:
|
|
959
|
-
values: import("../types/seedService.js").GeneratedValueType[] | {
|
|
960
|
-
weight: number;
|
|
961
|
-
values: import("../types/seedService.js").GeneratedValueType[];
|
|
962
|
-
}[];
|
|
963
|
-
isUnique?: boolean;
|
|
964
|
-
arraySize?: number;
|
|
965
|
-
}) => GenerateValuesFromArray;
|
|
1828
|
+
valuesFromArray: (args_0: import("./Generators.js").GenerateValuesFromArrayT) => GenerateValuesFromArray;
|
|
966
1829
|
/**
|
|
967
1830
|
* generates sequential integers starting with 1.
|
|
968
1831
|
* @example
|
|
@@ -1372,12 +2235,7 @@ export declare const generatorsFuncsV2: {
|
|
|
1372
2235
|
*
|
|
1373
2236
|
* ```
|
|
1374
2237
|
*/
|
|
1375
|
-
phoneNumber: (...args: [] | [
|
|
1376
|
-
template?: string;
|
|
1377
|
-
prefixes?: string[];
|
|
1378
|
-
generatedDigitsNumbers?: number | number[];
|
|
1379
|
-
arraySize?: number;
|
|
1380
|
-
}]) => GeneratePhoneNumber;
|
|
2238
|
+
phoneNumber: (...args: [] | [import("./Generators.js").GeneratePhoneNumberT]) => GeneratePhoneNumber;
|
|
1381
2239
|
/**
|
|
1382
2240
|
* generates country's names.
|
|
1383
2241
|
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
@@ -1788,6 +2646,7 @@ export declare const generatorsFuncsV2: {
|
|
|
1788
2646
|
}]) => GenerateVector;
|
|
1789
2647
|
};
|
|
1790
2648
|
export declare const generatorsMap: {
|
|
2649
|
+
readonly GenerateHashFromString: readonly [typeof GenerateHashFromString, typeof GenerateHashFromStringV3];
|
|
1791
2650
|
readonly HollowGenerator: readonly [typeof HollowGenerator];
|
|
1792
2651
|
readonly GenerateDefault: readonly [typeof GenerateDefault];
|
|
1793
2652
|
readonly GenerateValuesFromArray: readonly [typeof GenerateValuesFromArray];
|
|
@@ -1846,4 +2705,5 @@ export declare const generatorsMap: {
|
|
|
1846
2705
|
readonly GenerateUniqueGeometry: readonly [typeof GenerateUniqueGeometry];
|
|
1847
2706
|
readonly GenerateVector: readonly [typeof GenerateVector];
|
|
1848
2707
|
readonly GenerateUniqueVector: readonly [typeof GenerateUniqueVector];
|
|
2708
|
+
readonly GenerateCompositeUniqueKey: readonly [typeof GenerateCompositeUniqueKey];
|
|
1849
2709
|
};
|