@battle-racing/br-common-lib 4.9.1 → 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.
Files changed (27) hide show
  1. package/.github/workflows/publish-rc.yml +68 -0
  2. package/dist/domains/gameTrack/GameTrack.schema.d.ts +1 -1
  3. package/dist/domains/gameTrack/GameTrack.schema.js +1 -1
  4. package/dist/domains/kart/Kart.schema.d.ts +1 -1
  5. package/dist/domains/kart/Kart.schema.js +1 -1
  6. package/dist/domains/kartTracking/KartTracking.schema.d.ts +0 -21
  7. package/dist/domains/kartTracking/KartTracking.schema.js +1 -5
  8. package/dist/domains/kartTracking/KartTracking.types.d.ts +1 -2
  9. package/dist/domains/socket/clientToServer/SocketKartClientToServerEventsParams.d.ts +2 -5
  10. package/dist/domains/socket/inputs/SocketInitKartInput.d.ts +4 -0
  11. package/dist/domains/socket/inputs/SocketRegisterKartCheckpointInput.d.ts +0 -2
  12. package/dist/domains/socket/inputs/index.d.ts +1 -1
  13. package/dist/domains/socket/inputs/index.js +1 -1
  14. package/package.json +1 -1
  15. package/src/domains/gameTrack/GameTrack.schema.ts +1 -1
  16. package/src/domains/kart/Kart.schema.ts +1 -1
  17. package/src/domains/kartTracking/KartTracking.schema.ts +0 -5
  18. package/src/domains/kartTracking/KartTracking.types.ts +1 -2
  19. package/src/domains/socket/clientToServer/SocketKartClientToServerEventsParams.ts +5 -8
  20. package/src/domains/socket/inputs/SocketInitKartInput.ts +4 -0
  21. package/src/domains/socket/inputs/SocketRegisterKartCheckpointInput.ts +0 -2
  22. package/src/domains/socket/inputs/index.ts +1 -1
  23. package/dist/domains/game/swap-kart.schema.d.ts +0 -7
  24. package/dist/domains/game/swap-kart.schema.js +0 -9
  25. package/dist/domains/socket/inputs/SocketInitRaspberryInput.d.ts +0 -4
  26. package/src/domains/socket/inputs/SocketInitRaspberryInput.ts +0 -4
  27. /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"
@@ -36,7 +36,7 @@ export declare const gameTrackKartConfigSchema: z.ZodObject<{
36
36
  readonly SaddleBrown: "SaddleBrown";
37
37
  }>;
38
38
  kartNumber: z.ZodNumber;
39
- mac: z.ZodString;
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
- mac: zod_1.z.string(),
27
+ deviceId: zod_1.z.string(),
28
28
  });
29
29
  exports.gameTrackSchema = zod_1.z.object({
30
30
  id: zod_1.z.string(),
@@ -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
- mac: z.ZodString;
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
- mac: zod_1.z.string(),
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.kartTrackingSchema = exports.checkpointEventSchema = void 0;
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, kartTrackingSchema } from './KartTracking.schema';
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 { SocketInitRaspberryInput, SocketRegisterKartCheckpointInput } from '../inputs';
3
+ import type { SocketInitKartInput, SocketRegisterKartCheckpointInput } from '../inputs';
4
4
  export interface SocketKartClientToServerEventsParams {
5
- 'kart:init': SocketInitRaspberryInput;
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
  }
@@ -0,0 +1,4 @@
1
+ export type SocketInitKartInput = {
2
+ deviceId: string;
3
+ hostname: string;
4
+ };
@@ -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 */
@@ -1,3 +1,3 @@
1
- export * from './SocketInitRaspberryInput';
1
+ export * from './SocketInitKartInput';
2
2
  export * from './MacAddressGameTrackConnection';
3
3
  export * from './SocketRegisterKartCheckpointInput';
@@ -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("./SocketInitRaspberryInput"), exports);
17
+ __exportStar(require("./SocketInitKartInput"), exports);
18
18
  __exportStar(require("./MacAddressGameTrackConnection"), exports);
19
19
  __exportStar(require("./SocketRegisterKartCheckpointInput"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@battle-racing/br-common-lib",
3
- "version": "4.9.1",
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",
@@ -27,7 +27,7 @@ export const gameTrackKartConfigSchema = z.object({
27
27
  kartId: z.number(),
28
28
  color: colorNameSchema,
29
29
  kartNumber: z.number(),
30
- mac: z.string(),
30
+ deviceId: z.string(),
31
31
  });
32
32
 
33
33
  export const gameTrackSchema = z.object({
@@ -21,7 +21,7 @@ export const kartGameSchema = z.object({
21
21
  export const kartSchema = z.object({
22
22
  guid: z.string(),
23
23
  id: z.number(),
24
- mac: z.string(),
24
+ deviceId: z.string(),
25
25
  hostname: z.string(),
26
26
  isConnected: z.boolean(),
27
27
  status: kartStatusSchema,
@@ -8,8 +8,3 @@ export const checkpointEventSchema = checkpointSchema.extend({
8
8
  server: z.string(),
9
9
  }),
10
10
  });
11
-
12
- export const kartTrackingSchema = z.object({
13
- macAddress: z.string(),
14
- checkpointsEvents: z.array(checkpointEventSchema).optional(),
15
- });
@@ -1,5 +1,4 @@
1
1
  import { z } from 'zod';
2
- import { checkpointEventSchema, kartTrackingSchema } from './KartTracking.schema';
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 { SocketInitRaspberryInput, SocketRegisterKartCheckpointInput } from '../inputs';
3
+ import type { SocketInitKartInput, SocketRegisterKartCheckpointInput } from '../inputs';
4
4
 
5
5
  export interface SocketKartClientToServerEventsParams {
6
- 'kart:init': SocketInitRaspberryInput;
6
+ 'kart:init': SocketInitKartInput;
7
7
  'kart:checkpoint': SocketRegisterKartCheckpointInput;
8
8
  /** Activate the damage of a powerUp */
9
- 'kart:damage:sent': { macAddress: string; damageName: DamageEffectName };
9
+ 'kart:damage:sent': { damageName: DamageEffectName };
10
10
  /** The Kart received damage */
11
- 'kart:damage:received': { macAddress: string; damageName: DamageEffectName };
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
  }
@@ -0,0 +1,4 @@
1
+ export type SocketInitKartInput = {
2
+ deviceId: string;
3
+ hostname: string;
4
+ };
@@ -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 */
@@ -1,3 +1,3 @@
1
- export * from './SocketInitRaspberryInput';
1
+ export * from './SocketInitKartInput';
2
2
  export * from './MacAddressGameTrackConnection';
3
3
  export * from './SocketRegisterKartCheckpointInput';
@@ -1,7 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const swapKartSchema: z.ZodObject<{
3
- playerId: z.ZodString;
4
- oldKartGuid: z.ZodString;
5
- newKartGuid: z.ZodString;
6
- }, z.core.$strip>;
7
- export type SwapKartDto = z.infer<typeof swapKartSchema>;
@@ -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
- });
@@ -1,4 +0,0 @@
1
- export type SocketInitRaspberryInput = {
2
- macAddress: string;
3
- hostname: string;
4
- };
@@ -1,4 +0,0 @@
1
- export type SocketInitRaspberryInput = {
2
- macAddress: string;
3
- hostname: string;
4
- };