@kubb/plugin-faker 4.29.1 → 4.31.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.
@@ -1,5 +1,4 @@
1
- import { t as __name } from "./chunk-DKWOrOAv.js";
2
- import { n as PluginFaker } from "./types-BIWyHbXy.js";
1
+ import { n as PluginFaker, r as __name } from "./types-DpNAdZTi.js";
3
2
  import { Schema } from "@kubb/plugin-oas";
4
3
  import { FabricReactNode } from "@kubb/react-fabric/types";
5
4
 
@@ -1,11 +1,10 @@
1
- import { t as __name } from "./chunk-DKWOrOAv.js";
2
- import { n as PluginFaker } from "./types-BIWyHbXy.js";
3
- import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
4
- import { Fabric } from "@kubb/react-fabric";
1
+ import { n as PluginFaker, r as __name } from "./types-DpNAdZTi.js";
5
2
  import { FabricReactNode } from "@kubb/react-fabric/types";
3
+ import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
6
4
  import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
7
5
  import { AsyncEventEmitter } from "@kubb/core/utils";
8
6
  import { KubbFile } from "@kubb/fabric-core/types";
7
+ import { Fabric } from "@kubb/react-fabric";
9
8
 
10
9
  //#region ../plugin-oas/src/types.d.ts
11
10
  type GetOasOptions = {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { t as __name } from "./chunk-DKWOrOAv.js";
2
- import { n as PluginFaker, t as Options } from "./types-BIWyHbXy.js";
1
+ import { n as PluginFaker, r as __name, t as Options } from "./types-DpNAdZTi.js";
3
2
  import * as _kubb_core0 from "@kubb/core";
4
3
 
5
4
  //#region src/plugin.d.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-faker",
3
- "version": "4.29.1",
3
+ "version": "4.31.0",
4
4
  "description": "Faker.js data generator plugin for Kubb, creating realistic mock data from OpenAPI specifications for development and testing.",
5
5
  "keywords": [
6
6
  "faker",
@@ -60,7 +60,8 @@
60
60
  "src",
61
61
  "dist",
62
62
  "!/**/**.test.**",
63
- "!/**/__tests__/**"
63
+ "!/**/__tests__/**",
64
+ "!/**/__snapshots__/**"
64
65
  ],
65
66
  "size-limit": [
66
67
  {
@@ -70,11 +71,11 @@
70
71
  }
71
72
  ],
72
73
  "dependencies": {
73
- "@kubb/react-fabric": "0.13.1",
74
- "@kubb/core": "4.29.1",
75
- "@kubb/oas": "4.29.1",
76
- "@kubb/plugin-oas": "4.29.1",
77
- "@kubb/plugin-ts": "4.29.1"
74
+ "@kubb/react-fabric": "0.13.2",
75
+ "@kubb/core": "4.31.0",
76
+ "@kubb/oas": "4.31.0",
77
+ "@kubb/plugin-oas": "4.31.0",
78
+ "@kubb/plugin-ts": "4.31.0"
78
79
  },
79
80
  "engines": {
80
81
  "node": ">=20"
@@ -1,30 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- /**
8
- * @description Null response
9
- */
10
- export function createPets201() {
11
- return undefined
12
- }
13
-
14
- /**
15
- * @description unexpected error
16
- */
17
- export function createPetsError(data?: Partial<CreatePetsError>): CreatePetsError {
18
- return error(data)
19
- }
20
-
21
- export function createPetsMutationRequest(data?: Partial<CreatePetsMutationRequest>): CreatePetsMutationRequest {
22
- return {
23
- ...{ name: faker.string.alpha(), tag: faker.string.alpha() },
24
- ...(data || {}),
25
- }
26
- }
27
-
28
- export function createPetsMutationResponse(data?: Partial<CreatePetsMutationResponse>): CreatePetsMutationResponse {
29
- return data || faker.helpers.arrayElement<any>([createPets201()])
30
- }
@@ -1,34 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- /**
8
- * @description Null response
9
- */
10
- export function createPets201() {
11
- faker.seed([222])
12
- return undefined
13
- }
14
-
15
- /**
16
- * @description unexpected error
17
- */
18
- export function createPetsError(data?: Partial<CreatePetsError>): CreatePetsError {
19
- faker.seed([222])
20
- return error(data)
21
- }
22
-
23
- export function createPetsMutationRequest(data?: Partial<CreatePetsMutationRequest>): CreatePetsMutationRequest {
24
- faker.seed([222])
25
- return {
26
- ...{ name: faker.string.alpha(), tag: faker.string.alpha() },
27
- ...(data || {}),
28
- }
29
- }
30
-
31
- export function createPetsMutationResponse(data?: Partial<CreatePetsMutationResponse>): CreatePetsMutationResponse {
32
- faker.seed([222])
33
- return data || faker.helpers.arrayElement<any>([createPets201()])
34
- }
@@ -1,30 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- /**
8
- * @description Null response
9
- */
10
- export function createPets201() {
11
- return undefined
12
- }
13
-
14
- /**
15
- * @description unexpected error
16
- */
17
- export function createPetsError(data?: Partial<CreatePetsError>): CreatePetsError {
18
- return error(data)
19
- }
20
-
21
- export function createPetsMutationRequest(data?: Partial<CreatePetsMutationRequest>): CreatePetsMutationRequest {
22
- return {
23
- ...{ name: faker.string.alpha(), tag: faker.string.alpha() },
24
- ...(data || {}),
25
- }
26
- }
27
-
28
- export function createPetsMutationResponse(data?: Partial<CreatePetsMutationResponse>): CreatePetsMutationResponse {
29
- return data || faker.helpers.arrayElement<any>([createPets201()])
30
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
-
6
- export function deletePetsPetidMutationResponse(data?: Partial<DeletePetsPetidMutationResponse>): DeletePetsPetidMutationResponse {
7
- return undefined
8
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- export function enumNamesType(data?: Partial<EnumNamesType>): EnumNamesType {
8
- return data || faker.helpers.arrayElement<EnumNamesType>([0, 1])
9
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- export function enumVarNamesType(data?: Partial<EnumVarNamesType>): EnumVarNamesType {
8
- return data || faker.helpers.arrayElement<EnumVarNamesType>([0, 1])
9
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- export function float(data?: number): number {
8
- return data ?? faker.number.float()
9
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- export function listPetsQueryParams(data?: Partial<ListPetsQueryParams>): ListPetsQueryParams {
8
- return {
9
- ...{ limit: faker.string.alpha() },
10
- ...(data || {}),
11
- }
12
- }
13
-
14
- /**
15
- * @description A paged array of pets
16
- */
17
- export function listPets200(data?: Partial<ListPets200>): ListPets200 {
18
- return {
19
- ...{ ...pagination(), ...pets() },
20
- ...(data || {}),
21
- }
22
- }
23
-
24
- /**
25
- * @description unexpected error
26
- */
27
- export function listPetsError(data?: Partial<ListPetsError>): ListPetsError {
28
- return error(data)
29
- }
30
-
31
- export function listPetsQueryResponse(data?: Partial<ListPetsQueryResponse>): ListPetsQueryResponse {
32
- return data || faker.helpers.arrayElement<any>([listPets200()])
33
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- export function integer(data?: number): number {
8
- return data ?? faker.number.int()
9
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- export function node(data?: Partial<Node>): Node {
8
- return {
9
- ...{ id: faker.string.alpha(), children: faker.helpers.multiple(() => undefined as any) },
10
- ...(data || {}),
11
- }
12
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- export function pet(data?: Partial<Pet>): Pet {
8
- return {
9
- ...{
10
- id: faker.number.int(),
11
- name: faker.string.alpha(),
12
- tag: faker.string.alpha(),
13
- code: faker.helpers.fromRegExp('\b[1-9]\b'),
14
- shipDate: faker.date.anytime(),
15
- shipTime: faker.date.anytime(),
16
- info: { animal: faker.helpers.arrayElement<NonNullable<NonNullable<Pet>['info']>['animal']>(['dog', 'cat', 'ant']) },
17
- },
18
- ...(data || {}),
19
- }
20
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
-
6
- export function petAdoption400(data?: Partial<PetAdoption400>): PetAdoption400 {
7
- return petAdoptionError(data)
8
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- /**
8
- * @description Pet adoption error codes
9
- */
10
- export function petAdoptionError(data?: Partial<PetAdoptionError>): PetAdoptionError {
11
- return data || faker.helpers.arrayElement<PetAdoptionError>(['pet_not_found', 'already_adopted', 'age_restriction'])
12
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- export function pet(data?: Partial<Pet>): Pet {
8
- return {
9
- ...{
10
- id: faker.number.int(),
11
- name: faker.string.alpha(),
12
- tag: faker.string.alpha(),
13
- code: faker.helpers.fromRegExp('\b[1-9]\b'),
14
- shipDate: faker.date.anytime().toISOString().substring(0, 10),
15
- shipTime: faker.date.anytime().toISOString().substring(11, 19),
16
- info: { animal: faker.helpers.arrayElement<NonNullable<NonNullable<Pet>['info']>['animal']>(['dog', 'cat', 'ant']) },
17
- },
18
- ...(data || {}),
19
- }
20
- }
@@ -1,21 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import dayjs from 'dayjs'
6
- import { faker } from '@faker-js/faker'
7
-
8
- export function pet(data?: Partial<Pet>): Pet {
9
- return {
10
- ...{
11
- id: faker.number.int(),
12
- name: faker.string.alpha(),
13
- tag: faker.string.alpha(),
14
- code: faker.helpers.fromRegExp('\b[1-9]\b'),
15
- shipDate: dayjs(faker.date.anytime()).format('YYYY-MM-DD'),
16
- shipTime: dayjs(faker.date.anytime()).format('HH:mm:ss'),
17
- info: { animal: faker.helpers.arrayElement<NonNullable<NonNullable<Pet>['info']>['animal']>(['dog', 'cat', 'ant']) },
18
- },
19
- ...(data || {}),
20
- }
21
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- export function pet(data?: Partial<Pet>): Pet {
8
- return {
9
- ...{
10
- id: faker.string.fromCharacters('abc'),
11
- name: faker.string.alpha({ casing: 'lower' }),
12
- tag: faker.string.alpha(),
13
- code: faker.helpers.fromRegExp('\b[1-9]\b'),
14
- shipDate: faker.date.anytime(),
15
- shipTime: faker.date.anytime(),
16
- info: { animal: faker.helpers.arrayElement<NonNullable<NonNullable<Pet>['info']>['animal']>(['dog', 'cat', 'ant']) },
17
- },
18
- ...(data || {}),
19
- }
20
- }
@@ -1,21 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import RandExp from 'randexp'
6
- import { faker } from '@faker-js/faker'
7
-
8
- export function pet(data?: Partial<Pet>): Pet {
9
- return {
10
- ...{
11
- id: faker.number.int(),
12
- name: faker.string.alpha(),
13
- tag: faker.string.alpha(),
14
- code: new RandExp('\\b[1-9]\\b').gen(),
15
- shipDate: faker.date.anytime(),
16
- shipTime: faker.date.anytime(),
17
- info: { animal: faker.helpers.arrayElement<NonNullable<NonNullable<Pet>['info']>['animal']>(['dog', 'cat', 'ant']) },
18
- },
19
- ...(data || {}),
20
- }
21
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- export function pets(data?: Pets): Pets {
8
- return [...faker.helpers.multiple(() => pet()), ...(data || [])]
9
- }
@@ -1,30 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- export function showPetByIdPathParams(data?: Partial<ShowPetByIdPathParams>): ShowPetByIdPathParams {
8
- return {
9
- ...{ petId: faker.string.alpha(), testId: faker.string.alpha() },
10
- ...(data || {}),
11
- }
12
- }
13
-
14
- /**
15
- * @description Expected response to a valid request
16
- */
17
- export function showPetById200(data?: Partial<ShowPetById200>): ShowPetById200 {
18
- return pet(data)
19
- }
20
-
21
- /**
22
- * @description unexpected error
23
- */
24
- export function showPetByIdError(data?: Partial<ShowPetByIdError>): ShowPetByIdError {
25
- return error(data)
26
- }
27
-
28
- export function showPetByIdQueryResponse(data?: Partial<ShowPetByIdQueryResponse>): ShowPetByIdQueryResponse {
29
- return data || faker.helpers.arrayElement<any>([showPetById200()])
30
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- export function string(data?: string): string {
8
- return data ?? faker.string.alpha()
9
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- export function treeNode(data?: Partial<TreeNode>): TreeNode {
8
- return {
9
- ...{ value: faker.string.alpha(), left: undefined as any, right: undefined as any },
10
- ...(data || {}),
11
- }
12
- }
@@ -1,34 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import { faker } from '@faker-js/faker'
6
-
7
- export function updatePetPathParams(data?: Partial<UpdatePetPathParams>): UpdatePetPathParams {
8
- return {
9
- ...{ petId: faker.number.int() },
10
- ...(data || {}),
11
- }
12
- }
13
-
14
- /**
15
- * @description Pet updated
16
- */
17
- export function updatePet200(data?: Partial<UpdatePet200>): UpdatePet200 {
18
- return pet(data)
19
- }
20
-
21
- /**
22
- * @description unexpected error
23
- */
24
- export function updatePetError(data?: Partial<UpdatePetError>): UpdatePetError {
25
- return error(data)
26
- }
27
-
28
- export function updatePetMutationRequest(data?: Partial<UpdatePetMutationRequest>): UpdatePetMutationRequest {
29
- return pet(data)
30
- }
31
-
32
- export function updatePetMutationResponse(data?: Partial<UpdatePetMutationResponse>): UpdatePetMutationResponse {
33
- return data || faker.helpers.arrayElement<any>([updatePet200()])
34
- }