@battle-racing/br-common-lib 4.9.0 → 5.0.0-rc.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.
- package/.github/workflows/publish-rc.yml +68 -0
- package/dist/domains/catalog/Catalog.schema.d.ts +0 -3
- package/dist/domains/catalog/Catalog.schema.js +0 -1
- package/dist/domains/gameTrack/GameTrack.schema.d.ts +1 -1
- package/dist/domains/gameTrack/GameTrack.schema.js +1 -1
- package/dist/domains/index.d.ts +1 -0
- package/dist/domains/index.js +1 -0
- package/dist/domains/kart/Kart.schema.d.ts +1 -1
- package/dist/domains/kart/Kart.schema.js +1 -1
- package/dist/domains/kartTracking/KartTracking.schema.d.ts +0 -21
- package/dist/domains/kartTracking/KartTracking.schema.js +1 -5
- package/dist/domains/kartTracking/KartTracking.types.d.ts +1 -2
- package/dist/domains/socket/clientToServer/SocketKartClientToServerEventsParams.d.ts +2 -5
- package/dist/domains/socket/inputs/SocketInitKartInput.d.ts +4 -0
- package/dist/domains/socket/inputs/SocketRegisterKartCheckpointInput.d.ts +0 -2
- package/dist/domains/socket/inputs/index.d.ts +1 -1
- package/dist/domains/socket/inputs/index.js +1 -1
- package/dist/domains/ticketing/Ticketing.schema.d.ts +6 -0
- package/dist/domains/ticketing/Ticketing.schema.js +6 -0
- package/dist/domains/user/User.schema.d.ts +2 -3
- package/dist/domains/user/User.schema.js +2 -2
- package/package.json +3 -3
- package/src/domains/catalog/Catalog.const.ts +4 -0
- package/src/domains/catalog/Catalog.schema.ts +27 -0
- package/src/domains/catalog/Catalog.types.ts +12 -0
- package/src/domains/catalog/index.ts +3 -0
- package/src/domains/gameTrack/GameTrack.schema.ts +1 -1
- package/src/domains/index.ts +1 -0
- package/src/domains/kart/Kart.schema.ts +1 -1
- package/src/domains/kartTracking/KartTracking.schema.ts +0 -5
- package/src/domains/kartTracking/KartTracking.types.ts +1 -2
- package/src/domains/socket/clientToServer/SocketKartClientToServerEventsParams.ts +5 -8
- package/src/domains/socket/inputs/SocketInitKartInput.ts +4 -0
- package/src/domains/socket/inputs/SocketRegisterKartCheckpointInput.ts +0 -2
- package/src/domains/socket/inputs/index.ts +1 -1
- package/src/domains/ticketing/Ticketing.schema.ts +8 -0
- package/src/domains/user/User.schema.ts +3 -5
- package/dist/domains/game/swap-kart.schema.d.ts +0 -7
- package/dist/domains/game/swap-kart.schema.js +0 -9
- package/dist/domains/socket/inputs/SocketInitRaspberryInput.d.ts +0 -4
- package/src/domains/socket/inputs/SocketInitRaspberryInput.ts +0 -4
- /package/dist/domains/socket/inputs/{SocketInitRaspberryInput.js → SocketInitKartInput.js} +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
name: Publish RC
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
bump:
|
|
7
|
+
description: 'Version bump'
|
|
8
|
+
required: true
|
|
9
|
+
type: choice
|
|
10
|
+
default: prerelease
|
|
11
|
+
options:
|
|
12
|
+
- prerelease
|
|
13
|
+
- premajor
|
|
14
|
+
- preminor
|
|
15
|
+
- prepatch
|
|
16
|
+
|
|
17
|
+
concurrency:
|
|
18
|
+
group: publish-rc
|
|
19
|
+
cancel-in-progress: false
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
publish:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
permissions:
|
|
25
|
+
contents: write
|
|
26
|
+
id-token: write
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
|
|
31
|
+
- uses: actions/setup-node@v4
|
|
32
|
+
with:
|
|
33
|
+
node-version: 22
|
|
34
|
+
registry-url: https://registry.npmjs.org
|
|
35
|
+
|
|
36
|
+
# Trusted publishing (OIDC) requires a newer npm than the one bundled with Node 22.
|
|
37
|
+
- run: npm install -g npm@latest
|
|
38
|
+
|
|
39
|
+
- run: npm ci
|
|
40
|
+
|
|
41
|
+
- name: Configure git author
|
|
42
|
+
run: |
|
|
43
|
+
git config user.name "github-actions[bot]"
|
|
44
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
45
|
+
|
|
46
|
+
- name: Bump version
|
|
47
|
+
id: bump
|
|
48
|
+
run: |
|
|
49
|
+
TAG=$(npm version "${{ inputs.bump }}" --preid=rc)
|
|
50
|
+
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
|
|
51
|
+
|
|
52
|
+
# --tag rc is hardcoded on purpose: this workflow must never move the `latest` tag.
|
|
53
|
+
- name: Publish
|
|
54
|
+
run: npm publish --access public --tag rc
|
|
55
|
+
|
|
56
|
+
- name: Push version commit and tag
|
|
57
|
+
run: git push --follow-tags
|
|
58
|
+
|
|
59
|
+
- name: Summary
|
|
60
|
+
run: |
|
|
61
|
+
{
|
|
62
|
+
echo "### Published ${{ steps.bump.outputs.version }}"
|
|
63
|
+
echo ''
|
|
64
|
+
echo 'Pin it in the consumer:'
|
|
65
|
+
echo '```json'
|
|
66
|
+
echo "\"@battle-racing/br-common-lib\": \"${{ steps.bump.outputs.version }}\""
|
|
67
|
+
echo '```'
|
|
68
|
+
} >> "$GITHUB_STEP_SUMMARY"
|
|
@@ -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
|
|
@@ -36,7 +36,7 @@ export declare const gameTrackKartConfigSchema: z.ZodObject<{
|
|
|
36
36
|
readonly SaddleBrown: "SaddleBrown";
|
|
37
37
|
}>;
|
|
38
38
|
kartNumber: z.ZodNumber;
|
|
39
|
-
|
|
39
|
+
deviceId: z.ZodString;
|
|
40
40
|
}, z.core.$strip>;
|
|
41
41
|
export declare const gameTrackSchema: z.ZodObject<{
|
|
42
42
|
id: z.ZodString;
|
|
@@ -24,7 +24,7 @@ exports.gameTrackKartConfigSchema = zod_1.z.object({
|
|
|
24
24
|
kartId: zod_1.z.number(),
|
|
25
25
|
color: color_1.colorNameSchema,
|
|
26
26
|
kartNumber: zod_1.z.number(),
|
|
27
|
-
|
|
27
|
+
deviceId: zod_1.z.string(),
|
|
28
28
|
});
|
|
29
29
|
exports.gameTrackSchema = zod_1.z.object({
|
|
30
30
|
id: zod_1.z.string(),
|
package/dist/domains/index.d.ts
CHANGED
package/dist/domains/index.js
CHANGED
|
@@ -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);
|
|
@@ -22,7 +22,7 @@ export declare const kartGameSchema: z.ZodObject<{
|
|
|
22
22
|
export declare const kartSchema: z.ZodObject<{
|
|
23
23
|
guid: z.ZodString;
|
|
24
24
|
id: z.ZodNumber;
|
|
25
|
-
|
|
25
|
+
deviceId: z.ZodString;
|
|
26
26
|
hostname: z.ZodString;
|
|
27
27
|
isConnected: z.ZodBoolean;
|
|
28
28
|
status: z.ZodEnum<{
|
|
@@ -20,7 +20,7 @@ exports.kartGameSchema = zod_1.z.object({
|
|
|
20
20
|
exports.kartSchema = zod_1.z.object({
|
|
21
21
|
guid: zod_1.z.string(),
|
|
22
22
|
id: zod_1.z.number(),
|
|
23
|
-
|
|
23
|
+
deviceId: zod_1.z.string(),
|
|
24
24
|
hostname: zod_1.z.string(),
|
|
25
25
|
isConnected: zod_1.z.boolean(),
|
|
26
26
|
status: exports.kartStatusSchema,
|
|
@@ -17,24 +17,3 @@ export declare const checkpointEventSchema: z.ZodObject<{
|
|
|
17
17
|
server: z.ZodString;
|
|
18
18
|
}, z.core.$strip>;
|
|
19
19
|
}, z.core.$strip>;
|
|
20
|
-
export declare const kartTrackingSchema: z.ZodObject<{
|
|
21
|
-
macAddress: z.ZodString;
|
|
22
|
-
checkpointsEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
23
|
-
id: z.ZodString;
|
|
24
|
-
address: z.ZodNumber;
|
|
25
|
-
name: z.ZodOptional<z.ZodString>;
|
|
26
|
-
type: z.ZodEnum<{
|
|
27
|
-
readonly TRACK: "Track";
|
|
28
|
-
readonly POWER_UP: "PowerUp";
|
|
29
|
-
readonly SHORTCUT: "Shortcut";
|
|
30
|
-
readonly UNKNOWN: "Unknown";
|
|
31
|
-
}>;
|
|
32
|
-
progress: z.ZodNumber;
|
|
33
|
-
averageTimeSecondsToNext: z.ZodOptional<z.ZodNumber>;
|
|
34
|
-
index: z.ZodNumber;
|
|
35
|
-
timestampISO: z.ZodObject<{
|
|
36
|
-
origin: z.ZodString;
|
|
37
|
-
server: z.ZodString;
|
|
38
|
-
}, z.core.$strip>;
|
|
39
|
-
}, z.core.$strip>>>;
|
|
40
|
-
}, z.core.$strip>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.checkpointEventSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const checkpoint_1 = require("../checkpoint");
|
|
6
6
|
exports.checkpointEventSchema = checkpoint_1.checkpointSchema.extend({
|
|
@@ -10,7 +10,3 @@ exports.checkpointEventSchema = checkpoint_1.checkpointSchema.extend({
|
|
|
10
10
|
server: zod_1.z.string(),
|
|
11
11
|
}),
|
|
12
12
|
});
|
|
13
|
-
exports.kartTrackingSchema = zod_1.z.object({
|
|
14
|
-
macAddress: zod_1.z.string(),
|
|
15
|
-
checkpointsEvents: zod_1.z.array(exports.checkpointEventSchema).optional(),
|
|
16
|
-
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { checkpointEventSchema
|
|
2
|
+
import { checkpointEventSchema } from './KartTracking.schema';
|
|
3
3
|
export type CheckpointEvent = z.infer<typeof checkpointEventSchema>;
|
|
4
|
-
export type KartTracking = z.infer<typeof kartTrackingSchema>;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import type { DamageEffectName } from '../../damage';
|
|
2
2
|
import type { Kart } from '../../kart';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SocketInitKartInput, SocketRegisterKartCheckpointInput } from '../inputs';
|
|
4
4
|
export interface SocketKartClientToServerEventsParams {
|
|
5
|
-
'kart:init':
|
|
5
|
+
'kart:init': SocketInitKartInput;
|
|
6
6
|
'kart:checkpoint': SocketRegisterKartCheckpointInput;
|
|
7
7
|
/** Activate the damage of a powerUp */
|
|
8
8
|
'kart:damage:sent': {
|
|
9
|
-
macAddress: string;
|
|
10
9
|
damageName: DamageEffectName;
|
|
11
10
|
};
|
|
12
11
|
/** The Kart received damage */
|
|
13
12
|
'kart:damage:received': {
|
|
14
|
-
macAddress: string;
|
|
15
13
|
damageName: DamageEffectName;
|
|
16
14
|
};
|
|
17
15
|
'kart:data:changed': {
|
|
18
|
-
macAddress: string;
|
|
19
16
|
kart: Kart;
|
|
20
17
|
};
|
|
21
18
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { Checkpoint } from '../../checkpoint';
|
|
2
2
|
export type SocketRegisterKartCheckpointInput = {
|
|
3
|
-
/** The macAddress is necessary to avoid extra process in the backend to find the macAddress */
|
|
4
|
-
macAddress: string;
|
|
5
3
|
checkpointAddress: Checkpoint['address'];
|
|
6
4
|
checkpointType: Checkpoint['type'];
|
|
7
5
|
/** Just Request the power-up when there is no a power-up already assigned */
|
|
@@ -14,6 +14,6 @@ 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("./
|
|
17
|
+
__exportStar(require("./SocketInitKartInput"), exports);
|
|
18
18
|
__exportStar(require("./MacAddressGameTrackConnection"), exports);
|
|
19
19
|
__exportStar(require("./SocketRegisterKartCheckpointInput"), 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.
|
|
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.
|
|
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": "
|
|
3
|
+
"version": "5.0.0-rc.0",
|
|
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.
|
|
36
|
+
"zod": "^4.4.3"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"zod": "^4.
|
|
39
|
+
"zod": "^4.4.3"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@battle-racing/br-common-lib": "^4.6.1"
|
|
@@ -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>;
|
package/src/domains/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { checkpointEventSchema
|
|
2
|
+
import { checkpointEventSchema } from './KartTracking.schema';
|
|
3
3
|
|
|
4
4
|
export type CheckpointEvent = z.infer<typeof checkpointEventSchema>;
|
|
5
|
-
export type KartTracking = z.infer<typeof kartTrackingSchema>;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import type { DamageEffectName } from '../../damage';
|
|
2
2
|
import type { Kart } from '../../kart';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SocketInitKartInput, SocketRegisterKartCheckpointInput } from '../inputs';
|
|
4
4
|
|
|
5
5
|
export interface SocketKartClientToServerEventsParams {
|
|
6
|
-
'kart:init':
|
|
6
|
+
'kart:init': SocketInitKartInput;
|
|
7
7
|
'kart:checkpoint': SocketRegisterKartCheckpointInput;
|
|
8
8
|
/** Activate the damage of a powerUp */
|
|
9
|
-
'kart:damage:sent': {
|
|
9
|
+
'kart:damage:sent': { damageName: DamageEffectName };
|
|
10
10
|
/** The Kart received damage */
|
|
11
|
-
'kart:damage:received': {
|
|
12
|
-
'kart:data:changed': {
|
|
13
|
-
macAddress: string;
|
|
14
|
-
kart: Kart;
|
|
15
|
-
};
|
|
11
|
+
'kart:damage:received': { damageName: DamageEffectName };
|
|
12
|
+
'kart:data:changed': { kart: Kart };
|
|
16
13
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { Checkpoint } from '../../checkpoint';
|
|
2
2
|
|
|
3
3
|
export type SocketRegisterKartCheckpointInput = {
|
|
4
|
-
/** The macAddress is necessary to avoid extra process in the backend to find the macAddress */
|
|
5
|
-
macAddress: string;
|
|
6
4
|
checkpointAddress: Checkpoint['address'];
|
|
7
5
|
checkpointType: Checkpoint['type'];
|
|
8
6
|
/** Just Request the power-up when there is no a power-up already assigned */
|
|
@@ -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.
|
|
73
|
-
z.
|
|
74
|
-
|
|
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,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.swapKartSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.swapKartSchema = zod_1.z.object({
|
|
6
|
-
playerId: zod_1.z.string(),
|
|
7
|
-
oldKartGuid: zod_1.z.string(),
|
|
8
|
-
newKartGuid: zod_1.z.string(),
|
|
9
|
-
});
|
|
File without changes
|