struct-fakerator 3.0.0 → 3.1.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.
Files changed (67) hide show
  1. package/README.md +152 -145
  2. package/dist/config.cjs +4 -4
  3. package/dist/config_scheme.cjs +30 -46
  4. package/dist/config_scheme.js +24 -40
  5. package/dist/create_config.cjs +12 -11
  6. package/dist/create_config.js +8 -7
  7. package/dist/create_generator_fn.cjs +15 -14
  8. package/dist/create_generator_fn.js +9 -8
  9. package/dist/generator_fn.cjs +5 -5
  10. package/dist/index.cjs +33 -39
  11. package/dist/index.js +3 -3
  12. package/dist/type.cjs +2 -2
  13. package/dist/types/config_scheme.d.ts +35 -29
  14. package/dist/types/create_generator_fn.d.ts +2 -2
  15. package/dist/types/type.d.ts +1 -10
  16. package/dist/types/utils/airline.d.ts +4 -4
  17. package/dist/types/utils/color.d.ts +7 -7
  18. package/dist/types/utils/commerce.d.ts +2 -2
  19. package/dist/types/utils/common.d.ts +2 -1
  20. package/dist/types/utils/datatype.d.ts +1 -1
  21. package/dist/types/utils/datetime.d.ts +8 -8
  22. package/dist/types/utils/finance.d.ts +7 -7
  23. package/dist/types/utils/git.d.ts +3 -3
  24. package/dist/types/utils/image.d.ts +4 -4
  25. package/dist/types/utils/internet.d.ts +11 -11
  26. package/dist/types/utils/location.d.ts +11 -11
  27. package/dist/types/utils/lorem.d.ts +8 -8
  28. package/dist/types/utils/number.d.ts +7 -7
  29. package/dist/types/utils/person.d.ts +8 -6
  30. package/dist/types/utils/phone.d.ts +1 -1
  31. package/dist/types/utils/string.d.ts +14 -11
  32. package/dist/types/utils/system.d.ts +5 -5
  33. package/dist/types/utils/utils.d.ts +1 -1
  34. package/dist/types/utils/word.d.ts +9 -9
  35. package/dist/utils/airline.cjs +7 -7
  36. package/dist/utils/animal.cjs +6 -6
  37. package/dist/utils/book.cjs +4 -4
  38. package/dist/utils/color.cjs +6 -6
  39. package/dist/utils/commerce.cjs +6 -6
  40. package/dist/utils/common.cjs +5 -5
  41. package/dist/utils/common.js +1 -1
  42. package/dist/utils/company.cjs +9 -9
  43. package/dist/utils/database.cjs +6 -6
  44. package/dist/utils/datatype.cjs +3 -3
  45. package/dist/utils/datetime.cjs +6 -6
  46. package/dist/utils/finance.cjs +16 -16
  47. package/dist/utils/food.cjs +4 -4
  48. package/dist/utils/git.cjs +5 -5
  49. package/dist/utils/hacker.cjs +5 -5
  50. package/dist/utils/image.cjs +5 -5
  51. package/dist/utils/index.cjs +13 -13
  52. package/dist/utils/index.js +29 -29
  53. package/dist/utils/internet.cjs +15 -15
  54. package/dist/utils/location.cjs +14 -14
  55. package/dist/utils/lorem.cjs +8 -8
  56. package/dist/utils/music.cjs +3 -3
  57. package/dist/utils/number.cjs +3 -3
  58. package/dist/utils/person.cjs +10 -10
  59. package/dist/utils/phone.cjs +3 -3
  60. package/dist/utils/science.cjs +3 -3
  61. package/dist/utils/string.cjs +9 -9
  62. package/dist/utils/system.cjs +11 -11
  63. package/dist/utils/utils.cjs +5 -5
  64. package/dist/utils/utils.js +1 -1
  65. package/dist/utils/vehicle.cjs +3 -3
  66. package/dist/utils/word.cjs +6 -6
  67. package/package.json +54 -51
package/README.md CHANGED
@@ -1,126 +1,131 @@
1
1
  # 假資料結構產生器
2
2
 
