@marcoappio/marco-config 2.0.570 → 2.0.571

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.
@@ -689,7 +689,7 @@ export declare const marcoSchemas: {
689
689
  };
690
690
  user: {
691
691
  createFeedback: import("valibot").ObjectSchema<{
692
- readonly feedbackText: import("valibot").UndefinedableSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>]>, undefined>;
692
+ readonly feedbackText: import("valibot").OptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, 4000, undefined>]>, undefined>;
693
693
  readonly id: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, undefined>, import("valibot").MaxLengthAction<string, number, undefined>, import("valibot").BrandAction<string, "UserId">]>, undefined>;
694
694
  readonly rating: import("valibot").NonOptionalSchema<import("valibot").SchemaWithPipe<readonly [import("valibot").NumberSchema<undefined>, import("valibot").IntegerAction<number, undefined>, import("valibot").MinValueAction<number, 1, undefined>, import("valibot").MaxValueAction<number, 5, undefined>]>, undefined>;
695
695
  }, undefined>;
@@ -264,7 +264,7 @@ export declare const mutatorSchemas: {
264
264
  };
265
265
  user: {
266
266
  createFeedback: v.ObjectSchema<{
267
- readonly feedbackText: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
267
+ readonly feedbackText: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, 4000, undefined>]>, undefined>;
268
268
  readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "UserId">]>, undefined>;
269
269
  readonly rating: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 5, undefined>]>, undefined>;
270
270
  }, undefined>;
@@ -194,7 +194,7 @@ export const mutatorSchemas = {
194
194
  },
195
195
  user: {
196
196
  createFeedback: v.object({
197
- feedbackText: string.optional(4000),
197
+ feedbackText: v.optional(v.pipe(v.string(), v.nonEmpty(), v.maxLength(4000))),
198
198
  id: id.userId.required(),
199
199
  rating: v.nonOptional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(5))),
200
200
  }),
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mutatorSchemas.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutatorSchemas.test.d.ts","sourceRoot":"","sources":["../../../src/schemas/mutators/mutatorSchemas.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+ import * as v from 'valibot';
3
+ import { mutatorSchemas } from './mutatorSchemas';
4
+ describe('mutatorSchemas.user.createFeedback', () => {
5
+ const testCases = [
6
+ {
7
+ description: 'omitted feedbackText',
8
+ input: {
9
+ id: 'user_01K4FZ8D9QCA8ZA9DCE3W1SET3',
10
+ rating: 5,
11
+ },
12
+ success: true,
13
+ },
14
+ {
15
+ description: 'non-empty feedbackText',
16
+ input: {
17
+ feedbackText: 'test-feedback-text',
18
+ id: 'user_01K4FZ8D9QCA8ZA9DCE3W1SET3',
19
+ rating: 5,
20
+ },
21
+ success: true,
22
+ },
23
+ {
24
+ description: 'empty feedbackText',
25
+ input: {
26
+ feedbackText: '',
27
+ id: 'user_01K4FZ8D9QCA8ZA9DCE3W1SET3',
28
+ rating: 5,
29
+ },
30
+ success: false,
31
+ },
32
+ ];
33
+ for (const testCase of testCases) {
34
+ it(`handles ${testCase.description}`, () => {
35
+ const result = v.safeParse(mutatorSchemas.user.createFeedback, testCase.input);
36
+ expect(result.success).toBe(testCase.success);
37
+ });
38
+ }
39
+ });
@@ -1,6 +1,6 @@
1
1
  import * as v from 'valibot';
2
2
  export declare const createFeedback: import("../../../../..").EndpointConfig<"/v1/pv/models/user/feedback/create", v.ObjectSchema<{
3
- readonly feedbackText: v.UndefinedableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
3
+ readonly feedbackText: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, 4000, undefined>]>, undefined>;
4
4
  readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>, v.BrandAction<string, "UserId">]>, undefined>;
5
5
  readonly rating: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 5, undefined>]>, undefined>;
6
6
  }, undefined>, v.GenericSchema | undefined, v.UnionSchema<[v.ObjectSchema<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marcoappio/marco-config",
3
- "version": "2.0.570",
3
+ "version": "2.0.571",
4
4
  "author": "team@marcoapp.io",
5
5
  "main": "dist/index.js",
6
6
  "repository": "git@github.com:marcoappio/marco-config.git",