drizzle-seed 0.3.2-f8a2f3c → 0.4.0-02522e1
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/{services/SeedService.d.cts → SeedService.d.cts} +19 -26
- package/{services/SeedService.d.mts → SeedService.d.mts} +19 -26
- package/{services/SeedService.d.ts → SeedService.d.ts} +19 -26
- package/cockroach-core/index.d.cts +28 -0
- package/cockroach-core/index.d.mts +28 -0
- package/cockroach-core/index.d.ts +28 -0
- package/cockroach-core/selectGensForColumn.d.cts +3 -0
- package/cockroach-core/selectGensForColumn.d.mts +3 -0
- package/cockroach-core/selectGensForColumn.d.ts +3 -0
- package/common.d.cts +23 -0
- package/common.d.mts +23 -0
- package/common.d.ts +23 -0
- package/{services → generators}/GeneratorFuncs.d.cts +1194 -58
- package/{services → generators}/GeneratorFuncs.d.mts +1194 -58
- package/{services → generators}/GeneratorFuncs.d.ts +1194 -58
- package/{services → generators}/Generators.d.cts +286 -55
- package/{services → generators}/Generators.d.mts +286 -55
- package/{services → generators}/Generators.d.ts +286 -55
- package/generators/apiVersion.d.cts +1 -0
- package/generators/apiVersion.d.mts +1 -0
- package/generators/apiVersion.d.ts +1 -0
- package/generators/utils.d.cts +38 -0
- package/generators/utils.d.mts +38 -0
- package/generators/utils.d.ts +38 -0
- package/{services → generators}/versioning/v2.d.cts +13 -6
- package/{services → generators}/versioning/v2.d.mts +13 -6
- package/{services → generators}/versioning/v2.d.ts +13 -6
- 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 +3195 -1463
- package/index.cjs.map +1 -1
- package/index.d.cts +94 -125
- package/index.d.mts +94 -125
- package/index.d.ts +94 -125
- package/index.mjs +3200 -1467
- package/index.mjs.map +1 -1
- package/mssql-core/index.d.cts +24 -0
- package/mssql-core/index.d.mts +24 -0
- package/mssql-core/index.d.ts +24 -0
- package/mssql-core/selectGensForColumn.d.cts +2 -0
- package/mssql-core/selectGensForColumn.d.mts +2 -0
- package/mssql-core/selectGensForColumn.d.ts +2 -0
- package/mysql-core/index.d.cts +28 -0
- package/mysql-core/index.d.mts +28 -0
- package/mysql-core/index.d.ts +28 -0
- package/mysql-core/selectGensForColumn.d.cts +2 -0
- package/mysql-core/selectGensForColumn.d.mts +2 -0
- package/mysql-core/selectGensForColumn.d.ts +2 -0
- package/package.json +108 -103
- package/pg-core/index.d.cts +28 -0
- package/pg-core/index.d.mts +28 -0
- package/pg-core/index.d.ts +28 -0
- package/pg-core/selectGensForColumn.d.cts +3 -0
- package/pg-core/selectGensForColumn.d.mts +3 -0
- package/pg-core/selectGensForColumn.d.ts +3 -0
- package/singlestore-core/index.d.cts +28 -0
- package/singlestore-core/index.d.mts +28 -0
- package/singlestore-core/index.d.ts +28 -0
- package/singlestore-core/selectGensForColumn.d.cts +2 -0
- package/singlestore-core/selectGensForColumn.d.mts +2 -0
- package/singlestore-core/selectGensForColumn.d.ts +2 -0
- package/sqlite-core/index.d.cts +28 -0
- package/sqlite-core/index.d.mts +28 -0
- package/sqlite-core/index.d.ts +28 -0
- package/sqlite-core/selectGensForColumn.d.cts +2 -0
- package/sqlite-core/selectGensForColumn.d.mts +2 -0
- package/sqlite-core/selectGensForColumn.d.ts +2 -0
- package/types/seedService.d.cts +11 -1
- package/types/seedService.d.mts +11 -1
- package/types/seedService.d.ts +11 -1
- package/types/tables.d.cts +20 -0
- package/types/tables.d.mts +20 -0
- package/types/tables.d.ts +20 -0
- package/utils.d.cts +3 -0
- package/utils.d.mts +3 -0
- package/utils.d.ts +3 -0
- package/services/apiVersion.d.cts +0 -1
- package/services/apiVersion.d.mts +0 -1
- package/services/apiVersion.d.ts +0 -1
- package/services/utils.d.cts +0 -23
- package/services/utils.d.mts +0 -23
- package/services/utils.d.ts +0 -23
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AbstractGenerator } from './Generators.js';
|
|
2
|
-
import { GenerateArray, GenerateBoolean, GenerateCity, GenerateCompanyName, GenerateCountry, GenerateDate, GenerateDatetime, GenerateDefault, GenerateEmail, GenerateEnum, GenerateFirstName, GenerateFullName, GenerateInt, GenerateInterval, GenerateIntPrimaryKey, GenerateJobTitle, GenerateJson, GenerateLastName, GenerateLine, GenerateLoremIpsum, GenerateNumber, GeneratePhoneNumber, GeneratePoint, GeneratePostcode, GenerateSelfRelationsValuesFromArray, GenerateState, GenerateStreetAddress, GenerateString, GenerateTime, GenerateTimestamp, GenerateUniqueCity, GenerateUniqueCompanyName, GenerateUniqueCountry, GenerateUniqueFirstName, GenerateUniqueFullName, GenerateUniqueInt, GenerateUniqueInterval, GenerateUniqueLastName, GenerateUniqueLine, GenerateUniqueNumber, GenerateUniquePoint, GenerateUniquePostcode, GenerateUniqueStreetAddress, GenerateUniqueString, GenerateUUID, GenerateValuesFromArray, 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
|
|
@@ -183,8 +1058,6 @@ export declare const generatorsFuncs: {
|
|
|
183
1058
|
}]) => GenerateDate;
|
|
184
1059
|
/**
|
|
185
1060
|
* generates time in 24 hours style.
|
|
186
|
-
* @param minTime - lower border of range.
|
|
187
|
-
* @param maxTime - upper border of range.
|
|
188
1061
|
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
189
1062
|
*
|
|
190
1063
|
* @example
|
|
@@ -192,7 +1065,7 @@ export declare const generatorsFuncs: {
|
|
|
192
1065
|
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
193
1066
|
* users: {
|
|
194
1067
|
* columns: {
|
|
195
|
-
* birthTime: funcs.time(
|
|
1068
|
+
* birthTime: funcs.time()
|
|
196
1069
|
* },
|
|
197
1070
|
* },
|
|
198
1071
|
* }));
|
|
@@ -200,14 +1073,10 @@ export declare const generatorsFuncs: {
|
|
|
200
1073
|
* ```
|
|
201
1074
|
*/
|
|
202
1075
|
time: (...args: [] | [{
|
|
203
|
-
minTime?: string | Date;
|
|
204
|
-
maxTime?: string | Date;
|
|
205
1076
|
arraySize?: number;
|
|
206
1077
|
}]) => GenerateTime;
|
|
207
1078
|
/**
|
|
208
1079
|
* generates timestamps.
|
|
209
|
-
* @param minTimestamp - lower border of range.
|
|
210
|
-
* @param maxTimestamp - upper border of range.
|
|
211
1080
|
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
212
1081
|
*
|
|
213
1082
|
* @example
|
|
@@ -215,7 +1084,7 @@ export declare const generatorsFuncs: {
|
|
|
215
1084
|
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
216
1085
|
* orders: {
|
|
217
1086
|
* columns: {
|
|
218
|
-
* shippedDate: funcs.timestamp(
|
|
1087
|
+
* shippedDate: funcs.timestamp()
|
|
219
1088
|
* },
|
|
220
1089
|
* },
|
|
221
1090
|
* }));
|
|
@@ -223,14 +1092,10 @@ export declare const generatorsFuncs: {
|
|
|
223
1092
|
* ```
|
|
224
1093
|
*/
|
|
225
1094
|
timestamp: (...args: [] | [{
|
|
226
|
-
minTimestamp?: string | Date;
|
|
227
|
-
maxTimestamp?: string | Date;
|
|
228
1095
|
arraySize?: number;
|
|
229
1096
|
}]) => GenerateTimestamp;
|
|
230
1097
|
/**
|
|
231
1098
|
* generates datetime objects.
|
|
232
|
-
* @param minDatetime - lower border of range.
|
|
233
|
-
* @param maxDatetime - upper border of range.
|
|
234
1099
|
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
235
1100
|
*
|
|
236
1101
|
* @example
|
|
@@ -238,7 +1103,7 @@ export declare const generatorsFuncs: {
|
|
|
238
1103
|
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
239
1104
|
* orders: {
|
|
240
1105
|
* columns: {
|
|
241
|
-
* shippedDate: funcs.datetime(
|
|
1106
|
+
* shippedDate: funcs.datetime()
|
|
242
1107
|
* },
|
|
243
1108
|
* },
|
|
244
1109
|
* }));
|
|
@@ -246,8 +1111,6 @@ export declare const generatorsFuncs: {
|
|
|
246
1111
|
* ```
|
|
247
1112
|
*/
|
|
248
1113
|
datetime: (...args: [] | [{
|
|
249
|
-
minDatetime?: string | Date;
|
|
250
|
-
maxDatetime?: string | Date;
|
|
251
1114
|
arraySize?: number;
|
|
252
1115
|
}]) => GenerateDatetime;
|
|
253
1116
|
/**
|
|
@@ -491,12 +1354,7 @@ export declare const generatorsFuncs: {
|
|
|
491
1354
|
*
|
|
492
1355
|
* ```
|
|
493
1356
|
*/
|
|
494
|
-
phoneNumber: (...args: [] | [
|
|
495
|
-
template?: string;
|
|
496
|
-
prefixes?: string[];
|
|
497
|
-
generatedDigitsNumbers?: number | number[];
|
|
498
|
-
arraySize?: number;
|
|
499
|
-
}]) => GeneratePhoneNumber;
|
|
1357
|
+
phoneNumber: (...args: [] | [import("./Generators.js").GeneratePhoneNumberT]) => GeneratePhoneNumber;
|
|
500
1358
|
/**
|
|
501
1359
|
* generates country's names.
|
|
502
1360
|
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
@@ -759,8 +1617,154 @@ export declare const generatorsFuncs: {
|
|
|
759
1617
|
weight: number;
|
|
760
1618
|
value: AbstractGenerator<any>;
|
|
761
1619
|
}[]) => WeightedRandomGenerator;
|
|
1620
|
+
/**
|
|
1621
|
+
* generates bit strings based on specified parameters
|
|
1622
|
+
*
|
|
1623
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
1624
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
1625
|
+
* @param dimensions - desired length of each bit string (e.g., `dimensions = 3` produces values like `'010'`).
|
|
1626
|
+
*
|
|
1627
|
+
* Defaults to the value of the database column bit-length.
|
|
1628
|
+
*
|
|
1629
|
+
* @example
|
|
1630
|
+
* ```ts
|
|
1631
|
+
* await seed(db, { bitStringTable: schema.bitStringTable }).refine((funcs) => ({
|
|
1632
|
+
* bitStringTable: {
|
|
1633
|
+
* count,
|
|
1634
|
+
* columns: {
|
|
1635
|
+
* bit: funcs.bitString({
|
|
1636
|
+
* dimensions: 12,
|
|
1637
|
+
* isUnique: true
|
|
1638
|
+
* }),
|
|
1639
|
+
* },
|
|
1640
|
+
* },
|
|
1641
|
+
* }));
|
|
1642
|
+
* ```
|
|
1643
|
+
*/
|
|
1644
|
+
bitString: (...args: [] | [{
|
|
1645
|
+
dimensions?: number;
|
|
1646
|
+
isUnique?: boolean;
|
|
1647
|
+
arraySize?: number;
|
|
1648
|
+
}]) => GenerateBitString;
|
|
1649
|
+
/**
|
|
1650
|
+
* generates ip addresses based on specified parameters
|
|
1651
|
+
*
|
|
1652
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
1653
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
1654
|
+
* @param ipAddress - type of IP address to generate — either "ipv4" or "ipv6".
|
|
1655
|
+
*
|
|
1656
|
+
* Defaults to `'ipv4'`.
|
|
1657
|
+
* @param includeCidr - determines whether generated IPs include a CIDR suffix.
|
|
1658
|
+
*
|
|
1659
|
+
* Defaults to `true`.
|
|
1660
|
+
*
|
|
1661
|
+
* @example
|
|
1662
|
+
* ```ts
|
|
1663
|
+
* await seed(db, { inetTable: schema.inetTable }).refine((funcs) => ({
|
|
1664
|
+
* inetTable: {
|
|
1665
|
+
* count,
|
|
1666
|
+
* columns: {
|
|
1667
|
+
* inet: funcs.inet({
|
|
1668
|
+
* ipAddress: 'ipv4',
|
|
1669
|
+
* includeCidr: true,
|
|
1670
|
+
* isUnique: true
|
|
1671
|
+
* }),
|
|
1672
|
+
* },
|
|
1673
|
+
* },
|
|
1674
|
+
* }));
|
|
1675
|
+
* ```
|
|
1676
|
+
*/
|
|
1677
|
+
inet: (...args: [] | [{
|
|
1678
|
+
ipAddress?: "ipv4" | "ipv6";
|
|
1679
|
+
includeCidr?: boolean;
|
|
1680
|
+
isUnique?: boolean;
|
|
1681
|
+
arraySize?: number;
|
|
1682
|
+
}]) => GenerateInet;
|
|
1683
|
+
/**
|
|
1684
|
+
* generates PostGIS geometry objects based on the given parameters.
|
|
1685
|
+
*
|
|
1686
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
1687
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
1688
|
+
* @param type - geometry type to generate; currently only `'point'` is supported.
|
|
1689
|
+
*
|
|
1690
|
+
* Defaults to `'point'`.
|
|
1691
|
+
* @param srid - Spatial Reference System Identifier: determines what type of point will be generated - either `4326` or `3857`.
|
|
1692
|
+
*
|
|
1693
|
+
* Defaults to `4326`.
|
|
1694
|
+
* @param decimalPlaces - number of decimal places for points when `srid` is `4326` (e.g., `decimalPlaces = 3` produces values like `'point(30.723 46.482)'`).
|
|
1695
|
+
*
|
|
1696
|
+
* Defaults to `6`.
|
|
1697
|
+
*
|
|
1698
|
+
* @example
|
|
1699
|
+
* ```ts
|
|
1700
|
+
* await seed(db, { geometryTable: schema.geometryTable }).refine((funcs) => ({
|
|
1701
|
+
* geometryTable: {
|
|
1702
|
+
* count,
|
|
1703
|
+
* columns: {
|
|
1704
|
+
* geometryPointTuple: funcs.geometry({
|
|
1705
|
+
* type: 'point',
|
|
1706
|
+
* srid: 4326,
|
|
1707
|
+
* decimalPlaces: 5,
|
|
1708
|
+
* isUnique: true
|
|
1709
|
+
* })
|
|
1710
|
+
* },
|
|
1711
|
+
* },
|
|
1712
|
+
* }));
|
|
1713
|
+
* ```
|
|
1714
|
+
*/
|
|
1715
|
+
geometry: (...args: [] | [{
|
|
1716
|
+
type?: "point";
|
|
1717
|
+
srid?: 4326 | 3857;
|
|
1718
|
+
decimalPlaces?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
1719
|
+
isUnique?: boolean;
|
|
1720
|
+
arraySize?: number;
|
|
1721
|
+
}]) => GenerateGeometry;
|
|
1722
|
+
/**
|
|
1723
|
+
* generates vectors based on the provided parameters.
|
|
1724
|
+
*
|
|
1725
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
1726
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
1727
|
+
* @param decimalPlaces - number of decimal places for each vector element (e.g., `decimalPlaces = 3` produces values like `1.123`).
|
|
1728
|
+
*
|
|
1729
|
+
* Defaults to `2`.
|
|
1730
|
+
* @param dimensions - number of elements in each generated vector (e.g., `dimensions = 3` produces values like `[1,2,3]`).
|
|
1731
|
+
*
|
|
1732
|
+
* Defaults to the value of the database column’s dimensions.
|
|
1733
|
+
* @param minValue - minimum allowed value for each vector element.
|
|
1734
|
+
*
|
|
1735
|
+
* Defaults to `-1000`.
|
|
1736
|
+
* @param maxValue - maximum allowed value for each vector element.
|
|
1737
|
+
*
|
|
1738
|
+
* Defaults to `1000`.
|
|
1739
|
+
*
|
|
1740
|
+
* @example
|
|
1741
|
+
* ```ts
|
|
1742
|
+
* await seed(db, { vectorTable: schema.vectorTable }).refine((funcs) => ({
|
|
1743
|
+
* vectorTable: {
|
|
1744
|
+
* count,
|
|
1745
|
+
* columns: {
|
|
1746
|
+
* vector: funcs.vector({
|
|
1747
|
+
* decimalPlaces: 5,
|
|
1748
|
+
* dimensions: 12,
|
|
1749
|
+
* minValue: -100,
|
|
1750
|
+
* maxValue: 100,
|
|
1751
|
+
* isUnique: true
|
|
1752
|
+
* }),
|
|
1753
|
+
* },
|
|
1754
|
+
* },
|
|
1755
|
+
* }));
|
|
1756
|
+
* ```
|
|
1757
|
+
*/
|
|
1758
|
+
vector: (...args: [] | [{
|
|
1759
|
+
dimensions?: number;
|
|
1760
|
+
minValue?: number;
|
|
1761
|
+
maxValue?: number;
|
|
1762
|
+
decimalPlaces?: number;
|
|
1763
|
+
isUnique?: boolean;
|
|
1764
|
+
arraySize?: number;
|
|
1765
|
+
}]) => GenerateVector;
|
|
762
1766
|
};
|
|
763
|
-
export declare const
|
|
1767
|
+
export declare const generatorsFuncsV3: {
|
|
764
1768
|
/**
|
|
765
1769
|
* generates same given value each time the generator is called.
|
|
766
1770
|
* @param defaultValue - value you want to generate
|
|
@@ -821,14 +1825,7 @@ export declare const generatorsFuncsV2: {
|
|
|
821
1825
|
*
|
|
822
1826
|
* ```
|
|
823
1827
|
*/
|
|
824
|
-
valuesFromArray: (args_0:
|
|
825
|
-
values: (number | string | boolean | undefined)[] | {
|
|
826
|
-
weight: number;
|
|
827
|
-
values: (number | string | boolean | undefined)[];
|
|
828
|
-
}[];
|
|
829
|
-
isUnique?: boolean;
|
|
830
|
-
arraySize?: number;
|
|
831
|
-
}) => GenerateValuesFromArray;
|
|
1828
|
+
valuesFromArray: (args_0: import("./Generators.js").GenerateValuesFromArrayT) => GenerateValuesFromArray;
|
|
832
1829
|
/**
|
|
833
1830
|
* generates sequential integers starting with 1.
|
|
834
1831
|
* @example
|
|
@@ -942,8 +1939,6 @@ export declare const generatorsFuncsV2: {
|
|
|
942
1939
|
}]) => GenerateDate;
|
|
943
1940
|
/**
|
|
944
1941
|
* generates time in 24 hours style.
|
|
945
|
-
* @param minTime - lower border of range.
|
|
946
|
-
* @param maxTime - upper border of range.
|
|
947
1942
|
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
948
1943
|
*
|
|
949
1944
|
* @example
|
|
@@ -951,7 +1946,7 @@ export declare const generatorsFuncsV2: {
|
|
|
951
1946
|
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
952
1947
|
* users: {
|
|
953
1948
|
* columns: {
|
|
954
|
-
* birthTime: funcs.time(
|
|
1949
|
+
* birthTime: funcs.time()
|
|
955
1950
|
* },
|
|
956
1951
|
* },
|
|
957
1952
|
* }));
|
|
@@ -959,14 +1954,10 @@ export declare const generatorsFuncsV2: {
|
|
|
959
1954
|
* ```
|
|
960
1955
|
*/
|
|
961
1956
|
time: (...args: [] | [{
|
|
962
|
-
minTime?: string | Date;
|
|
963
|
-
maxTime?: string | Date;
|
|
964
1957
|
arraySize?: number;
|
|
965
1958
|
}]) => GenerateTime;
|
|
966
1959
|
/**
|
|
967
1960
|
* generates timestamps.
|
|
968
|
-
* @param minTimestamp - lower border of range.
|
|
969
|
-
* @param maxTimestamp - upper border of range.
|
|
970
1961
|
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
971
1962
|
*
|
|
972
1963
|
* @example
|
|
@@ -974,7 +1965,7 @@ export declare const generatorsFuncsV2: {
|
|
|
974
1965
|
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
975
1966
|
* orders: {
|
|
976
1967
|
* columns: {
|
|
977
|
-
* shippedDate: funcs.timestamp(
|
|
1968
|
+
* shippedDate: funcs.timestamp()
|
|
978
1969
|
* },
|
|
979
1970
|
* },
|
|
980
1971
|
* }));
|
|
@@ -982,14 +1973,10 @@ export declare const generatorsFuncsV2: {
|
|
|
982
1973
|
* ```
|
|
983
1974
|
*/
|
|
984
1975
|
timestamp: (...args: [] | [{
|
|
985
|
-
minTimestamp?: string | Date;
|
|
986
|
-
maxTimestamp?: string | Date;
|
|
987
1976
|
arraySize?: number;
|
|
988
1977
|
}]) => GenerateTimestamp;
|
|
989
1978
|
/**
|
|
990
1979
|
* generates datetime objects.
|
|
991
|
-
* @param minDatetime - lower border of range.
|
|
992
|
-
* @param maxDatetime - upper border of range.
|
|
993
1980
|
* @param arraySize - number of elements in each one-dimensional array. (If specified, arrays will be generated.)
|
|
994
1981
|
*
|
|
995
1982
|
* @example
|
|
@@ -997,7 +1984,7 @@ export declare const generatorsFuncsV2: {
|
|
|
997
1984
|
* await seed(db, schema, { count: 1000 }).refine((funcs) => ({
|
|
998
1985
|
* orders: {
|
|
999
1986
|
* columns: {
|
|
1000
|
-
* shippedDate: funcs.datetime(
|
|
1987
|
+
* shippedDate: funcs.datetime()
|
|
1001
1988
|
* },
|
|
1002
1989
|
* },
|
|
1003
1990
|
* }));
|
|
@@ -1005,8 +1992,6 @@ export declare const generatorsFuncsV2: {
|
|
|
1005
1992
|
* ```
|
|
1006
1993
|
*/
|
|
1007
1994
|
datetime: (...args: [] | [{
|
|
1008
|
-
minDatetime?: string | Date;
|
|
1009
|
-
maxDatetime?: string | Date;
|
|
1010
1995
|
arraySize?: number;
|
|
1011
1996
|
}]) => GenerateDatetime;
|
|
1012
1997
|
/**
|
|
@@ -1250,12 +2235,7 @@ export declare const generatorsFuncsV2: {
|
|
|
1250
2235
|
*
|
|
1251
2236
|
* ```
|
|
1252
2237
|
*/
|
|
1253
|
-
phoneNumber: (...args: [] | [
|
|
1254
|
-
template?: string;
|
|
1255
|
-
prefixes?: string[];
|
|
1256
|
-
generatedDigitsNumbers?: number | number[];
|
|
1257
|
-
arraySize?: number;
|
|
1258
|
-
}]) => GeneratePhoneNumber;
|
|
2238
|
+
phoneNumber: (...args: [] | [import("./Generators.js").GeneratePhoneNumberT]) => GeneratePhoneNumber;
|
|
1259
2239
|
/**
|
|
1260
2240
|
* generates country's names.
|
|
1261
2241
|
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
@@ -1518,8 +2498,155 @@ export declare const generatorsFuncsV2: {
|
|
|
1518
2498
|
weight: number;
|
|
1519
2499
|
value: AbstractGenerator<any>;
|
|
1520
2500
|
}[]) => WeightedRandomGenerator;
|
|
2501
|
+
/**
|
|
2502
|
+
* generates bit strings based on specified parameters
|
|
2503
|
+
*
|
|
2504
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2505
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
2506
|
+
* @param dimensions - desired length of each bit string (e.g., `dimensions = 3` produces values like `'010'`).
|
|
2507
|
+
*
|
|
2508
|
+
* Defaults to the value of the database column bit-length.
|
|
2509
|
+
*
|
|
2510
|
+
* @example
|
|
2511
|
+
* ```ts
|
|
2512
|
+
* await seed(db, { bitStringTable: schema.bitStringTable }).refine((funcs) => ({
|
|
2513
|
+
* bitStringTable: {
|
|
2514
|
+
* count,
|
|
2515
|
+
* columns: {
|
|
2516
|
+
* bit: funcs.bitString({
|
|
2517
|
+
* dimensions: 12,
|
|
2518
|
+
* isUnique: true
|
|
2519
|
+
* }),
|
|
2520
|
+
* },
|
|
2521
|
+
* },
|
|
2522
|
+
* }));
|
|
2523
|
+
* ```
|
|
2524
|
+
*/
|
|
2525
|
+
bitString: (...args: [] | [{
|
|
2526
|
+
dimensions?: number;
|
|
2527
|
+
isUnique?: boolean;
|
|
2528
|
+
arraySize?: number;
|
|
2529
|
+
}]) => GenerateBitString;
|
|
2530
|
+
/**
|
|
2531
|
+
* generates ip addresses based on specified parameters
|
|
2532
|
+
*
|
|
2533
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2534
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
2535
|
+
* @param ipAddress - type of IP address to generate — either "ipv4" or "ipv6".
|
|
2536
|
+
*
|
|
2537
|
+
* Defaults to `'ipv4'`.
|
|
2538
|
+
* @param includeCidr - determines whether generated IPs include a CIDR suffix.
|
|
2539
|
+
*
|
|
2540
|
+
* Defaults to `true`.
|
|
2541
|
+
*
|
|
2542
|
+
* @example
|
|
2543
|
+
* ```ts
|
|
2544
|
+
* await seed(db, { inetTable: schema.inetTable }).refine((funcs) => ({
|
|
2545
|
+
* inetTable: {
|
|
2546
|
+
* count,
|
|
2547
|
+
* columns: {
|
|
2548
|
+
* inet: funcs.inet({
|
|
2549
|
+
* ipAddress: 'ipv4',
|
|
2550
|
+
* includeCidr: true,
|
|
2551
|
+
* isUnique: true
|
|
2552
|
+
* }),
|
|
2553
|
+
* },
|
|
2554
|
+
* },
|
|
2555
|
+
* }));
|
|
2556
|
+
* ```
|
|
2557
|
+
*/
|
|
2558
|
+
inet: (...args: [] | [{
|
|
2559
|
+
ipAddress?: "ipv4" | "ipv6";
|
|
2560
|
+
includeCidr?: boolean;
|
|
2561
|
+
isUnique?: boolean;
|
|
2562
|
+
arraySize?: number;
|
|
2563
|
+
}]) => GenerateInet;
|
|
2564
|
+
/**
|
|
2565
|
+
* generates PostGIS geometry objects based on the given parameters.
|
|
2566
|
+
*
|
|
2567
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2568
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
2569
|
+
* @param type - geometry type to generate; currently only `'point'` is supported.
|
|
2570
|
+
*
|
|
2571
|
+
* Defaults to `'point'`.
|
|
2572
|
+
* @param srid - Spatial Reference System Identifier: determines what type of point will be generated - either `4326` or `3857`.
|
|
2573
|
+
*
|
|
2574
|
+
* Defaults to `4326`.
|
|
2575
|
+
* @param decimalPlaces - number of decimal places for points when `srid` is `4326` (e.g., `decimalPlaces = 3` produces values like `'point(30.723 46.482)'`).
|
|
2576
|
+
*
|
|
2577
|
+
* Defaults to `6`.
|
|
2578
|
+
*
|
|
2579
|
+
* @example
|
|
2580
|
+
* ```ts
|
|
2581
|
+
* await seed(db, { geometryTable: schema.geometryTable }).refine((funcs) => ({
|
|
2582
|
+
* geometryTable: {
|
|
2583
|
+
* count,
|
|
2584
|
+
* columns: {
|
|
2585
|
+
* geometryPointTuple: funcs.geometry({
|
|
2586
|
+
* type: 'point',
|
|
2587
|
+
* srid: 4326,
|
|
2588
|
+
* decimalPlaces: 5,
|
|
2589
|
+
* isUnique: true
|
|
2590
|
+
* })
|
|
2591
|
+
* },
|
|
2592
|
+
* },
|
|
2593
|
+
* }));
|
|
2594
|
+
* ```
|
|
2595
|
+
*/
|
|
2596
|
+
geometry: (...args: [] | [{
|
|
2597
|
+
type?: "point";
|
|
2598
|
+
srid?: 4326 | 3857;
|
|
2599
|
+
decimalPlaces?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
2600
|
+
isUnique?: boolean;
|
|
2601
|
+
arraySize?: number;
|
|
2602
|
+
}]) => GenerateGeometry;
|
|
2603
|
+
/**
|
|
2604
|
+
* generates vectors based on the provided parameters.
|
|
2605
|
+
*
|
|
2606
|
+
* @param isUnique - property that controls if generated values gonna be unique or not.
|
|
2607
|
+
* @param arraySize - number of elements in each one-dimensional array (If specified, arrays will be generated).
|
|
2608
|
+
* @param decimalPlaces - number of decimal places for each vector element (e.g., `decimalPlaces = 3` produces values like `1.123`).
|
|
2609
|
+
*
|
|
2610
|
+
* Defaults to `2`.
|
|
2611
|
+
* @param dimensions - number of elements in each generated vector (e.g., `dimensions = 3` produces values like `[1,2,3]`).
|
|
2612
|
+
*
|
|
2613
|
+
* Defaults to the value of the database column’s dimensions.
|
|
2614
|
+
* @param minValue - minimum allowed value for each vector element.
|
|
2615
|
+
*
|
|
2616
|
+
* Defaults to `-1000`.
|
|
2617
|
+
* @param maxValue - maximum allowed value for each vector element.
|
|
2618
|
+
*
|
|
2619
|
+
* Defaults to `1000`.
|
|
2620
|
+
*
|
|
2621
|
+
* @example
|
|
2622
|
+
* ```ts
|
|
2623
|
+
* await seed(db, { vectorTable: schema.vectorTable }).refine((funcs) => ({
|
|
2624
|
+
* vectorTable: {
|
|
2625
|
+
* count,
|
|
2626
|
+
* columns: {
|
|
2627
|
+
* vector: funcs.vector({
|
|
2628
|
+
* decimalPlaces: 5,
|
|
2629
|
+
* dimensions: 12,
|
|
2630
|
+
* minValue: -100,
|
|
2631
|
+
* maxValue: 100,
|
|
2632
|
+
* isUnique: true
|
|
2633
|
+
* }),
|
|
2634
|
+
* },
|
|
2635
|
+
* },
|
|
2636
|
+
* }));
|
|
2637
|
+
* ```
|
|
2638
|
+
*/
|
|
2639
|
+
vector: (...args: [] | [{
|
|
2640
|
+
dimensions?: number;
|
|
2641
|
+
minValue?: number;
|
|
2642
|
+
maxValue?: number;
|
|
2643
|
+
decimalPlaces?: number;
|
|
2644
|
+
isUnique?: boolean;
|
|
2645
|
+
arraySize?: number;
|
|
2646
|
+
}]) => GenerateVector;
|
|
1521
2647
|
};
|
|
1522
2648
|
export declare const generatorsMap: {
|
|
2649
|
+
readonly GenerateHashFromString: readonly [typeof GenerateHashFromString, typeof GenerateHashFromStringV3];
|
|
1523
2650
|
readonly HollowGenerator: readonly [typeof HollowGenerator];
|
|
1524
2651
|
readonly GenerateDefault: readonly [typeof GenerateDefault];
|
|
1525
2652
|
readonly GenerateValuesFromArray: readonly [typeof GenerateValuesFromArray];
|
|
@@ -1570,4 +2697,13 @@ export declare const generatorsMap: {
|
|
|
1570
2697
|
readonly WeightedRandomGenerator: readonly [typeof WeightedRandomGenerator];
|
|
1571
2698
|
readonly GenerateArray: readonly [typeof GenerateArray];
|
|
1572
2699
|
readonly GenerateWeightedCount: readonly [typeof GenerateWeightedCount];
|
|
2700
|
+
readonly GenerateBitString: readonly [typeof GenerateBitString];
|
|
2701
|
+
readonly GenerateUniqueBitString: readonly [typeof GenerateUniqueBitString];
|
|
2702
|
+
readonly GenerateInet: readonly [typeof GenerateInet];
|
|
2703
|
+
readonly GenerateUniqueInet: readonly [typeof GenerateUniqueInet];
|
|
2704
|
+
readonly GenerateGeometry: readonly [typeof GenerateGeometry];
|
|
2705
|
+
readonly GenerateUniqueGeometry: readonly [typeof GenerateUniqueGeometry];
|
|
2706
|
+
readonly GenerateVector: readonly [typeof GenerateVector];
|
|
2707
|
+
readonly GenerateUniqueVector: readonly [typeof GenerateUniqueVector];
|
|
2708
|
+
readonly GenerateCompositeUniqueKey: readonly [typeof GenerateCompositeUniqueKey];
|
|
1573
2709
|
};
|