@nfcard/validation 0.1.0 → 0.2.1
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/dist/index.d.ts +3 -0
- package/dist/index.js +0 -0
- package/package.json +2 -2
- package/src/index.test.ts +14 -1
- package/src/index.ts +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -2116,11 +2116,14 @@ declare const configurationUpdateSchema: z.ZodObject<{
|
|
|
2116
2116
|
declare const createOrderSchema: z.ZodObject<{
|
|
2117
2117
|
configurationId: z.ZodString;
|
|
2118
2118
|
discountCode: z.ZodOptional<z.ZodString>;
|
|
2119
|
+
designType: z.ZodEnum<["template", "custom"]>;
|
|
2119
2120
|
}, "strip", z.ZodTypeAny, {
|
|
2120
2121
|
configurationId: string;
|
|
2122
|
+
designType: "custom" | "template";
|
|
2121
2123
|
discountCode?: string | undefined;
|
|
2122
2124
|
}, {
|
|
2123
2125
|
configurationId: string;
|
|
2126
|
+
designType: "custom" | "template";
|
|
2124
2127
|
discountCode?: string | undefined;
|
|
2125
2128
|
}>;
|
|
2126
2129
|
declare const cardUpdateSchema: z.ZodObject<{
|
package/dist/index.js
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nfcard/validation",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Shared Zod validation schemas for the NFCard product family.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"zod": "^3.24.0",
|
|
20
|
-
"@nfcard/types": "0.
|
|
20
|
+
"@nfcard/types": "0.3.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"tsup": "^8.0.0"
|
package/src/index.test.ts
CHANGED
|
@@ -518,23 +518,36 @@ describe('createOrderSchema', () => {
|
|
|
518
518
|
expect(
|
|
519
519
|
createOrderSchema.safeParse({
|
|
520
520
|
configurationId: '550e8400-e29b-41d4-a716-446655440000',
|
|
521
|
+
designType: 'custom',
|
|
521
522
|
}).success,
|
|
522
523
|
).toBe(true);
|
|
523
524
|
});
|
|
524
525
|
|
|
525
526
|
it('rejects a non-uuid configurationId', () => {
|
|
526
527
|
expect(
|
|
527
|
-
createOrderSchema.safeParse({
|
|
528
|
+
createOrderSchema.safeParse({
|
|
529
|
+
configurationId: 'not-a-uuid',
|
|
530
|
+
designType: 'custom',
|
|
531
|
+
}).success,
|
|
528
532
|
).toBe(false);
|
|
529
533
|
});
|
|
530
534
|
|
|
531
535
|
it('accepts an optional discountCode', () => {
|
|
532
536
|
const r = createOrderSchema.safeParse({
|
|
533
537
|
configurationId: '550e8400-e29b-41d4-a716-446655440000',
|
|
538
|
+
designType: 'custom',
|
|
534
539
|
discountCode: 'SUMMER10',
|
|
535
540
|
});
|
|
536
541
|
expect(r.success).toBe(true);
|
|
537
542
|
});
|
|
543
|
+
|
|
544
|
+
it('requires designType (FOXHOLE-714 — Template/Custom pricing path)', () => {
|
|
545
|
+
expect(
|
|
546
|
+
createOrderSchema.safeParse({
|
|
547
|
+
configurationId: '550e8400-e29b-41d4-a716-446655440000',
|
|
548
|
+
}).success,
|
|
549
|
+
).toBe(false);
|
|
550
|
+
});
|
|
538
551
|
});
|
|
539
552
|
|
|
540
553
|
// ── contactExchangeSchema ───────────────────────────────────────
|
package/src/index.ts
CHANGED
|
Binary file
|