@battle-racing/br-common-lib 4.9.0 → 4.9.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.
@@ -6,7 +6,6 @@ export declare const bundleStatusSchema: z.ZodEnum<{
6
6
  export declare const bundleDefinitionSchema: z.ZodObject<{
7
7
  id: z.ZodUUID;
8
8
  name: z.ZodString;
9
- description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
10
9
  items: z.ZodArray<z.ZodObject<{
11
10
  ticketType: z.ZodEnum<{
12
11
  readonly Race: "Race";
@@ -37,7 +36,6 @@ export declare const createBundleDefinitionInputSchema: z.ZodObject<{
37
36
  priceCents: z.ZodNumber;
38
37
  }, z.core.$strip>>;
39
38
  name: z.ZodString;
40
- description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
41
39
  }, z.core.$strip>;
42
40
  export declare const updateBundleDefinitionInputSchema: z.ZodObject<{
43
41
  status: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
@@ -53,5 +51,4 @@ export declare const updateBundleDefinitionInputSchema: z.ZodObject<{
53
51
  priceCents: z.ZodNumber;
54
52
  }, z.core.$strip>>>;
55
53
  name: z.ZodOptional<z.ZodString>;
56
- description: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
57
54
  }, z.core.$strip>;
@@ -8,7 +8,6 @@ exports.bundleStatusSchema = zod_1.z.enum(Catalog_const_1.BUNDLE_STATUS);
8
8
  exports.bundleDefinitionSchema = zod_1.z.object({
9
9
  id: zod_1.z.uuidv4(),
10
10
  name: zod_1.z.string().min(1),
11
- description: zod_1.z.string().optional().nullable(),
12
11
  items: zod_1.z.array(Ticketing_schema_1.purchaseItemSchema).min(1),
13
12
  status: exports.bundleStatusSchema.default(Catalog_const_1.BUNDLE_STATUS.ACTIVE),
14
13
  // Set after syncing to an external storefront — null means not yet synced
@@ -1,3 +1,4 @@
1
+ export * from './catalog';
1
2
  export * from './checkpoint';
2
3
  export * from './color';
3
4
  export * from './damage';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./catalog"), exports);
17
18
  __exportStar(require("./checkpoint"), exports);
18
19
  __exportStar(require("./color"), exports);
19
20
  __exportStar(require("./damage"), exports);
@@ -61,6 +61,8 @@ export declare const purchaseSchema: z.ZodObject<{
61
61
  buyerUserId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
62
62
  guestName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
63
63
  guestContact: z.ZodNullable<z.ZodOptional<z.ZodString>>;
64
+ bundleId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
65
+ externalOrderId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
64
66
  items: z.ZodArray<z.ZodObject<{
65
67
  ticketType: z.ZodEnum<{
66
68
  readonly Race: "Race";
@@ -106,6 +108,8 @@ export declare const paginatedPurchaseSchema: z.ZodObject<{
106
108
  buyerUserId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
107
109
  guestName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
108
110
  guestContact: z.ZodNullable<z.ZodOptional<z.ZodString>>;
111
+ bundleId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
112
+ externalOrderId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
109
113
  items: z.ZodArray<z.ZodObject<{
110
114
  ticketType: z.ZodEnum<{
111
115
  readonly Race: "Race";
@@ -148,6 +152,8 @@ export declare const createPurchaseInputSchema: z.ZodObject<{
148
152
  quantity: z.ZodNumber;
149
153
  priceCents: z.ZodNumber;
150
154
  }, z.core.$strip>>;
155
+ bundleId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
156
+ externalOrderId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
151
157
  }, z.core.$strip>;
152
158
  export declare const gameTurnStatusSchema: z.ZodEnum<{
153
159
  readonly CREATED: "created";
@@ -35,6 +35,10 @@ exports.purchaseSchema = zod_1.z.object({
35
35
  buyerUserId: zod_1.z.string().optional().nullable(),
36
36
  guestName: zod_1.z.string().optional().nullable(),
37
37
  guestContact: zod_1.z.string().optional().nullable(),
38
+ // Bundle reference — null for legacy on-site purchases without bundle
39
+ bundleId: zod_1.z.string().optional().nullable(),
40
+ // External order reference (e.g. Wix) — null for on-site (POS) purchases
41
+ externalOrderId: zod_1.z.string().optional().nullable(),
38
42
  items: zod_1.z.array(exports.purchaseItemSchema),
39
43
  totalAmountCents: zod_1.z.number().min(0),
40
44
  status: exports.purchaseStatusSchema.default(Ticketing_const_1.PURCHASE_STATUS.PENDING),
@@ -61,6 +65,8 @@ exports.createPurchaseInputSchema = zod_1.z.object({
61
65
  guestName: zod_1.z.string().optional(),
62
66
  guestContact: zod_1.z.string().optional(),
63
67
  items: zod_1.z.array(exports.purchaseItemSchema).min(1),
68
+ bundleId: zod_1.z.string().optional().nullable(),
69
+ externalOrderId: zod_1.z.string().optional().nullable(),
64
70
  });
65
71
  exports.gameTurnStatusSchema = zod_1.z.enum(Ticketing_const_1.GAME_TURN_STATUS);
66
72
  exports.gameTurnCheckSchema = zod_1.z.enum(Ticketing_const_1.GAME_TURN_CHECK);
@@ -70,7 +70,7 @@ export declare const authUserSchema: z.ZodObject<{
70
70
  lastLoginAt: z.ZodOptional<z.ZodDate>;
71
71
  authToken: z.ZodString;
72
72
  }, z.core.$strip>;
73
- export declare const userWithPasswordSchema: z.ZodIntersection<z.ZodObject<{
73
+ export declare const userWithPasswordSchema: z.ZodObject<{
74
74
  id: z.ZodUUID;
75
75
  name: z.ZodOptional<z.ZodString>;
76
76
  lastName: z.ZodOptional<z.ZodString>;
@@ -92,9 +92,8 @@ export declare const userWithPasswordSchema: z.ZodIntersection<z.ZodObject<{
92
92
  defaultPlayerId: z.ZodOptional<z.ZodUUID>;
93
93
  createdAt: z.ZodDate;
94
94
  lastLoginAt: z.ZodOptional<z.ZodDate>;
95
- }, z.core.$strip>, z.ZodObject<{
96
95
  password: z.ZodString;
97
- }, z.core.$strip>>;
96
+ }, z.core.$strip>;
98
97
  export declare const userInitialRegistrationSchema: z.ZodObject<{
99
98
  emailOrPhone: z.ZodString;
100
99
  password: z.ZodString;
@@ -54,9 +54,9 @@ exports.initialUserSchema = baseUserObj.pick({
54
54
  exports.authUserSchema = baseUserObj.extend({
55
55
  authToken: zod_1.z.string(),
56
56
  });
57
- exports.userWithPasswordSchema = exports.userSchema.and(zod_1.z.object({
57
+ exports.userWithPasswordSchema = exports.userSchema.extend({
58
58
  password: zod_1.z.string().min(MIN_PASSWORD_LENGTH),
59
- }));
59
+ });
60
60
  exports.userInitialRegistrationSchema = zod_1.z.object({
61
61
  emailOrPhone: exports.emailOrPhoneSchema,
62
62
  password: zod_1.z.string().min(MIN_PASSWORD_LENGTH, `Password must be at least ${MIN_PASSWORD_LENGTH} characters`),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@battle-racing/br-common-lib",
3
- "version": "4.9.0",
3
+ "version": "4.9.1",
4
4
  "description": "Common library for all Battle Racing Repositorios",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -33,10 +33,10 @@
33
33
  "@modelcontextprotocol/sdk": "^1.29.0",
34
34
  "@types/node": "^25.6.0",
35
35
  "typescript": "^5.8.3",
36
- "zod": "^4.2.1"
36
+ "zod": "^4.4.3"
37
37
  },
38
38
  "peerDependencies": {
39
- "zod": "^4.2.1"
39
+ "zod": "^4.4.3"
40
40
  },
41
41
  "dependencies": {
42
42
  "@battle-racing/br-common-lib": "^4.6.1"
@@ -0,0 +1,4 @@
1
+ export const BUNDLE_STATUS = {
2
+ ACTIVE: 'active',
3
+ INACTIVE: 'inactive',
4
+ } as const;
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ import { BUNDLE_STATUS } from './Catalog.const';
3
+ import { purchaseItemSchema } from '../ticketing/Ticketing.schema';
4
+
5
+ export const bundleStatusSchema = z.enum(BUNDLE_STATUS);
6
+
7
+ export const bundleDefinitionSchema = z.object({
8
+ id: z.uuidv4(),
9
+ name: z.string().min(1),
10
+ items: z.array(purchaseItemSchema).min(1),
11
+ status: bundleStatusSchema.default(BUNDLE_STATUS.ACTIVE),
12
+
13
+ // Set after syncing to an external storefront — null means not yet synced
14
+ externalProductId: z.string().optional().nullable(),
15
+
16
+ createdAt: z.date(),
17
+ updatedAt: z.date(),
18
+ });
19
+
20
+ export const createBundleDefinitionInputSchema = bundleDefinitionSchema.omit({
21
+ id: true,
22
+ externalProductId: true,
23
+ createdAt: true,
24
+ updatedAt: true,
25
+ });
26
+
27
+ export const updateBundleDefinitionInputSchema = createBundleDefinitionInputSchema.partial();
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import {
3
+ bundleDefinitionSchema,
4
+ bundleStatusSchema,
5
+ createBundleDefinitionInputSchema,
6
+ updateBundleDefinitionInputSchema,
7
+ } from './Catalog.schema';
8
+
9
+ export type BundleStatus = z.infer<typeof bundleStatusSchema>;
10
+ export type BundleDefinition = z.infer<typeof bundleDefinitionSchema>;
11
+ export type CreateBundleDefinitionInput = z.infer<typeof createBundleDefinitionInputSchema>;
12
+ export type UpdateBundleDefinitionInput = z.infer<typeof updateBundleDefinitionInputSchema>;
@@ -0,0 +1,3 @@
1
+ export * from './Catalog.const';
2
+ export * from './Catalog.schema';
3
+ export * from './Catalog.types';
@@ -1,3 +1,4 @@
1
+ export * from './catalog';
1
2
  export * from './checkpoint';
2
3
  export * from './color';
3
4
  export * from './damage';
@@ -48,6 +48,12 @@ export const purchaseSchema = z.object({
48
48
  guestName: z.string().optional().nullable(),
49
49
  guestContact: z.string().optional().nullable(),
50
50
 
51
+ // Bundle reference — null for legacy on-site purchases without bundle
52
+ bundleId: z.string().optional().nullable(),
53
+
54
+ // External order reference (e.g. Wix) — null for on-site (POS) purchases
55
+ externalOrderId: z.string().optional().nullable(),
56
+
51
57
  items: z.array(purchaseItemSchema),
52
58
  totalAmountCents: z.number().min(0),
53
59
  status: purchaseStatusSchema.default(PURCHASE_STATUS.PENDING),
@@ -79,6 +85,8 @@ export const createPurchaseInputSchema = z.object({
79
85
  guestName: z.string().optional(),
80
86
  guestContact: z.string().optional(),
81
87
  items: z.array(purchaseItemSchema).min(1),
88
+ bundleId: z.string().optional().nullable(),
89
+ externalOrderId: z.string().optional().nullable(),
82
90
  });
83
91
 
84
92
  export const gameTurnStatusSchema = z.enum(GAME_TURN_STATUS);
@@ -69,11 +69,9 @@ export const authUserSchema = baseUserObj.extend({
69
69
  authToken: z.string(),
70
70
  });
71
71
 
72
- export const userWithPasswordSchema = userSchema.and(
73
- z.object({
74
- password: z.string().min(MIN_PASSWORD_LENGTH),
75
- }),
76
- );
72
+ export const userWithPasswordSchema = userSchema.extend({
73
+ password: z.string().min(MIN_PASSWORD_LENGTH),
74
+ });
77
75
 
78
76
  export const userInitialRegistrationSchema = z.object({
79
77
  emailOrPhone: emailOrPhoneSchema,