@reifydb/core 0.2.0 → 0.4.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/dist/index.d.ts +20 -238
- package/dist/index.js +133 -127
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/constant.ts
|
|
2
|
-
var
|
|
2
|
+
var NONE_VALUE = "\u27EAnone\u27EB";
|
|
3
3
|
|
|
4
4
|
// src/value/blob.ts
|
|
5
5
|
var BlobValue = class _BlobValue {
|
|
@@ -101,7 +101,7 @@ var BlobValue = class _BlobValue {
|
|
|
101
101
|
*/
|
|
102
102
|
static parse(str) {
|
|
103
103
|
const trimmed = str.trim();
|
|
104
|
-
if (trimmed === "" || trimmed ===
|
|
104
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
105
105
|
return new _BlobValue(void 0);
|
|
106
106
|
}
|
|
107
107
|
const parsed = _BlobValue.parseString(trimmed);
|
|
@@ -161,7 +161,7 @@ var BlobValue = class _BlobValue {
|
|
|
161
161
|
*/
|
|
162
162
|
toString() {
|
|
163
163
|
if (this.bytes === void 0) {
|
|
164
|
-
return "
|
|
164
|
+
return "none";
|
|
165
165
|
}
|
|
166
166
|
return this.toHex();
|
|
167
167
|
}
|
|
@@ -218,7 +218,7 @@ var BlobValue = class _BlobValue {
|
|
|
218
218
|
encode() {
|
|
219
219
|
return {
|
|
220
220
|
type: this.type,
|
|
221
|
-
value: this.value === void 0 ?
|
|
221
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
222
222
|
};
|
|
223
223
|
}
|
|
224
224
|
};
|
|
@@ -238,7 +238,7 @@ var BooleanValue = class _BooleanValue {
|
|
|
238
238
|
}
|
|
239
239
|
static parse(str) {
|
|
240
240
|
const trimmed = str.trim().toLowerCase();
|
|
241
|
-
if (trimmed === "" || trimmed ===
|
|
241
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
242
242
|
return new _BooleanValue(void 0);
|
|
243
243
|
}
|
|
244
244
|
if (trimmed === "true") {
|
|
@@ -253,7 +253,7 @@ var BooleanValue = class _BooleanValue {
|
|
|
253
253
|
return this.value;
|
|
254
254
|
}
|
|
255
255
|
toString() {
|
|
256
|
-
return this.value === void 0 ? "
|
|
256
|
+
return this.value === void 0 ? "none" : this.value.toString();
|
|
257
257
|
}
|
|
258
258
|
/**
|
|
259
259
|
* Compare two boolean values for equality
|
|
@@ -268,7 +268,7 @@ var BooleanValue = class _BooleanValue {
|
|
|
268
268
|
encode() {
|
|
269
269
|
return {
|
|
270
270
|
type: this.type,
|
|
271
|
-
value: this.value === void 0 ?
|
|
271
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
272
272
|
};
|
|
273
273
|
}
|
|
274
274
|
};
|
|
@@ -335,7 +335,7 @@ var DateValue = class _DateValue {
|
|
|
335
335
|
*/
|
|
336
336
|
static parse(str) {
|
|
337
337
|
const trimmed = str.trim();
|
|
338
|
-
if (trimmed === "" || trimmed ===
|
|
338
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
339
339
|
return new _DateValue(void 0);
|
|
340
340
|
}
|
|
341
341
|
const parsed = _DateValue.parseDate(trimmed);
|
|
@@ -414,7 +414,7 @@ var DateValue = class _DateValue {
|
|
|
414
414
|
*/
|
|
415
415
|
toString() {
|
|
416
416
|
if (this.months === void 0 || this.days === void 0) {
|
|
417
|
-
return "
|
|
417
|
+
return "none";
|
|
418
418
|
}
|
|
419
419
|
const year = Math.floor(this.months / 12);
|
|
420
420
|
let m = this.months % 12;
|
|
@@ -505,7 +505,7 @@ var DateValue = class _DateValue {
|
|
|
505
505
|
encode() {
|
|
506
506
|
return {
|
|
507
507
|
type: this.type,
|
|
508
|
-
value: this.value === void 0 ?
|
|
508
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
509
509
|
};
|
|
510
510
|
}
|
|
511
511
|
};
|
|
@@ -581,7 +581,7 @@ var _TimeValue = class _TimeValue {
|
|
|
581
581
|
*/
|
|
582
582
|
static parse(str) {
|
|
583
583
|
const trimmed = str.trim();
|
|
584
|
-
if (trimmed === "" || trimmed ===
|
|
584
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
585
585
|
return new _TimeValue(void 0);
|
|
586
586
|
}
|
|
587
587
|
const parsed = _TimeValue.parseTime(trimmed);
|
|
@@ -638,7 +638,7 @@ var _TimeValue = class _TimeValue {
|
|
|
638
638
|
*/
|
|
639
639
|
toString() {
|
|
640
640
|
if (this.value === void 0) {
|
|
641
|
-
return "
|
|
641
|
+
return "none";
|
|
642
642
|
}
|
|
643
643
|
const hour = this.hour();
|
|
644
644
|
const minute = this.minute();
|
|
@@ -694,7 +694,7 @@ var _TimeValue = class _TimeValue {
|
|
|
694
694
|
encode() {
|
|
695
695
|
return {
|
|
696
696
|
type: this.type,
|
|
697
|
-
value: this.value === void 0 ?
|
|
697
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
698
698
|
};
|
|
699
699
|
}
|
|
700
700
|
};
|
|
@@ -846,7 +846,7 @@ var DateTimeValue = class _DateTimeValue {
|
|
|
846
846
|
*/
|
|
847
847
|
static parse(str) {
|
|
848
848
|
const trimmed = str.trim();
|
|
849
|
-
if (trimmed === "" || trimmed ===
|
|
849
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
850
850
|
return new _DateTimeValue(void 0);
|
|
851
851
|
}
|
|
852
852
|
const parsed = _DateTimeValue.parseDateTime(trimmed);
|
|
@@ -918,7 +918,7 @@ var DateTimeValue = class _DateTimeValue {
|
|
|
918
918
|
*/
|
|
919
919
|
toString() {
|
|
920
920
|
if (this.months === void 0 || this.days === void 0 || this.nanos === void 0) {
|
|
921
|
-
return "
|
|
921
|
+
return "none";
|
|
922
922
|
}
|
|
923
923
|
const year = Math.floor(this.months / 12);
|
|
924
924
|
let m = this.months % 12;
|
|
@@ -1046,7 +1046,7 @@ var DateTimeValue = class _DateTimeValue {
|
|
|
1046
1046
|
encode() {
|
|
1047
1047
|
return {
|
|
1048
1048
|
type: this.type,
|
|
1049
|
-
value: this.value === void 0 ?
|
|
1049
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
1050
1050
|
};
|
|
1051
1051
|
}
|
|
1052
1052
|
};
|
|
@@ -1065,7 +1065,7 @@ var DecimalValue = class _DecimalValue {
|
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
1067
|
static parse(str) {
|
|
1068
|
-
if (str ===
|
|
1068
|
+
if (str === NONE_VALUE) {
|
|
1069
1069
|
return new _DecimalValue(void 0);
|
|
1070
1070
|
}
|
|
1071
1071
|
return new _DecimalValue(str);
|
|
@@ -1074,7 +1074,7 @@ var DecimalValue = class _DecimalValue {
|
|
|
1074
1074
|
return this.value;
|
|
1075
1075
|
}
|
|
1076
1076
|
toString() {
|
|
1077
|
-
return this.value === void 0 ? "
|
|
1077
|
+
return this.value === void 0 ? "none" : this.value;
|
|
1078
1078
|
}
|
|
1079
1079
|
equals(other) {
|
|
1080
1080
|
if (other.type !== this.type) {
|
|
@@ -1086,7 +1086,7 @@ var DecimalValue = class _DecimalValue {
|
|
|
1086
1086
|
encode() {
|
|
1087
1087
|
return {
|
|
1088
1088
|
type: this.type,
|
|
1089
|
-
value: this.value === void 0 ?
|
|
1089
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
1090
1090
|
};
|
|
1091
1091
|
}
|
|
1092
1092
|
};
|
|
@@ -1120,7 +1120,7 @@ var _Float4Value = class _Float4Value {
|
|
|
1120
1120
|
}
|
|
1121
1121
|
static parse(str) {
|
|
1122
1122
|
const trimmed = str.trim();
|
|
1123
|
-
if (trimmed === "" || trimmed ===
|
|
1123
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
1124
1124
|
return new _Float4Value(void 0);
|
|
1125
1125
|
}
|
|
1126
1126
|
const num = Number(trimmed);
|
|
@@ -1133,7 +1133,7 @@ var _Float4Value = class _Float4Value {
|
|
|
1133
1133
|
return this.value;
|
|
1134
1134
|
}
|
|
1135
1135
|
toString() {
|
|
1136
|
-
return this.value === void 0 ? "
|
|
1136
|
+
return this.value === void 0 ? "none" : this.value.toString();
|
|
1137
1137
|
}
|
|
1138
1138
|
/**
|
|
1139
1139
|
* Compare two Float4 values for equality with limited precision
|
|
@@ -1152,7 +1152,7 @@ var _Float4Value = class _Float4Value {
|
|
|
1152
1152
|
encode() {
|
|
1153
1153
|
return {
|
|
1154
1154
|
type: this.type,
|
|
1155
|
-
value: this.value === void 0 ?
|
|
1155
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
1156
1156
|
};
|
|
1157
1157
|
}
|
|
1158
1158
|
};
|
|
@@ -1176,7 +1176,7 @@ var Float8Value = class _Float8Value {
|
|
|
1176
1176
|
}
|
|
1177
1177
|
static parse(str) {
|
|
1178
1178
|
const trimmed = str.trim();
|
|
1179
|
-
if (trimmed === "" || trimmed ===
|
|
1179
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
1180
1180
|
return new _Float8Value(void 0);
|
|
1181
1181
|
}
|
|
1182
1182
|
const num = Number(trimmed);
|
|
@@ -1189,7 +1189,7 @@ var Float8Value = class _Float8Value {
|
|
|
1189
1189
|
return this.value;
|
|
1190
1190
|
}
|
|
1191
1191
|
toString() {
|
|
1192
|
-
return this.value === void 0 ? "
|
|
1192
|
+
return this.value === void 0 ? "none" : this.value.toString();
|
|
1193
1193
|
}
|
|
1194
1194
|
/**
|
|
1195
1195
|
* Compare two Float8 values for equality
|
|
@@ -1204,7 +1204,7 @@ var Float8Value = class _Float8Value {
|
|
|
1204
1204
|
encode() {
|
|
1205
1205
|
return {
|
|
1206
1206
|
type: this.type,
|
|
1207
|
-
value: this.value === void 0 ?
|
|
1207
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
1208
1208
|
};
|
|
1209
1209
|
}
|
|
1210
1210
|
};
|
|
@@ -1225,7 +1225,7 @@ var _Int1Value = class _Int1Value {
|
|
|
1225
1225
|
}
|
|
1226
1226
|
static parse(str) {
|
|
1227
1227
|
const trimmed = str.trim();
|
|
1228
|
-
if (trimmed === "" || trimmed ===
|
|
1228
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
1229
1229
|
return new _Int1Value(void 0);
|
|
1230
1230
|
}
|
|
1231
1231
|
const num = Number(trimmed);
|
|
@@ -1238,7 +1238,7 @@ var _Int1Value = class _Int1Value {
|
|
|
1238
1238
|
return this.value;
|
|
1239
1239
|
}
|
|
1240
1240
|
toString() {
|
|
1241
|
-
return this.value === void 0 ? "
|
|
1241
|
+
return this.value === void 0 ? "none" : this.value.toString();
|
|
1242
1242
|
}
|
|
1243
1243
|
/**
|
|
1244
1244
|
* Compare two Int1 values for equality
|
|
@@ -1253,7 +1253,7 @@ var _Int1Value = class _Int1Value {
|
|
|
1253
1253
|
encode() {
|
|
1254
1254
|
return {
|
|
1255
1255
|
type: this.type,
|
|
1256
|
-
value: this.value === void 0 ?
|
|
1256
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
1257
1257
|
};
|
|
1258
1258
|
}
|
|
1259
1259
|
};
|
|
@@ -1277,7 +1277,7 @@ var _Int2Value = class _Int2Value {
|
|
|
1277
1277
|
}
|
|
1278
1278
|
static parse(str) {
|
|
1279
1279
|
const trimmed = str.trim();
|
|
1280
|
-
if (trimmed === "" || trimmed ===
|
|
1280
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
1281
1281
|
return new _Int2Value(void 0);
|
|
1282
1282
|
}
|
|
1283
1283
|
const num = Number(trimmed);
|
|
@@ -1290,7 +1290,7 @@ var _Int2Value = class _Int2Value {
|
|
|
1290
1290
|
return this.value;
|
|
1291
1291
|
}
|
|
1292
1292
|
toString() {
|
|
1293
|
-
return this.value === void 0 ? "
|
|
1293
|
+
return this.value === void 0 ? "none" : this.value.toString();
|
|
1294
1294
|
}
|
|
1295
1295
|
/**
|
|
1296
1296
|
* Compare two Int2 values for equality
|
|
@@ -1305,7 +1305,7 @@ var _Int2Value = class _Int2Value {
|
|
|
1305
1305
|
encode() {
|
|
1306
1306
|
return {
|
|
1307
1307
|
type: this.type,
|
|
1308
|
-
value: this.value === void 0 ?
|
|
1308
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
1309
1309
|
};
|
|
1310
1310
|
}
|
|
1311
1311
|
};
|
|
@@ -1329,7 +1329,7 @@ var _Int4Value = class _Int4Value {
|
|
|
1329
1329
|
}
|
|
1330
1330
|
static parse(str) {
|
|
1331
1331
|
const trimmed = str.trim();
|
|
1332
|
-
if (trimmed === "" || trimmed ===
|
|
1332
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
1333
1333
|
return new _Int4Value(void 0);
|
|
1334
1334
|
}
|
|
1335
1335
|
const num = Number(trimmed);
|
|
@@ -1342,7 +1342,7 @@ var _Int4Value = class _Int4Value {
|
|
|
1342
1342
|
return this.value;
|
|
1343
1343
|
}
|
|
1344
1344
|
toString() {
|
|
1345
|
-
return this.value === void 0 ? "
|
|
1345
|
+
return this.value === void 0 ? "none" : this.value.toString();
|
|
1346
1346
|
}
|
|
1347
1347
|
/**
|
|
1348
1348
|
* Compare two Int4 values for equality
|
|
@@ -1357,7 +1357,7 @@ var _Int4Value = class _Int4Value {
|
|
|
1357
1357
|
encode() {
|
|
1358
1358
|
return {
|
|
1359
1359
|
type: this.type,
|
|
1360
|
-
value: this.value === void 0 ?
|
|
1360
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
1361
1361
|
};
|
|
1362
1362
|
}
|
|
1363
1363
|
};
|
|
@@ -1381,7 +1381,7 @@ var _Int8Value = class _Int8Value {
|
|
|
1381
1381
|
}
|
|
1382
1382
|
static parse(str) {
|
|
1383
1383
|
const trimmed = str.trim();
|
|
1384
|
-
if (trimmed === "" || trimmed ===
|
|
1384
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
1385
1385
|
return new _Int8Value(void 0);
|
|
1386
1386
|
}
|
|
1387
1387
|
let value;
|
|
@@ -1399,7 +1399,7 @@ var _Int8Value = class _Int8Value {
|
|
|
1399
1399
|
return this.value;
|
|
1400
1400
|
}
|
|
1401
1401
|
toString() {
|
|
1402
|
-
return this.value === void 0 ? "
|
|
1402
|
+
return this.value === void 0 ? "none" : this.value.toString();
|
|
1403
1403
|
}
|
|
1404
1404
|
/**
|
|
1405
1405
|
* Compare two Int8 values for equality
|
|
@@ -1414,7 +1414,7 @@ var _Int8Value = class _Int8Value {
|
|
|
1414
1414
|
encode() {
|
|
1415
1415
|
return {
|
|
1416
1416
|
type: this.type,
|
|
1417
|
-
value: this.value === void 0 ?
|
|
1417
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
1418
1418
|
};
|
|
1419
1419
|
}
|
|
1420
1420
|
};
|
|
@@ -1449,7 +1449,7 @@ var _Int16Value = class _Int16Value {
|
|
|
1449
1449
|
}
|
|
1450
1450
|
static parse(str) {
|
|
1451
1451
|
const trimmed = str.trim();
|
|
1452
|
-
if (trimmed === "" || trimmed ===
|
|
1452
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
1453
1453
|
return new _Int16Value(void 0);
|
|
1454
1454
|
}
|
|
1455
1455
|
let value;
|
|
@@ -1467,7 +1467,7 @@ var _Int16Value = class _Int16Value {
|
|
|
1467
1467
|
return this.value;
|
|
1468
1468
|
}
|
|
1469
1469
|
toString() {
|
|
1470
|
-
return this.value === void 0 ? "
|
|
1470
|
+
return this.value === void 0 ? "none" : this.value.toString();
|
|
1471
1471
|
}
|
|
1472
1472
|
/**
|
|
1473
1473
|
* Compare two Int16 values for equality
|
|
@@ -1482,7 +1482,7 @@ var _Int16Value = class _Int16Value {
|
|
|
1482
1482
|
encode() {
|
|
1483
1483
|
return {
|
|
1484
1484
|
type: this.type,
|
|
1485
|
-
value: this.value === void 0 ?
|
|
1485
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
1486
1486
|
};
|
|
1487
1487
|
}
|
|
1488
1488
|
};
|
|
@@ -1600,7 +1600,7 @@ var DurationValue = class _DurationValue {
|
|
|
1600
1600
|
*/
|
|
1601
1601
|
static parse(str) {
|
|
1602
1602
|
const trimmed = str.trim();
|
|
1603
|
-
if (trimmed === "" || trimmed ===
|
|
1603
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
1604
1604
|
return new _DurationValue(void 0);
|
|
1605
1605
|
}
|
|
1606
1606
|
const parsed = _DurationValue.parseDuration(trimmed);
|
|
@@ -1703,7 +1703,7 @@ var DurationValue = class _DurationValue {
|
|
|
1703
1703
|
*/
|
|
1704
1704
|
toIsoString() {
|
|
1705
1705
|
if (this.months === void 0 || this.days === void 0 || this.nanos === void 0) {
|
|
1706
|
-
return "
|
|
1706
|
+
return "none";
|
|
1707
1707
|
}
|
|
1708
1708
|
if (this.months === 0 && this.days === 0 && this.nanos === 0n) {
|
|
1709
1709
|
return "PT0S";
|
|
@@ -1755,7 +1755,7 @@ var DurationValue = class _DurationValue {
|
|
|
1755
1755
|
*/
|
|
1756
1756
|
toString() {
|
|
1757
1757
|
if (this.months === void 0 || this.days === void 0 || this.nanos === void 0) {
|
|
1758
|
-
return "
|
|
1758
|
+
return "none";
|
|
1759
1759
|
}
|
|
1760
1760
|
if (this.months === 0 && this.days === 0 && this.nanos === 0n) {
|
|
1761
1761
|
return "00:00:00";
|
|
@@ -1874,12 +1874,12 @@ var DurationValue = class _DurationValue {
|
|
|
1874
1874
|
return this.months === otherDuration.months && this.days === otherDuration.days && this.nanos === otherDuration.nanos;
|
|
1875
1875
|
}
|
|
1876
1876
|
toJSON() {
|
|
1877
|
-
return this.value === void 0 ?
|
|
1877
|
+
return this.value === void 0 ? NONE_VALUE : this.toIsoString();
|
|
1878
1878
|
}
|
|
1879
1879
|
encode() {
|
|
1880
1880
|
return {
|
|
1881
1881
|
type: this.type,
|
|
1882
|
-
value: this.value === void 0 ?
|
|
1882
|
+
value: this.value === void 0 ? NONE_VALUE : this.toIsoString()
|
|
1883
1883
|
};
|
|
1884
1884
|
}
|
|
1885
1885
|
};
|
|
@@ -1900,7 +1900,7 @@ var _Uint1Value = class _Uint1Value {
|
|
|
1900
1900
|
}
|
|
1901
1901
|
static parse(str) {
|
|
1902
1902
|
const trimmed = str.trim();
|
|
1903
|
-
if (trimmed === "" || trimmed ===
|
|
1903
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
1904
1904
|
return new _Uint1Value(void 0);
|
|
1905
1905
|
}
|
|
1906
1906
|
const num = Number(trimmed);
|
|
@@ -1913,7 +1913,7 @@ var _Uint1Value = class _Uint1Value {
|
|
|
1913
1913
|
return this.value;
|
|
1914
1914
|
}
|
|
1915
1915
|
toString() {
|
|
1916
|
-
return this.value === void 0 ? "
|
|
1916
|
+
return this.value === void 0 ? "none" : this.value.toString();
|
|
1917
1917
|
}
|
|
1918
1918
|
/**
|
|
1919
1919
|
* Compare two Uint1 values for equality
|
|
@@ -1928,7 +1928,7 @@ var _Uint1Value = class _Uint1Value {
|
|
|
1928
1928
|
encode() {
|
|
1929
1929
|
return {
|
|
1930
1930
|
type: this.type,
|
|
1931
|
-
value: this.value === void 0 ?
|
|
1931
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
1932
1932
|
};
|
|
1933
1933
|
}
|
|
1934
1934
|
};
|
|
@@ -1952,7 +1952,7 @@ var _Uint2Value = class _Uint2Value {
|
|
|
1952
1952
|
}
|
|
1953
1953
|
static parse(str) {
|
|
1954
1954
|
const trimmed = str.trim();
|
|
1955
|
-
if (trimmed === "" || trimmed ===
|
|
1955
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
1956
1956
|
return new _Uint2Value(void 0);
|
|
1957
1957
|
}
|
|
1958
1958
|
const num = Number(trimmed);
|
|
@@ -1965,7 +1965,7 @@ var _Uint2Value = class _Uint2Value {
|
|
|
1965
1965
|
return this.value;
|
|
1966
1966
|
}
|
|
1967
1967
|
toString() {
|
|
1968
|
-
return this.value === void 0 ? "
|
|
1968
|
+
return this.value === void 0 ? "none" : this.value.toString();
|
|
1969
1969
|
}
|
|
1970
1970
|
/**
|
|
1971
1971
|
* Compare two Uint2 values for equality
|
|
@@ -1980,7 +1980,7 @@ var _Uint2Value = class _Uint2Value {
|
|
|
1980
1980
|
encode() {
|
|
1981
1981
|
return {
|
|
1982
1982
|
type: this.type,
|
|
1983
|
-
value: this.value === void 0 ?
|
|
1983
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
1984
1984
|
};
|
|
1985
1985
|
}
|
|
1986
1986
|
};
|
|
@@ -2004,7 +2004,7 @@ var _Uint4Value = class _Uint4Value {
|
|
|
2004
2004
|
}
|
|
2005
2005
|
static parse(str) {
|
|
2006
2006
|
const trimmed = str.trim();
|
|
2007
|
-
if (trimmed === "" || trimmed ===
|
|
2007
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
2008
2008
|
return new _Uint4Value(void 0);
|
|
2009
2009
|
}
|
|
2010
2010
|
const num = Number(trimmed);
|
|
@@ -2017,7 +2017,7 @@ var _Uint4Value = class _Uint4Value {
|
|
|
2017
2017
|
return this.value;
|
|
2018
2018
|
}
|
|
2019
2019
|
toString() {
|
|
2020
|
-
return this.value === void 0 ? "
|
|
2020
|
+
return this.value === void 0 ? "none" : this.value.toString();
|
|
2021
2021
|
}
|
|
2022
2022
|
/**
|
|
2023
2023
|
* Compare two Uint4 values for equality
|
|
@@ -2032,7 +2032,7 @@ var _Uint4Value = class _Uint4Value {
|
|
|
2032
2032
|
encode() {
|
|
2033
2033
|
return {
|
|
2034
2034
|
type: this.type,
|
|
2035
|
-
value: this.value === void 0 ?
|
|
2035
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
2036
2036
|
};
|
|
2037
2037
|
}
|
|
2038
2038
|
};
|
|
@@ -2056,7 +2056,7 @@ var _Uint8Value = class _Uint8Value {
|
|
|
2056
2056
|
}
|
|
2057
2057
|
static parse(str) {
|
|
2058
2058
|
const trimmed = str.trim();
|
|
2059
|
-
if (trimmed === "" || trimmed ===
|
|
2059
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
2060
2060
|
return new _Uint8Value(void 0);
|
|
2061
2061
|
}
|
|
2062
2062
|
let value;
|
|
@@ -2078,7 +2078,7 @@ var _Uint8Value = class _Uint8Value {
|
|
|
2078
2078
|
return Number(this.value);
|
|
2079
2079
|
}
|
|
2080
2080
|
toString() {
|
|
2081
|
-
return this.value === void 0 ? "
|
|
2081
|
+
return this.value === void 0 ? "none" : this.value.toString();
|
|
2082
2082
|
}
|
|
2083
2083
|
/**
|
|
2084
2084
|
* Compare two Uint8 values for equality
|
|
@@ -2093,7 +2093,7 @@ var _Uint8Value = class _Uint8Value {
|
|
|
2093
2093
|
encode() {
|
|
2094
2094
|
return {
|
|
2095
2095
|
type: this.type,
|
|
2096
|
-
value: this.value === void 0 ?
|
|
2096
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
2097
2097
|
};
|
|
2098
2098
|
}
|
|
2099
2099
|
};
|
|
@@ -2128,7 +2128,7 @@ var _Uint16Value = class _Uint16Value {
|
|
|
2128
2128
|
}
|
|
2129
2129
|
static parse(str) {
|
|
2130
2130
|
const trimmed = str.trim();
|
|
2131
|
-
if (trimmed === "" || trimmed ===
|
|
2131
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
2132
2132
|
return new _Uint16Value(void 0);
|
|
2133
2133
|
}
|
|
2134
2134
|
let value;
|
|
@@ -2146,7 +2146,7 @@ var _Uint16Value = class _Uint16Value {
|
|
|
2146
2146
|
return this.value;
|
|
2147
2147
|
}
|
|
2148
2148
|
toString() {
|
|
2149
|
-
return this.value === void 0 ? "
|
|
2149
|
+
return this.value === void 0 ? "none" : this.value.toString();
|
|
2150
2150
|
}
|
|
2151
2151
|
/**
|
|
2152
2152
|
* Compare two Uint16 values for equality
|
|
@@ -2161,7 +2161,7 @@ var _Uint16Value = class _Uint16Value {
|
|
|
2161
2161
|
encode() {
|
|
2162
2162
|
return {
|
|
2163
2163
|
type: this.type,
|
|
2164
|
-
value: this.value === void 0 ?
|
|
2164
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
2165
2165
|
};
|
|
2166
2166
|
}
|
|
2167
2167
|
};
|
|
@@ -2169,73 +2169,44 @@ _Uint16Value.MIN_VALUE = BigInt(0);
|
|
|
2169
2169
|
_Uint16Value.MAX_VALUE = BigInt("340282366920938463463374607431768211455");
|
|
2170
2170
|
var Uint16Value = _Uint16Value;
|
|
2171
2171
|
|
|
2172
|
-
// src/value/
|
|
2173
|
-
var
|
|
2174
|
-
constructor() {
|
|
2175
|
-
this.type = "
|
|
2172
|
+
// src/value/none.ts
|
|
2173
|
+
var NoneValue = class _NoneValue {
|
|
2174
|
+
constructor(innerType) {
|
|
2175
|
+
this.type = "None";
|
|
2176
|
+
this.innerType = innerType ?? "None";
|
|
2176
2177
|
}
|
|
2177
|
-
|
|
2178
|
-
* Create a new UndefinedValue
|
|
2179
|
-
*/
|
|
2180
|
-
static new() {
|
|
2181
|
-
return new _UndefinedValue();
|
|
2182
|
-
}
|
|
2183
|
-
/**
|
|
2184
|
-
* Get default UndefinedValue
|
|
2185
|
-
*/
|
|
2186
|
-
static default() {
|
|
2187
|
-
return new _UndefinedValue();
|
|
2188
|
-
}
|
|
2189
|
-
/**
|
|
2190
|
-
* Parse a string as undefined
|
|
2191
|
-
*/
|
|
2192
|
-
static parse(str) {
|
|
2178
|
+
static parse(str, innerType) {
|
|
2193
2179
|
const trimmed = str.trim();
|
|
2194
|
-
if (trimmed === "" || trimmed ===
|
|
2195
|
-
return new
|
|
2180
|
+
if (trimmed === "" || trimmed === NONE_VALUE || trimmed === "none") {
|
|
2181
|
+
return new _NoneValue(innerType);
|
|
2196
2182
|
}
|
|
2197
|
-
throw new Error(`Cannot parse "${str}" as
|
|
2183
|
+
throw new Error(`Cannot parse "${str}" as None`);
|
|
2198
2184
|
}
|
|
2199
|
-
|
|
2200
|
-
* Check if this value is undefined (always true)
|
|
2201
|
-
*/
|
|
2202
|
-
isUndefined() {
|
|
2185
|
+
isNone() {
|
|
2203
2186
|
return true;
|
|
2204
2187
|
}
|
|
2205
|
-
/**
|
|
2206
|
-
* Format as string
|
|
2207
|
-
*/
|
|
2208
2188
|
toString() {
|
|
2209
|
-
return "
|
|
2189
|
+
return "none";
|
|
2210
2190
|
}
|
|
2211
2191
|
valueOf() {
|
|
2212
2192
|
return void 0;
|
|
2213
2193
|
}
|
|
2214
|
-
/**
|
|
2215
|
-
* Get the internal representation (always undefined)
|
|
2216
|
-
*/
|
|
2217
2194
|
get value() {
|
|
2218
2195
|
return void 0;
|
|
2219
2196
|
}
|
|
2220
|
-
/**
|
|
2221
|
-
* Compare two undefined values (always equal)
|
|
2222
|
-
*/
|
|
2223
2197
|
equals(other) {
|
|
2224
|
-
if (other
|
|
2198
|
+
if (!(other instanceof _NoneValue)) {
|
|
2225
2199
|
return false;
|
|
2226
2200
|
}
|
|
2227
2201
|
return true;
|
|
2228
2202
|
}
|
|
2229
|
-
/**
|
|
2230
|
-
* Compare two undefined values for ordering (always equal)
|
|
2231
|
-
*/
|
|
2232
2203
|
compare(other) {
|
|
2233
2204
|
return 0;
|
|
2234
2205
|
}
|
|
2235
2206
|
encode() {
|
|
2236
2207
|
return {
|
|
2237
|
-
type:
|
|
2238
|
-
value:
|
|
2208
|
+
type: "None",
|
|
2209
|
+
value: NONE_VALUE
|
|
2239
2210
|
};
|
|
2240
2211
|
}
|
|
2241
2212
|
};
|
|
@@ -2254,7 +2225,7 @@ var Utf8Value = class _Utf8Value {
|
|
|
2254
2225
|
}
|
|
2255
2226
|
}
|
|
2256
2227
|
static parse(str) {
|
|
2257
|
-
if (str ===
|
|
2228
|
+
if (str === NONE_VALUE) {
|
|
2258
2229
|
return new _Utf8Value(void 0);
|
|
2259
2230
|
}
|
|
2260
2231
|
return new _Utf8Value(str);
|
|
@@ -2263,7 +2234,7 @@ var Utf8Value = class _Utf8Value {
|
|
|
2263
2234
|
return this.value;
|
|
2264
2235
|
}
|
|
2265
2236
|
toString() {
|
|
2266
|
-
return this.value === void 0 ? "
|
|
2237
|
+
return this.value === void 0 ? "none" : this.value;
|
|
2267
2238
|
}
|
|
2268
2239
|
/**
|
|
2269
2240
|
* Compare two Utf8 values for equality
|
|
@@ -2278,7 +2249,7 @@ var Utf8Value = class _Utf8Value {
|
|
|
2278
2249
|
encode() {
|
|
2279
2250
|
return {
|
|
2280
2251
|
type: this.type,
|
|
2281
|
-
value: this.value === void 0 ?
|
|
2252
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
2282
2253
|
};
|
|
2283
2254
|
}
|
|
2284
2255
|
};
|
|
@@ -2333,7 +2304,7 @@ var Uuid4Value = class _Uuid4Value {
|
|
|
2333
2304
|
*/
|
|
2334
2305
|
static parse(str) {
|
|
2335
2306
|
const trimmed = str.trim();
|
|
2336
|
-
if (trimmed === "" || trimmed ===
|
|
2307
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
2337
2308
|
return new _Uuid4Value(void 0);
|
|
2338
2309
|
}
|
|
2339
2310
|
if (!validate(trimmed)) {
|
|
@@ -2381,7 +2352,7 @@ var Uuid4Value = class _Uuid4Value {
|
|
|
2381
2352
|
*/
|
|
2382
2353
|
toString() {
|
|
2383
2354
|
if (this.uuid === void 0) {
|
|
2384
|
-
return "
|
|
2355
|
+
return "none";
|
|
2385
2356
|
}
|
|
2386
2357
|
return this.uuid;
|
|
2387
2358
|
}
|
|
@@ -2424,7 +2395,7 @@ var Uuid4Value = class _Uuid4Value {
|
|
|
2424
2395
|
encode() {
|
|
2425
2396
|
return {
|
|
2426
2397
|
type: this.type,
|
|
2427
|
-
value: this.value === void 0 ?
|
|
2398
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
2428
2399
|
};
|
|
2429
2400
|
}
|
|
2430
2401
|
};
|
|
@@ -2479,7 +2450,7 @@ var Uuid7Value = class _Uuid7Value {
|
|
|
2479
2450
|
*/
|
|
2480
2451
|
static parse(str) {
|
|
2481
2452
|
const trimmed = str.trim();
|
|
2482
|
-
if (trimmed === "" || trimmed ===
|
|
2453
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
2483
2454
|
return new _Uuid7Value(void 0);
|
|
2484
2455
|
}
|
|
2485
2456
|
if (!validate2(trimmed)) {
|
|
@@ -2537,7 +2508,7 @@ var Uuid7Value = class _Uuid7Value {
|
|
|
2537
2508
|
*/
|
|
2538
2509
|
toString() {
|
|
2539
2510
|
if (this.uuid === void 0) {
|
|
2540
|
-
return "
|
|
2511
|
+
return "none";
|
|
2541
2512
|
}
|
|
2542
2513
|
return this.uuid;
|
|
2543
2514
|
}
|
|
@@ -2581,7 +2552,7 @@ var Uuid7Value = class _Uuid7Value {
|
|
|
2581
2552
|
encode() {
|
|
2582
2553
|
return {
|
|
2583
2554
|
type: this.type,
|
|
2584
|
-
value: this.value === void 0 ?
|
|
2555
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
2585
2556
|
};
|
|
2586
2557
|
}
|
|
2587
2558
|
};
|
|
@@ -2624,7 +2595,7 @@ var IdentityIdValue = class _IdentityIdValue {
|
|
|
2624
2595
|
*/
|
|
2625
2596
|
static parse(str) {
|
|
2626
2597
|
const trimmed = str.trim();
|
|
2627
|
-
if (trimmed === "" || trimmed ===
|
|
2598
|
+
if (trimmed === "" || trimmed === NONE_VALUE) {
|
|
2628
2599
|
return new _IdentityIdValue(void 0);
|
|
2629
2600
|
}
|
|
2630
2601
|
if (!validate3(trimmed)) {
|
|
@@ -2646,7 +2617,7 @@ var IdentityIdValue = class _IdentityIdValue {
|
|
|
2646
2617
|
* Format as string
|
|
2647
2618
|
*/
|
|
2648
2619
|
toString() {
|
|
2649
|
-
return this.value === void 0 ? "
|
|
2620
|
+
return this.value === void 0 ? "none" : this.value;
|
|
2650
2621
|
}
|
|
2651
2622
|
/**
|
|
2652
2623
|
* Extract the timestamp from the UUID v7 (milliseconds since Unix epoch)
|
|
@@ -2677,17 +2648,31 @@ var IdentityIdValue = class _IdentityIdValue {
|
|
|
2677
2648
|
encode() {
|
|
2678
2649
|
return {
|
|
2679
2650
|
type: this.type,
|
|
2680
|
-
value: this.value === void 0 ?
|
|
2651
|
+
value: this.value === void 0 ? NONE_VALUE : this.toString()
|
|
2681
2652
|
};
|
|
2682
2653
|
}
|
|
2683
2654
|
};
|
|
2684
2655
|
|
|
2685
2656
|
// src/value/index.ts
|
|
2657
|
+
function isOptionType(t) {
|
|
2658
|
+
return typeof t === "object" && t !== null && "Option" in t;
|
|
2659
|
+
}
|
|
2660
|
+
function unwrapOptionType(t) {
|
|
2661
|
+
if (isOptionType(t)) return unwrapOptionType(t.Option);
|
|
2662
|
+
return t;
|
|
2663
|
+
}
|
|
2686
2664
|
var Value = class {
|
|
2687
2665
|
};
|
|
2688
2666
|
|
|
2689
2667
|
// src/decoder.ts
|
|
2690
2668
|
function decode(pair) {
|
|
2669
|
+
if (isOptionType(pair.type)) {
|
|
2670
|
+
const innerType = unwrapOptionType(pair.type);
|
|
2671
|
+
if (pair.value === NONE_VALUE || pair.value === "") {
|
|
2672
|
+
return new NoneValue(innerType);
|
|
2673
|
+
}
|
|
2674
|
+
return decode({ type: innerType, value: pair.value });
|
|
2675
|
+
}
|
|
2691
2676
|
switch (pair.type) {
|
|
2692
2677
|
case "Blob":
|
|
2693
2678
|
return BlobValue.parse(pair.value);
|
|
@@ -2727,8 +2712,8 @@ function decode(pair) {
|
|
|
2727
2712
|
return Uint8Value.parse(pair.value);
|
|
2728
2713
|
case "Uint16":
|
|
2729
2714
|
return Uint16Value.parse(pair.value);
|
|
2730
|
-
case "
|
|
2731
|
-
return
|
|
2715
|
+
case "None":
|
|
2716
|
+
return NoneValue.parse(pair.value);
|
|
2732
2717
|
case "Utf8":
|
|
2733
2718
|
return Utf8Value.parse(pair.value);
|
|
2734
2719
|
case "Uuid4":
|
|
@@ -2831,8 +2816,8 @@ var SchemaBuilder = class {
|
|
|
2831
2816
|
static uuid() {
|
|
2832
2817
|
return { kind: "primitive", type: "Uuid7" };
|
|
2833
2818
|
}
|
|
2834
|
-
static
|
|
2835
|
-
return { kind: "primitive", type: "
|
|
2819
|
+
static none() {
|
|
2820
|
+
return { kind: "primitive", type: "None" };
|
|
2836
2821
|
}
|
|
2837
2822
|
static identityid() {
|
|
2838
2823
|
return { kind: "primitive", type: "IdentityId" };
|
|
@@ -2912,8 +2897,8 @@ var SchemaBuilder = class {
|
|
|
2912
2897
|
static uuid7Value() {
|
|
2913
2898
|
return { kind: "value", type: "Uuid7" };
|
|
2914
2899
|
}
|
|
2915
|
-
static
|
|
2916
|
-
return { kind: "value", type: "
|
|
2900
|
+
static noneValue() {
|
|
2901
|
+
return { kind: "value", type: "None" };
|
|
2917
2902
|
}
|
|
2918
2903
|
static blobValue() {
|
|
2919
2904
|
return { kind: "value", type: "Blob" };
|
|
@@ -2969,8 +2954,12 @@ function createValueInstance(type, value) {
|
|
|
2969
2954
|
return new Uuid4Value(value);
|
|
2970
2955
|
case "Uuid7":
|
|
2971
2956
|
return new Uuid7Value(value);
|
|
2972
|
-
case "
|
|
2973
|
-
return new
|
|
2957
|
+
case "Decimal":
|
|
2958
|
+
return new DecimalValue(value);
|
|
2959
|
+
case "IdentityId":
|
|
2960
|
+
return new IdentityIdValue(value);
|
|
2961
|
+
case "None":
|
|
2962
|
+
return new NoneValue();
|
|
2974
2963
|
default:
|
|
2975
2964
|
throw new Error(`Unknown type: ${type}`);
|
|
2976
2965
|
}
|
|
@@ -3004,6 +2993,12 @@ function parseValue(schema, value) {
|
|
|
3004
2993
|
}
|
|
3005
2994
|
return parseValue(schema.schema, value);
|
|
3006
2995
|
}
|
|
2996
|
+
if (schema.kind === "value") {
|
|
2997
|
+
if (value === null || value === void 0) {
|
|
2998
|
+
return void 0;
|
|
2999
|
+
}
|
|
3000
|
+
return createValueInstance(schema.type, value);
|
|
3001
|
+
}
|
|
3007
3002
|
throw new Error(`Unknown schema kind: ${schema.kind}`);
|
|
3008
3003
|
}
|
|
3009
3004
|
|
|
@@ -3012,7 +3007,7 @@ function validateSchema(schema, value) {
|
|
|
3012
3007
|
if (schema.kind === "primitive") {
|
|
3013
3008
|
const schemaType = schema.type;
|
|
3014
3009
|
if (value === null || value === void 0) {
|
|
3015
|
-
return schemaType === "
|
|
3010
|
+
return schemaType === "None";
|
|
3016
3011
|
}
|
|
3017
3012
|
switch (schemaType) {
|
|
3018
3013
|
case "Boolean":
|
|
@@ -3043,7 +3038,7 @@ function validateSchema(schema, value) {
|
|
|
3043
3038
|
return value instanceof Date || typeof value === "string";
|
|
3044
3039
|
case "Blob":
|
|
3045
3040
|
return value instanceof Uint8Array || value instanceof ArrayBuffer;
|
|
3046
|
-
case "
|
|
3041
|
+
case "None":
|
|
3047
3042
|
return value === void 0;
|
|
3048
3043
|
default:
|
|
3049
3044
|
return false;
|
|
@@ -3072,6 +3067,15 @@ function validateSchema(schema, value) {
|
|
|
3072
3067
|
}
|
|
3073
3068
|
return validateSchema(schema.schema, value);
|
|
3074
3069
|
}
|
|
3070
|
+
if (schema.kind === "value") {
|
|
3071
|
+
if (value === null || value === void 0) {
|
|
3072
|
+
return schema.type === "None";
|
|
3073
|
+
}
|
|
3074
|
+
if (typeof value === "object" && value !== null && "type" in value && "encode" in value) {
|
|
3075
|
+
return value.type === schema.type;
|
|
3076
|
+
}
|
|
3077
|
+
return false;
|
|
3078
|
+
}
|
|
3075
3079
|
return false;
|
|
3076
3080
|
}
|
|
3077
3081
|
|
|
@@ -3121,24 +3125,26 @@ export {
|
|
|
3121
3125
|
Int2Value,
|
|
3122
3126
|
Int4Value,
|
|
3123
3127
|
Int8Value,
|
|
3128
|
+
NONE_VALUE,
|
|
3129
|
+
NoneValue,
|
|
3124
3130
|
ReifyError,
|
|
3125
3131
|
Schema,
|
|
3126
3132
|
SchemaBuilder,
|
|
3127
3133
|
TimeValue,
|
|
3128
|
-
UNDEFINED_VALUE,
|
|
3129
3134
|
Uint16Value,
|
|
3130
3135
|
Uint1Value,
|
|
3131
3136
|
Uint2Value,
|
|
3132
3137
|
Uint4Value,
|
|
3133
3138
|
Uint8Value,
|
|
3134
|
-
UndefinedValue,
|
|
3135
3139
|
Utf8Value,
|
|
3136
3140
|
Uuid4Value,
|
|
3137
3141
|
Uuid7Value,
|
|
3138
3142
|
Value,
|
|
3139
3143
|
asFrameResults,
|
|
3140
3144
|
decode,
|
|
3145
|
+
isOptionType,
|
|
3141
3146
|
parseValue,
|
|
3147
|
+
unwrapOptionType,
|
|
3142
3148
|
validateSchema
|
|
3143
3149
|
};
|
|
3144
3150
|
//# sourceMappingURL=index.js.map
|