@everyonesoftware/common 10.0.0 → 12.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 → characterWriteStream-CzPcNOCD.d.cts} +115 -68
- package/outputs/{characterWriteStream-ogvZec-U.d.ts → characterWriteStream-CzPcNOCD.d.ts} +115 -68
- package/outputs/{chunk-TPV4JEMM.js → chunk-FZ3WRQ7B.js} +2 -2
- package/outputs/chunk-FZ3WRQ7B.js.map +1 -0
- package/outputs/{chunk-OYMWB5SX.js → chunk-MHMLVX2O.js} +4877 -4561
- package/outputs/chunk-MHMLVX2O.js.map +1 -0
- package/outputs/sourceIndex.cjs +4500 -4176
- package/outputs/sourceIndex.cjs.map +1 -1
- package/outputs/sourceIndex.d.cts +320 -210
- package/outputs/sourceIndex.d.ts +320 -210
- package/outputs/sourceIndex.js +17 -1
- package/outputs/testIndex.cjs +754 -454
- package/outputs/testIndex.cjs.map +1 -1
- package/outputs/testIndex.d.cts +22 -2
- package/outputs/testIndex.d.ts +22 -2
- package/outputs/testIndex.js +31 -2
- package/outputs/testIndex.js.map +1 -1
- package/outputs/tests.cjs +3039 -2576
- package/outputs/tests.cjs.map +1 -1
- package/outputs/tests.js +2464 -2303
- package/outputs/tests.js.map +1 -1
- package/package.json +1 -1
- package/outputs/chunk-OYMWB5SX.js.map +0 -1
- package/outputs/chunk-TPV4JEMM.js.map +0 -1
package/outputs/testIndex.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(tests_exports, {
|
|
|
34
34
|
BasicTestSkip: () => BasicTestSkip,
|
|
35
35
|
ConsoleTestRunner: () => ConsoleTestRunner,
|
|
36
36
|
FailedTest: () => FailedTest,
|
|
37
|
+
FakeClock: () => FakeClock,
|
|
37
38
|
SkippedTest: () => SkippedTest,
|
|
38
39
|
Test: () => Test,
|
|
39
40
|
TestAction: () => TestAction,
|
|
@@ -1505,11 +1506,9 @@ var Iterator = class _Iterator {
|
|
|
1505
1506
|
PreCondition.assertNotUndefinedAndNotNull(iterator, "iterator");
|
|
1506
1507
|
return SyncResult.create(() => {
|
|
1507
1508
|
const result = [];
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
while (iterator.next().await()) {
|
|
1512
|
-
result.push(iterator.getCurrent());
|
|
1509
|
+
iterator.start().await();
|
|
1510
|
+
while (iterator.hasCurrent()) {
|
|
1511
|
+
result.push(iterator.takeCurrent().await());
|
|
1513
1512
|
}
|
|
1514
1513
|
return result;
|
|
1515
1514
|
});
|
|
@@ -4167,6 +4166,184 @@ var ANSIStyles = class {
|
|
|
4167
4166
|
}
|
|
4168
4167
|
};
|
|
4169
4168
|
|
|
4169
|
+
// sources/luxonDateTime.ts
|
|
4170
|
+
var luxon = __toESM(require("luxon"), 1);
|
|
4171
|
+
var pctTimeZone = "America/Los_Angeles";
|
|
4172
|
+
var LuxonDateTime = class _LuxonDateTime {
|
|
4173
|
+
dateTime;
|
|
4174
|
+
constructor(dateTime) {
|
|
4175
|
+
this.dateTime = dateTime;
|
|
4176
|
+
}
|
|
4177
|
+
static create(dateTime) {
|
|
4178
|
+
return new _LuxonDateTime(dateTime);
|
|
4179
|
+
}
|
|
4180
|
+
static parse(text) {
|
|
4181
|
+
return _LuxonDateTime.create(luxon.DateTime.fromISO(text, { zone: pctTimeZone }));
|
|
4182
|
+
}
|
|
4183
|
+
static now() {
|
|
4184
|
+
return _LuxonDateTime.create(luxon.DateTime.now().setZone(pctTimeZone));
|
|
4185
|
+
}
|
|
4186
|
+
getYear() {
|
|
4187
|
+
return this.dateTime.year;
|
|
4188
|
+
}
|
|
4189
|
+
getMonth() {
|
|
4190
|
+
return this.dateTime.month;
|
|
4191
|
+
}
|
|
4192
|
+
getDay() {
|
|
4193
|
+
return this.dateTime.day;
|
|
4194
|
+
}
|
|
4195
|
+
getHour() {
|
|
4196
|
+
return this.dateTime.hour;
|
|
4197
|
+
}
|
|
4198
|
+
getMinute() {
|
|
4199
|
+
return this.dateTime.minute;
|
|
4200
|
+
}
|
|
4201
|
+
getSecond() {
|
|
4202
|
+
return this.dateTime.second;
|
|
4203
|
+
}
|
|
4204
|
+
addDays(days) {
|
|
4205
|
+
return _LuxonDateTime.create(this.dateTime.plus({ days }));
|
|
4206
|
+
}
|
|
4207
|
+
toString() {
|
|
4208
|
+
return this.dateTime.toISO();
|
|
4209
|
+
}
|
|
4210
|
+
toDateString() {
|
|
4211
|
+
return this.dateTime.toISODate();
|
|
4212
|
+
}
|
|
4213
|
+
compareTo(dateTime, compareTimes) {
|
|
4214
|
+
return DateTime2.compareTo(this, dateTime, compareTimes);
|
|
4215
|
+
}
|
|
4216
|
+
lessThan(dateTime, compareTimes) {
|
|
4217
|
+
return DateTime2.lessThan(this, dateTime, compareTimes);
|
|
4218
|
+
}
|
|
4219
|
+
lessThanOrEqualTo(dateTime, compareTimes) {
|
|
4220
|
+
return DateTime2.lessThanOrEqualTo(this, dateTime, compareTimes);
|
|
4221
|
+
}
|
|
4222
|
+
equals(dateTime, compareTimes) {
|
|
4223
|
+
return DateTime2.equals(this, dateTime, compareTimes);
|
|
4224
|
+
}
|
|
4225
|
+
greaterThanOrEqualTo(dateTime, compareTimes) {
|
|
4226
|
+
return DateTime2.greaterThanOrEqualTo(this, dateTime, compareTimes);
|
|
4227
|
+
}
|
|
4228
|
+
greaterThan(dateTime, compareTimes) {
|
|
4229
|
+
return DateTime2.greaterThan(this, dateTime, compareTimes);
|
|
4230
|
+
}
|
|
4231
|
+
get debug() {
|
|
4232
|
+
return DateTime2.debug(this);
|
|
4233
|
+
}
|
|
4234
|
+
};
|
|
4235
|
+
|
|
4236
|
+
// sources/dateTime.ts
|
|
4237
|
+
var DateTime2 = class _DateTime {
|
|
4238
|
+
static parse(text) {
|
|
4239
|
+
return LuxonDateTime.parse(text);
|
|
4240
|
+
}
|
|
4241
|
+
static now() {
|
|
4242
|
+
return LuxonDateTime.now();
|
|
4243
|
+
}
|
|
4244
|
+
/**
|
|
4245
|
+
* Compare this {@link DateTime} to the provided {@link DateTime}. If this {@link DateTime} is
|
|
4246
|
+
* less than the provided {@link DateTime}, then a negative number will be returned, 0 if
|
|
4247
|
+
* they're equal, or a positive number if this {@link DateTime} is greater than the provided
|
|
4248
|
+
* {@link DateTime}.
|
|
4249
|
+
* @param dateTime The {@link DateTime} to compare to this {@link DateTime}.
|
|
4250
|
+
*/
|
|
4251
|
+
compareTo(dateTime, compareTimes) {
|
|
4252
|
+
return _DateTime.compareTo(this, dateTime, compareTimes);
|
|
4253
|
+
}
|
|
4254
|
+
static compareTo(left, right, compareTimes) {
|
|
4255
|
+
let result = left.getYear() - right.getYear();
|
|
4256
|
+
if (result === 0) {
|
|
4257
|
+
result = left.getMonth() - right.getMonth();
|
|
4258
|
+
if (result === 0) {
|
|
4259
|
+
result = left.getDay() - right.getDay();
|
|
4260
|
+
if (compareTimes && result === 0) {
|
|
4261
|
+
result = left.getHour() - right.getHour();
|
|
4262
|
+
if (result === 0) {
|
|
4263
|
+
result = left.getMinute() - right.getMinute();
|
|
4264
|
+
if (result === 0) {
|
|
4265
|
+
result = left.getSecond();
|
|
4266
|
+
-right.getSecond();
|
|
4267
|
+
}
|
|
4268
|
+
}
|
|
4269
|
+
}
|
|
4270
|
+
}
|
|
4271
|
+
}
|
|
4272
|
+
return result;
|
|
4273
|
+
}
|
|
4274
|
+
lessThan(dateTime, compareTimes) {
|
|
4275
|
+
return _DateTime.lessThan(this, dateTime, compareTimes);
|
|
4276
|
+
}
|
|
4277
|
+
static lessThan(left, right, compareTimes) {
|
|
4278
|
+
return left.compareTo(right, compareTimes) < 0;
|
|
4279
|
+
}
|
|
4280
|
+
lessThanOrEqualTo(dateTime, compareTimes) {
|
|
4281
|
+
return _DateTime.lessThanOrEqualTo(this, dateTime, compareTimes);
|
|
4282
|
+
}
|
|
4283
|
+
static lessThanOrEqualTo(left, right, compareTimes) {
|
|
4284
|
+
return left.compareTo(right, compareTimes) <= 0;
|
|
4285
|
+
}
|
|
4286
|
+
equals(dateTime, compareTimes) {
|
|
4287
|
+
return _DateTime.equals(this, dateTime, compareTimes);
|
|
4288
|
+
}
|
|
4289
|
+
static equals(left, right, compareTimes) {
|
|
4290
|
+
return left.compareTo(right, compareTimes) === 0;
|
|
4291
|
+
}
|
|
4292
|
+
greaterThanOrEqualTo(dateTime, compareTimes) {
|
|
4293
|
+
return _DateTime.greaterThanOrEqualTo(this, dateTime, compareTimes);
|
|
4294
|
+
}
|
|
4295
|
+
static greaterThanOrEqualTo(left, right, compareTimes) {
|
|
4296
|
+
return left.compareTo(right, compareTimes) >= 0;
|
|
4297
|
+
}
|
|
4298
|
+
greaterThan(dateTime, compareTimes) {
|
|
4299
|
+
return _DateTime.greaterThan(this, dateTime, compareTimes);
|
|
4300
|
+
}
|
|
4301
|
+
static greaterThan(left, right, compareTimes) {
|
|
4302
|
+
return left.compareTo(right, compareTimes) > 0;
|
|
4303
|
+
}
|
|
4304
|
+
get debug() {
|
|
4305
|
+
return _DateTime.debug(this);
|
|
4306
|
+
}
|
|
4307
|
+
static debug(dateTime) {
|
|
4308
|
+
return dateTime.toString();
|
|
4309
|
+
}
|
|
4310
|
+
};
|
|
4311
|
+
|
|
4312
|
+
// sources/RealClock.ts
|
|
4313
|
+
var RealClock = class _RealClock {
|
|
4314
|
+
constructor() {
|
|
4315
|
+
}
|
|
4316
|
+
static create() {
|
|
4317
|
+
return new _RealClock();
|
|
4318
|
+
}
|
|
4319
|
+
now() {
|
|
4320
|
+
return DateTime2.now();
|
|
4321
|
+
}
|
|
4322
|
+
};
|
|
4323
|
+
|
|
4324
|
+
// sources/Clock.ts
|
|
4325
|
+
var Clock = class {
|
|
4326
|
+
static create() {
|
|
4327
|
+
return RealClock.create();
|
|
4328
|
+
}
|
|
4329
|
+
};
|
|
4330
|
+
|
|
4331
|
+
// sources/FetchError.ts
|
|
4332
|
+
var FetchError = class extends Error {
|
|
4333
|
+
innerError;
|
|
4334
|
+
constructor(innerError) {
|
|
4335
|
+
PreCondition.assertNotUndefinedAndNotNull(innerError, "innerError");
|
|
4336
|
+
super(innerError.message, { cause: innerError });
|
|
4337
|
+
this.innerError = innerError;
|
|
4338
|
+
}
|
|
4339
|
+
get code() {
|
|
4340
|
+
return "code" in this.innerError ? this.innerError.code : void 0;
|
|
4341
|
+
}
|
|
4342
|
+
get hostname() {
|
|
4343
|
+
return "hostname" in this.innerError ? this.innerError.hostname : void 0;
|
|
4344
|
+
}
|
|
4345
|
+
};
|
|
4346
|
+
|
|
4170
4347
|
// sources/asyncResult.ts
|
|
4171
4348
|
var AsyncResult = class {
|
|
4172
4349
|
static create(actionOrPromise) {
|
|
@@ -4548,338 +4725,107 @@ var IndentedCharacterWriteStream = class _IndentedCharacterWriteStream extends C
|
|
|
4548
4725
|
}
|
|
4549
4726
|
};
|
|
4550
4727
|
|
|
4551
|
-
// sources/
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
PreCondition.assertNotUndefinedAndNotNull(values, "values");
|
|
4561
|
-
let result = "";
|
|
4562
|
-
let index = 0;
|
|
4563
|
-
const iterator = Iterator.create(values).start().await();
|
|
4564
|
-
while (iterator.hasCurrent()) {
|
|
4565
|
-
const currentValue = iterator.takeCurrent().await();
|
|
4566
|
-
if (index >= 1) {
|
|
4567
|
-
if (iterator.hasCurrent()) {
|
|
4568
|
-
result += `, `;
|
|
4569
|
-
} else {
|
|
4570
|
-
if (index >= 2) {
|
|
4571
|
-
result += `,`;
|
|
4572
|
-
}
|
|
4573
|
-
result += ` ${conjunction} `;
|
|
4574
|
-
}
|
|
4575
|
-
}
|
|
4576
|
-
result += currentValue;
|
|
4577
|
-
index++;
|
|
4728
|
+
// sources/httpHeader.ts
|
|
4729
|
+
var HttpHeader = class _HttpHeader {
|
|
4730
|
+
name;
|
|
4731
|
+
value;
|
|
4732
|
+
constructor(name, value) {
|
|
4733
|
+
PreCondition.assertNotEmpty(name, "name");
|
|
4734
|
+
PreCondition.assertNotUndefinedAndNotNull(value, "value");
|
|
4735
|
+
this.name = name;
|
|
4736
|
+
this.value = value;
|
|
4578
4737
|
}
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
// sources/commandLineParameters.ts
|
|
4583
|
-
var CommandLineParameters = class _CommandLineParameters {
|
|
4584
|
-
args;
|
|
4585
|
-
parameters;
|
|
4586
|
-
constructor(argv) {
|
|
4587
|
-
PreCondition.assertNotUndefinedAndNotNull(argv, "argv");
|
|
4588
|
-
this.args = isIterable(argv) ? argv : Iterable.create(argv);
|
|
4589
|
-
this.parameters = List.create();
|
|
4738
|
+
static create(name, value) {
|
|
4739
|
+
return new _HttpHeader(name, value);
|
|
4590
4740
|
}
|
|
4591
|
-
|
|
4592
|
-
return
|
|
4741
|
+
getName() {
|
|
4742
|
+
return this.name;
|
|
4593
4743
|
}
|
|
4594
|
-
|
|
4595
|
-
return
|
|
4744
|
+
getValue() {
|
|
4745
|
+
return this.value;
|
|
4596
4746
|
}
|
|
4597
|
-
|
|
4598
|
-
return this.
|
|
4747
|
+
toString() {
|
|
4748
|
+
return `${escapeAndQuote(this.name)}:${escapeAndQuote(this.value)}`;
|
|
4599
4749
|
}
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4750
|
+
};
|
|
4751
|
+
|
|
4752
|
+
// sources/mutableHttpHeaders.ts
|
|
4753
|
+
var MutableHttpHeaders = class _MutableHttpHeaders {
|
|
4754
|
+
headers;
|
|
4755
|
+
constructor(headers) {
|
|
4756
|
+
this.headers = List.create();
|
|
4757
|
+
if (headers) {
|
|
4758
|
+
this.setAll(headers);
|
|
4759
|
+
}
|
|
4760
|
+
}
|
|
4761
|
+
static create(headers) {
|
|
4762
|
+
return new _MutableHttpHeaders(headers);
|
|
4763
|
+
}
|
|
4764
|
+
iterate() {
|
|
4765
|
+
return this.headers.iterate();
|
|
4766
|
+
}
|
|
4767
|
+
get(headerName) {
|
|
4768
|
+
PreCondition.assertNotEmpty(headerName, "headerName");
|
|
4606
4769
|
return SyncResult.create(() => {
|
|
4607
|
-
let foundArgName = false;
|
|
4608
4770
|
let result;
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
for (const arg of this.args) {
|
|
4614
|
-
if (!foundArgName) {
|
|
4615
|
-
const argName = _CommandLineParameters.getArgumentName(arg);
|
|
4616
|
-
foundArgName = !!(argName && searchNames.contains(argName));
|
|
4617
|
-
} else {
|
|
4618
|
-
result = arg;
|
|
4771
|
+
const lowerHeaderName = headerName.toLowerCase();
|
|
4772
|
+
for (const header of this.headers) {
|
|
4773
|
+
if (header.getName().toLowerCase() === lowerHeaderName) {
|
|
4774
|
+
result = header;
|
|
4619
4775
|
break;
|
|
4620
4776
|
}
|
|
4621
4777
|
}
|
|
4622
4778
|
if (result === void 0) {
|
|
4623
|
-
|
|
4624
|
-
throw new NotFoundError(`No argument found that matches ${orList(searchNames.map((n) => toStringFunctions.toString(n)))}.`);
|
|
4779
|
+
throw new NotFoundError(`No HttpHeader found with the name ${escapeAndQuote(headerName)}.`);
|
|
4625
4780
|
}
|
|
4626
4781
|
return result;
|
|
4627
4782
|
});
|
|
4628
4783
|
}
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4784
|
+
getValue(headerName) {
|
|
4785
|
+
return this.get(headerName).then((header) => header.getValue());
|
|
4786
|
+
}
|
|
4787
|
+
set(headerOrHeaderName, headerValue) {
|
|
4788
|
+
let headerName;
|
|
4789
|
+
if (isString(headerOrHeaderName)) {
|
|
4790
|
+
headerName = headerOrHeaderName;
|
|
4791
|
+
} else {
|
|
4792
|
+
headerName = headerOrHeaderName.getName();
|
|
4793
|
+
headerValue = headerOrHeaderName.getValue();
|
|
4794
|
+
}
|
|
4795
|
+
PreCondition.assertNotEmpty(headerName, "headerName");
|
|
4796
|
+
PreCondition.assertNotUndefinedAndNotNull(headerValue, "headerValue");
|
|
4797
|
+
let insertIndex = 0;
|
|
4798
|
+
for (let insertIndex2 = 0; insertIndex2 < this.headers.getCount().await(); insertIndex2++) {
|
|
4799
|
+
const header = this.headers.get(insertIndex2).await();
|
|
4800
|
+
if (header.getName() === headerName) {
|
|
4801
|
+
this.headers.removeAt(insertIndex2);
|
|
4635
4802
|
break;
|
|
4636
4803
|
}
|
|
4637
4804
|
}
|
|
4638
|
-
|
|
4805
|
+
this.headers.insert(insertIndex, HttpHeader.create(headerName, headerValue));
|
|
4806
|
+
return this;
|
|
4639
4807
|
}
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
}
|
|
4645
|
-
this
|
|
4646
|
-
return result;
|
|
4808
|
+
setAll(headers) {
|
|
4809
|
+
PreCondition.assertNotUndefinedAndNotNull(headers, "headers");
|
|
4810
|
+
for (const header of headers) {
|
|
4811
|
+
this.set(header);
|
|
4812
|
+
}
|
|
4813
|
+
return this;
|
|
4647
4814
|
}
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
// sources/commandLineParameter.ts
|
|
4651
|
-
var CommandLineParameter = class _CommandLineParameter {
|
|
4652
|
-
owner;
|
|
4653
|
-
name;
|
|
4654
|
-
aliases;
|
|
4655
|
-
description;
|
|
4656
|
-
constructor(owner, name) {
|
|
4657
|
-
PreCondition.assertNotUndefinedAndNotNull(owner, "owner");
|
|
4658
|
-
PreCondition.assertNotEmpty(name, "name");
|
|
4659
|
-
PreCondition.assertFalse(owner.nameOrAliasExists(name), "owner.nameOrAliasExists(name)");
|
|
4660
|
-
this.owner = owner;
|
|
4661
|
-
this.name = name;
|
|
4815
|
+
setContentType(contentType) {
|
|
4816
|
+
return this.set(HttpHeaders.contentTypeHeaderName, contentType);
|
|
4662
4817
|
}
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
if (ownerOrProperties instanceof CommandLineParameters) {
|
|
4666
|
-
owner = ownerOrProperties;
|
|
4667
|
-
name = name;
|
|
4668
|
-
} else {
|
|
4669
|
-
owner = ownerOrProperties.owner;
|
|
4670
|
-
name = ownerOrProperties.name;
|
|
4671
|
-
}
|
|
4672
|
-
return new _CommandLineParameter(owner, name);
|
|
4818
|
+
getContentType() {
|
|
4819
|
+
return this.get(HttpHeaders.contentTypeHeaderName);
|
|
4673
4820
|
}
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
*/
|
|
4677
|
-
getName() {
|
|
4678
|
-
return this.name;
|
|
4821
|
+
getContentTypeValue() {
|
|
4822
|
+
return this.getValue(HttpHeaders.contentTypeHeaderName);
|
|
4679
4823
|
}
|
|
4680
|
-
|
|
4681
|
-
return this.
|
|
4824
|
+
getCount() {
|
|
4825
|
+
return this.headers.getCount();
|
|
4682
4826
|
}
|
|
4683
|
-
|
|
4684
|
-
return
|
|
4685
|
-
}
|
|
4686
|
-
addAlias(alias) {
|
|
4687
|
-
PreCondition.assertNotEmpty(alias, "alias");
|
|
4688
|
-
PreCondition.assertFalse(this.nameOrAliasExists(alias), "this.nameOrAliasExists(alias)");
|
|
4689
|
-
if (this.aliases === void 0) {
|
|
4690
|
-
this.aliases = List.create();
|
|
4691
|
-
}
|
|
4692
|
-
this.aliases.add(alias);
|
|
4693
|
-
return this;
|
|
4694
|
-
}
|
|
4695
|
-
addAliases(aliases) {
|
|
4696
|
-
for (const alias of aliases) {
|
|
4697
|
-
this.addAlias(alias);
|
|
4698
|
-
}
|
|
4699
|
-
return this;
|
|
4700
|
-
}
|
|
4701
|
-
getNameAndAliases() {
|
|
4702
|
-
return List.create().add(this.getName()).addAll(this.getAliases());
|
|
4703
|
-
}
|
|
4704
|
-
getDescription() {
|
|
4705
|
-
return this.description ?? "";
|
|
4706
|
-
}
|
|
4707
|
-
setDescription(description) {
|
|
4708
|
-
PreCondition.assertNotUndefinedAndNotNull(description, "description");
|
|
4709
|
-
this.description = description;
|
|
4710
|
-
return this;
|
|
4711
|
-
}
|
|
4712
|
-
};
|
|
4713
|
-
|
|
4714
|
-
// sources/nodeJSCharacterWriteStream.ts
|
|
4715
|
-
var NodeJSCharacterWriteStream = class _NodeJSCharacterWriteStream extends CharacterWriteStream {
|
|
4716
|
-
nodeJSWriteStream;
|
|
4717
|
-
constructor(nodeJSWriteStream) {
|
|
4718
|
-
PreCondition.assertNotUndefinedAndNotNull(nodeJSWriteStream, "nodeJSWriteStream");
|
|
4719
|
-
super();
|
|
4720
|
-
this.nodeJSWriteStream = nodeJSWriteStream;
|
|
4721
|
-
}
|
|
4722
|
-
static create(nodeJSWriteStream) {
|
|
4723
|
-
return new _NodeJSCharacterWriteStream(nodeJSWriteStream);
|
|
4724
|
-
}
|
|
4725
|
-
writeString(text) {
|
|
4726
|
-
PreCondition.assertNotUndefinedAndNotNull(text, "text");
|
|
4727
|
-
return PromiseAsyncResult.create(new Promise((resolve, reject) => {
|
|
4728
|
-
this.nodeJSWriteStream.write(text, (error) => {
|
|
4729
|
-
if (error) {
|
|
4730
|
-
reject(error);
|
|
4731
|
-
} else {
|
|
4732
|
-
resolve(text.length);
|
|
4733
|
-
}
|
|
4734
|
-
});
|
|
4735
|
-
}));
|
|
4736
|
-
}
|
|
4737
|
-
};
|
|
4738
|
-
|
|
4739
|
-
// sources/property.ts
|
|
4740
|
-
var Property = class _Property {
|
|
4741
|
-
getter;
|
|
4742
|
-
setter;
|
|
4743
|
-
constructor(getter, setter) {
|
|
4744
|
-
PreCondition.assertNotUndefinedAndNotNull(getter, "getter");
|
|
4745
|
-
PreCondition.assertNotUndefinedAndNotNull(setter, "setter");
|
|
4746
|
-
this.getter = getter;
|
|
4747
|
-
this.setter = setter;
|
|
4748
|
-
}
|
|
4749
|
-
static create(getterOptionsOrInitialValue, setter) {
|
|
4750
|
-
let getter;
|
|
4751
|
-
if (isFunction(getterOptionsOrInitialValue)) {
|
|
4752
|
-
getter = getterOptionsOrInitialValue;
|
|
4753
|
-
} else if (isObject(getterOptionsOrInitialValue) && hasProperty(getterOptionsOrInitialValue, "getter") && hasProperty(getterOptionsOrInitialValue, "setter")) {
|
|
4754
|
-
const options = getterOptionsOrInitialValue;
|
|
4755
|
-
getter = options.getter;
|
|
4756
|
-
setter = options.setter;
|
|
4757
|
-
} else {
|
|
4758
|
-
let initialValue = getterOptionsOrInitialValue;
|
|
4759
|
-
getter = () => {
|
|
4760
|
-
return initialValue;
|
|
4761
|
-
};
|
|
4762
|
-
setter = (value) => {
|
|
4763
|
-
initialValue = value;
|
|
4764
|
-
};
|
|
4765
|
-
}
|
|
4766
|
-
PreCondition.assertNotUndefinedAndNotNull(getter, "getter");
|
|
4767
|
-
PreCondition.assertNotUndefinedAndNotNull(setter, "setter");
|
|
4768
|
-
return new _Property(getter, setter);
|
|
4769
|
-
}
|
|
4770
|
-
getValue() {
|
|
4771
|
-
return this.getter();
|
|
4772
|
-
}
|
|
4773
|
-
setValue(value) {
|
|
4774
|
-
this.setter(value);
|
|
4775
|
-
return this;
|
|
4776
|
-
}
|
|
4777
|
-
toString() {
|
|
4778
|
-
return `${this.getValue()}`;
|
|
4779
|
-
}
|
|
4780
|
-
};
|
|
4781
|
-
|
|
4782
|
-
// sources/httpHeader.ts
|
|
4783
|
-
var HttpHeader = class _HttpHeader {
|
|
4784
|
-
name;
|
|
4785
|
-
value;
|
|
4786
|
-
constructor(name, value) {
|
|
4787
|
-
PreCondition.assertNotEmpty(name, "name");
|
|
4788
|
-
PreCondition.assertNotUndefinedAndNotNull(value, "value");
|
|
4789
|
-
this.name = name;
|
|
4790
|
-
this.value = value;
|
|
4791
|
-
}
|
|
4792
|
-
static create(name, value) {
|
|
4793
|
-
return new _HttpHeader(name, value);
|
|
4794
|
-
}
|
|
4795
|
-
getName() {
|
|
4796
|
-
return this.name;
|
|
4797
|
-
}
|
|
4798
|
-
getValue() {
|
|
4799
|
-
return this.value;
|
|
4800
|
-
}
|
|
4801
|
-
toString() {
|
|
4802
|
-
return `${escapeAndQuote(this.name)}:${escapeAndQuote(this.value)}`;
|
|
4803
|
-
}
|
|
4804
|
-
};
|
|
4805
|
-
|
|
4806
|
-
// sources/mutableHttpHeaders.ts
|
|
4807
|
-
var MutableHttpHeaders = class _MutableHttpHeaders {
|
|
4808
|
-
headers;
|
|
4809
|
-
constructor(headers) {
|
|
4810
|
-
this.headers = List.create();
|
|
4811
|
-
if (headers) {
|
|
4812
|
-
this.setAll(headers);
|
|
4813
|
-
}
|
|
4814
|
-
}
|
|
4815
|
-
static create(headers) {
|
|
4816
|
-
return new _MutableHttpHeaders(headers);
|
|
4817
|
-
}
|
|
4818
|
-
iterate() {
|
|
4819
|
-
return this.headers.iterate();
|
|
4820
|
-
}
|
|
4821
|
-
get(headerName) {
|
|
4822
|
-
PreCondition.assertNotEmpty(headerName, "headerName");
|
|
4823
|
-
return SyncResult.create(() => {
|
|
4824
|
-
let result;
|
|
4825
|
-
const lowerHeaderName = headerName.toLowerCase();
|
|
4826
|
-
for (const header of this.headers) {
|
|
4827
|
-
if (header.getName().toLowerCase() === lowerHeaderName) {
|
|
4828
|
-
result = header;
|
|
4829
|
-
break;
|
|
4830
|
-
}
|
|
4831
|
-
}
|
|
4832
|
-
if (result === void 0) {
|
|
4833
|
-
throw new NotFoundError(`No HttpHeader found with the name ${escapeAndQuote(headerName)}.`);
|
|
4834
|
-
}
|
|
4835
|
-
return result;
|
|
4836
|
-
});
|
|
4837
|
-
}
|
|
4838
|
-
getValue(headerName) {
|
|
4839
|
-
return this.get(headerName).then((header) => header.getValue());
|
|
4840
|
-
}
|
|
4841
|
-
set(headerOrHeaderName, headerValue) {
|
|
4842
|
-
let headerName;
|
|
4843
|
-
if (isString(headerOrHeaderName)) {
|
|
4844
|
-
headerName = headerOrHeaderName;
|
|
4845
|
-
} else {
|
|
4846
|
-
headerName = headerOrHeaderName.getName();
|
|
4847
|
-
headerValue = headerOrHeaderName.getValue();
|
|
4848
|
-
}
|
|
4849
|
-
PreCondition.assertNotEmpty(headerName, "headerName");
|
|
4850
|
-
PreCondition.assertNotUndefinedAndNotNull(headerValue, "headerValue");
|
|
4851
|
-
let insertIndex = 0;
|
|
4852
|
-
for (let insertIndex2 = 0; insertIndex2 < this.headers.getCount().await(); insertIndex2++) {
|
|
4853
|
-
const header = this.headers.get(insertIndex2).await();
|
|
4854
|
-
if (header.getName() === headerName) {
|
|
4855
|
-
this.headers.removeAt(insertIndex2);
|
|
4856
|
-
break;
|
|
4857
|
-
}
|
|
4858
|
-
}
|
|
4859
|
-
this.headers.insert(insertIndex, HttpHeader.create(headerName, headerValue));
|
|
4860
|
-
return this;
|
|
4861
|
-
}
|
|
4862
|
-
setAll(headers) {
|
|
4863
|
-
PreCondition.assertNotUndefinedAndNotNull(headers, "headers");
|
|
4864
|
-
for (const header of headers) {
|
|
4865
|
-
this.set(header);
|
|
4866
|
-
}
|
|
4867
|
-
return this;
|
|
4868
|
-
}
|
|
4869
|
-
setContentType(contentType) {
|
|
4870
|
-
return this.set(HttpHeaders.contentTypeHeaderName, contentType);
|
|
4871
|
-
}
|
|
4872
|
-
getContentType() {
|
|
4873
|
-
return this.get(HttpHeaders.contentTypeHeaderName);
|
|
4874
|
-
}
|
|
4875
|
-
getContentTypeValue() {
|
|
4876
|
-
return this.getValue(HttpHeaders.contentTypeHeaderName);
|
|
4877
|
-
}
|
|
4878
|
-
getCount() {
|
|
4879
|
-
return this.headers.getCount();
|
|
4880
|
-
}
|
|
4881
|
-
toArray() {
|
|
4882
|
-
return HttpHeaders.toArray(this);
|
|
4827
|
+
toArray() {
|
|
4828
|
+
return HttpHeaders.toArray(this);
|
|
4883
4829
|
}
|
|
4884
4830
|
any() {
|
|
4885
4831
|
return HttpHeaders.any(this);
|
|
@@ -4964,70 +4910,473 @@ var HttpHeaders = class _HttpHeaders {
|
|
|
4964
4910
|
static equals(headers, right, equalFunctions) {
|
|
4965
4911
|
return Iterable.equals(headers, right, equalFunctions);
|
|
4966
4912
|
}
|
|
4967
|
-
toString(toStringFunctions) {
|
|
4968
|
-
return _HttpHeaders.toString(this, toStringFunctions);
|
|
4913
|
+
toString(toStringFunctions) {
|
|
4914
|
+
return _HttpHeaders.toString(this, toStringFunctions);
|
|
4915
|
+
}
|
|
4916
|
+
static toString(headers, toStringFunctions) {
|
|
4917
|
+
return Iterable.toString(headers, toStringFunctions);
|
|
4918
|
+
}
|
|
4919
|
+
concatenate(...toConcatenate) {
|
|
4920
|
+
return _HttpHeaders.concatenate(this, ...toConcatenate);
|
|
4921
|
+
}
|
|
4922
|
+
static concatenate(headers, ...toConcatenate) {
|
|
4923
|
+
return Iterable.concatenate(headers, ...toConcatenate);
|
|
4924
|
+
}
|
|
4925
|
+
map(mapping) {
|
|
4926
|
+
return _HttpHeaders.map(this, mapping);
|
|
4927
|
+
}
|
|
4928
|
+
static map(headers, mapping) {
|
|
4929
|
+
return Iterable.map(headers, mapping);
|
|
4930
|
+
}
|
|
4931
|
+
flatMap(mapping) {
|
|
4932
|
+
return _HttpHeaders.flatMap(this, mapping);
|
|
4933
|
+
}
|
|
4934
|
+
static flatMap(headers, mapping) {
|
|
4935
|
+
return Iterable.flatMap(headers, mapping);
|
|
4936
|
+
}
|
|
4937
|
+
where(condition) {
|
|
4938
|
+
return _HttpHeaders.where(this, condition);
|
|
4939
|
+
}
|
|
4940
|
+
static where(headers, condition) {
|
|
4941
|
+
return Iterable.where(headers, condition);
|
|
4942
|
+
}
|
|
4943
|
+
instanceOf(typeOrTypeCheck) {
|
|
4944
|
+
return _HttpHeaders.instanceOf(this, typeOrTypeCheck);
|
|
4945
|
+
}
|
|
4946
|
+
static instanceOf(headers, typeOrTypeCheck) {
|
|
4947
|
+
return Iterable.instanceOf(headers, typeOrTypeCheck);
|
|
4948
|
+
}
|
|
4949
|
+
first(condition) {
|
|
4950
|
+
return _HttpHeaders.first(this, condition);
|
|
4951
|
+
}
|
|
4952
|
+
static first(headers, condition) {
|
|
4953
|
+
return Iterable.first(headers, condition);
|
|
4954
|
+
}
|
|
4955
|
+
last(condition) {
|
|
4956
|
+
return _HttpHeaders.last(this, condition);
|
|
4957
|
+
}
|
|
4958
|
+
static last(headers, condition) {
|
|
4959
|
+
return Iterable.last(headers, condition);
|
|
4960
|
+
}
|
|
4961
|
+
[Symbol.iterator]() {
|
|
4962
|
+
return _HttpHeaders[Symbol.iterator](this);
|
|
4963
|
+
}
|
|
4964
|
+
static [Symbol.iterator](headers) {
|
|
4965
|
+
return Iterable[Symbol.iterator](headers);
|
|
4966
|
+
}
|
|
4967
|
+
contains(value, equalFunctions) {
|
|
4968
|
+
return _HttpHeaders.contains(this, value, equalFunctions);
|
|
4969
|
+
}
|
|
4970
|
+
static contains(headers, value, equalFunctions) {
|
|
4971
|
+
return SyncResult.create(() => {
|
|
4972
|
+
if (!equalFunctions) {
|
|
4973
|
+
equalFunctions = EqualFunctions.create();
|
|
4974
|
+
}
|
|
4975
|
+
return headers.getValue(value.getName()).then((headerValue) => equalFunctions.areEqual(headerValue, value.getValue()).await()).catch(NotFoundError, () => false).await();
|
|
4976
|
+
});
|
|
4977
|
+
}
|
|
4978
|
+
};
|
|
4979
|
+
|
|
4980
|
+
// sources/NodeJSHttpOutgoingResponse.ts
|
|
4981
|
+
var NodeJSHttpOutgoingResponse = class _NodeJSHttpOutgoingResponse {
|
|
4982
|
+
innerResponse;
|
|
4983
|
+
bodyString;
|
|
4984
|
+
constructor(innerResponse) {
|
|
4985
|
+
PreCondition.assertNotUndefinedAndNotNull(innerResponse, "innerResponse");
|
|
4986
|
+
this.innerResponse = innerResponse;
|
|
4987
|
+
}
|
|
4988
|
+
static create(innerResponse) {
|
|
4989
|
+
return new _NodeJSHttpOutgoingResponse(innerResponse);
|
|
4990
|
+
}
|
|
4991
|
+
setStatusCode(statusCode) {
|
|
4992
|
+
this.innerResponse.statusCode = statusCode;
|
|
4993
|
+
return this;
|
|
4994
|
+
}
|
|
4995
|
+
getStatusCode() {
|
|
4996
|
+
return SyncResult.value(this.innerResponse.statusCode);
|
|
4997
|
+
}
|
|
4998
|
+
static headerValueToString(headerValue) {
|
|
4999
|
+
PreCondition.assertNotUndefinedAndNotNull(headerValue, "headerValue");
|
|
5000
|
+
return isArray(headerValue) ? join(",", headerValue) : headerValue.toString();
|
|
5001
|
+
}
|
|
5002
|
+
getHeaders() {
|
|
5003
|
+
const result = HttpHeaders.create();
|
|
5004
|
+
for (const rawHeader of Object.entries(this.innerResponse.getHeaders())) {
|
|
5005
|
+
const headerName = rawHeader[0];
|
|
5006
|
+
const headerValue = rawHeader[1];
|
|
5007
|
+
if (headerValue !== void 0) {
|
|
5008
|
+
result.set(headerName, _NodeJSHttpOutgoingResponse.headerValueToString(headerValue));
|
|
5009
|
+
}
|
|
5010
|
+
}
|
|
5011
|
+
return result;
|
|
5012
|
+
}
|
|
5013
|
+
getHeader(headerName) {
|
|
5014
|
+
PreCondition.assertNotEmpty(headerName, "headerName");
|
|
5015
|
+
const headerValue = this.innerResponse.getHeader(headerName);
|
|
5016
|
+
return headerValue === void 0 ? SyncResult.error(new NotFoundError(`No HTTP header value exists with the name ${escapeAndQuote(headerName)}.`)) : SyncResult.value(HttpHeader.create(headerName, _NodeJSHttpOutgoingResponse.headerValueToString(headerValue)));
|
|
5017
|
+
}
|
|
5018
|
+
getHeaderValue(headerName) {
|
|
5019
|
+
const headerValue = this.innerResponse.getHeader(headerName);
|
|
5020
|
+
return headerValue === void 0 ? SyncResult.error(new NotFoundError(`No HTTP header value exists with the name ${escapeAndQuote(headerName)}.`)) : SyncResult.value(_NodeJSHttpOutgoingResponse.headerValueToString(headerValue));
|
|
5021
|
+
}
|
|
5022
|
+
setHeader(headerName, headerValue) {
|
|
5023
|
+
PreCondition.assertNotEmpty(headerName, "headerName");
|
|
5024
|
+
PreCondition.assertNotUndefinedAndNotNull(headerValue, "headerValue");
|
|
5025
|
+
this.innerResponse.setHeader(headerName, headerValue);
|
|
5026
|
+
return this;
|
|
5027
|
+
}
|
|
5028
|
+
setBodyString(body) {
|
|
5029
|
+
PreCondition.assertNotUndefinedAndNotNull(body, "body");
|
|
5030
|
+
this.bodyString = body;
|
|
5031
|
+
return this;
|
|
5032
|
+
}
|
|
5033
|
+
setBodyJSON(body) {
|
|
5034
|
+
PreCondition.assertNotUndefinedAndNotNull(body, "body");
|
|
5035
|
+
return this.setBodyString(JSON.stringify(body));
|
|
5036
|
+
}
|
|
5037
|
+
end() {
|
|
5038
|
+
return AsyncResult.create(new Promise((resolve, reject) => {
|
|
5039
|
+
this.innerResponse.end(this.bodyString, () => {
|
|
5040
|
+
resolve();
|
|
5041
|
+
});
|
|
5042
|
+
}));
|
|
5043
|
+
}
|
|
5044
|
+
};
|
|
5045
|
+
|
|
5046
|
+
// sources/TokenType.ts
|
|
5047
|
+
var TokenType = class _TokenType {
|
|
5048
|
+
name;
|
|
5049
|
+
constructor(name) {
|
|
5050
|
+
PreCondition.assertNotEmpty(name, "name");
|
|
5051
|
+
this.name = name;
|
|
5052
|
+
}
|
|
5053
|
+
static create(name) {
|
|
5054
|
+
return new _TokenType(name);
|
|
5055
|
+
}
|
|
5056
|
+
static Whitespace = _TokenType.create("Whitespace");
|
|
5057
|
+
static NewLine = _TokenType.create("NewLine");
|
|
5058
|
+
static Letters = _TokenType.create("Letters");
|
|
5059
|
+
static Digits = _TokenType.create("Digits");
|
|
5060
|
+
static LeftParenthesis = _TokenType.create("LeftParenthesis");
|
|
5061
|
+
static RightParenthesis = _TokenType.create("RightParenthesis");
|
|
5062
|
+
static Backslash = _TokenType.create("Backslash");
|
|
5063
|
+
static ForwardSlash = _TokenType.create("ForwardSlash");
|
|
5064
|
+
static Unknown = _TokenType.create("Unknown");
|
|
5065
|
+
static Period = _TokenType.create("Period");
|
|
5066
|
+
static Underscore = _TokenType.create("Underscore");
|
|
5067
|
+
static Colon = _TokenType.create("Colon");
|
|
5068
|
+
toString() {
|
|
5069
|
+
return this.name;
|
|
5070
|
+
}
|
|
5071
|
+
};
|
|
5072
|
+
|
|
5073
|
+
// sources/Token.ts
|
|
5074
|
+
var Token = class _Token {
|
|
5075
|
+
static newLineToken = _Token.create("\n", TokenType.NewLine);
|
|
5076
|
+
static carriageReturnNewLineToken = _Token.create("\r\n", TokenType.NewLine);
|
|
5077
|
+
static leftParenthesisToken = _Token.create("(", TokenType.LeftParenthesis);
|
|
5078
|
+
static rightParenthesisToken = _Token.create(")", TokenType.RightParenthesis);
|
|
5079
|
+
static backslashToken = _Token.create("\\", TokenType.Backslash);
|
|
5080
|
+
static forwardSlashToken = _Token.create("/", TokenType.ForwardSlash);
|
|
5081
|
+
static periodToken = _Token.create(".", TokenType.Period);
|
|
5082
|
+
static underscoreToken = _Token.create("_", TokenType.Underscore);
|
|
5083
|
+
static colonToken = _Token.create(":", TokenType.Colon);
|
|
5084
|
+
text;
|
|
5085
|
+
type;
|
|
5086
|
+
constructor(text, type) {
|
|
5087
|
+
PreCondition.assertNotEmpty(text, "text");
|
|
5088
|
+
PreCondition.assertNotUndefinedAndNotNull(type, "type");
|
|
5089
|
+
this.text = text;
|
|
5090
|
+
this.type = type;
|
|
5091
|
+
}
|
|
5092
|
+
static create(text, type) {
|
|
5093
|
+
return new _Token(text, type);
|
|
5094
|
+
}
|
|
5095
|
+
static whitespace(text) {
|
|
5096
|
+
return _Token.create(text, TokenType.Whitespace);
|
|
5097
|
+
}
|
|
5098
|
+
static newLine(text) {
|
|
5099
|
+
text ??= "\n";
|
|
5100
|
+
let result;
|
|
5101
|
+
switch (text) {
|
|
5102
|
+
case "\n":
|
|
5103
|
+
result = _Token.newLineToken;
|
|
5104
|
+
break;
|
|
5105
|
+
case "\r\n":
|
|
5106
|
+
result = _Token.carriageReturnNewLineToken;
|
|
5107
|
+
break;
|
|
5108
|
+
default:
|
|
5109
|
+
result = _Token.create(text, TokenType.NewLine);
|
|
5110
|
+
break;
|
|
5111
|
+
}
|
|
5112
|
+
return result;
|
|
5113
|
+
}
|
|
5114
|
+
static leftParenthesis() {
|
|
5115
|
+
return _Token.leftParenthesisToken;
|
|
5116
|
+
}
|
|
5117
|
+
static rightParenthesis() {
|
|
5118
|
+
return _Token.rightParenthesisToken;
|
|
5119
|
+
}
|
|
5120
|
+
static backslash() {
|
|
5121
|
+
return _Token.backslashToken;
|
|
5122
|
+
}
|
|
5123
|
+
static forwardSlash() {
|
|
5124
|
+
return _Token.forwardSlashToken;
|
|
5125
|
+
}
|
|
5126
|
+
static period() {
|
|
5127
|
+
return _Token.periodToken;
|
|
5128
|
+
}
|
|
5129
|
+
static underscore() {
|
|
5130
|
+
return _Token.underscoreToken;
|
|
5131
|
+
}
|
|
5132
|
+
static colon() {
|
|
5133
|
+
return _Token.colonToken;
|
|
5134
|
+
}
|
|
5135
|
+
static letters(text) {
|
|
5136
|
+
return _Token.create(text, TokenType.Letters);
|
|
5137
|
+
}
|
|
5138
|
+
static digits(text) {
|
|
5139
|
+
return _Token.create(text, TokenType.Digits);
|
|
5140
|
+
}
|
|
5141
|
+
static unknown(text) {
|
|
5142
|
+
return _Token.create(text, TokenType.Unknown);
|
|
5143
|
+
}
|
|
5144
|
+
getText() {
|
|
5145
|
+
return this.text;
|
|
5146
|
+
}
|
|
5147
|
+
getType() {
|
|
5148
|
+
return this.type;
|
|
5149
|
+
}
|
|
5150
|
+
};
|
|
5151
|
+
|
|
5152
|
+
// sources/english.ts
|
|
5153
|
+
function andList(values) {
|
|
5154
|
+
return list("and", values);
|
|
5155
|
+
}
|
|
5156
|
+
function orList(values) {
|
|
5157
|
+
return list("or", values);
|
|
5158
|
+
}
|
|
5159
|
+
function list(conjunction, values) {
|
|
5160
|
+
PreCondition.assertNotEmpty(conjunction, "conjunction");
|
|
5161
|
+
PreCondition.assertNotUndefinedAndNotNull(values, "values");
|
|
5162
|
+
let result = "";
|
|
5163
|
+
let index = 0;
|
|
5164
|
+
const iterator = Iterator.create(values).start().await();
|
|
5165
|
+
while (iterator.hasCurrent()) {
|
|
5166
|
+
const currentValue = iterator.takeCurrent().await();
|
|
5167
|
+
if (index >= 1) {
|
|
5168
|
+
if (iterator.hasCurrent()) {
|
|
5169
|
+
result += `, `;
|
|
5170
|
+
} else {
|
|
5171
|
+
if (index >= 2) {
|
|
5172
|
+
result += `,`;
|
|
5173
|
+
}
|
|
5174
|
+
result += ` ${conjunction} `;
|
|
5175
|
+
}
|
|
5176
|
+
}
|
|
5177
|
+
result += currentValue;
|
|
5178
|
+
index++;
|
|
5179
|
+
}
|
|
5180
|
+
return result;
|
|
5181
|
+
}
|
|
5182
|
+
|
|
5183
|
+
// sources/commandLineParameters.ts
|
|
5184
|
+
var CommandLineParameters = class _CommandLineParameters {
|
|
5185
|
+
args;
|
|
5186
|
+
parameters;
|
|
5187
|
+
constructor(argv) {
|
|
5188
|
+
PreCondition.assertNotUndefinedAndNotNull(argv, "argv");
|
|
5189
|
+
this.args = isIterable(argv) ? argv : Iterable.create(argv);
|
|
5190
|
+
this.parameters = List.create();
|
|
5191
|
+
}
|
|
5192
|
+
static create(args) {
|
|
5193
|
+
return new _CommandLineParameters(args);
|
|
5194
|
+
}
|
|
5195
|
+
static getArgumentName(arg) {
|
|
5196
|
+
return arg[0] === "-" ? arg.substring(arg[1] === "-" ? 2 : 1) : void 0;
|
|
5197
|
+
}
|
|
5198
|
+
getArguments() {
|
|
5199
|
+
return this.args;
|
|
5200
|
+
}
|
|
5201
|
+
/**
|
|
5202
|
+
* Get the value of the first argument that matches one of the provided names.
|
|
5203
|
+
* @param names The possible names to look for.
|
|
5204
|
+
*/
|
|
5205
|
+
getNamedArgumentStringValue(nameOrNames) {
|
|
5206
|
+
PreCondition.assertNotEmpty(nameOrNames, "nameOrNames");
|
|
5207
|
+
return SyncResult.create(() => {
|
|
5208
|
+
let foundArgName = false;
|
|
5209
|
+
let result;
|
|
5210
|
+
if (isString(nameOrNames)) {
|
|
5211
|
+
nameOrNames = [nameOrNames];
|
|
5212
|
+
}
|
|
5213
|
+
const searchNames = Iterable.create(nameOrNames);
|
|
5214
|
+
for (const arg of this.args) {
|
|
5215
|
+
if (!foundArgName) {
|
|
5216
|
+
const argName = _CommandLineParameters.getArgumentName(arg);
|
|
5217
|
+
foundArgName = !!(argName && searchNames.contains(argName));
|
|
5218
|
+
} else {
|
|
5219
|
+
result = arg;
|
|
5220
|
+
break;
|
|
5221
|
+
}
|
|
5222
|
+
}
|
|
5223
|
+
if (result === void 0) {
|
|
5224
|
+
const toStringFunctions = ToStringFunctions.create();
|
|
5225
|
+
throw new NotFoundError(`No argument found that matches ${orList(searchNames.map((n) => toStringFunctions.toString(n)))}.`);
|
|
5226
|
+
}
|
|
5227
|
+
return result;
|
|
5228
|
+
});
|
|
5229
|
+
}
|
|
5230
|
+
nameOrAliasExists(nameOrAlias) {
|
|
5231
|
+
PreCondition.assertNotEmpty(nameOrAlias, "nameOrAlias");
|
|
5232
|
+
let result = false;
|
|
5233
|
+
for (const parameter of this.parameters) {
|
|
5234
|
+
if (parameter.getNameAndAliases().contains(nameOrAlias).await()) {
|
|
5235
|
+
result = true;
|
|
5236
|
+
break;
|
|
5237
|
+
}
|
|
5238
|
+
}
|
|
5239
|
+
return result;
|
|
4969
5240
|
}
|
|
4970
|
-
|
|
4971
|
-
|
|
5241
|
+
add(name) {
|
|
5242
|
+
const result = CommandLineParameter.create({
|
|
5243
|
+
owner: this,
|
|
5244
|
+
name
|
|
5245
|
+
});
|
|
5246
|
+
this.parameters.add(result);
|
|
5247
|
+
return result;
|
|
4972
5248
|
}
|
|
4973
|
-
|
|
4974
|
-
|
|
5249
|
+
};
|
|
5250
|
+
|
|
5251
|
+
// sources/commandLineParameter.ts
|
|
5252
|
+
var CommandLineParameter = class _CommandLineParameter {
|
|
5253
|
+
owner;
|
|
5254
|
+
name;
|
|
5255
|
+
aliases;
|
|
5256
|
+
description;
|
|
5257
|
+
constructor(owner, name) {
|
|
5258
|
+
PreCondition.assertNotUndefinedAndNotNull(owner, "owner");
|
|
5259
|
+
PreCondition.assertNotEmpty(name, "name");
|
|
5260
|
+
PreCondition.assertFalse(owner.nameOrAliasExists(name), "owner.nameOrAliasExists(name)");
|
|
5261
|
+
this.owner = owner;
|
|
5262
|
+
this.name = name;
|
|
4975
5263
|
}
|
|
4976
|
-
static
|
|
4977
|
-
|
|
5264
|
+
static create(ownerOrProperties, name) {
|
|
5265
|
+
let owner;
|
|
5266
|
+
if (ownerOrProperties instanceof CommandLineParameters) {
|
|
5267
|
+
owner = ownerOrProperties;
|
|
5268
|
+
name = name;
|
|
5269
|
+
} else {
|
|
5270
|
+
owner = ownerOrProperties.owner;
|
|
5271
|
+
name = ownerOrProperties.name;
|
|
5272
|
+
}
|
|
5273
|
+
return new _CommandLineParameter(owner, name);
|
|
4978
5274
|
}
|
|
4979
|
-
|
|
4980
|
-
|
|
5275
|
+
/**
|
|
5276
|
+
* Get the name of this {@link CommandLineParameter}.
|
|
5277
|
+
*/
|
|
5278
|
+
getName() {
|
|
5279
|
+
return this.name;
|
|
4981
5280
|
}
|
|
4982
|
-
|
|
4983
|
-
return Iterable.
|
|
5281
|
+
getAliases() {
|
|
5282
|
+
return this.aliases ?? Iterable.create();
|
|
4984
5283
|
}
|
|
4985
|
-
|
|
4986
|
-
return
|
|
5284
|
+
nameOrAliasExists(nameOrAlias) {
|
|
5285
|
+
return this.owner.nameOrAliasExists(nameOrAlias);
|
|
4987
5286
|
}
|
|
4988
|
-
|
|
4989
|
-
|
|
5287
|
+
addAlias(alias) {
|
|
5288
|
+
PreCondition.assertNotEmpty(alias, "alias");
|
|
5289
|
+
PreCondition.assertFalse(this.nameOrAliasExists(alias), "this.nameOrAliasExists(alias)");
|
|
5290
|
+
if (this.aliases === void 0) {
|
|
5291
|
+
this.aliases = List.create();
|
|
5292
|
+
}
|
|
5293
|
+
this.aliases.add(alias);
|
|
5294
|
+
return this;
|
|
4990
5295
|
}
|
|
4991
|
-
|
|
4992
|
-
|
|
5296
|
+
addAliases(aliases) {
|
|
5297
|
+
for (const alias of aliases) {
|
|
5298
|
+
this.addAlias(alias);
|
|
5299
|
+
}
|
|
5300
|
+
return this;
|
|
4993
5301
|
}
|
|
4994
|
-
|
|
4995
|
-
return
|
|
5302
|
+
getNameAndAliases() {
|
|
5303
|
+
return List.create().add(this.getName()).addAll(this.getAliases());
|
|
4996
5304
|
}
|
|
4997
|
-
|
|
4998
|
-
return
|
|
5305
|
+
getDescription() {
|
|
5306
|
+
return this.description ?? "";
|
|
4999
5307
|
}
|
|
5000
|
-
|
|
5001
|
-
|
|
5308
|
+
setDescription(description) {
|
|
5309
|
+
PreCondition.assertNotUndefinedAndNotNull(description, "description");
|
|
5310
|
+
this.description = description;
|
|
5311
|
+
return this;
|
|
5002
5312
|
}
|
|
5003
|
-
|
|
5004
|
-
|
|
5313
|
+
};
|
|
5314
|
+
|
|
5315
|
+
// sources/nodeJSCharacterWriteStream.ts
|
|
5316
|
+
var NodeJSCharacterWriteStream = class _NodeJSCharacterWriteStream extends CharacterWriteStream {
|
|
5317
|
+
nodeJSWriteStream;
|
|
5318
|
+
constructor(nodeJSWriteStream) {
|
|
5319
|
+
PreCondition.assertNotUndefinedAndNotNull(nodeJSWriteStream, "nodeJSWriteStream");
|
|
5320
|
+
super();
|
|
5321
|
+
this.nodeJSWriteStream = nodeJSWriteStream;
|
|
5005
5322
|
}
|
|
5006
|
-
static
|
|
5007
|
-
return
|
|
5323
|
+
static create(nodeJSWriteStream) {
|
|
5324
|
+
return new _NodeJSCharacterWriteStream(nodeJSWriteStream);
|
|
5008
5325
|
}
|
|
5009
|
-
|
|
5010
|
-
|
|
5326
|
+
writeString(text) {
|
|
5327
|
+
PreCondition.assertNotUndefinedAndNotNull(text, "text");
|
|
5328
|
+
return PromiseAsyncResult.create(new Promise((resolve, reject) => {
|
|
5329
|
+
this.nodeJSWriteStream.write(text, (error) => {
|
|
5330
|
+
if (error) {
|
|
5331
|
+
reject(error);
|
|
5332
|
+
} else {
|
|
5333
|
+
resolve(text.length);
|
|
5334
|
+
}
|
|
5335
|
+
});
|
|
5336
|
+
}));
|
|
5011
5337
|
}
|
|
5012
|
-
|
|
5013
|
-
|
|
5338
|
+
};
|
|
5339
|
+
|
|
5340
|
+
// sources/property.ts
|
|
5341
|
+
var Property = class _Property {
|
|
5342
|
+
getter;
|
|
5343
|
+
setter;
|
|
5344
|
+
constructor(getter, setter) {
|
|
5345
|
+
PreCondition.assertNotUndefinedAndNotNull(getter, "getter");
|
|
5346
|
+
PreCondition.assertNotUndefinedAndNotNull(setter, "setter");
|
|
5347
|
+
this.getter = getter;
|
|
5348
|
+
this.setter = setter;
|
|
5014
5349
|
}
|
|
5015
|
-
|
|
5016
|
-
|
|
5350
|
+
static create(getterOptionsOrInitialValue, setter) {
|
|
5351
|
+
let getter;
|
|
5352
|
+
if (isFunction(getterOptionsOrInitialValue)) {
|
|
5353
|
+
getter = getterOptionsOrInitialValue;
|
|
5354
|
+
} else if (isObject(getterOptionsOrInitialValue) && hasProperty(getterOptionsOrInitialValue, "getter") && hasProperty(getterOptionsOrInitialValue, "setter")) {
|
|
5355
|
+
const options = getterOptionsOrInitialValue;
|
|
5356
|
+
getter = options.getter;
|
|
5357
|
+
setter = options.setter;
|
|
5358
|
+
} else {
|
|
5359
|
+
let initialValue = getterOptionsOrInitialValue;
|
|
5360
|
+
getter = () => {
|
|
5361
|
+
return initialValue;
|
|
5362
|
+
};
|
|
5363
|
+
setter = (value) => {
|
|
5364
|
+
initialValue = value;
|
|
5365
|
+
};
|
|
5366
|
+
}
|
|
5367
|
+
PreCondition.assertNotUndefinedAndNotNull(getter, "getter");
|
|
5368
|
+
PreCondition.assertNotUndefinedAndNotNull(setter, "setter");
|
|
5369
|
+
return new _Property(getter, setter);
|
|
5017
5370
|
}
|
|
5018
|
-
|
|
5019
|
-
return
|
|
5371
|
+
getValue() {
|
|
5372
|
+
return this.getter();
|
|
5020
5373
|
}
|
|
5021
|
-
|
|
5022
|
-
|
|
5374
|
+
setValue(value) {
|
|
5375
|
+
this.setter(value);
|
|
5376
|
+
return this;
|
|
5023
5377
|
}
|
|
5024
|
-
|
|
5025
|
-
return
|
|
5026
|
-
if (!equalFunctions) {
|
|
5027
|
-
equalFunctions = EqualFunctions.create();
|
|
5028
|
-
}
|
|
5029
|
-
return headers.getValue(value.getName()).then((headerValue) => equalFunctions.areEqual(headerValue, value.getValue()).await()).catch(NotFoundError, () => false).await();
|
|
5030
|
-
});
|
|
5378
|
+
toString() {
|
|
5379
|
+
return `${this.getValue()}`;
|
|
5031
5380
|
}
|
|
5032
5381
|
};
|
|
5033
5382
|
|
|
@@ -5185,14 +5534,27 @@ var FetchHttpClient = class _FetchHttpClient {
|
|
|
5185
5534
|
}
|
|
5186
5535
|
sendRequest(request) {
|
|
5187
5536
|
PreCondition.assertNotUndefinedAndNotNull(request, "request");
|
|
5188
|
-
return
|
|
5537
|
+
return AsyncResult.create(async () => {
|
|
5538
|
+
const fetchURL = request.getURL();
|
|
5539
|
+
const fetchMethod = _FetchHttpClient.convertMethod(request.getMethod());
|
|
5540
|
+
const fetchHeaders = request.getHeaders().map((header) => [header.getName(), header.getValue()]).toArray().await();
|
|
5541
|
+
const fetchBody = request.getBody() || void 0;
|
|
5189
5542
|
const requestInit = {
|
|
5190
|
-
method:
|
|
5191
|
-
headers:
|
|
5192
|
-
body:
|
|
5543
|
+
method: fetchMethod,
|
|
5544
|
+
headers: fetchHeaders,
|
|
5545
|
+
body: fetchBody
|
|
5193
5546
|
};
|
|
5194
|
-
|
|
5195
|
-
|
|
5547
|
+
let result;
|
|
5548
|
+
try {
|
|
5549
|
+
const fetchResponse = await fetch(fetchURL, requestInit);
|
|
5550
|
+
result = FetchHttpIncomingResponse.create(fetchResponse);
|
|
5551
|
+
} catch (error) {
|
|
5552
|
+
if (error instanceof Error && error.cause instanceof Error) {
|
|
5553
|
+
throw new FetchError(error.cause);
|
|
5554
|
+
}
|
|
5555
|
+
throw error;
|
|
5556
|
+
}
|
|
5557
|
+
return result;
|
|
5196
5558
|
});
|
|
5197
5559
|
}
|
|
5198
5560
|
sendGetRequest(url) {
|
|
@@ -5246,83 +5608,6 @@ var http = __toESM(require("http"), 1);
|
|
|
5246
5608
|
var HttpServer = class {
|
|
5247
5609
|
};
|
|
5248
5610
|
|
|
5249
|
-
// sources/httpOutgoingResponse.ts
|
|
5250
|
-
var HttpOutgoingResponse = class _HttpOutgoingResponse {
|
|
5251
|
-
statusCode;
|
|
5252
|
-
headers;
|
|
5253
|
-
body;
|
|
5254
|
-
constructor() {
|
|
5255
|
-
this.statusCode = 200;
|
|
5256
|
-
this.headers = MutableHttpHeaders.create();
|
|
5257
|
-
this.body = "";
|
|
5258
|
-
}
|
|
5259
|
-
static create() {
|
|
5260
|
-
return new _HttpOutgoingResponse();
|
|
5261
|
-
}
|
|
5262
|
-
/**
|
|
5263
|
-
* Get the status code of this {@link HttpOutgoingResponse}.
|
|
5264
|
-
*/
|
|
5265
|
-
getStatusCode() {
|
|
5266
|
-
return this.statusCode;
|
|
5267
|
-
}
|
|
5268
|
-
/**
|
|
5269
|
-
* Set the status code of this {@link HttpOutgoingResponse}.
|
|
5270
|
-
* @param statusCode The status code of this {@link HttpOutgoingResponse}.
|
|
5271
|
-
*/
|
|
5272
|
-
setStatusCode(statusCode) {
|
|
5273
|
-
PreCondition.assertBetween(100, statusCode, 599, "statusCode");
|
|
5274
|
-
this.statusCode = statusCode;
|
|
5275
|
-
return this;
|
|
5276
|
-
}
|
|
5277
|
-
getHeaders() {
|
|
5278
|
-
return this.headers;
|
|
5279
|
-
}
|
|
5280
|
-
/**
|
|
5281
|
-
* Get the HTTP header with the provided name or return a {@link NotFoundError} if the header
|
|
5282
|
-
* doesn't exist.
|
|
5283
|
-
* @param headerName The name of the header to get.
|
|
5284
|
-
*/
|
|
5285
|
-
getHeader(headerName) {
|
|
5286
|
-
return this.headers.get(headerName);
|
|
5287
|
-
}
|
|
5288
|
-
/**
|
|
5289
|
-
* Get the value of the header with the provided name or return a {@link NotFoundError} if the
|
|
5290
|
-
* header doesn't exist.
|
|
5291
|
-
* @param headerName The name of the header value to get.
|
|
5292
|
-
*/
|
|
5293
|
-
getHeaderValue(headerName) {
|
|
5294
|
-
return this.headers.getValue(headerName);
|
|
5295
|
-
}
|
|
5296
|
-
/**
|
|
5297
|
-
* Set the HTTP header in this {@link HttpOutgoingResponse}.
|
|
5298
|
-
* @param headerName The name of the HTTP header.
|
|
5299
|
-
* @param headerValue The value of the HTTP header.
|
|
5300
|
-
*/
|
|
5301
|
-
setHeader(headerName, headerValue) {
|
|
5302
|
-
this.headers.set(headerName, headerValue);
|
|
5303
|
-
return this;
|
|
5304
|
-
}
|
|
5305
|
-
setContentTypeHeader(contentType) {
|
|
5306
|
-
this.headers.setContentType(contentType);
|
|
5307
|
-
return this;
|
|
5308
|
-
}
|
|
5309
|
-
/**
|
|
5310
|
-
* Get the body of this {@link HttpOutgoingResponse}.
|
|
5311
|
-
*/
|
|
5312
|
-
getBody() {
|
|
5313
|
-
return this.body;
|
|
5314
|
-
}
|
|
5315
|
-
/**
|
|
5316
|
-
* Set the body of this {@link HttpOutgoingResponse}.
|
|
5317
|
-
* @param body The body for this {@link HttpOutgoingResponse}.
|
|
5318
|
-
*/
|
|
5319
|
-
setBody(body) {
|
|
5320
|
-
PreCondition.assertNotUndefinedAndNotNull(body, "body");
|
|
5321
|
-
this.body = body;
|
|
5322
|
-
return this;
|
|
5323
|
-
}
|
|
5324
|
-
};
|
|
5325
|
-
|
|
5326
5611
|
// sources/nodeJSHttpServer.ts
|
|
5327
5612
|
var NodeJSHttpServer = class _NodeJSHttpServer extends HttpServer {
|
|
5328
5613
|
httpServer;
|
|
@@ -5375,16 +5660,9 @@ var NodeJSHttpServer = class _NodeJSHttpServer extends HttpServer {
|
|
|
5375
5660
|
reject(new Error("Can't run a HttpServer multiple times."));
|
|
5376
5661
|
} else {
|
|
5377
5662
|
this.httpServer = http.createServer();
|
|
5378
|
-
this.httpServer.on("request", (
|
|
5379
|
-
const
|
|
5380
|
-
|
|
5381
|
-
const headers = httpResponse.getHeaders();
|
|
5382
|
-
const responseHeaders = {};
|
|
5383
|
-
for (const header of headers) {
|
|
5384
|
-
responseHeaders[header.getName()] = header.getValue();
|
|
5385
|
-
}
|
|
5386
|
-
response.writeHead(statusCode, responseHeaders);
|
|
5387
|
-
response.end(httpResponse.getBody());
|
|
5663
|
+
this.httpServer.on("request", async (rawRequest, rawResponse) => {
|
|
5664
|
+
const response = NodeJSHttpOutgoingResponse.create(rawResponse).setStatusCode(200).setHeader("Content-Type", "text/plain").setBodyString("Hello world!");
|
|
5665
|
+
await response.end();
|
|
5388
5666
|
});
|
|
5389
5667
|
this.httpServer.on("close", () => {
|
|
5390
5668
|
resolve();
|
|
@@ -5511,9 +5789,6 @@ var CurrentProcess = class _CurrentProcess {
|
|
|
5511
5789
|
}
|
|
5512
5790
|
};
|
|
5513
5791
|
|
|
5514
|
-
// sources/luxonDateTime.ts
|
|
5515
|
-
var luxon = __toESM(require("luxon"), 1);
|
|
5516
|
-
|
|
5517
5792
|
// sources/listStack.ts
|
|
5518
5793
|
var ListStack = class _ListStack {
|
|
5519
5794
|
list;
|
|
@@ -6730,12 +7005,37 @@ var ConsoleTestRunner = class _ConsoleTestRunner {
|
|
|
6730
7005
|
return this.ui.writeSummary(this.passedTestCount, this.getSkippedTests(), this.getFailedTests());
|
|
6731
7006
|
}
|
|
6732
7007
|
};
|
|
7008
|
+
|
|
7009
|
+
// tests/FakeClock.ts
|
|
7010
|
+
var FakeClock = class _FakeClock extends Clock {
|
|
7011
|
+
currentTime;
|
|
7012
|
+
constructor(currentTime) {
|
|
7013
|
+
PreCondition.assertNotUndefinedAndNotNull(currentTime, "currentTime");
|
|
7014
|
+
super();
|
|
7015
|
+
this.currentTime = currentTime;
|
|
7016
|
+
}
|
|
7017
|
+
static create(currentTime) {
|
|
7018
|
+
return new _FakeClock(currentTime ?? DateTime2.now());
|
|
7019
|
+
}
|
|
7020
|
+
/**
|
|
7021
|
+
* Set the {@link DateTime} that this {@link FakeClock} will return.
|
|
7022
|
+
* @param currentTime The {@link DateTime} that this {@link FakeClock} will return.
|
|
7023
|
+
*/
|
|
7024
|
+
setCurrentTime(currentTime) {
|
|
7025
|
+
this.currentTime = currentTime;
|
|
7026
|
+
return this;
|
|
7027
|
+
}
|
|
7028
|
+
now() {
|
|
7029
|
+
return this.currentTime;
|
|
7030
|
+
}
|
|
7031
|
+
};
|
|
6733
7032
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6734
7033
|
0 && (module.exports = {
|
|
6735
7034
|
AssertTest,
|
|
6736
7035
|
BasicTestSkip,
|
|
6737
7036
|
ConsoleTestRunner,
|
|
6738
7037
|
FailedTest,
|
|
7038
|
+
FakeClock,
|
|
6739
7039
|
SkippedTest,
|
|
6740
7040
|
Test,
|
|
6741
7041
|
TestAction,
|