@everyonesoftware/common 5.0.0 → 7.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/outputs/characterWriteStream-ogvZec-U.d.cts +798 -0
- package/outputs/characterWriteStream-ogvZec-U.d.ts +798 -0
- package/outputs/{chunk-AY3YWKOM.js → chunk-MMAX3IZF.js} +4911 -3470
- package/outputs/chunk-MMAX3IZF.js.map +1 -0
- package/outputs/chunk-VF6FBNAU.js +1062 -0
- package/outputs/chunk-VF6FBNAU.js.map +1 -0
- package/outputs/{sources.cjs → sourceIndex.cjs} +926 -560
- package/outputs/sourceIndex.cjs.map +1 -0
- package/outputs/{sources.d.cts → sourceIndex.d.cts} +457 -1160
- package/outputs/{sources.d.ts → sourceIndex.d.ts} +457 -1160
- package/outputs/sourceIndex.js +331 -0
- package/outputs/sourceIndex.js.map +1 -0
- package/outputs/testIndex.cjs +6522 -0
- package/outputs/testIndex.cjs.map +1 -0
- package/outputs/testIndex.d.cts +476 -0
- package/outputs/testIndex.d.ts +476 -0
- package/outputs/testIndex.js +26 -0
- package/outputs/testIndex.js.map +1 -0
- package/outputs/tests.cjs +13935 -12780
- package/outputs/tests.cjs.map +1 -1
- package/outputs/tests.js +2763 -3032
- package/outputs/tests.js.map +1 -1
- package/package.json +7 -7
- package/outputs/chunk-AY3YWKOM.js.map +0 -1
- package/outputs/sources.cjs.map +0 -1
- package/outputs/sources.js +0 -1370
- package/outputs/sources.js.map +0 -1
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// sources/index.ts
|
|
31
31
|
var sources_exports = {};
|
|
32
32
|
__export(sources_exports, {
|
|
33
|
+
ANSIStyles: () => ANSIStyles,
|
|
33
34
|
AsyncIterator: () => AsyncIterator,
|
|
34
35
|
AsyncIteratorToJavascriptAsyncIteratorAdapter: () => AsyncIteratorToJavascriptAsyncIteratorAdapter,
|
|
35
36
|
AsyncResult: () => AsyncResult,
|
|
@@ -42,6 +43,7 @@ __export(sources_exports, {
|
|
|
42
43
|
CharacterListStream: () => CharacterListStream,
|
|
43
44
|
CharacterReadStream: () => CharacterReadStream,
|
|
44
45
|
CharacterReadStreamAsyncIterator: () => CharacterReadStreamAsyncIterator,
|
|
46
|
+
CharacterTable: () => CharacterTable,
|
|
45
47
|
CharacterWriteStream: () => CharacterWriteStream,
|
|
46
48
|
CommandLineParameter: () => CommandLineParameter,
|
|
47
49
|
CommandLineParameters: () => CommandLineParameters,
|
|
@@ -71,6 +73,8 @@ __export(sources_exports, {
|
|
|
71
73
|
HttpOutgoingResponse: () => HttpOutgoingResponse,
|
|
72
74
|
HttpServer: () => HttpServer,
|
|
73
75
|
InMemoryCharacterWriteStream: () => InMemoryCharacterWriteStream,
|
|
76
|
+
IndentedCharacterWriteStream: () => IndentedCharacterWriteStream,
|
|
77
|
+
Indexable: () => Indexable,
|
|
74
78
|
Iterable: () => Iterable,
|
|
75
79
|
Iterator: () => Iterator,
|
|
76
80
|
IteratorToJavascriptIteratorAdapter: () => IteratorToJavascriptIteratorAdapter,
|
|
@@ -192,6 +196,40 @@ __export(sources_exports, {
|
|
|
192
196
|
});
|
|
193
197
|
module.exports = __toCommonJS(sources_exports);
|
|
194
198
|
|
|
199
|
+
// sources/ANSIStyles.ts
|
|
200
|
+
var ANSIStyles = class {
|
|
201
|
+
constructor() {
|
|
202
|
+
}
|
|
203
|
+
static color(colorCode, text) {
|
|
204
|
+
return `\x1B[${colorCode}m${text}\x1B[0m`;
|
|
205
|
+
}
|
|
206
|
+
static black(text) {
|
|
207
|
+
return this.color(30, text);
|
|
208
|
+
}
|
|
209
|
+
static red(text) {
|
|
210
|
+
return this.color(31, text);
|
|
211
|
+
}
|
|
212
|
+
static green(text) {
|
|
213
|
+
return this.color(32, text);
|
|
214
|
+
}
|
|
215
|
+
static yellow(text) {
|
|
216
|
+
return this.color(33, text);
|
|
217
|
+
}
|
|
218
|
+
static blue(text) {
|
|
219
|
+
return this.color(34, text);
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// sources/CharacterTable.ts
|
|
224
|
+
var CharacterTable = class _CharacterTable {
|
|
225
|
+
constructor() {
|
|
226
|
+
}
|
|
227
|
+
static create() {
|
|
228
|
+
return new _CharacterTable();
|
|
229
|
+
}
|
|
230
|
+
// public getRows()
|
|
231
|
+
};
|
|
232
|
+
|
|
195
233
|
// sources/bytes.ts
|
|
196
234
|
var Bytes = class _Bytes {
|
|
197
235
|
/**
|
|
@@ -609,109 +647,6 @@ function isPromise(value) {
|
|
|
609
647
|
return isPromiseLike(value) && hasFunction(value, "catch", 1) && hasFunction(value, "finally", 1);
|
|
610
648
|
}
|
|
611
649
|
|
|
612
|
-
// sources/promiseAsyncResult.ts
|
|
613
|
-
var PromiseAsyncResult = class _PromiseAsyncResult {
|
|
614
|
-
promise;
|
|
615
|
-
constructor(promise) {
|
|
616
|
-
PreCondition.assertNotUndefinedAndNotNull(promise, "promise");
|
|
617
|
-
this.promise = promise;
|
|
618
|
-
}
|
|
619
|
-
static create(actionOrPromise) {
|
|
620
|
-
PreCondition.assertNotUndefinedAndNotNull(actionOrPromise, "action or promise");
|
|
621
|
-
return new _PromiseAsyncResult(Promise.resolve(isPromise(actionOrPromise) ? actionOrPromise : actionOrPromise()));
|
|
622
|
-
}
|
|
623
|
-
static value(value) {
|
|
624
|
-
return _PromiseAsyncResult.create(Promise.resolve(value));
|
|
625
|
-
}
|
|
626
|
-
static error(error) {
|
|
627
|
-
return _PromiseAsyncResult.create(Promise.reject(error));
|
|
628
|
-
}
|
|
629
|
-
static yield() {
|
|
630
|
-
return _PromiseAsyncResult.create(Promise.resolve());
|
|
631
|
-
}
|
|
632
|
-
then(onfulfilled, onrejected) {
|
|
633
|
-
return _PromiseAsyncResult.create(this.promise.then(onfulfilled, onrejected));
|
|
634
|
-
}
|
|
635
|
-
onValue(onValueFunction) {
|
|
636
|
-
return this.then(async (value) => {
|
|
637
|
-
let result;
|
|
638
|
-
try {
|
|
639
|
-
await onValueFunction(value);
|
|
640
|
-
result = this;
|
|
641
|
-
} catch (error) {
|
|
642
|
-
result = _PromiseAsyncResult.error(error);
|
|
643
|
-
}
|
|
644
|
-
return result;
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
catch(errorTypeOrOnRejected, onrejected) {
|
|
648
|
-
let errorType;
|
|
649
|
-
if (!isUndefinedOrNull(onrejected)) {
|
|
650
|
-
errorType = errorTypeOrOnRejected;
|
|
651
|
-
PreCondition.assertNotUndefinedAndNotNull(errorType, "errorType");
|
|
652
|
-
} else {
|
|
653
|
-
onrejected = errorTypeOrOnRejected;
|
|
654
|
-
}
|
|
655
|
-
return _PromiseAsyncResult.create(this.promise.catch((reason) => {
|
|
656
|
-
let value;
|
|
657
|
-
if (errorType && !instanceOfType(reason, errorType)) {
|
|
658
|
-
throw reason;
|
|
659
|
-
} else if (!isUndefinedOrNull(onrejected)) {
|
|
660
|
-
value = onrejected(reason);
|
|
661
|
-
}
|
|
662
|
-
return value;
|
|
663
|
-
}));
|
|
664
|
-
}
|
|
665
|
-
onError(errorTypeOrOnErrorFunction, onErrorFunction) {
|
|
666
|
-
let errorType;
|
|
667
|
-
if (!isUndefinedOrNull(onErrorFunction)) {
|
|
668
|
-
errorType = errorTypeOrOnErrorFunction;
|
|
669
|
-
PreCondition.assertNotUndefinedAndNotNull(errorType, "errorType");
|
|
670
|
-
} else {
|
|
671
|
-
onErrorFunction = errorTypeOrOnErrorFunction;
|
|
672
|
-
}
|
|
673
|
-
PreCondition.assertNotUndefinedAndNotNull(onErrorFunction, "onErrorFunction");
|
|
674
|
-
let result;
|
|
675
|
-
if (errorType) {
|
|
676
|
-
result = this.catch(errorType, async (reason) => {
|
|
677
|
-
await onErrorFunction(reason);
|
|
678
|
-
throw reason;
|
|
679
|
-
});
|
|
680
|
-
} else {
|
|
681
|
-
result = this.catch(async (reason) => {
|
|
682
|
-
await onErrorFunction(reason);
|
|
683
|
-
throw reason;
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
return result;
|
|
687
|
-
}
|
|
688
|
-
convertError(errorTypeOrConvertErrorFunction, convertErrorFunction) {
|
|
689
|
-
let errorType;
|
|
690
|
-
if (!isUndefinedOrNull(convertErrorFunction)) {
|
|
691
|
-
errorType = errorTypeOrConvertErrorFunction;
|
|
692
|
-
PreCondition.assertNotUndefinedAndNotNull(errorType, "errorType");
|
|
693
|
-
} else {
|
|
694
|
-
convertErrorFunction = errorTypeOrConvertErrorFunction;
|
|
695
|
-
}
|
|
696
|
-
PreCondition.assertNotUndefinedAndNotNull(convertErrorFunction, "convertErrorFunction");
|
|
697
|
-
let result;
|
|
698
|
-
if (errorType) {
|
|
699
|
-
result = this.catch(errorType, async (reason) => {
|
|
700
|
-
throw await convertErrorFunction(reason);
|
|
701
|
-
});
|
|
702
|
-
} else {
|
|
703
|
-
result = this.catch(async (reason) => {
|
|
704
|
-
throw await convertErrorFunction(reason);
|
|
705
|
-
});
|
|
706
|
-
}
|
|
707
|
-
return result;
|
|
708
|
-
}
|
|
709
|
-
finally(onfinally) {
|
|
710
|
-
return _PromiseAsyncResult.create(this.promise.finally(onfinally));
|
|
711
|
-
}
|
|
712
|
-
[Symbol.toStringTag] = "AsyncResult";
|
|
713
|
-
};
|
|
714
|
-
|
|
715
650
|
// sources/syncResult.ts
|
|
716
651
|
var SyncResult = class _SyncResult {
|
|
717
652
|
value;
|
|
@@ -1956,6 +1891,118 @@ var Iterator = class _Iterator {
|
|
|
1956
1891
|
}
|
|
1957
1892
|
};
|
|
1958
1893
|
|
|
1894
|
+
// sources/Indexable.ts
|
|
1895
|
+
var Indexable = class _Indexable {
|
|
1896
|
+
static create(values) {
|
|
1897
|
+
return List.create(values);
|
|
1898
|
+
}
|
|
1899
|
+
toArray() {
|
|
1900
|
+
return _Indexable.toArray(this);
|
|
1901
|
+
}
|
|
1902
|
+
static toArray(indexable) {
|
|
1903
|
+
return Iterable.toArray(indexable);
|
|
1904
|
+
}
|
|
1905
|
+
any() {
|
|
1906
|
+
return _Indexable.any(this);
|
|
1907
|
+
}
|
|
1908
|
+
static any(indexable) {
|
|
1909
|
+
return Iterable.any(indexable);
|
|
1910
|
+
}
|
|
1911
|
+
getCount() {
|
|
1912
|
+
return _Indexable.getCount(this);
|
|
1913
|
+
}
|
|
1914
|
+
static getCount(indexable) {
|
|
1915
|
+
return Iterable.getCount(indexable);
|
|
1916
|
+
}
|
|
1917
|
+
equals(right, equalFunctions) {
|
|
1918
|
+
return _Indexable.equals(this, right, equalFunctions);
|
|
1919
|
+
}
|
|
1920
|
+
static equals(left, right, equalFunctions) {
|
|
1921
|
+
return Iterable.equals(left, right, equalFunctions);
|
|
1922
|
+
}
|
|
1923
|
+
toString(toStringFunctions) {
|
|
1924
|
+
return _Indexable.toString(this, toStringFunctions);
|
|
1925
|
+
}
|
|
1926
|
+
static toString(indexable, toStringFunctions) {
|
|
1927
|
+
return Iterable.toString(indexable, toStringFunctions);
|
|
1928
|
+
}
|
|
1929
|
+
concatenate(...toConcatenate) {
|
|
1930
|
+
return _Indexable.concatenate(this, ...toConcatenate);
|
|
1931
|
+
}
|
|
1932
|
+
static concatenate(indexable, ...toConcatenate) {
|
|
1933
|
+
return Iterable.concatenate(indexable, ...toConcatenate);
|
|
1934
|
+
}
|
|
1935
|
+
map(mapping) {
|
|
1936
|
+
return _Indexable.map(this, mapping);
|
|
1937
|
+
}
|
|
1938
|
+
static map(indexable, mapping) {
|
|
1939
|
+
return Iterable.map(indexable, mapping);
|
|
1940
|
+
}
|
|
1941
|
+
flatMap(mapping) {
|
|
1942
|
+
return _Indexable.flatMap(this, mapping);
|
|
1943
|
+
}
|
|
1944
|
+
static flatMap(indexable, mapping) {
|
|
1945
|
+
return Iterable.flatMap(indexable, mapping);
|
|
1946
|
+
}
|
|
1947
|
+
where(condition) {
|
|
1948
|
+
return _Indexable.where(this, condition);
|
|
1949
|
+
}
|
|
1950
|
+
static where(indexable, condition) {
|
|
1951
|
+
return Iterable.where(indexable, condition);
|
|
1952
|
+
}
|
|
1953
|
+
instanceOf(typeOrTypeCheck) {
|
|
1954
|
+
return _Indexable.instanceOf(this, typeOrTypeCheck);
|
|
1955
|
+
}
|
|
1956
|
+
static instanceOf(indexable, typeOrTypeCheck) {
|
|
1957
|
+
return Iterable.instanceOf(indexable, typeOrTypeCheck);
|
|
1958
|
+
}
|
|
1959
|
+
first(condition) {
|
|
1960
|
+
return _Indexable.first(this, condition);
|
|
1961
|
+
}
|
|
1962
|
+
static first(indexable, condition) {
|
|
1963
|
+
let result;
|
|
1964
|
+
if (condition) {
|
|
1965
|
+
result = Iterable.first(indexable, condition);
|
|
1966
|
+
} else {
|
|
1967
|
+
if (indexable.any().await()) {
|
|
1968
|
+
result = indexable.get(0);
|
|
1969
|
+
} else {
|
|
1970
|
+
result = SyncResult.error(new EmptyError());
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
return result;
|
|
1974
|
+
}
|
|
1975
|
+
last(condition) {
|
|
1976
|
+
return _Indexable.last(this, condition);
|
|
1977
|
+
}
|
|
1978
|
+
static last(indexable, condition) {
|
|
1979
|
+
let result;
|
|
1980
|
+
if (condition) {
|
|
1981
|
+
result = Iterable.last(indexable, condition);
|
|
1982
|
+
} else {
|
|
1983
|
+
const count = indexable.getCount().await();
|
|
1984
|
+
if (count > 0) {
|
|
1985
|
+
result = indexable.get(count - 1);
|
|
1986
|
+
} else {
|
|
1987
|
+
result = SyncResult.error(new EmptyError());
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
return result;
|
|
1991
|
+
}
|
|
1992
|
+
[Symbol.iterator]() {
|
|
1993
|
+
return _Indexable[Symbol.iterator](this);
|
|
1994
|
+
}
|
|
1995
|
+
static [Symbol.iterator](indexable) {
|
|
1996
|
+
return Iterable[Symbol.iterator](indexable);
|
|
1997
|
+
}
|
|
1998
|
+
contains(value, equalFunctions) {
|
|
1999
|
+
return _Indexable.contains(this, value, equalFunctions);
|
|
2000
|
+
}
|
|
2001
|
+
static contains(indexable, value, equalFunctions) {
|
|
2002
|
+
return Iterable.contains(indexable, value, equalFunctions);
|
|
2003
|
+
}
|
|
2004
|
+
};
|
|
2005
|
+
|
|
1959
2006
|
// sources/javascriptArrayList.ts
|
|
1960
2007
|
var JavascriptArrayList = class _JavascriptArrayList {
|
|
1961
2008
|
array;
|
|
@@ -2907,85 +2954,85 @@ var List = class _List {
|
|
|
2907
2954
|
return _List.toArray(this);
|
|
2908
2955
|
}
|
|
2909
2956
|
static toArray(list2) {
|
|
2910
|
-
return
|
|
2957
|
+
return Indexable.toArray(list2);
|
|
2911
2958
|
}
|
|
2912
2959
|
any() {
|
|
2913
2960
|
return _List.any(this);
|
|
2914
2961
|
}
|
|
2915
2962
|
static any(list2) {
|
|
2916
|
-
return
|
|
2963
|
+
return Indexable.any(list2);
|
|
2917
2964
|
}
|
|
2918
2965
|
getCount() {
|
|
2919
2966
|
return _List.getCount(this);
|
|
2920
2967
|
}
|
|
2921
2968
|
static getCount(list2) {
|
|
2922
|
-
return
|
|
2969
|
+
return Indexable.getCount(list2);
|
|
2923
2970
|
}
|
|
2924
2971
|
equals(right, equalFunctions) {
|
|
2925
2972
|
return _List.equals(this, right, equalFunctions);
|
|
2926
2973
|
}
|
|
2927
2974
|
static equals(left, right, equalFunctions) {
|
|
2928
|
-
return
|
|
2975
|
+
return Indexable.equals(left, right, equalFunctions);
|
|
2929
2976
|
}
|
|
2930
2977
|
toString(toStringFunctions) {
|
|
2931
2978
|
return _List.toString(this, toStringFunctions);
|
|
2932
2979
|
}
|
|
2933
2980
|
static toString(list2, toStringFunctions) {
|
|
2934
|
-
return
|
|
2981
|
+
return Indexable.toString(list2, toStringFunctions);
|
|
2935
2982
|
}
|
|
2936
2983
|
concatenate(...toConcatenate) {
|
|
2937
2984
|
return _List.concatenate(this, ...toConcatenate);
|
|
2938
2985
|
}
|
|
2939
2986
|
static concatenate(list2, ...toConcatenate) {
|
|
2940
|
-
return
|
|
2987
|
+
return Indexable.concatenate(list2, ...toConcatenate);
|
|
2941
2988
|
}
|
|
2942
2989
|
map(mapping) {
|
|
2943
2990
|
return _List.map(this, mapping);
|
|
2944
2991
|
}
|
|
2945
2992
|
static map(list2, mapping) {
|
|
2946
|
-
return
|
|
2993
|
+
return Indexable.map(list2, mapping);
|
|
2947
2994
|
}
|
|
2948
2995
|
flatMap(mapping) {
|
|
2949
2996
|
return _List.flatMap(this, mapping);
|
|
2950
2997
|
}
|
|
2951
2998
|
static flatMap(list2, mapping) {
|
|
2952
|
-
return
|
|
2999
|
+
return Indexable.flatMap(list2, mapping);
|
|
2953
3000
|
}
|
|
2954
3001
|
where(condition) {
|
|
2955
3002
|
return _List.where(this, condition);
|
|
2956
3003
|
}
|
|
2957
3004
|
static where(list2, condition) {
|
|
2958
|
-
return
|
|
3005
|
+
return Indexable.where(list2, condition);
|
|
2959
3006
|
}
|
|
2960
3007
|
instanceOf(typeOrTypeCheck) {
|
|
2961
3008
|
return _List.instanceOf(this, typeOrTypeCheck);
|
|
2962
3009
|
}
|
|
2963
3010
|
static instanceOf(list2, typeOrTypeCheck) {
|
|
2964
|
-
return
|
|
3011
|
+
return Indexable.instanceOf(list2, typeOrTypeCheck);
|
|
2965
3012
|
}
|
|
2966
3013
|
first(condition) {
|
|
2967
3014
|
return _List.first(this, condition);
|
|
2968
3015
|
}
|
|
2969
3016
|
static first(list2, condition) {
|
|
2970
|
-
return
|
|
3017
|
+
return Indexable.first(list2, condition);
|
|
2971
3018
|
}
|
|
2972
3019
|
last(condition) {
|
|
2973
3020
|
return _List.last(this, condition);
|
|
2974
3021
|
}
|
|
2975
3022
|
static last(list2, condition) {
|
|
2976
|
-
return
|
|
3023
|
+
return Indexable.last(list2, condition);
|
|
2977
3024
|
}
|
|
2978
3025
|
[Symbol.iterator]() {
|
|
2979
3026
|
return _List[Symbol.iterator](this);
|
|
2980
3027
|
}
|
|
2981
3028
|
static [Symbol.iterator](list2) {
|
|
2982
|
-
return
|
|
3029
|
+
return Indexable[Symbol.iterator](list2);
|
|
2983
3030
|
}
|
|
2984
3031
|
contains(value, equalFunctions) {
|
|
2985
3032
|
return _List.contains(this, value, equalFunctions);
|
|
2986
3033
|
}
|
|
2987
3034
|
static contains(list2, value, equalFunctions) {
|
|
2988
|
-
return
|
|
3035
|
+
return Indexable.contains(list2, value, equalFunctions);
|
|
2989
3036
|
}
|
|
2990
3037
|
};
|
|
2991
3038
|
|
|
@@ -3342,7 +3389,7 @@ var WhereIterable = class _WhereIterable {
|
|
|
3342
3389
|
// sources/iterable.ts
|
|
3343
3390
|
var Iterable = class _Iterable {
|
|
3344
3391
|
static create(values) {
|
|
3345
|
-
return
|
|
3392
|
+
return Indexable.create(values);
|
|
3346
3393
|
}
|
|
3347
3394
|
[Symbol.iterator]() {
|
|
3348
3395
|
return _Iterable[Symbol.iterator](this);
|
|
@@ -3829,7 +3876,7 @@ var MutableCondition = class _MutableCondition {
|
|
|
3829
3876
|
}
|
|
3830
3877
|
assertNotEmpty(value, expression, message) {
|
|
3831
3878
|
this.assertNotUndefinedAndNotNull(value, expression, message);
|
|
3832
|
-
if (isString(value) && value.length === 0 || isJavascriptIterable(value) && !Iterable.create(value).any()) {
|
|
3879
|
+
if (isString(value) && value.length === 0 || isJavascriptIterable(value) && !Iterable.create(value).any().await()) {
|
|
3833
3880
|
throw this.createError({
|
|
3834
3881
|
expected: "not empty",
|
|
3835
3882
|
actual: this.toValueString(value),
|
|
@@ -4195,65 +4242,568 @@ var PreCondition = class _PreCondition {
|
|
|
4195
4242
|
}
|
|
4196
4243
|
};
|
|
4197
4244
|
|
|
4198
|
-
// sources/
|
|
4199
|
-
var
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
this.iterator = iterator;
|
|
4205
|
-
this.hasStarted = false;
|
|
4206
|
-
}
|
|
4207
|
-
static create(iterator) {
|
|
4208
|
-
return new _AsyncIteratorToJavascriptAsyncIteratorAdapter(iterator);
|
|
4245
|
+
// sources/promiseAsyncResult.ts
|
|
4246
|
+
var PromiseAsyncResult = class _PromiseAsyncResult {
|
|
4247
|
+
promise;
|
|
4248
|
+
constructor(promise) {
|
|
4249
|
+
PreCondition.assertNotUndefinedAndNotNull(promise, "promise");
|
|
4250
|
+
this.promise = promise;
|
|
4209
4251
|
}
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4252
|
+
static create(actionOrPromise) {
|
|
4253
|
+
PreCondition.assertNotUndefinedAndNotNull(actionOrPromise, "action or promise");
|
|
4254
|
+
let promise;
|
|
4255
|
+
if (isPromise(actionOrPromise)) {
|
|
4256
|
+
promise = actionOrPromise;
|
|
4214
4257
|
} else {
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4258
|
+
let actionExecutor2 = function(resolve, reject) {
|
|
4259
|
+
try {
|
|
4260
|
+
resolve(action());
|
|
4261
|
+
} catch (error) {
|
|
4262
|
+
reject(error);
|
|
4263
|
+
}
|
|
4264
|
+
};
|
|
4265
|
+
var actionExecutor = actionExecutor2;
|
|
4266
|
+
const action = actionOrPromise;
|
|
4267
|
+
;
|
|
4268
|
+
promise = new Promise(actionExecutor2);
|
|
4223
4269
|
}
|
|
4224
|
-
return
|
|
4225
|
-
}
|
|
4226
|
-
};
|
|
4227
|
-
|
|
4228
|
-
// sources/javascriptAsyncIteratorToAsyncIteratorAdapter.ts
|
|
4229
|
-
var JavascriptAsyncIteratorToAsyncIteratorAdapter = class _JavascriptAsyncIteratorToAsyncIteratorAdapter {
|
|
4230
|
-
javascriptIterator;
|
|
4231
|
-
javascriptIteratorResult;
|
|
4232
|
-
constructor(javascriptIterator) {
|
|
4233
|
-
PreCondition.assertNotUndefinedAndNotNull(javascriptIterator, "javascriptIterator");
|
|
4234
|
-
this.javascriptIterator = javascriptIterator;
|
|
4270
|
+
return new _PromiseAsyncResult(promise);
|
|
4235
4271
|
}
|
|
4236
|
-
static
|
|
4237
|
-
|
|
4238
|
-
javascriptIterator = javascriptIterator[Symbol.asyncIterator]();
|
|
4239
|
-
}
|
|
4240
|
-
return new _JavascriptAsyncIteratorToAsyncIteratorAdapter(javascriptIterator);
|
|
4272
|
+
static empty() {
|
|
4273
|
+
return _PromiseAsyncResult.create(Promise.resolve());
|
|
4241
4274
|
}
|
|
4242
|
-
|
|
4243
|
-
return
|
|
4244
|
-
this.javascriptIteratorResult = await this.javascriptIterator.next();
|
|
4245
|
-
return this.hasCurrent();
|
|
4246
|
-
});
|
|
4275
|
+
static value(value) {
|
|
4276
|
+
return _PromiseAsyncResult.create(Promise.resolve(value));
|
|
4247
4277
|
}
|
|
4248
|
-
|
|
4249
|
-
return
|
|
4278
|
+
static error(error) {
|
|
4279
|
+
return _PromiseAsyncResult.create(Promise.reject(error));
|
|
4250
4280
|
}
|
|
4251
|
-
|
|
4252
|
-
return
|
|
4281
|
+
static yield() {
|
|
4282
|
+
return _PromiseAsyncResult.create(Promise.resolve());
|
|
4253
4283
|
}
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4284
|
+
then(onfulfilled, onrejected) {
|
|
4285
|
+
return _PromiseAsyncResult.create(this.promise.then(onfulfilled, onrejected));
|
|
4286
|
+
}
|
|
4287
|
+
onValue(onValueFunction) {
|
|
4288
|
+
return this.then(async (value) => {
|
|
4289
|
+
let result;
|
|
4290
|
+
try {
|
|
4291
|
+
await onValueFunction(value);
|
|
4292
|
+
result = this;
|
|
4293
|
+
} catch (error) {
|
|
4294
|
+
result = _PromiseAsyncResult.error(error);
|
|
4295
|
+
}
|
|
4296
|
+
return result;
|
|
4297
|
+
});
|
|
4298
|
+
}
|
|
4299
|
+
catch(errorTypeOrOnRejected, onrejected) {
|
|
4300
|
+
let errorType;
|
|
4301
|
+
if (!isUndefinedOrNull(onrejected)) {
|
|
4302
|
+
errorType = errorTypeOrOnRejected;
|
|
4303
|
+
PreCondition.assertNotUndefinedAndNotNull(errorType, "errorType");
|
|
4304
|
+
} else {
|
|
4305
|
+
onrejected = errorTypeOrOnRejected;
|
|
4306
|
+
}
|
|
4307
|
+
return _PromiseAsyncResult.create(this.promise.catch((reason) => {
|
|
4308
|
+
let value;
|
|
4309
|
+
if (errorType && !instanceOfType(reason, errorType)) {
|
|
4310
|
+
throw reason;
|
|
4311
|
+
} else if (!isUndefinedOrNull(onrejected)) {
|
|
4312
|
+
value = onrejected(reason);
|
|
4313
|
+
}
|
|
4314
|
+
return value;
|
|
4315
|
+
}));
|
|
4316
|
+
}
|
|
4317
|
+
onError(errorTypeOrOnErrorFunction, onErrorFunction) {
|
|
4318
|
+
let errorType;
|
|
4319
|
+
if (!isUndefinedOrNull(onErrorFunction)) {
|
|
4320
|
+
errorType = errorTypeOrOnErrorFunction;
|
|
4321
|
+
PreCondition.assertNotUndefinedAndNotNull(errorType, "errorType");
|
|
4322
|
+
} else {
|
|
4323
|
+
onErrorFunction = errorTypeOrOnErrorFunction;
|
|
4324
|
+
}
|
|
4325
|
+
PreCondition.assertNotUndefinedAndNotNull(onErrorFunction, "onErrorFunction");
|
|
4326
|
+
let result;
|
|
4327
|
+
if (errorType) {
|
|
4328
|
+
result = this.catch(errorType, async (reason) => {
|
|
4329
|
+
await onErrorFunction(reason);
|
|
4330
|
+
throw reason;
|
|
4331
|
+
});
|
|
4332
|
+
} else {
|
|
4333
|
+
result = this.catch(async (reason) => {
|
|
4334
|
+
await onErrorFunction(reason);
|
|
4335
|
+
throw reason;
|
|
4336
|
+
});
|
|
4337
|
+
}
|
|
4338
|
+
return result;
|
|
4339
|
+
}
|
|
4340
|
+
convertError(errorTypeOrConvertErrorFunction, convertErrorFunction) {
|
|
4341
|
+
let errorType;
|
|
4342
|
+
if (!isUndefinedOrNull(convertErrorFunction)) {
|
|
4343
|
+
errorType = errorTypeOrConvertErrorFunction;
|
|
4344
|
+
PreCondition.assertNotUndefinedAndNotNull(errorType, "errorType");
|
|
4345
|
+
} else {
|
|
4346
|
+
convertErrorFunction = errorTypeOrConvertErrorFunction;
|
|
4347
|
+
}
|
|
4348
|
+
PreCondition.assertNotUndefinedAndNotNull(convertErrorFunction, "convertErrorFunction");
|
|
4349
|
+
let result;
|
|
4350
|
+
if (errorType) {
|
|
4351
|
+
result = this.catch(errorType, async (reason) => {
|
|
4352
|
+
throw await convertErrorFunction(reason);
|
|
4353
|
+
});
|
|
4354
|
+
} else {
|
|
4355
|
+
result = this.catch(async (reason) => {
|
|
4356
|
+
throw await convertErrorFunction(reason);
|
|
4357
|
+
});
|
|
4358
|
+
}
|
|
4359
|
+
return result;
|
|
4360
|
+
}
|
|
4361
|
+
finally(onfinally) {
|
|
4362
|
+
return _PromiseAsyncResult.create(this.promise.finally(onfinally));
|
|
4363
|
+
}
|
|
4364
|
+
[Symbol.toStringTag] = "AsyncResult";
|
|
4365
|
+
};
|
|
4366
|
+
|
|
4367
|
+
// sources/asyncResult.ts
|
|
4368
|
+
var AsyncResult = class {
|
|
4369
|
+
static create(actionOrPromise) {
|
|
4370
|
+
return PromiseAsyncResult.create(actionOrPromise);
|
|
4371
|
+
}
|
|
4372
|
+
/**
|
|
4373
|
+
* Get an {@link AsyncResult} that is already completed and doesn't do anything.
|
|
4374
|
+
*/
|
|
4375
|
+
static empty() {
|
|
4376
|
+
return PromiseAsyncResult.empty();
|
|
4377
|
+
}
|
|
4378
|
+
/**
|
|
4379
|
+
* Create a new {@link AsyncResult} that contains the provided value.
|
|
4380
|
+
* @param value The value to wrap in a {@link AsyncResult}.
|
|
4381
|
+
*/
|
|
4382
|
+
static value(value) {
|
|
4383
|
+
return PromiseAsyncResult.value(value);
|
|
4384
|
+
}
|
|
4385
|
+
/**
|
|
4386
|
+
* Create a new {@link AsyncResult} that contains the provided error.
|
|
4387
|
+
* @param error The error to wrap in a {@link AsyncResult}.
|
|
4388
|
+
*/
|
|
4389
|
+
static error(error) {
|
|
4390
|
+
return PromiseAsyncResult.error(error);
|
|
4391
|
+
}
|
|
4392
|
+
static yield() {
|
|
4393
|
+
return PromiseAsyncResult.yield();
|
|
4394
|
+
}
|
|
4395
|
+
};
|
|
4396
|
+
|
|
4397
|
+
// sources/postConditionError.ts
|
|
4398
|
+
var PostConditionError = class extends Error {
|
|
4399
|
+
constructor(...message) {
|
|
4400
|
+
super(join("\n", message));
|
|
4401
|
+
}
|
|
4402
|
+
};
|
|
4403
|
+
|
|
4404
|
+
// sources/postCondition.ts
|
|
4405
|
+
var PostCondition = class _PostCondition {
|
|
4406
|
+
static condition;
|
|
4407
|
+
static getCondition() {
|
|
4408
|
+
if (_PostCondition.condition === void 0) {
|
|
4409
|
+
_PostCondition.condition = MutableCondition.create().setCreateErrorFunction((message) => {
|
|
4410
|
+
return new PostConditionError(message);
|
|
4411
|
+
});
|
|
4412
|
+
}
|
|
4413
|
+
return _PostCondition.condition;
|
|
4414
|
+
}
|
|
4415
|
+
/**
|
|
4416
|
+
* Assert that the provided value is undefined.
|
|
4417
|
+
* @param value The value to check.
|
|
4418
|
+
* @param expression The name of the expression that produced the value.
|
|
4419
|
+
* @param message An additional message that will be included with the error.
|
|
4420
|
+
*/
|
|
4421
|
+
static assertUndefined(value, expression, message) {
|
|
4422
|
+
return _PostCondition.getCondition().assertUndefined(value, expression, message);
|
|
4423
|
+
}
|
|
4424
|
+
/**
|
|
4425
|
+
* Assert that the provided value is not undefined and not null.
|
|
4426
|
+
* @param value The value to check.
|
|
4427
|
+
* @param expression The name of the expression that produced the value.
|
|
4428
|
+
* @param message An additional message that will be included with the error.
|
|
4429
|
+
*/
|
|
4430
|
+
static assertNotUndefined(value, expression, message) {
|
|
4431
|
+
return _PostCondition.getCondition().assertNotUndefined(value, expression, message);
|
|
4432
|
+
}
|
|
4433
|
+
/**
|
|
4434
|
+
* Assert that the provided value is not undefined and not null.
|
|
4435
|
+
* @param value The value to check.
|
|
4436
|
+
* @param expression The name of the expression that produced the value.
|
|
4437
|
+
* @param message An additional message that will be included with the error.
|
|
4438
|
+
*/
|
|
4439
|
+
static assertNotUndefinedAndNotNull(value, expression, message) {
|
|
4440
|
+
return _PostCondition.getCondition().assertNotUndefinedAndNotNull(value, expression, message);
|
|
4441
|
+
}
|
|
4442
|
+
/**
|
|
4443
|
+
* Assert that the provided value is true.
|
|
4444
|
+
* @param value The value to check.
|
|
4445
|
+
* @param expression The name of the expression that produced the value.
|
|
4446
|
+
* @param message An additional message that will be included with the error.
|
|
4447
|
+
*/
|
|
4448
|
+
static assertTrue(value, expression, message) {
|
|
4449
|
+
return _PostCondition.getCondition().assertTrue(value, expression, message);
|
|
4450
|
+
}
|
|
4451
|
+
/**
|
|
4452
|
+
* Assert that the provided value is false.
|
|
4453
|
+
* @param value The value to check.
|
|
4454
|
+
* @param expression The name of the expression that produced the value.
|
|
4455
|
+
* @param message An additional message that will be included with the error.
|
|
4456
|
+
*/
|
|
4457
|
+
static assertFalse(value, expression, message) {
|
|
4458
|
+
return _PostCondition.getCondition().assertFalse(value, expression, message);
|
|
4459
|
+
}
|
|
4460
|
+
/**
|
|
4461
|
+
* Assert that the provided actual value is the same as the provided expected value.
|
|
4462
|
+
* @param expected The expected value.
|
|
4463
|
+
* @param actual The actual value.
|
|
4464
|
+
* @param expression The expression that produced the actual value.
|
|
4465
|
+
* @param message An optional message that describes the scenario.
|
|
4466
|
+
*/
|
|
4467
|
+
static assertSame(expected, actual, expression, message) {
|
|
4468
|
+
return _PostCondition.getCondition().assertSame(expected, actual, expression, message);
|
|
4469
|
+
}
|
|
4470
|
+
/**
|
|
4471
|
+
* Assert that the provided actual value is not the same as the provided expected value.
|
|
4472
|
+
* @param expected The expected value.
|
|
4473
|
+
* @param actual The actual value.
|
|
4474
|
+
* @param expression The expression that produced the actual value.
|
|
4475
|
+
* @param message An optional message that describes the scenario.
|
|
4476
|
+
*/
|
|
4477
|
+
static assertNotSame(expected, actual, expression, message) {
|
|
4478
|
+
return _PostCondition.getCondition().assertNotSame(expected, actual, expression, message);
|
|
4479
|
+
}
|
|
4480
|
+
/**
|
|
4481
|
+
* Assert that the provided actual value is equal to the provided expected value.
|
|
4482
|
+
* @param expected The expected value.
|
|
4483
|
+
* @param actual The actual value.
|
|
4484
|
+
* @param expression The expression that produced the actual value.
|
|
4485
|
+
* @param message An optional message that describes the scenario.
|
|
4486
|
+
*/
|
|
4487
|
+
static assertEqual(expected, actual, expression, message) {
|
|
4488
|
+
return _PostCondition.getCondition().assertEqual(expected, actual, expression, message);
|
|
4489
|
+
}
|
|
4490
|
+
/**
|
|
4491
|
+
* Assert that the provided actual value is not equal to the provided expected value.
|
|
4492
|
+
* @param notExpected The not expected value.
|
|
4493
|
+
* @param actual The actual value.
|
|
4494
|
+
* @param expression The expression that produced the actual value.
|
|
4495
|
+
* @param message An optional message that describes the scenario.
|
|
4496
|
+
*/
|
|
4497
|
+
static assertNotEqual(notExpected, actual, expression, message) {
|
|
4498
|
+
return _PostCondition.getCondition().assertNotEqual(notExpected, actual, expression, message);
|
|
4499
|
+
}
|
|
4500
|
+
/**
|
|
4501
|
+
* Assert that the provided value is not empty.
|
|
4502
|
+
* @param value The value to check.
|
|
4503
|
+
* @param expression The expression that produced the actual value.
|
|
4504
|
+
* @param message An optional message that describes the scenario.
|
|
4505
|
+
*/
|
|
4506
|
+
static assertNotEmpty(value, expression, message) {
|
|
4507
|
+
return _PostCondition.getCondition().assertNotEmpty(value, expression, message);
|
|
4508
|
+
}
|
|
4509
|
+
/**
|
|
4510
|
+
* Assert that the provided value is less than the provided upperBound.
|
|
4511
|
+
* @param value The value to check.
|
|
4512
|
+
* @param upperBound The upperBound that the value must be less than.
|
|
4513
|
+
* @param expression The expression that produced the actual value.
|
|
4514
|
+
* @param message An optional message that describes the scenario.
|
|
4515
|
+
*/
|
|
4516
|
+
static assertLessThan(value, upperBound, expression, message) {
|
|
4517
|
+
return _PostCondition.getCondition().assertLessThan(value, upperBound, expression, message);
|
|
4518
|
+
}
|
|
4519
|
+
/**
|
|
4520
|
+
* Assert that the provided value is less than or equal to the provided upperBound.
|
|
4521
|
+
* @param value The value to check.
|
|
4522
|
+
* @param upperBound The upperBound that the value must be less than.
|
|
4523
|
+
* @param expression The expression that produced the actual value.
|
|
4524
|
+
* @param message An optional message that describes the scenario.
|
|
4525
|
+
*/
|
|
4526
|
+
static assertLessThanOrEqualTo(value, upperBound, expression, message) {
|
|
4527
|
+
return _PostCondition.getCondition().assertLessThanOrEqualTo(value, upperBound, expression, message);
|
|
4528
|
+
}
|
|
4529
|
+
/**
|
|
4530
|
+
* Assert that the provided value is greater than or equal to the provided lowerBound.
|
|
4531
|
+
* @param value The value to check.
|
|
4532
|
+
* @param lowerBound The lowerBound that the value must be greater than or equal to.
|
|
4533
|
+
* @param expression The expression that produced the actual value.
|
|
4534
|
+
* @param message An optional message that describes the scenario.
|
|
4535
|
+
*/
|
|
4536
|
+
static assertGreaterThanOrEqualTo(value, lowerBound, expression, message) {
|
|
4537
|
+
return _PostCondition.getCondition().assertGreaterThanOrEqualTo(value, lowerBound, expression, message);
|
|
4538
|
+
}
|
|
4539
|
+
/**
|
|
4540
|
+
* Assert that the provided value is greater than the provided lowerBound.
|
|
4541
|
+
* @param value The value to check.
|
|
4542
|
+
* @param lowerBound The lowerBound that the value must be greater than.
|
|
4543
|
+
* @param expression The expression that produced the actual value.
|
|
4544
|
+
* @param message An optional message that describes the scenario.
|
|
4545
|
+
*/
|
|
4546
|
+
static assertGreaterThan(value, lowerBound, expression, message) {
|
|
4547
|
+
return _PostCondition.getCondition().assertGreaterThan(value, lowerBound, expression, message);
|
|
4548
|
+
}
|
|
4549
|
+
/**
|
|
4550
|
+
* Assert that the value is greater than or equal to the lowerBound and less than or equal to
|
|
4551
|
+
* the upperBound.
|
|
4552
|
+
* @param lowerBound The lowerBound that the value must be greater than or equal to.
|
|
4553
|
+
* @param value The value to check.
|
|
4554
|
+
* @param upperBound The upperBound that the value must be less than or equal to.
|
|
4555
|
+
* @param expression The expression that produced the actual value.
|
|
4556
|
+
* @param message An optional message that describes the scenario.
|
|
4557
|
+
*/
|
|
4558
|
+
static assertBetween(lowerBound, value, upperBound, expression, message) {
|
|
4559
|
+
return _PostCondition.getCondition().assertBetween(lowerBound, value, upperBound, expression, message);
|
|
4560
|
+
}
|
|
4561
|
+
/**
|
|
4562
|
+
* Assert that the index is within the access bounds of an indexable with the provided count.
|
|
4563
|
+
* @param index The index to check.
|
|
4564
|
+
* @param count The number of elements in the indexable.
|
|
4565
|
+
* @param expression The expression that produced the actual value.
|
|
4566
|
+
* @param message An optional message that describes the scenario.
|
|
4567
|
+
*/
|
|
4568
|
+
static assertAccessIndex(index, count, expression, message) {
|
|
4569
|
+
return _PostCondition.getCondition().assertAccessIndex(index, count, expression, message);
|
|
4570
|
+
}
|
|
4571
|
+
/**
|
|
4572
|
+
* Assert that the index is within the insertion bounds of a {@link List} with the provided count.
|
|
4573
|
+
* @param index The index to check.
|
|
4574
|
+
* @param count The number of elements in the indexable.
|
|
4575
|
+
* @param expression The expression that produced the actual value.
|
|
4576
|
+
* @param message An optional message that describes the scenario.
|
|
4577
|
+
*/
|
|
4578
|
+
static assertInsertIndex(index, count, expression, message) {
|
|
4579
|
+
return _PostCondition.getCondition().assertInsertIndex(index, count, expression, message);
|
|
4580
|
+
}
|
|
4581
|
+
/**
|
|
4582
|
+
* Assert that the value is one of the possibilities.
|
|
4583
|
+
* @param possibilities The possible values that the value can be.
|
|
4584
|
+
* @param value The value to check.
|
|
4585
|
+
* @param expression The expression that produced the value.
|
|
4586
|
+
* @param message An optional error message.
|
|
4587
|
+
*/
|
|
4588
|
+
static assertOneOf(possibilities, value, expression, message) {
|
|
4589
|
+
return _PostCondition.getCondition().assertOneOf(possibilities, value, expression, message);
|
|
4590
|
+
}
|
|
4591
|
+
/**
|
|
4592
|
+
* Assert that the value is within the bounds of a byte.
|
|
4593
|
+
* @param value The value to check.
|
|
4594
|
+
* @param expression The expression that produced the value.
|
|
4595
|
+
* @param message An optional error message.
|
|
4596
|
+
*/
|
|
4597
|
+
static assertByte(value, expression, message) {
|
|
4598
|
+
return _PostCondition.getCondition().assertByte(value, expression, message);
|
|
4599
|
+
}
|
|
4600
|
+
/**
|
|
4601
|
+
* Assert that the value is an integer.
|
|
4602
|
+
* @param value The value to check.
|
|
4603
|
+
* @param expression The expression that produced the value.
|
|
4604
|
+
* @param message An optional error message.
|
|
4605
|
+
*/
|
|
4606
|
+
static assertInteger(value, expression, message) {
|
|
4607
|
+
return _PostCondition.getCondition().assertInteger(value, expression, message);
|
|
4608
|
+
}
|
|
4609
|
+
/**
|
|
4610
|
+
* Assert that the value is a characer (single character string).
|
|
4611
|
+
* @param value The value to check.
|
|
4612
|
+
* @param expression The expression that produced the value.
|
|
4613
|
+
* @param message An optional error message.
|
|
4614
|
+
*/
|
|
4615
|
+
static assertCharacter(value, expression, message) {
|
|
4616
|
+
return _PostCondition.getCondition().assertCharacter(value, expression, message);
|
|
4617
|
+
}
|
|
4618
|
+
assertInstanceOf(parametersOrValue, type, typeCheck, expression, message) {
|
|
4619
|
+
return _PostCondition.getCondition().assertInstanceOf(parametersOrValue, type, typeCheck, expression, message);
|
|
4620
|
+
}
|
|
4621
|
+
};
|
|
4622
|
+
|
|
4623
|
+
// sources/characterWriteStream.ts
|
|
4624
|
+
var CharacterWriteStream = class _CharacterWriteStream {
|
|
4625
|
+
/**
|
|
4626
|
+
* Write the provided text (if provided) and then write a newline character sequence to this
|
|
4627
|
+
* {@link CharacterWriteStream}.
|
|
4628
|
+
* @param text The optional text to write before the newline character sequence.
|
|
4629
|
+
* @returns The number of characters that were written.
|
|
4630
|
+
*/
|
|
4631
|
+
writeLine(text) {
|
|
4632
|
+
return _CharacterWriteStream.writeLine(this, text);
|
|
4633
|
+
}
|
|
4634
|
+
static writeLine(writeStream, text) {
|
|
4635
|
+
PreCondition.assertNotUndefinedAndNotNull(writeStream, "writeStream");
|
|
4636
|
+
return PromiseAsyncResult.create(async () => {
|
|
4637
|
+
let result = 0;
|
|
4638
|
+
if (text) {
|
|
4639
|
+
result += await writeStream.writeString(text);
|
|
4640
|
+
}
|
|
4641
|
+
result += await writeStream.writeString("\n");
|
|
4642
|
+
PostCondition.assertGreaterThan(result, 0, "result");
|
|
4643
|
+
return result;
|
|
4644
|
+
});
|
|
4645
|
+
}
|
|
4646
|
+
};
|
|
4647
|
+
|
|
4648
|
+
// sources/IndentedCharacterWriteStream.ts
|
|
4649
|
+
var IndentedCharacterWriteStream = class _IndentedCharacterWriteStream extends CharacterWriteStream {
|
|
4650
|
+
innerStream;
|
|
4651
|
+
currentIndentationList;
|
|
4652
|
+
currentIndentation;
|
|
4653
|
+
singleIndent;
|
|
4654
|
+
atLineStart;
|
|
4655
|
+
constructor(innerStream) {
|
|
4656
|
+
PreCondition.assertNotUndefinedAndNotNull(innerStream, "innerStream");
|
|
4657
|
+
super();
|
|
4658
|
+
this.innerStream = innerStream;
|
|
4659
|
+
this.currentIndentationList = List.create();
|
|
4660
|
+
this.currentIndentation = "";
|
|
4661
|
+
this.singleIndent = " ";
|
|
4662
|
+
this.atLineStart = true;
|
|
4663
|
+
}
|
|
4664
|
+
static create(innerStream) {
|
|
4665
|
+
return new _IndentedCharacterWriteStream(innerStream);
|
|
4666
|
+
}
|
|
4667
|
+
getSingleIndent() {
|
|
4668
|
+
return this.singleIndent;
|
|
4669
|
+
}
|
|
4670
|
+
setSingleIndent(singleIndent) {
|
|
4671
|
+
PreCondition.assertNotUndefinedAndNotNull(singleIndent, "singleIndent");
|
|
4672
|
+
this.singleIndent = singleIndent;
|
|
4673
|
+
return this;
|
|
4674
|
+
}
|
|
4675
|
+
getCurrentIndentationCount() {
|
|
4676
|
+
return this.currentIndentationList.getCount().await();
|
|
4677
|
+
}
|
|
4678
|
+
getCurrentIndentation() {
|
|
4679
|
+
return this.currentIndentation;
|
|
4680
|
+
}
|
|
4681
|
+
addIndentation(singleIndent) {
|
|
4682
|
+
if (isUndefinedOrNull(singleIndent)) {
|
|
4683
|
+
singleIndent = this.singleIndent;
|
|
4684
|
+
}
|
|
4685
|
+
this.currentIndentationList.add(singleIndent);
|
|
4686
|
+
if (singleIndent) {
|
|
4687
|
+
this.currentIndentation = this.currentIndentation + singleIndent;
|
|
4688
|
+
}
|
|
4689
|
+
return this;
|
|
4690
|
+
}
|
|
4691
|
+
removeIndentation() {
|
|
4692
|
+
PreCondition.assertGreaterThanOrEqualTo(this.getCurrentIndentationCount(), 1, "this.getCurrentIndentationCount()");
|
|
4693
|
+
const result = this.currentIndentationList.removeLast().await();
|
|
4694
|
+
if (result) {
|
|
4695
|
+
this.currentIndentation = this.currentIndentation.substring(0, this.currentIndentation.length - result.length);
|
|
4696
|
+
}
|
|
4697
|
+
return result;
|
|
4698
|
+
}
|
|
4699
|
+
indent(actionOrSingleIndent, action) {
|
|
4700
|
+
let singleIndent;
|
|
4701
|
+
if (isString(actionOrSingleIndent)) {
|
|
4702
|
+
singleIndent = actionOrSingleIndent;
|
|
4703
|
+
action = action;
|
|
4704
|
+
} else {
|
|
4705
|
+
action = actionOrSingleIndent;
|
|
4706
|
+
}
|
|
4707
|
+
PreCondition.assertNotUndefinedAndNotNull(action, "action");
|
|
4708
|
+
return AsyncResult.create(async () => {
|
|
4709
|
+
let result;
|
|
4710
|
+
this.addIndentation(singleIndent);
|
|
4711
|
+
try {
|
|
4712
|
+
result = await action();
|
|
4713
|
+
if (!isNumber(result)) {
|
|
4714
|
+
result = 0;
|
|
4715
|
+
}
|
|
4716
|
+
} finally {
|
|
4717
|
+
this.removeIndentation();
|
|
4718
|
+
}
|
|
4719
|
+
return result;
|
|
4720
|
+
});
|
|
4721
|
+
}
|
|
4722
|
+
writeString(text) {
|
|
4723
|
+
return AsyncResult.create(async () => {
|
|
4724
|
+
let result = 0;
|
|
4725
|
+
const textLength = text.length;
|
|
4726
|
+
let startIndex = 0;
|
|
4727
|
+
while (startIndex < textLength) {
|
|
4728
|
+
const newLineCharacterIndex = text.indexOf("\n", startIndex);
|
|
4729
|
+
const atLineStartAfterWrite = newLineCharacterIndex !== -1;
|
|
4730
|
+
const nextLineStartIndex = atLineStartAfterWrite ? newLineCharacterIndex + 1 : textLength;
|
|
4731
|
+
if (newLineCharacterIndex === startIndex || newLineCharacterIndex === startIndex + 1 && text[startIndex] === "\r") {
|
|
4732
|
+
result += await this.innerStream.writeString(text.substring(startIndex, nextLineStartIndex));
|
|
4733
|
+
startIndex = nextLineStartIndex;
|
|
4734
|
+
} else {
|
|
4735
|
+
if (this.atLineStart && this.currentIndentation) {
|
|
4736
|
+
result += await this.innerStream.writeString(this.currentIndentation);
|
|
4737
|
+
}
|
|
4738
|
+
result += await this.innerStream.writeString(text.substring(startIndex, nextLineStartIndex));
|
|
4739
|
+
startIndex = nextLineStartIndex;
|
|
4740
|
+
}
|
|
4741
|
+
this.atLineStart = atLineStartAfterWrite;
|
|
4742
|
+
}
|
|
4743
|
+
return result;
|
|
4744
|
+
});
|
|
4745
|
+
}
|
|
4746
|
+
};
|
|
4747
|
+
|
|
4748
|
+
// sources/asyncIteratorToJavascriptAsyncIteratorAdapter.ts
|
|
4749
|
+
var AsyncIteratorToJavascriptAsyncIteratorAdapter = class _AsyncIteratorToJavascriptAsyncIteratorAdapter {
|
|
4750
|
+
iterator;
|
|
4751
|
+
hasStarted;
|
|
4752
|
+
constructor(iterator) {
|
|
4753
|
+
PreCondition.assertNotUndefinedAndNotNull(iterator, "iterator");
|
|
4754
|
+
this.iterator = iterator;
|
|
4755
|
+
this.hasStarted = false;
|
|
4756
|
+
}
|
|
4757
|
+
static create(iterator) {
|
|
4758
|
+
return new _AsyncIteratorToJavascriptAsyncIteratorAdapter(iterator);
|
|
4759
|
+
}
|
|
4760
|
+
async next() {
|
|
4761
|
+
if (!this.hasStarted) {
|
|
4762
|
+
this.hasStarted = true;
|
|
4763
|
+
await this.iterator.start();
|
|
4764
|
+
} else {
|
|
4765
|
+
await this.iterator.next();
|
|
4766
|
+
}
|
|
4767
|
+
const result = {
|
|
4768
|
+
done: !this.iterator.hasCurrent(),
|
|
4769
|
+
value: void 0
|
|
4770
|
+
};
|
|
4771
|
+
if (!result.done) {
|
|
4772
|
+
result.value = this.iterator.getCurrent();
|
|
4773
|
+
}
|
|
4774
|
+
return result;
|
|
4775
|
+
}
|
|
4776
|
+
};
|
|
4777
|
+
|
|
4778
|
+
// sources/javascriptAsyncIteratorToAsyncIteratorAdapter.ts
|
|
4779
|
+
var JavascriptAsyncIteratorToAsyncIteratorAdapter = class _JavascriptAsyncIteratorToAsyncIteratorAdapter {
|
|
4780
|
+
javascriptIterator;
|
|
4781
|
+
javascriptIteratorResult;
|
|
4782
|
+
constructor(javascriptIterator) {
|
|
4783
|
+
PreCondition.assertNotUndefinedAndNotNull(javascriptIterator, "javascriptIterator");
|
|
4784
|
+
this.javascriptIterator = javascriptIterator;
|
|
4785
|
+
}
|
|
4786
|
+
static create(javascriptIterator) {
|
|
4787
|
+
if (isJavascriptAsyncIterable(javascriptIterator)) {
|
|
4788
|
+
javascriptIterator = javascriptIterator[Symbol.asyncIterator]();
|
|
4789
|
+
}
|
|
4790
|
+
return new _JavascriptAsyncIteratorToAsyncIteratorAdapter(javascriptIterator);
|
|
4791
|
+
}
|
|
4792
|
+
next() {
|
|
4793
|
+
return PromiseAsyncResult.create(async () => {
|
|
4794
|
+
this.javascriptIteratorResult = await this.javascriptIterator.next();
|
|
4795
|
+
return this.hasCurrent();
|
|
4796
|
+
});
|
|
4797
|
+
}
|
|
4798
|
+
hasStarted() {
|
|
4799
|
+
return this.javascriptIteratorResult !== void 0;
|
|
4800
|
+
}
|
|
4801
|
+
hasCurrent() {
|
|
4802
|
+
return this.javascriptIteratorResult?.done === false;
|
|
4803
|
+
}
|
|
4804
|
+
getCurrent() {
|
|
4805
|
+
PreCondition.assertTrue(this.hasCurrent(), "this.hasCurrent()");
|
|
4806
|
+
return this.javascriptIteratorResult.value;
|
|
4257
4807
|
}
|
|
4258
4808
|
start() {
|
|
4259
4809
|
return AsyncIterator.start(this);
|
|
@@ -4925,30 +5475,6 @@ var AsyncIterator = class _AsyncIterator {
|
|
|
4925
5475
|
}
|
|
4926
5476
|
};
|
|
4927
5477
|
|
|
4928
|
-
// sources/asyncResult.ts
|
|
4929
|
-
var AsyncResult = class {
|
|
4930
|
-
static create(actionOrPromise) {
|
|
4931
|
-
return PromiseAsyncResult.create(isPromise(actionOrPromise) ? actionOrPromise : new Promise(actionOrPromise));
|
|
4932
|
-
}
|
|
4933
|
-
/**
|
|
4934
|
-
* Create a new {@link AsyncResult} that contains the provided value.
|
|
4935
|
-
* @param value The value to wrap in a {@link AsyncResult}.
|
|
4936
|
-
*/
|
|
4937
|
-
static value(value) {
|
|
4938
|
-
return PromiseAsyncResult.value(value);
|
|
4939
|
-
}
|
|
4940
|
-
/**
|
|
4941
|
-
* Create a new {@link AsyncResult} that contains the provided error.
|
|
4942
|
-
* @param error The error to wrap in a {@link AsyncResult}.
|
|
4943
|
-
*/
|
|
4944
|
-
static error(error) {
|
|
4945
|
-
return PromiseAsyncResult.error(error);
|
|
4946
|
-
}
|
|
4947
|
-
static yield() {
|
|
4948
|
-
return PromiseAsyncResult.yield();
|
|
4949
|
-
}
|
|
4950
|
-
};
|
|
4951
|
-
|
|
4952
5478
|
// sources/basicDisposable.ts
|
|
4953
5479
|
var SyncDisposable = class _SyncDisposable {
|
|
4954
5480
|
disposedFunction;
|
|
@@ -5372,315 +5898,64 @@ var CharacterList = class _CharacterList {
|
|
|
5372
5898
|
first(condition) {
|
|
5373
5899
|
return List.first(this, condition);
|
|
5374
5900
|
}
|
|
5375
|
-
last(condition) {
|
|
5376
|
-
return List.last(this, condition);
|
|
5377
|
-
}
|
|
5378
|
-
contains(value, equalFunctions) {
|
|
5379
|
-
return List.contains(this, value, equalFunctions);
|
|
5380
|
-
}
|
|
5381
|
-
[Symbol.iterator]() {
|
|
5382
|
-
return List[Symbol.iterator](this);
|
|
5383
|
-
}
|
|
5384
|
-
};
|
|
5385
|
-
|
|
5386
|
-
// sources/characterReadStream.ts
|
|
5387
|
-
var CharacterReadStream = class _CharacterReadStream {
|
|
5388
|
-
readCharacters(count) {
|
|
5389
|
-
return _CharacterReadStream.readCharacters(this, count);
|
|
5390
|
-
}
|
|
5391
|
-
static readCharacters(readStream, count) {
|
|
5392
|
-
let characters = "";
|
|
5393
|
-
function readUntilCount(countRemaining) {
|
|
5394
|
-
return readStream.readCharacter().then((character) => {
|
|
5395
|
-
characters += character;
|
|
5396
|
-
return countRemaining === 0 ? SyncResult.value(characters) : readUntilCount(countRemaining - 1);
|
|
5397
|
-
});
|
|
5398
|
-
}
|
|
5399
|
-
return readUntilCount(count);
|
|
5400
|
-
}
|
|
5401
|
-
/**
|
|
5402
|
-
* Read characters from this stream until the provided {@link searchString} is found or the end
|
|
5403
|
-
* of the stream is reached. The {@link searchString} will be included in the returned string if
|
|
5404
|
-
* it is found..
|
|
5405
|
-
* @param searchString The string to search for.
|
|
5406
|
-
*/
|
|
5407
|
-
readUntil(searchString) {
|
|
5408
|
-
return _CharacterReadStream.readUntil(this, searchString);
|
|
5409
|
-
}
|
|
5410
|
-
static readUntil(readStream, searchString) {
|
|
5411
|
-
PreCondition.assertNotUndefinedAndNotNull(readStream, "readStream");
|
|
5412
|
-
PreCondition.assertNotEmpty(searchString, "searchString");
|
|
5413
|
-
let characters = "";
|
|
5414
|
-
function readUntilSearchString() {
|
|
5415
|
-
return readStream.readCharacter().then((character) => {
|
|
5416
|
-
characters += character;
|
|
5417
|
-
return characters.endsWith(searchString) ? SyncResult.value(characters) : readUntilSearchString();
|
|
5418
|
-
});
|
|
5419
|
-
}
|
|
5420
|
-
return readUntilSearchString();
|
|
5421
|
-
}
|
|
5422
|
-
/**
|
|
5423
|
-
* Read a sequence of characters from this stream until either a newline character ('\\n') or
|
|
5424
|
-
* the end of the stream is reached. Terminating newline characters will be included in the
|
|
5425
|
-
* returned string.
|
|
5426
|
-
*/
|
|
5427
|
-
readLine() {
|
|
5428
|
-
return _CharacterReadStream.readLine(this);
|
|
5429
|
-
}
|
|
5430
|
-
static readLine(readStream) {
|
|
5431
|
-
PreCondition.assertNotUndefinedAndNotNull(readStream, "readStream");
|
|
5432
|
-
return readStream.readUntil("\n");
|
|
5433
|
-
}
|
|
5434
|
-
};
|
|
5435
|
-
|
|
5436
|
-
// sources/postConditionError.ts
|
|
5437
|
-
var PostConditionError = class extends Error {
|
|
5438
|
-
constructor(...message) {
|
|
5439
|
-
super(join("\n", message));
|
|
5440
|
-
}
|
|
5441
|
-
};
|
|
5442
|
-
|
|
5443
|
-
// sources/postCondition.ts
|
|
5444
|
-
var PostCondition = class _PostCondition {
|
|
5445
|
-
static condition;
|
|
5446
|
-
static getCondition() {
|
|
5447
|
-
if (_PostCondition.condition === void 0) {
|
|
5448
|
-
_PostCondition.condition = MutableCondition.create().setCreateErrorFunction((message) => {
|
|
5449
|
-
return new PostConditionError(message);
|
|
5450
|
-
});
|
|
5451
|
-
}
|
|
5452
|
-
return _PostCondition.condition;
|
|
5453
|
-
}
|
|
5454
|
-
/**
|
|
5455
|
-
* Assert that the provided value is undefined.
|
|
5456
|
-
* @param value The value to check.
|
|
5457
|
-
* @param expression The name of the expression that produced the value.
|
|
5458
|
-
* @param message An additional message that will be included with the error.
|
|
5459
|
-
*/
|
|
5460
|
-
static assertUndefined(value, expression, message) {
|
|
5461
|
-
return _PostCondition.getCondition().assertUndefined(value, expression, message);
|
|
5462
|
-
}
|
|
5463
|
-
/**
|
|
5464
|
-
* Assert that the provided value is not undefined and not null.
|
|
5465
|
-
* @param value The value to check.
|
|
5466
|
-
* @param expression The name of the expression that produced the value.
|
|
5467
|
-
* @param message An additional message that will be included with the error.
|
|
5468
|
-
*/
|
|
5469
|
-
static assertNotUndefined(value, expression, message) {
|
|
5470
|
-
return _PostCondition.getCondition().assertNotUndefined(value, expression, message);
|
|
5471
|
-
}
|
|
5472
|
-
/**
|
|
5473
|
-
* Assert that the provided value is not undefined and not null.
|
|
5474
|
-
* @param value The value to check.
|
|
5475
|
-
* @param expression The name of the expression that produced the value.
|
|
5476
|
-
* @param message An additional message that will be included with the error.
|
|
5477
|
-
*/
|
|
5478
|
-
static assertNotUndefinedAndNotNull(value, expression, message) {
|
|
5479
|
-
return _PostCondition.getCondition().assertNotUndefinedAndNotNull(value, expression, message);
|
|
5480
|
-
}
|
|
5481
|
-
/**
|
|
5482
|
-
* Assert that the provided value is true.
|
|
5483
|
-
* @param value The value to check.
|
|
5484
|
-
* @param expression The name of the expression that produced the value.
|
|
5485
|
-
* @param message An additional message that will be included with the error.
|
|
5486
|
-
*/
|
|
5487
|
-
static assertTrue(value, expression, message) {
|
|
5488
|
-
return _PostCondition.getCondition().assertTrue(value, expression, message);
|
|
5489
|
-
}
|
|
5490
|
-
/**
|
|
5491
|
-
* Assert that the provided value is false.
|
|
5492
|
-
* @param value The value to check.
|
|
5493
|
-
* @param expression The name of the expression that produced the value.
|
|
5494
|
-
* @param message An additional message that will be included with the error.
|
|
5495
|
-
*/
|
|
5496
|
-
static assertFalse(value, expression, message) {
|
|
5497
|
-
return _PostCondition.getCondition().assertFalse(value, expression, message);
|
|
5498
|
-
}
|
|
5499
|
-
/**
|
|
5500
|
-
* Assert that the provided actual value is the same as the provided expected value.
|
|
5501
|
-
* @param expected The expected value.
|
|
5502
|
-
* @param actual The actual value.
|
|
5503
|
-
* @param expression The expression that produced the actual value.
|
|
5504
|
-
* @param message An optional message that describes the scenario.
|
|
5505
|
-
*/
|
|
5506
|
-
static assertSame(expected, actual, expression, message) {
|
|
5507
|
-
return _PostCondition.getCondition().assertSame(expected, actual, expression, message);
|
|
5508
|
-
}
|
|
5509
|
-
/**
|
|
5510
|
-
* Assert that the provided actual value is not the same as the provided expected value.
|
|
5511
|
-
* @param expected The expected value.
|
|
5512
|
-
* @param actual The actual value.
|
|
5513
|
-
* @param expression The expression that produced the actual value.
|
|
5514
|
-
* @param message An optional message that describes the scenario.
|
|
5515
|
-
*/
|
|
5516
|
-
static assertNotSame(expected, actual, expression, message) {
|
|
5517
|
-
return _PostCondition.getCondition().assertNotSame(expected, actual, expression, message);
|
|
5518
|
-
}
|
|
5519
|
-
/**
|
|
5520
|
-
* Assert that the provided actual value is equal to the provided expected value.
|
|
5521
|
-
* @param expected The expected value.
|
|
5522
|
-
* @param actual The actual value.
|
|
5523
|
-
* @param expression The expression that produced the actual value.
|
|
5524
|
-
* @param message An optional message that describes the scenario.
|
|
5525
|
-
*/
|
|
5526
|
-
static assertEqual(expected, actual, expression, message) {
|
|
5527
|
-
return _PostCondition.getCondition().assertEqual(expected, actual, expression, message);
|
|
5528
|
-
}
|
|
5529
|
-
/**
|
|
5530
|
-
* Assert that the provided actual value is not equal to the provided expected value.
|
|
5531
|
-
* @param notExpected The not expected value.
|
|
5532
|
-
* @param actual The actual value.
|
|
5533
|
-
* @param expression The expression that produced the actual value.
|
|
5534
|
-
* @param message An optional message that describes the scenario.
|
|
5535
|
-
*/
|
|
5536
|
-
static assertNotEqual(notExpected, actual, expression, message) {
|
|
5537
|
-
return _PostCondition.getCondition().assertNotEqual(notExpected, actual, expression, message);
|
|
5538
|
-
}
|
|
5539
|
-
/**
|
|
5540
|
-
* Assert that the provided value is not empty.
|
|
5541
|
-
* @param value The value to check.
|
|
5542
|
-
* @param expression The expression that produced the actual value.
|
|
5543
|
-
* @param message An optional message that describes the scenario.
|
|
5544
|
-
*/
|
|
5545
|
-
static assertNotEmpty(value, expression, message) {
|
|
5546
|
-
return _PostCondition.getCondition().assertNotEmpty(value, expression, message);
|
|
5547
|
-
}
|
|
5548
|
-
/**
|
|
5549
|
-
* Assert that the provided value is less than the provided upperBound.
|
|
5550
|
-
* @param value The value to check.
|
|
5551
|
-
* @param upperBound The upperBound that the value must be less than.
|
|
5552
|
-
* @param expression The expression that produced the actual value.
|
|
5553
|
-
* @param message An optional message that describes the scenario.
|
|
5554
|
-
*/
|
|
5555
|
-
static assertLessThan(value, upperBound, expression, message) {
|
|
5556
|
-
return _PostCondition.getCondition().assertLessThan(value, upperBound, expression, message);
|
|
5557
|
-
}
|
|
5558
|
-
/**
|
|
5559
|
-
* Assert that the provided value is less than or equal to the provided upperBound.
|
|
5560
|
-
* @param value The value to check.
|
|
5561
|
-
* @param upperBound The upperBound that the value must be less than.
|
|
5562
|
-
* @param expression The expression that produced the actual value.
|
|
5563
|
-
* @param message An optional message that describes the scenario.
|
|
5564
|
-
*/
|
|
5565
|
-
static assertLessThanOrEqualTo(value, upperBound, expression, message) {
|
|
5566
|
-
return _PostCondition.getCondition().assertLessThanOrEqualTo(value, upperBound, expression, message);
|
|
5567
|
-
}
|
|
5568
|
-
/**
|
|
5569
|
-
* Assert that the provided value is greater than or equal to the provided lowerBound.
|
|
5570
|
-
* @param value The value to check.
|
|
5571
|
-
* @param lowerBound The lowerBound that the value must be greater than or equal to.
|
|
5572
|
-
* @param expression The expression that produced the actual value.
|
|
5573
|
-
* @param message An optional message that describes the scenario.
|
|
5574
|
-
*/
|
|
5575
|
-
static assertGreaterThanOrEqualTo(value, lowerBound, expression, message) {
|
|
5576
|
-
return _PostCondition.getCondition().assertGreaterThanOrEqualTo(value, lowerBound, expression, message);
|
|
5577
|
-
}
|
|
5578
|
-
/**
|
|
5579
|
-
* Assert that the provided value is greater than the provided lowerBound.
|
|
5580
|
-
* @param value The value to check.
|
|
5581
|
-
* @param lowerBound The lowerBound that the value must be greater than.
|
|
5582
|
-
* @param expression The expression that produced the actual value.
|
|
5583
|
-
* @param message An optional message that describes the scenario.
|
|
5584
|
-
*/
|
|
5585
|
-
static assertGreaterThan(value, lowerBound, expression, message) {
|
|
5586
|
-
return _PostCondition.getCondition().assertGreaterThan(value, lowerBound, expression, message);
|
|
5587
|
-
}
|
|
5588
|
-
/**
|
|
5589
|
-
* Assert that the value is greater than or equal to the lowerBound and less than or equal to
|
|
5590
|
-
* the upperBound.
|
|
5591
|
-
* @param lowerBound The lowerBound that the value must be greater than or equal to.
|
|
5592
|
-
* @param value The value to check.
|
|
5593
|
-
* @param upperBound The upperBound that the value must be less than or equal to.
|
|
5594
|
-
* @param expression The expression that produced the actual value.
|
|
5595
|
-
* @param message An optional message that describes the scenario.
|
|
5596
|
-
*/
|
|
5597
|
-
static assertBetween(lowerBound, value, upperBound, expression, message) {
|
|
5598
|
-
return _PostCondition.getCondition().assertBetween(lowerBound, value, upperBound, expression, message);
|
|
5599
|
-
}
|
|
5600
|
-
/**
|
|
5601
|
-
* Assert that the index is within the access bounds of an indexable with the provided count.
|
|
5602
|
-
* @param index The index to check.
|
|
5603
|
-
* @param count The number of elements in the indexable.
|
|
5604
|
-
* @param expression The expression that produced the actual value.
|
|
5605
|
-
* @param message An optional message that describes the scenario.
|
|
5606
|
-
*/
|
|
5607
|
-
static assertAccessIndex(index, count, expression, message) {
|
|
5608
|
-
return _PostCondition.getCondition().assertAccessIndex(index, count, expression, message);
|
|
5901
|
+
last(condition) {
|
|
5902
|
+
return List.last(this, condition);
|
|
5609
5903
|
}
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
* @param index The index to check.
|
|
5613
|
-
* @param count The number of elements in the indexable.
|
|
5614
|
-
* @param expression The expression that produced the actual value.
|
|
5615
|
-
* @param message An optional message that describes the scenario.
|
|
5616
|
-
*/
|
|
5617
|
-
static assertInsertIndex(index, count, expression, message) {
|
|
5618
|
-
return _PostCondition.getCondition().assertInsertIndex(index, count, expression, message);
|
|
5904
|
+
contains(value, equalFunctions) {
|
|
5905
|
+
return List.contains(this, value, equalFunctions);
|
|
5619
5906
|
}
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
* @param possibilities The possible values that the value can be.
|
|
5623
|
-
* @param value The value to check.
|
|
5624
|
-
* @param expression The expression that produced the value.
|
|
5625
|
-
* @param message An optional error message.
|
|
5626
|
-
*/
|
|
5627
|
-
static assertOneOf(possibilities, value, expression, message) {
|
|
5628
|
-
return _PostCondition.getCondition().assertOneOf(possibilities, value, expression, message);
|
|
5907
|
+
[Symbol.iterator]() {
|
|
5908
|
+
return List[Symbol.iterator](this);
|
|
5629
5909
|
}
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
static assertByte(value, expression, message) {
|
|
5637
|
-
return _PostCondition.getCondition().assertByte(value, expression, message);
|
|
5910
|
+
};
|
|
5911
|
+
|
|
5912
|
+
// sources/characterReadStream.ts
|
|
5913
|
+
var CharacterReadStream = class _CharacterReadStream {
|
|
5914
|
+
readCharacters(count) {
|
|
5915
|
+
return _CharacterReadStream.readCharacters(this, count);
|
|
5638
5916
|
}
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5917
|
+
static readCharacters(readStream, count) {
|
|
5918
|
+
let characters = "";
|
|
5919
|
+
function readUntilCount(countRemaining) {
|
|
5920
|
+
return readStream.readCharacter().then((character) => {
|
|
5921
|
+
characters += character;
|
|
5922
|
+
return countRemaining === 0 ? SyncResult.value(characters) : readUntilCount(countRemaining - 1);
|
|
5923
|
+
});
|
|
5924
|
+
}
|
|
5925
|
+
return readUntilCount(count);
|
|
5647
5926
|
}
|
|
5648
5927
|
/**
|
|
5649
|
-
*
|
|
5650
|
-
*
|
|
5651
|
-
*
|
|
5652
|
-
* @param
|
|
5928
|
+
* Read characters from this stream until the provided {@link searchString} is found or the end
|
|
5929
|
+
* of the stream is reached. The {@link searchString} will be included in the returned string if
|
|
5930
|
+
* it is found..
|
|
5931
|
+
* @param searchString The string to search for.
|
|
5653
5932
|
*/
|
|
5654
|
-
|
|
5655
|
-
return
|
|
5933
|
+
readUntil(searchString) {
|
|
5934
|
+
return _CharacterReadStream.readUntil(this, searchString);
|
|
5656
5935
|
}
|
|
5657
|
-
|
|
5658
|
-
|
|
5936
|
+
static readUntil(readStream, searchString) {
|
|
5937
|
+
PreCondition.assertNotUndefinedAndNotNull(readStream, "readStream");
|
|
5938
|
+
PreCondition.assertNotEmpty(searchString, "searchString");
|
|
5939
|
+
let characters = "";
|
|
5940
|
+
function readUntilSearchString() {
|
|
5941
|
+
return readStream.readCharacter().then((character) => {
|
|
5942
|
+
characters += character;
|
|
5943
|
+
return characters.endsWith(searchString) ? SyncResult.value(characters) : readUntilSearchString();
|
|
5944
|
+
});
|
|
5945
|
+
}
|
|
5946
|
+
return readUntilSearchString();
|
|
5659
5947
|
}
|
|
5660
|
-
};
|
|
5661
|
-
|
|
5662
|
-
// sources/characterWriteStream.ts
|
|
5663
|
-
var CharacterWriteStream = class _CharacterWriteStream {
|
|
5664
5948
|
/**
|
|
5665
|
-
*
|
|
5666
|
-
*
|
|
5667
|
-
*
|
|
5668
|
-
* @returns The number of characters that were written.
|
|
5949
|
+
* Read a sequence of characters from this stream until either a newline character ('\\n') or
|
|
5950
|
+
* the end of the stream is reached. Terminating newline characters will be included in the
|
|
5951
|
+
* returned string.
|
|
5669
5952
|
*/
|
|
5670
|
-
|
|
5671
|
-
return
|
|
5953
|
+
readLine() {
|
|
5954
|
+
return _CharacterReadStream.readLine(this);
|
|
5672
5955
|
}
|
|
5673
|
-
static
|
|
5674
|
-
PreCondition.assertNotUndefinedAndNotNull(
|
|
5675
|
-
return
|
|
5676
|
-
let result = 0;
|
|
5677
|
-
if (text) {
|
|
5678
|
-
result += await writeStream.writeString(text);
|
|
5679
|
-
}
|
|
5680
|
-
result += await writeStream.writeString("\n");
|
|
5681
|
-
PostCondition.assertGreaterThan(result, 0, "result");
|
|
5682
|
-
return result;
|
|
5683
|
-
});
|
|
5956
|
+
static readLine(readStream) {
|
|
5957
|
+
PreCondition.assertNotUndefinedAndNotNull(readStream, "readStream");
|
|
5958
|
+
return readStream.readUntil("\n");
|
|
5684
5959
|
}
|
|
5685
5960
|
};
|
|
5686
5961
|
|
|
@@ -5846,51 +6121,166 @@ var CharacterReadStreamAsyncIterator = class _CharacterReadStreamAsyncIterator {
|
|
|
5846
6121
|
}
|
|
5847
6122
|
};
|
|
5848
6123
|
|
|
5849
|
-
// sources/
|
|
5850
|
-
|
|
6124
|
+
// sources/english.ts
|
|
6125
|
+
function andList(values) {
|
|
6126
|
+
return list("and", values);
|
|
6127
|
+
}
|
|
6128
|
+
function orList(values) {
|
|
6129
|
+
return list("or", values);
|
|
6130
|
+
}
|
|
6131
|
+
function list(conjunction, values) {
|
|
6132
|
+
PreCondition.assertNotEmpty(conjunction, "conjunction");
|
|
6133
|
+
PreCondition.assertNotUndefinedAndNotNull(values, "values");
|
|
6134
|
+
let result = "";
|
|
6135
|
+
let index = 0;
|
|
6136
|
+
const iterator = Iterator.create(values).start().await();
|
|
6137
|
+
while (iterator.hasCurrent()) {
|
|
6138
|
+
const currentValue = iterator.takeCurrent().await();
|
|
6139
|
+
if (index >= 1) {
|
|
6140
|
+
if (iterator.hasCurrent()) {
|
|
6141
|
+
result += `, `;
|
|
6142
|
+
} else {
|
|
6143
|
+
if (index >= 2) {
|
|
6144
|
+
result += `,`;
|
|
6145
|
+
}
|
|
6146
|
+
result += ` ${conjunction} `;
|
|
6147
|
+
}
|
|
6148
|
+
}
|
|
6149
|
+
result += currentValue;
|
|
6150
|
+
index++;
|
|
6151
|
+
}
|
|
6152
|
+
return result;
|
|
6153
|
+
}
|
|
6154
|
+
|
|
6155
|
+
// sources/commandLineParameters.ts
|
|
6156
|
+
var CommandLineParameters = class _CommandLineParameters {
|
|
6157
|
+
args;
|
|
6158
|
+
parameters;
|
|
6159
|
+
constructor(argv) {
|
|
6160
|
+
PreCondition.assertNotUndefinedAndNotNull(argv, "argv");
|
|
6161
|
+
this.args = isIterable(argv) ? argv : Iterable.create(argv);
|
|
6162
|
+
this.parameters = List.create();
|
|
6163
|
+
}
|
|
6164
|
+
static create(args) {
|
|
6165
|
+
return new _CommandLineParameters(args);
|
|
6166
|
+
}
|
|
6167
|
+
static getArgumentName(arg) {
|
|
6168
|
+
return arg[0] === "-" ? arg.substring(arg[1] === "-" ? 2 : 1) : void 0;
|
|
6169
|
+
}
|
|
6170
|
+
getArguments() {
|
|
6171
|
+
return this.args;
|
|
6172
|
+
}
|
|
5851
6173
|
/**
|
|
5852
|
-
*
|
|
6174
|
+
* Get the value of the first argument that matches one of the provided names.
|
|
6175
|
+
* @param names The possible names to look for.
|
|
5853
6176
|
*/
|
|
6177
|
+
getNamedArgumentStringValue(nameOrNames) {
|
|
6178
|
+
PreCondition.assertNotEmpty(nameOrNames, "nameOrNames");
|
|
6179
|
+
return SyncResult.create(() => {
|
|
6180
|
+
let foundArgName = false;
|
|
6181
|
+
let result;
|
|
6182
|
+
if (isString(nameOrNames)) {
|
|
6183
|
+
nameOrNames = [nameOrNames];
|
|
6184
|
+
}
|
|
6185
|
+
const searchNames = Iterable.create(nameOrNames);
|
|
6186
|
+
for (const arg of this.args) {
|
|
6187
|
+
if (!foundArgName) {
|
|
6188
|
+
const argName = _CommandLineParameters.getArgumentName(arg);
|
|
6189
|
+
foundArgName = !!(argName && searchNames.contains(argName));
|
|
6190
|
+
} else {
|
|
6191
|
+
result = arg;
|
|
6192
|
+
break;
|
|
6193
|
+
}
|
|
6194
|
+
}
|
|
6195
|
+
if (result === void 0) {
|
|
6196
|
+
const toStringFunctions = ToStringFunctions.create();
|
|
6197
|
+
throw new NotFoundError(`No argument found that matches ${orList(searchNames.map((n) => toStringFunctions.toString(n)))}.`);
|
|
6198
|
+
}
|
|
6199
|
+
return result;
|
|
6200
|
+
});
|
|
6201
|
+
}
|
|
6202
|
+
nameOrAliasExists(nameOrAlias) {
|
|
6203
|
+
PreCondition.assertNotEmpty(nameOrAlias, "nameOrAlias");
|
|
6204
|
+
let result = false;
|
|
6205
|
+
for (const parameter of this.parameters) {
|
|
6206
|
+
if (parameter.getNameAndAliases().contains(nameOrAlias).await()) {
|
|
6207
|
+
result = true;
|
|
6208
|
+
break;
|
|
6209
|
+
}
|
|
6210
|
+
}
|
|
6211
|
+
return result;
|
|
6212
|
+
}
|
|
6213
|
+
add(name) {
|
|
6214
|
+
const result = CommandLineParameter.create({
|
|
6215
|
+
owner: this,
|
|
6216
|
+
name
|
|
6217
|
+
});
|
|
6218
|
+
this.parameters.add(result);
|
|
6219
|
+
return result;
|
|
6220
|
+
}
|
|
6221
|
+
};
|
|
6222
|
+
|
|
6223
|
+
// sources/commandLineParameter.ts
|
|
6224
|
+
var CommandLineParameter = class _CommandLineParameter {
|
|
6225
|
+
owner;
|
|
5854
6226
|
name;
|
|
5855
|
-
|
|
5856
|
-
* The description for this {@link CommandLineParameter}.
|
|
5857
|
-
*/
|
|
6227
|
+
aliases;
|
|
5858
6228
|
description;
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
6229
|
+
constructor(owner, name) {
|
|
6230
|
+
PreCondition.assertNotUndefinedAndNotNull(owner, "owner");
|
|
6231
|
+
PreCondition.assertNotEmpty(name, "name");
|
|
6232
|
+
PreCondition.assertFalse(owner.nameOrAliasExists(name), "owner.nameOrAliasExists(name)");
|
|
6233
|
+
this.owner = owner;
|
|
5864
6234
|
this.name = name;
|
|
5865
|
-
this.description = description;
|
|
5866
|
-
this.valueGetter = valueGetter;
|
|
5867
6235
|
}
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
6236
|
+
static create(ownerOrProperties, name) {
|
|
6237
|
+
let owner;
|
|
6238
|
+
if (ownerOrProperties instanceof CommandLineParameters) {
|
|
6239
|
+
owner = ownerOrProperties;
|
|
6240
|
+
name = name;
|
|
6241
|
+
} else {
|
|
6242
|
+
owner = ownerOrProperties.owner;
|
|
6243
|
+
name = ownerOrProperties.name;
|
|
6244
|
+
}
|
|
6245
|
+
return new _CommandLineParameter(owner, name);
|
|
5877
6246
|
}
|
|
5878
6247
|
/**
|
|
5879
|
-
* Get the
|
|
6248
|
+
* Get the name of this {@link CommandLineParameter}.
|
|
5880
6249
|
*/
|
|
5881
|
-
|
|
5882
|
-
return this.
|
|
6250
|
+
getName() {
|
|
6251
|
+
return this.name;
|
|
5883
6252
|
}
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
// sources/commandLineParameters.ts
|
|
5887
|
-
var CommandLineParameters = class _CommandLineParameters {
|
|
5888
|
-
args;
|
|
5889
|
-
constructor(argv) {
|
|
5890
|
-
this.args = argv;
|
|
6253
|
+
getAliases() {
|
|
6254
|
+
return this.aliases ?? Iterable.create();
|
|
5891
6255
|
}
|
|
5892
|
-
|
|
5893
|
-
return
|
|
6256
|
+
nameOrAliasExists(nameOrAlias) {
|
|
6257
|
+
return this.owner.nameOrAliasExists(nameOrAlias);
|
|
6258
|
+
}
|
|
6259
|
+
addAlias(alias) {
|
|
6260
|
+
PreCondition.assertNotEmpty(alias, "alias");
|
|
6261
|
+
PreCondition.assertFalse(this.nameOrAliasExists(alias), "this.nameOrAliasExists(alias)");
|
|
6262
|
+
if (this.aliases === void 0) {
|
|
6263
|
+
this.aliases = List.create();
|
|
6264
|
+
}
|
|
6265
|
+
this.aliases.add(alias);
|
|
6266
|
+
return this;
|
|
6267
|
+
}
|
|
6268
|
+
addAliases(aliases) {
|
|
6269
|
+
for (const alias of aliases) {
|
|
6270
|
+
this.addAlias(alias);
|
|
6271
|
+
}
|
|
6272
|
+
return this;
|
|
6273
|
+
}
|
|
6274
|
+
getNameAndAliases() {
|
|
6275
|
+
return List.create().add(this.getName()).addAll(this.getAliases());
|
|
6276
|
+
}
|
|
6277
|
+
getDescription() {
|
|
6278
|
+
return this.description ?? "";
|
|
6279
|
+
}
|
|
6280
|
+
setDescription(description) {
|
|
6281
|
+
PreCondition.assertNotUndefinedAndNotNull(description, "description");
|
|
6282
|
+
this.description = description;
|
|
6283
|
+
return this;
|
|
5894
6284
|
}
|
|
5895
6285
|
};
|
|
5896
6286
|
|
|
@@ -6818,14 +7208,14 @@ var CurrentProcess = class _CurrentProcess {
|
|
|
6818
7208
|
}
|
|
6819
7209
|
getArguments() {
|
|
6820
7210
|
if (!this.args) {
|
|
6821
|
-
this.args = process.argv;
|
|
7211
|
+
this.args = Iterable.create(process.argv);
|
|
6822
7212
|
}
|
|
6823
7213
|
return this.args;
|
|
6824
7214
|
}
|
|
6825
7215
|
setArguments(args) {
|
|
6826
7216
|
PreCondition.assertNotUndefinedAndNotNull(args, "args");
|
|
6827
7217
|
PreCondition.assertUndefined(this.parameters, "this.parameters");
|
|
6828
|
-
this.args = args;
|
|
7218
|
+
this.args = isIterable(args) ? args : Iterable.create(args);
|
|
6829
7219
|
return this;
|
|
6830
7220
|
}
|
|
6831
7221
|
getParameters() {
|
|
@@ -7038,6 +7428,9 @@ var ListStack = class _ListStack {
|
|
|
7038
7428
|
any() {
|
|
7039
7429
|
return this.list.any();
|
|
7040
7430
|
}
|
|
7431
|
+
getCount() {
|
|
7432
|
+
return this.list.getCount();
|
|
7433
|
+
}
|
|
7041
7434
|
add(value) {
|
|
7042
7435
|
return SyncResult.create(() => {
|
|
7043
7436
|
this.list.add(value);
|
|
@@ -7084,7 +7477,7 @@ var DepthFirstSearch = class _DepthFirstSearch {
|
|
|
7084
7477
|
started;
|
|
7085
7478
|
done;
|
|
7086
7479
|
constructor(initialToVisit, searchAction) {
|
|
7087
|
-
PreCondition.
|
|
7480
|
+
PreCondition.assertNotUndefinedAndNotNull(initialToVisit, "initialToVisit");
|
|
7088
7481
|
PreCondition.assertNotUndefinedAndNotNull(searchAction, "searchAction");
|
|
7089
7482
|
this.searchAction = searchAction;
|
|
7090
7483
|
this.toVisit = Stack.create();
|
|
@@ -7226,37 +7619,6 @@ var Disposable = class {
|
|
|
7226
7619
|
}
|
|
7227
7620
|
};
|
|
7228
7621
|
|
|
7229
|
-
// sources/english.ts
|
|
7230
|
-
function andList(values) {
|
|
7231
|
-
return list("and", values);
|
|
7232
|
-
}
|
|
7233
|
-
function orList(values) {
|
|
7234
|
-
return list("or", values);
|
|
7235
|
-
}
|
|
7236
|
-
function list(conjunction, values) {
|
|
7237
|
-
PreCondition.assertNotEmpty(conjunction, "conjunction");
|
|
7238
|
-
PreCondition.assertNotUndefinedAndNotNull(values, "values");
|
|
7239
|
-
let result = "";
|
|
7240
|
-
let index = 0;
|
|
7241
|
-
const iterator = Iterator.create(values).start().await();
|
|
7242
|
-
while (iterator.hasCurrent()) {
|
|
7243
|
-
const currentValue = iterator.takeCurrent().await();
|
|
7244
|
-
if (index >= 1) {
|
|
7245
|
-
if (iterator.hasCurrent()) {
|
|
7246
|
-
result += `, `;
|
|
7247
|
-
} else {
|
|
7248
|
-
if (index >= 2) {
|
|
7249
|
-
result += `,`;
|
|
7250
|
-
}
|
|
7251
|
-
result += ` ${conjunction} `;
|
|
7252
|
-
}
|
|
7253
|
-
}
|
|
7254
|
-
result += currentValue;
|
|
7255
|
-
index++;
|
|
7256
|
-
}
|
|
7257
|
-
return result;
|
|
7258
|
-
}
|
|
7259
|
-
|
|
7260
7622
|
// sources/generator.ts
|
|
7261
7623
|
var InnerGeneratorControl = class _InnerGeneratorControl {
|
|
7262
7624
|
returnValues;
|
|
@@ -8844,6 +9206,7 @@ var WonderlandTrailClient = class _WonderlandTrailClient {
|
|
|
8844
9206
|
};
|
|
8845
9207
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8846
9208
|
0 && (module.exports = {
|
|
9209
|
+
ANSIStyles,
|
|
8847
9210
|
AsyncIterator,
|
|
8848
9211
|
AsyncIteratorToJavascriptAsyncIteratorAdapter,
|
|
8849
9212
|
AsyncResult,
|
|
@@ -8856,6 +9219,7 @@ var WonderlandTrailClient = class _WonderlandTrailClient {
|
|
|
8856
9219
|
CharacterListStream,
|
|
8857
9220
|
CharacterReadStream,
|
|
8858
9221
|
CharacterReadStreamAsyncIterator,
|
|
9222
|
+
CharacterTable,
|
|
8859
9223
|
CharacterWriteStream,
|
|
8860
9224
|
CommandLineParameter,
|
|
8861
9225
|
CommandLineParameters,
|
|
@@ -8885,6 +9249,8 @@ var WonderlandTrailClient = class _WonderlandTrailClient {
|
|
|
8885
9249
|
HttpOutgoingResponse,
|
|
8886
9250
|
HttpServer,
|
|
8887
9251
|
InMemoryCharacterWriteStream,
|
|
9252
|
+
IndentedCharacterWriteStream,
|
|
9253
|
+
Indexable,
|
|
8888
9254
|
Iterable,
|
|
8889
9255
|
Iterator,
|
|
8890
9256
|
IteratorToJavascriptIteratorAdapter,
|
|
@@ -9004,4 +9370,4 @@ var WonderlandTrailClient = class _WonderlandTrailClient {
|
|
|
9004
9370
|
quote,
|
|
9005
9371
|
toString
|
|
9006
9372
|
});
|
|
9007
|
-
//# sourceMappingURL=
|
|
9373
|
+
//# sourceMappingURL=sourceIndex.cjs.map
|