alepha 0.23.0 → 0.24.0
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/assets/swagger-ui/swagger-ui-bundle.js +1 -1
- package/assets/swagger-ui/swagger-ui-standalone-preset.js +1 -1
- package/dist/api/audits/index.browser.js +49 -52
- package/dist/api/audits/index.browser.js.map +1 -1
- package/dist/api/audits/index.d.ts +629 -565
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/audits/index.js +206 -98
- package/dist/api/audits/index.js.map +1 -1
- package/dist/api/files/index.browser.js +44 -44
- package/dist/api/files/index.browser.js.map +1 -1
- package/dist/api/files/index.d.ts +292 -293
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/files/index.js +61 -64
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.browser.js +61 -59
- package/dist/api/jobs/index.browser.js.map +1 -1
- package/dist/api/jobs/index.d.ts +546 -347
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/jobs/index.js +165 -86
- package/dist/api/jobs/index.js.map +1 -1
- package/dist/api/keys/index.d.ts +247 -235
- package/dist/api/keys/index.d.ts.map +1 -1
- package/dist/api/keys/index.js +63 -66
- package/dist/api/keys/index.js.map +1 -1
- package/dist/api/notifications/index.browser.js +40 -38
- package/dist/api/notifications/index.browser.js.map +1 -1
- package/dist/api/notifications/index.d.ts +339 -209
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/notifications/index.js +108 -60
- package/dist/api/notifications/index.js.map +1 -1
- package/dist/api/oauth/index.d.ts +190 -78
- package/dist/api/oauth/index.d.ts.map +1 -1
- package/dist/api/oauth/index.js +290 -68
- package/dist/api/oauth/index.js.map +1 -1
- package/dist/api/organizations/index.browser.js +14 -14
- package/dist/api/organizations/index.browser.js.map +1 -1
- package/dist/api/organizations/index.d.ts +158 -134
- package/dist/api/organizations/index.d.ts.map +1 -1
- package/dist/api/organizations/index.js +18 -18
- package/dist/api/organizations/index.js.map +1 -1
- package/dist/api/parameters/index.browser.js +74 -53
- package/dist/api/parameters/index.browser.js.map +1 -1
- package/dist/api/parameters/index.d.ts +607 -513
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/parameters/index.js +205 -127
- package/dist/api/parameters/index.js.map +1 -1
- package/dist/api/payments/index.d.ts +652 -449
- package/dist/api/payments/index.d.ts.map +1 -1
- package/dist/api/payments/index.js +159 -93
- package/dist/api/payments/index.js.map +1 -1
- package/dist/api/subscriptions/index.d.ts +1032 -762
- package/dist/api/subscriptions/index.d.ts.map +1 -1
- package/dist/api/subscriptions/index.js +166 -185
- package/dist/api/subscriptions/index.js.map +1 -1
- package/dist/api/users/index.browser.js +48 -71
- package/dist/api/users/index.browser.js.map +1 -1
- package/dist/api/users/index.d.ts +1297 -1143
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +456 -392
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.browser.js +17 -17
- package/dist/api/verifications/index.browser.js.map +1 -1
- package/dist/api/verifications/index.d.ts +167 -155
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/api/verifications/index.js +47 -95
- package/dist/api/verifications/index.js.map +1 -1
- package/dist/background/index.d.ts +0 -1
- package/dist/background/index.d.ts.map +1 -1
- package/dist/background/index.js.map +1 -1
- package/dist/background/index.workerd.js.map +1 -1
- package/dist/batch/index.d.ts +0 -1
- package/dist/batch/index.d.ts.map +1 -1
- package/dist/batch/index.js.map +1 -1
- package/dist/bin/index.js +1 -1
- package/dist/bin/index.js.map +1 -1
- package/dist/bucket/index.d.ts +27 -32
- package/dist/bucket/index.d.ts.map +1 -1
- package/dist/bucket/index.js +56 -26
- package/dist/bucket/index.js.map +1 -1
- package/dist/bucket/index.workerd.js +52 -24
- package/dist/bucket/index.workerd.js.map +1 -1
- package/dist/cache/core/index.d.ts +4 -6
- package/dist/cache/core/index.d.ts.map +1 -1
- package/dist/cache/core/index.js +4 -10
- package/dist/cache/core/index.js.map +1 -1
- package/dist/cache/core/index.workerd.js +4 -10
- package/dist/cache/core/index.workerd.js.map +1 -1
- package/dist/cache/database/index.d.ts +22 -23
- package/dist/cache/database/index.d.ts.map +1 -1
- package/dist/cache/database/index.js +11 -20
- package/dist/cache/database/index.js.map +1 -1
- package/dist/cache/redis/index.d.ts +3 -4
- package/dist/cache/redis/index.d.ts.map +1 -1
- package/dist/cache/redis/index.js +2 -2
- package/dist/cache/redis/index.js.map +1 -1
- package/dist/captcha/index.d.ts.map +1 -1
- package/dist/captcha/index.js +4 -4
- package/dist/captcha/index.js.map +1 -1
- package/dist/cli/config/index.d.ts +0 -1
- package/dist/cli/config/index.d.ts.map +1 -1
- package/dist/cli/core/index.d.ts +205 -442
- package/dist/cli/core/index.d.ts.map +1 -1
- package/dist/cli/core/index.js +259 -284
- package/dist/cli/core/index.js.map +1 -1
- package/dist/cli/devtools/index.d.ts +3 -9
- package/dist/cli/devtools/index.d.ts.map +1 -1
- package/dist/cli/devtools/index.js +3 -3
- package/dist/cli/devtools/index.js.map +1 -1
- package/dist/cli/i18n/index.d.ts +8 -34
- package/dist/cli/i18n/index.d.ts.map +1 -1
- package/dist/cli/i18n/index.js +6 -6
- package/dist/cli/i18n/index.js.map +1 -1
- package/dist/cli/platform/index.d.ts +89 -82
- package/dist/cli/platform/index.d.ts.map +1 -1
- package/dist/cli/platform/index.js +27 -33
- package/dist/cli/platform/index.js.map +1 -1
- package/dist/cli/platform-lib/index.d.ts +351 -404
- package/dist/cli/platform-lib/index.d.ts.map +1 -1
- package/dist/cli/platform-lib/index.js +218 -239
- package/dist/cli/platform-lib/index.js.map +1 -1
- package/dist/cli/vendor/index.d.ts +17 -41
- package/dist/cli/vendor/index.d.ts.map +1 -1
- package/dist/cli/vendor/index.js +10 -13
- package/dist/cli/vendor/index.js.map +1 -1
- package/dist/command/index.d.ts +83 -195
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +160 -563
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +845 -859
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +787 -527
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +845 -859
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +845 -859
- package/dist/core/index.native.js.map +1 -1
- package/dist/core/index.workerd.js +845 -859
- package/dist/core/index.workerd.js.map +1 -1
- package/dist/crypto/index.browser.js +1 -1
- package/dist/crypto/index.browser.js.map +1 -1
- package/dist/crypto/index.d.ts +3 -4
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/crypto/index.js +6 -3
- package/dist/crypto/index.js.map +1 -1
- package/dist/datetime/index.d.ts +12 -2
- package/dist/datetime/index.d.ts.map +1 -1
- package/dist/datetime/index.js +6 -1
- package/dist/datetime/index.js.map +1 -1
- package/dist/email/brevo/index.d.ts +0 -1
- package/dist/email/brevo/index.d.ts.map +1 -1
- package/dist/email/brevo/index.js +4 -4
- package/dist/email/brevo/index.js.map +1 -1
- package/dist/email/cloudflare/index.d.ts +0 -1
- package/dist/email/cloudflare/index.d.ts.map +1 -1
- package/dist/email/cloudflare/index.js +2 -2
- package/dist/email/cloudflare/index.js.map +1 -1
- package/dist/email/core/index.d.ts +15 -7
- package/dist/email/core/index.d.ts.map +1 -1
- package/dist/email/core/index.js +14 -5
- package/dist/email/core/index.js.map +1 -1
- package/dist/email/core/index.workerd.js +5 -1
- package/dist/email/core/index.workerd.js.map +1 -1
- package/dist/email/smtp/index.d.ts +8 -9
- package/dist/email/smtp/index.d.ts.map +1 -1
- package/dist/email/smtp/index.js +702 -479
- package/dist/email/smtp/index.js.map +1 -1
- package/dist/fake/index.d.ts +1580 -1238
- package/dist/fake/index.d.ts.map +1 -1
- package/dist/fake/index.js +11728 -32131
- package/dist/fake/index.js.map +1 -1
- package/dist/lock/core/index.d.ts +13 -9
- package/dist/lock/core/index.d.ts.map +1 -1
- package/dist/lock/core/index.js +5 -5
- package/dist/lock/core/index.js.map +1 -1
- package/dist/lock/redis/index.d.ts +0 -1
- package/dist/lock/redis/index.d.ts.map +1 -1
- package/dist/lock/redis/index.js.map +1 -1
- package/dist/logger/index.d.ts +81 -69
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +123 -56
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.d.ts +27 -90
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +42 -70
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/core/index.browser.js +54 -40
- package/dist/orm/core/index.browser.js.map +1 -1
- package/dist/orm/core/index.bun.js +140 -106
- package/dist/orm/core/index.bun.js.map +1 -1
- package/dist/orm/core/index.d.ts +145 -150
- package/dist/orm/core/index.d.ts.map +1 -1
- package/dist/orm/core/index.js +144 -109
- package/dist/orm/core/index.js.map +1 -1
- package/dist/orm/postgres/index.bun.js +64 -54
- package/dist/orm/postgres/index.bun.js.map +1 -1
- package/dist/orm/postgres/index.d.ts +36 -76
- package/dist/orm/postgres/index.d.ts.map +1 -1
- package/dist/orm/postgres/index.js +67 -57
- package/dist/orm/postgres/index.js.map +1 -1
- package/dist/queue/core/index.d.ts +62 -75
- package/dist/queue/core/index.d.ts.map +1 -1
- package/dist/queue/core/index.js +48 -71
- package/dist/queue/core/index.js.map +1 -1
- package/dist/queue/core/index.workerd.js +48 -71
- package/dist/queue/core/index.workerd.js.map +1 -1
- package/dist/queue/redis/index.d.ts +3 -4
- package/dist/queue/redis/index.d.ts.map +1 -1
- package/dist/queue/redis/index.js +2 -2
- package/dist/queue/redis/index.js.map +1 -1
- package/dist/react/auth/index.browser.js.map +1 -1
- package/dist/react/auth/index.d.ts +7 -4
- package/dist/react/auth/index.d.ts.map +1 -1
- package/dist/react/auth/index.js.map +1 -1
- package/dist/react/core/index.d.ts +87 -5
- package/dist/react/core/index.d.ts.map +1 -1
- package/dist/react/core/index.js +170 -23
- package/dist/react/core/index.js.map +1 -1
- package/dist/react/form/index.d.ts +4 -5
- package/dist/react/form/index.d.ts.map +1 -1
- package/dist/react/form/index.js +91 -56
- package/dist/react/form/index.js.map +1 -1
- package/dist/react/head/index.browser.js.map +1 -1
- package/dist/react/head/index.d.ts +0 -1
- package/dist/react/head/index.d.ts.map +1 -1
- package/dist/react/head/index.js.map +1 -1
- package/dist/react/i18n/index.d.ts +4 -5
- package/dist/react/i18n/index.d.ts.map +1 -1
- package/dist/react/i18n/index.js +2 -2
- package/dist/react/i18n/index.js.map +1 -1
- package/dist/react/intro/index.d.ts +1 -4
- package/dist/react/intro/index.d.ts.map +1 -1
- package/dist/react/intro/index.js.map +1 -1
- package/dist/react/router/index.browser.js +60 -24
- package/dist/react/router/index.browser.js.map +1 -1
- package/dist/react/router/index.d.ts +378 -377
- package/dist/react/router/index.d.ts.map +1 -1
- package/dist/react/router/index.js +77 -41
- package/dist/react/router/index.js.map +1 -1
- package/dist/react/sitemap/index.d.ts +0 -1
- package/dist/react/sitemap/index.d.ts.map +1 -1
- package/dist/react/sitemap/index.js.map +1 -1
- package/dist/react/testing/index.d.ts +4 -5
- package/dist/react/testing/index.d.ts.map +1 -1
- package/dist/react/testing/index.js +41 -15
- package/dist/react/testing/index.js.map +1 -1
- package/dist/react/testing/{chunk-BpyX8vjI.js → rolldown-runtime-Bl3dcgcQ.js} +1 -1
- package/dist/react/ui/index.d.ts +35 -34
- package/dist/react/ui/index.d.ts.map +1 -1
- package/dist/react/ui/index.js +12 -17
- package/dist/react/ui/index.js.map +1 -1
- package/dist/redis/index.bun.js +5 -5
- package/dist/redis/index.bun.js.map +1 -1
- package/dist/redis/index.d.ts +6 -7
- package/dist/redis/index.d.ts.map +1 -1
- package/dist/redis/index.js +6 -6
- package/dist/redis/index.js.map +1 -1
- package/dist/retry/index.d.ts +0 -1
- package/dist/retry/index.d.ts.map +1 -1
- package/dist/retry/index.js.map +1 -1
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js.map +1 -1
- package/dist/scheduler/index.d.ts +4 -12
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +9 -4
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/index.workerd.js +9 -4
- package/dist/scheduler/index.workerd.js.map +1 -1
- package/dist/security/index.browser.js +30 -28
- package/dist/security/index.browser.js.map +1 -1
- package/dist/security/index.d.ts +113 -44
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +452 -37
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.browser.js +19 -19
- package/dist/server/auth/index.browser.js.map +1 -1
- package/dist/server/auth/index.d.ts +198 -274
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +83 -621
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cookies/index.browser.js +103 -5
- package/dist/server/cookies/index.browser.js.map +1 -1
- package/dist/server/cookies/index.d.ts +72 -5
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/cookies/index.js +103 -9
- package/dist/server/cookies/index.js.map +1 -1
- package/dist/server/core/index.browser.js +22 -27
- package/dist/server/core/index.browser.js.map +1 -1
- package/dist/server/core/index.d.ts +116 -85
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +105 -118
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/cors/index.d.ts +9 -10
- package/dist/server/cors/index.d.ts.map +1 -1
- package/dist/server/cors/index.js +14 -26
- package/dist/server/cors/index.js.map +1 -1
- package/dist/server/etag/index.d.ts +2 -3
- package/dist/server/etag/index.d.ts.map +1 -1
- package/dist/server/etag/index.js.map +1 -1
- package/dist/server/health/index.d.ts +18 -19
- package/dist/server/health/index.d.ts.map +1 -1
- package/dist/server/health/index.js +6 -6
- package/dist/server/health/index.js.map +1 -1
- package/dist/server/links/index.browser.js +15 -18
- package/dist/server/links/index.browser.js.map +1 -1
- package/dist/server/links/index.d.ts +66 -67
- package/dist/server/links/index.d.ts.map +1 -1
- package/dist/server/links/index.js +29 -32
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/metrics/index.d.ts +0 -1
- package/dist/server/metrics/index.d.ts.map +1 -1
- package/dist/server/metrics/index.js +10 -3
- package/dist/server/metrics/index.js.map +1 -1
- package/dist/server/proxy/index.d.ts +0 -1
- package/dist/server/proxy/index.d.ts.map +1 -1
- package/dist/server/proxy/index.js.map +1 -1
- package/dist/server/rate-limit/index.d.ts +8 -9
- package/dist/server/rate-limit/index.d.ts.map +1 -1
- package/dist/server/rate-limit/index.js +6 -12
- package/dist/server/rate-limit/index.js.map +1 -1
- package/dist/server/static/index.d.ts +0 -1
- package/dist/server/static/index.d.ts.map +1 -1
- package/dist/server/static/index.js.map +1 -1
- package/dist/server/swagger/index.d.ts +4 -4
- package/dist/server/swagger/index.d.ts.map +1 -1
- package/dist/server/swagger/index.js +37 -25
- package/dist/server/swagger/index.js.map +1 -1
- package/dist/sms/index.d.ts +0 -1
- package/dist/sms/index.d.ts.map +1 -1
- package/dist/sms/index.js.map +1 -1
- package/dist/system/index.browser.js.map +1 -1
- package/dist/system/index.d.ts +0 -1
- package/dist/system/index.d.ts.map +1 -1
- package/dist/system/index.js +2 -1
- package/dist/system/index.js.map +1 -1
- package/dist/system/index.workerd.js.map +1 -1
- package/dist/topic/core/index.d.ts +19 -20
- package/dist/topic/core/index.d.ts.map +1 -1
- package/dist/topic/core/index.js +8 -8
- package/dist/topic/core/index.js.map +1 -1
- package/dist/topic/redis/index.d.ts +3 -4
- package/dist/topic/redis/index.d.ts.map +1 -1
- package/dist/topic/redis/index.js +2 -2
- package/dist/topic/redis/index.js.map +1 -1
- package/package.json +22 -35
- package/src/api/audits/__tests__/AuditJobs.spec.ts +83 -0
- package/src/api/audits/__tests__/AuditService.spec.ts +139 -1
- package/src/api/audits/controllers/AdminAuditController.ts +41 -41
- package/src/api/audits/entities/audits.ts +22 -22
- package/src/api/audits/index.ts +6 -1
- package/src/api/audits/jobs/AuditJobs.ts +29 -0
- package/src/api/audits/parameters/AuditParameters.ts +51 -0
- package/src/api/audits/primitives/$audit.ts +24 -0
- package/src/api/audits/schemas/auditQuerySchema.ts +13 -13
- package/src/api/audits/schemas/createAuditSchema.ts +18 -18
- package/src/api/audits/services/AuditService.ts +79 -7
- package/src/api/files/__tests__/FileController.spec.ts +5 -5
- package/src/api/files/__tests__/FileJobs.spec.ts +6 -0
- package/src/api/files/controllers/FileController.ts +25 -25
- package/src/api/files/entities/files.ts +15 -15
- package/src/api/files/schemas/fileCreatorSummarySchema.ts +7 -7
- package/src/api/files/schemas/fileQuerySchema.ts +9 -9
- package/src/api/files/schemas/fileResourceSchema.ts +7 -9
- package/src/api/files/schemas/storageStatsSchema.ts +13 -13
- package/src/api/jobs/__tests__/$job-hardening.spec.ts +289 -0
- package/src/api/jobs/__tests__/$job.spec.ts +18 -18
- package/src/api/jobs/controllers/AdminJobController.ts +8 -8
- package/src/api/jobs/entities/jobExecutionEntity.ts +29 -19
- package/src/api/jobs/providers/JobProvider.ts +128 -12
- package/src/api/jobs/providers/JobQueueProvider.ts +2 -2
- package/src/api/jobs/schemas/jobConfigAtom.ts +22 -22
- package/src/api/jobs/schemas/jobExecutionQuerySchema.ts +6 -6
- package/src/api/jobs/schemas/jobExecutionResourceSchema.ts +11 -15
- package/src/api/jobs/schemas/jobRegistrationSchema.ts +20 -19
- package/src/api/jobs/schemas/triggerJobSchema.ts +3 -3
- package/src/api/jobs/services/JobService.ts +6 -6
- package/src/api/keys/__tests__/ApiKeyService.spec.ts +2 -2
- package/src/api/keys/controllers/AdminApiKeyController.ts +10 -10
- package/src/api/keys/entities/apiKeyEntity.ts +15 -15
- package/src/api/keys/schemas/adminApiKeyQuerySchema.ts +4 -4
- package/src/api/keys/schemas/adminApiKeyResourceSchema.ts +15 -15
- package/src/api/keys/schemas/createApiKeyBodySchema.ts +5 -5
- package/src/api/keys/schemas/createApiKeyResponseSchema.ts +9 -9
- package/src/api/keys/schemas/listApiKeyResponseSchema.ts +13 -13
- package/src/api/keys/schemas/revokeApiKeyParamsSchema.ts +3 -3
- package/src/api/keys/schemas/revokeApiKeyResponseSchema.ts +3 -3
- package/src/api/notifications/__tests__/AlephaApiNotifications.spec.ts +2 -2
- package/src/api/notifications/controllers/AdminNotificationController.ts +38 -14
- package/src/api/notifications/jobs/NotificationJobs.ts +7 -6
- package/src/api/notifications/primitives/$notification.ts +43 -4
- package/src/api/notifications/schemas/notificationContactPreferencesSchema.ts +4 -4
- package/src/api/notifications/schemas/notificationContactSchema.ts +7 -7
- package/src/api/notifications/schemas/notificationDetailResourceSchema.ts +9 -11
- package/src/api/notifications/schemas/notificationPayloadSchema.ts +11 -9
- package/src/api/notifications/schemas/notificationQuerySchema.ts +6 -6
- package/src/api/notifications/schemas/notificationResourceSchema.ts +14 -14
- package/src/api/notifications/services/NotificationSenderService.ts +38 -2
- package/src/api/oauth/__tests__/OAuthClientService.spec.ts +42 -0
- package/src/api/oauth/__tests__/OAuthController.spec.ts +128 -0
- package/src/api/oauth/controllers/OAuthController.ts +132 -12
- package/src/api/oauth/entities/oauthClientEntity.ts +29 -12
- package/src/api/oauth/helpers/oauthMetadata.ts +1 -0
- package/src/api/oauth/helpers/oidcMetadata.ts +19 -0
- package/src/api/oauth/index.ts +1 -0
- package/src/api/oauth/schemas/authorizeDecisionBodySchema.ts +12 -11
- package/src/api/oauth/schemas/authorizeQuerySchema.ts +12 -10
- package/src/api/oauth/schemas/registerClientBodySchema.ts +10 -11
- package/src/api/oauth/schemas/tokenRequestBodySchema.ts +9 -8
- package/src/api/oauth/services/OAuthClientService.ts +228 -15
- package/src/api/organizations/controllers/AdminOrganizationController.ts +8 -8
- package/src/api/organizations/entities/organizations.ts +6 -6
- package/src/api/organizations/schemas/createOrganizationSchema.ts +5 -5
- package/src/api/organizations/schemas/organizationQuerySchema.ts +4 -4
- package/src/api/organizations/schemas/updateOrganizationSchema.ts +1 -2
- package/src/api/parameters/__tests__/$parameter.spec.ts +229 -50
- package/src/api/parameters/controllers/AdminParameterController.ts +9 -12
- package/src/api/parameters/entities/parameters.ts +29 -16
- package/src/api/parameters/primitives/$parameter.ts +3 -3
- package/src/api/parameters/schemas/activateParameterBodySchema.ts +4 -4
- package/src/api/parameters/schemas/createParameterVersionBodySchema.ts +15 -15
- package/src/api/parameters/schemas/parameterCreatorSummarySchema.ts +7 -7
- package/src/api/parameters/schemas/parameterCurrentResponseSchema.ts +7 -7
- package/src/api/parameters/schemas/parameterHistoryResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/parameterNameParamSchema.ts +2 -3
- package/src/api/parameters/schemas/parameterNamesResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/parameterResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/parameterStatusSchema.ts +2 -2
- package/src/api/parameters/schemas/parameterTreeNodeSchema.ts +6 -6
- package/src/api/parameters/schemas/parameterVersionParamSchema.ts +5 -6
- package/src/api/parameters/schemas/parameterVersionResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/rollbackParameterBodySchema.ts +6 -9
- package/src/api/parameters/services/ParameterProvider.ts +152 -65
- package/src/api/payments/controllers/AdminPaymentController.ts +7 -7
- package/src/api/payments/controllers/MockCheckoutController.ts +79 -28
- package/src/api/payments/controllers/PaymentController.ts +4 -4
- package/src/api/payments/entities/paymentIntents.ts +11 -11
- package/src/api/payments/entities/paymentMethods.ts +11 -11
- package/src/api/payments/entities/refunds.ts +9 -9
- package/src/api/payments/providers/PaymentProvider.ts +18 -0
- package/src/api/payments/schemas/intentSchemas.ts +25 -25
- package/src/api/payments/schemas/paymentMethodSchemas.ts +3 -3
- package/src/api/payments/services/PaymentService.ts +60 -3
- package/src/api/subscriptions/__tests__/SubscriptionService.spec.ts +14 -0
- package/src/api/subscriptions/controllers/AdminSubscriptionController.ts +11 -11
- package/src/api/subscriptions/controllers/SubscriptionController.ts +5 -4
- package/src/api/subscriptions/entities/subscriptionEvents.ts +15 -15
- package/src/api/subscriptions/entities/subscriptions.ts +22 -22
- package/src/api/subscriptions/notifications/SubscriptionNotifications.ts +22 -22
- package/src/api/subscriptions/schemas/cancelSubscriptionSchema.ts +4 -4
- package/src/api/subscriptions/schemas/changePlanSchema.ts +5 -5
- package/src/api/subscriptions/schemas/createSubscriptionSchema.ts +14 -7
- package/src/api/subscriptions/schemas/entitlementsSchema.ts +10 -10
- package/src/api/subscriptions/schemas/mrrSchema.ts +9 -9
- package/src/api/subscriptions/schemas/planDefinitionSchema.ts +21 -21
- package/src/api/subscriptions/schemas/planResourceSchema.ts +19 -19
- package/src/api/subscriptions/schemas/subscriptionQuerySchema.ts +8 -8
- package/src/api/subscriptions/schemas/subscriptionSettingsSchema.ts +7 -7
- package/src/api/subscriptions/schemas/subscriptionStatsSchema.ts +17 -17
- package/src/api/subscriptions/services/SubscriptionConfig.ts +2 -2
- package/src/api/users/__tests__/ApiKeys-integration.spec.ts +11 -11
- package/src/api/users/atoms/realmAuthSettingsAtom.ts +111 -119
- package/src/api/users/controllers/AdminIdentityController.ts +29 -19
- package/src/api/users/controllers/AdminSessionController.ts +37 -27
- package/src/api/users/controllers/AdminUserController.ts +75 -53
- package/src/api/users/controllers/MySessionController.ts +125 -0
- package/src/api/users/controllers/RealmController.ts +9 -10
- package/src/api/users/controllers/UserController.ts +55 -55
- package/src/api/users/entities/identities.ts +8 -8
- package/src/api/users/entities/sessions.ts +17 -17
- package/src/api/users/entities/users.ts +17 -17
- package/src/api/users/index.ts +3 -0
- package/src/api/users/notifications/UserNotifications.ts +76 -24
- package/src/api/users/primitives/$realm.ts +12 -26
- package/src/api/users/providers/RealmProvider.ts +0 -15
- package/src/api/users/schemas/completePasswordResetRequestSchema.ts +8 -12
- package/src/api/users/schemas/completeRegistrationRequestSchema.ts +17 -20
- package/src/api/users/schemas/createUserSchema.ts +2 -2
- package/src/api/users/schemas/identityQuerySchema.ts +4 -4
- package/src/api/users/schemas/identityResourceSchema.ts +3 -2
- package/src/api/users/schemas/loginSchema.ts +4 -4
- package/src/api/users/schemas/passwordResetIntentResponseSchema.ts +6 -8
- package/src/api/users/schemas/realmConfigSchema.ts +10 -24
- package/src/api/users/schemas/registerQuerySchema.ts +6 -6
- package/src/api/users/schemas/registerRequestSchema.ts +21 -43
- package/src/api/users/schemas/registerResponseSchema.ts +2 -2
- package/src/api/users/schemas/registerSchema.ts +13 -31
- package/src/api/users/schemas/registrationIntentResponseSchema.ts +19 -23
- package/src/api/users/schemas/resetPasswordSchema.ts +10 -17
- package/src/api/users/schemas/sessionQuerySchema.ts +3 -3
- package/src/api/users/schemas/sessionResourceSchema.ts +25 -25
- package/src/api/users/schemas/updateUserSchema.ts +3 -4
- package/src/api/users/schemas/userQuerySchema.ts +7 -7
- package/src/api/users/services/RegistrationService.ts +25 -11
- package/src/api/users/services/UserService.ts +12 -6
- package/src/api/verifications/__tests__/CodeVerification.spec.ts +63 -101
- package/src/api/verifications/__tests__/LinkVerification.spec.ts +23 -92
- package/src/api/verifications/controllers/VerificationController.ts +13 -27
- package/src/api/verifications/entities/verifications.ts +13 -14
- package/src/api/verifications/schemas/requestVerificationCodeResponseSchema.ts +17 -14
- package/src/api/verifications/schemas/validateVerificationCodeResponseSchema.ts +9 -10
- package/src/api/verifications/schemas/verificationSettingsSchema.ts +65 -66
- package/src/api/verifications/schemas/verificationTypeEnumSchema.ts +2 -2
- package/src/api/verifications/services/VerificationService.ts +12 -0
- package/src/background/__tests__/BackgroundTaskProvider.spec.ts +36 -0
- package/src/batch/__tests__/$batch.spec.ts +22 -22
- package/src/batch/__tests__/startup-buffering.spec.ts +9 -9
- package/src/bin/index.ts +1 -1
- package/src/bucket/__tests__/TenantScopedBucket.spec.ts +60 -0
- package/src/bucket/providers/LocalFileStorageProvider.ts +14 -6
- package/src/bucket/providers/MemoryFileStorageProvider.ts +18 -7
- package/src/bucket/providers/R2FileStorageProvider.ts +14 -6
- package/src/bucket/providers/S3FileStorageProvider.ts +31 -15
- package/src/cache/core/primitives/$cache.ts +7 -10
- package/src/cache/database/entities/cacheEntries.ts +16 -27
- package/src/cache/database/providers/DatabaseCacheProvider.ts +15 -13
- package/src/cache/redis/providers/RedisCacheProvider.ts +6 -6
- package/src/captcha/providers/TurnstileCaptchaProvider.ts +4 -4
- package/src/cli/core/__tests__/BuildCloudflareTask.spec.ts +178 -0
- package/src/cli/core/__tests__/BuildDockerTask.spec.ts +0 -2
- package/src/cli/core/__tests__/DbCommand.spec.ts +108 -0
- package/src/cli/core/atoms/appEntryOptions.ts +5 -5
- package/src/cli/core/atoms/buildOptions.ts +76 -76
- package/src/cli/core/atoms/changelogOptions.ts +3 -3
- package/src/cli/core/atoms/devOptions.ts +3 -3
- package/src/cli/core/commands/build.ts +36 -39
- package/src/cli/core/commands/db.ts +171 -83
- package/src/cli/core/commands/dev.ts +8 -8
- package/src/cli/core/commands/gen/changelog.ts +12 -14
- package/src/cli/core/commands/gen/env.ts +6 -6
- package/src/cli/core/commands/gen/openapi.ts +6 -6
- package/src/cli/core/commands/init.ts +28 -33
- package/src/cli/core/commands/pack.ts +10 -10
- package/src/cli/core/commands/root.ts +7 -8
- package/src/cli/core/commands/test.ts +17 -20
- package/src/cli/core/tasks/BuildCloudflareTask.ts +103 -230
- package/src/cli/core/templates/apiHelloResponseSchemaTs.ts +4 -4
- package/src/cli/devtools/atoms/devtoolsOptions.ts +6 -6
- package/src/cli/i18n/atoms/i18nOptions.ts +8 -8
- package/src/cli/platform/commands/SecretsCommand.ts +24 -25
- package/src/cli/platform/commands/platform.ts +40 -46
- package/src/cli/platform/index.ts +1 -1
- package/src/cli/platform-lib/__tests__/CloudflareAdapter.spec.ts +0 -4
- package/src/cli/platform-lib/__tests__/PlatformInspector.spec.ts +10 -3
- package/src/cli/platform-lib/__tests__/VercelAdapter.spec.ts +0 -2
- package/src/cli/platform-lib/adapters/CloudflareAdapter.ts +13 -14
- package/src/cli/platform-lib/adapters/VercelAdapter.ts +6 -11
- package/src/cli/platform-lib/atoms/platformOptions.ts +46 -25
- package/src/cli/platform-lib/schemas/cloudflare.ts +87 -87
- package/src/cli/platform-lib/schemas/platform.ts +51 -51
- package/src/cli/platform-lib/schemas/vercel.ts +28 -28
- package/src/cli/platform-lib/services/CloudflareApi.ts +5 -5
- package/src/cli/platform-lib/services/VercelApi.ts +4 -4
- package/src/cli/platform-lib/services/VercelCli.ts +6 -15
- package/src/cli/platform-lib/services/WranglerApi.ts +6 -15
- package/src/cli/vendor/atoms/vendorOptions.ts +9 -9
- package/src/cli/vendor/commands/VendorCommand.ts +11 -12
- package/src/command/__tests__/$command.spec.ts +82 -83
- package/src/command/__tests__/Asker.spec.ts +6 -13
- package/src/command/__tests__/CliProvider.spec.ts +136 -149
- package/src/command/__tests__/Runner.spec.ts +86 -110
- package/src/command/helpers/Asker.ts +23 -58
- package/src/command/helpers/Runner.ts +34 -110
- package/src/command/index.ts +4 -9
- package/src/command/primitives/$command.ts +10 -10
- package/src/command/providers/CliProvider.ts +183 -161
- package/src/core/Alepha.ts +62 -13
- package/src/core/__tests__/$atom.spec.ts +52 -3
- package/src/core/__tests__/$computed.spec.ts +129 -0
- package/src/core/__tests__/$env.spec.ts +13 -13
- package/src/core/__tests__/$inject.spec.ts +4 -4
- package/src/core/__tests__/$module.spec.ts +1 -1
- package/src/core/__tests__/Alepha-graph.spec.ts +1 -1
- package/src/core/__tests__/Alepha-parseEnv.spec.ts +32 -32
- package/src/core/__tests__/Alepha-start.spec.ts +3 -3
- package/src/core/__tests__/CodecManager.spec.ts +113 -94
- package/src/core/__tests__/KeylessJsonSchemaCodec.spec.ts +138 -138
- package/src/core/__tests__/SchemaValidator.spec.ts +43 -44
- package/src/core/__tests__/StateManager.persist.browser.spec.ts +87 -0
- package/src/core/__tests__/StateManager.spec.ts +423 -0
- package/src/core/__tests__/TypeBox-usecases.spec.ts +8 -8
- package/src/core/__tests__/TypeProvider.spec.ts +314 -309
- package/src/core/__tests__/dump.spec.ts +6 -6
- package/src/core/__tests__/pagination.spec.ts +4 -4
- package/src/core/__tests__/scoped-after-start.spec.ts +43 -0
- package/src/core/errors/TypeBoxError.ts +10 -4
- package/src/core/helpers/FileLike.ts +5 -5
- package/src/core/helpers/coerceStrings.ts +70 -0
- package/src/core/helpers/jsonSchemaToZod.ts +112 -0
- package/src/core/index.shared.ts +4 -1
- package/src/core/primitives/$atom.ts +95 -27
- package/src/core/primitives/$computed.ts +148 -0
- package/src/core/primitives/$env.ts +5 -5
- package/src/core/primitives/$state.ts +1 -1
- package/src/core/providers/AlsProvider.ts +26 -0
- package/src/core/providers/CodecManager.ts +1 -2
- package/src/core/providers/JsonSchemaCodec.ts +1 -2
- package/src/core/providers/KeylessJsonSchemaCodec.ts +82 -57
- package/src/core/providers/SchemaValidator.ts +48 -158
- package/src/core/providers/StateManager.ts +383 -9
- package/src/core/providers/TypeProvider.ts +80 -734
- package/src/core/providers/ZodProvider.ts +380 -0
- package/src/core/providers/zodAugment.ts +69 -0
- package/src/core/schemas/pageQuerySchema.ts +19 -21
- package/src/core/schemas/pageSchema.ts +47 -57
- package/src/crypto/__tests__/SecretProvider.spec.ts +31 -0
- package/src/crypto/providers/SecretProvider.ts +16 -10
- package/src/datetime/primitives/$throttle.ts +6 -1
- package/src/email/brevo/providers/BrevoEmailProvider.ts +4 -4
- package/src/email/cloudflare/providers/CloudflareEmailProvider.ts +6 -6
- package/src/email/core/index.ts +7 -2
- package/src/email/core/primitives/$email.ts +5 -1
- package/src/email/core/providers/LocalEmailProvider.ts +5 -5
- package/src/email/smtp/providers/NodemailerEmailProvider.ts +41 -52
- package/src/fake/__tests__/FakeProvider.spec.ts +110 -110
- package/src/fake/__tests__/keyName.example.ts +21 -21
- package/src/fake/__tests__/keyName.spec.ts +41 -41
- package/src/fake/__tests__/module.example.ts +8 -8
- package/src/fake/providers/FakeProvider.ts +122 -121
- package/src/lock/core/__tests__/lock-mutual-exclusion.spec.ts +44 -0
- package/src/lock/core/index.ts +1 -0
- package/src/lock/core/primitives/$lock.ts +13 -6
- package/src/logger/__tests__/CliFormatterProvider.spec.ts +76 -0
- package/src/logger/__tests__/Logger.spec.ts +49 -0
- package/src/logger/index.ts +25 -18
- package/src/logger/providers/CliFormatterProvider.ts +75 -0
- package/src/logger/schemas/logEntrySchema.ts +10 -10
- package/src/logger/services/Logger.ts +18 -0
- package/src/mcp/__tests__/$prompt.spec.ts +21 -23
- package/src/mcp/__tests__/$tool.spec.ts +22 -22
- package/src/mcp/__tests__/McpServerProvider.spec.ts +11 -11
- package/src/mcp/__tests__/StreamableHttpMcpTransport.spec.ts +2 -2
- package/src/mcp/__tests__/integration.spec.ts +33 -33
- package/src/mcp/primitives/$prompt.ts +11 -9
- package/src/mcp/primitives/$tool.ts +27 -86
- package/src/mcp/transports/StreamableHttpMcpTransport.ts +7 -7
- package/src/orm/__tests__/$repository-tests.ts +133 -27
- package/src/orm/__tests__/$repository.spec.ts +23 -0
- package/src/orm/__tests__/$transactional-tests.ts +4 -4
- package/src/orm/__tests__/ModelBuilder-tests.ts +28 -28
- package/src/orm/__tests__/ModelBuilder.spec.ts +124 -106
- package/src/orm/__tests__/QueryManager.spec.ts +5 -5
- package/src/orm/__tests__/delete-returning-tests.ts +11 -11
- package/src/orm/__tests__/deletedAt-tests.ts +3 -3
- package/src/orm/__tests__/enums.spec.ts +29 -25
- package/src/orm/__tests__/execute-tests.ts +8 -8
- package/src/orm/__tests__/fixtures/bigEntitySchema.ts +48 -48
- package/src/orm/__tests__/fixtures/userEntitySchema.ts +6 -6
- package/src/orm/__tests__/joins-tests.ts +30 -30
- package/src/orm/__tests__/organization-tests.ts +105 -3
- package/src/orm/__tests__/organization.spec.ts +46 -0
- package/src/orm/__tests__/orm-errors.spec.ts +10 -10
- package/src/orm/__tests__/orm-next-tests.ts +29 -29
- package/src/orm/__tests__/orm-showcase-tests.ts +9 -9
- package/src/orm/__tests__/primaryKey.spec.ts +4 -4
- package/src/orm/__tests__/query-date-encoding-tests.ts +17 -17
- package/src/orm/__tests__/ref-auto-onDelete.spec.ts +14 -14
- package/src/orm/__tests__/references.spec.ts +7 -7
- package/src/orm/__tests__/security.spec.ts +17 -17
- package/src/orm/__tests__/string-operators-tests.ts +5 -5
- package/src/orm/__tests__/timestamps-tests.ts +14 -14
- package/src/orm/__tests__/validation-tests.ts +5 -5
- package/src/orm/core/__tests__/BunSqliteProvider.bun.spec.ts +8 -8
- package/src/orm/core/constants/PG_SYMBOLS.ts +13 -1
- package/src/orm/core/entities/alephaSequences.ts +8 -8
- package/src/orm/core/helpers/pgAttr.ts +4 -4
- package/src/orm/core/primitives/$entity.ts +10 -6
- package/src/orm/core/providers/DatabaseTypeProvider.ts +46 -53
- package/src/orm/core/providers/drivers/BunSqliteProvider.ts +8 -8
- package/src/orm/core/providers/drivers/CloudflareD1Provider.ts +3 -5
- package/src/orm/core/providers/drivers/NodeSqliteProvider.ts +8 -8
- package/src/orm/core/schemas/databaseEnvSchema.ts +4 -4
- package/src/orm/core/schemas/insertSchema.ts +14 -18
- package/src/orm/core/schemas/legacyIdSchema.ts +2 -2
- package/src/orm/core/schemas/updateSchema.ts +10 -16
- package/src/orm/core/services/PgRelationManager.ts +2 -2
- package/src/orm/core/services/QueryManager.ts +13 -2
- package/src/orm/core/services/Repository.ts +88 -33
- package/src/orm/core/services/SqliteModelBuilder.ts +38 -45
- package/src/orm/postgres/__tests__/BunPostgresProvider.bun.spec.ts +4 -4
- package/src/orm/postgres/providers/CloudflareHyperdriveProvider.ts +4 -6
- package/src/orm/postgres/schemas/postgresEnvSchema.ts +6 -6
- package/src/orm/postgres/services/PostgresModelBuilder.ts +127 -114
- package/src/queue/core/__tests__/$consumer.spec.ts +4 -4
- package/src/queue/core/__tests__/WorkerProvider.spec.ts +4 -4
- package/src/queue/core/__tests__/shared.ts +6 -6
- package/src/queue/core/primitives/$consumer.ts +5 -5
- package/src/queue/core/primitives/$queue.ts +44 -61
- package/src/queue/core/providers/CloudflareQueueProvider.ts +6 -0
- package/src/queue/core/providers/WorkerProvider.ts +17 -14
- package/src/queue/redis/providers/RedisQueueProvider.ts +3 -3
- package/src/react/core/__tests__/ErrorBoundary.browser.spec.tsx +92 -0
- package/src/react/core/__tests__/Router.spec.tsx +4 -4
- package/src/react/core/__tests__/useComputed.browser.spec.tsx +192 -0
- package/src/react/core/__tests__/useQuery.browser.spec.tsx +48 -0
- package/src/react/core/__tests__/useSelector.browser.spec.tsx +105 -0
- package/src/react/core/__tests__/useStore.browser.spec.tsx +113 -0
- package/src/react/core/components/ErrorBoundary.tsx +42 -0
- package/src/react/core/hooks/useAction.ts +56 -19
- package/src/react/core/hooks/useComputed.ts +91 -0
- package/src/react/core/hooks/useSelector.ts +67 -0
- package/src/react/core/hooks/useStore.ts +36 -17
- package/src/react/core/index.ts +3 -0
- package/src/react/core/utils/shallowEqual.ts +36 -0
- package/src/react/form/__tests__/FormModel-submit-loading.spec.ts +2 -2
- package/src/react/form/__tests__/form-submitting-reactive.browser.spec.tsx +5 -5
- package/src/react/form/__tests__/useForm.browser.spec.tsx +54 -54
- package/src/react/form/errors/FormValidationError.ts +0 -2
- package/src/react/form/hooks/useForm.ts +19 -4
- package/src/react/form/hooks/useFormQuerySync.ts +0 -0
- package/src/react/form/services/FormModel.ts +67 -47
- package/src/react/form/services/parseField.ts +66 -27
- package/src/react/i18n/__tests__/Localize.spec.tsx +1 -1
- package/src/react/i18n/providers/I18nProvider.ts +2 -2
- package/src/react/router/__tests__/$page.browser.spec.tsx +19 -19
- package/src/react/router/__tests__/$page.spec.tsx +21 -21
- package/src/react/router/__tests__/ReactBrowserProvider.browser.spec.ts +87 -1
- package/src/react/router/atoms/ssrManifestAtom.ts +16 -16
- package/src/react/router/components/NestedView.tsx +11 -3
- package/src/react/router/hooks/useQueryParams.ts +1 -1
- package/src/react/router/primitives/$page.ts +2 -2
- package/src/react/router/providers/ReactBrowserProvider.ts +64 -13
- package/src/react/router/providers/ReactPageProvider.ts +26 -12
- package/src/react/router/providers/ReactServerProvider.ts +13 -15
- package/src/react/sitemap/__tests__/$sitemap.spec.ts +2 -2
- package/src/react/ui/atoms/uiAtom.ts +6 -6
- package/src/react/ui/atoms/uiThemeListAtom.ts +7 -7
- package/src/react/ui/hooks/useColorMode.ts +11 -4
- package/src/react/ui/services/SchemaControl.ts +4 -4
- package/src/redis/providers/BunRedisProvider.ts +19 -11
- package/src/redis/providers/NodeRedisProvider.ts +3 -3
- package/src/scheduler/primitives/$scheduler.ts +21 -8
- package/src/security/__tests__/assertRealmScope.spec.ts +29 -0
- package/src/security/atoms/currentTenantAtom.ts +6 -6
- package/src/security/atoms/currentUserAtom.ts +2 -2
- package/src/security/primitives/$issuer.ts +24 -2
- package/src/security/providers/JwtProvider.ts +100 -0
- package/src/security/providers/SecurityProvider.ts +43 -2
- package/src/security/schemas/permissionSchema.ts +19 -19
- package/src/security/schemas/roleSchema.ts +22 -28
- package/src/security/schemas/userAccountInfoSchema.ts +47 -37
- package/src/server/auth/index.ts +0 -3
- package/src/server/auth/primitives/$auth.ts +6 -6
- package/src/server/auth/primitives/$authApple.ts +10 -10
- package/src/server/auth/primitives/$authFacebook.ts +10 -10
- package/src/server/auth/primitives/$authFranceConnect.ts +10 -10
- package/src/server/auth/primitives/$authGithub.ts +10 -10
- package/src/server/auth/primitives/$authGoogle.ts +10 -10
- package/src/server/auth/primitives/$authMicrosoft.ts +14 -14
- package/src/server/auth/providers/ServerAuthProvider.ts +49 -48
- package/src/server/auth/schemas/authenticationProviderSchema.ts +9 -12
- package/src/server/auth/schemas/tokenResponseSchema.ts +2 -2
- package/src/server/auth/schemas/tokensSchema.ts +16 -16
- package/src/server/auth/schemas/userinfoResponseSchema.ts +3 -3
- package/src/server/cookies/__tests__/AtomCookieBinding.spec.ts +80 -0
- package/src/server/cookies/__tests__/AtomCookiePersistence.browser.spec.ts +169 -0
- package/src/server/cookies/__tests__/AtomCookiePersistence.spec.ts +294 -0
- package/src/server/cookies/__tests__/ServerCookiesProvider.spec.ts +14 -14
- package/src/server/cookies/index.browser.ts +4 -1
- package/src/server/cookies/index.ts +8 -1
- package/src/server/cookies/primitives/$cookie.browser.ts +1 -1
- package/src/server/cookies/primitives/$cookie.ts +16 -0
- package/src/server/cookies/providers/AtomCookiePersistence.browser.ts +133 -0
- package/src/server/cookies/providers/AtomCookiePersistence.ts +148 -0
- package/src/server/cookies/providers/ServerCookiesProvider.ts +13 -5
- package/src/server/cookies/services/CookieParser.ts +6 -1
- package/src/server/core/__tests__/$action.spec.ts +13 -13
- package/src/server/core/__tests__/$middleware.spec.ts +10 -10
- package/src/server/core/__tests__/$route.spec.ts +9 -9
- package/src/server/core/__tests__/$sse.spec.ts +26 -26
- package/src/server/core/__tests__/BunHttpServerProvider.bun.spec.ts +6 -6
- package/src/server/core/__tests__/HttpClient.spec.ts +2 -2
- package/src/server/core/__tests__/NodeHttpServerProvider.spec.ts +15 -3
- package/src/server/core/__tests__/ServerBodyParserProvider.spec.ts +14 -14
- package/src/server/core/__tests__/ServerMultipartProvider.spec.ts +33 -33
- package/src/server/core/__tests__/ServerRouterProvider-errorHandler.spec.ts +5 -1
- package/src/server/core/__tests__/ServerRouterProvider-getRoutes.spec.ts +25 -25
- package/src/server/core/__tests__/ServerRouterProvider-serializationError.spec.ts +9 -5
- package/src/server/core/__tests__/ServerRouterProvider-validationError.spec.ts +56 -24
- package/src/server/core/errors/ValidationError.ts +6 -3
- package/src/server/core/helpers/isMultipart.ts +2 -1
- package/src/server/core/index.ts +5 -2
- package/src/server/core/interfaces/ServerRequest.ts +6 -14
- package/src/server/core/primitives/$action.ts +26 -36
- package/src/server/core/primitives/$sse.ts +3 -3
- package/src/server/core/providers/BunHttpServerProvider.ts +8 -9
- package/src/server/core/providers/NodeHttpServerProvider.ts +8 -9
- package/src/server/core/providers/ServerBodyParserProvider.ts +20 -12
- package/src/server/core/providers/ServerCompressProvider.ts +9 -10
- package/src/server/core/providers/ServerHelmetProvider.ts +26 -27
- package/src/server/core/providers/ServerMultipartProvider.ts +19 -19
- package/src/server/core/providers/ServerRouterProvider.ts +44 -15
- package/src/server/core/schemas/errorSchema.ts +20 -25
- package/src/server/core/schemas/okSchema.ts +9 -14
- package/src/server/core/services/HttpClient.ts +13 -1
- package/src/server/core/services/ServerRequestParser.ts +6 -6
- package/src/server/cors/providers/ServerCorsProvider.ts +26 -28
- package/src/server/health/schemas/healthSchema.ts +6 -6
- package/src/server/links/__tests__/$remote.spec.ts +3 -3
- package/src/server/links/__tests__/BatchEndpoint.spec.ts +9 -9
- package/src/server/links/__tests__/LinkProvider.spec.ts +9 -9
- package/src/server/links/__tests__/ServerLinksProvider.spec.ts +23 -23
- package/src/server/links/__tests__/fixtures/CrudApp.ts +21 -21
- package/src/server/links/atoms/apiLinksAtom.ts +2 -2
- package/src/server/links/atoms/linkOptionsAtom.ts +6 -6
- package/src/server/links/primitives/$remote.ts +3 -3
- package/src/server/links/providers/LinkProvider.ts +3 -3
- package/src/server/links/providers/ServerLinksProvider.ts +20 -20
- package/src/server/links/schemas/apiLinksResponseSchema.ts +23 -23
- package/src/server/proxy/__tests__/$proxy.spec.ts +9 -9
- package/src/server/proxy/providers/ServerProxyProvider.ts +5 -0
- package/src/server/rate-limit/providers/ServerRateLimitProvider.ts +18 -20
- package/src/server/swagger/__tests__/$swagger.spec.ts +91 -94
- package/src/server/swagger/__tests__/ui.spec.ts +3 -3
- package/src/server/swagger/providers/ServerSwaggerProvider.ts +66 -43
- package/src/system/__tests__/NodeShellProvider.spec.ts +46 -0
- package/src/system/providers/NodeShellProvider.ts +4 -1
- package/src/topic/core/__tests__/$subscriber.spec.ts +4 -4
- package/src/topic/core/__tests__/shared.ts +8 -8
- package/src/topic/core/primitives/$subscriber.ts +5 -5
- package/src/topic/core/primitives/$topic.ts +14 -14
- package/src/topic/redis/providers/RedisTopicProvider.ts +3 -3
- package/dist/container/core/index.d.ts +0 -236
- package/dist/container/core/index.d.ts.map +0 -1
- package/dist/container/core/index.js +0 -231
- package/dist/container/core/index.js.map +0 -1
- package/dist/container/core/index.workerd.js +0 -192
- package/dist/container/core/index.workerd.js.map +0 -1
- package/src/command/helpers/PrettyAsker.ts +0 -256
- package/src/command/helpers/PrettyPrint.ts +0 -332
- package/src/container/core/__tests__/$container.spec.ts +0 -83
- package/src/container/core/index.ts +0 -50
- package/src/container/core/index.workerd.ts +0 -53
- package/src/container/core/interfaces/ContainerOptions.ts +0 -69
- package/src/container/core/primitives/$container.ts +0 -100
- package/src/container/core/providers/CloudflareContainerProvider.ts +0 -70
- package/src/container/core/providers/ContainerProvider.ts +0 -92
- package/src/container/core/providers/MockContainerProvider.ts +0 -62
- package/src/container/core/providers/NodeContainerProvider.ts +0 -53
- package/src/core/__tests__/jsonSchemaToTypeBox.spec.ts +0 -771
- package/src/core/helpers/jsonSchemaToTypeBox.ts +0 -359
- package/src/server/auth/__tests__/authFederationClient.spec.ts +0 -40
- package/src/server/auth/__tests__/federationAssertion.spec.ts +0 -146
- package/src/server/auth/helpers/federationAssertion.ts +0 -74
- package/src/server/auth/primitives/$authFederationBroker.ts +0 -273
- package/src/server/auth/primitives/$authFederationClient.ts +0 -89
- /package/dist/orm/core/{chunk-B4FMCO8f.js → rolldown-runtime-B4FMCO8f.js} +0 -0
package/dist/fake/index.d.ts
CHANGED
|
@@ -1,12 +1,52 @@
|
|
|
1
|
-
import { StaticDecode, TArray, TBoolean, TInteger, TNumber, TObject, TRecord, TSchema, TString
|
|
2
|
-
|
|
3
|
-
//#region
|
|
1
|
+
import { StaticDecode, TArray, TBoolean, TInteger, TNumber, TObject, TRecord, TSchema, TString } from "alepha";
|
|
2
|
+
//#region ../../../../node_modules/@faker-js/faker/dist/index-BSUsvzGS.d.ts
|
|
3
|
+
//#region src/config.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The possible configuration options, that can be set.
|
|
6
|
+
* This type exists to be extended for plugins via type augmentation.
|
|
7
|
+
*
|
|
8
|
+
* The `@default` tag is used to indicate the default value, that should be used if, the config is absent.
|
|
9
|
+
*/
|
|
10
|
+
interface FakerConfig {
|
|
11
|
+
/**
|
|
12
|
+
* The function used to generate the `refDate` date instance, if not provided as method param.
|
|
13
|
+
* The function must return a new valid `Date` instance for every call.
|
|
14
|
+
*
|
|
15
|
+
* @see [Reproducible Results](https://fakerjs.dev/guide/usage.html#reproducible-results)
|
|
16
|
+
* @see faker.seed(): For generating reproducible values.
|
|
17
|
+
*
|
|
18
|
+
* @since 9.0.0
|
|
19
|
+
*
|
|
20
|
+
* @default () => new Date()
|
|
21
|
+
*/
|
|
22
|
+
defaultRefDate?: () => Date;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/internal/locale-proxy.d.ts
|
|
26
|
+
declare const LOCALE_PROXY_TAG: unique symbol;
|
|
4
27
|
/**
|
|
5
28
|
* A proxy for LocaleDefinition that marks all properties as required and throws an error when an entry is accessed that is not defined.
|
|
6
29
|
*/
|
|
7
|
-
type LocaleProxy = Readonly<{ [key in keyof LocaleDefinition]-?: LocaleProxyCategory<LocaleDefinition[key]
|
|
8
|
-
|
|
30
|
+
type LocaleProxy = Readonly<{ [key in keyof LocaleDefinition]-?: LocaleProxyCategory<LocaleDefinition[key]>; } & {
|
|
31
|
+
/**
|
|
32
|
+
* The raw locale definition used to create this proxy.
|
|
33
|
+
* This can be useful to check if a category/entry exists without triggering the proxy's error.
|
|
34
|
+
*/
|
|
35
|
+
raw: LocaleDefinition;
|
|
36
|
+
/**
|
|
37
|
+
* Marker to identify a `LocaleProxy`.
|
|
38
|
+
*/
|
|
39
|
+
[LOCALE_PROXY_TAG]: true;
|
|
40
|
+
}>;
|
|
41
|
+
type LocaleProxyCategory<T> = Readonly<{ [key in keyof T]-?: LocaleProxyEntry<T[key]>; }>;
|
|
9
42
|
type LocaleProxyEntry<T> = unknown extends T ? T : Readonly<NonNullable<T>>;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a proxy for LocaleDefinition that throws an error if an undefined property is accessed.
|
|
45
|
+
*
|
|
46
|
+
* @param locale The locale definition to create the proxy for.
|
|
47
|
+
*/
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/modules/animal/index.d.ts
|
|
10
50
|
/**
|
|
11
51
|
* Module to generate animal related entries.
|
|
12
52
|
*
|
|
@@ -164,6 +204,8 @@ declare class AnimalModule extends ModuleBase {
|
|
|
164
204
|
*/
|
|
165
205
|
petName(): string;
|
|
166
206
|
}
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region src/modules/book/index.d.ts
|
|
167
209
|
/**
|
|
168
210
|
* Module to generate book related entries.
|
|
169
211
|
*
|
|
@@ -236,6 +278,18 @@ declare class BookModule extends ModuleBase {
|
|
|
236
278
|
*/
|
|
237
279
|
title(): string;
|
|
238
280
|
}
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/utils/types.d.ts
|
|
283
|
+
/**
|
|
284
|
+
* The casing applied to generated characters.
|
|
285
|
+
*
|
|
286
|
+
* - `'upper'`: All generated characters are uppercase.
|
|
287
|
+
* - `'lower'`: All generated characters are lowercase.
|
|
288
|
+
* - `'mixed'`: Generated characters keep their original casing.
|
|
289
|
+
*/
|
|
290
|
+
type Casing = 'upper' | 'lower' | 'mixed';
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/modules/color/index.d.ts
|
|
239
293
|
/**
|
|
240
294
|
* Color space names supported by CSS.
|
|
241
295
|
*/
|
|
@@ -271,7 +325,6 @@ type CssFunctionType = `${CssFunction}`;
|
|
|
271
325
|
type StringColorFormat = 'css' | 'binary';
|
|
272
326
|
type NumberColorFormat = 'decimal';
|
|
273
327
|
type ColorFormat = StringColorFormat | NumberColorFormat;
|
|
274
|
-
type Casing$1 = 'lower' | 'upper' | 'mixed';
|
|
275
328
|
/**
|
|
276
329
|
* Module to generate colors.
|
|
277
330
|
*
|
|
@@ -302,7 +355,7 @@ declare class ColorModule extends ModuleBase {
|
|
|
302
355
|
*/
|
|
303
356
|
space(): string;
|
|
304
357
|
/**
|
|
305
|
-
* Returns a random
|
|
358
|
+
* Returns a random CSS-supported color function name.
|
|
306
359
|
*
|
|
307
360
|
* @example
|
|
308
361
|
* faker.color.cssSupportedFunction() // 'rgb'
|
|
@@ -311,7 +364,7 @@ declare class ColorModule extends ModuleBase {
|
|
|
311
364
|
*/
|
|
312
365
|
cssSupportedFunction(): CssFunctionType;
|
|
313
366
|
/**
|
|
314
|
-
* Returns a random
|
|
367
|
+
* Returns a random CSS-supported color space name.
|
|
315
368
|
*
|
|
316
369
|
* @example
|
|
317
370
|
* faker.color.cssSupportedSpace() // 'display-p3'
|
|
@@ -363,7 +416,7 @@ declare class ColorModule extends ModuleBase {
|
|
|
363
416
|
*
|
|
364
417
|
* @default 'lower'
|
|
365
418
|
*/
|
|
366
|
-
casing?: Casing
|
|
419
|
+
casing?: Casing;
|
|
367
420
|
/**
|
|
368
421
|
* Format of generated RGB color.
|
|
369
422
|
*
|
|
@@ -442,7 +495,7 @@ declare class ColorModule extends ModuleBase {
|
|
|
442
495
|
*
|
|
443
496
|
* @default 'lower'
|
|
444
497
|
*/
|
|
445
|
-
casing?: Casing
|
|
498
|
+
casing?: Casing;
|
|
446
499
|
/**
|
|
447
500
|
* Format of generated RGB color.
|
|
448
501
|
*
|
|
@@ -949,6 +1002,8 @@ declare class ColorModule extends ModuleBase {
|
|
|
949
1002
|
space?: CssSpaceType;
|
|
950
1003
|
}): string | number[];
|
|
951
1004
|
}
|
|
1005
|
+
//#endregion
|
|
1006
|
+
//#region src/modules/commerce/index.d.ts
|
|
952
1007
|
/**
|
|
953
1008
|
* Module to generate commerce and product related entries.
|
|
954
1009
|
*
|
|
@@ -1128,6 +1183,8 @@ declare class CommerceModule extends ModuleBase {
|
|
|
1128
1183
|
prefix?: string;
|
|
1129
1184
|
}): string;
|
|
1130
1185
|
}
|
|
1186
|
+
//#endregion
|
|
1187
|
+
//#region src/modules/company/index.d.ts
|
|
1131
1188
|
/**
|
|
1132
1189
|
* Module to generate company related entries.
|
|
1133
1190
|
*
|
|
@@ -1171,7 +1228,7 @@ declare class CompanyModule extends ModuleBase {
|
|
|
1171
1228
|
*/
|
|
1172
1229
|
buzzPhrase(): string;
|
|
1173
1230
|
/**
|
|
1174
|
-
* Returns a random catch phrase adjective that can be displayed to an end user
|
|
1231
|
+
* Returns a random catch phrase adjective that can be displayed to an end user.
|
|
1175
1232
|
*
|
|
1176
1233
|
* @example
|
|
1177
1234
|
* faker.company.catchPhraseAdjective() // 'Multi-tiered'
|
|
@@ -1180,7 +1237,7 @@ declare class CompanyModule extends ModuleBase {
|
|
|
1180
1237
|
*/
|
|
1181
1238
|
catchPhraseAdjective(): string;
|
|
1182
1239
|
/**
|
|
1183
|
-
* Returns a random catch phrase descriptor that can be displayed to an end user
|
|
1240
|
+
* Returns a random catch phrase descriptor that can be displayed to an end user.
|
|
1184
1241
|
*
|
|
1185
1242
|
* @example
|
|
1186
1243
|
* faker.company.catchPhraseDescriptor() // 'composite'
|
|
@@ -1189,7 +1246,7 @@ declare class CompanyModule extends ModuleBase {
|
|
|
1189
1246
|
*/
|
|
1190
1247
|
catchPhraseDescriptor(): string;
|
|
1191
1248
|
/**
|
|
1192
|
-
* Returns a random catch phrase noun that can be displayed to an end user
|
|
1249
|
+
* Returns a random catch phrase noun that can be displayed to an end user.
|
|
1193
1250
|
*
|
|
1194
1251
|
* @example
|
|
1195
1252
|
* faker.company.catchPhraseNoun() // 'leverage'
|
|
@@ -1225,6 +1282,8 @@ declare class CompanyModule extends ModuleBase {
|
|
|
1225
1282
|
*/
|
|
1226
1283
|
buzzNoun(): string;
|
|
1227
1284
|
}
|
|
1285
|
+
//#endregion
|
|
1286
|
+
//#region src/modules/database/index.d.ts
|
|
1228
1287
|
/**
|
|
1229
1288
|
* Module to generate database related entries.
|
|
1230
1289
|
*
|
|
@@ -1281,6 +1340,8 @@ declare class DatabaseModule extends ModuleBase {
|
|
|
1281
1340
|
*/
|
|
1282
1341
|
mongodbObjectId(): string;
|
|
1283
1342
|
}
|
|
1343
|
+
//#endregion
|
|
1344
|
+
//#region src/modules/date/index.d.ts
|
|
1284
1345
|
/**
|
|
1285
1346
|
* Module to generate dates (without methods requiring localized data).
|
|
1286
1347
|
*/
|
|
@@ -1312,14 +1373,18 @@ declare class SimpleDateModule extends SimpleModuleBase {
|
|
|
1312
1373
|
* Generates a random date in the past.
|
|
1313
1374
|
*
|
|
1314
1375
|
* @param options The optional options object.
|
|
1315
|
-
* @param options.years The range of years the date may be in the past. Defaults to `1`.
|
|
1376
|
+
* @param options.years The range of years the date may be in the past. Either as a fixed amount of years or as a year range. Defaults to `1`.
|
|
1316
1377
|
* @param options.refDate The date to use as reference point for the newly generated date. Defaults to `faker.defaultRefDate()`.
|
|
1317
1378
|
*
|
|
1379
|
+
* @throws {FakerError} If `years.max` is less than 0.
|
|
1380
|
+
* @throws {FakerError} If `years.min` is greater than or equal to `years.max`.
|
|
1381
|
+
*
|
|
1318
1382
|
* @see faker.date.recent(): For generating dates in the recent past (days instead of years).
|
|
1319
1383
|
*
|
|
1320
1384
|
* @example
|
|
1321
1385
|
* faker.date.past() // '2021-12-03T05:40:44.408Z'
|
|
1322
1386
|
* faker.date.past({ years: 10 }) // '2017-10-25T21:34:19.488Z'
|
|
1387
|
+
* faker.date.past({ years: { min: 4, max: 7 } }) // '2022-12-12T03:43:16.434Z'
|
|
1323
1388
|
* faker.date.past({ years: 10, refDate: '2020-01-01T00:00:00.000Z' }) // '2017-08-18T02:59:12.350Z'
|
|
1324
1389
|
*
|
|
1325
1390
|
* @since 8.0.0
|
|
@@ -1330,7 +1395,20 @@ declare class SimpleDateModule extends SimpleModuleBase {
|
|
|
1330
1395
|
*
|
|
1331
1396
|
* @default 1
|
|
1332
1397
|
*/
|
|
1333
|
-
years?: number
|
|
1398
|
+
years?: number | {
|
|
1399
|
+
/**
|
|
1400
|
+
* The minimum amount of years the date should be in the past.
|
|
1401
|
+
*
|
|
1402
|
+
* @default 0
|
|
1403
|
+
*/
|
|
1404
|
+
min: number;
|
|
1405
|
+
/**
|
|
1406
|
+
* The maximum amount of years the date should be in the past.
|
|
1407
|
+
*
|
|
1408
|
+
* @default 1
|
|
1409
|
+
*/
|
|
1410
|
+
max: number;
|
|
1411
|
+
};
|
|
1334
1412
|
/**
|
|
1335
1413
|
* The date to use as reference point for the newly generated date.
|
|
1336
1414
|
*
|
|
@@ -1342,14 +1420,18 @@ declare class SimpleDateModule extends SimpleModuleBase {
|
|
|
1342
1420
|
* Generates a random date in the future.
|
|
1343
1421
|
*
|
|
1344
1422
|
* @param options The optional options object.
|
|
1345
|
-
* @param options.years The range of years the date may be in the future. Defaults to `1`.
|
|
1423
|
+
* @param options.years The range of years the date may be in the future. Either as a fixed amount of years or as a year range. Defaults to `1`.
|
|
1346
1424
|
* @param options.refDate The date to use as reference point for the newly generated date. Defaults to `faker.defaultRefDate()`.
|
|
1347
1425
|
*
|
|
1426
|
+
* @throws {FakerError} If `years.max` is less than 0.
|
|
1427
|
+
* @throws {FakerError} If `years.min` is greater than or equal to `years.max`.
|
|
1428
|
+
*
|
|
1348
1429
|
* @see faker.date.soon(): For generating dates in the near future (days instead of years).
|
|
1349
1430
|
*
|
|
1350
1431
|
* @example
|
|
1351
1432
|
* faker.date.future() // '2022-11-19T05:52:49.100Z'
|
|
1352
1433
|
* faker.date.future({ years: 10 }) // '2030-11-23T09:38:28.710Z'
|
|
1434
|
+
* faker.date.future({ years: { min: 4, max: 7 } }) // '2031-05-21T05:49:21.116Z'
|
|
1353
1435
|
* faker.date.future({ years: 10, refDate: '2020-01-01T00:00:00.000Z' }) // '2020-12-13T22:45:10.252Z'
|
|
1354
1436
|
*
|
|
1355
1437
|
* @since 8.0.0
|
|
@@ -1360,7 +1442,20 @@ declare class SimpleDateModule extends SimpleModuleBase {
|
|
|
1360
1442
|
*
|
|
1361
1443
|
* @default 1
|
|
1362
1444
|
*/
|
|
1363
|
-
years?: number
|
|
1445
|
+
years?: number | {
|
|
1446
|
+
/**
|
|
1447
|
+
* The minimum amount of years the date should be in the future.
|
|
1448
|
+
*
|
|
1449
|
+
* @default 0
|
|
1450
|
+
*/
|
|
1451
|
+
min: number;
|
|
1452
|
+
/**
|
|
1453
|
+
* The maximum amount of years the date should be in the future.
|
|
1454
|
+
*
|
|
1455
|
+
* @default 1
|
|
1456
|
+
*/
|
|
1457
|
+
max: number;
|
|
1458
|
+
};
|
|
1364
1459
|
/**
|
|
1365
1460
|
* The date to use as reference point for the newly generated date.
|
|
1366
1461
|
*
|
|
@@ -1451,14 +1546,18 @@ declare class SimpleDateModule extends SimpleModuleBase {
|
|
|
1451
1546
|
* Generates a random date in the recent past.
|
|
1452
1547
|
*
|
|
1453
1548
|
* @param options The optional options object.
|
|
1454
|
-
* @param options.days The range of days the date may be in the past. Defaults to `1`.
|
|
1549
|
+
* @param options.days The range of days the date may be in the past. Either as a fixed amount of days or as a day range. Defaults to `1`.
|
|
1455
1550
|
* @param options.refDate The date to use as reference point for the newly generated date. Defaults to `faker.defaultRefDate()`.
|
|
1456
1551
|
*
|
|
1552
|
+
* @throws {FakerError} If `days.max` is less than 0.
|
|
1553
|
+
* @throws {FakerError} If `days.min` is greater than or equal to `days.max`.
|
|
1554
|
+
*
|
|
1457
1555
|
* @see faker.date.past(): For generating dates further back in time (years instead of days).
|
|
1458
1556
|
*
|
|
1459
1557
|
* @example
|
|
1460
1558
|
* faker.date.recent() // '2022-02-04T02:09:35.077Z'
|
|
1461
1559
|
* faker.date.recent({ days: 10 }) // '2022-01-29T06:12:12.829Z'
|
|
1560
|
+
* faker.date.recent({ days: { min: 4, max: 7 } }) // '2022-02-02T17:54:01.818Z'
|
|
1462
1561
|
* faker.date.recent({ days: 10, refDate: '2020-01-01T00:00:00.000Z' }) // '2019-12-27T18:11:19.117Z'
|
|
1463
1562
|
*
|
|
1464
1563
|
* @since 8.0.0
|
|
@@ -1469,7 +1568,20 @@ declare class SimpleDateModule extends SimpleModuleBase {
|
|
|
1469
1568
|
*
|
|
1470
1569
|
* @default 1
|
|
1471
1570
|
*/
|
|
1472
|
-
days?: number
|
|
1571
|
+
days?: number | {
|
|
1572
|
+
/**
|
|
1573
|
+
* The minimum amount of days the date should be in the past.
|
|
1574
|
+
*
|
|
1575
|
+
* @default 0
|
|
1576
|
+
*/
|
|
1577
|
+
min: number;
|
|
1578
|
+
/**
|
|
1579
|
+
* The maximum amount of days the date should be in the past.
|
|
1580
|
+
*
|
|
1581
|
+
* @default 1
|
|
1582
|
+
*/
|
|
1583
|
+
max: number;
|
|
1584
|
+
};
|
|
1473
1585
|
/**
|
|
1474
1586
|
* The date to use as reference point for the newly generated date.
|
|
1475
1587
|
*
|
|
@@ -1481,14 +1593,18 @@ declare class SimpleDateModule extends SimpleModuleBase {
|
|
|
1481
1593
|
* Generates a random date in the near future.
|
|
1482
1594
|
*
|
|
1483
1595
|
* @param options The optional options object.
|
|
1484
|
-
* @param options.days The range of days the date may be in the future. Defaults to `1`.
|
|
1596
|
+
* @param options.days The range of days the date may be in the future. Either as a fixed amount of days or as a day range. Defaults to `1`.
|
|
1485
1597
|
* @param options.refDate The date to use as reference point for the newly generated date. Defaults to `faker.defaultRefDate()`.
|
|
1486
1598
|
*
|
|
1599
|
+
* @throws {FakerError} If `days.max` is less than 0.
|
|
1600
|
+
* @throws {FakerError} If `days.min` is greater than or equal to `days.max`.
|
|
1601
|
+
*
|
|
1487
1602
|
* @see faker.date.future(): For generating dates further in the future (years instead of days).
|
|
1488
1603
|
*
|
|
1489
1604
|
* @example
|
|
1490
1605
|
* faker.date.soon() // '2022-02-05T09:55:39.216Z'
|
|
1491
1606
|
* faker.date.soon({ days: 10 }) // '2022-02-11T05:14:39.138Z'
|
|
1607
|
+
* faker.date.soon({ days: { min: 4, max: 7 } }) // '2022-02-09T17:54:01.818Z'
|
|
1492
1608
|
* faker.date.soon({ days: 10, refDate: '2020-01-01T00:00:00.000Z' }) // '2020-01-01T02:40:44.990Z'
|
|
1493
1609
|
*
|
|
1494
1610
|
* @since 8.0.0
|
|
@@ -1499,7 +1615,20 @@ declare class SimpleDateModule extends SimpleModuleBase {
|
|
|
1499
1615
|
*
|
|
1500
1616
|
* @default 1
|
|
1501
1617
|
*/
|
|
1502
|
-
days?: number
|
|
1618
|
+
days?: number | {
|
|
1619
|
+
/**
|
|
1620
|
+
* The minimum amount of days the date should be in the future.
|
|
1621
|
+
*
|
|
1622
|
+
* @default 0
|
|
1623
|
+
*/
|
|
1624
|
+
min: number;
|
|
1625
|
+
/**
|
|
1626
|
+
* The maximum amount of days the date should be in the future.
|
|
1627
|
+
*
|
|
1628
|
+
* @default 1
|
|
1629
|
+
*/
|
|
1630
|
+
max: number;
|
|
1631
|
+
};
|
|
1503
1632
|
/**
|
|
1504
1633
|
* The date to use as reference point for the newly generated date.
|
|
1505
1634
|
*
|
|
@@ -1748,1305 +1877,801 @@ declare class DateModule extends SimpleDateModule {
|
|
|
1748
1877
|
*/
|
|
1749
1878
|
timeZone(): string;
|
|
1750
1879
|
}
|
|
1880
|
+
//#endregion
|
|
1881
|
+
//#region src/modules/finance/bitcoin.d.ts
|
|
1751
1882
|
/**
|
|
1752
|
-
*
|
|
1753
|
-
*
|
|
1754
|
-
* @see https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609
|
|
1883
|
+
* The bitcoin address families.
|
|
1755
1884
|
*/
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
type NumericChar = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
|
|
1763
|
-
type AlphaChar = LowerAlphaChar | UpperAlphaChar;
|
|
1764
|
-
type AlphaNumericChar = AlphaChar | NumericChar;
|
|
1885
|
+
declare enum BitcoinAddressFamily {
|
|
1886
|
+
Legacy = "legacy",
|
|
1887
|
+
Segwit = "segwit",
|
|
1888
|
+
Bech32 = "bech32",
|
|
1889
|
+
Taproot = "taproot"
|
|
1890
|
+
}
|
|
1765
1891
|
/**
|
|
1766
|
-
*
|
|
1892
|
+
* The bitcoin address families.
|
|
1893
|
+
*/
|
|
1894
|
+
type BitcoinAddressFamilyType = `${BitcoinAddressFamily}`;
|
|
1895
|
+
/**
|
|
1896
|
+
* The different bitcoin networks.
|
|
1897
|
+
*/
|
|
1898
|
+
declare enum BitcoinNetwork {
|
|
1899
|
+
Mainnet = "mainnet",
|
|
1900
|
+
Testnet = "testnet"
|
|
1901
|
+
}
|
|
1902
|
+
/**
|
|
1903
|
+
* The different bitcoin networks.
|
|
1904
|
+
*/
|
|
1905
|
+
type BitcoinNetworkType = `${BitcoinNetwork}`;
|
|
1906
|
+
//#endregion
|
|
1907
|
+
//#region src/modules/finance/index.d.ts
|
|
1908
|
+
/**
|
|
1909
|
+
* The possible definitions related to currency entries.
|
|
1910
|
+
*/
|
|
1911
|
+
interface Currency {
|
|
1912
|
+
/**
|
|
1913
|
+
* The full name for the currency (e.g. `US Dollar`).
|
|
1914
|
+
*/
|
|
1915
|
+
name: string;
|
|
1916
|
+
/**
|
|
1917
|
+
* The code/short text/abbreviation for the currency (e.g. `USD`).
|
|
1918
|
+
*/
|
|
1919
|
+
code: string;
|
|
1920
|
+
/**
|
|
1921
|
+
* The symbol for the currency (e.g. `$`).
|
|
1922
|
+
*/
|
|
1923
|
+
symbol: string;
|
|
1924
|
+
/**
|
|
1925
|
+
* The ISO 4217 numeric code for the currency (e.g. `840`).
|
|
1926
|
+
*/
|
|
1927
|
+
numericCode: string;
|
|
1928
|
+
}
|
|
1929
|
+
/**
|
|
1930
|
+
* Module to generate finance and money related entries.
|
|
1767
1931
|
*
|
|
1768
1932
|
* ### Overview
|
|
1769
1933
|
*
|
|
1770
|
-
* For a
|
|
1771
|
-
*
|
|
1772
|
-
* For strings of base-ten digits, use [`numeric()`](https://fakerjs.dev/api/string.html#numeric). For other bases, use [`binary()`](https://fakerjs.dev/api/string.html#binary), [`octal()`](https://fakerjs.dev/api/string.html#octal), or [`hexadecimal()`](https://fakerjs.dev/api/string.html#hexadecimal)).
|
|
1934
|
+
* For a random amount, use [`amount()`](https://fakerjs.dev/api/finance.html#amount).
|
|
1773
1935
|
*
|
|
1774
|
-
*
|
|
1936
|
+
* For traditional bank accounts, use: [`accountNumber()`](https://fakerjs.dev/api/finance.html#accountnumber), [`accountName()`](https://fakerjs.dev/api/finance.html#accountname), [`bic()`](https://fakerjs.dev/api/finance.html#bic), [`iban()`](https://fakerjs.dev/api/finance.html#iban), [`pin()`](https://fakerjs.dev/api/finance.html#pin) and [`routingNumber()`](https://fakerjs.dev/api/finance.html#routingnumber).
|
|
1775
1937
|
*
|
|
1776
|
-
*
|
|
1938
|
+
* For credit card related methods, use: [`creditCardNumber()`](https://fakerjs.dev/api/finance.html#creditcardnumber), [`creditCardCVV()`](https://fakerjs.dev/api/finance.html#creditcardcvv), [`creditCardIssuer()`](https://fakerjs.dev/api/finance.html#creditcardissuer), [`transactionDescription()`](https://fakerjs.dev/api/finance.html#transactiondescription) and [`transactionType()`](https://fakerjs.dev/api/finance.html#transactiontype).
|
|
1777
1939
|
*
|
|
1778
|
-
*
|
|
1779
|
-
* - The [`faker.helpers`](https://fakerjs.dev/api/helpers.html) module includes a number of string related methods.
|
|
1940
|
+
* For blockchain related methods, use: [`bitcoinAddress()`](https://fakerjs.dev/api/finance.html#bitcoinaddress), [`ethereumAddress()`](https://fakerjs.dev/api/finance.html#ethereumaddress) and [`litecoinAddress()`](https://fakerjs.dev/api/finance.html#litecoinaddress).
|
|
1780
1941
|
*/
|
|
1781
|
-
declare class
|
|
1942
|
+
declare class FinanceModule extends ModuleBase {
|
|
1782
1943
|
/**
|
|
1783
|
-
* Generates a
|
|
1944
|
+
* Generates a random account number.
|
|
1784
1945
|
*
|
|
1785
|
-
* @param
|
|
1786
|
-
*
|
|
1787
|
-
* @
|
|
1788
|
-
* @param length.min The minimum length of the string to generate.
|
|
1789
|
-
* @param length.max The maximum length of the string to generate.
|
|
1946
|
+
* @param length The length of the account number. Defaults to `8`.
|
|
1947
|
+
*
|
|
1948
|
+
* @see faker.string.numeric(): For generating the number with greater control.
|
|
1790
1949
|
*
|
|
1791
1950
|
* @example
|
|
1792
|
-
* faker.
|
|
1793
|
-
* faker.
|
|
1794
|
-
* faker.string.fromCharacters('abc', 10) // 'cbbbacbacb'
|
|
1795
|
-
* faker.string.fromCharacters('abc', { min: 5, max: 10 }) // 'abcaaaba'
|
|
1951
|
+
* faker.finance.accountNumber() // '92842238'
|
|
1952
|
+
* faker.finance.accountNumber(5) // '32564'
|
|
1796
1953
|
*
|
|
1797
1954
|
* @since 8.0.0
|
|
1798
1955
|
*/
|
|
1799
|
-
|
|
1800
|
-
/**
|
|
1801
|
-
* The minimum length of the string to generate.
|
|
1802
|
-
*/
|
|
1803
|
-
min: number;
|
|
1804
|
-
/**
|
|
1805
|
-
* The maximum length of the string to generate.
|
|
1806
|
-
*/
|
|
1807
|
-
max: number;
|
|
1808
|
-
}): string;
|
|
1956
|
+
accountNumber(length?: number): string;
|
|
1809
1957
|
/**
|
|
1810
|
-
*
|
|
1958
|
+
* Generates a random account number.
|
|
1811
1959
|
*
|
|
1812
|
-
* @param options
|
|
1813
|
-
* @param options.length The length of the
|
|
1814
|
-
*
|
|
1815
|
-
* @
|
|
1960
|
+
* @param options An options object.
|
|
1961
|
+
* @param options.length The length of the account number. Defaults to `8`.
|
|
1962
|
+
*
|
|
1963
|
+
* @see faker.string.numeric(): For generating the number with greater control.
|
|
1816
1964
|
*
|
|
1817
1965
|
* @example
|
|
1818
|
-
* faker.
|
|
1819
|
-
* faker.
|
|
1820
|
-
* faker.string.alpha({ length: { min: 5, max: 10 } }) // 'HcVrCf'
|
|
1821
|
-
* faker.string.alpha({ casing: 'lower' }) // 'r'
|
|
1822
|
-
* faker.string.alpha({ exclude: ['W'] }) // 'Z'
|
|
1823
|
-
* faker.string.alpha({ length: 5, casing: 'upper', exclude: ['A'] }) // 'DTCIC'
|
|
1966
|
+
* faker.finance.accountNumber() // '92842238'
|
|
1967
|
+
* faker.finance.accountNumber({ length: 5 }) // '32564'
|
|
1824
1968
|
*
|
|
1825
1969
|
* @since 8.0.0
|
|
1826
1970
|
*/
|
|
1827
|
-
|
|
1828
|
-
/**
|
|
1829
|
-
* The length of the string to generate either as a fixed length or as a length range.
|
|
1830
|
-
*
|
|
1831
|
-
* @default 1
|
|
1832
|
-
*/
|
|
1833
|
-
length?: number | {
|
|
1834
|
-
/**
|
|
1835
|
-
* The minimum length of the string to generate.
|
|
1836
|
-
*/
|
|
1837
|
-
min: number;
|
|
1838
|
-
/**
|
|
1839
|
-
* The maximum length of the string to generate.
|
|
1840
|
-
*/
|
|
1841
|
-
max: number;
|
|
1842
|
-
};
|
|
1843
|
-
/**
|
|
1844
|
-
* The casing of the characters.
|
|
1845
|
-
*
|
|
1846
|
-
* @default 'mixed'
|
|
1847
|
-
*/
|
|
1848
|
-
casing?: Casing;
|
|
1971
|
+
accountNumber(options?: {
|
|
1849
1972
|
/**
|
|
1850
|
-
*
|
|
1973
|
+
* The length of the account number.
|
|
1851
1974
|
*
|
|
1852
|
-
* @default
|
|
1975
|
+
* @default 8
|
|
1853
1976
|
*/
|
|
1854
|
-
|
|
1977
|
+
length?: number;
|
|
1855
1978
|
}): string;
|
|
1856
1979
|
/**
|
|
1857
|
-
*
|
|
1980
|
+
* Generates a random account number.
|
|
1858
1981
|
*
|
|
1859
|
-
* @param options
|
|
1860
|
-
* @param
|
|
1861
|
-
*
|
|
1862
|
-
* @
|
|
1982
|
+
* @param optionsOrLength An options object or the length of the account number.
|
|
1983
|
+
* @param optionsOrLength.length The length of the account number. Defaults to `8`.
|
|
1984
|
+
*
|
|
1985
|
+
* @see faker.string.numeric(): For generating the number with greater control.
|
|
1863
1986
|
*
|
|
1864
1987
|
* @example
|
|
1865
|
-
* faker.
|
|
1866
|
-
* faker.
|
|
1867
|
-
* faker.
|
|
1868
|
-
* faker.string.alphanumeric({ casing: 'upper' }) // 'A'
|
|
1869
|
-
* faker.string.alphanumeric({ exclude: ['W'] }) // 'r'
|
|
1870
|
-
* faker.string.alphanumeric({ length: 5, exclude: ["a"] }) // 'x1Z7f'
|
|
1988
|
+
* faker.finance.accountNumber() // '92842238'
|
|
1989
|
+
* faker.finance.accountNumber(5) // '28736'
|
|
1990
|
+
* faker.finance.accountNumber({ length: 5 }) // '32564'
|
|
1871
1991
|
*
|
|
1872
1992
|
* @since 8.0.0
|
|
1873
1993
|
*/
|
|
1874
|
-
|
|
1875
|
-
/**
|
|
1876
|
-
* The length of the string to generate either as a fixed length or as a length range.
|
|
1877
|
-
*
|
|
1878
|
-
* @default 1
|
|
1879
|
-
*/
|
|
1880
|
-
length?: number | {
|
|
1881
|
-
/**
|
|
1882
|
-
* The minimum length of the string to generate.
|
|
1883
|
-
*/
|
|
1884
|
-
min: number;
|
|
1885
|
-
/**
|
|
1886
|
-
* The maximum length of the string to generate.
|
|
1887
|
-
*/
|
|
1888
|
-
max: number;
|
|
1889
|
-
};
|
|
1994
|
+
accountNumber(optionsOrLength?: number | {
|
|
1890
1995
|
/**
|
|
1891
|
-
* The
|
|
1996
|
+
* The length of the account number.
|
|
1892
1997
|
*
|
|
1893
|
-
* @default
|
|
1998
|
+
* @default 8
|
|
1894
1999
|
*/
|
|
1895
|
-
|
|
1896
|
-
/**
|
|
1897
|
-
* An array of characters and digits which should be excluded in the generated string.
|
|
1898
|
-
*
|
|
1899
|
-
* @default []
|
|
1900
|
-
*/
|
|
1901
|
-
exclude?: ReadonlyArray<LiteralUnion<AlphaNumericChar>> | string;
|
|
2000
|
+
length?: number;
|
|
1902
2001
|
}): string;
|
|
1903
2002
|
/**
|
|
1904
|
-
*
|
|
2003
|
+
* Generates a random account name.
|
|
1905
2004
|
*
|
|
1906
|
-
* @
|
|
1907
|
-
*
|
|
1908
|
-
* @param options.prefix Prefix for the generated number. Defaults to `'0b'`.
|
|
2005
|
+
* @example
|
|
2006
|
+
* faker.finance.accountName() // 'Personal Loan Account'
|
|
1909
2007
|
*
|
|
1910
|
-
* @
|
|
2008
|
+
* @since 2.0.1
|
|
2009
|
+
*/
|
|
2010
|
+
accountName(): string;
|
|
2011
|
+
/**
|
|
2012
|
+
* Generates a random [ABA routing number](https://en.wikipedia.org/wiki/ABA_routing_transit_number).
|
|
1911
2013
|
*
|
|
1912
2014
|
* @example
|
|
1913
|
-
* faker.
|
|
1914
|
-
* faker.string.binary({ length: 10 }) // '0b1101011011'
|
|
1915
|
-
* faker.string.binary({ length: { min: 5, max: 10 } }) // '0b11101011'
|
|
1916
|
-
* faker.string.binary({ prefix: '0b' }) // '0b1'
|
|
1917
|
-
* faker.string.binary({ length: 10, prefix: 'bin_' }) // 'bin_1101011011'
|
|
2015
|
+
* faker.finance.routingNumber() // '062197511'
|
|
1918
2016
|
*
|
|
1919
|
-
* @since
|
|
2017
|
+
* @since 5.0.0
|
|
1920
2018
|
*/
|
|
1921
|
-
|
|
1922
|
-
/**
|
|
1923
|
-
* The length of the string (excluding the prefix) to generate either as a fixed length or as a length range.
|
|
1924
|
-
*
|
|
1925
|
-
* @default 1
|
|
1926
|
-
*/
|
|
1927
|
-
length?: number | {
|
|
1928
|
-
/**
|
|
1929
|
-
* The minimum length of the string (excluding the prefix) to generate.
|
|
1930
|
-
*/
|
|
1931
|
-
min: number;
|
|
1932
|
-
/**
|
|
1933
|
-
* The maximum length of the string (excluding the prefix) to generate.
|
|
1934
|
-
*/
|
|
1935
|
-
max: number;
|
|
1936
|
-
};
|
|
1937
|
-
/**
|
|
1938
|
-
* Prefix for the generated number.
|
|
1939
|
-
*
|
|
1940
|
-
* @default '0b'
|
|
1941
|
-
*/
|
|
1942
|
-
prefix?: string;
|
|
1943
|
-
}): string;
|
|
2019
|
+
routingNumber(): string;
|
|
1944
2020
|
/**
|
|
1945
|
-
*
|
|
2021
|
+
* Generates a random amount between the given bounds (inclusive).
|
|
1946
2022
|
*
|
|
1947
|
-
* @param options
|
|
1948
|
-
* @param options.
|
|
1949
|
-
* @param options.
|
|
2023
|
+
* @param options An options object.
|
|
2024
|
+
* @param options.min The lower bound for the amount. Defaults to `0`.
|
|
2025
|
+
* @param options.max The upper bound for the amount. Defaults to `1000`.
|
|
2026
|
+
* @param options.dec The number of decimal places for the amount. Defaults to `2`.
|
|
2027
|
+
* @param options.symbol The symbol used to prefix the amount. Defaults to `''`.
|
|
2028
|
+
* @param options.autoFormat If true this method will use `Number.toLocaleString()`. Otherwise it will use `Number.toFixed()`.
|
|
1950
2029
|
*
|
|
1951
|
-
* @see faker.number.
|
|
2030
|
+
* @see faker.number.float(): For generating the amount with greater control.
|
|
1952
2031
|
*
|
|
1953
2032
|
* @example
|
|
1954
|
-
* faker.
|
|
1955
|
-
* faker.
|
|
1956
|
-
* faker.
|
|
1957
|
-
* faker.
|
|
1958
|
-
* faker.
|
|
2033
|
+
* faker.finance.amount() // '617.87'
|
|
2034
|
+
* faker.finance.amount({ min: 5, max: 10 }) // '5.53'
|
|
2035
|
+
* faker.finance.amount({ min: 5, max: 10, dec: 0 }) // '8'
|
|
2036
|
+
* faker.finance.amount({ min: 5, max: 10, dec: 2, symbol: '$' }) // '$5.85'
|
|
2037
|
+
* faker.finance.amount({ min: 5, max: 10, dec: 5, symbol: '', autoFormat: true }) // '9,75067'
|
|
1959
2038
|
*
|
|
1960
|
-
* @since
|
|
2039
|
+
* @since 2.0.1
|
|
1961
2040
|
*/
|
|
1962
|
-
|
|
2041
|
+
amount(options?: {
|
|
1963
2042
|
/**
|
|
1964
|
-
* The
|
|
2043
|
+
* The lower bound for the amount.
|
|
1965
2044
|
*
|
|
1966
|
-
* @default
|
|
2045
|
+
* @default 0
|
|
1967
2046
|
*/
|
|
1968
|
-
|
|
1969
|
-
/**
|
|
1970
|
-
* The minimum length of the string (excluding the prefix) to generate.
|
|
1971
|
-
*/
|
|
1972
|
-
min: number;
|
|
1973
|
-
/**
|
|
1974
|
-
* The maximum length of the string (excluding the prefix) to generate.
|
|
1975
|
-
*/
|
|
1976
|
-
max: number;
|
|
1977
|
-
};
|
|
2047
|
+
min?: number;
|
|
1978
2048
|
/**
|
|
1979
|
-
*
|
|
2049
|
+
* The upper bound for the amount.
|
|
1980
2050
|
*
|
|
1981
|
-
* @default
|
|
2051
|
+
* @default 1000
|
|
1982
2052
|
*/
|
|
1983
|
-
|
|
1984
|
-
}): string;
|
|
1985
|
-
/**
|
|
1986
|
-
* Returns a [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) string.
|
|
1987
|
-
*
|
|
1988
|
-
* @param options The optional options object.
|
|
1989
|
-
* @param options.length The length of the string (excluding the prefix) to generate either as a fixed length or as a length range. Defaults to `1`.
|
|
1990
|
-
* @param options.casing Casing of the generated number. Defaults to `'mixed'`.
|
|
1991
|
-
* @param options.prefix Prefix for the generated number. Defaults to `'0x'`.
|
|
1992
|
-
*
|
|
1993
|
-
* @example
|
|
1994
|
-
* faker.string.hexadecimal() // '0xB'
|
|
1995
|
-
* faker.string.hexadecimal({ length: 10 }) // '0xaE13d044cB'
|
|
1996
|
-
* faker.string.hexadecimal({ length: { min: 5, max: 10 } }) // '0x7dEf7FCD'
|
|
1997
|
-
* faker.string.hexadecimal({ prefix: '0x' }) // '0xE'
|
|
1998
|
-
* faker.string.hexadecimal({ casing: 'lower' }) // '0xf'
|
|
1999
|
-
* faker.string.hexadecimal({ length: 10, prefix: '#' }) // '#f12a974eB1'
|
|
2000
|
-
* faker.string.hexadecimal({ length: 10, casing: 'upper' }) // '0xE3F38014FB'
|
|
2001
|
-
* faker.string.hexadecimal({ casing: 'lower', prefix: '' }) // 'd'
|
|
2002
|
-
* faker.string.hexadecimal({ length: 10, casing: 'mixed', prefix: '0x' }) // '0xAdE330a4D1'
|
|
2003
|
-
*
|
|
2004
|
-
* @since 8.0.0
|
|
2005
|
-
*/
|
|
2006
|
-
hexadecimal(options?: {
|
|
2053
|
+
max?: number;
|
|
2007
2054
|
/**
|
|
2008
|
-
* The
|
|
2055
|
+
* The number of decimal places for the amount.
|
|
2009
2056
|
*
|
|
2010
|
-
* @default
|
|
2057
|
+
* @default 2
|
|
2011
2058
|
*/
|
|
2012
|
-
|
|
2013
|
-
/**
|
|
2014
|
-
* The minimum length of the string (excluding the prefix) to generate.
|
|
2015
|
-
*/
|
|
2016
|
-
min: number;
|
|
2017
|
-
/**
|
|
2018
|
-
* The maximum length of the string (excluding the prefix) to generate.
|
|
2019
|
-
*/
|
|
2020
|
-
max: number;
|
|
2021
|
-
};
|
|
2059
|
+
dec?: number;
|
|
2022
2060
|
/**
|
|
2023
|
-
*
|
|
2061
|
+
* The symbol used to prefix the amount.
|
|
2024
2062
|
*
|
|
2025
|
-
* @default '
|
|
2063
|
+
* @default ''
|
|
2026
2064
|
*/
|
|
2027
|
-
|
|
2065
|
+
symbol?: string;
|
|
2028
2066
|
/**
|
|
2029
|
-
*
|
|
2067
|
+
* If true this method will use `Number.toLocaleString()`. Otherwise it will use `Number.toFixed()`.
|
|
2030
2068
|
*
|
|
2031
|
-
* @default
|
|
2069
|
+
* @default false
|
|
2032
2070
|
*/
|
|
2033
|
-
|
|
2071
|
+
autoFormat?: boolean;
|
|
2034
2072
|
}): string;
|
|
2035
2073
|
/**
|
|
2036
|
-
*
|
|
2037
|
-
*
|
|
2038
|
-
* @param options Either the length of the string to generate or the optional options object.
|
|
2039
|
-
* @param options.length The length of the string to generate either as a fixed length or as a length range. Defaults to `1`.
|
|
2040
|
-
* @param options.allowLeadingZeros Whether leading zeros are allowed or not. Defaults to `true`.
|
|
2041
|
-
* @param options.exclude An array of digits which should be excluded in the generated string. Defaults to `[]`.
|
|
2042
|
-
*
|
|
2043
|
-
* @see faker.number.int(): For generating a number (within a range).
|
|
2074
|
+
* Returns a random transaction type.
|
|
2044
2075
|
*
|
|
2045
2076
|
* @example
|
|
2046
|
-
* faker.
|
|
2047
|
-
* faker.string.numeric(5) // '31507'
|
|
2048
|
-
* faker.string.numeric(42) // '06434563150765416546479875435481513188548'
|
|
2049
|
-
* faker.string.numeric({ length: { min: 5, max: 10 } }) // '197089478'
|
|
2050
|
-
* faker.string.numeric({ length: 42, allowLeadingZeros: false }) // '72564846278453876543517840713421451546115'
|
|
2051
|
-
* faker.string.numeric({ length: 6, exclude: ['0'] }) // '943228'
|
|
2077
|
+
* faker.finance.transactionType() // 'payment'
|
|
2052
2078
|
*
|
|
2053
|
-
* @since
|
|
2079
|
+
* @since 2.0.1
|
|
2054
2080
|
*/
|
|
2055
|
-
|
|
2056
|
-
/**
|
|
2057
|
-
* The length of the string to generate either as a fixed length or as a length range.
|
|
2058
|
-
*
|
|
2059
|
-
* @default 1
|
|
2060
|
-
*/
|
|
2061
|
-
length?: number | {
|
|
2062
|
-
/**
|
|
2063
|
-
* The minimum length of the string to generate.
|
|
2064
|
-
*/
|
|
2065
|
-
min: number;
|
|
2066
|
-
/**
|
|
2067
|
-
* The maximum length of the string to generate.
|
|
2068
|
-
*/
|
|
2069
|
-
max: number;
|
|
2070
|
-
};
|
|
2071
|
-
/**
|
|
2072
|
-
* Whether leading zeros are allowed or not.
|
|
2073
|
-
*
|
|
2074
|
-
* @default true
|
|
2075
|
-
*/
|
|
2076
|
-
allowLeadingZeros?: boolean;
|
|
2077
|
-
/**
|
|
2078
|
-
* An array of digits which should be excluded in the generated string.
|
|
2079
|
-
*
|
|
2080
|
-
* @default []
|
|
2081
|
-
*/
|
|
2082
|
-
exclude?: ReadonlyArray<LiteralUnion<NumericChar>> | string;
|
|
2083
|
-
}): string;
|
|
2081
|
+
transactionType(): string;
|
|
2084
2082
|
/**
|
|
2085
|
-
* Returns a
|
|
2083
|
+
* Returns a random currency object, containing `code`, `name`, `symbol`, and `numericCode` properties.
|
|
2086
2084
|
*
|
|
2087
|
-
* @
|
|
2088
|
-
* @
|
|
2089
|
-
* @
|
|
2085
|
+
* @see faker.finance.currencyCode(): For generating specifically the currency code.
|
|
2086
|
+
* @see faker.finance.currencyName(): For generating specifically the currency name.
|
|
2087
|
+
* @see faker.finance.currencySymbol(): For generating specifically the currency symbol.
|
|
2088
|
+
* @see faker.finance.currencyNumericCode(): For generating specifically the currency numeric code.
|
|
2090
2089
|
*
|
|
2091
2090
|
* @example
|
|
2092
|
-
* faker.
|
|
2093
|
-
* faker.string.sample(5) // '6Bye8'
|
|
2094
|
-
* faker.string.sample({ min: 5, max: 10 }) // 'FeKunG'
|
|
2091
|
+
* faker.finance.currency() // { code: 'USD', name: 'US Dollar', symbol: '$', numericCode: '840' }
|
|
2095
2092
|
*
|
|
2096
2093
|
* @since 8.0.0
|
|
2097
2094
|
*/
|
|
2098
|
-
|
|
2099
|
-
/**
|
|
2100
|
-
* The minimum length of the string to generate.
|
|
2101
|
-
*/
|
|
2102
|
-
min: number;
|
|
2103
|
-
/**
|
|
2104
|
-
* The maximum length of the string to generate.
|
|
2105
|
-
*/
|
|
2106
|
-
max: number;
|
|
2107
|
-
}): string;
|
|
2095
|
+
currency(): Currency;
|
|
2108
2096
|
/**
|
|
2109
|
-
* Returns a
|
|
2097
|
+
* Returns a random currency code.
|
|
2098
|
+
* (The short text/abbreviation for the currency (e.g. `US Dollar` -> `USD`))
|
|
2110
2099
|
*
|
|
2111
2100
|
* @example
|
|
2112
|
-
* faker.
|
|
2101
|
+
* faker.finance.currencyCode() // 'USD'
|
|
2113
2102
|
*
|
|
2114
|
-
* @since
|
|
2103
|
+
* @since 2.0.1
|
|
2115
2104
|
*/
|
|
2116
|
-
|
|
2105
|
+
currencyCode(): string;
|
|
2117
2106
|
/**
|
|
2118
|
-
* Returns a
|
|
2119
|
-
*
|
|
2120
|
-
* @param options An options object.
|
|
2121
|
-
* @param options.version The specific UUID version to use.
|
|
2107
|
+
* Returns a random currency name.
|
|
2122
2108
|
*
|
|
2123
2109
|
* @example
|
|
2124
|
-
* faker.
|
|
2110
|
+
* faker.finance.currencyName() // 'US Dollar'
|
|
2125
2111
|
*
|
|
2126
|
-
* @since
|
|
2112
|
+
* @since 2.0.1
|
|
2127
2113
|
*/
|
|
2128
|
-
|
|
2129
|
-
/**
|
|
2130
|
-
* The specific UUID version to use.
|
|
2131
|
-
*/
|
|
2132
|
-
version: 4;
|
|
2133
|
-
}): string;
|
|
2114
|
+
currencyName(): string;
|
|
2134
2115
|
/**
|
|
2135
|
-
* Returns a
|
|
2136
|
-
*
|
|
2137
|
-
* @param options An options object.
|
|
2138
|
-
* @param options.version The specific UUID version to use.
|
|
2139
|
-
* @param options.refDate The timestamp to encode into the uuid.
|
|
2140
|
-
* The encoded timestamp is represented by the first 12 characters of the result.
|
|
2141
|
-
* Defaults to `faker.defaultRefDate()`.
|
|
2116
|
+
* Returns a random currency symbol.
|
|
2142
2117
|
*
|
|
2143
2118
|
* @example
|
|
2144
|
-
* faker.
|
|
2119
|
+
* faker.finance.currencySymbol() // '$'
|
|
2145
2120
|
*
|
|
2146
|
-
* @since
|
|
2121
|
+
* @since 2.0.1
|
|
2147
2122
|
*/
|
|
2148
|
-
|
|
2149
|
-
/**
|
|
2150
|
-
* The specific UUID version to use.
|
|
2151
|
-
*/
|
|
2152
|
-
version: 7;
|
|
2153
|
-
/**
|
|
2154
|
-
* The timestamp to encode into the uuid.
|
|
2155
|
-
* The encoded timestamp is represented by the first 12 characters of the result.
|
|
2156
|
-
*
|
|
2157
|
-
* @default faker.defaultRefDate()
|
|
2158
|
-
*/
|
|
2159
|
-
refDate: string | Date | number;
|
|
2160
|
-
}): string;
|
|
2123
|
+
currencySymbol(): string;
|
|
2161
2124
|
/**
|
|
2162
|
-
* Returns a
|
|
2125
|
+
* Returns a random currency numeric code.
|
|
2126
|
+
* (The ISO 4217 numerical code for a currency (e.g. `US Dollar` -> `840` ))
|
|
2127
|
+
*
|
|
2128
|
+
* @example
|
|
2129
|
+
* faker.finance.currencyNumericCode() // '840'
|
|
2130
|
+
*
|
|
2131
|
+
* @since 9.6.0
|
|
2132
|
+
*/
|
|
2133
|
+
currencyNumericCode(): string;
|
|
2134
|
+
/**
|
|
2135
|
+
* Generates a random Bitcoin address.
|
|
2163
2136
|
*
|
|
2164
2137
|
* @param options An optional options object.
|
|
2165
|
-
* @param options.
|
|
2166
|
-
* @param options.
|
|
2167
|
-
* This parameter is only relevant for UUID v7.
|
|
2168
|
-
* Defaults to `faker.defaultRefDate()`.
|
|
2138
|
+
* @param options.type The bitcoin address type (`'legacy'`, `'segwit'`, `'bech32'` or `'taproot'`). Defaults to a random address type.
|
|
2139
|
+
* @param options.network The bitcoin network (`'mainnet'` or `'testnet'`). Defaults to `'mainnet'`.
|
|
2169
2140
|
*
|
|
2170
2141
|
* @example
|
|
2171
|
-
* faker.
|
|
2172
|
-
* faker.
|
|
2173
|
-
* faker.
|
|
2174
|
-
* faker.string.uuid({ version: 7, refDate: '2020-01-01T00:00:00.000Z' }) // '016f5e66-e800-725e-b078-f413f23aaff0'
|
|
2142
|
+
* faker.finance.bitcoinAddress() // '1TeZEFLmGPLEQrSRdAcnZLoWwYeiHwmRog'
|
|
2143
|
+
* faker.finance.bitcoinAddress({ type: 'bech32' }) // 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4'
|
|
2144
|
+
* faker.finance.bitcoinAddress({ type: 'bech32', network: 'testnet' }) // 'tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx'
|
|
2175
2145
|
*
|
|
2176
|
-
* @since
|
|
2146
|
+
* @since 3.1.0
|
|
2177
2147
|
*/
|
|
2178
|
-
|
|
2148
|
+
bitcoinAddress(options?: {
|
|
2179
2149
|
/**
|
|
2180
|
-
* The
|
|
2150
|
+
* The bitcoin address type (`'legacy'`, `'segwit'`, `'bech32'` or `'taproot'`).
|
|
2151
|
+
*
|
|
2152
|
+
* @default faker.helpers.enumValue(BitcoinAddressFamily)
|
|
2181
2153
|
*/
|
|
2182
|
-
|
|
2154
|
+
type?: BitcoinAddressFamilyType;
|
|
2183
2155
|
/**
|
|
2184
|
-
* The
|
|
2185
|
-
* This parameter is only relevant for UUID v7.
|
|
2156
|
+
* The bitcoin network (`'mainnet'` or `'testnet'`).
|
|
2186
2157
|
*
|
|
2187
|
-
* @default
|
|
2158
|
+
* @default 'mainnet'
|
|
2188
2159
|
*/
|
|
2189
|
-
|
|
2160
|
+
network?: BitcoinNetworkType;
|
|
2190
2161
|
}): string;
|
|
2191
2162
|
/**
|
|
2192
|
-
*
|
|
2163
|
+
* Generates a random Litecoin address.
|
|
2193
2164
|
*
|
|
2194
|
-
* @
|
|
2195
|
-
*
|
|
2196
|
-
*
|
|
2197
|
-
*
|
|
2165
|
+
* @example
|
|
2166
|
+
* faker.finance.litecoinAddress() // 'MoQaSTGWBRXkWfyxKbNKuPrAWGELzcW'
|
|
2167
|
+
*
|
|
2168
|
+
* @since 5.0.0
|
|
2169
|
+
*/
|
|
2170
|
+
litecoinAddress(): string;
|
|
2171
|
+
/**
|
|
2172
|
+
* Generates a random credit card number.
|
|
2173
|
+
*
|
|
2174
|
+
* @param issuer The name of the issuer (case-insensitive) or the format used to generate one.
|
|
2198
2175
|
*
|
|
2199
2176
|
* @example
|
|
2200
|
-
* faker.
|
|
2201
|
-
* faker.
|
|
2177
|
+
* faker.finance.creditCardNumber() // '4427163488662'
|
|
2178
|
+
* faker.finance.creditCardNumber('visa') // '4882664999007'
|
|
2179
|
+
* faker.finance.creditCardNumber('63[7-9]#-####-####-###L') // '6375-3265-4676-6646'
|
|
2202
2180
|
*
|
|
2203
|
-
* @since
|
|
2181
|
+
* @since 5.0.0
|
|
2204
2182
|
*/
|
|
2205
|
-
|
|
2206
|
-
/**
|
|
2207
|
-
* The date to use as reference point for the newly generated ULID encoded timestamp.
|
|
2208
|
-
* The encoded timestamp is represented by the first 10 characters of the result.
|
|
2209
|
-
*
|
|
2210
|
-
* @default faker.defaultRefDate()
|
|
2211
|
-
*/
|
|
2212
|
-
refDate?: string | Date | number;
|
|
2213
|
-
}): string;
|
|
2183
|
+
creditCardNumber(issuer?: string): string;
|
|
2214
2184
|
/**
|
|
2215
|
-
* Generates a
|
|
2185
|
+
* Generates a random credit card number.
|
|
2216
2186
|
*
|
|
2217
|
-
* @param
|
|
2218
|
-
* @param
|
|
2219
|
-
* @param length.max The maximum length of the Nano ID to generate.
|
|
2187
|
+
* @param options An options object.
|
|
2188
|
+
* @param options.issuer The name of the issuer (case-insensitive) or the format used to generate one. Defaults to `''`.
|
|
2220
2189
|
*
|
|
2221
2190
|
* @example
|
|
2222
|
-
* faker.
|
|
2223
|
-
* faker.
|
|
2224
|
-
* faker.
|
|
2191
|
+
* faker.finance.creditCardNumber() // '4427163488662'
|
|
2192
|
+
* faker.finance.creditCardNumber({ issuer: 'visa' }) // '4882664999007'
|
|
2193
|
+
* faker.finance.creditCardNumber({ issuer: '63[7-9]#-####-####-###L' }) // '6375-3265-4676-6646'
|
|
2225
2194
|
*
|
|
2226
|
-
* @since
|
|
2195
|
+
* @since 5.0.0
|
|
2227
2196
|
*/
|
|
2228
|
-
|
|
2229
|
-
/**
|
|
2230
|
-
* The minimum length of the Nano ID to generate.
|
|
2231
|
-
*/
|
|
2232
|
-
min: number;
|
|
2197
|
+
creditCardNumber(options?: {
|
|
2233
2198
|
/**
|
|
2234
|
-
* The
|
|
2199
|
+
* The name of the issuer (case-insensitive) or the format used to generate one.
|
|
2200
|
+
*
|
|
2201
|
+
* @default ''
|
|
2235
2202
|
*/
|
|
2236
|
-
|
|
2203
|
+
issuer?: string;
|
|
2237
2204
|
}): string;
|
|
2238
2205
|
/**
|
|
2239
|
-
*
|
|
2240
|
-
*
|
|
2241
|
-
* ```txt
|
|
2242
|
-
* ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~
|
|
2243
|
-
* ```
|
|
2206
|
+
* Generates a random credit card number.
|
|
2244
2207
|
*
|
|
2245
|
-
* @param
|
|
2246
|
-
* @param
|
|
2247
|
-
* @param length.max The maximum length of the string to generate.
|
|
2208
|
+
* @param options An options object, the issuer or a custom format.
|
|
2209
|
+
* @param options.issuer The name of the issuer (case-insensitive) or the format used to generate one. Defaults to `''`.
|
|
2248
2210
|
*
|
|
2249
2211
|
* @example
|
|
2250
|
-
* faker.
|
|
2251
|
-
* faker.
|
|
2252
|
-
* faker.
|
|
2212
|
+
* faker.finance.creditCardNumber() // '4427163488662'
|
|
2213
|
+
* faker.finance.creditCardNumber({ issuer: 'visa' }) // '4882664999007'
|
|
2214
|
+
* faker.finance.creditCardNumber({ issuer: '63[7-9]#-####-####-###L' }) // '6375-3265-4676-6646'
|
|
2215
|
+
* faker.finance.creditCardNumber('visa') // '1226423499765'
|
|
2253
2216
|
*
|
|
2254
|
-
* @since
|
|
2217
|
+
* @since 5.0.0
|
|
2255
2218
|
*/
|
|
2256
|
-
|
|
2257
|
-
/**
|
|
2258
|
-
* The minimum length of the string to generate.
|
|
2259
|
-
*/
|
|
2260
|
-
min: number;
|
|
2219
|
+
creditCardNumber(options?: string | {
|
|
2261
2220
|
/**
|
|
2262
|
-
* The
|
|
2221
|
+
* The name of the issuer (case-insensitive) or the format used to generate one.
|
|
2222
|
+
*
|
|
2223
|
+
* @default ''
|
|
2263
2224
|
*/
|
|
2264
|
-
|
|
2225
|
+
issuer?: string;
|
|
2265
2226
|
}): string;
|
|
2266
|
-
}
|
|
2267
|
-
/**
|
|
2268
|
-
* The bitcoin address families.
|
|
2269
|
-
*/
|
|
2270
|
-
declare enum BitcoinAddressFamily {
|
|
2271
|
-
Legacy = "legacy",
|
|
2272
|
-
Segwit = "segwit",
|
|
2273
|
-
Bech32 = "bech32",
|
|
2274
|
-
Taproot = "taproot"
|
|
2275
|
-
}
|
|
2276
|
-
/**
|
|
2277
|
-
* The bitcoin address families.
|
|
2278
|
-
*/
|
|
2279
|
-
type BitcoinAddressFamilyType = `${BitcoinAddressFamily}`;
|
|
2280
|
-
/**
|
|
2281
|
-
* The different bitcoin networks.
|
|
2282
|
-
*/
|
|
2283
|
-
declare enum BitcoinNetwork {
|
|
2284
|
-
Mainnet = "mainnet",
|
|
2285
|
-
Testnet = "testnet"
|
|
2286
|
-
}
|
|
2287
|
-
/**
|
|
2288
|
-
* The different bitcoin networks.
|
|
2289
|
-
*/
|
|
2290
|
-
type BitcoinNetworkType = `${BitcoinNetwork}`;
|
|
2291
|
-
/**
|
|
2292
|
-
* The possible definitions related to currency entries.
|
|
2293
|
-
*/
|
|
2294
|
-
interface Currency {
|
|
2295
|
-
/**
|
|
2296
|
-
* The full name for the currency (e.g. `US Dollar`).
|
|
2297
|
-
*/
|
|
2298
|
-
name: string;
|
|
2299
|
-
/**
|
|
2300
|
-
* The code/short text/abbreviation for the currency (e.g. `USD`).
|
|
2301
|
-
*/
|
|
2302
|
-
code: string;
|
|
2303
2227
|
/**
|
|
2304
|
-
*
|
|
2228
|
+
* Generates a random credit card CVV.
|
|
2229
|
+
*
|
|
2230
|
+
* @example
|
|
2231
|
+
* faker.finance.creditCardCVV() // '506'
|
|
2232
|
+
*
|
|
2233
|
+
* @since 5.0.0
|
|
2305
2234
|
*/
|
|
2306
|
-
|
|
2235
|
+
creditCardCVV(): string;
|
|
2307
2236
|
/**
|
|
2308
|
-
*
|
|
2237
|
+
* Returns a random credit card issuer.
|
|
2238
|
+
*
|
|
2239
|
+
* @example
|
|
2240
|
+
* faker.finance.creditCardIssuer() // 'discover'
|
|
2241
|
+
*
|
|
2242
|
+
* @since 6.3.0
|
|
2309
2243
|
*/
|
|
2310
|
-
|
|
2311
|
-
}
|
|
2312
|
-
/**
|
|
2313
|
-
* Module to generate finance and money related entries.
|
|
2314
|
-
*
|
|
2315
|
-
* ### Overview
|
|
2316
|
-
*
|
|
2317
|
-
* For a random amount, use [`amount()`](https://fakerjs.dev/api/finance.html#amount).
|
|
2318
|
-
*
|
|
2319
|
-
* For traditional bank accounts, use: [`accountNumber()`](https://fakerjs.dev/api/finance.html#accountnumber), [`accountName()`](https://fakerjs.dev/api/finance.html#accountname), [`bic()`](https://fakerjs.dev/api/finance.html#bic), [`iban()`](https://fakerjs.dev/api/finance.html#iban), [`pin()`](https://fakerjs.dev/api/finance.html#pin) and [`routingNumber()`](https://fakerjs.dev/api/finance.html#routingnumber).
|
|
2320
|
-
*
|
|
2321
|
-
* For credit card related methods, use: [`creditCardNumber()`](https://fakerjs.dev/api/finance.html#creditcardnumber), [`creditCardCVV()`](https://fakerjs.dev/api/finance.html#creditcardcvv), [`creditCardIssuer()`](https://fakerjs.dev/api/finance.html#creditcardissuer), [`transactionDescription()`](https://fakerjs.dev/api/finance.html#transactiondescription) and [`transactionType()`](https://fakerjs.dev/api/finance.html#transactiontype).
|
|
2322
|
-
*
|
|
2323
|
-
* For blockchain related methods, use: [`bitcoinAddress()`](https://fakerjs.dev/api/finance.html#bitcoinaddress), [`ethereumAddress()`](https://fakerjs.dev/api/finance.html#ethereumaddress) and [`litecoinAddress()`](https://fakerjs.dev/api/finance.html#litecoinaddress).
|
|
2324
|
-
*/
|
|
2325
|
-
declare class FinanceModule extends ModuleBase {
|
|
2244
|
+
creditCardIssuer(): string;
|
|
2326
2245
|
/**
|
|
2327
|
-
* Generates a random
|
|
2246
|
+
* Generates a random PIN number.
|
|
2328
2247
|
*
|
|
2329
|
-
* @param length The length of the
|
|
2248
|
+
* @param length The length of the PIN to generate. Defaults to `4`.
|
|
2330
2249
|
*
|
|
2331
|
-
* @
|
|
2250
|
+
* @throws {FakerError} Will throw an error if length is less than 1.
|
|
2251
|
+
*
|
|
2252
|
+
* @see faker.string.numeric(): For generating the pin with greater control.
|
|
2332
2253
|
*
|
|
2333
2254
|
* @example
|
|
2334
|
-
* faker.finance.
|
|
2335
|
-
* faker.finance.
|
|
2255
|
+
* faker.finance.pin() // '5067'
|
|
2256
|
+
* faker.finance.pin(6) // '213789'
|
|
2336
2257
|
*
|
|
2337
|
-
* @since
|
|
2258
|
+
* @since 6.2.0
|
|
2338
2259
|
*/
|
|
2339
|
-
|
|
2260
|
+
pin(length?: number): string;
|
|
2340
2261
|
/**
|
|
2341
|
-
* Generates a random
|
|
2262
|
+
* Generates a random PIN number.
|
|
2342
2263
|
*
|
|
2343
2264
|
* @param options An options object.
|
|
2344
|
-
* @param options.length The length of the
|
|
2265
|
+
* @param options.length The length of the PIN to generate. Defaults to `4`.
|
|
2345
2266
|
*
|
|
2346
|
-
* @
|
|
2267
|
+
* @throws {FakerError} Will throw an error if length is less than 1.
|
|
2268
|
+
*
|
|
2269
|
+
* @see faker.string.numeric(): For generating the pin with greater control.
|
|
2347
2270
|
*
|
|
2348
2271
|
* @example
|
|
2349
|
-
* faker.finance.
|
|
2350
|
-
* faker.finance.
|
|
2272
|
+
* faker.finance.pin() // '5067'
|
|
2273
|
+
* faker.finance.pin({ length: 6 }) // '213789'
|
|
2351
2274
|
*
|
|
2352
|
-
* @since
|
|
2275
|
+
* @since 6.2.0
|
|
2353
2276
|
*/
|
|
2354
|
-
|
|
2277
|
+
pin(options?: {
|
|
2355
2278
|
/**
|
|
2356
|
-
* The length of the
|
|
2279
|
+
* The length of the PIN to generate.
|
|
2357
2280
|
*
|
|
2358
|
-
* @default
|
|
2281
|
+
* @default 4
|
|
2359
2282
|
*/
|
|
2360
2283
|
length?: number;
|
|
2361
2284
|
}): string;
|
|
2362
2285
|
/**
|
|
2363
|
-
* Generates a random
|
|
2364
|
-
*
|
|
2365
|
-
* @param optionsOrLength An options object or the length of the account number.
|
|
2366
|
-
* @param optionsOrLength.length The length of the account number. Defaults to `8`.
|
|
2286
|
+
* Generates a random PIN number.
|
|
2367
2287
|
*
|
|
2368
|
-
* @
|
|
2288
|
+
* @param options An options object or the length of the PIN.
|
|
2289
|
+
* @param options.length The length of the PIN to generate. Defaults to `4`.
|
|
2290
|
+
*
|
|
2291
|
+
* @throws {FakerError} Will throw an error if length is less than 1.
|
|
2292
|
+
*
|
|
2293
|
+
* @see faker.string.numeric(): For generating the pin with greater control.
|
|
2369
2294
|
*
|
|
2370
2295
|
* @example
|
|
2371
|
-
* faker.finance.
|
|
2372
|
-
* faker.finance.
|
|
2373
|
-
* faker.finance.
|
|
2296
|
+
* faker.finance.pin() // '5067'
|
|
2297
|
+
* faker.finance.pin({ length: 6 }) // '213789'
|
|
2298
|
+
* faker.finance.pin(6) // '213789'
|
|
2374
2299
|
*
|
|
2375
|
-
* @since
|
|
2300
|
+
* @since 6.2.0
|
|
2376
2301
|
*/
|
|
2377
|
-
|
|
2302
|
+
pin(options?: number | {
|
|
2378
2303
|
/**
|
|
2379
|
-
* The length of the
|
|
2304
|
+
* The length of the PIN to generate.
|
|
2380
2305
|
*
|
|
2381
|
-
* @default
|
|
2306
|
+
* @default 4
|
|
2382
2307
|
*/
|
|
2383
2308
|
length?: number;
|
|
2384
2309
|
}): string;
|
|
2385
2310
|
/**
|
|
2386
|
-
*
|
|
2387
|
-
*
|
|
2388
|
-
* @example
|
|
2389
|
-
* faker.finance.accountName() // 'Personal Loan Account'
|
|
2311
|
+
* Creates a random, non-checksum Ethereum address.
|
|
2390
2312
|
*
|
|
2391
|
-
*
|
|
2392
|
-
*/
|
|
2393
|
-
accountName(): string;
|
|
2394
|
-
/**
|
|
2395
|
-
* Generates a random routing number.
|
|
2313
|
+
* To generate a checksummed Ethereum address (with specific per character casing), wrap this method in a custom method and use third-party libraries to transform the result.
|
|
2396
2314
|
*
|
|
2397
2315
|
* @example
|
|
2398
|
-
* faker.finance.
|
|
2316
|
+
* faker.finance.ethereumAddress() // '0xf03dfeecbafc5147241cc4c4ca20b3c9dfd04c4a'
|
|
2399
2317
|
*
|
|
2400
2318
|
* @since 5.0.0
|
|
2401
2319
|
*/
|
|
2402
|
-
|
|
2320
|
+
ethereumAddress(): string;
|
|
2403
2321
|
/**
|
|
2404
|
-
* Generates a random
|
|
2322
|
+
* Generates a random IBAN.
|
|
2323
|
+
*
|
|
2324
|
+
* Please note that the generated IBAN might be invalid due to randomly generated bank codes/other country specific validation rules.
|
|
2405
2325
|
*
|
|
2406
2326
|
* @param options An options object.
|
|
2407
|
-
* @param options.
|
|
2408
|
-
* @param options.
|
|
2409
|
-
* @param options.dec The number of decimal places for the amount. Defaults to `2`.
|
|
2410
|
-
* @param options.symbol The symbol used to prefix the amount. Defaults to `''`.
|
|
2411
|
-
* @param options.autoFormat If true this method will use `Number.toLocaleString()`. Otherwise it will use `Number.toFixed()`.
|
|
2327
|
+
* @param options.formatted Return a formatted version of the generated IBAN. Defaults to `false`.
|
|
2328
|
+
* @param options.countryCode The country code from which you want to generate an IBAN, if none is provided a random country will be used.
|
|
2412
2329
|
*
|
|
2413
|
-
* @
|
|
2330
|
+
* @throws {FakerError} Will throw an error if the passed country code is not supported.
|
|
2414
2331
|
*
|
|
2415
2332
|
* @example
|
|
2416
|
-
* faker.finance.
|
|
2417
|
-
* faker.finance.
|
|
2418
|
-
* faker.finance.
|
|
2419
|
-
* faker.finance.amount({ min: 5, max: 10, dec: 2, symbol: '$' }) // '$5.85'
|
|
2420
|
-
* faker.finance.amount({ min: 5, max: 10, dec: 5, symbol: '', autoFormat: true }) // '9,75067'
|
|
2333
|
+
* faker.finance.iban() // 'TR736918640040966092800056'
|
|
2334
|
+
* faker.finance.iban({ formatted: true }) // 'FR20 8008 2330 8984 74S3 Z620 224'
|
|
2335
|
+
* faker.finance.iban({ formatted: true, countryCode: 'DE' }) // 'DE84 1022 7075 0900 1170 01'
|
|
2421
2336
|
*
|
|
2422
|
-
* @since
|
|
2337
|
+
* @since 4.0.0
|
|
2423
2338
|
*/
|
|
2424
|
-
|
|
2425
|
-
/**
|
|
2426
|
-
* The lower bound for the amount.
|
|
2427
|
-
*
|
|
2428
|
-
* @default 0
|
|
2429
|
-
*/
|
|
2430
|
-
min?: number;
|
|
2431
|
-
/**
|
|
2432
|
-
* The upper bound for the amount.
|
|
2433
|
-
*
|
|
2434
|
-
* @default 1000
|
|
2435
|
-
*/
|
|
2436
|
-
max?: number;
|
|
2339
|
+
iban(options?: {
|
|
2437
2340
|
/**
|
|
2438
|
-
*
|
|
2341
|
+
* Return a formatted version of the generated IBAN.
|
|
2439
2342
|
*
|
|
2440
|
-
* @default
|
|
2343
|
+
* @default false
|
|
2441
2344
|
*/
|
|
2442
|
-
|
|
2345
|
+
formatted?: boolean;
|
|
2443
2346
|
/**
|
|
2444
|
-
* The
|
|
2445
|
-
*
|
|
2446
|
-
* @default ''
|
|
2347
|
+
* The country code from which you want to generate an IBAN,
|
|
2348
|
+
* if none is provided a random country will be used.
|
|
2447
2349
|
*/
|
|
2448
|
-
|
|
2350
|
+
countryCode?: string;
|
|
2351
|
+
}): string;
|
|
2352
|
+
/**
|
|
2353
|
+
* Generates a random SWIFT/BIC code based on the [ISO-9362](https://en.wikipedia.org/wiki/ISO_9362) format.
|
|
2354
|
+
*
|
|
2355
|
+
* @param options Options object.
|
|
2356
|
+
* @param options.includeBranchCode Whether to include a three-digit branch code at the end of the generated code. Defaults to a random boolean value.
|
|
2357
|
+
*
|
|
2358
|
+
* @example
|
|
2359
|
+
* faker.finance.bic() // 'WYAUPGX1'
|
|
2360
|
+
* faker.finance.bic({ includeBranchCode: true }) // 'KCAUPGR1432'
|
|
2361
|
+
* faker.finance.bic({ includeBranchCode: false }) // 'XDAFQGT7'
|
|
2362
|
+
*
|
|
2363
|
+
* @since 4.0.0
|
|
2364
|
+
*/
|
|
2365
|
+
bic(options?: {
|
|
2449
2366
|
/**
|
|
2450
|
-
*
|
|
2367
|
+
* Whether to include a three-digit branch code at the end of the generated code.
|
|
2451
2368
|
*
|
|
2452
|
-
* @default
|
|
2369
|
+
* @default faker.datatype.boolean()
|
|
2453
2370
|
*/
|
|
2454
|
-
|
|
2371
|
+
includeBranchCode?: boolean;
|
|
2455
2372
|
}): string;
|
|
2456
2373
|
/**
|
|
2457
|
-
*
|
|
2374
|
+
* Generates a random transaction description.
|
|
2458
2375
|
*
|
|
2459
2376
|
* @example
|
|
2460
|
-
* faker.finance.
|
|
2377
|
+
* faker.finance.transactionDescription()
|
|
2378
|
+
* // 'payment transaction at Emard LLC using card ending with ****9187 for HNL 506.57 in account ***2584.'
|
|
2461
2379
|
*
|
|
2462
|
-
* @since
|
|
2380
|
+
* @since 5.1.0
|
|
2463
2381
|
*/
|
|
2464
|
-
|
|
2382
|
+
transactionDescription(): string;
|
|
2383
|
+
}
|
|
2384
|
+
//#endregion
|
|
2385
|
+
//#region src/modules/food/index.d.ts
|
|
2386
|
+
/**
|
|
2387
|
+
* Module for generating food-related data.
|
|
2388
|
+
*
|
|
2389
|
+
* ### Overview
|
|
2390
|
+
*
|
|
2391
|
+
* This module provides methods to generate various food-related information, such as items on a menu.
|
|
2392
|
+
* To generate the name of a dish, use [`dish()`](https://fakerjs.dev/api/food.html#dish) and to generate a long description for a dish use [`description()`](https://fakerjs.dev/api/food.html#description). Note that these will not correspond with each other.
|
|
2393
|
+
* You can also generate individual components of a dish such as [spices](https://fakerjs.dev/api/food.html#spice), [vegetables](https://fakerjs.dev/api/food.html#vegetable), [meats](https://fakerjs.dev/api/food.html#meat), [fruits](https://fakerjs.dev/api/food.html#fruit), or generic [ingredients](https://fakerjs.dev/api/food.html#ingredient).
|
|
2394
|
+
*/
|
|
2395
|
+
declare class FoodModule extends ModuleBase {
|
|
2465
2396
|
/**
|
|
2466
|
-
*
|
|
2467
|
-
*
|
|
2468
|
-
* @see faker.finance.currencyCode(): For generating specifically the currency code.
|
|
2469
|
-
* @see faker.finance.currencyName(): For generating specifically the currency name.
|
|
2470
|
-
* @see faker.finance.currencySymbol(): For generating specifically the currency symbol.
|
|
2471
|
-
* @see faker.finance.currencyNumericCode(): For generating specifically the currency numeric code.
|
|
2397
|
+
* Generates a random dish adjective.
|
|
2472
2398
|
*
|
|
2473
2399
|
* @example
|
|
2474
|
-
* faker.
|
|
2400
|
+
* faker.food.adjective() // 'crispy'
|
|
2475
2401
|
*
|
|
2476
|
-
* @since
|
|
2402
|
+
* @since 9.0.0
|
|
2477
2403
|
*/
|
|
2478
|
-
|
|
2404
|
+
adjective(): string;
|
|
2479
2405
|
/**
|
|
2480
|
-
*
|
|
2481
|
-
* (The short text/abbreviation for the currency (e.g. `US Dollar` -> `USD`))
|
|
2406
|
+
* Generates a random dish description.
|
|
2482
2407
|
*
|
|
2483
2408
|
* @example
|
|
2484
|
-
* faker.
|
|
2409
|
+
* faker.food.description() // 'An exquisite ostrich roast, infused with the essence of longan, slow-roasted to bring out its natural flavors and served with a side of creamy red cabbage'
|
|
2485
2410
|
*
|
|
2486
|
-
* @since
|
|
2411
|
+
* @since 9.0.0
|
|
2487
2412
|
*/
|
|
2488
|
-
|
|
2413
|
+
description(): string;
|
|
2489
2414
|
/**
|
|
2490
|
-
*
|
|
2415
|
+
* Generates a random dish name.
|
|
2491
2416
|
*
|
|
2492
2417
|
* @example
|
|
2493
|
-
* faker.
|
|
2418
|
+
* faker.food.dish() // 'Tagine-Rubbed Venison Salad'
|
|
2494
2419
|
*
|
|
2495
|
-
* @since
|
|
2420
|
+
* @since 9.0.0
|
|
2496
2421
|
*/
|
|
2497
|
-
|
|
2422
|
+
dish(): string;
|
|
2498
2423
|
/**
|
|
2499
|
-
*
|
|
2424
|
+
* Generates a random food's ethnic category.
|
|
2500
2425
|
*
|
|
2501
2426
|
* @example
|
|
2502
|
-
* faker.
|
|
2427
|
+
* faker.food.ethnicCategory() // 'Italian'
|
|
2503
2428
|
*
|
|
2504
|
-
* @since
|
|
2429
|
+
* @since 9.0.0
|
|
2505
2430
|
*/
|
|
2506
|
-
|
|
2431
|
+
ethnicCategory(): string;
|
|
2507
2432
|
/**
|
|
2508
|
-
*
|
|
2509
|
-
* (The ISO 4217 numerical code for a currency (e.g. `US Dollar` -> `840` ))
|
|
2433
|
+
* Generates a random fruit name.
|
|
2510
2434
|
*
|
|
2511
2435
|
* @example
|
|
2512
|
-
* faker.
|
|
2436
|
+
* faker.food.fruit() // 'lemon'
|
|
2513
2437
|
*
|
|
2514
|
-
* @since 9.
|
|
2438
|
+
* @since 9.0.0
|
|
2515
2439
|
*/
|
|
2516
|
-
|
|
2440
|
+
fruit(): string;
|
|
2517
2441
|
/**
|
|
2518
|
-
* Generates a random
|
|
2519
|
-
*
|
|
2520
|
-
* @param options An optional options object.
|
|
2521
|
-
* @param options.type The bitcoin address type (`'legacy'`, `'sewgit'`, `'bech32'` or `'taproot'`). Defaults to a random address type.
|
|
2522
|
-
* @param options.network The bitcoin network (`'mainnet'` or `'testnet'`). Defaults to `'mainnet'`.
|
|
2442
|
+
* Generates a random ingredient name.
|
|
2523
2443
|
*
|
|
2524
2444
|
* @example
|
|
2525
|
-
* faker.
|
|
2526
|
-
* faker.finance.bitcoinAddress({ type: 'bech32' }) // 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4'
|
|
2527
|
-
* faker.finance.bitcoinAddress({ type: 'bech32', network: 'testnet' }) // 'tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx'
|
|
2445
|
+
* faker.food.ingredient() // 'butter'
|
|
2528
2446
|
*
|
|
2529
|
-
* @since
|
|
2447
|
+
* @since 9.0.0
|
|
2530
2448
|
*/
|
|
2531
|
-
|
|
2532
|
-
/**
|
|
2533
|
-
* The bitcoin address type (`'legacy'`, `'sewgit'`, `'bech32'` or `'taproot'`).
|
|
2534
|
-
*
|
|
2535
|
-
* @default faker.helpers.arrayElement(['legacy','sewgit','bech32','taproot'])
|
|
2536
|
-
*/
|
|
2537
|
-
type?: BitcoinAddressFamilyType;
|
|
2538
|
-
/**
|
|
2539
|
-
* The bitcoin network (`'mainnet'` or `'testnet'`).
|
|
2540
|
-
*
|
|
2541
|
-
* @default 'mainnet'
|
|
2542
|
-
*/
|
|
2543
|
-
network?: BitcoinNetworkType;
|
|
2544
|
-
}): string;
|
|
2449
|
+
ingredient(): string;
|
|
2545
2450
|
/**
|
|
2546
|
-
* Generates a random
|
|
2451
|
+
* Generates a random meat.
|
|
2547
2452
|
*
|
|
2548
2453
|
* @example
|
|
2549
|
-
* faker.
|
|
2454
|
+
* faker.food.meat() // 'venison'
|
|
2550
2455
|
*
|
|
2551
|
-
* @since
|
|
2456
|
+
* @since 9.0.0
|
|
2552
2457
|
*/
|
|
2553
|
-
|
|
2458
|
+
meat(): string;
|
|
2554
2459
|
/**
|
|
2555
|
-
* Generates a random
|
|
2556
|
-
*
|
|
2557
|
-
* @param issuer The name of the issuer (case-insensitive) or the format used to generate one.
|
|
2460
|
+
* Generates a random spice name.
|
|
2558
2461
|
*
|
|
2559
2462
|
* @example
|
|
2560
|
-
* faker.
|
|
2561
|
-
* faker.finance.creditCardNumber('visa') // '4882664999007'
|
|
2562
|
-
* faker.finance.creditCardNumber('63[7-9]#-####-####-###L') // '6375-3265-4676-6646'
|
|
2463
|
+
* faker.food.spice() // 'chilli'
|
|
2563
2464
|
*
|
|
2564
|
-
* @since
|
|
2465
|
+
* @since 9.0.0
|
|
2565
2466
|
*/
|
|
2566
|
-
|
|
2467
|
+
spice(): string;
|
|
2567
2468
|
/**
|
|
2568
|
-
* Generates a random
|
|
2569
|
-
*
|
|
2570
|
-
* @param options An options object.
|
|
2571
|
-
* @param options.issuer The name of the issuer (case-insensitive) or the format used to generate one. Defaults to `''`.
|
|
2469
|
+
* Generates a random vegetable name.
|
|
2572
2470
|
*
|
|
2573
2471
|
* @example
|
|
2574
|
-
* faker.
|
|
2575
|
-
* faker.finance.creditCardNumber({ issuer: 'visa' }) // '4882664999007'
|
|
2576
|
-
* faker.finance.creditCardNumber({ issuer: '63[7-9]#-####-####-###L' }) // '6375-3265-4676-6646'
|
|
2472
|
+
* faker.food.vegetable() // 'broccoli'
|
|
2577
2473
|
*
|
|
2578
|
-
* @since
|
|
2474
|
+
* @since 9.0.0
|
|
2579
2475
|
*/
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2476
|
+
vegetable(): string;
|
|
2477
|
+
}
|
|
2478
|
+
//#endregion
|
|
2479
|
+
//#region src/modules/git/index.d.ts
|
|
2480
|
+
/**
|
|
2481
|
+
* Module to generate git related entries.
|
|
2482
|
+
*
|
|
2483
|
+
* ### Overview
|
|
2484
|
+
*
|
|
2485
|
+
* [`commitEntry()`](https://fakerjs.dev/api/git.html#commitentry) generates a random commit entry as printed by `git log`. This includes a commit hash [`commitSha()`](https://fakerjs.dev/api/git.html#commitsha), author, date [`commitDate()`](https://fakerjs.dev/api/git.html#commitdate), and commit message [`commitMessage()`](https://fakerjs.dev/api/git.html#commitmessage). You can also generate a random branch name with [`branch()`](https://fakerjs.dev/api/git.html#branch).
|
|
2486
|
+
*/
|
|
2487
|
+
declare class GitModule extends ModuleBase {
|
|
2588
2488
|
/**
|
|
2589
|
-
* Generates a random
|
|
2590
|
-
*
|
|
2591
|
-
* @param options An options object, the issuer or a custom format.
|
|
2592
|
-
* @param options.issuer The name of the issuer (case-insensitive) or the format used to generate one. Defaults to `''`.
|
|
2489
|
+
* Generates a random branch name.
|
|
2593
2490
|
*
|
|
2594
2491
|
* @example
|
|
2595
|
-
* faker.
|
|
2596
|
-
* faker.finance.creditCardNumber({ issuer: 'visa' }) // '4882664999007'
|
|
2597
|
-
* faker.finance.creditCardNumber({ issuer: '63[7-9]#-####-####-###L' }) // '6375-3265-4676-6646'
|
|
2598
|
-
* faker.finance.creditCardNumber('visa') // '1226423499765'
|
|
2492
|
+
* faker.git.branch() // 'feed-parse'
|
|
2599
2493
|
*
|
|
2600
2494
|
* @since 5.0.0
|
|
2601
2495
|
*/
|
|
2602
|
-
|
|
2603
|
-
/**
|
|
2604
|
-
* The name of the issuer (case-insensitive) or the format used to generate one.
|
|
2605
|
-
*
|
|
2606
|
-
* @default ''
|
|
2607
|
-
*/
|
|
2608
|
-
issuer?: string;
|
|
2609
|
-
}): string;
|
|
2610
|
-
/**
|
|
2611
|
-
* Generates a random credit card CVV.
|
|
2612
|
-
*
|
|
2613
|
-
* @example
|
|
2614
|
-
* faker.finance.creditCardCVV() // '506'
|
|
2615
|
-
*
|
|
2616
|
-
* @since 5.0.0
|
|
2617
|
-
*/
|
|
2618
|
-
creditCardCVV(): string;
|
|
2619
|
-
/**
|
|
2620
|
-
* Returns a random credit card issuer.
|
|
2621
|
-
*
|
|
2622
|
-
* @example
|
|
2623
|
-
* faker.finance.creditCardIssuer() // 'discover'
|
|
2624
|
-
*
|
|
2625
|
-
* @since 6.3.0
|
|
2626
|
-
*/
|
|
2627
|
-
creditCardIssuer(): string;
|
|
2628
|
-
/**
|
|
2629
|
-
* Generates a random PIN number.
|
|
2630
|
-
*
|
|
2631
|
-
* @param length The length of the PIN to generate. Defaults to `4`.
|
|
2632
|
-
*
|
|
2633
|
-
* @throws {FakerError} Will throw an error if length is less than 1.
|
|
2634
|
-
*
|
|
2635
|
-
* @see faker.string.numeric(): For generating the pin with greater control.
|
|
2636
|
-
*
|
|
2637
|
-
* @example
|
|
2638
|
-
* faker.finance.pin() // '5067'
|
|
2639
|
-
* faker.finance.pin(6) // '213789'
|
|
2640
|
-
*
|
|
2641
|
-
* @since 6.2.0
|
|
2642
|
-
*/
|
|
2643
|
-
pin(length?: number): string;
|
|
2496
|
+
branch(): string;
|
|
2644
2497
|
/**
|
|
2645
|
-
* Generates a random
|
|
2646
|
-
*
|
|
2647
|
-
* @param options An options object.
|
|
2648
|
-
* @param options.length The length of the PIN to generate. Defaults to `4`.
|
|
2649
|
-
*
|
|
2650
|
-
* @throws {FakerError} Will throw an error if length is less than 1.
|
|
2498
|
+
* Generates a random commit entry as printed by `git log`.
|
|
2651
2499
|
*
|
|
2652
|
-
* @
|
|
2500
|
+
* @param options Options for the commit entry.
|
|
2501
|
+
* @param options.merge Whether to generate a merge message line. Defaults to 20% `true` and 80% `false`.
|
|
2502
|
+
* @param options.eol Choose the end of line character to use. Defaults to `'CRLF'`.
|
|
2503
|
+
* 'LF' = '\n',
|
|
2504
|
+
* 'CRLF' = '\r\n'
|
|
2505
|
+
* @param options.refDate The date to use as reference point for the commit. Defaults to `new Date()`.
|
|
2653
2506
|
*
|
|
2654
2507
|
* @example
|
|
2655
|
-
* faker.
|
|
2656
|
-
*
|
|
2508
|
+
* faker.git.commitEntry()
|
|
2509
|
+
* // commit fe8c38a965d13d9794eb36918cb24cebe49a45c2
|
|
2510
|
+
* // Author: Marion Becker <Marion_Becker49@gmail.com>
|
|
2511
|
+
* // Date: Mon Nov 7 05:38:37 2022 -0600
|
|
2512
|
+
* //
|
|
2513
|
+
* // generate open-source system
|
|
2657
2514
|
*
|
|
2658
|
-
* @since
|
|
2515
|
+
* @since 5.0.0
|
|
2659
2516
|
*/
|
|
2660
|
-
|
|
2517
|
+
commitEntry(options?: {
|
|
2661
2518
|
/**
|
|
2662
|
-
*
|
|
2519
|
+
* Set to `true` to generate a merge message line.
|
|
2663
2520
|
*
|
|
2664
|
-
* @default
|
|
2521
|
+
* @default faker.datatype.boolean({ probability: 0.2 })
|
|
2665
2522
|
*/
|
|
2666
|
-
|
|
2667
|
-
}): string;
|
|
2668
|
-
/**
|
|
2669
|
-
* Generates a random PIN number.
|
|
2670
|
-
*
|
|
2671
|
-
* @param options An options object or the length of the PIN.
|
|
2672
|
-
* @param options.length The length of the PIN to generate. Defaults to `4`.
|
|
2673
|
-
*
|
|
2674
|
-
* @throws {FakerError} Will throw an error if length is less than 1.
|
|
2675
|
-
*
|
|
2676
|
-
* @see faker.string.numeric(): For generating the pin with greater control.
|
|
2677
|
-
*
|
|
2678
|
-
* @example
|
|
2679
|
-
* faker.finance.pin() // '5067'
|
|
2680
|
-
* faker.finance.pin({ length: 6 }) // '213789'
|
|
2681
|
-
* faker.finance.pin(6) // '213789'
|
|
2682
|
-
*
|
|
2683
|
-
* @since 6.2.0
|
|
2684
|
-
*/
|
|
2685
|
-
pin(options?: number | {
|
|
2523
|
+
merge?: boolean;
|
|
2686
2524
|
/**
|
|
2687
|
-
*
|
|
2525
|
+
* Choose the end of line character to use.
|
|
2688
2526
|
*
|
|
2689
|
-
*
|
|
2527
|
+
* - 'LF' = '\n',
|
|
2528
|
+
* - 'CRLF' = '\r\n'
|
|
2529
|
+
*
|
|
2530
|
+
* @default 'CRLF'
|
|
2690
2531
|
*/
|
|
2691
|
-
|
|
2532
|
+
eol?: 'LF' | 'CRLF';
|
|
2533
|
+
/**
|
|
2534
|
+
* The date to use as reference point for the commit.
|
|
2535
|
+
*
|
|
2536
|
+
* @default new Date()
|
|
2537
|
+
*/
|
|
2538
|
+
refDate?: string | Date | number;
|
|
2692
2539
|
}): string;
|
|
2693
2540
|
/**
|
|
2694
|
-
*
|
|
2695
|
-
*
|
|
2696
|
-
* To generate a checksummed Ethereum address (with specific per character casing), wrap this method in a custom method and use third-party libraries to transform the result.
|
|
2541
|
+
* Generates a random commit message.
|
|
2697
2542
|
*
|
|
2698
2543
|
* @example
|
|
2699
|
-
* faker.
|
|
2544
|
+
* faker.git.commitMessage() // 'reboot cross-platform driver'
|
|
2700
2545
|
*
|
|
2701
2546
|
* @since 5.0.0
|
|
2702
2547
|
*/
|
|
2703
|
-
|
|
2548
|
+
commitMessage(): string;
|
|
2704
2549
|
/**
|
|
2705
|
-
* Generates a
|
|
2706
|
-
*
|
|
2707
|
-
* Please note that the generated IBAN might be invalid due to randomly generated bank codes/other country specific validation rules.
|
|
2708
|
-
*
|
|
2709
|
-
* @param options An options object.
|
|
2710
|
-
* @param options.formatted Return a formatted version of the generated IBAN. Defaults to `false`.
|
|
2711
|
-
* @param options.countryCode The country code from which you want to generate an IBAN, if none is provided a random country will be used.
|
|
2550
|
+
* Generates a date string for a git commit using the same format as `git log`.
|
|
2712
2551
|
*
|
|
2713
|
-
* @
|
|
2552
|
+
* @param options The optional options object.
|
|
2553
|
+
* @param options.refDate The date to use as reference point for the commit. Defaults to `faker.defaultRefDate()`.
|
|
2714
2554
|
*
|
|
2715
2555
|
* @example
|
|
2716
|
-
* faker.
|
|
2717
|
-
* faker.
|
|
2718
|
-
* faker.finance.iban({ formatted: true, countryCode: 'DE' }) // 'DE84 1022 7075 0900 1170 01'
|
|
2556
|
+
* faker.git.commitDate() // 'Mon Nov 7 14:40:58 2022 +0600'
|
|
2557
|
+
* faker.git.commitDate({ refDate: '2020-01-01' }) // 'Tue Dec 31 05:40:59 2019 -0400'
|
|
2719
2558
|
*
|
|
2720
|
-
* @since
|
|
2559
|
+
* @since 8.0.0
|
|
2721
2560
|
*/
|
|
2722
|
-
|
|
2561
|
+
commitDate(options?: {
|
|
2723
2562
|
/**
|
|
2724
|
-
*
|
|
2563
|
+
* The date to use as reference point for the commit.
|
|
2725
2564
|
*
|
|
2726
|
-
* @default
|
|
2727
|
-
*/
|
|
2728
|
-
formatted?: boolean;
|
|
2729
|
-
/**
|
|
2730
|
-
* The country code from which you want to generate an IBAN,
|
|
2731
|
-
* if none is provided a random country will be used.
|
|
2565
|
+
* @default faker.defaultRefDate()
|
|
2732
2566
|
*/
|
|
2733
|
-
|
|
2567
|
+
refDate?: string | Date | number;
|
|
2734
2568
|
}): string;
|
|
2735
2569
|
/**
|
|
2736
|
-
* Generates a random
|
|
2570
|
+
* Generates a random commit sha.
|
|
2737
2571
|
*
|
|
2738
|
-
*
|
|
2739
|
-
*
|
|
2572
|
+
* By default, the length of the commit sha is 40 characters.
|
|
2573
|
+
*
|
|
2574
|
+
* For a shorter commit sha, use the `length` option.
|
|
2575
|
+
*
|
|
2576
|
+
* Usual short commit sha length is:
|
|
2577
|
+
* - 7 for GitHub
|
|
2578
|
+
* - 8 for GitLab
|
|
2579
|
+
*
|
|
2580
|
+
* @param options Options for the commit sha.
|
|
2581
|
+
* @param options.length The length of the commit sha. Defaults to `40`.
|
|
2740
2582
|
*
|
|
2741
2583
|
* @example
|
|
2742
|
-
* faker.
|
|
2743
|
-
* faker.
|
|
2744
|
-
* faker.
|
|
2584
|
+
* faker.git.commitSha() // '2c6e3880fd94ddb7ef72d34e683cdc0c47bec6e6'
|
|
2585
|
+
* faker.git.commitSha({ length: 7 }) // 'dbee57b'
|
|
2586
|
+
* faker.git.commitSha({ length: 8 }) // '0e52376a'
|
|
2745
2587
|
*
|
|
2746
|
-
* @since
|
|
2588
|
+
* @since 5.0.0
|
|
2747
2589
|
*/
|
|
2748
|
-
|
|
2590
|
+
commitSha(options?: {
|
|
2749
2591
|
/**
|
|
2750
|
-
*
|
|
2592
|
+
* The length of the commit sha.
|
|
2751
2593
|
*
|
|
2752
|
-
* @default
|
|
2594
|
+
* @default 40
|
|
2753
2595
|
*/
|
|
2754
|
-
|
|
2596
|
+
length?: number;
|
|
2755
2597
|
}): string;
|
|
2756
|
-
/**
|
|
2757
|
-
* Generates a random transaction description.
|
|
2758
|
-
*
|
|
2759
|
-
* @example
|
|
2760
|
-
* faker.finance.transactionDescription()
|
|
2761
|
-
* // 'payment transaction at Emard LLC using card ending with ****9187 for HNL 506.57 in account ***2584.'
|
|
2762
|
-
*
|
|
2763
|
-
* @since 5.1.0
|
|
2764
|
-
*/
|
|
2765
|
-
transactionDescription(): string;
|
|
2766
2598
|
}
|
|
2599
|
+
//#endregion
|
|
2600
|
+
//#region src/modules/hacker/index.d.ts
|
|
2767
2601
|
/**
|
|
2768
|
-
* Module
|
|
2602
|
+
* Module to generate hacker/IT words and phrases.
|
|
2769
2603
|
*
|
|
2770
2604
|
* ### Overview
|
|
2771
2605
|
*
|
|
2772
|
-
*
|
|
2773
|
-
*
|
|
2774
|
-
*
|
|
2606
|
+
* There are methods for different parts of speech, such as [`abbreviation()`](https://fakerjs.dev/api/hacker.html#abbreviation), [`adjective()`](https://fakerjs.dev/api/hacker.html#adjective), [`noun()`](https://fakerjs.dev/api/hacker.html#noun), [`verb()`](https://fakerjs.dev/api/hacker.html#verb), and [`ingverb()`](https://fakerjs.dev/api/hacker.html#ingverb). Alternatively, [`phrase()`](https://fakerjs.dev/api/hacker.html#phrase) creates a longer phrase combining these words.
|
|
2607
|
+
*
|
|
2608
|
+
* ### Related modules
|
|
2609
|
+
*
|
|
2610
|
+
* Various modules allow for generating other types of words and phrases:
|
|
2611
|
+
*
|
|
2612
|
+
* - [faker.word](https://fakerjs.dev/api/word.html) uses general vocabulary rather than hacker-specific terms.
|
|
2613
|
+
* - [faker.lorem](https://fakerjs.dev/api/lorem.html) uses faux-Latin "lorem ipsum" text.
|
|
2614
|
+
* - [faker.company](https://fakerjs.dev/api/company.html) includes corporate catchphrases and buzzwords.
|
|
2775
2615
|
*/
|
|
2776
|
-
declare class
|
|
2616
|
+
declare class HackerModule extends ModuleBase {
|
|
2777
2617
|
/**
|
|
2778
|
-
*
|
|
2618
|
+
* Returns a random hacker/IT abbreviation.
|
|
2779
2619
|
*
|
|
2780
2620
|
* @example
|
|
2781
|
-
* faker.
|
|
2621
|
+
* faker.hacker.abbreviation() // 'THX'
|
|
2782
2622
|
*
|
|
2783
|
-
* @since
|
|
2623
|
+
* @since 2.0.1
|
|
2784
2624
|
*/
|
|
2785
|
-
|
|
2625
|
+
abbreviation(): string;
|
|
2786
2626
|
/**
|
|
2787
|
-
*
|
|
2627
|
+
* Returns a random hacker/IT adjective.
|
|
2788
2628
|
*
|
|
2789
2629
|
* @example
|
|
2790
|
-
* faker.
|
|
2630
|
+
* faker.hacker.adjective() // 'cross-platform'
|
|
2791
2631
|
*
|
|
2792
|
-
* @since
|
|
2632
|
+
* @since 2.0.1
|
|
2793
2633
|
*/
|
|
2794
|
-
|
|
2634
|
+
adjective(): string;
|
|
2795
2635
|
/**
|
|
2796
|
-
*
|
|
2636
|
+
* Returns a random hacker/IT noun.
|
|
2797
2637
|
*
|
|
2798
2638
|
* @example
|
|
2799
|
-
* faker.
|
|
2639
|
+
* faker.hacker.noun() // 'system'
|
|
2800
2640
|
*
|
|
2801
|
-
* @since
|
|
2641
|
+
* @since 2.0.1
|
|
2802
2642
|
*/
|
|
2803
|
-
|
|
2643
|
+
noun(): string;
|
|
2804
2644
|
/**
|
|
2805
|
-
*
|
|
2645
|
+
* Returns a random hacker/IT verb.
|
|
2806
2646
|
*
|
|
2807
2647
|
* @example
|
|
2808
|
-
* faker.
|
|
2648
|
+
* faker.hacker.verb() // 'copy'
|
|
2809
2649
|
*
|
|
2810
|
-
* @since
|
|
2650
|
+
* @since 2.0.1
|
|
2811
2651
|
*/
|
|
2812
|
-
|
|
2652
|
+
verb(): string;
|
|
2813
2653
|
/**
|
|
2814
|
-
*
|
|
2654
|
+
* Returns a random hacker/IT verb for continuous actions (en: ing suffix; e.g. hacking).
|
|
2815
2655
|
*
|
|
2816
2656
|
* @example
|
|
2817
|
-
* faker.
|
|
2657
|
+
* faker.hacker.ingverb() // 'navigating'
|
|
2818
2658
|
*
|
|
2819
|
-
* @since
|
|
2659
|
+
* @since 2.0.1
|
|
2820
2660
|
*/
|
|
2821
|
-
|
|
2661
|
+
ingverb(): string;
|
|
2822
2662
|
/**
|
|
2823
|
-
* Generates a random
|
|
2663
|
+
* Generates a random hacker/IT phrase.
|
|
2824
2664
|
*
|
|
2825
2665
|
* @example
|
|
2826
|
-
* faker.
|
|
2666
|
+
* faker.hacker.phrase()
|
|
2667
|
+
* // 'If we override the card, we can get to the HDD feed through the back-end HDD sensor!'
|
|
2827
2668
|
*
|
|
2828
|
-
* @since
|
|
2829
|
-
*/
|
|
2830
|
-
ingredient(): string;
|
|
2831
|
-
/**
|
|
2832
|
-
* Generates a random meat
|
|
2833
|
-
*
|
|
2834
|
-
* @example
|
|
2835
|
-
* faker.food.meat() // 'venison'
|
|
2836
|
-
*
|
|
2837
|
-
* @since 9.0.0
|
|
2838
|
-
*/
|
|
2839
|
-
meat(): string;
|
|
2840
|
-
/**
|
|
2841
|
-
* Generates a random spice name.
|
|
2842
|
-
*
|
|
2843
|
-
* @example
|
|
2844
|
-
* faker.food.spice() // 'chilli'
|
|
2845
|
-
*
|
|
2846
|
-
* @since 9.0.0
|
|
2847
|
-
*/
|
|
2848
|
-
spice(): string;
|
|
2849
|
-
/**
|
|
2850
|
-
* Generates a random vegetable name.
|
|
2851
|
-
*
|
|
2852
|
-
* @example
|
|
2853
|
-
* faker.food.vegetable() // 'broccoli'
|
|
2854
|
-
*
|
|
2855
|
-
* @since 9.0.0
|
|
2856
|
-
*/
|
|
2857
|
-
vegetable(): string;
|
|
2858
|
-
}
|
|
2859
|
-
/**
|
|
2860
|
-
* Module to generate git related entries.
|
|
2861
|
-
*
|
|
2862
|
-
* ### Overview
|
|
2863
|
-
*
|
|
2864
|
-
* [`commitEntry()`](https://fakerjs.dev/api/git.html#commitentry) generates a random commit entry as printed by `git log`. This includes a commit hash [`commitSha()`](https://fakerjs.dev/api/git.html#commitsha), author, date [`commitDate()`](https://fakerjs.dev/api/git.html#commitdate), and commit message [`commitMessage()`](https://fakerjs.dev/api/git.html#commitmessage). You can also generate a random branch name with [`branch()`](https://fakerjs.dev/api/git.html#branch).
|
|
2865
|
-
*/
|
|
2866
|
-
declare class GitModule extends ModuleBase {
|
|
2867
|
-
/**
|
|
2868
|
-
* Generates a random branch name.
|
|
2869
|
-
*
|
|
2870
|
-
* @example
|
|
2871
|
-
* faker.git.branch() // 'feed-parse'
|
|
2872
|
-
*
|
|
2873
|
-
* @since 5.0.0
|
|
2874
|
-
*/
|
|
2875
|
-
branch(): string;
|
|
2876
|
-
/**
|
|
2877
|
-
* Generates a random commit entry as printed by `git log`.
|
|
2878
|
-
*
|
|
2879
|
-
* @param options Options for the commit entry.
|
|
2880
|
-
* @param options.merge Whether to generate a merge message line. Defaults to 20% `true` and 80% `false`.
|
|
2881
|
-
* @param options.eol Choose the end of line character to use. Defaults to `'CRLF'`.
|
|
2882
|
-
* 'LF' = '\n',
|
|
2883
|
-
* 'CRLF' = '\r\n'
|
|
2884
|
-
* @param options.refDate The date to use as reference point for the commit. Defaults to `new Date()`.
|
|
2885
|
-
*
|
|
2886
|
-
* @example
|
|
2887
|
-
* faker.git.commitEntry()
|
|
2888
|
-
* // commit fe8c38a965d13d9794eb36918cb24cebe49a45c2
|
|
2889
|
-
* // Author: Marion Becker <Marion_Becker49@gmail.com>
|
|
2890
|
-
* // Date: Mon Nov 7 05:38:37 2022 -0600
|
|
2891
|
-
* //
|
|
2892
|
-
* // generate open-source system
|
|
2893
|
-
*
|
|
2894
|
-
* @since 5.0.0
|
|
2895
|
-
*/
|
|
2896
|
-
commitEntry(options?: {
|
|
2897
|
-
/**
|
|
2898
|
-
* Set to `true` to generate a merge message line.
|
|
2899
|
-
*
|
|
2900
|
-
* @default faker.datatype.boolean({ probability: 0.2 })
|
|
2901
|
-
*/
|
|
2902
|
-
merge?: boolean;
|
|
2903
|
-
/**
|
|
2904
|
-
* Choose the end of line character to use.
|
|
2905
|
-
*
|
|
2906
|
-
* - 'LF' = '\n',
|
|
2907
|
-
* - 'CRLF' = '\r\n'
|
|
2908
|
-
*
|
|
2909
|
-
* @default 'CRLF'
|
|
2910
|
-
*/
|
|
2911
|
-
eol?: 'LF' | 'CRLF';
|
|
2912
|
-
/**
|
|
2913
|
-
* The date to use as reference point for the commit.
|
|
2914
|
-
*
|
|
2915
|
-
* @default new Date()
|
|
2916
|
-
*/
|
|
2917
|
-
refDate?: string | Date | number;
|
|
2918
|
-
}): string;
|
|
2919
|
-
/**
|
|
2920
|
-
* Generates a random commit message.
|
|
2921
|
-
*
|
|
2922
|
-
* @example
|
|
2923
|
-
* faker.git.commitMessage() // 'reboot cross-platform driver'
|
|
2924
|
-
*
|
|
2925
|
-
* @since 5.0.0
|
|
2926
|
-
*/
|
|
2927
|
-
commitMessage(): string;
|
|
2928
|
-
/**
|
|
2929
|
-
* Generates a date string for a git commit using the same format as `git log`.
|
|
2930
|
-
*
|
|
2931
|
-
* @param options The optional options object.
|
|
2932
|
-
* @param options.refDate The date to use as reference point for the commit. Defaults to `faker.defaultRefDate()`.
|
|
2933
|
-
*
|
|
2934
|
-
* @example
|
|
2935
|
-
* faker.git.commitDate() // 'Mon Nov 7 14:40:58 2022 +0600'
|
|
2936
|
-
* faker.git.commitDate({ refDate: '2020-01-01' }) // 'Tue Dec 31 05:40:59 2019 -0400'
|
|
2937
|
-
*
|
|
2938
|
-
* @since 8.0.0
|
|
2939
|
-
*/
|
|
2940
|
-
commitDate(options?: {
|
|
2941
|
-
/**
|
|
2942
|
-
* The date to use as reference point for the commit.
|
|
2943
|
-
*
|
|
2944
|
-
* @default faker.defaultRefDate()
|
|
2945
|
-
*/
|
|
2946
|
-
refDate?: string | Date | number;
|
|
2947
|
-
}): string;
|
|
2948
|
-
/**
|
|
2949
|
-
* Generates a random commit sha.
|
|
2950
|
-
*
|
|
2951
|
-
* By default, the length of the commit sha is 40 characters.
|
|
2952
|
-
*
|
|
2953
|
-
* For a shorter commit sha, use the `length` option.
|
|
2954
|
-
*
|
|
2955
|
-
* Usual short commit sha length is:
|
|
2956
|
-
* - 7 for GitHub
|
|
2957
|
-
* - 8 for GitLab
|
|
2958
|
-
*
|
|
2959
|
-
* @param options Options for the commit sha.
|
|
2960
|
-
* @param options.length The length of the commit sha. Defaults to `40`.
|
|
2961
|
-
*
|
|
2962
|
-
* @example
|
|
2963
|
-
* faker.git.commitSha() // '2c6e3880fd94ddb7ef72d34e683cdc0c47bec6e6'
|
|
2964
|
-
* faker.git.commitSha({ length: 7 }) // 'dbee57b'
|
|
2965
|
-
* faker.git.commitSha({ length: 8 }) // '0e52376a'
|
|
2966
|
-
*
|
|
2967
|
-
* @since 5.0.0
|
|
2968
|
-
*/
|
|
2969
|
-
commitSha(options?: {
|
|
2970
|
-
/**
|
|
2971
|
-
* The length of the commit sha.
|
|
2972
|
-
*
|
|
2973
|
-
* @default 40
|
|
2974
|
-
*/
|
|
2975
|
-
length?: number;
|
|
2976
|
-
}): string;
|
|
2977
|
-
}
|
|
2978
|
-
/**
|
|
2979
|
-
* Module to generate hacker/IT words and phrases.
|
|
2980
|
-
*
|
|
2981
|
-
* ### Overview
|
|
2982
|
-
*
|
|
2983
|
-
* There are methods for different parts of speech, such as [`abbreviation()`](https://fakerjs.dev/api/hacker.html#abbreviation), [`adjective()`](https://fakerjs.dev/api/hacker.html#adjective), [`noun()`](https://fakerjs.dev/api/hacker.html#noun), [`verb()`](https://fakerjs.dev/api/hacker.html#verb), and [`ingverb()`](https://fakerjs.dev/api/hacker.html#ingverb). Alternatively, [`phrase()`](https://fakerjs.dev/api/hacker.html#phrase) creates a longer phrase combining these words.
|
|
2984
|
-
*
|
|
2985
|
-
* ### Related modules
|
|
2986
|
-
*
|
|
2987
|
-
* Various modules allow for generating other types of words and phrases:
|
|
2988
|
-
*
|
|
2989
|
-
* - [faker.word](https://fakerjs.dev/api/word.html) uses general vocabulary rather than hacker-specific terms.
|
|
2990
|
-
* - [faker.lorem](https://fakerjs.dev/api/lorem.html) uses faux-Latin "lorem ipsum" text.
|
|
2991
|
-
* - [faker.company](https://fakerjs.dev/api/company.html) includes corporate catchphrases and buzzwords.
|
|
2992
|
-
*/
|
|
2993
|
-
declare class HackerModule extends ModuleBase {
|
|
2994
|
-
/**
|
|
2995
|
-
* Returns a random hacker/IT abbreviation.
|
|
2996
|
-
*
|
|
2997
|
-
* @example
|
|
2998
|
-
* faker.hacker.abbreviation() // 'THX'
|
|
2999
|
-
*
|
|
3000
|
-
* @since 2.0.1
|
|
3001
|
-
*/
|
|
3002
|
-
abbreviation(): string;
|
|
3003
|
-
/**
|
|
3004
|
-
* Returns a random hacker/IT adjective.
|
|
3005
|
-
*
|
|
3006
|
-
* @example
|
|
3007
|
-
* faker.hacker.adjective() // 'cross-platform'
|
|
3008
|
-
*
|
|
3009
|
-
* @since 2.0.1
|
|
3010
|
-
*/
|
|
3011
|
-
adjective(): string;
|
|
3012
|
-
/**
|
|
3013
|
-
* Returns a random hacker/IT noun.
|
|
3014
|
-
*
|
|
3015
|
-
* @example
|
|
3016
|
-
* faker.hacker.noun() // 'system'
|
|
3017
|
-
*
|
|
3018
|
-
* @since 2.0.1
|
|
3019
|
-
*/
|
|
3020
|
-
noun(): string;
|
|
3021
|
-
/**
|
|
3022
|
-
* Returns a random hacker/IT verb.
|
|
3023
|
-
*
|
|
3024
|
-
* @example
|
|
3025
|
-
* faker.hacker.verb() // 'copy'
|
|
3026
|
-
*
|
|
3027
|
-
* @since 2.0.1
|
|
3028
|
-
*/
|
|
3029
|
-
verb(): string;
|
|
3030
|
-
/**
|
|
3031
|
-
* Returns a random hacker/IT verb for continuous actions (en: ing suffix; e.g. hacking).
|
|
3032
|
-
*
|
|
3033
|
-
* @example
|
|
3034
|
-
* faker.hacker.ingverb() // 'navigating'
|
|
3035
|
-
*
|
|
3036
|
-
* @since 2.0.1
|
|
3037
|
-
*/
|
|
3038
|
-
ingverb(): string;
|
|
3039
|
-
/**
|
|
3040
|
-
* Generates a random hacker/IT phrase.
|
|
3041
|
-
*
|
|
3042
|
-
* @example
|
|
3043
|
-
* faker.hacker.phrase()
|
|
3044
|
-
* // 'If we override the card, we can get to the HDD feed through the back-end HDD sensor!'
|
|
3045
|
-
*
|
|
3046
|
-
* @since 2.0.1
|
|
2669
|
+
* @since 2.0.1
|
|
3047
2670
|
*/
|
|
3048
2671
|
phrase(): string;
|
|
3049
2672
|
}
|
|
2673
|
+
//#endregion
|
|
2674
|
+
//#region src/modules/helpers/index.d.ts
|
|
3050
2675
|
/**
|
|
3051
2676
|
* Module with various helper methods providing basic (seed-dependent) operations useful for implementing faker methods (without methods requiring localized data).
|
|
3052
2677
|
*/
|
|
@@ -3066,7 +2691,7 @@ declare class SimpleHelpersModule extends SimpleModuleBase {
|
|
|
3066
2691
|
*/
|
|
3067
2692
|
slugify(string?: string): string;
|
|
3068
2693
|
/**
|
|
3069
|
-
* Parses the given string symbol by
|
|
2694
|
+
* Parses the given string symbol by symbol and replaces the placeholder appropriately.
|
|
3070
2695
|
*
|
|
3071
2696
|
* - `#` will be replaced with a digit (`0` - `9`).
|
|
3072
2697
|
* - `?` will be replaced with an upper letter ('A' - 'Z')
|
|
@@ -3263,7 +2888,7 @@ declare class SimpleHelpersModule extends SimpleModuleBase {
|
|
|
3263
2888
|
*
|
|
3264
2889
|
* @template TResult The type of result of the given callback.
|
|
3265
2890
|
*
|
|
3266
|
-
* @param callback The callback
|
|
2891
|
+
* @param callback The callback that will be invoked if the probability check was successful.
|
|
3267
2892
|
* @param options The options to use.
|
|
3268
2893
|
* @param options.probability The probability (`[0.00, 1.00]`) of the callback being invoked. Defaults to `0.5`.
|
|
3269
2894
|
*
|
|
@@ -3637,6 +3262,8 @@ declare class HelpersModule extends SimpleHelpersModule {
|
|
|
3637
3262
|
*/
|
|
3638
3263
|
fake(pattern: string | ReadonlyArray<string>): string;
|
|
3639
3264
|
}
|
|
3265
|
+
//#endregion
|
|
3266
|
+
//#region src/modules/person/index.d.ts
|
|
3640
3267
|
/**
|
|
3641
3268
|
* The enum for values corresponding to a person's sex.
|
|
3642
3269
|
*/
|
|
@@ -3886,6 +3513,8 @@ declare class PersonModule extends ModuleBase {
|
|
|
3886
3513
|
*/
|
|
3887
3514
|
zodiacSign(): string;
|
|
3888
3515
|
}
|
|
3516
|
+
//#endregion
|
|
3517
|
+
//#region src/modules/image/index.d.ts
|
|
3889
3518
|
/**
|
|
3890
3519
|
* Module to generate images.
|
|
3891
3520
|
*
|
|
@@ -3897,7 +3526,10 @@ declare class PersonModule extends ModuleBase {
|
|
|
3897
3526
|
*
|
|
3898
3527
|
* For a random user avatar image, use [`avatar()`](https://fakerjs.dev/api/image.html#avatar), or [`personPortrait()`](https://fakerjs.dev/api/image.html#personportrait) which has more control over the size and sex of the person.
|
|
3899
3528
|
*
|
|
3900
|
-
*
|
|
3529
|
+
* For full control over the returned image URL, use [`faker.helpers.arrayElement()`](https://fakerjs.dev/api/helpers.html#arrayelement) with your own array of image URLs.
|
|
3530
|
+
*
|
|
3531
|
+
* ::: info Hint
|
|
3532
|
+
* If you think an image method/category is missing, please [open an issue/vote for an existing one](https://github.com/faker-js/faker/issues/3810).
|
|
3901
3533
|
*/
|
|
3902
3534
|
declare class ImageModule extends ModuleBase {
|
|
3903
3535
|
/**
|
|
@@ -4111,6 +3743,8 @@ declare class ImageModule extends ModuleBase {
|
|
|
4111
3743
|
type?: 'svg-uri' | 'svg-base64';
|
|
4112
3744
|
}): string;
|
|
4113
3745
|
}
|
|
3746
|
+
//#endregion
|
|
3747
|
+
//#region src/modules/internet/index.d.ts
|
|
4114
3748
|
type EmojiType = 'smiley' | 'body' | 'person' | 'nature' | 'food' | 'travel' | 'activity' | 'object' | 'symbol' | 'flag';
|
|
4115
3749
|
type HTTPStatusCodeType = 'informational' | 'success' | 'clientError' | 'serverError' | 'redirection';
|
|
4116
3750
|
type HTTPProtocolType = 'http' | 'https';
|
|
@@ -4180,7 +3814,7 @@ type IPv4NetworkType = `${IPv4Network}`;
|
|
|
4180
3814
|
*
|
|
4181
3815
|
* ### Overview
|
|
4182
3816
|
*
|
|
4183
|
-
* For user accounts, you may need an [`email()`](https://fakerjs.dev/api/internet.html#email) and a [`password()`](https://fakerjs.dev/api/internet.html#password), as well as
|
|
3817
|
+
* For user accounts, you may need an [`email()`](https://fakerjs.dev/api/internet.html#email) and a [`password()`](https://fakerjs.dev/api/internet.html#password), as well as an ASCII [`username()`](https://fakerjs.dev/api/internet.html#username) or Unicode [`displayName()`](https://fakerjs.dev/api/internet.html#displayname). Since the emails generated could coincidentally be real email addresses, you should not use these for sending real email addresses. If this is a concern, use [`exampleEmail()`](https://fakerjs.dev/api/internet.html#exampleemail) instead.
|
|
4184
3818
|
*
|
|
4185
3819
|
* For websites, you can generate a [`domainName()`](https://fakerjs.dev/api/internet.html#domainname) or a full [`url()`](https://fakerjs.dev/api/internet.html#url).
|
|
4186
3820
|
*
|
|
@@ -4559,7 +4193,7 @@ declare class InternetModule extends ModuleBase {
|
|
|
4559
4193
|
* Generates a random mac address.
|
|
4560
4194
|
*
|
|
4561
4195
|
* @param options An options object.
|
|
4562
|
-
* @param separator The optional separator to use. Can be either `':'`, `'-'` or `''`. Defaults to `':'`.
|
|
4196
|
+
* @param options.separator The optional separator to use. Can be either `':'`, `'-'` or `''`. Defaults to `':'`.
|
|
4563
4197
|
*
|
|
4564
4198
|
* @example
|
|
4565
4199
|
* faker.internet.mac() // '32:8e:2e:09:c6:05'
|
|
@@ -4589,7 +4223,7 @@ declare class InternetModule extends ModuleBase {
|
|
|
4589
4223
|
* Generates a random mac address.
|
|
4590
4224
|
*
|
|
4591
4225
|
* @param options The optional separator or an options object.
|
|
4592
|
-
* @param separator The optional separator to use. Can be either `':'`, `'-'` or `''`. Defaults to `':'`.
|
|
4226
|
+
* @param options.separator The optional separator to use. Can be either `':'`, `'-'` or `''`. Defaults to `':'`.
|
|
4593
4227
|
*
|
|
4594
4228
|
* @example
|
|
4595
4229
|
* faker.internet.mac() // '32:8e:2e:09:c6:05'
|
|
@@ -4738,6 +4372,8 @@ declare class InternetModule extends ModuleBase {
|
|
|
4738
4372
|
refDate?: string | Date | number;
|
|
4739
4373
|
}): string;
|
|
4740
4374
|
}
|
|
4375
|
+
//#endregion
|
|
4376
|
+
//#region src/modules/location/index.d.ts
|
|
4741
4377
|
/**
|
|
4742
4378
|
* Represents a language with its full name, 2 character ISO 639-1 code, and 3 character ISO 639-2 code.
|
|
4743
4379
|
*/
|
|
@@ -4965,6 +4601,33 @@ declare class LocationModule extends SimpleLocationModule {
|
|
|
4965
4601
|
*/
|
|
4966
4602
|
useFullAddress?: boolean;
|
|
4967
4603
|
}): string;
|
|
4604
|
+
/**
|
|
4605
|
+
* Generates a random localized full postal address, which may include a street address, secondary address, city, state, and zip code. To ensure you get locale-specific address formats, use a localized Faker instance.
|
|
4606
|
+
*
|
|
4607
|
+
* @example
|
|
4608
|
+
* faker.location.postalAddress()
|
|
4609
|
+
* // 'Apt. 980
|
|
4610
|
+
* // 0917 O'Conner Estates
|
|
4611
|
+
* // West Shannonview
|
|
4612
|
+
* // Michigan
|
|
4613
|
+
* // 82180'
|
|
4614
|
+
*
|
|
4615
|
+
* fakerEN_US.location.postalAddress()
|
|
4616
|
+
* // '0917 O'Conner Estates, Apt. 980
|
|
4617
|
+
* // West Shannonview, MI 82180'
|
|
4618
|
+
*
|
|
4619
|
+
* fakerEN_GB.location.postalAddress()
|
|
4620
|
+
* // '79 Bogan Corner
|
|
4621
|
+
* // Castle Zemlakborough
|
|
4622
|
+
* // Dumfries and Galloway
|
|
4623
|
+
* // ZH17 2SD'
|
|
4624
|
+
*
|
|
4625
|
+
* fakerZH_CN.location.postalAddress()
|
|
4626
|
+
* // '广东省贵原市门路19号'
|
|
4627
|
+
*
|
|
4628
|
+
* @since 10.5.0
|
|
4629
|
+
*/
|
|
4630
|
+
postalAddress(): string;
|
|
4968
4631
|
/**
|
|
4969
4632
|
* Generates a random localized secondary address. This refers to a specific location at a given address
|
|
4970
4633
|
* such as an apartment or room number.
|
|
@@ -5158,6 +4821,8 @@ declare class LocationModule extends SimpleLocationModule {
|
|
|
5158
4821
|
*/
|
|
5159
4822
|
language(): Language;
|
|
5160
4823
|
}
|
|
4824
|
+
//#endregion
|
|
4825
|
+
//#region src/modules/lorem/index.d.ts
|
|
5161
4826
|
/**
|
|
5162
4827
|
* Module to generate random texts and words.
|
|
5163
4828
|
*
|
|
@@ -5445,6 +5110,8 @@ declare class LoremModule extends ModuleBase {
|
|
|
5445
5110
|
max: number;
|
|
5446
5111
|
}): string;
|
|
5447
5112
|
}
|
|
5113
|
+
//#endregion
|
|
5114
|
+
//#region src/modules/music/index.d.ts
|
|
5448
5115
|
/**
|
|
5449
5116
|
* Module to generate music related entries.
|
|
5450
5117
|
*
|
|
@@ -5500,6 +5167,8 @@ declare class MusicModule extends ModuleBase {
|
|
|
5500
5167
|
*/
|
|
5501
5168
|
songName(): string;
|
|
5502
5169
|
}
|
|
5170
|
+
//#endregion
|
|
5171
|
+
//#region src/modules/phone/index.d.ts
|
|
5503
5172
|
/**
|
|
5504
5173
|
* Module to generate phone-related data.
|
|
5505
5174
|
*
|
|
@@ -5522,6 +5191,7 @@ declare class PhoneModule extends ModuleBase {
|
|
|
5522
5191
|
* faker.phone.number({ style: 'human' }) // '555.770.7727 x1234'
|
|
5523
5192
|
* faker.phone.number({ style: 'national' }) // '(961) 770-7727'
|
|
5524
5193
|
* faker.phone.number({ style: 'international' }) // '+15551234567'
|
|
5194
|
+
* fakerEN_GB.phone.number({ style: 'mobile' }) // '07123456789'
|
|
5525
5195
|
*
|
|
5526
5196
|
* @since 7.3.0
|
|
5527
5197
|
*/
|
|
@@ -5531,10 +5201,11 @@ declare class PhoneModule extends ModuleBase {
|
|
|
5531
5201
|
* - `'human'`: (default) A human-input phone number, e.g. `555-770-7727` or `555.770.7727 x1234`
|
|
5532
5202
|
* - `'national'`: A phone number in a standardized national format, e.g. `(555) 123-4567`.
|
|
5533
5203
|
* - `'international'`: A phone number in the E.123 international format, e.g. `+15551234567`
|
|
5204
|
+
* - `'mobile'`: In selected locales, provides a number used for mobile phones, e.g. `07123456789` in en_GB.
|
|
5534
5205
|
*
|
|
5535
5206
|
* @default 'human'
|
|
5536
5207
|
*/
|
|
5537
|
-
style?: 'human' | 'national' | 'international';
|
|
5208
|
+
style?: 'human' | 'national' | 'international' | 'mobile';
|
|
5538
5209
|
}): string;
|
|
5539
5210
|
/**
|
|
5540
5211
|
* Generates IMEI number.
|
|
@@ -5546,6 +5217,8 @@ declare class PhoneModule extends ModuleBase {
|
|
|
5546
5217
|
*/
|
|
5547
5218
|
imei(): string;
|
|
5548
5219
|
}
|
|
5220
|
+
//#endregion
|
|
5221
|
+
//#region src/modules/science/index.d.ts
|
|
5549
5222
|
/**
|
|
5550
5223
|
* The possible definitions related to elements.
|
|
5551
5224
|
*/
|
|
@@ -5604,6 +5277,8 @@ declare class ScienceModule extends ModuleBase {
|
|
|
5604
5277
|
*/
|
|
5605
5278
|
unit(): Unit;
|
|
5606
5279
|
}
|
|
5280
|
+
//#endregion
|
|
5281
|
+
//#region src/modules/system/index.d.ts
|
|
5607
5282
|
declare const commonInterfaceTypes: readonly ["en", "wl", "ww"];
|
|
5608
5283
|
declare const commonInterfaceSchemas: {
|
|
5609
5284
|
readonly index: "o";
|
|
@@ -5792,6 +5467,8 @@ declare class SystemModule extends ModuleBase {
|
|
|
5792
5467
|
includeNonStandard?: boolean;
|
|
5793
5468
|
}): string;
|
|
5794
5469
|
}
|
|
5470
|
+
//#endregion
|
|
5471
|
+
//#region src/modules/vehicle/index.d.ts
|
|
5795
5472
|
/**
|
|
5796
5473
|
* Module to generate vehicle related entries.
|
|
5797
5474
|
*
|
|
@@ -5884,6 +5561,8 @@ declare class VehicleModule extends ModuleBase {
|
|
|
5884
5561
|
*/
|
|
5885
5562
|
bicycle(): string;
|
|
5886
5563
|
}
|
|
5564
|
+
//#endregion
|
|
5565
|
+
//#region src/modules/word/index.d.ts
|
|
5887
5566
|
/**
|
|
5888
5567
|
* Module to return various types of words.
|
|
5889
5568
|
*/
|
|
@@ -6350,26 +6029,66 @@ declare class WordModule extends ModuleBase {
|
|
|
6350
6029
|
};
|
|
6351
6030
|
}): string;
|
|
6352
6031
|
}
|
|
6032
|
+
//#endregion
|
|
6033
|
+
//#region src/modules/datatype/index.d.ts
|
|
6353
6034
|
/**
|
|
6354
|
-
*
|
|
6355
|
-
*
|
|
6356
|
-
* **Note:** Normally there is no need to implement this interface directly,
|
|
6357
|
-
* unless you want to achieve a specific goal with it.
|
|
6358
|
-
*
|
|
6359
|
-
* This interface enables you to use random generators from third party libraries such as [pure-rand](https://github.com/dubzzz/pure-rand).
|
|
6360
|
-
*
|
|
6361
|
-
* Instances are expected to be ready for use before being passed to any Faker constructor,
|
|
6362
|
-
* this includes being `seed()`ed with either a random or fixed value.
|
|
6363
|
-
*
|
|
6364
|
-
* For more information please refer to the [documentation](https://fakerjs.dev/guide/randomizer.html).
|
|
6035
|
+
* Module to generate boolean values.
|
|
6365
6036
|
*
|
|
6366
|
-
*
|
|
6367
|
-
* import { Faker, Randomizer, SimpleFaker } from '@faker-js/faker';
|
|
6368
|
-
* import { RandomGenerator, xoroshiro128plus } from 'pure-rand';
|
|
6037
|
+
* ### Overview
|
|
6369
6038
|
*
|
|
6370
|
-
*
|
|
6371
|
-
|
|
6372
|
-
|
|
6039
|
+
* For a simple random true or false value, use [`boolean()`](https://fakerjs.dev/api/datatype.html#boolean).
|
|
6040
|
+
*/
|
|
6041
|
+
declare class DatatypeModule extends SimpleModuleBase {
|
|
6042
|
+
/**
|
|
6043
|
+
* Returns the boolean value true or false.
|
|
6044
|
+
*
|
|
6045
|
+
* **Note:**
|
|
6046
|
+
* A probability of `0.75` results in `true` being returned `75%` of the calls; likewise `0.3` => `30%`.
|
|
6047
|
+
* If the probability is `<= 0.0`, it will always return `false`.
|
|
6048
|
+
* If the probability is `>= 1.0`, it will always return `true`.
|
|
6049
|
+
* The probability is limited to two decimal places.
|
|
6050
|
+
*
|
|
6051
|
+
* @param options The optional options object or the probability (`[0.00, 1.00]`) of returning `true`.
|
|
6052
|
+
* @param options.probability The probability (`[0.00, 1.00]`) of returning `true`. Defaults to `0.5`.
|
|
6053
|
+
*
|
|
6054
|
+
* @example
|
|
6055
|
+
* faker.datatype.boolean() // false
|
|
6056
|
+
* faker.datatype.boolean(0.9) // true
|
|
6057
|
+
* faker.datatype.boolean({ probability: 0.1 }) // false
|
|
6058
|
+
*
|
|
6059
|
+
* @since 5.5.0
|
|
6060
|
+
*/
|
|
6061
|
+
boolean(options?: number | {
|
|
6062
|
+
/**
|
|
6063
|
+
* The probability (`[0.00, 1.00]`) of returning `true`.
|
|
6064
|
+
*
|
|
6065
|
+
* @default 0.5
|
|
6066
|
+
*/
|
|
6067
|
+
probability?: number;
|
|
6068
|
+
}): boolean;
|
|
6069
|
+
}
|
|
6070
|
+
//#endregion
|
|
6071
|
+
//#region src/randomizer.d.ts
|
|
6072
|
+
/**
|
|
6073
|
+
* Interface for a random number generator.
|
|
6074
|
+
*
|
|
6075
|
+
* **Note:** Normally there is no need to implement this interface directly,
|
|
6076
|
+
* unless you want to achieve a specific goal with it.
|
|
6077
|
+
*
|
|
6078
|
+
* This interface enables you to use random generators from third party libraries such as [pure-rand](https://github.com/dubzzz/pure-rand).
|
|
6079
|
+
*
|
|
6080
|
+
* Instances are expected to be ready for use before being passed to any Faker constructor,
|
|
6081
|
+
* this includes being `seed()`ed with either a random or fixed value.
|
|
6082
|
+
*
|
|
6083
|
+
* For more information please refer to the [documentation](https://fakerjs.dev/guide/randomizer.html).
|
|
6084
|
+
*
|
|
6085
|
+
* @example
|
|
6086
|
+
* import { Faker, Randomizer, SimpleFaker } from '@faker-js/faker';
|
|
6087
|
+
* import { RandomGenerator, xoroshiro128plus } from 'pure-rand';
|
|
6088
|
+
*
|
|
6089
|
+
* function generatePureRandRandomizer(
|
|
6090
|
+
* seed: number | number[] = Date.now() ^ (Math.random() * 0x100000000),
|
|
6091
|
+
* factory: (seed: number) => RandomGenerator = xoroshiro128plus
|
|
6373
6092
|
* ): Randomizer {
|
|
6374
6093
|
* const self = {
|
|
6375
6094
|
* next: () => (self.generator.unsafeNext() >>> 0) / 0x100000000,
|
|
@@ -6420,42 +6139,47 @@ interface Randomizer {
|
|
|
6420
6139
|
*/
|
|
6421
6140
|
seed(seed: number | number[]): void;
|
|
6422
6141
|
}
|
|
6142
|
+
//#endregion
|
|
6143
|
+
//#region src/distributors/distributor.d.ts
|
|
6423
6144
|
/**
|
|
6424
|
-
*
|
|
6145
|
+
* A function that determines the distribution of generated values.
|
|
6146
|
+
* Values generated by a randomizer are considered uniformly distributed, distributor functions can be used to change this.
|
|
6147
|
+
* If many results are collected the results form a limited distribution between `0` and `1`.
|
|
6148
|
+
* So an exponential distributor's values will resemble a limited exponential distribution.
|
|
6425
6149
|
*
|
|
6426
|
-
*
|
|
6150
|
+
* Common examples of distributor functions are:
|
|
6427
6151
|
*
|
|
6428
|
-
*
|
|
6152
|
+
* - Uniform distributor: All values have the same likelihood.
|
|
6153
|
+
* - Normal distributor: Values are more likely to be close to a specific value.
|
|
6154
|
+
* - Exponential distributor: Values are biased towards `0`/`1` (depending on options).
|
|
6155
|
+
*
|
|
6156
|
+
* Distributor functions can be used by some faker functions such as `faker.number.int()` and `faker.number.float()`.
|
|
6157
|
+
*
|
|
6158
|
+
* Please note that the result from the distributor function is processed further by the function accepting it.
|
|
6159
|
+
* E.g. a distributor result of `0.5` within a call to `faker.number.int({ min: 10, max: 20 })` will result in `15`.
|
|
6160
|
+
*
|
|
6161
|
+
* @param randomizer The randomizer to use for generating values.
|
|
6162
|
+
*
|
|
6163
|
+
* @returns Generates a random float between 0 (inclusive) and 1 (exclusive).
|
|
6164
|
+
*
|
|
6165
|
+
* @example
|
|
6166
|
+
* import { Distributor, Randomizer, faker } from '@faker-js/faker';
|
|
6167
|
+
*
|
|
6168
|
+
* const alwaysMin: Distributor = () => 0;
|
|
6169
|
+
* faker.number.int({ min: 2, max: 10, distributor: alwaysMin }); // 2
|
|
6170
|
+
* faker.number.int({ min: 2, max: 10, distributor: alwaysMin }); // 2
|
|
6171
|
+
* faker.number.int({ min: 2, max: 10, distributor: alwaysMin }); // 2
|
|
6172
|
+
*
|
|
6173
|
+
* const uniform: Distributor = (randomizer: Randomizer) => randomizer.next();
|
|
6174
|
+
* faker.number.int({ min: 0, max: 10, distributor: uniform }); // 5
|
|
6175
|
+
* faker.number.int({ min: 0, max: 10, distributor: uniform }); // 2
|
|
6176
|
+
* faker.number.int({ min: 0, max: 10, distributor: uniform }); // 9
|
|
6177
|
+
*
|
|
6178
|
+
* @since 10.5.0
|
|
6429
6179
|
*/
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
*
|
|
6434
|
-
* **Note:**
|
|
6435
|
-
* A probability of `0.75` results in `true` being returned `75%` of the calls; likewise `0.3` => `30%`.
|
|
6436
|
-
* If the probability is `<= 0.0`, it will always return `false`.
|
|
6437
|
-
* If the probability is `>= 1.0`, it will always return `true`.
|
|
6438
|
-
* The probability is limited to two decimal places.
|
|
6439
|
-
*
|
|
6440
|
-
* @param options The optional options object or the probability (`[0.00, 1.00]`) of returning `true`.
|
|
6441
|
-
* @param options.probability The probability (`[0.00, 1.00]`) of returning `true`. Defaults to `0.5`.
|
|
6442
|
-
*
|
|
6443
|
-
* @example
|
|
6444
|
-
* faker.datatype.boolean() // false
|
|
6445
|
-
* faker.datatype.boolean(0.9) // true
|
|
6446
|
-
* faker.datatype.boolean({ probability: 0.1 }) // false
|
|
6447
|
-
*
|
|
6448
|
-
* @since 5.5.0
|
|
6449
|
-
*/
|
|
6450
|
-
boolean(options?: number | {
|
|
6451
|
-
/**
|
|
6452
|
-
* The probability (`[0.00, 1.00]`) of returning `true`.
|
|
6453
|
-
*
|
|
6454
|
-
* @default 0.5
|
|
6455
|
-
*/
|
|
6456
|
-
probability?: number;
|
|
6457
|
-
}): boolean;
|
|
6458
|
-
}
|
|
6180
|
+
type Distributor = (randomizer: Randomizer) => number;
|
|
6181
|
+
//#endregion
|
|
6182
|
+
//#region src/modules/number/index.d.ts
|
|
6459
6183
|
/**
|
|
6460
6184
|
* Module to generate numbers of any kind.
|
|
6461
6185
|
*
|
|
@@ -6479,6 +6203,7 @@ declare class NumberModule extends SimpleModuleBase {
|
|
|
6479
6203
|
* @param options.min Lower bound for generated number. Defaults to `0`.
|
|
6480
6204
|
* @param options.max Upper bound for generated number. Defaults to `Number.MAX_SAFE_INTEGER`.
|
|
6481
6205
|
* @param options.multipleOf Generated number will be a multiple of the given integer. Defaults to `1`.
|
|
6206
|
+
* @param options.distributor A function to determine the distribution of generated values. Defaults to `uniformDistributor()`.
|
|
6482
6207
|
*
|
|
6483
6208
|
* @throws {FakerError} When `min` is greater than `max`.
|
|
6484
6209
|
* @throws {FakerError} When there are no suitable integers between `min` and `max`.
|
|
@@ -6515,6 +6240,12 @@ declare class NumberModule extends SimpleModuleBase {
|
|
|
6515
6240
|
* @default 1
|
|
6516
6241
|
*/
|
|
6517
6242
|
multipleOf?: number;
|
|
6243
|
+
/**
|
|
6244
|
+
* A function to determine the distribution of generated values.
|
|
6245
|
+
*
|
|
6246
|
+
* @default uniformDistributor()
|
|
6247
|
+
*/
|
|
6248
|
+
distributor?: Distributor;
|
|
6518
6249
|
}): number;
|
|
6519
6250
|
/**
|
|
6520
6251
|
* Returns a single random floating-point number, by default between `0.0` and `1.0`. To change the range, pass a `min` and `max` value. To limit the number of decimal places, pass a `multipleOf` or `fractionDigits` parameter.
|
|
@@ -6523,7 +6254,8 @@ declare class NumberModule extends SimpleModuleBase {
|
|
|
6523
6254
|
* @param options.min Lower bound for generated number, inclusive. Defaults to `0.0`.
|
|
6524
6255
|
* @param options.max Upper bound for generated number, exclusive, unless `multipleOf` or `fractionDigits` are passed. Defaults to `1.0`.
|
|
6525
6256
|
* @param options.multipleOf The generated number will be a multiple of this parameter. Only one of `multipleOf` or `fractionDigits` should be passed.
|
|
6526
|
-
* @param options.fractionDigits The maximum number of digits to appear after the decimal point, for example `2` will round to 2 decimal points.
|
|
6257
|
+
* @param options.fractionDigits The maximum number of digits to appear after the decimal point, for example `2` will round to 2 decimal points. Only one of `multipleOf` or `fractionDigits` should be passed.
|
|
6258
|
+
* @param options.distributor A function to determine the distribution of generated values. Defaults to `uniformDistributor()`.
|
|
6527
6259
|
*
|
|
6528
6260
|
* @throws {FakerError} When `min` is greater than `max`.
|
|
6529
6261
|
* @throws {FakerError} When `multipleOf` is not a positive number.
|
|
@@ -6557,13 +6289,19 @@ declare class NumberModule extends SimpleModuleBase {
|
|
|
6557
6289
|
*/
|
|
6558
6290
|
max?: number;
|
|
6559
6291
|
/**
|
|
6560
|
-
* The maximum number of digits to appear after the decimal point, for example `2` will round to 2 decimal points.
|
|
6292
|
+
* The maximum number of digits to appear after the decimal point, for example `2` will round to 2 decimal points. Only one of `multipleOf` or `fractionDigits` should be passed.
|
|
6561
6293
|
*/
|
|
6562
6294
|
fractionDigits?: number;
|
|
6563
6295
|
/**
|
|
6564
6296
|
* The generated number will be a multiple of this parameter. Only one of `multipleOf` or `fractionDigits` should be passed.
|
|
6565
6297
|
*/
|
|
6566
6298
|
multipleOf?: number;
|
|
6299
|
+
/**
|
|
6300
|
+
* A function to determine the distribution of generated values.
|
|
6301
|
+
*
|
|
6302
|
+
* @default uniformDistributor()
|
|
6303
|
+
*/
|
|
6304
|
+
distributor?: Distributor;
|
|
6567
6305
|
}): number;
|
|
6568
6306
|
/**
|
|
6569
6307
|
* Returns a [binary](https://en.wikipedia.org/wiki/Binary_number) number.
|
|
@@ -6583,168 +6321,689 @@ declare class NumberModule extends SimpleModuleBase {
|
|
|
6583
6321
|
* faker.number.binary(255) // '110101'
|
|
6584
6322
|
* faker.number.binary({ min: 0, max: 65535 }) // '10110101'
|
|
6585
6323
|
*
|
|
6586
|
-
* @since 8.0.0
|
|
6324
|
+
* @since 8.0.0
|
|
6325
|
+
*/
|
|
6326
|
+
binary(options?: number | {
|
|
6327
|
+
/**
|
|
6328
|
+
* Lower bound for generated number.
|
|
6329
|
+
*
|
|
6330
|
+
* @default 0
|
|
6331
|
+
*/
|
|
6332
|
+
min?: number;
|
|
6333
|
+
/**
|
|
6334
|
+
* Upper bound for generated number.
|
|
6335
|
+
*
|
|
6336
|
+
* @default 1
|
|
6337
|
+
*/
|
|
6338
|
+
max?: number;
|
|
6339
|
+
}): string;
|
|
6340
|
+
/**
|
|
6341
|
+
* Returns an [octal](https://en.wikipedia.org/wiki/Octal) number.
|
|
6342
|
+
* The bounds are inclusive.
|
|
6343
|
+
*
|
|
6344
|
+
* @param options Maximum value or options object.
|
|
6345
|
+
* @param options.min Lower bound for generated number. Defaults to `0`.
|
|
6346
|
+
* @param options.max Upper bound for generated number. Defaults to `7`.
|
|
6347
|
+
*
|
|
6348
|
+
* @throws {FakerError} When `min` is greater than `max`.
|
|
6349
|
+
* @throws {FakerError} When there are no integers between `min` and `max`.
|
|
6350
|
+
*
|
|
6351
|
+
* @see faker.string.octal(): For generating an `octal string` with a given length (range).
|
|
6352
|
+
*
|
|
6353
|
+
* @example
|
|
6354
|
+
* faker.number.octal() // '5'
|
|
6355
|
+
* faker.number.octal(255) // '377'
|
|
6356
|
+
* faker.number.octal({ min: 0, max: 65535 }) // '4766'
|
|
6357
|
+
*
|
|
6358
|
+
* @since 8.0.0
|
|
6359
|
+
*/
|
|
6360
|
+
octal(options?: number | {
|
|
6361
|
+
/**
|
|
6362
|
+
* Lower bound for generated number.
|
|
6363
|
+
*
|
|
6364
|
+
* @default 0
|
|
6365
|
+
*/
|
|
6366
|
+
min?: number;
|
|
6367
|
+
/**
|
|
6368
|
+
* Upper bound for generated number.
|
|
6369
|
+
*
|
|
6370
|
+
* @default 7
|
|
6371
|
+
*/
|
|
6372
|
+
max?: number;
|
|
6373
|
+
}): string;
|
|
6374
|
+
/**
|
|
6375
|
+
* Returns a lowercase [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) number.
|
|
6376
|
+
* The bounds are inclusive.
|
|
6377
|
+
*
|
|
6378
|
+
* @param options Maximum value or options object.
|
|
6379
|
+
* @param options.min Lower bound for generated number. Defaults to `0`.
|
|
6380
|
+
* @param options.max Upper bound for generated number. Defaults to `15`.
|
|
6381
|
+
*
|
|
6382
|
+
* @throws {FakerError} When `min` is greater than `max`.
|
|
6383
|
+
* @throws {FakerError} When there are no integers between `min` and `max`.
|
|
6384
|
+
*
|
|
6385
|
+
* @example
|
|
6386
|
+
* faker.number.hex() // 'b'
|
|
6387
|
+
* faker.number.hex(255) // '9d'
|
|
6388
|
+
* faker.number.hex({ min: 0, max: 65535 }) // 'af17'
|
|
6389
|
+
*
|
|
6390
|
+
* @since 8.0.0
|
|
6391
|
+
*/
|
|
6392
|
+
hex(options?: number | {
|
|
6393
|
+
/**
|
|
6394
|
+
* Lower bound for generated number.
|
|
6395
|
+
*
|
|
6396
|
+
* @default 0
|
|
6397
|
+
*/
|
|
6398
|
+
min?: number;
|
|
6399
|
+
/**
|
|
6400
|
+
* Upper bound for generated number.
|
|
6401
|
+
*
|
|
6402
|
+
* @default 15
|
|
6403
|
+
*/
|
|
6404
|
+
max?: number;
|
|
6405
|
+
}): string;
|
|
6406
|
+
/**
|
|
6407
|
+
* Returns a [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type) number.
|
|
6408
|
+
* The bounds are inclusive.
|
|
6409
|
+
*
|
|
6410
|
+
* @param options Maximum value or options object.
|
|
6411
|
+
* @param options.min Lower bound for generated bigint. Defaults to `0n`.
|
|
6412
|
+
* @param options.max Upper bound for generated bigint. Defaults to `min + 999999999999999n`.
|
|
6413
|
+
* @param options.multipleOf The generated bigint will be a multiple of this parameter. Defaults to `1n`.
|
|
6414
|
+
*
|
|
6415
|
+
* @throws {FakerError} When `min` is greater than `max`.
|
|
6416
|
+
* @throws {FakerError} When there are no suitable bigint between `min` and `max`.
|
|
6417
|
+
* @throws {FakerError} When `multipleOf` is not a positive bigint.
|
|
6418
|
+
*
|
|
6419
|
+
* @example
|
|
6420
|
+
* faker.number.bigInt() // 55422n
|
|
6421
|
+
* faker.number.bigInt(100n) // 52n
|
|
6422
|
+
* faker.number.bigInt({ min: 1000000n }) // 431433n
|
|
6423
|
+
* faker.number.bigInt({ max: 100n }) // 42n
|
|
6424
|
+
* faker.number.bigInt({ multipleOf: 7n }) // 35n
|
|
6425
|
+
* faker.number.bigInt({ min: 10n, max: 100n }) // 36n
|
|
6426
|
+
*
|
|
6427
|
+
* @since 8.0.0
|
|
6428
|
+
*/
|
|
6429
|
+
bigInt(options?: bigint | number | string | boolean | {
|
|
6430
|
+
/**
|
|
6431
|
+
* Lower bound for generated bigint.
|
|
6432
|
+
*
|
|
6433
|
+
* @default 0n
|
|
6434
|
+
*/
|
|
6435
|
+
min?: bigint | number | string | boolean;
|
|
6436
|
+
/**
|
|
6437
|
+
* Upper bound for generated bigint.
|
|
6438
|
+
*
|
|
6439
|
+
* @default min + 999999999999999n
|
|
6440
|
+
*/
|
|
6441
|
+
max?: bigint | number | string | boolean;
|
|
6442
|
+
/**
|
|
6443
|
+
* The generated bigint will be a multiple of this parameter.
|
|
6444
|
+
*
|
|
6445
|
+
* @default 1n
|
|
6446
|
+
*/
|
|
6447
|
+
multipleOf?: bigint | number | string | boolean;
|
|
6448
|
+
}): bigint;
|
|
6449
|
+
/**
|
|
6450
|
+
* Returns a roman numeral in String format.
|
|
6451
|
+
* The bounds are inclusive.
|
|
6452
|
+
*
|
|
6453
|
+
* @param options Maximum value or options object.
|
|
6454
|
+
* @param options.min Lower bound for generated roman numerals. Defaults to `1`.
|
|
6455
|
+
* @param options.max Upper bound for generated roman numerals. Defaults to `3999`.
|
|
6456
|
+
*
|
|
6457
|
+
* @throws {FakerError} When `min` is greater than `max`.
|
|
6458
|
+
* @throws {FakerError} When `min`, `max` is not a number.
|
|
6459
|
+
* @throws {FakerError} When `min` is less than `1`.
|
|
6460
|
+
* @throws {FakerError} When `max` is greater than `3999`.
|
|
6461
|
+
*
|
|
6462
|
+
* @example
|
|
6463
|
+
* faker.number.romanNumeral() // "CMXCIII"
|
|
6464
|
+
* faker.number.romanNumeral(5) // "III"
|
|
6465
|
+
* faker.number.romanNumeral({ min: 10 }) // "XCIX"
|
|
6466
|
+
* faker.number.romanNumeral({ max: 20 }) // "XVII"
|
|
6467
|
+
* faker.number.romanNumeral({ min: 5, max: 10 }) // "VII"
|
|
6468
|
+
*
|
|
6469
|
+
* @since 9.2.0
|
|
6470
|
+
*/
|
|
6471
|
+
romanNumeral(options?: number | {
|
|
6472
|
+
/**
|
|
6473
|
+
* Lower bound for generated number.
|
|
6474
|
+
*
|
|
6475
|
+
* @default 1
|
|
6476
|
+
*/
|
|
6477
|
+
min?: number;
|
|
6478
|
+
/**
|
|
6479
|
+
* Upper bound for generated number.
|
|
6480
|
+
*
|
|
6481
|
+
* @default 3999
|
|
6482
|
+
*/
|
|
6483
|
+
max?: number;
|
|
6484
|
+
}): string;
|
|
6485
|
+
}
|
|
6486
|
+
//#endregion
|
|
6487
|
+
//#region src/internal/types.d.ts
|
|
6488
|
+
/**
|
|
6489
|
+
* Type that provides auto-suggestions but also any string.
|
|
6490
|
+
*
|
|
6491
|
+
* @see https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609
|
|
6492
|
+
*/
|
|
6493
|
+
type LiteralUnion<TSuggested extends TBase, TBase = string> = TSuggested | (TBase & {
|
|
6494
|
+
zz_IGNORE_ME?: never;
|
|
6495
|
+
});
|
|
6496
|
+
//#endregion
|
|
6497
|
+
//#region src/modules/string/index.d.ts
|
|
6498
|
+
type LowerAlphaChar = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
|
|
6499
|
+
type UpperAlphaChar = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z';
|
|
6500
|
+
type NumericChar = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
|
|
6501
|
+
type AlphaChar = LowerAlphaChar | UpperAlphaChar;
|
|
6502
|
+
type AlphaNumericChar = AlphaChar | NumericChar;
|
|
6503
|
+
/**
|
|
6504
|
+
* Module to generate string related entries.
|
|
6505
|
+
*
|
|
6506
|
+
* ### Overview
|
|
6507
|
+
*
|
|
6508
|
+
* For a string containing just A-Z characters, use [`alpha()`](https://fakerjs.dev/api/string.html#alpha). To add digits too, use [`alphanumeric()`](https://fakerjs.dev/api/string.html#alphanumeric). If you only want punctuation marks/symbols, use [`symbol()`](https://fakerjs.dev/api/string.html). For a full set of ASCII characters, use [`sample()`](https://fakerjs.dev/api/string.html#sample). For a custom set of characters, use [`fromCharacters()`](https://fakerjs.dev/api/string.html#fromcharacters).
|
|
6509
|
+
*
|
|
6510
|
+
* For strings of base-ten digits, use [`numeric()`](https://fakerjs.dev/api/string.html#numeric). For other bases, use [`binary()`](https://fakerjs.dev/api/string.html#binary), [`octal()`](https://fakerjs.dev/api/string.html#octal), or [`hexadecimal()`](https://fakerjs.dev/api/string.html#hexadecimal)).
|
|
6511
|
+
*
|
|
6512
|
+
* You can generate standard ID strings using [`uuid()`](https://fakerjs.dev/api/string.html#uuid) or [`nanoid()`](https://fakerjs.dev/api/string.html#nanoid).
|
|
6513
|
+
*
|
|
6514
|
+
* ### Related modules
|
|
6515
|
+
*
|
|
6516
|
+
* - Emoji can be found at [`faker.internet.emoji()`](https://fakerjs.dev/api/internet.html#emoji).
|
|
6517
|
+
* - The [`faker.helpers`](https://fakerjs.dev/api/helpers.html) module includes a number of string related methods.
|
|
6518
|
+
*/
|
|
6519
|
+
declare class StringModule extends SimpleModuleBase {
|
|
6520
|
+
/**
|
|
6521
|
+
* Generates a string from the given characters.
|
|
6522
|
+
*
|
|
6523
|
+
* @param characters The characters to use for the string. Can be a string or an array of characters.
|
|
6524
|
+
* If it is an array, then each element is treated as a single character even if it is a string with multiple characters.
|
|
6525
|
+
* @param length The length of the string to generate either as a fixed length or as a length range. Defaults to `1`.
|
|
6526
|
+
* @param length.min The minimum length of the string to generate.
|
|
6527
|
+
* @param length.max The maximum length of the string to generate.
|
|
6528
|
+
*
|
|
6529
|
+
* @example
|
|
6530
|
+
* faker.string.fromCharacters('abc') // 'c'
|
|
6531
|
+
* faker.string.fromCharacters(['a', 'b', 'c']) // 'a'
|
|
6532
|
+
* faker.string.fromCharacters('abc', 10) // 'cbbbacbacb'
|
|
6533
|
+
* faker.string.fromCharacters('abc', { min: 5, max: 10 }) // 'abcaaaba'
|
|
6534
|
+
*
|
|
6535
|
+
* @since 8.0.0
|
|
6536
|
+
*/
|
|
6537
|
+
fromCharacters(characters: string | ReadonlyArray<string>, length?: number | {
|
|
6538
|
+
/**
|
|
6539
|
+
* The minimum length of the string to generate.
|
|
6540
|
+
*/
|
|
6541
|
+
min: number;
|
|
6542
|
+
/**
|
|
6543
|
+
* The maximum length of the string to generate.
|
|
6544
|
+
*/
|
|
6545
|
+
max: number;
|
|
6546
|
+
}): string;
|
|
6547
|
+
/**
|
|
6548
|
+
* Generating a string consisting of letters in the English alphabet.
|
|
6549
|
+
*
|
|
6550
|
+
* @param options Either the length of the string to generate or the optional options object.
|
|
6551
|
+
* @param options.length The length of the string to generate either as a fixed length or as a length range. Defaults to `1`.
|
|
6552
|
+
* @param options.casing The casing of the characters. Defaults to `'mixed'`.
|
|
6553
|
+
* @param options.exclude An array with characters which should be excluded in the generated string. Defaults to `[]`.
|
|
6554
|
+
*
|
|
6555
|
+
* @example
|
|
6556
|
+
* faker.string.alpha() // 'b'
|
|
6557
|
+
* faker.string.alpha(10) // 'fEcAaCVbaR'
|
|
6558
|
+
* faker.string.alpha({ length: { min: 5, max: 10 } }) // 'HcVrCf'
|
|
6559
|
+
* faker.string.alpha({ casing: 'lower' }) // 'r'
|
|
6560
|
+
* faker.string.alpha({ exclude: ['W'] }) // 'Z'
|
|
6561
|
+
* faker.string.alpha({ length: 5, casing: 'upper', exclude: ['A'] }) // 'DTCIC'
|
|
6562
|
+
*
|
|
6563
|
+
* @since 8.0.0
|
|
6564
|
+
*/
|
|
6565
|
+
alpha(options?: number | {
|
|
6566
|
+
/**
|
|
6567
|
+
* The length of the string to generate either as a fixed length or as a length range.
|
|
6568
|
+
*
|
|
6569
|
+
* @default 1
|
|
6570
|
+
*/
|
|
6571
|
+
length?: number | {
|
|
6572
|
+
/**
|
|
6573
|
+
* The minimum length of the string to generate.
|
|
6574
|
+
*/
|
|
6575
|
+
min: number;
|
|
6576
|
+
/**
|
|
6577
|
+
* The maximum length of the string to generate.
|
|
6578
|
+
*/
|
|
6579
|
+
max: number;
|
|
6580
|
+
};
|
|
6581
|
+
/**
|
|
6582
|
+
* The casing of the characters.
|
|
6583
|
+
*
|
|
6584
|
+
* @default 'mixed'
|
|
6585
|
+
*/
|
|
6586
|
+
casing?: Casing;
|
|
6587
|
+
/**
|
|
6588
|
+
* An array with characters which should be excluded in the generated string.
|
|
6589
|
+
*
|
|
6590
|
+
* @default []
|
|
6591
|
+
*/
|
|
6592
|
+
exclude?: ReadonlyArray<LiteralUnion<AlphaChar>> | string;
|
|
6593
|
+
}): string;
|
|
6594
|
+
/**
|
|
6595
|
+
* Generating a string consisting of alpha characters and digits.
|
|
6596
|
+
*
|
|
6597
|
+
* @param options Either the length of the string to generate or the optional options object.
|
|
6598
|
+
* @param options.length The length of the string to generate either as a fixed length or as a length range. Defaults to `1`.
|
|
6599
|
+
* @param options.casing The casing of the characters. Defaults to `'mixed'`.
|
|
6600
|
+
* @param options.exclude An array of characters and digits which should be excluded in the generated string. Defaults to `[]`.
|
|
6601
|
+
*
|
|
6602
|
+
* @example
|
|
6603
|
+
* faker.string.alphanumeric() // '2'
|
|
6604
|
+
* faker.string.alphanumeric(5) // '3e5V7'
|
|
6605
|
+
* faker.string.alphanumeric({ length: { min: 5, max: 10 } }) // 'muaApG'
|
|
6606
|
+
* faker.string.alphanumeric({ casing: 'upper' }) // 'A'
|
|
6607
|
+
* faker.string.alphanumeric({ exclude: ['W'] }) // 'r'
|
|
6608
|
+
* faker.string.alphanumeric({ length: 5, exclude: ["a"] }) // 'x1Z7f'
|
|
6609
|
+
*
|
|
6610
|
+
* @since 8.0.0
|
|
6611
|
+
*/
|
|
6612
|
+
alphanumeric(options?: number | {
|
|
6613
|
+
/**
|
|
6614
|
+
* The length of the string to generate either as a fixed length or as a length range.
|
|
6615
|
+
*
|
|
6616
|
+
* @default 1
|
|
6617
|
+
*/
|
|
6618
|
+
length?: number | {
|
|
6619
|
+
/**
|
|
6620
|
+
* The minimum length of the string to generate.
|
|
6621
|
+
*/
|
|
6622
|
+
min: number;
|
|
6623
|
+
/**
|
|
6624
|
+
* The maximum length of the string to generate.
|
|
6625
|
+
*/
|
|
6626
|
+
max: number;
|
|
6627
|
+
};
|
|
6628
|
+
/**
|
|
6629
|
+
* The casing of the characters.
|
|
6630
|
+
*
|
|
6631
|
+
* @default 'mixed'
|
|
6632
|
+
*/
|
|
6633
|
+
casing?: Casing;
|
|
6634
|
+
/**
|
|
6635
|
+
* An array of characters and digits which should be excluded in the generated string.
|
|
6636
|
+
*
|
|
6637
|
+
* @default []
|
|
6638
|
+
*/
|
|
6639
|
+
exclude?: ReadonlyArray<LiteralUnion<AlphaNumericChar>> | string;
|
|
6640
|
+
}): string;
|
|
6641
|
+
/**
|
|
6642
|
+
* Returns a [binary](https://en.wikipedia.org/wiki/Binary_number) string.
|
|
6643
|
+
*
|
|
6644
|
+
* @param options The optional options object.
|
|
6645
|
+
* @param options.length The length of the string (excluding the prefix) to generate either as a fixed length or as a length range. Defaults to `1`.
|
|
6646
|
+
* @param options.prefix Prefix for the generated number. Defaults to `'0b'`.
|
|
6647
|
+
*
|
|
6648
|
+
* @see faker.number.binary(): For generating a binary number (within a range).
|
|
6649
|
+
*
|
|
6650
|
+
* @example
|
|
6651
|
+
* faker.string.binary() // '0b1'
|
|
6652
|
+
* faker.string.binary({ length: 10 }) // '0b1101011011'
|
|
6653
|
+
* faker.string.binary({ length: { min: 5, max: 10 } }) // '0b11101011'
|
|
6654
|
+
* faker.string.binary({ prefix: '0b' }) // '0b1'
|
|
6655
|
+
* faker.string.binary({ length: 10, prefix: 'bin_' }) // 'bin_1101011011'
|
|
6656
|
+
*
|
|
6657
|
+
* @since 8.0.0
|
|
6658
|
+
*/
|
|
6659
|
+
binary(options?: {
|
|
6660
|
+
/**
|
|
6661
|
+
* The length of the string (excluding the prefix) to generate either as a fixed length or as a length range.
|
|
6662
|
+
*
|
|
6663
|
+
* @default 1
|
|
6664
|
+
*/
|
|
6665
|
+
length?: number | {
|
|
6666
|
+
/**
|
|
6667
|
+
* The minimum length of the string (excluding the prefix) to generate.
|
|
6668
|
+
*/
|
|
6669
|
+
min: number;
|
|
6670
|
+
/**
|
|
6671
|
+
* The maximum length of the string (excluding the prefix) to generate.
|
|
6672
|
+
*/
|
|
6673
|
+
max: number;
|
|
6674
|
+
};
|
|
6675
|
+
/**
|
|
6676
|
+
* Prefix for the generated number.
|
|
6677
|
+
*
|
|
6678
|
+
* @default '0b'
|
|
6679
|
+
*/
|
|
6680
|
+
prefix?: string;
|
|
6681
|
+
}): string;
|
|
6682
|
+
/**
|
|
6683
|
+
* Returns an [octal](https://en.wikipedia.org/wiki/Octal) string.
|
|
6684
|
+
*
|
|
6685
|
+
* @param options The optional options object.
|
|
6686
|
+
* @param options.length The length of the string (excluding the prefix) to generate either as a fixed length or as a length range. Defaults to `1`.
|
|
6687
|
+
* @param options.prefix Prefix for the generated number. Defaults to `'0o'`.
|
|
6688
|
+
*
|
|
6689
|
+
* @see faker.number.octal(): For generating an octal number (within a range).
|
|
6690
|
+
*
|
|
6691
|
+
* @example
|
|
6692
|
+
* faker.string.octal() // '0o3'
|
|
6693
|
+
* faker.string.octal({ length: 10 }) // '0o1526216210'
|
|
6694
|
+
* faker.string.octal({ length: { min: 5, max: 10 } }) // '0o15263214'
|
|
6695
|
+
* faker.string.octal({ prefix: '0o' }) // '0o7'
|
|
6696
|
+
* faker.string.octal({ length: 10, prefix: 'oct_' }) // 'oct_1542153414'
|
|
6697
|
+
*
|
|
6698
|
+
* @since 8.0.0
|
|
6699
|
+
*/
|
|
6700
|
+
octal(options?: {
|
|
6701
|
+
/**
|
|
6702
|
+
* The length of the string (excluding the prefix) to generate either as a fixed length or as a length range.
|
|
6703
|
+
*
|
|
6704
|
+
* @default 1
|
|
6705
|
+
*/
|
|
6706
|
+
length?: number | {
|
|
6707
|
+
/**
|
|
6708
|
+
* The minimum length of the string (excluding the prefix) to generate.
|
|
6709
|
+
*/
|
|
6710
|
+
min: number;
|
|
6711
|
+
/**
|
|
6712
|
+
* The maximum length of the string (excluding the prefix) to generate.
|
|
6713
|
+
*/
|
|
6714
|
+
max: number;
|
|
6715
|
+
};
|
|
6716
|
+
/**
|
|
6717
|
+
* Prefix for the generated number.
|
|
6718
|
+
*
|
|
6719
|
+
* @default '0o'
|
|
6720
|
+
*/
|
|
6721
|
+
prefix?: string;
|
|
6722
|
+
}): string;
|
|
6723
|
+
/**
|
|
6724
|
+
* Returns a [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) string.
|
|
6725
|
+
*
|
|
6726
|
+
* @param options The optional options object.
|
|
6727
|
+
* @param options.length The length of the string (excluding the prefix) to generate either as a fixed length or as a length range. Defaults to `1`.
|
|
6728
|
+
* @param options.casing Casing of the generated number. Defaults to `'mixed'`.
|
|
6729
|
+
* @param options.prefix Prefix for the generated number. Defaults to `'0x'`.
|
|
6730
|
+
*
|
|
6731
|
+
* @example
|
|
6732
|
+
* faker.string.hexadecimal() // '0xB'
|
|
6733
|
+
* faker.string.hexadecimal({ length: 10 }) // '0xaE13d044cB'
|
|
6734
|
+
* faker.string.hexadecimal({ length: { min: 5, max: 10 } }) // '0x7dEf7FCD'
|
|
6735
|
+
* faker.string.hexadecimal({ prefix: '0x' }) // '0xE'
|
|
6736
|
+
* faker.string.hexadecimal({ casing: 'lower' }) // '0xf'
|
|
6737
|
+
* faker.string.hexadecimal({ length: 10, prefix: '#' }) // '#f12a974eB1'
|
|
6738
|
+
* faker.string.hexadecimal({ length: 10, casing: 'upper' }) // '0xE3F38014FB'
|
|
6739
|
+
* faker.string.hexadecimal({ casing: 'lower', prefix: '' }) // 'd'
|
|
6740
|
+
* faker.string.hexadecimal({ length: 10, casing: 'mixed', prefix: '0x' }) // '0xAdE330a4D1'
|
|
6741
|
+
*
|
|
6742
|
+
* @since 8.0.0
|
|
6743
|
+
*/
|
|
6744
|
+
hexadecimal(options?: {
|
|
6745
|
+
/**
|
|
6746
|
+
* The length of the string (excluding the prefix) to generate either as a fixed length or as a length range.
|
|
6747
|
+
*
|
|
6748
|
+
* @default 1
|
|
6749
|
+
*/
|
|
6750
|
+
length?: number | {
|
|
6751
|
+
/**
|
|
6752
|
+
* The minimum length of the string (excluding the prefix) to generate.
|
|
6753
|
+
*/
|
|
6754
|
+
min: number;
|
|
6755
|
+
/**
|
|
6756
|
+
* The maximum length of the string (excluding the prefix) to generate.
|
|
6757
|
+
*/
|
|
6758
|
+
max: number;
|
|
6759
|
+
};
|
|
6760
|
+
/**
|
|
6761
|
+
* Casing of the generated number.
|
|
6762
|
+
*
|
|
6763
|
+
* @default 'mixed'
|
|
6764
|
+
*/
|
|
6765
|
+
casing?: Casing;
|
|
6766
|
+
/**
|
|
6767
|
+
* Prefix for the generated number.
|
|
6768
|
+
*
|
|
6769
|
+
* @default '0x'
|
|
6770
|
+
*/
|
|
6771
|
+
prefix?: string;
|
|
6772
|
+
}): string;
|
|
6773
|
+
/**
|
|
6774
|
+
* Generates a given length string of digits.
|
|
6775
|
+
*
|
|
6776
|
+
* @param options Either the length of the string to generate or the optional options object.
|
|
6777
|
+
* @param options.length The length of the string to generate either as a fixed length or as a length range. Defaults to `1`.
|
|
6778
|
+
* @param options.allowLeadingZeros Whether leading zeros are allowed or not. Defaults to `true`.
|
|
6779
|
+
* @param options.exclude An array of digits which should be excluded in the generated string. Defaults to `[]`.
|
|
6780
|
+
*
|
|
6781
|
+
* @see faker.number.int(): For generating a number (within a range).
|
|
6782
|
+
*
|
|
6783
|
+
* @example
|
|
6784
|
+
* faker.string.numeric() // '2'
|
|
6785
|
+
* faker.string.numeric(5) // '31507'
|
|
6786
|
+
* faker.string.numeric(42) // '06434563150765416546479875435481513188548'
|
|
6787
|
+
* faker.string.numeric({ length: { min: 5, max: 10 } }) // '197089478'
|
|
6788
|
+
* faker.string.numeric({ length: 42, allowLeadingZeros: false }) // '72564846278453876543517840713421451546115'
|
|
6789
|
+
* faker.string.numeric({ length: 6, exclude: ['0'] }) // '943228'
|
|
6790
|
+
*
|
|
6791
|
+
* @since 8.0.0
|
|
6792
|
+
*/
|
|
6793
|
+
numeric(options?: number | {
|
|
6794
|
+
/**
|
|
6795
|
+
* The length of the string to generate either as a fixed length or as a length range.
|
|
6796
|
+
*
|
|
6797
|
+
* @default 1
|
|
6798
|
+
*/
|
|
6799
|
+
length?: number | {
|
|
6800
|
+
/**
|
|
6801
|
+
* The minimum length of the string to generate.
|
|
6802
|
+
*/
|
|
6803
|
+
min: number;
|
|
6804
|
+
/**
|
|
6805
|
+
* The maximum length of the string to generate.
|
|
6806
|
+
*/
|
|
6807
|
+
max: number;
|
|
6808
|
+
};
|
|
6809
|
+
/**
|
|
6810
|
+
* Whether leading zeros are allowed or not.
|
|
6811
|
+
*
|
|
6812
|
+
* @default true
|
|
6813
|
+
*/
|
|
6814
|
+
allowLeadingZeros?: boolean;
|
|
6815
|
+
/**
|
|
6816
|
+
* An array of digits which should be excluded in the generated string.
|
|
6817
|
+
*
|
|
6818
|
+
* @default []
|
|
6819
|
+
*/
|
|
6820
|
+
exclude?: ReadonlyArray<LiteralUnion<NumericChar>> | string;
|
|
6821
|
+
}): string;
|
|
6822
|
+
/**
|
|
6823
|
+
* Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`).
|
|
6824
|
+
*
|
|
6825
|
+
* @param length The length of the string (excluding the prefix) to generate either as a fixed length or as a length range. Defaults to `10`.
|
|
6826
|
+
* @param length.min The minimum length of the string to generate.
|
|
6827
|
+
* @param length.max The maximum length of the string to generate.
|
|
6828
|
+
*
|
|
6829
|
+
* @example
|
|
6830
|
+
* faker.string.sample() // 'Zo!.:*e>wR'
|
|
6831
|
+
* faker.string.sample(5) // '6Bye8'
|
|
6832
|
+
* faker.string.sample({ min: 5, max: 10 }) // 'FeKunG'
|
|
6833
|
+
*
|
|
6834
|
+
* @since 8.0.0
|
|
6835
|
+
*/
|
|
6836
|
+
sample(length?: number | {
|
|
6837
|
+
/**
|
|
6838
|
+
* The minimum length of the string to generate.
|
|
6839
|
+
*/
|
|
6840
|
+
min: number;
|
|
6841
|
+
/**
|
|
6842
|
+
* The maximum length of the string to generate.
|
|
6843
|
+
*/
|
|
6844
|
+
max: number;
|
|
6845
|
+
}): string;
|
|
6846
|
+
/**
|
|
6847
|
+
* Returns a UUID ([Universally Unique Identifier](https://en.wikipedia.org/wiki/Universally_unique_identifier)).
|
|
6848
|
+
*
|
|
6849
|
+
* @example
|
|
6850
|
+
* faker.string.uuid() // '4136cd0b-d90b-4af7-b485-5d1ded8db252'
|
|
6851
|
+
*
|
|
6852
|
+
* @since 8.0.0
|
|
6853
|
+
*/
|
|
6854
|
+
uuid(): string;
|
|
6855
|
+
/**
|
|
6856
|
+
* Returns a UUID v4 ([Universally Unique Identifier](https://en.wikipedia.org/wiki/Universally_unique_identifier)).
|
|
6857
|
+
*
|
|
6858
|
+
* @param options An options object.
|
|
6859
|
+
* @param options.version The specific UUID version to use.
|
|
6860
|
+
*
|
|
6861
|
+
* @example
|
|
6862
|
+
* faker.string.uuid({ version: 4 }) // '4136cd0b-d90b-4af7-b485-5d1ded8db252'
|
|
6863
|
+
*
|
|
6864
|
+
* @since 8.0.0
|
|
6865
|
+
*/
|
|
6866
|
+
uuid(options: {
|
|
6867
|
+
/**
|
|
6868
|
+
* The specific UUID version to use.
|
|
6869
|
+
*/
|
|
6870
|
+
version: 4;
|
|
6871
|
+
}): string;
|
|
6872
|
+
/**
|
|
6873
|
+
* Returns a UUID v7 ([Universally Unique Identifier](https://en.wikipedia.org/wiki/Universally_unique_identifier)).
|
|
6874
|
+
*
|
|
6875
|
+
* @param options An options object.
|
|
6876
|
+
* @param options.version The specific UUID version to use.
|
|
6877
|
+
* @param options.refDate The timestamp to encode into the uuid.
|
|
6878
|
+
* The encoded timestamp is represented by the first 12 characters of the result.
|
|
6879
|
+
* Defaults to `faker.defaultRefDate()`.
|
|
6880
|
+
*
|
|
6881
|
+
* @example
|
|
6882
|
+
* faker.string.uuid() // '019be2c5-58de-70fe-a693-2ccbff1f0780'
|
|
6883
|
+
*
|
|
6884
|
+
* @since 10.3.0
|
|
6587
6885
|
*/
|
|
6588
|
-
|
|
6886
|
+
uuid(options: {
|
|
6589
6887
|
/**
|
|
6590
|
-
*
|
|
6591
|
-
*
|
|
6592
|
-
* @default 0
|
|
6888
|
+
* The specific UUID version to use.
|
|
6593
6889
|
*/
|
|
6594
|
-
|
|
6890
|
+
version: 7;
|
|
6595
6891
|
/**
|
|
6596
|
-
*
|
|
6892
|
+
* The timestamp to encode into the uuid.
|
|
6893
|
+
* The encoded timestamp is represented by the first 12 characters of the result.
|
|
6597
6894
|
*
|
|
6598
|
-
* @default
|
|
6895
|
+
* @default faker.defaultRefDate()
|
|
6599
6896
|
*/
|
|
6600
|
-
|
|
6897
|
+
refDate: string | Date | number;
|
|
6601
6898
|
}): string;
|
|
6602
6899
|
/**
|
|
6603
|
-
* Returns
|
|
6604
|
-
* The bounds are inclusive.
|
|
6605
|
-
*
|
|
6606
|
-
* @param options Maximum value or options object.
|
|
6607
|
-
* @param options.min Lower bound for generated number. Defaults to `0`.
|
|
6608
|
-
* @param options.max Upper bound for generated number. Defaults to `7`.
|
|
6609
|
-
*
|
|
6610
|
-
* @throws {FakerError} When `min` is greater than `max`.
|
|
6611
|
-
* @throws {FakerError} When there are no integers between `min` and `max`.
|
|
6900
|
+
* Returns a UUID ([Universally Unique Identifier](https://en.wikipedia.org/wiki/Universally_unique_identifier)).
|
|
6612
6901
|
*
|
|
6613
|
-
* @
|
|
6902
|
+
* @param options An optional options object.
|
|
6903
|
+
* @param options.version The specific UUID version to use. Defaults to `4`.
|
|
6904
|
+
* @param options.refDate The timestamp to encode into the UUID.
|
|
6905
|
+
* This parameter is only relevant for UUID v7.
|
|
6906
|
+
* Defaults to `faker.defaultRefDate()`.
|
|
6614
6907
|
*
|
|
6615
6908
|
* @example
|
|
6616
|
-
* faker.
|
|
6617
|
-
* faker.
|
|
6618
|
-
* faker.
|
|
6909
|
+
* faker.string.uuid() // '4136cd0b-d90b-4af7-b485-5d1ded8db252'
|
|
6910
|
+
* faker.string.uuid({ version: 4 }) // 'd5482c1f-c30d-4bbc-b151-d95145bae71b'
|
|
6911
|
+
* faker.string.uuid({ version: 7 }) // '01948b54-1b78-75fb-9922-0d9b0fd32248'
|
|
6912
|
+
* faker.string.uuid({ version: 7, refDate: '2020-01-01T00:00:00.000Z' }) // '016f5e66-e800-725e-b078-f413f23aaff0'
|
|
6619
6913
|
*
|
|
6620
6914
|
* @since 8.0.0
|
|
6621
6915
|
*/
|
|
6622
|
-
|
|
6916
|
+
uuid(options?: {
|
|
6623
6917
|
/**
|
|
6624
|
-
*
|
|
6625
|
-
*
|
|
6626
|
-
* @default 0
|
|
6918
|
+
* The specific UUID version to use.
|
|
6627
6919
|
*/
|
|
6628
|
-
|
|
6920
|
+
version?: 4 | 7;
|
|
6629
6921
|
/**
|
|
6630
|
-
*
|
|
6922
|
+
* The timestamp to encode into the UUID.
|
|
6923
|
+
* This parameter is only relevant for UUID v7.
|
|
6631
6924
|
*
|
|
6632
|
-
* @default
|
|
6925
|
+
* @default faker.defaultRefDate()
|
|
6633
6926
|
*/
|
|
6634
|
-
|
|
6927
|
+
refDate?: string | Date | number;
|
|
6635
6928
|
}): string;
|
|
6636
6929
|
/**
|
|
6637
|
-
* Returns a
|
|
6638
|
-
* The bounds are inclusive.
|
|
6639
|
-
*
|
|
6640
|
-
* @param options Maximum value or options object.
|
|
6641
|
-
* @param options.min Lower bound for generated number. Defaults to `0`.
|
|
6642
|
-
* @param options.max Upper bound for generated number. Defaults to `15`.
|
|
6930
|
+
* Returns a ULID ([Universally Unique Lexicographically Sortable Identifier](https://github.com/ulid/spec)).
|
|
6643
6931
|
*
|
|
6644
|
-
* @
|
|
6645
|
-
* @
|
|
6932
|
+
* @param options The optional options object.
|
|
6933
|
+
* @param options.refDate The timestamp to encode into the ULID.
|
|
6934
|
+
* The encoded timestamp is represented by the first 10 characters of the result.
|
|
6935
|
+
* Defaults to `faker.defaultRefDate()`.
|
|
6646
6936
|
*
|
|
6647
6937
|
* @example
|
|
6648
|
-
* faker.
|
|
6649
|
-
* faker.
|
|
6650
|
-
* faker.number.hex({ min: 0, max: 65535 }) // 'af17'
|
|
6938
|
+
* faker.string.ulid() // '01ARZ3NDEKTSV4RRFFQ69G5FAV'
|
|
6939
|
+
* faker.string.ulid({ refDate: '2020-01-01T00:00:00.000Z' }) // '01DXF6DT00CX9QNNW7PNXQ3YR8'
|
|
6651
6940
|
*
|
|
6652
|
-
* @since
|
|
6941
|
+
* @since 9.1.0
|
|
6653
6942
|
*/
|
|
6654
|
-
|
|
6655
|
-
/**
|
|
6656
|
-
* Lower bound for generated number.
|
|
6657
|
-
*
|
|
6658
|
-
* @default 0
|
|
6659
|
-
*/
|
|
6660
|
-
min?: number;
|
|
6943
|
+
ulid(options?: {
|
|
6661
6944
|
/**
|
|
6662
|
-
*
|
|
6945
|
+
* The date to use as reference point for the newly generated ULID encoded timestamp.
|
|
6946
|
+
* The encoded timestamp is represented by the first 10 characters of the result.
|
|
6663
6947
|
*
|
|
6664
|
-
* @default
|
|
6948
|
+
* @default faker.defaultRefDate()
|
|
6665
6949
|
*/
|
|
6666
|
-
|
|
6950
|
+
refDate?: string | Date | number;
|
|
6667
6951
|
}): string;
|
|
6668
6952
|
/**
|
|
6669
|
-
*
|
|
6670
|
-
* The bounds are inclusive.
|
|
6671
|
-
*
|
|
6672
|
-
* @param options Maximum value or options object.
|
|
6673
|
-
* @param options.min Lower bound for generated bigint. Defaults to `0n`.
|
|
6674
|
-
* @param options.max Upper bound for generated bigint. Defaults to `min + 999999999999999n`.
|
|
6675
|
-
* @param options.multipleOf The generated bigint will be a multiple of this parameter. Defaults to `1n`.
|
|
6953
|
+
* Generates a [Nano ID](https://github.com/ai/nanoid).
|
|
6676
6954
|
*
|
|
6677
|
-
* @
|
|
6678
|
-
* @
|
|
6679
|
-
* @
|
|
6955
|
+
* @param length The length of the string to generate either as a fixed length or as a length range. Defaults to `21`.
|
|
6956
|
+
* @param length.min The minimum length of the Nano ID to generate.
|
|
6957
|
+
* @param length.max The maximum length of the Nano ID to generate.
|
|
6680
6958
|
*
|
|
6681
6959
|
* @example
|
|
6682
|
-
* faker.
|
|
6683
|
-
* faker.
|
|
6684
|
-
* faker.
|
|
6685
|
-
* faker.number.bigInt({ max: 100n }) // 42n
|
|
6686
|
-
* faker.number.bigInt({ multipleOf: 7n }) // 35n
|
|
6687
|
-
* faker.number.bigInt({ min: 10n, max: 100n }) // 36n
|
|
6960
|
+
* faker.string.nanoid() // ptL0KpX_yRMI98JFr6B3n
|
|
6961
|
+
* faker.string.nanoid(10) // VsvwSdm_Am
|
|
6962
|
+
* faker.string.nanoid({ min: 13, max: 37 }) // KIRsdEL9jxVgqhBDlm
|
|
6688
6963
|
*
|
|
6689
6964
|
* @since 8.0.0
|
|
6690
6965
|
*/
|
|
6691
|
-
|
|
6692
|
-
/**
|
|
6693
|
-
* Lower bound for generated bigint.
|
|
6694
|
-
*
|
|
6695
|
-
* @default 0n
|
|
6696
|
-
*/
|
|
6697
|
-
min?: bigint | number | string | boolean;
|
|
6966
|
+
nanoid(length?: number | {
|
|
6698
6967
|
/**
|
|
6699
|
-
*
|
|
6700
|
-
*
|
|
6701
|
-
* @default min + 999999999999999n
|
|
6968
|
+
* The minimum length of the Nano ID to generate.
|
|
6702
6969
|
*/
|
|
6703
|
-
|
|
6970
|
+
min: number;
|
|
6704
6971
|
/**
|
|
6705
|
-
* The
|
|
6706
|
-
*
|
|
6707
|
-
* @default 1n
|
|
6972
|
+
* The maximum length of the Nano ID to generate.
|
|
6708
6973
|
*/
|
|
6709
|
-
|
|
6710
|
-
}):
|
|
6974
|
+
max: number;
|
|
6975
|
+
}): string;
|
|
6711
6976
|
/**
|
|
6712
|
-
* Returns a
|
|
6713
|
-
* The bounds are inclusive.
|
|
6977
|
+
* Returns a string containing only special characters from the following list:
|
|
6714
6978
|
*
|
|
6715
|
-
*
|
|
6716
|
-
*
|
|
6717
|
-
*
|
|
6979
|
+
* ```txt
|
|
6980
|
+
* ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~
|
|
6981
|
+
* ```
|
|
6718
6982
|
*
|
|
6719
|
-
* @
|
|
6720
|
-
* @
|
|
6721
|
-
* @
|
|
6722
|
-
* @throws {FakerError} When `max` is greater than `3999`.
|
|
6983
|
+
* @param length The length of the string to generate either as a fixed length or as a length range. Defaults to `1`.
|
|
6984
|
+
* @param length.min The minimum length of the string to generate.
|
|
6985
|
+
* @param length.max The maximum length of the string to generate.
|
|
6723
6986
|
*
|
|
6724
6987
|
* @example
|
|
6725
|
-
* faker.
|
|
6726
|
-
* faker.
|
|
6727
|
-
* faker.
|
|
6728
|
-
* faker.number.romanNumeral({ max: 20 }) // "XVII"
|
|
6729
|
-
* faker.number.romanNumeral({ min: 5, max: 10 }) // "VII"
|
|
6988
|
+
* faker.string.symbol() // '$'
|
|
6989
|
+
* faker.string.symbol(5) // '#*!.~'
|
|
6990
|
+
* faker.string.symbol({ min: 5, max: 10 }) // ')|@*>^+'
|
|
6730
6991
|
*
|
|
6731
|
-
* @since
|
|
6992
|
+
* @since 8.0.0
|
|
6732
6993
|
*/
|
|
6733
|
-
|
|
6994
|
+
symbol(length?: number | {
|
|
6734
6995
|
/**
|
|
6735
|
-
*
|
|
6736
|
-
*
|
|
6737
|
-
* @default 1
|
|
6996
|
+
* The minimum length of the string to generate.
|
|
6738
6997
|
*/
|
|
6739
|
-
min
|
|
6998
|
+
min: number;
|
|
6740
6999
|
/**
|
|
6741
|
-
*
|
|
6742
|
-
*
|
|
6743
|
-
* @default 3999
|
|
7000
|
+
* The maximum length of the string to generate.
|
|
6744
7001
|
*/
|
|
6745
|
-
max
|
|
7002
|
+
max: number;
|
|
6746
7003
|
}): string;
|
|
6747
7004
|
}
|
|
7005
|
+
//#endregion
|
|
7006
|
+
//#region src/simple-faker.d.ts
|
|
6748
7007
|
/**
|
|
6749
7008
|
* This is a simplified Faker class that doesn't need any localized data to generate its output.
|
|
6750
7009
|
*
|
|
@@ -6766,7 +7025,6 @@ declare class NumberModule extends SimpleModuleBase {
|
|
|
6766
7025
|
* simpleFaker.string.uuid(); // 'c50e1f5c-86e8-4aa9-888e-168e0a182519'
|
|
6767
7026
|
*/
|
|
6768
7027
|
declare class SimpleFaker {
|
|
6769
|
-
protected _defaultRefDate: () => Date;
|
|
6770
7028
|
/**
|
|
6771
7029
|
* Gets a new reference date used to generate relative dates.
|
|
6772
7030
|
*/
|
|
@@ -6782,17 +7040,17 @@ declare class SimpleFaker {
|
|
|
6782
7040
|
* @see faker.seed(): For generating reproducible values.
|
|
6783
7041
|
*
|
|
6784
7042
|
* @example
|
|
6785
|
-
*
|
|
6786
|
-
*
|
|
6787
|
-
* // Default behavior
|
|
7043
|
+
* // Default
|
|
7044
|
+
* faker.seed(1234); // Keep `past()` offset consistent for example runs
|
|
6788
7045
|
* // faker.setDefaultRefDate();
|
|
6789
7046
|
* faker.date.past(); // Changes based on the current date/time
|
|
6790
|
-
*
|
|
6791
|
-
* //
|
|
7047
|
+
* @example
|
|
7048
|
+
* // Fixed
|
|
7049
|
+
* faker.seed(1234);
|
|
6792
7050
|
* faker.setDefaultRefDate(new Date('2020-01-01'));
|
|
6793
7051
|
* faker.date.past(); // Reproducible '2019-07-03T08:27:58.118Z'
|
|
6794
|
-
*
|
|
6795
|
-
* //
|
|
7052
|
+
* @example
|
|
7053
|
+
* // Tick on use
|
|
6796
7054
|
* let clock = new Date("2020-01-01").getTime();
|
|
6797
7055
|
* faker.setDefaultRefDate(() => {
|
|
6798
7056
|
* clock += 1000; // +1s
|
|
@@ -6838,25 +7096,7 @@ declare class SimpleFaker {
|
|
|
6838
7096
|
*
|
|
6839
7097
|
* @since 8.1.0
|
|
6840
7098
|
*/
|
|
6841
|
-
constructor(options?:
|
|
6842
|
-
/**
|
|
6843
|
-
* The Randomizer to use.
|
|
6844
|
-
* Specify this only if you want to use it to achieve a specific goal,
|
|
6845
|
-
* such as sharing the same random generator with other instances/tools.
|
|
6846
|
-
*
|
|
6847
|
-
* @default generateMersenne53Randomizer()
|
|
6848
|
-
*/
|
|
6849
|
-
randomizer?: Randomizer;
|
|
6850
|
-
/**
|
|
6851
|
-
* The initial seed to use.
|
|
6852
|
-
* The seed can be used to generate reproducible values.
|
|
6853
|
-
*
|
|
6854
|
-
* Refer to the `seed()` method for more information.
|
|
6855
|
-
*
|
|
6856
|
-
* Defaults to a random seed.
|
|
6857
|
-
*/
|
|
6858
|
-
seed?: number;
|
|
6859
|
-
});
|
|
7099
|
+
constructor(options?: FakerOptions);
|
|
6860
7100
|
/**
|
|
6861
7101
|
* Sets the seed or generates a new one.
|
|
6862
7102
|
*
|
|
@@ -6901,7 +7141,7 @@ declare class SimpleFaker {
|
|
|
6901
7141
|
* Please note that generated values are dependent on both the seed and the
|
|
6902
7142
|
* number of calls that have been made since it was set.
|
|
6903
7143
|
*
|
|
6904
|
-
* This method is intended to allow for consistent values in
|
|
7144
|
+
* This method is intended to allow for consistent values in tests, so you
|
|
6905
7145
|
* might want to use hardcoded values as the seed.
|
|
6906
7146
|
*
|
|
6907
7147
|
* In addition to that it can be used for creating truly random tests
|
|
@@ -6938,7 +7178,7 @@ declare class SimpleFaker {
|
|
|
6938
7178
|
* Please note that generated values are dependent on both the seed and the
|
|
6939
7179
|
* number of calls that have been made since it was set.
|
|
6940
7180
|
*
|
|
6941
|
-
* This method is intended to allow for consistent values in
|
|
7181
|
+
* This method is intended to allow for consistent values in tests, so you
|
|
6942
7182
|
* might want to use hardcoded values as the seed.
|
|
6943
7183
|
*
|
|
6944
7184
|
* In addition to that it can be used for creating truly random tests
|
|
@@ -6979,12 +7219,15 @@ declare class SimpleFaker {
|
|
|
6979
7219
|
*/
|
|
6980
7220
|
seed(seed?: number | number[]): number | number[];
|
|
6981
7221
|
}
|
|
7222
|
+
//#endregion
|
|
7223
|
+
//#region src/faker.d.ts
|
|
6982
7224
|
/**
|
|
6983
7225
|
* This is Faker's main class containing all modules that can be used to generate data.
|
|
6984
7226
|
*
|
|
6985
7227
|
* Please have a look at the individual modules and methods for more information and examples.
|
|
6986
7228
|
*
|
|
6987
7229
|
* @example
|
|
7230
|
+
* // Default Faker instance
|
|
6988
7231
|
* import { faker } from '@faker-js/faker';
|
|
6989
7232
|
* // const { faker } = require('@faker-js/faker');
|
|
6990
7233
|
*
|
|
@@ -6993,6 +7236,7 @@ declare class SimpleFaker {
|
|
|
6993
7236
|
* faker.person.firstName(); // 'John'
|
|
6994
7237
|
* faker.person.lastName(); // 'Doe'
|
|
6995
7238
|
* @example
|
|
7239
|
+
* // Custom locale without en fallback
|
|
6996
7240
|
* import { Faker, es } from '@faker-js/faker';
|
|
6997
7241
|
* // const { Faker, es } = require('@faker-js/faker');
|
|
6998
7242
|
*
|
|
@@ -7005,8 +7249,6 @@ declare class SimpleFaker {
|
|
|
7005
7249
|
* customFaker.music.genre(); // throws Error as this data is not available in `es`
|
|
7006
7250
|
*/
|
|
7007
7251
|
declare class Faker extends SimpleFaker {
|
|
7008
|
-
readonly rawDefinitions: LocaleDefinition;
|
|
7009
|
-
readonly definitions: LocaleProxy;
|
|
7010
7252
|
readonly airline: AirlineModule;
|
|
7011
7253
|
readonly animal: AnimalModule;
|
|
7012
7254
|
readonly book: BookModule;
|
|
@@ -7031,6 +7273,8 @@ declare class Faker extends SimpleFaker {
|
|
|
7031
7273
|
readonly system: SystemModule;
|
|
7032
7274
|
readonly vehicle: VehicleModule;
|
|
7033
7275
|
readonly word: WordModule;
|
|
7276
|
+
get rawDefinitions(): LocaleDefinition;
|
|
7277
|
+
get definitions(): LocaleProxy;
|
|
7034
7278
|
/**
|
|
7035
7279
|
* Creates a new instance of Faker.
|
|
7036
7280
|
*
|
|
@@ -7067,33 +7311,7 @@ declare class Faker extends SimpleFaker {
|
|
|
7067
7311
|
*
|
|
7068
7312
|
* @since 8.0.0
|
|
7069
7313
|
*/
|
|
7070
|
-
constructor(options:
|
|
7071
|
-
/**
|
|
7072
|
-
* The locale data to use for this instance.
|
|
7073
|
-
* If an array is provided, the first locale that has a definition for a given property will be used.
|
|
7074
|
-
* Please make sure that all required locales and their parent locales are present, e.g. `[de_AT, de, en, base]`.
|
|
7075
|
-
*
|
|
7076
|
-
* @see mergeLocales(): For more information about how the locales are merged.
|
|
7077
|
-
*/
|
|
7078
|
-
locale: LocaleDefinition | LocaleDefinition[];
|
|
7079
|
-
/**
|
|
7080
|
-
* The Randomizer to use.
|
|
7081
|
-
* Specify this only if you want to use it to achieve a specific goal,
|
|
7082
|
-
* such as sharing the same random generator with other instances/tools.
|
|
7083
|
-
*
|
|
7084
|
-
* @default generateMersenne53Randomizer()
|
|
7085
|
-
*/
|
|
7086
|
-
randomizer?: Randomizer;
|
|
7087
|
-
/**
|
|
7088
|
-
* The initial seed to use.
|
|
7089
|
-
* The seed can be used to generate reproducible values.
|
|
7090
|
-
*
|
|
7091
|
-
* Refer to the `seed()` method for more information.
|
|
7092
|
-
*
|
|
7093
|
-
* Defaults to a random seed.
|
|
7094
|
-
*/
|
|
7095
|
-
seed?: number;
|
|
7096
|
-
});
|
|
7314
|
+
constructor(options: FakerOptions);
|
|
7097
7315
|
/**
|
|
7098
7316
|
* Returns an object with metadata about the current locale.
|
|
7099
7317
|
*
|
|
@@ -7107,6 +7325,8 @@ declare class Faker extends SimpleFaker {
|
|
|
7107
7325
|
*/
|
|
7108
7326
|
getMetadata(): MetadataDefinition;
|
|
7109
7327
|
}
|
|
7328
|
+
//#endregion
|
|
7329
|
+
//#region src/internal/module-base.d.ts
|
|
7110
7330
|
/**
|
|
7111
7331
|
* Base class for all modules that use a `SimpleFaker` instance.
|
|
7112
7332
|
*/
|
|
@@ -7121,12 +7341,8 @@ declare abstract class ModuleBase extends SimpleModuleBase {
|
|
|
7121
7341
|
protected readonly faker: Faker;
|
|
7122
7342
|
constructor(faker: Faker);
|
|
7123
7343
|
}
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
* It's the trade association for the world's airlines and it is
|
|
7127
|
-
* responsible for setting standards relating to many aspects of airline
|
|
7128
|
-
* operations.
|
|
7129
|
-
*/
|
|
7344
|
+
//#endregion
|
|
7345
|
+
//#region src/modules/airline/index.d.ts
|
|
7130
7346
|
declare enum Aircraft {
|
|
7131
7347
|
Narrowbody = "narrowbody",
|
|
7132
7348
|
Regional = "regional",
|
|
@@ -7318,6 +7534,8 @@ declare class AirlineModule extends ModuleBase {
|
|
|
7318
7534
|
addLeadingZeros?: boolean;
|
|
7319
7535
|
}): string;
|
|
7320
7536
|
}
|
|
7537
|
+
//#endregion
|
|
7538
|
+
//#region src/definitions/animal.d.ts
|
|
7321
7539
|
/**
|
|
7322
7540
|
* The possible definitions related to animals.
|
|
7323
7541
|
*/
|
|
@@ -7339,6 +7557,8 @@ type AnimalDefinition = LocaleEntry<{
|
|
|
7339
7557
|
type: string[];
|
|
7340
7558
|
pet_name: string[];
|
|
7341
7559
|
}>;
|
|
7560
|
+
//#endregion
|
|
7561
|
+
//#region src/definitions/book.d.ts
|
|
7342
7562
|
/**
|
|
7343
7563
|
* The possible definitions related to books.
|
|
7344
7564
|
*/
|
|
@@ -7368,6 +7588,8 @@ type BookDefinition = LocaleEntry<{
|
|
|
7368
7588
|
*/
|
|
7369
7589
|
publisher: string[];
|
|
7370
7590
|
}>;
|
|
7591
|
+
//#endregion
|
|
7592
|
+
//#region src/definitions/color.d.ts
|
|
7371
7593
|
/**
|
|
7372
7594
|
* The possible definitions related to colors.
|
|
7373
7595
|
*/
|
|
@@ -7381,6 +7603,8 @@ type ColorDefinition = LocaleEntry<{
|
|
|
7381
7603
|
*/
|
|
7382
7604
|
space: string[];
|
|
7383
7605
|
}>;
|
|
7606
|
+
//#endregion
|
|
7607
|
+
//#region src/definitions/commerce.d.ts
|
|
7384
7608
|
/**
|
|
7385
7609
|
* The possible definitions related to commerce.
|
|
7386
7610
|
*/
|
|
@@ -7419,6 +7643,8 @@ interface CommerceProductNameDefinition {
|
|
|
7419
7643
|
*/
|
|
7420
7644
|
pattern: string[];
|
|
7421
7645
|
}
|
|
7646
|
+
//#endregion
|
|
7647
|
+
//#region src/definitions/company.d.ts
|
|
7422
7648
|
/**
|
|
7423
7649
|
* The possible definitions related to companies.
|
|
7424
7650
|
*/
|
|
@@ -7452,6 +7678,8 @@ type CompanyDefinition = LocaleEntry<{
|
|
|
7452
7678
|
*/
|
|
7453
7679
|
noun: string[];
|
|
7454
7680
|
}>;
|
|
7681
|
+
//#endregion
|
|
7682
|
+
//#region src/definitions/database.d.ts
|
|
7455
7683
|
/**
|
|
7456
7684
|
* The possible definitions related to databases.
|
|
7457
7685
|
*/
|
|
@@ -7473,6 +7701,8 @@ type DatabaseDefinition = LocaleEntry<{
|
|
|
7473
7701
|
*/
|
|
7474
7702
|
type: string[];
|
|
7475
7703
|
}>;
|
|
7704
|
+
//#endregion
|
|
7705
|
+
//#region src/definitions/date.d.ts
|
|
7476
7706
|
/**
|
|
7477
7707
|
* The possible definitions related to dates.
|
|
7478
7708
|
*/
|
|
@@ -7518,6 +7748,8 @@ interface DateEntryDefinition {
|
|
|
7518
7748
|
*/
|
|
7519
7749
|
abbr_context?: string[];
|
|
7520
7750
|
}
|
|
7751
|
+
//#endregion
|
|
7752
|
+
//#region src/definitions/finance.d.ts
|
|
7521
7753
|
/**
|
|
7522
7754
|
* The possible definitions related to finance.
|
|
7523
7755
|
*/
|
|
@@ -7535,6 +7767,12 @@ type FinanceDefinition = LocaleEntry<{
|
|
|
7535
7767
|
credit_card: {
|
|
7536
7768
|
[issuer: string]: string[];
|
|
7537
7769
|
};
|
|
7770
|
+
/**
|
|
7771
|
+
* The first four digits of a US American Bankers Association (ABA) routing number.
|
|
7772
|
+
* Digits 0-1 determine the federal district
|
|
7773
|
+
* Digits 2-3 determine the city within that district
|
|
7774
|
+
*/
|
|
7775
|
+
federal_reserve_routing_symbol: string[];
|
|
7538
7776
|
/**
|
|
7539
7777
|
* Currencies including their name, code, symbol and ISO numeric code (e.g. `US Dollar` / `USD` / `$` / '840').
|
|
7540
7778
|
*/
|
|
@@ -7548,6 +7786,8 @@ type FinanceDefinition = LocaleEntry<{
|
|
|
7548
7786
|
*/
|
|
7549
7787
|
transaction_description_pattern: string[];
|
|
7550
7788
|
}>;
|
|
7789
|
+
//#endregion
|
|
7790
|
+
//#region src/definitions/food.d.ts
|
|
7551
7791
|
type FoodDefinition = LocaleEntry<{
|
|
7552
7792
|
/**
|
|
7553
7793
|
* Common food adjectives.
|
|
@@ -7590,6 +7830,8 @@ type FoodDefinition = LocaleEntry<{
|
|
|
7590
7830
|
*/
|
|
7591
7831
|
vegetable: string[];
|
|
7592
7832
|
}>;
|
|
7833
|
+
//#endregion
|
|
7834
|
+
//#region src/definitions/hacker.d.ts
|
|
7593
7835
|
/**
|
|
7594
7836
|
* The possible definitions related to computers.
|
|
7595
7837
|
*/
|
|
@@ -7619,6 +7861,8 @@ type HackerDefinition = LocaleEntry<{
|
|
|
7619
7861
|
*/
|
|
7620
7862
|
verb: string[];
|
|
7621
7863
|
}>;
|
|
7864
|
+
//#endregion
|
|
7865
|
+
//#region src/definitions/internet.d.ts
|
|
7622
7866
|
/**
|
|
7623
7867
|
* The possible definitions related to internet stuff.
|
|
7624
7868
|
*/
|
|
@@ -7649,6 +7893,8 @@ type InternetDefinition = LocaleEntry<{
|
|
|
7649
7893
|
*/
|
|
7650
7894
|
user_agent_pattern: string[];
|
|
7651
7895
|
}>;
|
|
7896
|
+
//#endregion
|
|
7897
|
+
//#region src/definitions/location.d.ts
|
|
7652
7898
|
/**
|
|
7653
7899
|
* The possible definitions related to addresses and locations.
|
|
7654
7900
|
*/
|
|
@@ -7766,6 +8012,10 @@ type LocationDefinition = LocaleEntry<{
|
|
|
7766
8012
|
*/
|
|
7767
8013
|
full: string;
|
|
7768
8014
|
};
|
|
8015
|
+
/**
|
|
8016
|
+
* The fake pattern(s) used to generate a full postal address.
|
|
8017
|
+
*/
|
|
8018
|
+
postal_address: string | string[];
|
|
7769
8019
|
/**
|
|
7770
8020
|
* The address "inside" an address/e.g. an apartment or office. Since these rarely start with 0, any consecutive # characters will be replaced by a number without a leading zero.
|
|
7771
8021
|
*/
|
|
@@ -7783,6 +8033,8 @@ type LocationDefinition = LocaleEntry<{
|
|
|
7783
8033
|
*/
|
|
7784
8034
|
language: Language[];
|
|
7785
8035
|
}>;
|
|
8036
|
+
//#endregion
|
|
8037
|
+
//#region src/definitions/lorem.d.ts
|
|
7786
8038
|
/**
|
|
7787
8039
|
* The possible definitions related to lorem texts.
|
|
7788
8040
|
*/
|
|
@@ -7792,6 +8044,8 @@ type LoremDefinition = LocaleEntry<{
|
|
|
7792
8044
|
*/
|
|
7793
8045
|
word: string[];
|
|
7794
8046
|
}>;
|
|
8047
|
+
//#endregion
|
|
8048
|
+
//#region src/definitions/metadata.d.ts
|
|
7795
8049
|
/**
|
|
7796
8050
|
* Metadata for pre-built locales.
|
|
7797
8051
|
*/
|
|
@@ -7846,6 +8100,8 @@ type PreBuiltMetadataDefinitionForCountry = PreBuiltMetadataDefinition & {
|
|
|
7846
8100
|
* Metadata for the current locale.
|
|
7847
8101
|
*/
|
|
7848
8102
|
type MetadataDefinition = LocaleEntry<PreBuiltMetadataDefinitionForCountry>;
|
|
8103
|
+
//#endregion
|
|
8104
|
+
//#region src/definitions/music.d.ts
|
|
7849
8105
|
/**
|
|
7850
8106
|
* The possible definitions related to music.
|
|
7851
8107
|
*/
|
|
@@ -7867,6 +8123,8 @@ type MusicDefinition = LocaleEntry<{
|
|
|
7867
8123
|
*/
|
|
7868
8124
|
song_name: string[];
|
|
7869
8125
|
}>;
|
|
8126
|
+
//#endregion
|
|
8127
|
+
//#region src/definitions/person.d.ts
|
|
7870
8128
|
/**
|
|
7871
8129
|
* Entries that are dependent on a person's sex.
|
|
7872
8130
|
*/
|
|
@@ -7925,6 +8183,8 @@ type PersonDefinition = LocaleEntry<{
|
|
|
7925
8183
|
job_title_pattern: string[];
|
|
7926
8184
|
western_zodiac_sign: string[];
|
|
7927
8185
|
}>;
|
|
8186
|
+
//#endregion
|
|
8187
|
+
//#region src/definitions/phone_number.d.ts
|
|
7928
8188
|
/**
|
|
7929
8189
|
* The possible definitions related to phone numbers.
|
|
7930
8190
|
*/
|
|
@@ -7950,8 +8210,14 @@ type PhoneNumberDefinition = LocaleEntry<{
|
|
|
7950
8210
|
* Formats for a phone number in the standardised E.123 format, e.g. `+15551234567`
|
|
7951
8211
|
*/
|
|
7952
8212
|
international: string[];
|
|
8213
|
+
/**
|
|
8214
|
+
* Formats for a mobile phone number in a standardized national format, e.g. `5551234567`.
|
|
8215
|
+
*/
|
|
8216
|
+
mobile?: string[];
|
|
7953
8217
|
};
|
|
7954
8218
|
}>;
|
|
8219
|
+
//#endregion
|
|
8220
|
+
//#region src/definitions/science.d.ts
|
|
7955
8221
|
/**
|
|
7956
8222
|
* The possible definitions related to science.
|
|
7957
8223
|
*/
|
|
@@ -7965,6 +8231,8 @@ type ScienceDefinition = LocaleEntry<{
|
|
|
7965
8231
|
*/
|
|
7966
8232
|
chemical_element: ReadonlyArray<ChemicalElement>;
|
|
7967
8233
|
}>;
|
|
8234
|
+
//#endregion
|
|
8235
|
+
//#region src/definitions/system.d.ts
|
|
7968
8236
|
/**
|
|
7969
8237
|
* The possible definitions related to files and operating systems.
|
|
7970
8238
|
*/
|
|
@@ -7986,6 +8254,8 @@ type SystemDefinition = LocaleEntry<{
|
|
|
7986
8254
|
interface SystemMimeTypeEntryDefinition {
|
|
7987
8255
|
extensions: string[];
|
|
7988
8256
|
}
|
|
8257
|
+
//#endregion
|
|
8258
|
+
//#region src/definitions/vehicle.d.ts
|
|
7989
8259
|
/**
|
|
7990
8260
|
* The possible definitions related to vehicles.
|
|
7991
8261
|
*/
|
|
@@ -8011,6 +8281,8 @@ type VehicleDefinition = LocaleEntry<{
|
|
|
8011
8281
|
*/
|
|
8012
8282
|
type: string[];
|
|
8013
8283
|
}>;
|
|
8284
|
+
//#endregion
|
|
8285
|
+
//#region src/definitions/word.d.ts
|
|
8014
8286
|
/**
|
|
8015
8287
|
* The possible definitions related to words.
|
|
8016
8288
|
*/
|
|
@@ -8023,10 +8295,12 @@ type WordDefinition = LocaleEntry<{
|
|
|
8023
8295
|
preposition: string[];
|
|
8024
8296
|
verb: string[];
|
|
8025
8297
|
}>;
|
|
8298
|
+
//#endregion
|
|
8299
|
+
//#region src/definitions/definitions.d.ts
|
|
8026
8300
|
/**
|
|
8027
8301
|
* Wrapper type for all definition categories that will make all properties optional and allow extra properties.
|
|
8028
8302
|
*/
|
|
8029
|
-
type LocaleEntry<TCategoryDefinition extends Record<string, unknown>> = { [P in keyof TCategoryDefinition]?: TCategoryDefinition[P] | null } & Record<string, unknown>;
|
|
8303
|
+
type LocaleEntry<TCategoryDefinition extends Record<string, unknown>> = { [P in keyof TCategoryDefinition]?: TCategoryDefinition[P] | null; } & Record<string, unknown>;
|
|
8030
8304
|
/**
|
|
8031
8305
|
* The definitions as used by the translations/locales.
|
|
8032
8306
|
*/
|
|
@@ -8054,6 +8328,8 @@ type LocaleDefinition = {
|
|
|
8054
8328
|
vehicle?: VehicleDefinition;
|
|
8055
8329
|
word?: WordDefinition;
|
|
8056
8330
|
} & Record<string, Record<string, unknown>>;
|
|
8331
|
+
//#endregion
|
|
8332
|
+
//#region src/definitions/airline.d.ts
|
|
8057
8333
|
type AirlineDefinition = LocaleEntry<{
|
|
8058
8334
|
/**
|
|
8059
8335
|
* Some airline information
|
|
@@ -8068,8 +8344,37 @@ type AirlineDefinition = LocaleEntry<{
|
|
|
8068
8344
|
*/
|
|
8069
8345
|
airport: Airport[];
|
|
8070
8346
|
}>;
|
|
8347
|
+
interface FakerOptions {
|
|
8348
|
+
/**
|
|
8349
|
+
* The locale definitions to use. If not provided, this core will not have any locale data and thus all methods that rely on locale data will throw an error when called.
|
|
8350
|
+
*
|
|
8351
|
+
* @default {}
|
|
8352
|
+
*/
|
|
8353
|
+
locale?: LocaleProxy | LocaleDefinition | LocaleDefinition[];
|
|
8354
|
+
/**
|
|
8355
|
+
* The randomizer used to generate random values.
|
|
8356
|
+
*
|
|
8357
|
+
* @default generateMersenne53Randomizer()
|
|
8358
|
+
*/
|
|
8359
|
+
randomizer?: Randomizer;
|
|
8360
|
+
/**
|
|
8361
|
+
* The configuration options for all methods.
|
|
8362
|
+
*
|
|
8363
|
+
* @default {}
|
|
8364
|
+
*/
|
|
8365
|
+
config?: FakerConfig;
|
|
8366
|
+
/**
|
|
8367
|
+
* The initial seed to use.
|
|
8368
|
+
* The seed can be used to generate reproducible values.
|
|
8369
|
+
*
|
|
8370
|
+
* Refer to the `seed()` method for more information.
|
|
8371
|
+
*
|
|
8372
|
+
* Defaults to a random seed.
|
|
8373
|
+
*/
|
|
8374
|
+
seed?: number;
|
|
8375
|
+
}
|
|
8071
8376
|
//#endregion
|
|
8072
|
-
//#region
|
|
8377
|
+
//#region src/locale/en.d.ts
|
|
8073
8378
|
/**
|
|
8074
8379
|
* The faker instance for the `en` locale.
|
|
8075
8380
|
*
|
|
@@ -8081,7 +8386,7 @@ type AirlineDefinition = LocaleEntry<{
|
|
|
8081
8386
|
* - `en`
|
|
8082
8387
|
* - `base`
|
|
8083
8388
|
*/
|
|
8084
|
-
declare const faker: Faker;
|
|
8389
|
+
declare const faker$62: Faker;
|
|
8085
8390
|
//#endregion
|
|
8086
8391
|
//#region ../../src/fake/providers/FakeProvider.d.ts
|
|
8087
8392
|
interface FakeOptions {
|
|
@@ -8130,10 +8435,10 @@ interface FakeOptions {
|
|
|
8130
8435
|
* @example
|
|
8131
8436
|
* ```ts
|
|
8132
8437
|
* const fake = new FakeProvider();
|
|
8133
|
-
* const userSchema =
|
|
8134
|
-
* id:
|
|
8135
|
-
* name:
|
|
8136
|
-
* email:
|
|
8438
|
+
* const userSchema = z.object({
|
|
8439
|
+
* id: z.uuid(),
|
|
8440
|
+
* name: z.text(),
|
|
8441
|
+
* email: z.email(),
|
|
8137
8442
|
* });
|
|
8138
8443
|
* const fakeUser = fake.generate(userSchema);
|
|
8139
8444
|
*
|
|
@@ -8143,7 +8448,44 @@ interface FakeOptions {
|
|
|
8143
8448
|
*/
|
|
8144
8449
|
declare class FakeProvider {
|
|
8145
8450
|
protected readonly faker: Faker;
|
|
8146
|
-
protected readonly guard:
|
|
8451
|
+
protected readonly guard: {
|
|
8452
|
+
isOptional: (s: any) => s is import("zod").ZodOptional<import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>;
|
|
8453
|
+
isDefault: (s: any) => s is import("zod").ZodDefault<import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>;
|
|
8454
|
+
isObject: (s: any) => s is import("zod").ZodObject<import("zod/v4/core").$ZodLooseShape, import("zod/v4/core").$strip>;
|
|
8455
|
+
isString: (s: any) => boolean;
|
|
8456
|
+
isNumber: (s: any) => boolean;
|
|
8457
|
+
isBoolean: (s: any) => s is import("zod").ZodBoolean;
|
|
8458
|
+
isArray: (s: any) => s is import("zod").ZodArray<import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>;
|
|
8459
|
+
isUnion: (s: any) => s is import("zod").ZodUnion<readonly import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>[]>;
|
|
8460
|
+
isNull: (s: any) => s is import("zod").ZodNull;
|
|
8461
|
+
isRecord: (s: any) => s is import("zod").ZodRecord<import("zod/v4/core").$ZodRecordKey, import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>;
|
|
8462
|
+
isEnum: (s: any) => boolean;
|
|
8463
|
+
isLiteral: (s: any) => boolean;
|
|
8464
|
+
isAny: (s: any) => s is import("zod").ZodAny;
|
|
8465
|
+
isNullable: (s: any) => s is import("zod").ZodNullable<import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>;
|
|
8466
|
+
isInteger: (s: any) => boolean;
|
|
8467
|
+
isText: (s: any) => boolean;
|
|
8468
|
+
isDateTime: (s: any) => boolean;
|
|
8469
|
+
isDate: (s: any) => boolean;
|
|
8470
|
+
isTime: (s: any) => boolean;
|
|
8471
|
+
isBigInt: (s: any) => boolean;
|
|
8472
|
+
isUuid: (s: any) => boolean;
|
|
8473
|
+
isEmail: (s: any) => boolean;
|
|
8474
|
+
isUrl: (s: any) => boolean;
|
|
8475
|
+
isBinary: (s: any) => boolean;
|
|
8476
|
+
isUUID: (s: any) => boolean;
|
|
8477
|
+
isScalar: (s: any) => boolean;
|
|
8478
|
+
isSchema: (s: any) => s is import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
|
|
8479
|
+
isTuple: (s: any) => s is import("zod").ZodTuple<readonly import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>[], import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> | null>;
|
|
8480
|
+
isUndefined: (s: any) => s is import("zod").ZodUndefined;
|
|
8481
|
+
isUnsafe: (s: any) => s is import("zod").ZodAny | import("zod").ZodUnknown;
|
|
8482
|
+
isVoid: (s: any) => s is import("zod").ZodVoid;
|
|
8483
|
+
format: (s: any) => string | undefined;
|
|
8484
|
+
enumValues: (s: any) => string[];
|
|
8485
|
+
unwrap: (s: any) => any;
|
|
8486
|
+
getDefault: (s: any) => unknown;
|
|
8487
|
+
requiredKeys: (s: any) => string[];
|
|
8488
|
+
};
|
|
8147
8489
|
protected options: Required<FakeOptions>;
|
|
8148
8490
|
constructor();
|
|
8149
8491
|
/**
|
|
@@ -8187,10 +8529,10 @@ declare class FakeProvider {
|
|
|
8187
8529
|
* @example
|
|
8188
8530
|
* ```ts
|
|
8189
8531
|
* const fake = new FakeProvider();
|
|
8190
|
-
* const schema =
|
|
8191
|
-
* user_name:
|
|
8192
|
-
* firstName:
|
|
8193
|
-
* "e-mail":
|
|
8532
|
+
* const schema = z.object({
|
|
8533
|
+
* user_name: z.string(), // generates username
|
|
8534
|
+
* firstName: z.string(), // generates first name
|
|
8535
|
+
* "e-mail": z.string(), // generates email
|
|
8194
8536
|
* });
|
|
8195
8537
|
* const result = fake.generate(schema);
|
|
8196
8538
|
* ```
|
|
@@ -8229,5 +8571,5 @@ declare class FakeProvider {
|
|
|
8229
8571
|
*/
|
|
8230
8572
|
declare const AlephaFake: import("alepha").Service<import("alepha").Module>;
|
|
8231
8573
|
//#endregion
|
|
8232
|
-
export { AlephaFake, FakeOptions, FakeProvider, faker as fake };
|
|
8574
|
+
export { AlephaFake, FakeOptions, FakeProvider, faker$62 as fake };
|
|
8233
8575
|
//# sourceMappingURL=index.d.ts.map
|