xpt-shared-types 1.7.0 → 1.9.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.
@@ -23,12 +23,14 @@ export interface FaqInput {
23
23
  export interface FeaturedGameInput {
24
24
  featuredHeading?: string;
25
25
  featuredSubheading?: string;
26
+ isActive?: boolean;
26
27
  game?: RelationInput;
27
28
  }
28
29
  /** Write payload for `featured-tournament`. */
29
30
  export interface FeaturedTournamentInput {
30
31
  featuredHeading?: string;
31
32
  featuredSubheading?: string;
33
+ isActive?: boolean;
32
34
  tournament?: RelationInput;
33
35
  }
34
36
  /** Write payload for `friendship`. */
@@ -136,6 +138,8 @@ export interface MatchInput {
136
138
  endedAt?: string;
137
139
  resultType?: MatchResultType;
138
140
  resultNote?: string;
141
+ homeReportedAt?: string;
142
+ awayReportedAt?: string;
139
143
  disputeReason?: MatchDisputeReason;
140
144
  disputeNote?: string;
141
145
  disputedBy?: RelationInput;
@@ -23,12 +23,14 @@ export interface Faq extends StrapiDocument {
23
23
  export interface FeaturedGame extends StrapiDocument {
24
24
  featuredHeading?: string | null;
25
25
  featuredSubheading?: string | null;
26
+ isActive?: boolean | null;
26
27
  game?: Game | null;
27
28
  }
28
29
  /** `featured-tournament` */
29
30
  export interface FeaturedTournament extends StrapiDocument {
30
31
  featuredHeading?: string | null;
31
32
  featuredSubheading?: string | null;
33
+ isActive?: boolean | null;
32
34
  tournament?: Tournament | null;
33
35
  }
34
36
  /** `friendship` */
@@ -136,6 +138,8 @@ export interface Match extends StrapiDocument {
136
138
  endedAt?: string | null;
137
139
  resultType?: MatchResultType | null;
138
140
  resultNote?: string | null;
141
+ homeReportedAt?: string | null;
142
+ awayReportedAt?: string | null;
139
143
  disputeReason?: MatchDisputeReason | null;
140
144
  disputeNote?: string | null;
141
145
  disputedBy?: User | null;
@@ -2,3 +2,5 @@
2
2
  * Hand-written types that are not derived from a Strapi content type.
3
3
  */
4
4
  export * from './country';
5
+ export * from './lobby';
6
+ export * from './tournamentEntry';
@@ -18,3 +18,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  * Hand-written types that are not derived from a Strapi content type.
19
19
  */
20
20
  __exportStar(require("./country"), exports);
21
+ __exportStar(require("./lobby"), exports);
22
+ __exportStar(require("./tournamentEntry"), exports);
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The match lobby as the client renders it.
3
+ *
4
+ * None of these are Strapi content types. The lobby is a view over a match
5
+ * row plus what `GET /matches/:id/lobby` derives for the viewer, and these
6
+ * name the parts of that view both apps have to agree on.
7
+ */
8
+ import type { MatchDisputeReason, MatchRound } from '../generated/enums';
9
+ /**
10
+ * Where a lobby is in its life, from the viewer's side. Derived on the client
11
+ * from `lobbyStatus`, `startedAt`/`endedAt` and whether the viewer's own side
12
+ * has reported; `disputed` and `completed` come straight from `lobbyStatus`.
13
+ */
14
+ export type LobbyPhase = 'waiting' | 'live' | 'reported' | 'disputed' | 'completed';
15
+ /**
16
+ * What the viewer may do in the lobby. A captain (or a solo player) acts for
17
+ * a side; a roster member only talks; the host and staff watch and rule from
18
+ * the manage page.
19
+ */
20
+ export type LobbyViewerRole = 'captain' | 'teamMember' | 'hostOrSpectator';
21
+ /** The match the winner goes on to — enough to say "Round 2 — Match #2". */
22
+ export interface LobbyNextMatch {
23
+ documentId: string;
24
+ round: MatchRound | null;
25
+ matchNumber: number | null;
26
+ }
27
+ /** The reasons a player may send; a score mismatch is found by the server. */
28
+ export type PlayerDisputeReason = Exclude<MatchDisputeReason, 'scoreMismatch'>;
29
+ /** Body of `POST /matches/:id/dispute`, inside `data`. */
30
+ export interface MatchDisputeInput {
31
+ reason: PlayerDisputeReason;
32
+ /** Optional, trimmed, at most `DISPUTE_NOTE_MAX_LENGTH` characters. */
33
+ note?: string;
34
+ }
35
+ export declare const DISPUTE_NOTE_MAX_LENGTH = 500;
36
+ /** Body of `POST /matches/:id/ready`, inside `data`. Omitted means ready. */
37
+ export interface MatchReadyInput {
38
+ ready?: boolean;
39
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * The match lobby as the client renders it.
4
+ *
5
+ * None of these are Strapi content types. The lobby is a view over a match
6
+ * row plus what `GET /matches/:id/lobby` derives for the viewer, and these
7
+ * name the parts of that view both apps have to agree on.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.DISPUTE_NOTE_MAX_LENGTH = void 0;
11
+ exports.DISPUTE_NOTE_MAX_LENGTH = 500;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * A tournament entry after registration — withdrawing it and changing its
3
+ * roster.
4
+ *
5
+ * Neither is a Strapi content type. An entry is a `tournament-participant`
6
+ * row; these name the window in which its registrant may still act on it and
7
+ * the bodies of the endpoints that do so, so the backend guards and the
8
+ * client's buttons agree on both.
9
+ */
10
+ /**
11
+ * Statuses in which an entry can still be withdrawn or have its roster
12
+ * changed. Everything before is unpublished; everything after has a bracket
13
+ * that reads the entry, so the entry is frozen.
14
+ */
15
+ export declare const ENTRY_EDITABLE_STATUSES: readonly ["open", "checkIn"];
16
+ export type EntryEditableStatus = (typeof ENTRY_EDITABLE_STATUSES)[number];
17
+ /** True when `status` still lets an entry be withdrawn or re-rostered. */
18
+ export declare function isEntryEditable(status: string | null | undefined): status is EntryEditableStatus;
19
+ /**
20
+ * Body of `PUT /tournaments/:id/entry/roster`. Flat, like `/join`, not inside
21
+ * `data`. The full new roster, not a diff — the server works out who was
22
+ * added and who was removed.
23
+ */
24
+ export interface TournamentRosterUpdateInput {
25
+ selectedMemberIds: number[];
26
+ }
27
+ /** Body of `POST /tournaments/:id/join` for a team entry. Flat, like above. */
28
+ export interface TournamentTeamJoinInput {
29
+ teamId: string;
30
+ selectedMemberIds: number[];
31
+ }
32
+ /**
33
+ * `error.details.name` values the entry endpoints raise that a client is
34
+ * expected to branch on. Anything else is a plain message.
35
+ */
36
+ export type TournamentEntryErrorName = 'NotEntryLeader' | 'MembersMissingGameAccount' | 'InsufficientCoins' | 'GameAccountRequired' | 'TeamEntryRequired';
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /**
3
+ * A tournament entry after registration — withdrawing it and changing its
4
+ * roster.
5
+ *
6
+ * Neither is a Strapi content type. An entry is a `tournament-participant`
7
+ * row; these name the window in which its registrant may still act on it and
8
+ * the bodies of the endpoints that do so, so the backend guards and the
9
+ * client's buttons agree on both.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ENTRY_EDITABLE_STATUSES = void 0;
13
+ exports.isEntryEditable = isEntryEditable;
14
+ /**
15
+ * Statuses in which an entry can still be withdrawn or have its roster
16
+ * changed. Everything before is unpublished; everything after has a bracket
17
+ * that reads the entry, so the entry is frozen.
18
+ */
19
+ exports.ENTRY_EDITABLE_STATUSES = ['open', 'checkIn'];
20
+ /** True when `status` still lets an entry be withdrawn or re-rostered. */
21
+ function isEntryEditable(status) {
22
+ return exports.ENTRY_EDITABLE_STATUSES.includes(status !== null && status !== void 0 ? status : '');
23
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xpt-shared-types",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "Shared types and data for XPT projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -62,6 +62,7 @@ export interface FaqInput {
62
62
  export interface FeaturedGameInput {
63
63
  featuredHeading?: string;
64
64
  featuredSubheading?: string;
65
+ isActive?: boolean;
65
66
  game?: RelationInput;
66
67
  }
67
68
 
@@ -69,6 +70,7 @@ export interface FeaturedGameInput {
69
70
  export interface FeaturedTournamentInput {
70
71
  featuredHeading?: string;
71
72
  featuredSubheading?: string;
73
+ isActive?: boolean;
72
74
  tournament?: RelationInput;
73
75
  }
74
76
 
@@ -184,6 +186,8 @@ export interface MatchInput {
184
186
  endedAt?: string;
185
187
  resultType?: MatchResultType;
186
188
  resultNote?: string;
189
+ homeReportedAt?: string;
190
+ awayReportedAt?: string;
187
191
  disputeReason?: MatchDisputeReason;
188
192
  disputeNote?: string;
189
193
  disputedBy?: RelationInput;
@@ -63,6 +63,7 @@ export interface Faq extends StrapiDocument {
63
63
  export interface FeaturedGame extends StrapiDocument {
64
64
  featuredHeading?: string | null;
65
65
  featuredSubheading?: string | null;
66
+ isActive?: boolean | null;
66
67
  game?: Game | null;
67
68
  }
68
69
 
@@ -70,6 +71,7 @@ export interface FeaturedGame extends StrapiDocument {
70
71
  export interface FeaturedTournament extends StrapiDocument {
71
72
  featuredHeading?: string | null;
72
73
  featuredSubheading?: string | null;
74
+ isActive?: boolean | null;
73
75
  tournament?: Tournament | null;
74
76
  }
75
77
 
@@ -185,6 +187,8 @@ export interface Match extends StrapiDocument {
185
187
  endedAt?: string | null;
186
188
  resultType?: MatchResultType | null;
187
189
  resultNote?: string | null;
190
+ homeReportedAt?: string | null;
191
+ awayReportedAt?: string | null;
188
192
  disputeReason?: MatchDisputeReason | null;
189
193
  disputeNote?: string | null;
190
194
  disputedBy?: User | null;
@@ -2,3 +2,5 @@
2
2
  * Hand-written types that are not derived from a Strapi content type.
3
3
  */
4
4
  export * from './country';
5
+ export * from './lobby';
6
+ export * from './tournamentEntry';
@@ -0,0 +1,52 @@
1
+ /**
2
+ * The match lobby as the client renders it.
3
+ *
4
+ * None of these are Strapi content types. The lobby is a view over a match
5
+ * row plus what `GET /matches/:id/lobby` derives for the viewer, and these
6
+ * name the parts of that view both apps have to agree on.
7
+ */
8
+
9
+ import type { MatchDisputeReason, MatchRound } from '../generated/enums';
10
+
11
+ /**
12
+ * Where a lobby is in its life, from the viewer's side. Derived on the client
13
+ * from `lobbyStatus`, `startedAt`/`endedAt` and whether the viewer's own side
14
+ * has reported; `disputed` and `completed` come straight from `lobbyStatus`.
15
+ */
16
+ export type LobbyPhase =
17
+ | 'waiting'
18
+ | 'live'
19
+ | 'reported'
20
+ | 'disputed'
21
+ | 'completed';
22
+
23
+ /**
24
+ * What the viewer may do in the lobby. A captain (or a solo player) acts for
25
+ * a side; a roster member only talks; the host and staff watch and rule from
26
+ * the manage page.
27
+ */
28
+ export type LobbyViewerRole = 'captain' | 'teamMember' | 'hostOrSpectator';
29
+
30
+ /** The match the winner goes on to — enough to say "Round 2 — Match #2". */
31
+ export interface LobbyNextMatch {
32
+ documentId: string;
33
+ round: MatchRound | null;
34
+ matchNumber: number | null;
35
+ }
36
+
37
+ /** The reasons a player may send; a score mismatch is found by the server. */
38
+ export type PlayerDisputeReason = Exclude<MatchDisputeReason, 'scoreMismatch'>;
39
+
40
+ /** Body of `POST /matches/:id/dispute`, inside `data`. */
41
+ export interface MatchDisputeInput {
42
+ reason: PlayerDisputeReason;
43
+ /** Optional, trimmed, at most `DISPUTE_NOTE_MAX_LENGTH` characters. */
44
+ note?: string;
45
+ }
46
+
47
+ export const DISPUTE_NOTE_MAX_LENGTH = 500;
48
+
49
+ /** Body of `POST /matches/:id/ready`, inside `data`. Omitted means ready. */
50
+ export interface MatchReadyInput {
51
+ ready?: boolean;
52
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * A tournament entry after registration — withdrawing it and changing its
3
+ * roster.
4
+ *
5
+ * Neither is a Strapi content type. An entry is a `tournament-participant`
6
+ * row; these name the window in which its registrant may still act on it and
7
+ * the bodies of the endpoints that do so, so the backend guards and the
8
+ * client's buttons agree on both.
9
+ */
10
+
11
+ import type { TournamentCurrentStatus } from '../generated/enums';
12
+
13
+ /**
14
+ * Statuses in which an entry can still be withdrawn or have its roster
15
+ * changed. Everything before is unpublished; everything after has a bracket
16
+ * that reads the entry, so the entry is frozen.
17
+ */
18
+ export const ENTRY_EDITABLE_STATUSES = ['open', 'checkIn'] as const satisfies
19
+ readonly TournamentCurrentStatus[];
20
+
21
+ export type EntryEditableStatus = (typeof ENTRY_EDITABLE_STATUSES)[number];
22
+
23
+ /** True when `status` still lets an entry be withdrawn or re-rostered. */
24
+ export function isEntryEditable(
25
+ status: string | null | undefined
26
+ ): status is EntryEditableStatus {
27
+ return (ENTRY_EDITABLE_STATUSES as readonly string[]).includes(status ?? '');
28
+ }
29
+
30
+ /**
31
+ * Body of `PUT /tournaments/:id/entry/roster`. Flat, like `/join`, not inside
32
+ * `data`. The full new roster, not a diff — the server works out who was
33
+ * added and who was removed.
34
+ */
35
+ export interface TournamentRosterUpdateInput {
36
+ selectedMemberIds: number[];
37
+ }
38
+
39
+ /** Body of `POST /tournaments/:id/join` for a team entry. Flat, like above. */
40
+ export interface TournamentTeamJoinInput {
41
+ teamId: string;
42
+ selectedMemberIds: number[];
43
+ }
44
+
45
+ /**
46
+ * `error.details.name` values the entry endpoints raise that a client is
47
+ * expected to branch on. Anything else is a plain message.
48
+ */
49
+ export type TournamentEntryErrorName =
50
+ | 'NotEntryLeader'
51
+ | 'MembersMissingGameAccount'
52
+ | 'InsufficientCoins'
53
+ | 'GameAccountRequired'
54
+ | 'TeamEntryRequired';