3
3
  - [假資料結構產生器](#假資料結構產生器)
4
- - [Wrapping fakerjs Functions](#wrapping-fakerjs-functions)
5
- - [用途](#用途)
6
- - [Value](#value)
7
- - [Selection](#selection)
8
- - [Object](#object)
9
- - [Array](#array)
10
- - [Tuple](#tuple)
11
- - [BoundedSeries](#boundedseries)
12
- - [擴充](#擴充)
4
+ - [Wrapping fakerjs Functions](#wrapping-fakerjs-functions)
5
+ - [用途](#用途)
6
+ - [Value](#value)
7
+ - [Selection](#selection)
8
+ - [Object](#object)
9
+ - [Array](#array)
10
+ - [Tuple](#tuple)
11
+ - [BoundedSeries](#boundedseries)
12
+ - [擴充](#擴充)
13
13
 
14
14
  ## Wrapping fakerjs Functions
15
15
 
16
- - [X] Airline
17
- - [X] Animal
18
- - [X] Color
19
- - [X] Commerce
20
- - [X] Company
21
- - [X] Database
22
- - [X] Datatype
23
- - [X] Date(Datetime)
24
- - [X] Finance
25
- - [X] Food
26
- - [X] Git
27
- - [X] Hacker
28
- - [X] Image
29
- - [X] Internet
30
- - [X] Location
31
- - [X] Lorem
32
- - [X] Music
33
- - [X] Number
34
- - [X] Person
35
- - [X] Phone
36
- - [X] Science
37
- - [X] String
38
- - [X] System
39
- - [X] Vehicle
16
+ - [x] Airline
17
+ - [x] Animal
18
+ - [x] Color
19
+ - [x] Commerce
20
+ - [x] Company
21
+ - [x] Database
22
+ - [x] Datatype
23
+ - [x] Date(Datetime)
24
+ - [x] Finance
25
+ - [x] Food
26
+ - [x] Git
27
+ - [x] Hacker
28
+ - [x] Image
29
+ - [x] Internet
30
+ - [x] Location
31
+ - [x] Lorem
32
+ - [x] Music
33
+ - [x] Number
34
+ - [x] Person
35
+ - [x] Phone
36
+ - [x] Science
37
+ - [x] String
38
+ - [x] System
39
+ - [x] Vehicle
40
40
 
41
41
  ## 用途
42
42
 
43
43
  使用 faker js 時是單一純值不能產生結構,需要自己手動組合結構,此專案利用撰寫設定檔的方式來產生一個特定的假資料函數,減少手動組合結構的麻煩。
44
44
 
45
45
  ```typescript
46
- import { StructConfig } from 'struct-fakerator'
46
+ import { StructConfig } from "struct-fakerator";
47
47
 
48
48
  const scheme = StructConfig.object({
49
- name: StructConfig.value(() => 'hello'),
50
- enum: StructConfig.select([1, 2, 3]),
51
- list: StructConfig.array(StructConfig.value(() => 10), 5),
52
- tuple: StructConfig.tuple([StructConfig.value(() => 'tuple1'), StructConfig.value(() => '100')])
53
- })
49
+ name: StructConfig.value(() => "hello"),
50
+ enum: StructConfig.select([1, 2, 3]),
51
+ list: StructConfig.array(
52
+ StructConfig.value(() => 10),
53
+ 5,
54
+ ),
55
+ tuple: StructConfig.tuple([
56
+ StructConfig.value(() => "tuple1"),
57
+ StructConfig.value(() => "100"),
58
+ ]),
59
+ });
54
60
 
55
61
  // or
56
62
  import {
57
- createObjectConfig,
58
- createArrayConfig,
59
- createValueConfig,
60
- createTupleConfig,
61
- createSelectionConfig
62
- } from 'struct-fakerator';
63
-
63
+ createObjectConfig,
64
+ createArrayConfig,
65
+ createValueConfig,
66
+ createTupleConfig,
67
+ createSelectionConfig,
68
+ } from "struct-fakerator";
64
69
 
65
70
  const scheme = createObjectConfig({
66
- name: createValueConfig(() => 'hello'),
67
- enum: createSelectionConfig([1, 2, 3]),
68
- list: createArrayConfig(
69
- createValueConfig(() => 10),
70
- 5
71
- ),
72
- tuple: createTupleConfig([
73
- createValueConfig(() => 'tuple1'),
74
- createValueConfig(() => 100),
75
- createValueConfig(() => false),
76
- ])
71
+ name: createValueConfig(() => "hello"),
72
+ enum: createSelectionConfig([1, 2, 3]),
73
+ list: createArrayConfig(
74
+ createValueConfig(() => 10),
75
+ 5,
76
+ ),
77
+ tuple: createTupleConfig([
78
+ createValueConfig(() => "tuple1"),
79
+ createValueConfig(() => 100),
80
+ createValueConfig(() => false),
81
+ ]),
77
82
  });
78
83
 
79
84
  // or
80
85
  const scheme = {
81
- type: 'obj',
82
- content: {
83
- name: {
84
- type: 'value',
85
- generateFn: () => 'hello',
86
- },
87
- enum: {
88
- type: 'select',
89
- items: [1, 2, 3],
90
- },
91
- list: {
92
- type: 'arr',
93
- item: {
94
- type: 'value',
95
- generateFn: () => 10,
96
- },
97
- len: 5,
98
- },
99
- tuple: {
100
- type: 'tuple',
101
- configItems: [
102
- {
103
- type: 'value',
104
- generateFn: () => 'tuple1',
86
+ type: "obj",
87
+ content: {
88
+ name: {
89
+ type: "value",
90
+ generateFn: () => "hello",
105
91
  },
106
- {
107
- type: 'value',
108
- generateFn: () => 100,
92
+ enum: {
93
+ type: "select",
94
+ items: [1, 2, 3],
109
95
  },
110
- {
111
- type: 'value',
112
- generateFn: () => false,
96
+ list: {
97
+ type: "arr",
98
+ item: {
99
+ type: "value",
100
+ generateFn: () => 10,
101
+ },
102
+ len: 5,
103
+ },
104
+ tuple: {
105
+ type: "tuple",
106
+ configItems: [
107
+ {
108
+ type: "value",
109
+ generateFn: () => "tuple1",
110
+ },
111
+ {
112
+ type: "value",
113
+ generateFn: () => 100,
114
+ },
115
+ {
116
+ type: "value",
117
+ generateFn: () => false,
118
+ },
119
+ ],
113
120
  },
114
- ],
115
121
  },
116
- },
117
122
  };
118
123
  ```
119
124
 
120
125
  ```typescript
121
- import { StructGenerator } from 'struct-fakerator';
126
+ import { StructGenerator } from "struct-fakerator";
122
127
 
123
- const result = StructGenerator.genFn(scheme)()
128
+ const result = StructGenerator.genFn(scheme)();
124
129
 
125
130
  console.log(result);
126
131
  // {
@@ -129,10 +134,8 @@ console.log(result);
129
134
  // list: [10, 10, 10, 10, 10],
130
135
  // tuple: ['tuple1', 100, false]
131
136
  // }
132
-
133
137
  ```
134
138
 
135
-
136
139
  ### Value
137
140
 
138
141
  ```typescript
@@ -145,7 +148,7 @@ console.log(generateFn());
145
148
  ### Selection
146
149
 
147
150
  ```typescript
148
- const generateFn = StructGenerator.genFn(StructConfig.select([1, 2, 3, 4, 5]))
151
+ const generateFn = StructGenerator.genFn(StructConfig.select([1, 2, 3, 4, 5]));
149
152
 
150
153
  console.log(generateFn());
151
154
  // 1 or 2 or 3 or 4 or 5
@@ -154,10 +157,15 @@ console.log(generateFn());
154
157
  ### Object
155
158
 
156
159
  ```typescript
157
- const generateFn = StructGenerator.genFn(StructConfig.object({
158
- name: StructConfig.value(() => 'hello'),
159
- list: StructConfig.array(StructConfig.value(() => 10), 5),
160
- }));
160
+ const generateFn = StructGenerator.genFn(
161
+ StructConfig.object({
162
+ name: StructConfig.value(() => "hello"),
163
+ list: StructConfig.array(
164
+ StructConfig.value(() => 10),
165
+ 5,
166
+ ),
167
+ }),
168
+ );
161
169
 
162
170
  console.log(generateFn());
163
171
  // {
@@ -167,16 +175,16 @@ console.log(generateFn());
167
175
 
168
176
  // with transformer function
169
177
  const generateFn = StructGenerator.genFn(
170
- StructConfig.object(
171
- {
172
- name: StructConfig.value(() => 'hello'),
173
- list: StructConfig.array(
174
- StructConfig.value(() => 10),
175
- 5
176
- ),
177
- },
178
- ({ name, list }) => list.map((item) => `${name} ${item}`)
179
- )
178
+ StructConfig.object(
179
+ {
180
+ name: StructConfig.value(() => "hello"),
181
+ list: StructConfig.array(
182
+ StructConfig.value(() => 10),
183
+ 5,
184
+ ),
185
+ },
186
+ ({ name, list }) => list.map((item) => `${name} ${item}`),
187
+ ),
180
188
  );
181
189
 
182
190
  console.log(generateFn());
@@ -187,10 +195,10 @@ console.log(generateFn());
187
195
 
188
196
  ```typescript
189
197
  const generateFn = StructGenerator.genFn(
190
- StructConfig.array(
191
- StructConfig.value(() => 10),
192
- 5
193
- )
198
+ StructConfig.array(
199
+ StructConfig.value(() => 10),
200
+ 5,
201
+ ),
194
202
  );
195
203
 
196
204
  console.log(generateFn());
@@ -198,11 +206,11 @@ console.log(generateFn());
198
206
 
199
207
  // with next function
200
208
  const generateFn = StructGenerator.genFn(
201
- StructConfig.array(
202
- StructConfig.value(() => 10),
203
- 5,
204
- (prev, current) => prev + 1 + current
205
- )
209
+ StructConfig.array(
210
+ StructConfig.value(() => 10),
211
+ 5,
212
+ (prev, current) => prev + 1 + current,
213
+ ),
206
214
  );
207
215
 
208
216
  console.log(generateFn());
@@ -213,11 +221,11 @@ console.log(generateFn());
213
221
 
214
222
  ```typescript
215
223
  const generateFn = StructGenerator.genFn(
216
- StructConfig.tuple([
217
- StructConfig.value(() => 'tuple1'),
218
- StructConfig.value(() => 100),
219
- StructConfig.value(() => false),
220
- ])
224
+ StructConfig.tuple([
225
+ StructConfig.value(() => "tuple1"),
226
+ StructConfig.value(() => 100),
227
+ StructConfig.value(() => false),
228
+ ]),
221
229
  );
222
230
 
223
231
  console.log(generateFn());
@@ -228,19 +236,19 @@ console.log(generateFn());
228
236
 
229
237
  ```typescript
230
238
  const generateFn = StructGenerator.genFn(
231
- StructConfig.boundedSeries({
232
- upperLimit: 1.1,
233
- lowerLimit: 0.9,
234
- createInitValue: () => 100,
235
- count: 20,
236
- })
239
+ StructConfig.boundedSeries({
240
+ upperLimit: 1.1,
241
+ lowerLimit: 0.9,
242
+ createInitValue: () => 100,
243
+ count: 20,
244
+ }),
237
245
  );
238
246
 
239
247
  console.log(generateFn());
240
- // [100 * 0.9 <= num <= 100 * 1.1,
248
+ // [100 * 0.9 <= num <= 100 * 1.1,
241
249
  // prev * 0.9 <= num <= prev * 1.1,
242
250
  // prev * 0.9 <= num <= prev * 1.1,
243
- // ...]
251
+ // ...]
244
252
  ```
245
253
 
246
254
  ## 擴充
@@ -263,23 +271,23 @@ const createIntValueConfig = (option) => createValueConfig(() => faker.number.in
263
271
  const createEmailValueConfig = (option) => createValueConfig(() => faker.internet.email(option));
264
272
 
265
273
  const customTypeMatch = (config) => {
266
- if (config.type === "int") {
267
- return createIntValueConfig(config.option);
268
- }
269
- if (config.type === "email") {
270
- return createEmailValueConfig(config.option);
271
- }
272
-
273
- throw Error("error");
274
+ if (config.type === "int") {
275
+ return createIntValueConfig(config.option);
276
+ }
277
+ if (config.type === "email") {
278
+ return createEmailValueConfig(config.option);
279
+ }
280
+
281
+ throw Error("error");
274
282
  };
275
283
 
276
284
  const config = {
277
- type: "obj",
278
- content: {
279
- name: { type: "value", generateFn: () => "John" },
280
- age: { type: "int" },
281
- email: { type: "email" },
282
- },
285
+ type: "obj",
286
+ content: {
287
+ name: { type: "value", generateFn: () => "John" },
288
+ age: { type: "int" },
289
+ email: { type: "email" },
290
+ },
283
291
  };
284
292
 
285
293
  const result = createGeneratorByType(config, customTypeMatch)();
@@ -294,4 +302,3 @@ console.log(result);
294
302
  }
295
303
  */
296
304
  ```
297
-
package/dist/config.cjs CHANGED
@@ -13,7 +13,7 @@ var __webpack_require__ = {};
13
13
  })();
14
14
  (()=>{
15
15
  __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
17
  value: 'Module'
18
18
  });
19
19
  Object.defineProperty(exports1, '__esModule', {
@@ -25,10 +25,10 @@ var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  select: ()=>external_create_config_cjs_namespaceObject.createSelectionConfig,
28
+ boundedSeries: ()=>external_create_config_cjs_namespaceObject.createBoundedSeriesConfig,
28
29
  object: ()=>external_create_config_cjs_namespaceObject.createObjectConfig,
29
30
  tuple: ()=>external_create_config_cjs_namespaceObject.createTupleConfig,
30
31
  value: ()=>external_create_config_cjs_namespaceObject.createValueConfig,
31
- boundedSeries: ()=>external_create_config_cjs_namespaceObject.createBoundedSeriesConfig,
32
32
  array: ()=>external_create_config_cjs_namespaceObject.createArrayConfig
33
33
  });
34
34
  const external_create_config_cjs_namespaceObject = require("./create_config.cjs");
@@ -38,14 +38,14 @@ exports.object = __webpack_exports__.object;
38
38
  exports.select = __webpack_exports__.select;
39
39
  exports.tuple = __webpack_exports__.tuple;
40
40
  exports.value = __webpack_exports__.value;
41
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
41
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
42
42
  "array",
43
43
  "boundedSeries",
44
44
  "object",
45
45
  "select",
46
46
  "tuple",
47
47
  "value"
48
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
48
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
49
49
  Object.defineProperty(exports, '__esModule', {
50
50
  value: true
51
51
  });
@@ -13,7 +13,7 @@ var __webpack_require__ = {};
13
13
  })();
14
14
  (()=>{
15
15
  __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
17
  value: 'Module'
18
18
  });
19
19
  Object.defineProperty(exports1, '__esModule', {
@@ -24,72 +24,56 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
- boundedSeriesScheme: ()=>boundedSeriesScheme,
27
+ selectionConfigScheme: ()=>selectionConfigScheme,
28
28
  tupleConfigScheme: ()=>tupleConfigScheme,
29
- valueConfigScheme: ()=>valueConfigScheme,
30
29
  arrayConfigScheme: ()=>arrayConfigScheme,
31
- selectionConfigScheme: ()=>selectionConfigScheme,
30
+ valueConfigScheme: ()=>valueConfigScheme,
31
+ boundedSeriesScheme: ()=>boundedSeriesScheme,
32
32
  objConfigScheme: ()=>objConfigScheme
33
33
  });
34
- const external_zod_namespaceObject = require("zod");
35
- const valueConfigScheme = external_zod_namespaceObject.z.object({
36
- type: external_zod_namespaceObject.z.string().regex(/^value$/, {
37
- message: "invalid type string"
38
- }),
39
- generateFn: external_zod_namespaceObject.z.any()
40
- });
41
- const selectionConfigScheme = external_zod_namespaceObject.z.object({
42
- type: external_zod_namespaceObject.z.string().regex(/^select$/, {
43
- message: "invalid type string"
44
- }),
45
- items: external_zod_namespaceObject.z.any().array().nonempty({
46
- message: "items can not be empty"
47
- })
34
+ const external_valibot_namespaceObject = require("valibot");
35
+ const valueConfigScheme = external_valibot_namespaceObject.object({
36
+ type: external_valibot_namespaceObject.pipe(external_valibot_namespaceObject.string(), external_valibot_namespaceObject.regex(/^value$/, "invalid type string")),
37
+ generateFn: external_valibot_namespaceObject.any()
48
38
  });
49
- const arrayConfigScheme = external_zod_namespaceObject.z.object({
50
- type: external_zod_namespaceObject.z.string().regex(/^arr$/, {
51
- message: "invalid type string"
52
- }),
53
- item: external_zod_namespaceObject.z.object({}),
54
- len: external_zod_namespaceObject.z.number().nonnegative()
39
+ const selectionConfigScheme = external_valibot_namespaceObject.object({
40
+ type: external_valibot_namespaceObject.pipe(external_valibot_namespaceObject.string(), external_valibot_namespaceObject.regex(/^select$/, "invalid type string")),
41
+ items: external_valibot_namespaceObject.pipe(external_valibot_namespaceObject.array(external_valibot_namespaceObject.any()), external_valibot_namespaceObject.nonEmpty("items can not be empty"))
55
42
  });
56
- const tupleConfigScheme = external_zod_namespaceObject.z.object({
57
- type: external_zod_namespaceObject.z.string().regex(/^tuple$/, {
58
- message: "invalid type string"
59
- }),
60
- configItems: external_zod_namespaceObject.z.any().array()
43
+ const arrayConfigScheme = external_valibot_namespaceObject.object({
44
+ type: external_valibot_namespaceObject.pipe(external_valibot_namespaceObject.string(), external_valibot_namespaceObject.regex(/^arr$/, "invalid type string")),
45
+ item: external_valibot_namespaceObject.object({}),
46
+ len: external_valibot_namespaceObject.pipe(external_valibot_namespaceObject.number(), external_valibot_namespaceObject.integer(), external_valibot_namespaceObject.minValue(0))
61
47
  });
62
- const objConfigScheme = external_zod_namespaceObject.z.object({
63
- type: external_zod_namespaceObject.z.string().regex(/^obj$/, {
64
- message: "invalid type string"
65
- }),
66
- content: external_zod_namespaceObject.z.object({})
48
+ const tupleConfigScheme = external_valibot_namespaceObject.object({
49
+ type: external_valibot_namespaceObject.pipe(external_valibot_namespaceObject.string(), external_valibot_namespaceObject.regex(/^tuple$/, "invalid type string")),
50
+ configItems: external_valibot_namespaceObject.array(external_valibot_namespaceObject.any())
67
51
  });
68
- const boundedSeriesScheme = external_zod_namespaceObject.z.object({
69
- type: external_zod_namespaceObject.z.string().regex(/^bounded_series$/, {
70
- message: "invalid type string"
71
- }),
72
- upperLimit: external_zod_namespaceObject.z.number().nonnegative(),
73
- lowerLimit: external_zod_namespaceObject.z.number().nonnegative(),
74
- createInitValue: external_zod_namespaceObject.z.any(),
75
- count: external_zod_namespaceObject.z.number().nonnegative()
76
- }).refine(({ upperLimit, lowerLimit })=>upperLimit >= lowerLimit, {
77
- message: "lowerLimit can not greater then upperLimit"
52
+ const objConfigScheme = external_valibot_namespaceObject.object({
53
+ type: external_valibot_namespaceObject.pipe(external_valibot_namespaceObject.string(), external_valibot_namespaceObject.regex(/^obj$/, "invalid type string")),
54
+ content: external_valibot_namespaceObject.object({})
78
55
  });
56
+ const boundedSeriesScheme = external_valibot_namespaceObject.pipe(external_valibot_namespaceObject.object({
57
+ type: external_valibot_namespaceObject.pipe(external_valibot_namespaceObject.string(), external_valibot_namespaceObject.regex(/^bounded_series$/, "invalid type string")),
58
+ upperLimit: external_valibot_namespaceObject.pipe(external_valibot_namespaceObject.number(), external_valibot_namespaceObject.minValue(0)),
59
+ lowerLimit: external_valibot_namespaceObject.pipe(external_valibot_namespaceObject.number(), external_valibot_namespaceObject.minValue(0)),
60
+ createInitValue: external_valibot_namespaceObject.any(),
61
+ count: external_valibot_namespaceObject.pipe(external_valibot_namespaceObject.number(), external_valibot_namespaceObject.integer(), external_valibot_namespaceObject.minValue(0))
62
+ }), external_valibot_namespaceObject.check(({ upperLimit, lowerLimit })=>upperLimit >= lowerLimit, "lowerLimit can not greater then upperLimit"));
79
63
  exports.arrayConfigScheme = __webpack_exports__.arrayConfigScheme;
80
64
  exports.boundedSeriesScheme = __webpack_exports__.boundedSeriesScheme;
81
65
  exports.objConfigScheme = __webpack_exports__.objConfigScheme;
82
66
  exports.selectionConfigScheme = __webpack_exports__.selectionConfigScheme;
83
67
  exports.tupleConfigScheme = __webpack_exports__.tupleConfigScheme;
84
68
  exports.valueConfigScheme = __webpack_exports__.valueConfigScheme;
85
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
69
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
86
70
  "arrayConfigScheme",
87
71
  "boundedSeriesScheme",
88
72
  "objConfigScheme",
89
73
  "selectionConfigScheme",
90
74
  "tupleConfigScheme",
91
75
  "valueConfigScheme"
92
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
76
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
93
77
  Object.defineProperty(exports, '__esModule', {
94
78
  value: true
95
79
  });
@@ -1,46 +1,30 @@
1
- import { z } from "zod";
2
- const valueConfigScheme = z.object({
3
- type: z.string().regex(/^value$/, {
4
- message: "invalid type string"
5
- }),
6
- generateFn: z.any()
1
+ import { any, array, check, integer, minValue, nonEmpty, number, object, pipe, regex, string } from "valibot";
2
+ const valueConfigScheme = object({
3
+ type: pipe(string(), regex(/^value$/, "invalid type string")),
4
+ generateFn: any()
7
5
  });
8
- const selectionConfigScheme = z.object({
9
- type: z.string().regex(/^select$/, {
10
- message: "invalid type string"
11
- }),
12
- items: z.any().array().nonempty({
13
- message: "items can not be empty"
14
- })
6
+ const selectionConfigScheme = object({
7
+ type: pipe(string(), regex(/^select$/, "invalid type string")),
8
+ items: pipe(array(any()), nonEmpty("items can not be empty"))
15
9
  });
16
- const arrayConfigScheme = z.object({
17
- type: z.string().regex(/^arr$/, {
18
- message: "invalid type string"
19
- }),
20
- item: z.object({}),
21
- len: z.number().nonnegative()
10
+ const arrayConfigScheme = object({
11
+ type: pipe(string(), regex(/^arr$/, "invalid type string")),
12
+ item: object({}),
13
+ len: pipe(number(), integer(), minValue(0))
22
14
  });
23
- const tupleConfigScheme = z.object({
24
- type: z.string().regex(/^tuple$/, {
25
- message: "invalid type string"
26
- }),
27
- configItems: z.any().array()
15
+ const tupleConfigScheme = object({
16
+ type: pipe(string(), regex(/^tuple$/, "invalid type string")),
17
+ configItems: array(any())
28
18
  });
29
- const objConfigScheme = z.object({
30
- type: z.string().regex(/^obj$/, {
31
- message: "invalid type string"
32
- }),
33
- content: z.object({})
34
- });
35
- const boundedSeriesScheme = z.object({
36
- type: z.string().regex(/^bounded_series$/, {
37
- message: "invalid type string"
38
- }),
39
- upperLimit: z.number().nonnegative(),
40
- lowerLimit: z.number().nonnegative(),
41
- createInitValue: z.any(),
42
- count: z.number().nonnegative()
43
- }).refine(({ upperLimit, lowerLimit })=>upperLimit >= lowerLimit, {
44
- message: "lowerLimit can not greater then upperLimit"
19
+ const objConfigScheme = object({
20
+ type: pipe(string(), regex(/^obj$/, "invalid type string")),
21
+ content: object({})
45
22
  });
23
+ const boundedSeriesScheme = pipe(object({
24
+ type: pipe(string(), regex(/^bounded_series$/, "invalid type string")),
25
+ upperLimit: pipe(number(), minValue(0)),
26
+ lowerLimit: pipe(number(), minValue(0)),
27
+ createInitValue: any(),
28
+ count: pipe(number(), integer(), minValue(0))
29
+ }), check(({ upperLimit, lowerLimit })=>upperLimit >= lowerLimit, "lowerLimit can not greater then upperLimit"));
46
30
  export { arrayConfigScheme, boundedSeriesScheme, objConfigScheme, selectionConfigScheme, tupleConfigScheme, valueConfigScheme };