@battle-racing/br-common-lib 6.0.0-rc.0 → 6.0.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/RELEASING.md ADDED
@@ -0,0 +1,111 @@
1
+ # Publicar versiones de `br-common-lib`
2
+
3
+ Esta librería la consumen cuatro repositorios (`game-manager-backend`, `kart-manager`,
4
+ `webapp-battle-racing`, `screen-web-RPI`). Un cambio incompatible los rompe a todos, así que
5
+ todo cambio se prueba primero como **release candidate (RC)** y solo se publica como versión
6
+ oficial cuando ya se validó el cambio.
7
+
8
+ Hay dos roles:
9
+
10
+ | Rol | Qué publica | Cómo |
11
+ | :---------------------- | :----------------- | :----------------------------------- |
12
+ | Cualquier desarrollador | RCs (`X.Y.Z-rc.N`) | GitHub Actions → **Publish RC** |
13
+ | Mantenedor | Versión oficial | `npm run release:*` desde su máquina |
14
+
15
+ ---
16
+
17
+ ## Elegir el bump: la tabla que evita el error
18
+
19
+ Esta es la parte donde se equivoca todo el mundo. La pregunta no es "qué tan grande es mi
20
+ cambio", sino **"¿es la primera RC de este cambio, o ya venía iterando?"**
21
+
22
+ | Situación | Bump | Ejemplo desde `6.0.0-rc.0` |
23
+ | :------------------------------------------------------- | :----------- | :------------------------- |
24
+ | **Primera** RC de un cambio incompatible | `premajor` | `7.0.0-rc.0` |
25
+ | **Primera** RC de una funcionalidad retrocompatible | `preminor` | `6.1.0-rc.0` |
26
+ | **Primera** RC de un arreglo menor | `prepatch` | `6.0.1-rc.0` |
27
+ | **Otra** RC del mismo cambio (corregir algo, reintentar) | `prerelease` | `6.0.0-rc.1` |
28
+
29
+ > **La regla:** `premajor` / `preminor` / `prepatch` se usan **una sola vez por cambio**.
30
+ > A partir de ahí, siempre `prerelease`.
31
+
32
+ Si te equivocas y usas `premajor` dos veces, terminas con una versión mayor que nunca existió
33
+ como release (`5.0.0` saltando a `6.0.0`). El error que cometió el bruto de JD **No es grave y no hay que arreglarlo:** `latest` no
34
+ se movió y nadie consumió esa versión. Sigue con `prerelease` desde donde quedaste. Las
35
+ versiones publicadas en npm no se pueden reutilizar ni borrar, así que no intentes "volver atrás".
36
+
37
+ ---
38
+
39
+ ## Publicar una RC
40
+
41
+ 0. Has push de tu rama.
42
+ 1. Repositorio → pestaña **Actions**
43
+ 2. En la barra izquierda: **Publish RC**
44
+ 3. **Run workflow**
45
+ 4. **Branch:** la rama que estás probando
46
+ 5. **Version bump:** según la tabla de arriba
47
+ 6. **Run workflow**
48
+
49
+ Al terminar, abrí el run → **Summary**. Ahí está la línea lista para pegar en el consumidor.
50
+
51
+ ### Probarla en un consumidor
52
+
53
+ Versión **exacta**, sin `^`:
54
+
55
+ ```json
56
+ "@battle-racing/br-common-lib": "6.0.0-rc.1"
57
+ ```
58
+
59
+ El caret con prereleases se comporta de forma poco intuitiva, y sobre hardware querés saber
60
+ exactamente qué build está corriendo.
61
+
62
+ ```bash
63
+ npm install @battle-racing/br-common-lib@6.0.0-rc.1
64
+ ```
65
+
66
+ ### Verificar que salió bien
67
+
68
+ ```bash
69
+ npm view @battle-racing/br-common-lib dist-tags
70
+ # esperado: { latest: '<la oficial>', rc: '6.0.0-rc.1' }
71
+ ```
72
+
73
+ Si `latest` se movió, algo está mal en el workflow. Pará y avisá antes de seguir.
74
+
75
+ ---
76
+
77
+ ## Publicar la versión oficial
78
+
79
+ Solo el mantenedor, y solo cuando la RC ya se validó en pista.
80
+
81
+ ```bash
82
+ git checkout main && git pull
83
+ npm run release:major # o release:minor / release:patch
84
+ ```
85
+
86
+ Desde `6.0.0-rc.3`, `release:major` publica `6.0.0` — quita el sufijo de RC, no salta a `7.0.0`.
87
+
88
+ Después, repinear los consumidores a la versión final y quitar el pin exacto de la RC.
89
+
90
+ ---
91
+
92
+ ## Qué protege a `latest`
93
+
94
+ - El workflow tiene `--tag rc` **hardcodeado**, sin input. Desde Actions no se puede mover `latest`.
95
+ - Los rangos de semver nunca resuelven a prereleases salvo que se pidan explícitamente: un
96
+ consumidor en `^4.9.1` no va a agarrar una `6.0.0-rc.0` ni por accidente.
97
+ - La publicación usa **trusted publishing (OIDC)**: no hay token de npm en ningún lado.
98
+
99
+ **Límite conocido:** al despachar el workflow se ejecuta la copia del `.yml` **de la rama
100
+ seleccionada**. Quien tenga permiso de escritura puede editar ese archivo en su rama y quitar
101
+ el `--tag rc`. La protección real contra eso es un Environment con revisor obligatorio, que
102
+ requiere repo público o plan de pago.
103
+
104
+ ---
105
+
106
+ ## Notas
107
+
108
+ - El commit y el tag de versión quedan en la rama desde la que publicaste. Al mergear a `main`
109
+ puede haber conflicto en el `package.json` si `main` avanzó por otro lado.
110
+ - Las RC publicadas son públicas y permanentes (se pueden deprecar, pero solo desaparecen si se
111
+ despublican dentro de las primeras 72 horas).
@@ -0,0 +1,7 @@
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>;
@@ -0,0 +1,9 @@
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
+ });
@@ -0,0 +1,4 @@
1
+ export type SocketInitRaspberryInput = {
2
+ macAddress: string;
3
+ hostname: string;
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ export declare const WAIVER_SIGNER_ROLE: {
2
+ readonly SELF: "SELF";
3
+ readonly GUARDIAN: "GUARDIAN";
4
+ };
5
+ export declare const WAIVER_RELATIONSHIP: {
6
+ readonly PARENT: "PARENT";
7
+ readonly LEGAL_GUARDIAN: "LEGAL_GUARDIAN";
8
+ readonly OTHER: "OTHER";
9
+ };
10
+ export declare const WAIVER_CONTEXT_TYPE: {
11
+ readonly SESSION: "SESSION";
12
+ readonly RACING_TEAM: "RACING_TEAM";
13
+ };
14
+ export declare const WAIVER_VALIDITY_DAYS = 365;
15
+ export declare const WAIVER_DRAFT_TEMPLATE_VERSION = "draft-1";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WAIVER_DRAFT_TEMPLATE_VERSION = exports.WAIVER_VALIDITY_DAYS = exports.WAIVER_CONTEXT_TYPE = exports.WAIVER_RELATIONSHIP = exports.WAIVER_SIGNER_ROLE = void 0;
4
+ exports.WAIVER_SIGNER_ROLE = {
5
+ SELF: 'SELF',
6
+ GUARDIAN: 'GUARDIAN',
7
+ };
8
+ exports.WAIVER_RELATIONSHIP = {
9
+ PARENT: 'PARENT',
10
+ LEGAL_GUARDIAN: 'LEGAL_GUARDIAN',
11
+ OTHER: 'OTHER',
12
+ };
13
+ exports.WAIVER_CONTEXT_TYPE = {
14
+ SESSION: 'SESSION',
15
+ RACING_TEAM: 'RACING_TEAM',
16
+ };
17
+ exports.WAIVER_VALIDITY_DAYS = 365;
18
+ exports.WAIVER_DRAFT_TEMPLATE_VERSION = 'draft-1';
@@ -0,0 +1,116 @@
1
+ import { z } from 'zod';
2
+ export declare const waiverSignerRoleSchema: z.ZodEnum<{
3
+ readonly SELF: "SELF";
4
+ readonly GUARDIAN: "GUARDIAN";
5
+ }>;
6
+ export declare const waiverRelationshipSchema: z.ZodEnum<{
7
+ readonly PARENT: "PARENT";
8
+ readonly LEGAL_GUARDIAN: "LEGAL_GUARDIAN";
9
+ readonly OTHER: "OTHER";
10
+ }>;
11
+ export declare const waiverContextTypeSchema: z.ZodEnum<{
12
+ readonly SESSION: "SESSION";
13
+ readonly RACING_TEAM: "RACING_TEAM";
14
+ }>;
15
+ export declare const waiverTemplateSchema: z.ZodObject<{
16
+ version: z.ZodString;
17
+ title: z.ZodString;
18
+ body: z.ZodString;
19
+ hash: z.ZodString;
20
+ isActive: z.ZodDefault<z.ZodBoolean>;
21
+ createdAt: z.ZodDate;
22
+ }, z.core.$strip>;
23
+ export declare const waiverContextSchema: z.ZodObject<{
24
+ type: z.ZodEnum<{
25
+ readonly SESSION: "SESSION";
26
+ readonly RACING_TEAM: "RACING_TEAM";
27
+ }>;
28
+ refId: z.ZodString;
29
+ }, z.core.$strip>;
30
+ export declare const waiverSignerSchema: z.ZodObject<{
31
+ role: z.ZodEnum<{
32
+ readonly SELF: "SELF";
33
+ readonly GUARDIAN: "GUARDIAN";
34
+ }>;
35
+ legalName: z.ZodString;
36
+ relationship: z.ZodOptional<z.ZodEnum<{
37
+ readonly PARENT: "PARENT";
38
+ readonly LEGAL_GUARDIAN: "LEGAL_GUARDIAN";
39
+ readonly OTHER: "OTHER";
40
+ }>>;
41
+ playerId: z.ZodOptional<z.ZodUUID>;
42
+ userId: z.ZodOptional<z.ZodUUID>;
43
+ contact: z.ZodOptional<z.ZodString>;
44
+ documentId: z.ZodOptional<z.ZodString>;
45
+ }, z.core.$strip>;
46
+ export declare const waiverRecordSchema: z.ZodObject<{
47
+ id: z.ZodUUID;
48
+ playerId: z.ZodUUID;
49
+ signer: z.ZodObject<{
50
+ role: z.ZodEnum<{
51
+ readonly SELF: "SELF";
52
+ readonly GUARDIAN: "GUARDIAN";
53
+ }>;
54
+ legalName: z.ZodString;
55
+ relationship: z.ZodOptional<z.ZodEnum<{
56
+ readonly PARENT: "PARENT";
57
+ readonly LEGAL_GUARDIAN: "LEGAL_GUARDIAN";
58
+ readonly OTHER: "OTHER";
59
+ }>>;
60
+ playerId: z.ZodOptional<z.ZodUUID>;
61
+ userId: z.ZodOptional<z.ZodUUID>;
62
+ contact: z.ZodOptional<z.ZodString>;
63
+ documentId: z.ZodOptional<z.ZodString>;
64
+ }, z.core.$strip>;
65
+ context: z.ZodObject<{
66
+ type: z.ZodEnum<{
67
+ readonly SESSION: "SESSION";
68
+ readonly RACING_TEAM: "RACING_TEAM";
69
+ }>;
70
+ refId: z.ZodString;
71
+ }, z.core.$strip>;
72
+ templateVersion: z.ZodString;
73
+ templateHash: z.ZodString;
74
+ documentSnapshot: z.ZodString;
75
+ signature: z.ZodOptional<z.ZodString>;
76
+ acceptedAt: z.ZodDate;
77
+ expiresAt: z.ZodDate;
78
+ supersedesWaiverId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
79
+ ipAddress: z.ZodOptional<z.ZodString>;
80
+ userAgent: z.ZodOptional<z.ZodString>;
81
+ createdAt: z.ZodDate;
82
+ }, z.core.$strip>;
83
+ export declare const signWaiverSchema: z.ZodObject<{
84
+ accepted: z.ZodLiteral<true>;
85
+ signerRole: z.ZodDefault<z.ZodEnum<{
86
+ readonly SELF: "SELF";
87
+ readonly GUARDIAN: "GUARDIAN";
88
+ }>>;
89
+ legalName: z.ZodString;
90
+ relationship: z.ZodOptional<z.ZodEnum<{
91
+ readonly PARENT: "PARENT";
92
+ readonly LEGAL_GUARDIAN: "LEGAL_GUARDIAN";
93
+ readonly OTHER: "OTHER";
94
+ }>>;
95
+ signerPlayerId: z.ZodOptional<z.ZodUUID>;
96
+ signerContact: z.ZodOptional<z.ZodString>;
97
+ signerDocumentId: z.ZodOptional<z.ZodString>;
98
+ context: z.ZodObject<{
99
+ type: z.ZodEnum<{
100
+ readonly SESSION: "SESSION";
101
+ readonly RACING_TEAM: "RACING_TEAM";
102
+ }>;
103
+ refId: z.ZodString;
104
+ }, z.core.$strip>;
105
+ templateVersion: z.ZodString;
106
+ signature: z.ZodOptional<z.ZodString>;
107
+ }, z.core.$strip>;
108
+ export declare const filterWaiverSchema: z.ZodObject<{
109
+ playerId: z.ZodOptional<z.ZodUUID>;
110
+ sessionId: z.ZodOptional<z.ZodString>;
111
+ racingTeamId: z.ZodOptional<z.ZodString>;
112
+ signerRole: z.ZodOptional<z.ZodEnum<{
113
+ readonly SELF: "SELF";
114
+ readonly GUARDIAN: "GUARDIAN";
115
+ }>>;
116
+ }, z.core.$strip>;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.filterWaiverSchema = exports.signWaiverSchema = exports.waiverRecordSchema = exports.waiverSignerSchema = exports.waiverContextSchema = exports.waiverTemplateSchema = exports.waiverContextTypeSchema = exports.waiverRelationshipSchema = exports.waiverSignerRoleSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const Waiver_const_1 = require("./Waiver.const");
6
+ exports.waiverSignerRoleSchema = zod_1.z.enum(Waiver_const_1.WAIVER_SIGNER_ROLE);
7
+ exports.waiverRelationshipSchema = zod_1.z.enum(Waiver_const_1.WAIVER_RELATIONSHIP);
8
+ exports.waiverContextTypeSchema = zod_1.z.enum(Waiver_const_1.WAIVER_CONTEXT_TYPE);
9
+ exports.waiverTemplateSchema = zod_1.z.object({
10
+ version: zod_1.z.string().min(1),
11
+ title: zod_1.z.string().min(1),
12
+ body: zod_1.z.string().min(1),
13
+ hash: zod_1.z.string().length(64),
14
+ isActive: zod_1.z.boolean().default(false),
15
+ createdAt: zod_1.z.date(),
16
+ });
17
+ exports.waiverContextSchema = zod_1.z.object({
18
+ type: exports.waiverContextTypeSchema,
19
+ refId: zod_1.z.string().min(1),
20
+ });
21
+ exports.waiverSignerSchema = zod_1.z.object({
22
+ role: exports.waiverSignerRoleSchema,
23
+ legalName: zod_1.z.string().min(3).max(120),
24
+ relationship: exports.waiverRelationshipSchema.optional(),
25
+ playerId: zod_1.z.uuidv4().optional(),
26
+ userId: zod_1.z.uuidv4().optional(),
27
+ contact: zod_1.z.string().max(60).optional(),
28
+ documentId: zod_1.z.string().max(60).optional(),
29
+ });
30
+ exports.waiverRecordSchema = zod_1.z.object({
31
+ id: zod_1.z.uuidv4(),
32
+ playerId: zod_1.z.uuidv4(),
33
+ signer: exports.waiverSignerSchema,
34
+ context: exports.waiverContextSchema,
35
+ templateVersion: zod_1.z.string().min(1),
36
+ templateHash: zod_1.z.string().length(64),
37
+ documentSnapshot: zod_1.z.string().min(1),
38
+ signature: zod_1.z.string().optional(),
39
+ acceptedAt: zod_1.z.date(),
40
+ expiresAt: zod_1.z.date(),
41
+ supersedesWaiverId: zod_1.z.uuidv4().nullable().optional(),
42
+ ipAddress: zod_1.z.string().max(45).optional(),
43
+ userAgent: zod_1.z.string().max(255).optional(),
44
+ createdAt: zod_1.z.date(),
45
+ });
46
+ exports.signWaiverSchema = zod_1.z
47
+ .object({
48
+ accepted: zod_1.z.literal(true),
49
+ signerRole: exports.waiverSignerRoleSchema.default(Waiver_const_1.WAIVER_SIGNER_ROLE.SELF),
50
+ legalName: zod_1.z.string().min(3).max(120),
51
+ relationship: exports.waiverRelationshipSchema.optional(),
52
+ signerPlayerId: zod_1.z.uuidv4().optional(),
53
+ signerContact: zod_1.z.string().max(60).optional(),
54
+ signerDocumentId: zod_1.z.string().max(60).optional(),
55
+ context: exports.waiverContextSchema,
56
+ templateVersion: zod_1.z.string().min(1),
57
+ signature: zod_1.z.string().optional(),
58
+ })
59
+ .refine((input) => input.signerRole !== Waiver_const_1.WAIVER_SIGNER_ROLE.GUARDIAN || Boolean(input.relationship), {
60
+ message: 'relationship is required when signing as GUARDIAN',
61
+ path: ['relationship'],
62
+ });
63
+ exports.filterWaiverSchema = zod_1.z.object({
64
+ playerId: zod_1.z.uuidv4().optional(),
65
+ sessionId: zod_1.z.string().optional(),
66
+ racingTeamId: zod_1.z.string().optional(),
67
+ signerRole: exports.waiverSignerRoleSchema.optional(),
68
+ });
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { filterWaiverSchema, signWaiverSchema, waiverContextSchema, waiverContextTypeSchema, waiverRecordSchema, waiverRelationshipSchema, waiverSignerRoleSchema, waiverSignerSchema, waiverTemplateSchema } from './Waiver.schema';
3
+ export type WaiverSignerRole = z.infer<typeof waiverSignerRoleSchema>;
4
+ export type WaiverRelationship = z.infer<typeof waiverRelationshipSchema>;
5
+ export type WaiverContextType = z.infer<typeof waiverContextTypeSchema>;
6
+ export type WaiverTemplate = z.infer<typeof waiverTemplateSchema>;
7
+ export type WaiverContext = z.infer<typeof waiverContextSchema>;
8
+ export type WaiverSigner = z.infer<typeof waiverSignerSchema>;
9
+ export type WaiverRecord = z.infer<typeof waiverRecordSchema>;
10
+ export type SignWaiverInput = z.infer<typeof signWaiverSchema>;
11
+ export type FilterWaiverInput = z.infer<typeof filterWaiverSchema>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export * from './Waiver.const';
2
+ export * from './Waiver.schema';
3
+ export * from './Waiver.types';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Waiver.const"), exports);
18
+ __exportStar(require("./Waiver.schema"), exports);
19
+ __exportStar(require("./Waiver.types"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@battle-racing/br-common-lib",
3
- "version": "6.0.0-rc.0",
3
+ "version": "6.0.0",
4
4
  "description": "Common library for all Battle Racing Repositorios",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",