crewtimer-common 1.0.2-beta.2

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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +23 -0
  3. package/dist/cjs/src/index.d.ts +1 -0
  4. package/dist/cjs/src/index.js +5 -0
  5. package/dist/cjs/src/index.js.map +1 -0
  6. package/dist/cjs/src/types/CrewTimerTypes.d.ts +6 -0
  7. package/dist/cjs/src/types/CrewTimerTypes.js +10 -0
  8. package/dist/cjs/src/types/CrewTimerTypes.js.map +1 -0
  9. package/dist/cjs/src/types/Entry.d.ts +17 -0
  10. package/dist/cjs/src/types/Entry.js +3 -0
  11. package/dist/cjs/src/types/Entry.js.map +1 -0
  12. package/dist/cjs/src/types/Event.d.ts +17 -0
  13. package/dist/cjs/src/types/Event.js +3 -0
  14. package/dist/cjs/src/types/Event.js.map +1 -0
  15. package/dist/cjs/src/types/KeyMap.d.ts +4 -0
  16. package/dist/cjs/src/types/KeyMap.js +3 -0
  17. package/dist/cjs/src/types/KeyMap.js.map +1 -0
  18. package/dist/cjs/src/types/RMTypes.d.ts +155 -0
  19. package/dist/cjs/src/types/RMTypes.js +3 -0
  20. package/dist/cjs/src/types/RMTypes.js.map +1 -0
  21. package/dist/cjs/src/types/ResultTypes.d.ts +69 -0
  22. package/dist/cjs/src/types/ResultTypes.js +3 -0
  23. package/dist/cjs/src/types/ResultTypes.js.map +1 -0
  24. package/dist/cjs/src/types/ServerTypes.d.ts +143 -0
  25. package/dist/cjs/src/types/ServerTypes.js +3 -0
  26. package/dist/cjs/src/types/ServerTypes.js.map +1 -0
  27. package/dist/esm/src/index.d.ts +1 -0
  28. package/dist/esm/src/index.js +2 -0
  29. package/dist/esm/src/index.js.map +1 -0
  30. package/dist/esm/src/types/CrewTimerTypes.d.ts +6 -0
  31. package/dist/esm/src/types/CrewTimerTypes.js +7 -0
  32. package/dist/esm/src/types/CrewTimerTypes.js.map +1 -0
  33. package/dist/esm/src/types/Entry.d.ts +17 -0
  34. package/dist/esm/src/types/Entry.js +2 -0
  35. package/dist/esm/src/types/Entry.js.map +1 -0
  36. package/dist/esm/src/types/Event.d.ts +17 -0
  37. package/dist/esm/src/types/Event.js +2 -0
  38. package/dist/esm/src/types/Event.js.map +1 -0
  39. package/dist/esm/src/types/KeyMap.d.ts +4 -0
  40. package/dist/esm/src/types/KeyMap.js +2 -0
  41. package/dist/esm/src/types/KeyMap.js.map +1 -0
  42. package/dist/esm/src/types/RMTypes.d.ts +155 -0
  43. package/dist/esm/src/types/RMTypes.js +2 -0
  44. package/dist/esm/src/types/RMTypes.js.map +1 -0
  45. package/dist/esm/src/types/ResultTypes.d.ts +69 -0
  46. package/dist/esm/src/types/ResultTypes.js +2 -0
  47. package/dist/esm/src/types/ResultTypes.js.map +1 -0
  48. package/dist/esm/src/types/ServerTypes.d.ts +143 -0
  49. package/dist/esm/src/types/ServerTypes.js +2 -0
  50. package/dist/esm/src/types/ServerTypes.js.map +1 -0
  51. package/package.json +62 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 CrewTimer Regatta Timing
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # CrewTimer Types and Utilities
2
+
3
+ This repository includes types and utilities that are shared among various CrewTimer subsystems. CrewTimer grew slowly over time with nearly all the code currently written in Typescript.
4
+
5
+ As time allows, this codebase will be cleaned and documented but the initial version is put out there as-is to facilite migration of addtional CrewTimer modules to open source.
6
+
7
+ ## Planned CrewTimer Repositories
8
+
9
+ ### Currently Open Source
10
+
11
+ * [crewtimer-points](https://github.com/crewtimer/crewtimer-points) - A points engine for CrewTimer results.
12
+
13
+ ### Coming Soon
14
+
15
+ * crewtimer-handicaps - A handicap engine for CrewTimer handicap calculations
16
+ * crewtimer-lynx - Support for FinishLynx integration with CrewTimer. This is an electron app.
17
+
18
+ ### Future Open Source
19
+
20
+ * crewtimer-mobile - Mobile Apps for Andriod and iOS
21
+ * crewtimer-results - CrewTimer results website [https://crewtimer.com](https://crewtimer.com)
22
+ * crewtimer-admin - CrewTimer Admin interface [https://admin.crewtimer.com](https://admin.crewtimer.com)
23
+ * crewtimer-wisblock - Hardware devices such as the BLE Clicker and Mobile Horn (C++)
@@ -0,0 +1 @@
1
+ export * from './types/CrewTimerTypes';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./types/CrewTimerTypes"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;AAAA,iEAAuC"}
@@ -0,0 +1,6 @@
1
+ export * from './Entry';
2
+ export * from './Event';
3
+ export * from './KeyMap';
4
+ export * from './ResultTypes';
5
+ export * from './RMTypes';
6
+ export * from './ServerTypes';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./Entry"), exports);
5
+ tslib_1.__exportStar(require("./Event"), exports);
6
+ tslib_1.__exportStar(require("./KeyMap"), exports);
7
+ tslib_1.__exportStar(require("./ResultTypes"), exports);
8
+ tslib_1.__exportStar(require("./RMTypes"), exports);
9
+ tslib_1.__exportStar(require("./ServerTypes"), exports);
10
+ //# sourceMappingURL=CrewTimerTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CrewTimerTypes.js","sourceRoot":"","sources":["../../../../src/types/CrewTimerTypes.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,kDAAwB;AACxB,mDAAyB;AACzB,wDAA8B;AAC9B,oDAA0B;AAC1B,wDAA8B"}
@@ -0,0 +1,17 @@
1
+ import KeyMap from './KeyMap';
2
+ export interface Entry extends KeyMap {
3
+ AdjTime?: string;
4
+ Bow: string;
5
+ Crew: string;
6
+ CrewAbbrev: string;
7
+ Event: string;
8
+ EventAbbrev: string;
9
+ EventNum: string;
10
+ Gate?: string;
11
+ Place?: string;
12
+ State?: string;
13
+ Stroke?: string;
14
+ Time?: string;
15
+ Timestamp?: number;
16
+ uuid?: string;
17
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Entry.js","sourceRoot":"","sources":["../../../../src/types/Entry.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { Entry } from './Entry';
2
+ export interface Event {
3
+ Day?: string;
4
+ DispOrder: number[];
5
+ entries?: Entry[];
6
+ Event: string;
7
+ eventIndex: number;
8
+ EventInfo?: string;
9
+ eventItems: Entry[];
10
+ eventKey?: string;
11
+ EventNum: string;
12
+ Finished?: boolean;
13
+ Official?: boolean;
14
+ RaceType: 'Head' | 'Sprint';
15
+ Start?: string;
16
+ }
17
+ export type EventList = Event[];
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Event.js","sourceRoot":"","sources":["../../../../src/types/Event.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export interface KeyMap<T = any> {
2
+ [key: string]: T;
3
+ }
4
+ export default KeyMap;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=KeyMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyMap.js","sourceRoot":"","sources":["../../../../src/types/KeyMap.ts"],"names":[],"mappings":""}
@@ -0,0 +1,155 @@
1
+ import { Entry } from './Entry';
2
+ import { KeyMap } from './KeyMap';
3
+ /** Define the publication posted to tracking_items */
4
+ export interface PenaltyPub {
5
+ /** this is an identity column like the Id in times, so handle the same way(0 or null) */
6
+ trackingId: number | undefined;
7
+ /** tracking_stations.Id – the station the device is assigned to */
8
+ trackingStationId: string;
9
+ /** uuid that is used to update the record if needed, as the trackingId is not good for this. */
10
+ trackingItemId: string;
11
+ /** the race the actual race is grouped with for timing - from the races list */
12
+ timingRaceId: string;
13
+ /** tracking_codes.Id - the actual race Id from races list */
14
+ trackingCodeId: string;
15
+ raceId: string;
16
+ /** lane */
17
+ laneNo: number;
18
+ /** tracking_locations.id */
19
+ locationId: string;
20
+ /** 2(warning) */
21
+ severity: number;
22
+ /** number of penalties of this code / location */
23
+ qty: string;
24
+ unit: string;
25
+ /** if available, the name of person reporting the penalty */
26
+ reporter: string;
27
+ /** to delete an item, set this to 1, otherwise 0 */
28
+ isDeleted: number;
29
+ trackingComments: string;
30
+ /** regattaId(ie, 1302) */
31
+ trackingItemTimestamp: string;
32
+ RMRSID: string;
33
+ /** same as RMRSID */
34
+ intRID: number;
35
+ }
36
+ export interface RMDocumentPub {
37
+ /** key field of parent (tracking_items) record */
38
+ trackingId?: number;
39
+ /** The uuid of the parent tracking item */
40
+ trackingItemId: string;
41
+ /** The uuid of this document in blob storage */
42
+ docId: string;
43
+ /** The absolute URL for the document storage */
44
+ docURL: string;
45
+ /** The type of document. pdf, jpg, png, mp4, mov, doc, wav, txt, rtf, etc */
46
+ docType: string;
47
+ /** Brief description of document */
48
+ docDescription: string;
49
+ /** Name, role of document provider */
50
+ docSource: string;
51
+ /** Document Application Source. CrewTimer or RMMT */
52
+ docAppSource: number;
53
+ /** Document creation timestamp */
54
+ docTimestamp: string;
55
+ /** A filename looking string */
56
+ originalFileName: string;
57
+ /** 1=deleted, 0=not deleted */
58
+ isDeleted: number;
59
+ RMRSID: string;
60
+ }
61
+ export interface RMEvent {
62
+ EventID: string;
63
+ HeatID: string;
64
+ RMRSID: number;
65
+ flightId: string;
66
+ isDeleted: number;
67
+ lane: string;
68
+ raceId: string;
69
+ raceIdActual: string;
70
+ timerHandle: string;
71
+ timerLastUpdated: string;
72
+ }
73
+ export interface RMStation {
74
+ Id: string;
75
+ stationId: number;
76
+ stationName: string;
77
+ tracking_station_type: number;
78
+ displayOrder: number;
79
+ }
80
+ export interface RMStationQuery {
81
+ Id: string;
82
+ RMRSID: number;
83
+ stationId: number;
84
+ stationName: string;
85
+ userPW: string;
86
+ isDeleted: number;
87
+ intRID: number;
88
+ timingSystemId: number;
89
+ stationType: number;
90
+ intervalNo: number;
91
+ }
92
+ export interface RMTrackingStationQuery {
93
+ Id: string;
94
+ stationId: number;
95
+ stationName: string;
96
+ intRID: number;
97
+ isDeleted: number;
98
+ password: string;
99
+ RMRSID: number;
100
+ trackingStationType: number;
101
+ }
102
+ export interface RMLocation {
103
+ Id: string;
104
+ description: string;
105
+ locationCd: string;
106
+ tracking_station_type: number;
107
+ }
108
+ export interface RMTrackingLocationsQuery extends RMLocation {
109
+ intRID: string;
110
+ isDeleted: string;
111
+ RMRSID: number;
112
+ }
113
+ export interface RMTrackingCode {
114
+ Id?: string;
115
+ description: string;
116
+ trackingCd: string;
117
+ defaultQty: string;
118
+ defaultSeverity: number;
119
+ time?: string;
120
+ }
121
+ export interface RMTrackingCodesQuery extends RMTrackingCode {
122
+ defaultQty: string;
123
+ defaultSeverity: number;
124
+ intRID: number;
125
+ isDeleted: number;
126
+ RMRSID: number;
127
+ tracking_station_type: number;
128
+ unit: string;
129
+ }
130
+ export interface RMConfig {
131
+ lineups: Entry[];
132
+ waypoints: string[];
133
+ Stations: RMStation[];
134
+ RaceType: string;
135
+ CombinedRaces: KeyMap<string[]>;
136
+ FlightRaces?: string[][];
137
+ EventStarts: KeyMap<Entry[]>;
138
+ RMRSID: string;
139
+ }
140
+ export interface RMStationDetail extends RMStation {
141
+ locations: RMLocation[];
142
+ codes: RMTrackingCode[];
143
+ }
144
+ export interface RMConfigSummary {
145
+ PenaltyCodes: RMTrackingCode[];
146
+ PenaltyLocations: RMLocation[];
147
+ PenaltyStations: RMStation[];
148
+ RMRSID: string;
149
+ Stations: RMStationDetail[];
150
+ }
151
+ export interface RMFullConfig extends RMConfig {
152
+ penalties: string;
153
+ PenaltyLocations: string;
154
+ RMConfig: RMConfigSummary;
155
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=RMTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RMTypes.js","sourceRoot":"","sources":["../../../../src/types/RMTypes.ts"],"names":[],"mappings":""}
@@ -0,0 +1,69 @@
1
+ import { Event, EventList } from './Event';
2
+ import { KeyMap } from './KeyMap';
3
+ import { RegattaInfo } from './ServerTypes';
4
+ export interface EntryProgressItem {
5
+ c?: string;
6
+ e?: string;
7
+ s: string;
8
+ }
9
+ export interface Progress {
10
+ S: KeyMap<EntryProgressItem>;
11
+ Waypoints: string[];
12
+ }
13
+ export interface ResultRegattaInfo {
14
+ Admins: string;
15
+ ClearTS: number;
16
+ CombinedRaces: string;
17
+ CustomCodes: string;
18
+ DayList: string[];
19
+ DataSource: string;
20
+ Date: string;
21
+ Finished: boolean;
22
+ FlightRaces: string;
23
+ HasRoster: boolean;
24
+ InfoText: string;
25
+ Name: string;
26
+ NumDays: string;
27
+ NumEntries: number;
28
+ NumEvents: number;
29
+ Owner: string;
30
+ PenaltyLocations: string;
31
+ PointsEngine: string;
32
+ Public: boolean;
33
+ RaceType: string;
34
+ ResultDigits: string;
35
+ ResultOmitCols: string[];
36
+ ResultsPending: boolean;
37
+ ResultsPendOfficial: boolean;
38
+ ResultWaypoints: string;
39
+ RMPublishDisable: boolean;
40
+ Title: string;
41
+ Titles: KeyMap<string>;
42
+ Waypoints: string;
43
+ }
44
+ export interface Results {
45
+ lastUpdatedEvent: string;
46
+ P: Progress;
47
+ regattaInfo: ResultRegattaInfo;
48
+ ResultOmitCols?: string[];
49
+ results: Event[];
50
+ ResultsPendOfficial?: boolean;
51
+ }
52
+ export interface MobileSettings {
53
+ eventList: EventList;
54
+ info: RegattaInfo;
55
+ }
56
+ /**
57
+ * Data that comes from the cloud via /mobile/<regatta>
58
+ */
59
+ export interface MobileConfig {
60
+ P: Progress;
61
+ settings: MobileSettings;
62
+ }
63
+ export interface CrewTimerHttpResponse {
64
+ list: KeyMap[] | {
65
+ error: {
66
+ message: string;
67
+ };
68
+ };
69
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ResultTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResultTypes.js","sourceRoot":"","sources":["../../../../src/types/ResultTypes.ts"],"names":[],"mappings":""}
@@ -0,0 +1,143 @@
1
+ import { Entry } from './Entry';
2
+ import { KeyMap } from './KeyMap';
3
+ import { RMStation, RMConfigSummary } from './RMTypes';
4
+ export type RaceType = 'Sprint' | 'Head';
5
+ export type ConfigSource = 'Local' | 'CrewTimer.com';
6
+ export interface PenaltyInfo {
7
+ PenaltyCode: string;
8
+ PenaltyComment: string;
9
+ PenaltyLocation: string;
10
+ PenaltyLocationCode: string;
11
+ PenaltyQuantity: string;
12
+ PenaltyTime: string;
13
+ }
14
+ export type LapStatus = 'TxPend' | 'TxActive' | 'Fail' | 'OK';
15
+ export interface DocAttachment {
16
+ croppedImage: string;
17
+ description: string;
18
+ initialImage: string;
19
+ name: string;
20
+ State?: 'Deleted' | 'OK';
21
+ Status?: LapStatus;
22
+ uri: string;
23
+ uuid: string;
24
+ }
25
+ export interface Lap extends Entry {
26
+ Docs?: DocAttachment[];
27
+ Duplicate?: boolean;
28
+ index?: number;
29
+ keyid: string;
30
+ PenaltyCode?: string;
31
+ PenaltyComment?: string;
32
+ PenaltyLocation?: string;
33
+ PenaltyLocationCode?: string;
34
+ PenaltyQuantity?: string;
35
+ PenaltySeverity?: string;
36
+ PenaltyTime?: string;
37
+ Reporter?: string;
38
+ SequenceNum?: number;
39
+ State?: 'Deleted' | string;
40
+ stationType?: string;
41
+ Status?: LapStatus;
42
+ Time?: string;
43
+ Timestamp?: number;
44
+ uuid: string;
45
+ }
46
+ export interface TxLapItem {
47
+ data: Lap;
48
+ op: 'store-lap';
49
+ uuid: string;
50
+ }
51
+ export interface StopwatchConfig {
52
+ clockTime: string;
53
+ stopwatchTime: string;
54
+ useStopwatchTimes: boolean;
55
+ }
56
+ /** Public regatta settings */
57
+ export interface RegattaInfo {
58
+ ClearTS: number;
59
+ CombinedRaces?: string;
60
+ CsvTimestamp?: string;
61
+ CustomCodes?: string;
62
+ DataSource?: string;
63
+ Date: string;
64
+ DayList: string[];
65
+ Finished?: boolean;
66
+ FlightRaces?: string[][];
67
+ InfoText?: string;
68
+ NumDays: string;
69
+ PenaltyLocations?: string;
70
+ PointsEngine: string;
71
+ RMConfig: RMConfigSummary;
72
+ RMPublishDisable: boolean;
73
+ RaceType: RaceType;
74
+ ResultWaypoints: string;
75
+ ResultsPendOfficial?: boolean;
76
+ ResultsPending?: boolean;
77
+ Source: 'Local' | 'CrewTimer.com';
78
+ Stations: RMStation[];
79
+ Stopwatch?: StopwatchConfig;
80
+ Title: string;
81
+ Titles?: KeyMap<string>;
82
+ Waypoints: string;
83
+ }
84
+ /** Private regatta settings
85
+ * Stored as /regatta/<regatta>/settings/config
86
+ */
87
+ export interface RegattaConfig extends RegattaInfo {
88
+ DocUrl: string;
89
+ MobileKey: string;
90
+ MobilePins?: [{
91
+ pin: string;
92
+ stationType: string;
93
+ }];
94
+ }
95
+ export interface QRCodeInfo {
96
+ mobilePin: string;
97
+ name: string;
98
+ props: string;
99
+ url: string;
100
+ uuid: string;
101
+ }
102
+ export interface TimeSystem {
103
+ [waypoint: string]: string;
104
+ }
105
+ export interface TimeSystems {
106
+ events: KeyMap<TimeSystem>;
107
+ system: TimeSystem;
108
+ }
109
+ export interface ReloadResult {
110
+ date: string;
111
+ status: string;
112
+ }
113
+ export interface ResultSummary {
114
+ Date: string;
115
+ InfoText: string;
116
+ Name: string;
117
+ NumDays: string;
118
+ Public: string;
119
+ Title: string;
120
+ }
121
+ export interface AdminSummary extends ResultSummary {
122
+ NumEntries: number;
123
+ Owner: string;
124
+ RaceType: string;
125
+ }
126
+ export interface DBSettings {
127
+ config: RegattaConfig;
128
+ entries: string;
129
+ timeSystems?: TimeSystems;
130
+ qrcodes?: KeyMap<QRCodeInfo>;
131
+ }
132
+ /** This represents data stored as /regatta/<mobileID>/ */
133
+ export interface DBRegatta {
134
+ lapdata: Lap[];
135
+ lapdataTS?: number;
136
+ settings: DBSettings;
137
+ }
138
+ /** Base regatta data plus some cooked fields used when calculating results */
139
+ export interface RegattaData extends DBRegatta {
140
+ /** List of events for mobile results calculations. */
141
+ eventList?: KeyMap[];
142
+ timeSystems?: TimeSystems;
143
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ServerTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServerTypes.js","sourceRoot":"","sources":["../../../../src/types/ServerTypes.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export * from './types/CrewTimerTypes';
@@ -0,0 +1,2 @@
1
+ export * from './types/CrewTimerTypes';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './Entry';
2
+ export * from './Event';
3
+ export * from './KeyMap';
4
+ export * from './ResultTypes';
5
+ export * from './RMTypes';
6
+ export * from './ServerTypes';
@@ -0,0 +1,7 @@
1
+ export * from './Entry';
2
+ export * from './Event';
3
+ export * from './KeyMap';
4
+ export * from './ResultTypes';
5
+ export * from './RMTypes';
6
+ export * from './ServerTypes';
7
+ //# sourceMappingURL=CrewTimerTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CrewTimerTypes.js","sourceRoot":"","sources":["../../../../src/types/CrewTimerTypes.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,17 @@
1
+ import KeyMap from './KeyMap';
2
+ export interface Entry extends KeyMap {
3
+ AdjTime?: string;
4
+ Bow: string;
5
+ Crew: string;
6
+ CrewAbbrev: string;
7
+ Event: string;
8
+ EventAbbrev: string;
9
+ EventNum: string;
10
+ Gate?: string;
11
+ Place?: string;
12
+ State?: string;
13
+ Stroke?: string;
14
+ Time?: string;
15
+ Timestamp?: number;
16
+ uuid?: string;
17
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Entry.js","sourceRoot":"","sources":["../../../../src/types/Entry.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { Entry } from './Entry';
2
+ export interface Event {
3
+ Day?: string;
4
+ DispOrder: number[];
5
+ entries?: Entry[];
6
+ Event: string;
7
+ eventIndex: number;
8
+ EventInfo?: string;
9
+ eventItems: Entry[];
10
+ eventKey?: string;
11
+ EventNum: string;
12
+ Finished?: boolean;
13
+ Official?: boolean;
14
+ RaceType: 'Head' | 'Sprint';
15
+ Start?: string;
16
+ }
17
+ export type EventList = Event[];
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Event.js","sourceRoot":"","sources":["../../../../src/types/Event.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export interface KeyMap<T = any> {
2
+ [key: string]: T;
3
+ }
4
+ export default KeyMap;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=KeyMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyMap.js","sourceRoot":"","sources":["../../../../src/types/KeyMap.ts"],"names":[],"mappings":""}
@@ -0,0 +1,155 @@
1
+ import { Entry } from './Entry';
2
+ import { KeyMap } from './KeyMap';
3
+ /** Define the publication posted to tracking_items */
4
+ export interface PenaltyPub {
5
+ /** this is an identity column like the Id in times, so handle the same way(0 or null) */
6
+ trackingId: number | undefined;
7
+ /** tracking_stations.Id – the station the device is assigned to */
8
+ trackingStationId: string;
9
+ /** uuid that is used to update the record if needed, as the trackingId is not good for this. */
10
+ trackingItemId: string;
11
+ /** the race the actual race is grouped with for timing - from the races list */
12
+ timingRaceId: string;
13
+ /** tracking_codes.Id - the actual race Id from races list */
14
+ trackingCodeId: string;
15
+ raceId: string;
16
+ /** lane */
17
+ laneNo: number;
18
+ /** tracking_locations.id */
19
+ locationId: string;
20
+ /** 2(warning) */
21
+ severity: number;
22
+ /** number of penalties of this code / location */
23
+ qty: string;
24
+ unit: string;
25
+ /** if available, the name of person reporting the penalty */
26
+ reporter: string;
27
+ /** to delete an item, set this to 1, otherwise 0 */
28
+ isDeleted: number;
29
+ trackingComments: string;
30
+ /** regattaId(ie, 1302) */
31
+ trackingItemTimestamp: string;
32
+ RMRSID: string;
33
+ /** same as RMRSID */
34
+ intRID: number;
35
+ }
36
+ export interface RMDocumentPub {
37
+ /** key field of parent (tracking_items) record */
38
+ trackingId?: number;
39
+ /** The uuid of the parent tracking item */
40
+ trackingItemId: string;
41
+ /** The uuid of this document in blob storage */
42
+ docId: string;
43
+ /** The absolute URL for the document storage */
44
+ docURL: string;
45
+ /** The type of document. pdf, jpg, png, mp4, mov, doc, wav, txt, rtf, etc */
46
+ docType: string;
47
+ /** Brief description of document */
48
+ docDescription: string;
49
+ /** Name, role of document provider */
50
+ docSource: string;
51
+ /** Document Application Source. CrewTimer or RMMT */
52
+ docAppSource: number;
53
+ /** Document creation timestamp */
54
+ docTimestamp: string;
55
+ /** A filename looking string */
56
+ originalFileName: string;
57
+ /** 1=deleted, 0=not deleted */
58
+ isDeleted: number;
59
+ RMRSID: string;
60
+ }
61
+ export interface RMEvent {
62
+ EventID: string;
63
+ HeatID: string;
64
+ RMRSID: number;
65
+ flightId: string;
66
+ isDeleted: number;
67
+ lane: string;
68
+ raceId: string;
69
+ raceIdActual: string;
70
+ timerHandle: string;
71
+ timerLastUpdated: string;
72
+ }
73
+ export interface RMStation {
74
+ Id: string;
75
+ stationId: number;
76
+ stationName: string;
77
+ tracking_station_type: number;
78
+ displayOrder: number;
79
+ }
80
+ export interface RMStationQuery {
81
+ Id: string;
82
+ RMRSID: number;
83
+ stationId: number;
84
+ stationName: string;
85
+ userPW: string;
86
+ isDeleted: number;
87
+ intRID: number;
88
+ timingSystemId: number;
89
+ stationType: number;
90
+ intervalNo: number;
91
+ }
92
+ export interface RMTrackingStationQuery {
93
+ Id: string;
94
+ stationId: number;
95
+ stationName: string;
96
+ intRID: number;
97
+ isDeleted: number;
98
+ password: string;
99
+ RMRSID: number;
100
+ trackingStationType: number;
101
+ }
102
+ export interface RMLocation {
103
+ Id: string;
104
+ description: string;
105
+ locationCd: string;
106
+ tracking_station_type: number;
107
+ }
108
+ export interface RMTrackingLocationsQuery extends RMLocation {
109
+ intRID: string;
110
+ isDeleted: string;
111
+ RMRSID: number;
112
+ }
113
+ export interface RMTrackingCode {
114
+ Id?: string;
115
+ description: string;
116
+ trackingCd: string;
117
+ defaultQty: string;
118
+ defaultSeverity: number;
119
+ time?: string;
120
+ }
121
+ export interface RMTrackingCodesQuery extends RMTrackingCode {
122
+ defaultQty: string;
123
+ defaultSeverity: number;
124
+ intRID: number;
125
+ isDeleted: number;
126
+ RMRSID: number;
127
+ tracking_station_type: number;
128
+ unit: string;
129
+ }
130
+ export interface RMConfig {
131
+ lineups: Entry[];
132
+ waypoints: string[];
133
+ Stations: RMStation[];
134
+ RaceType: string;
135
+ CombinedRaces: KeyMap<string[]>;
136
+ FlightRaces?: string[][];
137
+ EventStarts: KeyMap<Entry[]>;
138
+ RMRSID: string;
139
+ }
140
+ export interface RMStationDetail extends RMStation {
141
+ locations: RMLocation[];
142
+ codes: RMTrackingCode[];
143
+ }
144
+ export interface RMConfigSummary {
145
+ PenaltyCodes: RMTrackingCode[];
146
+ PenaltyLocations: RMLocation[];
147
+ PenaltyStations: RMStation[];
148
+ RMRSID: string;
149
+ Stations: RMStationDetail[];
150
+ }
151
+ export interface RMFullConfig extends RMConfig {
152
+ penalties: string;
153
+ PenaltyLocations: string;
154
+ RMConfig: RMConfigSummary;
155
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RMTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RMTypes.js","sourceRoot":"","sources":["../../../../src/types/RMTypes.ts"],"names":[],"mappings":""}
@@ -0,0 +1,69 @@
1
+ import { Event, EventList } from './Event';
2
+ import { KeyMap } from './KeyMap';
3
+ import { RegattaInfo } from './ServerTypes';
4
+ export interface EntryProgressItem {
5
+ c?: string;
6
+ e?: string;
7
+ s: string;
8
+ }
9
+ export interface Progress {
10
+ S: KeyMap<EntryProgressItem>;
11
+ Waypoints: string[];
12
+ }
13
+ export interface ResultRegattaInfo {
14
+ Admins: string;
15
+ ClearTS: number;
16
+ CombinedRaces: string;
17
+ CustomCodes: string;
18
+ DayList: string[];
19
+ DataSource: string;
20
+ Date: string;
21
+ Finished: boolean;
22
+ FlightRaces: string;
23
+ HasRoster: boolean;
24
+ InfoText: string;
25
+ Name: string;
26
+ NumDays: string;
27
+ NumEntries: number;
28
+ NumEvents: number;
29
+ Owner: string;
30
+ PenaltyLocations: string;
31
+ PointsEngine: string;
32
+ Public: boolean;
33
+ RaceType: string;
34
+ ResultDigits: string;
35
+ ResultOmitCols: string[];
36
+ ResultsPending: boolean;
37
+ ResultsPendOfficial: boolean;
38
+ ResultWaypoints: string;
39
+ RMPublishDisable: boolean;
40
+ Title: string;
41
+ Titles: KeyMap<string>;
42
+ Waypoints: string;
43
+ }
44
+ export interface Results {
45
+ lastUpdatedEvent: string;
46
+ P: Progress;
47
+ regattaInfo: ResultRegattaInfo;
48
+ ResultOmitCols?: string[];
49
+ results: Event[];
50
+ ResultsPendOfficial?: boolean;
51
+ }
52
+ export interface MobileSettings {
53
+ eventList: EventList;
54
+ info: RegattaInfo;
55
+ }
56
+ /**
57
+ * Data that comes from the cloud via /mobile/<regatta>
58
+ */
59
+ export interface MobileConfig {
60
+ P: Progress;
61
+ settings: MobileSettings;
62
+ }
63
+ export interface CrewTimerHttpResponse {
64
+ list: KeyMap[] | {
65
+ error: {
66
+ message: string;
67
+ };
68
+ };
69
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ResultTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResultTypes.js","sourceRoot":"","sources":["../../../../src/types/ResultTypes.ts"],"names":[],"mappings":""}
@@ -0,0 +1,143 @@
1
+ import { Entry } from './Entry';
2
+ import { KeyMap } from './KeyMap';
3
+ import { RMStation, RMConfigSummary } from './RMTypes';
4
+ export type RaceType = 'Sprint' | 'Head';
5
+ export type ConfigSource = 'Local' | 'CrewTimer.com';
6
+ export interface PenaltyInfo {
7
+ PenaltyCode: string;
8
+ PenaltyComment: string;
9
+ PenaltyLocation: string;
10
+ PenaltyLocationCode: string;
11
+ PenaltyQuantity: string;
12
+ PenaltyTime: string;
13
+ }
14
+ export type LapStatus = 'TxPend' | 'TxActive' | 'Fail' | 'OK';
15
+ export interface DocAttachment {
16
+ croppedImage: string;
17
+ description: string;
18
+ initialImage: string;
19
+ name: string;
20
+ State?: 'Deleted' | 'OK';
21
+ Status?: LapStatus;
22
+ uri: string;
23
+ uuid: string;
24
+ }
25
+ export interface Lap extends Entry {
26
+ Docs?: DocAttachment[];
27
+ Duplicate?: boolean;
28
+ index?: number;
29
+ keyid: string;
30
+ PenaltyCode?: string;
31
+ PenaltyComment?: string;
32
+ PenaltyLocation?: string;
33
+ PenaltyLocationCode?: string;
34
+ PenaltyQuantity?: string;
35
+ PenaltySeverity?: string;
36
+ PenaltyTime?: string;
37
+ Reporter?: string;
38
+ SequenceNum?: number;
39
+ State?: 'Deleted' | string;
40
+ stationType?: string;
41
+ Status?: LapStatus;
42
+ Time?: string;
43
+ Timestamp?: number;
44
+ uuid: string;
45
+ }
46
+ export interface TxLapItem {
47
+ data: Lap;
48
+ op: 'store-lap';
49
+ uuid: string;
50
+ }
51
+ export interface StopwatchConfig {
52
+ clockTime: string;
53
+ stopwatchTime: string;
54
+ useStopwatchTimes: boolean;
55
+ }
56
+ /** Public regatta settings */
57
+ export interface RegattaInfo {
58
+ ClearTS: number;
59
+ CombinedRaces?: string;
60
+ CsvTimestamp?: string;
61
+ CustomCodes?: string;
62
+ DataSource?: string;
63
+ Date: string;
64
+ DayList: string[];
65
+ Finished?: boolean;
66
+ FlightRaces?: string[][];
67
+ InfoText?: string;
68
+ NumDays: string;
69
+ PenaltyLocations?: string;
70
+ PointsEngine: string;
71
+ RMConfig: RMConfigSummary;
72
+ RMPublishDisable: boolean;
73
+ RaceType: RaceType;
74
+ ResultWaypoints: string;
75
+ ResultsPendOfficial?: boolean;
76
+ ResultsPending?: boolean;
77
+ Source: 'Local' | 'CrewTimer.com';
78
+ Stations: RMStation[];
79
+ Stopwatch?: StopwatchConfig;
80
+ Title: string;
81
+ Titles?: KeyMap<string>;
82
+ Waypoints: string;
83
+ }
84
+ /** Private regatta settings
85
+ * Stored as /regatta/<regatta>/settings/config
86
+ */
87
+ export interface RegattaConfig extends RegattaInfo {
88
+ DocUrl: string;
89
+ MobileKey: string;
90
+ MobilePins?: [{
91
+ pin: string;
92
+ stationType: string;
93
+ }];
94
+ }
95
+ export interface QRCodeInfo {
96
+ mobilePin: string;
97
+ name: string;
98
+ props: string;
99
+ url: string;
100
+ uuid: string;
101
+ }
102
+ export interface TimeSystem {
103
+ [waypoint: string]: string;
104
+ }
105
+ export interface TimeSystems {
106
+ events: KeyMap<TimeSystem>;
107
+ system: TimeSystem;
108
+ }
109
+ export interface ReloadResult {
110
+ date: string;
111
+ status: string;
112
+ }
113
+ export interface ResultSummary {
114
+ Date: string;
115
+ InfoText: string;
116
+ Name: string;
117
+ NumDays: string;
118
+ Public: string;
119
+ Title: string;
120
+ }
121
+ export interface AdminSummary extends ResultSummary {
122
+ NumEntries: number;
123
+ Owner: string;
124
+ RaceType: string;
125
+ }
126
+ export interface DBSettings {
127
+ config: RegattaConfig;
128
+ entries: string;
129
+ timeSystems?: TimeSystems;
130
+ qrcodes?: KeyMap<QRCodeInfo>;
131
+ }
132
+ /** This represents data stored as /regatta/<mobileID>/ */
133
+ export interface DBRegatta {
134
+ lapdata: Lap[];
135
+ lapdataTS?: number;
136
+ settings: DBSettings;
137
+ }
138
+ /** Base regatta data plus some cooked fields used when calculating results */
139
+ export interface RegattaData extends DBRegatta {
140
+ /** List of events for mobile results calculations. */
141
+ eventList?: KeyMap[];
142
+ timeSystems?: TimeSystems;
143
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ServerTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServerTypes.js","sourceRoot":"","sources":["../../../../src/types/ServerTypes.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "crewtimer-common",
3
+ "version": "1.0.2-beta.2",
4
+ "description": "Common types and utilities for CrewTimer",
5
+ "main": "./dist/cjs/src/index.js",
6
+ "module": "./dist/esm/src/index.js",
7
+ "types": "./dist/esm/src/index.d.ts",
8
+ "scripts": {
9
+ "build": "rm -rf dist && yarn build:esm && yarn build:cjs",
10
+ "build:esm": "tsc",
11
+ "build:cjs": "tsc --module commonjs --outDir dist/cjs",
12
+ "lint": "eslint \"{**/*,*}.{js,ts,jsx,tsx}\"",
13
+ "prettier": "prettier --write \"{src,tests,example/src}/**/*.{js,ts,jsx,tsx}\"",
14
+ "test": "jest --config jestconfig.json",
15
+ "prepare": "npm run build",
16
+ "prepublishOnly": "npm test && npm run prettier && npm run lint",
17
+ "start": "parcel src/example/index.html",
18
+ "publish": "npm publish"
19
+ },
20
+ "keywords": [
21
+ "crewtimer"
22
+ ],
23
+ "author": "Glenn Engel (glenne)",
24
+ "license": "MIT",
25
+ "devDependencies": {
26
+ "@emotion/react": "^11.10.6",
27
+ "@emotion/styled": "^11.10.6",
28
+ "@mui/lab": "^5.0.0-alpha.124",
29
+ "@mui/material": "^5.11.13",
30
+ "@mui/styles": "^5.11.13",
31
+ "@testing-library/react": "^14.0.0",
32
+ "@types/jest": "^29.5.0",
33
+ "@types/react": "^18.0.28",
34
+ "@typescript-eslint/eslint-plugin": "^5.55.0",
35
+ "@typescript-eslint/parser": "^5.55.0",
36
+ "eslint": "^8.36.0",
37
+ "eslint-config-prettier": "^8.7.0",
38
+ "eslint-plugin-react": "^7.32.2",
39
+ "eslint-plugin-react-hooks": "^4.6.0",
40
+ "jest": "^29.5.0",
41
+ "jest-canvas-mock": "^2.4.0",
42
+ "jest-environment-jsdom": "^29.5.0",
43
+ "parcel": "^2.8.3",
44
+ "prettier": "^2.8.4",
45
+ "process": "^0.11.10",
46
+ "react": "^18.2.0",
47
+ "react-dom": "^18.2.0",
48
+ "ts-jest": "^29.0.5",
49
+ "tslib": "^2.5.0",
50
+ "typescript": "^5.0.2"
51
+ },
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "git+https://github.com/crewtimer/crewtimer-common.git"
55
+ },
56
+ "files": [
57
+ "dist",
58
+ "LICENSE",
59
+ "README.md"
60
+ ],
61
+ "dependencies": {}
62
+ }