@everyonesoftware/common 2.0.0 → 3.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.
Files changed (59) hide show
  1. package/.github/workflows/publish.yml +54 -36
  2. package/package.json +6 -2
  3. package/sources/asyncIterator.ts +436 -436
  4. package/sources/asyncIteratorToJavascriptAsyncIteratorAdapter.ts +47 -47
  5. package/sources/asyncResult.ts +95 -95
  6. package/sources/byteList.ts +201 -201
  7. package/sources/byteListStream.ts +120 -120
  8. package/sources/byteReadStream.ts +23 -23
  9. package/sources/byteWriteStream.ts +15 -15
  10. package/sources/characterList.ts +194 -194
  11. package/sources/characterListStream.ts +150 -150
  12. package/sources/characterReadStream.ts +80 -80
  13. package/sources/characterReadStreamIterator.ts +127 -127
  14. package/sources/concatenateIterable.ts +118 -118
  15. package/sources/concatenateIterator.ts +164 -164
  16. package/sources/currentProcess.ts +157 -157
  17. package/sources/dateTime.ts +129 -129
  18. package/sources/depthFirstSearch.ts +229 -229
  19. package/sources/flatMapIterable.ts +103 -103
  20. package/sources/flatMapIterator.ts +151 -151
  21. package/sources/generator.ts +250 -250
  22. package/sources/index.ts +1 -1
  23. package/sources/iterator.ts +480 -480
  24. package/sources/javascriptAsyncIteratorToAsyncIteratorAdapter.ts +123 -123
  25. package/sources/javascriptSetSet.ts +133 -133
  26. package/sources/listQueue.ts +61 -61
  27. package/sources/listStack.ts +61 -61
  28. package/sources/luxonDateTime.ts +108 -108
  29. package/sources/mapAsyncIterator.ts +140 -140
  30. package/sources/mutableMap.ts +291 -291
  31. package/sources/node.ts +36 -36
  32. package/sources/promiseAsyncResult.ts +173 -173
  33. package/sources/queue.ts +48 -48
  34. package/sources/recreationDotGovClient.ts +258 -258
  35. package/sources/searchControl.ts +41 -41
  36. package/sources/set.ts +243 -243
  37. package/sources/skipAsyncIterator.ts +144 -144
  38. package/sources/stack.ts +47 -47
  39. package/sources/syncResult.ts +299 -299
  40. package/sources/takeAsyncIterator.ts +140 -140
  41. package/sources/whereAsyncIterator.ts +142 -142
  42. package/sources/wonderlandTrailClient.ts +1502 -1502
  43. package/tests/assertTestTests.ts +74 -74
  44. package/tests/byteListStreamTests.ts +389 -389
  45. package/tests/byteListTests.ts +26 -26
  46. package/tests/characterListStreamTests.ts +390 -390
  47. package/tests/characterListTests.ts +249 -249
  48. package/tests/dateTimeTests.ts +29 -29
  49. package/tests/depthFirstSearchTests.ts +105 -105
  50. package/tests/generatorTests.ts +85 -85
  51. package/tests/mutableMapTests.ts +153 -153
  52. package/tests/promiseAsyncResultTests.ts +687 -687
  53. package/tests/queueTests.ts +28 -28
  54. package/tests/recreationDotGovClientTests.ts +190 -190
  55. package/tests/setTests.ts +139 -139
  56. package/tests/stackTests.ts +65 -65
  57. package/tests/syncResultTests.ts +1250 -1250
  58. package/tests/wonderlandTrailClientTests.ts +451 -451
  59. package/tsup.config.ts +12 -12
