@time2win/t2w 1.4.15 → 1.4.17
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/CHANGELOG.md +10 -0
- package/index.d.ts +1 -1
- package/index.js +11 -14
- package/models.d.ts +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## 1.4.17 - 2024-11-12
|
|
9
|
+
### Changed
|
|
10
|
+
```Time2WinAPI``` constructor, to add optional parameter ```pageSize```, default value = 250.
|
|
11
|
+
<br> removed currently unused ```getEventData()``` call in ```getParticipantInfos()```
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.4.16 - 2024-10-15
|
|
15
|
+
### Changed
|
|
16
|
+
type of ```organization``` of ```T2WTeamResult``` to ```string | null```
|
|
17
|
+
|
|
8
18
|
## 1.4.15 - 2024-10-14
|
|
9
19
|
### Added
|
|
10
20
|
```T2WParticipantBasic``` to abstract combined properties of ```T2WParticipantInfo``` and ```T2WIndividualResult```
|
package/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export default class Time2WinAPI {
|
|
|
3
3
|
private readonly apiUrl;
|
|
4
4
|
private readonly apiKey;
|
|
5
5
|
private readonly pageSize;
|
|
6
|
-
constructor(apiKey: string);
|
|
6
|
+
constructor(apiKey: string, pageSize?: number);
|
|
7
7
|
getEventData(eventId: number, dataExtra?: ('prices' | 'splits')[]): Promise<T2WEvent>;
|
|
8
8
|
getTeamResult(eventId: number, raceId: number, dataExtra?: ('splits' | 'attributes' | 'laps')[], teamType?: 'M' | 'F' | 'U', page?: number): Promise<T2WTeamResultsResponse>;
|
|
9
9
|
getTeamsWithMembers(eventId: number, raceId?: number, dataExtra?: ('teammembers' | 'attributes')[], page?: number): Promise<T2WTeamResponse>;
|
package/index.js
CHANGED
|
@@ -48,10 +48,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
50
|
var Time2WinAPI = /** @class */ (function () {
|
|
51
|
-
function Time2WinAPI(apiKey) {
|
|
51
|
+
function Time2WinAPI(apiKey, pageSize) {
|
|
52
|
+
if (pageSize === void 0) { pageSize = 250; }
|
|
52
53
|
this.apiUrl = 'https://time2win.at/api/1.1/{{route}}';
|
|
53
54
|
this.apiKey = apiKey;
|
|
54
|
-
this.pageSize =
|
|
55
|
+
this.pageSize = pageSize;
|
|
55
56
|
}
|
|
56
57
|
Time2WinAPI.prototype.getEventData = function (eventId, dataExtra) {
|
|
57
58
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -255,7 +256,7 @@ var Time2WinAPI = /** @class */ (function () {
|
|
|
255
256
|
};
|
|
256
257
|
fetch(_this.getUrl("/participants/".concat(eventId, "/individuals"), queryParams))
|
|
257
258
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () {
|
|
258
|
-
var body,
|
|
259
|
+
var body, _a, _b, _c;
|
|
259
260
|
var _d;
|
|
260
261
|
var _this = this;
|
|
261
262
|
return __generator(this, function (_e) {
|
|
@@ -267,24 +268,20 @@ var Time2WinAPI = /** @class */ (function () {
|
|
|
267
268
|
reject(body);
|
|
268
269
|
return [2 /*return*/];
|
|
269
270
|
}
|
|
270
|
-
if (
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
_e.label = 3;
|
|
275
|
-
case 3:
|
|
276
|
-
race = null;
|
|
277
|
-
if (!body.page_more) return [3 /*break*/, 5];
|
|
271
|
+
if (!raceId) {
|
|
272
|
+
// const race = (await this.getEventData(eventId)).races.find(r => r.race_id === raceId);
|
|
273
|
+
}
|
|
274
|
+
if (!body.page_more) return [3 /*break*/, 3];
|
|
278
275
|
_b = (_a = (_d = body.list).push).apply;
|
|
279
276
|
_c = [_d];
|
|
280
277
|
return [4 /*yield*/, this.getParticipantInfos(eventId, raceId, dataExtra, gender, body.page + 1)];
|
|
281
|
-
case
|
|
278
|
+
case 2:
|
|
282
279
|
_b.apply(_a, _c.concat([(_e.sent()).list]));
|
|
283
280
|
body.page_more = false;
|
|
284
281
|
body.page = Math.ceil(body.list.length / body.page_size);
|
|
285
282
|
resolve(body);
|
|
286
|
-
_e.label =
|
|
287
|
-
case
|
|
283
|
+
_e.label = 3;
|
|
284
|
+
case 3:
|
|
288
285
|
body.list = body.list.map(function (p) {
|
|
289
286
|
return __assign(__assign({}, p), { birthdate: p.birthdate ? new Date(p.birthdate) : null,
|
|
290
287
|
// age: p.birthdate && race ? this.calculateAge(new Date(p.birthdate), race.starttime) : null,
|
package/models.d.ts
CHANGED
|
@@ -79,10 +79,10 @@ export interface T2WTeamResultSplit {
|
|
|
79
79
|
split_accumulatedtime: boolean;
|
|
80
80
|
}
|
|
81
81
|
export interface T2WTeamResult {
|
|
82
|
+
id: number;
|
|
82
83
|
team_type: 'M' | 'F' | 'U';
|
|
83
84
|
name_team: string;
|
|
84
|
-
organization: string;
|
|
85
|
-
id: number;
|
|
85
|
+
organization: string | null;
|
|
86
86
|
race_id: number;
|
|
87
87
|
race_name: string;
|
|
88
88
|
wave_id: number | null;
|