@@ -1,259 +1,259 @@
1
- import { PromiseAsyncResult } from "./promiseAsyncResult";
2
- import { DateTime } from "./dateTime";
3
- import { HttpClient } from "./httpClient";
4
- import { HttpIncomingResponse } from "./httpIncomingResponse";
5
- import { HttpOutgoingRequest } from "./httpOutgoingRequest";
6
- import { Iterable } from "./iterable";
7
- import { List } from "./list";
8
- import { PreCondition } from "./preCondition";
9
- import { AsyncResult } from "./asyncResult";
10
-
11
- export interface RecreationDotGovDivisionDayAvailability
12
- {
13
- readonly date: DateTime;
14
-
15
- readonly walkup: boolean;
16
-
17
- readonly reservationsRemaining: number;
18
-
19
- readonly totalSpots: number;
20
- }
21
-
22
- export interface RecreationDotGovDivisionAvailabilityJson
23
- {
24
- readonly bools: { [date: string]: boolean };
25
-
26
- readonly rules: {
27
- readonly name: string;
28
- readonly value: number;
29
- }[];
30
-
31
- readonly quota_type_maps: {
32
- readonly ConstantQuotaUsageDaily?: {
33
- [date: string]: {
34
- readonly is_hidden: boolean;
35
- readonly remaining: number;
36
- readonly season_type: string;
37
- readonly show_walkup: boolean;
38
- readonly total: number;
39
- };
40
- };
41
- readonly QuotaUsageByMemberDaily?: {
42
- [date: string]: {
43
- readonly is_hidden: boolean;
44
- readonly remaining: number;
45
- readonly season_type: string;
46
- readonly show_walkup: boolean;
47
- readonly total: number;
48
- };
49
- };
50
- };
51
- }
52
-
53
- export class RecreationDotGovDivisionAvailability
54
- {
55
- public readonly json: RecreationDotGovDivisionAvailabilityJson;
56
-
57
- public readonly minimumGroupSize?: number;
58
- public readonly maximumGroupSize?: number;
59
- public readonly dayAvailabilities: Iterable<RecreationDotGovDivisionDayAvailability>;
60
-
61
- private constructor(json: RecreationDotGovDivisionAvailabilityJson)
62
- {
63
- PreCondition.assertNotUndefinedAndNotNull(json, "json");
64
-
65
- this.json = json;
66
-
67
- const minGroupSize: string = "MinGroupSize".toLowerCase();
68
- const maxGroupSize: string = "MaxGroupSize".toLowerCase();
69
- for (const rule of json.rules)
70
- {
71
- switch (rule.name.toLowerCase())
72
- {
73
- case minGroupSize:
74
- this.minimumGroupSize = rule.value;
75
- break;
76
-
77
- case maxGroupSize:
78
- this.maximumGroupSize = rule.value;
79
- break;
80
- }
81
- }
82
-
83
- const dayAvailabilities = List.create<RecreationDotGovDivisionDayAvailability>();
84
- const quotaUsageByMemberDaily = json.quota_type_maps?.QuotaUsageByMemberDaily;
85
- if (quotaUsageByMemberDaily)
86
- {
87
- for (const quotaUsage of Object.entries(quotaUsageByMemberDaily))
88
- {
89
- const dateString: string = quotaUsage[0];
90
-
91
- const usageData = quotaUsage[1];
92
-
93
- let walkup: boolean = false;
94
- let reservationsRemaining: number = 0;
95
- const boolsEntry: boolean = json.bools[dateString];
96
- if (boolsEntry)
97
- {
98
- walkup = usageData.show_walkup;
99
- reservationsRemaining = usageData.remaining;
100
- }
101
-
102
- dayAvailabilities.add({
103
- date: DateTime.parse(dateString),
104
- totalSpots: usageData.total,
105
- walkup,
106
- reservationsRemaining,
107
- });
108
- }
109
- }
110
- this.dayAvailabilities = dayAvailabilities;
111
- }
112
-
113
- public static create(json: RecreationDotGovDivisionAvailabilityJson): RecreationDotGovDivisionAvailability
114
- {
115
- return new RecreationDotGovDivisionAvailability(json);
116
- }
117
- }
118
-
119
- interface RecreationDotGovPayloadResponse<T>
120
- {
121
- readonly payload: T;
122
- }
123
-
124
- export interface RecreationDotGovDivisionJson
125
- {
126
- readonly id: string;
127
-
128
- readonly name: string;
129
-
130
- readonly type: string;
131
-
132
- readonly district: string;
133
- }
134
-
135
- export interface RecreationDotGovPermitItineraryJson
136
- {
137
- readonly id: string;
138
-
139
- readonly name: string;
140
-
141
- readonly divisions: { [divisionId: number]: RecreationDotGovDivisionJson };
142
- }
143
-
144
- export class RecreationDotGovError extends Error
145
- {
146
- public constructor(message: string)
147
- {
148
- super(message);
149
- }
150
- }
151
-
152
- export interface RecreationDotGovErrorResponse
153
- {
154
- readonly error: string;
155
- }
156
-
157
- export class RecreationDotGovClient implements HttpClient
158
- {
159
- private readonly httpClient: HttpClient;
160
-
161
- private constructor(httpClient: HttpClient)
162
- {
163
- PreCondition.assertNotUndefinedAndNotNull(httpClient, "httpClient");
164
-
165
- this.httpClient = httpClient;
166
- }
167
-
168
- public static create(httpClient: HttpClient): RecreationDotGovClient
169
- {
170
- return new RecreationDotGovClient(httpClient);
171
- }
172
-
173
- public sendRequest(request: HttpOutgoingRequest): AsyncResult<HttpIncomingResponse>
174
- {
175
- return this.httpClient.sendRequest(request);
176
- }
177
-
178
- public sendGetRequest(url: string): AsyncResult<HttpIncomingResponse>
179
- {
180
- return HttpClient.sendGetRequest(this, url);
181
- }
182
-
183
- public getPermitItinerary(permitItineraryId: string): PromiseAsyncResult<RecreationDotGovPermitItineraryJson>
184
- {
185
- PreCondition.assertNotEmpty(permitItineraryId, "permitItineraryId");
186
-
187
- return PromiseAsyncResult.create(async () =>
188
- {
189
- const response: HttpIncomingResponse = await this.sendGetRequest(`https://www.recreation.gov/api/permitcontent/${permitItineraryId}`);
190
-
191
- const responseBody: string = await response.getBody();
192
-
193
- const statusCode: number = response.getStatusCode();
194
- if (statusCode < 200 || 300 <= statusCode)
195
- {
196
- const responseBodyJson: RecreationDotGovErrorResponse = JSON.parse(responseBody);
197
- const errorMessage: string = responseBodyJson.error;
198
- switch (errorMessage.toLowerCase())
199
- {
200
- case "permit not found":
201
- throw new RecreationDotGovError(`No permit itinerary found for id: ${JSON.stringify(permitItineraryId)}`);
202
-
203
- default:
204
- throw new RecreationDotGovError(`Unrecognized error: ${JSON.stringify(errorMessage)}`);
205
- }
206
- }
207
-
208
- const responseBodyJson: RecreationDotGovPayloadResponse<RecreationDotGovPermitItineraryJson> = JSON.parse(responseBody);
209
- return responseBodyJson.payload;
210
- });
211
- }
212
-
213
- public getDivisionAvailability(permitItineraryId: string, divisionId: string, month: number, year: number, earlyAccessPermitLotteryId?: string): PromiseAsyncResult<RecreationDotGovDivisionAvailability>
214
- {
215
- PreCondition.assertNotEmpty(permitItineraryId, "permitItineraryId");
216
- PreCondition.assertNotEmpty(divisionId, "divisionId");
217
- PreCondition.assertBetween(1, month, 12, "month");
218
-
219
- return PromiseAsyncResult.create(async () =>
220
- {
221
- const url: string = earlyAccessPermitLotteryId
222
- ? `https://www.recreation.gov/api/permititinerary/${permitItineraryId}/division/${divisionId}/eapavailability/month/${earlyAccessPermitLotteryId}?month=${month}&year=${year}`
223
- : `https://www.recreation.gov/api/permititinerary/${permitItineraryId}/division/${divisionId}/availability/month?month=${month}&year=${year}`
224
- const response: HttpIncomingResponse = await this.sendGetRequest(url);
225
-
226
- let responseBody: string = await response.getBody();
227
-
228
- const statusCode: number = response.getStatusCode();
229
- if (statusCode < 200 || 300 <= statusCode)
230
- {
231
- const responseBodyJson: RecreationDotGovErrorResponse = JSON.parse(responseBody) as RecreationDotGovErrorResponse;
232
- const errorMessage: string = responseBodyJson.error;
233
- switch (errorMessage.toLowerCase())
234
- {
235
- case "invalid permit id":
236
- throw new RecreationDotGovError(`No permit itinerary found for id: ${JSON.stringify(permitItineraryId)}`);
237
-
238
- case "request year is missing or invalid":
239
- // Ignore this error and just return an empty availability.
240
- const emptyResponseBody: RecreationDotGovPayloadResponse<RecreationDotGovDivisionAvailabilityJson> = {
241
- payload: {
242
- bools: {},
243
- rules: [],
244
- quota_type_maps: {},
245
- },
246
- };
247
- responseBody = JSON.stringify(emptyResponseBody);
248
- break;
249
-
250
- default:
251
- throw new RecreationDotGovError(`Unrecognized error: ${JSON.stringify(errorMessage)}`);
252
- }
253
- }
254
-
255
- const responseBodyJson: RecreationDotGovPayloadResponse<RecreationDotGovDivisionAvailabilityJson> = JSON.parse(responseBody);
256
- return RecreationDotGovDivisionAvailability.create(responseBodyJson.payload);
257
- });
258
- }
1
+ import { PromiseAsyncResult } from "./promiseAsyncResult";
2
+ import { DateTime } from "./dateTime";
3
+ import { HttpClient } from "./httpClient";
4
+ import { HttpIncomingResponse } from "./httpIncomingResponse";
5
+ import { HttpOutgoingRequest } from "./httpOutgoingRequest";
6
+ import { Iterable } from "./iterable";
7
+ import { List } from "./list";
8
+ import { PreCondition } from "./preCondition";
9
+ import { AsyncResult } from "./asyncResult";
10
+
11
+ export interface RecreationDotGovDivisionDayAvailability
12
+ {
13
+ readonly date: DateTime;
14
+
15
+ readonly walkup: boolean;
16
+
17
+ readonly reservationsRemaining: number;
18
+
19
+ readonly totalSpots: number;
20
+ }
21
+
22
+ export interface RecreationDotGovDivisionAvailabilityJson
23
+ {
24
+ readonly bools: { [date: string]: boolean };
25
+
26
+ readonly rules: {
27
+ readonly name: string;
28
+ readonly value: number;
29
+ }[];
30
+
31
+ readonly quota_type_maps: {
32
+ readonly ConstantQuotaUsageDaily?: {
33
+ [date: string]: {
34
+ readonly is_hidden: boolean;
35
+ readonly remaining: number;
36
+ readonly season_type: string;
37
+ readonly show_walkup: boolean;
38
+ readonly total: number;
39
+ };
40
+ };
41
+ readonly QuotaUsageByMemberDaily?: {
42
+ [date: string]: {
43
+ readonly is_hidden: boolean;
44
+ readonly remaining: number;
45
+ readonly season_type: string;
46
+ readonly show_walkup: boolean;
47
+ readonly total: number;
48
+ };
49
+ };
50
+ };
51
+ }
52
+
53
+ export class RecreationDotGovDivisionAvailability
54
+ {
55
+ public readonly json: RecreationDotGovDivisionAvailabilityJson;
56
+
57
+ public readonly minimumGroupSize?: number;
58
+ public readonly maximumGroupSize?: number;
59
+ public readonly dayAvailabilities: Iterable<RecreationDotGovDivisionDayAvailability>;
60
+
61
+ private constructor(json: RecreationDotGovDivisionAvailabilityJson)
62
+ {
63
+ PreCondition.assertNotUndefinedAndNotNull(json, "json");
64
+
65
+ this.json = json;
66
+
67
+ const minGroupSize: string = "MinGroupSize".toLowerCase();
68
+ const maxGroupSize: string = "MaxGroupSize".toLowerCase();
69
+ for (const rule of json.rules)
70
+ {
71
+ switch (rule.name.toLowerCase())
72
+ {
73
+ case minGroupSize:
74
+ this.minimumGroupSize = rule.value;
75
+ break;
76
+
77
+ case maxGroupSize:
78
+ this.maximumGroupSize = rule.value;
79
+ break;
80
+ }
81
+ }
82
+
83
+ const dayAvailabilities = List.create<RecreationDotGovDivisionDayAvailability>();
84
+ const quotaUsageByMemberDaily = json.quota_type_maps?.QuotaUsageByMemberDaily;
85
+ if (quotaUsageByMemberDaily)
86
+ {
87
+ for (const quotaUsage of Object.entries(quotaUsageByMemberDaily))
88
+ {
89
+ const dateString: string = quotaUsage[0];
90
+
91
+ const usageData = quotaUsage[1];
92
+
93
+ let walkup: boolean = false;
94
+ let reservationsRemaining: number = 0;
95
+ const boolsEntry: boolean = json.bools[dateString];
96
+ if (boolsEntry)
97
+ {
98
+ walkup = usageData.show_walkup;
99
+ reservationsRemaining = usageData.remaining;
100
+ }
101
+
102
+ dayAvailabilities.add({
103
+ date: DateTime.parse(dateString),
104
+ totalSpots: usageData.total,
105
+ walkup,
106
+ reservationsRemaining,
107
+ });
108
+ }
109
+ }
110
+ this.dayAvailabilities = dayAvailabilities;
111
+ }
112
+
113
+ public static create(json: RecreationDotGovDivisionAvailabilityJson): RecreationDotGovDivisionAvailability
114
+ {
115
+ return new RecreationDotGovDivisionAvailability(json);
116
+ }
117
+ }
118
+
119
+ interface RecreationDotGovPayloadResponse<T>
120
+ {
121
+ readonly payload: T;
122
+ }
123
+
124
+ export interface RecreationDotGovDivisionJson
125
+ {
126
+ readonly id: string;
127
+
128
+ readonly name: string;
129
+
130
+ readonly type: string;
131
+
132
+ readonly district: string;
133
+ }
134
+
135
+ export interface RecreationDotGovPermitItineraryJson
136
+ {
137
+ readonly id: string;
138
+
139
+ readonly name: string;
140
+
141
+ readonly divisions: { [divisionId: number]: RecreationDotGovDivisionJson };
142
+ }
143
+
144
+ export class RecreationDotGovError extends Error
145
+ {
146
+ public constructor(message: string)
147
+ {
148
+ super(message);
149
+ }
150
+ }
151
+
152
+ export interface RecreationDotGovErrorResponse
153
+ {
154
+ readonly error: string;
155
+ }
156
+
157
+ export class RecreationDotGovClient implements HttpClient
158
+ {
159
+ private readonly httpClient: HttpClient;
160
+
161
+ private constructor(httpClient: HttpClient)
162
+ {
163
+ PreCondition.assertNotUndefinedAndNotNull(httpClient, "httpClient");
164
+
165
+ this.httpClient = httpClient;
166
+ }
167
+
168
+ public static create(httpClient: HttpClient): RecreationDotGovClient
169
+ {
170
+ return new RecreationDotGovClient(httpClient);
171
+ }
172
+
173
+ public sendRequest(request: HttpOutgoingRequest): AsyncResult<HttpIncomingResponse>
174
+ {
175
+ return this.httpClient.sendRequest(request);
176
+ }
177
+
178
+ public sendGetRequest(url: string): AsyncResult<HttpIncomingResponse>
179
+ {
180
+ return HttpClient.sendGetRequest(this, url);
181
+ }
182
+
183
+ public getPermitItinerary(permitItineraryId: string): PromiseAsyncResult<RecreationDotGovPermitItineraryJson>
184
+ {
185
+ PreCondition.assertNotEmpty(permitItineraryId, "permitItineraryId");
186
+
187
+ return PromiseAsyncResult.create(async () =>
188
+ {
189
+ const response: HttpIncomingResponse = await this.sendGetRequest(`https://www.recreation.gov/api/permitcontent/${permitItineraryId}`);
190
+
191
+ const responseBody: string = await response.getBody();
192
+
193
+ const statusCode: number = response.getStatusCode();
194
+ if (statusCode < 200 || 300 <= statusCode)
195
+ {
196
+ const responseBodyJson: RecreationDotGovErrorResponse = JSON.parse(responseBody);
197
+ const errorMessage: string = responseBodyJson.error;
198
+ switch (errorMessage.toLowerCase())
199
+ {
200
+ case "permit not found":
201
+ throw new RecreationDotGovError(`No permit itinerary found for id: ${JSON.stringify(permitItineraryId)}`);
202
+
203
+ default:
204
+ throw new RecreationDotGovError(`Unrecognized error: ${JSON.stringify(errorMessage)}`);
205
+ }
206
+ }
207
+
208
+ const responseBodyJson: RecreationDotGovPayloadResponse<RecreationDotGovPermitItineraryJson> = JSON.parse(responseBody);
209
+ return responseBodyJson.payload;
210
+ });
211
+ }
212
+
213
+ public getDivisionAvailability(permitItineraryId: string, divisionId: string, month: number, year: number, earlyAccessPermitLotteryId?: string): PromiseAsyncResult<RecreationDotGovDivisionAvailability>
214
+ {
215
+ PreCondition.assertNotEmpty(permitItineraryId, "permitItineraryId");
216
+ PreCondition.assertNotEmpty(divisionId, "divisionId");
217
+ PreCondition.assertBetween(1, month, 12, "month");
218
+
219
+ return PromiseAsyncResult.create(async () =>
220
+ {
221
+ const url: string = earlyAccessPermitLotteryId
222
+ ? `https://www.recreation.gov/api/permititinerary/${permitItineraryId}/division/${divisionId}/eapavailability/month/${earlyAccessPermitLotteryId}?month=${month}&year=${year}`
223
+ : `https://www.recreation.gov/api/permititinerary/${permitItineraryId}/division/${divisionId}/availability/month?month=${month}&year=${year}`
224
+ const response: HttpIncomingResponse = await this.sendGetRequest(url);
225
+
226
+ let responseBody: string = await response.getBody();
227
+
228
+ const statusCode: number = response.getStatusCode();
229
+ if (statusCode < 200 || 300 <= statusCode)
230
+ {
231
+ const responseBodyJson: RecreationDotGovErrorResponse = JSON.parse(responseBody) as RecreationDotGovErrorResponse;
232
+ const errorMessage: string = responseBodyJson.error;
233
+ switch (errorMessage.toLowerCase())
234
+ {
235
+ case "invalid permit id":
236
+ throw new RecreationDotGovError(`No permit itinerary found for id: ${JSON.stringify(permitItineraryId)}`);
237
+
238
+ case "request year is missing or invalid":
239
+ // Ignore this error and just return an empty availability.
240
+ const emptyResponseBody: RecreationDotGovPayloadResponse<RecreationDotGovDivisionAvailabilityJson> = {
241
+ payload: {
242
+ bools: {},
243
+ rules: [],
244
+ quota_type_maps: {},
245
+ },
246
+ };
247
+ responseBody = JSON.stringify(emptyResponseBody);
248
+ break;
249
+
250
+ default:
251
+ throw new RecreationDotGovError(`Unrecognized error: ${JSON.stringify(errorMessage)}`);
252
+ }
253
+ }
254
+
255
+ const responseBodyJson: RecreationDotGovPayloadResponse<RecreationDotGovDivisionAvailabilityJson> = JSON.parse(responseBody);
256
+ return RecreationDotGovDivisionAvailability.create(responseBodyJson.payload);
257
+ });
258
+ }
259
259
  }
@@ -1,42 +1,42 @@
1
- import { JavascriptIterable } from "./javascript";
2
-
3
- /**
4
- * An object that can be used to implement a search algorithm.
5
- */
6
- export abstract class SearchControl<TVisit,TResult>
7
- {
8
- /**
9
- * Add the provided value to the to-visit list.
10
- * @param value The value to add to the to-visit list.
11
- */
12
- public abstract addToVisit(value: TVisit): void;
13
-
14
- /**
15
- * Add the provided values to the to-visit list.
16
- * @param values The values to add to the to-visit list.
17
- */
18
- public abstract addAllToVisit(values: JavascriptIterable<TVisit>): void;
19
-
20
- /**
21
- * Get whether the provided value has already been visited.
22
- * @param value The value to check.
23
- */
24
- public abstract hasVisited(value: TVisit): boolean;
25
-
26
- /**
27
- * Add the provided value to the list of values to be returned.
28
- * @param value The value to add.
29
- */
30
- public abstract addResult(value: TResult): void;
31
-
32
- /**
33
- * Add the provided values to the list of values to be returned.
34
- * @param values The values to add.
35
- */
36
- public abstract addResults(values: JavascriptIterable<TResult>): void;
37
-
38
- /**
39
- * Immediately stop the search.
40
- */
41
- public abstract break(): never;
1
+ import { JavascriptIterable } from "./javascript";
2
+
3
+ /**
4
+ * An object that can be used to implement a search algorithm.
5
+ */
6
+ export abstract class SearchControl<TVisit,TResult>
7
+ {
8
+ /**
9
+ * Add the provided value to the to-visit list.
10
+ * @param value The value to add to the to-visit list.
11
+ */
12
+ public abstract addToVisit(value: TVisit): void;
13
+
14
+ /**
15
+ * Add the provided values to the to-visit list.
16
+ * @param values The values to add to the to-visit list.
17
+ */
18
+ public abstract addAllToVisit(values: JavascriptIterable<TVisit>): void;
19
+
20
+ /**
21
+ * Get whether the provided value has already been visited.
22
+ * @param value The value to check.
23
+ */
24
+ public abstract hasVisited(value: TVisit): boolean;
25
+
26
+ /**
27
+ * Add the provided value to the list of values to be returned.
28
+ * @param value The value to add.
29
+ */
30
+ public abstract addResult(value: TResult): void;
31
+
32
+ /**
33
+ * Add the provided values to the list of values to be returned.
34
+ * @param values The values to add.
35
+ */
36
+ public abstract addResults(values: JavascriptIterable<TResult>): void;
37
+
38
+ /**
39
+ * Immediately stop the search.
40
+ */
41
+ public abstract break(): never;
42
42
  }